From 98652a349a67be718e8e8b5fcf590972eb62a104 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 21 Sep 2022 18:39:53 +0000 Subject: [PATCH] Bump version to 4.9.0-beta and LKG. --- lib/cs/diagnosticMessages.generated.json | 25 +- lib/de/diagnosticMessages.generated.json | 28 +- lib/es/diagnosticMessages.generated.json | 28 +- lib/fr/diagnosticMessages.generated.json | 25 +- lib/it/diagnosticMessages.generated.json | 25 +- lib/ja/diagnosticMessages.generated.json | 28 +- lib/ko/diagnosticMessages.generated.json | 28 +- lib/lib.dom.d.ts | 257 +- lib/lib.es2015.promise.d.ts | 13 +- lib/lib.es2015.proxy.d.ts | 2 +- lib/lib.es2015.reflect.d.ts | 27 +- lib/lib.es2019.d.ts | 1 + lib/lib.es2019.intl.d.ts | 25 + lib/lib.es2020.intl.d.ts | 2 +- lib/lib.es5.d.ts | 34 +- lib/lib.webworker.d.ts | 97 +- lib/pl/diagnosticMessages.generated.json | 25 +- lib/protocol.d.ts | 2 + lib/pt-br/diagnosticMessages.generated.json | 28 +- lib/ru/diagnosticMessages.generated.json | 28 +- lib/tr/diagnosticMessages.generated.json | 28 +- lib/tsc.js | 14578 ++++++----- lib/tsserver.js | 20028 ++++++++------- lib/tsserverlibrary.d.ts | 539 +- lib/tsserverlibrary.js | 20209 ++++++++-------- lib/typescript.d.ts | 539 +- lib/typescript.js | 20196 +++++++-------- lib/typescriptServices.d.ts | 539 +- lib/typescriptServices.js | 20196 +++++++-------- lib/typingsInstaller.js | 15325 ++++++------ lib/zh-cn/diagnosticMessages.generated.json | 117 +- lib/zh-tw/diagnosticMessages.generated.json | 28 +- package.json | 4 +- src/compiler/corePublic.ts | 2 +- ...DynamicImportWithPackageExports.errors.txt | 80 + ...tionEmitDynamicImportWithPackageExports.js | 16 - ...DeclarationEmit1(module=node16).errors.txt | 20 +- ...portModeDeclarationEmit1(module=node16).js | 13 - ...clarationEmit1(module=nodenext).errors.txt | 20 +- ...rtModeDeclarationEmit1(module=nodenext).js | 13 - ...DeclarationEmit2(module=node16).errors.txt | 20 +- ...portModeDeclarationEmit2(module=node16).js | 13 - ...clarationEmit2(module=nodenext).errors.txt | 20 +- ...rtModeDeclarationEmit2(module=nodenext).js | 13 - ...ationEmitErrors1(module=node16).errors.txt | 5 +- ...deDeclarationEmitErrors1(module=node16).js | 7 - ...ionEmitErrors1(module=nodenext).errors.txt | 5 +- ...DeclarationEmitErrors1(module=nodenext).js | 7 - ...DeclarationEmit1(module=node16).errors.txt | 38 + ...TypeModeDeclarationEmit1(module=node16).js | 6 - ...clarationEmit1(module=nodenext).errors.txt | 38 + ...peModeDeclarationEmit1(module=nodenext).js | 6 - ...ationEmitErrors1(module=node16).errors.txt | 11 +- ...deDeclarationEmitErrors1(module=node16).js | 4 - ...ionEmitErrors1(module=nodenext).errors.txt | 11 +- ...DeclarationEmitErrors1(module=nodenext).js | 4 - 56 files changed, 60576 insertions(+), 52850 deletions(-) create mode 100644 lib/lib.es2019.intl.d.ts create mode 100644 tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node16).errors.txt create mode 100644 tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).errors.txt diff --git a/lib/cs/diagnosticMessages.generated.json b/lib/cs/diagnosticMessages.generated.json index fe4fc282221..e75af197f65 100644 --- a/lib/cs/diagnosticMessages.generated.json +++ b/lib/cs/diagnosticMessages.generated.json @@ -186,6 +186,7 @@ "An_abstract_accessor_cannot_have_an_implementation_1318": "Abstraktní přístupový objekt nemůže mít implementaci.", "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "Modifikátor přístupnosti se nedá použít spolu s privátním identifikátorem.", "An_accessor_cannot_have_type_parameters_1094": "Přístupový objekt nemůže obsahovat parametry typu.", + "An_accessor_property_cannot_be_declared_optional_1276": "Vlastnost accessor nejde deklarovat jako volitelnou.", "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "Deklarace ambientního modulu je povolená jenom na nejvyšší úrovni v souboru.", "An_argument_for_0_was_not_provided_6210": "Neposkytl se argument pro {0}.", "An_argument_matching_this_binding_pattern_was_not_provided_6211": "Neposkytl se argument, který by odpovídal tomuto vzoru vazby.", @@ -382,7 +383,7 @@ "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720": "Třída {0} nesprávně implementuje třídu {1}. Nechtěli jste rozšířit třídu {1} a dědit její členy jako podtřídu?", "Class_0_incorrectly_implements_interface_1_2420": "Třída {0} nesprávně implementuje rozhraní {1}.", "Class_0_used_before_its_declaration_2449": "Třída {0} se používá dříve, než se deklaruje.", - "Class_constructor_may_not_be_a_generator_1360": "Konstruktor třídy nemůže být generátor.", + "Class_constructor_may_not_be_a_generator_1368": "Konstruktor třídy nemůže být generátor.", "Class_constructor_may_not_be_an_accessor_1341": "Konstruktor třídy nemůže být přístupový objekt.", "Class_declaration_cannot_implement_overload_list_for_0_2813": "Deklarace třídy nemůže implementovat seznam přetížení pro {0}.", "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025": "Deklarace tříd nemůžou mít více než jednu značku ‚@augments‘ nebo ‚@extends‘.", @@ -430,6 +431,7 @@ "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "Převod typu {0} na typ {1} může být chyba, protože ani jeden z těchto typů se s tím druhým dostatečně nepřekrývá. Pokud je to záměr, převeďte nejdříve výraz na unknown.", "Convert_0_to_1_in_0_95003": "Převést {0} na {1} v {0}", "Convert_0_to_mapped_object_type_95055": "Převést {0} na typ mapovaného objektu", + "Convert_all_const_to_let_95102": "Převést všechny const na let", "Convert_all_constructor_functions_to_classes_95045": "Převést všechny funkce konstruktoru na třídy", "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "Převést všechny importy, které se nepoužívají jako hodnota, na importy, při kterých se importují jen typy.", "Convert_all_invalid_characters_to_HTML_entity_code_95101": "Převést všechny neplatné znaky na kód entity HTML", @@ -919,7 +921,7 @@ "Method_not_implemented_95158": "Metoda není implementovaná.", "Modifiers_cannot_appear_here_1184": "Tady nejde použít modifikátory.", "Module_0_can_only_be_default_imported_using_the_1_flag_1259": "Modul {0} se dá importovat podle výchozího nastavení jen pomocí příznaku {1}.", - "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "Modul {0} nejde importovat pomocí této konstrukce. Specifikátor se převede jenom na modul ES, který se nedá importovat synchronně. Místo toho použijte dynamický import.", + "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "Modul {0} nejde importovat pomocí této konstrukce. Specifikátor se převede jenom na modul ES, který se nedá importovat s příkazem require. Místo toho použijte import ECMAScript.", "Module_0_declares_1_locally_but_it_is_exported_as_2_2460": "Modul {0} deklaruje {1} místně, ale exportuje se jako {2}.", "Module_0_declares_1_locally_but_it_is_not_exported_2459": "Modul {0} deklaruje {1} místně, ale neexportuje se.", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340": "Modul {0} neodkazuje na typ, ale používá se tady jako typ. Měli jste na mysli typeof import('{0}')?", @@ -1103,6 +1105,7 @@ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Projekt {0} je zastaralý, protože výstupní soubor {1} neexistuje.", "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "Projekt {0} je zastaralý, protože jeho výstup se vygeneroval pomocí verze {1}, která se liší od aktuální verze {2}.", "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "Projekt {0} je zastaralý, protože se změnil výstup jeho závislosti {1}.", + "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401": "Projekt {0} je zastaralý, protože při čtení souboru {1} došlo k chybě.", "Project_0_is_up_to_date_6361": "Projekt {0} je aktuální.", "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "Projekt {0} je aktuální, protože nejnovější vstup {1} je starší než výstup {2}.", "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "Projekt {0} je aktuální, ale musí aktualizovat časová razítka výstupních souborů, které jsou starší než vstupní soubory.", @@ -1110,6 +1113,7 @@ "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "Odkazy projektu nemůžou tvořit cyklický graf. Zjistil se cyklus: {0}", "Projects_6255": "Projekty", "Projects_in_this_build_Colon_0_6355": "Projekty v tomto sestavení: {0}", + "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "Vlastnosti s modifikátorem accessor jsou k dispozici jen při cílení na ECMAScript 2015 a vyšší.", "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "Vlastnost {0} nemůže mít inicializátor, protože je označená jako abstraktní.", "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "Vlastnost {0} pochází ze signatury indexu, proto je zapotřebí k ní přistupovat pomocí ['{0}'].", "Property_0_does_not_exist_on_type_1_2339": "Vlastnost {0} v typu {1} neexistuje.", @@ -1385,6 +1389,7 @@ "The_containing_arrow_function_captures_the_global_value_of_this_7041": "Obsahující funkce šipky zachytává globální hodnotu pro this.", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "Text obsahující funkce nebo modulu je pro analýzu toku řízení příliš dlouhý.", "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "Aktuální soubor je modul CommonJS a na nejvyšší úrovni nemůže používat await.", + "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479": "Aktuální soubor je modul CommonJS, jehož importy vytvoří volání require. Odkazovaný soubor je však modul ECMAScript a nelze ho importovat pomocí příkazu require. Raději zvažte vytvoření dynamického volání import(\"{0}\").", "The_current_host_does_not_support_the_0_option_5001": "Aktuální hostitel nepodporuje možnost {0}.", "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "Deklarace {0}, kterou jste pravděpodobně chtěli použít, je definovaná tady.", "The_declaration_was_marked_as_deprecated_here_2798": "Deklarace se tady označila jako zastaralá.", @@ -1464,13 +1469,14 @@ "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490": "Typ vrácený metodou {0}() iterátoru musí obsahovat vlastnost value.", "The_types_of_0_are_incompatible_between_these_types_2200": "Typy {0} nejsou mezi těmito typy kompatibilní.", "The_types_returned_by_0_are_incompatible_between_these_types_2201": "Typy vrácené metodou {0} nejsou mezi těmito typy kompatibilní.", + "The_value_0_cannot_be_used_here_18050": "Hodnota „{0}“ se tady nedá použít.", "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "Deklarace proměnné příkazu for...in nemůže obsahovat inicializátor.", "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "Deklarace proměnné příkazu for...of nemůže obsahovat inicializátor.", "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "Příkaz with není podporovaný. Všechny symboly s blokem with budou typu any.", "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_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_0_since_the_types_1_and_2_have_no_overlap_2367": "Tato podmínka vždy vrátí {0}, protože typy {1} a {2} se nijak nepřekrývají.", "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?", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Tato funkce konstruktoru se může převést na deklaraci třídy.", @@ -1491,7 +1497,7 @@ "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114": "Tento člen musí mít modifikátor override, protože přepisuje člen v základní třídě {0}.", "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "Tento člen musí mít modifikátor override, protože přepisuje abstraktní metodu, která je deklarovaná v základní třídě {0}.", "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "Na tento modul je možné se pomocí importů nebo exportů ECMAScript odkazovat jen tak, že se zapne příznak {0} a odkáže se na výchozí export.", - "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594": "Tento modul se deklaroval pomocí export =, a když se používá příznak {0}, dá se použít jen s výchozím importem.", + "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "Tento modul se deklaroval pomocí export =, a dá se použít jenom s výchozím importem při použití příznaku {0}.", "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "Tato signatura přetížení není kompatibilní se signaturou implementace.", "This_parameter_is_not_allowed_with_use_strict_directive_1346": "Tento parametr se nepodporuje s direktivou use strict.", "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120": "Tato vlastnost parametru musí mít komentář JSDoc se značkou @override, protože přepisuje člen v základní třídě {0}.", @@ -1504,6 +1510,10 @@ "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "Tato syntaxe vyžaduje importovanou pomocnou rutinu s názvem {1} a parametry {2}, která není kompatibilní s tou v {0}. Zvažte upgrade verze {0}.", "This_type_parameter_might_need_an_extends_0_constraint_2208": "Tento parametr typu může potřebovat omezení extends {0}.", "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "Toto použití importu není platné. Volání import() se dají zapsat, ale musí mít závorky a nemůžou mít typové argumenty.", + "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482": "Pokud chcete tento soubor převést na modul ECMAScript, přidejte pole \"type\": \"module\" do {0}.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481": "Pokud chcete tento soubor převést na modul ECMAScript, změňte jeho příponu na {0}\" nebo přidejte pole \"type\": \"module\" do {1}.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480": "Pokud chcete tento soubor převést na modul ECMAScript, změňte jeho příponu na {0} nebo vytvořte místní soubor package.json s {\"type\": \"module\"}.", + "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483": "Pokud chcete tento soubor převést na modul ECMAScript, vytvořte místní soubor package.json s { \"type\": \"module\" }.", "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "Výrazy await nejvyšší úrovně se povolují jen v případě, že možnost module je nastavená na es2022, esnext, system, node16 nebo nodenext a možnost target je nastavená na es2017 nebo vyšší.", "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": "Deklarace nejvyšší úrovně v souborech .d.ts musí začínat modifikátorem declare, nebo export.", "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "Smyčky for await nejvyšší úrovně se povolují jen v případě, že možnost module je nastavená na es2022, esnext, system, node16 nebo nodenext a možnost target je nastavená na es2017 nebo vyšší.", @@ -1519,6 +1529,7 @@ "Type_0_cannot_be_used_as_an_index_type_2538": "Typ {0} se nedá použít jako typ indexu.", "Type_0_cannot_be_used_to_index_type_1_2536": "Typ {0} nejde použít k indexování typu {1}.", "Type_0_does_not_satisfy_the_constraint_1_2344": "Typ {0} nevyhovuje omezení {1}.", + "Type_0_does_not_satisfy_the_expected_type_1_1360": "Typ {0} nevyhovuje očekávanému typu {1}.", "Type_0_has_no_call_signatures_2757": "Typ {0} nemá žádné signatury volání.", "Type_0_has_no_construct_signatures_2761": "Typ {0} nemá žádné signatury konstruktu.", "Type_0_has_no_matching_index_signature_for_type_1_2537": "Typ {0} nemá odpovídající signaturu indexu pro typ {1}.", @@ -1596,6 +1607,7 @@ "Type_reference_directive_0_was_not_resolved_6120": "======== Direktiva odkazu na typ {0} se nepřeložila. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== Direktiva odkazu na typ {0} se úspěšně přeložila na {1}, primární: {2}. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219": "======== Direktiva odkazu na typ {0} se úspěšně přeložila na {1} s ID balíčku {2}, primární: {3}. ========", + "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037": "Kontrolní výrazy typů se dají používat jen v typescriptových souborech.", "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043": "Typy se v deklaracích exportu v souborech JavaScriptu nemůžou vyskytovat.", "Types_have_separate_declarations_of_a_private_property_0_2442": "Typy mají samostatné deklarace privátní vlastnosti {0}.", "Types_of_construct_signatures_are_incompatible_2419": "Typy signatur konstruktorů nejsou kompatibilní.", @@ -1717,6 +1729,10 @@ "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "{0} není platnou metavlastností pro klíčové slovo {1}. Měli jste na mysli {2}?", "_0_is_not_allowed_as_a_parameter_name_1390": "{0} není povolen jako název parametru.", "_0_is_not_allowed_as_a_variable_declaration_name_1389": "{0} se nepovoluje jako název deklarace proměnné.", + "_0_is_of_type_unknown_18046": "„{0}“ je typ unknown", + "_0_is_possibly_null_18047": "„{0}“ je pravděpodobně typ null.", + "_0_is_possibly_null_or_undefined_18049": "„{0}“ je typ null nebo undefined", + "_0_is_possibly_undefined_18048": "„{0}“ je pravděpodobně typ undefined.", "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "Na {0} se přímo nebo nepřímo odkazuje ve vlastním základním výrazu.", "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "Na {0} se odkazuje přímo nebo nepřímo v jeho vlastní anotaci typu.", "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783": "{0} se zadalo více než jednou, proto se toto použití přepíše.", @@ -1752,6 +1768,7 @@ "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "{0} s chybějící anotací návratového typu má implicitně návratový typ {1}.", "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "{0} s chybějící anotací návratového typu má implicitně typ yield {1}.", "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "Modifikátor abstract se může objevit jenom v deklaraci třídy, metody nebo vlastnosti.", + "accessor_modifier_can_only_appear_on_a_property_declaration_1275": "Modifikátor accessor se může objevit jenom v deklaraci vlastnosti.", "and_here_6204": "a tady.", "arguments_cannot_be_referenced_in_property_initializers_2815": "Na argumenty nejde odkazovat v inicializátorech vlastností.", "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "auto: Považovat soubory s importy, exporty, import.meta, jsx (s jsx: react-jsx) nebo formátem esm (s modulem node16+) za moduly.", diff --git a/lib/de/diagnosticMessages.generated.json b/lib/de/diagnosticMessages.generated.json index 5e4c0191427..7a87b1eebfe 100644 --- a/lib/de/diagnosticMessages.generated.json +++ b/lib/de/diagnosticMessages.generated.json @@ -186,6 +186,7 @@ "An_abstract_accessor_cannot_have_an_implementation_1318": "Ein abstrakter Accessor kann keine Implementierung aufweisen.", "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "Ein Zugriffsmodifizierer kann nicht mit einem privaten Bezeichner verwendet werden.", "An_accessor_cannot_have_type_parameters_1094": "Eine Zugriffsmethode darf keine Typparameter aufweisen.", + "An_accessor_property_cannot_be_declared_optional_1276": "Eine Accessoreigenschaft kann nicht als optional deklariert werden.", "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "Eine Umgebungsmoduldeklaration ist nur auf der obersten Ebene in einer Datei zulässig.", "An_argument_for_0_was_not_provided_6210": "Für \"{0}\" wurde ein Argument nicht angegeben.", "An_argument_matching_this_binding_pattern_was_not_provided_6211": "Es wurde kein Argument angegeben, das diesem Bindungsmuster entspricht.", @@ -382,7 +383,7 @@ "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720": "Die Klasse \"{0}\" implementiert fälschlicherweise die Klasse \"{1}\". Wollten Sie \"{1}\" erweitern und ihre Member als Unterklasse vererben?", "Class_0_incorrectly_implements_interface_1_2420": "Die Klasse \"{0}\" implementiert fälschlicherweise die Schnittstelle \"{1}\".", "Class_0_used_before_its_declaration_2449": "Klasse \"{0}\", die vor der Deklaration verwendet wurde.", - "Class_constructor_may_not_be_a_generator_1360": "Der Klassenkonstruktor darf kein Generator sein.", + "Class_constructor_may_not_be_a_generator_1368": "Der Klassenkonstruktor darf kein Generator sein.", "Class_constructor_may_not_be_an_accessor_1341": "Der Klassenkonstruktor darf kein Accessor sein.", "Class_declaration_cannot_implement_overload_list_for_0_2813": "Die Klassendeklaration kann die Überladungsliste für \"{0}\" nicht implementieren.", "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025": "Klassendeklarationen dürfen maximal ein \"@augments\"- oder \"@extends\"-Tag aufweisen.", @@ -430,6 +431,7 @@ "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "Die Konvertierung des Typs \"{0}\" in den Typ \"{1}\" kann ein Fehler sein, weil die Typen keine ausreichende Überschneidung aufweisen. Wenn dies beabsichtigt war, konvertieren Sie den Ausdruck zuerst in \"unknown\".", "Convert_0_to_1_in_0_95003": "\"{0}\" in \"{1} in {0}\" konvertieren", "Convert_0_to_mapped_object_type_95055": "\"{0}\" in zugeordneten Objekttyp konvertieren", + "Convert_all_const_to_let_95102": "Alle \"const\" in \"let\" konvertieren", "Convert_all_constructor_functions_to_classes_95045": "Alle Konstruktorfunktionen in Klassen konvertieren", "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "Alle nicht als Wert verwendeten Importe in reine Typenimporte konvertieren", "Convert_all_invalid_characters_to_HTML_entity_code_95101": "Alle ungültigen Zeichen in HTML-Entitätscode konvertieren", @@ -919,7 +921,7 @@ "Method_not_implemented_95158": "Die Methode ist nicht implementiert.", "Modifiers_cannot_appear_here_1184": "Modifizierer dürfen hier nicht enthalten sein.", "Module_0_can_only_be_default_imported_using_the_1_flag_1259": "Das Modul \"{0}\" kann nur mit dem Flag \"{1}\" als Standard importiert werden.", - "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "Das Modul \"{0}\" kann nicht mithilfe dieses Konstrukts importiert werden. Der Spezifizierer wird nur in ein ES-Modul aufgelöst, das nicht synchron importiert werden kann. Verwenden Sie stattdessen den dynamischen Import.", + "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "Das Modul \"{0}\" kann nicht mit diesem Konstrukt importiert werden. Der Spezifizierer wird nur in ein ES-Modul aufgelöst, das nicht mit \"require\" importiert werden kann. Verwenden Sie stattdessen einen ECMAScript-Import.", "Module_0_declares_1_locally_but_it_is_exported_as_2_2460": "Das Modul \"{0}\" deklariert \"{1}\" lokal, der Export erfolgt jedoch als \"{2}\".", "Module_0_declares_1_locally_but_it_is_not_exported_2459": "Das Modul \"{0}\" deklariert \"{1}\" lokal, es erfolgt jedoch kein Export.", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340": "Das Modul \"{0}\" verweist nicht auf einen Typ, wird hier aber als Typ verwendet. Meinten Sie \"typeof import('{0}')\"?", @@ -1103,6 +1105,7 @@ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Projekt \"{0}\" ist veraltet, weil die Ausgabedatei \"{1}\" nicht vorhanden ist.", "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "Das Projekt \"{0}\" ist veraltet, weil die Ausgabe für das Projekt mit Version {1} generiert wurde, die sich von der aktuellen Version {2} unterscheidet.", "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "Das Projekt \"{0}\" ist veraltet, weil sich die zugehörige Abhängigkeit \"{1}\" geändert hat.", + "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401": "Das Projekt \"{0}\" ist veraltet, weil beim Lesen der Datei \"{1}\" ein Fehler aufgetreten ist.", "Project_0_is_up_to_date_6361": "Projekt \"{0}\" ist auf dem neuesten Stand.", "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "Projekt \"{0}\" ist auf dem neuesten Stand, weil die neueste Eingabe \"{1}\" älter ist als die Ausgabe \"{2}\".", "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "Das Projekt \"{0}\" ist aktuell, muss jedoch Zeitstempel von Ausgabedateien aktualisieren, die älter als Eingabedateien sind.", @@ -1110,6 +1113,7 @@ "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "Projektverweise dürfen keinen kreisförmigen Graphen bilden. Zyklus erkannt: {0}", "Projects_6255": "Projekte", "Projects_in_this_build_Colon_0_6355": "Projekte in diesem Build: {0}", + "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "Eigenschaften mit dem Accessormodifizierer sind nur für ECMAScript 2015 und höher verfügbar.", "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "Die Eigenschaft \"{0}\" darf keinen Initialisierer aufweisen, weil sie als abstrakt markiert ist.", "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "Die Eigenschaft \"{0}\" stammt aus einer Indexsignatur. Der Zugriff muss daher mit [\"{0}\"] erfolgen.", "Property_0_does_not_exist_on_type_1_2339": "Die Eigenschaft \"{0}\" ist für den Typ \"{1}\" nicht vorhanden.", @@ -1385,6 +1389,7 @@ "The_containing_arrow_function_captures_the_global_value_of_this_7041": "Die enthaltende Pfeilfunktion erfasst den globalen Wert von \"this\".", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "Der beinhaltende Funktions- oder Modulkörper ist zu groß für eine Ablaufsteuerungsanalyse.", "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "Die aktuelle Datei ist ein CommonJS-Modul und kann „await“ nicht auf der obersten Ebene verwenden.", + "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479": "Die aktuelle Datei ist ein CommonJS-Modul, dessen Importe \"require\"-Aufrufe generieren. Die Datei, auf die verwiesen wird, ist jedoch ein ECMAScript-Modul und kann nicht mit \"require\" importiert werden. Erwägen Sie stattdessen, einen dynamischen 'import(\"{0}\")'-Aufruf zu schreiben.", "The_current_host_does_not_support_the_0_option_5001": "Der aktuelle Host unterstützt die Option \"{0}\" nicht.", "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "Die Deklaration von \"{0}\", die Sie wahrscheinlich verwenden wollten, ist hier definiert.", "The_declaration_was_marked_as_deprecated_here_2798": "Die Deklaration wurde hier als veraltet markiert.", @@ -1422,7 +1427,6 @@ "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362": "Die linke Seite einer arithmetischen Operation muss den Typ \"any\", \"number\" oder \"bigint\" aufweisen oder ein Enumerationstyp sein.", "The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779": "Die linke Seite eines Zuweisungsausdrucks darf kein optionaler Eigenschaftenzugriff sein.", "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364": "Die linke Seite eines Zuweisungsausdrucks muss eine Variable oder ein Eigenschaftenzugriff sein.", - "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360": "Die linke Seite eines in-Ausdrucks muss ein privater Bezeichner sein oder zum Typ \"any\", \"string\", \"number\" oder \"symbol\" gehören.", "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358": "Die linke Seite eines instanceof-Ausdrucks muss den Typ \"any\" aufweisen oder ein Objekttyp bzw. ein Typparameter sein.", "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156": "Das beim Anzeigen von Meldungen für den Benutzer verwendete Gebietsschema (z. B. \"de-de\").", "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136": "Die maximale Abhängigkeitstiefe, die unter \"node_modules\" durchsucht und für die JavaScript-Dateien geladen werden sollen.", @@ -1443,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": "Der Rückgabetyp einer asynchronen Funktion oder Methode muss der globale Typ \"Promise\" sein. Wollten Sie eigentlich \"Promise<{0}>\" verwenden?", "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407": "Die rechte Seite einer for...in-Anweisung muss den Typ \"any\" aufweisen oder ein Objekttyp bzw. ein Typparameter sein. Sie weist hier jedoch den Typ \"{0}\" auf.", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363": "Die rechte Seite einer arithmetischen Operation muss den Typ \"any\", \"number\" oder \"bigint\" aufweisen oder ein Enumerationstyp sein.", - "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361": "Die rechte Seite eines in-Ausdrucks darf kein primitiver Typ sein.", "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359": "Die rechte Seite eines instanceof-Ausdrucks muss den Typ \"any\" oder einen Typ aufweisen, der dem Schnittstellentyp \"Function\" zugewiesen werden kann.", "The_root_value_of_a_0_file_must_be_an_object_5092": "Der Stammwert einer {0}-Datei muss ein Objekt sein.", "The_shadowing_declaration_of_0_is_defined_here_18017": "Die verbergende Deklaration von \"{0}\" ist hier definiert.", @@ -1464,13 +1467,14 @@ "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490": "Der von der {0}()-Methode eines Iterators zurückgegebene Typ muss eine value-Eigenschaft aufweisen.", "The_types_of_0_are_incompatible_between_these_types_2200": "Die Typen von \"{0}\" sind zwischen diesen Typen nicht kompatibel.", "The_types_returned_by_0_are_incompatible_between_these_types_2201": "Die von \"{0}\" zurückgegebenen Typen sind zwischen diesen Typen nicht kompatibel.", + "The_value_0_cannot_be_used_here_18050": "Der Wert \"{0}\" kann hier nicht verwendet werden.", "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "Die Variablendeklaration einer for...in-Anweisung darf keinen Initialisierer aufweisen.", "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "Die Variablendeklaration einer for...of-Anweisung darf keinen Initialisierer aufweisen.", "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "Die with-Anweisung wird nicht unterstützt. Alle Symbole in einem with-Block weisen den Typ \"any\" auf.", "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_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_0_since_the_types_1_and_2_have_no_overlap_2367": "Diese Bedingung gibt immer \"{0}\" zurück, weil die Typen \"{1}\" und \"{2}\" keine Überschneidung aufweisen.", "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?", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Diese Konstruktorfunktion kann in eine Klassendeklaration konvertiert werden.", @@ -1491,7 +1495,7 @@ "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114": "Dieser Member muss einen override-Modifizierer aufweisen, weil er einen Member in der Basisklasse \"{0}\" überschreibt.", "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "Dieser Member muss einen override-Modifizierer aufweisen, weil er eine abstrakte Methode überschreibt, die in der Basisklasse \"{0}\" deklariert ist.", "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "Auf dieses Modul kann nur mit ECMAScript-Importen/-Exporten verwiesen werden, indem das Flag \"{0}\" aktiviert und auf den Standardexport verwiesen wird.", - "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594": "Dieses Modul wird mit \"export =\" deklariert und kann nur bei Verwendung des Flags \"{0}\" mit einem Standardimport verwendet werden.", + "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "Dieses Modul wird mit „export =“ deklariert und kann nur bei Verwendung des Kennzeichnens „{0}“ mit einem Standardimport verwendet werden.", "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "Diese Überladungssignatur ist nicht mit der zugehörigen Implementierungssignatur kompatibel.", "This_parameter_is_not_allowed_with_use_strict_directive_1346": "Dieser Parameter ist mit der Direktive \"use strict\" nicht zugelassen.", "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120": "Diese Parametereigenschaft muss über einen JSDoc-Kommentar mit einem \"@override\"-Tag verfügen, da sie ein Mitglied in der Basisklasse \"{0}\" überschreibt.", @@ -1504,6 +1508,10 @@ "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "Diese Syntax erfordert ein importiertes Hilfsprogramm mit dem Namen \"{1}\" mit {2} Parametern, die nicht mit der in \"{0}\" kompatibel ist. Erwägen Sie ein Upgrade Ihrer Version von \"{0}\".", "This_type_parameter_might_need_an_extends_0_constraint_2208": "Für diesen Typparameter ist möglicherweise die Einschränkung \"extends {0}\" erforderlich.", "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "Diese Verwendung von „import“ ist ungültig. „import()“-Aufrufe können geschrieben werden, müssen jedoch Klammern aufweisen und dürfen keine Typargumente aufweisen.", + "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482": "Um diese Datei in ein ECMAScript-Modul zu konvertieren, fügen Sie das Feld \"type\": \"module\" zu \"{0}\" hinzu.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481": "Um diese Datei in ein ECMAScript-Modul zu konvertieren, ändern Sie die Dateierweiterung in \"{0}\", oder fügen Sie das Feld ''type': 'module'' zu \"{1}\" hinzu.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480": "Um diese Datei in ein ECMAScript-Modul zu konvertieren, ändern Sie ihre Dateierweiterung in '{0}', oder erstellen Sie eine lokale package.json-Datei mit `{ \"type\": \"module\" }`.", + "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483": "Um diese Datei in ein ECMAScript-Modul zu konvertieren, erstellen Sie eine lokale package.json-Datei mit `{ \"type\": \"module\" }`.", "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "'await'-Ausdrücke der obersten Ebene sind nur zulässig, wenn die 'module'-Option auf 'es2022', 'esnext', 'system', 'node16' oder 'nodenext' und die 'target'-Option auf ' es2017' oder höher.", "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": "Deklarationen der obersten Ebene in .d.ts-Dateien müssen entweder mit einem declare- oder einem export-Modifizierer beginnen.", "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "'for await'-Schleifen der obersten Ebene sind nur erlaubt, wenn die 'module'-Option auf 'es2022', 'esnext', 'system', 'node16' oder 'nodenext' gesetzt ist und die 'target'-Option auf gesetzt ist 'es2017' oder höher.", @@ -1519,6 +1527,7 @@ "Type_0_cannot_be_used_as_an_index_type_2538": "Der Typ \"{0}\" kann nicht als Indextyp verwendet werden.", "Type_0_cannot_be_used_to_index_type_1_2536": "Der Typ \"{0}\" kann nicht zum Indizieren von Typ \"{1}\" verwendet werden.", "Type_0_does_not_satisfy_the_constraint_1_2344": "Der Typ \"{0}\" erfüllt die Einschränkung \"{1}\" nicht.", + "Type_0_does_not_satisfy_the_expected_type_1_1360": "Der Typ \"{0}\" erfüllt den erwarteten Typ \"{1}\" nicht.", "Type_0_has_no_call_signatures_2757": "Der Typ \"{0}\" weist keine Aufrufsignaturen auf.", "Type_0_has_no_construct_signatures_2761": "Der Typ \"{0}\" weist keine Konstruktsignaturen auf.", "Type_0_has_no_matching_index_signature_for_type_1_2537": "Der Typ \"{0}\" weist keine übereinstimmende Indexsignatur für den Typ \"{1}\" auf.", @@ -1540,6 +1549,7 @@ "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412": "Der Typ „{0}“ kann dem Typ „{1}“ mit „exactOptionalPropertyTypes: true“ nicht zugewiesen werden. Erwägen Sie das Hinzufügen von „undefined“ zum Typ des Ziels.", "Type_0_is_not_comparable_to_type_1_2678": "Der Typ \"{0}\" kann nicht mit dem Typ \"{1}\" verglichen werden.", "Type_0_is_not_generic_2315": "Der Typ \"{0}\" ist nicht generisch.", + "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638": "Typ „{0}“ kann einen primitiven Wert darstellen, der als rechter Operand des „In“-Operators nicht zulässig ist.", "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "Der Typ \"{0}\" muss eine Methode \"[Symbol.asyncIterator]()\" aufweisen, die einen async-Iterator zurückgibt.", "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "Der Typ \"{0}\" muss eine Methode \"[Symbol.iterator]()\" aufweisen, die einen Iterator zurückgibt.", "Type_0_provides_no_match_for_the_signature_1_2658": "Der Typ \"{0}\" enthält keine Entsprechung für die Signatur \"{1}\".", @@ -1596,6 +1606,7 @@ "Type_reference_directive_0_was_not_resolved_6120": "======== Die Typverweisdirektive \"{0}\" wurde nicht aufgelöst. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== Die Typverweisdirektive \"{0}\" wurde erfolgreich in \"{1}\" aufgelöst. Primär: {2}. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219": "======== Die Typverweisdirektive \"{0}\" wurde erfolgreich in \"{1}\" mit Paket-ID \"{2}\" aufgelöst. Primär: {3}. ========", + "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037": "Typerfüllungsausdrücke können nur in TypeScript-Dateien verwendet werden.", "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043": "Typen können in Exportdeklarationen in JavaScript-Dateien nicht angezeigt werden.", "Types_have_separate_declarations_of_a_private_property_0_2442": "Typen weisen separate Deklarationen einer privaten Eigenschaft \"{0}\" auf.", "Types_of_construct_signatures_are_incompatible_2419": "Die Typen der Konstruktsignaturen sind nicht kompatibel.", @@ -1717,6 +1728,10 @@ "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "\"{0}\" ist keine gültige Metaeigenschaft für das Schlüsselwort \"{1}\". Meinten Sie \"{2}\"?", "_0_is_not_allowed_as_a_parameter_name_1390": "\"{0}\" ist als Parametername nicht zulässig.", "_0_is_not_allowed_as_a_variable_declaration_name_1389": "\"{0}\" ist als Name für Variablendeklarationen nicht zulässig.", + "_0_is_of_type_unknown_18046": "\"{0}\" ist vom Typ \"unbekannt\".", + "_0_is_possibly_null_18047": "\"{0}\" ist möglicherweise \"null\".", + "_0_is_possibly_null_or_undefined_18049": "\"{0}\" ist möglicherweise \"null\" oder \"nicht definiert\".", + "_0_is_possibly_undefined_18048": "\"{0}\" ist möglicherweise nicht \"nicht definiert\".", "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "Auf \"{0}\" wird direkt oder indirekt im eigenen Basisausdruck verwiesen.", "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "Auf \"{0}\" wird direkt oder indirekt in der eigenen Typanmerkung verwiesen.", "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783": "\"{0}\" wurde mehrmals angegeben, deshalb wird dieses Vorkommen überschrieben.", @@ -1752,6 +1767,7 @@ "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "\"{0}\" ohne Rückgabetypanmerkung weist implizit einen Rückgabetyp \"{1}\" auf.", "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "\"{0}\" ohne Rückgabetypanmerkung weist implizit einen yield-Typ \"{1}\" auf.", "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "Der Modifizierer \"abstract\" darf nur für eine Klassen-, Methoden- oder Eigenschaftendeklaration verwendet werden.", + "accessor_modifier_can_only_appear_on_a_property_declaration_1275": "Der Accessormodifizierer kann nur in einer Eigenschaftendeklaration angezeigt werden.", "and_here_6204": "und hier.", "arguments_cannot_be_referenced_in_property_initializers_2815": "Auf \"arguments\" kann in Eigenschaftsinitialisierern nicht verwiesen werden.", "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "„auto“: Dateien mit imports, exports, import.meta, jsx (mit jsx: respond-jsx) oder esm-Format (mit module: node16+) als Module behandeln.", diff --git a/lib/es/diagnosticMessages.generated.json b/lib/es/diagnosticMessages.generated.json index 06fd2b618cc..2d36e561a3e 100644 --- a/lib/es/diagnosticMessages.generated.json +++ b/lib/es/diagnosticMessages.generated.json @@ -186,6 +186,7 @@ "An_abstract_accessor_cannot_have_an_implementation_1318": "Un descriptor de acceso abstracto no puede tener una implementación.", "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "No se puede usar un modificador de accesibilidad con un identificador privado.", "An_accessor_cannot_have_type_parameters_1094": "Un descriptor de acceso no puede tener parámetros de tipo.", + "An_accessor_property_cannot_be_declared_optional_1276": "Una propiedad 'accessor' no se puede declarar como opcional.", "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "Una declaración de módulo de ambiente solo se permite en el nivel superior de un archivo.", "An_argument_for_0_was_not_provided_6210": "No se proporcionó ningún argumento para \"{0}\".", "An_argument_matching_this_binding_pattern_was_not_provided_6211": "No se proporcionó ningún argumento que coincida con este patrón de enlace.", @@ -382,7 +383,7 @@ "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720": "La clase \"{0}\" no implementa correctamente la clase \"{1}\". ¿Pretendía extender \"{1}\" y heredar sus miembros como una subclase?", "Class_0_incorrectly_implements_interface_1_2420": "La clase '{0}' implementa la interfaz '{1}' de forma incorrecta.", "Class_0_used_before_its_declaration_2449": "Se ha usado la clase \"{0}\" antes de declararla.", - "Class_constructor_may_not_be_a_generator_1360": "El constructor de clase no puede ser un generador.", + "Class_constructor_may_not_be_a_generator_1368": "El constructor de clase no puede ser un generador.", "Class_constructor_may_not_be_an_accessor_1341": "El constructor de clase no puede ser un descriptor de acceso.", "Class_declaration_cannot_implement_overload_list_for_0_2813": "La declaración de clase no puede implementar la lista de sobrecarga para '{0}'.", "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025": "Las declaraciones de clase no pueden tener más de una etiqueta \"@augments\" o \"@extends\".", @@ -430,6 +431,7 @@ "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "La conversión del tipo \"{0}\" al tipo \"{1}\" puede ser un error, porque ninguno de los tipos se superpone suficientemente al otro. Si esto era intencionado, convierta primero la expresión en \"unknown\".", "Convert_0_to_1_in_0_95003": "Convertir \"{0}\" a \"{1} en \"{0}\"", "Convert_0_to_mapped_object_type_95055": "Convertir \"{0}\" en el tipo de objeto asignado", + "Convert_all_const_to_let_95102": "Convertir todo \"const\" en \"let\"", "Convert_all_constructor_functions_to_classes_95045": "Convertir todas las funciones de constructor en clases", "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "Convertir todas las importaciones no usadas como valor para las importaciones solo de tipo", "Convert_all_invalid_characters_to_HTML_entity_code_95101": "Convertir todos los caracteres no válidos al código de entidad HTML", @@ -919,7 +921,7 @@ "Method_not_implemented_95158": "El método no está implementado.", "Modifiers_cannot_appear_here_1184": "Los modificadores no pueden aparecer aquí.", "Module_0_can_only_be_default_imported_using_the_1_flag_1259": "El módulo \"{0}\" solo puede importarse de forma predeterminada con la marca \"{1}\".", - "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "El módulo \"{0}\" no se puede importar usando esta construcción. El especificador solo se resuelve en un módulo ES, que no se puede importar de forma sincrónica. En su lugar, use la importación dinámica.", + "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "El módulo \"{0}\" no se puede importar con esta construcción. El especificador solo se resuelve en un módulo ES, que no se puede importar con \"require\". En su lugar, use una importación de ECMAScript.", "Module_0_declares_1_locally_but_it_is_exported_as_2_2460": "El módulo \"{0}\" declara \"{1}\" localmente, pero se exporta como \"{2}\".", "Module_0_declares_1_locally_but_it_is_not_exported_2459": "El módulo \"{0}\" declara \"{1}\" localmente, pero no se exporta.", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340": "El módulo \"{0}\" no hace referencia a un tipo, pero aquí se usa como tipo. ¿Quiso decir \"typeof import('{0}')\"?", @@ -1103,6 +1105,7 @@ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "El proyecto \"{0}\" está obsoleto porque el archivo de salida \"{1}\" no existe", "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "El proyecto \"{0}\" está obsoleto porque su salida se generó con la versión \"{1}\", que es distinta a la versión actual \"{2}\".", "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "El proyecto \"{0}\" está obsoleto porque la salida de su dependencia \"{1}\" ha cambiado.", + "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401": "El proyecto \"{0}\" no está actualizado porque se produjo un error al leer el archivo \"{1}\"", "Project_0_is_up_to_date_6361": "El proyecto \"{0}\" está actualizado", "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "El proyecto \"{0}\" está actualizado porque la entrada más reciente \"{1}\" es anterior a la salida \"{2}\"", "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "El proyecto \"{0}\" está actualizado, pero debe actualizar las marcas de tiempo de los archivos de salida anteriores a los archivos de entrada", @@ -1110,6 +1113,7 @@ "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "Las referencias del proyecto no pueden formar un gráfico circular. Ciclo detectado: {0}", "Projects_6255": "Proyectos", "Projects_in_this_build_Colon_0_6355": "Proyectos de esta compilación: {0}", + "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "Las propiedades con el modificador 'accessor' solo están disponibles cuando el destino es ECMAScript 2015 y versiones posteriores.", "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "La propiedad '{0}' no puede tener un mediador porque se marca como abstracto.", "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "La propiedad \"{0}\" procede de una signatura de índice, por lo que debe accederse a ella con [\"{0}\"].", "Property_0_does_not_exist_on_type_1_2339": "La propiedad '{0}' no existe en el tipo '{1}'.", @@ -1385,6 +1389,7 @@ "The_containing_arrow_function_captures_the_global_value_of_this_7041": "La función de flecha contenedora captura el valor global de \"this\".", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "El cuerpo de la función o del módulo contenedor es demasiado grande para realizar un análisis de flujo de control.", "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "El archivo actual es un módulo CommonJS y no puede usar \"await\" en el nivel superior.", + "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479": "El archivo actual es un módulo CommonJS cuyas importaciones generarán llamadas \"require\"; sin embargo, el archivo al que se hace referencia es un módulo ECMAScript y no se puede importar con \"require\". Considere la posibilidad de escribir una llamada dinámica \"import(\"{0}\")\" en su lugar.", "The_current_host_does_not_support_the_0_option_5001": "El host actual no admite la opción '{0}'.", "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "La declaración de \"{0}\" que probablemente pretendía usar se define aquí", "The_declaration_was_marked_as_deprecated_here_2798": "La declaración se ha marcado aquí como en desuso.", @@ -1422,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 izquierda de una operación aritmética debe ser de tipo \"any\", \"number\", \"bigint\" o un tipo de enumeración.", "The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779": "La parte izquierda de una expresión de asignación no puede ser un acceso de propiedad opcional.", "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364": "La parte izquierda de una expresión de asignación debe ser una variable o el acceso a una propiedad.", - "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360": "La parte izquierda de una expresión \"in\" debe ser un identificador privado o de 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 izquierda de una expresión \"instanceof\" debe ser de tipo \"any\", un tipo de objeto o un parámetro de tipo.", "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156": "Configuración regional utilizada para mostrar los mensajes al usuario (por ejemplo, \"es-es\")", "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136": "La profundidad máxima de dependencia para buscar en node_modules y cargar los archivos de JavaScript.", @@ -1443,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": "El tipo de valor devuelto de una función o un método asincrónicos debe ser el tipo Promise global. ¿Pretendía escribir \"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 derecha de una instrucción \"for...in\" debe ser de tipo \"any\", un tipo de objeto o un parámetro de tipo, pero aquí tiene el tipo \"{0}\".", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363": "La parte derecha de una operación aritmética debe ser de tipo \"any\", \"number\", \"bigint\" o un tipo de enumeración.", - "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361": "La parte derecha de una expresión \"in\" no debe ser un elemento primitivo.", "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359": "La parte derecha de una expresión \"instanceof\" debe ser de tipo \"any\" o un tipo que pueda asignarse al tipo de interfaz \"Function\".", "The_root_value_of_a_0_file_must_be_an_object_5092": "El valor raíz de un archivo \"{0}\" debe ser un objeto.", "The_shadowing_declaration_of_0_is_defined_here_18017": "La declaración que ensombrece a \"{0}\" se define aquí.", @@ -1464,13 +1467,14 @@ "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490": "El tipo devuelto por el método \"{0}()\" de un iterador debe tener una propiedad \"value\".", "The_types_of_0_are_incompatible_between_these_types_2200": "Los tipos de \"{0}\" son incompatibles entre estos tipos.", "The_types_returned_by_0_are_incompatible_between_these_types_2201": "Los tipos que \"{0}\" devuelve son incompatibles entre estos tipos.", + "The_value_0_cannot_be_used_here_18050": "El valor \"{0}\" no se puede usar aquí.", "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "La declaración de variable de una instrucción \"for...in\" no puede tener un inicializador.", "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "La declaración de variable de una instrucción \"for...of\" no puede tener un inicializador.", "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "No se admite la instrucción 'with'. Todos los símbolos de un bloque 'with' tendrán el tipo 'any'.", "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_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_0_since_the_types_1_and_2_have_no_overlap_2367": "Esta condición siempre devolverá \"{0}\", porque los tipos \"{1}\" y \"{2}\" no se superponen.", "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?", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Esta función de constructor puede convertirse en una declaración de clase.", @@ -1491,7 +1495,7 @@ "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114": "Este miembro debe tener un modificador \"override\" porque reemplaza a un miembro en la clase base \"{0}\".", "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "Este miembro debe tener un modificador \"override\" porque reemplaza a un método abstracto que se declara en la clase base \"{0}\".", "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "Solo se puede hacer referencia a este módulo con las importaciones o exportaciones de ECMAScript mediante la activación de la marca \"{0}\" y la referencia a su exportación predeterminada.", - "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594": "Este módulo se declara con \"export =\" y solo se puede usar con una importación predeterminada cuando se usa la marca \"{0}\".", + "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "Este módulo se declara con \"export =\" y solo se puede usar con una importación predeterminada cuando se usa la marca \"{0}\".", "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "Esta signatura de sobrecarga no es compatible con su signatura de implementación.", "This_parameter_is_not_allowed_with_use_strict_directive_1346": "Este parámetro no se permite con la directiva \"use strict\".", "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120": "Esta propiedad de parámetro debe tener un comentario JSDoc con una etiqueta '@override' porque invalida un miembro de la clase base '{0}'.", @@ -1504,6 +1508,10 @@ "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "Esta sintaxis requiere un asistente importado denominado \"{1}\" con parámetros de {2}, que no es compatible con el de \"{0}\". Pruebe a actualizar la versión de \"{0}\".", "This_type_parameter_might_need_an_extends_0_constraint_2208": "Este parámetro de tipo podría necesitar una restricción \"extends {0}\".", "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "Este uso de \"import\" no es válido. Se pueden escribir llamadas \"import()\", pero deben tener paréntesis y no pueden tener argumentos de tipo.", + "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482": "Para convertir este archivo en un módulo ECMAScript, agregue el campo `\"type\": \"module\"` a \"{0}\"'.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481": "Para convertir este archivo en un módulo ECMAScript, cambie su extensión de archivo a \"{0}\" o agregue el campo `\"type\": \"module\"` a \"{1}\".", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480": "Para convertir este archivo en un módulo ECMAScript, cambie su extensión de archivo a \"{0}\" o cree un archivo package.json local con '{ \"type\": \"module\" }'.", + "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483": "Para convertir este archivo en un módulo ECMAScript, cree un archivo package.json local con `{ \"type\": \"module\" }`.", "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "Las expresiones \"await\" de nivel superior solo se permiten cuando la opción \"módulo\" está establecida en \"es2022\", \"esnext\", \"system\", \"node16\" o \"nodenext\", y la opción \"destino\" está establecida en \"es2017\" o superior.", "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": "Las declaraciones de nivel superior de los archivos .d.ts deben comenzar con un modificador \"declare\" o \"export\".", "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "Los bucles \"for await\" de nivel superior solo se permiten cuando la opción \"módulo\" está establecida en \"es2022\", \"esnext\", \"system\", \"node16\" o \"nodenext\", y la opción \"destino\" está establecida en \"es2017\" o superior.", @@ -1519,6 +1527,7 @@ "Type_0_cannot_be_used_as_an_index_type_2538": "El tipo '{0}' no se puede usar como tipo de índice.", "Type_0_cannot_be_used_to_index_type_1_2536": "El tipo '{0}' no se puede usar para indexar el tipo '{1}'.", "Type_0_does_not_satisfy_the_constraint_1_2344": "El tipo '{0}' no cumple la restricción '{1}'.", + "Type_0_does_not_satisfy_the_expected_type_1_1360": "El tipo \"{0}\" no satisface el tipo esperado \"{1}\".", "Type_0_has_no_call_signatures_2757": "El tipo \"{0}\" no tiene signaturas de llamada.", "Type_0_has_no_construct_signatures_2761": "El tipo \"{0}\" no tiene signaturas de construcción.", "Type_0_has_no_matching_index_signature_for_type_1_2537": "El tipo '{0}' no tiene una signatura de índice correspondiente al tipo '{1}'.", @@ -1540,6 +1549,7 @@ "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412": "El tipo '{0}' no se puede asignar al tipo '{1}' con 'exactOptionalPropertyTypes: true'. Considere la posibilidad de agregar \"undefined\" al tipo del destino.", "Type_0_is_not_comparable_to_type_1_2678": "El tipo '{0}' no se puede comparar con el tipo '{1}'.", "Type_0_is_not_generic_2315": "El tipo '{0}' no es genérico.", + "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638": "El tipo \"{0}\" puede representar un valor primitivo, que no se permite como operando derecho del operador \"in\".", "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "El tipo \"{0}\" debe tener un método \"[Symbol.asyncIterator]()\" que devuelve un iterador de asincronía.", "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "El tipo \"{0}\" debe tener un método \"[Symbol.iterator]()\" que devuelve un iterador.", "Type_0_provides_no_match_for_the_signature_1_2658": "El tipo \"{0}\" no proporciona ninguna coincidencia para la signatura \"{1}\".", @@ -1596,6 +1606,7 @@ "Type_reference_directive_0_was_not_resolved_6120": "======== No se resolvió la directiva de referencia de tipo '{0}'. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== La directiva de referencia de tipo '{0}' se resolvió correctamente como '{1}', principal: {2}. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219": "======== La directiva de referencia de tipo \"{0}\" se resolvió correctamente como \"{1}\" con el identificador de paquete \"{2}\", principal: {3}. ========", + "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037": "Las expresiones de satisfacción de tipo solo se pueden usar en archivos TypeScript.", "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043": "Los tipos no pueden aparecer en declaraciones de exportación en archivos JavaScript.", "Types_have_separate_declarations_of_a_private_property_0_2442": "Los tipos tienen declaraciones independientes de una propiedad '{0}' privada.", "Types_of_construct_signatures_are_incompatible_2419": "Los tipos de signaturas de construcción son incompatibles.", @@ -1717,6 +1728,10 @@ "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "\"{0}\" no es una propiedad Meta válida para la palabra clave \"{1}\". ¿Pretendía usar \"{2}\"?", "_0_is_not_allowed_as_a_parameter_name_1390": "No se permite “{0}” como nombre de parámetro.", "_0_is_not_allowed_as_a_variable_declaration_name_1389": "No se permite \"{0}\" como nombre de declaración de variable.", + "_0_is_of_type_unknown_18046": "\"{0}\" es de tipo \"unknown\".", + "_0_is_possibly_null_18047": "\"{0}\" es posiblemente \"null\".", + "_0_is_possibly_null_or_undefined_18049": "\"{0}\" es posiblemente \"null\" o \"undefined\".", + "_0_is_possibly_undefined_18048": "\"{0}\" es posiblemente \"undefined\".", "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "Se hace referencia a '{0}' directa o indirectamente en su propia expresión base.", "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "Se hace referencia a '{0}' directa o indirectamente en su propia anotación de tipo.", "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783": "\"{0}\" se ha especificado más de una vez, por lo que se sobrescribirá este uso.", @@ -1752,6 +1767,7 @@ "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "'{0}' carece de una anotación de tipo de valor devuelto, pero tiene un tipo de valor devuelto '{1}' implícitamente.", "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "\"{0}\" carece de una anotación de tipo de valor devuelto, pero tiene un tipo yield \"{1}\" de forma implícita.", "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "El modificador 'abstract' solo puede aparecer en una declaración de propiedad, clase o método.", + "accessor_modifier_can_only_appear_on_a_property_declaration_1275": "El modificador 'accessor' solo puede aparecer en una declaración de propiedad.", "and_here_6204": "y aquí.", "arguments_cannot_be_referenced_in_property_initializers_2815": "no se puede hacer referencia a «arguments» en los inicializadores de propiedad.", "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "\"auto\": trate los archivos con importaciones, exportaciones, import.meta, jsx (con jsx: react-jsx) o formato esm (con el módulo: node16+) como módulos.", diff --git a/lib/fr/diagnosticMessages.generated.json b/lib/fr/diagnosticMessages.generated.json index 632cac15426..2a520a280a1 100644 --- a/lib/fr/diagnosticMessages.generated.json +++ b/lib/fr/diagnosticMessages.generated.json @@ -186,6 +186,7 @@ "An_abstract_accessor_cannot_have_an_implementation_1318": "Un accesseur abstrait ne peut pas avoir d'implémentation.", "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "Un modificateur d'accessibilité ne peut pas être utilisé avec un identificateur privé.", "An_accessor_cannot_have_type_parameters_1094": "Un accesseur ne peut pas avoir de paramètres de type.", + "An_accessor_property_cannot_be_declared_optional_1276": "Une propriété 'accessor' ne peut pas être déclarée comme facultative.", "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "Une déclaration de module ambiant est uniquement autorisée au niveau supérieur dans un fichier.", "An_argument_for_0_was_not_provided_6210": "Aucun argument pour '{0}' n'a été fourni.", "An_argument_matching_this_binding_pattern_was_not_provided_6211": "Aucun argument correspondant à ce modèle de liaison n'a été fourni.", @@ -382,7 +383,7 @@ "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720": "La classe '{0}' implémente de manière incorrecte la classe '{1}'. Voulez-vous vraiment étendre '{1}' et hériter de ses membres en tant que sous-classe ?", "Class_0_incorrectly_implements_interface_1_2420": "La classe '{0}' implémente de manière incorrecte l'interface '{1}'.", "Class_0_used_before_its_declaration_2449": "Classe '{0}' utilisée avant sa déclaration.", - "Class_constructor_may_not_be_a_generator_1360": "Le constructeur de classe ne peut pas être un générateur.", + "Class_constructor_may_not_be_a_generator_1368": "Le constructeur de classe ne peut pas être un générateur.", "Class_constructor_may_not_be_an_accessor_1341": "Le constructeur de la classe ne peut pas être un accesseur.", "Class_declaration_cannot_implement_overload_list_for_0_2813": "La déclaration de classe ne peut pas implémenter la liste de surcharge pour «{0}».", "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025": "Les déclarations de classes ne peuvent pas avoir plusieurs balises '@augments' ou '@extends'.", @@ -430,6 +431,7 @@ "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "La conversion du type '{0}' en type '{1}' est peut-être une erreur, car aucun type ne chevauche suffisamment l'autre. Si cela est intentionnel, convertissez d'abord l'expression en 'unknown'.", "Convert_0_to_1_in_0_95003": "Convertir '{0}' en '{1} dans {0}'", "Convert_0_to_mapped_object_type_95055": "Convertir '{0}' en type d'objet mappé", + "Convert_all_const_to_let_95102": "Convertir tous les 'const' en 'let'", "Convert_all_constructor_functions_to_classes_95045": "Convertir toutes les fonctions de constructeur en classes", "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "Convertir toutes les importations non utilisées en tant que valeur en importations de types uniquement", "Convert_all_invalid_characters_to_HTML_entity_code_95101": "Convertir tous les caractères non valides en code d'entité HTML", @@ -919,7 +921,7 @@ "Method_not_implemented_95158": "Méthode non implémentée.", "Modifiers_cannot_appear_here_1184": "Les modificateurs ne peuvent pas apparaître ici.", "Module_0_can_only_be_default_imported_using_the_1_flag_1259": "Le module '{0}' peut uniquement être importé par défaut à l'aide de l'indicateur '{1}'", - "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "Vous ne pouvez pas importer le module « {0} » à l’aide de cette construction. Le spécificateur se résout uniquement en module ES, que vous ne pouvez pas importer de manière synchrone. Utilisez l’importation dynamique à la place.", + "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "Le module '{0}' ne peut pas être importé à l'aide de cette construction. Le spécificateur se résout uniquement en un module ES, qui ne peut pas être importé avec 'require'. Utilisez plutôt une importation ECMAScript.", "Module_0_declares_1_locally_but_it_is_exported_as_2_2460": "Le module '{0}' déclare '{1}' localement, mais il est exporté en tant que '{2}'.", "Module_0_declares_1_locally_but_it_is_not_exported_2459": "Le module '{0}' déclare '{1}' localement, mais il n'est pas exporté.", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340": "Le module '{0}' ne fait pas référence à un type, mais il est utilisé ici en tant que type. Est-ce que vous avez voulu utiliser 'typeof import('{0}')' ?", @@ -1103,6 +1105,7 @@ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Le projet '{0}' est obsolète car le fichier de sortie '{1}' n'existe pas", "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "Le projet '{0}' est obsolète, car sa sortie a été générée avec la version '{1}', qui diffère de la version actuelle '{2}'", "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "Le projet '{0}' est obsolète, car la sortie de sa dépendance '{1}' a changé", + "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401": "Le projet « {0} » est obsolète car une erreur s'est produite lors de la lecture du fichier « {1} »", "Project_0_is_up_to_date_6361": "Le projet '{0}' est à jour", "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "Le projet « {0} » est à jour car l'entrée la plus récente (« {1} ») est antérieure à la sortie (« {2} »)", "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "Project « {0} » est à jour, mais doit mettre à jour les horodatages des fichiers de sortie plus anciens que les fichiers d’entrée", @@ -1110,6 +1113,7 @@ "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "Les références de projet ne peuvent pas former un graphe circulaire. Cycle détecté : {0}", "Projects_6255": "Projets", "Projects_in_this_build_Colon_0_6355": "Projets dans cette build : {0}", + "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "Les propriétés avec le modificateur 'accessor' ne sont disponibles que pour le ciblage d’ECMAScript 2015 et versions ultérieures.", "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "La propriété « {0} » ne peut pas avoir d’initialiseur, car elle est marquée comme abstraite.", "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "La propriété '{0}' est issue d'une signature d'index, elle doit donc faire l'objet d'un accès avec ['{0}'].", "Property_0_does_not_exist_on_type_1_2339": "La propriété '{0}' n'existe pas sur le type '{1}'.", @@ -1385,6 +1389,7 @@ "The_containing_arrow_function_captures_the_global_value_of_this_7041": "La fonction arrow conteneur capture la valeur globale de 'this'.", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "Le corps de la fonction ou du module conteneur est trop grand pour l'analyse du flux de contrôle.", "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "Le fichier actuel est un module CommonJS et ne peut pas utiliser 'await' au niveau supérieur.", + "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479": "Le fichier actuel est un module CommonJS dont les importations produiront des appels 'require' ; cependant, le fichier référencé est un module ECMAScript et ne peut pas être importé avec 'require'. Envisagez d'écrire un appel dynamique 'import(\"{0}\")' à la place.", "The_current_host_does_not_support_the_0_option_5001": "L'hôte actuel ne prend pas en charge l'option '{0}'.", "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "La déclaration de '{0}' que vous aviez probablement l'intention d'utiliser est définie ici", "The_declaration_was_marked_as_deprecated_here_2798": "La déclaration a été marquée ici comme étant dépréciée.", @@ -1464,13 +1469,14 @@ "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490": "Le type retourné par la méthode '{0}()' d'un itérateur doit avoir une propriété 'value'.", "The_types_of_0_are_incompatible_between_these_types_2200": "Les types de '{0}' sont incompatibles entre eux.", "The_types_returned_by_0_are_incompatible_between_these_types_2201": "Les types retournés par '{0}' sont incompatibles entre eux.", + "The_value_0_cannot_be_used_here_18050": "La valeur '{0}' ne peut pas être utilisée ici.", "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "La déclaration de variable d'une instruction 'for...in' ne peut pas avoir d'initialiseur.", "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "La déclaration de variable d'une instruction 'for...of' ne peut pas avoir d'initialiseur.", "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "L'instruction 'with' n'est pas prise en charge. Tous les symboles d'un bloc 'with' ont le type 'any'.", "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_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_0_since_the_types_1_and_2_have_no_overlap_2367": "Cette condition retourne toujours '{0}', car les types '{1}' et '{2}' n'ont pas de chevauchement.", "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 ?", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Cette fonction constructeur peut être convertie en déclaration de classe.", @@ -1491,7 +1497,7 @@ "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114": "Ce membre doit avoir un modificateur 'override', car il se substitue à un membre de la classe de base '{0}'.", "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "Ce membre doit avoir un modificateur 'override', car il se substitue à une méthode abstraite déclarée dans la classe de base '{0}'.", "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "Vous pouvez référencer ce module uniquement avec les importations/exportations ECMAScript en activant l'indicateur '{0}' et en référençant son exportation par défaut.", - "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594": "Ce module est déclaré à l'aide de 'export =' et peut être utilisé uniquement avec une importation par défaut quand l'indicateur '{0}' est employé.", + "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "Ce module est déclaré avec 'export =', et ne peut être utilisé qu’avec une importation par défaut lors de l’utilisation de l’indicateur '{0}'.", "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "Cette signature de surcharge n'est pas compatible avec sa signature d'implémentation.", "This_parameter_is_not_allowed_with_use_strict_directive_1346": "Ce paramètre n'est pas autorisé avec la directive 'use strict'.", "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120": "Cette propriété de paramètre doit avoir un commentaire JSDoc avec une balise '@override' car elle remplace un membre dans la classe de base '{0}'.", @@ -1504,6 +1510,10 @@ "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "Cette syntaxe nécessite un composant d'assistance importé nommé '{1}' avec {2} paramètres, ce qui n'est pas compatible avec celui qui se trouve dans '{0}'. Effectuez une mise à niveau de votre version de '{0}'.", "This_type_parameter_might_need_an_extends_0_constraint_2208": "Ce paramètre de type nécessite peut-être une contrainte « extends {0}».", "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "Cette utilisation de « import » n’est pas valide. Les appels « import() » peuvent être écrits, mais ils doivent avoir des parenthèses et ne peuvent pas avoir d’arguments de type.", + "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482": "Pour convertir ce fichier en module ECMAScript, ajoutez le champ `\"type\" : \"module\"` à '{0}'.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481": "Pour convertir ce fichier en module ECMAScript, changez son extension de fichier en '{0}', ou ajoutez le champ `\"type\" : \"module\"` à '{1}'.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480": "Pour convertir ce fichier en module ECMAScript, changez son extension de fichier en '{0}' ou créez un fichier package.json local avec `{ \"type\": \"module\" }`.", + "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483": "Pour convertir ce fichier en module ECMAScript, créez un fichier package.json local avec `{ \"type\": \"module\" }`.", "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "Les expressions 'await' de niveau supérieur sont autorisées uniquement lorsque l’option 'module' a la valeur 'es2022', 'esnext', 'system', 'node16' ou 'nodenext' et que l’option 'target' a la valeur 'es2017' ou une valeur supérieure.", "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": "Les déclarations de niveau supérieur dans les fichiers .d.ts doivent commencer par un modificateur 'declare' ou 'export'.", "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "Les boucles « for await » de niveau supérieur sont autorisées uniquement lorsque l’option « module » a la valeur « es2022 », « esnext », « system », « node16 » ou « nodenext », et que l’option « target » a la valeur « es2017 » ou une version ultérieure.", @@ -1519,6 +1529,7 @@ "Type_0_cannot_be_used_as_an_index_type_2538": "Impossible d'utiliser le type '{0}' comme type d'index.", "Type_0_cannot_be_used_to_index_type_1_2536": "Le type '{0}' ne peut pas être utilisé pour indexer le type '{1}'.", "Type_0_does_not_satisfy_the_constraint_1_2344": "Le type '{0}' ne satisfait pas la contrainte '{1}'.", + "Type_0_does_not_satisfy_the_expected_type_1_1360": "Le type '{0}' ne satisfait pas le type attendu '{1}'.", "Type_0_has_no_call_signatures_2757": "Le type '{0}' n'a aucune signature d'appel.", "Type_0_has_no_construct_signatures_2761": "Le type '{0}' n'a aucune signature de construction.", "Type_0_has_no_matching_index_signature_for_type_1_2537": "Le type '{0}' n'a aucune signature d'index correspondant au type '{1}'.", @@ -1596,6 +1607,7 @@ "Type_reference_directive_0_was_not_resolved_6120": "======== La directive de référence de type '{0}' n'a pas été résolue. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== La directive de référence de type '{0}' a été correctement résolue en '{1}', primaire : {2}. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219": "======== La directive de référence de type '{0}' a été correctement résolue en '{1}' avec l'ID de package '{2}', primaire : {3}. ========", + "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037": "Les expressions de satisfaction de type peuvent uniquement être utilisées dans les fichiers TypeScript.", "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043": "Les types ne peuvent pas apparaître dans les déclarations d’exportation dans les fichiers JavaScript.", "Types_have_separate_declarations_of_a_private_property_0_2442": "Les types ont des déclarations distinctes d'une propriété privée '{0}'.", "Types_of_construct_signatures_are_incompatible_2419": "Les types de signature de construction sont incompatibles.", @@ -1717,6 +1729,10 @@ "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "'{0}' n'est pas une métapropriété valide pour le mot clé '{1}'. Est-ce qu'il ne s'agit pas plutôt de '{2}' ?", "_0_is_not_allowed_as_a_parameter_name_1390": "'{0}' n'est pas autorisé comme nom de paramètre.", "_0_is_not_allowed_as_a_variable_declaration_name_1389": "'{0}' n'est pas autorisé en tant que nom de déclaration de variable.", + "_0_is_of_type_unknown_18046": "'{0}' est de type 'unknown'.", + "_0_is_possibly_null_18047": "'{0}' est peut-être 'null'.", + "_0_is_possibly_null_or_undefined_18049": "'{0}' est peut-être 'null' ou 'undefined'.", + "_0_is_possibly_undefined_18048": "'{0}' est peut-être 'non défini'.", "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "'{0}' est référencé directement ou indirectement dans sa propre expression de base.", "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "'{0}' est référencé directement ou indirectement dans sa propre annotation de type.", "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783": "'{0}' est spécifié plusieurs fois. Cette utilisation va donc être remplacée.", @@ -1752,6 +1768,7 @@ "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "'{0}', qui ne dispose pas d'annotation de type de retour, possède implicitement un type de retour '{1}'.", "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "'{0}', qui n'a pas d'annotation de type de retour, a implicitement le type de retour '{1}'.", "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "Le modificateur 'abstract' peut apparaître uniquement dans une déclaration de classe, de méthode ou de propriété.", + "accessor_modifier_can_only_appear_on_a_property_declaration_1275": "Le modificateur 'accessor' ne peut apparaître que sur une déclaration de propriété.", "and_here_6204": "et ici.", "arguments_cannot_be_referenced_in_property_initializers_2815": "Les « arguments » ne peuvent pas être référencés dans les initialiseurs de propriété.", "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "« auto » : traitez les fichiers avec des importations, des exportations, import.meta, jsx (avec jsx: react-jsx) ou un format esm (avec module : node16+) en tant que modules.", diff --git a/lib/it/diagnosticMessages.generated.json b/lib/it/diagnosticMessages.generated.json index dff39262567..d5cf2611165 100644 --- a/lib/it/diagnosticMessages.generated.json +++ b/lib/it/diagnosticMessages.generated.json @@ -186,6 +186,7 @@ "An_abstract_accessor_cannot_have_an_implementation_1318": "Una funzione di accesso astratta non può contenere un'implementazione.", "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "Non è possibile usare un modificatore di accessibilità con un identificatore privato.", "An_accessor_cannot_have_type_parameters_1094": "Una funzione di accesso non può contenere parametri di tipo.", + "An_accessor_property_cannot_be_declared_optional_1276": "Una proprietà 'accessor' non può essere dichiarata facoltativa.", "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "Una dichiarazione di modulo di ambiente è consentita solo al primo livello in un file.", "An_argument_for_0_was_not_provided_6210": "Non è stato specificato alcun argomento per '{0}'.", "An_argument_matching_this_binding_pattern_was_not_provided_6211": "Non è stato specificato alcun argomento corrispondente a questo modello di associazione.", @@ -382,7 +383,7 @@ "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720": "La classe '{0}' implementa in modo errato la classe '{1}'. Si intendeva estendere '{1}' ed ereditarne i membri come sottoclasse?", "Class_0_incorrectly_implements_interface_1_2420": "La classe '{0}' implementa in modo errato l'interfaccia '{1}'.", "Class_0_used_before_its_declaration_2449": "La classe '{0}' è stata usata prima di essere stata dichiarata.", - "Class_constructor_may_not_be_a_generator_1360": "Il costruttore di classe non può essere un generatore.", + "Class_constructor_may_not_be_a_generator_1368": "Il costruttore di classe non può essere un generatore.", "Class_constructor_may_not_be_an_accessor_1341": "Il costruttore di classe non può essere una funzione di accesso.", "Class_declaration_cannot_implement_overload_list_for_0_2813": "La dichiarazione classe non può implementare l'elenco di overload per '{0}'.", "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025": "Le dichiarazioni di classe non possono contenere più di un tag '@augments' o '@extends'.", @@ -430,6 +431,7 @@ "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "La conversione del tipo '{0}' nel tipo '{1}' può essere un errore perché nessuno dei due tipi si sovrappone sufficientemente all'altro. Se questa opzione è intenzionale, convertire prima l'espressione in 'unknown'.", "Convert_0_to_1_in_0_95003": "Convertire '{0}' in '{1} in {0}'", "Convert_0_to_mapped_object_type_95055": "Convertire '{0}' nel tipo di oggetto con mapping", + "Convert_all_const_to_let_95102": "Convertire ogni 'const' in 'let'", "Convert_all_constructor_functions_to_classes_95045": "Convertire tutte le funzioni di costruttore in classi", "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "Convertire tutte le importazioni non usate come valore in importazioni solo di tipi", "Convert_all_invalid_characters_to_HTML_entity_code_95101": "Convertire tutti i caratteri non validi nel codice entità HTML", @@ -919,7 +921,7 @@ "Method_not_implemented_95158": "Metodo non implementato.", "Modifiers_cannot_appear_here_1184": "In questo punto non è possibile usare modificatori.", "Module_0_can_only_be_default_imported_using_the_1_flag_1259": "Il modulo '{0}' può essere importato come predefinito solo con il flag '{1}'", - "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "Non è possibile importare il modulo ' {0}' utilizzando questo costrutto. L'identificatore può essere solo risolto in un modulo ES, che non può essere importato in modo sincrono. Utilizzare l'importazione dinamica.", + "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "Non è possibile importare il modulo '{0}' utilizzando questo costrutto. L'identificatore può essere solo risolto in un modulo ES, che non può essere importato con 'require'. Usare invece un'importazione ECMAScript.", "Module_0_declares_1_locally_but_it_is_exported_as_2_2460": "Il modulo '{0}' dichiara '{1}' in locale, ma viene esportato come '{2}'.", "Module_0_declares_1_locally_but_it_is_not_exported_2459": "Il modulo '{0}' dichiara '{1}' in locale, ma non viene esportato.", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340": "Il modulo '{0}' non fa riferimento a un tipo, ma viene usato come tipo in questo punto. Si intendeva 'typeof import('{0}')'?", @@ -1103,6 +1105,7 @@ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Il progetto '{0}' non è aggiornato perché il file di output '{1}' non esiste", "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "Il progetto '{0}' non è aggiornato perché l'output per il progetto è stato generato con la versione '{1}' che non corrisponde alla versione corrente '{2}'", "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "Il progetto '{0}' non è aggiornato perché l'output della relativa dipendenza '{1}' è cambiato", + "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401": "Il progetto '{0}' non è aggiornato perché si è verificato un errore durante la lettura del file '{1}'", "Project_0_is_up_to_date_6361": "Il progetto '{0}' è aggiornato", "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "Il progetto '{0}' è aggiornato perché l'input più recente '{1}' è meno recente dell'output '{2}'", "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "Project '{0}' è aggiornato ma deve aggiornare i timestamp dei file di output precedenti ai file di input", @@ -1110,6 +1113,7 @@ "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "I riferimenti al progetto non possono formare un grafico circolare. Ciclo rilevato: {0}", "Projects_6255": "Progetti", "Projects_in_this_build_Colon_0_6355": "Progetti in questa compilazione: {0}", + "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "Le proprietà con il modificatore 'funzione di accesso' sono disponibili solo quando la destinazione è ECMAScript 2015 e versioni successive.", "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "La proprietà '{0}' non può includere un inizializzatore perché è contrassegnata come astratta.", "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "La proprietà '{0}' deriva da una firma dell'indice, quindi è necessario accedervi con ['{0}'].", "Property_0_does_not_exist_on_type_1_2339": "La proprietà '{0}' non esiste nel tipo '{1}'.", @@ -1385,6 +1389,7 @@ "The_containing_arrow_function_captures_the_global_value_of_this_7041": "La funzione arrow contenitore acquisisce il valore globale di 'this'.", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "Il corpo del modulo o la funzione che contiene è troppo grande per l'analisi del flusso di controllo.", "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "Il file corrente è un modulo CommonJS e non può usare 'await' al livello principale.", + "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479": "Il file corrente è un modulo CommonJS le cui importazioni genereranno chiamate 'require'. Tuttavia, il file a cui si fa riferimento è un modulo ECMAScript e non può essere importato con 'require'. Provare a scrivere una chiamata 'import(\"{0}\")' dinamica.", "The_current_host_does_not_support_the_0_option_5001": "L'host corrente non supporta l'opzione '{0}'.", "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "La dichiarazione di '{0}' che probabilmente si intende usare viene definita in questo punto", "The_declaration_was_marked_as_deprecated_here_2798": "La dichiarazione è stata contrassegnata come deprecata in questo punto.", @@ -1464,13 +1469,14 @@ "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490": "Il tipo restituito dal metodo '{0}()' di un iteratore deve contenere una proprietà 'value'.", "The_types_of_0_are_incompatible_between_these_types_2200": "I tipi di '{0}' sono incompatibili tra questi tipi.", "The_types_returned_by_0_are_incompatible_between_these_types_2201": "I tipi restituiti da '{0}' sono incompatibili tra questi tipi.", + "The_value_0_cannot_be_used_here_18050": "Non è possibile usare qui il valore '{0}'.", "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "La dichiarazione di variabile di un'istruzione 'for...in' non può contenere un inizializzatore.", "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "La dichiarazione di variabile di un'istruzione 'for...of' non può contenere un inizializzatore.", "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "L'istruzione 'with' non è supportata. Il tipo di tutti i simboli in un blocco 'with' è 'any'.", "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_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_0_since_the_types_1_and_2_have_no_overlap_2367": "Questa condizione restituirà sempre '{0}' perché i tipi '{1}' e '{2}' non presentano alcuna sovrapposizione.", "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?", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Questa funzione del costruttore può essere convertita in una dichiarazione di classe.", @@ -1491,7 +1497,7 @@ "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114": "Questo membro deve includere un modificatore 'override' perché sovrascrive un membro nella classe di base '{0}'.", "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "Questo membro deve includere un modificatore 'override' perché esegue l'override di un metodo astratto dichiarato nella classe di base '{0}'.", "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "È possibile fare riferimento a questo modulo solo con importazioni/esportazioni ECMAScript attivando il flag '{0}' e facendo riferimento alla relativa esportazione predefinita.", - "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594": "Il modulo viene dichiarato con 'export =' e può essere usato solo con un'importazione predefinita quando si usa il flag '{0}'.", + "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "Il modulo viene dichiarato con 'export =' e può essere usato solo con un'importazione predefinita quando si usa il flag '{0}'.", "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "Questa firma di overload non è compatibile con la relativa firma di implementazione.", "This_parameter_is_not_allowed_with_use_strict_directive_1346": "Questo parametro non è consentito con la direttiva 'use strict'.", "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120": "Questa proprietà di parametro deve avere un commento JSDoc con un tag '@override' perché sostituisce un membro nella classe di base '{0}'.", @@ -1504,6 +1510,10 @@ "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "Con questa sintassi è richiesto un helper importato denominato '{1}' con {2} parametri, che non è compatibile con quello presente in '{0}'. Provare ad aggiornare la versione di '{0}'.", "This_type_parameter_might_need_an_extends_0_constraint_2208": "Questo parametro di tipo potrebbe richiedere un vincolo `extends {0}`.", "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "Questo uso di 'import' non è valido. le chiamate 'import()' possono essere scritte, ma devono avere parentesi e non possono avere argomenti di tipo.", + "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482": "Per convertire questo file in un modulo ECMAScript, aggiungere il campo '\"type\": \"module\"' a '{0}'.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481": "Per convertire il file in un modulo ECMAScript, modificarne l'estensione in '{0}' oppure aggiungere il campo '\"type\": \"module\"' a '{1}'.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480": "Per convertire questo file in un modulo ECMAScript, modificarne l'estensione in '{0}' o creare un file package.json locale con '{ \"type\": \"module\" }'.", + "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483": "Per convertire questo file in un modulo ECMAScript, creare un file package.json locale con '{ \"type\": \"module\" }'.", "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "Le espressioni 'await' di primo livello sono consentite solo quando l'opzione 'module' è impostata su 'es2022', 'esnext', 'system', 'node16', or 'nodenext', e l'opzione 'target' è impostata su 'es2017' o versione successiva.", "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": "Le dichiarazioni di primo livello nei file con estensione d.ts devono iniziare con un modificatore 'declare' o 'export'.", "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "I cicli 'for await' di primo livello sono consentiti solo quando l'opzione 'module' è impostata su'es2022', 'esnext', 'system', 'node16', o 'nodenext' e l'opzione 'target' è impostata su 'es2017' o versione successiva.", @@ -1519,6 +1529,7 @@ "Type_0_cannot_be_used_as_an_index_type_2538": "Non è possibile usare il tipo '{0}' come tipo di indice.", "Type_0_cannot_be_used_to_index_type_1_2536": "Non è possibile usare il tipo '{0}' per indicizzare il tipo '{1}'.", "Type_0_does_not_satisfy_the_constraint_1_2344": "Il tipo '{0}' non soddisfa il vincolo '{1}'.", + "Type_0_does_not_satisfy_the_expected_type_1_1360": "Il tipo '{0}' non soddisfa il tipo previsto '{1}'.", "Type_0_has_no_call_signatures_2757": "Il tipo '{0}' non contiene firme di chiamata.", "Type_0_has_no_construct_signatures_2761": "Il tipo '{0}' non contiene firme del costrutto.", "Type_0_has_no_matching_index_signature_for_type_1_2537": "Nel tipo '{0}' non esiste alcuna firma dell'indice corrispondente per il tipo '{1}'.", @@ -1596,6 +1607,7 @@ "Type_reference_directive_0_was_not_resolved_6120": "======== La direttiva '{0}' del riferimento al tipo non è stata risolta. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== La direttiva '{0}' del riferimento al tipo è stata risolta in '{1}'. Primaria: {2}. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219": "======== La direttiva '{0}' del riferimento al tipo è stata risolta in '{1}' con ID pacchetto ID '{2}'. Primaria: {3}. ========", + "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037": "Le espressioni di soddisfazione del tipo possono essere usate solo nei file TypeScript.", "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043": "I tipi non possono essere visualizzati nelle dichiarazioni di esportazione nei file JavaScript.", "Types_have_separate_declarations_of_a_private_property_0_2442": "I tipi contengono dichiarazioni separate di una proprietà privata '{0}'.", "Types_of_construct_signatures_are_incompatible_2419": "I tipi delle firme del costrutto sono incompatibili.", @@ -1717,6 +1729,10 @@ "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "'{0}' non è una metaproprietà valida per la parola chiave '{1}'. Si intendeva '{2}'?", "_0_is_not_allowed_as_a_parameter_name_1390": "'{0}' non è un nome di parametro consentito.", "_0_is_not_allowed_as_a_variable_declaration_name_1389": "'{0}' non è consentito come nome di una dichiarazione di variabile.", + "_0_is_of_type_unknown_18046": "'{0}' è di tipo 'unknown'.", + "_0_is_possibly_null_18047": "'{0}' è probabilmente 'null'.", + "_0_is_possibly_null_or_undefined_18049": "'{0}' è probabilmente 'null' o 'undefined'.", + "_0_is_possibly_undefined_18048": "'{0}' è probabilmente 'undefined'.", "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "'{0}' viene usato come riferimento diretto o indiretto nella relativa espressione di base.", "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "'{0}' viene usato come riferimento diretto o indiretto nella relativa annotazione di tipo.", "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783": "'{0}' è specificato più di una volta, quindi il relativo utilizzo verrà sovrascritto.", @@ -1752,6 +1768,7 @@ "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "'{0}', in cui manca l'annotazione di tipo restituito, contiene implicitamente un tipo restituito '{1}'.", "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "'{0}', in cui manca l'annotazione di tipo restituito, contiene implicitamente un tipo yield '{1}'.", "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "Il modificatore 'abstract' può essere incluso solo in una dichiarazione di classe, metodo o proprietà.", + "accessor_modifier_can_only_appear_on_a_property_declaration_1275": "Il modificatore 'accessor' può essere visualizzato solo in una dichiarazione di proprietà.", "and_here_6204": "e in questo punto.", "arguments_cannot_be_referenced_in_property_initializers_2815": "impossibile fare riferimento agli 'argomenti' negli inizializzatori di proprietà.", "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "\"auto\": considera i file con importazioni, esportazioni, import.meta, jsx (con jsx: react-jsx) o il formato esm (con modulo: node16+) come moduli.", diff --git a/lib/ja/diagnosticMessages.generated.json b/lib/ja/diagnosticMessages.generated.json index 9841773a6a0..33c8b7142a6 100644 --- a/lib/ja/diagnosticMessages.generated.json +++ b/lib/ja/diagnosticMessages.generated.json @@ -186,6 +186,7 @@ "An_abstract_accessor_cannot_have_an_implementation_1318": "抽象アクセサーに実装を含めることはできません。", "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "アクセシビリティ修飾子を private 識別子と共に使用することはできません。", "An_accessor_cannot_have_type_parameters_1094": "アクセサーに型パラメーターを指定することはできません。", + "An_accessor_property_cannot_be_declared_optional_1276": "'accessor' プロパティはオプションとして宣言できません。", "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "アンビエント モジュール宣言は、ファイルの最上位にのみ使用できます。", "An_argument_for_0_was_not_provided_6210": "'{0}' の引数が指定されていません。", "An_argument_matching_this_binding_pattern_was_not_provided_6211": "このバインド パターンに一致する引数が指定されていません。", @@ -382,7 +383,7 @@ "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720": "クラス '{0}' はクラス '{1}' を正しく実装していません。'{1}' を拡張し、そのメンバーをサブクラスとして継承しますか?", "Class_0_incorrectly_implements_interface_1_2420": "クラス '{0}' はインターフェイス '{1}' を正しく実装していません。", "Class_0_used_before_its_declaration_2449": "クラス '{0}' は宣言の前に使用されました。", - "Class_constructor_may_not_be_a_generator_1360": "クラス コンストラクターをジェネレーターにすることはできません。", + "Class_constructor_may_not_be_a_generator_1368": "クラス コンストラクターをジェネレーターにすることはできません。", "Class_constructor_may_not_be_an_accessor_1341": "クラス コンストラクターをアクセサーにすることはできません。", "Class_declaration_cannot_implement_overload_list_for_0_2813": "クラスの宣言では '{0}' のオーバーロード リストを実装できません。", "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025": "クラスの宣言で複数の '@augments' または '@extends' タグを含めることはできません。", @@ -430,6 +431,7 @@ "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "型 '{0}' から型 '{1}' への変換は、互いに十分に重複できないため間違っている可能性があります。意図的にそうする場合は、まず式を 'unknown' に変換してください。", "Convert_0_to_1_in_0_95003": "'{0}' を '{0} の {1}' に変換します", "Convert_0_to_mapped_object_type_95055": "'{0}' をマップされたオブジェクト型に変換する", + "Convert_all_const_to_let_95102": "すべての 'const' を 'let' に変換する", "Convert_all_constructor_functions_to_classes_95045": "すべてのコンストラクター関数をクラスに変換します", "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "値として使用されていないすべてのインポートを型のみのインポートに変換する", "Convert_all_invalid_characters_to_HTML_entity_code_95101": "すべての無効な文字を HTML エンティティ コードに変換する", @@ -919,7 +921,7 @@ "Method_not_implemented_95158": "メソッドが実装されていません。", "Modifiers_cannot_appear_here_1184": "ここで修飾子を使用することはできません。", "Module_0_can_only_be_default_imported_using_the_1_flag_1259": "モジュール '{0}' は、'{1}' フラグを使用して既定でのみインポートできます", - "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "モジュール '{0}' はこのコンストラクトではインポートできません。指定子は ES モジュールに対してのみ解決されるため、同期的にインポートすることはできません。代わりに動的インポートを使用します。", + "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "モジュール '{0}' はこのコンストラクトではインポートできません。指定子は ES モジュールに解決されるだけであるため、'require' でインポートすることはできません。代わりに ECMAScript インポートを使用してください。", "Module_0_declares_1_locally_but_it_is_exported_as_2_2460": "モジュール '{0}' は '{1}' をローカルで宣言していますが、これは '{2}' としてエクスポートされています。", "Module_0_declares_1_locally_but_it_is_not_exported_2459": "モジュール '{0}' は '{1}' をローカルで宣言していますが、これはエクスポートされていません。", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340": "モジュール '{0}' は型を参照していませんが、ここでは型として使用されています。'typeof import('{0}')' を意図していましたか?", @@ -1103,6 +1105,7 @@ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "プロジェクト '{0}' は出力ファイル '{1}' が存在しないため最新の状態ではありません", "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "プロジェクト '{0}' の出力が現在のバージョン '{2}' と異なるバージョン '{1}' で生成されているため、このプロジェクトは最新の状態ではありません", "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "依存関係 '{1}' の出力が変更されているため、プロジェクト '{0}' は最新の状態ではありません", + "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401": "ファイル '{1}' の読み取り中にエラーが発生したため、プロジェクト '{0}' は最新ではありません", "Project_0_is_up_to_date_6361": "プロジェクト '{0}' は最新の状態です", "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "プロジェクト '{0}' は最新の入力 '{1}' が出力 '{2}' より古いため最新の状態です", "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "プロジェクト '{0}' は最新ですが、入力ファイルよりも古い出力ファイルのタイムスタンプを更新する必要があります", @@ -1110,6 +1113,7 @@ "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "プロジェクト参照が円グラフを形成できません。循環が検出されました: {0}", "Projects_6255": "プロジェクト", "Projects_in_this_build_Colon_0_6355": "このビルドのプロジェクト: {0}", + "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "'accessor' 修飾子を持つプロパティは、ECMAScript 2015 以降を対象とする場合にのみ使用できます。", "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "メソッド '{0}' は abstract に指定されているため、初期化子を含めることができません。", "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "プロパティ '{0}' はインデックス シグネチャに基づいているため、['{0}'] を使用してアクセスする必要があります。", "Property_0_does_not_exist_on_type_1_2339": "プロパティ '{0}' は型 '{1}' に存在しません。", @@ -1385,6 +1389,7 @@ "The_containing_arrow_function_captures_the_global_value_of_this_7041": "含まれているアロー関数は、'this' のグローバル値をキャプチャします。", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "含まれている関数またはモジュールの本体は、制御フロー解析には大きすぎます。", "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "現在のファイルは CommonJS モジュールであり、最上位レベルでは 'await' を使用できません。", + "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479": "現在のファイルは CommonJS モジュールであり、このインポートでは 'require' 呼び出しが生成されますが、参照ファイルは ECMAScript モジュールであるため、'require' ではインポートできません。代わりに動的な 'import(\"{0}\")' 呼び出しを記述することを検討してください。", "The_current_host_does_not_support_the_0_option_5001": "現在のホストは '{0}' オプションをサポートしていません。", "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "使用するつもりだったと思われる '{0}' の宣言はここで定義されています", "The_declaration_was_marked_as_deprecated_here_2798": "この宣言はここで非推奨とマークされました。", @@ -1422,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 ファイルを読み込む依存関係の最大深度です。", @@ -1443,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}' のシャドウ宣言はここで定義されています", @@ -1464,13 +1467,14 @@ "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490": "反復子の '{0}()' メソッドによって返される型には 'value' プロパティが必要です。", "The_types_of_0_are_incompatible_between_these_types_2200": "'{0}' の型は、これらの型同士で互換性がありません。", "The_types_returned_by_0_are_incompatible_between_these_types_2201": "'{0}' によって返された型は、これらの型同士で互換性がありません。", + "The_value_0_cannot_be_used_here_18050": "値 '{0}' はここでは使用できません。", "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "'for...in' ステートメントの変数宣言に初期化子を指定することはできません。", "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "'for...of' ステートメントの変数宣言に初期化子を指定することはできません。", "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "'with' ステートメントはサポートされていません。'with' ブロック内のすべてのシンボルの型は 'any' になります。", "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_since_JavaScript_compares_objects_by_reference_not_value_2839": "JavaScript が値ではなく参照でオブジェクトを比較するため、この条件は常に '{0}' を返します。", - "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367": "型 '{1}' と '{2}' には重複がないため、この条件は常に '{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 を返します。代わりにこれを呼び出すことを意図していましたか?", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "このコンストラクター関数はクラス宣言に変換される可能性があります。", @@ -1491,7 +1495,7 @@ "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114": "このメンバーは、基底クラス '{0}' のメンバーをオーバーライドするため、'override' 修飾子を指定する必要があります。", "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "このメンバーは、基底クラス '{0}' で宣言された抽象メソッドをオーバーライドするため、'override' 修飾子を指定する必要があります。", "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "このモジュールは、'{0}' フラグをオンにして既定のエクスポートを参照することにより、ECMAScript のインポートまたはエクスポートのみを使用して参照できます。", - "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594": "このモジュールは 'export =' を使用して宣言されていて、'{0}' フラグを使用する場合は既定のインポートでのみ使用できます。", + "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "このモジュールは、'export =' を使用して宣言されており、'{0}' フラグを使用する場合は既定のインポートでのみ使用できます。", "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "このオーバーロード シグネチャには、実装シグネチャとの互換性はありません。", "This_parameter_is_not_allowed_with_use_strict_directive_1346": "このパラメーターは、'use strict' ディレクティブと共に使用することはできません。", "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120": "このパラメーター プロパティには、基底クラス '{0}' のメンバーをオーバーライドするため、'@override' タグを含む JSDoc コメントが必要です。", @@ -1504,6 +1508,10 @@ "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "この構文には、{2} パラメーターを持つ '{1}' という名前のインポートされたヘルパーが必要ですが、'{0}' にあるものと互換性がありません。'{0}' のバージョンをアップグレードすることをご検討ください。", "This_type_parameter_might_need_an_extends_0_constraint_2208": "この型パラメーターには 'extends {0}' 制約が必要な場合があります。", "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "この 'import' の使用は無効です。'import()' 呼び出しは書き込むことができますが、かっこが必要であり、型引数を指定することはできません。", + "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482": "このファイルを ECMAScript モジュールに変換するには、フィールド '\"type\": \"module\"' を '{0}' に追加します。", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481": "このファイルを ECMAScript モジュールに変換するには、ファイル拡張子を '{0}' に変更するか、フィールド '\"type\": \"module\"' を '{1}' に追加します。", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480": "このファイルを ECMAScript モジュールに変換するには、ファイル拡張子を '{0}' に変更するか、'{ \"type\": \"module\" }' を含むローカルの package.json ファイルを作成します。", + "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483": "このファイルを ECMAScript モジュールに変換するには、'{ \"type\": \"module\" }' を含むローカルの package.json ファイルを作成します。", "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "トップレベルの 'await' 式は、'module' オプションが 'es2022'、'esnext'、'system'、'node16' または 'nodenext' に設定されていて、'target' オプションが 'es2017' 以上に設定されている場合にのみ使用できます。", "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": ".d.ts ファイルのトップレベルの宣言は、'declare' または 'export' 修飾子で始める必要があります。", "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "トップレベルの 'for await' ループは、'module' オプションが 'es2022'、'esnext'、'system'、'node16'、または 'nodenext' に設定されていて、'target' オプションが 'es2017' 以上に設定されている場合にのみ使用できます。", @@ -1519,6 +1527,7 @@ "Type_0_cannot_be_used_as_an_index_type_2538": "型 '{0}' はインデックスの型として使用できません。", "Type_0_cannot_be_used_to_index_type_1_2536": "型 '{0}' はインデックスの種類 '{1}' に使用できません。", "Type_0_does_not_satisfy_the_constraint_1_2344": "型 '{0}' は制約 '{1}' を満たしていません。", + "Type_0_does_not_satisfy_the_expected_type_1_1360": "型 '{0}' は想定された型 '{1}' を満たしていません。", "Type_0_has_no_call_signatures_2757": "型 '{0}' には呼び出しシグネチャがありません。", "Type_0_has_no_construct_signatures_2761": "型 '{0}' にはコンストラクト シグネチャがありません。", "Type_0_has_no_matching_index_signature_for_type_1_2537": "型 '{0}' には型 '{1}' と一致するインデックス シグネチャがありません。", @@ -1540,6 +1549,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}' に一致するものがありません。", @@ -1596,6 +1606,7 @@ "Type_reference_directive_0_was_not_resolved_6120": "======== 型参照ディレクティブ '{0}' が解決されませんでした。========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== 型参照ディレクティブ '{0}' が正常に '{1}' に解決されました。プライマリ: {2}。========", "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219": "======== 型参照ディレクティブ '{0}' が正常に '{1}' に解決されました (パッケージ ID '{2}'、プライマリ: {3})。========", + "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037": "型充足式は TypeScript ファイルでのみ使用できます。", "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043": "JavaScript ファイルのエクスポート宣言に型を含めることはできません。", "Types_have_separate_declarations_of_a_private_property_0_2442": "複数の型に、プライベート プロパティ '{0}' の異なる宣言が含まれています。", "Types_of_construct_signatures_are_incompatible_2419": "コンストラクト シグネチャの型に互換性がありません。", @@ -1717,6 +1728,10 @@ "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "'{0}' はキーワード '{1}' に関するメタプロパティとして無効です。候補: '{2}'。", "_0_is_not_allowed_as_a_parameter_name_1390": "'{0}' はパラメーター名として使用できません。", "_0_is_not_allowed_as_a_variable_declaration_name_1389": "'{0}' は変数宣言の名前として使用できません。", + "_0_is_of_type_unknown_18046": "'{0}''は 'unknown' 型です。", + "_0_is_possibly_null_18047": "'{0}' は 'null' の可能性があります。", + "_0_is_possibly_null_or_undefined_18049": "'{0}' は 'null' か 'undefined' の可能性があります。", + "_0_is_possibly_undefined_18048": "'{0}' は 'undefined' の可能性があります。", "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "'{0}' はそれ自身のベース式内で直接または間接的に参照されます。", "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "'{0}' はそれ自身の型の注釈内で直接または間接的に参照されます。", "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783": "'{0}' が複数回指定されているため、ここでの使用は上書きされます。", @@ -1752,6 +1767,7 @@ "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "'{0}' には戻り値の型の注釈がないため、戻り値の型は暗黙的に '{1}' になります。", "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "'{0}' には戻り値の型の注釈がないため、yield 型は暗黙的に '{1}' になります。", "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "'abstract' 修飾子は、クラス宣言、メソッド宣言、またはプロパティ宣言のみに使用できます。", + "accessor_modifier_can_only_appear_on_a_property_declaration_1275": "'accessor' 修飾子は、プロパティ宣言でのみ使用できます。", "and_here_6204": "およびここで。", "arguments_cannot_be_referenced_in_property_initializers_2815": "プロパティ初期化子で 'arguments' を参照することはできません。", "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "\"auto\": インポート、エクスポート、import.meta、jsx (jsx: react-jsx を使用)、または esm 形式 (モジュール: node16+) でファイルをモジュールとして扱います。", diff --git a/lib/ko/diagnosticMessages.generated.json b/lib/ko/diagnosticMessages.generated.json index e60bffb9ec3..4d9732bbcff 100644 --- a/lib/ko/diagnosticMessages.generated.json +++ b/lib/ko/diagnosticMessages.generated.json @@ -186,6 +186,7 @@ "An_abstract_accessor_cannot_have_an_implementation_1318": "추상 접근자는 구현이 있을 수 없습니다.", "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "접근성 한정자는 프라이빗 식별자와 함께 사용할 수 없습니다.", "An_accessor_cannot_have_type_parameters_1094": "접근자에는 형식 매개 변수를 사용할 수 없습니다.", + "An_accessor_property_cannot_be_declared_optional_1276": "'accessor' 속성은 선택 사항으로 선언할 수 없습니다.", "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "앰비언트 모듈 선언은 파일의 최상위에서만 사용할 수 있습니다.", "An_argument_for_0_was_not_provided_6210": "'{0}'의 인수가 제공되지 않았습니다.", "An_argument_matching_this_binding_pattern_was_not_provided_6211": "이 바인딩 패턴과 일치하는 인수가 제공되지 않았습니다.", @@ -382,7 +383,7 @@ "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720": "'{0}' 클래스가 '{1}' 클래스를 잘못 구현합니다. '{1}'을(를) 확장하고 이 클래스의 멤버를 하위 클래스로 상속하시겠습니까?", "Class_0_incorrectly_implements_interface_1_2420": "'{0}' 클래스가 '{1}' 인터페이스를 잘못 구현합니다.", "Class_0_used_before_its_declaration_2449": "선언 전에 사용된 '{0}' 클래스입니다.", - "Class_constructor_may_not_be_a_generator_1360": "클래스 생성자는 생성기가 아닐 수 있습니다.", + "Class_constructor_may_not_be_a_generator_1368": "클래스 생성자는 생성기가 아닐 수 있습니다.", "Class_constructor_may_not_be_an_accessor_1341": "클래스 생성자는 접근자가 아닐 수 있습니다.", "Class_declaration_cannot_implement_overload_list_for_0_2813": "클래스 선언에서 '{0}'에 대한 오버로드 목록을 구현할 수 없습니다.", "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025": "클래스 선언은 '@augments' 또는 '@extends' 태그를 둘 이상 가질 수 없습니다.", @@ -430,6 +431,7 @@ "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "'{0}' 형식을 '{1}' 형식으로 변환한 작업은 실수일 수 있습니다. 두 형식이 서로 충분히 겹치지 않기 때문입니다. 의도적으로 변환한 경우에는 먼저 'unknown'으로 식을 변환합니다.", "Convert_0_to_1_in_0_95003": "'{0}'을(를) '{0}의 {1}'(으)로 변환", "Convert_0_to_mapped_object_type_95055": "'{0}'을(를) 매핑된 개체 형식으로 변환", + "Convert_all_const_to_let_95102": "모든 'const'를 'let'으로 변환", "Convert_all_constructor_functions_to_classes_95045": "모든 생성자 함수를 클래스로 변환", "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "값으로 사용되지 않는 모든 가져오기를 형식 전용 가져오기로 변환", "Convert_all_invalid_characters_to_HTML_entity_code_95101": "모든 잘못된 문자를 HTML 엔터티 코드로 변환", @@ -919,7 +921,7 @@ "Method_not_implemented_95158": "메서드가 구현되지 않았습니다.", "Modifiers_cannot_appear_here_1184": "한정자를 여기에 표시할 수 없습니다.", "Module_0_can_only_be_default_imported_using_the_1_flag_1259": "'{0}' 모듈은 '{1}' 플래그를 사용하는 가져온 기본값이어야만 합니다.", - "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "이 구성을 사용하여 모듈 '{0}'을(를) 가져올 수 없습니다. 지정자는 동기적으로 가져올 수 없는 ES 모듈로만 확인됩니다. 대신 동적 가져오기를 사용하세요.", + "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "이 구문을 사용하여 '{0}' 모듈을 가져올 수 없습니다. 지정자는 'require'로 가져올 수 없는 ES 모듈로만 확인됩니다. ECMAScript 가져오기를 대신 사용하세요.", "Module_0_declares_1_locally_but_it_is_exported_as_2_2460": "'{0}' 모듈은 '{1}'을(를) 로컬로 선언하지만, 모듈을 '{2}'(으)로 내보냅니다.", "Module_0_declares_1_locally_but_it_is_not_exported_2459": "'{0}' 모듈은 '{1}'을(를) 로컬로 선언하지만, 모듈을 내보내지 않습니다.", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340": "모듈 '{0}'은(는) 형식을 참조하지 않지만, 여기에서 형식으로 사용됩니다. 'typeof 가져오기('{0}')'를 사용하시겠습니까?", @@ -1103,6 +1105,7 @@ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "'{1}' 출력 파일이 존재하지 않기 때문에 '{0}' 프로젝트가 최신 상태가 아닙니다.", "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "'{0}' 프로젝트의 출력이 현재 버전 '{2}'과(와) 다른 '{1}' 버전으로 생성되었기 때문에 이 프로젝트가 최신 상태가 아닙니다.", "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "'{1}' 종속성의 출력이 변경되었기 때문에 '{0}' 프로젝트가 최신 상태가 아닙니다.", + "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401": "'{1}' 파일을 읽는 동안 오류가 발생하여 프로젝트 '{0}'이(가) 만료되었습니다.", "Project_0_is_up_to_date_6361": "'{0}' 프로젝트가 최신 상태입니다.", "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "최신 입력 '{1}'이(가) 출력 '{2}'보다 오래되었기 때문에 '{0}' 프로젝트가 최신 상태입니다.", "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "프로젝트 '{0}'이(가) 최신 상태이지만 입력 파일보다 오래된 출력 파일의 타임스탬프를 업데이트해야 합니다.", @@ -1110,6 +1113,7 @@ "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "프로젝트 참조는 순환 그래프를 형성할 수 없습니다. 순환이 발견되었습니다. {0}", "Projects_6255": "프로젝트", "Projects_in_this_build_Colon_0_6355": "이 빌드의 프로젝트: {0}", + "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "'accessor' 한정자가 있는 속성은 ECMAScript 2015 이상을 대상으로 하는 경우에만 사용할 수 있습니다.", "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "'{0}' 속성은 추상으로 표시되어 있으므로 이니셜라이저를 사용할 수 없습니다.", "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "'{0}' 속성은 인덱스 시그니처에서 가져오는 것이므로 ['{0}']을(를) 사용하여 액세스해야 합니다.", "Property_0_does_not_exist_on_type_1_2339": "'{1}' 형식에 '{0}' 속성이 없습니다.", @@ -1385,6 +1389,7 @@ "The_containing_arrow_function_captures_the_global_value_of_this_7041": "포함하는 화살표 함수는 'this'의 전역 값을 캡처합니다.", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "제어 흐름 분석에 대해 포함된 함수 또는 모듈 본문이 너무 큽니다.", "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "현재 파일은 CommonJS 모듈이며 최상위 수준에서 'await'를 사용할 수 없습니다.", + "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479": "현재 파일은 가져오기에서 'require' 호출을 생성하는 CommonJS 모듈입니다. 그러나 참조된 파일은 ECMAScript 모듈이며 'require'로 가져올 수 없습니다. 대신 동적 'import(\"{0}\")' 호출을 작성하는 것이 좋습니다.", "The_current_host_does_not_support_the_0_option_5001": "현재 호스트가 '{0}' 옵션을 지원하지 않습니다.", "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "사용하려는 '{0}'의 선언이 여기서 정의됩니다.", "The_declaration_was_marked_as_deprecated_here_2798": "선언이 여기에 사용되지 않음으로 표시되었습니다.", @@ -1422,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 파일을 로드할 최대 종속성 깊이입니다.", @@ -1443,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}'의 섀도 선언이 정의됩니다.", @@ -1464,13 +1467,14 @@ "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490": "반복기의 '{0}()' 메서드에 의해 반환되는 형식에는 'value' 속성이 있어야 합니다.", "The_types_of_0_are_incompatible_between_these_types_2200": "'{0}'의 형식은 해당 형식 간에 호환되지 않습니다.", "The_types_returned_by_0_are_incompatible_between_these_types_2201": "'{0}'에서 반환되는 형식은 해당 형식 간에 호환되지 않습니다.", + "The_value_0_cannot_be_used_here_18050": "여기서는 '{0}' 값을 사용할 수 없습니다.", "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "'for...in' 문의 변수 선언에 이니셜라이저가 포함될 수 없습니다.", "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "'for...of' 문의 변수 선언에 이니셜라이저가 포함될 수 없습니다.", "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "'with' 문은 지원되지 않습니다. 'with' 블록의 모든 기호가 'any' 형식이 됩니다.", "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_since_JavaScript_compares_objects_by_reference_not_value_2839": "JavaScript는 값이 아닌 참조로 개체를 비교하므로 이 조건은 항상 '{0}'을(를) 반환합니다.", - "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367": "'{1}' 및 '{2}' 형식에 겹침이 없기 때문에 이 조건은 항상 '{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를 반환합니다. 대신 호출하시겠어요?", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "이 생성자 함수는 클래스 선언으로 변환될 수 있습니다.", @@ -1491,7 +1495,7 @@ "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114": "이 멤버는 기본 클래스 '{0}'의 멤버를 재정의하므로 'override' 한정자를 포함해야 합니다.", "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "이 멤버는 기본 클래스 '{0}'에 선언된 추상 메서드를 재정의하므로 'override' 한정자를 포함해야 합니다.", "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "이 모듈은 '{0}' 플래그를 켜고 기본 내보내기를 참조하여 ECMAScript 가져오기/내보내기를 통해서만 참조할 수 있습니다.", - "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594": "이 모듈은 'export ='를 사용하여 선언되었으며 '{0}' 플래그를 사용하는 경우에만 기본 가져오기와 함께 사용할 수 있습니다.", + "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "이 모듈은 'export ='를 사용하여 선언되었으며 '{0}' 플래그를 사용하는 경우에만 기본 가져오기와 함께 사용할 수 있습니다.", "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "이 오버로드 시그니처는 해당 구현 시그니처와 호환되지 않습니다.", "This_parameter_is_not_allowed_with_use_strict_directive_1346": "이 매개 변수는 'use strict' 지시문에서 사용할 수 없습니다.", "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120": "이 매개변수 속성은 기본 클래스 '{0}'의 멤버를 재정의하므로 '@override' 태그가 있는 JSDoc 주석이 있어야 합니다.", @@ -1504,6 +1508,10 @@ "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "이 구문에는 {2} 매개 변수가 포함된 '{1}'(이)라는 가져온 도우미가 필요하지만, 이 도우미는 '{0}'에 있는 도우미와 호환되지 않습니다. '{0}' 버전을 업그레이드하는 것이 좋습니다.", "This_type_parameter_might_need_an_extends_0_constraint_2208": "이 형식 매개 변수에는 `extends {0}` 제약 조건이 필요할 수 있습니다.", "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "이 '가져오기' 사용은 유효하지 않습니다. 'import()' 호출을 작성할 수 있지만 괄호가 있어야 하며 유형 인수를 가질 수 없습니다.", + "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482": "이 파일을 ECMAScript 모듈로 변환하려면 `\"type\": \"module\"` 필드를 '{0}'에 추가하세요.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481": "이 파일을 ECMAScript 모듈로 변환하려면 파일 확장명을 '{0}'(으)로 변경하거나 `\"type\": \"module\"` 필드를 '{1}'에 추가하세요.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480": "이 파일을 ECMAScript 모듈로 변환하려면 파일 확장명을 '{0}'(으)로 변경하거나 `{ \"type\": \"module\" }`을 사용하여 로컬 package.json 파일을 만드세요.", + "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483": "이 파일을 ECMAScript 모듈로 변환하려면 `{ \"type\": \"module\" }`을 사용하여 로컬 package.json 파일을 만드세요.", "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "최상위 'await' 식은 'module' 옵션이 'es2022', 'esnext', 'system', 'node16' 또는 'nodenext'로 설정되고 'target' 옵션이 'es2017' 이상으로 설정된 경우에만 허용됩니다.", "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": ".d.ts 파일의 최상위 수준 선언은 'declare' 또는 'export' 한정자로 시작해야 합니다.", "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "최상위 'for await' 루프는 'module' 옵션이 'es2022', 'esnext', 'system', 'node16' 또는 'nodenext'로 설정되고 'target' 옵션이 'es2017' 이상으로 설정된 경우에만 허용됩니다.", @@ -1519,6 +1527,7 @@ "Type_0_cannot_be_used_as_an_index_type_2538": "'{0}' 형식을 인덱스 형식으로 사용할 수 없습니다.", "Type_0_cannot_be_used_to_index_type_1_2536": "'{0}' 형식을 인덱스 형식 '{1}'에 사용할 수 없습니다.", "Type_0_does_not_satisfy_the_constraint_1_2344": "'{0}' 형식이 '{1}' 제약 조건을 만족하지 않습니다.", + "Type_0_does_not_satisfy_the_expected_type_1_1360": "형식 '{0}'이(가) 필요한 형식 '{1}'을(를) 충족하지 않습니다.", "Type_0_has_no_call_signatures_2757": "'{0}' 형식에 호출 시그니처가 없습니다.", "Type_0_has_no_construct_signatures_2761": "'{0}' 형식에 구문 시그니처가 없습니다.", "Type_0_has_no_matching_index_signature_for_type_1_2537": "'{0}' 형식에 '{1}' 형식에 대한 일치하는 인덱스 시그니처가 없습니다.", @@ -1540,6 +1549,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}' 시그니처에 대한 일치하는 항목을 제공하지 않습니다.", @@ -1596,6 +1606,7 @@ "Type_reference_directive_0_was_not_resolved_6120": "======== 형식 참조 지시문 '{0}'이(가) 확인되지 않았습니다. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== 형식 참조 지시문 '{0}'이(가) '{1}'(으)로 확인되었습니다. 주: {2}. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219": "======== 형식 참조 지시문 '{0}'이(가) 패키지 ID가 '{2}'인 '{1}'(으)로 확인되었습니다. 주: {3}. ========", + "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037": "형식 만족 식은 TypeScript 파일에서만 사용할 수 있습니다.", "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043": "유형은 JavaScript 파일의 내보내기 선언에 나타날 수 없습니다.", "Types_have_separate_declarations_of_a_private_property_0_2442": "형식에 별도의 프라이빗 속성 '{0}' 선언이 있습니다.", "Types_of_construct_signatures_are_incompatible_2419": "구문 시그니처 형식이 호환되지 않습니다.", @@ -1717,6 +1728,10 @@ "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "'{0}'은(는) '{1}' 키워드에 대한 올바른 메타 속성이 아닙니다. '{2}'을(를) 사용하시겠습니까?", "_0_is_not_allowed_as_a_parameter_name_1390": "'{0}'은(는) 매개 변수 이름으로 사용할 수 없습니다.", "_0_is_not_allowed_as_a_variable_declaration_name_1389": "'{0}'은(는) 변수 선언 이름으로 사용할 수 없습니다.", + "_0_is_of_type_unknown_18046": "'{0}'은(는) 'unknown' 형식입니다.", + "_0_is_possibly_null_18047": "'{0}'은(는) 'null'일 수 있습니다.", + "_0_is_possibly_null_or_undefined_18049": "'{0}'은(는) 'null' 또는 'undefined'일 수 있습니다.", + "_0_is_possibly_undefined_18048": "'{0}'은(는) 'undefined'일 수 있습니다.", "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "'{0}'은(는) 자체 기본 식에서 직간접적으로 참조됩니다.", "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "'{0}'은(는) 자체 형식 주석에서 직간접적으로 참조됩니다.", "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783": "'{0}'이(가) 두 번 이상 지정되어 이 사용량을 덮어씁니다.", @@ -1752,6 +1767,7 @@ "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "반환 형식 주석이 없는 '{0}'에는 암시적으로 '{1}' 반환 형식이 포함됩니다.", "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "반환 형식 주석이 없는 '{0}'에는 암시적으로 '{1}' yield 형식이 포함됩니다.", "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "'abstract' 한정자는 클래스, 메서드 또는 속성 선언에만 나타날 수 있습니다.", + "accessor_modifier_can_only_appear_on_a_property_declaration_1275": "'accessor' 한정자는 속성 선언에만 나타날 수 있습니다.", "and_here_6204": "및 여기.", "arguments_cannot_be_referenced_in_property_initializers_2815": "'arguments'는 속성 이니셜라이저에서 참조할 수 없습니다.", "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "\"auto\": 가져오기, 내보내기, import.meta, jsx(jsx: react-jsx 포함) 또는 esm 형식(모듈: node16+ 포함)이 있는 파일을 모듈로 처리합니다.", diff --git a/lib/lib.dom.d.ts b/lib/lib.dom.d.ts index d1223acc6ff..6db4e11aa59 100644 --- a/lib/lib.dom.d.ts +++ b/lib/lib.dom.d.ts @@ -136,15 +136,12 @@ interface AudioWorkletNodeOptions extends AudioNodeOptions { interface AuthenticationExtensionsClientInputs { appid?: string; - appidExclude?: string; credProps?: boolean; - uvm?: boolean; } interface AuthenticationExtensionsClientOutputs { appid?: boolean; credProps?: CredentialPropertiesOutput; - uvm?: UvmEntries; } interface AuthenticatorSelectionCriteria { @@ -373,7 +370,7 @@ interface DeviceOrientationEventInit extends EventInit { gamma?: number | null; } -interface DisplayMediaStreamConstraints { +interface DisplayMediaStreamOptions { audio?: boolean | MediaTrackConstraints; video?: boolean | MediaTrackConstraints; } @@ -806,10 +803,6 @@ interface MediaQueryListEventInit extends EventInit { media?: string; } -interface MediaRecorderErrorEventInit extends EventInit { - error: DOMException; -} - interface MediaRecorderOptions { audioBitsPerSecond?: number; bitsPerSecond?: number; @@ -819,9 +812,9 @@ interface MediaRecorderOptions { interface MediaSessionActionDetails { action: MediaSessionAction; - fastSeek?: boolean | null; - seekOffset?: number | null; - seekTime?: number | null; + fastSeek?: boolean; + seekOffset?: number; + seekTime?: number; } interface MediaStreamAudioSourceOptions { @@ -1121,6 +1114,10 @@ interface PermissionDescriptor { name: PermissionName; } +interface PictureInPictureEventInit extends EventInit { + pictureInPictureWindow: PictureInPictureWindow; +} + interface PointerEventInit extends MouseEventInit { coalescedEvents?: PointerEvent[]; height?: number; @@ -1314,6 +1311,8 @@ interface RTCIceCandidatePairStats extends RTCStats { bytesReceived?: number; bytesSent?: number; currentRoundTripTime?: number; + lastPacketReceivedTimestamp?: DOMHighResTimeStamp; + lastPacketSentTimestamp?: DOMHighResTimeStamp; localCandidateId: string; nominated?: boolean; remoteCandidateId: string; @@ -1328,18 +1327,45 @@ interface RTCIceCandidatePairStats extends RTCStats { interface RTCIceServer { credential?: string; - credentialType?: RTCIceCredentialType; urls: string | string[]; username?: string; } interface RTCInboundRtpStreamStats extends RTCReceivedRtpStreamStats { + audioLevel?: number; + bytesReceived?: number; + concealedSamples?: number; + concealmentEvents?: number; + decoderImplementation?: string; + estimatedPlayoutTimestamp?: DOMHighResTimeStamp; + fecPacketsDiscarded?: number; + fecPacketsReceived?: number; firCount?: number; + frameHeight?: number; + frameWidth?: number; framesDecoded?: number; + framesPerSecond?: number; + framesReceived?: number; + headerBytesReceived?: number; + insertedSamplesForDeceleration?: number; + jitterBufferDelay?: number; + jitterBufferEmittedCount?: number; + keyFramesDecoded?: number; + kind: string; + lastPacketReceivedTimestamp?: DOMHighResTimeStamp; nackCount?: number; + packetsDiscarded?: number; pliCount?: number; qpSum?: number; remoteId?: string; + removedSamplesForAcceleration?: number; + silentConcealedSamples?: number; + totalAudioEnergy?: number; + totalDecodeTime?: number; + totalInterFrameDelay?: number; + totalSamplesDuration?: number; + totalSamplesReceived?: number; + totalSquaredInterFrameDelay?: number; } interface RTCLocalSessionDescriptionInit { @@ -1358,11 +1384,27 @@ interface RTCOfferOptions extends RTCOfferAnswerOptions { interface RTCOutboundRtpStreamStats extends RTCSentRtpStreamStats { firCount?: number; + frameHeight?: number; + frameWidth?: number; framesEncoded?: number; + framesPerSecond?: number; + framesSent?: number; + headerBytesSent?: number; + hugeFramesSent?: number; + keyFramesEncoded?: number; + mediaSourceId?: string; nackCount?: number; pliCount?: number; qpSum?: number; + qualityLimitationResolutionChanges?: number; remoteId?: string; + retransmittedBytesSent?: number; + retransmittedPacketsSent?: number; + rid?: string; + targetBitrate?: number; + totalEncodeTime?: number; + totalEncodedBytesTarget?: number; + totalPacketSendDelay?: number; } interface RTCPeerConnectionIceErrorEventInit extends EventInit { @@ -1379,8 +1421,8 @@ interface RTCPeerConnectionIceEventInit extends EventInit { } interface RTCReceivedRtpStreamStats extends RTCRtpStreamStats { + framesDropped?: number; jitter?: number; - packetsDiscarded?: number; packetsLost?: number; packetsReceived?: number; } @@ -1499,15 +1541,23 @@ interface RTCTransportStats extends RTCStats { dtlsState: RTCDtlsTransportState; localCertificateId?: string; remoteCertificateId?: string; - rtcpTransportStatsId?: string; selectedCandidatePairId?: string; srtpCipher?: string; tlsVersion?: string; } -interface ReadableStreamReadDoneResult { +interface ReadableStreamGetReaderOptions { + /** + * Creates a ReadableStreamBYOBReader and locks the stream to the new reader. + * + * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation. + */ + mode?: ReadableStreamReaderMode; +} + +interface ReadableStreamReadDoneResult { done: true; - value?: undefined; + value?: T; } interface ReadableStreamReadValueResult { @@ -1791,6 +1841,21 @@ interface ULongRange { min?: number; } +interface UnderlyingByteSource { + autoAllocateChunkSize?: number; + cancel?: UnderlyingSourceCancelCallback; + pull?: (controller: ReadableByteStreamController) => void | PromiseLike; + start?: (controller: ReadableByteStreamController) => any; + type: "bytes"; +} + +interface UnderlyingDefaultSource { + cancel?: UnderlyingSourceCancelCallback; + pull?: (controller: ReadableStreamDefaultController) => void | PromiseLike; + start?: (controller: ReadableStreamDefaultController) => any; + type?: undefined; +} + interface UnderlyingSink { abort?: UnderlyingSinkAbortCallback; close?: UnderlyingSinkCloseCallback; @@ -1800,10 +1865,11 @@ interface UnderlyingSink { } interface UnderlyingSource { + autoAllocateChunkSize?: number; cancel?: UnderlyingSourceCancelCallback; pull?: UnderlyingSourcePullCallback; start?: UnderlyingSourceStartCallback; - type?: undefined; + type?: ReadableStreamType; } interface ValidityStateFlags { @@ -1931,12 +1997,14 @@ interface ARIAMixin { ariaChecked: string | null; ariaColCount: string | null; ariaColIndex: string | null; + ariaColIndexText: string | null; ariaColSpan: string | null; ariaCurrent: string | null; ariaDisabled: string | null; ariaExpanded: string | null; ariaHasPopup: string | null; ariaHidden: string | null; + ariaInvalid: string | null; ariaKeyShortcuts: string | null; ariaLabel: string | null; ariaLevel: string | null; @@ -1953,6 +2021,7 @@ interface ARIAMixin { ariaRoleDescription: string | null; ariaRowCount: string | null; ariaRowIndex: string | null; + ariaRowIndexText: string | null; ariaRowSpan: string | null; ariaSelected: string | null; ariaSetSize: string | null; @@ -1961,6 +2030,7 @@ interface ARIAMixin { ariaValueMin: string | null; ariaValueNow: string | null; ariaValueText: string | null; + role: string | null; } /** A controller object that allows you to abort one or more DOM requests as and when desired. */ @@ -1997,6 +2067,7 @@ declare var AbortSignal: { prototype: AbortSignal; new(): AbortSignal; // abort(): AbortSignal; - To be re-added in the future + timeout(milliseconds: number): AbortSignal; }; interface AbstractRange { @@ -2147,6 +2218,7 @@ interface Attr extends Node { readonly ownerDocument: Document; readonly ownerElement: Element | null; readonly prefix: string | null; + /** @deprecated */ readonly specified: boolean; value: string; } @@ -2382,6 +2454,8 @@ declare var AuthenticatorAssertionResponse: { /** Available only in secure contexts. */ interface AuthenticatorAttestationResponse extends AuthenticatorResponse { readonly attestationObject: ArrayBuffer; + getAuthenticatorData(): ArrayBuffer; + getTransports(): string[]; } declare var AuthenticatorAttestationResponse: { @@ -2608,6 +2682,18 @@ declare var CSSFontFaceRule: { new(): CSSFontFaceRule; }; +interface CSSFontPaletteValuesRule extends CSSRule { + readonly basePalette: string; + readonly fontFamily: string; + readonly name: string; + readonly overrideColors: string; +} + +declare var CSSFontPaletteValuesRule: { + prototype: CSSFontPaletteValuesRule; + new(): CSSFontPaletteValuesRule; +}; + /** Any CSS at-rule that contains other rules nested within it. */ interface CSSGroupingRule extends CSSRule { readonly cssRules: CSSRuleList; @@ -2622,6 +2708,7 @@ declare var CSSGroupingRule: { interface CSSImportRule extends CSSRule { readonly href: string; + readonly layerName: string | null; readonly media: MediaList; readonly styleSheet: CSSStyleSheet; } @@ -2656,6 +2743,24 @@ declare var CSSKeyframesRule: { new(): CSSKeyframesRule; }; +interface CSSLayerBlockRule extends CSSGroupingRule { + readonly name: string; +} + +declare var CSSLayerBlockRule: { + prototype: CSSLayerBlockRule; + new(): CSSLayerBlockRule; +}; + +interface CSSLayerStatementRule extends CSSRule { + readonly nameList: ReadonlyArray; +} + +declare var CSSLayerStatementRule: { + prototype: CSSLayerStatementRule; + new(): CSSLayerStatementRule; +}; + /** A single CSS @media rule. It implements the CSSConditionRule interface, and therefore the CSSGroupingRule and the CSSRule interface with a type value of 4 (CSSRule.MEDIA_RULE). */ interface CSSMediaRule extends CSSConditionRule { readonly media: MediaList; @@ -2753,6 +2858,7 @@ interface CSSStyleDeclaration { animationTimingFunction: string; appearance: string; aspectRatio: string; + backdropFilter: string; backfaceVisibility: string; background: string; backgroundAttachment: string; @@ -2887,6 +2993,7 @@ interface CSSStyleDeclaration { fontFeatureSettings: string; fontKerning: string; fontOpticalSizing: string; + fontPalette: string; fontSize: string; fontSizeAdjust: string; fontStretch: string; @@ -3518,6 +3625,7 @@ interface CanvasText { interface CanvasTextDrawingStyles { direction: CanvasDirection; font: string; + fontKerning: CanvasFontKerning; textAlign: CanvasTextAlign; textBaseline: CanvasTextBaseline; } @@ -4379,7 +4487,10 @@ interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShad readonly documentElement: HTMLElement; /** Returns document's URL. */ readonly documentURI: string; - /** Sets or gets the security domain of the document. */ + /** + * Sets or gets the security domain of the document. + * @deprecated + */ domain: string; /** Retrieves a collection of all embed objects in the document. */ readonly embeds: HTMLCollectionOf; @@ -4533,7 +4644,6 @@ interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShad createEvent(eventInterface: "MediaEncryptedEvent"): MediaEncryptedEvent; createEvent(eventInterface: "MediaKeyMessageEvent"): MediaKeyMessageEvent; createEvent(eventInterface: "MediaQueryListEvent"): MediaQueryListEvent; - createEvent(eventInterface: "MediaRecorderErrorEvent"): MediaRecorderErrorEvent; createEvent(eventInterface: "MediaStreamTrackEvent"): MediaStreamTrackEvent; createEvent(eventInterface: "MessageEvent"): MessageEvent; createEvent(eventInterface: "MouseEvent"): MouseEvent; @@ -4544,6 +4654,7 @@ interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShad createEvent(eventInterface: "PageTransitionEvent"): PageTransitionEvent; createEvent(eventInterface: "PaymentMethodChangeEvent"): PaymentMethodChangeEvent; createEvent(eventInterface: "PaymentRequestUpdateEvent"): PaymentRequestUpdateEvent; + createEvent(eventInterface: "PictureInPictureEvent"): PictureInPictureEvent; createEvent(eventInterface: "PointerEvent"): PointerEvent; createEvent(eventInterface: "PopStateEvent"): PopStateEvent; createEvent(eventInterface: "ProgressEvent"): ProgressEvent; @@ -4662,6 +4773,7 @@ interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShad /** * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. * @param commandId String that specifies a command identifier. + * @deprecated */ queryCommandIndeterm(commandId: string): boolean; /** @@ -4679,6 +4791,7 @@ interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShad /** * Returns the current value of the document, range, or current selection for the given command. * @param commandId String that specifies a command identifier. + * @deprecated */ queryCommandValue(commandId: string): string; /** @deprecated */ @@ -4837,6 +4950,13 @@ interface EXT_sRGB { interface EXT_shader_texture_lod { } +interface EXT_texture_compression_bptc { + readonly COMPRESSED_RGBA_BPTC_UNORM_EXT: GLenum; + readonly COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT: GLenum; + readonly COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT: GLenum; + readonly COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT: GLenum; +} + interface EXT_texture_compression_rgtc { readonly COMPRESSED_RED_GREEN_RGTC2_EXT: GLenum; readonly COMPRESSED_RED_RGTC1_EXT: GLenum; @@ -5032,6 +5152,7 @@ declare var ErrorEvent: { interface Event { /** Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. */ readonly bubbles: boolean; + /** @deprecated */ cancelBubble: boolean; /** Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. */ readonly cancelable: boolean; @@ -5568,6 +5689,7 @@ interface GlobalEventHandlersEventMap { "auxclick": MouseEvent; "beforeinput": InputEvent; "blur": FocusEvent; + "cancel": Event; "canplay": Event; "canplaythrough": Event; "change": Event; @@ -5668,11 +5790,13 @@ interface GlobalEventHandlers { onanimationiteration: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null; onanimationstart: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null; onauxclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + onbeforeinput: ((this: GlobalEventHandlers, ev: InputEvent) => any) | null; /** * Fires when the object loses the input focus. * @param ev The focus event. */ onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null; + oncancel: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** * Occurs when playback is possible, but would require further buffering. * @param ev The event. @@ -8769,13 +8893,13 @@ declare var IDBObjectStore: { }; interface IDBOpenDBRequestEventMap extends IDBRequestEventMap { - "blocked": Event; + "blocked": IDBVersionChangeEvent; "upgradeneeded": IDBVersionChangeEvent; } /** Also inherits methods from its parents IDBRequest and EventTarget. */ interface IDBOpenDBRequest extends IDBRequest { - onblocked: ((this: IDBOpenDBRequest, ev: Event) => any) | null; + onblocked: ((this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any) | null; onupgradeneeded: ((this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any) | null; addEventListener(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -9184,7 +9308,7 @@ interface MediaDevicesEventMap { interface MediaDevices extends EventTarget { ondevicechange: ((this: MediaDevices, ev: Event) => any) | null; enumerateDevices(): Promise; - getDisplayMedia(constraints?: DisplayMediaStreamConstraints): Promise; + getDisplayMedia(options?: DisplayMediaStreamOptions): Promise; getSupportedConstraints(): MediaTrackSupportedConstraints; getUserMedia(constraints?: MediaStreamConstraints): Promise; addEventListener(type: K, listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; @@ -9391,7 +9515,7 @@ declare var MediaQueryListEvent: { interface MediaRecorderEventMap { "dataavailable": BlobEvent; - "error": MediaRecorderErrorEvent; + "error": Event; "pause": Event; "resume": Event; "start": Event; @@ -9402,7 +9526,7 @@ interface MediaRecorder extends EventTarget { readonly audioBitsPerSecond: number; readonly mimeType: string; ondataavailable: ((this: MediaRecorder, ev: BlobEvent) => any) | null; - onerror: ((this: MediaRecorder, ev: MediaRecorderErrorEvent) => any) | null; + onerror: ((this: MediaRecorder, ev: Event) => any) | null; onpause: ((this: MediaRecorder, ev: Event) => any) | null; onresume: ((this: MediaRecorder, ev: Event) => any) | null; onstart: ((this: MediaRecorder, ev: Event) => any) | null; @@ -9427,15 +9551,6 @@ declare var MediaRecorder: { isTypeSupported(type: string): boolean; }; -interface MediaRecorderErrorEvent extends Event { - readonly error: DOMException; -} - -declare var MediaRecorderErrorEvent: { - prototype: MediaRecorderErrorEvent; - new(type: string, eventInitDict: MediaRecorderErrorEventInit): MediaRecorderErrorEvent; -}; - interface MediaSession { metadata: MediaMetadata | null; playbackState: MediaSessionPlaybackState; @@ -9888,12 +10003,14 @@ interface NavigatorID { readonly appName: string; /** @deprecated */ readonly appVersion: string; + /** @deprecated */ readonly platform: string; /** @deprecated */ readonly product: string; /** @deprecated */ readonly productSub: string; readonly userAgent: string; + /** @deprecated */ readonly vendor: string; /** @deprecated */ readonly vendorSub: string; @@ -10680,6 +10797,7 @@ interface PermissionStatusEventMap { } interface PermissionStatus extends EventTarget { + readonly name: string; onchange: ((this: PermissionStatus, ev: Event) => any) | null; readonly state: PermissionState; addEventListener(type: K, listener: (this: PermissionStatus, ev: PermissionStatusEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; @@ -10702,6 +10820,15 @@ declare var Permissions: { new(): Permissions; }; +interface PictureInPictureEvent extends Event { + readonly pictureInPictureWindow: PictureInPictureWindow; +} + +declare var PictureInPictureEvent: { + prototype: PictureInPictureEvent; + new(type: string, eventInitDict: PictureInPictureEventInit): PictureInPictureEvent; +}; + interface PictureInPictureWindowEventMap { "resize": Event; } @@ -10853,6 +10980,7 @@ declare var PromiseRejectionEvent: { /** Available only in secure contexts. */ interface PublicKeyCredential extends Credential { + readonly authenticatorAttachment: string | null; readonly rawId: ArrayBuffer; readonly response: AuthenticatorResponse; getClientExtensionResults(): AuthenticationExtensionsClientOutputs; @@ -10901,6 +11029,7 @@ declare var PushSubscription: { /** Available only in secure contexts. */ interface PushSubscriptionOptions { readonly applicationServerKey: ArrayBuffer | null; + readonly userVisibleOnly: boolean; } declare var PushSubscriptionOptions: { @@ -11385,7 +11514,9 @@ declare var ReadableByteStreamController: { interface ReadableStream { readonly locked: boolean; cancel(reason?: any): Promise; + getReader(options: { mode: "byob" }): ReadableStreamBYOBReader; getReader(): ReadableStreamDefaultReader; + getReader(options?: ReadableStreamGetReaderOptions): ReadableStreamReader; pipeThrough(transform: ReadableWritablePair, options?: StreamPipeOptions): ReadableStream; pipeTo(destination: WritableStream, options?: StreamPipeOptions): Promise; tee(): [ReadableStream, ReadableStream]; @@ -11393,11 +11524,13 @@ interface ReadableStream { declare var ReadableStream: { prototype: ReadableStream; + new(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number }): ReadableStream; + new(underlyingSource: UnderlyingDefaultSource, strategy?: QueuingStrategy): ReadableStream; new(underlyingSource?: UnderlyingSource, strategy?: QueuingStrategy): ReadableStream; }; interface ReadableStreamBYOBReader extends ReadableStreamGenericReader { - read(view: ArrayBufferView): Promise>; + read(view: T): Promise>; releaseLock(): void; } @@ -13018,6 +13151,7 @@ interface SVGStyleElement extends SVGElement, LinkStyle { disabled: boolean; media: string; title: string; + /** @deprecated */ type: string; addEventListener(type: K, listener: (this: SVGStyleElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -13380,6 +13514,7 @@ interface Selection { empty(): void; extend(node: Node, offset?: number): void; getRangeAt(index: number): Range; + modify(alter?: string, direction?: string, granularity?: string): void; removeAllRanges(): void; removeRange(range: Range): void; selectAllChildren(node: Node): void; @@ -13778,6 +13913,7 @@ interface StorageEvent extends Event { readonly storageArea: Storage | null; /** Returns the URL of the document whose storage item changed. */ readonly url: string; + /** @deprecated */ initStorageEvent(type: string, bubbles?: boolean, cancelable?: boolean, key?: string | null, oldValue?: string | null, newValue?: string | null, url?: string | URL, storageArea?: Storage | null): void; } @@ -14560,8 +14696,8 @@ interface WEBGL_lose_context { interface WEBGL_multi_draw { multiDrawArraysInstancedWEBGL(mode: GLenum, firstsList: Int32Array | GLint[], firstsOffset: GLuint, countsList: Int32Array | GLsizei[], countsOffset: GLuint, instanceCountsList: Int32Array | GLsizei[], instanceCountsOffset: GLuint, drawcount: GLsizei): void; multiDrawArraysWEBGL(mode: GLenum, firstsList: Int32Array | GLint[], firstsOffset: GLuint, countsList: Int32Array | GLsizei[], countsOffset: GLuint, drawcount: GLsizei): void; - multiDrawElementsInstancedWEBGL(mode: GLenum, countsList: Int32Array | GLint[], countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | GLsizei[], offsetsOffset: GLuint, instanceCountsList: Int32Array | GLsizei[], instanceCountsOffset: GLuint, drawcount: GLsizei): void; - multiDrawElementsWEBGL(mode: GLenum, countsList: Int32Array | GLint[], countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | GLsizei[], offsetsOffset: GLuint, drawcount: GLsizei): void; + multiDrawElementsInstancedWEBGL(mode: GLenum, countsList: Int32Array | GLsizei[], countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | GLsizei[], offsetsOffset: GLuint, instanceCountsList: Int32Array | GLsizei[], instanceCountsOffset: GLuint, drawcount: GLsizei): void; + multiDrawElementsWEBGL(mode: GLenum, countsList: Int32Array | GLsizei[], countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | GLsizei[], offsetsOffset: GLuint, drawcount: GLsizei): void; } /** A WaveShaperNode always has exactly one input and one output. */ @@ -15971,35 +16107,39 @@ interface WebGLRenderingContextBase { getBufferParameter(target: GLenum, pname: GLenum): any; getContextAttributes(): WebGLContextAttributes | null; getError(): GLenum; + getExtension(extensionName: "ANGLE_instanced_arrays"): ANGLE_instanced_arrays | null; getExtension(extensionName: "EXT_blend_minmax"): EXT_blend_minmax | null; getExtension(extensionName: "EXT_color_buffer_float"): EXT_color_buffer_float | null; getExtension(extensionName: "EXT_color_buffer_half_float"): EXT_color_buffer_half_float | null; getExtension(extensionName: "EXT_float_blend"): EXT_float_blend | null; - getExtension(extensionName: "EXT_texture_filter_anisotropic"): EXT_texture_filter_anisotropic | null; getExtension(extensionName: "EXT_frag_depth"): EXT_frag_depth | null; - getExtension(extensionName: "EXT_shader_texture_lod"): EXT_shader_texture_lod | null; getExtension(extensionName: "EXT_sRGB"): EXT_sRGB | null; + getExtension(extensionName: "EXT_shader_texture_lod"): EXT_shader_texture_lod | null; + getExtension(extensionName: "EXT_texture_compression_bptc"): EXT_texture_compression_bptc | null; + getExtension(extensionName: "EXT_texture_compression_rgtc"): EXT_texture_compression_rgtc | null; + getExtension(extensionName: "EXT_texture_filter_anisotropic"): EXT_texture_filter_anisotropic | null; getExtension(extensionName: "KHR_parallel_shader_compile"): KHR_parallel_shader_compile | null; + getExtension(extensionName: "OES_element_index_uint"): OES_element_index_uint | null; + getExtension(extensionName: "OES_fbo_render_mipmap"): OES_fbo_render_mipmap | null; + getExtension(extensionName: "OES_standard_derivatives"): OES_standard_derivatives | null; + getExtension(extensionName: "OES_texture_float"): OES_texture_float | null; + getExtension(extensionName: "OES_texture_float_linear"): OES_texture_float_linear | null; + getExtension(extensionName: "OES_texture_half_float"): OES_texture_half_float | null; + getExtension(extensionName: "OES_texture_half_float_linear"): OES_texture_half_float_linear | null; getExtension(extensionName: "OES_vertex_array_object"): OES_vertex_array_object | null; getExtension(extensionName: "OVR_multiview2"): OVR_multiview2 | null; getExtension(extensionName: "WEBGL_color_buffer_float"): WEBGL_color_buffer_float | null; getExtension(extensionName: "WEBGL_compressed_texture_astc"): WEBGL_compressed_texture_astc | null; getExtension(extensionName: "WEBGL_compressed_texture_etc"): WEBGL_compressed_texture_etc | null; getExtension(extensionName: "WEBGL_compressed_texture_etc1"): WEBGL_compressed_texture_etc1 | null; + getExtension(extensionName: "WEBGL_compressed_texture_s3tc"): WEBGL_compressed_texture_s3tc | null; getExtension(extensionName: "WEBGL_compressed_texture_s3tc_srgb"): WEBGL_compressed_texture_s3tc_srgb | null; + getExtension(extensionName: "WEBGL_debug_renderer_info"): WEBGL_debug_renderer_info | null; getExtension(extensionName: "WEBGL_debug_shaders"): WEBGL_debug_shaders | null; + getExtension(extensionName: "WEBGL_depth_texture"): WEBGL_depth_texture | null; getExtension(extensionName: "WEBGL_draw_buffers"): WEBGL_draw_buffers | null; getExtension(extensionName: "WEBGL_lose_context"): WEBGL_lose_context | null; - getExtension(extensionName: "WEBGL_depth_texture"): WEBGL_depth_texture | null; - getExtension(extensionName: "WEBGL_debug_renderer_info"): WEBGL_debug_renderer_info | null; - getExtension(extensionName: "WEBGL_compressed_texture_s3tc"): WEBGL_compressed_texture_s3tc | null; - getExtension(extensionName: "OES_texture_half_float_linear"): OES_texture_half_float_linear | null; - getExtension(extensionName: "OES_texture_half_float"): OES_texture_half_float | null; - getExtension(extensionName: "OES_texture_float_linear"): OES_texture_float_linear | null; - getExtension(extensionName: "OES_texture_float"): OES_texture_float | null; - getExtension(extensionName: "OES_standard_derivatives"): OES_standard_derivatives | null; - getExtension(extensionName: "OES_element_index_uint"): OES_element_index_uint | null; - getExtension(extensionName: "ANGLE_instanced_arrays"): ANGLE_instanced_arrays | null; + getExtension(extensionName: "WEBGL_multi_draw"): WEBGL_multi_draw | null; getExtension(name: string): any; getFramebufferAttachmentParameter(target: GLenum, attachment: GLenum, pname: GLenum): any; getParameter(pname: GLenum): any; @@ -17744,11 +17884,13 @@ declare var onanimationend: ((this: Window, ev: AnimationEvent) => any) | null; declare var onanimationiteration: ((this: Window, ev: AnimationEvent) => any) | null; declare var onanimationstart: ((this: Window, ev: AnimationEvent) => any) | null; declare var onauxclick: ((this: Window, ev: MouseEvent) => any) | null; +declare var onbeforeinput: ((this: Window, ev: InputEvent) => any) | null; /** * Fires when the object loses the input focus. * @param ev The focus event. */ declare var onblur: ((this: Window, ev: FocusEvent) => any) | null; +declare var oncancel: ((this: Window, ev: Event) => any) | null; /** * Occurs when playback is possible, but would require further buffering. * @param ev The event. @@ -18100,17 +18242,15 @@ type NamedCurve = string; type OnBeforeUnloadEventHandler = OnBeforeUnloadEventHandlerNonNull | null; type OnErrorEventHandler = OnErrorEventHandlerNonNull | null; type PerformanceEntryList = PerformanceEntry[]; -type ReadableStreamController = ReadableStreamDefaultController; -type ReadableStreamReadResult = ReadableStreamReadValueResult | ReadableStreamReadDoneResult; -type ReadableStreamReader = ReadableStreamDefaultReader; +type ReadableStreamController = ReadableStreamDefaultController | ReadableByteStreamController; +type ReadableStreamReadResult = ReadableStreamReadValueResult | ReadableStreamReadDoneResult; +type ReadableStreamReader = ReadableStreamDefaultReader | ReadableStreamBYOBReader; type RenderingContext = CanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext | WebGL2RenderingContext; type RequestInfo = Request | string; type TexImageSource = ImageBitmap | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement; type TimerHandler = string | Function; -type Transferable = ArrayBuffer | MessagePort | ImageBitmap; +type Transferable = ImageBitmap | MessagePort | ReadableStream | WritableStream | TransformStream | ArrayBuffer; type Uint32List = Uint32Array | GLuint[]; -type UvmEntries = UvmEntry[]; -type UvmEntry = number[]; type VibratePattern = number | number[]; type WindowProxy = Window; type XMLHttpRequestBodyInit = Blob | BufferSource | FormData | URLSearchParams | string; @@ -18122,7 +18262,7 @@ type AttestationConveyancePreference = "direct" | "enterprise" | "indirect" | "n type AudioContextLatencyCategory = "balanced" | "interactive" | "playback"; type AudioContextState = "closed" | "running" | "suspended"; type AuthenticatorAttachment = "cross-platform" | "platform"; -type AuthenticatorTransport = "ble" | "internal" | "nfc" | "usb"; +type AuthenticatorTransport = "ble" | "hybrid" | "internal" | "nfc" | "usb"; type AutoKeyword = "auto"; type AutomationRate = "a-rate" | "k-rate"; type BinaryType = "arraybuffer" | "blob"; @@ -18183,7 +18323,7 @@ type MediaKeySessionClosedReason = "closed-by-application" | "hardware-context-r type MediaKeySessionType = "persistent-license" | "temporary"; type MediaKeyStatus = "expired" | "internal-error" | "output-downscaled" | "output-restricted" | "released" | "status-pending" | "usable" | "usable-in-future"; type MediaKeysRequirement = "not-allowed" | "optional" | "required"; -type MediaSessionAction = "hangup" | "nexttrack" | "pause" | "play" | "previoustrack" | "seekbackward" | "seekforward" | "seekto" | "skipad" | "stop" | "togglecamera" | "togglemicrophone"; +type MediaSessionAction = "nexttrack" | "pause" | "play" | "previoustrack" | "seekbackward" | "seekforward" | "seekto" | "skipad" | "stop"; type MediaSessionPlaybackState = "none" | "paused" | "playing"; type MediaStreamTrackState = "ended" | "live"; type NavigationTimingType = "back_forward" | "navigate" | "prerender" | "reload"; @@ -18213,7 +18353,6 @@ type RTCErrorDetailType = "data-channel-failure" | "dtls-failure" | "fingerprint type RTCIceCandidateType = "host" | "prflx" | "relay" | "srflx"; type RTCIceComponent = "rtcp" | "rtp"; type RTCIceConnectionState = "checking" | "closed" | "completed" | "connected" | "disconnected" | "failed" | "new"; -type RTCIceCredentialType = "password"; type RTCIceGathererState = "complete" | "gathering" | "new"; type RTCIceGatheringState = "complete" | "gathering" | "new"; type RTCIceProtocol = "tcp" | "udp"; @@ -18228,7 +18367,9 @@ type RTCSctpTransportState = "closed" | "connected" | "connecting"; type RTCSdpType = "answer" | "offer" | "pranswer" | "rollback"; type RTCSignalingState = "closed" | "have-local-offer" | "have-local-pranswer" | "have-remote-offer" | "have-remote-pranswer" | "stable"; type RTCStatsIceCandidatePairState = "failed" | "frozen" | "in-progress" | "inprogress" | "succeeded" | "waiting"; -type RTCStatsType = "candidate-pair" | "certificate" | "codec" | "csrc" | "data-channel" | "inbound-rtp" | "local-candidate" | "media-source" | "outbound-rtp" | "peer-connection" | "remote-candidate" | "remote-inbound-rtp" | "remote-outbound-rtp" | "track" | "transport"; +type RTCStatsType = "candidate-pair" | "certificate" | "codec" | "data-channel" | "inbound-rtp" | "local-candidate" | "media-source" | "outbound-rtp" | "peer-connection" | "remote-candidate" | "remote-inbound-rtp" | "remote-outbound-rtp" | "track" | "transport"; +type ReadableStreamReaderMode = "byob"; +type ReadableStreamType = "bytes"; type ReadyState = "closed" | "ended" | "open"; type RecordingState = "inactive" | "paused" | "recording"; type ReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url"; diff --git a/lib/lib.es2015.promise.d.ts b/lib/lib.es2015.promise.d.ts index 57eea0f6bbc..685f7164f5d 100644 --- a/lib/lib.es2015.promise.d.ts +++ b/lib/lib.es2015.promise.d.ts @@ -41,7 +41,7 @@ interface PromiseConstructor { all(values: T): Promise<{ -readonly [P in keyof T]: Awaited }>; // see: lib.es2015.iterable.d.ts - // all(values: Iterable>): Promise; + // all(values: Iterable>): Promise[]>; /** * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved @@ -52,7 +52,7 @@ interface PromiseConstructor { race(values: T): Promise>; // see: lib.es2015.iterable.d.ts - // race(values: Iterable): Promise ? U : T>; + // race(values: Iterable>): Promise>; /** * Creates a new rejected promise for the provided reason. @@ -66,13 +66,18 @@ interface PromiseConstructor { * @returns A resolved promise. */ resolve(): Promise; - /** * Creates a new resolved promise for the provided value. * @param value A promise. * @returns A promise whose internal state matches the provided promise. */ - resolve(value: T | PromiseLike): Promise; + resolve(value: T): Promise>; + /** + * Creates a new resolved promise for the provided value. + * @param value A promise. + * @returns A promise whose internal state matches the provided promise. + */ + resolve(value: T | PromiseLike): Promise>; } declare var Promise: PromiseConstructor; diff --git a/lib/lib.es2015.proxy.d.ts b/lib/lib.es2015.proxy.d.ts index c241866150b..8c465ab06a0 100644 --- a/lib/lib.es2015.proxy.d.ts +++ b/lib/lib.es2015.proxy.d.ts @@ -98,7 +98,7 @@ interface ProxyHandler { * @param target The original object which is being proxied. * @param p The name or `Symbol` of the property to set. * @param receiver The object to which the assignment was originally directed. - * @returns `A `Boolean` indicating whether or not the property was set. + * @returns A `Boolean` indicating whether or not the property was set. */ set?(target: T, p: string | symbol, newValue: any, receiver: any): boolean; diff --git a/lib/lib.es2015.reflect.d.ts b/lib/lib.es2015.reflect.d.ts index d1beb6862f1..2e2b3893d4d 100644 --- a/lib/lib.es2015.reflect.d.ts +++ b/lib/lib.es2015.reflect.d.ts @@ -26,6 +26,11 @@ declare namespace Reflect { * @param thisArgument The object to be used as the this object. * @param argumentsList An array of argument values to be passed to the function. */ + function apply( + target: (this: T, ...args: A) => R, + thisArgument: T, + argumentsList: Readonly, + ): R; function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; /** @@ -35,6 +40,11 @@ declare namespace Reflect { * @param argumentsList An array of argument values to be passed to the constructor. * @param newTarget The constructor to be used as the `new.target` object. */ + function construct( + target: new (...args: A) => R, + argumentsList: Readonly, + newTarget?: new (...args: any) => any, + ): R; function construct(target: Function, argumentsList: ArrayLike, newTarget?: Function): any; /** @@ -61,7 +71,11 @@ declare namespace Reflect { * @param receiver The reference to use as the `this` value in the getter function, * if `target[propertyKey]` is an accessor property. */ - function get(target: object, propertyKey: PropertyKey, receiver?: any): any; + function get( + target: T, + propertyKey: P, + receiver?: unknown, + ): P extends keyof T ? T[P] : any; /** * Gets the own property descriptor of the specified object. @@ -69,7 +83,10 @@ declare namespace Reflect { * @param target Object that contains the property. * @param propertyKey The property name. */ - function getOwnPropertyDescriptor(target: object, propertyKey: PropertyKey): PropertyDescriptor | undefined; + function getOwnPropertyDescriptor( + target: T, + propertyKey: P, + ): TypedPropertyDescriptor

| undefined; /** * Returns the prototype of an object. @@ -111,6 +128,12 @@ declare namespace Reflect { * @param receiver The reference to use as the `this` value in the setter function, * if `target[propertyKey]` is an accessor property. */ + function set( + target: T, + propertyKey: P, + value: P extends keyof T ? T[P] : any, + receiver?: any, + ): boolean; function set(target: object, propertyKey: PropertyKey, value: any, receiver?: any): boolean; /** diff --git a/lib/lib.es2019.d.ts b/lib/lib.es2019.d.ts index 5eab0e2c235..77d3d6b5f09 100644 --- a/lib/lib.es2019.d.ts +++ b/lib/lib.es2019.d.ts @@ -23,3 +23,4 @@ and limitations under the License. /// /// /// +/// diff --git a/lib/lib.es2019.intl.d.ts b/lib/lib.es2019.intl.d.ts new file mode 100644 index 00000000000..fe17c7cd719 --- /dev/null +++ b/lib/lib.es2019.intl.d.ts @@ -0,0 +1,25 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + + + +/// + + +declare namespace Intl { + interface DateTimeFormatPartTypesRegistry { + unknown: any + } +} diff --git a/lib/lib.es2020.intl.d.ts b/lib/lib.es2020.intl.d.ts index 5bce3812d8c..5ee8e4cdc41 100644 --- a/lib/lib.es2020.intl.d.ts +++ b/lib/lib.es2020.intl.d.ts @@ -103,7 +103,7 @@ declare namespace Intl { * * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument). */ - type LocalesArgument = UnicodeBCP47LocaleIdentifier | Locale | (UnicodeBCP47LocaleIdentifier | Locale)[] | undefined; + type LocalesArgument = UnicodeBCP47LocaleIdentifier | Locale | readonly (UnicodeBCP47LocaleIdentifier | Locale)[] | undefined; /** * An object with some or all of properties of `options` parameter diff --git a/lib/lib.es5.d.ts b/lib/lib.es5.d.ts index 28ca95abe3e..62cb9fb3814 100644 --- a/lib/lib.es5.d.ts +++ b/lib/lib.es5.d.ts @@ -214,12 +214,6 @@ interface ObjectConstructor { */ seal(o: T): T; - /** - * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. - * @param a Object on which to lock the attributes. - */ - freeze(a: T[]): readonly T[]; - /** * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. * @param f Object on which to lock the attributes. @@ -908,7 +902,17 @@ interface Date { interface DateConstructor { new(): Date; new(value: number | string): Date; - new(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; + /** + * Creates a new Date. + * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. + * @param monthIndex The month as a number between 0 and 11 (January to December). + * @param date The date as a number between 1 and 31. + * @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour. + * @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes. + * @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds. + * @param ms A number from 0 to 999 that specifies the milliseconds. + */ + new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; (): string; readonly prototype: Date; /** @@ -919,14 +923,14 @@ interface DateConstructor { /** * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. - * @param month The month as a number between 0 and 11 (January to December). + * @param monthIndex The month as a number between 0 and 11 (January to December). * @param date The date as a number between 1 and 31. * @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour. * @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes. * @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds. * @param ms A number from 0 to 999 that specifies the milliseconds. */ - UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; + UTC(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; now(): number; } @@ -941,6 +945,10 @@ interface RegExpMatchArray extends Array { * A copy of the search string. */ input?: string; + /** + * The first match. This will always be present because `null` will be returned if there are no matches. + */ + 0: string; } interface RegExpExecArray extends Array { @@ -952,6 +960,10 @@ interface RegExpExecArray extends Array { * A copy of the search string. */ input: string; + /** + * The first match. This will always be present because `null` will be returned if there are no matches. + */ + 0: string; } interface RegExp { @@ -1532,8 +1544,8 @@ interface Promise { */ type Awaited = T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode - T extends object & { then(onfulfilled: infer F): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped - F extends ((value: infer V, ...args: any) => any) ? // if the argument to `then` is callable, extracts the first argument + T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped + F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T; // non-object or non-thenable diff --git a/lib/lib.webworker.d.ts b/lib/lib.webworker.d.ts index 30f83bc8462..f6ab7e9363d 100644 --- a/lib/lib.webworker.d.ts +++ b/lib/lib.webworker.d.ts @@ -500,9 +500,18 @@ interface RTCEncodedVideoFrameMetadata { width?: number; } -interface ReadableStreamReadDoneResult { +interface ReadableStreamGetReaderOptions { + /** + * Creates a ReadableStreamBYOBReader and locks the stream to the new reader. + * + * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation. + */ + mode?: ReadableStreamReaderMode; +} + +interface ReadableStreamReadDoneResult { done: true; - value?: undefined; + value?: T; } interface ReadableStreamReadValueResult { @@ -658,6 +667,21 @@ interface Transformer { writableType?: undefined; } +interface UnderlyingByteSource { + autoAllocateChunkSize?: number; + cancel?: UnderlyingSourceCancelCallback; + pull?: (controller: ReadableByteStreamController) => void | PromiseLike; + start?: (controller: ReadableByteStreamController) => any; + type: "bytes"; +} + +interface UnderlyingDefaultSource { + cancel?: UnderlyingSourceCancelCallback; + pull?: (controller: ReadableStreamDefaultController) => void | PromiseLike; + start?: (controller: ReadableStreamDefaultController) => any; + type?: undefined; +} + interface UnderlyingSink { abort?: UnderlyingSinkAbortCallback; close?: UnderlyingSinkCloseCallback; @@ -667,10 +691,11 @@ interface UnderlyingSink { } interface UnderlyingSource { + autoAllocateChunkSize?: number; cancel?: UnderlyingSourceCancelCallback; pull?: UnderlyingSourcePullCallback; start?: UnderlyingSourceStartCallback; - type?: undefined; + type?: ReadableStreamType; } interface VideoColorSpaceInit { @@ -756,6 +781,7 @@ declare var AbortSignal: { prototype: AbortSignal; new(): AbortSignal; abort(reason?: any): AbortSignal; + timeout(milliseconds: number): AbortSignal; }; interface AbstractWorkerEventMap { @@ -1316,6 +1342,13 @@ interface EXT_sRGB { interface EXT_shader_texture_lod { } +interface EXT_texture_compression_bptc { + readonly COMPRESSED_RGBA_BPTC_UNORM_EXT: GLenum; + readonly COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT: GLenum; + readonly COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT: GLenum; + readonly COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT: GLenum; +} + interface EXT_texture_compression_rgtc { readonly COMPRESSED_RED_GREEN_RGTC2_EXT: GLenum; readonly COMPRESSED_RED_RGTC1_EXT: GLenum; @@ -1347,6 +1380,7 @@ declare var ErrorEvent: { interface Event { /** Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. */ readonly bubbles: boolean; + /** @deprecated */ cancelBubble: boolean; /** Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. */ readonly cancelable: boolean; @@ -2030,13 +2064,13 @@ declare var IDBObjectStore: { }; interface IDBOpenDBRequestEventMap extends IDBRequestEventMap { - "blocked": Event; + "blocked": IDBVersionChangeEvent; "upgradeneeded": IDBVersionChangeEvent; } /** Also inherits methods from its parents IDBRequest and EventTarget. */ interface IDBOpenDBRequest extends IDBRequest { - onblocked: ((this: IDBOpenDBRequest, ev: Event) => any) | null; + onblocked: ((this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any) | null; onupgradeneeded: ((this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any) | null; addEventListener(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -2292,6 +2326,7 @@ interface NavigatorID { readonly appName: string; /** @deprecated */ readonly appVersion: string; + /** @deprecated */ readonly platform: string; /** @deprecated */ readonly product: string; @@ -2553,6 +2588,7 @@ interface PermissionStatusEventMap { } interface PermissionStatus extends EventTarget { + readonly name: string; onchange: ((this: PermissionStatus, ev: Event) => any) | null; readonly state: PermissionState; addEventListener(type: K, listener: (this: PermissionStatus, ev: PermissionStatusEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; @@ -2664,6 +2700,7 @@ declare var PushSubscription: { /** Available only in secure contexts. */ interface PushSubscriptionOptions { readonly applicationServerKey: ArrayBuffer | null; + readonly userVisibleOnly: boolean; } declare var PushSubscriptionOptions: { @@ -2711,7 +2748,9 @@ declare var ReadableByteStreamController: { interface ReadableStream { readonly locked: boolean; cancel(reason?: any): Promise; + getReader(options: { mode: "byob" }): ReadableStreamBYOBReader; getReader(): ReadableStreamDefaultReader; + getReader(options?: ReadableStreamGetReaderOptions): ReadableStreamReader; pipeThrough(transform: ReadableWritablePair, options?: StreamPipeOptions): ReadableStream; pipeTo(destination: WritableStream, options?: StreamPipeOptions): Promise; tee(): [ReadableStream, ReadableStream]; @@ -2719,11 +2758,13 @@ interface ReadableStream { declare var ReadableStream: { prototype: ReadableStream; + new(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number }): ReadableStream; + new(underlyingSource: UnderlyingDefaultSource, strategy?: QueuingStrategy): ReadableStream; new(underlyingSource?: UnderlyingSource, strategy?: QueuingStrategy): ReadableStream; }; interface ReadableStreamBYOBReader extends ReadableStreamGenericReader { - read(view: ArrayBufferView): Promise>; + read(view: T): Promise>; releaseLock(): void; } @@ -2911,6 +2952,7 @@ interface ServiceWorkerGlobalScopeEventMap extends WorkerGlobalScopeEventMap { "notificationclick": NotificationEvent; "notificationclose": NotificationEvent; "push": PushEvent; + "pushsubscriptionchange": Event; } /** This ServiceWorker API interface represents the global execution context of a service worker. */ @@ -2924,6 +2966,7 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope { onnotificationclick: ((this: ServiceWorkerGlobalScope, ev: NotificationEvent) => any) | null; onnotificationclose: ((this: ServiceWorkerGlobalScope, ev: NotificationEvent) => any) | null; onpush: ((this: ServiceWorkerGlobalScope, ev: PushEvent) => any) | null; + onpushsubscriptionchange: ((this: ServiceWorkerGlobalScope, ev: Event) => any) | null; readonly registration: ServiceWorkerRegistration; readonly serviceWorker: ServiceWorker; skipWaiting(): Promise; @@ -3340,8 +3383,8 @@ interface WEBGL_lose_context { interface WEBGL_multi_draw { multiDrawArraysInstancedWEBGL(mode: GLenum, firstsList: Int32Array | GLint[], firstsOffset: GLuint, countsList: Int32Array | GLsizei[], countsOffset: GLuint, instanceCountsList: Int32Array | GLsizei[], instanceCountsOffset: GLuint, drawcount: GLsizei): void; multiDrawArraysWEBGL(mode: GLenum, firstsList: Int32Array | GLint[], firstsOffset: GLuint, countsList: Int32Array | GLsizei[], countsOffset: GLuint, drawcount: GLsizei): void; - multiDrawElementsInstancedWEBGL(mode: GLenum, countsList: Int32Array | GLint[], countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | GLsizei[], offsetsOffset: GLuint, instanceCountsList: Int32Array | GLsizei[], instanceCountsOffset: GLuint, drawcount: GLsizei): void; - multiDrawElementsWEBGL(mode: GLenum, countsList: Int32Array | GLint[], countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | GLsizei[], offsetsOffset: GLuint, drawcount: GLsizei): void; + multiDrawElementsInstancedWEBGL(mode: GLenum, countsList: Int32Array | GLsizei[], countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | GLsizei[], offsetsOffset: GLuint, instanceCountsList: Int32Array | GLsizei[], instanceCountsOffset: GLuint, drawcount: GLsizei): void; + multiDrawElementsWEBGL(mode: GLenum, countsList: Int32Array | GLsizei[], countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | GLsizei[], offsetsOffset: GLuint, drawcount: GLsizei): void; } interface WebGL2RenderingContext extends WebGL2RenderingContextBase, WebGL2RenderingContextOverloads, WebGLRenderingContextBase { @@ -4739,35 +4782,39 @@ interface WebGLRenderingContextBase { getBufferParameter(target: GLenum, pname: GLenum): any; getContextAttributes(): WebGLContextAttributes | null; getError(): GLenum; + getExtension(extensionName: "ANGLE_instanced_arrays"): ANGLE_instanced_arrays | null; getExtension(extensionName: "EXT_blend_minmax"): EXT_blend_minmax | null; getExtension(extensionName: "EXT_color_buffer_float"): EXT_color_buffer_float | null; getExtension(extensionName: "EXT_color_buffer_half_float"): EXT_color_buffer_half_float | null; getExtension(extensionName: "EXT_float_blend"): EXT_float_blend | null; - getExtension(extensionName: "EXT_texture_filter_anisotropic"): EXT_texture_filter_anisotropic | null; getExtension(extensionName: "EXT_frag_depth"): EXT_frag_depth | null; - getExtension(extensionName: "EXT_shader_texture_lod"): EXT_shader_texture_lod | null; getExtension(extensionName: "EXT_sRGB"): EXT_sRGB | null; + getExtension(extensionName: "EXT_shader_texture_lod"): EXT_shader_texture_lod | null; + getExtension(extensionName: "EXT_texture_compression_bptc"): EXT_texture_compression_bptc | null; + getExtension(extensionName: "EXT_texture_compression_rgtc"): EXT_texture_compression_rgtc | null; + getExtension(extensionName: "EXT_texture_filter_anisotropic"): EXT_texture_filter_anisotropic | null; getExtension(extensionName: "KHR_parallel_shader_compile"): KHR_parallel_shader_compile | null; + getExtension(extensionName: "OES_element_index_uint"): OES_element_index_uint | null; + getExtension(extensionName: "OES_fbo_render_mipmap"): OES_fbo_render_mipmap | null; + getExtension(extensionName: "OES_standard_derivatives"): OES_standard_derivatives | null; + getExtension(extensionName: "OES_texture_float"): OES_texture_float | null; + getExtension(extensionName: "OES_texture_float_linear"): OES_texture_float_linear | null; + getExtension(extensionName: "OES_texture_half_float"): OES_texture_half_float | null; + getExtension(extensionName: "OES_texture_half_float_linear"): OES_texture_half_float_linear | null; getExtension(extensionName: "OES_vertex_array_object"): OES_vertex_array_object | null; getExtension(extensionName: "OVR_multiview2"): OVR_multiview2 | null; getExtension(extensionName: "WEBGL_color_buffer_float"): WEBGL_color_buffer_float | null; getExtension(extensionName: "WEBGL_compressed_texture_astc"): WEBGL_compressed_texture_astc | null; getExtension(extensionName: "WEBGL_compressed_texture_etc"): WEBGL_compressed_texture_etc | null; getExtension(extensionName: "WEBGL_compressed_texture_etc1"): WEBGL_compressed_texture_etc1 | null; + getExtension(extensionName: "WEBGL_compressed_texture_s3tc"): WEBGL_compressed_texture_s3tc | null; getExtension(extensionName: "WEBGL_compressed_texture_s3tc_srgb"): WEBGL_compressed_texture_s3tc_srgb | null; + getExtension(extensionName: "WEBGL_debug_renderer_info"): WEBGL_debug_renderer_info | null; getExtension(extensionName: "WEBGL_debug_shaders"): WEBGL_debug_shaders | null; + getExtension(extensionName: "WEBGL_depth_texture"): WEBGL_depth_texture | null; getExtension(extensionName: "WEBGL_draw_buffers"): WEBGL_draw_buffers | null; getExtension(extensionName: "WEBGL_lose_context"): WEBGL_lose_context | null; - getExtension(extensionName: "WEBGL_depth_texture"): WEBGL_depth_texture | null; - getExtension(extensionName: "WEBGL_debug_renderer_info"): WEBGL_debug_renderer_info | null; - getExtension(extensionName: "WEBGL_compressed_texture_s3tc"): WEBGL_compressed_texture_s3tc | null; - getExtension(extensionName: "OES_texture_half_float_linear"): OES_texture_half_float_linear | null; - getExtension(extensionName: "OES_texture_half_float"): OES_texture_half_float | null; - getExtension(extensionName: "OES_texture_float_linear"): OES_texture_float_linear | null; - getExtension(extensionName: "OES_texture_float"): OES_texture_float | null; - getExtension(extensionName: "OES_standard_derivatives"): OES_standard_derivatives | null; - getExtension(extensionName: "OES_element_index_uint"): OES_element_index_uint | null; - getExtension(extensionName: "ANGLE_instanced_arrays"): ANGLE_instanced_arrays | null; + getExtension(extensionName: "WEBGL_multi_draw"): WEBGL_multi_draw | null; getExtension(name: string): any; getFramebufferAttachmentParameter(target: GLenum, attachment: GLenum, pname: GLenum): any; getParameter(pname: GLenum): any; @@ -5896,13 +5943,13 @@ type NamedCurve = string; type OnErrorEventHandler = OnErrorEventHandlerNonNull | null; type PerformanceEntryList = PerformanceEntry[]; type PushMessageDataInit = BufferSource | string; -type ReadableStreamController = ReadableStreamDefaultController; -type ReadableStreamReadResult = ReadableStreamReadValueResult | ReadableStreamReadDoneResult; -type ReadableStreamReader = ReadableStreamDefaultReader; +type ReadableStreamController = ReadableStreamDefaultController | ReadableByteStreamController; +type ReadableStreamReadResult = ReadableStreamReadValueResult | ReadableStreamReadDoneResult; +type ReadableStreamReader = ReadableStreamDefaultReader | ReadableStreamBYOBReader; type RequestInfo = Request | string; type TexImageSource = ImageBitmap | ImageData | OffscreenCanvas; type TimerHandler = string | Function; -type Transferable = ArrayBuffer | MessagePort | ImageBitmap; +type Transferable = OffscreenCanvas | ImageBitmap | MessagePort | ReadableStream | WritableStream | TransformStream | ArrayBuffer; type Uint32List = Uint32Array | GLuint[]; type VibratePattern = number | number[]; type XMLHttpRequestBodyInit = Blob | BufferSource | FormData | URLSearchParams | string; @@ -5936,6 +5983,8 @@ type PredefinedColorSpace = "display-p3" | "srgb"; type PremultiplyAlpha = "default" | "none" | "premultiply"; type PushEncryptionKeyName = "auth" | "p256dh"; type RTCEncodedVideoFrameType = "delta" | "empty" | "key"; +type ReadableStreamReaderMode = "byob"; +type ReadableStreamType = "bytes"; type ReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url"; type RequestCache = "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload"; type RequestCredentials = "include" | "omit" | "same-origin"; diff --git a/lib/pl/diagnosticMessages.generated.json b/lib/pl/diagnosticMessages.generated.json index 8523a81e5bc..107a9859cd2 100644 --- a/lib/pl/diagnosticMessages.generated.json +++ b/lib/pl/diagnosticMessages.generated.json @@ -186,6 +186,7 @@ "An_abstract_accessor_cannot_have_an_implementation_1318": "Abstrakcyjna metoda dostępu nie może mieć implementacji.", "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "Modyfikator dostępności nie może być używany z identyfikatorem prywatnym.", "An_accessor_cannot_have_type_parameters_1094": "Metoda dostępu nie może mieć parametrów typu.", + "An_accessor_property_cannot_be_declared_optional_1276": "Właściwość „accessor” nie może być zadeklarowana jako opcjonalna.", "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "Deklaracja otaczającego modułu jest dozwolona tylko na najwyższym poziomie pliku.", "An_argument_for_0_was_not_provided_6210": "Nie podano argumentu dla elementu „{0}”.", "An_argument_matching_this_binding_pattern_was_not_provided_6211": "Argument pasujący do tego wzorca powiązania nie został podany.", @@ -382,7 +383,7 @@ "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720": "Klasa „{0}” niepoprawnie implementuje klasę „{1}”. Czy chodziło o rozszerzenie „{1}” i odziedziczenie jego elementów członkowskich jako podklasy?", "Class_0_incorrectly_implements_interface_1_2420": "Klasa „{0}” zawiera niepoprawną implementację interfejsu „{1}”.", "Class_0_used_before_its_declaration_2449": "Klasa „{0}” została użyta przed zadeklarowaniem.", - "Class_constructor_may_not_be_a_generator_1360": "Konstruktor klas nie może być generatorem.", + "Class_constructor_may_not_be_a_generator_1368": "Konstruktor klas nie może być generatorem.", "Class_constructor_may_not_be_an_accessor_1341": "Konstruktor klas nie może być metodą dostępu.", "Class_declaration_cannot_implement_overload_list_for_0_2813": "Deklaracja klasy nie może implementować listy przeciążeń dla elementu \"{0}\".", "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025": "Deklaracje klas nie mogą mieć więcej niż jeden tag \"@augments\" lub \"@extends\".", @@ -430,6 +431,7 @@ "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "Konwersja typu „{0}” na typ „{1}” może być błędem, ponieważ żaden z tych typów nie pokrywa się w wystarczającym stopniu z drugim. Jeśli było to zamierzone, najpierw przekonwertuj wyrażenie na typ „unknown”.", "Convert_0_to_1_in_0_95003": "Konwertuj element „{0}” na element „{1} w {0}”.", "Convert_0_to_mapped_object_type_95055": "Konwertuj element „{0}” na zamapowany typ obiektu", + "Convert_all_const_to_let_95102": "Konwertuj wszystkie elementy „const” na „let”", "Convert_all_constructor_functions_to_classes_95045": "Przekonwertuj wszystkie funkcje konstruktora na klasy", "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "Konwertuj wszystkie importy nieużywane jako wartość na importy dotyczące tylko typu", "Convert_all_invalid_characters_to_HTML_entity_code_95101": "Konwertuj wszystkie nieprawidłowe znaki na kod jednostki HTML", @@ -919,7 +921,7 @@ "Method_not_implemented_95158": "Metoda nie jest zaimplementowana.", "Modifiers_cannot_appear_here_1184": "Modyfikatory nie mogą występować w tym miejscu.", "Module_0_can_only_be_default_imported_using_the_1_flag_1259": "Moduł „{0}” może być importowany domyślnie tylko przy użyciu flagi „{1}”", - "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "Nie można zaimportować modułu „{0}” przy użyciu tej konstrukcji. Specyfikator jest rozpoznawany tylko jako moduł ES, którego nie można zaimportować synchronicznie. Zamiast tego użyj importu dynamicznego.", + "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "Nie można zaimportować modułu „{0}” przy użyciu tej konstrukcji. Specyfikator jest rozpoznawany tylko jako moduł ES, którego nie można zaimportować za pomocą wywołania „require”. Zamiast tego użyj importu ECMAScript.", "Module_0_declares_1_locally_but_it_is_exported_as_2_2460": "Moduł „{0}” deklaruje element „{1}” lokalnie, ale jest on eksportowany jako „{2}”.", "Module_0_declares_1_locally_but_it_is_not_exported_2459": "Moduł „{0}” deklaruje element „{1}” lokalnie, ale nie jest on eksportowany.", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340": "Moduł „{0}” nie odwołuje się do typu, ale jest tutaj używany jako typ. Czy chodziło Ci o „typeof import(„{0}”)”?", @@ -1103,6 +1105,7 @@ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Projekt „{0}” jest nieaktualny, ponieważ plik wyjściowy „{1}” nie istnieje", "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "Projekt „{0}” jest nieaktualny, ponieważ jego dane wyjściowe zostały wygenerowane w wersji „{1}”, która różni się od bieżącej wersji „{2}”", "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "Projekt „{0}” jest nieaktualny, ponieważ dane wyjściowe jego zależności „{1}” uległy zmianie", + "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401": "Projekt „{0}” jest nieaktualny, ponieważ wystąpił błąd podczas odczytywania pliku „{1}”", "Project_0_is_up_to_date_6361": "Projekt „{0}” jest aktualny", "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "Projekt „{0}” jest aktualny, ponieważ najnowsze dane wejściowe „{1}” są starsze niż dane wyjściowe „{2}”", "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "Projekt „{0}” jest aktualny, ale musi zaktualizować sygnatury czasowe plików wyjściowych, które są starsze niż pliki wejściowe", @@ -1110,6 +1113,7 @@ "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "Odwołania do projektu nie mogą tworzyć grafu kołowego. Wykryto cykl: {0}", "Projects_6255": "Projekty", "Projects_in_this_build_Colon_0_6355": "Projekty w tej kompilacji: {0}", + "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "Właściwości z modyfikatorem „accessor” są dostępne tylko w przypadku określania wartości docelowej ECMAScript 2015 lub nowszej.", "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "Właściwości \"{0}\" nie może mieć inicjatora, ponieważ jest oznaczona jako abstrakcyjna.", "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "Właściwość „{0}” pochodzi z sygnatury indeksu, dlatego należy uzyskiwać do niej dostęp za pomocą elementu [„{0}”].", "Property_0_does_not_exist_on_type_1_2339": "Właściwość „{0}” nie istnieje w typie „{1}”.", @@ -1385,6 +1389,7 @@ "The_containing_arrow_function_captures_the_global_value_of_this_7041": "Zawierająca funkcja strzałki przechwytuje wartość globalną parametru „this”.", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "Treść zawierającej funkcji lub modułu jest za duża do analizy przepływu sterowania.", "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "Bieżący plik jest modułem CommonJS i nie może używać elementu „await” na najwyższym poziomie.", + "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479": "Bieżący plik jest modułem CommonJS, którego importy będą generować wywołania „require”; jednak przywoływany plik jest modułem ECMAScript i nie można go zaimportować za pomocą wywołania „require”. Zamiast tego rozważ zapisanie dynamicznego wywołania „import(\"{0}\")”.", "The_current_host_does_not_support_the_0_option_5001": "Bieżący host nie obsługuje opcji „{0}”.", "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "W tym miejscu zdefiniowano deklarację elementu „{0}”, której prawdopodobnie zamierzano użyć", "The_declaration_was_marked_as_deprecated_here_2798": "Deklaracja została oznaczona jako przestarzała w tym miejscu.", @@ -1464,13 +1469,14 @@ "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490": "Typ zwracany przez metodę „{0}()” iteratora musi mieć właściwość „value”.", "The_types_of_0_are_incompatible_between_these_types_2200": "Typy elementu „{0}” są niezgodne między tymi typami.", "The_types_returned_by_0_are_incompatible_between_these_types_2201": "Typy zwrócone przez element „{0}” są niezgodne między tymi typami.", + "The_value_0_cannot_be_used_here_18050": "W tym miejscu nie można użyć wartości „{0}”.", "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "Deklaracja zmiennej instrukcji „for...in” nie może mieć inicjatora.", "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "Deklaracja zmiennej instrukcji „for...of” nie może mieć inicjatora.", "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "Instrukcja „with” nie jest obsługiwana. Wszystkie symbole w bloku „with” będą mieć typ „any”.", "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_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_0_since_the_types_1_and_2_have_no_overlap_2367": "Ten warunek będzie zawsze zwracał element „{0}”, ponieważ typy „{1}” i „{2}” nie nakładają się.", "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?", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Ta funkcja konstruktora może zostać przekonwertowana na deklarację klasy.", @@ -1491,7 +1497,7 @@ "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114": "Ten element członkowski musi mieć modyfikator „override”, ponieważ przesłania on element członkowski w klasie podstawowej „{0}”.", "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "Ten element członkowski musi mieć modyfikator „override”, ponieważ zastępuje metodę abstrakcyjną zadeklarowaną w klasie podstawowej „{0}”.", "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "Do tego modułu można odwoływać się tylko za pomocą importów/eksportów języka ECMAScript, włączając flagę „{0}” i odwołując się do jego eksportu domyślnego.", - "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594": "Ten moduł jest zadeklarowany przy użyciu składni „export =” i może być używany tylko z importem domyślnym, gdy jest używana flaga „{0}”.", + "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "Ten moduł jest zadeklarowany przy użyciu składni „export =” i może być używany tylko z importem domyślnym, gdy jest używana flaga „{0}”.", "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "Ta sygnatura przeciążenia nie jest zgodna z jej sygnaturą implementacji.", "This_parameter_is_not_allowed_with_use_strict_directive_1346": "Ten parametr nie jest dozwolony w dyrektywie „use strict”.", "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120": "Ta właściwość parametru musi mieć komentarz JSDoc z tagiem „@override”, ponieważ zastępuje składową w klasie bazowej „{0}”.", @@ -1504,6 +1510,10 @@ "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "Ta składnia wymaga zaimportowanego pomocnika o nazwie „{1}” z parametrami {2}, który nie jest zgodny z tym w elemencie „{0}”. Rozważ uaktualnienie wersji elementu „{0}”.", "This_type_parameter_might_need_an_extends_0_constraint_2208": "Ten parametr typu może wymagać ograniczenia „rozszerzeń{0}”.", "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "To użycie elementu „import” jest nieprawidłowe. Wywołania „import()” mogą być zapisywane, ale muszą mieć nawiasy i nie mogą mieć argumentów typu.", + "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482": "Aby przekonwertować ten plik na moduł ECMAScript, dodaj pole „\"type\": \"module\"” do „{0}”.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481": "Aby przekonwertować ten plik na moduł ECMAScript, zmień rozszerzenie jego pliku na „{0}” lub dodaj pole „\"type\": \"module\"” do „{1}”.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480": "Aby przekonwertować ten plik na moduł ECMAScript, zmień rozszerzenie jego pliku na „{0}” lub utwórz lokalny plik package.json z polem „{ \"type\": \"module\" }\".", + "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483": "Aby przekonwertować ten plik na moduł ECMAScript, utwórz lokalny plik package.json z polem „{ \"type\": \"module\" }\".", "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "Wyrażenia „await” najwyższego poziomu są dozwolone tylko wtedy, gdy opcja „module” jest ustawiona na wartość „es2022”, „esnext”, „system”, „node16” lub „nodenext”, a opcja „target” jest ustawiona na wartość „es2017” lub wyższą.", "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": "Deklaracje najwyższego poziomu w plikach .d.ts muszą rozpoczynać się od modyfikatora „declare” lub „export”.", "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "Pętle najwyższego poziomu „for await” są dozwolone tylko wtedy, gdy opcja „module” jest ustawiona na wartość „es2022”, „esnext”, „system”, „node16” lub „nodenext”, a opcja „target” jest ustawiona na wartość „es2017” lub wyższą.", @@ -1519,6 +1529,7 @@ "Type_0_cannot_be_used_as_an_index_type_2538": "Typu „{0}” nie można używać jako typu indeksu.", "Type_0_cannot_be_used_to_index_type_1_2536": "Typu „{0}” nie można użyć do indeksowania typu „{1}”.", "Type_0_does_not_satisfy_the_constraint_1_2344": "Typ „{0}” nie spełnia warunków ograniczenia „{1}”.", + "Type_0_does_not_satisfy_the_expected_type_1_1360": "Typ „{0}” nie spełnia oczekiwanego typu „{1}”.", "Type_0_has_no_call_signatures_2757": "Typ „{0}” nie ma sygnatur wywołania.", "Type_0_has_no_construct_signatures_2761": "Typ „{0}” nie ma sygnatur konstrukcji.", "Type_0_has_no_matching_index_signature_for_type_1_2537": "Typ „{0}” nie ma pasującej sygnatury indeksu dla typu „{1}”.", @@ -1596,6 +1607,7 @@ "Type_reference_directive_0_was_not_resolved_6120": "======== Dyrektywa odwołania do typu „{0}” nie została rozpoznana. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== Dyrektywa odwołania do typu „{0}” została pomyślnie rozpoznana jako „{1}”, podstawowe: {2}. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219": "======== Dyrektywa odwołania do typu „{0}” została pomyślnie rozpoznana jako „{1}” z identyfikatorem pakietu „{2}”, podstawowe: {3}. ========", + "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037": "Wyrażeń asercji typu można używać tylko w plikach TypeScript.", "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043": "Typy nie mogą występować w deklaracjach eksportu w plikach JavaScript.", "Types_have_separate_declarations_of_a_private_property_0_2442": "Typy mają osobne deklaracje właściwości prywatnej „{0}”.", "Types_of_construct_signatures_are_incompatible_2419": "Typy sygnatur konstrukcji są niezgodne.", @@ -1717,6 +1729,10 @@ "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "„{0}” nie jest prawidłową metawłaściwością słowa kluczowego „{1}”. Czy miał to być element „{2}”?", "_0_is_not_allowed_as_a_parameter_name_1390": "„{0}” jest niedozwolone jako nazwa parametru.", "_0_is_not_allowed_as_a_variable_declaration_name_1389": "Element „{0}” nie jest dozwolony jako nazwa deklaracji zmiennej.", + "_0_is_of_type_unknown_18046": "Element „{0}” jest typu „nieznany”.", + "_0_is_possibly_null_18047": "Element „{0}” prawdopodobnie ma wartość „null”.", + "_0_is_possibly_null_or_undefined_18049": "Element „{0}” prawdopodobnie ma wartość „null” lub jest „niezdefiniowany”.", + "_0_is_possibly_undefined_18048": "Element „{0}” jest prawdopodobnie „niezdefiniowany”.", "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "Element „{0}” jest przywoływany bezpośrednio lub pośrednio w jego własnym wyrażeniu podstawowym.", "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "Element „{0}” jest przywoływany bezpośrednio lub pośrednio w jego własnej adnotacji typu.", "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783": "Element „{0}” został określony więcej niż raz, dlatego to użycie zostanie przesłonięte.", @@ -1752,6 +1768,7 @@ "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "Dla elementu „{0}” bez adnotacji zwracanego typu niejawnie określono zwracany typ „{1}”.", "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "Dla elementu „{0}” bez adnotacji zwracanego typu niejawnie określono zwracany typ „{1}”.", "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "Modyfikator „abstract” może być stosowany jedynie w przypadku deklaracji klasy, metody lub właściwości.", + "accessor_modifier_can_only_appear_on_a_property_declaration_1275": "Modyfikator „accessor” może występować tylko w deklaracji właściwości.", "and_here_6204": "i tutaj.", "arguments_cannot_be_referenced_in_property_initializers_2815": "w inicjatorach właściwości nie można odwoływać się do \"arguments\".", "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "„auto”: Traktuj pliki za pomocą importów, eksportów, import.meta, jsx (z jsx: react-jsx) lub formatu esm (z modułem: node16+) jako moduły.", diff --git a/lib/protocol.d.ts b/lib/protocol.d.ts index 44e76da5038..6a80289a9ea 100644 --- a/lib/protocol.d.ts +++ b/lib/protocol.d.ts @@ -2924,6 +2924,8 @@ declare namespace ts.server.protocol { * interface Y { foo:number; } */ memberVariableElement = "property", + /** class X { [public|private]* accessor foo: number; } */ + memberAccessorVariableElement = "accessor", /** * class X { constructor() { } } * class X { static { } } diff --git a/lib/pt-br/diagnosticMessages.generated.json b/lib/pt-br/diagnosticMessages.generated.json index 269fbc9d6b6..50245312a05 100644 --- a/lib/pt-br/diagnosticMessages.generated.json +++ b/lib/pt-br/diagnosticMessages.generated.json @@ -186,6 +186,7 @@ "An_abstract_accessor_cannot_have_an_implementation_1318": "Um acessador abstrato não pode ter uma implementação.", "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "Não é possível usar um modificador de acessibilidade com um identificador privado.", "An_accessor_cannot_have_type_parameters_1094": "Um acessador não pode ter parâmetros de tipo.", + "An_accessor_property_cannot_be_declared_optional_1276": "Uma propriedade 'acessador' não pode ser declarada opcional.", "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "Uma declaração de módulo de ambiente só é permitida no nível superior em um arquivo.", "An_argument_for_0_was_not_provided_6210": "Não foi fornecido um argumento para '{0}'.", "An_argument_matching_this_binding_pattern_was_not_provided_6211": "Não foi fornecido um argumento correspondente a esse padrão de associação.", @@ -382,7 +383,7 @@ "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720": "A classe '{0}' implementa incorretamente a classe '{1}'. Você pretendia estender '{1}' e herdar seus membros como uma subclasse?", "Class_0_incorrectly_implements_interface_1_2420": "A classe '{0}' implementa incorretamente a interface '{1}'.", "Class_0_used_before_its_declaration_2449": "Classe '{0}' usada antes de sua declaração.", - "Class_constructor_may_not_be_a_generator_1360": "O construtor de classe não pode ser um gerador.", + "Class_constructor_may_not_be_a_generator_1368": "O construtor de classe não pode ser um gerador.", "Class_constructor_may_not_be_an_accessor_1341": "O construtor de classe não pode ser um acessador.", "Class_declaration_cannot_implement_overload_list_for_0_2813": "A declaração da classe não pode implementar a lista de sobrecarga para '{0}'.", "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025": "As declarações de classe não podem ter mais de uma marca '@augments' ou '@extends'.", @@ -430,6 +431,7 @@ "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "A conversão do tipo '{0}' para o tipo '{1}' pode ser um erro porque nenhum tipo está suficientemente sobreposto ao outro. Se isso era intencional, converta a expressão para 'unknown' primeiro.", "Convert_0_to_1_in_0_95003": "Converter '{0}' em '{1} em {0}'", "Convert_0_to_mapped_object_type_95055": "Converter '{0}' para o tipo de objeto mapeado", + "Convert_all_const_to_let_95102": "Converta todos os 'const' para 'let'", "Convert_all_constructor_functions_to_classes_95045": "Converter todas as funções de construtor em classes", "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "Converter todas as importações não usadas como um valor para importações somente de tipo", "Convert_all_invalid_characters_to_HTML_entity_code_95101": "Converter todos os caracteres inválidos em código de entidade HTML", @@ -919,7 +921,7 @@ "Method_not_implemented_95158": "Método não implementado.", "Modifiers_cannot_appear_here_1184": "Modificadores não podem aparecer aqui.", "Module_0_can_only_be_default_imported_using_the_1_flag_1259": "O módulo '{0}' só pode ser importado por padrão usando o sinalizador '{1}'", - "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "Módulo '{0}' não pode ser importado usando esta constructo. O especificador só resolve para um módulo ES, que não pode ser importado de forma síncrona. Em vez disso, use a importação dinâmica.", + "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "O módulo '{0}' não pode ser importado usando esta construção. O especificador resolve apenas para um módulo ES, que não pode ser importado com 'require'. Em vez disso, use uma importação ECMAScript.", "Module_0_declares_1_locally_but_it_is_exported_as_2_2460": "O módulo '{0}' declara '{1}' localmente, mas é exportado como '{2}'.", "Module_0_declares_1_locally_but_it_is_not_exported_2459": "O módulo '{0}' declara '{1}' localmente, mas não é exportado.", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340": "O módulo '{0}' não faz referência a um tipo, mas é usado como um tipo aqui. Você quis dizer 'typeof import('{0}')'?", @@ -1103,6 +1105,7 @@ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "O projeto '{0}' está desatualizado porque o arquivo de saída '{1}' não existe", "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "O projeto '{0}' está desatualizado porque a saída foi gerada com a versão '{1}' que difere da versão atual '{2}'", "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "O projeto '{0}' está desatualizado porque a saída de sua dependência '{1}' foi alterada", + "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401": "O projeto '{0}' está desatualizado porque ocorreu um erro ao ler o arquivo '{1}'", "Project_0_is_up_to_date_6361": "O projeto '{0}' está atualizado", "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "O projeto '{0}' está atualizado porque a entrada mais recente '{1}' é mais antiga que a saída '{2}'", "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "O projeto '{0}' está atualizado, mas precisa atualizar os registros de data e hora dos arquivos de saída mais antigos que os arquivos de entrada", @@ -1110,6 +1113,7 @@ "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "Referências de projeto não podem formar um gráfico circular. Ciclo detectado: {0}", "Projects_6255": "Projetos", "Projects_in_this_build_Colon_0_6355": "Projetos neste build: {0}", + "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "Propriedades com o modificador 'acessador' estão disponíveis somente quando o alvo é ECMAScript 2015 e superior.", "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "A propriedade '{0}' não pode ter um inicializador, pois está marcado como abstrato.", "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "A propriedade '{0}' vem de uma assinatura de índice, portanto, ela precisa ser acessada com ['{0}'].", "Property_0_does_not_exist_on_type_1_2339": "A propriedade '{0}' não existe no tipo '{1}'.", @@ -1385,6 +1389,7 @@ "The_containing_arrow_function_captures_the_global_value_of_this_7041": "A função de seta contida captura o valor global de 'this'.", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "O corpo da função ou do módulo contido é muito grande para a análise de fluxo de controle.", "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "O arquivo atual é um módulo CommonJS e não pode usar 'await' no nível superior.", + "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479": "O arquivo atual é um módulo CommonJS cujas importações produzirão chamadas 'require'; no entanto, o arquivo referenciado é um módulo ECMAScript e não pode ser importado com 'require'. Considere escrever uma chamada 'import(\"{0}\")' dinâmica em vez disso.", "The_current_host_does_not_support_the_0_option_5001": "O host atual não dá suporte à opção '{0}'.", "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "A declaração de '{0}' que você provavelmente pretende usar é definida aqui", "The_declaration_was_marked_as_deprecated_here_2798": "A declaração foi marcada como preterida aqui.", @@ -1422,7 +1427,6 @@ "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362": "O lado esquerdo de uma operação aritmética deve ser do tipo 'any', 'number', 'bigint' ou um tipo enumerado.", "The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779": "O lado esquerdo de uma expressão de atribuição pode não ser um acesso opcional de propriedade.", "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364": "O lado esquerdo de uma expressão de atribuição deve ser uma variável ou um acesso à propriedade.", - "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360": "O lado esquerdo de uma expressão 'em' deve ser um identificador privado ou do tipo 'qualquer', 'cadeia de caracteres', 'número' ou 'símbolo'.", "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358": "O lado esquerdo de uma expressão 'instanceof' deve ser do tipo 'any', um tipo de objeto ou um parâmetro de tipo.", "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156": "O local usado ao exibir mensagens ao usuário (por exemplo, 'en-us')", "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136": "A profundidade máxima de dependência a ser pesquisada em arquivos node_modules e de carregamento de JavaScript.", @@ -1443,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": "O tipo de retorno de uma função assíncrona ou método precisa ser o tipo Promise global. Você quis escrever '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": "O lado direito de uma instrução 'for...in' deve ser do tipo 'any', um tipo de objeto ou um parâmetro de tipo, mas aqui ele tem o tipo '{0}'.", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363": "O lado direito de uma operação aritmética deve ser do tipo 'any', 'number', 'bigint' ou um tipo enumerado.", - "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361": "O lado direito de uma expressão 'in' não pode ser um primitivo.", "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359": "O lado direito de uma expressão 'instanceof' deve ser do tipo 'any' ou de um tipo que pode ser atribuído ao tipo de interface 'Function'.", "The_root_value_of_a_0_file_must_be_an_object_5092": "O valor raiz de um arquivo '{0}' precisa ser um objeto.", "The_shadowing_declaration_of_0_is_defined_here_18017": "A declaração de sombreamento de '{0}' é definida aqui", @@ -1464,13 +1467,14 @@ "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490": "O tipo retornado pelo método '{0}()' de um iterador deve ter uma propriedade 'value'.", "The_types_of_0_are_incompatible_between_these_types_2200": "Os tipos de '{0}' são incompatíveis entre esses tipos.", "The_types_returned_by_0_are_incompatible_between_these_types_2201": "Os tipos retornados por '{0}' são incompatíveis entre esses tipos.", + "The_value_0_cannot_be_used_here_18050": "O valor '{0}' não pode ser usado aqui.", "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "A declaração de variável de uma instrução 'for...in' não pode ter um inicializador.", "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "A declaração de variável de uma instrução 'for...of' não pode ter um inicializador.", "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "A instrução \"with\" não tem suporte. Todos os símbolos em um bloco \"with\" terão o tipo \"any\".", "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_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_0_since_the_types_1_and_2_have_no_overlap_2367": "Essa condição sempre retornará '{0}', pois os tipos '{1}' e '{2}' não têm nenhuma sobreposição.", "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?", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Esta função de construtor pode ser convertida em uma declaração de classe.", @@ -1491,7 +1495,7 @@ "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114": "Este membro precisa ter um modificador 'override' porque substitui um membro na classe base '{0}'.", "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "Este membro precisa ter um modificador 'override' porque substitui um método abstrato que é declarado na classe base '{0}'.", "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "Esse módulo só pode ser referenciado com importações/exportações de ECMAScript ligando o sinalizador '{0}' e referenciando sua exportação padrão.", - "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594": "Esse módulo é declarado com o uso de 'export =' e só pode ser usado com uma importação padrão ao usar o sinalizador '{0}'.", + "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "Este módulo é declarado com 'export =', e só pode ser usado com uma importação padrão ao usar o sinalizador '{0}'.", "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "Esta assinatura de sobrecarga não é compatível com sua assinatura de implementação.", "This_parameter_is_not_allowed_with_use_strict_directive_1346": "Este parâmetro não é permitido com a diretiva 'use strict'.", "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120": "Essa propriedade de parâmetro deve ter um comentário JSDoc com uma marca '@override' porque ela substitui um membro na classe base '{0}'.", @@ -1504,6 +1508,10 @@ "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "Esta sintaxe exige um auxiliar importado nomeado como '{1}' com parâmetros {2}, o que não é compatível com o que está em '{0}'. Considere atualizar sua versão do '{0}'.", "This_type_parameter_might_need_an_extends_0_constraint_2208": "Este parâmetro de tipo pode precisar de uma restrição `extends {0}`.", "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "Este uso de 'importar' é inválido. Chamadas 'import()' podem ser escritas, mas devem ter parênteses e não podem ter argumentos de tipo.", + "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482": "Para converter este arquivo em um módulo ECMAScript, adicione o campo `\"type\": \"module\"` a '{0}'.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481": "Para converter este arquivo em um módulo ECMAScript, altere sua extensão de arquivo para '{0}' ou adicione o campo `\"type\": \"module\"` para '{1}'.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480": "Para converter este arquivo em um módulo ECMAScript, altere sua extensão de arquivo para '{0}' ou crie um arquivo package.json local com `{ \"type\": \"module\" }`.", + "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483": "Para converter este arquivo em um módulo ECMAScript, crie um arquivo package.json local com `{ \"type\": \"module\" }`.", "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "As expressões 'await' de nível superior só são permitidas quando a opção 'module' está definida como 'es2022', 'esnext', 'system', 'node16' ou 'nodenext' e a opção 'target' está definida como ' es2017' ou superior.", "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": "As declarações de nível superior em arquivos .d.ts devem começar com um modificador 'declare' ou 'export'.", "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "Loops 'for await' de nível superior só são permitidos quando a opção 'module' está definida como 'es2022', 'esnext', 'system', 'node16' ou 'nodenext', e a opção 'target' está definida como 'es2017' ou superior.", @@ -1519,6 +1527,7 @@ "Type_0_cannot_be_used_as_an_index_type_2538": "O tipo '{0}' não pode ser usado como um tipo de índice.", "Type_0_cannot_be_used_to_index_type_1_2536": "O tipo '{0}' não pode ser usado para indexar o tipo '{1}'.", "Type_0_does_not_satisfy_the_constraint_1_2344": "O tipo '{0}' não satisfaz a restrição '{1}'.", + "Type_0_does_not_satisfy_the_expected_type_1_1360": "O tipo '{0}' não atende ao tipo esperado '{1}'.", "Type_0_has_no_call_signatures_2757": "O tipo '{0}' não tem assinaturas de chamada.", "Type_0_has_no_construct_signatures_2761": "O tipo '{0}' não tem assinaturas de constructo.", "Type_0_has_no_matching_index_signature_for_type_1_2537": "O tipo '{0}' não tem assinatura de índice correspondente para o tipo '{1}'.", @@ -1540,6 +1549,7 @@ "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412": "O tipo '{0}' não pode ser atribuído ao tipo '{1}' com 'exactOptionalPropertyTypes: true'. Considere adicionar 'undefined' ao tipo do destino.", "Type_0_is_not_comparable_to_type_1_2678": "O tipo '{0}' não pode ser comparável ao tipo '{1}'.", "Type_0_is_not_generic_2315": "O tipo '{0}' não é genérico.", + "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638": "O tipo '{0}' pode representar um valor primitivo, que não é permitido como operando direito do operador 'in'.", "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "O tipo '{0}' deve ter um método '[Symbol.asyncIterator]()' que retorna um iterador assíncrono.", "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "O tipo '{0}' deve ter um método '[Symbol.iterator]()' que retorna um iterador.", "Type_0_provides_no_match_for_the_signature_1_2658": "O tipo '{0}' fornece nenhuma correspondência para a assinatura '{1}'.", @@ -1596,6 +1606,7 @@ "Type_reference_directive_0_was_not_resolved_6120": "======== A diretiva de referência de tipo '{0}' não foi resolvida. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== A diretiva de referência de tipo '{0}' foi resolvida com sucesso para '{1}', primário: {2}. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219": "======== A diretiva de referência de tipo '{0}' foi resolvida com sucesso para '{1}' com a ID do Pacote '{2}', primário: {3}. ========", + "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037": "As expressões de satisfação de tipo só podem ser usadas em arquivos TypeScript.", "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043": "Os tipos não podem aparecer em declarações de exportação em arquivos JavaScript.", "Types_have_separate_declarations_of_a_private_property_0_2442": "Tipos têm declarações separadas de uma propriedade privada '{0}'.", "Types_of_construct_signatures_are_incompatible_2419": "Os tipos de assinaturas de constructo são incompatíveis.", @@ -1717,6 +1728,10 @@ "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "'{0}' não é uma metapropriedade para a palavra-chave '{1}'. Você quis dizer '{2}'?", "_0_is_not_allowed_as_a_parameter_name_1390": "'{0}' não é permitido como um nome de parâmetro.", "_0_is_not_allowed_as_a_variable_declaration_name_1389": "'{0}' não é permitido como um nome de declaração de variável.", + "_0_is_of_type_unknown_18046": "'{0}' é do tipo 'desconhecido'.", + "_0_is_possibly_null_18047": "'{0}' é possivelmente 'null'.", + "_0_is_possibly_null_or_undefined_18049": "'{0}' é possivelmente 'null' ou 'undefined'.", + "_0_is_possibly_undefined_18048": "'{0}' é possivelmente 'indefinido'.", "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "'{0}' é referenciado direta ou indiretamente em sua própria expressão base.", "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "'{0}' é referenciado direta ou indiretamente em sua própria anotação de tipo.", "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783": "'{0}' foi especificado mais de uma vez, portanto esse uso será substituído.", @@ -1752,6 +1767,7 @@ "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "'{0}', que não tem a anotação de tipo de retorno, implicitamente tem um tipo de retorno '{1}'.", "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "'{0}', que não tem a anotação de tipo de retorno, implicitamente tem um tipo de rendimento '{1}'.", "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "O modificador 'abstract' pode aparecer somente em uma declaração de classe, método ou propriedade.", + "accessor_modifier_can_only_appear_on_a_property_declaration_1275": "o modificador 'acessador' só pode aparecer em uma declaração de propriedade.", "and_here_6204": "e aqui.", "arguments_cannot_be_referenced_in_property_initializers_2815": "'argumentos' não podem ser referenciados em inicializadores de propriedade.", "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "\"auto\": trata os arquivos com import, export, import.meta, jsx (com jsx: react-jsx) ou formato esm (com module: node16+) como módulos.", diff --git a/lib/ru/diagnosticMessages.generated.json b/lib/ru/diagnosticMessages.generated.json index e3d29e3966b..2e5431012e9 100644 --- a/lib/ru/diagnosticMessages.generated.json +++ b/lib/ru/diagnosticMessages.generated.json @@ -186,6 +186,7 @@ "An_abstract_accessor_cannot_have_an_implementation_1318": "У абстрактного метода доступа не может быть реализации.", "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "Модификатор специальных возможностей запрещено использовать с закрытым идентификатором.", "An_accessor_cannot_have_type_parameters_1094": "Метод доступа не может иметь параметры типа.", + "An_accessor_property_cannot_be_declared_optional_1276": "Невозможно объявить свойство \"accessor\" как необязательное.", "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "Объявление окружающего модуля разрешено использовать только в рамках верхнего уровня файла.", "An_argument_for_0_was_not_provided_6210": "Не указан аргумент для \"{0}\".", "An_argument_matching_this_binding_pattern_was_not_provided_6211": "Не указан аргумент, соответствующий этому шаблону привязки.", @@ -382,7 +383,7 @@ "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720": "Класс \"{0}\" неправильно реализует класс \"{1}\". Вы хотели расширить \"{1}\" и унаследовать его члены в виде подкласса?", "Class_0_incorrectly_implements_interface_1_2420": "Класс \"{0}\" неправильно реализует интерфейс \"{1}\".", "Class_0_used_before_its_declaration_2449": "Класс \"{0}\" использован прежде, чем объявлен.", - "Class_constructor_may_not_be_a_generator_1360": "Конструктор класса не может быть генератором.", + "Class_constructor_may_not_be_a_generator_1368": "Конструктор класса не может быть генератором.", "Class_constructor_may_not_be_an_accessor_1341": "Конструктор класса не может быть методом доступа.", "Class_declaration_cannot_implement_overload_list_for_0_2813": "Объявление класса не может реализовать список перегрузок для \"{0}\".", "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025": "В объявлении класса не может использоваться более одного тега \"@augments\" или \"@extends\".", @@ -430,6 +431,7 @@ "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "Преобразование типа \"{0}\" в тип \"{1}\" может привести к ошибке, так как ни один из типов не перекрывается с другим в достаточной степени. Если это сделано намеренно, сначала преобразуйте выражение в \"unknown\".", "Convert_0_to_1_in_0_95003": "Преобразовать \"{0}\" в \"{1} в {0}\"", "Convert_0_to_mapped_object_type_95055": "Преобразовать \"{0}\" в тип сопоставленного объекта", + "Convert_all_const_to_let_95102": "Преобразовать все \"const\" в \"let\"", "Convert_all_constructor_functions_to_classes_95045": "Преобразовать все функции конструктора в классы", "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "Преобразовать все импорты, не используемые в качестве значения, в импорты, затрагивающие только тип", "Convert_all_invalid_characters_to_HTML_entity_code_95101": "Преобразовать все недопустимые символы в код сущности HTML", @@ -919,7 +921,7 @@ "Method_not_implemented_95158": "Метод не реализован.", "Modifiers_cannot_appear_here_1184": "Здесь невозможно использовать модификаторы.", "Module_0_can_only_be_default_imported_using_the_1_flag_1259": "Модуль \"{0}\" можно только импортировать по умолчанию с помощью флага \"{1}\"", - "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "Не удается импортировать модуль \"{0}\" с помощью этой конструкции. Описатель разрешается только в модуль ES, который не может быть импортирован синхронно. Вместо этого используйте динамический импорт.", + "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "Не удается импортировать модуль \"{0}\" с помощью этой конструкции. Описатель разрешается только в модуль ES, который нельзя импортировать с помощью \"require\". Вместо этого используйте импорт ECMAScript.", "Module_0_declares_1_locally_but_it_is_exported_as_2_2460": "Модуль \"{0}\" объявляет \"{1}\" локально, но он экспортируется как \"{2}\".", "Module_0_declares_1_locally_but_it_is_not_exported_2459": "Модуль \"{0}\" объявляет \"{1}\" локально, но он не экспортируется.", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340": "Модуль \"{0}\" не ссылается на тип, но используется здесь как тип. Возможно, вы хотели использовать \"typeof import('{0}')\"?", @@ -1103,6 +1105,7 @@ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Проект \"{0}\" требует обновления, так как выходного файла \"{1}\" не существует", "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "Проект \"{0}\" устарел, так как выходные данные для него были созданы с помощью версии \"{1}\", которая отличается от текущей версии \"{2}\"", "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "Проект \"{0}\" устарел, так как изменились выходные данные его зависимости \"{1}\"", + "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401": "Проект \"{0}\" устарел из-за ошибки при чтении файла \"{1}\"", "Project_0_is_up_to_date_6361": "Проект \"{0}\" не требует обновления", "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "Проект \"{0}\" актуален, так как новейшие входные данные \"{1}\" старше выходных данных \"{2}\".", "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "Проект \"{0}\" актуален, но требуется обновить метки времени файлов вывода, которые старше файлов ввода.", @@ -1110,6 +1113,7 @@ "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "Ссылки на проект не могут формировать циклический граф. Обнаружен цикл: {0}", "Projects_6255": "Проекты", "Projects_in_this_build_Colon_0_6355": "Проекты в этой сборке: {0}", + "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "Свойства с модификатором \"accessor\" доступны только при обращении к ECMAScript 2015 и более поздним версиям.", "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "Свойство \"{0}\" не может содержать инициализатор, так как оно помечено как абстрактное.", "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "Свойство \"{0}\" поступает из сигнатуры индекса, поэтому доступ к нему должен осуществляться с помощью [\"{0}\"].", "Property_0_does_not_exist_on_type_1_2339": "Свойство \"{0}\" не существует в типе \"{1}\".", @@ -1385,6 +1389,7 @@ "The_containing_arrow_function_captures_the_global_value_of_this_7041": "Содержащая стрелочная функция фиксирует глобальное значение \"this\".", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "Содержащая функция или текст модуля слишком велики для анализа потока управления.", "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "Текущий файл является модулем CommonJS и не может использовать \"await\" на верхнем уровне.", + "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479": "Текущий файл является модулем CommonJS, импорт которого приведет к вызовам \"require\"; однако файл, на который указывает ссылка, является модулем ECMAScript и не может быть импортирован с помощью \"require\". Вместо этого попробуйте написать динамический вызов \"import(\"{0}\")\".", "The_current_host_does_not_support_the_0_option_5001": "Текущий узел не поддерживает параметр \"{0}\".", "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "Здесь определяется объявление объекта \"{0}\", который вы, вероятно, намеревались использовать", "The_declaration_was_marked_as_deprecated_here_2798": "Объявление было отмечено как устаревшее.", @@ -1422,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.", @@ -1443,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}\"", @@ -1464,13 +1467,14 @@ "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490": "Тип, возвращаемый методом \"{0}()\" итератора, должен содержать свойство \"value\".", "The_types_of_0_are_incompatible_between_these_types_2200": "Типы \"{0}\" несовместимы между этими типами.", "The_types_returned_by_0_are_incompatible_between_these_types_2201": "Типы, возвращаемые \"{0}\", несовместимы между этими типами.", + "The_value_0_cannot_be_used_here_18050": "Здесь нельзя использовать значение \"{0}\".", "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "Объявление переменной оператора for...in не может содержать инициализатор.", "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "Объявление переменной оператора for...of не может содержать инициализатор.", "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "Оператор with не поддерживается. Все символы в блоке with получат тип any.", "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_since_JavaScript_compares_objects_by_reference_not_value_2839": "Это условие всегда будет возвращать ''{0}'', так как JavaScript сравнивает объекты по ссылке, а не по значению.", - "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367": "Это условие всегда будет возвращать \"{0}\", так как типы \"{1}\" и \"{2}\" не перекрываются.", "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, поскольку функция всегда определена. Возможно, вы хотите вызвать ее?", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Эту функцию конструктора можно преобразовать в объявление класса.", @@ -1491,7 +1495,7 @@ "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114": "Этот элемент должен иметь модификатор \"override\", так как он переопределяет элемент в базовом классе \"{0}\".", "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "Этот элемент должен иметь модификатор \"override\", так как он переопределяет абстрактный метод, объявленный в базовом классе \"{0}\".", "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "На этот модуль можно ссылаться только с помощью импортов/экспортов ECMAScript, включив флаг \"{0}\" и сославшись на его экспорт по умолчанию.", - "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594": "Этот модуль объявлен с помощью \"export =\" и может использоваться только с импортом по умолчанию при использовании флага \"{0}\".", + "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "Этот модуль объявлен с помощью оператора \"export =\" и может использоваться только с импортом по умолчанию при использовании флажка \"{0}\".", "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "Сигнатура перегрузки несовместима с ее сигнатурой реализации.", "This_parameter_is_not_allowed_with_use_strict_directive_1346": "Этот параметр запрещено использовать с директивой \"use strict\".", "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120": "Это свойство параметра должно иметь комментарий JSDoc с тегом \"@override\", так как он переопределяет элемент в базовом классе \"{0}\".", @@ -1504,6 +1508,10 @@ "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "Для этого синтаксиса требуется импортированный вспомогательный объект с именем \"{1}\" и параметрами ({2}), который не совместим с объектом в \"{0}\". Попробуйте обновить версию \"{0}\".", "This_type_parameter_might_need_an_extends_0_constraint_2208": "Для этого параметра типа может потребоваться ограничение \"extends {0}\".", "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "Недопустимое использование \"import\". Можно записывать вызовы \"import()\", но у них должны быть скобки и не должно быть аргументов типа.", + "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482": "Чтобы преобразовать этот файл в модуль ECMAScript, добавьте поле \"type\": \"module\" в \"{0}\".", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481": "Чтобы преобразовать этот файл в модуль ECMAScript, измените его расширение на \"{0}\" или добавьте поле \"type\": \"module\" в \"{1}\".", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480": "Чтобы преобразовать этот файл в модуль ECMAScript, измените его расширение на \"{0}\" или создайте локальный файл package.json с \"{ \"type\": \"module\" }\".", + "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483": "Чтобы преобразовать этот файл в модуль ECMAScript, создайте локальный файл package.json с \"{ \"type\": \"module\" }\".", "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "Выражения ожидания верхнего уровня разрешены только в том случае, если для параметра \"module\" установлено значение \"es2022\", \"esnext\", \"system\", \"node16\" или \"nodenext\", а для параметра \"цель\" установлено значение \"es2017\" или выше.", "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": "Объявления верхнего уровня в файлах .d.ts должны начинаться с модификатора \"declare\" или \"export\".", "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "Выражения ожидания верхнего уровня разрешены, только если для параметра \"module\" установлено значение \"es2022\", \"esnext\", \"system\", \"node16\" или \"nodenext\", а для параметра \"target\" установлено значение \"es2017\" или выше.", @@ -1519,6 +1527,7 @@ "Type_0_cannot_be_used_as_an_index_type_2538": "Тип \"{0}\" невозможно использовать как тип индекса.", "Type_0_cannot_be_used_to_index_type_1_2536": "Тип \"{0}\" не может использоваться для индексации типа \"{1}\".", "Type_0_does_not_satisfy_the_constraint_1_2344": "Тип \"{0}\" не удовлетворяет ограничению \"{1}\".", + "Type_0_does_not_satisfy_the_expected_type_1_1360": "Тип \"{0}\" не соответствует ожидаемому типу \"{1}\".", "Type_0_has_no_call_signatures_2757": "Тип \"{0}\" не содержит сигнатуры вызова.", "Type_0_has_no_construct_signatures_2761": "Тип \"{0}\" не содержит сигнатуры конструкции.", "Type_0_has_no_matching_index_signature_for_type_1_2537": "Тип \"{0}\" не содержит соответствующую сигнатуру индекса для типа \"{1}\".", @@ -1540,6 +1549,7 @@ "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412": "Невозможно назначить тип \"{0}\" типу \"{1}\", когда свойство \"exactOptionalPropertyTypes\" имеет значение \"true\". Рассмотрите возможность добавления типа \"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}\".", @@ -1596,6 +1606,7 @@ "Type_reference_directive_0_was_not_resolved_6120": "======== Директива ссылки на тип \"{0}\" не разрешена. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== Директива ссылки на тип \"{0}\" успешно разрешена в \"{1}\", первичный объект: {2}. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219": "======== Директива ссылки на тип \"{0}\" успешно разрешена в \"{1}\" с идентификатором пакета \"{2}\", первичный объект: {3}. ========", + "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037": "Выражения соответствия типа можно использовать только в файлах TypeScript.", "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043": "Типы не могут отображаться в объявлениях экспорта в файлах JavaScript.", "Types_have_separate_declarations_of_a_private_property_0_2442": "Типы имеют раздельные объявления закрытого свойства \"{0}\".", "Types_of_construct_signatures_are_incompatible_2419": "Типы сигнатур конструкций несовместимы.", @@ -1717,6 +1728,10 @@ "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "\"{0}\" не является допустимым метасвойством для ключевого слова \"{1}\". Вы имели в виду \"{2}\"?", "_0_is_not_allowed_as_a_parameter_name_1390": "\"{0}\" не является допустимым именем параметра.", "_0_is_not_allowed_as_a_variable_declaration_name_1389": "Использование \"{0}\" в качестве имени объявления переменной не допускается.", + "_0_is_of_type_unknown_18046": "\"{0}\" относится к типу unknown.", + "_0_is_possibly_null_18047": "Возможно, \"{0}\" имеет значение null.", + "_0_is_possibly_null_or_undefined_18049": "Возможно, \"{0}\" имеет значение null или undefined.", + "_0_is_possibly_undefined_18048": "Возможно, \"{0}\" имеет значение undefined.", "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "На \"{0}\" есть прямые или непрямые ссылки в его собственном базовом выражении.", "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "На \"{0}\" есть прямые или непрямые ссылки в его собственной аннотации типа.", "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783": "\"{0}\" указан несколько раз, поэтому такое использование будет перезаписано.", @@ -1752,6 +1767,7 @@ "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "\"{0}\", у которого нет аннотации типа возвращаемого значения, неявно имеет тип возвращаемого значения \"{1}\".", "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "\"{0}\", у которого нет заметки с типом возвращаемого значения, неявно имеет тип yield \"{1}\".", "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "Модификатор abstract может отображаться только в объявлении класса, метода или свойства.", + "accessor_modifier_can_only_appear_on_a_property_declaration_1275": "Модификатор \"accessor\" может быть только в объявлении свойства.", "and_here_6204": "и здесь.", "arguments_cannot_be_referenced_in_property_initializers_2815": "Ссылка на \"arguments\" в инициализаторах свойств невозможна.", "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "\"auto\": обрабатывать файлы с импортом, экспортом, import.meta, jsx (с jsx: react-jsx) или форматом esm (с модулем: node16+) как файлы с модулями.", diff --git a/lib/tr/diagnosticMessages.generated.json b/lib/tr/diagnosticMessages.generated.json index 5297519a46f..1745a7341a8 100644 --- a/lib/tr/diagnosticMessages.generated.json +++ b/lib/tr/diagnosticMessages.generated.json @@ -186,6 +186,7 @@ "An_abstract_accessor_cannot_have_an_implementation_1318": "Soyut erişimcinin uygulaması olamaz.", "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "Erişilebilirlik değiştiricisi özel bir tanımlayıcıyla kullanılamıyor.", "An_accessor_cannot_have_type_parameters_1094": "Erişimci, tür parametrelerine sahip olamaz.", + "An_accessor_property_cannot_be_declared_optional_1276": "'accessor' özelliği isteğe bağlı olarak bildirilemez.", "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "Çevresel modül bildirimine yalnızca bir dosyadaki en üst düzeyde izin verilir.", "An_argument_for_0_was_not_provided_6210": "'{0}' için bağımsız değişken sağlanmadı.", "An_argument_matching_this_binding_pattern_was_not_provided_6211": "Bu bağlama deseniyle eşleşen bağımsız değişken sağlanmadı.", @@ -382,7 +383,7 @@ "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720": "'{0}' sınıfı hatalı olarak '{1}' sınıfını uyguluyor. '{1}' sınıfını genişletip üyelerini bir alt sınıf olarak devralmak mı istiyordunuz?", "Class_0_incorrectly_implements_interface_1_2420": "'{0}' sınıfı, '{1}' arabirimini yanlış uyguluyor.", "Class_0_used_before_its_declaration_2449": "'{0}' sınıfı, bildiriminden önce kullanıldı.", - "Class_constructor_may_not_be_a_generator_1360": "Sınıf oluşturucu, program yönergeleri üreten bir oluşturucu olamaz.", + "Class_constructor_may_not_be_a_generator_1368": "Sınıf oluşturucu, program yönergeleri üreten bir oluşturucu olamaz.", "Class_constructor_may_not_be_an_accessor_1341": "Sınıf oluşturucu, bir erişimci olamaz.", "Class_declaration_cannot_implement_overload_list_for_0_2813": "Sınıf bildirimi, '{0}' için aşırı yükleme listesi uygulayamaz.", "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025": "Sınıf bildirimlerinde birden fazla '@augments' veya '@extends' etiketi olamaz.", @@ -430,6 +431,7 @@ "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "Türler birbiriyle yeterince örtüşmediğinden '{0}' türünün '{1}' türüne dönüştürülmesi bir hata olabilir. Bu bilerek yapıldıysa, ifadeyi önce 'unknown' değerine dönüştürün.", "Convert_0_to_1_in_0_95003": "'{0}' öğesini '{0} içinde {1}' öğesine dönüştür", "Convert_0_to_mapped_object_type_95055": "'{0}' öğesini eşlenen nesne türüne dönüştür", + "Convert_all_const_to_let_95102": "Tüm 'const' ifadelerini 'let' ifadesine dönüştürün", "Convert_all_constructor_functions_to_classes_95045": "Tüm oluşturucu işlevleri sınıflara dönüştür", "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "Bir değer olarak kullanılmayan tüm içeri aktarmaları yalnızca tür içeri aktarmalarına dönüştürün", "Convert_all_invalid_characters_to_HTML_entity_code_95101": "Tüm geçersiz karakterleri HTML varlık koduna dönüştür", @@ -919,7 +921,7 @@ "Method_not_implemented_95158": "Metot uygulanmadı.", "Modifiers_cannot_appear_here_1184": "Değiştiriciler burada görüntülenemez.", "Module_0_can_only_be_default_imported_using_the_1_flag_1259": "'{0}' modülü yalnızca varsayılan olarak '{1}' bayrağı kullanılarak içeri aktarılabilir", - "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "'{0}' modülü bu yapı kullanılarak içeri aktarılamaz. Tanımlayıcı yalnızca eşzamanlı olarak içeri aktarılamayan bir ES modülüne çözümleniyor. Bunun yerine dinamik içeri aktarma kullanın.", + "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "'{0}' modülü bu yapı kullanılarak içe aktarılamaz. Belirtici yalnızca 'require' ile içe aktarılamayan bir ES modülüne çözümlenir. Bunun yerine bir ECMAScript içe aktarma kullanın.", "Module_0_declares_1_locally_but_it_is_exported_as_2_2460": "'{0}' modülü '{1}' öğesini yerel olarak bildiriyor ancak '{2}' olarak dışarı aktarıldı.", "Module_0_declares_1_locally_but_it_is_not_exported_2459": "'{0}' modülü '{1}' öğesini yerel olarak bildiriyor ancak dışarı aktarılmadı.", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340": "'{0}' modülü bir türe başvurmuyor ancak burada bir tür olarak kullanılmış. Şunu mu demek istediniz?: 'typeof import('{0}')'", @@ -1103,6 +1105,7 @@ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Çıkış dosyası '{1}' mevcut olmadığından '{0}' projesi güncel değil", "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "'{0}' projesinin çıkışı geçerli '{2}' sürümünden farklı olan '{1}' sürümü ile oluşturulduğundan proje güncel değil", "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "'{0}' projesinin '{1}' bağımlılığı değiştirildiğinden proje güncel değil", + "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401": "'{1}' dosyası okunurken hata oluştuğu için '{0}' projesi güncel değil", "Project_0_is_up_to_date_6361": "'{0}' projesi güncel", "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "En yeni '{1}' girişi '{2}' çıkışından daha eski olduğundan '{0}' projesi güncel", "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "'{0}' projesi güncel ancak giriş dosyalarından daha eski olan çıkış dosyalarına ait zaman damgalarının güncelleştirilmesi gerekiyor", @@ -1110,6 +1113,7 @@ "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "Proje başvuruları döngüsel bir grafik formu oluşturamaz. Döngü tespit edildi: {0}", "Projects_6255": "Projeler", "Projects_in_this_build_Colon_0_6355": "Bu derlemedeki projeler: {0}", + "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "'accessor' değiştiricisine sahip özellikler yalnızca ECMAScript 2015 ve üzeri hedeflendiğinde kullanılabilir.", "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "'{0}' özelliği abstract olarak işaretlendiğinden bir başlatıcıya sahip olamaz.", "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "'{0}' özelliği bir dizin imzasından geldiğinden ['{0}'] ile erişilmelidir.", "Property_0_does_not_exist_on_type_1_2339": "'{0}' özelliği, '{1}' türünde değil.", @@ -1385,6 +1389,7 @@ "The_containing_arrow_function_captures_the_global_value_of_this_7041": "Kapsayıcı ok işlevi, 'this' öğesinin genel değerini yakalar.", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "İçeren işlev veya modül gövdesi, denetim akışı analizi için çok büyük.", "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "Geçerli dosya bir CommonJS modülüdür ve en üst düzeyde 'await'i kullanamaz.", + "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479": "Geçerli dosya, içe aktarma işlemlerinin 'require' çağrıları üreteceği bir CommonJS modülüdür; ancak başvurulan dosya bir ECMAScript modülüdür ve 'require' ile içe aktarılamaz. Bunun yerine dinamik bir 'import(\"{0}\")' çağrısı yazmayı deneyin.", "The_current_host_does_not_support_the_0_option_5001": "Mevcut ana bilgisayar '{0}' seçeneğini desteklemiyor.", "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "Büyük olasılıkla kullanmayı amaçladığınız '{0}' bildirimi burada tanımlanır", "The_declaration_was_marked_as_deprecated_here_2798": "Bildirim burada kullanım dışı olarak işaretlendi.", @@ -1422,7 +1427,6 @@ "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362": "Aritmetik işlemin sol tarafı, 'any', 'number', 'bigint' veya bir sabit listesi türünde olmalıdır.", "The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779": "Atama ifadesinin sol tarafı, isteğe bağlı bir özellik erişimi olamaz.", "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364": "Atama ifadesinin sol tarafında bir değişken veya özellik erişimi bulunmalıdır.", - "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360": "'in' ifadesinin sol tarafı özel bir tanımlayıcı veya 'any', 'string', 'number' ya da 'symbol' türünde olmalıdır.", "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358": "'instanceof' ifadesinin sol tarafı 'any' türünde, bir nesne türü veya tür parametresi olmalıdır.", "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156": "Kullanıcıya ileti görüntülenirken kullanılacak yerel ayar (örn. 'tr-tr')", "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136": "node_modules altında arama yapmak ve JavaScript dosyalarını yüklemek için en yüksek bağımlılık derinliği.", @@ -1443,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": "Asenkron bir işlevin ya da metodun dönüş türü, genel Promise türü olmalıdır. 'Promise<{0}>' yazmak mı istediniz?", "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' deyiminin sağ tarafı 'any' türünde, bir nesne türü veya tür parametresi olmalıdır ancak burada '{0}' türüne sahip.", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363": "Aritmetik işlemin sağ tarafı, 'any', 'number', 'bigint' veya bir sabit listesi türünde olmalıdır.", - "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361": "'in' ifadesinin sağ tarafı basit olmamalıdır.", "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359": "'instanceof' ifadesinin sağ tarafı 'any' türünde veya 'Function' arabirim türüne atanabilir bir türde olmalıdır.", "The_root_value_of_a_0_file_must_be_an_object_5092": "'{0}' dosyasının kök değeri bir nesne olmalıdır.", "The_shadowing_declaration_of_0_is_defined_here_18017": "'{0}' için gölgeleme bildirimi burada tanımlanır", @@ -1464,13 +1467,14 @@ "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490": "Bir yineleyicinin '{0}()' metodu tarafından döndürülen tür, 'value' özelliğine sahip olmalıdır.", "The_types_of_0_are_incompatible_between_these_types_2200": "'{0}' türleri bu türler arasında uyumsuz.", "The_types_returned_by_0_are_incompatible_between_these_types_2201": "'{0}' tarafından döndürülen türler, bu türler arasında uyumsuz.", + "The_value_0_cannot_be_used_here_18050": "'{0}' değeri burada kullanılamaz.", "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "'for...in' deyiminin değişken bildirimi bir başlatıcıya sahip olamaz.", "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "'for...of' deyiminin değişken bildirimi bir başlatıcıya sahip olamaz.", "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "'with' ifadesi desteklenmiyor. 'with' bloklarındaki tüm simgeler 'any' türüne sahip olacaktır.", "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746": "Bu JSX etiketinin '{0}' özelliği, '{1}' türünde tek bir alt öğe bekliyor ancak birden çok alt öğe sağlandı.", "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745": "Bu JSX etiketinin '{0}' özelliği, birden çok alt öğe gerektiren '{1}' türünü bekliyor ancak yalnızca tek bir alt öğe sağlandı.", + "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367": "'{0}' ve '{1}' türlerinde çakışma olmadığından bu karşılaştırma yanlışlıkla yapılmış gibi görünüyor.", "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839": "JavaScript nesneleri değer göre değil başvuruya göre karşılaştırdığından bu koşul her zaman '{0}' değerini döndürür.", - "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367": "'{1}' ve '{2}' türleri çakışmadığından bu koşul her zaman '{0}' döndürür.", "This_condition_will_always_return_true_since_this_0_is_always_defined_2801": "Bu '{0}' her zaman tanımlandığı için bu koşul her zaman doğru olacaktır.", "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774": "İşlev her zaman tanımlı olduğundan bu koşul her zaman true döndürür. Bunun yerine işlevi çağırmayı mı istediniz?", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Bu oluşturucu işlevi bir sınıf bildirimine dönüştürülebilir.", @@ -1491,7 +1495,7 @@ "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114": "Bu üye, '{0}' temel sınıfındaki bir üyeyi geçersiz kıldığından 'override' değiştiricisine sahip olmalıdır.", "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "Bu üye, '{0}' temel sınıfında bildirilen soyut bir metodu geçersiz kıldığından 'override' değiştiricisine sahip olmalıdır.", "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "Bu modüle yalnızca '{0}' bayrağını açıp modülün varsayılan dışarı aktarma işlemine başvurarak ECMAScript içeri/dışarı aktarma işlemleri ile başvurulabilir.", - "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594": "Bu modül, 'export =' kullanılarak bildirildi ve yalnızca '{0}' bayrağı kullanılırken varsayılan bir içeri aktarma ile kullanılabilir.", + "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "Bu modül, 'export =' ile bildirildi ve yalnızca '{0}' bayrağı kullanılırken varsayılan bir içeri aktarmayla kullanılabilir.", "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "Bu aşırı yükleme imzası, uygulama imzasıyla uyumlu değil.", "This_parameter_is_not_allowed_with_use_strict_directive_1346": "Bu parametreye 'use strict' yönergesi ile izin verilmiyor.", "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120": "' {0}' temel sınıfındaki bir üyeyi geçersiz kıldığından, bu parametre özelliğinin '@override' etiketi olan bir JSDoc yorumu olmalıdır.", @@ -1504,6 +1508,10 @@ "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "Bu söz dizimi, '{0}' içindeki yardımcı ile uyumlu olmayan, {2} parametreye sahip '{1}' adlı içeri aktarılan yardımcıyı gerektiriyor. '{0}' sürümünüzü yükseltmeyi düşünün.", "This_type_parameter_might_need_an_extends_0_constraint_2208": "Bu tür parametresinin bir `extends {0}` kısıtlamasına ihtiyacı olabilir.", "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "'import' çağrısının bu kullanımı geçersiz. 'import()' çağrıları yazılabilir ancak ayraç içermeleri gerekir ve tür bağımsız değişkenleri içeremezler.", + "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482": "Bu dosyayı bir ECMAScript modülüne dönüştürmek için, '{0}' dizinine `\"type\": \"module\"` alanı ekleyin.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481": "Bu dosyayı bir ECMAScript modülüne dönüştürmek için dosya uzantısını '{0}' olarak değiştirin veya '{1}' dizinine ''type': 'module'' alanı ekleyin.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480": "Bu dosyayı bir ECMAScript modülüne dönüştürmek için dosya uzantısını '{0}' olarak değiştirin veya `{ \"type\": \"module\" }` ile yerel bir package.json dosyası oluşturun.", + "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483": "Bu dosyayı bir ECMAScript modülüne dönüştürmek için, `{ \"type\": \"module\" }` ile yerel bir package.json dosyası oluşturun.", "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "Üst düzey 'await' ifadelerine yalnızca 'module' seçeneği 'es2022', 'esnext', 'system', 'node16' veya 'nodenext' olarak ayarlandığında ve 'target' seçeneği 'es2017' veya üzeri olarak ayarlandığında izin verilir.", "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": ".d.ts dosyalarındaki üst düzey bildirimler bir 'declare' veya 'export' değiştiricisi ile başlamalıdır.", "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "Üst düzey 'bekleme için' döngülerine yalnızca 'modül' seçeneği 'es2022', 'esnext', 'system', 'node16' veya 'nodenext' olarak ayarlandığında ve 'target' seçeneği 'es2017' veya üstü olarak ayarlandığında izin verilir.", @@ -1519,6 +1527,7 @@ "Type_0_cannot_be_used_as_an_index_type_2538": "'{0}' türü, dizin türü olarak kullanılamaz.", "Type_0_cannot_be_used_to_index_type_1_2536": "'{0}' türü, '{1}' türünü dizinlemek için kullanılamaz.", "Type_0_does_not_satisfy_the_constraint_1_2344": "'{0}' türü, '{1}' kısıtlamasını karşılamıyor.", + "Type_0_does_not_satisfy_the_expected_type_1_1360": "'{0}' türü, beklenen '{1}' türünü karşılamıyor.", "Type_0_has_no_call_signatures_2757": "'{0}' türünün çağrı imzası yok.", "Type_0_has_no_construct_signatures_2761": "'{0}' türünün oluşturma imzası yok.", "Type_0_has_no_matching_index_signature_for_type_1_2537": "'{0}' türü, '{1}' türüyle eşleşen dizin imzasına sahip değil.", @@ -1540,6 +1549,7 @@ "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412": "'{0}' türü, '{1}' türüne 'exactOptionalPropertyTypes: true' ile atanamaz. Hedef türüne 'undefined' eklemeyi deneyin.", "Type_0_is_not_comparable_to_type_1_2678": "'{0}' türü '{1}' türüyle karşılaştırılamaz.", "Type_0_is_not_generic_2315": "'{0}' türü genel değil.", + "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638": "'{0}' tipi, 'in' operatörünün doğru işleneni olarak izin verilmeyen temel bir değeri temsil edebilir.", "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "'{0}' türünün, zaman uyumsuz bir yineleyici döndüren bir '[Symbol.asyncIterator]()' metoduna sahip olması gerekir.", "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "'{0}' türünün, bir yineleyici döndüren '[Symbol.iterator]()' metoduna sahip olması gerekir.", "Type_0_provides_no_match_for_the_signature_1_2658": "'{0}' türü, '{1}' imzası için eşleşme sağlamıyor.", @@ -1596,6 +1606,7 @@ "Type_reference_directive_0_was_not_resolved_6120": "======== '{0}' tür başvuru yönergesi çözümlenmedi. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== '{0}' tür başvuru yönergesi '{1}' olarak başarıyla çözümlendi, birincil: {2}. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219": "======== '{0}' tür başvuru yönergesi '{2}' Paket Kimliğine sahip '{1}' olarak başarıyla çözümlendi, birincil: {3}. ========", + "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037": "Tür karşılama ifadeleri yalnızca TypeScript dosyalarında kullanılabilir.", "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043": "Türler, JavaScript dosyalarında dışarı aktarma bildirimlerinde görünemez.", "Types_have_separate_declarations_of_a_private_property_0_2442": "Türler, '{0}' özel özelliğinin ayrı bildirimlerine sahip.", "Types_of_construct_signatures_are_incompatible_2419": "Yapı imzalarının türleri uyumsuz.", @@ -1717,6 +1728,10 @@ "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "'{0}', '{1}' anahtar sözcüğü için geçerli bir meta özellik değil. Bunu mu demek istediniz: '{2}'?", "_0_is_not_allowed_as_a_parameter_name_1390": "'{0}' öğesine parametre adı olarak izin verilmiyor.", "_0_is_not_allowed_as_a_variable_declaration_name_1389": "'{0}' öğesinin değişken bildirim adı olarak kullanılmasına izin verilmiyor.", + "_0_is_of_type_unknown_18046": "'{0}' 'unknown' türünde.", + "_0_is_possibly_null_18047": "'{0}' değerinin 'null' olması olasıdır.", + "_0_is_possibly_null_or_undefined_18049": "'{0}' değerinin 'null' veya 'undefined' olması olasıdır.", + "_0_is_possibly_undefined_18048": "'{0}' değerinin 'undefined' olması olasıdır.", "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "'{0}' öğesine kendi temel ifadesinde doğrudan veya dolaylı olarak başvuruluyor.", "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "'{0}' öğesine kendi tür ek açıklamasında doğrudan veya dolaylı olarak başvuruluyor.", "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783": "'{0}' birden çok kez belirtildiğinden bu kullanımın üzerine yazılacak.", @@ -1752,6 +1767,7 @@ "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "Dönüş türü ek açıklaması olmayan '{0}', örtük olarak '{1}' dönüş türüne sahip.", "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "Dönüş türü ek açıklaması olmayan '{0}', örtük olarak '{1}' yield türüne sahip.", "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "'abstract' değiştiricisi yalnızca sınıf, metot veya özellik bildiriminde görünebilir.", + "accessor_modifier_can_only_appear_on_a_property_declaration_1275": "'accessor' değiştiricisi yalnızca özellik bildiriminde görünebilir.", "and_here_6204": "ve buraya.", "arguments_cannot_be_referenced_in_property_initializers_2815": "Özellik başlatıcılarda 'arguments' öğesine başvurulamaz.", "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "\"auto\": İçe aktarma, dışa aktarma, import.meta, jsx (jsx: react-jsx ile) veya esm biçimi (modül: node16+ ile) içeren dosyaları modül olarak ele alın.", diff --git a/lib/tsc.js b/lib/tsc.js index ab79f9e91fe..dc10999c8fe 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -68,8 +68,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) { }; var ts; (function (ts) { - ts.versionMajorMinor = "4.8"; - ts.version = "4.8.3"; + ts.versionMajorMinor = "4.9"; + ts.version = "".concat(ts.versionMajorMinor, ".0-beta"); var NativeCollections; (function (NativeCollections) { var globals = typeof globalThis !== "undefined" ? globalThis : @@ -78,24 +78,25 @@ var ts; undefined; function tryGetNativeMap() { var gMap = globals === null || globals === void 0 ? void 0 : globals.Map; - return typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; + var constructor = typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; + if (!constructor) { + throw new Error("No compatible Map implementation found."); + } + return constructor; } NativeCollections.tryGetNativeMap = tryGetNativeMap; function tryGetNativeSet() { var gSet = globals === null || globals === void 0 ? void 0 : globals.Set; - return typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; + var constructor = typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; + if (!constructor) { + throw new Error("No compatible Set implementation found."); + } + return constructor; } NativeCollections.tryGetNativeSet = tryGetNativeSet; })(NativeCollections || (NativeCollections = {})); - ts.Map = getCollectionImplementation("Map", "tryGetNativeMap", "createMapShim"); - ts.Set = getCollectionImplementation("Set", "tryGetNativeSet", "createSetShim"); - function getCollectionImplementation(name, nativeFactory, shimFactory) { - var _a; - var constructor = (_a = NativeCollections[nativeFactory]()) !== null && _a !== void 0 ? _a : ts.ShimCollections === null || ts.ShimCollections === void 0 ? void 0 : ts.ShimCollections[shimFactory](ts.getIterator); - if (constructor) - return constructor; - throw new Error("TypeScript requires an environment that provides a compatible native ".concat(name, " implementation.")); - } + ts.Map = NativeCollections.tryGetNativeMap(); + ts.Set = NativeCollections.tryGetNativeSet(); })(ts || (ts = {})); var ts; (function (ts) { @@ -759,15 +760,18 @@ var ts; function insertSorted(array, insert, compare, allowDuplicates) { if (array.length === 0) { array.push(insert); - return; + return true; } var insertIndex = binarySearch(array, insert, identity, compare); if (insertIndex < 0) { array.splice(~insertIndex, 0, insert); + return true; } - else if (allowDuplicates) { + if (allowDuplicates) { array.splice(insertIndex, 0, insert); + return true; } + return false; } ts.insertSorted = insertSorted; function sortAndDeduplicate(array, comparer, equalityComparer) { @@ -1001,6 +1005,10 @@ var ts; : undefined; } ts.singleOrUndefined = singleOrUndefined; + function single(array) { + return ts.Debug.checkDefined(singleOrUndefined(array)); + } + ts.single = single; function singleOrMany(array) { return array && array.length === 1 ? array[0] @@ -2258,7 +2266,7 @@ var ts; if (typeof func !== "function") { return ""; } - else if (func.hasOwnProperty("name")) { + else if (ts.hasProperty(func, "name")) { return func.name; } else { @@ -2556,7 +2564,7 @@ var ts; ]; for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) { var ctor = nodeConstructors_1[_i]; - if (!ctor.prototype.hasOwnProperty("__debugKind")) { + if (!ts.hasProperty(ctor.prototype, "__debugKind")) { Object.defineProperties(ctor.prototype, { __tsDebuggerDisplay: { value: function () { @@ -3022,6 +3030,8 @@ var ts; typeof performance.mark === "function" && typeof performance.measure === "function" && typeof performance.now === "function" && + typeof performance.clearMarks === "function" && + typeof performance.clearMeasures === "function" && typeof PerformanceObserver === "function"; } function tryGetWebPerformanceHooks() { @@ -3059,7 +3069,9 @@ var ts; if (end === "__performance.measure-fix__") { nodePerformance_1.clearMarks("__performance.measure-fix__"); } - } + }, + clearMarks: function (name) { return nodePerformance_1.clearMarks(name); }, + clearMeasures: function (name) { return nodePerformance_1.clearMeasures(name); }, }; } return { @@ -3154,6 +3166,30 @@ var ts; durations.forEach(function (duration, measureName) { return cb(measureName, duration); }); } performance.forEachMeasure = forEachMeasure; + function forEachMark(cb) { + marks.forEach(function (_time, markName) { return cb(markName); }); + } + performance.forEachMark = forEachMark; + function clearMeasures(name) { + if (name !== undefined) + durations.delete(name); + else + durations.clear(); + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMeasures(name); + } + performance.clearMeasures = clearMeasures; + function clearMarks(name) { + if (name !== undefined) { + counts.delete(name); + marks.delete(name); + } + else { + counts.clear(); + marks.clear(); + } + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMarks(name); + } + performance.clearMarks = clearMarks; function isEnabled() { return enabled; } @@ -3232,7 +3268,6 @@ var ts; var typeCatalog = []; var legendPath; var legend = []; - ; function startTracing(tracingMode, traceDir, configFilePath) { ts.Debug.assert(!ts.tracing, "Tracing already started"); if (fs === undefined) { @@ -3410,7 +3445,7 @@ var ts; var substitutionType = type; substitutionProperties = { substitutionBaseType: (_o = substitutionType.baseType) === null || _o === void 0 ? void 0 : _o.id, - substituteType: (_p = substitutionType.substitute) === null || _p === void 0 ? void 0 : _p.id, + constraintType: (_p = substitutionType.constraint) === null || _p === void 0 ? void 0 : _p.id, }; } var reverseMappedProperties = {}; @@ -3697,7 +3732,6 @@ var ts; createPollingIntervalBasedLevels(customLevels ? __assign(__assign({}, defaultLevels), customLevels) : defaultLevels); } } - ts.setCustomPollingValues = setCustomPollingValues; function pollWatchedFileQueue(host, queue, pollIndex, chunkSize, callbackOnWatchFileStat) { var definedValueCopyToIndex = pollIndex; for (var canVisit = queue.length; chunkSize && canVisit; nextPollIndex(), canVisit--) { @@ -3835,7 +3869,6 @@ var ts; pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === PollingInterval.Low ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval)); } } - ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile; function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) { var fileWatcherCallbacks = ts.createMultiMap(); var dirWatchers = new ts.Map(); @@ -3910,37 +3943,31 @@ var ts; pollScheduled = host.setTimeout(pollQueue, PollingInterval.High); } } - function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) { - var cache = new ts.Map(); - var callbacksCache = ts.createMultiMap(); + function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) { var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); - return function (fileName, callback, pollingInterval, options) { - var path = toCanonicalFileName(fileName); - var existing = cache.get(path); - if (existing) { - existing.refCount++; + var path = toCanonicalFileName(name); + var existing = cache.get(path); + if (existing) { + existing.callbacks.push(callback); + } + else { + cache.set(path, { + watcher: createWatcher((function (param1, param2, param3) { var _a; return (_a = cache.get(path)) === null || _a === void 0 ? void 0 : _a.callbacks.slice().forEach(function (cb) { return cb(param1, param2, param3); }); })), + callbacks: [callback] + }); + } + return { + close: function () { + var watcher = cache.get(path); + if (!watcher) + return; + if (!ts.orderedRemoveItem(watcher.callbacks, callback) || watcher.callbacks.length) + return; + cache.delete(path); + ts.closeFileWatcherOf(watcher); } - else { - cache.set(path, { - watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options), - refCount: 1 - }); - } - callbacksCache.add(path, callback); - return { - close: function () { - var watcher = ts.Debug.checkDefined(cache.get(path)); - callbacksCache.remove(path, callback); - watcher.refCount--; - if (watcher.refCount) - return; - cache.delete(path); - ts.closeFileWatcherOf(watcher); - } - }; }; } - ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName; function onWatchedFileStat(watchedFile, modifiedTime) { var oldTime = watchedFile.mtime.getTime(); var newTime = modifiedTime.getTime(); @@ -3951,7 +3978,6 @@ var ts; } return false; } - ts.onWatchedFileStat = onWatchedFileStat; function getFileWatcherEventKind(oldTime, newTime) { return oldTime === 0 ? FileWatcherEventKind.Created @@ -4158,11 +4184,9 @@ var ts; return ts.stringContains(toCanonicalFilePath(path), searchPath); } } - ts.createDirectoryWatcherSupportingRecursive = createDirectoryWatcherSupportingRecursive; function createFileWatcherCallback(callback) { return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); }; } - ts.createFileWatcherCallback = createFileWatcherCallback; function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) { return function (eventName, _relativeFileName, modifiedTime) { if (eventName === "rename") { @@ -4189,7 +4213,10 @@ var ts; }; } function createSystemWatchFunctions(_a) { - var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog; + var pollingWatchFileWorker = _a.pollingWatchFileWorker, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog; + var pollingWatches = new ts.Map(); + var fsWatches = new ts.Map(); + var fsWatchesRecursive = new ts.Map(); var dynamicPollingWatchFile; var fixedChunkSizePollingWatchFile; var nonPollingWatchFile; @@ -4245,7 +4272,7 @@ var ts; default: return useNonPollingWatchers ? generateWatchFileOptions(ts.WatchFileKind.UseFsEventsOnParentDirectory, ts.PollingWatchKind.PriorityInterval, options) : - { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.FixedPollingInterval }; + { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.UseFsEvents }; } } function generateWatchFileOptions(watchFile, fallbackPolling, options) { @@ -4310,7 +4337,13 @@ var ts; }; } } + function pollingWatchFile(fileName, callback, pollingInterval, options) { + return createSingleWatcherPerName(pollingWatches, useCaseSensitiveFileNames, fileName, callback, function (cb) { return pollingWatchFileWorker(fileName, cb, pollingInterval, options); }); + } function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { + return createSingleWatcherPerName(recursive ? fsWatchesRecursive : fsWatches, useCaseSensitiveFileNames, fileOrDirectory, callback, function (cb) { return fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, cb, recursive, fallbackPollingInterval, fallbackOptions); }); + } + function fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { var lastDirectoryPartWithDirectorySeparator; var lastDirectoryPart; if (inodeWatching) { @@ -4448,7 +4481,7 @@ var ts; var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin"); var getCurrentDirectory = ts.memoize(function () { return process.cwd(); }); var _b = createSystemWatchFunctions({ - pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames), + pollingWatchFileWorker: fsWatchFileWorker, getModifiedTime: getModifiedTime, setTimeout: setTimeout, clearTimeout: clearTimeout, @@ -5081,12 +5114,9 @@ var ts; } ts.getPathFromPathComponents = getPathFromPathComponents; function normalizeSlashes(path) { - var index = path.indexOf("\\"); - if (index === -1) { - return path; - } - backslashRegExp.lastIndex = index; - return path.replace(backslashRegExp, ts.directorySeparator); + return path.indexOf("\\") !== -1 + ? path.replace(backslashRegExp, ts.directorySeparator) + : path; } ts.normalizeSlashes = normalizeSlashes; function reducePathComponents(components) { @@ -5589,6 +5619,8 @@ var ts; A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled: diag(1272, ts.DiagnosticCategory.Error, "A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_w_1272", "A type referenced in a decorated signature must be imported with 'import type' or a namespace import when 'isolatedModules' and 'emitDecoratorMetadata' are enabled."), _0_modifier_cannot_appear_on_a_type_parameter: diag(1273, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_type_parameter_1273", "'{0}' modifier cannot appear on a type parameter"), _0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias: diag(1274, ts.DiagnosticCategory.Error, "_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias_1274", "'{0}' modifier can only appear on a type parameter of a class, interface or type alias"), + accessor_modifier_can_only_appear_on_a_property_declaration: diag(1275, ts.DiagnosticCategory.Error, "accessor_modifier_can_only_appear_on_a_property_declaration_1275", "'accessor' modifier can only appear on a property declaration."), + An_accessor_property_cannot_be_declared_optional: diag(1276, ts.DiagnosticCategory.Error, "An_accessor_property_cannot_be_declared_optional_1276", "An 'accessor' property cannot be declared optional."), with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."), await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."), The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, ts.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."), @@ -5639,7 +5671,7 @@ var ts; An_enum_member_name_must_be_followed_by_a_or: diag(1357, ts.DiagnosticCategory.Error, "An_enum_member_name_must_be_followed_by_a_or_1357", "An enum member name must be followed by a ',', '=', or '}'."), Tagged_template_expressions_are_not_permitted_in_an_optional_chain: diag(1358, ts.DiagnosticCategory.Error, "Tagged_template_expressions_are_not_permitted_in_an_optional_chain_1358", "Tagged template expressions are not permitted in an optional chain."), Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here: diag(1359, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here_1359", "Identifier expected. '{0}' is a reserved word that cannot be used here."), - Class_constructor_may_not_be_a_generator: diag(1360, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1360", "Class constructor may not be a generator."), + Type_0_does_not_satisfy_the_expected_type_1: diag(1360, ts.DiagnosticCategory.Error, "Type_0_does_not_satisfy_the_expected_type_1_1360", "Type '{0}' does not satisfy the expected type '{1}'."), _0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type: diag(1361, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type_1361", "'{0}' cannot be used as a value because it was imported using 'import type'."), _0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type: diag(1362, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type_1362", "'{0}' cannot be used as a value because it was exported using 'export type'."), A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both: diag(1363, ts.DiagnosticCategory.Error, "A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both_1363", "A type-only import can specify a default import or named bindings, but not both."), @@ -5647,6 +5679,7 @@ var ts; Convert_all_re_exported_types_to_type_only_exports: diag(1365, ts.DiagnosticCategory.Message, "Convert_all_re_exported_types_to_type_only_exports_1365", "Convert all re-exported types to type-only exports"), Split_into_two_separate_import_declarations: diag(1366, ts.DiagnosticCategory.Message, "Split_into_two_separate_import_declarations_1366", "Split into two separate import declarations"), Split_all_invalid_type_only_imports: diag(1367, ts.DiagnosticCategory.Message, "Split_all_invalid_type_only_imports_1367", "Split all invalid type-only imports"), + Class_constructor_may_not_be_a_generator: diag(1368, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1368", "Class constructor may not be a generator."), Did_you_mean_0: diag(1369, ts.DiagnosticCategory.Message, "Did_you_mean_0_1369", "Did you mean '{0}'?"), This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error: diag(1371, ts.DiagnosticCategory.Error, "This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set__1371", "This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'."), Convert_to_type_only_import: diag(1373, ts.DiagnosticCategory.Message, "Convert_to_type_only_import_1373", "Convert to type-only import"), @@ -5820,14 +5853,12 @@ var ts; The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."), The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."), The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."), - The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360", "The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."), - The_right_hand_side_of_an_in_expression_must_not_be_a_primitive: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361", "The right-hand side of an 'in' expression must not be a primitive."), The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."), Operator_0_cannot_be_applied_to_types_1_and_2: diag(2365, ts.DiagnosticCategory.Error, "Operator_0_cannot_be_applied_to_types_1_and_2_2365", "Operator '{0}' cannot be applied to types '{1}' and '{2}'."), Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: diag(2366, ts.DiagnosticCategory.Error, "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", "Function lacks ending return statement and return type does not include 'undefined'."), - This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367", "This condition will always return '{0}' since the types '{1}' and '{2}' have no overlap."), + This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367", "This comparison appears to be unintentional because the types '{0}' and '{1}' have no overlap."), Type_parameter_name_cannot_be_0: diag(2368, ts.DiagnosticCategory.Error, "Type_parameter_name_cannot_be_0_2368", "Type parameter name cannot be '{0}'."), A_parameter_property_is_only_allowed_in_a_constructor_implementation: diag(2369, ts.DiagnosticCategory.Error, "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", "A parameter property is only allowed in a constructor implementation."), A_rest_parameter_must_be_of_an_array_type: diag(2370, ts.DiagnosticCategory.Error, "A_rest_parameter_must_be_of_an_array_type_2370", "A rest parameter must be of an array type."), @@ -6070,6 +6101,7 @@ var ts; Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."), Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation: diag(2636, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation_2636", "Type '{0}' is not assignable to type '{1}' as implied by variance annotation."), Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types: diag(2637, ts.DiagnosticCategory.Error, "Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_t_2637", "Variance annotations are only supported in type aliases for object, function, constructor, and mapped types."), + Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator: diag(2638, ts.DiagnosticCategory.Error, "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638", "Type '{0}' may represent a primitive value, which is not permitted as the right operand of the 'in' operator."), Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."), A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."), Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."), @@ -6250,6 +6282,7 @@ var ts; _0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation: diag(2842, ts.DiagnosticCategory.Error, "_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842", "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"), We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here: diag(2843, ts.DiagnosticCategory.Error, "We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843", "We can only write a type for '{0}' by adding a type for the entire parameter here."), Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, ts.DiagnosticCategory.Error, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."), + This_condition_will_always_return_0: diag(2845, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."), Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."), Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."), Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."), @@ -6707,6 +6740,7 @@ var ts; Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved: diag(6398, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."), Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes were not emitted"), Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs to update timestamps of output files that are older than input files"), + Project_0_is_out_of_date_because_there_was_error_reading_file_1: diag(6401, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401", "Project '{0}' is out of date because there was error reading file '{1}'"), The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"), The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."), The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."), @@ -6949,6 +6983,7 @@ var ts; The_tag_was_first_specified_here: diag(8034, ts.DiagnosticCategory.Error, "The_tag_was_first_specified_here_8034", "The tag was first specified here."), You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder: diag(8035, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder_8035", "You cannot rename elements that are defined in a 'node_modules' folder."), You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder: diag(8036, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder_8036", "You cannot rename elements that are defined in another 'node_modules' folder."), + Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files: diag(8037, ts.DiagnosticCategory.Error, "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037", "Type satisfaction expressions can only be used in TypeScript files."), Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."), Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."), JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17000, ts.DiagnosticCategory.Error, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."), @@ -7120,6 +7155,7 @@ var ts; Set_the_module_option_in_your_configuration_file_to_0: diag(95099, ts.DiagnosticCategory.Message, "Set_the_module_option_in_your_configuration_file_to_0_95099", "Set the 'module' option in your configuration file to '{0}'"), Convert_invalid_character_to_its_html_entity_code: diag(95100, ts.DiagnosticCategory.Message, "Convert_invalid_character_to_its_html_entity_code_95100", "Convert invalid character to its html entity code"), Convert_all_invalid_characters_to_HTML_entity_code: diag(95101, ts.DiagnosticCategory.Message, "Convert_all_invalid_characters_to_HTML_entity_code_95101", "Convert all invalid characters to HTML entity code"), + Convert_all_const_to_let: diag(95102, ts.DiagnosticCategory.Message, "Convert_all_const_to_let_95102", "Convert all 'const' to 'let'"), Convert_function_expression_0_to_arrow_function: diag(95105, ts.DiagnosticCategory.Message, "Convert_function_expression_0_to_arrow_function_95105", "Convert function expression '{0}' to arrow function"), Convert_function_declaration_0_to_arrow_function: diag(95106, ts.DiagnosticCategory.Message, "Convert_function_declaration_0_to_arrow_function_95106", "Convert function declaration '{0}' to arrow function"), Fix_all_implicit_this_errors: diag(95107, ts.DiagnosticCategory.Message, "Fix_all_implicit_this_errors_95107", "Fix all implicit-'this' errors"), @@ -7189,6 +7225,8 @@ var ts; Delete_unused_param_tag_0: diag(95171, ts.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"), Delete_all_unused_param_tags: diag(95172, ts.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"), Rename_param_tag_name_0_to_1: diag(95173, ts.DiagnosticCategory.Message, "Rename_param_tag_name_0_to_1_95173", "Rename '@param' tag name '{0}' to '{1}'"), + Use_0: diag(95174, ts.DiagnosticCategory.Message, "Use_0_95174", "Use `{0}`."), + Use_Number_isNaN_in_all_conditions: diag(95175, ts.DiagnosticCategory.Message, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."), No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."), Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."), JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, ts.DiagnosticCategory.Error, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"), @@ -7222,6 +7260,12 @@ var ts; _0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation: diag(18042, ts.DiagnosticCategory.Error, "_0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation_18042", "'{0}' is a type and cannot be imported in JavaScript files. Use '{1}' in a JSDoc type annotation."), Types_cannot_appear_in_export_declarations_in_JavaScript_files: diag(18043, ts.DiagnosticCategory.Error, "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043", "Types cannot appear in export declarations in JavaScript files."), _0_is_automatically_exported_here: diag(18044, ts.DiagnosticCategory.Message, "_0_is_automatically_exported_here_18044", "'{0}' is automatically exported here."), + Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher: diag(18045, ts.DiagnosticCategory.Error, "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045", "Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher."), + _0_is_of_type_unknown: diag(18046, ts.DiagnosticCategory.Error, "_0_is_of_type_unknown_18046", "'{0}' is of type 'unknown'."), + _0_is_possibly_null: diag(18047, ts.DiagnosticCategory.Error, "_0_is_possibly_null_18047", "'{0}' is possibly 'null'."), + _0_is_possibly_undefined: diag(18048, ts.DiagnosticCategory.Error, "_0_is_possibly_undefined_18048", "'{0}' is possibly 'undefined'."), + _0_is_possibly_null_or_undefined: diag(18049, ts.DiagnosticCategory.Error, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."), + The_value_0_cannot_be_used_here: diag(18050, ts.DiagnosticCategory.Error, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."), }; })(ts || (ts = {})); var ts; @@ -7237,12 +7281,13 @@ var ts; ts.tokenIsIdentifierOrKeywordOrGreaterThan = tokenIsIdentifierOrKeywordOrGreaterThan; ts.textToKeywordObj = (_a = { abstract: 126, - any: 130, - as: 127, - asserts: 128, - assert: 129, - bigint: 158, - boolean: 133, + accessor: 127, + any: 131, + as: 128, + asserts: 129, + assert: 130, + bigint: 160, + boolean: 134, break: 81, case: 82, catch: 83, @@ -7250,9 +7295,9 @@ var ts; continue: 86, const: 85 }, - _a["" + "constructor"] = 134, + _a["" + "constructor"] = 135, _a.debugger = 87, - _a.declare = 135, + _a.declare = 136, _a.default = 88, _a.delete = 89, _a.do = 90, @@ -7263,60 +7308,61 @@ var ts; _a.false = 95, _a.finally = 96, _a.for = 97, - _a.from = 156, + _a.from = 158, _a.function = 98, - _a.get = 136, + _a.get = 137, _a.if = 99, _a.implements = 117, _a.import = 100, _a.in = 101, - _a.infer = 137, + _a.infer = 138, _a.instanceof = 102, _a.interface = 118, - _a.intrinsic = 138, - _a.is = 139, - _a.keyof = 140, + _a.intrinsic = 139, + _a.is = 140, + _a.keyof = 141, _a.let = 119, - _a.module = 141, - _a.namespace = 142, - _a.never = 143, + _a.module = 142, + _a.namespace = 143, + _a.never = 144, _a.new = 103, _a.null = 104, - _a.number = 147, - _a.object = 148, + _a.number = 148, + _a.object = 149, _a.package = 120, _a.private = 121, _a.protected = 122, _a.public = 123, - _a.override = 159, - _a.out = 144, - _a.readonly = 145, - _a.require = 146, - _a.global = 157, + _a.override = 161, + _a.out = 145, + _a.readonly = 146, + _a.require = 147, + _a.global = 159, _a.return = 105, - _a.set = 149, + _a.satisfies = 150, + _a.set = 151, _a.static = 124, - _a.string = 150, + _a.string = 152, _a.super = 106, _a.switch = 107, - _a.symbol = 151, + _a.symbol = 153, _a.this = 108, _a.throw = 109, _a.true = 110, _a.try = 111, - _a.type = 152, + _a.type = 154, _a.typeof = 112, - _a.undefined = 153, - _a.unique = 154, - _a.unknown = 155, + _a.undefined = 155, + _a.unique = 156, + _a.unknown = 157, _a.var = 113, _a.void = 114, _a.while = 115, _a.with = 116, _a.yield = 125, - _a.async = 131, - _a.await = 132, - _a.of = 160, + _a.async = 132, + _a.await = 133, + _a.of = 162, _a); var textToKeyword = new ts.Map(ts.getEntries(ts.textToKeywordObj)); var textToToken = new ts.Map(ts.getEntries(__assign(__assign({}, ts.textToKeywordObj), { "{": 18, "}": 19, "(": 20, ")": 21, "[": 22, "]": 23, ".": 24, "...": 25, ";": 26, ",": 27, "<": 29, ">": 31, "<=": 32, ">=": 33, "==": 34, "!=": 35, "===": 36, "!==": 37, "=>": 38, "+": 39, "-": 40, "**": 42, "*": 41, "/": 43, "%": 44, "++": 45, "--": 46, "<<": 47, ">": 48, ">>>": 49, "&": 50, "|": 51, "^": 52, "!": 53, "~": 54, "&&": 55, "||": 56, "?": 57, "??": 60, "?.": 28, ":": 58, "=": 63, "+=": 64, "-=": 65, "*=": 66, "**=": 67, "/=": 68, "%=": 69, "<<=": 70, ">>=": 71, ">>>=": 72, "&=": 73, "|=": 74, "^=": 78, "||=": 75, "&&=": 76, "??=": 77, "@": 59, "#": 62, "`": 61 }))); @@ -7380,7 +7426,7 @@ var ts; } ts.stringToToken = stringToToken; function computeLineStarts(text) { - var result = new Array(); + var result = []; var pos = 0; var lineStart = 0; while (pos < text.length) { @@ -8812,12 +8858,31 @@ var ts; pos++; return token = 0; } - if (isIdentifierStart(codePointAt(text, pos + 1), languageVersion)) { + var charAfterHash = codePointAt(text, pos + 1); + if (charAfterHash === 92) { pos++; - scanIdentifier(codePointAt(text, pos), languageVersion); + var extendedCookedChar_1 = peekExtendedUnicodeEscape(); + if (extendedCookedChar_1 >= 0 && isIdentifierStart(extendedCookedChar_1, languageVersion)) { + pos += 3; + tokenFlags |= 8; + tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts(); + return token = 80; + } + var cookedChar_1 = peekUnicodeEscape(); + if (cookedChar_1 >= 0 && isIdentifierStart(cookedChar_1, languageVersion)) { + pos += 6; + tokenFlags |= 1024; + tokenValue = "#" + String.fromCharCode(cookedChar_1) + scanIdentifierParts(); + return token = 80; + } + pos--; + } + if (isIdentifierStart(charAfterHash, languageVersion)) { + pos++; + scanIdentifier(charAfterHash, languageVersion); } else { - tokenValue = String.fromCharCode(codePointAt(text, pos)); + tokenValue = "#"; error(ts.Diagnostics.Invalid_character, pos++, charSize(ch)); } return token = 80; @@ -9434,9 +9499,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 163) { + if (d && d.kind === 165) { for (var current = d; current; current = current.parent) { - if (isFunctionLike(current) || isClassLike(current) || current.kind === 258) { + if (isFunctionLike(current) || isClassLike(current) || current.kind === 261) { return current; } } @@ -9444,7 +9509,7 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node, parent) { - return ts.hasSyntacticModifier(node, 16476) && parent.kind === 171; + return ts.hasSyntacticModifier(node, 16476) && parent.kind === 173; } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; function isEmptyBindingPattern(node) { @@ -9474,14 +9539,14 @@ var ts; node = walkUpBindingElementsAndPatterns(node); } var flags = getFlags(node); - if (node.kind === 254) { + if (node.kind === 257) { node = node.parent; } - if (node && node.kind === 255) { + if (node && node.kind === 258) { flags |= getFlags(node); node = node.parent; } - if (node && node.kind === 237) { + if (node && node.kind === 240) { flags |= getFlags(node); } return flags; @@ -9617,30 +9682,30 @@ var ts; return getDeclarationIdentifier(hostNode); } switch (hostNode.kind) { - case 237: + case 240: if (hostNode.declarationList && hostNode.declarationList.declarations[0]) { return getDeclarationIdentifier(hostNode.declarationList.declarations[0]); } break; - case 238: + case 241: var expr = hostNode.expression; - if (expr.kind === 221 && expr.operatorToken.kind === 63) { + if (expr.kind === 223 && expr.operatorToken.kind === 63) { expr = expr.left; } switch (expr.kind) { - case 206: + case 208: return expr.name; - case 207: + case 209: var arg = expr.argumentExpression; if (ts.isIdentifier(arg)) { return arg; } } break; - case 212: { + case 214: { return getDeclarationIdentifier(hostNode.expression); } - case 250: { + case 253: { if (isDeclaration(hostNode.statement) || isExpression(hostNode.statement)) { return getDeclarationIdentifier(hostNode.statement); } @@ -9674,16 +9739,16 @@ var ts; switch (declaration.kind) { case 79: return declaration; - case 347: - case 340: { + case 350: + case 343: { var name = declaration.name; - if (name.kind === 161) { + if (name.kind === 163) { return name.right; } break; } - case 208: - case 221: { + case 210: + case 223: { var expr_1 = declaration; switch (ts.getAssignmentDeclarationKind(expr_1)) { case 1: @@ -9699,15 +9764,15 @@ var ts; return undefined; } } - case 345: + case 348: return getNameOfJSDocTypedef(declaration); - case 339: + case 342: return nameForNamelessJSDocTypedef(declaration); - case 271: { + case 274: { var expression = declaration.expression; return ts.isIdentifier(expression) ? expression : undefined; } - case 207: + case 209: var expr = declaration; if (ts.isBindableStaticElementAccessExpression(expr)) { return expr.argumentExpression; @@ -9750,7 +9815,7 @@ var ts; } ts.getDecorators = getDecorators; function getModifiers(node) { - if (ts.hasSyntacticModifier(node, 125951)) { + if (ts.hasSyntacticModifier(node, 126975)) { return ts.filter(node.modifiers, isModifier); } } @@ -9937,12 +10002,12 @@ var ts; ts.getAllJSDocTagsOfKind = getAllJSDocTagsOfKind; function getTextOfJSDocComment(comment) { return typeof comment === "string" ? comment - : comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 321 ? c.text : formatJSDocLink(c); }).join(""); + : comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 324 ? c.text : formatJSDocLink(c); }).join(""); } ts.getTextOfJSDocComment = getTextOfJSDocComment; function formatJSDocLink(link) { - var kind = link.kind === 324 ? "link" - : link.kind === 325 ? "linkcode" + var kind = link.kind === 327 ? "link" + : link.kind === 328 ? "linkcode" : "linkplain"; var name = link.name ? ts.entityNameToString(link.name) : ""; var space = link.name && link.text.startsWith("://") ? "" : " "; @@ -9953,7 +10018,7 @@ var ts; return ts.emptyArray; } if (ts.isJSDocTypeAlias(node)) { - ts.Debug.assert(node.parent.kind === 320); + ts.Debug.assert(node.parent.kind === 323); return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; }); } if (node.typeParameters) { @@ -9986,7 +10051,7 @@ var ts; } ts.isMemberName = isMemberName; function isGetOrSetAccessorDeclaration(node) { - return node.kind === 173 || node.kind === 172; + return node.kind === 175 || node.kind === 174; } ts.isGetOrSetAccessorDeclaration = isGetOrSetAccessorDeclaration; function isPropertyAccessChain(node) { @@ -10004,10 +10069,10 @@ var ts; function isOptionalChain(node) { var kind = node.kind; return !!(node.flags & 32) && - (kind === 206 - || kind === 207 - || kind === 208 - || kind === 230); + (kind === 208 + || kind === 209 + || kind === 210 + || kind === 232); } ts.isOptionalChain = isOptionalChain; function isOptionalChainRoot(node) { @@ -10025,7 +10090,7 @@ var ts; } ts.isOutermostOptionalChain = isOutermostOptionalChain; function isNullishCoalesce(node) { - return node.kind === 221 && node.operatorToken.kind === 60; + return node.kind === 223 && node.operatorToken.kind === 60; } ts.isNullishCoalesce = isNullishCoalesce; function isConstTypeReference(node) { @@ -10042,17 +10107,17 @@ var ts; } ts.isNonNullChain = isNonNullChain; function isBreakOrContinueStatement(node) { - return node.kind === 246 || node.kind === 245; + return node.kind === 249 || node.kind === 248; } ts.isBreakOrContinueStatement = isBreakOrContinueStatement; function isNamedExportBindings(node) { - return node.kind === 274 || node.kind === 273; + return node.kind === 277 || node.kind === 276; } ts.isNamedExportBindings = isNamedExportBindings; function isUnparsedTextLike(node) { switch (node.kind) { - case 302: - case 303: + case 305: + case 306: return true; default: return false; @@ -10061,12 +10126,12 @@ var ts; ts.isUnparsedTextLike = isUnparsedTextLike; function isUnparsedNode(node) { return isUnparsedTextLike(node) || - node.kind === 300 || - node.kind === 304; + node.kind === 303 || + node.kind === 307; } ts.isUnparsedNode = isUnparsedNode; function isJSDocPropertyLikeTag(node) { - return node.kind === 347 || node.kind === 340; + return node.kind === 350 || node.kind === 343; } ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; function isNode(node) { @@ -10074,11 +10139,11 @@ var ts; } ts.isNode = isNode; function isNodeKind(kind) { - return kind >= 161; + return kind >= 163; } ts.isNodeKind = isNodeKind; function isTokenKind(kind) { - return kind >= 0 && kind <= 160; + return kind >= 0 && kind <= 162; } ts.isTokenKind = isTokenKind; function isToken(n) { @@ -10086,7 +10151,7 @@ var ts; } ts.isToken = isToken; function isNodeArray(array) { - return array.hasOwnProperty("pos") && array.hasOwnProperty("end"); + return ts.hasProperty(array, "pos") && ts.hasProperty(array, "end"); } ts.isNodeArray = isNodeArray; function isLiteralKind(kind) { @@ -10099,11 +10164,11 @@ var ts; ts.isLiteralExpression = isLiteralExpression; function isLiteralExpressionOfObject(node) { switch (node.kind) { - case 205: - case 204: + case 207: + case 206: case 13: - case 213: - case 226: + case 215: + case 228: return true; } return false; @@ -10129,13 +10194,13 @@ var ts; ts.isImportOrExportSpecifier = isImportOrExportSpecifier; function isTypeOnlyImportOrExportDeclaration(node) { switch (node.kind) { - case 270: - case 275: + case 273: + case 278: return node.isTypeOnly || node.parent.parent.isTypeOnly; - case 268: + case 271: return node.parent.isTypeOnly; - case 267: - case 265: + case 270: + case 268: return node.isTypeOnly; default: return false; @@ -10154,6 +10219,10 @@ var ts; return ts.isIdentifier(node) && (node.autoGenerateFlags & 7) > 0; } ts.isGeneratedIdentifier = isGeneratedIdentifier; + function isGeneratedPrivateIdentifier(node) { + return ts.isPrivateIdentifier(node) && (node.autoGenerateFlags & 7) > 0; + } + ts.isGeneratedPrivateIdentifier = isGeneratedPrivateIdentifier; function isPrivateIdentifierClassElementDeclaration(node) { return (ts.isPropertyDeclaration(node) || isMethodOrAccessor(node)) && ts.isPrivateIdentifier(node.name); } @@ -10165,19 +10234,20 @@ var ts; function isModifierKind(token) { switch (token) { case 126: - case 131: + case 127: + case 132: case 85: - case 135: + case 136: case 88: case 93: case 101: case 123: case 121: case 122: - case 145: + case 146: case 124: - case 144: - case 159: + case 145: + case 161: return true; } return false; @@ -10188,7 +10258,10 @@ var ts; } ts.isParameterPropertyModifier = isParameterPropertyModifier; function isClassMemberModifier(idToken) { - return isParameterPropertyModifier(idToken) || idToken === 124 || idToken === 159; + return isParameterPropertyModifier(idToken) || + idToken === 124 || + idToken === 161 || + idToken === 127; } ts.isClassMemberModifier = isClassMemberModifier; function isModifier(node) { @@ -10197,7 +10270,7 @@ var ts; ts.isModifier = isModifier; function isEntityName(node) { var kind = node.kind; - return kind === 161 + return kind === 163 || kind === 79; } ts.isEntityName = isEntityName; @@ -10207,14 +10280,14 @@ var ts; || kind === 80 || kind === 10 || kind === 8 - || kind === 162; + || kind === 164; } ts.isPropertyName = isPropertyName; function isBindingName(node) { var kind = node.kind; return kind === 79 - || kind === 201 - || kind === 202; + || kind === 203 + || kind === 204; } ts.isBindingName = isBindingName; function isFunctionLike(node) { @@ -10235,13 +10308,13 @@ var ts; ts.isBooleanLiteral = isBooleanLiteral; function isFunctionLikeDeclarationKind(kind) { switch (kind) { - case 256: - case 169: + case 259: case 171: - case 172: case 173: - case 213: - case 214: + case 174: + case 175: + case 215: + case 216: return true; default: return false; @@ -10249,14 +10322,14 @@ var ts; } function isFunctionLikeKind(kind) { switch (kind) { - case 168: - case 174: - case 323: - case 175: + case 170: case 176: - case 179: - case 317: - case 180: + case 326: + case 177: + case 178: + case 181: + case 320: + case 182: return true; default: return isFunctionLikeDeclarationKind(kind); @@ -10269,48 +10342,64 @@ var ts; ts.isFunctionOrModuleBlock = isFunctionOrModuleBlock; function isClassElement(node) { var kind = node.kind; - return kind === 171 - || kind === 167 + return kind === 173 || kind === 169 + || kind === 171 + || kind === 174 + || kind === 175 + || kind === 178 || kind === 172 - || kind === 173 - || kind === 176 - || kind === 170 - || kind === 234; + || kind === 237; } ts.isClassElement = isClassElement; function isClassLike(node) { - return node && (node.kind === 257 || node.kind === 226); + return node && (node.kind === 260 || node.kind === 228); } ts.isClassLike = isClassLike; function isAccessor(node) { - return node && (node.kind === 172 || node.kind === 173); + return node && (node.kind === 174 || node.kind === 175); } ts.isAccessor = isAccessor; + function isAutoAccessorPropertyDeclaration(node) { + return ts.isPropertyDeclaration(node) && ts.hasAccessorModifier(node); + } + ts.isAutoAccessorPropertyDeclaration = isAutoAccessorPropertyDeclaration; function isMethodOrAccessor(node) { switch (node.kind) { - case 169: - case 172: - case 173: + case 171: + case 174: + case 175: return true; default: return false; } } ts.isMethodOrAccessor = isMethodOrAccessor; + function isNamedClassElement(node) { + switch (node.kind) { + case 171: + case 174: + case 175: + case 169: + return true; + default: + return false; + } + } + ts.isNamedClassElement = isNamedClassElement; function isModifierLike(node) { return isModifier(node) || ts.isDecorator(node); } ts.isModifierLike = isModifierLike; function isTypeElement(node) { var kind = node.kind; - return kind === 175 - || kind === 174 - || kind === 166 - || kind === 168 + return kind === 177 || kind === 176 - || kind === 172 - || kind === 173; + || kind === 168 + || kind === 170 + || kind === 178 + || kind === 174 + || kind === 175; } ts.isTypeElement = isTypeElement; function isClassOrTypeElement(node) { @@ -10319,12 +10408,12 @@ var ts; ts.isClassOrTypeElement = isClassOrTypeElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 296 - || kind === 297 - || kind === 298 - || kind === 169 - || kind === 172 - || kind === 173; + return kind === 299 + || kind === 300 + || kind === 301 + || kind === 171 + || kind === 174 + || kind === 175; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; function isTypeNode(node) { @@ -10333,8 +10422,8 @@ var ts; ts.isTypeNode = isTypeNode; function isFunctionOrConstructorTypeNode(node) { switch (node.kind) { - case 179: - case 180: + case 181: + case 182: return true; } return false; @@ -10343,29 +10432,29 @@ var ts; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 202 - || kind === 201; + return kind === 204 + || kind === 203; } return false; } ts.isBindingPattern = isBindingPattern; function isAssignmentPattern(node) { var kind = node.kind; - return kind === 204 - || kind === 205; + return kind === 206 + || kind === 207; } ts.isAssignmentPattern = isAssignmentPattern; function isArrayBindingElement(node) { var kind = node.kind; - return kind === 203 - || kind === 227; + return kind === 205 + || kind === 229; } ts.isArrayBindingElement = isArrayBindingElement; function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 254: - case 164: - case 203: + case 257: + case 166: + case 205: return true; } return false; @@ -10378,8 +10467,8 @@ var ts; ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern; function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 201: - case 205: + case 203: + case 207: return true; } return false; @@ -10387,10 +10476,10 @@ var ts; ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern; function isObjectBindingOrAssignmentElement(node) { switch (node.kind) { - case 203: - case 296: - case 297: - case 298: + case 205: + case 299: + case 300: + case 301: return true; } return false; @@ -10398,8 +10487,8 @@ var ts; ts.isObjectBindingOrAssignmentElement = isObjectBindingOrAssignmentElement; function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 202: case 204: + case 206: return true; } return false; @@ -10407,25 +10496,25 @@ var ts; ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern; function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) { var kind = node.kind; - return kind === 206 - || kind === 161 - || kind === 200; + return kind === 208 + || kind === 163 + || kind === 202; } ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode; function isPropertyAccessOrQualifiedName(node) { var kind = node.kind; - return kind === 206 - || kind === 161; + return kind === 208 + || kind === 163; } ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName; function isCallLikeExpression(node) { switch (node.kind) { - case 280: - case 279: - case 208: - case 209: + case 283: + case 282: case 210: - case 165: + case 211: + case 212: + case 167: return true; default: return false; @@ -10433,12 +10522,12 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function isCallOrNewExpression(node) { - return node.kind === 208 || node.kind === 209; + return node.kind === 210 || node.kind === 211; } ts.isCallOrNewExpression = isCallOrNewExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 223 + return kind === 225 || kind === 14; } ts.isTemplateLiteral = isTemplateLiteral; @@ -10448,19 +10537,19 @@ var ts; ts.isLeftHandSideExpression = isLeftHandSideExpression; function isLeftHandSideExpressionKind(kind) { switch (kind) { - case 206: - case 207: - case 209: case 208: - case 278: - case 279: - case 282: + case 209: + case 211: case 210: - case 204: + case 281: + case 282: + case 285: case 212: - case 205: - case 226: - case 213: + case 206: + case 214: + case 207: + case 228: + case 215: case 79: case 80: case 13: @@ -10468,15 +10557,15 @@ var ts; case 9: case 10: case 14: - case 223: + case 225: case 95: case 104: case 108: case 110: case 106: + case 232: case 230: - case 228: - case 231: + case 233: case 100: return true; default: @@ -10489,13 +10578,13 @@ var ts; ts.isUnaryExpression = isUnaryExpression; function isUnaryExpressionKind(kind) { switch (kind) { - case 219: - case 220: - case 215: - case 216: + case 221: + case 222: case 217: case 218: - case 211: + case 219: + case 220: + case 213: return true; default: return isLeftHandSideExpressionKind(kind); @@ -10503,9 +10592,9 @@ var ts; } function isUnaryExpressionWithWrite(expr) { switch (expr.kind) { - case 220: + case 222: return true; - case 219: + case 221: return expr.operator === 45 || expr.operator === 46; default: @@ -10519,15 +10608,16 @@ var ts; ts.isExpression = isExpression; function isExpressionKind(kind) { switch (kind) { - case 222: case 224: - case 214: - case 221: - case 225: - case 229: + case 226: + case 216: + case 223: case 227: - case 351: - case 350: + case 231: + case 229: + case 354: + case 353: + case 235: return true; default: return isUnaryExpressionKind(kind); @@ -10535,8 +10625,8 @@ var ts; } function isAssertionExpression(node) { var kind = node.kind; - return kind === 211 - || kind === 229; + return kind === 213 + || kind === 231; } ts.isAssertionExpression = isAssertionExpression; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -10546,13 +10636,13 @@ var ts; ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 242: + case 245: + case 246: + case 247: case 243: case 244: - case 240: - case 241: return true; - case 250: + case 253: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -10575,7 +10665,7 @@ var ts; } ts.isExternalModuleIndicator = isExternalModuleIndicator; function isForInOrOfStatement(node) { - return node.kind === 243 || node.kind === 244; + return node.kind === 246 || node.kind === 247; } ts.isForInOrOfStatement = isForInOrOfStatement; function isConciseBody(node) { @@ -10594,110 +10684,110 @@ var ts; ts.isForInitializer = isForInitializer; function isModuleBody(node) { var kind = node.kind; - return kind === 262 - || kind === 261 + return kind === 265 + || kind === 264 || kind === 79; } ts.isModuleBody = isModuleBody; function isNamespaceBody(node) { var kind = node.kind; - return kind === 262 - || kind === 261; + return kind === 265 + || kind === 264; } ts.isNamespaceBody = isNamespaceBody; function isJSDocNamespaceBody(node) { var kind = node.kind; return kind === 79 - || kind === 261; + || kind === 264; } ts.isJSDocNamespaceBody = isJSDocNamespaceBody; function isNamedImportBindings(node) { var kind = node.kind; - return kind === 269 - || kind === 268; + return kind === 272 + || kind === 271; } ts.isNamedImportBindings = isNamedImportBindings; function isModuleOrEnumDeclaration(node) { - return node.kind === 261 || node.kind === 260; + return node.kind === 264 || node.kind === 263; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 214 - || kind === 203 - || kind === 257 - || kind === 226 - || kind === 170 - || kind === 171 + return kind === 216 + || kind === 205 || kind === 260 - || kind === 299 - || kind === 275 - || kind === 256 - || kind === 213 + || kind === 228 || kind === 172 - || kind === 267 - || kind === 265 + || kind === 173 + || kind === 263 + || kind === 302 + || kind === 278 + || kind === 259 + || kind === 215 + || kind === 174 || kind === 270 - || kind === 258 - || kind === 285 + || kind === 268 + || kind === 273 + || kind === 261 + || kind === 288 + || kind === 171 + || kind === 170 + || kind === 264 + || kind === 267 + || kind === 271 + || kind === 277 + || kind === 166 + || kind === 299 || kind === 169 || kind === 168 - || kind === 261 - || kind === 264 - || kind === 268 - || kind === 274 - || kind === 164 - || kind === 296 - || kind === 167 - || kind === 166 - || kind === 173 - || kind === 297 - || kind === 259 - || kind === 163 - || kind === 254 - || kind === 345 - || kind === 338 - || kind === 347; + || kind === 175 + || kind === 300 + || kind === 262 + || kind === 165 + || kind === 257 + || kind === 348 + || kind === 341 + || kind === 350; } function isDeclarationStatementKind(kind) { - return kind === 256 - || kind === 276 - || kind === 257 - || kind === 258 - || kind === 259 + return kind === 259 + || kind === 279 || kind === 260 || kind === 261 - || kind === 266 - || kind === 265 - || kind === 272 - || kind === 271 - || kind === 264; + || kind === 262 + || kind === 263 + || kind === 264 + || kind === 269 + || kind === 268 + || kind === 275 + || kind === 274 + || kind === 267; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 246 - || kind === 245 - || kind === 253 - || kind === 240 - || kind === 238 - || kind === 236 - || kind === 243 - || kind === 244 - || kind === 242 - || kind === 239 - || kind === 250 - || kind === 247 - || kind === 249 - || kind === 251 - || kind === 252 - || kind === 237 - || kind === 241 + return kind === 249 || kind === 248 - || kind === 349 - || kind === 353 - || kind === 352; + || kind === 256 + || kind === 243 + || kind === 241 + || kind === 239 + || kind === 246 + || kind === 247 + || kind === 245 + || kind === 242 + || kind === 253 + || kind === 250 + || kind === 252 + || kind === 254 + || kind === 255 + || kind === 240 + || kind === 244 + || kind === 251 + || kind === 352 + || kind === 356 + || kind === 355; } function isDeclaration(node) { - if (node.kind === 163) { - return (node.parent && node.parent.kind !== 344) || ts.isInJSFile(node); + if (node.kind === 165) { + return (node.parent && node.parent.kind !== 347) || ts.isInJSFile(node); } return isDeclarationKind(node.kind); } @@ -10718,10 +10808,10 @@ var ts; } ts.isStatement = isStatement; function isBlockStatement(node) { - if (node.kind !== 235) + if (node.kind !== 238) return false; if (node.parent !== undefined) { - if (node.parent.kind === 252 || node.parent.kind === 292) { + if (node.parent.kind === 255 || node.parent.kind === 295) { return false; } } @@ -10731,13 +10821,13 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 235; + || kind === 238; } ts.isStatementOrBlock = isStatementOrBlock; function isModuleReference(node) { var kind = node.kind; - return kind === 277 - || kind === 161 + return kind === 280 + || kind === 163 || kind === 79; } ts.isModuleReference = isModuleReference; @@ -10745,50 +10835,50 @@ var ts; var kind = node.kind; return kind === 108 || kind === 79 - || kind === 206; + || kind === 208; } ts.isJsxTagNameExpression = isJsxTagNameExpression; function isJsxChild(node) { var kind = node.kind; - return kind === 278 - || kind === 288 - || kind === 279 + return kind === 281 + || kind === 291 + || kind === 282 || kind === 11 - || kind === 282; + || kind === 285; } ts.isJsxChild = isJsxChild; function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 285 - || kind === 287; + return kind === 288 + || kind === 290; } ts.isJsxAttributeLike = isJsxAttributeLike; function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 10 - || kind === 288; + || kind === 291; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isJsxOpeningLikeElement(node) { var kind = node.kind; - return kind === 280 - || kind === 279; + return kind === 283 + || kind === 282; } ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 289 - || kind === 290; + return kind === 292 + || kind === 293; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; function isJSDocNode(node) { - return node.kind >= 309 && node.kind <= 347; + return node.kind >= 312 && node.kind <= 350; } ts.isJSDocNode = isJSDocNode; function isJSDocCommentContainingNode(node) { - return node.kind === 320 - || node.kind === 319 - || node.kind === 321 + return node.kind === 323 + || node.kind === 322 + || node.kind === 324 || isJSDocLinkLike(node) || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) @@ -10796,15 +10886,15 @@ var ts; } ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode; function isJSDocTag(node) { - return node.kind >= 327 && node.kind <= 347; + return node.kind >= 330 && node.kind <= 350; } ts.isJSDocTag = isJSDocTag; function isSetAccessor(node) { - return node.kind === 173; + return node.kind === 175; } ts.isSetAccessor = isSetAccessor; function isGetAccessor(node) { - return node.kind === 172; + return node.kind === 174; } ts.isGetAccessor = isGetAccessor; function hasJSDocNodes(node) { @@ -10822,12 +10912,12 @@ var ts; ts.hasInitializer = hasInitializer; function hasOnlyExpressionInitializer(node) { switch (node.kind) { - case 254: - case 164: - case 203: - case 167: - case 296: + case 257: + case 166: + case 205: + case 169: case 299: + case 302: return true; default: return false; @@ -10835,11 +10925,11 @@ var ts; } ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer; function isObjectLiteralElement(node) { - return node.kind === 285 || node.kind === 287 || isObjectLiteralElementLike(node); + return node.kind === 288 || node.kind === 290 || isObjectLiteralElementLike(node); } ts.isObjectLiteralElement = isObjectLiteralElement; function isTypeReferenceType(node) { - return node.kind === 178 || node.kind === 228; + return node.kind === 180 || node.kind === 230; } ts.isTypeReferenceType = isTypeReferenceType; var MAX_SMI_X86 = 1073741823; @@ -10871,7 +10961,7 @@ var ts; } ts.isStringLiteralLike = isStringLiteralLike; function isJSDocLinkLike(node) { - return node.kind === 324 || node.kind === 325 || node.kind === 326; + return node.kind === 327 || node.kind === 328 || node.kind === 329; } ts.isJSDocLinkLike = isJSDocLinkLike; function hasRestParameter(s) { @@ -10881,7 +10971,7 @@ var ts; ts.hasRestParameter = hasRestParameter; function isRestParameter(node) { var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type; - return node.dotDotDotToken !== undefined || !!type && type.kind === 318; + return node.dotDotDotToken !== undefined || !!type && type.kind === 321; } ts.isRestParameter = isRestParameter; })(ts || (ts = {})); @@ -11120,7 +11210,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 305) { + while (node && node.kind !== 308) { node = node.parent; } return node; @@ -11136,11 +11226,11 @@ var ts; ts.isPlainJsFile = isPlainJsFile; function isStatementWithLocals(node) { switch (node.kind) { - case 235: - case 263: - case 242: - case 243: - case 244: + case 238: + case 266: + case 245: + case 246: + case 247: return true; } return false; @@ -11290,7 +11380,7 @@ var ts; if (includeJsDoc && ts.hasJSDocNodes(node)) { return getTokenPosOfNode(node.jsDoc[0], sourceFile); } - if (node.kind === 348 && node._children.length > 0) { + if (node.kind === 351 && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, false, false, isInJSDoc(node)); @@ -11345,7 +11435,6 @@ var ts; return emitNode && emitNode.flags || 0; } ts.getEmitFlags = getEmitFlags; - ; function getScriptTargetFeatures() { return { es2015: { @@ -11502,7 +11591,7 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 254 && node.parent.kind === 292; + return node.kind === 257 && node.parent.kind === 295; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { @@ -11526,11 +11615,11 @@ var ts; } ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { - return !!node && node.kind === 261 && (!node.body); + return !!node && node.kind === 264 && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 305 || - node.kind === 261 || + return node.kind === 308 || + node.kind === 264 || ts.isFunctionLikeOrClassStaticBlockDeclaration(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -11544,9 +11633,9 @@ var ts; ts.isExternalModuleAugmentation = isExternalModuleAugmentation; function isModuleAugmentationExternal(node) { switch (node.parent.kind) { - case 305: + case 308: return ts.isExternalModule(node.parent); - case 262: + case 265: return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -11592,26 +11681,30 @@ var ts; return false; } ts.isEffectiveStrictModeSourceFile = isEffectiveStrictModeSourceFile; + function isAmbientPropertyDeclaration(node) { + return !!(node.flags & 16777216) || hasSyntacticModifier(node, 2); + } + ts.isAmbientPropertyDeclaration = isAmbientPropertyDeclaration; function isBlockScope(node, parentNode) { switch (node.kind) { - case 305: - case 263: - case 292: - case 261: - case 242: - case 243: - case 244: + case 308: + case 266: + case 295: + case 264: + case 245: + case 246: + case 247: + case 173: case 171: + case 174: + case 175: + case 259: + case 215: + case 216: case 169: case 172: - case 173: - case 256: - case 213: - case 214: - case 167: - case 170: return true; - case 235: + case 238: return !ts.isFunctionLikeOrClassStaticBlockDeclaration(parentNode); } return false; @@ -11619,9 +11712,9 @@ var ts; ts.isBlockScope = isBlockScope; function isDeclarationWithTypeParameters(node) { switch (node.kind) { - case 338: - case 345: - case 323: + case 341: + case 348: + case 326: return true; default: ts.assertType(node); @@ -11631,25 +11724,25 @@ var ts; ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters; function isDeclarationWithTypeParameterChildren(node) { switch (node.kind) { + case 176: + case 177: + case 170: + case 178: + case 181: + case 182: + case 320: + case 260: + case 228: + case 261: + case 262: + case 347: + case 259: + case 171: + case 173: case 174: case 175: - case 168: - case 176: - case 179: - case 180: - case 317: - case 257: - case 226: - case 258: - case 259: - case 344: - case 256: - case 169: - case 171: - case 172: - case 173: - case 213: - case 214: + case 215: + case 216: return true; default: ts.assertType(node); @@ -11659,8 +11752,8 @@ var ts; ts.isDeclarationWithTypeParameterChildren = isDeclarationWithTypeParameterChildren; function isAnyImportSyntax(node) { switch (node.kind) { - case 266: - case 265: + case 269: + case 268: return true; default: return false; @@ -11673,15 +11766,15 @@ var ts; ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire; function isLateVisibilityPaintedStatement(node) { switch (node.kind) { - case 266: - case 265: - case 237: - case 257: - case 256: - case 261: - case 259: - case 258: + case 269: + case 268: + case 240: case 260: + case 259: + case 264: + case 262: + case 261: + case 263: return true; default: return false; @@ -11717,19 +11810,19 @@ var ts; } ts.getNameFromIndexInfo = getNameFromIndexInfo; function isComputedNonLiteralName(name) { - return name.kind === 162 && !isStringOrNumericLiteralLike(name.expression); + return name.kind === 164 && !isStringOrNumericLiteralLike(name.expression); } ts.isComputedNonLiteralName = isComputedNonLiteralName; function tryGetTextOfPropertyName(name) { switch (name.kind) { case 79: case 80: - return name.escapedText; + return name.autoGenerateFlags ? undefined : name.escapedText; case 10: case 8: case 14: return ts.escapeLeadingUnderscores(name.text); - case 162: + case 164: if (isStringOrNumericLiteralLike(name.expression)) return ts.escapeLeadingUnderscores(name.expression.text); return undefined; @@ -11749,16 +11842,16 @@ var ts; case 80: case 79: return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name); - case 161: + case 163: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 206: + case 208: if (ts.isIdentifier(name.name) || ts.isPrivateIdentifier(name.name)) { return entityNameToString(name.expression) + "." + entityNameToString(name.name); } else { return ts.Debug.assertNever(name.name); } - case 311: + case 314: return entityNameToString(name.left) + entityNameToString(name.right); default: return ts.Debug.assertNever(name); @@ -11848,7 +11941,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 235) { + if (node.body && node.body.kind === 238) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -11860,35 +11953,35 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 305: + case 308: var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); if (pos_1 === sourceFile.text.length) { return ts.createTextSpan(0, 0); } return getSpanOfTokenAtPosition(sourceFile, pos_1); - case 254: - case 203: case 257: - case 226: - case 258: - case 261: + case 205: case 260: - case 299: - case 256: - case 213: - case 169: - case 172: - case 173: + case 228: + case 261: + case 264: + case 263: + case 302: case 259: - case 167: - case 166: - case 268: + case 215: + case 171: + case 174: + case 175: + case 262: + case 169: + case 168: + case 271: errorNode = node.name; break; - case 214: + case 216: return getErrorSpanForArrowFunction(sourceFile, node); - case 289: - case 290: + case 292: + case 293: var start = ts.skipTrivia(sourceFile.text, node.pos); var end = node.statements.length > 0 ? node.statements[0].pos : node.end; return ts.createTextSpanFromBounds(start, end); @@ -11937,11 +12030,11 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 208 && n.expression.kind === 106; + return n.kind === 210 && n.expression.kind === 106; } ts.isSuperCall = isSuperCall; function isImportCall(n) { - return n.kind === 208 && n.expression.kind === 100; + return n.kind === 210 && n.expression.kind === 100; } ts.isImportCall = isImportCall; function isImportMeta(n) { @@ -11955,7 +12048,7 @@ var ts; } ts.isLiteralImportTypeNode = isLiteralImportTypeNode; function isPrologueDirective(node) { - return node.kind === 238 + return node.kind === 241 && node.expression.kind === 10; } ts.isPrologueDirective = isPrologueDirective; @@ -11983,13 +12076,13 @@ var ts; } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; function getJSDocCommentRanges(node, text) { - var commentRanges = (node.kind === 164 || - node.kind === 163 || - node.kind === 213 || + var commentRanges = (node.kind === 166 || + node.kind === 165 || + node.kind === 215 || + node.kind === 216 || node.kind === 214 || - node.kind === 212 || - node.kind === 254 || - node.kind === 275) ? + node.kind === 257 || + node.kind === 278) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : ts.getLeadingCommentRanges(text, node.pos); return ts.filter(commentRanges, function (comment) { @@ -12004,79 +12097,79 @@ var ts; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; var defaultLibReferenceRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (177 <= node.kind && node.kind <= 200) { + if (179 <= node.kind && node.kind <= 202) { return true; } switch (node.kind) { - case 130: - case 155: - case 147: - case 158: - case 150: - case 133: - case 151: + case 131: + case 157: case 148: + case 160: + case 152: + case 134: case 153: - case 143: + case 149: + case 155: + case 144: return true; case 114: - return node.parent.kind !== 217; - case 228: + return node.parent.kind !== 219; + case 230: return ts.isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node); - case 163: - return node.parent.kind === 195 || node.parent.kind === 190; + case 165: + return node.parent.kind === 197 || node.parent.kind === 192; case 79: - if (node.parent.kind === 161 && node.parent.right === node) { + if (node.parent.kind === 163 && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 206 && node.parent.name === node) { + else if (node.parent.kind === 208 && node.parent.name === node) { node = node.parent; } - ts.Debug.assert(node.kind === 79 || node.kind === 161 || node.kind === 206, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); - case 161: - case 206: + ts.Debug.assert(node.kind === 79 || node.kind === 163 || node.kind === 208, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + case 163: + case 208: case 108: { var parent = node.parent; - if (parent.kind === 181) { + if (parent.kind === 183) { return false; } - if (parent.kind === 200) { + if (parent.kind === 202) { return !parent.isTypeOf; } - if (177 <= parent.kind && parent.kind <= 200) { + if (179 <= parent.kind && parent.kind <= 202) { return true; } switch (parent.kind) { - case 228: + case 230: return ts.isHeritageClause(parent.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(parent); - case 163: + case 165: return node === parent.constraint; - case 344: + case 347: return node === parent.constraint; - case 167: - case 166: - case 164: - case 254: - return node === parent.type; - case 256: - case 213: - case 214: - case 171: case 169: case 168: - case 172: - case 173: + case 166: + case 257: return node === parent.type; + case 259: + case 215: + case 216: + case 173: + case 171: + case 170: case 174: case 175: + return node === parent.type; case 176: + case 177: + case 178: return node === parent.type; - case 211: + case 213: return node === parent.type; - case 208: - case 209: - return ts.contains(parent.typeArguments, node); case 210: + case 211: + return ts.contains(parent.typeArguments, node); + case 212: return false; } } @@ -12098,23 +12191,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 247: + case 250: return visitor(node); - case 263: - case 235: - case 239: - case 240: - case 241: + case 266: + case 238: case 242: case 243: case 244: - case 248: - case 249: - case 289: - case 290: - case 250: + case 245: + case 246: + case 247: + case 251: case 252: case 292: + case 293: + case 253: + case 255: + case 295: return ts.forEachChild(node, traverse); } } @@ -12124,21 +12217,21 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 224: + case 226: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } return; - case 260: - case 258: + case 263: case 261: - case 259: + case 264: + case 262: return; default: if (ts.isFunctionLike(node)) { - if (node.name && node.name.kind === 162) { + if (node.name && node.name.kind === 164) { traverse(node.name.expression); return; } @@ -12151,10 +12244,10 @@ var ts; } ts.forEachYieldExpression = forEachYieldExpression; function getRestParameterElementType(node) { - if (node && node.kind === 183) { + if (node && node.kind === 185) { return node.elementType; } - else if (node && node.kind === 178) { + else if (node && node.kind === 180) { return ts.singleOrUndefined(node.typeArguments); } else { @@ -12164,12 +12257,12 @@ var ts; ts.getRestParameterElementType = getRestParameterElementType; function getMembersOfDeclaration(node) { switch (node.kind) { - case 258: - case 257: - case 226: - case 182: + case 261: + case 260: + case 228: + case 184: return node.members; - case 205: + case 207: return node.properties; } } @@ -12177,14 +12270,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 203: - case 299: - case 164: - case 296: - case 167: + case 205: + case 302: case 166: - case 297: - case 254: + case 299: + case 169: + case 168: + case 300: + case 257: return true; } } @@ -12196,8 +12289,8 @@ var ts; } ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor; function isVariableDeclarationInVariableStatement(node) { - return node.parent.kind === 255 - && node.parent.parent.kind === 237; + return node.parent.kind === 258 + && node.parent.parent.kind === 240; } ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement; function isCommonJsExportedExpression(node) { @@ -12221,13 +12314,13 @@ var ts; ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 169: - case 168: case 171: - case 172: + case 170: case 173: - case 256: - case 213: + case 174: + case 175: + case 259: + case 215: return true; } return false; @@ -12238,7 +12331,7 @@ var ts; if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 250) { + if (node.statement.kind !== 253) { return node.statement; } node = node.statement; @@ -12246,17 +12339,17 @@ var ts; } ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel; function isFunctionBlock(node) { - return node && node.kind === 235 && ts.isFunctionLike(node.parent); + return node && node.kind === 238 && ts.isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 169 && node.parent.kind === 205; + return node && node.kind === 171 && node.parent.kind === 207; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethodOrAccessor(node) { - return (node.kind === 169 || node.kind === 172 || node.kind === 173) && - (node.parent.kind === 205 || - node.parent.kind === 226); + return (node.kind === 171 || node.kind === 174 || node.kind === 175) && + (node.parent.kind === 207 || + node.parent.kind === 228); } ts.isObjectLiteralOrClassExpressionMethodOrAccessor = isObjectLiteralOrClassExpressionMethodOrAccessor; function isIdentifierTypePredicate(predicate) { @@ -12269,7 +12362,7 @@ var ts; ts.isThisTypePredicate = isThisTypePredicate; function getPropertyAssignment(objectLiteral, key, key2) { return objectLiteral.properties.filter(function (property) { - if (property.kind === 296) { + if (property.kind === 299) { var propName = tryGetTextOfPropertyName(property.name); return key === propName || (!!key2 && key2 === propName); } @@ -12331,47 +12424,47 @@ var ts; } ts.getContainingFunctionOrClassStaticBlock = getContainingFunctionOrClassStaticBlock; function getThisContainer(node, includeArrowFunctions) { - ts.Debug.assert(node.kind !== 305); + ts.Debug.assert(node.kind !== 308); while (true) { node = node.parent; if (!node) { return ts.Debug.fail(); } switch (node.kind) { - case 162: + case 164: if (ts.isClassLike(node.parent.parent)) { return node; } node = node.parent; break; - case 165: - if (node.parent.kind === 164 && ts.isClassElement(node.parent.parent)) { + case 167: + if (node.parent.kind === 166 && ts.isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (ts.isClassElement(node.parent)) { node = node.parent; } break; - case 214: + case 216: if (!includeArrowFunctions) { continue; } - case 256: - case 213: - case 261: - case 170: - case 167: - case 166: + case 259: + case 215: + case 264: + case 172: case 169: case 168: case 171: - case 172: + case 170: case 173: case 174: case 175: case 176: - case 260: - case 305: + case 177: + case 178: + case 263: + case 308: return node; } } @@ -12379,17 +12472,17 @@ var ts; ts.getThisContainer = getThisContainer; function isThisContainerOrFunctionBlock(node) { switch (node.kind) { - case 214: - case 256: - case 213: - case 167: + case 216: + case 259: + case 215: + case 169: return true; - case 235: + case 238: switch (node.parent.kind) { - case 171: - case 169: - case 172: case 173: + case 171: + case 174: + case 175: return true; default: return false; @@ -12411,9 +12504,9 @@ var ts; var container = getThisContainer(node, false); if (container) { switch (container.kind) { - case 171: - case 256: - case 213: + case 173: + case 259: + case 215: return container; } } @@ -12427,26 +12520,26 @@ var ts; return node; } switch (node.kind) { - case 162: + case 164: node = node.parent; break; - case 256: - case 213: - case 214: + case 259: + case 215: + case 216: if (!stopOnFunctions) { continue; } - case 167: - case 166: case 169: case 168: case 171: - case 172: - case 173: case 170: + case 173: + case 174: + case 175: + case 172: return node; - case 165: - if (node.parent.kind === 164 && ts.isClassElement(node.parent.parent)) { + case 167: + if (node.parent.kind === 166 && ts.isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (ts.isClassElement(node.parent)) { @@ -12458,14 +12551,14 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 213 || func.kind === 214) { + if (func.kind === 215 || func.kind === 216) { var prev = func; var parent = func.parent; - while (parent.kind === 212) { + while (parent.kind === 214) { prev = parent; parent = parent.parent; } - if (parent.kind === 208 && parent.expression === prev) { + if (parent.kind === 210 && parent.expression === prev) { return parent; } } @@ -12478,13 +12571,13 @@ var ts; ts.isSuperOrSuperProperty = isSuperOrSuperProperty; function isSuperProperty(node) { var kind = node.kind; - return (kind === 206 || kind === 207) + return (kind === 208 || kind === 209) && node.expression.kind === 106; } ts.isSuperProperty = isSuperProperty; function isThisProperty(node) { var kind = node.kind; - return (kind === 206 || kind === 207) + return (kind === 208 || kind === 209) && node.expression.kind === 108; } ts.isThisProperty = isThisProperty; @@ -12503,14 +12596,14 @@ var ts; ts.isThisInitializedObjectBindingExpression = isThisInitializedObjectBindingExpression; function getEntityNameFromTypeNode(node) { switch (node.kind) { - case 178: + case 180: return node.typeName; - case 228: + case 230: return isEntityNameExpression(node.expression) ? node.expression : undefined; case 79: - case 161: + case 163: return node; } return undefined; @@ -12518,10 +12611,10 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { switch (node.kind) { - case 210: + case 212: return node.tag; - case 280: - case 279: + case 283: + case 282: return node.tagName; default: return node.expression; @@ -12533,21 +12626,21 @@ var ts; return false; } switch (node.kind) { - case 257: + case 260: return true; - case 167: - return parent.kind === 257; - case 172: - case 173: case 169: + return parent.kind === 260; + case 174: + case 175: + case 171: return node.body !== undefined - && parent.kind === 257; - case 164: + && parent.kind === 260; + case 166: return parent.body !== undefined - && (parent.kind === 171 - || parent.kind === 169 - || parent.kind === 173) - && grandparent.kind === 257; + && (parent.kind === 173 + || parent.kind === 171 + || parent.kind === 175) + && grandparent.kind === 260; } return false; } @@ -12563,11 +12656,11 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node, parent) { switch (node.kind) { - case 257: + case 260: return ts.some(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); }); - case 169: - case 173: case 171: + case 175: + case 173: return ts.some(node.parameters, function (p) { return nodeIsDecorated(p, node, parent); }); default: return false; @@ -12583,9 +12676,9 @@ var ts; ts.classOrConstructorParameterIsDecorated = classOrConstructorParameterIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 280 || - parent.kind === 279 || - parent.kind === 281) { + if (parent.kind === 283 || + parent.kind === 282 || + parent.kind === 284) { return parent.tagName === node; } return false; @@ -12598,53 +12691,54 @@ var ts; case 110: case 95: case 13: - case 204: - case 205: case 206: case 207: case 208: case 209: case 210: - case 229: case 211: - case 230: case 212: + case 231: case 213: - case 226: + case 235: + case 232: case 214: - case 217: case 215: + case 228: case 216: case 219: - case 220: + case 217: + case 218: case 221: case 222: - case 225: case 223: - case 227: - case 278: - case 279: - case 282: case 224: - case 218: - case 231: + case 227: + case 225: + case 229: + case 281: + case 282: + case 285: + case 226: + case 220: + case 233: return true; - case 228: + case 230: return !ts.isHeritageClause(node.parent); - case 161: - while (node.parent.kind === 161) { + case 163: + while (node.parent.kind === 163) { node = node.parent; } - return node.parent.kind === 181 || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); - case 311: + return node.parent.kind === 183 || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); + case 314: while (ts.isJSDocMemberName(node.parent)) { node = node.parent; } - return node.parent.kind === 181 || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); + return node.parent.kind === 183 || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); case 80: return ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 101; case 79: - if (node.parent.kind === 181 || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) { + if (node.parent.kind === 183 || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) { return true; } case 8: @@ -12661,60 +12755,62 @@ var ts; function isInExpressionContext(node) { var parent = node.parent; switch (parent.kind) { - case 254: - case 164: - case 167: + case 257: case 166: + case 169: + case 168: + case 302: case 299: - case 296: - case 203: + case 205: return parent.initializer === node; - case 238: - case 239: - case 240: case 241: - case 247: - case 248: - case 249: - case 289: - case 251: - return parent.expression === node; case 242: - var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 255) || - forStatement.condition === node || - forStatement.incrementor === node; case 243: case 244: + case 250: + case 251: + case 252: + case 292: + case 254: + return parent.expression === node; + case 245: + var forStatement = parent; + return (forStatement.initializer === node && forStatement.initializer.kind !== 258) || + forStatement.condition === node || + forStatement.incrementor === node; + case 246: + case 247: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 255) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 258) || forInStatement.expression === node; - case 211: - case 229: + case 213: + case 231: return node === parent.expression; - case 233: + case 236: return node === parent.expression; - case 162: + case 164: return node === parent.expression; - case 165: - case 288: - case 287: - case 298: + case 167: + case 291: + case 290: + case 301: return true; - case 228: + case 230: return parent.expression === node && !isPartOfTypeNode(parent); - case 297: + case 300: return parent.objectAssignmentInitializer === node; + case 235: + return node === parent.expression; default: return isExpressionNode(parent); } } ts.isInExpressionContext = isInExpressionContext; function isPartOfTypeQuery(node) { - while (node.kind === 161 || node.kind === 79) { + while (node.kind === 163 || node.kind === 79) { node = node.parent; } - return node.kind === 181; + return node.kind === 183; } ts.isPartOfTypeQuery = isPartOfTypeQuery; function isNamespaceReexportDeclaration(node) { @@ -12722,7 +12818,7 @@ var ts; } ts.isNamespaceReexportDeclaration = isNamespaceReexportDeclaration; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 265 && node.moduleReference.kind === 277; + return node.kind === 268 && node.moduleReference.kind === 280; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -12735,7 +12831,7 @@ var ts; } ts.getExternalModuleRequireArgument = getExternalModuleRequireArgument; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 265 && node.moduleReference.kind !== 277; + return node.kind === 268 && node.moduleReference.kind !== 280; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJS(file) { @@ -12767,11 +12863,11 @@ var ts; ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && node.typeArguments && node.typeArguments.length === 2 && - (node.typeArguments[0].kind === 150 || node.typeArguments[0].kind === 147); + (node.typeArguments[0].kind === 152 || node.typeArguments[0].kind === 148); } ts.isJSDocIndexSignature = isJSDocIndexSignature; function isRequireCall(callExpression, requireStringLiteralLikeArgument) { - if (callExpression.kind !== 208) { + if (callExpression.kind !== 210) { return false; } var _a = callExpression, expression = _a.expression, args = _a.arguments; @@ -12857,11 +12953,11 @@ var ts; function getExpandoInitializer(initializer, isPrototypeAssignment) { if (ts.isCallExpression(initializer)) { var e = skipParentheses(initializer.expression); - return e.kind === 213 || e.kind === 214 ? initializer : undefined; + return e.kind === 215 || e.kind === 216 ? initializer : undefined; } - if (initializer.kind === 213 || - initializer.kind === 226 || - initializer.kind === 214) { + if (initializer.kind === 215 || + initializer.kind === 228 || + initializer.kind === 216) { return initializer; } if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) { @@ -13072,7 +13168,7 @@ var ts; ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment; function isSpecialPropertyDeclaration(expr) { return isInJSFile(expr) && - expr.parent && expr.parent.kind === 238 && + expr.parent && expr.parent.kind === 241 && (!ts.isElementAccessExpression(expr) || isLiteralLikeElementAccess(expr)) && !!ts.getJSDocTypeTag(expr.parent); } @@ -13092,17 +13188,17 @@ var ts; return false; } var decl = symbol.valueDeclaration; - return decl.kind === 256 || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); + return decl.kind === 259 || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); } ts.isFunctionSymbol = isFunctionSymbol; function tryGetModuleSpecifierFromDeclaration(node) { var _a, _b; switch (node.kind) { - case 254: + case 257: return (_a = ts.findAncestor(node.initializer, function (node) { return isRequireCall(node, true); })) === null || _a === void 0 ? void 0 : _a.arguments[0]; - case 266: + case 269: return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike); - case 265: + case 268: return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike); default: ts.Debug.assertNever(node); @@ -13115,14 +13211,14 @@ var ts; ts.importFromModuleSpecifier = importFromModuleSpecifier; function tryGetImportFromModuleSpecifier(node) { switch (node.parent.kind) { - case 266: - case 272: + case 269: + case 275: return node.parent; - case 277: + case 280: return node.parent.parent; - case 208: + case 210: return isImportCall(node.parent) || isRequireCall(node.parent, false) ? node.parent : undefined; - case 196: + case 198: ts.Debug.assert(ts.isStringLiteral(node)); return ts.tryCast(node.parent.parent, ts.isImportTypeNode); default: @@ -13132,16 +13228,16 @@ var ts; ts.tryGetImportFromModuleSpecifier = tryGetImportFromModuleSpecifier; function getExternalModuleName(node) { switch (node.kind) { - case 266: - case 272: + case 269: + case 275: return node.moduleSpecifier; - case 265: - return node.moduleReference.kind === 277 ? node.moduleReference.expression : undefined; - case 200: + case 268: + return node.moduleReference.kind === 280 ? node.moduleReference.expression : undefined; + case 202: return isLiteralImportTypeNode(node) ? node.argument.literal : undefined; - case 208: + case 210: return node.arguments[0]; - case 261: + case 264: return node.name.kind === 10 ? node.name : undefined; default: return ts.Debug.assertNever(node); @@ -13150,11 +13246,11 @@ var ts; ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { switch (node.kind) { - case 266: + case 269: return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport); - case 265: + case 268: return node; - case 272: + case 275: return node.exportClause && ts.tryCast(node.exportClause, ts.isNamespaceExport); default: return ts.Debug.assertNever(node); @@ -13162,7 +13258,7 @@ var ts; } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 266 && !!node.importClause && !!node.importClause.name; + return node.kind === 269 && !!node.importClause && !!node.importClause.name; } ts.isDefaultImport = isDefaultImport; function forEachImportClauseDeclaration(node, action) { @@ -13183,13 +13279,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 164: + case 166: + case 171: + case 170: + case 300: + case 299: case 169: case 168: - case 297: - case 296: - case 167: - case 166: return node.questionToken !== undefined; } } @@ -13203,7 +13299,7 @@ var ts; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function isJSDocTypeAlias(node) { - return node.kind === 345 || node.kind === 338 || node.kind === 339; + return node.kind === 348 || node.kind === 341 || node.kind === 342; } ts.isJSDocTypeAlias = isJSDocTypeAlias; function isTypeAlias(node) { @@ -13228,12 +13324,12 @@ var ts; } function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) { switch (node.kind) { - case 237: + case 240: var v = getSingleVariableOfVariableStatement(node); return v && v.initializer; - case 167: + case 169: return node.initializer; - case 296: + case 299: return node.initializer; } } @@ -13245,7 +13341,7 @@ var ts; function getNestedModuleDeclaration(node) { return ts.isModuleDeclaration(node) && node.body && - node.body.kind === 261 + node.body.kind === 264 ? node.body : undefined; } @@ -13259,11 +13355,11 @@ var ts; if (ts.hasJSDocNodes(node)) { result = ts.addRange(result, filterOwnedJSDocTags(hostNode, ts.last(node.jsDoc))); } - if (node.kind === 164) { + if (node.kind === 166) { result = ts.addRange(result, (noCache ? ts.getJSDocParameterTagsNoCache : ts.getJSDocParameterTags)(node)); break; } - if (node.kind === 163) { + if (node.kind === 165) { result = ts.addRange(result, (noCache ? ts.getJSDocTypeParameterTagsNoCache : ts.getJSDocTypeParameterTags)(node)); break; } @@ -13288,11 +13384,11 @@ var ts; } function getNextJSDocCommentLocation(node) { var parent = node.parent; - if (parent.kind === 296 || - parent.kind === 271 || - parent.kind === 167 || - parent.kind === 238 && node.kind === 206 || - parent.kind === 247 || + if (parent.kind === 299 || + parent.kind === 274 || + parent.kind === 169 || + parent.kind === 241 && node.kind === 208 || + parent.kind === 250 || getNestedModuleDeclaration(parent) || ts.isBinaryExpression(node) && node.operatorToken.kind === 63) { return parent; @@ -13386,34 +13482,34 @@ var ts; var parent = node.parent; while (true) { switch (parent.kind) { - case 221: + case 223: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 63 || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 : 2 : 0; - case 219: - case 220: + case 221: + case 222: var unaryOperator = parent.operator; return unaryOperator === 45 || unaryOperator === 46 ? 2 : 0; - case 243: - case 244: + case 246: + case 247: return parent.initializer === node ? 1 : 0; - case 212: - case 204: - case 225: - case 230: + case 214: + case 206: + case 227: + case 232: node = parent; break; - case 298: + case 301: node = parent.parent; break; - case 297: + case 300: if (parent.name !== node) { return 0; } node = parent.parent; break; - case 296: + case 299: if (parent.name === node) { return 0; } @@ -13432,22 +13528,22 @@ var ts; ts.isAssignmentTarget = isAssignmentTarget; function isNodeWithPossibleHoistedDeclaration(node) { switch (node.kind) { - case 235: - case 237: - case 248: - case 239: - case 249: - case 263: - case 289: - case 290: - case 250: + case 238: + case 240: + case 251: case 242: + case 252: + case 266: + case 292: + case 293: + case 253: + case 245: + case 246: + case 247: case 243: case 244: - case 240: - case 241: - case 252: - case 292: + case 255: + case 295: return true; } return false; @@ -13464,16 +13560,16 @@ var ts; return node; } function walkUpParenthesizedTypes(node) { - return walkUp(node, 191); + return walkUp(node, 193); } ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes; function walkUpParenthesizedExpressions(node) { - return walkUp(node, 212); + return walkUp(node, 214); } ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions; function walkUpParenthesizedTypesAndGetParentAndChild(node) { var child; - while (node && node.kind === 191) { + while (node && node.kind === 193) { child = node; node = node.parent; } @@ -13494,11 +13590,11 @@ var ts; } ts.skipParentheses = skipParentheses; function isDeleteTarget(node) { - if (node.kind !== 206 && node.kind !== 207) { + if (node.kind !== 208 && node.kind !== 209) { return false; } node = walkUpParenthesizedExpressions(node.parent); - return node && node.kind === 215; + return node && node.kind === 217; } ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { @@ -13548,47 +13644,47 @@ var ts; ts.getDeclarationFromName = getDeclarationFromName; function isLiteralComputedPropertyDeclarationName(node) { return isStringOrNumericLiteralLike(node) && - node.parent.kind === 162 && + node.parent.kind === 164 && ts.isDeclaration(node.parent.parent); } ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 167: - case 166: case 169: case 168: - case 172: - case 173: + case 171: + case 170: + case 174: + case 175: + case 302: case 299: - case 296: - case 206: + case 208: return parent.name === node; - case 161: + case 163: return parent.right === node; - case 203: - case 270: + case 205: + case 273: return parent.propertyName === node; - case 275: - case 285: - case 279: - case 280: - case 281: + case 278: + case 288: + case 282: + case 283: + case 284: return true; } return false; } ts.isIdentifierName = isIdentifierName; function isAliasSymbolDeclaration(node) { - if (node.kind === 265 || - node.kind === 264 || - node.kind === 267 && !!node.name || - node.kind === 268 || - node.kind === 274 || - node.kind === 270 || - node.kind === 275 || - node.kind === 271 && exportAssignmentIsAlias(node)) { + if (node.kind === 268 || + node.kind === 267 || + node.kind === 270 && !!node.name || + node.kind === 271 || + node.kind === 277 || + node.kind === 273 || + node.kind === 278 || + node.kind === 274 && exportAssignmentIsAlias(node)) { return true; } return isInJSFile(node) && (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 && exportAssignmentIsAlias(node) || @@ -13601,18 +13697,18 @@ var ts; ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getAliasDeclarationFromName(node) { switch (node.parent.kind) { - case 267: case 270: - case 268: - case 275: + case 273: case 271: - case 265: + case 278: case 274: + case 268: + case 277: return node.parent; - case 161: + case 163: do { node = node.parent; - } while (node.parent.kind === 161); + } while (node.parent.kind === 163); return getAliasDeclarationFromName(node); } } @@ -13631,7 +13727,7 @@ var ts; } ts.getExportAssignmentExpression = getExportAssignmentExpression; function getPropertyAssignmentAliasLikeExpression(node) { - return node.kind === 297 ? node.name : node.kind === 296 ? node.initializer : + return node.kind === 300 ? node.name : node.kind === 299 ? node.initializer : node.parent.right; } ts.getPropertyAssignmentAliasLikeExpression = getPropertyAssignmentAliasLikeExpression; @@ -13695,11 +13791,11 @@ var ts; } ts.getAncestor = getAncestor; function isKeyword(token) { - return 81 <= token && token <= 160; + return 81 <= token && token <= 162; } ts.isKeyword = isKeyword; function isContextualKeyword(token) { - return 126 <= token && token <= 160; + return 126 <= token && token <= 162; } ts.isContextualKeyword = isContextualKeyword; function isNonContextualKeyword(token) { @@ -13735,14 +13831,14 @@ var ts; } var flags = 0; switch (node.kind) { - case 256: - case 213: - case 169: + case 259: + case 215: + case 171: if (node.asteriskToken) { flags |= 1; } - case 214: - if (hasSyntacticModifier(node, 256)) { + case 216: + if (hasSyntacticModifier(node, 512)) { flags |= 2; } break; @@ -13755,13 +13851,13 @@ var ts; ts.getFunctionFlags = getFunctionFlags; function isAsyncFunction(node) { switch (node.kind) { - case 256: - case 213: - case 214: - case 169: + case 259: + case 215: + case 216: + case 171: return node.body !== undefined && node.asteriskToken === undefined - && hasSyntacticModifier(node, 256); + && hasSyntacticModifier(node, 512); } return false; } @@ -13780,7 +13876,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - if (!(name.kind === 162 || name.kind === 207)) { + if (!(name.kind === 164 || name.kind === 209)) { return false; } var expr = ts.isElementAccessExpression(name) ? skipParentheses(name.argumentExpression) : name.expression; @@ -13796,7 +13892,7 @@ var ts; case 10: case 8: return ts.escapeLeadingUnderscores(name.text); - case 162: + case 164: var nameExpression = name.expression; if (isStringOrNumericLiteralLike(nameExpression)) { return ts.escapeLeadingUnderscores(nameExpression.text); @@ -13859,11 +13955,11 @@ var ts; ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 164; + return root.kind === 166; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 203) { + while (node.kind === 205) { node = node.parent.parent; } return node; @@ -13871,15 +13967,15 @@ var ts; ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; - return kind === 171 - || kind === 213 - || kind === 256 - || kind === 214 - || kind === 169 - || kind === 172 - || kind === 173 - || kind === 261 - || kind === 305; + return kind === 173 + || kind === 215 + || kind === 259 + || kind === 216 + || kind === 171 + || kind === 174 + || kind === 175 + || kind === 264 + || kind === 308; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(range) { @@ -13893,23 +13989,23 @@ var ts; ts.getOriginalSourceFile = getOriginalSourceFile; function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 209 && expression.arguments !== undefined; + var hasArguments = expression.kind === 211 && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 209: + case 211: return hasArguments ? 0 : 1; - case 219: - case 216: - case 217: - case 215: - case 218: - case 222: - case 224: - return 1; case 221: + case 218: + case 219: + case 217: + case 220: + case 224: + case 226: + return 1; + case 223: switch (operator) { case 42: case 63: @@ -13936,15 +14032,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 209 && expression.arguments !== undefined; + var hasArguments = expression.kind === 211 && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 221) { + if (expression.kind === 223) { return expression.operatorToken.kind; } - else if (expression.kind === 219 || expression.kind === 220) { + else if (expression.kind === 221 || expression.kind === 222) { return expression.operator; } else { @@ -13954,15 +14050,15 @@ var ts; ts.getOperator = getOperator; function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { switch (nodeKind) { - case 351: + case 354: return 0; - case 225: + case 227: return 1; - case 224: + case 226: return 2; - case 222: + case 224: return 4; - case 221: + case 223: switch (operatorKind) { case 27: return 0; @@ -13986,26 +14082,27 @@ var ts; default: return getBinaryOperatorPrecedence(operatorKind); } - case 211: - case 230: - case 219: - case 216: - case 217: - case 215: + case 213: + case 232: + case 221: case 218: - return 16; + case 219: + case 217: case 220: + return 16; + case 222: return 17; - case 208: - return 18; - case 209: - return hasArguments ? 19 : 18; case 210: - case 206: - case 207: - case 231: + return 18; + case 211: + return hasArguments ? 19 : 18; + case 212: + case 208: + case 209: + case 233: return 19; - case 229: + case 231: + case 235: return 11; case 108: case 106: @@ -14017,19 +14114,19 @@ var ts; case 8: case 9: case 10: - case 204: - case 205: - case 213: - case 214: - case 226: + case 206: + case 207: + case 215: + case 216: + case 228: case 13: case 14: - case 223: - case 212: - case 227: - case 278: - case 279: + case 225: + case 214: + case 229: + case 281: case 282: + case 285: return 20; default: return -1; @@ -14061,7 +14158,8 @@ var ts; case 33: case 102: case 101: - case 127: + case 128: + case 150: return 11; case 47: case 48: @@ -14083,7 +14181,7 @@ var ts; function getSemanticJsxChildren(children) { return ts.filter(children, function (i) { switch (i.kind) { - case 288: + case 291: return !!i.expression; case 11: return !i.containsOnlyTriviaWhiteSpaces; @@ -14138,7 +14236,7 @@ var ts; } diagnostics = nonFileDiagnostics; } - ts.insertSorted(diagnostics, diagnostic, compareDiagnostics); + ts.insertSorted(diagnostics, diagnostic, compareDiagnosticsSkipRelatedInformation); } function getGlobalDiagnostics() { hasReadNonFileDiagnostics = true; @@ -14625,7 +14723,7 @@ var ts; while (ts.isQualifiedName(node.parent) && node.parent.left === node) { node = node.parent; } - return node.parent.kind === 181; + return node.parent.kind === 183; } ts.isThisInTypeQuery = isThisInTypeQuery; function identifierIsThisKeyword(id) { @@ -14639,10 +14737,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 172) { + if (accessor.kind === 174) { getAccessor = accessor; } - else if (accessor.kind === 173) { + else if (accessor.kind === 175) { setAccessor = accessor; } else { @@ -14662,10 +14760,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 172 && !getAccessor) { + if (member.kind === 174 && !getAccessor) { getAccessor = member; } - if (member.kind === 173 && !setAccessor) { + if (member.kind === 175 && !setAccessor) { setAccessor = member; } } @@ -14704,7 +14802,7 @@ var ts; } ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations; function isNonTypeAliasTemplate(tag) { - return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 320 && tag.parent.tags.some(isJSDocTypeAlias)); + return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 323 && tag.parent.tags.some(isJSDocTypeAlias)); } function getEffectiveSetAccessorTypeAnnotationNode(node) { var parameter = getSetAccessorValueParameter(node); @@ -14888,13 +14986,17 @@ var ts; } ts.hasOverrideModifier = hasOverrideModifier; function hasAbstractModifier(node) { - return hasSyntacticModifier(node, 128); + return hasSyntacticModifier(node, 256); } ts.hasAbstractModifier = hasAbstractModifier; function hasAmbientModifier(node) { return hasSyntacticModifier(node, 2); } ts.hasAmbientModifier = hasAmbientModifier; + function hasAccessorModifier(node) { + return hasSyntacticModifier(node, 128); + } + ts.hasAccessorModifier = hasAccessorModifier; function hasEffectiveReadonlyModifier(node) { return hasEffectiveModifier(node, 64); } @@ -14912,7 +15014,7 @@ var ts; } ts.getSelectedSyntacticModifierFlags = getSelectedSyntacticModifierFlags; function getModifierFlagsWorker(node, includeJSDoc, alwaysIncludeJSDoc) { - if (node.kind >= 0 && node.kind <= 160) { + if (node.kind >= 0 && node.kind <= 162) { return 0; } if (!(node.modifierFlagsCache & 536870912)) { @@ -14984,25 +15086,22 @@ var ts; case 123: return 4; case 122: return 16; case 121: return 8; - case 126: return 128; + case 126: return 256; + case 127: return 128; case 93: return 1; - case 135: return 2; + case 136: return 2; case 85: return 2048; - case 88: return 512; - case 131: return 256; - case 145: return 64; - case 159: return 16384; + case 88: return 1024; + case 132: return 512; + case 146: return 64; + case 161: return 16384; case 101: return 32768; - case 144: return 65536; - case 165: return 131072; + case 145: return 65536; + case 167: return 131072; } return 0; } ts.modifierToFlag = modifierToFlag; - function createModifiers(modifierFlags) { - return modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; - } - ts.createModifiers = createModifiers; function isLogicalOperator(token) { return token === 56 || token === 55 @@ -15051,8 +15150,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, true)) { var kind = node.left.kind; - return kind === 205 - || kind === 204; + return kind === 207 + || kind === 206; } return false; } @@ -15069,12 +15168,12 @@ var ts; switch (node.kind) { case 79: return node; - case 161: + case 163: do { node = node.left; } while (node.kind !== 79); return node; - case 206: + case 208: do { node = node.expression; } while (node.kind !== 79); @@ -15086,9 +15185,9 @@ var ts; return node.kind === 79 || node.kind === 108 || node.kind === 106 - || node.kind === 231 - || node.kind === 206 && isDottedName(node.expression) - || node.kind === 212 && isDottedName(node.expression); + || node.kind === 233 + || node.kind === 208 && isDottedName(node.expression) + || node.kind === 214 && isDottedName(node.expression); } ts.isDottedName = isDottedName; function isPropertyAccessEntityNameExpression(node) { @@ -15119,8 +15218,8 @@ var ts; } ts.isPrototypeAccess = isPrototypeAccess; function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 161 && node.parent.right === node) || - (node.parent.kind === 206 && node.parent.name === node); + return (node.parent.kind === 163 && node.parent.right === node) || + (node.parent.kind === 208 && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isRightSideOfAccessExpression(node) { @@ -15135,12 +15234,12 @@ var ts; } ts.isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName = isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName; function isEmptyObjectLiteral(expression) { - return expression.kind === 205 && + return expression.kind === 207 && expression.properties.length === 0; } ts.isEmptyObjectLiteral = isEmptyObjectLiteral; function isEmptyArrayLiteral(expression) { - return expression.kind === 204 && + return expression.kind === 206 && expression.elements.length === 0; } ts.isEmptyArrayLiteral = isEmptyArrayLiteral; @@ -15156,7 +15255,7 @@ var ts; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; function isExportDefaultSymbol(symbol) { - return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 512); + return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 1024); } function tryExtractTSExtension(fileName) { return ts.find(supportedTSExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); }); @@ -15282,20 +15381,16 @@ var ts; return getStringFromExpandedCharCodes(expandedCharCodes); } ts.base64decode = base64decode; + function readJsonOrUndefined(path, hostOrText) { + var jsonText = ts.isString(hostOrText) ? hostOrText : hostOrText.readFile(path); + if (!jsonText) + return undefined; + var result = ts.parseConfigFileTextToJson(path, jsonText); + return !result.error ? result.config : undefined; + } + ts.readJsonOrUndefined = readJsonOrUndefined; function readJson(path, host) { - try { - var jsonText = host.readFile(path); - if (!jsonText) - return {}; - var result = ts.parseConfigFileTextToJson(path, jsonText); - if (result.error) { - return {}; - } - return result.config; - } - catch (e) { - return {}; - } + return readJsonOrUndefined(path, host) || {}; } ts.readJson = readJson; function directoryProbablyExists(directoryName, host) { @@ -15414,8 +15509,8 @@ var ts; var parseNode = ts.getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 260: - case 261: + case 263: + case 264: return parseNode === parseNode.parent.name; } } @@ -15430,7 +15525,7 @@ var ts; return node.initializer !== undefined; } function isWatchSet(options) { - return options.watch && options.hasOwnProperty("watch"); + return options.watch && ts.hasProperty(options, "watch"); } ts.isWatchSet = isWatchSet; function closeFileWatcher(watcher) { @@ -15484,32 +15579,32 @@ var ts; if (!parent) return 0; switch (parent.kind) { - case 212: + case 214: return accessKind(parent); - case 220: - case 219: + case 222: + case 221: var operator = parent.operator; return operator === 45 || operator === 46 ? writeOrReadWrite() : 0; - case 221: + case 223: var _a = parent, left = _a.left, operatorToken = _a.operatorToken; return left === node && isAssignmentOperator(operatorToken.kind) ? operatorToken.kind === 63 ? 1 : writeOrReadWrite() : 0; - case 206: + case 208: return parent.name !== node ? 0 : accessKind(parent); - case 296: { + case 299: { var parentAccess = accessKind(parent.parent); return node === parent.name ? reverseAccessKind(parentAccess) : parentAccess; } - case 297: + case 300: return node === parent.objectAssignmentInitializer ? 0 : accessKind(parent.parent); - case 204: + case 206: return accessKind(parent); default: return 0; } function writeOrReadWrite() { - return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 238 ? 1 : 2; + return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 241 ? 1 : 2; } } function reverseAccessKind(a) { @@ -15575,7 +15670,7 @@ var ts; function isAbstractConstructorSymbol(symbol) { if (symbol.flags & 32) { var declaration = getClassLikeDeclarationOfSymbol(symbol); - return !!declaration && hasSyntacticModifier(declaration, 128); + return !!declaration && hasSyntacticModifier(declaration, 256); } return false; } @@ -15636,37 +15731,37 @@ var ts; } ts.isObjectTypeDeclaration = isObjectTypeDeclaration; function isTypeNodeKind(kind) { - return (kind >= 177 && kind <= 200) - || kind === 130 - || kind === 155 - || kind === 147 - || kind === 158 + return (kind >= 179 && kind <= 202) + || kind === 131 + || kind === 157 || kind === 148 - || kind === 133 - || kind === 150 - || kind === 151 - || kind === 114 + || kind === 160 + || kind === 149 + || kind === 134 + || kind === 152 || kind === 153 - || kind === 143 - || kind === 228 - || kind === 312 - || kind === 313 - || kind === 314 + || kind === 114 + || kind === 155 + || kind === 144 + || kind === 230 || kind === 315 || kind === 316 || kind === 317 - || kind === 318; + || kind === 318 + || kind === 319 + || kind === 320 + || kind === 321; } ts.isTypeNodeKind = isTypeNodeKind; function isAccessExpression(node) { - return node.kind === 206 || node.kind === 207; + return node.kind === 208 || node.kind === 209; } ts.isAccessExpression = isAccessExpression; function getNameOfAccessExpression(node) { - if (node.kind === 206) { + if (node.kind === 208) { return node.name; } - ts.Debug.assert(node.kind === 207); + ts.Debug.assert(node.kind === 209); return node.argumentExpression; } ts.getNameOfAccessExpression = getNameOfAccessExpression; @@ -15681,7 +15776,7 @@ var ts; } ts.isBundleFileTextLike = isBundleFileTextLike; function isNamedImportsOrExports(node) { - return node.kind === 269 || node.kind === 273; + return node.kind === 272 || node.kind === 276; } ts.isNamedImportsOrExports = isNamedImportsOrExports; function getLeftmostAccessExpression(expr) { @@ -15696,13 +15791,13 @@ var ts; return walkAccessExpression(name.parent); } function walkAccessExpression(access) { - if (access.kind === 206) { + if (access.kind === 208) { var res = action(access.name); if (res !== undefined) { return res; } } - else if (access.kind === 207) { + else if (access.kind === 209) { if (ts.isIdentifier(access.argumentExpression) || ts.isStringLiteralLike(access.argumentExpression)) { var res = action(access.argumentExpression); if (res !== undefined) { @@ -15726,27 +15821,28 @@ var ts; function getLeftmostExpression(node, stopAtCallExpressions) { while (true) { switch (node.kind) { - case 220: + case 222: node = node.operand; continue; - case 221: + case 223: node = node.left; continue; - case 222: + case 224: node = node.condition; continue; - case 210: + case 212: node = node.tag; continue; - case 208: + case 210: if (stopAtCallExpressions) { return node; } - case 229: - case 207: - case 206: - case 230: - case 350: + case 231: + case 209: + case 208: + case 232: + case 353: + case 235: node = node.expression; continue; } @@ -16860,33 +16956,33 @@ var ts; return ts.isIdentifier(useSite) && ts.isShorthandPropertyAssignment(useSite.parent) && useSite.parent.name === useSite; } function isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(node) { - while (node.kind === 79 || node.kind === 206) { + while (node.kind === 79 || node.kind === 208) { node = node.parent; } - if (node.kind !== 162) { + if (node.kind !== 164) { return false; } - if (hasSyntacticModifier(node.parent, 128)) { + if (hasSyntacticModifier(node.parent, 256)) { return true; } var containerKind = node.parent.parent.kind; - return containerKind === 258 || containerKind === 182; + return containerKind === 261 || containerKind === 184; } function isIdentifierInNonEmittingHeritageClause(node) { if (node.kind !== 79) return false; var heritageClause = ts.findAncestor(node.parent, function (parent) { switch (parent.kind) { - case 291: + case 294: return true; - case 206: - case 228: + case 208: + case 230: return false; default: return "quit"; } }); - return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 258; + return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 261; } function isIdentifierTypeReference(node) { return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName); @@ -17016,22 +17112,22 @@ var ts; if (!node.parent) return undefined; switch (node.kind) { - case 163: + case 165: var parent_1 = node.parent; - return parent_1.kind === 190 ? undefined : parent_1.typeParameters; - case 164: + return parent_1.kind === 192 ? undefined : parent_1.typeParameters; + case 166: return node.parent.parameters; - case 199: + case 201: return node.parent.templateSpans; - case 233: + case 236: return node.parent.templateSpans; - case 165: { + case 167: { var parent_2 = node.parent; return ts.canHaveDecorators(parent_2) ? parent_2.modifiers : ts.canHaveIllegalDecorators(parent_2) ? parent_2.illegalDecorators : undefined; } - case 291: + case 294: return node.parent.heritageClauses; } var parent = node.parent; @@ -17039,45 +17135,45 @@ var ts; return ts.isJSDocTypeLiteral(node.parent) ? undefined : node.parent.tags; } switch (parent.kind) { - case 182: - case 258: - return ts.isTypeElement(node) ? parent.members : undefined; - case 187: - case 188: - return parent.types; case 184: - case 204: - case 351: - case 269: - case 273: + case 261: + return ts.isTypeElement(node) ? parent.members : undefined; + case 189: + case 190: + return parent.types; + case 186: + case 206: + case 354: + case 272: + case 276: return parent.elements; - case 205: - case 286: + case 207: + case 289: return parent.properties; - case 208: - case 209: + case 210: + case 211: return ts.isTypeNode(node) ? parent.typeArguments : parent.expression === node ? undefined : parent.arguments; - case 278: - case 282: + case 281: + case 285: return ts.isJsxChild(node) ? parent.children : undefined; - case 280: - case 279: + case 283: + case 282: return ts.isTypeNode(node) ? parent.typeArguments : undefined; - case 235: - case 289: - case 290: - case 262: + case 238: + case 292: + case 293: + case 265: return parent.statements; - case 263: + case 266: return parent.clauses; - case 257: - case 226: - return ts.isClassElement(node) ? parent.members : undefined; case 260: + case 228: + return ts.isClassElement(node) ? parent.members : undefined; + case 263: return ts.isEnumMember(node) ? parent.members : undefined; - case 305: + case 308: return parent.statements; } } @@ -17087,7 +17183,7 @@ var ts; if (ts.some(node.parameters, function (p) { return !getEffectiveTypeAnnotationNode(p); })) { return true; } - if (node.kind !== 214) { + if (node.kind !== 216) { var parameter = ts.firstOrUndefined(node.parameters); if (!(parameter && parameterIsThisKeyword(parameter))) { return true; @@ -17102,7 +17198,7 @@ var ts; } ts.isInfinityOrNaNString = isInfinityOrNaNString; function isCatchClauseVariableDeclaration(node) { - return node.kind === 254 && node.parent.kind === 292; + return node.kind === 257 && node.parent.kind === 295; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function isParameterOrCatchClauseVariable(symbol) { @@ -17111,7 +17207,7 @@ var ts; } ts.isParameterOrCatchClauseVariable = isParameterOrCatchClauseVariable; function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 213 || node.kind === 214; + return node.kind === 215 || node.kind === 216; } ts.isFunctionExpressionOrArrowFunction = isFunctionExpressionOrArrowFunction; function escapeSnippetText(text) { @@ -17177,7 +17273,7 @@ var ts; ts.getNodeModulePathParts = getNodeModulePathParts; function getParameterTypeNode(parameter) { var _a; - return parameter.kind === 340 ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; + return parameter.kind === 343 ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; } ts.getParameterTypeNode = getParameterTypeNode; })(ts || (ts = {})); @@ -17270,10 +17366,10 @@ var ts; return parenthesizerRule; } function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { - var binaryOperatorPrecedence = ts.getOperatorPrecedence(221, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(221, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(223, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(223, binaryOperator); var emittedOperand = ts.skipPartiallyEmittedExpressions(operand); - if (!isLeftSideOfBinary && operand.kind === 214 && binaryOperatorPrecedence > 3) { + if (!isLeftSideOfBinary && operand.kind === 216 && binaryOperatorPrecedence > 3) { return true; } var operandPrecedence = ts.getExpressionPrecedence(emittedOperand); @@ -17281,7 +17377,7 @@ var ts; case -1: if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 - && operand.kind === 224) { + && operand.kind === 226) { return false; } return true; @@ -17313,14 +17409,15 @@ var ts; return binaryOperator === 41 || binaryOperator === 51 || binaryOperator === 50 - || binaryOperator === 52; + || binaryOperator === 52 + || binaryOperator === 27; } function getLiteralKindOfBinaryPlusOperand(node) { node = ts.skipPartiallyEmittedExpressions(node); if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 221 && node.operatorToken.kind === 39) { + if (node.kind === 223 && node.operatorToken.kind === 39) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -17336,7 +17433,7 @@ var ts; } function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = ts.skipPartiallyEmittedExpressions(operand); - if (skipped.kind === 212) { + if (skipped.kind === 214) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) @@ -17353,7 +17450,7 @@ var ts; return ts.isCommaSequence(expression) ? factory.createParenthesizedExpression(expression) : expression; } function parenthesizeConditionOfConditionalExpression(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(222, 57); + var conditionalPrecedence = ts.getOperatorPrecedence(224, 57); var emittedCondition = ts.skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) !== 1) { @@ -17372,8 +17469,8 @@ var ts; var needsParens = ts.isCommaSequence(check); if (!needsParens) { switch (ts.getLeftmostExpression(check, false).kind) { - case 226: - case 213: + case 228: + case 215: needsParens = true; } } @@ -17382,9 +17479,9 @@ var ts; function parenthesizeExpressionOfNew(expression) { var leftmostExpr = ts.getLeftmostExpression(expression, true); switch (leftmostExpr.kind) { - case 208: + case 210: return factory.createParenthesizedExpression(expression); - case 209: + case 211: return !leftmostExpr.arguments ? factory.createParenthesizedExpression(expression) : expression; @@ -17394,7 +17491,7 @@ var ts; function parenthesizeLeftSideOfAccess(expression, optionalChain) { var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 209 || emittedExpression.arguments) + && (emittedExpression.kind !== 211 || emittedExpression.arguments) && (optionalChain || !ts.isOptionalChain(emittedExpression))) { return expression; } @@ -17413,7 +17510,7 @@ var ts; function parenthesizeExpressionForDisallowedComma(expression) { var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(221, 27); + var commaPrecedence = ts.getOperatorPrecedence(223, 27); return expressionPrecedence > commaPrecedence ? expression : ts.setTextRange(factory.createParenthesizedExpression(expression), expression); } function parenthesizeExpressionOfExpressionStatement(expression) { @@ -17421,43 +17518,43 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = ts.skipPartiallyEmittedExpressions(callee).kind; - if (kind === 213 || kind === 214) { + if (kind === 215 || kind === 216) { var updated = factory.updateCallExpression(emittedExpression, ts.setTextRange(factory.createParenthesizedExpression(callee), callee), emittedExpression.typeArguments, emittedExpression.arguments); return factory.restoreOuterExpressions(expression, updated, 8); } } var leftmostExpressionKind = ts.getLeftmostExpression(emittedExpression, false).kind; - if (leftmostExpressionKind === 205 || leftmostExpressionKind === 213) { + if (leftmostExpressionKind === 207 || leftmostExpressionKind === 215) { return ts.setTextRange(factory.createParenthesizedExpression(expression), expression); } return expression; } function parenthesizeConciseBodyOfArrowFunction(body) { - if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, false).kind === 205)) { + if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, false).kind === 207)) { return ts.setTextRange(factory.createParenthesizedExpression(body), body); } return body; } function parenthesizeCheckTypeOfConditionalType(checkType) { switch (checkType.kind) { - case 179: - case 180: - case 189: + case 181: + case 182: + case 191: return factory.createParenthesizedType(checkType); } return checkType; } function parenthesizeExtendsTypeOfConditionalType(extendsType) { switch (extendsType.kind) { - case 189: + case 191: return factory.createParenthesizedType(extendsType); } return extendsType; } function parenthesizeConstituentTypeOfUnionType(type) { switch (type.kind) { - case 187: - case 188: + case 189: + case 190: return factory.createParenthesizedType(type); } return parenthesizeCheckTypeOfConditionalType(type); @@ -17467,8 +17564,8 @@ var ts; } function parenthesizeConstituentTypeOfIntersectionType(type) { switch (type.kind) { - case 187: - case 188: + case 189: + case 190: return factory.createParenthesizedType(type); } return parenthesizeConstituentTypeOfUnionType(type); @@ -17478,23 +17575,23 @@ var ts; } function parenthesizeOperandOfTypeOperator(type) { switch (type.kind) { - case 188: + case 190: return factory.createParenthesizedType(type); } return parenthesizeConstituentTypeOfIntersectionType(type); } function parenthesizeOperandOfReadonlyTypeOperator(type) { switch (type.kind) { - case 193: + case 195: return factory.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); } function parenthesizeNonArrayTypeOfPostfixType(type) { switch (type.kind) { - case 190: - case 193: - case 181: + case 192: + case 195: + case 183: return factory.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); @@ -17638,11 +17735,11 @@ var ts; } function convertToAssignmentPattern(node) { switch (node.kind) { - case 202: case 204: + case 206: return convertToArrayAssignmentPattern(node); - case 201: - case 205: + case 203: + case 207: return convertToObjectAssignmentPattern(node); } } @@ -17715,6 +17812,8 @@ var ts; createUniqueName: createUniqueName, getGeneratedNameForNode: getGeneratedNameForNode, createPrivateIdentifier: createPrivateIdentifier, + createUniquePrivateName: createUniquePrivateName, + getGeneratedPrivateNameForNode: getGeneratedPrivateNameForNode, createToken: createToken, createSuper: createSuper, createThis: createThis, @@ -17877,6 +17976,8 @@ var ts; updateAsExpression: updateAsExpression, createNonNullExpression: createNonNullExpression, updateNonNullExpression: updateNonNullExpression, + createSatisfiesExpression: createSatisfiesExpression, + updateSatisfiesExpression: updateSatisfiesExpression, createNonNullChain: createNonNullChain, updateNonNullChain: updateNonNullChain, createMetaProperty: createMetaProperty, @@ -17973,18 +18074,18 @@ var ts; createMissingDeclaration: createMissingDeclaration, createExternalModuleReference: createExternalModuleReference, updateExternalModuleReference: updateExternalModuleReference, - get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(312); }, - get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(313); }, - get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(315); }, - get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(315); }, - get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(314); }, - get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(314); }, - get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(316); }, - get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(316); }, - get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(318); }, - get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(318); }, - get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(319); }, - get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(319); }, + get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(315); }, + get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(316); }, + get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(318); }, + get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(318); }, + get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(317); }, + get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(317); }, + get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(319); }, + get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(319); }, + get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(321); }, + get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(321); }, + get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(322); }, + get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(322); }, createJSDocFunctionType: createJSDocFunctionType, updateJSDocFunctionType: updateJSDocFunctionType, createJSDocTypeLiteral: createJSDocTypeLiteral, @@ -18019,30 +18120,30 @@ var ts; updateJSDocLinkCode: updateJSDocLinkCode, createJSDocLinkPlain: createJSDocLinkPlain, updateJSDocLinkPlain: updateJSDocLinkPlain, - get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(343); }, - get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(343); }, - get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(341); }, - get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(341); }, - get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(342); }, - get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(342); }, - get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(339); }, - get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(339); }, - get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(330); }, - get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(330); }, - get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(332); }, - get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(332); }, - get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(333); }, - get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(333); }, - get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(334); }, - get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(334); }, - get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(335); }, - get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(335); }, - get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(336); }, - get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(336); }, - get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(337); }, - get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(337); }, - get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(331); }, - get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(331); }, + get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(346); }, + get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(346); }, + get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(344); }, + get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(344); }, + get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(345); }, + get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(345); }, + get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(342); }, + get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(342); }, + get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(333); }, + get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(333); }, + get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(335); }, + get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(335); }, + get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(336); }, + get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(336); }, + get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(337); }, + get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(337); }, + get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(338); }, + get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(338); }, + get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(339); }, + get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(339); }, + get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(340); }, + get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(340); }, + get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(334); }, + get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(334); }, createJSDocUnknownTag: createJSDocUnknownTag, updateJSDocUnknownTag: updateJSDocUnknownTag, createJSDocText: createJSDocText, @@ -18228,11 +18329,11 @@ var ts; } if (name) { switch (node.kind) { + case 171: + case 174: + case 175: case 169: - case 172: - case 173: - case 167: - case 296: + case 299: if (ts.isIdentifier(name)) { node.transformFlags |= propagateIdentifierNameFlags(name); break; @@ -18366,10 +18467,12 @@ var ts; node.escapedText = ts.escapeLeadingUnderscores(text); return node; } - function createBaseGeneratedIdentifier(text, autoGenerateFlags) { + function createBaseGeneratedIdentifier(text, autoGenerateFlags, prefix, suffix) { var node = createBaseIdentifier(text, undefined); node.autoGenerateFlags = autoGenerateFlags; node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; nextAutoGenerateId++; return node; } @@ -18378,7 +18481,7 @@ var ts; if (typeArguments) { node.typeArguments = createNodeArray(typeArguments); } - if (node.originalKeywordKind === 132) { + if (node.originalKeywordKind === 133) { node.transformFlags |= 67108864; } return node; @@ -18388,11 +18491,11 @@ var ts; ? update(createIdentifier(ts.idText(node), typeArguments), node) : node; } - function createTempVariable(recordTempVariable, reservedInNestedScopes) { + function createTempVariable(recordTempVariable, reservedInNestedScopes, prefix, suffix) { var flags = 1; if (reservedInNestedScopes) flags |= 8; - var name = createBaseGeneratedIdentifier("", flags); + var name = createBaseGeneratedIdentifier("", flags, prefix, suffix); if (recordTempVariable) { recordTempVariable(name); } @@ -18402,41 +18505,73 @@ var ts; var flags = 2; if (reservedInNestedScopes) flags |= 8; - return createBaseGeneratedIdentifier("", flags); + return createBaseGeneratedIdentifier("", flags, undefined, undefined); } - function createUniqueName(text, flags) { + function createUniqueName(text, flags, prefix, suffix) { if (flags === void 0) { flags = 0; } ts.Debug.assert(!(flags & 7), "Argument out of range: flags"); ts.Debug.assert((flags & (16 | 32)) !== 32, "GeneratedIdentifierFlags.FileLevel cannot be set without also setting GeneratedIdentifierFlags.Optimistic"); - return createBaseGeneratedIdentifier(text, 3 | flags); + return createBaseGeneratedIdentifier(text, 3 | flags, prefix, suffix); } - function getGeneratedNameForNode(node, flags) { + function getGeneratedNameForNode(node, flags, prefix, suffix) { if (flags === void 0) { flags = 0; } ts.Debug.assert(!(flags & 7), "Argument out of range: flags"); - var name = createBaseGeneratedIdentifier(node && ts.isIdentifier(node) ? ts.idText(node) : "", 4 | flags); + var text = !node ? "" : + ts.isMemberName(node) ? ts.formatGeneratedName(false, prefix, node, suffix, ts.idText) : + "generated@".concat(ts.getNodeId(node)); + if (prefix || suffix) + flags |= 16; + var name = createBaseGeneratedIdentifier(text, 4 | flags, prefix, suffix); name.original = node; return name; } - function createPrivateIdentifier(text) { - if (!ts.startsWith(text, "#")) - ts.Debug.fail("First character of private identifier must be #: " + text); + function createBasePrivateIdentifier(text) { var node = baseFactory.createBasePrivateIdentifierNode(80); node.escapedText = ts.escapeLeadingUnderscores(text); node.transformFlags |= 16777216; return node; } + function createPrivateIdentifier(text) { + if (!ts.startsWith(text, "#")) + ts.Debug.fail("First character of private identifier must be #: " + text); + return createBasePrivateIdentifier(text); + } + function createBaseGeneratedPrivateIdentifier(text, autoGenerateFlags, prefix, suffix) { + var node = createBasePrivateIdentifier(text); + node.autoGenerateFlags = autoGenerateFlags; + node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; + nextAutoGenerateId++; + return node; + } + function createUniquePrivateName(text, prefix, suffix) { + if (text && !ts.startsWith(text, "#")) + ts.Debug.fail("First character of private identifier must be #: " + text); + var autoGenerateFlags = 8 | + (text ? 3 : 1); + return createBaseGeneratedPrivateIdentifier(text !== null && text !== void 0 ? text : "", autoGenerateFlags, prefix, suffix); + } + function getGeneratedPrivateNameForNode(node, prefix, suffix) { + var text = ts.isMemberName(node) ? ts.formatGeneratedName(true, prefix, node, suffix, ts.idText) : + "#generated@".concat(ts.getNodeId(node)); + var flags = prefix || suffix ? 16 : 0; + var name = createBaseGeneratedPrivateIdentifier(text, 4 | flags, prefix, suffix); + name.original = node; + return name; + } function createBaseToken(kind) { return baseFactory.createBaseTokenNode(kind); } function createToken(token) { - ts.Debug.assert(token >= 0 && token <= 160, "Invalid token"); + ts.Debug.assert(token >= 0 && token <= 162, "Invalid token"); ts.Debug.assert(token <= 14 || token >= 17, "Invalid token. Use 'createTemplateLiteralLikeNode' to create template literals."); ts.Debug.assert(token <= 8 || token >= 14, "Invalid token. Use 'createLiteralLikeNode' to create literals."); ts.Debug.assert(token !== 79, "Invalid token. Use 'createIdentifier' to create identifiers"); var node = createBaseToken(token); var transformFlags = 0; switch (token) { - case 131: + case 132: transformFlags = 256 | 128; @@ -18444,24 +18579,24 @@ var ts; case 123: case 121: case 122: - case 145: + case 146: case 126: - case 135: + case 136: case 85: - case 130: - case 147: - case 158: - case 143: + case 131: case 148: - case 101: + case 160: case 144: - case 159: - case 150: - case 133: - case 151: - case 114: - case 155: + case 149: + case 101: + case 145: + case 161: + case 152: + case 134: case 153: + case 114: + case 157: + case 155: transformFlags = 1; break; case 106: @@ -18470,6 +18605,9 @@ var ts; case 124: transformFlags = 1024; break; + case 127: + transformFlags = 16777216; + break; case 108: transformFlags = 16384; break; @@ -18502,8 +18640,8 @@ var ts; if (flags & 1) result.push(createModifier(93)); if (flags & 2) - result.push(createModifier(135)); - if (flags & 512) + result.push(createModifier(136)); + if (flags & 1024) result.push(createModifier(88)); if (flags & 2048) result.push(createModifier(85)); @@ -18513,24 +18651,26 @@ var ts; result.push(createModifier(121)); if (flags & 16) result.push(createModifier(122)); - if (flags & 128) + if (flags & 256) result.push(createModifier(126)); if (flags & 32) result.push(createModifier(124)); if (flags & 16384) - result.push(createModifier(159)); + result.push(createModifier(161)); if (flags & 64) - result.push(createModifier(145)); - if (flags & 256) - result.push(createModifier(131)); + result.push(createModifier(146)); + if (flags & 128) + result.push(createModifier(127)); + if (flags & 512) + result.push(createModifier(132)); if (flags & 32768) result.push(createModifier(101)); if (flags & 65536) - result.push(createModifier(144)); + result.push(createModifier(145)); return result.length ? result : undefined; } function createQualifiedName(left, right) { - var node = createBaseNode(161); + var node = createBaseNode(163); node.left = left; node.right = asName(right); node.transformFlags |= @@ -18545,7 +18685,7 @@ var ts; : node; } function createComputedPropertyName(expression) { - var node = createBaseNode(162); + var node = createBaseNode(164); node.expression = parenthesizerRules().parenthesizeExpressionOfComputedPropertyName(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -18559,7 +18699,7 @@ var ts; : node; } function createTypeParameterDeclaration(modifiers, name, constraint, defaultType) { - var node = createBaseNamedDeclaration(163, modifiers, name); + var node = createBaseNamedDeclaration(165, modifiers, name); node.constraint = constraint; node.default = defaultType; node.transformFlags = 1; @@ -18574,7 +18714,7 @@ var ts; : node; } function createParameterDeclaration(modifiers, dotDotDotToken, name, questionToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(164, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); + var node = createBaseVariableLikeDeclaration(166, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.dotDotDotToken = dotDotDotToken; node.questionToken = questionToken; if (ts.isThisIdentifier(node.name)) { @@ -18604,7 +18744,7 @@ var ts; : node; } function createDecorator(expression) { - var node = createBaseNode(165); + var node = createBaseNode(167); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, false); node.transformFlags |= propagateChildFlags(node.expression) | @@ -18619,7 +18759,7 @@ var ts; : node; } function createPropertySignature(modifiers, name, questionToken, type) { - var node = createBaseNamedDeclaration(166, modifiers, name); + var node = createBaseNamedDeclaration(168, modifiers, name); node.type = type; node.questionToken = questionToken; node.transformFlags = 1; @@ -18641,7 +18781,7 @@ var ts; return update(updated, original); } function createPropertyDeclaration(modifiers, name, questionOrExclamationToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(167, modifiers, name, type, initializer); + var node = createBaseVariableLikeDeclaration(169, modifiers, name, type, initializer); node.questionToken = questionOrExclamationToken && ts.isQuestionToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.exclamationToken = questionOrExclamationToken && ts.isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.transformFlags |= @@ -18667,7 +18807,7 @@ var ts; : node; } function createMethodSignature(modifiers, name, questionToken, typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(168, modifiers, name, typeParameters, parameters, type); + var node = createBaseSignatureDeclaration(170, modifiers, name, typeParameters, parameters, type); node.questionToken = questionToken; node.transformFlags = 1; return node; @@ -18683,7 +18823,7 @@ var ts; : node; } function createMethodDeclaration(modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(169, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(171, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; node.questionToken = questionToken; node.transformFlags |= @@ -18693,7 +18833,7 @@ var ts; if (questionToken) { node.transformFlags |= 1; } - if (ts.modifiersToFlags(node.modifiers) & 256) { + if (ts.modifiersToFlags(node.modifiers) & 512) { if (asteriskToken) { node.transformFlags |= 128; } @@ -18726,7 +18866,7 @@ var ts; return update(updated, original); } function createClassStaticBlockDeclaration(body) { - var node = createBaseGenericNamedDeclaration(170, undefined, undefined, undefined); + var node = createBaseGenericNamedDeclaration(172, undefined, undefined, undefined); node.body = body; node.transformFlags = propagateChildFlags(body) | 16777216; node.illegalDecorators = undefined; @@ -18746,7 +18886,7 @@ var ts; return update(updated, original); } function createConstructorDeclaration(modifiers, parameters, body) { - var node = createBaseFunctionLikeDeclaration(171, modifiers, undefined, undefined, parameters, undefined, body); + var node = createBaseFunctionLikeDeclaration(173, modifiers, undefined, undefined, parameters, undefined, body); node.transformFlags |= 1024; node.illegalDecorators = undefined; node.typeParameters = undefined; @@ -18769,7 +18909,7 @@ var ts; return finishUpdateBaseSignatureDeclaration(updated, original); } function createGetAccessorDeclaration(modifiers, name, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(172, modifiers, name, undefined, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(174, modifiers, name, undefined, parameters, type, body); node.typeParameters = undefined; return node; } @@ -18789,7 +18929,7 @@ var ts; return finishUpdateBaseSignatureDeclaration(updated, original); } function createSetAccessorDeclaration(modifiers, name, parameters, body) { - var node = createBaseFunctionLikeDeclaration(173, modifiers, name, undefined, parameters, undefined, body); + var node = createBaseFunctionLikeDeclaration(175, modifiers, name, undefined, parameters, undefined, body); node.typeParameters = undefined; node.type = undefined; return node; @@ -18810,7 +18950,7 @@ var ts; return finishUpdateBaseSignatureDeclaration(updated, original); } function createCallSignature(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(174, undefined, undefined, typeParameters, parameters, type); + var node = createBaseSignatureDeclaration(176, undefined, undefined, typeParameters, parameters, type); node.transformFlags = 1; return node; } @@ -18822,7 +18962,7 @@ var ts; : node; } function createConstructSignature(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(175, undefined, undefined, typeParameters, parameters, type); + var node = createBaseSignatureDeclaration(177, undefined, undefined, typeParameters, parameters, type); node.transformFlags = 1; return node; } @@ -18834,7 +18974,7 @@ var ts; : node; } function createIndexSignature(modifiers, parameters, type) { - var node = createBaseSignatureDeclaration(176, modifiers, undefined, undefined, parameters, type); + var node = createBaseSignatureDeclaration(178, modifiers, undefined, undefined, parameters, type); node.transformFlags = 1; return node; } @@ -18846,7 +18986,7 @@ var ts; : node; } function createTemplateLiteralTypeSpan(type, literal) { - var node = createBaseNode(199); + var node = createBaseNode(201); node.type = type; node.literal = literal; node.transformFlags = 1; @@ -18862,7 +19002,7 @@ var ts; return createToken(kind); } function createTypePredicateNode(assertsModifier, parameterName, type) { - var node = createBaseNode(177); + var node = createBaseNode(179); node.assertsModifier = assertsModifier; node.parameterName = asName(parameterName); node.type = type; @@ -18877,7 +19017,7 @@ var ts; : node; } function createTypeReferenceNode(typeName, typeArguments) { - var node = createBaseNode(178); + var node = createBaseNode(180); node.typeName = asName(typeName); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(createNodeArray(typeArguments)); node.transformFlags = 1; @@ -18890,7 +19030,7 @@ var ts; : node; } function createFunctionTypeNode(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(179, undefined, undefined, typeParameters, parameters, type); + var node = createBaseSignatureDeclaration(181, undefined, undefined, typeParameters, parameters, type); node.transformFlags = 1; node.modifiers = undefined; return node; @@ -18918,7 +19058,7 @@ var ts; ts.Debug.fail("Incorrect number of arguments specified."); } function createConstructorTypeNode1(modifiers, typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(180, modifiers, undefined, typeParameters, parameters, type); + var node = createBaseSignatureDeclaration(182, modifiers, undefined, typeParameters, parameters, type); node.transformFlags = 1; return node; } @@ -18946,7 +19086,7 @@ var ts; return updateConstructorTypeNode1(node, node.modifiers, typeParameters, parameters, type); } function createTypeQueryNode(exprName, typeArguments) { - var node = createBaseNode(181); + var node = createBaseNode(183); node.exprName = exprName; node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags = 1; @@ -18959,7 +19099,7 @@ var ts; : node; } function createTypeLiteralNode(members) { - var node = createBaseNode(182); + var node = createBaseNode(184); node.members = createNodeArray(members); node.transformFlags = 1; return node; @@ -18970,7 +19110,7 @@ var ts; : node; } function createArrayTypeNode(elementType) { - var node = createBaseNode(183); + var node = createBaseNode(185); node.elementType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(elementType); node.transformFlags = 1; return node; @@ -18981,7 +19121,7 @@ var ts; : node; } function createTupleTypeNode(elements) { - var node = createBaseNode(184); + var node = createBaseNode(186); node.elements = createNodeArray(parenthesizerRules().parenthesizeElementTypesOfTupleType(elements)); node.transformFlags = 1; return node; @@ -18992,7 +19132,7 @@ var ts; : node; } function createNamedTupleMember(dotDotDotToken, name, questionToken, type) { - var node = createBaseNode(197); + var node = createBaseNode(199); node.dotDotDotToken = dotDotDotToken; node.name = name; node.questionToken = questionToken; @@ -19009,7 +19149,7 @@ var ts; : node; } function createOptionalTypeNode(type) { - var node = createBaseNode(185); + var node = createBaseNode(187); node.type = parenthesizerRules().parenthesizeTypeOfOptionalType(type); node.transformFlags = 1; return node; @@ -19020,7 +19160,7 @@ var ts; : node; } function createRestTypeNode(type) { - var node = createBaseNode(186); + var node = createBaseNode(188); node.type = type; node.transformFlags = 1; return node; @@ -19042,19 +19182,19 @@ var ts; : node; } function createUnionTypeNode(types) { - return createUnionOrIntersectionTypeNode(187, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); + return createUnionOrIntersectionTypeNode(189, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); } function updateUnionTypeNode(node, types) { return updateUnionOrIntersectionTypeNode(node, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); } function createIntersectionTypeNode(types) { - return createUnionOrIntersectionTypeNode(188, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); + return createUnionOrIntersectionTypeNode(190, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); } function updateIntersectionTypeNode(node, types) { return updateUnionOrIntersectionTypeNode(node, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); } function createConditionalTypeNode(checkType, extendsType, trueType, falseType) { - var node = createBaseNode(189); + var node = createBaseNode(191); node.checkType = parenthesizerRules().parenthesizeCheckTypeOfConditionalType(checkType); node.extendsType = parenthesizerRules().parenthesizeExtendsTypeOfConditionalType(extendsType); node.trueType = trueType; @@ -19071,7 +19211,7 @@ var ts; : node; } function createInferTypeNode(typeParameter) { - var node = createBaseNode(190); + var node = createBaseNode(192); node.typeParameter = typeParameter; node.transformFlags = 1; return node; @@ -19082,7 +19222,7 @@ var ts; : node; } function createTemplateLiteralType(head, templateSpans) { - var node = createBaseNode(198); + var node = createBaseNode(200); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags = 1; @@ -19096,7 +19236,7 @@ var ts; } function createImportTypeNode(argument, assertions, qualifier, typeArguments, isTypeOf) { if (isTypeOf === void 0) { isTypeOf = false; } - var node = createBaseNode(200); + var node = createBaseNode(202); node.argument = argument; node.assertions = assertions; node.qualifier = qualifier; @@ -19116,7 +19256,7 @@ var ts; : node; } function createParenthesizedType(type) { - var node = createBaseNode(191); + var node = createBaseNode(193); node.type = type; node.transformFlags = 1; return node; @@ -19127,14 +19267,14 @@ var ts; : node; } function createThisTypeNode() { - var node = createBaseNode(192); + var node = createBaseNode(194); node.transformFlags = 1; return node; } function createTypeOperatorNode(operator, type) { - var node = createBaseNode(193); + var node = createBaseNode(195); node.operator = operator; - node.type = operator === 145 ? + node.type = operator === 146 ? parenthesizerRules().parenthesizeOperandOfReadonlyTypeOperator(type) : parenthesizerRules().parenthesizeOperandOfTypeOperator(type); node.transformFlags = 1; @@ -19146,7 +19286,7 @@ var ts; : node; } function createIndexedAccessTypeNode(objectType, indexType) { - var node = createBaseNode(194); + var node = createBaseNode(196); node.objectType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(objectType); node.indexType = indexType; node.transformFlags = 1; @@ -19159,7 +19299,7 @@ var ts; : node; } function createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members) { - var node = createBaseNode(195); + var node = createBaseNode(197); node.readonlyToken = readonlyToken; node.typeParameter = typeParameter; node.nameType = nameType; @@ -19180,7 +19320,7 @@ var ts; : node; } function createLiteralTypeNode(literal) { - var node = createBaseNode(196); + var node = createBaseNode(198); node.literal = literal; node.transformFlags = 1; return node; @@ -19191,7 +19331,7 @@ var ts; : node; } function createObjectBindingPattern(elements) { - var node = createBaseNode(201); + var node = createBaseNode(203); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | @@ -19210,7 +19350,7 @@ var ts; : node; } function createArrayBindingPattern(elements) { - var node = createBaseNode(202); + var node = createBaseNode(204); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | @@ -19224,7 +19364,7 @@ var ts; : node; } function createBindingElement(dotDotDotToken, propertyName, name, initializer) { - var node = createBaseBindingLikeDeclaration(203, undefined, name, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); + var node = createBaseBindingLikeDeclaration(205, undefined, name, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.propertyName = asName(propertyName); node.dotDotDotToken = dotDotDotToken; node.transformFlags |= @@ -19252,7 +19392,7 @@ var ts; return node; } function createArrayLiteralExpression(elements, multiLine) { - var node = createBaseExpression(204); + var node = createBaseExpression(206); var lastElement = elements && ts.lastOrUndefined(elements); var elementsArray = createNodeArray(elements, lastElement && ts.isOmittedExpression(lastElement) ? true : undefined); node.elements = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(elementsArray); @@ -19266,7 +19406,7 @@ var ts; : node; } function createObjectLiteralExpression(properties, multiLine) { - var node = createBaseExpression(205); + var node = createBaseExpression(207); node.properties = createNodeArray(properties); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.properties); @@ -19278,7 +19418,7 @@ var ts; : node; } function createPropertyAccessExpression(expression, name) { - var node = createBaseExpression(206); + var node = createBaseExpression(208); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, false); node.name = asName(name); node.transformFlags = @@ -19303,7 +19443,7 @@ var ts; : node; } function createPropertyAccessChain(expression, questionDotToken, name) { - var node = createBaseExpression(206); + var node = createBaseExpression(208); node.flags |= 32; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, true); node.questionDotToken = questionDotToken; @@ -19326,7 +19466,7 @@ var ts; : node; } function createElementAccessExpression(expression, index) { - var node = createBaseExpression(207); + var node = createBaseExpression(209); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, false); node.argumentExpression = asExpression(index); node.transformFlags |= @@ -19349,7 +19489,7 @@ var ts; : node; } function createElementAccessChain(expression, questionDotToken, index) { - var node = createBaseExpression(207); + var node = createBaseExpression(209); node.flags |= 32; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, true); node.questionDotToken = questionDotToken; @@ -19370,7 +19510,7 @@ var ts; : node; } function createCallExpression(expression, typeArguments, argumentsArray) { - var node = createBaseExpression(208); + var node = createBaseExpression(210); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, false); node.typeArguments = asNodeArray(typeArguments); node.arguments = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(createNodeArray(argumentsArray)); @@ -19400,7 +19540,7 @@ var ts; : node; } function createCallChain(expression, questionDotToken, typeArguments, argumentsArray) { - var node = createBaseExpression(208); + var node = createBaseExpression(210); node.flags |= 32; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, true); node.questionDotToken = questionDotToken; @@ -19430,7 +19570,7 @@ var ts; : node; } function createNewExpression(expression, typeArguments, argumentsArray) { - var node = createBaseExpression(209); + var node = createBaseExpression(211); node.expression = parenthesizerRules().parenthesizeExpressionOfNew(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = argumentsArray ? parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(argumentsArray) : undefined; @@ -19452,7 +19592,7 @@ var ts; : node; } function createTaggedTemplateExpression(tag, typeArguments, template) { - var node = createBaseExpression(210); + var node = createBaseExpression(212); node.tag = parenthesizerRules().parenthesizeLeftSideOfAccess(tag, false); node.typeArguments = asNodeArray(typeArguments); node.template = template; @@ -19477,7 +19617,7 @@ var ts; : node; } function createTypeAssertion(type, expression) { - var node = createBaseExpression(211); + var node = createBaseExpression(213); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.type = type; node.transformFlags |= @@ -19493,7 +19633,7 @@ var ts; : node; } function createParenthesizedExpression(expression) { - var node = createBaseExpression(212); + var node = createBaseExpression(214); node.expression = expression; node.transformFlags = propagateChildFlags(node.expression); return node; @@ -19504,13 +19644,13 @@ var ts; : node; } function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(213, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(215, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; node.transformFlags |= propagateChildFlags(node.asteriskToken); if (node.typeParameters) { node.transformFlags |= 1; } - if (ts.modifiersToFlags(node.modifiers) & 256) { + if (ts.modifiersToFlags(node.modifiers) & 512) { if (node.asteriskToken) { node.transformFlags |= 128; } @@ -19535,12 +19675,12 @@ var ts; : node; } function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { - var node = createBaseFunctionLikeDeclaration(214, modifiers, undefined, typeParameters, parameters, type, parenthesizerRules().parenthesizeConciseBodyOfArrowFunction(body)); + var node = createBaseFunctionLikeDeclaration(216, modifiers, undefined, typeParameters, parameters, type, parenthesizerRules().parenthesizeConciseBodyOfArrowFunction(body)); node.equalsGreaterThanToken = equalsGreaterThanToken !== null && equalsGreaterThanToken !== void 0 ? equalsGreaterThanToken : createToken(38); node.transformFlags |= propagateChildFlags(node.equalsGreaterThanToken) | 1024; - if (ts.modifiersToFlags(node.modifiers) & 256) { + if (ts.modifiersToFlags(node.modifiers) & 512) { node.transformFlags |= 256 | 16384; } return node; @@ -19556,7 +19696,7 @@ var ts; : node; } function createDeleteExpression(expression) { - var node = createBaseExpression(215); + var node = createBaseExpression(217); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -19567,7 +19707,7 @@ var ts; : node; } function createTypeOfExpression(expression) { - var node = createBaseExpression(216); + var node = createBaseExpression(218); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -19578,7 +19718,7 @@ var ts; : node; } function createVoidExpression(expression) { - var node = createBaseExpression(217); + var node = createBaseExpression(219); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -19589,7 +19729,7 @@ var ts; : node; } function createAwaitExpression(expression) { - var node = createBaseExpression(218); + var node = createBaseExpression(220); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -19604,7 +19744,7 @@ var ts; : node; } function createPrefixUnaryExpression(operator, operand) { - var node = createBaseExpression(219); + var node = createBaseExpression(221); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPrefixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -19622,7 +19762,7 @@ var ts; : node; } function createPostfixUnaryExpression(operand, operator) { - var node = createBaseExpression(220); + var node = createBaseExpression(222); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPostfixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -19639,7 +19779,7 @@ var ts; : node; } function createBinaryExpression(left, operator, right) { - var node = createBaseExpression(221); + var node = createBaseExpression(223); var operatorToken = asToken(operator); var operatorKind = operatorToken.kind; node.left = parenthesizerRules().parenthesizeLeftSideOfBinary(operatorKind, left); @@ -19707,7 +19847,7 @@ var ts; : node; } function createConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse) { - var node = createBaseExpression(222); + var node = createBaseExpression(224); node.condition = parenthesizerRules().parenthesizeConditionOfConditionalExpression(condition); node.questionToken = questionToken !== null && questionToken !== void 0 ? questionToken : createToken(57); node.whenTrue = parenthesizerRules().parenthesizeBranchOfConditionalExpression(whenTrue); @@ -19731,7 +19871,7 @@ var ts; : node; } function createTemplateExpression(head, templateSpans) { - var node = createBaseExpression(223); + var node = createBaseExpression(225); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags |= @@ -19792,7 +19932,7 @@ var ts; } function createYieldExpression(asteriskToken, expression) { ts.Debug.assert(!asteriskToken || !!expression, "A `YieldExpression` with an asteriskToken must have an expression."); - var node = createBaseExpression(224); + var node = createBaseExpression(226); node.expression = expression && parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.asteriskToken = asteriskToken; node.transformFlags |= @@ -19810,7 +19950,7 @@ var ts; : node; } function createSpreadElement(expression) { - var node = createBaseExpression(225); + var node = createBaseExpression(227); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -19824,7 +19964,7 @@ var ts; : node; } function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseClassLikeDeclaration(226, modifiers, name, typeParameters, heritageClauses, members); + var node = createBaseClassLikeDeclaration(228, modifiers, name, typeParameters, heritageClauses, members); node.transformFlags |= 1024; return node; } @@ -19838,10 +19978,10 @@ var ts; : node; } function createOmittedExpression() { - return createBaseExpression(227); + return createBaseExpression(229); } function createExpressionWithTypeArguments(expression, typeArguments) { - var node = createBaseNode(228); + var node = createBaseNode(230); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, false); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags |= @@ -19857,7 +19997,7 @@ var ts; : node; } function createAsExpression(expression, type) { - var node = createBaseExpression(229); + var node = createBaseExpression(231); node.expression = expression; node.type = type; node.transformFlags |= @@ -19873,7 +20013,7 @@ var ts; : node; } function createNonNullExpression(expression) { - var node = createBaseExpression(230); + var node = createBaseExpression(232); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, false); node.transformFlags |= propagateChildFlags(node.expression) | @@ -19888,8 +20028,24 @@ var ts; ? update(createNonNullExpression(expression), node) : node; } + function createSatisfiesExpression(expression, type) { + var node = createBaseExpression(235); + node.expression = expression; + node.type = type; + node.transformFlags |= + propagateChildFlags(node.expression) | + propagateChildFlags(node.type) | + 1; + return node; + } + function updateSatisfiesExpression(node, expression, type) { + return node.expression !== expression + || node.type !== type + ? update(createSatisfiesExpression(expression, type), node) + : node; + } function createNonNullChain(expression) { - var node = createBaseExpression(230); + var node = createBaseExpression(232); node.flags |= 32; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, true); node.transformFlags |= @@ -19904,7 +20060,7 @@ var ts; : node; } function createMetaProperty(keywordToken, name) { - var node = createBaseExpression(231); + var node = createBaseExpression(233); node.keywordToken = keywordToken; node.name = name; node.transformFlags |= propagateChildFlags(node.name); @@ -19926,7 +20082,7 @@ var ts; : node; } function createTemplateSpan(expression, literal) { - var node = createBaseNode(233); + var node = createBaseNode(236); node.expression = expression; node.literal = literal; node.transformFlags |= @@ -19942,12 +20098,12 @@ var ts; : node; } function createSemicolonClassElement() { - var node = createBaseNode(234); + var node = createBaseNode(237); node.transformFlags |= 1024; return node; } function createBlock(statements, multiLine) { - var node = createBaseNode(235); + var node = createBaseNode(238); node.statements = createNodeArray(statements); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.statements); @@ -19959,7 +20115,7 @@ var ts; : node; } function createVariableStatement(modifiers, declarationList) { - var node = createBaseDeclaration(237); + var node = createBaseDeclaration(240); node.modifiers = asNodeArray(modifiers); node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; node.transformFlags |= @@ -19977,10 +20133,10 @@ var ts; : node; } function createEmptyStatement() { - return createBaseNode(236); + return createBaseNode(239); } function createExpressionStatement(expression) { - var node = createBaseNode(238); + var node = createBaseNode(241); node.expression = parenthesizerRules().parenthesizeExpressionOfExpressionStatement(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -19991,7 +20147,7 @@ var ts; : node; } function createIfStatement(expression, thenStatement, elseStatement) { - var node = createBaseNode(239); + var node = createBaseNode(242); node.expression = expression; node.thenStatement = asEmbeddedStatement(thenStatement); node.elseStatement = asEmbeddedStatement(elseStatement); @@ -20009,7 +20165,7 @@ var ts; : node; } function createDoStatement(statement, expression) { - var node = createBaseNode(240); + var node = createBaseNode(243); node.statement = asEmbeddedStatement(statement); node.expression = expression; node.transformFlags |= @@ -20024,7 +20180,7 @@ var ts; : node; } function createWhileStatement(expression, statement) { - var node = createBaseNode(241); + var node = createBaseNode(244); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -20039,7 +20195,7 @@ var ts; : node; } function createForStatement(initializer, condition, incrementor, statement) { - var node = createBaseNode(242); + var node = createBaseNode(245); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -20060,7 +20216,7 @@ var ts; : node; } function createForInStatement(initializer, expression, statement) { - var node = createBaseNode(243); + var node = createBaseNode(246); node.initializer = initializer; node.expression = expression; node.statement = asEmbeddedStatement(statement); @@ -20078,7 +20234,7 @@ var ts; : node; } function createForOfStatement(awaitModifier, initializer, expression, statement) { - var node = createBaseNode(244); + var node = createBaseNode(247); node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); @@ -20102,7 +20258,7 @@ var ts; : node; } function createContinueStatement(label) { - var node = createBaseNode(245); + var node = createBaseNode(248); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | @@ -20115,7 +20271,7 @@ var ts; : node; } function createBreakStatement(label) { - var node = createBaseNode(246); + var node = createBaseNode(249); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | @@ -20128,7 +20284,7 @@ var ts; : node; } function createReturnStatement(expression) { - var node = createBaseNode(247); + var node = createBaseNode(250); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression) | @@ -20142,7 +20298,7 @@ var ts; : node; } function createWithStatement(expression, statement) { - var node = createBaseNode(248); + var node = createBaseNode(251); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -20157,7 +20313,7 @@ var ts; : node; } function createSwitchStatement(expression, caseBlock) { - var node = createBaseNode(249); + var node = createBaseNode(252); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.caseBlock = caseBlock; node.transformFlags |= @@ -20172,7 +20328,7 @@ var ts; : node; } function createLabeledStatement(label, statement) { - var node = createBaseNode(250); + var node = createBaseNode(253); node.label = asName(label); node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -20187,7 +20343,7 @@ var ts; : node; } function createThrowStatement(expression) { - var node = createBaseNode(251); + var node = createBaseNode(254); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -20198,7 +20354,7 @@ var ts; : node; } function createTryStatement(tryBlock, catchClause, finallyBlock) { - var node = createBaseNode(252); + var node = createBaseNode(255); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -20216,10 +20372,10 @@ var ts; : node; } function createDebuggerStatement() { - return createBaseNode(253); + return createBaseNode(256); } function createVariableDeclaration(name, exclamationToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(254, undefined, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); + var node = createBaseVariableLikeDeclaration(257, undefined, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.exclamationToken = exclamationToken; node.transformFlags |= propagateChildFlags(node.exclamationToken); if (exclamationToken) { @@ -20237,7 +20393,7 @@ var ts; } function createVariableDeclarationList(declarations, flags) { if (flags === void 0) { flags = 0; } - var node = createBaseNode(255); + var node = createBaseNode(258); node.flags |= flags & 3; node.declarations = createNodeArray(declarations); node.transformFlags |= @@ -20256,7 +20412,7 @@ var ts; : node; } function createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(256, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(259, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; if (!node.body || ts.modifiersToFlags(node.modifiers) & 2) { node.transformFlags = 1; @@ -20265,7 +20421,7 @@ var ts; node.transformFlags |= propagateChildFlags(node.asteriskToken) | 4194304; - if (ts.modifiersToFlags(node.modifiers) & 256) { + if (ts.modifiersToFlags(node.modifiers) & 512) { if (node.asteriskToken) { node.transformFlags |= 128; } @@ -20298,7 +20454,7 @@ var ts; return finishUpdateBaseSignatureDeclaration(updated, original); } function createClassDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseClassLikeDeclaration(257, modifiers, name, typeParameters, heritageClauses, members); + var node = createBaseClassLikeDeclaration(260, modifiers, name, typeParameters, heritageClauses, members); if (ts.modifiersToFlags(node.modifiers) & 2) { node.transformFlags = 1; } @@ -20320,7 +20476,7 @@ var ts; : node; } function createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseInterfaceOrClassLikeDeclaration(258, modifiers, name, typeParameters, heritageClauses); + var node = createBaseInterfaceOrClassLikeDeclaration(261, modifiers, name, typeParameters, heritageClauses); node.members = createNodeArray(members); node.transformFlags = 1; node.illegalDecorators = undefined; @@ -20342,7 +20498,7 @@ var ts; return update(updated, original); } function createTypeAliasDeclaration(modifiers, name, typeParameters, type) { - var node = createBaseGenericNamedDeclaration(259, modifiers, name, typeParameters); + var node = createBaseGenericNamedDeclaration(262, modifiers, name, typeParameters); node.type = type; node.transformFlags = 1; node.illegalDecorators = undefined; @@ -20363,7 +20519,7 @@ var ts; return update(updated, original); } function createEnumDeclaration(modifiers, name, members) { - var node = createBaseNamedDeclaration(260, modifiers, name); + var node = createBaseNamedDeclaration(263, modifiers, name); node.members = createNodeArray(members); node.transformFlags |= propagateChildrenFlags(node.members) | @@ -20387,7 +20543,7 @@ var ts; } function createModuleDeclaration(modifiers, name, body, flags) { if (flags === void 0) { flags = 0; } - var node = createBaseDeclaration(261); + var node = createBaseDeclaration(264); node.modifiers = asNodeArray(modifiers); node.flags |= flags & (16 | 4 | 1024); node.name = name; @@ -20420,7 +20576,7 @@ var ts; return update(updated, original); } function createModuleBlock(statements) { - var node = createBaseNode(262); + var node = createBaseNode(265); node.statements = createNodeArray(statements); node.transformFlags |= propagateChildrenFlags(node.statements); return node; @@ -20431,7 +20587,7 @@ var ts; : node; } function createCaseBlock(clauses) { - var node = createBaseNode(263); + var node = createBaseNode(266); node.clauses = createNodeArray(clauses); node.transformFlags |= propagateChildrenFlags(node.clauses); return node; @@ -20442,7 +20598,7 @@ var ts; : node; } function createNamespaceExportDeclaration(name) { - var node = createBaseNamedDeclaration(264, undefined, name); + var node = createBaseNamedDeclaration(267, undefined, name); node.transformFlags = 1; node.illegalDecorators = undefined; node.modifiers = undefined; @@ -20461,7 +20617,7 @@ var ts; return update(updated, original); } function createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference) { - var node = createBaseNamedDeclaration(265, modifiers, name); + var node = createBaseNamedDeclaration(268, modifiers, name); node.isTypeOnly = isTypeOnly; node.moduleReference = moduleReference; node.transformFlags |= propagateChildFlags(node.moduleReference); @@ -20486,7 +20642,7 @@ var ts; return update(updated, original); } function createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause) { - var node = createBaseDeclaration(266); + var node = createBaseDeclaration(269); node.modifiers = asNodeArray(modifiers); node.importClause = importClause; node.moduleSpecifier = moduleSpecifier; @@ -20513,7 +20669,7 @@ var ts; return update(updated, original); } function createImportClause(isTypeOnly, name, namedBindings) { - var node = createBaseNode(267); + var node = createBaseNode(270); node.isTypeOnly = isTypeOnly; node.name = name; node.namedBindings = namedBindings; @@ -20534,7 +20690,7 @@ var ts; : node; } function createAssertClause(elements, multiLine) { - var node = createBaseNode(293); + var node = createBaseNode(296); node.elements = createNodeArray(elements); node.multiLine = multiLine; node.transformFlags |= 4; @@ -20547,7 +20703,7 @@ var ts; : node; } function createAssertEntry(name, value) { - var node = createBaseNode(294); + var node = createBaseNode(297); node.name = name; node.value = value; node.transformFlags |= 4; @@ -20560,7 +20716,7 @@ var ts; : node; } function createImportTypeAssertionContainer(clause, multiLine) { - var node = createBaseNode(295); + var node = createBaseNode(298); node.assertClause = clause; node.multiLine = multiLine; return node; @@ -20572,7 +20728,7 @@ var ts; : node; } function createNamespaceImport(name) { - var node = createBaseNode(268); + var node = createBaseNode(271); node.name = name; node.transformFlags |= propagateChildFlags(node.name); node.transformFlags &= ~67108864; @@ -20584,7 +20740,7 @@ var ts; : node; } function createNamespaceExport(name) { - var node = createBaseNode(274); + var node = createBaseNode(277); node.name = name; node.transformFlags |= propagateChildFlags(node.name) | @@ -20598,7 +20754,7 @@ var ts; : node; } function createNamedImports(elements) { - var node = createBaseNode(269); + var node = createBaseNode(272); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864; @@ -20610,7 +20766,7 @@ var ts; : node; } function createImportSpecifier(isTypeOnly, propertyName, name) { - var node = createBaseNode(270); + var node = createBaseNode(273); node.isTypeOnly = isTypeOnly; node.propertyName = propertyName; node.name = name; @@ -20628,7 +20784,7 @@ var ts; : node; } function createExportAssignment(modifiers, isExportEquals, expression) { - var node = createBaseDeclaration(271); + var node = createBaseDeclaration(274); node.modifiers = asNodeArray(modifiers); node.isExportEquals = isExportEquals; node.expression = isExportEquals @@ -20652,7 +20808,7 @@ var ts; return update(updated, original); } function createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause) { - var node = createBaseDeclaration(272); + var node = createBaseDeclaration(275); node.modifiers = asNodeArray(modifiers); node.isTypeOnly = isTypeOnly; node.exportClause = exportClause; @@ -20682,7 +20838,7 @@ var ts; return update(updated, original); } function createNamedExports(elements) { - var node = createBaseNode(273); + var node = createBaseNode(276); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864; @@ -20694,7 +20850,7 @@ var ts; : node; } function createExportSpecifier(isTypeOnly, propertyName, name) { - var node = createBaseNode(275); + var node = createBaseNode(278); node.isTypeOnly = isTypeOnly; node.propertyName = asName(propertyName); node.name = asName(name); @@ -20712,11 +20868,11 @@ var ts; : node; } function createMissingDeclaration() { - var node = createBaseDeclaration(276); + var node = createBaseDeclaration(279); return node; } function createExternalModuleReference(expression) { - var node = createBaseNode(277); + var node = createBaseNode(280); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); node.transformFlags &= ~67108864; @@ -20752,7 +20908,7 @@ var ts; : node; } function createJSDocFunctionType(parameters, type) { - var node = createBaseSignatureDeclaration(317, undefined, undefined, undefined, parameters, type); + var node = createBaseSignatureDeclaration(320, undefined, undefined, undefined, parameters, type); return node; } function updateJSDocFunctionType(node, parameters, type) { @@ -20763,7 +20919,7 @@ var ts; } function createJSDocTypeLiteral(propertyTags, isArrayType) { if (isArrayType === void 0) { isArrayType = false; } - var node = createBaseNode(322); + var node = createBaseNode(325); node.jsDocPropertyTags = asNodeArray(propertyTags); node.isArrayType = isArrayType; return node; @@ -20775,7 +20931,7 @@ var ts; : node; } function createJSDocTypeExpression(type) { - var node = createBaseNode(309); + var node = createBaseNode(312); node.type = type; return node; } @@ -20785,7 +20941,7 @@ var ts; : node; } function createJSDocSignature(typeParameters, parameters, type) { - var node = createBaseNode(323); + var node = createBaseNode(326); node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; @@ -20811,7 +20967,7 @@ var ts; return node; } function createJSDocTemplateTag(tagName, constraint, typeParameters, comment) { - var node = createBaseJSDocTag(344, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); + var node = createBaseJSDocTag(347, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); node.constraint = constraint; node.typeParameters = createNodeArray(typeParameters); return node; @@ -20826,7 +20982,7 @@ var ts; : node; } function createJSDocTypedefTag(tagName, typeExpression, fullName, comment) { - var node = createBaseJSDocTag(345, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); + var node = createBaseJSDocTag(348, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = ts.getJSDocTypeAliasName(fullName); @@ -20842,7 +20998,7 @@ var ts; : node; } function createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - var node = createBaseJSDocTag(340, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); + var node = createBaseJSDocTag(343, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -20861,7 +21017,7 @@ var ts; : node; } function createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - var node = createBaseJSDocTag(347, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); + var node = createBaseJSDocTag(350, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -20880,7 +21036,7 @@ var ts; : node; } function createJSDocCallbackTag(tagName, typeExpression, fullName, comment) { - var node = createBaseJSDocTag(338, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); + var node = createBaseJSDocTag(341, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = ts.getJSDocTypeAliasName(fullName); @@ -20896,7 +21052,7 @@ var ts; : node; } function createJSDocAugmentsTag(tagName, className, comment) { - var node = createBaseJSDocTag(328, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); + var node = createBaseJSDocTag(331, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); node.class = className; return node; } @@ -20909,12 +21065,12 @@ var ts; : node; } function createJSDocImplementsTag(tagName, className, comment) { - var node = createBaseJSDocTag(329, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); + var node = createBaseJSDocTag(332, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); node.class = className; return node; } function createJSDocSeeTag(tagName, name, comment) { - var node = createBaseJSDocTag(346, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); + var node = createBaseJSDocTag(349, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); node.name = name; return node; } @@ -20926,7 +21082,7 @@ var ts; : node; } function createJSDocNameReference(name) { - var node = createBaseNode(310); + var node = createBaseNode(313); node.name = name; return node; } @@ -20936,7 +21092,7 @@ var ts; : node; } function createJSDocMemberName(left, right) { - var node = createBaseNode(311); + var node = createBaseNode(314); node.left = left; node.right = right; node.transformFlags |= @@ -20951,7 +21107,7 @@ var ts; : node; } function createJSDocLink(name, text) { - var node = createBaseNode(324); + var node = createBaseNode(327); node.name = name; node.text = text; return node; @@ -20962,7 +21118,7 @@ var ts; : node; } function createJSDocLinkCode(name, text) { - var node = createBaseNode(325); + var node = createBaseNode(328); node.name = name; node.text = text; return node; @@ -20973,7 +21129,7 @@ var ts; : node; } function createJSDocLinkPlain(name, text) { - var node = createBaseNode(326); + var node = createBaseNode(329); node.name = name; node.text = text; return node; @@ -21016,7 +21172,7 @@ var ts; : node; } function createJSDocUnknownTag(tagName, comment) { - var node = createBaseJSDocTag(327, tagName, comment); + var node = createBaseJSDocTag(330, tagName, comment); return node; } function updateJSDocUnknownTag(node, tagName, comment) { @@ -21026,7 +21182,7 @@ var ts; : node; } function createJSDocText(text) { - var node = createBaseNode(321); + var node = createBaseNode(324); node.text = text; return node; } @@ -21036,7 +21192,7 @@ var ts; : node; } function createJSDocComment(comment, tags) { - var node = createBaseNode(320); + var node = createBaseNode(323); node.comment = comment; node.tags = asNodeArray(tags); return node; @@ -21048,7 +21204,7 @@ var ts; : node; } function createJsxElement(openingElement, children, closingElement) { - var node = createBaseNode(278); + var node = createBaseNode(281); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -21067,7 +21223,7 @@ var ts; : node; } function createJsxSelfClosingElement(tagName, typeArguments, attributes) { - var node = createBaseNode(279); + var node = createBaseNode(282); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -21089,7 +21245,7 @@ var ts; : node; } function createJsxOpeningElement(tagName, typeArguments, attributes) { - var node = createBaseNode(280); + var node = createBaseNode(283); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -21111,7 +21267,7 @@ var ts; : node; } function createJsxClosingElement(tagName) { - var node = createBaseNode(281); + var node = createBaseNode(284); node.tagName = tagName; node.transformFlags |= propagateChildFlags(node.tagName) | @@ -21124,7 +21280,7 @@ var ts; : node; } function createJsxFragment(openingFragment, children, closingFragment) { - var node = createBaseNode(282); + var node = createBaseNode(285); node.openingFragment = openingFragment; node.children = createNodeArray(children); node.closingFragment = closingFragment; @@ -21156,17 +21312,17 @@ var ts; : node; } function createJsxOpeningFragment() { - var node = createBaseNode(283); + var node = createBaseNode(286); node.transformFlags |= 2; return node; } function createJsxJsxClosingFragment() { - var node = createBaseNode(284); + var node = createBaseNode(287); node.transformFlags |= 2; return node; } function createJsxAttribute(name, initializer) { - var node = createBaseNode(285); + var node = createBaseNode(288); node.name = name; node.initializer = initializer; node.transformFlags |= @@ -21182,7 +21338,7 @@ var ts; : node; } function createJsxAttributes(properties) { - var node = createBaseNode(286); + var node = createBaseNode(289); node.properties = createNodeArray(properties); node.transformFlags |= propagateChildrenFlags(node.properties) | @@ -21195,7 +21351,7 @@ var ts; : node; } function createJsxSpreadAttribute(expression) { - var node = createBaseNode(287); + var node = createBaseNode(290); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression) | @@ -21208,7 +21364,7 @@ var ts; : node; } function createJsxExpression(dotDotDotToken, expression) { - var node = createBaseNode(288); + var node = createBaseNode(291); node.dotDotDotToken = dotDotDotToken; node.expression = expression; node.transformFlags |= @@ -21223,7 +21379,7 @@ var ts; : node; } function createCaseClause(expression, statements) { - var node = createBaseNode(289); + var node = createBaseNode(292); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.statements = createNodeArray(statements); node.transformFlags |= @@ -21238,7 +21394,7 @@ var ts; : node; } function createDefaultClause(statements) { - var node = createBaseNode(290); + var node = createBaseNode(293); node.statements = createNodeArray(statements); node.transformFlags = propagateChildrenFlags(node.statements); return node; @@ -21249,7 +21405,7 @@ var ts; : node; } function createHeritageClause(token, types) { - var node = createBaseNode(291); + var node = createBaseNode(294); node.token = token; node.types = createNodeArray(types); node.transformFlags |= propagateChildrenFlags(node.types); @@ -21271,7 +21427,7 @@ var ts; : node; } function createCatchClause(variableDeclaration, block) { - var node = createBaseNode(292); + var node = createBaseNode(295); if (typeof variableDeclaration === "string" || variableDeclaration && !ts.isVariableDeclaration(variableDeclaration)) { variableDeclaration = createVariableDeclaration(variableDeclaration, undefined, undefined, undefined); } @@ -21291,7 +21447,7 @@ var ts; : node; } function createPropertyAssignment(name, initializer) { - var node = createBaseNamedDeclaration(296, undefined, name); + var node = createBaseNamedDeclaration(299, undefined, name); node.initializer = parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= propagateChildFlags(node.name) | @@ -21318,7 +21474,7 @@ var ts; return update(updated, original); } function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - var node = createBaseNamedDeclaration(297, undefined, name); + var node = createBaseNamedDeclaration(300, undefined, name); node.objectAssignmentInitializer = objectAssignmentInitializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(objectAssignmentInitializer); node.transformFlags |= propagateChildFlags(node.objectAssignmentInitializer) | @@ -21347,7 +21503,7 @@ var ts; return update(updated, original); } function createSpreadAssignment(expression) { - var node = createBaseNode(298); + var node = createBaseNode(301); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -21361,7 +21517,7 @@ var ts; : node; } function createEnumMember(name, initializer) { - var node = createBaseNode(299); + var node = createBaseNode(302); node.name = asName(name); node.initializer = initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= @@ -21377,7 +21533,7 @@ var ts; : node; } function createSourceFile(statements, endOfFileToken, flags) { - var node = baseFactory.createBaseSourceFileNode(305); + var node = baseFactory.createBaseSourceFileNode(308); node.statements = createNodeArray(statements); node.endOfFileToken = endOfFileToken; node.flags |= flags; @@ -21394,7 +21550,7 @@ var ts; return node; } function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) { - var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(305)); + var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(308)); for (var p in source) { if (p === "emitNode" || ts.hasProperty(node, p) || !ts.hasProperty(source, p)) continue; @@ -21431,7 +21587,7 @@ var ts; } function createBundle(sourceFiles, prepends) { if (prepends === void 0) { prepends = ts.emptyArray; } - var node = createBaseNode(306); + var node = createBaseNode(309); node.prepends = prepends; node.sourceFiles = sourceFiles; return node; @@ -21444,7 +21600,7 @@ var ts; : node; } function createUnparsedSource(prologues, syntheticReferences, texts) { - var node = createBaseNode(307); + var node = createBaseNode(310); node.prologues = prologues; node.syntheticReferences = syntheticReferences; node.texts = texts; @@ -21461,49 +21617,49 @@ var ts; return node; } function createUnparsedPrologue(data) { - return createBaseUnparsedNode(300, data); + return createBaseUnparsedNode(303, data); } function createUnparsedPrepend(data, texts) { - var node = createBaseUnparsedNode(301, data); + var node = createBaseUnparsedNode(304, data); node.texts = texts; return node; } function createUnparsedTextLike(data, internal) { - return createBaseUnparsedNode(internal ? 303 : 302, data); + return createBaseUnparsedNode(internal ? 306 : 305, data); } function createUnparsedSyntheticReference(section) { - var node = createBaseNode(304); + var node = createBaseNode(307); node.data = section.data; node.section = section; return node; } function createInputFiles() { - var node = createBaseNode(308); + var node = createBaseNode(311); node.javascriptText = ""; node.declarationText = ""; return node; } function createSyntheticExpression(type, isSpread, tupleNameSource) { if (isSpread === void 0) { isSpread = false; } - var node = createBaseNode(232); + var node = createBaseNode(234); node.type = type; node.isSpread = isSpread; node.tupleNameSource = tupleNameSource; return node; } function createSyntaxList(children) { - var node = createBaseNode(348); + var node = createBaseNode(351); node._children = children; return node; } function createNotEmittedStatement(original) { - var node = createBaseNode(349); + var node = createBaseNode(352); node.original = original; ts.setTextRange(node, original); return node; } function createPartiallyEmittedExpression(expression, original) { - var node = createBaseNode(350); + var node = createBaseNode(353); node.expression = expression; node.original = original; node.transformFlags |= @@ -21529,7 +21685,7 @@ var ts; return node; } function createCommaListExpression(elements) { - var node = createBaseNode(351); + var node = createBaseNode(354); node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)); node.transformFlags |= propagateChildrenFlags(node.elements); return node; @@ -21540,19 +21696,19 @@ var ts; : node; } function createEndOfDeclarationMarker(original) { - var node = createBaseNode(353); + var node = createBaseNode(356); node.emitNode = {}; node.original = original; return node; } function createMergeDeclarationMarker(original) { - var node = createBaseNode(352); + var node = createBaseNode(355); node.emitNode = {}; node.original = original; return node; } function createSyntheticReferenceExpression(expression, thisArg) { - var node = createBaseNode(354); + var node = createBaseNode(357); node.expression = expression; node.thisArg = thisArg; node.transformFlags |= @@ -21570,7 +21726,7 @@ var ts; if (node === undefined) { return node; } - var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(305) : + var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(308) : ts.isIdentifier(node) ? baseFactory.createBaseIdentifierNode(79) : ts.isPrivateIdentifier(node) ? baseFactory.createBasePrivateIdentifierNode(80) : !ts.isNodeKind(node.kind) ? baseFactory.createBaseTokenNode(node.kind) : @@ -21579,7 +21735,7 @@ var ts; clone.transformFlags = node.transformFlags; setOriginalNode(clone, node); for (var key in node) { - if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { + if (ts.hasProperty(clone, key) || !ts.hasProperty(node, key)) { continue; } clone[key] = node[key]; @@ -21661,11 +21817,12 @@ var ts; } function updateOuterExpression(outerExpression, expression) { switch (outerExpression.kind) { - case 212: return updateParenthesizedExpression(outerExpression, expression); - case 211: return updateTypeAssertion(outerExpression, outerExpression.type, expression); - case 229: return updateAsExpression(outerExpression, expression, outerExpression.type); - case 230: return updateNonNullExpression(outerExpression, expression); - case 350: return updatePartiallyEmittedExpression(outerExpression, expression); + case 214: return updateParenthesizedExpression(outerExpression, expression); + case 213: return updateTypeAssertion(outerExpression, outerExpression.type, expression); + case 231: return updateAsExpression(outerExpression, expression, outerExpression.type); + case 235: return updateSatisfiesExpression(outerExpression, expression, outerExpression.type); + case 232: return updateNonNullExpression(outerExpression, expression); + case 353: return updatePartiallyEmittedExpression(outerExpression, expression); } } function isIgnorableParen(node) { @@ -21705,13 +21862,13 @@ var ts; case 9: case 10: return false; - case 204: + case 206: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 205: + case 207: return target.properties.length > 0; default: return true; @@ -22005,24 +22162,24 @@ var ts; } function getDefaultTagNameForKind(kind) { switch (kind) { - case 343: return "type"; - case 341: return "returns"; - case 342: return "this"; - case 339: return "enum"; - case 330: return "author"; - case 332: return "class"; - case 333: return "public"; - case 334: return "private"; - case 335: return "protected"; - case 336: return "readonly"; - case 337: return "override"; - case 344: return "template"; - case 345: return "typedef"; - case 340: return "param"; - case 347: return "prop"; - case 338: return "callback"; - case 328: return "augments"; - case 329: return "implements"; + case 346: return "type"; + case 344: return "returns"; + case 345: return "this"; + case 342: return "enum"; + case 333: return "author"; + case 335: return "class"; + case 336: return "public"; + case 337: return "private"; + case 338: return "protected"; + case 339: return "readonly"; + case 340: return "override"; + case 347: return "template"; + case 348: return "typedef"; + case 343: return "param"; + case 350: return "prop"; + case 341: return "callback"; + case 331: return "augments"; + case 332: return "implements"; default: return ts.Debug.fail("Unsupported kind: ".concat(ts.Debug.formatSyntaxKind(kind))); } @@ -22095,69 +22252,70 @@ var ts; children.transformFlags = subtreeFlags; } function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 177 && kind <= 200) { + if (kind >= 179 && kind <= 202) { return -2; } switch (kind) { - case 208: - case 209: - case 204: + case 210: + case 211: + case 206: return -2147450880; - case 261: + case 264: return -1941676032; - case 164: - return -2147483648; - case 214: - return -2072174592; - case 213: - case 256: - return -1937940480; - case 255: - return -2146893824; - case 257: - case 226: - return -2147344384; - case 171: - return -1937948672; - case 167: - return -2013249536; - case 169: - case 172: - case 173: - return -2005057536; - case 130: - case 147: - case 158: - case 143: - case 150: - case 148: - case 133: - case 151: - case 114: - case 163: case 166: - case 168: + return -2147483648; + case 216: + return -2072174592; + case 215: + case 259: + return -1937940480; + case 258: + return -2146893824; + case 260: + case 228: + return -2147344384; + case 173: + return -1937948672; + case 169: + return -2013249536; + case 171: case 174: case 175: + return -2005057536; + case 131: + case 148: + case 160: + case 144: + case 152: + case 149: + case 134: + case 153: + case 114: + case 165: + case 168: + case 170: case 176: - case 258: - case 259: + case 177: + case 178: + case 261: + case 262: return -2; - case 205: + case 207: return -2147278848; - case 292: + case 295: return -2147418112; - case 201: - case 202: + case 203: + case 204: return -2147450880; - case 211: - case 229: - case 350: - case 212: + case 213: + case 235: + case 231: + case 353: + case 214: case 106: return -2147483648; - case 206: - case 207: + case 208: + case 209: return -2147483648; default: return -2147483648; @@ -22355,9 +22513,10 @@ var ts; }; var buildInfo_1; var getAndCacheBuildInfo_1 = function (getText) { + var _a; if (buildInfo_1 === undefined) { var result = getText(); - buildInfo_1 = result !== undefined ? ts.getBuildInfo(result) : false; + buildInfo_1 = result !== undefined ? (_a = ts.getBuildInfo(node.buildInfoPath, result)) !== null && _a !== void 0 ? _a : false : false; } return buildInfo_1 || undefined; }; @@ -22406,7 +22565,7 @@ var ts; } ts.setOriginalNode = setOriginalNode; function mergeEmitNode(sourceEmitNode, destEmitNode) { - var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine; + var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine, snippetElement = sourceEmitNode.snippetElement; if (!destEmitNode) destEmitNode = {}; if (leadingComments) @@ -22431,6 +22590,8 @@ var ts; } if (startsOnNewLine !== undefined) destEmitNode.startsOnNewLine = startsOnNewLine; + if (snippetElement !== undefined) + destEmitNode.snippetElement = snippetElement; return destEmitNode; } function mergeTokenSourceMapRanges(sourceRanges, destRanges) { @@ -22448,7 +22609,7 @@ var ts; var _a; if (!node.emitNode) { if (ts.isParseTreeNode(node)) { - if (node.kind === 305) { + if (node.kind === 308) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = (_a = ts.getSourceFileOfNode(ts.getParseTreeNode(ts.getSourceFileOfNode(node)))) !== null && _a !== void 0 ? _a : ts.Debug.fail("Could not determine parsed source file."); @@ -23194,19 +23355,19 @@ var ts; } ts.isExportModifier = isExportModifier; function isAsyncModifier(node) { - return node.kind === 131; + return node.kind === 132; } ts.isAsyncModifier = isAsyncModifier; function isAssertsKeyword(node) { - return node.kind === 128; + return node.kind === 129; } ts.isAssertsKeyword = isAssertsKeyword; function isAwaitKeyword(node) { - return node.kind === 132; + return node.kind === 133; } ts.isAwaitKeyword = isAwaitKeyword; function isReadonlyKeyword(node) { - return node.kind === 145; + return node.kind === 146; } ts.isReadonlyKeyword = isReadonlyKeyword; function isStaticModifier(node) { @@ -23218,9 +23379,13 @@ var ts; } ts.isAbstractModifier = isAbstractModifier; function isOverrideModifier(node) { - return node.kind === 159; + return node.kind === 161; } ts.isOverrideModifier = isOverrideModifier; + function isAccessorModifier(node) { + return node.kind === 127; + } + ts.isAccessorModifier = isAccessorModifier; function isSuperKeyword(node) { return node.kind === 106; } @@ -23230,755 +23395,759 @@ var ts; } ts.isImportKeyword = isImportKeyword; function isQualifiedName(node) { - return node.kind === 161; + return node.kind === 163; } ts.isQualifiedName = isQualifiedName; function isComputedPropertyName(node) { - return node.kind === 162; + return node.kind === 164; } ts.isComputedPropertyName = isComputedPropertyName; function isTypeParameterDeclaration(node) { - return node.kind === 163; + return node.kind === 165; } ts.isTypeParameterDeclaration = isTypeParameterDeclaration; function isParameter(node) { - return node.kind === 164; + return node.kind === 166; } ts.isParameter = isParameter; function isDecorator(node) { - return node.kind === 165; + return node.kind === 167; } ts.isDecorator = isDecorator; function isPropertySignature(node) { - return node.kind === 166; + return node.kind === 168; } ts.isPropertySignature = isPropertySignature; function isPropertyDeclaration(node) { - return node.kind === 167; + return node.kind === 169; } ts.isPropertyDeclaration = isPropertyDeclaration; function isMethodSignature(node) { - return node.kind === 168; + return node.kind === 170; } ts.isMethodSignature = isMethodSignature; function isMethodDeclaration(node) { - return node.kind === 169; + return node.kind === 171; } ts.isMethodDeclaration = isMethodDeclaration; function isClassStaticBlockDeclaration(node) { - return node.kind === 170; + return node.kind === 172; } ts.isClassStaticBlockDeclaration = isClassStaticBlockDeclaration; function isConstructorDeclaration(node) { - return node.kind === 171; + return node.kind === 173; } ts.isConstructorDeclaration = isConstructorDeclaration; function isGetAccessorDeclaration(node) { - return node.kind === 172; + return node.kind === 174; } ts.isGetAccessorDeclaration = isGetAccessorDeclaration; function isSetAccessorDeclaration(node) { - return node.kind === 173; + return node.kind === 175; } ts.isSetAccessorDeclaration = isSetAccessorDeclaration; function isCallSignatureDeclaration(node) { - return node.kind === 174; + return node.kind === 176; } ts.isCallSignatureDeclaration = isCallSignatureDeclaration; function isConstructSignatureDeclaration(node) { - return node.kind === 175; + return node.kind === 177; } ts.isConstructSignatureDeclaration = isConstructSignatureDeclaration; function isIndexSignatureDeclaration(node) { - return node.kind === 176; + return node.kind === 178; } ts.isIndexSignatureDeclaration = isIndexSignatureDeclaration; function isTypePredicateNode(node) { - return node.kind === 177; + return node.kind === 179; } ts.isTypePredicateNode = isTypePredicateNode; function isTypeReferenceNode(node) { - return node.kind === 178; + return node.kind === 180; } ts.isTypeReferenceNode = isTypeReferenceNode; function isFunctionTypeNode(node) { - return node.kind === 179; + return node.kind === 181; } ts.isFunctionTypeNode = isFunctionTypeNode; function isConstructorTypeNode(node) { - return node.kind === 180; + return node.kind === 182; } ts.isConstructorTypeNode = isConstructorTypeNode; function isTypeQueryNode(node) { - return node.kind === 181; + return node.kind === 183; } ts.isTypeQueryNode = isTypeQueryNode; function isTypeLiteralNode(node) { - return node.kind === 182; + return node.kind === 184; } ts.isTypeLiteralNode = isTypeLiteralNode; function isArrayTypeNode(node) { - return node.kind === 183; + return node.kind === 185; } ts.isArrayTypeNode = isArrayTypeNode; function isTupleTypeNode(node) { - return node.kind === 184; + return node.kind === 186; } ts.isTupleTypeNode = isTupleTypeNode; function isNamedTupleMember(node) { - return node.kind === 197; + return node.kind === 199; } ts.isNamedTupleMember = isNamedTupleMember; function isOptionalTypeNode(node) { - return node.kind === 185; + return node.kind === 187; } ts.isOptionalTypeNode = isOptionalTypeNode; function isRestTypeNode(node) { - return node.kind === 186; + return node.kind === 188; } ts.isRestTypeNode = isRestTypeNode; function isUnionTypeNode(node) { - return node.kind === 187; + return node.kind === 189; } ts.isUnionTypeNode = isUnionTypeNode; function isIntersectionTypeNode(node) { - return node.kind === 188; + return node.kind === 190; } ts.isIntersectionTypeNode = isIntersectionTypeNode; function isConditionalTypeNode(node) { - return node.kind === 189; + return node.kind === 191; } ts.isConditionalTypeNode = isConditionalTypeNode; function isInferTypeNode(node) { - return node.kind === 190; + return node.kind === 192; } ts.isInferTypeNode = isInferTypeNode; function isParenthesizedTypeNode(node) { - return node.kind === 191; + return node.kind === 193; } ts.isParenthesizedTypeNode = isParenthesizedTypeNode; function isThisTypeNode(node) { - return node.kind === 192; + return node.kind === 194; } ts.isThisTypeNode = isThisTypeNode; function isTypeOperatorNode(node) { - return node.kind === 193; + return node.kind === 195; } ts.isTypeOperatorNode = isTypeOperatorNode; function isIndexedAccessTypeNode(node) { - return node.kind === 194; + return node.kind === 196; } ts.isIndexedAccessTypeNode = isIndexedAccessTypeNode; function isMappedTypeNode(node) { - return node.kind === 195; + return node.kind === 197; } ts.isMappedTypeNode = isMappedTypeNode; function isLiteralTypeNode(node) { - return node.kind === 196; + return node.kind === 198; } ts.isLiteralTypeNode = isLiteralTypeNode; function isImportTypeNode(node) { - return node.kind === 200; + return node.kind === 202; } ts.isImportTypeNode = isImportTypeNode; function isTemplateLiteralTypeSpan(node) { - return node.kind === 199; + return node.kind === 201; } ts.isTemplateLiteralTypeSpan = isTemplateLiteralTypeSpan; function isTemplateLiteralTypeNode(node) { - return node.kind === 198; + return node.kind === 200; } ts.isTemplateLiteralTypeNode = isTemplateLiteralTypeNode; function isObjectBindingPattern(node) { - return node.kind === 201; + return node.kind === 203; } ts.isObjectBindingPattern = isObjectBindingPattern; function isArrayBindingPattern(node) { - return node.kind === 202; + return node.kind === 204; } ts.isArrayBindingPattern = isArrayBindingPattern; function isBindingElement(node) { - return node.kind === 203; + return node.kind === 205; } ts.isBindingElement = isBindingElement; function isArrayLiteralExpression(node) { - return node.kind === 204; + return node.kind === 206; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 205; + return node.kind === 207; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 206; + return node.kind === 208; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 207; + return node.kind === 209; } ts.isElementAccessExpression = isElementAccessExpression; function isCallExpression(node) { - return node.kind === 208; + return node.kind === 210; } ts.isCallExpression = isCallExpression; function isNewExpression(node) { - return node.kind === 209; + return node.kind === 211; } ts.isNewExpression = isNewExpression; function isTaggedTemplateExpression(node) { - return node.kind === 210; + return node.kind === 212; } ts.isTaggedTemplateExpression = isTaggedTemplateExpression; function isTypeAssertionExpression(node) { - return node.kind === 211; + return node.kind === 213; } ts.isTypeAssertionExpression = isTypeAssertionExpression; function isParenthesizedExpression(node) { - return node.kind === 212; + return node.kind === 214; } ts.isParenthesizedExpression = isParenthesizedExpression; function isFunctionExpression(node) { - return node.kind === 213; + return node.kind === 215; } ts.isFunctionExpression = isFunctionExpression; function isArrowFunction(node) { - return node.kind === 214; + return node.kind === 216; } ts.isArrowFunction = isArrowFunction; function isDeleteExpression(node) { - return node.kind === 215; + return node.kind === 217; } ts.isDeleteExpression = isDeleteExpression; function isTypeOfExpression(node) { - return node.kind === 216; + return node.kind === 218; } ts.isTypeOfExpression = isTypeOfExpression; function isVoidExpression(node) { - return node.kind === 217; + return node.kind === 219; } ts.isVoidExpression = isVoidExpression; function isAwaitExpression(node) { - return node.kind === 218; + return node.kind === 220; } ts.isAwaitExpression = isAwaitExpression; function isPrefixUnaryExpression(node) { - return node.kind === 219; + return node.kind === 221; } ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function isPostfixUnaryExpression(node) { - return node.kind === 220; + return node.kind === 222; } ts.isPostfixUnaryExpression = isPostfixUnaryExpression; function isBinaryExpression(node) { - return node.kind === 221; + return node.kind === 223; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 222; + return node.kind === 224; } ts.isConditionalExpression = isConditionalExpression; function isTemplateExpression(node) { - return node.kind === 223; + return node.kind === 225; } ts.isTemplateExpression = isTemplateExpression; function isYieldExpression(node) { - return node.kind === 224; + return node.kind === 226; } ts.isYieldExpression = isYieldExpression; function isSpreadElement(node) { - return node.kind === 225; + return node.kind === 227; } ts.isSpreadElement = isSpreadElement; function isClassExpression(node) { - return node.kind === 226; + return node.kind === 228; } ts.isClassExpression = isClassExpression; function isOmittedExpression(node) { - return node.kind === 227; + return node.kind === 229; } ts.isOmittedExpression = isOmittedExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 228; + return node.kind === 230; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isAsExpression(node) { - return node.kind === 229; + return node.kind === 231; } ts.isAsExpression = isAsExpression; + function isSatisfiesExpression(node) { + return node.kind === 235; + } + ts.isSatisfiesExpression = isSatisfiesExpression; function isNonNullExpression(node) { - return node.kind === 230; + return node.kind === 232; } ts.isNonNullExpression = isNonNullExpression; function isMetaProperty(node) { - return node.kind === 231; + return node.kind === 233; } ts.isMetaProperty = isMetaProperty; function isSyntheticExpression(node) { - return node.kind === 232; + return node.kind === 234; } ts.isSyntheticExpression = isSyntheticExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 350; + return node.kind === 353; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isCommaListExpression(node) { - return node.kind === 351; + return node.kind === 354; } ts.isCommaListExpression = isCommaListExpression; function isTemplateSpan(node) { - return node.kind === 233; + return node.kind === 236; } ts.isTemplateSpan = isTemplateSpan; function isSemicolonClassElement(node) { - return node.kind === 234; + return node.kind === 237; } ts.isSemicolonClassElement = isSemicolonClassElement; function isBlock(node) { - return node.kind === 235; + return node.kind === 238; } ts.isBlock = isBlock; function isVariableStatement(node) { - return node.kind === 237; + return node.kind === 240; } ts.isVariableStatement = isVariableStatement; function isEmptyStatement(node) { - return node.kind === 236; + return node.kind === 239; } ts.isEmptyStatement = isEmptyStatement; function isExpressionStatement(node) { - return node.kind === 238; + return node.kind === 241; } ts.isExpressionStatement = isExpressionStatement; function isIfStatement(node) { - return node.kind === 239; + return node.kind === 242; } ts.isIfStatement = isIfStatement; function isDoStatement(node) { - return node.kind === 240; + return node.kind === 243; } ts.isDoStatement = isDoStatement; function isWhileStatement(node) { - return node.kind === 241; + return node.kind === 244; } ts.isWhileStatement = isWhileStatement; function isForStatement(node) { - return node.kind === 242; + return node.kind === 245; } ts.isForStatement = isForStatement; function isForInStatement(node) { - return node.kind === 243; + return node.kind === 246; } ts.isForInStatement = isForInStatement; function isForOfStatement(node) { - return node.kind === 244; + return node.kind === 247; } ts.isForOfStatement = isForOfStatement; function isContinueStatement(node) { - return node.kind === 245; + return node.kind === 248; } ts.isContinueStatement = isContinueStatement; function isBreakStatement(node) { - return node.kind === 246; + return node.kind === 249; } ts.isBreakStatement = isBreakStatement; function isReturnStatement(node) { - return node.kind === 247; + return node.kind === 250; } ts.isReturnStatement = isReturnStatement; function isWithStatement(node) { - return node.kind === 248; + return node.kind === 251; } ts.isWithStatement = isWithStatement; function isSwitchStatement(node) { - return node.kind === 249; + return node.kind === 252; } ts.isSwitchStatement = isSwitchStatement; function isLabeledStatement(node) { - return node.kind === 250; + return node.kind === 253; } ts.isLabeledStatement = isLabeledStatement; function isThrowStatement(node) { - return node.kind === 251; + return node.kind === 254; } ts.isThrowStatement = isThrowStatement; function isTryStatement(node) { - return node.kind === 252; + return node.kind === 255; } ts.isTryStatement = isTryStatement; function isDebuggerStatement(node) { - return node.kind === 253; + return node.kind === 256; } ts.isDebuggerStatement = isDebuggerStatement; function isVariableDeclaration(node) { - return node.kind === 254; + return node.kind === 257; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 255; + return node.kind === 258; } ts.isVariableDeclarationList = isVariableDeclarationList; function isFunctionDeclaration(node) { - return node.kind === 256; + return node.kind === 259; } ts.isFunctionDeclaration = isFunctionDeclaration; function isClassDeclaration(node) { - return node.kind === 257; + return node.kind === 260; } ts.isClassDeclaration = isClassDeclaration; function isInterfaceDeclaration(node) { - return node.kind === 258; + return node.kind === 261; } ts.isInterfaceDeclaration = isInterfaceDeclaration; function isTypeAliasDeclaration(node) { - return node.kind === 259; + return node.kind === 262; } ts.isTypeAliasDeclaration = isTypeAliasDeclaration; function isEnumDeclaration(node) { - return node.kind === 260; + return node.kind === 263; } ts.isEnumDeclaration = isEnumDeclaration; function isModuleDeclaration(node) { - return node.kind === 261; + return node.kind === 264; } ts.isModuleDeclaration = isModuleDeclaration; function isModuleBlock(node) { - return node.kind === 262; + return node.kind === 265; } ts.isModuleBlock = isModuleBlock; function isCaseBlock(node) { - return node.kind === 263; + return node.kind === 266; } ts.isCaseBlock = isCaseBlock; function isNamespaceExportDeclaration(node) { - return node.kind === 264; + return node.kind === 267; } ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration; function isImportEqualsDeclaration(node) { - return node.kind === 265; + return node.kind === 268; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportDeclaration(node) { - return node.kind === 266; + return node.kind === 269; } ts.isImportDeclaration = isImportDeclaration; function isImportClause(node) { - return node.kind === 267; + return node.kind === 270; } ts.isImportClause = isImportClause; function isImportTypeAssertionContainer(node) { - return node.kind === 295; + return node.kind === 298; } ts.isImportTypeAssertionContainer = isImportTypeAssertionContainer; function isAssertClause(node) { - return node.kind === 293; + return node.kind === 296; } ts.isAssertClause = isAssertClause; function isAssertEntry(node) { - return node.kind === 294; + return node.kind === 297; } ts.isAssertEntry = isAssertEntry; function isNamespaceImport(node) { - return node.kind === 268; + return node.kind === 271; } ts.isNamespaceImport = isNamespaceImport; function isNamespaceExport(node) { - return node.kind === 274; + return node.kind === 277; } ts.isNamespaceExport = isNamespaceExport; function isNamedImports(node) { - return node.kind === 269; + return node.kind === 272; } ts.isNamedImports = isNamedImports; function isImportSpecifier(node) { - return node.kind === 270; + return node.kind === 273; } ts.isImportSpecifier = isImportSpecifier; function isExportAssignment(node) { - return node.kind === 271; + return node.kind === 274; } ts.isExportAssignment = isExportAssignment; function isExportDeclaration(node) { - return node.kind === 272; + return node.kind === 275; } ts.isExportDeclaration = isExportDeclaration; function isNamedExports(node) { - return node.kind === 273; + return node.kind === 276; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 275; + return node.kind === 278; } ts.isExportSpecifier = isExportSpecifier; function isMissingDeclaration(node) { - return node.kind === 276; + return node.kind === 279; } ts.isMissingDeclaration = isMissingDeclaration; function isNotEmittedStatement(node) { - return node.kind === 349; + return node.kind === 352; } ts.isNotEmittedStatement = isNotEmittedStatement; function isSyntheticReference(node) { - return node.kind === 354; + return node.kind === 357; } ts.isSyntheticReference = isSyntheticReference; function isMergeDeclarationMarker(node) { - return node.kind === 352; + return node.kind === 355; } ts.isMergeDeclarationMarker = isMergeDeclarationMarker; function isEndOfDeclarationMarker(node) { - return node.kind === 353; + return node.kind === 356; } ts.isEndOfDeclarationMarker = isEndOfDeclarationMarker; function isExternalModuleReference(node) { - return node.kind === 277; + return node.kind === 280; } ts.isExternalModuleReference = isExternalModuleReference; function isJsxElement(node) { - return node.kind === 278; + return node.kind === 281; } ts.isJsxElement = isJsxElement; function isJsxSelfClosingElement(node) { - return node.kind === 279; + return node.kind === 282; } ts.isJsxSelfClosingElement = isJsxSelfClosingElement; function isJsxOpeningElement(node) { - return node.kind === 280; + return node.kind === 283; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 281; + return node.kind === 284; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxFragment(node) { - return node.kind === 282; + return node.kind === 285; } ts.isJsxFragment = isJsxFragment; function isJsxOpeningFragment(node) { - return node.kind === 283; + return node.kind === 286; } ts.isJsxOpeningFragment = isJsxOpeningFragment; function isJsxClosingFragment(node) { - return node.kind === 284; + return node.kind === 287; } ts.isJsxClosingFragment = isJsxClosingFragment; function isJsxAttribute(node) { - return node.kind === 285; + return node.kind === 288; } ts.isJsxAttribute = isJsxAttribute; function isJsxAttributes(node) { - return node.kind === 286; + return node.kind === 289; } ts.isJsxAttributes = isJsxAttributes; function isJsxSpreadAttribute(node) { - return node.kind === 287; + return node.kind === 290; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxExpression(node) { - return node.kind === 288; + return node.kind === 291; } ts.isJsxExpression = isJsxExpression; function isCaseClause(node) { - return node.kind === 289; + return node.kind === 292; } ts.isCaseClause = isCaseClause; function isDefaultClause(node) { - return node.kind === 290; + return node.kind === 293; } ts.isDefaultClause = isDefaultClause; function isHeritageClause(node) { - return node.kind === 291; + return node.kind === 294; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 292; + return node.kind === 295; } ts.isCatchClause = isCatchClause; function isPropertyAssignment(node) { - return node.kind === 296; + return node.kind === 299; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 297; + return node.kind === 300; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isSpreadAssignment(node) { - return node.kind === 298; + return node.kind === 301; } ts.isSpreadAssignment = isSpreadAssignment; function isEnumMember(node) { - return node.kind === 299; + return node.kind === 302; } ts.isEnumMember = isEnumMember; function isUnparsedPrepend(node) { - return node.kind === 301; + return node.kind === 304; } ts.isUnparsedPrepend = isUnparsedPrepend; function isSourceFile(node) { - return node.kind === 305; + return node.kind === 308; } ts.isSourceFile = isSourceFile; function isBundle(node) { - return node.kind === 306; + return node.kind === 309; } ts.isBundle = isBundle; function isUnparsedSource(node) { - return node.kind === 307; + return node.kind === 310; } ts.isUnparsedSource = isUnparsedSource; function isJSDocTypeExpression(node) { - return node.kind === 309; + return node.kind === 312; } ts.isJSDocTypeExpression = isJSDocTypeExpression; function isJSDocNameReference(node) { - return node.kind === 310; + return node.kind === 313; } ts.isJSDocNameReference = isJSDocNameReference; function isJSDocMemberName(node) { - return node.kind === 311; + return node.kind === 314; } ts.isJSDocMemberName = isJSDocMemberName; function isJSDocLink(node) { - return node.kind === 324; + return node.kind === 327; } ts.isJSDocLink = isJSDocLink; function isJSDocLinkCode(node) { - return node.kind === 325; + return node.kind === 328; } ts.isJSDocLinkCode = isJSDocLinkCode; function isJSDocLinkPlain(node) { - return node.kind === 326; + return node.kind === 329; } ts.isJSDocLinkPlain = isJSDocLinkPlain; function isJSDocAllType(node) { - return node.kind === 312; + return node.kind === 315; } ts.isJSDocAllType = isJSDocAllType; function isJSDocUnknownType(node) { - return node.kind === 313; + return node.kind === 316; } ts.isJSDocUnknownType = isJSDocUnknownType; function isJSDocNullableType(node) { - return node.kind === 314; + return node.kind === 317; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 315; + return node.kind === 318; } ts.isJSDocNonNullableType = isJSDocNonNullableType; function isJSDocOptionalType(node) { - return node.kind === 316; + return node.kind === 319; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 317; + return node.kind === 320; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 318; + return node.kind === 321; } ts.isJSDocVariadicType = isJSDocVariadicType; function isJSDocNamepathType(node) { - return node.kind === 319; + return node.kind === 322; } ts.isJSDocNamepathType = isJSDocNamepathType; function isJSDoc(node) { - return node.kind === 320; + return node.kind === 323; } ts.isJSDoc = isJSDoc; function isJSDocTypeLiteral(node) { - return node.kind === 322; + return node.kind === 325; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; function isJSDocSignature(node) { - return node.kind === 323; + return node.kind === 326; } ts.isJSDocSignature = isJSDocSignature; function isJSDocAugmentsTag(node) { - return node.kind === 328; + return node.kind === 331; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocAuthorTag(node) { - return node.kind === 330; + return node.kind === 333; } ts.isJSDocAuthorTag = isJSDocAuthorTag; function isJSDocClassTag(node) { - return node.kind === 332; + return node.kind === 335; } ts.isJSDocClassTag = isJSDocClassTag; function isJSDocCallbackTag(node) { - return node.kind === 338; + return node.kind === 341; } ts.isJSDocCallbackTag = isJSDocCallbackTag; function isJSDocPublicTag(node) { - return node.kind === 333; + return node.kind === 336; } ts.isJSDocPublicTag = isJSDocPublicTag; function isJSDocPrivateTag(node) { - return node.kind === 334; + return node.kind === 337; } ts.isJSDocPrivateTag = isJSDocPrivateTag; function isJSDocProtectedTag(node) { - return node.kind === 335; + return node.kind === 338; } ts.isJSDocProtectedTag = isJSDocProtectedTag; function isJSDocReadonlyTag(node) { - return node.kind === 336; + return node.kind === 339; } ts.isJSDocReadonlyTag = isJSDocReadonlyTag; function isJSDocOverrideTag(node) { - return node.kind === 337; + return node.kind === 340; } ts.isJSDocOverrideTag = isJSDocOverrideTag; function isJSDocDeprecatedTag(node) { - return node.kind === 331; + return node.kind === 334; } ts.isJSDocDeprecatedTag = isJSDocDeprecatedTag; function isJSDocSeeTag(node) { - return node.kind === 346; + return node.kind === 349; } ts.isJSDocSeeTag = isJSDocSeeTag; function isJSDocEnumTag(node) { - return node.kind === 339; + return node.kind === 342; } ts.isJSDocEnumTag = isJSDocEnumTag; function isJSDocParameterTag(node) { - return node.kind === 340; + return node.kind === 343; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 341; + return node.kind === 344; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocThisTag(node) { - return node.kind === 342; + return node.kind === 345; } ts.isJSDocThisTag = isJSDocThisTag; function isJSDocTypeTag(node) { - return node.kind === 343; + return node.kind === 346; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 344; + return node.kind === 347; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 345; + return node.kind === 348; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocUnknownTag(node) { - return node.kind === 327; + return node.kind === 330; } ts.isJSDocUnknownTag = isJSDocUnknownTag; function isJSDocPropertyTag(node) { - return node.kind === 347; + return node.kind === 350; } ts.isJSDocPropertyTag = isJSDocPropertyTag; function isJSDocImplementsTag(node) { - return node.kind === 329; + return node.kind === 332; } ts.isJSDocImplementsTag = isJSDocImplementsTag; function isSyntaxList(n) { - return n.kind === 348; + return n.kind === 351; } ts.isSyntaxList = isSyntaxList; })(ts || (ts = {})); @@ -24139,14 +24308,14 @@ var ts; ts.Debug.failBadSyntaxKind(property.name, "Private identifiers are not allowed in object literals."); } switch (property.kind) { - case 172: - case 173: + case 174: + case 175: return createExpressionForAccessorDeclaration(factory, node.properties, property, receiver, !!node.multiLine); - case 296: + case 299: return createExpressionForPropertyAssignment(factory, property, receiver); - case 297: + case 300: return createExpressionForShorthandPropertyAssignment(factory, property, receiver); - case 169: + case 171: return createExpressionForMethodDeclaration(factory, property, receiver); } } @@ -24212,8 +24381,8 @@ var ts; } ts.startsWithUseStrict = startsWithUseStrict; function isCommaSequence(node) { - return node.kind === 221 && node.operatorToken.kind === 27 || - node.kind === 351; + return node.kind === 223 && node.operatorToken.kind === 27 || + node.kind === 354; } ts.isCommaSequence = isCommaSequence; function isJSDocTypeAssertion(node) { @@ -24231,17 +24400,18 @@ var ts; function isOuterExpression(node, kinds) { if (kinds === void 0) { kinds = 15; } switch (node.kind) { - case 212: + case 214: if (kinds & 16 && isJSDocTypeAssertion(node)) { return false; } return (kinds & 1) !== 0; - case 211: - case 229: + case 213: + case 231: + case 235: return (kinds & 2) !== 0; - case 230: + case 232: return (kinds & 4) !== 0; - case 350: + case 353: return (kinds & 8) !== 0; } return false; @@ -24353,10 +24523,10 @@ var ts; var name = namespaceDeclaration.name; return ts.isGeneratedIdentifier(name) ? name : factory.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name)); } - if (node.kind === 266 && node.importClause) { + if (node.kind === 269 && node.importClause) { return factory.getGeneratedNameForNode(node); } - if (node.kind === 272 && node.moduleSpecifier) { + if (node.kind === 275 && node.moduleSpecifier) { return factory.getGeneratedNameForNode(node); } return undefined; @@ -24419,11 +24589,11 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 296: + case 299: return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 297: + case 300: return bindingElement.name; - case 298: + case 301: return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } return undefined; @@ -24439,11 +24609,11 @@ var ts; ts.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement; function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 164: - case 203: + case 166: + case 205: return bindingElement.dotDotDotToken; - case 225: - case 298: + case 227: + case 301: return bindingElement; } return undefined; @@ -24457,7 +24627,7 @@ var ts; ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; function tryGetPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 203: + case 205: if (bindingElement.propertyName) { var propertyName = bindingElement.propertyName; if (ts.isPrivateIdentifier(propertyName)) { @@ -24468,7 +24638,7 @@ var ts; : propertyName; } break; - case 296: + case 299: if (bindingElement.name) { var propertyName = bindingElement.name; if (ts.isPrivateIdentifier(propertyName)) { @@ -24479,7 +24649,7 @@ var ts; : propertyName; } break; - case 298: + case 301: if (bindingElement.name && ts.isPrivateIdentifier(bindingElement.name)) { return ts.Debug.failBadSyntaxKind(bindingElement.name); } @@ -24498,11 +24668,11 @@ var ts; } function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 201: - case 202: + case 203: case 204: + case 206: return name.elements; - case 205: + case 207: return name.properties; } } @@ -24521,46 +24691,46 @@ var ts; ts.getJSDocTypeAliasName = getJSDocTypeAliasName; function canHaveIllegalType(node) { var kind = node.kind; - return kind === 171 - || kind === 173; + return kind === 173 + || kind === 175; } ts.canHaveIllegalType = canHaveIllegalType; function canHaveIllegalTypeParameters(node) { var kind = node.kind; - return kind === 171 - || kind === 172 - || kind === 173; + return kind === 173 + || kind === 174 + || kind === 175; } ts.canHaveIllegalTypeParameters = canHaveIllegalTypeParameters; function canHaveIllegalDecorators(node) { var kind = node.kind; - return kind === 296 - || kind === 297 - || kind === 256 - || kind === 171 - || kind === 176 - || kind === 170 - || kind === 276 - || kind === 237 - || kind === 258 + return kind === 299 + || kind === 300 || kind === 259 - || kind === 260 + || kind === 173 + || kind === 178 + || kind === 172 + || kind === 279 + || kind === 240 || kind === 261 - || kind === 265 - || kind === 266 + || kind === 262 + || kind === 263 || kind === 264 - || kind === 272 - || kind === 271; + || kind === 268 + || kind === 269 + || kind === 267 + || kind === 275 + || kind === 274; } ts.canHaveIllegalDecorators = canHaveIllegalDecorators; function canHaveIllegalModifiers(node) { var kind = node.kind; - return kind === 170 - || kind === 296 - || kind === 297 - || kind === 179 - || kind === 276 - || kind === 264; + return kind === 172 + || kind === 299 + || kind === 300 + || kind === 181 + || kind === 279 + || kind === 267; } ts.canHaveIllegalModifiers = canHaveIllegalModifiers; ts.isTypeNodeOrTypeParameterDeclaration = ts.or(ts.isTypeNode, ts.isTypeParameterDeclaration); @@ -24793,6 +24963,64 @@ var ts; return ts.setTextRange(factory.createNodeArray([], nodes.hasTrailingComma), nodes); } ts.elideNodes = elideNodes; + function getNodeForGeneratedName(name) { + if (name.autoGenerateFlags & 4) { + var autoGenerateId = name.autoGenerateId; + var node = name; + var original = node.original; + while (original) { + node = original; + if (ts.isMemberName(node) + && !!(node.autoGenerateFlags & 4) + && node.autoGenerateId !== autoGenerateId) { + break; + } + original = node.original; + } + return node; + } + return name; + } + ts.getNodeForGeneratedName = getNodeForGeneratedName; + function formatGeneratedNamePart(part, generateName) { + return typeof part === "object" ? formatGeneratedName(false, part.prefix, part.node, part.suffix, generateName) : + typeof part === "string" ? part.length > 0 && part.charCodeAt(0) === 35 ? part.slice(1) : part : + ""; + } + ts.formatGeneratedNamePart = formatGeneratedNamePart; + function formatIdentifier(name, generateName) { + return typeof name === "string" ? name : + formatIdentifierWorker(name, ts.Debug.checkDefined(generateName)); + } + function formatIdentifierWorker(node, generateName) { + return ts.isGeneratedPrivateIdentifier(node) ? generateName(node).slice(1) : + ts.isGeneratedIdentifier(node) ? generateName(node) : + ts.isPrivateIdentifier(node) ? node.escapedText.slice(1) : + ts.idText(node); + } + function formatGeneratedName(privateName, prefix, baseName, suffix, generateName) { + prefix = formatGeneratedNamePart(prefix, generateName); + suffix = formatGeneratedNamePart(suffix, generateName); + baseName = formatIdentifier(baseName, generateName); + return "".concat(privateName ? "#" : "").concat(prefix).concat(baseName).concat(suffix); + } + ts.formatGeneratedName = formatGeneratedName; + function createAccessorPropertyBackingField(factory, node, modifiers, initializer) { + return factory.updatePropertyDeclaration(node, modifiers, factory.getGeneratedPrivateNameForNode(node.name, undefined, "_accessor_storage"), undefined, undefined, initializer); + } + ts.createAccessorPropertyBackingField = createAccessorPropertyBackingField; + function createAccessorPropertyGetRedirector(factory, node, modifiers, name) { + return factory.createGetAccessorDeclaration(modifiers, name, [], undefined, factory.createBlock([ + factory.createReturnStatement(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name, undefined, "_accessor_storage"))) + ])); + } + ts.createAccessorPropertyGetRedirector = createAccessorPropertyGetRedirector; + function createAccessorPropertySetRedirector(factory, node, modifiers, name) { + return factory.createSetAccessorDeclaration(modifiers, name, [factory.createParameterDeclaration(undefined, undefined, "value")], factory.createBlock([ + factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name, undefined, "_accessor_storage")), factory.createIdentifier("value"))) + ])); + } + ts.createAccessorPropertySetRedirector = createAccessorPropertySetRedirector; })(ts || (ts = {})); var ts; (function (ts) { @@ -24802,47 +25030,48 @@ var ts; ts.setTextRange = setTextRange; function canHaveModifiers(node) { var kind = node.kind; - return kind === 163 - || kind === 164 + return kind === 165 || kind === 166 - || kind === 167 || kind === 168 || kind === 169 + || kind === 170 || kind === 171 - || kind === 172 || kind === 173 - || kind === 176 - || kind === 180 - || kind === 213 - || kind === 214 - || kind === 226 - || kind === 237 - || kind === 256 - || kind === 257 - || kind === 258 + || kind === 174 + || kind === 175 + || kind === 178 + || kind === 182 + || kind === 215 + || kind === 216 + || kind === 228 + || kind === 240 || kind === 259 || kind === 260 || kind === 261 - || kind === 265 - || kind === 266 - || kind === 271 - || kind === 272; + || kind === 262 + || kind === 263 + || kind === 264 + || kind === 268 + || kind === 269 + || kind === 274 + || kind === 275; } ts.canHaveModifiers = canHaveModifiers; function canHaveDecorators(node) { var kind = node.kind; - return kind === 164 - || kind === 167 + return kind === 166 || kind === 169 - || kind === 172 - || kind === 173 - || kind === 226 - || kind === 257; + || kind === 171 + || kind === 174 + || kind === 175 + || kind === 228 + || kind === 260; } ts.canHaveDecorators = canHaveDecorators; })(ts || (ts = {})); var ts; (function (ts) { + var _a; var NodeConstructor; var TokenConstructor; var IdentifierConstructor; @@ -24905,563 +25134,722 @@ var ts; function isImportMeta(node) { return ts.isMetaProperty(node) && node.keywordToken === 100 && node.name.escapedText === "meta"; } + var forEachChildTable = (_a = {}, + _a[163] = function forEachChildInQualifiedName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + }, + _a[165] = function forEachChildInTypeParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.default) || + visitNode(cbNode, node.expression); + }, + _a[300] = function forEachChildInShorthandPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.equalsToken) || + visitNode(cbNode, node.objectAssignmentInitializer); + }, + _a[301] = function forEachChildInSpreadAssignment(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[166] = function forEachChildInParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[169] = function forEachChildInPropertyDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[168] = function forEachChildInPropertySignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[299] = function forEachChildInPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.initializer); + }, + _a[257] = function forEachChildInVariableDeclaration(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[205] = function forEachChildInBindingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[178] = function forEachChildInIndexSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[182] = function forEachChildInConstructorType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[181] = function forEachChildInFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[176] = forEachChildInCallOrConstructSignature, + _a[177] = forEachChildInCallOrConstructSignature, + _a[171] = function forEachChildInMethodDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[170] = function forEachChildInMethodSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[173] = function forEachChildInConstructor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[174] = function forEachChildInGetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[175] = function forEachChildInSetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[259] = function forEachChildInFunctionDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[215] = function forEachChildInFunctionExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[216] = function forEachChildInArrowFunction(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.equalsGreaterThanToken) || + visitNode(cbNode, node.body); + }, + _a[172] = function forEachChildInClassStaticBlockDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.body); + }, + _a[180] = function forEachChildInTypeReference(node, cbNode, cbNodes) { + return visitNode(cbNode, node.typeName) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[179] = function forEachChildInTypePredicate(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertsModifier) || + visitNode(cbNode, node.parameterName) || + visitNode(cbNode, node.type); + }, + _a[183] = function forEachChildInTypeQuery(node, cbNode, cbNodes) { + return visitNode(cbNode, node.exprName) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[184] = function forEachChildInTypeLiteral(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.members); + }, + _a[185] = function forEachChildInArrayType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.elementType); + }, + _a[186] = function forEachChildInTupleType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[189] = forEachChildInUnionOrIntersectionType, + _a[190] = forEachChildInUnionOrIntersectionType, + _a[191] = function forEachChildInConditionalType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.checkType) || + visitNode(cbNode, node.extendsType) || + visitNode(cbNode, node.trueType) || + visitNode(cbNode, node.falseType); + }, + _a[192] = function forEachChildInInferType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.typeParameter); + }, + _a[202] = function forEachChildInImportType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.argument) || + visitNode(cbNode, node.assertions) || + visitNode(cbNode, node.qualifier) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[298] = function forEachChildInImportTypeAssertionContainer(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertClause); + }, + _a[193] = forEachChildInParenthesizedTypeOrTypeOperator, + _a[195] = forEachChildInParenthesizedTypeOrTypeOperator, + _a[196] = function forEachChildInIndexedAccessType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.objectType) || + visitNode(cbNode, node.indexType); + }, + _a[197] = function forEachChildInMappedType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.readonlyToken) || + visitNode(cbNode, node.typeParameter) || + visitNode(cbNode, node.nameType) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[198] = function forEachChildInLiteralType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.literal); + }, + _a[199] = function forEachChildInNamedTupleMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type); + }, + _a[203] = forEachChildInObjectOrArrayBindingPattern, + _a[204] = forEachChildInObjectOrArrayBindingPattern, + _a[206] = function forEachChildInArrayLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[207] = function forEachChildInObjectLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, + _a[208] = function forEachChildInPropertyAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNode(cbNode, node.name); + }, + _a[209] = function forEachChildInElementAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNode(cbNode, node.argumentExpression); + }, + _a[210] = forEachChildInCallOrNewExpression, + _a[211] = forEachChildInCallOrNewExpression, + _a[212] = function forEachChildInTaggedTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tag) || + visitNode(cbNode, node.questionDotToken) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNode(cbNode, node.template); + }, + _a[213] = function forEachChildInTypeAssertionExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.expression); + }, + _a[214] = function forEachChildInParenthesizedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[217] = function forEachChildInDeleteExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[218] = function forEachChildInTypeOfExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[219] = function forEachChildInVoidExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[221] = function forEachChildInPrefixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, + _a[226] = function forEachChildInYieldExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + }, + _a[220] = function forEachChildInAwaitExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[222] = function forEachChildInPostfixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, + _a[223] = function forEachChildInBinaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.operatorToken) || + visitNode(cbNode, node.right); + }, + _a[231] = function forEachChildInAsExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.type); + }, + _a[232] = function forEachChildInNonNullExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[235] = function forEachChildInSatisfiesExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); + }, + _a[233] = function forEachChildInMetaProperty(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[224] = function forEachChildInConditionalExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.condition) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.whenTrue) || + visitNode(cbNode, node.colonToken) || + visitNode(cbNode, node.whenFalse); + }, + _a[227] = function forEachChildInSpreadElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[238] = forEachChildInBlock, + _a[265] = forEachChildInBlock, + _a[308] = function forEachChildInSourceFile(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements) || + visitNode(cbNode, node.endOfFileToken); + }, + _a[240] = function forEachChildInVariableStatement(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.declarationList); + }, + _a[258] = function forEachChildInVariableDeclarationList(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.declarations); + }, + _a[241] = function forEachChildInExpressionStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[242] = function forEachChildInIfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.thenStatement) || + visitNode(cbNode, node.elseStatement); + }, + _a[243] = function forEachChildInDoStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.statement) || + visitNode(cbNode, node.expression); + }, + _a[244] = function forEachChildInWhileStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[245] = function forEachChildInForStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.incrementor) || + visitNode(cbNode, node.statement); + }, + _a[246] = function forEachChildInForInStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[247] = function forEachChildInForOfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.awaitModifier) || + visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[248] = forEachChildInContinueOrBreakStatement, + _a[249] = forEachChildInContinueOrBreakStatement, + _a[250] = function forEachChildInReturnStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[251] = function forEachChildInWithStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[252] = function forEachChildInSwitchStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.caseBlock); + }, + _a[266] = function forEachChildInCaseBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.clauses); + }, + _a[292] = function forEachChildInCaseClause(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNodes(cbNode, cbNodes, node.statements); + }, + _a[293] = function forEachChildInDefaultClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + }, + _a[253] = function forEachChildInLabeledStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + }, + _a[254] = function forEachChildInThrowStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[255] = function forEachChildInTryStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tryBlock) || + visitNode(cbNode, node.catchClause) || + visitNode(cbNode, node.finallyBlock); + }, + _a[295] = function forEachChildInCatchClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.variableDeclaration) || + visitNode(cbNode, node.block); + }, + _a[167] = function forEachChildInDecorator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[260] = forEachChildInClassDeclarationOrExpression, + _a[228] = forEachChildInClassDeclarationOrExpression, + _a[261] = function forEachChildInInterfaceDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[262] = function forEachChildInTypeAliasDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNode(cbNode, node.type); + }, + _a[263] = function forEachChildInEnumDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[302] = function forEachChildInEnumMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[264] = function forEachChildInModuleDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); + }, + _a[268] = function forEachChildInImportEqualsDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.moduleReference); + }, + _a[269] = function forEachChildInImportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.importClause) || + visitNode(cbNode, node.moduleSpecifier) || + visitNode(cbNode, node.assertClause); + }, + _a[270] = function forEachChildInImportClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.namedBindings); + }, + _a[296] = function forEachChildInAssertClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[297] = function forEachChildInAssertEntry(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.value); + }, + _a[267] = function forEachChildInNamespaceExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNode(cbNode, node.name); + }, + _a[271] = function forEachChildInNamespaceImport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[277] = function forEachChildInNamespaceExport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[272] = forEachChildInNamedImportsOrExports, + _a[276] = forEachChildInNamedImportsOrExports, + _a[275] = function forEachChildInExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.exportClause) || + visitNode(cbNode, node.moduleSpecifier) || + visitNode(cbNode, node.assertClause); + }, + _a[273] = forEachChildInImportOrExportSpecifier, + _a[278] = forEachChildInImportOrExportSpecifier, + _a[274] = function forEachChildInExportAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.expression); + }, + _a[225] = function forEachChildInTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || + visitNodes(cbNode, cbNodes, node.templateSpans); + }, + _a[236] = function forEachChildInTemplateSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.literal); + }, + _a[200] = function forEachChildInTemplateLiteralType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || + visitNodes(cbNode, cbNodes, node.templateSpans); + }, + _a[201] = function forEachChildInTemplateLiteralTypeSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.literal); + }, + _a[164] = function forEachChildInComputedPropertyName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[294] = function forEachChildInHeritageClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + }, + _a[230] = function forEachChildInExpressionWithTypeArguments(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[280] = function forEachChildInExternalModuleReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[279] = function forEachChildInMissingDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers); + }, + _a[354] = function forEachChildInCommaListExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[281] = function forEachChildInJsxElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingElement) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingElement); + }, + _a[285] = function forEachChildInJsxFragment(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingFragment) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingFragment); + }, + _a[282] = forEachChildInJsxOpeningOrSelfClosingElement, + _a[283] = forEachChildInJsxOpeningOrSelfClosingElement, + _a[289] = function forEachChildInJsxAttributes(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, + _a[288] = function forEachChildInJsxAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[290] = function forEachChildInJsxSpreadAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[291] = function forEachChildInJsxExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.expression); + }, + _a[284] = function forEachChildInJsxClosingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tagName); + }, + _a[187] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[188] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[312] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[318] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[317] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[319] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[321] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[320] = function forEachChildInJSDocFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[323] = function forEachChildInJSDoc(node, cbNode, cbNodes) { + return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) + || visitNodes(cbNode, cbNodes, node.tags); + }, + _a[349] = function forEachChildInJSDocSeeTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.name) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[313] = function forEachChildInJSDocNameReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[314] = function forEachChildInJSDocMemberName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + }, + _a[343] = forEachChildInJSDocParameterOrPropertyTag, + _a[350] = forEachChildInJSDocParameterOrPropertyTag, + _a[333] = function forEachChildInJSDocAuthorTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[332] = function forEachChildInJSDocImplementsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.class) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[331] = function forEachChildInJSDocAugmentsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.class) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[347] = function forEachChildInJSDocTemplateTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.constraint) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[348] = function forEachChildInJSDocTypedefTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (node.typeExpression && + node.typeExpression.kind === 312 + ? visitNode(cbNode, node.typeExpression) || + visitNode(cbNode, node.fullName) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) + : visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); + }, + _a[341] = function forEachChildInJSDocCallbackTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[344] = forEachChildInJSDocReturnTag, + _a[346] = forEachChildInJSDocReturnTag, + _a[345] = forEachChildInJSDocReturnTag, + _a[342] = forEachChildInJSDocReturnTag, + _a[326] = function forEachChildInJSDocSignature(node, cbNode, _cbNodes) { + return ts.forEach(node.typeParameters, cbNode) || + ts.forEach(node.parameters, cbNode) || + visitNode(cbNode, node.type); + }, + _a[327] = forEachChildInJSDocLinkCodeOrPlain, + _a[328] = forEachChildInJSDocLinkCodeOrPlain, + _a[329] = forEachChildInJSDocLinkCodeOrPlain, + _a[325] = function forEachChildInJSDocTypeLiteral(node, cbNode, _cbNodes) { + return ts.forEach(node.jsDocPropertyTags, cbNode); + }, + _a[330] = forEachChildInJSDocTag, + _a[335] = forEachChildInJSDocTag, + _a[336] = forEachChildInJSDocTag, + _a[337] = forEachChildInJSDocTag, + _a[338] = forEachChildInJSDocTag, + _a[339] = forEachChildInJSDocTag, + _a[334] = forEachChildInJSDocTag, + _a[340] = forEachChildInJSDocTag, + _a[353] = forEachChildInPartiallyEmittedExpression, + _a); + function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + } + function forEachChildInUnionOrIntersectionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + } + function forEachChildInParenthesizedTypeOrTypeOperator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInObjectOrArrayBindingPattern(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInCallOrNewExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNodes(cbNode, cbNodes, node.arguments); + } + function forEachChildInBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + } + function forEachChildInContinueOrBreakStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label); + } + function forEachChildInClassDeclarationOrExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); + } + function forEachChildInNamedImportsOrExports(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInImportOrExportSpecifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name); + } + function forEachChildInJsxOpeningOrSelfClosingElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNode(cbNode, node.attributes); + } + function forEachChildInOptionalRestOrJSDocParameterModifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInJSDocParameterOrPropertyTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (node.isNameFirst + ? visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression) + : visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name)) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocReturnTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocLinkCodeOrPlain(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + } + function forEachChildInJSDocTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) + || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInPartiallyEmittedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + } function forEachChild(node, cbNode, cbNodes) { - if (!node || node.kind <= 160) { + if (node === undefined || node.kind <= 162) { return; } - switch (node.kind) { - case 161: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); - case 163: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.constraint) || - visitNode(cbNode, node.default) || - visitNode(cbNode, node.expression); - case 297: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.equalsToken) || - visitNode(cbNode, node.objectAssignmentInitializer); - case 298: - return visitNode(cbNode, node.expression); - case 164: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 167: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 166: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 296: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.initializer); - case 254: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 203: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 176: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 180: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 179: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 174: - case 175: - return visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 169: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 168: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 171: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 172: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 173: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 256: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 213: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 214: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.equalsGreaterThanToken) || - visitNode(cbNode, node.body); - case 170: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.body); - case 178: - return visitNode(cbNode, node.typeName) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 177: - return visitNode(cbNode, node.assertsModifier) || - visitNode(cbNode, node.parameterName) || - visitNode(cbNode, node.type); - case 181: - return visitNode(cbNode, node.exprName) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 182: - return visitNodes(cbNode, cbNodes, node.members); - case 183: - return visitNode(cbNode, node.elementType); - case 184: - return visitNodes(cbNode, cbNodes, node.elements); - case 187: - case 188: - return visitNodes(cbNode, cbNodes, node.types); - case 189: - return visitNode(cbNode, node.checkType) || - visitNode(cbNode, node.extendsType) || - visitNode(cbNode, node.trueType) || - visitNode(cbNode, node.falseType); - case 190: - return visitNode(cbNode, node.typeParameter); - case 200: - return visitNode(cbNode, node.argument) || - visitNode(cbNode, node.assertions) || - visitNode(cbNode, node.qualifier) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 295: - return visitNode(cbNode, node.assertClause); - case 191: - case 193: - return visitNode(cbNode, node.type); - case 194: - return visitNode(cbNode, node.objectType) || - visitNode(cbNode, node.indexType); - case 195: - return visitNode(cbNode, node.readonlyToken) || - visitNode(cbNode, node.typeParameter) || - visitNode(cbNode, node.nameType) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNodes(cbNode, cbNodes, node.members); - case 196: - return visitNode(cbNode, node.literal); - case 197: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type); - case 201: - case 202: - return visitNodes(cbNode, cbNodes, node.elements); - case 204: - return visitNodes(cbNode, cbNodes, node.elements); - case 205: - return visitNodes(cbNode, cbNodes, node.properties); - case 206: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNode(cbNode, node.name); - case 207: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNode(cbNode, node.argumentExpression); - case 208: - case 209: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNodes(cbNode, cbNodes, node.arguments); - case 210: - return visitNode(cbNode, node.tag) || - visitNode(cbNode, node.questionDotToken) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNode(cbNode, node.template); - case 211: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.expression); - case 212: - return visitNode(cbNode, node.expression); - case 215: - return visitNode(cbNode, node.expression); - case 216: - return visitNode(cbNode, node.expression); - case 217: - return visitNode(cbNode, node.expression); - case 219: - return visitNode(cbNode, node.operand); - case 224: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); - case 218: - return visitNode(cbNode, node.expression); - case 220: - return visitNode(cbNode, node.operand); - case 221: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.operatorToken) || - visitNode(cbNode, node.right); - case 229: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.type); - case 230: - return visitNode(cbNode, node.expression); - case 231: - return visitNode(cbNode, node.name); - case 222: - return visitNode(cbNode, node.condition) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.whenTrue) || - visitNode(cbNode, node.colonToken) || - visitNode(cbNode, node.whenFalse); - case 225: - return visitNode(cbNode, node.expression); - case 235: - case 262: - return visitNodes(cbNode, cbNodes, node.statements); - case 305: - return visitNodes(cbNode, cbNodes, node.statements) || - visitNode(cbNode, node.endOfFileToken); - case 237: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.declarationList); - case 255: - return visitNodes(cbNode, cbNodes, node.declarations); - case 238: - return visitNode(cbNode, node.expression); - case 239: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.thenStatement) || - visitNode(cbNode, node.elseStatement); - case 240: - return visitNode(cbNode, node.statement) || - visitNode(cbNode, node.expression); - case 241: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 242: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.condition) || - visitNode(cbNode, node.incrementor) || - visitNode(cbNode, node.statement); - case 243: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 244: - return visitNode(cbNode, node.awaitModifier) || - visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 245: - case 246: - return visitNode(cbNode, node.label); - case 247: - return visitNode(cbNode, node.expression); - case 248: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 249: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.caseBlock); - case 263: - return visitNodes(cbNode, cbNodes, node.clauses); - case 289: - return visitNode(cbNode, node.expression) || - visitNodes(cbNode, cbNodes, node.statements); - case 290: - return visitNodes(cbNode, cbNodes, node.statements); - case 250: - return visitNode(cbNode, node.label) || - visitNode(cbNode, node.statement); - case 251: - return visitNode(cbNode, node.expression); - case 252: - return visitNode(cbNode, node.tryBlock) || - visitNode(cbNode, node.catchClause) || - visitNode(cbNode, node.finallyBlock); - case 292: - return visitNode(cbNode, node.variableDeclaration) || - visitNode(cbNode, node.block); - case 165: - return visitNode(cbNode, node.expression); - case 257: - case 226: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.heritageClauses) || - visitNodes(cbNode, cbNodes, node.members); - case 258: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.heritageClauses) || - visitNodes(cbNode, cbNodes, node.members); - case 259: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNode(cbNode, node.type); - case 260: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.members); - case 299: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 261: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.body); - case 265: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.moduleReference); - case 266: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.importClause) || - visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); - case 267: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.namedBindings); - case 293: - return visitNodes(cbNode, cbNodes, node.elements); - case 294: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.value); - case 264: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNode(cbNode, node.name); - case 268: - return visitNode(cbNode, node.name); - case 274: - return visitNode(cbNode, node.name); - case 269: - case 273: - return visitNodes(cbNode, cbNodes, node.elements); - case 272: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.exportClause) || - visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); - case 270: - case 275: - return visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name); - case 271: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.expression); - case 223: - return visitNode(cbNode, node.head) || - visitNodes(cbNode, cbNodes, node.templateSpans); - case 233: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.literal); - case 198: - return visitNode(cbNode, node.head) || - visitNodes(cbNode, cbNodes, node.templateSpans); - case 199: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.literal); - case 162: - return visitNode(cbNode, node.expression); - case 291: - return visitNodes(cbNode, cbNodes, node.types); - case 228: - return visitNode(cbNode, node.expression) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 277: - return visitNode(cbNode, node.expression); - case 276: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers); - case 351: - return visitNodes(cbNode, cbNodes, node.elements); - case 278: - return visitNode(cbNode, node.openingElement) || - visitNodes(cbNode, cbNodes, node.children) || - visitNode(cbNode, node.closingElement); - case 282: - return visitNode(cbNode, node.openingFragment) || - visitNodes(cbNode, cbNodes, node.children) || - visitNode(cbNode, node.closingFragment); - case 279: - case 280: - return visitNode(cbNode, node.tagName) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNode(cbNode, node.attributes); - case 286: - return visitNodes(cbNode, cbNodes, node.properties); - case 285: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 287: - return visitNode(cbNode, node.expression); - case 288: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.expression); - case 281: - return visitNode(cbNode, node.tagName); - case 185: - case 186: - case 309: - case 315: - case 314: - case 316: - case 318: - return visitNode(cbNode, node.type); - case 317: - return visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 320: - return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - || visitNodes(cbNode, cbNodes, node.tags); - case 346: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.name) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 310: - return visitNode(cbNode, node.name); - case 311: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); - case 340: - case 347: - return visitNode(cbNode, node.tagName) || - (node.isNameFirst - ? visitNode(cbNode, node.name) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - : visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.name) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); - case 330: - return visitNode(cbNode, node.tagName) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 329: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.class) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 328: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.class) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 344: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.constraint) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 345: - return visitNode(cbNode, node.tagName) || - (node.typeExpression && - node.typeExpression.kind === 309 - ? visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.fullName) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - : visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); - case 338: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 341: - case 343: - case 342: - case 339: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 323: - return ts.forEach(node.typeParameters, cbNode) || - ts.forEach(node.parameters, cbNode) || - visitNode(cbNode, node.type); - case 324: - case 325: - case 326: - return visitNode(cbNode, node.name); - case 322: - return ts.forEach(node.jsDocPropertyTags, cbNode); - case 327: - case 332: - case 333: - case 334: - case 335: - case 336: - case 331: - return visitNode(cbNode, node.tagName) - || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 350: - return visitNode(cbNode, node.expression); - } + var fn = forEachChildTable[node.kind]; + return fn === undefined ? undefined : fn(node, cbNode, cbNodes); } ts.forEachChild = forEachChild; function forEachChildRecursively(rootNode, cbNode, cbNodes) { @@ -25494,7 +25882,7 @@ var ts; continue; return res; } - if (current.kind >= 161) { + if (current.kind >= 163) { for (var _i = 0, _a = gatherPossibleChildren(current); _i < _a.length; _i++) { var child = _a[_i]; queue.push(child); @@ -26129,7 +26517,7 @@ var ts; if (token() === 125 && inYieldContext()) { return false; } - if (token() === 132 && inAwaitContext()) { + if (token() === 133 && inAwaitContext()) { return false; } return token() > 116; @@ -26346,7 +26734,7 @@ var ts; ts.isTemplateLiteralKind(kind) ? factory.createTemplateLiteralLikeNode(kind, "", "", undefined) : kind === 8 ? factory.createNumericLiteral("", undefined) : kind === 10 ? factory.createStringLiteral("", undefined) : - kind === 276 ? factory.createMissingDeclaration() : + kind === 279 ? factory.createMissingDeclaration() : factory.createToken(kind); return finishNode(result, pos); } @@ -26433,7 +26821,7 @@ var ts; } function parsePrivateIdentifier() { var pos = getNodePos(); - var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenText())); + var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenValue())); nextToken(); return finishNode(node, pos); } @@ -26456,15 +26844,16 @@ var ts; if (token() === 88) { return lookAhead(nextTokenCanFollowDefaultKeyword); } - if (token() === 152) { + if (token() === 154) { return lookAhead(nextTokenCanFollowExportModifier); } return canFollowExportModifier(); case 88: return nextTokenCanFollowDefaultKeyword(); + case 127: case 124: - case 136: - case 149: + case 137: + case 151: nextToken(); return canFollowModifier(); default: @@ -26473,7 +26862,7 @@ var ts; } function canFollowExportModifier() { return token() !== 41 - && token() !== 127 + && token() !== 128 && token() !== 18 && canFollowModifier(); } @@ -26496,7 +26885,7 @@ var ts; return token() === 84 || token() === 98 || token() === 118 || (token() === 126 && lookAhead(nextTokenIsClassKeywordOnSameLine)) || - (token() === 131 && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); + (token() === 132 && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); } function isListElement(parsingContext, inErrorRecovery) { var node = currentNode(parsingContext); @@ -26766,17 +27155,17 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 171: - case 176: - case 172: case 173: - case 167: - case 234: - return true; + case 178: + case 174: + case 175: case 169: + case 237: + return true; + case 171: var methodDeclaration = node; var nameIsConstructor = methodDeclaration.name.kind === 79 && - methodDeclaration.name.originalKeywordKind === 134; + methodDeclaration.name.originalKeywordKind === 135; return !nameIsConstructor; } } @@ -26785,8 +27174,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 289: - case 290: + case 292: + case 293: return true; } } @@ -26795,65 +27184,65 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 256: - case 237: - case 235: - case 239: + case 259: + case 240: case 238: - case 251: - case 247: - case 249: - case 246: - case 245: - case 243: - case 244: case 242: case 241: - case 248: - case 236: - case 252: + case 254: case 250: - case 240: + case 252: + case 249: + case 248: + case 246: + case 247: + case 245: + case 244: + case 251: + case 239: + case 255: case 253: - case 266: - case 265: - case 272: - case 271: - case 261: - case 257: - case 258: + case 243: + case 256: + case 269: + case 268: + case 275: + case 274: + case 264: case 260: - case 259: + case 261: + case 263: + case 262: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 299; + return node.kind === 302; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 175: + case 177: + case 170: + case 178: case 168: case 176: - case 166: - case 174: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 254) { + if (node.kind !== 257) { return false; } var variableDeclarator = node; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 164) { + if (node.kind !== 166) { return false; } var parameter = node; @@ -27094,14 +27483,14 @@ var ts; } function typeHasArrowFunctionBlockingParseError(node) { switch (node.kind) { - case 178: + case 180: return ts.nodeIsMissing(node.typeName); - case 179: - case 180: { + case 181: + case 182: { var _a = node, parameters = _a.parameters, type = _a.type; return isMissingList(parameters) || typeHasArrowFunctionBlockingParseError(type); } - case 191: + case 193: return typeHasArrowFunctionBlockingParseError(node.type); default: return false; @@ -27164,7 +27553,7 @@ var ts; function parseJSDocType() { scanner.setInJSDocType(true); var pos = getNodePos(); - if (parseOptional(141)) { + if (parseOptional(142)) { var moduleTag = factory.createJSDocNamepathType(undefined); terminate: while (true) { switch (token()) { @@ -27318,14 +27707,14 @@ var ts; function parseSignatureMember(kind) { var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); - if (kind === 175) { + if (kind === 177) { parseExpected(103); } var typeParameters = parseTypeParameters(); var parameters = parseParameters(4); var type = parseReturnType(58, true); parseTypeMemberSemicolon(); - var node = kind === 174 + var node = kind === 176 ? factory.createCallSignature(typeParameters, parameters, type) : factory.createConstructSignature(typeParameters, parameters, type); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -27389,8 +27778,8 @@ var ts; function isTypeMemberStart() { if (token() === 20 || token() === 29 || - token() === 136 || - token() === 149) { + token() === 137 || + token() === 151) { return true; } var idToken = false; @@ -27417,19 +27806,19 @@ var ts; } function parseTypeMember() { if (token() === 20 || token() === 29) { - return parseSignatureMember(174); + return parseSignatureMember(176); } if (token() === 103 && lookAhead(nextTokenIsOpenParenOrLessThan)) { - return parseSignatureMember(175); + return parseSignatureMember(177); } var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); var modifiers = parseModifiers(); - if (parseContextualModifier(136)) { - return parseAccessorDeclaration(pos, hasJSDoc, undefined, modifiers, 172, 4); + if (parseContextualModifier(137)) { + return parseAccessorDeclaration(pos, hasJSDoc, undefined, modifiers, 174, 4); } - if (parseContextualModifier(149)) { - return parseAccessorDeclaration(pos, hasJSDoc, undefined, modifiers, 173, 4); + if (parseContextualModifier(151)) { + return parseAccessorDeclaration(pos, hasJSDoc, undefined, modifiers, 175, 4); } if (isIndexSignature()) { return parseIndexSignatureDeclaration(pos, hasJSDoc, undefined, modifiers); @@ -27470,9 +27859,9 @@ var ts; function isStartOfMappedType() { nextToken(); if (token() === 39 || token() === 40) { - return nextToken() === 145; + return nextToken() === 146; } - if (token() === 145) { + if (token() === 146) { nextToken(); } return token() === 22 && nextTokenIsIdentifier() && nextToken() === 101; @@ -27488,15 +27877,15 @@ var ts; var pos = getNodePos(); parseExpected(18); var readonlyToken; - if (token() === 145 || token() === 39 || token() === 40) { + if (token() === 146 || token() === 39 || token() === 40) { readonlyToken = parseTokenNode(); - if (readonlyToken.kind !== 145) { - parseExpected(145); + if (readonlyToken.kind !== 146) { + parseExpected(146); } } parseExpected(22); var typeParameter = parseMappedTypeParameter(); - var nameType = parseOptional(127) ? parseType() : undefined; + var nameType = parseOptional(128) ? parseType() : undefined; parseExpected(23); var questionToken; if (token() === 57 || token() === 39 || token() === 40) { @@ -27610,7 +27999,7 @@ var ts; var openBracePosition = scanner.getTokenPos(); parseExpected(18); var multiLine = scanner.hasPrecedingLineBreak(); - parseExpected(129); + parseExpected(130); parseExpected(58); var clause = parseAssertClause(true); if (!parseExpected(19)) { @@ -27643,16 +28032,16 @@ var ts; } function parseNonArrayType() { switch (token()) { - case 130: - case 155: - case 150: - case 147: - case 158: - case 151: - case 133: - case 153: - case 143: + case 131: + case 157: + case 152: case 148: + case 160: + case 153: + case 134: + case 155: + case 144: + case 149: return tryParse(parseKeywordAndNoDot) || parseTypeReference(); case 66: scanner.reScanAsteriskEqualsToken(); @@ -27680,7 +28069,7 @@ var ts; return parseTokenNode(); case 108: { var thisKeyword = parseThisTypeNode(); - if (token() === 139 && !scanner.hasPrecedingLineBreak()) { + if (token() === 140 && !scanner.hasPrecedingLineBreak()) { return parseThisTypePredicate(thisKeyword); } else { @@ -27697,7 +28086,7 @@ var ts; return parseParenthesizedType(); case 100: return parseImportType(); - case 128: + case 129: return lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine) ? parseAssertsTypePredicate() : parseTypeReference(); case 15: return parseTemplateType(); @@ -27707,21 +28096,21 @@ var ts; } function isStartOfType(inStartOfParameter) { switch (token()) { - case 130: - case 155: - case 150: - case 147: - case 158: - case 133: - case 145: - case 151: - case 154: - case 114: + case 131: + case 157: + case 152: + case 148: + case 160: + case 134: + case 146: case 153: + case 156: + case 114: + case 155: case 104: case 108: case 112: - case 143: + case 144: case 18: case 22: case 29: @@ -27733,14 +28122,14 @@ var ts; case 9: case 110: case 95: - case 148: + case 149: case 41: case 57: case 53: case 25: - case 137: + case 138: case 100: - case 128: + case 129: case 14: case 15: return true; @@ -27814,17 +28203,17 @@ var ts; } function parseInferType() { var pos = getNodePos(); - parseExpected(137); + parseExpected(138); return finishNode(factory.createInferTypeNode(parseTypeParameterOfInferType()), pos); } function parseTypeOperatorOrHigher() { var operator = token(); switch (operator) { - case 140: - case 154: - case 145: + case 141: + case 156: + case 146: return parseTypeOperator(operator); - case 137: + case 138: return parseInferType(); } return allowConditionalTypesAnd(parsePostfixTypeOrHigher); @@ -27930,16 +28319,16 @@ var ts; } function parseTypePredicatePrefix() { var id = parseIdentifier(); - if (token() === 139 && !scanner.hasPrecedingLineBreak()) { + if (token() === 140 && !scanner.hasPrecedingLineBreak()) { nextToken(); return id; } } function parseAssertsTypePredicate() { var pos = getNodePos(); - var assertsModifier = parseExpectedToken(128); + var assertsModifier = parseExpectedToken(129); var parameterName = token() === 108 ? parseThisTypeNode() : parseIdentifier(); - var type = parseOptional(139) ? parseType() : undefined; + var type = parseOptional(140) ? parseType() : undefined; return finishNode(factory.createTypePredicateNode(assertsModifier, parameterName, type), pos); } function parseType() { @@ -28007,7 +28396,7 @@ var ts; case 45: case 46: case 29: - case 132: + case 133: case 125: case 80: return true; @@ -28106,7 +28495,7 @@ var ts; tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction); }); } function isParenthesizedArrowFunctionExpression() { - if (token() === 20 || token() === 29 || token() === 131) { + if (token() === 20 || token() === 29 || token() === 132) { return lookAhead(isParenthesizedArrowFunctionExpressionWorker); } if (token() === 38) { @@ -28115,7 +28504,7 @@ var ts; return 0; } function isParenthesizedArrowFunctionExpressionWorker() { - if (token() === 131) { + if (token() === 132) { nextToken(); if (scanner.hasPrecedingLineBreak()) { return 0; @@ -28144,8 +28533,8 @@ var ts; if (second === 25) { return 1; } - if (ts.isModifierKind(second) && second !== 131 && lookAhead(nextTokenIsIdentifier)) { - if (nextToken() === 127) { + if (ts.isModifierKind(second) && second !== 132 && lookAhead(nextTokenIsIdentifier)) { + if (nextToken() === 128) { return 0; } return 1; @@ -28212,7 +28601,7 @@ var ts; return result; } function tryParseAsyncSimpleArrowFunctionExpression(allowReturnTypeInArrowFunction) { - if (token() === 131) { + if (token() === 132) { if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1) { var pos = getNodePos(); var asyncModifier = parseModifiersForArrowFunction(); @@ -28223,7 +28612,7 @@ var ts; return undefined; } function isUnParenthesizedAsyncArrowFunctionWorker() { - if (token() === 131) { + if (token() === 132) { nextToken(); if (scanner.hasPrecedingLineBreak() || token() === 38) { return 0; @@ -28269,7 +28658,7 @@ var ts; return undefined; } var unwrappedType = type; - while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 191) { + while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 193) { unwrappedType = unwrappedType.type; } var hasJSDocFunctionType = unwrappedType && ts.isJSDocFunctionType(unwrappedType); @@ -28324,7 +28713,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand, pos); } function isInOrOfKeyword(t) { - return t === 101 || t === 160; + return t === 101 || t === 162; } function parseBinaryExpressionRest(precedence, leftOperand, pos) { while (true) { @@ -28339,13 +28728,15 @@ var ts; if (token() === 101 && inDisallowInContext()) { break; } - if (token() === 127) { + if (token() === 128 || token() === 150) { if (scanner.hasPrecedingLineBreak()) { break; } else { + var keywordKind = token(); nextToken(); - leftOperand = makeAsExpression(leftOperand, parseType()); + leftOperand = keywordKind === 150 ? makeSatisfiesExpression(leftOperand, parseType()) : + makeAsExpression(leftOperand, parseType()); } } else { @@ -28360,6 +28751,9 @@ var ts; } return ts.getBinaryOperatorPrecedence(token()) > 0; } + function makeSatisfiesExpression(left, right) { + return finishNode(factory.createSatisfiesExpression(left, right), left.pos); + } function makeBinaryExpression(left, operatorToken, right, pos) { return finishNode(factory.createBinaryExpression(left, operatorToken, right), pos); } @@ -28383,7 +28777,7 @@ var ts; return finishNode(factory.createVoidExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos); } function isAwaitExpression() { - if (token() === 132) { + if (token() === 133) { if (inAwaitContext()) { return true; } @@ -28408,7 +28802,7 @@ var ts; if (token() === 42) { var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); var end = simpleUnaryExpression.end; - if (simpleUnaryExpression.kind === 211) { + if (simpleUnaryExpression.kind === 213) { parseErrorAt(pos, end, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { @@ -28432,7 +28826,7 @@ var ts; return parseVoidExpression(); case 29: return parseTypeAssertion(); - case 132: + case 133: if (isAwaitExpression()) { return parseAwaitExpression(); } @@ -28449,7 +28843,7 @@ var ts; case 89: case 112: case 114: - case 132: + case 133: return false; case 29: if (languageVariant !== 1) { @@ -28527,11 +28921,11 @@ var ts; var pos = getNodePos(); var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); var result; - if (opening.kind === 280) { + if (opening.kind === 283) { var children = parseJsxChildren(opening); var closingElement = void 0; var lastChild = children[children.length - 1]; - if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 278 + if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 281 && !tagNamesAreEquivalent(lastChild.openingElement.tagName, lastChild.closingElement.tagName) && tagNamesAreEquivalent(opening.tagName, lastChild.closingElement.tagName)) { var end = lastChild.children.end; @@ -28552,11 +28946,11 @@ var ts; } result = finishNode(factory.createJsxElement(opening, children, closingElement), pos); } - else if (opening.kind === 283) { + else if (opening.kind === 286) { result = finishNode(factory.createJsxFragment(opening, parseJsxChildren(opening), parseJsxClosingFragment(inExpressionContext)), pos); } else { - ts.Debug.assert(opening.kind === 279); + ts.Debug.assert(opening.kind === 282); result = opening; } if (inExpressionContext && token() === 29) { @@ -28614,7 +29008,7 @@ var ts; break; list.push(child); if (ts.isJsxOpeningElement(openingTag) - && (child === null || child === void 0 ? void 0 : child.kind) === 278 + && (child === null || child === void 0 ? void 0 : child.kind) === 281 && !tagNamesAreEquivalent(child.openingElement.tagName, child.closingElement.tagName) && tagNamesAreEquivalent(openingTag.tagName, child.closingElement.tagName)) { break; @@ -28839,7 +29233,7 @@ var ts; continue; } if (isTemplateStartOfTaggedTemplate()) { - expression = !questionDotToken && expression.kind === 228 ? + expression = !questionDotToken && expression.kind === 230 ? parseTaggedTemplateRest(pos, expression.expression, questionDotToken, expression.typeArguments) : parseTaggedTemplateRest(pos, expression, questionDotToken, undefined); continue; @@ -28885,7 +29279,7 @@ var ts; } } if (typeArguments || token() === 20) { - if (!questionDotToken && expression.kind === 228) { + if (!questionDotToken && expression.kind === 230) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -28958,7 +29352,7 @@ var ts; return parseArrayLiteralExpression(); case 18: return parseObjectLiteralExpression(); - case 131: + case 132: if (!lookAhead(nextTokenIsFunctionKeywordOnSameLine)) { break; } @@ -29022,11 +29416,11 @@ var ts; } var decorators = parseDecorators(); var modifiers = parseModifiers(); - if (parseContextualModifier(136)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172, 0); + if (parseContextualModifier(137)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 174, 0); } - if (parseContextualModifier(149)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173, 0); + if (parseContextualModifier(151)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 175, 0); } var asteriskToken = parseOptionalToken(41); var tokenIsIdentifier = isIdentifier(); @@ -29099,7 +29493,7 @@ var ts; var expressionPos = getNodePos(); var expression = parseMemberExpressionRest(expressionPos, parsePrimaryExpression(), false); var typeArguments; - if (expression.kind === 228) { + if (expression.kind === 230) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -29196,7 +29590,7 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(97); - var awaitToken = parseOptionalToken(132); + var awaitToken = parseOptionalToken(133); parseExpected(20); var initializer; if (token() !== 26) { @@ -29208,7 +29602,7 @@ var ts; } } var node; - if (awaitToken ? parseExpected(160) : parseOptional(160)) { + if (awaitToken ? parseExpected(162) : parseOptional(162)) { var expression = allowInAnd(function () { return parseAssignmentExpressionOrHigher(true); }); parseExpected(21); node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement()); @@ -29235,10 +29629,10 @@ var ts; function parseBreakOrContinueStatement(kind) { var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(kind === 246 ? 81 : 86); + parseExpected(kind === 249 ? 81 : 86); var label = canParseSemicolon() ? undefined : parseIdentifier(); parseSemicolon(); - var node = kind === 246 + var node = kind === 249 ? factory.createBreakStatement(label) : factory.createContinueStatement(label); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -29393,24 +29787,25 @@ var ts; case 92: return true; case 118: - case 152: + case 154: return nextTokenIsIdentifierOnSameLine(); - case 141: case 142: + case 143: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); case 126: - case 131: - case 135: + case 127: + case 132: + case 136: case 121: case 122: case 123: - case 145: + case 146: nextToken(); if (scanner.hasPrecedingLineBreak()) { return false; } continue; - case 157: + case 159: nextToken(); return token() === 18 || token() === 79 || token() === 93; case 100: @@ -29419,12 +29814,12 @@ var ts; token() === 18 || ts.tokenIsIdentifierOrKeyword(token()); case 93: var currentToken_1 = nextToken(); - if (currentToken_1 === 152) { + if (currentToken_1 === 154) { currentToken_1 = lookAhead(nextToken); } if (currentToken_1 === 63 || currentToken_1 === 41 || currentToken_1 === 18 || currentToken_1 === 88 || - currentToken_1 === 127) { + currentToken_1 === 128) { return true; } continue; @@ -29469,19 +29864,20 @@ var ts; case 85: case 93: return isStartOfDeclaration(); - case 131: - case 135: + case 132: + case 136: case 118: - case 141: case 142: - case 152: - case 157: + case 143: + case 154: + case 159: return true; + case 127: case 123: case 121: case 122: case 124: - case 145: + case 146: return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); default: return isStartOfExpression(); @@ -29520,9 +29916,9 @@ var ts; case 97: return parseForOrForInOrForOfStatement(); case 86: - return parseBreakOrContinueStatement(245); + return parseBreakOrContinueStatement(248); case 81: - return parseBreakOrContinueStatement(246); + return parseBreakOrContinueStatement(249); case 105: return parseReturnStatement(); case 116: @@ -29539,12 +29935,12 @@ var ts; return parseDebuggerStatement(); case 59: return parseDeclaration(); - case 131: + case 132: case 118: - case 152: - case 141: + case 154: case 142: - case 135: + case 143: + case 136: case 85: case 92: case 93: @@ -29553,9 +29949,10 @@ var ts; case 122: case 123: case 126: + case 127: case 124: - case 145: - case 157: + case 146: + case 159: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -29564,7 +29961,7 @@ var ts; return parseExpressionOrLabeledStatement(); } function isDeclareModifier(modifier) { - return modifier.kind === 135; + return modifier.kind === 136; } function parseDeclaration() { var pos = getNodePos(); @@ -29607,13 +30004,13 @@ var ts; return parseClassDeclaration(pos, hasJSDoc, decorators, modifiers); case 118: return parseInterfaceDeclaration(pos, hasJSDoc, decorators, modifiers); - case 152: + case 154: return parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers); case 92: return parseEnumDeclaration(pos, hasJSDoc, decorators, modifiers); - case 157: - case 141: + case 159: case 142: + case 143: return parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers); case 100: return parseImportDeclarationOrImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers); @@ -29623,14 +30020,14 @@ var ts; case 88: case 63: return parseExportAssignment(pos, hasJSDoc, decorators, modifiers); - case 127: + case 128: return parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers); default: return parseExportDeclaration(pos, hasJSDoc, decorators, modifiers); } default: if (decorators || modifiers) { - var missing = createMissingNode(276, true, ts.Diagnostics.Declaration_expected); + var missing = createMissingNode(279, true, ts.Diagnostics.Declaration_expected); ts.setTextRangePos(missing, pos); missing.illegalDecorators = decorators; missing.modifiers = modifiers; @@ -29746,7 +30143,7 @@ var ts; } nextToken(); var declarations; - if (token() === 160 && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 162 && lookAhead(canFollowContextualOfKeyword)) { declarations = createMissingList(); } else { @@ -29772,9 +30169,9 @@ var ts; var modifierFlags = ts.modifiersToFlags(modifiers); parseExpected(98); var asteriskToken = parseOptionalToken(41); - var name = modifierFlags & 512 ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); + var name = modifierFlags & 1024 ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); var isGenerator = asteriskToken ? 1 : 0; - var isAsync = modifierFlags & 256 ? 2 : 0; + var isAsync = modifierFlags & 512 ? 2 : 0; var typeParameters = parseTypeParameters(); if (modifierFlags & 1) setAwaitContext(true); @@ -29787,8 +30184,8 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseConstructorName() { - if (token() === 134) { - return parseExpected(134); + if (token() === 135) { + return parseExpected(135); } if (token() === 10 && lookAhead(nextToken) === 20) { return tryParse(function () { @@ -29846,7 +30243,7 @@ var ts; var parameters = parseParameters(0); var type = parseReturnType(58, false); var body = parseFunctionBlockOrSemicolon(flags); - var node = kind === 172 + var node = kind === 174 ? factory.createGetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, type, body) : factory.createSetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, body); node.typeParameters = typeParameters; @@ -29877,7 +30274,7 @@ var ts; return true; } if (idToken !== undefined) { - if (!ts.isKeyword(idToken) || idToken === 149 || idToken === 136) { + if (!ts.isKeyword(idToken) || idToken === 151 || idToken === 137) { return true; } switch (token()) { @@ -29913,7 +30310,7 @@ var ts; return body; } function parseDecoratorExpression() { - if (inAwaitContext() && token() === 132) { + if (inAwaitContext() && token() === 133) { var pos = getNodePos(); var awaitExpression = parseIdentifier(ts.Diagnostics.Expression_expected); nextToken(); @@ -29980,10 +30377,10 @@ var ts; } function parseModifiersForArrowFunction() { var modifiers; - if (token() === 131) { + if (token() === 132) { var pos = getNodePos(); nextToken(); - var modifier = finishNode(factory.createToken(131), pos); + var modifier = finishNode(factory.createToken(132), pos); modifiers = createNodeArray([modifier], pos); } return modifiers; @@ -30000,13 +30397,13 @@ var ts; if (token() === 124 && lookAhead(nextTokenIsOpenBrace)) { return parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers); } - if (parseContextualModifier(136)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172, 0); + if (parseContextualModifier(137)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 174, 0); } - if (parseContextualModifier(149)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173, 0); + if (parseContextualModifier(151)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 175, 0); } - if (token() === 134 || token() === 10) { + if (token() === 135 || token() === 10) { var constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers); if (constructorDeclaration) { return constructorDeclaration; @@ -30039,10 +30436,10 @@ var ts; return ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), undefined, undefined, 226); + return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), undefined, undefined, 228); } function parseClassDeclaration(pos, hasJSDoc, decorators, modifiers) { - return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 257); + return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 260); } function parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, kind) { var savedAwaitContext = inAwaitContext(); @@ -30061,7 +30458,7 @@ var ts; members = createMissingList(); } setAwaitContext(savedAwaitContext); - var node = kind === 257 + var node = kind === 260 ? factory.createClassDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members) : factory.createClassExpression(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -30091,7 +30488,7 @@ var ts; function parseExpressionWithTypeArguments() { var pos = getNodePos(); var expression = parseLeftHandSideExpressionOrHigher(); - if (expression.kind === 228) { + if (expression.kind === 230) { return expression; } var typeArguments = tryParseTypeArguments(); @@ -30118,11 +30515,11 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers) { - parseExpected(152); + parseExpected(154); var name = parseIdentifier(); var typeParameters = parseTypeParameters(); parseExpected(63); - var type = token() === 138 && tryParse(parseKeywordAndNoDot) || parseType(); + var type = token() === 139 && tryParse(parseKeywordAndNoDot) || parseType(); parseSemicolon(); var node = factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type); node.illegalDecorators = decorators; @@ -30175,7 +30572,7 @@ var ts; function parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { var flags = 0; var name; - if (token() === 157) { + if (token() === 159) { name = parseIdentifier(); flags |= 1024; } @@ -30196,14 +30593,14 @@ var ts; } function parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { var flags = 0; - if (token() === 157) { + if (token() === 159) { return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); } - else if (parseOptional(142)) { + else if (parseOptional(143)) { flags |= 16; } else { - parseExpected(141); + parseExpected(142); if (token() === 10) { return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); } @@ -30211,7 +30608,7 @@ var ts; return parseModuleOrNamespaceDeclaration(pos, hasJSDoc, decorators, modifiers, flags); } function isExternalModuleReference() { - return token() === 146 && + return token() === 147 && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { @@ -30224,8 +30621,8 @@ var ts; return nextToken() === 43; } function parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers) { - parseExpected(127); - parseExpected(142); + parseExpected(128); + parseExpected(143); var name = parseIdentifier(); parseSemicolon(); var node = factory.createNamespaceExportDeclaration(name); @@ -30241,7 +30638,7 @@ var ts; identifier = parseIdentifier(); } var isTypeOnly = false; - if (token() !== 156 && + if (token() !== 158 && (identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) === "type" && (isIdentifier() || tokenAfterImportDefinitelyProducesImportDeclaration())) { isTypeOnly = true; @@ -30255,11 +30652,11 @@ var ts; token() === 41 || token() === 18) { importClause = parseImportClause(identifier, afterImportPos, isTypeOnly); - parseExpected(156); + parseExpected(158); } var moduleSpecifier = parseModuleSpecifier(); var assertClause; - if (token() === 129 && !scanner.hasPrecedingLineBreak()) { + if (token() === 130 && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -30277,7 +30674,7 @@ var ts; function parseAssertClause(skipAssertKeyword) { var pos = getNodePos(); if (!skipAssertKeyword) { - parseExpected(129); + parseExpected(130); } var openBracePosition = scanner.getTokenPos(); if (parseExpected(18)) { @@ -30300,7 +30697,7 @@ var ts; return token() === 41 || token() === 18; } function tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration() { - return token() === 27 || token() === 156; + return token() === 27 || token() === 158; } function parseImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers, identifier, isTypeOnly) { parseExpected(63); @@ -30315,7 +30712,7 @@ var ts; var namedBindings; if (!identifier || parseOptional(27)) { - namedBindings = token() === 41 ? parseNamespaceImport() : parseNamedImportsOrExports(269); + namedBindings = token() === 41 ? parseNamespaceImport() : parseNamedImportsOrExports(272); } return finishNode(factory.createImportClause(isTypeOnly, identifier, namedBindings), pos); } @@ -30326,7 +30723,7 @@ var ts; } function parseExternalModuleReference() { var pos = getNodePos(); - parseExpected(146); + parseExpected(147); parseExpected(20); var expression = parseModuleSpecifier(); parseExpected(21); @@ -30345,23 +30742,23 @@ var ts; function parseNamespaceImport() { var pos = getNodePos(); parseExpected(41); - parseExpected(127); + parseExpected(128); var name = parseIdentifier(); return finishNode(factory.createNamespaceImport(name), pos); } function parseNamedImportsOrExports(kind) { var pos = getNodePos(); - var node = kind === 269 + var node = kind === 272 ? factory.createNamedImports(parseBracketedList(23, parseImportSpecifier, 18, 19)) : factory.createNamedExports(parseBracketedList(23, parseExportSpecifier, 18, 19)); return finishNode(node, pos); } function parseExportSpecifier() { var hasJSDoc = hasPrecedingJSDocComment(); - return withJSDoc(parseImportOrExportSpecifier(275), hasJSDoc); + return withJSDoc(parseImportOrExportSpecifier(278), hasJSDoc); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(270); + return parseImportOrExportSpecifier(273); } function parseImportOrExportSpecifier(kind) { var pos = getNodePos(); @@ -30373,9 +30770,9 @@ var ts; var canParseAsKeyword = true; var name = parseIdentifierName(); if (name.escapedText === "type") { - if (token() === 127) { + if (token() === 128) { var firstAs = parseIdentifierName(); - if (token() === 127) { + if (token() === 128) { var secondAs = parseIdentifierName(); if (ts.tokenIsIdentifierOrKeyword(token())) { isTypeOnly = true; @@ -30404,15 +30801,15 @@ var ts; name = parseNameWithKeywordCheck(); } } - if (canParseAsKeyword && token() === 127) { + if (canParseAsKeyword && token() === 128) { propertyName = name; - parseExpected(127); + parseExpected(128); name = parseNameWithKeywordCheck(); } - if (kind === 270 && checkIdentifierIsKeyword) { + if (kind === 273 && checkIdentifierIsKeyword) { parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected); } - var node = kind === 270 + var node = kind === 273 ? factory.createImportSpecifier(isTypeOnly, propertyName, name) : factory.createExportSpecifier(isTypeOnly, propertyName, name); return finishNode(node, pos); @@ -30432,23 +30829,23 @@ var ts; var exportClause; var moduleSpecifier; var assertClause; - var isTypeOnly = parseOptional(152); + var isTypeOnly = parseOptional(154); var namespaceExportPos = getNodePos(); if (parseOptional(41)) { - if (parseOptional(127)) { + if (parseOptional(128)) { exportClause = parseNamespaceExport(namespaceExportPos); } - parseExpected(156); + parseExpected(158); moduleSpecifier = parseModuleSpecifier(); } else { - exportClause = parseNamedImportsOrExports(273); - if (token() === 156 || (token() === 10 && !scanner.hasPrecedingLineBreak())) { - parseExpected(156); + exportClause = parseNamedImportsOrExports(276); + if (token() === 158 || (token() === 10 && !scanner.hasPrecedingLineBreak())) { + parseExpected(158); moduleSpecifier = parseModuleSpecifier(); } } - if (moduleSpecifier && token() === 129 && !scanner.hasPrecedingLineBreak()) { + if (moduleSpecifier && token() === 130 && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -30981,9 +31378,9 @@ var ts; } function isObjectOrObjectArrayTypeReference(node) { switch (node.kind) { - case 148: + case 149: return true; - case 183: + case 185: return isObjectOrObjectArrayTypeReference(node.elementType); default: return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && !node.typeArguments; @@ -31015,12 +31412,12 @@ var ts; var child = void 0; var children = void 0; while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) { - if (child.kind === 340 || child.kind === 347) { + if (child.kind === 343 || child.kind === 350) { children = ts.append(children, child); } } if (children) { - var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 183), pos); + var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 185), pos); return finishNode(factory.createJSDocTypeExpression(literal), pos); } } @@ -31138,7 +31535,7 @@ var ts; var hasChildren = false; while (child = tryParse(function () { return parseChildPropertyTag(indent); })) { hasChildren = true; - if (child.kind === 343) { + if (child.kind === 346) { if (childTypeTag) { var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); if (lastError) { @@ -31155,7 +31552,7 @@ var ts; } } if (hasChildren) { - var isArrayType = typeExpression && typeExpression.type.kind === 183; + var isArrayType = typeExpression && typeExpression.type.kind === 185; var jsdocTypeLiteral = factory.createJSDocTypeLiteral(jsDocPropertyTags, isArrayType); typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ? childTypeTag.typeExpression : @@ -31205,7 +31602,7 @@ var ts; var returnTag = tryParse(function () { if (parseOptionalJsdoc(59)) { var tag = parseTag(indent); - if (tag && tag.kind === 341) { + if (tag && tag.kind === 344) { return tag; } } @@ -31240,7 +31637,7 @@ var ts; case 59: if (canParseTag) { var child = tryParseChildTag(target, indent); - if (child && (child.kind === 340 || child.kind === 347) && + if (child && (child.kind === 343 || child.kind === 350) && target !== 4 && name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; @@ -31982,6 +32379,7 @@ var ts; ["es2019.object", "lib.es2019.object.d.ts"], ["es2019.string", "lib.es2019.string.d.ts"], ["es2019.symbol", "lib.es2019.symbol.d.ts"], + ["es2019.intl", "lib.es2019.intl.d.ts"], ["es2020.bigint", "lib.es2020.bigint.d.ts"], ["es2020.date", "lib.es2020.date.d.ts"], ["es2020.promise", "lib.es2020.promise.d.ts"], @@ -32088,6 +32486,7 @@ var ts; shortName: "h", type: "boolean", showInSimplifiedHelpView: true, + isCommandLineOnly: true, category: ts.Diagnostics.Command_line_Options, description: ts.Diagnostics.Print_this_message, defaultValueDescription: false, @@ -32096,6 +32495,8 @@ var ts; name: "help", shortName: "?", type: "boolean", + isCommandLineOnly: true, + category: ts.Diagnostics.Command_line_Options, defaultValueDescription: false, }, { @@ -33748,7 +34149,7 @@ var ts; var _a; var rootExpression = (_a = sourceFile.statements[0]) === null || _a === void 0 ? void 0 : _a.expression; var knownRootOptions = reportOptionsErrors ? getTsconfigRootOptionsMap() : undefined; - if (rootExpression && rootExpression.kind !== 205) { + if (rootExpression && rootExpression.kind !== 207) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, rootExpression, ts.Diagnostics.The_root_value_of_a_0_file_must_be_an_object, ts.getBaseFileName(sourceFile.fileName) === "jsconfig.json" ? "jsconfig.json" : "tsconfig.json")); if (ts.isArrayLiteralExpression(rootExpression)) { var firstObject = ts.find(rootExpression.elements, ts.isObjectLiteralExpression); @@ -33776,7 +34177,7 @@ var ts; function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) { var result = returnValue ? {} : undefined; var _loop_4 = function (element) { - if (element.kind !== 296) { + if (element.kind !== 299) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); return "continue"; } @@ -33863,13 +34264,13 @@ var ts; case 8: reportInvalidOptionValue(option && option.type !== "number"); return validateValue(Number(valueExpression.text)); - case 219: + case 221: if (valueExpression.operator !== 40 || valueExpression.operand.kind !== 8) { break; } reportInvalidOptionValue(option && option.type !== "number"); return validateValue(-Number(valueExpression.operand.text)); - case 205: + case 207: reportInvalidOptionValue(option && option.type !== "object"); var objectLiteralExpression = valueExpression; if (option) { @@ -33879,7 +34280,7 @@ var ts; else { return validateValue(convertObjectLiteralExpressionToJson(objectLiteralExpression, undefined, undefined, undefined)); } - case 204: + case 206: reportInvalidOptionValue(option && option.type !== "list"); return validateValue(convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element)); } @@ -34873,7 +35274,7 @@ var ts; function convertCompilerOptionsForTelemetry(opts) { var out = {}; for (var key in opts) { - if (opts.hasOwnProperty(key)) { + if (ts.hasProperty(opts, key)) { var type = getOptionFromName(key); if (type !== undefined) { out[key] = getOptionValueWithEmptyStrings(opts[key], type); @@ -34938,7 +35339,7 @@ var ts; function withPackageId(packageInfo, r) { var packageId; if (r && packageInfo) { - var packageJsonContent = packageInfo.packageJsonContent; + var packageJsonContent = packageInfo.contents.packageJsonContent; if (typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string") { packageId = { name: packageJsonContent.name, @@ -36067,13 +36468,13 @@ var ts; function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson) { if (considerPackageJson === void 0) { considerPackageJson = true; } var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : undefined; - var packageJsonContent = packageInfo && packageInfo.packageJsonContent; - var versionPaths = packageInfo && packageInfo.versionPaths; + var packageJsonContent = packageInfo && packageInfo.contents.packageJsonContent; + var versionPaths = packageInfo && packageInfo.contents.versionPaths; return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths)); } function getEntrypointsFromPackageJsonInfo(packageJsonInfo, options, host, cache, resolveJs) { - if (!resolveJs && packageJsonInfo.resolvedEntrypoints !== undefined) { - return packageJsonInfo.resolvedEntrypoints; + if (!resolveJs && packageJsonInfo.contents.resolvedEntrypoints !== undefined) { + return packageJsonInfo.contents.resolvedEntrypoints; } var entrypoints; var extensions = resolveJs ? Extensions.JavaScript : Extensions.TypeScript; @@ -36081,13 +36482,13 @@ var ts; var requireState = getTemporaryModuleResolutionState(cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(), host, options); requireState.conditions = ["node", "require", "types"]; requireState.requestContainingDirectory = packageJsonInfo.packageDirectory; - var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory, false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths); + var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory, false, requireState, packageJsonInfo.contents.packageJsonContent, packageJsonInfo.contents.versionPaths); entrypoints = ts.append(entrypoints, requireResolution === null || requireResolution === void 0 ? void 0 : requireResolution.path); - if (features & NodeResolutionFeatures.Exports && packageJsonInfo.packageJsonContent.exports) { + if (features & NodeResolutionFeatures.Exports && packageJsonInfo.contents.packageJsonContent.exports) { for (var _i = 0, _a = [["node", "import", "types"], ["node", "require", "types"]]; _i < _a.length; _i++) { var conditions = _a[_i]; var exportState = __assign(__assign({}, requireState), { failedLookupLocations: [], conditions: conditions }); - var exportResolutions = loadEntrypointsFromExportMap(packageJsonInfo, packageJsonInfo.packageJsonContent.exports, exportState, extensions); + var exportResolutions = loadEntrypointsFromExportMap(packageJsonInfo, packageJsonInfo.contents.packageJsonContent.exports, exportState, extensions); if (exportResolutions) { for (var _b = 0, exportResolutions_1 = exportResolutions; _b < exportResolutions_1.length; _b++) { var resolution = exportResolutions_1[_b]; @@ -36096,7 +36497,7 @@ var ts; } } } - return packageJsonInfo.resolvedEntrypoints = entrypoints || false; + return packageJsonInfo.contents.resolvedEntrypoints = entrypoints || false; } ts.getEntrypointsFromPackageJsonInfo = getEntrypointsFromPackageJsonInfo; function loadEntrypointsFromExportMap(scope, exports, state, extensions) { @@ -36192,7 +36593,9 @@ var ts; if (traceEnabled) trace(host, ts.Diagnostics.File_0_exists_according_to_earlier_cached_lookups, packageJsonPath); state.affectingLocations.push(packageJsonPath); - return existing; + return existing.packageDirectory === packageDirectory ? + existing : + { packageDirectory: packageDirectory, contents: existing.contents }; } else { if (existing && traceEnabled) @@ -36208,7 +36611,7 @@ var ts; trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); } var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state); - var result = { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined }; + var result = { packageDirectory: packageDirectory, contents: { packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined } }; (_b = state.packageJsonInfoCache) === null || _b === void 0 ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result); state.affectingLocations.push(packageJsonPath); return result; @@ -36320,17 +36723,16 @@ var ts; } function loadModuleFromSelfNameReference(extensions, moduleName, directory, state, cache, redirectedReference) { var _a, _b; - var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames; - var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames)); + var directoryPath = ts.getNormalizedAbsolutePath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)); var scope = getPackageScopeForPath(directoryPath, state); - if (!scope || !scope.packageJsonContent.exports) { + if (!scope || !scope.contents.packageJsonContent.exports) { return undefined; } - if (typeof scope.packageJsonContent.name !== "string") { + if (typeof scope.contents.packageJsonContent.name !== "string") { return undefined; } var parts = ts.getPathComponents(moduleName); - var nameParts = ts.getPathComponents(scope.packageJsonContent.name); + var nameParts = ts.getPathComponents(scope.contents.packageJsonContent.name); if (!ts.every(nameParts, function (p, i) { return parts[i] === p; })) { return undefined; } @@ -36338,30 +36740,30 @@ var ts; return loadModuleFromExports(scope, extensions, !ts.length(trailingParts) ? "." : ".".concat(ts.directorySeparator).concat(trailingParts.join(ts.directorySeparator)), state, cache, redirectedReference); } function loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference) { - if (!scope.packageJsonContent.exports) { + if (!scope.contents.packageJsonContent.exports) { return undefined; } if (subpath === ".") { var mainExport = void 0; - if (typeof scope.packageJsonContent.exports === "string" || Array.isArray(scope.packageJsonContent.exports) || (typeof scope.packageJsonContent.exports === "object" && noKeyStartsWithDot(scope.packageJsonContent.exports))) { - mainExport = scope.packageJsonContent.exports; + if (typeof scope.contents.packageJsonContent.exports === "string" || Array.isArray(scope.contents.packageJsonContent.exports) || (typeof scope.contents.packageJsonContent.exports === "object" && noKeyStartsWithDot(scope.contents.packageJsonContent.exports))) { + mainExport = scope.contents.packageJsonContent.exports; } - else if (ts.hasProperty(scope.packageJsonContent.exports, ".")) { - mainExport = scope.packageJsonContent.exports["."]; + else if (ts.hasProperty(scope.contents.packageJsonContent.exports, ".")) { + mainExport = scope.contents.packageJsonContent.exports["."]; } if (mainExport) { var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, subpath, scope, false); return loadModuleFromTargetImportOrExport(mainExport, "", false); } } - else if (allKeysStartWithDot(scope.packageJsonContent.exports)) { - if (typeof scope.packageJsonContent.exports !== "object") { + else if (allKeysStartWithDot(scope.contents.packageJsonContent.exports)) { + if (typeof scope.contents.packageJsonContent.exports !== "object") { if (state.traceEnabled) { trace(state.host, ts.Diagnostics.Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1, subpath, scope.packageDirectory); } return toSearchResult(undefined); } - var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, subpath, scope.packageJsonContent.exports, scope, false); + var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, subpath, scope.contents.packageJsonContent.exports, scope, false); if (result) { return result; } @@ -36379,8 +36781,7 @@ var ts; } return toSearchResult(undefined); } - var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames; - var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames)); + var directoryPath = ts.getNormalizedAbsolutePath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)); var scope = getPackageScopeForPath(directoryPath, state); if (!scope) { if (state.traceEnabled) { @@ -36388,13 +36789,13 @@ var ts; } return toSearchResult(undefined); } - if (!scope.packageJsonContent.imports) { + if (!scope.contents.packageJsonContent.imports) { if (state.traceEnabled) { trace(state.host, ts.Diagnostics.package_json_scope_0_has_no_imports_defined, scope.packageDirectory); } return toSearchResult(undefined); } - var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, scope.packageJsonContent.imports, scope, true); + var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, scope.contents.packageJsonContent.imports, scope, true); if (result) { return result; } @@ -36691,20 +37092,20 @@ var ts; if (fromFile) { return noPackageId(fromFile); } - var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.packageJsonContent, packageInfo.versionPaths); + var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.contents.packageJsonContent, packageInfo.contents.versionPaths); 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.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { + 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.packageJsonContent, packageInfo && packageInfo.versionPaths); + loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths); if (!pathAndExtension && packageInfo - && (packageInfo.packageJsonContent.exports === undefined || packageInfo.packageJsonContent.exports === null) + && (packageInfo.contents.packageJsonContent.exports === undefined || packageInfo.contents.packageJsonContent.exports === null) && state.features & NodeResolutionFeatures.EsmMode) { pathAndExtension = loadModuleFromFile(extensions, ts.combinePaths(candidate, "index.js"), onlyRecordFailures, state); } @@ -36713,12 +37114,12 @@ var ts; if (rest !== "") { var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state); - if (packageInfo && packageInfo.versionPaths) { + 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.versionPaths.version, ts.version, rest); + 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.versionPaths.paths, undefined, loader, !packageDirectoryExists, state); + var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, undefined, loader, !packageDirectoryExists, state); if (fromPaths) { return fromPaths.value; } @@ -36899,23 +37300,23 @@ var ts; } function getModuleInstanceStateWorker(node, visited) { switch (node.kind) { - case 258: - case 259: + case 261: + case 262: return 0; - case 260: + case 263: if (ts.isEnumConst(node)) { return 2; } break; - case 266: - case 265: + case 269: + case 268: if (!(ts.hasSyntacticModifier(node, 1))) { return 0; } break; - case 272: + case 275: var exportDeclaration = node; - if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 273) { + if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 276) { var state = 0; for (var _i = 0, _a = exportDeclaration.exportClause.elements; _i < _a.length; _i++) { var specifier = _a[_i]; @@ -36930,7 +37331,7 @@ var ts; return state; } break; - case 262: { + case 265: { var state_1 = 0; ts.forEachChild(node, function (n) { var childState = getModuleInstanceStateCached(n, visited); @@ -36949,7 +37350,7 @@ var ts; }); return state_1; } - case 261: + case 264: return getModuleInstanceState(node, visited); case 79: if (node.isInJSDocNamespace) { @@ -37107,7 +37508,7 @@ var ts; } } function getDeclarationName(node) { - if (node.kind === 271) { + if (node.kind === 274) { return node.isExportEquals ? "export=" : "default"; } var name = ts.getNameOfDeclaration(node); @@ -37116,7 +37517,7 @@ var ts; var moduleName = ts.getTextOfIdentifierOrLiteral(name); return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"".concat(moduleName, "\"")); } - if (name.kind === 162) { + if (name.kind === 164) { var nameExpression = name.expression; if (ts.isStringOrNumericLiteralLike(nameExpression)) { return ts.escapeLeadingUnderscores(nameExpression.text); @@ -37139,31 +37540,31 @@ var ts; return ts.isPropertyNameLiteral(name) ? ts.getEscapedTextOfIdentifierOrLiteral(name) : undefined; } switch (node.kind) { - case 171: + case 173: return "__constructor"; - case 179: - case 174: - case 323: - return "__call"; - case 180: - case 175: - return "__new"; + case 181: case 176: + case 326: + return "__call"; + case 182: + case 177: + return "__new"; + case 178: return "__index"; - case 272: + case 275: return "__export"; - case 305: + case 308: return "export="; - case 221: + case 223: if (ts.getAssignmentDeclarationKind(node) === 2) { return "export="; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 317: + case 320: return (ts.isJSDocConstructSignature(node) ? "__new" : "__call"); - case 164: - ts.Debug.assert(node.parent.kind === 317, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); }); + case 166: + ts.Debug.assert(node.parent.kind === 320, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); }); var functionType = node.parent; var index = functionType.parameters.indexOf(node); return "arg" + index; @@ -37174,7 +37575,7 @@ var ts; } function declareSymbol(symbolTable, parent, node, includes, excludes, isReplaceableByMethod, isComputedName) { ts.Debug.assert(isComputedName || !ts.hasDynamicName(node)); - var isDefaultExport = ts.hasSyntacticModifier(node, 512) || ts.isExportSpecifier(node) && node.name.escapedText === "default"; + var isDefaultExport = ts.hasSyntacticModifier(node, 1024) || ts.isExportSpecifier(node) && node.name.escapedText === "default"; var name = isComputedName ? "__computed" : isDefaultExport && parent ? "default" : getDeclarationName(node); @@ -37220,7 +37621,7 @@ var ts; } else { if (symbol.declarations && symbol.declarations.length && - (node.kind === 271 && !node.isExportEquals)) { + (node.kind === 274 && !node.isExportEquals)) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; messageNeedsName_1 = false; multipleDefaultExports_1 = true; @@ -37258,7 +37659,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = !!(ts.getCombinedModifierFlags(node) & 1) || jsdocTreatAsExported(node); if (symbolFlags & 2097152) { - if (node.kind === 275 || (node.kind === 265 && hasExportModifier)) { + if (node.kind === 278 || (node.kind === 268 && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -37269,7 +37670,7 @@ var ts; if (ts.isJSDocTypeAlias(node)) ts.Debug.assert(ts.isInJSFile(node)); if (!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 64)) { - if (!container.locals || (ts.hasSyntacticModifier(node, 512) && !getDeclarationName(node))) { + if (!container.locals || (ts.hasSyntacticModifier(node, 1024) && !getDeclarationName(node))) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } var exportKind = symbolFlags & 111551 ? 1048576 : 0; @@ -37305,7 +37706,7 @@ var ts; var saveThisParentContainer = thisParentContainer; var savedBlockScopeContainer = blockScopeContainer; if (containerFlags & 1) { - if (node.kind !== 214) { + if (node.kind !== 216) { thisParentContainer = container; } container = blockScopeContainer = node; @@ -37327,17 +37728,17 @@ var ts; var saveActiveLabelList = activeLabelList; var saveHasExplicitReturn = hasExplicitReturn; var isImmediatelyInvoked = (containerFlags & 16 && - !ts.hasSyntacticModifier(node, 256) && + !ts.hasSyntacticModifier(node, 512) && !node.asteriskToken && !!ts.getImmediatelyInvokedFunctionExpression(node)) || - node.kind === 170; + node.kind === 172; if (!isImmediatelyInvoked) { currentFlow = initFlowNode({ flags: 2 }); if (containerFlags & (16 | 128)) { currentFlow.node = node; } } - currentReturnTarget = isImmediatelyInvoked || node.kind === 171 || (ts.isInJSFile(node) && (node.kind === 256 || node.kind === 213)) ? createBranchLabel() : undefined; + currentReturnTarget = isImmediatelyInvoked || node.kind === 173 || (ts.isInJSFile(node) && (node.kind === 259 || node.kind === 215)) ? createBranchLabel() : undefined; currentExceptionTarget = undefined; currentBreakTarget = undefined; currentContinueTarget = undefined; @@ -37351,14 +37752,14 @@ var ts; node.flags |= 512; node.endFlowNode = currentFlow; } - if (node.kind === 305) { + if (node.kind === 308) { node.flags |= emitFlags; node.endFlowNode = currentFlow; } if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); currentFlow = finishFlowLabel(currentReturnTarget); - if (node.kind === 171 || node.kind === 170 || (ts.isInJSFile(node) && (node.kind === 256 || node.kind === 213))) { + if (node.kind === 173 || node.kind === 172 || (ts.isInJSFile(node) && (node.kind === 259 || node.kind === 215))) { node.returnFlowNode = currentFlow; } } @@ -37385,8 +37786,8 @@ var ts; blockScopeContainer = savedBlockScopeContainer; } function bindEachFunctionsFirst(nodes) { - bindEach(nodes, function (n) { return n.kind === 256 ? bind(n) : undefined; }); - bindEach(nodes, function (n) { return n.kind !== 256 ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind === 259 ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind !== 259 ? bind(n) : undefined; }); } function bindEach(nodes, bindFunction) { if (bindFunction === void 0) { bindFunction = bind; } @@ -37407,59 +37808,59 @@ var ts; inAssignmentPattern = saveInAssignmentPattern; return; } - if (node.kind >= 237 && node.kind <= 253 && !options.allowUnreachableCode) { + if (node.kind >= 240 && node.kind <= 256 && !options.allowUnreachableCode) { node.flowNode = currentFlow; } switch (node.kind) { - case 241: + case 244: bindWhileStatement(node); break; - case 240: + case 243: bindDoStatement(node); break; - case 242: + case 245: bindForStatement(node); break; - case 243: - case 244: + case 246: + case 247: bindForInOrForOfStatement(node); break; - case 239: + case 242: bindIfStatement(node); break; - case 247: - case 251: + case 250: + case 254: bindReturnOrThrow(node); break; - case 246: - case 245: + case 249: + case 248: bindBreakOrContinueStatement(node); break; - case 252: + case 255: bindTryStatement(node); break; - case 249: + case 252: bindSwitchStatement(node); break; - case 263: + case 266: bindCaseBlock(node); break; - case 289: + case 292: bindCaseClause(node); break; - case 238: + case 241: bindExpressionStatement(node); break; - case 250: + case 253: bindLabeledStatement(node); break; - case 219: + case 221: bindPrefixUnaryExpressionFlow(node); break; - case 220: + case 222: bindPostfixUnaryExpressionFlow(node); break; - case 221: + case 223: if (ts.isDestructuringAssignment(node)) { inAssignmentPattern = saveInAssignmentPattern; bindDestructuringAssignmentFlow(node); @@ -37467,46 +37868,49 @@ var ts; } bindBinaryExpressionFlow(node); break; - case 215: + case 217: bindDeleteExpressionFlow(node); break; - case 222: + case 224: bindConditionalExpressionFlow(node); break; - case 254: + case 257: bindVariableDeclarationFlow(node); break; - case 206: - case 207: + case 208: + case 209: bindAccessExpressionFlow(node); break; - case 208: + case 210: bindCallExpressionFlow(node); break; - case 230: + case 232: bindNonNullExpressionFlow(node); break; - case 345: - case 338: - case 339: + case 348: + case 341: + case 342: bindJSDocTypeAlias(node); break; - case 305: { + case 308: { bindEachFunctionsFirst(node.statements); bind(node.endOfFileToken); break; } - case 235: - case 262: + case 238: + case 265: bindEachFunctionsFirst(node.statements); break; - case 203: + case 205: bindBindingElementFlow(node); break; - case 205: - case 204: - case 296: - case 225: + case 166: + bindParameterFlow(node); + break; + case 207: + case 206: + case 299: + case 227: inAssignmentPattern = saveInAssignmentPattern; default: bindEachChild(node); @@ -37520,19 +37924,19 @@ var ts; case 79: case 80: case 108: - case 206: - case 207: - return containsNarrowableReference(expr); case 208: + case 209: + return containsNarrowableReference(expr); + case 210: return hasNarrowableArgument(expr); - case 212: - case 230: + case 214: + case 232: return isNarrowingExpression(expr.expression); - case 221: + case 223: return isNarrowingBinaryExpression(expr); - case 219: + case 221: return expr.operator === 53 && isNarrowingExpression(expr.operand); - case 216: + case 218: return isNarrowingExpression(expr.expression); } return false; @@ -37556,7 +37960,7 @@ var ts; } } } - if (expr.expression.kind === 206 && + if (expr.expression.kind === 208 && containsNarrowableReference(expr.expression.expression)) { return true; } @@ -37589,9 +37993,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 212: + case 214: return isNarrowableOperand(expr.expression); - case 221: + case 223: switch (expr.operatorToken.kind) { case 63: return isNarrowableOperand(expr.left); @@ -37666,26 +38070,26 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 239: - case 241: - case 240: - return parent.expression === node; case 242: - case 222: + case 244: + case 243: + return parent.expression === node; + case 245: + case 224: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 212) { + if (node.kind === 214) { node = node.expression; } - else if (node.kind === 219 && node.operator === 53) { + else if (node.kind === 221 && node.operator === 53) { node = node.operand; } else { - return node.kind === 221 && (node.operatorToken.kind === 55 || + return node.kind === 223 && (node.operatorToken.kind === 55 || node.operatorToken.kind === 56 || node.operatorToken.kind === 60); } @@ -37731,7 +38135,7 @@ var ts; } function setContinueTarget(node, target) { var label = activeLabelList; - while (label && node.parent.kind === 250) { + while (label && node.parent.kind === 253) { label.continueTarget = target; label = label.next; node = node.parent; @@ -37782,12 +38186,12 @@ var ts; bind(node.expression); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; - if (node.kind === 244) { + if (node.kind === 247) { bind(node.awaitModifier); } addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 255) { + if (node.initializer.kind !== 258) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -37809,7 +38213,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 247) { + if (node.kind === 250) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -37826,7 +38230,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 246 ? breakTarget : continueTarget; + var flowLabel = node.kind === 249 ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -37899,7 +38303,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 290; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 293; }); node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; if (!hasDefault) { addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0)); @@ -37942,7 +38346,7 @@ var ts; maybeBindExpressionFlowIfCall(node.expression); } function maybeBindExpressionFlowIfCall(node) { - if (node.kind === 208) { + if (node.kind === 210) { var call = node; if (call.expression.kind !== 106 && ts.isDottedName(call.expression)) { currentFlow = createFlowCall(currentFlow, call); @@ -37968,7 +38372,7 @@ var ts; currentFlow = finishFlowLabel(postStatementLabel); } function bindDestructuringTargetFlow(node) { - if (node.kind === 221 && node.operatorToken.kind === 63) { + if (node.kind === 223 && node.operatorToken.kind === 63) { bindAssignmentTargetFlow(node.left); } else { @@ -37979,10 +38383,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowMutation(16, currentFlow, node); } - else if (node.kind === 204) { + else if (node.kind === 206) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 225) { + if (e.kind === 227) { bindAssignmentTargetFlow(e.expression); } else { @@ -37990,16 +38394,16 @@ var ts; } } } - else if (node.kind === 205) { + else if (node.kind === 207) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 296) { + if (p.kind === 299) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 297) { + else if (p.kind === 300) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 298) { + else if (p.kind === 301) { bindAssignmentTargetFlow(p.expression); } } @@ -38131,7 +38535,7 @@ var ts; var operator = node.operatorToken.kind; if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 63 && node.left.kind === 207) { + if (operator === 63 && node.left.kind === 209) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowMutation(256, currentFlow, node); @@ -38159,7 +38563,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 206) { + if (node.expression.kind === 208) { bindAssignmentTargetFlow(node.expression); } } @@ -38197,19 +38601,36 @@ var ts; } } function bindBindingElementFlow(node) { - if (ts.isBindingPattern(node.name)) { - bind(node.dotDotDotToken); - bind(node.propertyName); - bind(node.initializer); - bind(node.name); + bind(node.dotDotDotToken); + bind(node.propertyName); + bindInitializer(node.initializer); + bind(node.name); + } + function bindParameterFlow(node) { + bindEach(node.modifiers); + bind(node.dotDotDotToken); + bind(node.questionToken); + bind(node.type); + bindInitializer(node.initializer); + bind(node.name); + } + function bindInitializer(node) { + if (!node) { + return; } - else { - bindEachChild(node); + var entryFlow = currentFlow; + bind(node); + if (entryFlow === unreachableFlow || entryFlow === currentFlow) { + return; } + var exitFlow = createBranchLabel(); + addAntecedent(exitFlow, entryFlow); + addAntecedent(exitFlow, currentFlow); + currentFlow = finishFlowLabel(exitFlow); } function bindJSDocTypeAlias(node) { bind(node.tagName); - if (node.kind !== 339 && node.fullName) { + if (node.kind !== 342 && node.fullName) { ts.setParent(node.fullName, node); ts.setParentRecursive(node.fullName, false); } @@ -38220,7 +38641,7 @@ var ts; function bindJSDocClassTag(node) { bindEachChild(node); var host = ts.getHostSignatureFromJSDoc(node); - if (host && host.kind !== 169) { + if (host && host.kind !== 171) { addDeclarationToSymbol(host.symbol, host, 32); } } @@ -38233,15 +38654,15 @@ var ts; } function bindOptionalChainRest(node) { switch (node.kind) { - case 206: + case 208: bind(node.questionDotToken); bind(node.name); break; - case 207: + case 209: bind(node.questionDotToken); bind(node.argumentExpression); break; - case 208: + case 210: bind(node.questionDotToken); bindEach(node.typeArguments); bindEach(node.arguments); @@ -38292,7 +38713,7 @@ var ts; } else { var expr = ts.skipParentheses(node.expression); - if (expr.kind === 213 || expr.kind === 214) { + if (expr.kind === 215 || expr.kind === 216) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -38304,7 +38725,7 @@ var ts; } } } - if (node.expression.kind === 206) { + if (node.expression.kind === 208) { var propertyAccess = node.expression; if (ts.isIdentifier(propertyAccess.name) && isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowMutation(256, currentFlow, node); @@ -38313,54 +38734,54 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 226: - case 257: + case 228: case 260: - case 205: - case 182: - case 322: - case 286: + case 263: + case 207: + case 184: + case 325: + case 289: return 1; - case 258: - return 1 | 64; case 261: - case 259: - case 195: - case 176: + return 1 | 64; + case 264: + case 262: + case 197: + case 178: return 1 | 32; - case 305: + case 308: return 1 | 4 | 32; - case 172: - case 173: - case 169: + case 174: + case 175: + case 171: if (ts.isObjectLiteralOrClassExpressionMethodOrAccessor(node)) { return 1 | 4 | 32 | 8 | 128; } - case 171: - case 256: - case 168: - case 174: - case 323: - case 317: - case 179: - case 175: - case 180: + case 173: + case 259: case 170: + case 176: + case 326: + case 320: + case 181: + case 177: + case 182: + case 172: return 1 | 4 | 32 | 8; - case 213: - case 214: + case 215: + case 216: return 1 | 4 | 32 | 8 | 16; - case 262: + case 265: return 4; - case 167: + case 169: return node.initializer ? 4 : 0; - case 292: - case 242: - case 243: - case 244: - case 263: + case 295: + case 245: + case 246: + case 247: + case 266: return 2; - case 235: + case 238: return ts.isFunctionLike(node.parent) || ts.isClassStaticBlockDeclaration(node.parent) ? 0 : 2; } return 0; @@ -38373,41 +38794,41 @@ var ts; } function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) { switch (container.kind) { - case 261: + case 264: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 305: + case 308: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 226: - case 257: - return declareClassMember(node, symbolFlags, symbolExcludes); + case 228: case 260: + return declareClassMember(node, symbolFlags, symbolExcludes); + case 263: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 182: - case 322: - case 205: - case 258: - case 286: + case 184: + case 325: + case 207: + case 261: + case 289: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 179: - case 180: + case 181: + case 182: + case 176: + case 177: + case 326: + case 178: + case 171: + case 170: + case 173: case 174: case 175: - case 323: - case 176: - case 169: - case 168: - case 171: - case 172: - case 173: - case 256: - case 213: - case 214: - case 317: - case 345: - case 338: - case 170: case 259: - case 195: + case 215: + case 216: + case 320: + case 348: + case 341: + case 172: + case 262: + case 197: return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); } } @@ -38498,10 +38919,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 261: + case 264: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 305: + case 308: if (ts.isExternalOrCommonJsModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -38591,7 +39012,7 @@ var ts; node.originalKeywordKind <= 125) { file.bindDiagnostics.push(createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); } - else if (node.originalKeywordKind === 132) { + else if (node.originalKeywordKind === 133) { if (ts.isExternalModule(file) && ts.isInTopLevelContext(node)) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module, ts.declarationNameToString(node))); } @@ -38673,8 +39094,8 @@ var ts; } function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2) { - if (blockScopeContainer.kind !== 305 && - blockScopeContainer.kind !== 261 && + if (blockScopeContainer.kind !== 308 && + blockScopeContainer.kind !== 264 && !ts.isFunctionLikeOrClassStaticBlockDeclaration(blockScopeContainer)) { var errorSpan = ts.getErrorSpanForNode(file, node); file.bindDiagnostics.push(ts.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node))); @@ -38738,7 +39159,7 @@ var ts; node.tracingPath = file.path; var saveInStrictMode = inStrictMode; bindWorker(node); - if (node.kind > 160) { + if (node.kind > 162) { var saveParent = parent; parent = node; var containerFlags = getContainerFlags(node); @@ -38806,23 +39227,23 @@ var ts; break; } case 108: - if (currentFlow && (ts.isExpression(node) || parent.kind === 297)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 300)) { node.flowNode = currentFlow; } return checkContextualIdentifier(node); - case 161: + case 163: if (currentFlow && ts.isPartOfTypeQuery(node)) { node.flowNode = currentFlow; } break; - case 231: + case 233: case 106: node.flowNode = currentFlow; break; case 80: return checkPrivateIdentifier(node); - case 206: - case 207: + case 208: + case 209: var expr = node; if (currentFlow && isNarrowableReference(expr)) { expr.flowNode = currentFlow; @@ -38837,7 +39258,7 @@ var ts; declareSymbol(file.locals, undefined, expr.expression, 1 | 134217728, 111550); } break; - case 221: + case 223: var specialKind = ts.getAssignmentDeclarationKind(node); switch (specialKind) { case 1: @@ -38872,74 +39293,74 @@ var ts; ts.Debug.fail("Unknown binary expression special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 292: + case 295: return checkStrictModeCatchClause(node); - case 215: + case 217: return checkStrictModeDeleteExpression(node); case 8: return checkStrictModeNumericLiteral(node); - case 220: + case 222: return checkStrictModePostfixUnaryExpression(node); - case 219: + case 221: return checkStrictModePrefixUnaryExpression(node); - case 248: + case 251: return checkStrictModeWithStatement(node); - case 250: + case 253: return checkStrictModeLabeledStatement(node); - case 192: + case 194: seenThisKeyword = true; return; - case 177: + case 179: break; - case 163: + case 165: return bindTypeParameter(node); - case 164: + case 166: return bindParameter(node); - case 254: + case 257: return bindVariableDeclarationOrBindingElement(node); - case 203: + case 205: node.flowNode = currentFlow; return bindVariableDeclarationOrBindingElement(node); - case 167: - case 166: - return bindPropertyWorker(node); - case 296: - case 297: - return bindPropertyOrMethodOrAccessor(node, 4, 0); - case 299: - return bindPropertyOrMethodOrAccessor(node, 8, 900095); - case 174: - case 175: - case 176: - return declareSymbolAndAddToSymbolTable(node, 131072, 0); case 169: case 168: - return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 16777216 : 0), ts.isObjectLiteralMethod(node) ? 0 : 103359); - case 256: - return bindFunctionDeclaration(node); + return bindPropertyWorker(node); + case 299: + case 300: + return bindPropertyOrMethodOrAccessor(node, 4, 0); + case 302: + return bindPropertyOrMethodOrAccessor(node, 8, 900095); + case 176: + case 177: + case 178: + return declareSymbolAndAddToSymbolTable(node, 131072, 0); case 171: - return declareSymbolAndAddToSymbolTable(node, 16384, 0); - case 172: - return bindPropertyOrMethodOrAccessor(node, 32768, 46015); + case 170: + return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 16777216 : 0), ts.isObjectLiteralMethod(node) ? 0 : 103359); + case 259: + return bindFunctionDeclaration(node); case 173: + return declareSymbolAndAddToSymbolTable(node, 16384, 0); + case 174: + return bindPropertyOrMethodOrAccessor(node, 32768, 46015); + case 175: return bindPropertyOrMethodOrAccessor(node, 65536, 78783); - case 179: - case 317: - case 323: - case 180: - return bindFunctionOrConstructorType(node); + case 181: + case 320: + case 326: case 182: - case 322: - case 195: + return bindFunctionOrConstructorType(node); + case 184: + case 325: + case 197: return bindAnonymousTypeWorker(node); - case 332: + case 335: return bindJSDocClassTag(node); - case 205: + case 207: return bindObjectLiteralExpression(node); - case 213: - case 214: + case 215: + case 216: return bindFunctionExpression(node); - case 208: + case 210: var assignmentKind = ts.getAssignmentDeclarationKind(node); switch (assignmentKind) { case 7: @@ -38957,65 +39378,68 @@ var ts; bindCallExpression(node); } break; - case 226: - case 257: + case 228: + case 260: inStrictMode = true; return bindClassLikeDeclaration(node); - case 258: - return bindBlockScopedDeclaration(node, 64, 788872); - case 259: - return bindBlockScopedDeclaration(node, 524288, 788968); - case 260: - return bindEnumDeclaration(node); case 261: - return bindModuleDeclaration(node); - case 286: - return bindJsxAttributes(node); - case 285: - return bindJsxAttribute(node, 4, 0); - case 265: - case 268: - case 270: - case 275: - return declareSymbolAndAddToSymbolTable(node, 2097152, 2097152); + return bindBlockScopedDeclaration(node, 64, 788872); + case 262: + return bindBlockScopedDeclaration(node, 524288, 788968); + case 263: + return bindEnumDeclaration(node); case 264: - return bindNamespaceExportDeclaration(node); - case 267: - return bindImportClause(node); - case 272: - return bindExportDeclaration(node); + return bindModuleDeclaration(node); + case 289: + return bindJsxAttributes(node); + case 288: + return bindJsxAttribute(node, 4, 0); + case 268: case 271: + case 273: + case 278: + return declareSymbolAndAddToSymbolTable(node, 2097152, 2097152); + case 267: + return bindNamespaceExportDeclaration(node); + case 270: + return bindImportClause(node); + case 275: + return bindExportDeclaration(node); + case 274: return bindExportAssignment(node); - case 305: + case 308: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 235: + case 238: if (!ts.isFunctionLikeOrClassStaticBlockDeclaration(node.parent)) { return; } - case 262: + case 265: return updateStrictModeStatementList(node.statements); - case 340: - if (node.parent.kind === 323) { + case 343: + if (node.parent.kind === 326) { return bindParameter(node); } - if (node.parent.kind !== 322) { + if (node.parent.kind !== 325) { break; } - case 347: + case 350: var propTag = node; - var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 316 ? + var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 319 ? 4 | 16777216 : 4; return declareSymbolAndAddToSymbolTable(propTag, flags, 0); - case 345: - case 338: - case 339: + case 348: + case 341: + case 342: return (delayedTypeAliases || (delayedTypeAliases = [])).push(node); } } function bindPropertyWorker(node) { - return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 16777216 : 0), 0); + var isAutoAccessor = ts.isAutoAccessorPropertyDeclaration(node); + var includes = isAutoAccessor ? 98304 : 4; + var excludes = isAutoAccessor ? 13247 : 0; + return bindPropertyOrMethodOrAccessor(node, includes | (node.questionToken ? 16777216 : 0), excludes); } function bindAnonymousTypeWorker(node) { return bindAnonymousDeclaration(node, 2048, "__type"); @@ -39156,8 +39580,8 @@ var ts; } var thisContainer = ts.getThisContainer(node, false); switch (thisContainer.kind) { - case 256: - case 213: + case 259: + case 215: var constructorSymbol = thisContainer.symbol; if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 63) { var l = thisContainer.parent.left; @@ -39176,12 +39600,12 @@ var ts; addDeclarationToSymbol(constructorSymbol, constructorSymbol.valueDeclaration, 32); } break; - case 171: - case 167: - case 169: - case 172: case 173: - case 170: + case 169: + case 171: + case 174: + case 175: + case 172: var containingClass = thisContainer.parent; var symbolTable = ts.isStatic(thisContainer) ? containingClass.symbol.exports : containingClass.symbol.members; if (ts.hasDynamicName(node)) { @@ -39191,7 +39615,7 @@ var ts; declareSymbol(symbolTable, containingClass.symbol, node, 4 | 67108864, 0, true); } break; - case 305: + case 308: if (ts.hasDynamicName(node)) { break; } @@ -39219,7 +39643,7 @@ var ts; if (node.expression.kind === 108) { bindThisPropertyAssignment(node); } - else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 305) { + else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 308) { if (ts.isPrototypeAccess(node.expression)) { bindPrototypePropertyAssignment(node, node.parent); } @@ -39250,7 +39674,7 @@ var ts; } function bindObjectDefinePropertyAssignment(node) { var namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0]); - var isToplevel = node.parent.parent.kind === 305; + var isToplevel = node.parent.parent.kind === 308; namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, node.arguments[0], isToplevel, false, false); bindPotentiallyNewExpandoMemberToNamespace(node, namespaceSymbol, false); } @@ -39344,8 +39768,8 @@ var ts; } function isTopLevelNamespaceAssignment(propertyAccess) { return ts.isBinaryExpression(propertyAccess.parent) - ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 305 - : propertyAccess.parent.parent.kind === 305; + ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 308 + : propertyAccess.parent.parent.kind === 308; } function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty, containerIsClass) { var namespaceSymbol = lookupSymbolForPropertyAccess(name, container) || lookupSymbolForPropertyAccess(name, blockScopeContainer); @@ -39411,7 +39835,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 257) { + if (node.kind === 260) { bindBlockScopedDeclaration(node, 32, 899503); } else { @@ -39443,7 +39867,7 @@ var ts; checkStrictModeEvalOrArguments(node, node.name); } if (!ts.isBindingPattern(node.name)) { - var possibleVariableDecl = node.kind === 254 ? node : node.parent.parent; + var possibleVariableDecl = node.kind === 257 ? node : node.parent.parent; if (ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !ts.getJSDocTypeTag(node) && @@ -39462,7 +39886,7 @@ var ts; } } function bindParameter(node) { - if (node.kind === 340 && container.kind !== 323) { + if (node.kind === 343 && container.kind !== 326) { return; } if (inStrictMode && !(node.flags & 16777216)) { @@ -39535,7 +39959,7 @@ var ts; declareSymbolAndAddToSymbolTable(node, 262144, 526824); } } - else if (node.parent.kind === 190) { + else if (node.parent.kind === 192) { var container_2 = getInferTypeContainer(node.parent); if (container_2) { if (!container_2.locals) { @@ -39560,9 +39984,9 @@ var ts; return false; } if (currentFlow === unreachableFlow) { - var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 236) || - node.kind === 257 || - (node.kind === 261 && shouldReportErrorOnModuleDeclaration(node)); + var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 239) || + node.kind === 260 || + (node.kind === 264 && shouldReportErrorOnModuleDeclaration(node)); if (reportError) { currentFlow = reportedUnreachableFlow; if (!options.allowUnreachableCode) { @@ -39594,12 +40018,12 @@ var ts; } function isPurelyTypeDeclaration(s) { switch (s.kind) { - case 258: - case 259: - return true; case 261: + case 262: + return true; + case 264: return getModuleInstanceState(s) !== 1; - case 260: + case 263: return ts.hasSyntacticModifier(s, 2048); default: return false; @@ -39792,7 +40216,7 @@ var ts; symbol.exports.forEach(visitSymbol); } ts.forEach(symbol.declarations, function (d) { - if (d.type && d.type.kind === 181) { + if (d.type && d.type.kind === 183) { var query = d.type; var entity = getResolvedSymbol(getFirstIdentifier(query.exprName)); visitSymbol(entity); @@ -39964,6 +40388,7 @@ var ts; getTypeOfPropertyOfType: function (type, name) { return getTypeOfPropertyOfType(type, ts.escapeLeadingUnderscores(name)); }, getIndexInfoOfType: function (type, kind) { return getIndexInfoOfType(type, kind === 0 ? stringType : numberType); }, getIndexInfosOfType: getIndexInfosOfType, + getIndexInfosOfIndexSymbol: getIndexInfosOfIndexSymbol, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: function (type, kind) { return getIndexTypeOfType(type, kind === 0 ? stringType : numberType); }, getIndexType: function (type) { return getIndexType(type); }, @@ -39989,6 +40414,7 @@ var ts; signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration, symbolToEntityName: nodeBuilder.symbolToEntityName, symbolToExpression: nodeBuilder.symbolToExpression, + symbolToNode: nodeBuilder.symbolToNode, symbolToTypeParameterDeclarations: nodeBuilder.symbolToTypeParameterDeclarations, symbolToParameterDeclaration: nodeBuilder.symbolToParameterDeclaration, typeParameterToDeclaration: nodeBuilder.typeParameterToDeclaration, @@ -40230,6 +40656,7 @@ var ts; isPropertyAccessible: isPropertyAccessible, getTypeOnlyAliasDeclaration: getTypeOnlyAliasDeclaration, getMemberOverrideModifierStatus: getMemberOverrideModifierStatus, + isTypeParameterPossiblyReferenced: isTypeParameterPossiblyReferenced, }; function runWithInferenceBlockedFromSourceNode(node, fn) { var containingCall = ts.findAncestor(node, ts.isCallLikeExpression); @@ -40287,6 +40714,7 @@ var ts; var wildcardType = createIntrinsicType(1, "any"); var errorType = createIntrinsicType(1, "error"); var unresolvedType = createIntrinsicType(1, "unresolved"); + var nonInferrableAnyType = createIntrinsicType(1, "any", 65536); var intrinsicMarkerType = createIntrinsicType(1, "intrinsic"); var unknownType = createIntrinsicType(2, "unknown"); var nonNullUnknownType = createIntrinsicType(2, "unknown"); @@ -40348,7 +40776,8 @@ var ts; var emptyTypeLiteralSymbol = createSymbol(2048, "__type"); emptyTypeLiteralSymbol.members = ts.createSymbolTable(); var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); - var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType; + var unknownEmptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); + var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType; var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); emptyGenericType.instantiations = new ts.Map(); var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); @@ -40451,6 +40880,8 @@ var ts; var deferredGlobalOmitSymbol; var deferredGlobalAwaitedSymbol; var deferredGlobalBigIntType; + var deferredGlobalNaNSymbol; + var deferredGlobalRecordSymbol; var allPotentiallyUnusedIdentifiers = new ts.Map(); var flowLoopStart = 0; var flowLoopCount = 0; @@ -40851,7 +41282,7 @@ var ts; if (unidirectional === void 0) { unidirectional = false; } source.forEach(function (sourceSymbol, id) { var targetSymbol = target.get(id); - target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol); + target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol)); }); } function mergeModuleAugmentation(moduleName) { @@ -40924,7 +41355,7 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = new NodeLinks()); } function isGlobalSourceFile(node) { - return node.kind === 305 && !ts.isExternalOrCommonJsModule(node); + return node.kind === 308 && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -40971,15 +41402,15 @@ var ts; return sourceFiles.indexOf(declarationFile) <= sourceFiles.indexOf(useFile); } if (declaration.pos <= usage.pos && !(ts.isPropertyDeclaration(declaration) && ts.isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) { - if (declaration.kind === 203) { - var errorBindingElement = ts.getAncestor(usage, 203); + if (declaration.kind === 205) { + var errorBindingElement = ts.getAncestor(usage, 205); if (errorBindingElement) { return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) || declaration.pos < errorBindingElement.pos; } - return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 254), usage); + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 257), usage); } - else if (declaration.kind === 254) { + else if (declaration.kind === 257) { return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } else if (ts.isClassDeclaration(declaration)) { @@ -40995,10 +41426,10 @@ var ts; } return true; } - if (usage.parent.kind === 275 || (usage.parent.kind === 271 && usage.parent.isExportEquals)) { + if (usage.parent.kind === 278 || (usage.parent.kind === 274 && usage.parent.isExportEquals)) { return true; } - if (usage.kind === 271 && usage.isExportEquals) { + if (usage.kind === 274 && usage.isExportEquals) { return true; } if (!!(usage.flags & 8388608) || isInTypeQuery(usage) || usageInTypeDeclaration()) { @@ -41020,9 +41451,9 @@ var ts; } function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { switch (declaration.parent.parent.kind) { - case 237: - case 242: - case 244: + case 240: + case 245: + case 247: if (isSameScopeDescendentOf(usage, declaration, declContainer)) { return true; } @@ -41047,7 +41478,7 @@ var ts; var initializerOfProperty = propertyDeclaration.initializer === current; if (initializerOfProperty) { if (ts.isStatic(current.parent)) { - if (declaration.kind === 169) { + if (declaration.kind === 171) { return true; } if (ts.isPropertyDeclaration(declaration) && ts.getContainingClass(usage) === ts.getContainingClass(declaration)) { @@ -41062,7 +41493,7 @@ var ts; } } else { - var isDeclarationInstanceProperty = declaration.kind === 167 && !ts.isStatic(declaration); + var isDeclarationInstanceProperty = declaration.kind === 169 && !ts.isStatic(declaration); if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) { return true; } @@ -41081,18 +41512,18 @@ var ts; return "quit"; } switch (node.kind) { - case 214: + case 216: return true; - case 167: + case 169: return stopAtAnyPropertyDeclaration && (ts.isPropertyDeclaration(declaration) && node.parent === declaration.parent || ts.isParameterPropertyDeclaration(declaration, declaration.parent) && node.parent === declaration.parent.parent) ? "quit" : true; - case 235: + case 238: switch (node.parent.kind) { - case 172: - case 169: - case 173: + case 174: + case 171: + case 175: return true; default: return false; @@ -41127,17 +41558,17 @@ var ts; } function requiresScopeChangeWorker(node) { switch (node.kind) { - case 214: - case 213: - case 256: - case 171: - return false; - case 169: - case 172: + case 216: + case 215: + case 259: case 173: - case 296: + return false; + case 171: + case 174: + case 175: + case 299: return requiresScopeChangeWorker(node.name); - case 167: + case 169: if (ts.hasStaticModifier(node)) { return target < 99 || !useDefineForClassFields; } @@ -41159,10 +41590,10 @@ var ts; return (ts.isAssertionExpression(location) && ts.isConstTypeReference(location.type)) || (ts.isJSDocTypeTag(location) && ts.isConstTypeReference(location.typeExpression)); } - function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions) { + function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions) { if (excludeGlobals === void 0) { excludeGlobals = false; } - if (getSpellingSuggstions === void 0) { getSpellingSuggstions = true; } - return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions, getSymbol); + if (getSpellingSuggestions === void 0) { getSpellingSuggestions = true; } + return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol); } function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) { var _a, _b, _c; @@ -41184,13 +41615,13 @@ var ts; if (result = lookup(location.locals, name, meaning)) { var useResult = true; if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) { - if (meaning & result.flags & 788968 && lastLocation.kind !== 320) { + if (meaning & result.flags & 788968 && lastLocation.kind !== 323) { useResult = result.flags & 262144 ? lastLocation === location.type || - lastLocation.kind === 164 || - lastLocation.kind === 340 || - lastLocation.kind === 341 || - lastLocation.kind === 163 + lastLocation.kind === 166 || + lastLocation.kind === 343 || + lastLocation.kind === 344 || + lastLocation.kind === 165 : false; } if (meaning & result.flags & 3) { @@ -41199,13 +41630,13 @@ var ts; } else if (result.flags & 1) { useResult = - lastLocation.kind === 164 || + lastLocation.kind === 166 || (lastLocation === location.type && !!ts.findAncestor(result.valueDeclaration, ts.isParameter)); } } } - else if (location.kind === 189) { + else if (location.kind === 191) { useResult = lastLocation === location.trueType; } if (useResult) { @@ -41218,13 +41649,13 @@ var ts; } withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation); switch (location.kind) { - case 305: + case 308: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; - case 261: + case 264: var moduleExports = ((_a = getSymbolOfNode(location)) === null || _a === void 0 ? void 0 : _a.exports) || emptySymbols; - if (location.kind === 305 || (ts.isModuleDeclaration(location) && location.flags & 16777216 && !ts.isGlobalScopeAugmentation(location))) { + if (location.kind === 308 || (ts.isModuleDeclaration(location) && location.flags & 16777216 && !ts.isGlobalScopeAugmentation(location))) { if (result = moduleExports.get("default")) { var localSymbol = ts.getLocalSymbolForExportDefault(result); if (localSymbol && (result.flags & meaning) && localSymbol.escapedName === name) { @@ -41235,7 +41666,7 @@ var ts; var moduleExport = moduleExports.get(name); if (moduleExport && moduleExport.flags === 2097152 && - (ts.getDeclarationOfKind(moduleExport, 275) || ts.getDeclarationOfKind(moduleExport, 274))) { + (ts.getDeclarationOfKind(moduleExport, 278) || ts.getDeclarationOfKind(moduleExport, 277))) { break; } } @@ -41248,12 +41679,12 @@ var ts; } } break; - case 260: + case 263: if (result = lookup(((_c = getSymbolOfNode(location)) === null || _c === void 0 ? void 0 : _c.exports) || emptySymbols, name, meaning & 8)) { break loop; } break; - case 167: + case 169: if (!ts.isStatic(location)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { @@ -41264,21 +41695,23 @@ var ts; } } break; - case 257: - case 226: - case 258: + case 260: + case 228: + case 261: if (result = lookup(getSymbolOfNode(location).members || emptySymbols, name, meaning & 788968)) { if (!isTypeParameterSymbolDeclaredInContainer(result, location)) { result = undefined; break; } if (lastLocation && ts.isStatic(lastLocation)) { - error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + if (nameNotFoundMessage) { + error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + } return undefined; } break loop; } - if (location.kind === 226 && meaning & 32) { + if (location.kind === 228 && meaning & 32) { var className = location.name; if (className && name === className.escapedText) { result = location.symbol; @@ -41286,7 +41719,7 @@ var ts; } } break; - case 228: + case 230: if (lastLocation === location.expression && location.parent.token === 94) { var container = location.parent.parent; if (ts.isClassLike(container) && (result = lookup(getSymbolOfNode(container).members, name, meaning & 788968))) { @@ -41297,30 +41730,32 @@ var ts; } } break; - case 162: + case 164: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 258) { + if (ts.isClassLike(grandparent) || grandparent.kind === 261) { if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968)) { - error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + if (nameNotFoundMessage) { + error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + } return undefined; } } break; - case 214: + case 216: if (ts.getEmitScriptTarget(compilerOptions) >= 2) { break; } - case 169: case 171: - case 172: case 173: - case 256: + case 174: + case 175: + case 259: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 213: + case 215: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; @@ -41333,23 +41768,23 @@ var ts; } } break; - case 165: - if (location.parent && location.parent.kind === 164) { + case 167: + if (location.parent && location.parent.kind === 166) { location = location.parent; } - if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 257)) { + if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 260)) { location = location.parent; } break; - case 345: - case 338: - case 339: + case 348: + case 341: + case 342: var root = ts.getJSDocRoot(location); if (root) { location = root.parent; } break; - case 164: + case 166: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts.isBindingPattern(lastLocation))) { if (!associatedDeclarationForContainingInitializerOrBindingName) { @@ -41357,7 +41792,7 @@ var ts; } } break; - case 203: + case 205: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts.isBindingPattern(lastLocation))) { if (ts.isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) { @@ -41365,7 +41800,7 @@ var ts; } } break; - case 190: + case 192: if (meaning & 262144) { var parameterName = location.typeParameter.name; if (parameterName && name === parameterName.escapedText) { @@ -41388,7 +41823,7 @@ var ts; } if (!result) { if (lastLocation) { - ts.Debug.assert(lastLocation.kind === 305); + ts.Debug.assert(lastLocation.kind === 308); if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) { return lastLocation.symbol; } @@ -41461,7 +41896,7 @@ var ts; } return undefined; } - else if (checkAndReportErrorForInvalidInitializer()) { + else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) { return undefined; } if (nameNotFoundMessage) { @@ -41493,7 +41928,7 @@ var ts; if (result && errorLocation && meaning & 111551 && result.flags & 2097152 && !(result.flags & 111551) && !ts.isValidTypeOnlyAliasUseSite(errorLocation)) { var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result); if (typeOnlyDeclaration) { - var message = typeOnlyDeclaration.kind === 275 + var message = typeOnlyDeclaration.kind === 278 ? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type; var unescapedName = ts.unescapeLeadingUnderscores(name); @@ -41507,29 +41942,29 @@ var ts; function addTypeOnlyDeclarationRelatedInfo(diagnostic, typeOnlyDeclaration, unescapedName) { if (!typeOnlyDeclaration) return diagnostic; - return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 275 ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName)); + return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 278 ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName)); } function getIsDeferredContext(location, lastLocation) { - if (location.kind !== 214 && location.kind !== 213) { + if (location.kind !== 216 && location.kind !== 215) { return ts.isTypeQueryNode(location) || ((ts.isFunctionLikeDeclaration(location) || - (location.kind === 167 && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name)); + (location.kind === 169 && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name)); } if (lastLocation && lastLocation === location.name) { return false; } - if (location.asteriskToken || ts.hasSyntacticModifier(location, 256)) { + if (location.asteriskToken || ts.hasSyntacticModifier(location, 512)) { return true; } return !ts.getImmediatelyInvokedFunctionExpression(location); } function isSelfReferenceLocation(node) { switch (node.kind) { - case 256: - case 257: - case 258: - case 260: case 259: + case 260: case 261: + case 263: + case 262: + case 264: return true; default: return false; @@ -41542,7 +41977,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - if (decl.kind === 163) { + if (decl.kind === 165) { var parent = ts.isJSDocTemplateTag(decl.parent) ? ts.getJSDocHost(decl.parent) : decl.parent; if (parent === container) { return !(ts.isJSDocTemplateTag(decl.parent) && ts.find(decl.parent.parent.tags, ts.isJSDocTypeAlias)); @@ -41592,9 +42027,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 79: - case 206: + case 208: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 228: + case 230: if (ts.isEntityNameExpression(node.expression)) { return node.expression; } @@ -41637,7 +42072,7 @@ var ts; return name === "any" || name === "string" || name === "number" || name === "boolean" || name === "never" || name === "unknown"; } function checkAndReportErrorForExportingPrimitiveType(errorLocation, name) { - if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 275) { + if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 278) { error(errorLocation, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, name); return true; } @@ -41726,7 +42161,7 @@ var ts; if (result.flags & (16 | 1 | 67108864) && result.flags & 32) { return; } - var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 260); }); + var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 263); }); if (declaration === undefined) return ts.Debug.fail("checkResolvedBlockScopedVariable could not find block-scoped declaration"); if (!(declaration.flags & 16777216) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { @@ -41758,13 +42193,13 @@ var ts; } function getAnyImportSyntax(node) { switch (node.kind) { - case 265: - return node; - case 267: - return node.parent; case 268: - return node.parent.parent; + return node; case 270: + return node.parent; + case 271: + return node.parent.parent; + case 273: return node.parent.parent.parent; default: return undefined; @@ -41774,24 +42209,24 @@ var ts; return symbol.declarations && ts.findLast(symbol.declarations, isAliasSymbolDeclaration); } function isAliasSymbolDeclaration(node) { - return node.kind === 265 - || node.kind === 264 - || node.kind === 267 && !!node.name - || node.kind === 268 - || node.kind === 274 - || node.kind === 270 - || node.kind === 275 - || node.kind === 271 && ts.exportAssignmentIsAlias(node) + return node.kind === 268 + || node.kind === 267 + || node.kind === 270 && !!node.name + || node.kind === 271 + || node.kind === 277 + || node.kind === 273 + || node.kind === 278 + || node.kind === 274 && ts.exportAssignmentIsAlias(node) || ts.isBinaryExpression(node) && ts.getAssignmentDeclarationKind(node) === 2 && ts.exportAssignmentIsAlias(node) || ts.isAccessExpression(node) && ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 && isAliasableOrJsExpression(node.parent.right) - || node.kind === 297 - || node.kind === 296 && isAliasableOrJsExpression(node.initializer) - || node.kind === 254 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) - || node.kind === 203 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); + || node.kind === 300 + || node.kind === 299 && isAliasableOrJsExpression(node.initializer) + || node.kind === 257 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) + || node.kind === 205 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); } function isAliasableOrJsExpression(e) { return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e); @@ -41804,7 +42239,7 @@ var ts; ? resolveSymbol(getPropertyOfType(resolveExternalModuleTypeByLiteral(name), commonJSPropertyAccess.name.escapedText)) : undefined; } - if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 277) { + if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 280) { var immediate = resolveExternalModuleName(node, ts.getExternalModuleRequireArgument(node) || ts.getExternalModuleImportEqualsDeclarationExpression(node)); var resolved_4 = resolveExternalModuleSymbol(immediate); markSymbolOfAliasDeclarationIfTypeOnly(node, immediate, resolved_4, false); @@ -41817,7 +42252,7 @@ var ts; function checkAndReportErrorForResolvingImportAliasToTypeOnlySymbol(node, resolved) { if (markSymbolOfAliasDeclarationIfTypeOnly(node, undefined, resolved, false) && !node.isTypeOnly) { var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(getSymbolOfNode(node)); - var isExport = typeOnlyDeclaration.kind === 275; + var isExport = typeOnlyDeclaration.kind === 278; var message = isExport ? ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type : ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type; @@ -41836,7 +42271,7 @@ var ts; return resolved; } function isSyntacticDefault(node) { - return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 512) || ts.isExportSpecifier(node)); + return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 1024) || ts.isExportSpecifier(node)); } function getUsageModeForExpression(usage) { return ts.isStringLiteralLike(usage) ? ts.getModeForUsageLocation(ts.getSourceFileOfNode(usage), usage) : undefined; @@ -41923,11 +42358,11 @@ var ts; } function getModuleSpecifierForImportOrExport(node) { switch (node.kind) { - case 267: return node.parent.moduleSpecifier; - case 265: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; - case 268: return node.parent.parent.moduleSpecifier; - case 270: return node.parent.parent.parent.moduleSpecifier; - case 275: return node.parent.parent.moduleSpecifier; + case 270: return node.parent.moduleSpecifier; + case 268: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; + case 271: return node.parent.parent.moduleSpecifier; + case 273: return node.parent.parent.parent.moduleSpecifier; + case 278: return node.parent.parent.moduleSpecifier; default: return ts.Debug.assertNever(node); } } @@ -42176,31 +42611,31 @@ var ts; function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { if (dontRecursivelyResolve === void 0) { dontRecursivelyResolve = false; } switch (node.kind) { - case 265: - case 254: - return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); - case 267: - return getTargetOfImportClause(node, dontRecursivelyResolve); case 268: - return getTargetOfNamespaceImport(node, dontRecursivelyResolve); - case 274: - return getTargetOfNamespaceExport(node, dontRecursivelyResolve); + case 257: + return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); case 270: - case 203: - return getTargetOfImportSpecifier(node, dontRecursivelyResolve); - case 275: - return getTargetOfExportSpecifier(node, 111551 | 788968 | 1920, dontRecursivelyResolve); + return getTargetOfImportClause(node, dontRecursivelyResolve); case 271: - case 221: + return getTargetOfNamespaceImport(node, dontRecursivelyResolve); + case 277: + return getTargetOfNamespaceExport(node, dontRecursivelyResolve); + case 273: + case 205: + return getTargetOfImportSpecifier(node, dontRecursivelyResolve); + case 278: + return getTargetOfExportSpecifier(node, 111551 | 788968 | 1920, dontRecursivelyResolve); + case 274: + case 223: return getTargetOfExportAssignment(node, dontRecursivelyResolve); - case 264: + case 267: return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); - case 297: + case 300: return resolveEntityName(node.name, 111551 | 788968 | 1920, true, dontRecursivelyResolve); - case 296: + case 299: return getTargetOfAliasLikeExpression(node.initializer, dontRecursivelyResolve); - case 207: - case 206: + case 209: + case 208: return getTargetOfAccessExpression(node, dontRecursivelyResolve); default: return ts.Debug.fail(); @@ -42308,16 +42743,16 @@ var ts; if (entityName.kind === 79 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 79 || entityName.parent.kind === 161) { + if (entityName.kind === 79 || entityName.parent.kind === 163) { return resolveEntityName(entityName, 1920, false, dontResolveAlias); } else { - ts.Debug.assert(entityName.parent.kind === 265); + ts.Debug.assert(entityName.parent.kind === 268); return resolveEntityName(entityName, 111551 | 788968 | 1920, false, dontResolveAlias); } } function getFullyQualifiedName(symbol, containingLocation) { - return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, undefined, 16 | 4); + return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, undefined, 32 | 4); } function getContainingQualifiedNameNode(node) { while (ts.isQualifiedName(node.parent)) { @@ -42355,9 +42790,9 @@ var ts; return getMergedSymbol(symbolFromJSPrototype); } } - else if (name.kind === 161 || name.kind === 206) { - var left = name.kind === 161 ? name.left : name.expression; - var right = name.kind === 161 ? name.right : name.name; + else if (name.kind === 163 || name.kind === 208) { + var left = name.kind === 163 ? name.left : name.expression; + var right = name.kind === 163 ? name.right : name.name; var namespace = resolveEntityName(left, namespaceMeaning, ignoreErrors, false, location); if (!namespace || ts.nodeIsMissing(right)) { return undefined; @@ -42415,7 +42850,7 @@ var ts; throw ts.Debug.assertNever(name, "Unknown entity name kind."); } ts.Debug.assert((ts.getCheckFlags(symbol) & 1) === 0, "Should never get an instantiated symbol here."); - if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 || name.parent.kind === 271)) { + if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 || name.parent.kind === 274)) { markSymbolOfAliasDeclarationIfTypeOnly(ts.getAliasDeclarationFromName(name), symbol, undefined, true); } return (symbol.flags & meaning) || dontResolveAlias ? symbol : resolveAlias(symbol); @@ -42545,7 +42980,7 @@ var ts; if (ext === ".ts" || ext === ".js" || ext === ".tsx" || ext === ".jsx") { var scope = currentSourceFile.packageJsonScope; var targetExt = ext === ".ts" ? ".mts" : ext === ".js" ? ".mjs" : undefined; - if (scope && !scope.packageJsonContent.type) { + if (scope && !scope.contents.packageJsonContent.type) { if (targetExt) { diagnosticDetails = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1, targetExt, ts.combinePaths(scope.packageDirectory, "package.json")); } @@ -42695,7 +43130,7 @@ var ts; var _a; var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); if (!dontResolveAlias && symbol) { - if (!suppressInteropError && !(symbol.flags & (1536 | 3)) && !ts.getDeclarationOfKind(symbol, 305)) { + if (!suppressInteropError && !(symbol.flags & (1536 | 3)) && !ts.getDeclarationOfKind(symbol, 308)) { var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop"; @@ -43028,7 +43463,7 @@ var ts; var members = node.members; for (var _i = 0, members_3 = members; _i < members_3.length; _i++) { var member = members_3[_i]; - if (member.kind === 171 && ts.nodeIsPresent(member.body)) { + if (member.kind === 173 && ts.nodeIsPresent(member.body)) { return member; } } @@ -43130,19 +43565,19 @@ var ts; } } switch (location.kind) { - case 305: + case 308: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 261: + case 264: var sym = getSymbolOfNode(location); if (result = callback((sym === null || sym === void 0 ? void 0 : sym.exports) || emptySymbols, undefined, true, location)) { return { value: result }; } break; - case 257: - case 226: - case 258: + case 260: + case 228: + case 261: var table_1; (getSymbolOfNode(location).members || emptySymbols).forEach(function (memberSymbol, key) { if (memberSymbol.flags & (788968 & ~67108864)) { @@ -43213,7 +43648,7 @@ var ts; && !(ts.isUMDExportSymbol(symbolFromSymbolTable) && enclosingDeclaration && ts.isExternalModule(ts.getSourceFileOfNode(enclosingDeclaration))) && (!useOnlyExternalAliasing || ts.some(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) && (isLocalNameLookup ? !ts.some(symbolFromSymbolTable.declarations, ts.isNamespaceReexportDeclaration) : true) - && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 275))) { + && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 278))) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); var candidate = getCandidateListForSymbol(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification); if (candidate) { @@ -43249,7 +43684,7 @@ var ts; if (symbolFromSymbolTable === symbol) { return true; } - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 275)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 278)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -43263,10 +43698,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; switch (declaration.kind) { - case 167: case 169: - case 172: - case 173: + case 171: + case 174: + case 175: continue; default: return false; @@ -43366,10 +43801,10 @@ var ts; return node && getSymbolOfNode(node); } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 305 && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 308 && ts.isExternalOrCommonJsModule(declaration)); } function hasNonGlobalAugmentationExternalModuleSymbol(declaration) { - return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 305 && ts.isExternalOrCommonJsModule(declaration)); + return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 308 && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -43430,13 +43865,13 @@ var ts; } function isEntityNameVisible(entityName, enclosingDeclaration) { var meaning; - if (entityName.parent.kind === 181 || - entityName.parent.kind === 228 && !ts.isPartOfTypeNode(entityName.parent) || - entityName.parent.kind === 162) { + if (entityName.parent.kind === 183 || + entityName.parent.kind === 230 && !ts.isPartOfTypeNode(entityName.parent) || + entityName.parent.kind === 164) { meaning = 111551 | 1048576; } - else if (entityName.kind === 161 || entityName.kind === 206 || - entityName.parent.kind === 265) { + else if (entityName.kind === 163 || entityName.kind === 208 || + entityName.parent.kind === 268) { meaning = 1920; } else { @@ -43468,14 +43903,17 @@ var ts; if (flags & 8) { nodeFlags |= 16384; } - if (flags & 16) { + if (flags & 32) { nodeFlags |= 134217728; } - var builder = flags & 4 ? nodeBuilder.symbolToExpression : nodeBuilder.symbolToEntityName; + if (flags & 16) { + nodeFlags |= 1073741824; + } + var builder = flags & 4 ? nodeBuilder.symbolToNode : nodeBuilder.symbolToEntityName; return writer ? symbolToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(symbolToStringWorker); function symbolToStringWorker(writer) { var entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags); - var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 305 ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true }); + var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 308 ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true }); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); printer.writeNode(4, entity, sourceFile, writer); return writer; @@ -43487,10 +43925,10 @@ var ts; function signatureToStringWorker(writer) { var sigOutput; if (flags & 262144) { - sigOutput = kind === 1 ? 180 : 179; + sigOutput = kind === 1 ? 182 : 181; } else { - sigOutput = kind === 1 ? 175 : 174; + sigOutput = kind === 1 ? 177 : 176; } var sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 | 512); var printer = ts.createPrinter({ removeComments: true, omitTrailingSemicolon: true }); @@ -43568,7 +44006,25 @@ var ts; symbolTableToDeclarationStatements: function (symbolTable, enclosingDeclaration, flags, tracker, bundled) { return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolTableToDeclarationStatements(symbolTable, context, bundled); }); }, + symbolToNode: function (symbol, meaning, enclosingDeclaration, flags, tracker) { + return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolToNode(symbol, context, meaning); }); + }, }; + function symbolToNode(symbol, context, meaning) { + if (context.flags & 1073741824) { + if (symbol.valueDeclaration) { + var name = ts.getNameOfDeclaration(symbol.valueDeclaration); + if (name && ts.isComputedPropertyName(name)) + return name; + } + var nameType = getSymbolLinks(symbol).nameType; + if (nameType && nameType.flags & (1024 | 8192)) { + context.enclosingDeclaration = nameType.symbol.valueDeclaration; + return ts.factory.createComputedPropertyName(symbolToExpression(nameType.symbol, context, meaning)); + } + } + return symbolToExpression(symbol, context, meaning); + } function withContext(enclosingDeclaration, flags, tracker, cb) { var _a, _b; ts.Debug.assert(enclosingDeclaration === undefined || (enclosingDeclaration.flags & 8) === 0); @@ -43652,7 +44108,7 @@ var ts; return undefined; } context.approximateLength += 3; - return ts.factory.createKeywordTypeNode(130); + return ts.factory.createKeywordTypeNode(131); } if (!(context.flags & 536870912)) { type = getReducedType(type); @@ -43662,29 +44118,29 @@ var ts; return ts.factory.createTypeReferenceNode(symbolToEntityNameNode(type.aliasSymbol), mapToTypeNodes(type.aliasTypeArguments, context)); } if (type === unresolvedType) { - return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(130), 3, "unresolved"); + return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(131), 3, "unresolved"); } context.approximateLength += 3; - return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 138 : 130); + return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 139 : 131); } if (type.flags & 2) { - return ts.factory.createKeywordTypeNode(155); + return ts.factory.createKeywordTypeNode(157); } if (type.flags & 4) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(150); + return ts.factory.createKeywordTypeNode(152); } if (type.flags & 8) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(147); + return ts.factory.createKeywordTypeNode(148); } if (type.flags & 64) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(158); + return ts.factory.createKeywordTypeNode(160); } if (type.flags & 16 && !type.aliasSymbol) { context.approximateLength += 7; - return ts.factory.createKeywordTypeNode(133); + return ts.factory.createKeywordTypeNode(134); } if (type.flags & 1024 && !(type.flags & 1048576)) { var parentSymbol = getParentOfSymbol(type.symbol); @@ -43738,7 +44194,7 @@ var ts; } } context.approximateLength += 13; - return ts.factory.createTypeOperatorNode(154, ts.factory.createKeywordTypeNode(151)); + return ts.factory.createTypeOperatorNode(156, ts.factory.createKeywordTypeNode(153)); } if (type.flags & 16384) { context.approximateLength += 4; @@ -43746,7 +44202,7 @@ var ts; } if (type.flags & 32768) { context.approximateLength += 9; - return ts.factory.createKeywordTypeNode(153); + return ts.factory.createKeywordTypeNode(155); } if (type.flags & 65536) { context.approximateLength += 4; @@ -43754,15 +44210,15 @@ var ts; } if (type.flags & 131072) { context.approximateLength += 5; - return ts.factory.createKeywordTypeNode(143); + return ts.factory.createKeywordTypeNode(144); } if (type.flags & 4096) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(151); + return ts.factory.createKeywordTypeNode(153); } if (type.flags & 67108864) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(148); + return ts.factory.createKeywordTypeNode(149); } if (ts.isThisTypeParameter(type)) { if (context.flags & 4194304) { @@ -43845,7 +44301,7 @@ var ts; var indexedType = type.type; context.approximateLength += 6; var indexTypeNode = typeToTypeNodeHelper(indexedType, context); - return ts.factory.createTypeOperatorNode(140, indexTypeNode); + return ts.factory.createTypeOperatorNode(141, indexTypeNode); } if (type.flags & 134217728) { var texts_1 = type.texts; @@ -43887,7 +44343,7 @@ var ts; context.inferTypeParameters = saveInferTypeParameters_1; var trueTypeNode_1 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type.root.node.trueType), newMapper)); var falseTypeNode_1 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type.root.node.falseType), newMapper)); - return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(143)), ts.factory.createKeywordTypeNode(143)); + return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(144)), ts.factory.createKeywordTypeNode(144)); } var saveInferTypeParameters = context.inferTypeParameters; context.inferTypeParameters = type.root.inferTypeParameters; @@ -43927,7 +44383,7 @@ var ts; var name = typeParameterToName(newParam, context); newTypeVariable = ts.factory.createTypeReferenceNode(name); } - appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(140, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)); + appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(141, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)); } else { appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type), context); @@ -43940,7 +44396,7 @@ var ts; var result = ts.setEmitFlags(mappedTypeNode, 1); if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) && context.flags & 4) { var originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode(type.declaration.typeParameter.constraint.type)) || unknownType, type.mapper); - return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(143)); + return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(144)); } return result; } @@ -43983,7 +44439,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 305 || declaration.parent.kind === 262; + return declaration.parent.kind === 308 || declaration.parent.kind === 265; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return (!!(context.flags & 4096) || ((_a = context.visitedTypes) === null || _a === void 0 ? void 0 : _a.has(typeId))) && @@ -44067,12 +44523,12 @@ var ts; } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { var signature = resolved.callSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 179, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 181, context); return signatureNode; } if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { var signature = resolved.constructSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 180, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 182, context); return signatureNode; } } @@ -44108,7 +44564,7 @@ var ts; } var elementType = typeToTypeNodeHelper(typeArguments[0], context); var arrayType = ts.factory.createArrayTypeNode(elementType); - return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(145, arrayType); + return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(146, arrayType); } else if (type.target.objectFlags & 8) { typeArguments = ts.sameMap(typeArguments, function (t, i) { return removeMissingType(t, !!(type.target.elementFlags[i] & 2)); }); @@ -44133,12 +44589,12 @@ var ts; } } var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode(tupleConstituentNodes), 1); - return type.target.readonly ? ts.factory.createTypeOperatorNode(145, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.factory.createTypeOperatorNode(146, tupleTypeNode) : tupleTypeNode; } } if (context.encounteredError || (context.flags & 524288)) { var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode([]), 1); - return type.target.readonly ? ts.factory.createTypeOperatorNode(145, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.factory.createTypeOperatorNode(146, tupleTypeNode) : tupleTypeNode; } context.encounteredError = true; return undefined; @@ -44238,13 +44694,13 @@ var ts; var typeElements = []; for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 174, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 176, context)); } for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; if (signature.flags & 4) continue; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 175, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 177, context)); } for (var _d = 0, _e = resolvedType.indexInfos; _d < _e.length; _d++) { var info = _e[_d]; @@ -44281,7 +44737,7 @@ var ts; if (!(context.flags & 1)) { return ts.factory.createTypeReferenceNode(ts.factory.createIdentifier("..."), undefined); } - return ts.factory.createKeywordTypeNode(130); + return ts.factory.createKeywordTypeNode(131); } function shouldUsePlaceholderForProperty(propertySymbol, context) { var _a; @@ -44325,7 +44781,7 @@ var ts; var signatures = getSignaturesOfType(filterType(propertyType, function (t) { return !(t.flags & 32768); }), 0); for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) { var signature = signatures_1[_i]; - var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 168, context, { name: propertyName, questionToken: optionalToken }); + var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 170, context, { name: propertyName, questionToken: optionalToken }); typeElements.push(preserveCommentsOn(methodDeclaration)); } } @@ -44339,12 +44795,12 @@ var ts; context.reverseMappedStack || (context.reverseMappedStack = []); context.reverseMappedStack.push(propertySymbol); } - propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(130); + propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(131); if (propertyIsReverseMapped) { context.reverseMappedStack.pop(); } } - var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(145)] : undefined; + var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(146)] : undefined; if (modifiers) { context.approximateLength += 9; } @@ -44353,8 +44809,8 @@ var ts; } function preserveCommentsOn(node) { var _a; - if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 347; })) { - var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 347; }); + if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 350; })) { + var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 350; }); var commentText = ts.getTextOfJSDocComment(d.comment); if (commentText) { ts.setSyntheticLeadingComments(node, [{ kind: 3, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]); @@ -44440,7 +44896,7 @@ var ts; context.encounteredError = true; } context.approximateLength += (name.length + 4); - return ts.factory.createIndexSignature(indexInfo.isReadonly ? [ts.factory.createToken(145)] : undefined, [indexingParameter], typeNode); + return ts.factory.createIndexSignature(indexInfo.isReadonly ? [ts.factory.createToken(146)] : undefined, [indexingParameter], typeNode); } function signatureToSignatureDeclarationHelper(signature, kind, context, options) { var _a, _b, _c, _d; @@ -44457,7 +44913,7 @@ var ts; typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter, context); }); } var expandedParams = getExpandedParameters(signature, true)[0]; - var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 171, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); + var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 173, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); var thisParameter = context.flags & 33554432 ? undefined : tryGetThisParameterDeclaration(signature, context); if (thisParameter) { parameters.unshift(thisParameter); @@ -44466,7 +44922,7 @@ var ts; var typePredicate = getTypePredicateOfSignature(signature); if (typePredicate) { var assertsModifier = typePredicate.kind === 2 || typePredicate.kind === 3 ? - ts.factory.createToken(128) : + ts.factory.createToken(129) : undefined; var parameterName = typePredicate.kind === 1 || typePredicate.kind === 3 ? ts.setEmitFlags(ts.factory.createIdentifier(typePredicate.parameterName), 16777216) : @@ -44480,28 +44936,28 @@ var ts; returnTypeNode = serializeReturnTypeForSignature(context, returnType, signature, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); } else if (!suppressAny) { - returnTypeNode = ts.factory.createKeywordTypeNode(130); + returnTypeNode = ts.factory.createKeywordTypeNode(131); } } var modifiers = options === null || options === void 0 ? void 0 : options.modifiers; - if ((kind === 180) && signature.flags & 4) { + if ((kind === 182) && signature.flags & 4) { var flags = ts.modifiersToFlags(modifiers); - modifiers = ts.factory.createModifiersFromModifierFlags(flags | 128); + modifiers = ts.factory.createModifiersFromModifierFlags(flags | 256); } - var node = kind === 174 ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : - kind === 175 ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : - kind === 168 ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : - kind === 169 ? ts.factory.createMethodDeclaration(modifiers, undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), undefined, typeParameters, parameters, returnTypeNode, undefined) : - kind === 171 ? ts.factory.createConstructorDeclaration(modifiers, parameters, undefined) : - kind === 172 ? ts.factory.createGetAccessorDeclaration(modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, undefined) : - kind === 173 ? ts.factory.createSetAccessorDeclaration(modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, undefined) : - kind === 176 ? ts.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : - kind === 317 ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : - kind === 179 ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : - kind === 180 ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : - kind === 256 ? ts.factory.createFunctionDeclaration(modifiers, undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, undefined) : - kind === 213 ? ts.factory.createFunctionExpression(modifiers, undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) : - kind === 214 ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, undefined, ts.factory.createBlock([])) : + var node = kind === 176 ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : + kind === 177 ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : + kind === 170 ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : + kind === 171 ? ts.factory.createMethodDeclaration(modifiers, undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), undefined, typeParameters, parameters, returnTypeNode, undefined) : + kind === 173 ? ts.factory.createConstructorDeclaration(modifiers, parameters, undefined) : + kind === 174 ? ts.factory.createGetAccessorDeclaration(modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, undefined) : + kind === 175 ? ts.factory.createSetAccessorDeclaration(modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, undefined) : + kind === 178 ? ts.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : + kind === 320 ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : + kind === 181 ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : + kind === 182 ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : + kind === 259 ? ts.factory.createFunctionDeclaration(modifiers, undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, undefined) : + kind === 215 ? ts.factory.createFunctionExpression(modifiers, undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) : + kind === 216 ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, undefined, ts.factory.createBlock([])) : ts.Debug.assertNever(kind); if (typeArguments) { node.typeArguments = ts.factory.createNodeArray(typeArguments); @@ -44535,9 +44991,9 @@ var ts; return typeParameterToDeclarationWithConstraint(type, context, constraintNode); } function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) { - var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 164); + var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 166); if (!parameterDeclaration && !ts.isTransientSymbol(parameterSymbol)) { - parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 340); + parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 343); } var parameterType = getTypeOfSymbol(parameterSymbol); if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) { @@ -44549,7 +45005,7 @@ var ts; var dotDotDotToken = isRest ? ts.factory.createToken(25) : undefined; var name = parameterDeclaration ? parameterDeclaration.name ? parameterDeclaration.name.kind === 79 ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name), 16777216) : - parameterDeclaration.name.kind === 161 ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216) : + parameterDeclaration.name.kind === 163 ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216) : cloneBindingName(parameterDeclaration.name) : ts.symbolName(parameterSymbol) : ts.symbolName(parameterSymbol); @@ -44559,19 +45015,14 @@ var ts; context.approximateLength += ts.symbolName(parameterSymbol).length + 3; return parameterNode; function cloneBindingName(node) { - return elideInitializerAndPropertyRenamingAndSetEmitFlags(node); - function elideInitializerAndPropertyRenamingAndSetEmitFlags(node) { + return elideInitializerAndSetEmitFlags(node); + function elideInitializerAndSetEmitFlags(node) { if (context.tracker.trackSymbol && ts.isComputedPropertyName(node) && isLateBindableName(node)) { trackComputedName(node.expression, context.enclosingDeclaration, context); } - var visited = ts.visitEachChild(node, elideInitializerAndPropertyRenamingAndSetEmitFlags, ts.nullTransformationContext, undefined, elideInitializerAndPropertyRenamingAndSetEmitFlags); + var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, undefined, elideInitializerAndSetEmitFlags); if (ts.isBindingElement(visited)) { - if (visited.propertyName && ts.isIdentifier(visited.propertyName) && ts.isIdentifier(visited.name)) { - visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, undefined, visited.propertyName, undefined); - } - else { - visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name, undefined); - } + visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name, undefined); } if (!ts.nodeIsSynthesized(visited)) { visited = ts.factory.cloneNode(visited); @@ -44700,11 +45151,11 @@ var ts; } function getSpecifierForModuleSymbol(symbol, context, overrideImportMode) { var _a; - var file = ts.getDeclarationOfKind(symbol, 305); + var file = ts.getDeclarationOfKind(symbol, 308); if (!file) { var equivalentFileSymbol = ts.firstDefined(symbol.declarations, function (d) { return getFileSymbolIfFileSymbolExportEqualsContainer(d, symbol); }); if (equivalentFileSymbol) { - file = ts.getDeclarationOfKind(equivalentFileSymbol, 305); + file = ts.getDeclarationOfKind(equivalentFileSymbol, 308); } } if (file && file.moduleName !== undefined) { @@ -45138,17 +45589,17 @@ var ts; } return transformed === existing ? ts.setTextRange(ts.factory.cloneNode(existing), existing) : transformed; function visitExistingNodeTreeSymbols(node) { - if (ts.isJSDocAllType(node) || node.kind === 319) { - return ts.factory.createKeywordTypeNode(130); + if (ts.isJSDocAllType(node) || node.kind === 322) { + return ts.factory.createKeywordTypeNode(131); } if (ts.isJSDocUnknownType(node)) { - return ts.factory.createKeywordTypeNode(155); + return ts.factory.createKeywordTypeNode(157); } if (ts.isJSDocNullableType(node)) { return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createLiteralTypeNode(ts.factory.createNull())]); } if (ts.isJSDocOptionalType(node)) { - return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(153)]); + return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(155)]); } if (ts.isJSDocNonNullableType(node)) { return ts.visitNode(node.type, visitExistingNodeTreeSymbols); @@ -45161,11 +45612,11 @@ var ts; var name = ts.isIdentifier(t.name) ? t.name : t.name.right; var typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode(node), name.escapedText); var overrideTypeNode = typeViaParent && t.typeExpression && getTypeFromTypeNode(t.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : undefined; - return ts.factory.createPropertySignature(undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(130)); + return ts.factory.createPropertySignature(undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(131)); })); } if (ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "") { - return ts.setOriginalNode(ts.factory.createKeywordTypeNode(130), node); + return ts.setOriginalNode(ts.factory.createKeywordTypeNode(131), node); } if ((ts.isExpressionWithTypeArguments(node) || ts.isTypeReferenceNode(node)) && ts.isJSDocIndexSignature(node)) { return ts.factory.createTypeLiteralNode([ts.factory.createIndexSignature(undefined, [ts.factory.createParameterDeclaration(undefined, undefined, "x", undefined, ts.visitNode(node.typeArguments[0], visitExistingNodeTreeSymbols))], ts.visitNode(node.typeArguments[1], visitExistingNodeTreeSymbols))]); @@ -45173,10 +45624,10 @@ var ts; if (ts.isJSDocFunctionType(node)) { if (ts.isJSDocConstructSignature(node)) { var newTypeNode_1; - return ts.factory.createConstructorTypeNode(undefined, ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.mapDefined(node.parameters, function (p, i) { return p.name && ts.isIdentifier(p.name) && p.name.escapedText === "new" ? (newTypeNode_1 = p.type, undefined) : ts.factory.createParameterDeclaration(undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130)); + return ts.factory.createConstructorTypeNode(undefined, ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.mapDefined(node.parameters, function (p, i) { return p.name && ts.isIdentifier(p.name) && p.name.escapedText === "new" ? (newTypeNode_1 = p.type, undefined) : ts.factory.createParameterDeclaration(undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131)); } else { - return ts.factory.createFunctionTypeNode(ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.map(node.parameters, function (p, i) { return ts.factory.createParameterDeclaration(undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130)); + return ts.factory.createFunctionTypeNode(ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.map(node.parameters, function (p, i) { return ts.factory.createParameterDeclaration(undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131)); } } if (ts.isTypeReferenceNode(node) && ts.isInJSDoc(node) && (!existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(node, getTypeFromTypeNode(node)) || getIntendedTypeFromJSDocTypeReference(node) || unknownSymbol === resolveTypeReferenceName(node, 788968, true))) { @@ -45240,8 +45691,8 @@ var ts; } } function symbolTableToDeclarationStatements(symbolTable, context, bundled) { - var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 169, true); - var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 168, false); + var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 171, true); + var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 170, false); var enclosingDeclaration = context.enclosingDeclaration; var results = []; var visitedSymbols = new ts.Set(); @@ -45432,7 +45883,7 @@ var ts; if (needsPostExportDefault || needsExportDeclaration) { isPrivate = true; } - var modifierFlags = (!isPrivate ? 1 : 0) | (isDefault && !needsPostExportDefault ? 512 : 0); + var modifierFlags = (!isPrivate ? 1 : 0) | (isDefault && !needsPostExportDefault ? 1024 : 0); var isConstMergedWithNS = symbol.flags & 1536 && symbol.flags & (2 | 1 | 4) && symbol.escapedName !== "export="; @@ -45570,8 +46021,8 @@ var ts; (ts.isEnumDeclaration(node) || ts.isVariableStatement(node) || ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node) || ts.isModuleDeclaration(node))) { newModifierFlags |= 2; } - if ((additionalModifierFlags & 512) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) { - newModifierFlags |= 512; + if ((additionalModifierFlags & 1024) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) { + newModifierFlags |= 1024; } if (newModifierFlags) { node = ts.factory.updateModifiers(node, newModifierFlags | ts.getEffectiveModifierFlags(node)); @@ -45605,8 +46056,8 @@ var ts; var baseTypes = getBaseTypes(interfaceType); var baseType = ts.length(baseTypes) ? getIntersectionType(baseTypes) : undefined; var members = ts.flatMap(getPropertiesOfType(interfaceType), function (p) { return serializePropertySymbolForInterface(p, baseType); }); - var callSignatures = serializeSignatures(0, interfaceType, baseType, 174); - var constructSignatures = serializeSignatures(1, interfaceType, baseType, 175); + var callSignatures = serializeSignatures(0, interfaceType, baseType, 176); + var constructSignatures = serializeSignatures(1, interfaceType, baseType, 177); var indexSignatures = serializeIndexSignatures(interfaceType, baseType); var heritageClauses = !ts.length(baseTypes) ? undefined : [ts.factory.createHeritageClause(94, ts.mapDefined(baseTypes, function (b) { return trySerializeAsTypeReference(b, 111551); }))]; addResult(ts.factory.createInterfaceDeclaration(undefined, getInternalSymbolName(symbol, symbolName), typeParamDecls, heritageClauses, __spreadArray(__spreadArray(__spreadArray(__spreadArray([], indexSignatures, true), constructSignatures, true), callSignatures, true), members, true)), modifierFlags); @@ -45658,7 +46109,7 @@ var ts; var signatures = getSignaturesOfType(type, 0); for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var sig = signatures_2[_i]; - var decl = signatureToSignatureDeclarationHelper(sig, 256, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); + var decl = signatureToSignatureDeclarationHelper(sig, 259, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); addResult(ts.setTextRange(decl, getSignatureTextRangeLocation(sig)), modifierFlags); } if (!(symbol.flags & (512 | 1024) && !!symbol.exports && !!symbol.exports.size)) { @@ -45779,7 +46230,7 @@ var ts; !ts.some(getSignaturesOfType(staticType, 1)); var constructors = isNonConstructableClassLikeInJsFile ? [ts.factory.createConstructorDeclaration(ts.factory.createModifiersFromModifierFlags(8), [], undefined)] : - serializeSignatures(1, staticType, staticBaseType, 171); + serializeSignatures(1, staticType, staticBaseType, 173); var indexSignatures = serializeIndexSignatures(classType, baseTypes[0]); context.enclosingDeclaration = oldEnclosing; addResult(ts.setTextRange(ts.factory.createClassDeclaration(undefined, localName, typeParamDecls, heritageClauses, __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], indexSignatures, true), staticMembers, true), constructors, true), publicProperties, true), privateProperties, true)), symbol.declarations && ts.filter(symbol.declarations, function (d) { return ts.isClassDeclaration(d) || ts.isClassExpression(d); })[0]), modifierFlags); @@ -45820,8 +46271,8 @@ var ts; var targetName = getInternalSymbolName(target, verbatimTargetName); includePrivateSymbol(target); switch (node.kind) { - case 203: - if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 254) { + case 205: + if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 257) { var specifier_1 = getSpecifierForModuleSymbol(target.parent || target, context); var propertyName = node.propertyName; addResult(ts.factory.createImportDeclaration(undefined, ts.factory.createImportClause(false, undefined, ts.factory.createNamedImports([ts.factory.createImportSpecifier(false, propertyName && ts.isIdentifier(propertyName) ? ts.factory.createIdentifier(ts.idText(propertyName)) : undefined, ts.factory.createIdentifier(localName))])), ts.factory.createStringLiteral(specifier_1), undefined), 0); @@ -45829,12 +46280,12 @@ var ts; } ts.Debug.failBadSyntaxKind(((_c = node.parent) === null || _c === void 0 ? void 0 : _c.parent) || node, "Unhandled binding element grandparent kind in declaration serialization"); break; - case 297: - if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 221) { + case 300: + if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 223) { serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), targetName); } break; - case 254: + case 257: if (ts.isPropertyAccessExpression(node.initializer)) { var initializer = node.initializer; var uniqueName = ts.factory.createUniqueName(localName); @@ -45843,7 +46294,7 @@ var ts; addResult(ts.factory.createImportEqualsDeclaration(undefined, false, ts.factory.createIdentifier(localName), ts.factory.createQualifiedName(uniqueName, initializer.name)), modifierFlags); break; } - case 265: + case 268: if (target.escapedName === "export=" && ts.some(target.declarations, ts.isJsonSourceFile)) { serializeMaybeAliasAssignment(symbol); break; @@ -45853,33 +46304,33 @@ var ts; ? symbolToName(target, context, 67108863, false) : ts.factory.createExternalModuleReference(ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)))), isLocalImport ? modifierFlags : 0); break; - case 264: + case 267: addResult(ts.factory.createNamespaceExportDeclaration(ts.idText(node.name)), 0); break; - case 267: + case 270: addResult(ts.factory.createImportDeclaration(undefined, ts.factory.createImportClause(false, ts.factory.createIdentifier(localName), undefined), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), undefined), 0); break; - case 268: + case 271: addResult(ts.factory.createImportDeclaration(undefined, ts.factory.createImportClause(false, undefined, ts.factory.createNamespaceImport(ts.factory.createIdentifier(localName))), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)), undefined), 0); break; - case 274: + case 277: addResult(ts.factory.createExportDeclaration(undefined, false, ts.factory.createNamespaceExport(ts.factory.createIdentifier(localName)), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context))), 0); break; - case 270: + case 273: addResult(ts.factory.createImportDeclaration(undefined, ts.factory.createImportClause(false, undefined, ts.factory.createNamedImports([ ts.factory.createImportSpecifier(false, localName !== verbatimTargetName ? ts.factory.createIdentifier(verbatimTargetName) : undefined, ts.factory.createIdentifier(localName)) ])), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), undefined), 0); break; - case 275: + case 278: var specifier = node.parent.parent.moduleSpecifier; serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), specifier ? verbatimTargetName : targetName, specifier && ts.isStringLiteralLike(specifier) ? ts.factory.createStringLiteral(specifier.text) : undefined); break; - case 271: + case 274: serializeMaybeAliasAssignment(symbol); break; - case 221: - case 206: - case 207: + case 223: + case 208: + case 209: if (symbol.escapedName === "default" || symbol.escapedName === "export=") { serializeMaybeAliasAssignment(symbol); } @@ -45985,7 +46436,7 @@ var ts; && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName)))) { return []; } - var flag = (modifierFlags & ~256) | (isStatic ? 32 : 0); + var flag = (modifierFlags & ~512) | (isStatic ? 32 : 0); var name = getPropertyNameNodeForSymbol(p, context); var firstPropertyLikeDecl = (_a = p.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.or(ts.isPropertyDeclaration, ts.isAccessor, ts.isVariableDeclaration, ts.isPropertySignature, ts.isBinaryExpression, ts.isPropertyAccessExpression)); if (p.flags & 98304 && useAccessors) { @@ -46000,7 +46451,7 @@ var ts; return result; } else if (p.flags & (4 | 3 | 98304)) { - return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 : 0) | flag), name, p.flags & 16777216 ? ts.factory.createToken(57) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), undefined), ((_d = p.declarations) === null || _d === void 0 ? void 0 : _d.find(ts.or(ts.isPropertyDeclaration, ts.isVariableDeclaration))) || firstPropertyLikeDecl); + return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 : 0) | flag), name, p.flags & 16777216 ? ts.factory.createToken(57) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), undefined), ((_d = p.declarations) === null || _d === void 0 ? void 0 : _d.find(ts.or(ts.isPropertyDeclaration, ts.isVariableDeclaration))) || firstPropertyLikeDecl); } if (p.flags & (8192 | 16)) { var type = getTypeOfSymbol(p); @@ -46176,7 +46627,7 @@ var ts; if (flags === void 0) { flags = 16384; } return writer ? typePredicateToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(typePredicateToStringWorker); function typePredicateToStringWorker(writer) { - var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 || typePredicate.kind === 3 ? ts.factory.createToken(128) : undefined, typePredicate.kind === 1 || typePredicate.kind === 3 ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 | 512)); + var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 || typePredicate.kind === 3 ? ts.factory.createToken(129) : undefined, typePredicate.kind === 1 || typePredicate.kind === 3 ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 | 512)); var printer = ts.createPrinter({ removeComments: true }); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); printer.writeNode(4, predicate, sourceFile, writer); @@ -46222,7 +46673,7 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 && type.symbol.declarations) { var node = ts.walkUpParenthesizedTypes(type.symbol.declarations[0].parent); - if (node.kind === 259) { + if (node.kind === 262) { return getSymbolOfNode(node); } } @@ -46230,11 +46681,11 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 262 && + node.parent.kind === 265 && ts.isExternalModuleAugmentation(node.parent.parent); } function isDefaultBindingContext(location) { - return location.kind === 305 || ts.isAmbientModule(location); + return location.kind === 308 || ts.isAmbientModule(location); } function getNameOfSymbolFromNameType(symbol, context) { var nameType = getSymbolLinks(symbol).nameType; @@ -46282,17 +46733,17 @@ var ts; if (!declaration) { declaration = symbol.declarations[0]; } - if (declaration.parent && declaration.parent.kind === 254) { + if (declaration.parent && declaration.parent.kind === 257) { return ts.declarationNameToString(declaration.parent.name); } switch (declaration.kind) { - case 226: - case 213: - case 214: + case 228: + case 215: + case 216: if (context && !context.encounteredError && !(context.flags & 131072)) { context.encounteredError = true; } - return declaration.kind === 226 ? "(Anonymous class)" : "(Anonymous function)"; + return declaration.kind === 228 ? "(Anonymous class)" : "(Anonymous function)"; } } var name = getNameOfSymbolFromNameType(symbol, context); @@ -46309,68 +46760,68 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 338: - case 345: - case 339: + case 341: + case 348: + case 342: return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent)); - case 203: + case 205: return isDeclarationVisible(node.parent.parent); - case 254: + case 257: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 261: - case 257: - case 258: - case 259: - case 256: + case 264: case 260: - case 265: + case 261: + case 262: + case 259: + case 263: + case 268: if (ts.isExternalModuleAugmentation(node)) { return true; } var parent = getDeclarationContainer(node); if (!(ts.getCombinedModifierFlags(node) & 1) && - !(node.kind !== 265 && parent.kind !== 305 && parent.flags & 16777216)) { + !(node.kind !== 268 && parent.kind !== 308 && parent.flags & 16777216)) { return isGlobalSourceFile(parent); } return isDeclarationVisible(parent); - case 167: - case 166: - case 172: - case 173: case 169: case 168: + case 174: + case 175: + case 171: + case 170: if (ts.hasEffectiveModifier(node, 8 | 16)) { return false; } - case 171: - case 175: - case 174: + case 173: + case 177: case 176: - case 164: - case 262: - case 179: - case 180: - case 182: case 178: - case 183: + case 166: + case 265: + case 181: + case 182: case 184: - case 187: - case 188: - case 191: - case 197: + case 180: + case 185: + case 186: + case 189: + case 190: + case 193: + case 199: return isDeclarationVisible(node.parent); - case 267: - case 268: case 270: - return false; - case 163: - case 305: - case 264: - return true; case 271: + case 273: + return false; + case 165: + case 308: + case 267: + return true; + case 274: return false; default: return false; @@ -46379,10 +46830,10 @@ var ts; } function collectLinkedAliases(node, setVisibility) { var exportSymbol; - if (node.parent && node.parent.kind === 271) { + if (node.parent && node.parent.kind === 274) { exportSymbol = resolveName(node, node.escapedText, 111551 | 788968 | 1920 | 2097152, undefined, node, false); } - else if (node.parent.kind === 275) { + else if (node.parent.kind === 278) { exportSymbol = getTargetOfExportSpecifier(node.parent, 111551 | 788968 | 1920 | 2097152); } var result; @@ -46472,12 +46923,12 @@ var ts; function getDeclarationContainer(node) { return ts.findAncestor(ts.getRootDeclaration(node), function (node) { switch (node.kind) { - case 254: - case 255: + case 257: + case 258: + case 273: + case 272: + case 271: case 270: - case 269: - case 268: - case 267: return false; default: return true; @@ -46586,23 +47037,23 @@ var ts; function getParentElementAccess(node) { var ancestor = node.parent.parent; switch (ancestor.kind) { - case 203: - case 296: + case 205: + case 299: return getSyntheticElementAccess(ancestor); - case 204: + case 206: return getSyntheticElementAccess(node.parent); - case 254: + case 257: return ancestor.initializer; - case 221: + case 223: return ancestor.right; } } function getDestructuringPropertyName(node) { var parent = node.parent; - if (node.kind === 203 && parent.kind === 201) { + if (node.kind === 205 && parent.kind === 203) { return getLiteralPropertyNameText(node.propertyName || node.name); } - if (node.kind === 296 || node.kind === 297) { + if (node.kind === 299 || node.kind === 300) { return getLiteralPropertyNameText(node.name); } return "" + parent.elements.indexOf(node); @@ -46628,7 +47079,7 @@ var ts; parentType = getTypeWithFacts(parentType, 524288); } var type; - if (pattern.kind === 201) { + if (pattern.kind === 203) { if (declaration.dotDotDotToken) { parentType = getReducedType(parentType); if (parentType.flags & 2 || !isValidSpreadType(parentType)) { @@ -46690,7 +47141,7 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node, true); - return expr.kind === 204 && expr.elements.length === 0; + return expr.kind === 206 && expr.elements.length === 0; } function addOptionality(type, isProperty, isOptional) { if (isProperty === void 0) { isProperty = false; } @@ -46698,18 +47149,18 @@ var ts; return strictNullChecks && isOptional ? getOptionalType(type, isProperty) : type; } function getTypeForVariableLikeDeclaration(declaration, includeOptionality, checkMode) { - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 243) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 246) { var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression, checkMode))); return indexType.flags & (262144 | 4194304) ? getExtractStringType(indexType) : stringType; } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247) { var forOfStatement = declaration.parent.parent; return checkRightHandSideOfForOf(forOfStatement) || anyType; } if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } - var isProperty = ts.isPropertyDeclaration(declaration) || ts.isPropertySignature(declaration); + var isProperty = ts.isPropertyDeclaration(declaration) && !ts.hasAccessorModifier(declaration) || ts.isPropertySignature(declaration); var isOptional = includeOptionality && (isProperty && !!declaration.questionToken || ts.isParameter(declaration) && (!!declaration.questionToken || isJSDocOptionalParameter(declaration)) || isOptionalJSDocPropertyLikeTag(declaration)); @@ -46729,8 +47180,8 @@ var ts; } if (ts.isParameter(declaration)) { var func = declaration.parent; - if (func.kind === 173 && hasBindableName(func)) { - var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 172); + if (func.kind === 175 && hasBindableName(func)) { + var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 174); if (getter) { var getterSignature = getSignatureFromDeclaration(getter); var thisParameter = getAccessorThisParameter(func); @@ -46741,11 +47192,9 @@ var ts; return getReturnTypeOfSignature(getterSignature); } } - if (ts.isInJSFile(declaration)) { - var type_1 = getParameterTypeOfTypeTag(func, declaration); - if (type_1) - return type_1; - } + var parameterTypeOfTypeTag = getParameterTypeOfTypeTag(func, declaration); + if (parameterTypeOfTypeTag) + return parameterTypeOfTypeTag; var type = declaration.symbol.escapedName === "this" ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration); if (type) { return addOptionality(type, false, isOptional); @@ -46793,7 +47242,7 @@ var ts; links.isConstructorDeclaredProperty = !!getDeclaringConstructor(symbol) && ts.every(symbol.declarations, function (declaration) { return ts.isBinaryExpression(declaration) && isPossiblyAliasedThisProperty(declaration) && - (declaration.left.kind !== 207 || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && + (declaration.left.kind !== 209 || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && !getAnnotatedTypeForAssignmentDeclaration(undefined, declaration, symbol, declaration); }); } @@ -46813,11 +47262,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; var container = ts.getThisContainer(declaration, false); - if (container && (container.kind === 171 || isJSConstructor(container))) { + if (container && (container.kind === 173 || isJSConstructor(container))) { return container; } } - ; } function getFlowTypeFromCommonJSExport(symbol) { var file = ts.getSourceFileOfNode(symbol.declarations[0]); @@ -47089,9 +47537,9 @@ var ts; } function isDeclarationInConstructor(expression) { var thisContainer = ts.getThisContainer(expression, false); - return thisContainer.kind === 171 || - thisContainer.kind === 256 || - (thisContainer.kind === 213 && !ts.isPrototypePropertyAssignment(thisContainer.parent)); + return thisContainer.kind === 173 || + thisContainer.kind === 259 || + (thisContainer.kind === 215 && !ts.isPrototypePropertyAssignment(thisContainer.parent)); } function getConstructorDefinedThisAssignmentTypes(types, declarations) { ts.Debug.assert(types.length === declarations.length); @@ -47113,7 +47561,7 @@ var ts; if (reportErrors && !declarationBelongsToPrivateAmbientMember(element)) { reportImplicitAny(element, anyType); } - return anyType; + return includePatternInType ? nonInferrableAnyType : anyType; } function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) { var members = ts.createSymbolTable(); @@ -47148,7 +47596,7 @@ var ts; function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) { var elements = pattern.elements; var lastElement = ts.lastOrUndefined(elements); - var restElement = lastElement && lastElement.kind === 203 && lastElement.dotDotDotToken ? lastElement : undefined; + var restElement = lastElement && lastElement.kind === 205 && lastElement.dotDotDotToken ? lastElement : undefined; if (elements.length === 0 || elements.length === 1 && restElement) { return languageVersion >= 2 ? createIterableType(anyType) : anyArrayType; } @@ -47166,7 +47614,7 @@ var ts; function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { if (includePatternInType === void 0) { includePatternInType = false; } if (reportErrors === void 0) { reportErrors = false; } - return pattern.kind === 201 + return pattern.kind === 203 ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -47201,7 +47649,7 @@ var ts; } function declarationBelongsToPrivateAmbientMember(declaration) { var root = ts.getRootDeclaration(declaration); - var memberDeclaration = root.kind === 164 ? root.parent : root; + var memberDeclaration = root.kind === 166 ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function tryGetTypeFromEffectiveTypeNode(node) { @@ -47250,8 +47698,8 @@ var ts; if (typeNode === undefined) { return useUnknownInCatchVariables ? unknownType : anyType; } - var type_2 = getTypeOfNode(typeNode); - return isTypeAny(type_2) || type_2 === unknownType ? type_2 : errorType; + var type_1 = getTypeOfNode(typeNode); + return isTypeAny(type_1) || type_1 === unknownType ? type_1 : errorType; } if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) { if (!declaration.statements.length) { @@ -47269,7 +47717,7 @@ var ts; return reportCircularityError(symbol); } var type; - if (declaration.kind === 271) { + if (declaration.kind === 274) { type = widenTypeForVariableLikeDeclaration(tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionCached(declaration.expression), declaration); } else if (ts.isBinaryExpression(declaration) || @@ -47333,13 +47781,17 @@ var ts; } function getAnnotatedAccessorTypeNode(accessor) { if (accessor) { - if (accessor.kind === 172) { - var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); - return getterTypeAnnotation; - } - else { - var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation; + switch (accessor.kind) { + case 174: + var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); + return getterTypeAnnotation; + case 175: + var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); + return setterTypeAnnotation; + case 169: + ts.Debug.assert(ts.hasAccessorModifier(accessor)); + var accessorTypeAnnotation = ts.getEffectiveTypeAnnotationNode(accessor); + return accessorTypeAnnotation; } } return undefined; @@ -47361,12 +47813,15 @@ var ts; if (!pushTypeResolution(symbol, 0)) { return errorType; } - var getter = ts.getDeclarationOfKind(symbol, 172); - var setter = ts.getDeclarationOfKind(symbol, 173); + var getter = ts.getDeclarationOfKind(symbol, 174); + var setter = ts.getDeclarationOfKind(symbol, 175); + var accessor = ts.tryCast(ts.getDeclarationOfKind(symbol, 169), ts.isAutoAccessorPropertyDeclaration); var type = getter && ts.isInJSFile(getter) && getTypeForDeclarationFromJSDocComment(getter) || getAnnotatedAccessorType(getter) || getAnnotatedAccessorType(setter) || - getter && getter.body && getReturnTypeFromBody(getter); + getAnnotatedAccessorType(accessor) || + getter && getter.body && getReturnTypeFromBody(getter) || + accessor && accessor.initializer && getWidenedTypeForVariableLikeDeclaration(accessor, true); if (!type) { if (setter && !isPrivateWithinAmbient(setter)) { errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol)); @@ -47374,6 +47829,9 @@ var ts; else if (getter && !isPrivateWithinAmbient(getter)) { errorOrSuggestion(noImplicitAny, getter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol)); } + else if (accessor && !isPrivateWithinAmbient(accessor)) { + errorOrSuggestion(noImplicitAny, accessor, ts.Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), "any"); + } type = anyType; } if (!popTypeResolution()) { @@ -47383,6 +47841,9 @@ var ts; else if (getAnnotatedAccessorTypeNode(setter)) { error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); } + else if (getAnnotatedAccessorTypeNode(accessor)) { + error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } else if (getter && noImplicitAny) { error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } @@ -47393,12 +47854,13 @@ var ts; return links.type; } function getWriteTypeOfAccessors(symbol) { + var _a; var links = getSymbolLinks(symbol); if (!links.writeType) { if (!pushTypeResolution(symbol, 8)) { return errorType; } - var setter = ts.getDeclarationOfKind(symbol, 173); + var setter = (_a = ts.getDeclarationOfKind(symbol, 175)) !== null && _a !== void 0 ? _a : ts.tryCast(ts.getDeclarationOfKind(symbol, 169), ts.isAutoAccessorPropertyDeclaration); var writeType = getAnnotatedAccessorType(setter); if (!popTypeResolution()) { if (getAnnotatedAccessorTypeNode(setter)) { @@ -47436,9 +47898,9 @@ var ts; if (symbol.flags & 1536 && ts.isShorthandAmbientModuleSymbol(symbol)) { return anyType; } - else if (declaration && (declaration.kind === 221 || + else if (declaration && (declaration.kind === 223 || ts.isAccessExpression(declaration) && - declaration.parent.kind === 221)) { + declaration.parent.kind === 223)) { return getWidenedTypeForAssignmentDeclaration(symbol); } else if (symbol.flags & 512 && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) { @@ -47448,11 +47910,11 @@ var ts; return errorType; } var exportEquals = getMergedSymbol(symbol.exports.get("export=")); - var type_3 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule); + var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule); if (!popTypeResolution()) { return reportCircularityError(symbol); } - return type_3; + return type_2; } } var type = createObjectType(16, symbol); @@ -47496,7 +47958,7 @@ var ts; error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); return errorType; } - if (noImplicitAny && (declaration.kind !== 164 || declaration.initializer)) { + if (noImplicitAny && (declaration.kind !== 166 || declaration.initializer)) { error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); } return anyType; @@ -47614,46 +48076,46 @@ var ts; return undefined; } switch (node.kind) { - case 257: - case 226: - case 258: - case 174: - case 175: - case 168: - case 179: - case 180: - case 317: - case 256: - case 169: - case 213: - case 214: + case 260: + case 228: + case 261: + case 176: + case 177: + case 170: + case 181: + case 182: + case 320: case 259: - case 344: - case 345: - case 339: - case 338: - case 195: - case 189: { + case 171: + case 215: + case 216: + case 262: + case 347: + case 348: + case 342: + case 341: + case 197: + case 191: { var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); - if (node.kind === 195) { + if (node.kind === 197) { return ts.append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter))); } - else if (node.kind === 189) { + else if (node.kind === 191) { return ts.concatenate(outerTypeParameters, getInferTypeParameters(node)); } var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node)); var thisType = includeThisTypes && - (node.kind === 257 || node.kind === 226 || node.kind === 258 || isJSConstructor(node)) && + (node.kind === 260 || node.kind === 228 || node.kind === 261 || isJSConstructor(node)) && getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters; } - case 340: + case 343: var paramSymbol = ts.getParameterSymbolFromJSDoc(node); if (paramSymbol) { node = paramSymbol.valueDeclaration; } break; - case 320: { + case 323: { var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); return node.tags ? appendTypeParameters(outerTypeParameters, ts.flatMap(node.tags, function (t) { return ts.isJSDocTemplateTag(t) ? t.typeParameters : undefined; })) @@ -47663,7 +48125,7 @@ var ts; } } function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 258); + var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 261); ts.Debug.assert(!!declaration, "Class was missing valueDeclaration -OR- non-class had no interface declarations"); return getOuterTypeParameters(declaration); } @@ -47674,9 +48136,9 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 258 || - node.kind === 257 || - node.kind === 226 || + if (node.kind === 261 || + node.kind === 260 || + node.kind === 228 || isJSConstructor(node) || ts.isTypeAlias(node)) { var declaration = node; @@ -47814,7 +48276,7 @@ var ts; if (!popTypeResolution() && type.symbol.declarations) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 257 || declaration.kind === 258) { + if (declaration.kind === 260 || declaration.kind === 261) { reportCircularBaseType(declaration, type); } } @@ -47895,7 +48357,7 @@ var ts; if (type.symbol.declarations) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 258 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 261 && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getReducedType(getTypeFromTypeNode(node)); @@ -47928,7 +48390,7 @@ var ts; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 258) { + if (declaration.kind === 261) { if (declaration.flags & 128) { return false; } @@ -47996,7 +48458,7 @@ var ts; } else { type = errorType; - if (declaration.kind === 339) { + if (declaration.kind === 342) { error(declaration.typeExpression.type, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } else { @@ -48011,7 +48473,7 @@ var ts; if (ts.isStringLiteralLike(expr)) { return true; } - else if (expr.kind === 221) { + else if (expr.kind === 223) { return isStringConcatExpression(expr.left) && isStringConcatExpression(expr.right); } return false; @@ -48026,12 +48488,12 @@ var ts; case 8: case 14: return true; - case 219: + case 221: return expr.operator === 40 && expr.operand.kind === 8; case 79: return ts.nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText); - case 221: + case 223: return isStringConcatExpression(expr); default: return false; @@ -48046,7 +48508,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 260) { + if (declaration.kind === 263) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (member.initializer && ts.isStringLiteralLike(member.initializer)) { @@ -48075,7 +48537,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 260) { + if (declaration.kind === 263) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; var value = getEnumMemberValue(member); @@ -48143,22 +48605,22 @@ var ts; } function isThislessType(node) { switch (node.kind) { - case 130: - case 155: - case 150: - case 147: - case 158: - case 133: - case 151: + case 131: + case 157: + case 152: case 148: - case 114: + case 160: + case 134: case 153: - case 143: - case 196: + case 149: + case 114: + case 155: + case 144: + case 198: return true; - case 183: + case 185: return isThislessType(node.elementType); - case 178: + case 180: return !node.typeArguments || node.typeArguments.every(isThislessType); } return false; @@ -48174,7 +48636,7 @@ var ts; function isThislessFunctionLikeDeclaration(node) { var returnType = ts.getEffectiveReturnTypeNode(node); var typeParameters = ts.getEffectiveTypeParameterDeclarations(node); - return (node.kind === 171 || (!!returnType && isThislessType(returnType))) && + return (node.kind === 173 || (!!returnType && isThislessType(returnType))) && node.parameters.every(isThislessVariableLikeDeclaration) && typeParameters.every(isThislessTypeParameter); } @@ -48183,14 +48645,14 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 167: - case 166: - return isThislessVariableLikeDeclaration(declaration); case 169: case 168: + return isThislessVariableLikeDeclaration(declaration); case 171: - case 172: + case 170: case 173: + case 174: + case 175: return isThislessFunctionLikeDeclaration(declaration); } } @@ -48330,8 +48792,10 @@ var ts; if (members) { for (var _b = 0, members_5 = members; _b < members_5.length; _b++) { var member = members_5[_b]; - if (isStatic_1 === ts.hasStaticModifier(member) && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic_1 === ts.hasStaticModifier(member)) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -48346,8 +48810,10 @@ var ts; || ts.isBinaryExpression(member) && isPossiblyAliasedThisProperty(member, assignmentKind) || assignmentKind === 9 || assignmentKind === 6; - if (isStatic_1 === !isInstanceMember && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic_1 === !isInstanceMember) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -48520,7 +48986,7 @@ var ts; var baseConstructorType = getBaseConstructorTypeOfClass(classType); var baseSignatures = getSignaturesOfType(baseConstructorType, 1); var declaration = ts.getClassLikeDeclarationOfSymbol(classType.symbol); - var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 128); + var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 256); if (baseSignatures.length === 0) { return [createSignature(undefined, classType.localTypeParameters, undefined, ts.emptyArray, classType, undefined, 0, isAbstract ? 4 : 0)]; } @@ -48941,6 +49407,10 @@ var ts; return mapType(type, getLowerBoundOfKeyType); } if (type.flags & 2097152) { + var types = type.types; + if (types.length === 2 && !!(types[0].flags & (4 | 8 | 64)) && types[1] === emptyTypeLiteralType) { + return type; + } return getIntersectionType(ts.sameMap(type.types, getLowerBoundOfKeyType)); } return type; @@ -49069,8 +49539,8 @@ var ts; } function isMappedTypeWithKeyofConstraintDeclaration(type) { var constraintDeclaration = getConstraintDeclarationForMappedType(type); - return constraintDeclaration.kind === 193 && - constraintDeclaration.operator === 140; + return constraintDeclaration.kind === 195 && + constraintDeclaration.operator === 141; } function getModifiersTypeFromMappedType(type) { if (!type.modifiersType) { @@ -49378,10 +49848,10 @@ var ts; var baseTypes = []; var different = false; for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var type_4 = types_7[_i]; - var baseType = getBaseConstraint(type_4); + var type_3 = types_7[_i]; + var baseType = getBaseConstraint(type_3); if (baseType) { - if (baseType !== type_4) { + if (baseType !== type_3) { different = true; } baseTypes.push(baseType); @@ -49423,7 +49893,7 @@ var ts; return constraint && getBaseConstraint(constraint); } if (t.flags & 33554432) { - return getBaseConstraint(t.substitute); + return getBaseConstraint(getSubstitutionIntersection(t)); } return t; } @@ -49569,7 +50039,11 @@ var ts; } } } - if (!singleProp || isUnion && (propSet || checkFlags & 48) && checkFlags & (1024 | 512)) { + if (!singleProp || + isUnion && + (propSet || checkFlags & 48) && + checkFlags & (1024 | 512) && + !(propSet && getCommonDeclarationsOfSymbols(ts.arrayFrom(propSet.values())))) { return undefined; } if (!propSet && !(checkFlags & 16) && !indexTypes) { @@ -49659,6 +50133,33 @@ var ts; } return property; } + function getCommonDeclarationsOfSymbols(symbols) { + var commonDeclarations; + var _loop_14 = function (symbol) { + if (!symbol.declarations) { + return { value: undefined }; + } + if (!commonDeclarations) { + commonDeclarations = new ts.Set(symbol.declarations); + return "continue"; + } + commonDeclarations.forEach(function (declaration) { + if (!ts.contains(symbol.declarations, declaration)) { + commonDeclarations.delete(declaration); + } + }); + if (commonDeclarations.size === 0) { + return { value: undefined }; + } + }; + for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) { + var symbol = symbols_3[_i]; + var state_4 = _loop_14(symbol); + if (typeof state_4 === "object") + return state_4.value; + } + return commonDeclarations; + } function getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment) { var property = getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment); return property && !(ts.getCheckFlags(property) & 16) ? property : undefined; @@ -49826,10 +50327,10 @@ var ts; return result; } function isJSDocOptionalParameter(node) { - return ts.isInJSFile(node) && (node.type && node.type.kind === 316 + return ts.isInJSFile(node) && (node.type && node.type.kind === 319 || ts.getJSDocParameterTags(node).some(function (_a) { var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 316; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319; })); } function tryFindAmbientModule(moduleName, withAugmentations) { @@ -49858,14 +50359,14 @@ var ts; return false; } function isOptionalPropertyDeclaration(node) { - return ts.isPropertyDeclaration(node) && node.questionToken; + return ts.isPropertyDeclaration(node) && !ts.hasAccessorModifier(node) && node.questionToken; } function isOptionalJSDocPropertyLikeTag(node) { if (!ts.isJSDocPropertyLikeTag(node)) { return false; } var isBracketed = node.isBracketed, typeExpression = node.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 316; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319; } function createTypePredicate(kind, parameterName, parameterIndex, type) { return { kind: kind, parameterName: parameterName, parameterIndex: parameterIndex, type: type }; @@ -49938,7 +50439,7 @@ var ts; else { parameters.push(paramSymbol); } - if (type && type.kind === 196) { + if (type && type.kind === 198) { flags |= 2; } var isOptionalParameter_1 = isOptionalJSDocPropertyLikeTag(param) || @@ -49949,24 +50450,24 @@ var ts; minArgumentCount = parameters.length; } } - if ((declaration.kind === 172 || declaration.kind === 173) && + if ((declaration.kind === 174 || declaration.kind === 175) && hasBindableName(declaration) && (!hasThisParameter || !thisParameter)) { - var otherKind = declaration.kind === 172 ? 173 : 172; + var otherKind = declaration.kind === 174 ? 175 : 174; var other = ts.getDeclarationOfKind(getSymbolOfNode(declaration), otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); } } - var classType = declaration.kind === 171 ? + var classType = declaration.kind === 173 ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration); if (ts.hasRestParameter(declaration) || ts.isInJSFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters)) { flags |= 1; } - if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 128) || - ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 128)) { + if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 256) || + ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 256)) { flags |= 4; } links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, undefined, undefined, minArgumentCount, flags); @@ -50032,16 +50533,16 @@ var ts; switch (node.kind) { case 79: return node.escapedText === argumentsSymbol.escapedName && getReferencedValueSymbol(node) === argumentsSymbol; - case 167: case 169: - case 172: - case 173: - return node.name.kind === 162 + case 171: + case 174: + case 175: + return node.name.kind === 164 && traverse(node.name); - case 206: - case 207: + case 208: + case 209: return traverse(node.expression); - case 296: + case 299: return traverse(node.initializer); default: return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && !!ts.forEachChild(node, traverse); @@ -50062,7 +50563,10 @@ var ts; continue; } } - result.push(getSignatureFromDeclaration(decl)); + result.push((!ts.isFunctionExpressionOrArrowFunction(decl) && + !ts.isObjectLiteralMethod(decl) && + getSignatureOfTypeTag(decl)) || + getSignatureFromDeclaration(decl)); } return result; } @@ -50093,7 +50597,7 @@ var ts; else { var type = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration); var jsdocPredicate = void 0; - if (!type && ts.isInJSFile(signature.declaration)) { + if (!type) { var jsdocSignature = getSignatureOfTypeTag(signature.declaration); if (jsdocSignature && signature !== jsdocSignature) { jsdocPredicate = getTypePredicateOfSignature(jsdocSignature); @@ -50110,7 +50614,7 @@ var ts; function createTypePredicateFromTypePredicateNode(node, signature) { var parameterName = node.parameterName; var type = node.type && getTypeFromTypeNode(node.type); - return parameterName.kind === 192 ? + return parameterName.kind === 194 ? createTypePredicate(node.assertsModifier ? 2 : 0, undefined, undefined, type) : createTypePredicate(node.assertsModifier ? 3 : 1, parameterName.escapedText, ts.findIndex(signature.parameters, function (p) { return p.escapedName === parameterName.escapedText; }), type); } @@ -50156,7 +50660,7 @@ var ts; return signature.resolvedReturnType; } function getReturnTypeFromAnnotation(declaration) { - if (declaration.kind === 171) { + if (declaration.kind === 173) { return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)); } if (ts.isJSDocConstructSignature(declaration)) { @@ -50166,12 +50670,12 @@ var ts; if (typeNode) { return getTypeFromTypeNode(typeNode); } - if (declaration.kind === 172 && hasBindableName(declaration)) { + if (declaration.kind === 174 && hasBindableName(declaration)) { var jsDocType = ts.isInJSFile(declaration) && getTypeForDeclarationFromJSDocComment(declaration); if (jsDocType) { return jsDocType; } - var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 173); + var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 175); var setterType = getAnnotatedAccessorType(setter); if (setterType) { return setterType; @@ -50259,7 +50763,7 @@ var ts; var _a; if (!signature.isolatedSignatureType) { var kind = (_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind; - var isConstructor = kind === undefined || kind === 171 || kind === 175 || kind === 180; + var isConstructor = kind === undefined || kind === 173 || kind === 177 || kind === 182; var type = createObjectType(16); type.members = emptySymbols; type.properties = ts.emptyArray; @@ -50286,7 +50790,7 @@ var ts; function getIndexInfosOfIndexSymbol(indexSymbol) { if (indexSymbol.declarations) { var indexInfos_4 = []; - var _loop_14 = function (declaration) { + var _loop_15 = function (declaration) { if (declaration.parameters.length === 1) { var parameter = declaration.parameters[0]; if (parameter.type) { @@ -50300,7 +50804,7 @@ var ts; }; for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - _loop_14(declaration); + _loop_15(declaration); } return indexInfos_4; } @@ -50317,10 +50821,10 @@ var ts; var _a; var inferences; if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) { - var _loop_15 = function (declaration) { - if (declaration.parent.kind === 190) { + var _loop_16 = function (declaration) { + if (declaration.parent.kind === 192) { var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1]; - if (grandParent.kind === 178 && !omitTypeReferences) { + if (grandParent.kind === 180 && !omitTypeReferences) { var typeReference_1 = grandParent; var typeParameters_1 = getTypeParametersForTypeReference(typeReference_1); if (typeParameters_1) { @@ -50339,20 +50843,20 @@ var ts; } } } - else if (grandParent.kind === 164 && grandParent.dotDotDotToken || - grandParent.kind === 186 || - grandParent.kind === 197 && grandParent.dotDotDotToken) { + else if (grandParent.kind === 166 && grandParent.dotDotDotToken || + grandParent.kind === 188 || + grandParent.kind === 199 && grandParent.dotDotDotToken) { inferences = ts.append(inferences, createArrayType(unknownType)); } - else if (grandParent.kind === 199) { + else if (grandParent.kind === 201) { inferences = ts.append(inferences, stringType); } - else if (grandParent.kind === 163 && grandParent.parent.kind === 195) { + else if (grandParent.kind === 165 && grandParent.parent.kind === 197) { inferences = ts.append(inferences, keyofConstraintType); } - else if (grandParent.kind === 195 && grandParent.type && - ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 189 && - grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 195 && + else if (grandParent.kind === 197 && grandParent.type && + ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 191 && + grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 197 && grandParent.parent.checkType.type) { var checkMappedType_1 = grandParent.parent.checkType; var nodeType = getTypeFromTypeNode(checkMappedType_1.type); @@ -50362,7 +50866,7 @@ var ts; }; for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) { var declaration = _b[_i]; - _loop_15(declaration); + _loop_16(declaration); } } return inferences && getIntersectionType(inferences); @@ -50381,7 +50885,7 @@ var ts; else { var type = getTypeFromTypeNode(constraintDeclaration); if (type.flags & 1 && !isErrorType(type)) { - type = constraintDeclaration.parent.parent.kind === 195 ? keyofConstraintType : unknownType; + type = constraintDeclaration.parent.parent.kind === 197 ? keyofConstraintType : unknownType; } typeParameter.constraint = type; } @@ -50390,7 +50894,7 @@ var ts; return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - var tp = ts.getDeclarationOfKind(typeParameter.symbol, 163); + var tp = ts.getDeclarationOfKind(typeParameter.symbol, 165); var host = ts.isJSDocTemplateTag(tp.parent) ? ts.getEffectiveContainerForJSDocTemplateTag(tp.parent) : tp.parent; return host && getSymbolOfNode(host); } @@ -50472,8 +50976,8 @@ var ts; } var node = type.node; var typeArguments = !node ? ts.emptyArray : - node.kind === 178 ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : - node.kind === 183 ? [getTypeFromTypeNode(node.elementType)] : + node.kind === 180 ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : + node.kind === 185 ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); if (popTypeResolution()) { type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments; @@ -50511,7 +51015,7 @@ var ts; return errorType; } } - if (node.kind === 178 && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) { + if (node.kind === 180 && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) { return createDeferredTypeReference(type, node, undefined); } var typeArguments = ts.concatenate(type.outerTypeParameters, fillMissingTypeArguments(typeArgumentsFromTypeReferenceNode(node), typeParameters, minTypeArgumentCount, isJs)); @@ -50570,9 +51074,9 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 178: + case 180: return node.typeName; - case 228: + case 230: var expr = node.expression; if (ts.isEntityNameExpression(expr)) { return expr; @@ -50584,13 +51088,13 @@ var ts; return symbol.parent ? "".concat(getSymbolPath(symbol.parent), ".").concat(symbol.escapedName) : symbol.escapedName; } function getUnresolvedSymbolForEntityName(name) { - var identifier = name.kind === 161 ? name.right : - name.kind === 206 ? name.name : + var identifier = name.kind === 163 ? name.right : + name.kind === 208 ? name.name : name; var text = identifier.escapedText; if (text) { - var parentSymbol = name.kind === 161 ? getUnresolvedSymbolForEntityName(name.left) : - name.kind === 206 ? getUnresolvedSymbolForEntityName(name.expression) : + var parentSymbol = name.kind === 163 ? getUnresolvedSymbolForEntityName(name.left) : + name.kind === 208 ? getUnresolvedSymbolForEntityName(name.expression) : undefined; var path = parentSymbol ? "".concat(getSymbolPath(parentSymbol), ".").concat(text) : text; var result = unresolvedSymbols.get(path); @@ -50645,7 +51149,7 @@ var ts; var valueType = getTypeOfSymbol(symbol); var typeType = valueType; if (symbol.valueDeclaration) { - var isImportTypeWithQualifier = node.kind === 200 && node.qualifier; + var isImportTypeWithQualifier = node.kind === 202 && node.qualifier; if (valueType.symbol && valueType.symbol !== symbol && isImportTypeWithQualifier) { typeType = getTypeReferenceType(node, valueType.symbol); } @@ -50654,23 +51158,27 @@ var ts; } return links.resolvedJSDocType; } - function getSubstitutionType(baseType, substitute) { - if (substitute.flags & 3 || substitute === baseType) { + function getSubstitutionType(baseType, constraint) { + if (constraint.flags & 3 || constraint === baseType || + !isGenericType(baseType) && !isGenericType(constraint)) { return baseType; } - var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(substitute)); + var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(constraint)); var cached = substitutionTypes.get(id); if (cached) { return cached; } var result = createType(33554432); result.baseType = baseType; - result.substitute = substitute; + result.constraint = constraint; substitutionTypes.set(id, result); return result; } + function getSubstitutionIntersection(substitutionType) { + return getIntersectionType([substitutionType.constraint, substitutionType.baseType]); + } function isUnaryTupleTypeNode(node) { - return node.kind === 184 && node.elements.length === 1; + return node.kind === 186 && node.elements.length === 1; } function getImpliedConstraint(type, checkNode, extendsNode) { return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(type, checkNode.elements[0], extendsNode.elements[0]) : @@ -50680,18 +51188,18 @@ var ts; function getConditionalFlowTypeOfType(type, node) { var constraints; var covariant = true; - while (node && !ts.isStatement(node) && node.kind !== 320) { + while (node && !ts.isStatement(node) && node.kind !== 323) { var parent = node.parent; - if (parent.kind === 164) { + if (parent.kind === 166) { covariant = !covariant; } - if ((covariant || type.flags & 8650752) && parent.kind === 189 && node === parent.trueType) { + if ((covariant || type.flags & 8650752) && parent.kind === 191 && node === parent.trueType) { var constraint = getImpliedConstraint(type, parent.checkType, parent.extendsType); if (constraint) { constraints = ts.append(constraints, constraint); } } - else if (type.flags & 262144 && parent.kind === 195 && node === parent.type) { + else if (type.flags & 262144 && parent.kind === 197 && node === parent.type) { var mappedType = getTypeFromTypeNode(parent); if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) { var typeParameter = getHomomorphicTypeVariable(mappedType); @@ -50705,10 +51213,10 @@ var ts; } node = parent; } - return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type; + return constraints ? getSubstitutionType(type, getIntersectionType(constraints)) : type; } function isJSDocTypeReference(node) { - return !!(node.flags & 8388608) && (node.kind === 178 || node.kind === 200); + return !!(node.flags & 8388608) && (node.kind === 180 || node.kind === 202); } function checkNoTypeArguments(node, symbol) { if (node.typeArguments) { @@ -50816,9 +51324,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 257: - case 258: case 260: + case 261: + case 263: return declaration; } } @@ -50959,6 +51467,13 @@ var ts; function getGlobalBigIntType() { return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", 0, false))) || emptyObjectType; } + function getGlobalNaNSymbol() { + return (deferredGlobalNaNSymbol || (deferredGlobalNaNSymbol = getGlobalValueSymbol("NaN", false))); + } + function getGlobalRecordSymbol() { + deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", 2, true) || unknownSymbol); + return deferredGlobalRecordSymbol === unknownSymbol ? undefined : deferredGlobalRecordSymbol; + } function createTypeFromGenericGlobalType(genericGlobalType, typeArguments) { return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType; } @@ -50973,11 +51488,11 @@ var ts; } function getTupleElementFlags(node) { switch (node.kind) { - case 185: + case 187: return 2; - case 186: + case 188: return getRestTypeElementFlags(node); - case 197: + case 199: return node.questionToken ? 2 : node.dotDotDotToken ? getRestTypeElementFlags(node) : 1; @@ -50995,57 +51510,57 @@ var ts; return readonly ? globalReadonlyArrayType : globalArrayType; } var elementFlags = ts.map(node.elements, getTupleElementFlags); - var missingName = ts.some(node.elements, function (e) { return e.kind !== 197; }); + var missingName = ts.some(node.elements, function (e) { return e.kind !== 199; }); return getTupleTargetType(elementFlags, readonly, missingName ? undefined : node.elements); } function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) { - return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 183 ? mayResolveTypeAlias(node.elementType) : - node.kind === 184 ? ts.some(node.elements, mayResolveTypeAlias) : + return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 185 ? mayResolveTypeAlias(node.elementType) : + node.kind === 186 ? ts.some(node.elements, mayResolveTypeAlias) : hasDefaultTypeArguments || ts.some(node.typeArguments, mayResolveTypeAlias)); } function isResolvedByTypeAlias(node) { var parent = node.parent; switch (parent.kind) { - case 191: - case 197: - case 178: - case 187: - case 188: - case 194: - case 189: case 193: - case 183: - case 184: + case 199: + case 180: + case 189: + case 190: + case 196: + case 191: + case 195: + case 185: + case 186: return isResolvedByTypeAlias(parent); - case 259: + case 262: return true; } return false; } function mayResolveTypeAlias(node) { switch (node.kind) { - case 178: + case 180: return isJSDocTypeReference(node) || !!(resolveTypeReferenceName(node, 788968).flags & 524288); - case 181: + case 183: return true; + case 195: + return node.operator !== 156 && mayResolveTypeAlias(node.type); case 193: - return node.operator !== 154 && mayResolveTypeAlias(node.type); - case 191: - case 185: - case 197: - case 316: - case 314: - case 315: - case 309: - return mayResolveTypeAlias(node.type); - case 186: - return node.type.kind !== 183 || mayResolveTypeAlias(node.type.elementType); case 187: + case 199: + case 319: + case 317: + case 318: + case 312: + return mayResolveTypeAlias(node.type); case 188: - return ts.some(node.types, mayResolveTypeAlias); - case 194: - return mayResolveTypeAlias(node.objectType) || mayResolveTypeAlias(node.indexType); + return node.type.kind !== 185 || mayResolveTypeAlias(node.type.elementType); case 189: + case 190: + return ts.some(node.types, mayResolveTypeAlias); + case 196: + return mayResolveTypeAlias(node.objectType) || mayResolveTypeAlias(node.indexType); + case 191: return mayResolveTypeAlias(node.checkType) || mayResolveTypeAlias(node.extendsType) || mayResolveTypeAlias(node.trueType) || mayResolveTypeAlias(node.falseType); } @@ -51058,19 +51573,19 @@ var ts; if (target === emptyGenericType) { links.resolvedType = emptyObjectType; } - else if (!(node.kind === 184 && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8); })) && isDeferredTypeReferenceNode(node)) { - links.resolvedType = node.kind === 184 && node.elements.length === 0 ? target : + else if (!(node.kind === 186 && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8); })) && isDeferredTypeReferenceNode(node)) { + links.resolvedType = node.kind === 186 && node.elements.length === 0 ? target : createDeferredTypeReference(target, node, undefined); } else { - var elementTypes = node.kind === 183 ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); + var elementTypes = node.kind === 185 ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); links.resolvedType = createNormalizedTypeReference(target, elementTypes); } } return links.resolvedType; } function isReadonlyTypeOperator(node) { - return ts.isTypeOperatorNode(node) && node.operator === 145; + return ts.isTypeOperatorNode(node) && node.operator === 146; } function createTupleType(elementTypes, elementFlags, readonly, namedMemberDeclarations) { if (readonly === void 0) { readonly = false; } @@ -51170,7 +51685,7 @@ var ts; var lastRequiredIndex = -1; var firstRestIndex = -1; var lastOptionalOrRestIndex = -1; - var _loop_16 = function (i) { + var _loop_17 = function (i) { var type = elementTypes[i]; var flags = target.elementFlags[i]; if (flags & 8) { @@ -51196,9 +51711,9 @@ var ts; } }; for (var i = 0; i < elementTypes.length; i++) { - var state_4 = _loop_16(i); - if (typeof state_4 === "object") - return state_4.value; + var state_5 = _loop_17(i); + if (typeof state_5 === "object") + return state_5.value; } for (var i = 0; i < lastRequiredIndex; i++) { if (expandedFlags[i] & 2) @@ -51224,7 +51739,7 @@ var ts; if (flags & (2 | 4)) { lastOptionalOrRestIndex = expandedFlags.length; } - expandedTypes.push(type); + expandedTypes.push(flags & 2 ? addOptionality(type, true) : type); expandedFlags.push(flags); if (expandedDeclarations && declaration) { expandedDeclarations.push(declaration); @@ -51373,7 +51888,7 @@ var ts; var templates = ts.filter(types, isPatternLiteralType); if (templates.length) { var i = types.length; - var _loop_17 = function () { + var _loop_18 = function () { i--; var t = types[i]; if (t.flags & 128 && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) { @@ -51381,7 +51896,7 @@ var ts; } }; while (i > 0) { - _loop_17(); + _loop_18(); } } } @@ -51451,14 +51966,14 @@ var ts; var namedUnions = []; addNamedUnions(namedUnions, types); var reducedTypes = []; - var _loop_18 = function (t) { + var _loop_19 = function (t) { if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) { reducedTypes.push(t); } }; for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) { var t = typeSet_1[_i]; - _loop_18(t); + _loop_19(t); } if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) { return namedUnions[0]; @@ -51871,7 +52386,7 @@ var ts; type.flags & 16777216 ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 | 134217728) ? ts.every(type.types, isDistributive) : type.flags & 8388608 ? isDistributive(type.objectType) && isDistributive(type.indexType) : - type.flags & 33554432 ? isDistributive(type.substitute) : + type.flags & 33554432 ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 ? isDistributive(type.type) : false; } @@ -51945,15 +52460,15 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { switch (node.operator) { - case 140: + case 141: links.resolvedType = getIndexType(getTypeFromTypeNode(node.type)); break; - case 154: - links.resolvedType = node.type.kind === 151 + case 156: + links.resolvedType = node.type.kind === 153 ? getESSymbolLikeTypeForNode(ts.walkUpParenthesizedTypes(node.parent)) : errorType; break; - case 145: + case 146: links.resolvedType = getTypeFromTypeNode(node.type); break; default: @@ -52134,7 +52649,7 @@ var ts; } function getPropertyTypeForIndexType(originalObjectType, objectType, indexType, fullIndexType, accessNode, accessFlags) { var _a; - var accessExpression = accessNode && accessNode.kind === 207 ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 209 ? accessNode : undefined; var propName = accessNode && ts.isPrivateIdentifier(accessNode) ? undefined : getPropertyNameFromIndex(indexType, accessNode); if (propName !== undefined) { if (accessFlags & 256) { @@ -52303,9 +52818,9 @@ var ts; } } function getIndexNodeForAccessExpression(accessNode) { - return accessNode.kind === 207 ? accessNode.argumentExpression : - accessNode.kind === 194 ? accessNode.indexType : - accessNode.kind === 162 ? accessNode.expression : + return accessNode.kind === 209 ? accessNode.argumentExpression : + accessNode.kind === 196 ? accessNode.indexType : + accessNode.kind === 164 ? accessNode.expression : accessNode; } function isPatternLiteralPlaceholderType(type) { @@ -52334,7 +52849,7 @@ var ts; if (type.flags & 33554432) { if (!(type.objectFlags & 2097152)) { type.objectFlags |= 2097152 | - getGenericObjectFlags(type.substitute) | getGenericObjectFlags(type.baseType); + getGenericObjectFlags(type.baseType) | getGenericObjectFlags(type.constraint); } return type.objectFlags & 12582912; } @@ -52447,7 +52962,7 @@ var ts; } if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32) accessFlags |= 1; - if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 194 ? + if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 196 ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) { if (objectType.flags & 3) { @@ -52493,11 +53008,7 @@ var ts; var objectType = getTypeFromTypeNode(node.objectType); var indexType = getTypeFromTypeNode(node.indexType); var potentialAlias = getAliasSymbolForTypeNode(node); - var resolved = getIndexedAccessType(objectType, indexType, 0, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); - links.resolvedType = resolved.flags & 8388608 && - resolved.objectType === objectType && - resolved.indexType === indexType ? - getConditionalFlowTypeOfType(resolved, node) : resolved; + links.resolvedType = getIndexedAccessType(objectType, indexType, 0, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); } return links.resolvedType; } @@ -52544,7 +53055,7 @@ var ts; var result; var extraTypes; var tailCount = 0; - var _loop_19 = function () { + var _loop_20 = function () { if (tailCount === 1000) { error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite); result = errorType; @@ -52618,10 +53129,10 @@ var ts; return "break"; }; while (true) { - var state_5 = _loop_19(); - if (typeof state_5 === "object") - return state_5.value; - if (state_5 === "break") + var state_6 = _loop_20(); + if (typeof state_6 === "object") + return state_6.value; + if (state_6 === "break") break; } return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result; @@ -52805,7 +53316,7 @@ var ts; } function getAliasSymbolForTypeNode(node) { var host = node.parent; - while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 145) { + while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 146) { host = host.parent; } return ts.isTypeAlias(host) ? getSymbolOfNode(host) : undefined; @@ -53039,7 +53550,7 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 258)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 261)) { if (!ts.isStatic(container) && (!ts.isConstructorDeclaration(container) || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; @@ -53070,17 +53581,17 @@ var ts; } function getArrayElementTypeNode(node) { switch (node.kind) { - case 191: + case 193: return getArrayElementTypeNode(node.type); - case 184: + case 186: if (node.elements.length === 1) { node = node.elements[0]; - if (node.kind === 186 || node.kind === 197 && node.dotDotDotToken) { + if (node.kind === 188 || node.kind === 199 && node.dotDotDotToken) { return getArrayElementTypeNode(node.type); } } break; - case 183: + case 185: return node.elementType; } return undefined; @@ -53096,94 +53607,94 @@ var ts; } function getTypeFromTypeNodeWorker(node) { switch (node.kind) { - case 130: - case 312: - case 313: + case 131: + case 315: + case 316: return anyType; - case 155: + case 157: return unknownType; - case 150: + case 152: return stringType; - case 147: + case 148: return numberType; - case 158: + case 160: return bigintType; - case 133: + case 134: return booleanType; - case 151: + case 153: return esSymbolType; case 114: return voidType; - case 153: + case 155: return undefinedType; case 104: return nullType; - case 143: + case 144: return neverType; - case 148: + case 149: return node.flags & 262144 && !noImplicitAny ? anyType : nonPrimitiveType; - case 138: + case 139: return intrinsicMarkerType; - case 192: + case 194: case 108: return getTypeFromThisTypeNode(node); - case 196: - return getTypeFromLiteralTypeNode(node); - case 178: - return getTypeFromTypeReference(node); - case 177: - return node.assertsModifier ? voidType : booleanType; - case 228: - return getTypeFromTypeReference(node); - case 181: - return getTypeFromTypeQueryNode(node); - case 183: - case 184: - return getTypeFromArrayOrTupleTypeNode(node); - case 185: - return getTypeFromOptionalTypeNode(node); - case 187: - return getTypeFromUnionTypeNode(node); - case 188: - return getTypeFromIntersectionTypeNode(node); - case 314: - return getTypeFromJSDocNullableTypeNode(node); - case 316: - return addOptionality(getTypeFromTypeNode(node.type)); - case 197: - return getTypeFromNamedTupleTypeNode(node); - case 191: - case 315: - case 309: - return getTypeFromTypeNode(node.type); - case 186: - return getTypeFromRestTypeNode(node); - case 318: - return getTypeFromJSDocVariadicType(node); - case 179: - case 180: - case 182: - case 322: - case 317: - case 323: - return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 193: - return getTypeFromTypeOperatorNode(node); - case 194: - return getTypeFromIndexedAccessTypeNode(node); - case 195: - return getTypeFromMappedTypeNode(node); - case 189: - return getTypeFromConditionalTypeNode(node); - case 190: - return getTypeFromInferTypeNode(node); case 198: - return getTypeFromTemplateTypeNode(node); + return getTypeFromLiteralTypeNode(node); + case 180: + return getTypeFromTypeReference(node); + case 179: + return node.assertsModifier ? voidType : booleanType; + case 230: + return getTypeFromTypeReference(node); + case 183: + return getTypeFromTypeQueryNode(node); + case 185: + case 186: + return getTypeFromArrayOrTupleTypeNode(node); + case 187: + return getTypeFromOptionalTypeNode(node); + case 189: + return getTypeFromUnionTypeNode(node); + case 190: + return getTypeFromIntersectionTypeNode(node); + case 317: + return getTypeFromJSDocNullableTypeNode(node); + case 319: + return addOptionality(getTypeFromTypeNode(node.type)); + case 199: + return getTypeFromNamedTupleTypeNode(node); + case 193: + case 318: + case 312: + return getTypeFromTypeNode(node.type); + case 188: + return getTypeFromRestTypeNode(node); + case 321: + return getTypeFromJSDocVariadicType(node); + case 181: + case 182: + case 184: + case 325: + case 320: + case 326: + return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); + case 195: + return getTypeFromTypeOperatorNode(node); + case 196: + return getTypeFromIndexedAccessTypeNode(node); + case 197: + return getTypeFromMappedTypeNode(node); + case 191: + return getTypeFromConditionalTypeNode(node); + case 192: + return getTypeFromInferTypeNode(node); case 200: + return getTypeFromTemplateTypeNode(node); + case 202: return getTypeFromImportTypeNode(node); case 79: - case 161: - case 206: + case 163: + case 208: var symbol = getSymbolAtLocation(node); return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType; default: @@ -53286,8 +53797,8 @@ var ts; return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5, mapper, makeUnaryTypeMapper(source, target)); } function getRestrictiveTypeParameter(tp) { - return tp.constraint === unknownType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), - tp.restrictiveInstantiation.constraint = unknownType, + return !tp.constraint && !getConstraintDeclaration(tp) || tp.constraint === noConstraintType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), + tp.restrictiveInstantiation.constraint = noConstraintType, tp.restrictiveInstantiation); } function cloneTypeParameter(typeParameter) { @@ -53379,14 +53890,14 @@ var ts; return type; } function maybeTypeParameterReference(node) { - return !(node.parent.kind === 178 && node.parent.typeArguments && node === node.parent.typeName || - node.parent.kind === 200 && node.parent.typeArguments && node === node.parent.qualifier); + return !(node.parent.kind === 180 && node.parent.typeArguments && node === node.parent.typeName || + node.parent.kind === 202 && node.parent.typeArguments && node === node.parent.qualifier); } function isTypeParameterPossiblyReferenced(tp, node) { if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) { var container = tp.symbol.declarations[0].parent; for (var n = node; n !== container; n = n.parent) { - if (!n || n.kind === 235 || n.kind === 189 && ts.forEachChild(n.extendsType, containsReference)) { + if (!n || n.kind === 238 || n.kind === 191 && ts.forEachChild(n.extendsType, containsReference)) { return true; } } @@ -53395,15 +53906,33 @@ var ts; return true; function containsReference(node) { switch (node.kind) { - case 192: + case 194: return !!tp.isThisType; case 79: return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) && getTypeFromTypeNodeWorker(node) === tp; - case 181: + case 183: + var entityName = node.exprName; + var firstIdentifier = ts.getFirstIdentifier(entityName); + var firstIdentifierSymbol = getResolvedSymbol(firstIdentifier); + var tpDeclaration = tp.symbol.declarations[0]; + var tpScope_1; + if (tpDeclaration.kind === 165) { + tpScope_1 = tpDeclaration.parent; + } + else if (tp.isThisType) { + tpScope_1 = tpDeclaration; + } + else { + return true; + } + if (firstIdentifierSymbol.declarations) { + return ts.some(firstIdentifierSymbol.declarations, function (idDecl) { return ts.isNodeDescendantOf(idDecl, tpScope_1); }) || + ts.some(node.typeArguments, containsReference); + } return true; - case 169: - case 168: + case 171: + case 170: return !node.type && !!node.body || ts.some(node.typeParameters, containsReference) || ts.some(node.parameters, containsReference) || @@ -53599,17 +54128,15 @@ var ts; return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments); } if (flags & 33554432) { - var maybeVariable = instantiateType(type.baseType, mapper); - if (maybeVariable.flags & 8650752) { - return getSubstitutionType(maybeVariable, instantiateType(type.substitute, mapper)); + var newBaseType = instantiateType(type.baseType, mapper); + var newConstraint = instantiateType(type.constraint, mapper); + if (newBaseType.flags & 8650752 && isGenericType(newConstraint)) { + return getSubstitutionType(newBaseType, newConstraint); } - else { - var sub = instantiateType(type.substitute, mapper); - if (sub.flags & 3 || isTypeAssignableTo(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) { - return maybeVariable; - } - return sub; + if (newConstraint.flags & 3 || isTypeAssignableTo(getRestrictiveInstantiation(newBaseType), getRestrictiveInstantiation(newConstraint))) { + return newBaseType; } + return newBaseType.flags & 8650752 ? getSubstitutionType(newBaseType, newConstraint) : getIntersectionType([newConstraint, newBaseType]); } return type; } @@ -53651,34 +54178,34 @@ var ts; return createIndexInfo(info.keyType, instantiateType(info.type, mapper), info.isReadonly, info.declaration); } function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 169 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 213: - case 214: - case 169: - case 256: + case 215: + case 216: + case 171: + case 259: return isContextSensitiveFunctionLikeDeclaration(node); - case 205: + case 207: return ts.some(node.properties, isContextSensitive); - case 204: + case 206: return ts.some(node.elements, isContextSensitive); - case 222: + case 224: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 221: + case 223: return (node.operatorToken.kind === 56 || node.operatorToken.kind === 60) && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 296: + case 299: return isContextSensitive(node.initializer); - case 212: + case 214: return isContextSensitive(node.expression); - case 286: + case 289: return ts.some(node.properties, isContextSensitive) || ts.isJsxOpeningElement(node.parent) && ts.some(node.parent.parent.children, isContextSensitive); - case 285: { + case 288: { var initializer = node.initializer; return !!initializer && isContextSensitive(initializer); } - case 288: { + case 291: { var expression = node.expression; return !!expression && isContextSensitive(expression); } @@ -53686,14 +54213,13 @@ var ts; return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return (!ts.isFunctionDeclaration(node) || ts.isInJSFile(node) && !!getTypeForDeclarationFromJSDocComment(node)) && - (ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node)); + return ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node); } function hasContextSensitiveReturnExpression(node) { - return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 235 && isContextSensitive(node.body); + return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 238 && isContextSensitive(node.body); } function isContextSensitiveFunctionOrObjectLiteralMethod(func) { - return (ts.isInJSFile(func) && ts.isFunctionDeclaration(func) || ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && + return (ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func); } function getTypeWithoutSignatures(type) { @@ -53771,23 +54297,23 @@ var ts; return true; } switch (node.kind) { - case 288: - case 212: + case 291: + case 214: return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); - case 221: + case 223: switch (node.operatorToken.kind) { case 63: case 27: return elaborateError(node.right, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); } break; - case 205: + case 207: return elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 204: + case 206: return elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 286: + case 289: return elaborateJsxComponents(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 214: + case 216: return elaborateArrowFunction(node, source, target, relation, containingMessageChain, errorOutputContainer); } return false; @@ -53983,16 +54509,16 @@ var ts; } function getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic) { switch (child.kind) { - case 288: + case 291: return { errorNode: child, innerExpression: child.expression, nameType: nameType }; case 11: if (child.containsOnlyTriviaWhiteSpaces) { break; } return { errorNode: child, innerExpression: undefined, nameType: nameType, errorMessage: getInvalidTextDiagnostic() }; - case 278: - case 279: + case 281: case 282: + case 285: return { errorNode: child, innerExpression: child, nameType: nameType }; default: return ts.Debug.assertNever(child, "Found invalid jsx child"); @@ -54134,11 +54660,11 @@ var ts; } _b = prop.kind; switch (_b) { - case 173: return [3, 2]; - case 172: return [3, 2]; - case 169: return [3, 2]; - case 297: return [3, 2]; - case 296: return [3, 4]; + case 175: return [3, 2]; + case 174: return [3, 2]; + case 171: return [3, 2]; + case 300: return [3, 2]; + case 299: return [3, 4]; } return [3, 6]; case 2: return [4, { errorNode: prop.name, innerExpression: undefined, nameType: type }]; @@ -54199,8 +54725,8 @@ var ts; void instantiateType(sourceRestType || targetRestType, reportUnreliableMarkers); } var kind = target.declaration ? target.declaration.kind : 0; - var strictVariance = !(checkMode & 3) && strictFunctionTypes && kind !== 169 && - kind !== 168 && kind !== 171; + var strictVariance = !(checkMode & 3) && strictFunctionTypes && kind !== 171 && + kind !== 170 && kind !== 173; var result = -1; var sourceThisType = getThisTypeOfSignature(source); if (sourceThisType && sourceThisType !== voidType) { @@ -54473,7 +54999,7 @@ var ts; var t = isFreshLiteralType(type) ? type.regularType : ts.getObjectFlags(type) & 4 ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 ? getNormalizedUnionOrIntersectionType(type, writing) : - type.flags & 33554432 ? writing ? type.baseType : type.substitute : + type.flags & 33554432 ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 ? getSimplifiedType(type, writing) : type; if (t === type) @@ -54823,7 +55349,8 @@ var ts; return 0; } } - var isPerformingCommonPropertyChecks = relation !== comparableRelation && !(intersectionState & 2) && + var isPerformingCommonPropertyChecks = (relation !== comparableRelation || !(source.flags & 1048576) && isLiteralType(source)) && + !(intersectionState & 2) && source.flags & (131068 | 524288 | 2097152) && source !== globalObjectType && target.flags & (524288 | 2097152) && isWeakType(target) && (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source)); @@ -54964,7 +55491,7 @@ var ts; reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target); checkTypes = reducedTarget.flags & 1048576 ? reducedTarget.types : [reducedTarget]; } - var _loop_20 = function (prop) { + var _loop_21 = function (prop) { if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) { if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) { if (reportErrors) { @@ -55017,9 +55544,9 @@ var ts; }; for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) { var prop = _b[_i]; - var state_6 = _loop_20(prop); - if (typeof state_6 === "object") - return state_6.value; + var state_7 = _loop_21(prop); + if (typeof state_7 === "object") + return state_7.value; } return false; } @@ -55039,11 +55566,15 @@ var ts; return typeRelatedToEachType(source, target, reportErrors, 2); } if (relation === comparableRelation && target.flags & 131068) { - var constraints = ts.sameMap(source.types, getBaseConstraintOrType); + var constraints = ts.sameMap(source.types, function (t) { return t.flags & 465829888 ? getBaseConstraintOfType(t) || unknownType : t; }); if (constraints !== source.types) { source = getIntersectionType(constraints); + if (source.flags & 131072) { + return 0; + } if (!(source.flags & 2097152)) { - return isRelatedTo(source, target, 1, false); + return isRelatedTo(source, target, 1, false) || + isRelatedTo(target, source, 1, false); } } } @@ -55304,7 +55835,7 @@ var ts; var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo); if (!result && (source.flags & 2097152 || source.flags & 262144 && target.flags & 1048576)) { var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 ? source.types : [source], !!(target.flags & 1048576)); - if (constraint && everyType(constraint, function (c) { return c !== source; })) { + if (constraint && !(constraint.flags & 131072) && everyType(constraint, function (c) { return c !== source; })) { result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState); } } @@ -55354,7 +55885,11 @@ var ts; } } if (sourceFlags & 33554432) { - return isRelatedTo(source.substitute, target.substitute, 3, false); + if (result = isRelatedTo(source.baseType, target.baseType, 3, false)) { + if (result &= isRelatedTo(source.constraint, target.constraint, 3, false)) { + return result; + } + } } if (!(sourceFlags & 524288)) { return 0; @@ -55788,11 +56323,11 @@ var ts; } var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes); var matchingTypes = []; - var _loop_21 = function (combination) { + var _loop_22 = function (combination) { var hasMatch = false; outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) { var type = _d[_c]; - var _loop_22 = function (i) { + var _loop_23 = function (i) { var sourceProperty = sourcePropertiesFiltered[i]; var targetProperty = getPropertyOfType(type, sourceProperty.escapedName); if (!targetProperty) @@ -55805,8 +56340,8 @@ var ts; } }; for (var i = 0; i < sourcePropertiesFiltered.length; i++) { - var state_8 = _loop_22(i); - switch (state_8) { + var state_9 = _loop_23(i); + switch (state_9) { case "continue-outer": continue outer; } } @@ -55819,9 +56354,9 @@ var ts; }; for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) { var combination = discriminantCombinations_1[_a]; - var state_7 = _loop_21(combination); - if (typeof state_7 === "object") - return state_7.value; + var state_8 = _loop_22(combination); + if (typeof state_8 === "object") + return state_8.value; } var result = -1; for (var _b = 0, matchingTypes_1 = matchingTypes; _b < matchingTypes_1.length; _b++) { @@ -55935,7 +56470,7 @@ var ts; shouldSkipElaboration = true; } if (props.length === 1) { - var propName = symbolToString(unmatchedProperty); + var propName = symbolToString(unmatchedProperty, undefined, 0, 4 | 16); reportError.apply(void 0, __spreadArray([ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName], getTypeNamesForErrorDisplay(source, target), false)); if (ts.length(unmatchedProperty.declarations)) { associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName)); @@ -56167,7 +56702,7 @@ var ts; var targetSignature = ts.first(targetSignatures); result = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors, incompatibleReporter(sourceSignature, targetSignature)); if (!result && reportErrors && kind === 1 && (sourceObjectFlags & targetObjectFlags) && - (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 171 || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 171)) { + (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 173 || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 173)) { var constructSignatureToString = function (signature) { return signatureToString(signature, undefined, 262144, kind); }; @@ -56463,7 +56998,7 @@ var ts; ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes", "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) }); links.variances = ts.emptyArray; var variances = []; - var _loop_23 = function (tp) { + var _loop_24 = function (tp) { var modifiers = getVarianceModifiers(tp); var variance = modifiers & 65536 ? modifiers & 32768 ? 0 : 1 : @@ -56494,7 +57029,7 @@ var ts; }; for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) { var tp = typeParameters_2[_i]; - _loop_23(tp); + _loop_24(tp); } links.variances = variances; ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) }); @@ -56828,7 +57363,7 @@ var ts; var target = type.target; if (ts.getObjectFlags(target) & 1) { var baseTypeNode = getBaseTypeNodeOfClass(target); - if (baseTypeNode && baseTypeNode.expression.kind !== 79 && baseTypeNode.expression.kind !== 206) { + if (baseTypeNode && baseTypeNode.expression.kind !== 79 && baseTypeNode.expression.kind !== 208) { return undefined; } } @@ -56919,7 +57454,7 @@ var ts; if (!isLiteralOfContextualType(type, contextualType)) { type = getWidenedUniqueESSymbolType(getWidenedLiteralType(type)); } - return type; + return getRegularTypeOfLiteralType(type); } function getWidenedLiteralLikeTypeForContextualReturnTypeIfNeeded(type, contextualSignatureReturnType, isAsync) { if (type && isUnitType(type)) { @@ -57005,7 +57540,8 @@ var ts; function getOptionalType(type, isProperty) { if (isProperty === void 0) { isProperty = false; } ts.Debug.assert(strictNullChecks); - return type.flags & 32768 ? type : getUnionType([type, isProperty ? missingType : undefinedType]); + var missingOrUndefined = isProperty ? missingType : undefinedType; + return type.flags & 32768 || type.flags & 1048576 && type.types[0] === missingOrUndefined ? type : getUnionType([type, missingOrUndefined]); } function getGlobalNonNullableTypeInstantiation(type) { if (!deferredGlobalNonNullableTypeAlias) { @@ -57248,12 +57784,12 @@ var ts; } var diagnostic; switch (declaration.kind) { - case 221: - case 167: - case 166: + case 223: + case 169: + case 168: diagnostic = noImplicitAny ? ts.Diagnostics.Member_0_implicitly_has_an_1_type : ts.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 164: + case 166: var param = declaration; if (ts.isIdentifier(param.name) && (ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) && @@ -57269,22 +57805,22 @@ var ts; noImplicitAny ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage : noImplicitAny ? ts.Diagnostics.Parameter_0_implicitly_has_an_1_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 203: + case 205: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; if (!noImplicitAny) { return; } break; - case 317: + case 320: error(declaration, ts.Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; - case 256: - case 169: - case 168: - case 172: - case 173: - case 213: - case 214: + case 259: + case 171: + case 170: + case 174: + case 175: + case 215: + case 216: if (noImplicitAny && !declaration.name) { if (wideningKind === 3) { error(declaration, ts.Diagnostics.Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation, typeAsString); @@ -57298,7 +57834,7 @@ var ts; wideningKind === 3 ? ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type : ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; break; - case 195: + case 197: if (noImplicitAny) { error(declaration, ts.Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type); } @@ -57399,7 +57935,7 @@ var ts; if (context.intraExpressionInferenceSites) { for (var _i = 0, _a = context.intraExpressionInferenceSites; _i < _a.length; _i++) { var _b = _a[_i], node = _b.node, type = _b.type; - var contextualType = node.kind === 169 ? + var contextualType = node.kind === 171 ? getContextualTypeForObjectLiteralMethod(node, 2) : getContextualType(node, 2); if (contextualType) { @@ -57459,8 +57995,8 @@ var ts; } function isNonGenericTopLevelType(type) { if (type.aliasSymbol && !type.aliasTypeArguments) { - var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 259); - return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 305 ? true : n.kind === 261 ? false : "quit"; })); + var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 262); + return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 308 ? true : n.kind === 264 ? false : "quit"; })); } return false; } @@ -57813,7 +58349,7 @@ var ts; } var inference = getInferenceInfoForType(target); if (inference) { - if (ts.getObjectFlags(source) & 262144) { + if (ts.getObjectFlags(source) & 262144 || source === nonInferrableAnyType) { return; } if (!inference.isFixed) { @@ -57880,7 +58416,7 @@ var ts; } else if (source.flags & 33554432) { inferFromTypes(source.baseType, target); - inferWithPriority(source.substitute, target, 4); + inferWithPriority(getSubstitutionIntersection(source), target, 4); } else if (target.flags & 16777216) { invokeOnce(source, target, inferToConditionalType); @@ -58138,7 +58674,7 @@ var ts; var matches = inferTypesFromTemplateLiteralType(source, target); var types = target.types; if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) { - var _loop_24 = function (i) { + var _loop_25 = function (i) { var source_1 = matches ? matches[i] : neverType; var target_3 = types[i]; if (source_1.flags & 128 && target_3.flags & 8650752) { @@ -58182,7 +58718,7 @@ var ts; inferFromTypes(source_1, target_3); }; for (var i = 0; i < types.length; i++) { - _loop_24(i); + _loop_25(i); } } } @@ -58289,7 +58825,7 @@ var ts; function inferFromSignature(source, target) { var saveBivariant = bivariant; var kind = target.declaration ? target.declaration.kind : 0; - bivariant = bivariant || kind === 169 || kind === 168 || kind === 171; + bivariant = bivariant || kind === 171 || kind === 170 || kind === 173; applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes); bivariant = saveBivariant; applyToReturnTypes(source, target, inferFromTypes); @@ -58468,7 +59004,7 @@ var ts; return ts.Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function; } default: - if (node.parent.kind === 297) { + if (node.parent.kind === 300) { return ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer; } else { @@ -58485,7 +59021,7 @@ var ts; return links.resolvedSymbol; } function isInTypeQuery(node) { - return !!ts.findAncestor(node, function (n) { return n.kind === 181 ? true : n.kind === 79 || n.kind === 161 ? false : "quit"; }); + return !!ts.findAncestor(node, function (n) { return n.kind === 183 ? true : n.kind === 79 || n.kind === 163 ? false : "quit"; }); } function getFlowCacheKey(node, declaredType, initialType, flowContainer) { switch (node.kind) { @@ -58496,42 +59032,42 @@ var ts; } case 108: return "0|".concat(flowContainer ? getNodeId(flowContainer) : "-1", "|").concat(getTypeId(declaredType), "|").concat(getTypeId(initialType)); - case 230: - case 212: + case 232: + case 214: return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); - case 161: + case 163: var left = getFlowCacheKey(node.left, declaredType, initialType, flowContainer); return left && left + "." + node.right.escapedText; - case 206: - case 207: + case 208: + case 209: var propName = getAccessedPropertyName(node); if (propName !== undefined) { var key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); return key && key + "." + propName; } break; - case 201: - case 202: - case 256: - case 213: - case 214: - case 169: + case 203: + case 204: + case 259: + case 215: + case 216: + case 171: return "".concat(getNodeId(node), "#").concat(getTypeId(declaredType)); } return undefined; } function isMatchingReference(source, target) { switch (target.kind) { - case 212: - case 230: + case 214: + case 232: return isMatchingReference(source, target.expression); - case 221: + case 223: return (ts.isAssignmentExpression(target) && isMatchingReference(source, target.left)) || (ts.isBinaryExpression(target) && target.operatorToken.kind === 27 && isMatchingReference(source, target.right)); } switch (source.kind) { - case 231: - return target.kind === 231 + case 233: + return target.kind === 233 && source.keywordToken === target.keywordToken && source.name.escapedText === target.name.escapedText; case 79: @@ -58539,26 +59075,26 @@ var ts; return ts.isThisInTypeQuery(source) ? target.kind === 108 : target.kind === 79 && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 254 || target.kind === 203) && + (target.kind === 257 || target.kind === 205) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 108: return target.kind === 108; case 106: return target.kind === 106; - case 230: - case 212: + case 232: + case 214: return isMatchingReference(source.expression, target); - case 206: - case 207: + case 208: + case 209: var sourcePropertyName = getAccessedPropertyName(source); var targetPropertyName = ts.isAccessExpression(target) ? getAccessedPropertyName(target) : undefined; return sourcePropertyName !== undefined && targetPropertyName !== undefined && targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression); - case 161: + case 163: return ts.isAccessExpression(target) && source.right.escapedText === getAccessedPropertyName(target) && isMatchingReference(source.left, target.expression); - case 221: + case 223: return (ts.isBinaryExpression(source) && source.operatorToken.kind === 27 && isMatchingReference(source.right, target)); } return false; @@ -58601,7 +59137,7 @@ var ts; return name; } } - if (ts.hasOnlyExpressionInitializer(declaration)) { + if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) { var initializer = ts.getEffectiveInitializer(declaration); return initializer && tryGetNameFromType(getTypeOfExpression(initializer)); } @@ -58657,7 +59193,7 @@ var ts; function mapTypesByKeyProperty(types, name) { var map = new ts.Map(); var count = 0; - var _loop_25 = function (type) { + var _loop_26 = function (type) { if (type.flags & (524288 | 2097152 | 58982400)) { var discriminant = getTypeOfPropertyOfType(type, name); if (discriminant) { @@ -58683,9 +59219,9 @@ var ts; }; for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { var type = types_15[_i]; - var state_9 = _loop_25(type); - if (typeof state_9 === "object") - return state_9.value; + var state_10 = _loop_26(type); + if (typeof state_10 === "object") + return state_10.value; } return count >= 10 && count * 2 >= types.length ? map : undefined; } @@ -58719,7 +59255,7 @@ var ts; } function getMatchingUnionConstituentForObjectLiteral(unionType, node) { var keyPropertyName = getKeyPropertyName(unionType); - var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 296 && + var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 299 && p.symbol.escapedName === keyPropertyName && isPossiblyDiscriminantValue(p.initializer); }); var propType = propNode && getContextFreeTypeOfExpression(propNode.initializer); return propType && getConstituentTypeForKeyType(unionType, propType); @@ -58736,7 +59272,7 @@ var ts; } } } - if (expression.expression.kind === 206 && + if (expression.expression.kind === 208 && isOrContainsMatchingReference(reference, expression.expression.expression)) { return true; } @@ -58919,15 +59455,15 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(65, type, undefinedType, undefined) || errorType); } function getAssignedTypeOfBinaryExpression(node) { - var isDestructuringDefaultAssignment = node.parent.kind === 204 && isDestructuringAssignmentTarget(node.parent) || - node.parent.kind === 296 && isDestructuringAssignmentTarget(node.parent.parent); + var isDestructuringDefaultAssignment = node.parent.kind === 206 && isDestructuringAssignmentTarget(node.parent) || + node.parent.kind === 299 && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } function isDestructuringAssignmentTarget(parent) { - return parent.parent.kind === 221 && parent.parent.left === parent || - parent.parent.kind === 244 && parent.parent.initializer === parent; + return parent.parent.kind === 223 && parent.parent.left === parent || + parent.parent.kind === 247 && parent.parent.initializer === parent; } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element)); @@ -58944,21 +59480,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 243: + case 246: return stringType; - case 244: + case 247: return checkRightHandSideOfForOf(parent) || errorType; - case 221: + case 223: return getAssignedTypeOfBinaryExpression(parent); - case 215: + case 217: return undefinedType; - case 204: + case 206: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 225: + case 227: return getAssignedTypeOfSpreadExpression(parent); - case 296: + case 299: return getAssignedTypeOfPropertyAssignment(parent); - case 297: + case 300: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return errorType; @@ -58966,7 +59502,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 201 ? + var type = pattern.kind === 203 ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) : @@ -58981,30 +59517,30 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 243) { + if (node.parent.parent.kind === 246) { return stringType; } - if (node.parent.parent.kind === 244) { + if (node.parent.parent.kind === 247) { return checkRightHandSideOfForOf(node.parent.parent) || errorType; } return errorType; } function getInitialType(node) { - return node.kind === 254 ? + return node.kind === 257 ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function isEmptyArrayAssignment(node) { - return node.kind === 254 && node.initializer && + return node.kind === 257 && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 203 && node.parent.kind === 221 && + node.kind !== 205 && node.parent.kind === 223 && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 212: + case 214: return getReferenceCandidate(node.expression); - case 221: + case 223: switch (node.operatorToken.kind) { case 63: case 75: @@ -59019,13 +59555,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 212 || - parent.kind === 221 && parent.operatorToken.kind === 63 && parent.left === node || - parent.kind === 221 && parent.operatorToken.kind === 27 && parent.right === node ? + return parent.kind === 214 || + parent.kind === 223 && parent.operatorToken.kind === 63 && parent.left === node || + parent.kind === 223 && parent.operatorToken.kind === 27 && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 289) { + if (clause.kind === 292) { return getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); } return neverType; @@ -59042,13 +59578,13 @@ var ts; return links.switchTypes; } function getSwitchClauseTypeOfWitnesses(switchStatement) { - if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 289 && !ts.isStringLiteralLike(clause.expression); })) { + if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 292 && !ts.isStringLiteralLike(clause.expression); })) { return undefined; } var witnesses = []; for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) { var clause = _a[_i]; - var text = clause.kind === 289 ? clause.expression.text : undefined; + var text = clause.kind === 292 ? clause.expression.text : undefined; witnesses.push(text && !ts.contains(witnesses, text) ? text : undefined); } return witnesses; @@ -59215,12 +59751,12 @@ var ts; var root = getReferenceRoot(node); var parent = root.parent; var isLengthPushOrUnshift = ts.isPropertyAccessExpression(parent) && (parent.name.escapedText === "length" || - parent.parent.kind === 208 + parent.parent.kind === 210 && ts.isIdentifier(parent.name) && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 207 && + var isElementAssignment = parent.kind === 209 && parent.expression === root && - parent.parent.kind === 221 && + parent.parent.kind === 223 && parent.parent.operatorToken.kind === 63 && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -59248,7 +59784,7 @@ var ts; if (isDeclarationWithExplicitTypeAnnotation(declaration)) { return getTypeOfSymbol(symbol); } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247) { var statement = declaration.parent.parent; var expressionType = getTypeOfDottedName(statement.expression, undefined); if (expressionType) { @@ -59272,7 +59808,7 @@ var ts; return getExplicitThisType(node); case 106: return checkSuperExpression(node); - case 206: { + case 208: { var type = getTypeOfDottedName(node.expression, diagnostic); if (type) { var name = node.name; @@ -59290,7 +59826,7 @@ var ts; } return undefined; } - case 212: + case 214: return getTypeOfDottedName(node.expression, diagnostic); } } @@ -59300,7 +59836,7 @@ var ts; var signature = links.effectsSignature; if (signature === undefined) { var funcType = void 0; - if (node.parent.kind === 238) { + if (node.parent.kind === 241) { funcType = getTypeOfDottedName(node.expression, undefined); } else if (node.expression.kind !== 106) { @@ -59344,7 +59880,7 @@ var ts; } function isFalseExpression(expr) { var node = ts.skipParentheses(expr, true); - return node.kind === 95 || node.kind === 221 && (node.operatorToken.kind === 55 && (isFalseExpression(node.left) || isFalseExpression(node.right)) || + return node.kind === 95 || node.kind === 223 && (node.operatorToken.kind === 55 && (isFalseExpression(node.left) || isFalseExpression(node.right)) || node.operatorToken.kind === 56 && isFalseExpression(node.left) && isFalseExpression(node.right)); } function isReachableFlowNodeWorker(flow, noCacheCheck) { @@ -59455,8 +59991,8 @@ var ts; var symbol = getResolvedSymbol(node); return isConstVariable(symbol) || ts.isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol); } - case 206: - case 207: + case 208: + case 209: return isConstantReference(node.expression) && isReadonlySymbol(getNodeLinks(node).resolvedSymbol || unknownSymbol); } return false; @@ -59478,7 +60014,7 @@ var ts; var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(flowNode)); sharedFlowCount = sharedFlowStart; var resultType = ts.getObjectFlags(evolvedType) & 256 && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType); - if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 230 && !(resultType.flags & 131072) && getTypeWithFacts(resultType, 2097152).flags & 131072) { + if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 232 && !(resultType.flags & 131072) && getTypeWithFacts(resultType, 2097152).flags & 131072) { return declaredType; } return resultType === nonNullUnknownType ? unknownType : resultType; @@ -59556,8 +60092,8 @@ var ts; else if (flags & 2) { var container = flow.node; if (container && container !== flowContainer && - reference.kind !== 206 && - reference.kind !== 207 && + reference.kind !== 208 && + reference.kind !== 209 && reference.kind !== 108) { flow = container.flowNode; continue; @@ -59578,7 +60114,7 @@ var ts; } function getInitialOrAssignedType(flow) { var node = flow.node; - return getNarrowableTypeForReference(node.kind === 254 || node.kind === 203 ? + return getNarrowableTypeForReference(node.kind === 257 || node.kind === 205 ? getInitialType(node) : getAssignedType(node), reference); } @@ -59610,13 +60146,13 @@ var ts; } if (ts.isVariableDeclaration(node) && (ts.isInJSFile(node) || ts.isVarConst(node))) { var init = ts.getDeclaredExpandoInitializer(node); - if (init && (init.kind === 213 || init.kind === 214)) { + if (init && (init.kind === 215 || init.kind === 216)) { return getTypeAtFlowNode(flow.antecedent); } } return declaredType; } - if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 243 && isMatchingReference(reference, node.parent.parent.expression)) { + if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 246 && isMatchingReference(reference, node.parent.parent.expression)) { return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)))); } return undefined; @@ -59626,7 +60162,7 @@ var ts; if (node.kind === 95) { return unreachableNeverType; } - if (node.kind === 221) { + if (node.kind === 223) { if (node.operatorToken.kind === 55) { return narrowTypeByAssertion(narrowTypeByAssertion(type, node.left), node.right); } @@ -59657,7 +60193,7 @@ var ts; function getTypeAtFlowArrayMutation(flow) { if (declaredType === autoType || declaredType === autoArrayType) { var node = flow.node; - var expr = node.kind === 208 ? + var expr = node.kind === 210 ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -59665,7 +60201,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (ts.getObjectFlags(type) & 256) { var evolvedType_1 = type; - if (node.kind === 208) { + if (node.kind === 210) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -59705,7 +60241,7 @@ var ts; if (isMatchingReference(reference, expr)) { type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } - else if (expr.kind === 216 && isMatchingReference(reference, expr.expression)) { + else if (expr.kind === 218 && isMatchingReference(reference, expr.expression)) { type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } else { @@ -59713,7 +60249,7 @@ var ts; if (optionalChainContainsReference(expr, reference)) { type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & (32768 | 131072)); }); } - else if (expr.kind === 216 && optionalChainContainsReference(expr.expression, reference)) { + else if (expr.kind === 218 && optionalChainContainsReference(expr.expression, reference)) { type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & 131072 || t.flags & 128 && t.value === "undefined"); }); } } @@ -59893,7 +60429,7 @@ var ts; var narrowedPropType = narrowType(propType); return filterType(type, function (t) { var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName); - return !(narrowedPropType.flags & 131072) && areTypesComparable(narrowedPropType, discriminantType); + return !(discriminantType.flags & 131072) && !(narrowedPropType.flags & 131072) && areTypesComparable(narrowedPropType, discriminantType); }); } function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) { @@ -59935,18 +60471,22 @@ var ts; } function isTypePresencePossible(type, propName, assumeTrue) { var prop = getPropertyOfType(type, propName); - if (prop) { - return prop.flags & 16777216 ? true : assumeTrue; - } - return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue; + return prop ? + !!(prop.flags & 16777216) || assumeTrue : + !!getApplicableIndexInfoForName(type, propName) || !assumeTrue; } - function narrowByInKeyword(type, name, assumeTrue) { - if (type.flags & 1048576 - || type.flags & 524288 && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type)) - || ts.isThisTypeParameter(type) - || type.flags & 2097152 && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) { + function narrowByInKeyword(type, nameType, assumeTrue) { + var name = getPropertyNameFromType(nameType); + var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, true); }); + if (isKnownProperty) { return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); }); } + if (assumeTrue) { + var recordSymbol = getGlobalRecordSymbol(); + if (recordSymbol) { + return getIntersectionType([type, getTypeAliasInstantiation(recordSymbol, [nameType, unknownType])]); + } + } return type; } function narrowTypeByBinaryExpression(type, expr, assumeTrue) { @@ -59963,10 +60503,10 @@ var ts; var operator = expr.operatorToken.kind; var left = getReferenceCandidate(expr.left); var right = getReferenceCandidate(expr.right); - if (left.kind === 216 && ts.isStringLiteralLike(right)) { + if (left.kind === 218 && ts.isStringLiteralLike(right)) { return narrowTypeByTypeof(type, left, operator, right, assumeTrue); } - if (right.kind === 216 && ts.isStringLiteralLike(left)) { + if (right.kind === 218 && ts.isStringLiteralLike(left)) { return narrowTypeByTypeof(type, right, operator, left, assumeTrue); } if (isMatchingReference(reference, left)) { @@ -60005,15 +60545,14 @@ var ts; return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue); } var target = getReferenceCandidate(expr.right); - var leftType = getTypeOfNode(expr.left); - if (leftType.flags & 128) { - var name = ts.escapeLeadingUnderscores(leftType.value); + var leftType = getTypeOfExpression(expr.left); + if (leftType.flags & 8576) { if (containsMissingType(type) && ts.isAccessExpression(reference) && isMatchingReference(reference.expression, target) && - getAccessedPropertyName(reference) === name) { + getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) { return getTypeWithFacts(type, assumeTrue ? 524288 : 65536); } if (isMatchingReference(reference, target)) { - return narrowByInKeyword(type, name, assumeTrue); + return narrowByInKeyword(type, leftType, assumeTrue); } } break; @@ -60062,24 +60601,11 @@ var ts; assumeTrue = !assumeTrue; } var valueType = getTypeOfExpression(value); - if (((type.flags & 2) || isEmptyAnonymousObjectType(type) && !(valueType.flags & 98304)) && - assumeTrue && - (operator === 36 || operator === 37)) { - if (valueType.flags & (131068 | 67108864)) { - return valueType; - } - if (valueType.flags & 524288) { - return nonPrimitiveType; - } - if (type.flags & 2) { - return type; - } - } + var doubleEquals = operator === 34 || operator === 35; if (valueType.flags & 98304) { if (!strictNullChecks) { return type; } - var doubleEquals = operator === 34 || operator === 35; var facts = doubleEquals ? assumeTrue ? 262144 : 2097152 : valueType.flags & 65536 ? @@ -60088,10 +60614,16 @@ var ts; return getAdjustedTypeWithFacts(type, facts); } if (assumeTrue) { - var filterFn = operator === 34 ? - function (t) { return areTypesComparable(t, valueType) || isCoercibleUnderDoubleEquals(t, valueType); } : - function (t) { return areTypesComparable(t, valueType); }; - return replacePrimitivesWithLiterals(filterType(type, filterFn), valueType); + if (!doubleEquals && (type.flags & 2 || someType(type, isEmptyAnonymousObjectType))) { + if (valueType.flags & (131068 | 67108864) || isEmptyAnonymousObjectType(valueType)) { + return valueType; + } + if (valueType.flags & 524288) { + return nonPrimitiveType; + } + } + var filteredType = filterType(type, function (t) { return areTypesComparable(t, valueType) || doubleEquals && isCoercibleUnderDoubleEquals(t, valueType); }); + return replacePrimitivesWithLiterals(filteredType, valueType); } if (isUnitType(valueType)) { return filterType(type, function (t) { return !(isUnitLikeType(t) && areTypesComparable(t, valueType)); }); @@ -60104,11 +60636,18 @@ var ts; } var target = getReferenceCandidate(typeOfExpr.expression); if (!isMatchingReference(reference, target)) { + var propertyAccess = getDiscriminantPropertyAccess(typeOfExpr.expression, type); + if (propertyAccess) { + return narrowTypeByDiscriminant(type, propertyAccess, function (t) { return narrowTypeByLiteralExpression(t, literal, assumeTrue); }); + } if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) { return getAdjustedTypeWithFacts(type, 2097152); } return type; } + return narrowTypeByLiteralExpression(type, literal, assumeTrue); + } + function narrowTypeByLiteralExpression(type, literal, assumeTrue) { return assumeTrue ? narrowTypeByTypeName(type, literal.text) : getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768); @@ -60180,7 +60719,7 @@ var ts; if (!witnesses) { return type; } - var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 290; }); + var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 293; }); var hasDefaultClause = clauseStart === clauseEnd || (defaultIndex >= clauseStart && defaultIndex < clauseEnd); if (hasDefaultClause) { var notEqualFacts_1 = getNotEqualFactsFromTypeofSwitch(clauseStart, clauseEnd, witnesses); @@ -60349,17 +60888,17 @@ var ts; } case 108: case 106: - case 206: - case 207: - return narrowTypeByTruthiness(type, expr, assumeTrue); case 208: + case 209: + return narrowTypeByTruthiness(type, expr, assumeTrue); + case 210: return narrowTypeByCallExpression(type, expr, assumeTrue); - case 212: - case 230: + case 214: + case 232: return narrowType(type, expr.expression, assumeTrue); - case 221: + case 223: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 219: + case 221: if (expr.operator === 53) { return narrowType(type, expr.operand, !assumeTrue); } @@ -60399,9 +60938,9 @@ var ts; function getControlFlowContainer(node) { return ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 262 || - node.kind === 305 || - node.kind === 167; + node.kind === 265 || + node.kind === 308 || + node.kind === 169; }); } function isSymbolAssigned(symbol) { @@ -60442,7 +60981,7 @@ var ts; function removeOptionalityFromDeclaredType(declaredType, declaration) { if (pushTypeResolution(declaration.symbol, 2)) { var annotationIncludesUndefined = strictNullChecks && - declaration.kind === 164 && + declaration.kind === 166 && declaration.initializer && getTypeFacts(declaredType) & 16777216 && !(getTypeFacts(checkExpression(declaration.initializer)) & 16777216); @@ -60456,10 +60995,10 @@ var ts; } function isConstraintPosition(type, node) { var parent = node.parent; - return parent.kind === 206 || - parent.kind === 161 || - parent.kind === 208 && parent.expression === node || - parent.kind === 207 && parent.expression === node && + return parent.kind === 208 || + parent.kind === 163 || + parent.kind === 210 && parent.expression === node || + parent.kind === 209 && parent.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression))); } function isGenericTypeWithUnionConstraint(type) { @@ -60521,15 +61060,16 @@ var ts; if (declaration) { if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) { var parent = declaration.parent.parent; - if (parent.kind === 254 && ts.getCombinedNodeFlags(declaration) & 2 || parent.kind === 164) { + if (parent.kind === 257 && ts.getCombinedNodeFlags(declaration) & 2 || parent.kind === 166) { var links = getNodeLinks(parent); if (!(links.flags & 268435456)) { links.flags |= 268435456; var parentType = getTypeForBindingElementParent(parent, 0); + var parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType); links.flags &= ~268435456; - if (parentType && parentType.flags & 1048576 && !(parent.kind === 164 && isSymbolAssigned(symbol))) { + if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 && !(parent.kind === 166 && isSymbolAssigned(symbol))) { var pattern = declaration.parent; - var narrowedType = getFlowTypeOfReference(pattern, parentType, parentType, undefined, location.flowNode); + var narrowedType = getFlowTypeOfReference(pattern, parentTypeConstraint, parentTypeConstraint, undefined, location.flowNode); if (narrowedType.flags & 131072) { return neverType; } @@ -60570,10 +61110,10 @@ var ts; } var container = ts.getContainingFunction(node); if (languageVersion < 2) { - if (container.kind === 214) { + if (container.kind === 216) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } - else if (ts.hasSyntacticModifier(container, 256)) { + else if (ts.hasSyntacticModifier(container, 512)) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); } } @@ -60590,7 +61130,7 @@ var ts; } var declaration = localOrExportSymbol.valueDeclaration; if (declaration && localOrExportSymbol.flags & 32) { - if (declaration.kind === 257 + if (declaration.kind === 260 && ts.nodeIsDecorated(declaration)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -60602,9 +61142,9 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration.kind === 226) { + else if (declaration.kind === 228) { var container = ts.getThisContainer(node, false); - while (container.kind !== 305) { + while (container.kind !== 308) { if (container.parent === declaration) { if (ts.isPropertyDeclaration(container) && ts.isStatic(container) || ts.isClassStaticBlockDeclaration(container)) { getNodeLinks(declaration).flags |= 16777216; @@ -60657,22 +61197,22 @@ var ts; return type; } type = getNarrowableTypeForReference(type, node, checkMode); - var isParameter = ts.getRootDeclaration(declaration).kind === 164; + var isParameter = ts.getRootDeclaration(declaration).kind === 166; var declarationContainer = getControlFlowContainer(declaration); var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; var isSpreadDestructuringAssignmentTarget = node.parent && node.parent.parent && ts.isSpreadAssignment(node.parent) && isDestructuringAssignmentTarget(node.parent.parent); var isModuleExports = symbol.flags & 134217728; - while (flowContainer !== declarationContainer && (flowContainer.kind === 213 || - flowContainer.kind === 214 || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 215 || + flowContainer.kind === 216 || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter && !isSymbolAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || ts.isBindingElement(declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 | 16384)) !== 0 || - isInTypeQuery(node) || node.parent.kind === 275) || - node.parent.kind === 230 || - declaration.kind === 254 && declaration.exclamationToken || + isInTypeQuery(node) || node.parent.kind === 278) || + node.parent.kind === 232 || + declaration.kind === 257 && declaration.exclamationToken || declaration.flags & 16777216; var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) : type === autoType || type === autoArrayType ? undefinedType : @@ -60724,7 +61264,7 @@ var ts; (symbol.flags & (2 | 32)) === 0 || !symbol.valueDeclaration || ts.isSourceFile(symbol.valueDeclaration) || - symbol.valueDeclaration.parent.kind === 292) { + symbol.valueDeclaration.parent.kind === 295) { return; } var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); @@ -60734,7 +61274,7 @@ var ts; if (isCaptured) { var capturesBlockScopeBindingInLoopBody = true; if (ts.isForStatement(container)) { - var varDeclList = ts.getAncestor(symbol.valueDeclaration, 255); + var varDeclList = ts.getAncestor(symbol.valueDeclaration, 258); if (varDeclList && varDeclList.parent === container) { var part = getPartOfForStatementContainingNode(node.parent, container); if (part) { @@ -60753,7 +61293,7 @@ var ts; } } if (ts.isForStatement(container)) { - var varDeclList = ts.getAncestor(symbol.valueDeclaration, 255); + var varDeclList = ts.getAncestor(symbol.valueDeclaration, 258); if (varDeclList && varDeclList.parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 4194304; } @@ -60770,14 +61310,14 @@ var ts; } function isAssignedInBodyOfForStatement(node, container) { var current = node; - while (current.parent.kind === 212) { + while (current.parent.kind === 214) { current = current.parent; } var isAssigned = false; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 219 || current.parent.kind === 220)) { + else if ((current.parent.kind === 221 || current.parent.kind === 222)) { var expr = current.parent; isAssigned = expr.operator === 45 || expr.operator === 46; } @@ -60788,7 +61328,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2; - if (container.kind === 167 || container.kind === 171) { + if (container.kind === 169 || container.kind === 173) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4; } @@ -60826,27 +61366,27 @@ var ts; var isNodeInTypeQuery = isInTypeQuery(node); var container = ts.getThisContainer(node, true); var capturedByArrowFunction = false; - if (container.kind === 171) { + if (container.kind === 173) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } - if (container.kind === 214) { + if (container.kind === 216) { container = ts.getThisContainer(container, false); capturedByArrowFunction = true; } checkThisInStaticClassFieldInitializerInDecoratedClass(node, container); switch (container.kind) { - case 261: + case 264: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; - case 260: + case 263: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 171: + case 173: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 162: + case 164: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -60927,7 +61467,7 @@ var ts; } } function getClassNameFromPrototypeMethod(container) { - if (container.kind === 213 && + if (container.kind === 215 && ts.isBinaryExpression(container.parent) && ts.getAssignmentDeclarationKind(container.parent) === 3) { return container.parent @@ -60935,20 +61475,20 @@ var ts; .expression .expression; } - else if (container.kind === 169 && - container.parent.kind === 205 && + else if (container.kind === 171 && + container.parent.kind === 207 && ts.isBinaryExpression(container.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent) === 6) { return container.parent.parent.left.expression; } - else if (container.kind === 213 && - container.parent.kind === 296 && - container.parent.parent.kind === 205 && + else if (container.kind === 215 && + container.parent.kind === 299 && + container.parent.parent.kind === 207 && ts.isBinaryExpression(container.parent.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent.parent) === 6) { return container.parent.parent.parent.left.expression; } - else if (container.kind === 213 && + else if (container.kind === 215 && ts.isPropertyAssignment(container.parent) && ts.isIdentifier(container.parent.name) && (container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") && @@ -60970,7 +61510,7 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 317) { + if (jsdocType && jsdocType.kind === 320) { var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && @@ -60984,15 +61524,15 @@ var ts; } } function isInConstructorArgumentInitializer(node, constructorDecl) { - return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 164 && n.parent === constructorDecl; }); + return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 166 && n.parent === constructorDecl; }); } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 208 && node.parent.expression === node; + var isCallExpression = node.parent.kind === 210 && node.parent.expression === node; var immediateContainer = ts.getSuperContainer(node, true); var container = immediateContainer; var needToCaptureLexicalThis = false; if (!isCallExpression) { - while (container && container.kind === 214) { + while (container && container.kind === 216) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = languageVersion < 2; } @@ -61000,14 +61540,14 @@ var ts; var canUseSuperExpression = isLegalUsageOfSuperExpression(container); var nodeCheckFlag = 0; if (!canUseSuperExpression) { - var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 162; }); - if (current && current.kind === 162) { + var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 164; }); + if (current && current.kind === 164) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } - else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 205)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 207)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -61015,7 +61555,7 @@ var ts; } return errorType; } - if (!isCallExpression && immediateContainer.kind === 171) { + if (!isCallExpression && immediateContainer.kind === 173) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); } if (ts.isStatic(container) || isCallExpression) { @@ -61034,7 +61574,7 @@ var ts; nodeCheckFlag = 256; } getNodeLinks(node).flags |= nodeCheckFlag; - if (container.kind === 169 && ts.hasSyntacticModifier(container, 256)) { + if (container.kind === 171 && ts.hasSyntacticModifier(container, 512)) { if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= 4096; } @@ -61045,7 +61585,7 @@ var ts; if (needToCaptureLexicalThis) { captureLexicalThis(node.parent, container); } - if (container.parent.kind === 205) { + if (container.parent.kind === 207) { if (languageVersion < 2) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return errorType; @@ -61064,7 +61604,7 @@ var ts; if (!baseClassType) { return errorType; } - if (container.kind === 171 && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 173 && isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return errorType; } @@ -61076,26 +61616,26 @@ var ts; return false; } if (isCallExpression) { - return container.kind === 171; + return container.kind === 173; } else { - if (ts.isClassLike(container.parent) || container.parent.kind === 205) { + if (ts.isClassLike(container.parent) || container.parent.kind === 207) { if (ts.isStatic(container)) { - return container.kind === 169 || - container.kind === 168 || - container.kind === 172 || - container.kind === 173 || - container.kind === 167 || - container.kind === 170; + return container.kind === 171 || + container.kind === 170 || + container.kind === 174 || + container.kind === 175 || + container.kind === 169 || + container.kind === 172; } else { - return container.kind === 169 || + return container.kind === 171 || + container.kind === 170 || + container.kind === 174 || + container.kind === 175 || + container.kind === 169 || container.kind === 168 || - container.kind === 172 || - container.kind === 173 || - container.kind === 167 || - container.kind === 166 || - container.kind === 171; + container.kind === 173; } } } @@ -61103,10 +61643,10 @@ var ts; } } function getContainingObjectLiteral(func) { - return (func.kind === 169 || - func.kind === 172 || - func.kind === 173) && func.parent.kind === 205 ? func.parent : - func.kind === 213 && func.parent.kind === 296 ? func.parent.parent : + return (func.kind === 171 || + func.kind === 174 || + func.kind === 175) && func.parent.kind === 207 ? func.parent : + func.kind === 215 && func.parent.kind === 299 ? func.parent.parent : undefined; } function getThisTypeArgument(type) { @@ -61118,7 +61658,7 @@ var ts; }); } function getContextualThisParameterType(func) { - if (func.kind === 214) { + if (func.kind === 216) { return undefined; } if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { @@ -61142,7 +61682,7 @@ var ts; if (thisType) { return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral))); } - if (literal.parent.kind !== 296) { + if (literal.parent.kind !== 299) { break; } literal = literal.parent.parent; @@ -61151,7 +61691,7 @@ var ts; return getWidenedType(contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral)); } var parent = ts.walkUpParenthesizedExpressions(func.parent); - if (parent.kind === 221 && parent.operatorToken.kind === 63) { + if (parent.kind === 223 && parent.operatorToken.kind === 63) { var target = parent.left; if (ts.isAccessExpression(target)) { var expression = target.expression; @@ -61202,11 +61742,11 @@ var ts; return getTypeFromTypeNode(typeNode); } switch (declaration.kind) { - case 164: + case 166: return getContextuallyTypedParameterType(declaration); - case 203: + case 205: return getContextualTypeForBindingElement(declaration, contextFlags); - case 167: + case 169: if (ts.isStatic(declaration)) { return getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags); } @@ -61216,10 +61756,10 @@ var ts; var parent = declaration.parent.parent; var name = declaration.propertyName || declaration.name; var parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || - parent.kind !== 203 && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 : 0); + parent.kind !== 205 && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 : 0); if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name)) return undefined; - if (parent.name.kind === 202) { + if (parent.name.kind === 204) { var index = ts.indexOfNode(declaration.parent.elements, declaration); if (index < 0) return undefined; @@ -61359,7 +61899,7 @@ var ts; getTypeAtPosition(signature, argIndex); } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 210) { + if (template.parent.kind === 212) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -61463,8 +62003,11 @@ var ts; case 1: case 6: case 3: - var valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; case 2: + var valueDeclaration = void 0; + if (kind !== 2) { + valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; + } valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration); var annotated = valueDeclaration && ts.getEffectiveTypeAnnotationNode(valueDeclaration); return annotated ? getTypeFromTypeNode(annotated) : undefined; @@ -61620,21 +62163,21 @@ var ts; case 95: case 104: case 79: - case 153: + case 155: return true; - case 206: - case 212: + case 208: + case 214: return isPossiblyDiscriminantValue(node.expression); - case 288: + case 291: return !node.expression || isPossiblyDiscriminantValue(node.expression); } return false; } function discriminateContextualTypeByObjectMembers(node, contextualType) { - return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 296 && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); + return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 299 && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); } function discriminateContextualTypeByJSXAttributes(node, contextualType) { - return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 285 && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); + return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 288 && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); } function getApparentTypeOfContextualType(node, contextFlags) { var contextualType = ts.isObjectLiteralMethod(node) ? @@ -61684,59 +62227,61 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 254: - case 164: - case 167: + case 257: case 166: - case 203: + case 169: + case 168: + case 205: return getContextualTypeForInitializerExpression(node, contextFlags); - case 214: - case 247: + case 216: + case 250: return getContextualTypeForReturnExpression(node, contextFlags); - case 224: + case 226: return getContextualTypeForYieldOperand(parent, contextFlags); - case 218: + case 220: return getContextualTypeForAwaitOperand(parent, contextFlags); - case 208: - case 209: - return getContextualTypeForArgument(parent, node); + case 210: case 211: - case 229: + return getContextualTypeForArgument(parent, node); + case 213: + case 231: return ts.isConstTypeReference(parent.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(parent.type); - case 221: + case 223: return getContextualTypeForBinaryOperand(node, contextFlags); - case 296: - case 297: + case 299: + case 300: return getContextualTypeForObjectLiteralElement(parent, contextFlags); - case 298: + case 301: return getContextualType(parent.parent, contextFlags); - case 204: { + case 206: { var arrayLiteral = parent; var type = getApparentTypeOfContextualType(arrayLiteral, contextFlags); return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node)); } - case 222: + case 224: return getContextualTypeForConditionalOperand(node, contextFlags); - case 233: - ts.Debug.assert(parent.parent.kind === 223); + case 236: + ts.Debug.assert(parent.parent.kind === 225); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 212: { + case 214: { var tag = ts.isInJSFile(parent) ? ts.getJSDocTypeTag(parent) : undefined; return !tag ? getContextualType(parent, contextFlags) : ts.isJSDocTypeTag(tag) && ts.isConstTypeReference(tag.typeExpression.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(tag.typeExpression.type); } - case 230: + case 232: return getContextualType(parent, contextFlags); - case 271: + case 235: + return getTypeFromTypeNode(parent.type); + case 274: return tryGetTypeFromEffectiveTypeNode(parent); - case 288: + case 291: return getContextualTypeForJsxExpression(parent, contextFlags); - case 285: - case 287: + case 288: + case 290: return getContextualTypeForJsxAttribute(parent, contextFlags); - case 280: - case 279: + case 283: + case 282: return getContextualJsxElementAttributesType(parent, contextFlags); } return undefined; @@ -61848,9 +62393,14 @@ var ts; if (!isErrorType(intrinsicClassAttribs)) { var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); var hostClassType = getReturnTypeOfSignature(sig); - apparentAttributesType = intersectTypes(typeParams - ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context))) - : intrinsicClassAttribs, apparentAttributesType); + var libraryManagedAttributeType = void 0; + if (typeParams) { + var inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context)); + libraryManagedAttributeType = instantiateType(intrinsicClassAttribs, createTypeMapper(typeParams, inferredArgs)); + } + else + libraryManagedAttributeType = intrinsicClassAttribs; + apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType); } var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); if (!isErrorType(intrinsicAttribs)) { @@ -61958,7 +62508,7 @@ var ts; : undefined; } function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 169 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 || ts.isObjectLiteralMethod(node)); var typeTagSignature = getSignatureOfTypeTag(node); if (typeTagSignature) { return typeTagSignature; @@ -62002,8 +62552,8 @@ var ts; return node.isSpread ? getIndexedAccessType(node.type, numberType) : node.type; } function hasDefaultValue(node) { - return (node.kind === 203 && !!node.initializer) || - (node.kind === 221 && node.operatorToken.kind === 63); + return (node.kind === 205 && !!node.initializer) || + (node.kind === 223 && node.operatorToken.kind === 63); } function checkArrayLiteral(node, checkMode, forceTuple) { var elements = node.elements; @@ -62016,7 +62566,7 @@ var ts; var hasOmittedExpression = false; for (var i = 0; i < elementCount; i++) { var e = elements[i]; - if (e.kind === 225) { + if (e.kind === 227) { if (languageVersion < 2) { checkExternalEmitHelpers(e, compilerOptions.downlevelIteration ? 1536 : 1024); } @@ -62037,7 +62587,7 @@ var ts; elementFlags.push(4); } } - else if (exactOptionalPropertyTypes && e.kind === 227) { + else if (exactOptionalPropertyTypes && e.kind === 229) { hasOmittedExpression = true; elementTypes.push(missingType); elementFlags.push(2); @@ -62077,7 +62627,7 @@ var ts; } function isNumericName(name) { switch (name.kind) { - case 162: + case 164: return isNumericComputedName(name); case 79: return ts.isNumericLiteralName(name.escapedText); @@ -62096,7 +62646,7 @@ var ts; if (!links.resolvedType) { if ((ts.isTypeLiteralNode(node.parent.parent) || ts.isClassLike(node.parent.parent) || ts.isInterfaceDeclaration(node.parent.parent)) && ts.isBinaryExpression(node.expression) && node.expression.operatorToken.kind === 101 - && node.parent.kind !== 172 && node.parent.kind !== 173) { + && node.parent.kind !== 174 && node.parent.kind !== 175) { return links.resolvedType = errorType; } links.resolvedType = checkExpression(node.expression); @@ -62161,7 +62711,7 @@ var ts; var spread = emptyObjectType; var contextualType = getApparentTypeOfContextualType(node, undefined); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 201 || contextualType.pattern.kind === 205); + (contextualType.pattern.kind === 203 || contextualType.pattern.kind === 207); var inConstContext = isConstContext(node); var checkFlags = inConstContext ? 8 : 0; var isInJavascript = ts.isInJSFile(node) && !ts.isInJsonFile(node); @@ -62182,13 +62732,13 @@ var ts; for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var memberDecl = _c[_b]; var member = getSymbolOfNode(memberDecl); - var computedNameType = memberDecl.name && memberDecl.name.kind === 162 ? + var computedNameType = memberDecl.name && memberDecl.name.kind === 164 ? checkComputedPropertyName(memberDecl.name) : undefined; - if (memberDecl.kind === 296 || - memberDecl.kind === 297 || + if (memberDecl.kind === 299 || + memberDecl.kind === 300 || ts.isObjectLiteralMethod(memberDecl)) { - var type = memberDecl.kind === 296 ? checkPropertyAssignment(memberDecl, checkMode) : - memberDecl.kind === 297 ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : + var type = memberDecl.kind === 299 ? checkPropertyAssignment(memberDecl, checkMode) : + memberDecl.kind === 300 ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode); if (isInJavascript) { var jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl); @@ -62209,8 +62759,8 @@ var ts; prop.nameType = nameType; } if (inDestructuringPattern) { - var isOptional = (memberDecl.kind === 296 && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 297 && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 299 && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 300 && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 16777216; } @@ -62234,14 +62784,14 @@ var ts; member = prop; allPropertiesTable === null || allPropertiesTable === void 0 ? void 0 : allPropertiesTable.set(prop.escapedName, prop); if (contextualType && checkMode && checkMode & 2 && !(checkMode & 4) && - (memberDecl.kind === 296 || memberDecl.kind === 169) && isContextSensitive(memberDecl)) { + (memberDecl.kind === 299 || memberDecl.kind === 171) && isContextSensitive(memberDecl)) { var inferenceContext = getInferenceContext(node); ts.Debug.assert(inferenceContext); - var inferenceNode = memberDecl.kind === 296 ? memberDecl.initializer : memberDecl; + var inferenceNode = memberDecl.kind === 299 ? memberDecl.initializer : memberDecl; addIntraExpressionInferenceSite(inferenceContext, inferenceNode, type); } } - else if (memberDecl.kind === 298) { + else if (memberDecl.kind === 301) { if (languageVersion < 2) { checkExternalEmitHelpers(memberDecl, 2); } @@ -62272,7 +62822,7 @@ var ts; continue; } else { - ts.Debug.assert(memberDecl.kind === 172 || memberDecl.kind === 173); + ts.Debug.assert(memberDecl.kind === 174 || memberDecl.kind === 175); checkNodeDeferred(memberDecl); } if (computedNameType && !(computedNameType.flags & 8576)) { @@ -62296,15 +62846,26 @@ var ts; } propertiesArray.push(member); } - if (contextualTypeHasPattern && node.parent.kind !== 298) { - for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { - var prop = _e[_d]; - if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { - if (!(prop.flags & 16777216)) { - error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + if (contextualTypeHasPattern) { + var rootPatternParent_1 = ts.findAncestor(contextualType.pattern.parent, function (n) { + return n.kind === 257 || + n.kind === 223 || + n.kind === 166; + }); + var spreadOrOutsideRootObject = ts.findAncestor(node, function (n) { + return n === rootPatternParent_1 || + n.kind === 301; + }); + if (spreadOrOutsideRootObject.kind !== 301) { + for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { + var prop = _e[_d]; + if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { + if (!(prop.flags & 16777216)) { + error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + propertiesTable.set(prop.escapedName, prop); + propertiesArray.push(prop); } - propertiesTable.set(prop.escapedName, prop); - propertiesArray.push(prop); } } } @@ -62395,6 +62956,7 @@ var ts; } function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) { var attributes = openingLikeElement.attributes; + var attributesType = getContextualType(attributes, 0); var allAttributesTable = strictNullChecks ? ts.createSymbolTable() : undefined; var attributesTable = ts.createSymbolTable(); var spread = emptyJsxObjectType; @@ -62422,9 +62984,15 @@ var ts; if (attributeDecl.name.escapedText === jsxChildrenPropertyName) { explicitlySpecifyChildrenAttribute = true; } + if (attributesType) { + var prop = getPropertyOfType(attributesType, member.escapedName); + if (prop && prop.declarations && isDeprecatedSymbol(prop)) { + addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText); + } + } } else { - ts.Debug.assert(attributeDecl.kind === 287); + ts.Debug.assert(attributeDecl.kind === 290); if (attributesTable.size > 0) { spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, false); attributesTable = ts.createSymbolTable(); @@ -62450,7 +63018,7 @@ var ts; spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, false); } } - var parent = openingLikeElement.parent.kind === 278 ? openingLikeElement.parent : undefined; + var parent = openingLikeElement.parent.kind === 281 ? openingLikeElement.parent : undefined; if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) { var childrenTypes = checkJsxChildren(parent, checkMode); if (!hasSpreadAnyType && jsxChildrenPropertyName && jsxChildrenPropertyName !== "") { @@ -62494,7 +63062,7 @@ var ts; childrenTypes.push(stringType); } } - else if (child.kind === 288 && !child.expression) { + else if (child.kind === 291 && !child.expression) { continue; } else { @@ -62837,9 +63405,9 @@ var ts; function checkPropertyAccessibility(node, isSuper, writing, type, prop, reportError) { if (reportError === void 0) { reportError = true; } var errorNode = !reportError ? undefined : - node.kind === 161 ? node.right : - node.kind === 200 ? node : - node.kind === 203 && node.propertyName ? node.propertyName : node.name; + node.kind === 163 ? node.right : + node.kind === 202 ? node : + node.kind === 205 && node.propertyName ? node.propertyName : node.name; return checkPropertyAccessibilityAtLocation(node, isSuper, writing, type, prop, errorNode); } function checkPropertyAccessibilityAtLocation(location, isSuper, writing, containingType, prop, errorNode) { @@ -62853,14 +63421,14 @@ var ts; return false; } } - if (flags & 128) { + if (flags & 256) { if (errorNode) { error(errorNode, ts.Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(getDeclaringClass(prop))); } return false; } } - if ((flags & 128) && symbolHasNonMethodDeclaration(prop) && + if ((flags & 256) && symbolHasNonMethodDeclaration(prop) && (ts.isThisProperty(location) || ts.isThisInitializedObjectBindingExpression(location) || ts.isObjectBindingPattern(location.parent) && ts.isThisInitializedDeclaration(location.parent.parent))) { var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) { @@ -62942,10 +63510,27 @@ var ts; return isNullableType(type) ? getNonNullableType(type) : type; } function reportObjectPossiblyNullOrUndefinedError(node, facts) { - error(node, facts & 16777216 ? facts & 33554432 ? - ts.Diagnostics.Object_is_possibly_null_or_undefined : - ts.Diagnostics.Object_is_possibly_undefined : - ts.Diagnostics.Object_is_possibly_null); + var nodeText = ts.isEntityNameExpression(node) ? ts.entityNameToString(node) : undefined; + if (node.kind === 104) { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "null"); + return; + } + if (nodeText !== undefined && nodeText.length < 100) { + if (ts.isIdentifier(node) && nodeText === "undefined") { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "undefined"); + return; + } + error(node, facts & 16777216 ? facts & 33554432 ? + ts.Diagnostics._0_is_possibly_null_or_undefined : + ts.Diagnostics._0_is_possibly_undefined : + ts.Diagnostics._0_is_possibly_null, nodeText); + } + else { + error(node, facts & 16777216 ? facts & 33554432 ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + } } function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) { error(node, facts & 16777216 ? facts & 33554432 ? @@ -62955,6 +63540,13 @@ var ts; } function checkNonNullTypeWithReporter(type, node, reportError) { if (strictNullChecks && type.flags & 2) { + if (ts.isEntityNameExpression(node)) { + var nodeText = ts.entityNameToString(node); + if (nodeText.length < 100) { + error(node, ts.Diagnostics._0_is_of_type_unknown, nodeText); + return errorType; + } + } error(node, ts.Diagnostics.Object_is_of_type_unknown); return errorType; } @@ -62972,6 +63564,17 @@ var ts; function checkNonNullNonVoidType(type, node) { var nonNullType = checkNonNullType(type, node); if (nonNullType.flags & 16384) { + if (ts.isEntityNameExpression(node)) { + var nodeText = ts.entityNameToString(node); + if (ts.isIdentifier(node) && nodeText === "undefined") { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, nodeText); + return nonNullType; + } + if (nodeText.length < 100) { + error(node, ts.Diagnostics._0_is_possibly_undefined, nodeText); + return nonNullType; + } + } error(node, ts.Diagnostics.Object_is_possibly_undefined); } return nonNullType; @@ -62990,7 +63593,7 @@ var ts; return checkPropertyAccessExpressionOrQualifiedName(node, node.left, leftType, node.right, checkMode); } function isMethodAccessForCall(node) { - while (node.parent.kind === 212) { + while (node.parent.kind === 214) { node = node.parent; } return ts.isCallOrNewExpression(node.parent) && node.parent.expression === node; @@ -63122,10 +63725,10 @@ var ts; } return isErrorType(apparentType) ? errorType : apparentType; } - prop = getPropertyOfType(apparentType, right.escapedText, false, node.kind === 161); + prop = getPropertyOfType(apparentType, right.escapedText, false, node.kind === 163); } if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules || - !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 && node.parent.kind === 299)) || + !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 && node.parent.kind === 302)) || ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) { markAliasReferenced(parentSymbol, node); } @@ -63213,7 +63816,7 @@ var ts; if (declaration && isPropertyWithoutInitializer(declaration)) { if (!ts.isStatic(declaration)) { var flowContainer = getControlFlowContainer(node); - if (flowContainer.kind === 171 && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216)) { + if (flowContainer.kind === 173 && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216)) { assumeUninitialized = true; } } @@ -63247,8 +63850,8 @@ var ts; && (compilerOptions.useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) { diagnosticMessage = error(right, ts.Diagnostics.Property_0_is_used_before_its_initialization, declarationName); } - else if (valueDeclaration.kind === 257 && - node.parent.kind !== 178 && + else if (valueDeclaration.kind === 260 && + node.parent.kind !== 180 && !(valueDeclaration.flags & 16777216) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) { diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName); @@ -63260,25 +63863,25 @@ var ts; function isInPropertyInitializerOrClassStaticBlock(node) { return !!ts.findAncestor(node, function (node) { switch (node.kind) { - case 167: - return true; - case 296: case 169: - case 172: - case 173: - case 298: - case 162: - case 233: - case 288: - case 285: - case 286: - case 287: - case 280: - case 228: + return true; + case 299: + case 171: + case 174: + case 175: + case 301: + case 164: + case 236: case 291: + case 288: + case 289: + case 290: + case 283: + case 230: + case 294: return false; - case 214: - case 238: + case 216: + case 241: return ts.isBlock(node.parent) && ts.isClassStaticBlockDeclaration(node.parent.parent) ? true : "quit"; default: return ts.isExpressionNode(node) ? false : "quit"; @@ -63465,7 +64068,6 @@ var ts; } return false; } - ; var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get"; if (!hasProp(suggestedMethod)) { return undefined; @@ -63529,16 +64131,16 @@ var ts; } function isValidPropertyAccess(node, propertyName) { switch (node.kind) { - case 206: + case 208: return isValidPropertyAccessWithType(node, node.expression.kind === 106, propertyName, getWidenedType(checkExpression(node.expression))); - case 161: + case 163: return isValidPropertyAccessWithType(node, false, propertyName, getWidenedType(checkExpression(node.left))); - case 200: + case 202: return isValidPropertyAccessWithType(node, false, propertyName, getTypeFromTypeNode(node)); } } function isValidPropertyAccessForCompletions(node, type, property) { - return isPropertyAccessible(node, node.kind === 206 && node.expression.kind === 106, false, type, property); + return isPropertyAccessible(node, node.kind === 208 && node.expression.kind === 106, false, type, property); } function isValidPropertyAccessWithType(node, isSuper, propertyName, type) { if (isTypeAny(type)) { @@ -63559,7 +64161,7 @@ var ts; } function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 255) { + if (initializer.kind === 258) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -63581,7 +64183,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 243 && + if (node.kind === 246 && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -63628,13 +64230,13 @@ var ts; if (callLikeExpressionMayHaveTypeArguments(node)) { ts.forEach(node.typeArguments, checkSourceElement); } - if (node.kind === 210) { + if (node.kind === 212) { checkExpression(node.template); } else if (ts.isJsxOpeningLikeElement(node)) { checkExpression(node.attributes); } - else if (node.kind !== 165) { + else if (node.kind !== 167) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -63683,7 +64285,7 @@ var ts; } } function isSpreadArgument(arg) { - return !!arg && (arg.kind === 225 || arg.kind === 232 && arg.isSpread); + return !!arg && (arg.kind === 227 || arg.kind === 234 && arg.isSpread); } function getSpreadArgumentIndex(args) { return ts.findIndex(args, isSpreadArgument); @@ -63700,9 +64302,9 @@ var ts; var callIsIncomplete = false; var effectiveParameterCount = getParameterCount(signature); var effectiveMinimumArguments = getMinArgumentCount(signature); - if (node.kind === 210) { + if (node.kind === 212) { argCount = args.length; - if (node.template.kind === 223) { + if (node.template.kind === 225) { var lastSpan = ts.last(node.template.templateSpans); callIsIncomplete = ts.nodeIsMissing(lastSpan.literal) || !!lastSpan.literal.isUnterminated; } @@ -63712,7 +64314,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 165) { + else if (node.kind === 167) { argCount = getDecoratorArgumentCount(node, signature); } else if (ts.isJsxOpeningLikeElement(node)) { @@ -63725,7 +64327,7 @@ var ts; effectiveMinimumArguments = Math.min(effectiveMinimumArguments, 1); } else if (!node.arguments) { - ts.Debug.assert(node.kind === 209); + ts.Debug.assert(node.kind === 211); return getMinArgumentCount(signature) === 0; } else { @@ -63811,7 +64413,7 @@ var ts; if (ts.isJsxOpeningLikeElement(node)) { return inferJsxTypeArguments(node, signature, checkMode, context); } - if (node.kind !== 165) { + if (node.kind !== 167) { var skipBindingPatterns = ts.every(signature.typeParameters, function (p) { return !!getDefaultFromTypeParameter(p); }); var contextualType = getContextualType(node, skipBindingPatterns ? 8 : 0); if (contextualType) { @@ -63850,7 +64452,7 @@ var ts; } for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 227 && !(checkMode & 32 && hasSkipDirectInferenceFlag(arg))) { + if (arg.kind !== 229 && !(checkMode & 32 && hasSkipDirectInferenceFlag(arg))) { var paramType = getTypeAtPosition(signature, i); if (couldContainTypeVariables(paramType)) { var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode); @@ -63874,7 +64476,7 @@ var ts; if (index >= argCount - 1) { var arg = args[argCount - 1]; if (isSpreadArgument(arg)) { - return getMutableArrayOrTupleType(arg.kind === 232 ? arg.type : + return getMutableArrayOrTupleType(arg.kind === 234 ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode)); } } @@ -63884,13 +64486,13 @@ var ts; for (var i = index; i < argCount; i++) { var arg = args[i]; if (isSpreadArgument(arg)) { - var spreadType = arg.kind === 232 ? arg.type : checkExpression(arg.expression); + var spreadType = arg.kind === 234 ? arg.type : checkExpression(arg.expression); if (isArrayLikeType(spreadType)) { types.push(spreadType); flags.push(8); } else { - types.push(checkIteratedTypeOrElementType(33, spreadType, undefinedType, arg.kind === 225 ? arg.expression : arg)); + types.push(checkIteratedTypeOrElementType(33, spreadType, undefinedType, arg.kind === 227 ? arg.expression : arg)); flags.push(4); } } @@ -63901,7 +64503,7 @@ var ts; types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType)); flags.push(1); } - if (arg.kind === 232 && arg.tupleNameSource) { + if (arg.kind === 234 && arg.tupleNameSource) { names.push(arg.tupleNameSource); } } @@ -64032,7 +64634,7 @@ var ts; return undefined; } var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 209) { + if (thisType && thisType !== voidType && node.kind !== 211) { var thisArgumentNode = getThisArgumentOfCall(node); var thisArgumentType = getThisArgumentType(thisArgumentNode); var errorNode = reportErrors ? (thisArgumentNode || node) : undefined; @@ -64047,7 +64649,7 @@ var ts; var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length; for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 227) { + if (arg.kind !== 229) { var paramType = getTypeAtPosition(signature, i); var argType = checkExpressionWithContextualType(arg, paramType, undefined, checkMode); var checkArgType = checkMode & 4 ? getRegularTypeOfObjectLiteral(argType) : argType; @@ -64085,8 +64687,8 @@ var ts; } } function getThisArgumentOfCall(node) { - var expression = node.kind === 208 ? node.expression : - node.kind === 210 ? node.tag : undefined; + var expression = node.kind === 210 ? node.expression : + node.kind === 212 ? node.tag : undefined; if (expression) { var callee = ts.skipOuterExpressions(expression); if (ts.isAccessExpression(callee)) { @@ -64101,17 +64703,17 @@ var ts; return result; } function getEffectiveCallArguments(node) { - if (node.kind === 210) { + if (node.kind === 212) { var template = node.template; var args_3 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())]; - if (template.kind === 223) { + if (template.kind === 225) { ts.forEach(template.templateSpans, function (span) { args_3.push(span.expression); }); } return args_3; } - if (node.kind === 165) { + if (node.kind === 167) { return getEffectiveDecoratorArguments(node); } if (ts.isJsxOpeningLikeElement(node)) { @@ -64121,9 +64723,9 @@ var ts; var spreadIndex = getSpreadArgumentIndex(args); if (spreadIndex >= 0) { var effectiveArgs_1 = args.slice(0, spreadIndex); - var _loop_26 = function (i) { + var _loop_27 = function (i) { var arg = args[i]; - var spreadType = arg.kind === 225 && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); + var spreadType = arg.kind === 227 && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); if (spreadType && isTupleType(spreadType)) { ts.forEach(getTypeArguments(spreadType), function (t, i) { var _a; @@ -64137,7 +64739,7 @@ var ts; } }; for (var i = spreadIndex; i < args.length; i++) { - _loop_26(i); + _loop_27(i); } return effectiveArgs_1; } @@ -64147,23 +64749,23 @@ var ts; var parent = node.parent; var expr = node.expression; switch (parent.kind) { - case 257: - case 226: + case 260: + case 228: return [ createSyntheticExpression(expr, getTypeOfSymbol(getSymbolOfNode(parent))) ]; - case 164: + case 166: var func = parent.parent; return [ - createSyntheticExpression(expr, parent.parent.kind === 171 ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), + createSyntheticExpression(expr, parent.parent.kind === 173 ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), createSyntheticExpression(expr, anyType), createSyntheticExpression(expr, numberType) ]; - case 167: case 169: - case 172: - case 173: - var hasPropDesc = parent.kind !== 167 && languageVersion !== 0; + case 171: + case 174: + case 175: + var hasPropDesc = languageVersion !== 0 && (!ts.isPropertyDeclaration(parent) || ts.hasAccessorModifier(parent)); return [ createSyntheticExpression(expr, getParentTypeOfClassElement(parent)), createSyntheticExpression(expr, getClassElementPropertyKeyType(parent)), @@ -64174,16 +64776,16 @@ var ts; } function getDecoratorArgumentCount(node, signature) { switch (node.parent.kind) { - case 257: - case 226: + case 260: + case 228: return 1; - case 167: - return 2; case 169: - case 172: - case 173: + return ts.hasAccessorModifier(node.parent) ? 3 : 2; + case 171: + case 174: + case 175: return languageVersion === 0 || signature.parameters.length <= 2 ? 2 : 3; - case 164: + case 166: return 3; default: return ts.Debug.fail(); @@ -64318,8 +64920,8 @@ var ts; return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount); } function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags, fallbackError) { - var isTaggedTemplate = node.kind === 210; - var isDecorator = node.kind === 165; + var isTaggedTemplate = node.kind === 212; + var isDecorator = node.kind === 167; var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node); var reportErrors = !candidatesOutArray; var typeArguments; @@ -64345,7 +64947,7 @@ var ts; var candidateForArgumentArityError; var candidateForTypeArgumentError; var result; - var signatureHelpTrailingComma = !!(checkMode & 16) && node.kind === 208 && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = !!(checkMode & 16) && node.kind === 210 && node.arguments.hasTrailingComma; if (candidates.length > 1) { result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma); } @@ -64387,7 +64989,7 @@ var ts; var min_3 = Number.MAX_VALUE; var minIndex = 0; var i_1 = 0; - var _loop_27 = function (c) { + var _loop_28 = function (c) { var chain_2 = function () { return ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); }; var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0, true, chain_2); if (diags_2) { @@ -64405,7 +65007,7 @@ var ts; }; for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) { var c = candidatesForArgumentError_1[_a]; - _loop_27(c); + _loop_28(c); } var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics); ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures"); @@ -64548,7 +65150,7 @@ var ts; } var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max; var parameters = []; - var _loop_28 = function (i) { + var _loop_29 = function (i) { var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ? i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) : i < s.parameters.length ? s.parameters[i] : undefined; }); @@ -64556,7 +65158,7 @@ var ts; parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); }))); }; for (var i = 0; i < maxNonRestParam; i++) { - _loop_28(i); + _loop_29(i); } var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; }); var flags = 0; @@ -64736,7 +65338,7 @@ var ts; return resolveErrorCall(node); } var valueDecl = expressionType.symbol && ts.getClassLikeDeclarationOfSymbol(expressionType.symbol); - if (valueDecl && ts.hasSyntacticModifier(valueDecl, 128)) { + if (valueDecl && ts.hasSyntacticModifier(valueDecl, 256)) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_an_abstract_class); return resolveErrorCall(node); } @@ -64801,7 +65403,7 @@ var ts; } var declaration = signature.declaration; var modifiers = ts.getSelectedEffectiveModifierFlags(declaration, 24); - if (!modifiers || declaration.kind !== 171) { + if (!modifiers || declaration.kind !== 173) { return true; } var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(declaration.parent.symbol); @@ -64933,16 +65535,16 @@ var ts; } function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 257: - case 226: + case 260: + case 228: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 164: + case 166: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 167: - return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; case 169: - case 172: - case 173: + return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; + case 171: + case 174: + case 175: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; default: return ts.Debug.fail(); @@ -64983,7 +65585,7 @@ var ts; var exports = namespace && getExportsOfSymbol(namespace); var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 788968); var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 788968, node); - var declaration = ts.factory.createFunctionTypeNode(undefined, [ts.factory.createParameterDeclaration(undefined, undefined, "props", undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, undefined) : ts.factory.createKeywordTypeNode(130)); + var declaration = ts.factory.createFunctionTypeNode(undefined, [ts.factory.createParameterDeclaration(undefined, undefined, "props", undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, undefined) : ts.factory.createKeywordTypeNode(131)); var parameterSymbol = createSymbol(1, "props"); parameterSymbol.type = result; return createSignature(declaration, undefined, undefined, [parameterSymbol], typeSymbol ? getDeclaredTypeOfSymbol(typeSymbol) : errorType, undefined, 1, 0); @@ -65023,16 +65625,16 @@ var ts; } function resolveSignature(node, candidatesOutArray, checkMode) { switch (node.kind) { - case 208: - return resolveCallExpression(node, candidatesOutArray, checkMode); - case 209: - return resolveNewExpression(node, candidatesOutArray, checkMode); case 210: + return resolveCallExpression(node, candidatesOutArray, checkMode); + case 211: + return resolveNewExpression(node, candidatesOutArray, checkMode); + case 212: return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode); - case 165: + case 167: return resolveDecorator(node, candidatesOutArray, checkMode); - case 280: - case 279: + case 283: + case 282: return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode); } throw ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable."); @@ -65056,11 +65658,13 @@ var ts; return false; } var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node : - ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer : + (ts.isVariableDeclaration(node) || ts.isPropertyAssignment(node)) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer : undefined; if (func) { if (ts.getJSDocClassTag(node)) return true; + if (ts.isPropertyAssignment(ts.walkUpParenthesizedExpressions(func.parent))) + return false; var symbol = getSymbolOfNode(func); return !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.members) === null || _a === void 0 ? void 0 : _a.size); } @@ -65142,7 +65746,7 @@ var ts; return false; } var parent = node.parent; - while (parent && parent.kind === 206) { + while (parent && parent.kind === 208) { parent = parent.parent; } if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 63) { @@ -65161,12 +65765,12 @@ var ts; if (node.expression.kind === 106) { return voidType; } - if (node.kind === 209) { + if (node.kind === 211) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 171 && - declaration.kind !== 175 && - declaration.kind !== 180 && + declaration.kind !== 173 && + declaration.kind !== 177 && + declaration.kind !== 182 && !ts.isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) { if (noImplicitAny) { @@ -65182,7 +65786,7 @@ var ts; if (returnType.flags & 12288 && isSymbolOrSymbolForCall(node)) { return getESSymbolLikeTypeForNode(ts.walkUpParenthesizedExpressions(node.parent)); } - if (node.kind === 208 && !node.questionDotToken && node.parent.kind === 238 && + if (node.kind === 210 && !node.questionDotToken && node.parent.kind === 241 && returnType.flags & 16384 && getTypePredicateOfSignature(signature)) { if (!ts.isDottedName(node.expression)) { error(node.expression, ts.Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name); @@ -65212,20 +65816,20 @@ var ts; function getDeprecatedSuggestionNode(node) { node = ts.skipParentheses(node); switch (node.kind) { - case 208: - case 165: - case 209: - return getDeprecatedSuggestionNode(node.expression); case 210: + case 167: + case 211: + return getDeprecatedSuggestionNode(node.expression); + case 212: return getDeprecatedSuggestionNode(node.tag); - case 280: - case 279: + case 283: + case 282: return getDeprecatedSuggestionNode(node.tagName); - case 207: + case 209: return node.argumentExpression; - case 206: + case 208: return node.name; - case 178: + case 180: var typeReference = node; return ts.isQualifiedName(typeReference.typeName) ? typeReference.typeName.right : typeReference; default: @@ -65292,8 +65896,8 @@ var ts; if (hasDefaultOnly && type && !isErrorType(type)) { var synthType = type; if (!synthType.defaultOnlyType) { - var type_5 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); - synthType.defaultOnlyType = type_5; + var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); + synthType.defaultOnlyType = type_4; } return synthType.defaultOnlyType; } @@ -65334,9 +65938,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 - ? 256 + ? 259 : resolvedRequire.flags & 3 - ? 254 + ? 257 : 0; if (targetDeclarationKind !== 0) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -65355,7 +65959,7 @@ var ts; return getReturnTypeOfSignature(signature); } function checkAssertion(node) { - if (node.kind === 211) { + if (node.kind === 213) { var file = ts.getSourceFileOfNode(node); if (file && ts.fileExtensionIsOneOf(file.fileName, [".cts", ".mts"])) { grammarErrorOnNode(node, ts.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead); @@ -65371,19 +65975,19 @@ var ts; case 9: case 110: case 95: - case 204: - case 205: - case 223: + case 206: + case 207: + case 225: return true; - case 212: + case 214: return isValidConstAssertionArgument(node.expression); - case 219: + case 221: var op = node.operator; var arg = node.operand; return op === 40 && (arg.kind === 8 || arg.kind === 9) || op === 39 && arg.kind === 8; - case 206: - case 207: + case 208: + case 209: var expr = node.expression; var symbol = getTypeOfNode(expr).symbol; if (symbol && symbol.flags & 2097152) { @@ -65425,7 +66029,7 @@ var ts; } function checkExpressionWithTypeArguments(node) { checkGrammarExpressionWithTypeArguments(node); - var exprType = node.kind === 228 ? checkExpression(node.expression) : + var exprType = node.kind === 230 ? checkExpression(node.expression) : ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName); var typeArguments = node.typeArguments; @@ -65489,6 +66093,16 @@ var ts; }); } } + function checkSatisfiesExpression(node) { + checkSourceElement(node.type); + var targetType = getTypeFromTypeNode(node.type); + if (isErrorType(targetType)) { + return targetType; + } + var exprType = checkExpression(node.expression); + checkTypeAssignableToAndOptionallyElaborate(exprType, targetType, node.type, node.expression, ts.Diagnostics.Type_0_does_not_satisfy_the_expected_type_1); + return exprType; + } function checkMetaProperty(node) { checkGrammarMetaProperty(node); if (node.keywordToken === 103) { @@ -65516,7 +66130,7 @@ var ts; error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); return errorType; } - else if (container.kind === 171) { + else if (container.kind === 173) { var symbol = getSymbolOfNode(container.parent); return getTypeOfSymbol(symbol); } @@ -65568,7 +66182,7 @@ var ts; } function getParameterIdentifierNameAtPosition(signature, pos) { var _a; - if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 317) { + if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 320) { return undefined; } var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -65600,7 +66214,7 @@ var ts; return symbol.valueDeclaration && ts.isParameter(symbol.valueDeclaration) && ts.isIdentifier(symbol.valueDeclaration.name); } function isValidDeclarationForTupleLabel(d) { - return d.kind === 197 || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name)); + return d.kind === 199 || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name)); } function getNameableDeclarationAtPosition(signature, pos) { var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -65872,7 +66486,7 @@ var ts; var yieldType; var nextType; var fallbackReturnType = voidType; - if (func.body.kind !== 235) { + if (func.body.kind !== 238) { returnType = checkExpressionCached(func.body, checkMode && checkMode & ~8); if (isAsync) { returnType = unwrapAwaitedType(checkAwaitedType(returnType, false, func, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member)); @@ -66007,7 +66621,7 @@ var ts; return links.isExhaustive !== undefined ? links.isExhaustive : (links.isExhaustive = computeExhaustiveSwitchStatement(node)); } function computeExhaustiveSwitchStatement(node) { - if (node.expression.kind === 216) { + if (node.expression.kind === 218) { var witnesses = getSwitchClauseTypeOfWitnesses(node); if (!witnesses) { return false; @@ -66064,11 +66678,11 @@ var ts; } function mayReturnNever(func) { switch (func.kind) { - case 213: - case 214: + case 215: + case 216: return true; - case 169: - return func.parent.kind === 205; + case 171: + return func.parent.kind === 207; default: return false; } @@ -66082,7 +66696,7 @@ var ts; if (type && maybeTypeOfKind(type, 1 | 16384)) { return; } - if (func.kind === 168 || ts.nodeIsMissing(func.body) || func.body.kind !== 235 || !functionHasImplicitReturn(func)) { + if (func.kind === 170 || ts.nodeIsMissing(func.body) || func.body.kind !== 238 || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 512; @@ -66111,7 +66725,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) { - ts.Debug.assert(node.kind !== 169 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 || ts.isObjectLiteralMethod(node)); checkNodeDeferred(node); if (ts.isFunctionExpression(node)) { checkCollisionsForDeclarationName(node, node.name); @@ -66134,7 +66748,7 @@ var ts; return anyFunctionType; } var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 213) { + if (!hasGrammarError && node.kind === 215) { checkGrammarForGenerator(node); } contextuallyCheckFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -66180,7 +66794,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 169 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 || ts.isObjectLiteralMethod(node)); var functionFlags = ts.getFunctionFlags(node); var returnType = getReturnTypeFromAnnotation(node); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); @@ -66188,7 +66802,7 @@ var ts; if (!ts.getEffectiveReturnTypeNode(node)) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 235) { + if (node.body.kind === 238) { checkSourceElement(node.body); } else { @@ -66260,7 +66874,7 @@ var ts; ts.isAccessExpression(expr) && expr.expression.kind === 108) { var ctor = ts.getContainingFunction(expr); - if (!(ctor && (ctor.kind === 171 || isJSConstructor(ctor)))) { + if (!(ctor && (ctor.kind === 173 || isJSConstructor(ctor)))) { return true; } if (symbol.valueDeclaration) { @@ -66284,7 +66898,7 @@ var ts; var symbol_2 = getNodeLinks(node).resolvedSymbol; if (symbol_2.flags & 2097152) { var declaration = getDeclarationOfAliasSymbol(symbol_2); - return !!declaration && declaration.kind === 268; + return !!declaration && declaration.kind === 271; } } } @@ -66379,7 +66993,7 @@ var ts; if (!hasParseDiagnostics(sourceFile)) { var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos); var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); - if (container && container.kind !== 171 && (ts.getFunctionFlags(container) & 2) === 0) { + if (container && container.kind !== 173 && (ts.getFunctionFlags(container) & 2) === 0) { var relatedInfo = ts.createDiagnosticForNode(container, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); ts.addRelatedInfo(diagnostic, relatedInfo); } @@ -66536,6 +67150,9 @@ var ts; } return booleanType; } + function hasEmptyObjectIntersection(type) { + return someType(type, function (t) { return t === unknownEmptyObjectType || !!(t.flags & 2097152) && ts.some(t.types, isEmptyAnonymousObjectType); }); + } function checkInExpression(left, right, leftType, rightType) { if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; @@ -66550,18 +67167,12 @@ var ts; } } else { - leftType = checkNonNullType(leftType, left); - if (!(allTypesAssignableToKind(leftType, 402653316 | 296 | 12288) || - isTypeAssignableToKind(leftType, 4194304 | 134217728 | 268435456 | 262144))) { - error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol); - } + checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left); } - rightType = checkNonNullType(rightType, right); - var rightTypeConstraint = getConstraintOfType(rightType); - if (!allTypesAssignableToKind(rightType, 67108864 | 58982400) || - rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 | 58982400) || - !maybeTypeOfKind(rightTypeConstraint, 67108864 | 58982400 | 524288))) { - error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive); + if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) { + if (hasEmptyObjectIntersection(rightType)) { + error(right, ts.Diagnostics.Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator, typeToString(rightType)); + } } return booleanType; } @@ -66579,7 +67190,7 @@ var ts; if (rightIsThis === void 0) { rightIsThis = false; } var properties = node.properties; var property = properties[propertyIndex]; - if (property.kind === 296 || property.kind === 297) { + if (property.kind === 299 || property.kind === 300) { var name = property.name; var exprType = getLiteralTypeFromPropertyName(name); if (isTypeUsableAsPropertyName(exprType)) { @@ -66592,9 +67203,9 @@ var ts; } var elementType = getIndexedAccessType(objectLiteralType, exprType, 32, name); var type = getFlowTypeOfDestructuring(property, elementType); - return checkDestructuringAssignment(property.kind === 297 ? property : property.initializer, type); + return checkDestructuringAssignment(property.kind === 300 ? property : property.initializer, type); } - else if (property.kind === 298) { + else if (property.kind === 301) { if (propertyIndex < properties.length - 1) { error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } @@ -66629,7 +67240,7 @@ var ts; var inBoundsType = compilerOptions.noUncheckedIndexedAccess ? undefined : possiblyOutOfBoundsType; for (var i = 0; i < elements.length; i++) { var type = possiblyOutOfBoundsType; - if (node.elements[i].kind === 225) { + if (node.elements[i].kind === 227) { type = inBoundsType = inBoundsType !== null && inBoundsType !== void 0 ? inBoundsType : (checkIteratedTypeOrElementType(65, sourceType, undefinedType, node) || errorType); } checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, type, checkMode); @@ -66639,8 +67250,8 @@ var ts; function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 227) { - if (element.kind !== 225) { + if (element.kind !== 229) { + if (element.kind !== 227) { var indexType = getNumberLiteralType(elementIndex); if (isArrayLikeType(sourceType)) { var accessFlags = 32 | (hasDefaultValue(element) ? 16 : 0); @@ -66656,7 +67267,7 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 221 && restExpression.operatorToken.kind === 63) { + if (restExpression.kind === 223 && restExpression.operatorToken.kind === 63) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -66672,7 +67283,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode, rightIsThis) { var target; - if (exprOrAssignment.kind === 297) { + if (exprOrAssignment.kind === 300) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { if (strictNullChecks && @@ -66686,27 +67297,27 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 221 && target.operatorToken.kind === 63) { + if (target.kind === 223 && target.operatorToken.kind === 63) { checkBinaryExpression(target, checkMode); target = target.left; if (strictNullChecks) { sourceType = getTypeWithFacts(sourceType, 524288); } } - if (target.kind === 205) { + if (target.kind === 207) { return checkObjectLiteralAssignment(target, sourceType, rightIsThis); } - if (target.kind === 204) { + if (target.kind === 206) { return checkArrayLiteralAssignment(target, sourceType, checkMode); } return checkReferenceAssignment(target, sourceType, checkMode); } function checkReferenceAssignment(target, sourceType, checkMode) { var targetType = checkExpression(target, checkMode); - var error = target.parent.kind === 298 ? + var error = target.parent.kind === 301 ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; - var optionalError = target.parent.kind === 298 ? + var optionalError = target.parent.kind === 301 ? ts.Diagnostics.The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access; if (checkReferenceExpression(target, error, optionalError)) { @@ -66723,36 +67334,36 @@ var ts; case 79: case 10: case 13: - case 210: - case 223: + case 212: + case 225: case 14: case 8: case 9: case 110: case 95: case 104: - case 153: - case 213: - case 226: - case 214: - case 204: - case 205: + case 155: + case 215: + case 228: case 216: - case 230: - case 279: - case 278: + case 206: + case 207: + case 218: + case 232: + case 282: + case 281: return true; - case 222: + case 224: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 221: + case 223: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 219: - case 220: + case 221: + case 222: switch (node.operator) { case 53: case 39: @@ -66761,9 +67372,9 @@ var ts; return true; } return false; - case 217: - case 211: - case 229: + case 219: + case 213: + case 231: default: return false; } @@ -66800,7 +67411,7 @@ var ts; } checkGrammarNullishCoalesceWithLogicalExpression(node); var operator = node.operatorToken.kind; - if (operator === 63 && (node.left.kind === 205 || node.left.kind === 204)) { + if (operator === 63 && (node.left.kind === 207 || node.left.kind === 206)) { state.skip = true; setLastResult(state, checkDestructuringAssignment(node.left, checkExpression(node.right, checkMode), checkMode, node.right.kind === 108)); return state; @@ -66822,11 +67433,11 @@ var ts; if (operator === 55 || operator === 56 || operator === 60) { if (operator === 55) { var parent = node.parent; - while (parent.kind === 212 + while (parent.kind === 214 || ts.isBinaryExpression(parent) && (parent.operatorToken.kind === 55 || parent.operatorToken.kind === 56)) { parent = parent.parent; } - checkTestingKnownTruthyCallableOrAwaitableType(node.left, ts.isIfStatement(parent) ? parent.thenStatement : undefined); + checkTestingKnownTruthyCallableOrAwaitableType(node.left, leftType, ts.isIfStatement(parent) ? parent.thenStatement : undefined); } checkTruthinessOfType(leftType, node.left); } @@ -66891,7 +67502,7 @@ var ts; } function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { var operator = operatorToken.kind; - if (operator === 63 && (left.kind === 205 || left.kind === 204)) { + if (operator === 63 && (left.kind === 207 || left.kind === 206)) { return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 108); } var leftType; @@ -67029,6 +67640,7 @@ var ts; var eqType = operator === 34 || operator === 36; error(errorNode, ts.Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true"); } + checkNaNEquality(errorNode, operator, left, right); reportOperatorErrorUnless(function (left, right) { return isTypeEqualityComparableTo(left, right) || isTypeEqualityComparableTo(right, left); }); return booleanType; case 102: @@ -67212,20 +67824,35 @@ var ts; } } function tryGiveBetterPrimaryError(errNode, maybeMissingAwait, leftStr, rightStr) { - var typeName; switch (operatorToken.kind) { case 36: case 34: - typeName = "false"; - break; case 37: case 35: - typeName = "true"; + return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap, leftStr, rightStr); + default: + return undefined; } - if (typeName) { - return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap, typeName, leftStr, rightStr); + } + function checkNaNEquality(errorNode, operator, left, right) { + var isLeftNaN = isGlobalNaN(ts.skipParentheses(left)); + var isRightNaN = isGlobalNaN(ts.skipParentheses(right)); + if (isLeftNaN || isRightNaN) { + var err = error(errorNode, ts.Diagnostics.This_condition_will_always_return_0, ts.tokenToString(operator === 36 || operator === 34 ? 95 : 110)); + if (isLeftNaN && isRightNaN) + return; + var operatorString = operator === 37 || operator === 35 ? ts.tokenToString(53) : ""; + var location = isLeftNaN ? right : left; + var expression = ts.skipParentheses(location); + ts.addRelatedInfo(err, ts.createDiagnosticForNode(location, ts.Diagnostics.Did_you_mean_0, "".concat(operatorString, "Number.isNaN(").concat(ts.isEntityNameExpression(expression) ? ts.entityNameToString(expression) : "...", ")"))); } - return undefined; + } + function isGlobalNaN(expr) { + if (ts.isIdentifier(expr) && expr.escapedText === "NaN") { + var globalNaNSymbol = getGlobalNaNSymbol(); + return !!globalNaNSymbol && globalNaNSymbol === getResolvedSymbol(expr); + } + return false; } } function getBaseTypesIfUnrelated(leftType, rightType, isRelated) { @@ -67299,8 +67926,8 @@ var ts; } } function checkConditionalExpression(node, checkMode) { - checkTruthinessExpression(node.condition); - checkTestingKnownTruthyCallableOrAwaitableType(node.condition, node.whenTrue); + var type = checkTruthinessExpression(node.condition); + checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue); var type1 = checkExpression(node.whenTrue, checkMode); var type2 = checkExpression(node.whenFalse, checkMode); return getUnionType([type1, type2], 2); @@ -67329,7 +67956,7 @@ var ts; type.flags & 58982400 && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316)); } function getContextNode(node) { - if (node.kind === 286 && !ts.isJsxSelfClosingElement(node.parent)) { + if (node.kind === 289 && !ts.isJsxSelfClosingElement(node.parent)) { return node.parent.parent; } return node; @@ -67372,8 +67999,8 @@ var ts; } function isTypeAssertion(node) { node = ts.skipParentheses(node, true); - return node.kind === 211 || - node.kind === 229 || + return node.kind === 213 || + node.kind === 231 || ts.isJSDocTypeAssertion(node); } function checkDeclarationInitializer(declaration, checkMode, contextualType) { @@ -67382,7 +68009,7 @@ var ts; (contextualType ? checkExpressionWithContextualType(initializer, contextualType, undefined, checkMode || 0) : checkExpressionCached(initializer, checkMode)); - return ts.isParameter(declaration) && declaration.name.kind === 202 && + return ts.isParameter(declaration) && declaration.name.kind === 204 && isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ? padTupleType(type, declaration.name) : type; } @@ -67392,7 +68019,7 @@ var ts; var elementFlags = type.target.elementFlags.slice(); for (var i = getTypeReferenceArity(type); i < patternElements.length; i++) { var e = patternElements[i]; - if (i < patternElements.length - 1 || !(e.kind === 203 && e.dotDotDotToken)) { + if (i < patternElements.length - 1 || !(e.kind === 205 && e.dotDotDotToken)) { elementTypes.push(!ts.isOmittedExpression(e) && hasDefaultValue(e) ? getTypeFromBindingElement(e, false, false) : anyType); elementFlags.push(2); if (!ts.isOmittedExpression(e) && !hasDefaultValue(e)) { @@ -67452,14 +68079,14 @@ var ts; getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(arguments.length === 2 ? getContextualType(node, undefined) : contextualType, node, undefined)); } function checkPropertyAssignment(node, checkMode) { - if (node.name.kind === 162) { + if (node.name.kind === 164) { checkComputedPropertyName(node.name); } return checkExpressionForMutableLocation(node.initializer, checkMode); } function checkObjectLiteralMethod(node, checkMode) { checkGrammarMethod(node); - if (node.name.kind === 162) { + if (node.name.kind === 164) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -67662,11 +68289,11 @@ var ts; return type; } function checkConstEnumAccess(node, type) { - var ok = (node.parent.kind === 206 && node.parent.expression === node) || - (node.parent.kind === 207 && node.parent.expression === node) || - ((node.kind === 79 || node.kind === 161) && isInRightSideOfImportOrExportAssignment(node) || - (node.parent.kind === 181 && node.parent.exprName === node)) || - (node.parent.kind === 275); + var ok = (node.parent.kind === 208 && node.parent.expression === node) || + (node.parent.kind === 209 && node.parent.expression === node) || + ((node.kind === 79 || node.kind === 163) && isInRightSideOfImportOrExportAssignment(node) || + (node.parent.kind === 183 && node.parent.exprName === node)) || + (node.parent.kind === 278); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query); } @@ -67689,9 +68316,9 @@ var ts; var kind = node.kind; if (cancellationToken) { switch (kind) { - case 226: - case 213: - case 214: + case 228: + case 215: + case 216: cancellationToken.throwIfCancellationRequested(); } } @@ -67722,79 +68349,81 @@ var ts; return trueType; case 95: return falseType; - case 223: + case 225: return checkTemplateExpression(node); case 13: return globalRegExpType; - case 204: - return checkArrayLiteral(node, checkMode, forceTuple); - case 205: - return checkObjectLiteral(node, checkMode); case 206: - return checkPropertyAccessExpression(node, checkMode); - case 161: - return checkQualifiedName(node, checkMode); + return checkArrayLiteral(node, checkMode, forceTuple); case 207: - return checkIndexedAccess(node, checkMode); + return checkObjectLiteral(node, checkMode); case 208: + return checkPropertyAccessExpression(node, checkMode); + case 163: + return checkQualifiedName(node, checkMode); + case 209: + return checkIndexedAccess(node, checkMode); + case 210: if (node.expression.kind === 100) { return checkImportCallExpression(node); } - case 209: - return checkCallExpression(node, checkMode); - case 210: - return checkTaggedTemplateExpression(node); - case 212: - return checkParenthesizedExpression(node, checkMode); - case 226: - return checkClassExpression(node); - case 213: - case 214: - return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); - case 216: - return checkTypeOfExpression(node); case 211: - case 229: - return checkAssertion(node); - case 230: - return checkNonNullAssertion(node); + return checkCallExpression(node, checkMode); + case 212: + return checkTaggedTemplateExpression(node); + case 214: + return checkParenthesizedExpression(node, checkMode); case 228: - return checkExpressionWithTypeArguments(node); - case 231: - return checkMetaProperty(node); + return checkClassExpression(node); case 215: - return checkDeleteExpression(node); - case 217: - return checkVoidExpression(node); + case 216: + return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); case 218: - return checkAwaitExpression(node); - case 219: - return checkPrefixUnaryExpression(node); - case 220: - return checkPostfixUnaryExpression(node); - case 221: - return checkBinaryExpression(node, checkMode); - case 222: - return checkConditionalExpression(node, checkMode); - case 225: - return checkSpreadExpression(node, checkMode); - case 227: - return undefinedWideningType; - case 224: - return checkYieldExpression(node); + return checkTypeOfExpression(node); + case 213: + case 231: + return checkAssertion(node); case 232: + return checkNonNullAssertion(node); + case 230: + return checkExpressionWithTypeArguments(node); + case 235: + return checkSatisfiesExpression(node); + case 233: + return checkMetaProperty(node); + case 217: + return checkDeleteExpression(node); + case 219: + return checkVoidExpression(node); + case 220: + return checkAwaitExpression(node); + case 221: + return checkPrefixUnaryExpression(node); + case 222: + return checkPostfixUnaryExpression(node); + case 223: + return checkBinaryExpression(node, checkMode); + case 224: + return checkConditionalExpression(node, checkMode); + case 227: + return checkSpreadExpression(node, checkMode); + case 229: + return undefinedWideningType; + case 226: + return checkYieldExpression(node); + case 234: return checkSyntheticExpression(node); - case 288: + case 291: return checkJsxExpression(node, checkMode); - case 278: + case 281: return checkJsxElement(node, checkMode); - case 279: - return checkJsxSelfClosingElement(node, checkMode); case 282: + return checkJsxSelfClosingElement(node, checkMode); + case 285: return checkJsxFragment(node); - case 286: + case 289: return checkJsxAttributes(node, checkMode); - case 280: + case 283: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return errorType; @@ -67846,10 +68475,10 @@ var ts; checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); if (ts.hasSyntacticModifier(node, 16476)) { - if (!(func.kind === 171 && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 173 && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } - if (func.kind === 171 && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { + if (func.kind === 173 && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { error(node.name, ts.Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name); } } @@ -67860,13 +68489,13 @@ var ts; if (func.parameters.indexOf(node) !== 0) { error(node, ts.Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText); } - if (func.kind === 171 || func.kind === 175 || func.kind === 180) { + if (func.kind === 173 || func.kind === 177 || func.kind === 182) { error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); } - if (func.kind === 214) { + if (func.kind === 216) { error(node, ts.Diagnostics.An_arrow_function_cannot_have_a_this_parameter); } - if (func.kind === 172 || func.kind === 173) { + if (func.kind === 174 || func.kind === 175) { error(node, ts.Diagnostics.get_and_set_accessors_cannot_declare_this_parameters); } } @@ -67920,13 +68549,13 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 214: - case 174: - case 256: - case 213: - case 179: - case 169: - case 168: + case 216: + case 176: + case 259: + case 215: + case 181: + case 171: + case 170: var parent = node.parent; if (node === parent.type) { return parent; @@ -67944,7 +68573,7 @@ var ts; error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name.kind === 202 || name.kind === 201) { + else if (name.kind === 204 || name.kind === 203) { if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } @@ -67952,12 +68581,12 @@ var ts; } } function checkSignatureDeclaration(node) { - if (node.kind === 176) { + if (node.kind === 178) { checkGrammarIndexSignature(node); } - else if (node.kind === 179 || node.kind === 256 || node.kind === 180 || - node.kind === 174 || node.kind === 171 || - node.kind === 175) { + else if (node.kind === 181 || node.kind === 259 || node.kind === 182 || + node.kind === 176 || node.kind === 173 || + node.kind === 177) { checkGrammarFunctionLikeDeclaration(node); } var functionFlags = ts.getFunctionFlags(node); @@ -67984,10 +68613,10 @@ var ts; var returnTypeNode = ts.getEffectiveReturnTypeNode(node); if (noImplicitAny && !returnTypeNode) { switch (node.kind) { - case 175: + case 177: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 174: + case 176: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -68011,7 +68640,7 @@ var ts; checkAsyncFunctionReturnType(node, returnTypeNode); } } - if (node.kind !== 176 && node.kind !== 317) { + if (node.kind !== 178 && node.kind !== 320) { registerForUnusedIdentifiersCheck(node); } } @@ -68022,7 +68651,7 @@ var ts; var privateIdentifiers = new ts.Map(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 171) { + if (member.kind === 173) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; if (ts.isParameterPropertyDeclaration(param, member) && !ts.isBindingPattern(param.name)) { @@ -68044,16 +68673,16 @@ var ts; var memberName = name && ts.getPropertyNameForPropertyNameNode(name); if (memberName) { switch (member.kind) { - case 172: + case 174: addName(names, name, memberName, 1 | privateStaticFlags); break; - case 173: + case 175: addName(names, name, memberName, 2 | privateStaticFlags); break; - case 167: + case 169: addName(names, name, memberName, 3 | privateStaticFlags); break; - case 169: + case 171: addName(names, name, memberName, 8 | privateStaticFlags); break; } @@ -68112,7 +68741,7 @@ var ts; var names = new ts.Map(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 166) { + if (member.kind === 168) { var memberName = void 0; var name = member.name; switch (name.kind) { @@ -68137,7 +68766,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 258) { + if (node.kind === 261) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations && nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -68146,7 +68775,7 @@ var ts; var indexSymbol = getIndexSymbol(getSymbolOfNode(node)); if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) { var indexSignatureMap_1 = new ts.Map(); - var _loop_29 = function (declaration) { + var _loop_30 = function (declaration) { if (declaration.parameters.length === 1 && declaration.parameters[0].type) { forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) { var entry = indexSignatureMap_1.get(getTypeId(type)); @@ -68161,7 +68790,7 @@ var ts; }; for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - _loop_29(declaration); + _loop_30(declaration); } indexSignatureMap_1.forEach(function (entry) { if (entry.declarations.length > 1) { @@ -68178,7 +68807,7 @@ var ts; checkGrammarComputedPropertyName(node.name); checkVariableLikeDeclaration(node); setNodeLinksForPrivateIdentifierScope(node); - if (ts.hasSyntacticModifier(node, 128) && node.kind === 167 && node.initializer) { + if (ts.hasSyntacticModifier(node, 256) && node.kind === 169 && node.initializer) { error(node, ts.Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } } @@ -68195,7 +68824,7 @@ var ts; error(node.name, ts.Diagnostics.Class_constructor_may_not_be_a_generator); } checkFunctionOrMethodDeclaration(node); - if (ts.hasSyntacticModifier(node, 128) && node.kind === 169 && node.body) { + if (ts.hasSyntacticModifier(node, 256) && node.kind === 171 && node.body) { error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } if (ts.isPrivateIdentifier(node.name) && !ts.getContainingClass(node)) { @@ -68240,7 +68869,7 @@ var ts; if (ts.isPrivateIdentifierClassElementDeclaration(n)) { return true; } - return n.kind === 167 && + return n.kind === 169 && !ts.isStatic(n) && !!n.initializer; } @@ -68310,25 +68939,25 @@ var ts; checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 172) { + if (node.kind === 174) { if (!(node.flags & 16777216) && ts.nodeIsPresent(node.body) && (node.flags & 256)) { if (!(node.flags & 512)) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); } } } - if (node.name.kind === 162) { + if (node.name.kind === 164) { checkComputedPropertyName(node.name); } if (hasBindableName(node)) { var symbol = getSymbolOfNode(node); - var getter = ts.getDeclarationOfKind(symbol, 172); - var setter = ts.getDeclarationOfKind(symbol, 173); + var getter = ts.getDeclarationOfKind(symbol, 174); + var setter = ts.getDeclarationOfKind(symbol, 175); if (getter && setter && !(getNodeCheckFlags(getter) & 1)) { getNodeLinks(getter).flags |= 1; var getterFlags = ts.getEffectiveModifierFlags(getter); var setterFlags = ts.getEffectiveModifierFlags(setter); - if ((getterFlags & 128) !== (setterFlags & 128)) { + if ((getterFlags & 256) !== (setterFlags & 256)) { error(getter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); error(setter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); } @@ -68345,7 +68974,7 @@ var ts; } } var returnType = getTypeOfAccessors(getSymbolOfNode(node)); - if (node.kind === 172) { + if (node.kind === 174) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } @@ -68354,7 +68983,7 @@ var ts; checkDecorators(node); } function getEffectiveTypeArgumentAtIndex(node, typeParameters, index) { - if (index < typeParameters.length) { + if (node.typeArguments && index < node.typeArguments.length) { return getTypeFromTypeNode(node.typeArguments[index]); } return getEffectiveTypeArguments(node, typeParameters)[index]; @@ -68391,7 +69020,7 @@ var ts; } function checkTypeReferenceNode(node) { checkGrammarTypeArguments(node, node.typeArguments); - if (node.kind === 178 && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { + if (node.kind === 180 && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { grammarErrorAtPos(node, node.typeName.jsdocDotPos, 1, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); } ts.forEach(node.typeArguments, checkSourceElement); @@ -68449,7 +69078,7 @@ var ts; var hasNamedElement = ts.some(elementTypes, ts.isNamedTupleMember); for (var _i = 0, elementTypes_1 = elementTypes; _i < elementTypes_1.length; _i++) { var e = elementTypes_1[_i]; - if (e.kind !== 197 && hasNamedElement) { + if (e.kind !== 199 && hasNamedElement) { grammarErrorOnNode(e, ts.Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names); break; } @@ -68497,7 +69126,7 @@ var ts; var objectType = type.objectType; var indexType = type.indexType; if (isTypeAssignableTo(indexType, getIndexType(objectType, false))) { - if (accessNode.kind === 207 && ts.isAssignmentTarget(accessNode) && + if (accessNode.kind === 209 && ts.isAssignmentTarget(accessNode) && ts.getObjectFlags(objectType) & 32 && getMappedTypeModifiers(objectType) & 1) { error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); } @@ -68560,7 +69189,7 @@ var ts; ts.forEachChild(node, checkSourceElement); } function checkInferType(node) { - if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 189 && n.parent.extendsType === n; })) { + if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 191 && n.parent.extendsType === n; })) { grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type); } checkSourceElement(node.typeParameter); @@ -68570,7 +69199,7 @@ var ts; if (!links.typeParametersChecked) { links.typeParametersChecked = true; var typeParameter = getDeclaredTypeOfTypeParameter(symbol); - var declarations = ts.getDeclarationsOfKind(symbol, 163); + var declarations = ts.getDeclarationsOfKind(symbol, 165); if (!areTypeParametersIdentical(declarations, [typeParameter], function (decl) { return [decl]; })) { var name = symbolToString(symbol); for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) { @@ -68610,10 +69239,10 @@ var ts; if (node.dotDotDotToken && node.questionToken) { grammarErrorOnNode(node, ts.Diagnostics.A_tuple_member_cannot_be_both_optional_and_rest); } - if (node.type.kind === 185) { + if (node.type.kind === 187) { grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type); } - if (node.type.kind === 186) { + if (node.type.kind === 188) { grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type); } checkSourceElement(node.type); @@ -68624,9 +69253,9 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedModifierFlags(n); - if (n.parent.kind !== 258 && - n.parent.kind !== 257 && - n.parent.kind !== 226 && + if (n.parent.kind !== 261 && + n.parent.kind !== 260 && + n.parent.kind !== 228 && n.flags & 16777216) { if (!(flags & 2) && !(ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent))) { flags |= 1; @@ -68658,7 +69287,7 @@ var ts; else if (deviation & (8 | 16)) { error(ts.getNameOfDeclaration(o) || o, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } - else if (deviation & 128) { + else if (deviation & 256) { error(ts.getNameOfDeclaration(o), ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract); } }); @@ -68675,7 +69304,7 @@ var ts; }); } } - var flagsToCheck = 1 | 2 | 8 | 16 | 128; + var flagsToCheck = 1 | 2 | 8 | 16 | 256; var someNodeFlags = 0; var allNodeFlags = flagsToCheck; var someHaveQuestionToken = false; @@ -68707,7 +69336,7 @@ var ts; ts.isComputedPropertyName(node.name) && ts.isComputedPropertyName(subsequentName) || ts.isPropertyNameLiteral(node.name) && ts.isPropertyNameLiteral(subsequentName) && ts.getEscapedTextOfIdentifierOrLiteral(node.name) === ts.getEscapedTextOfIdentifierOrLiteral(subsequentName))) { - var reportError = (node.kind === 169 || node.kind === 168) && + var reportError = (node.kind === 171 || node.kind === 170) && ts.isStatic(node) !== ts.isStatic(subsequentNode); if (reportError) { var diagnostic = ts.isStatic(node) ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; @@ -68726,7 +69355,7 @@ var ts; error(errorNode, ts.Diagnostics.Constructor_implementation_is_missing); } else { - if (ts.hasSyntacticModifier(node, 128)) { + if (ts.hasSyntacticModifier(node, 256)) { error(errorNode, ts.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive); } else { @@ -68743,14 +69372,14 @@ var ts; var current = declarations_5[_i]; var node = current; var inAmbientContext = node.flags & 16777216; - var inAmbientContextOrInterface = node.parent && (node.parent.kind === 258 || node.parent.kind === 182) || inAmbientContext; + var inAmbientContextOrInterface = node.parent && (node.parent.kind === 261 || node.parent.kind === 184) || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if ((node.kind === 257 || node.kind === 226) && !inAmbientContext) { + if ((node.kind === 260 || node.kind === 228) && !inAmbientContext) { hasNonAmbientClass = true; } - if (node.kind === 256 || node.kind === 169 || node.kind === 168 || node.kind === 171) { + if (node.kind === 259 || node.kind === 171 || node.kind === 170 || node.kind === 173) { functionDeclarations.push(node); var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; @@ -68795,12 +69424,12 @@ var ts; }); } if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 && declarations) { - var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 257; }) + var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 260; }) .map(function (d) { return ts.createDiagnosticForNode(d, ts.Diagnostics.Consider_adding_a_declare_modifier_to_this_class); }); ts.forEach(declarations, function (declaration) { - var diagnostic = declaration.kind === 257 + var diagnostic = declaration.kind === 260 ? ts.Diagnostics.Class_declaration_cannot_implement_overload_list_for_0 - : declaration.kind === 256 + : declaration.kind === 259 ? ts.Diagnostics.Function_with_bodies_can_only_merge_with_classes_that_are_ambient : undefined; if (diagnostic) { @@ -68809,7 +69438,7 @@ var ts; }); } if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && - !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 128) && !lastSeenNonAmbientDeclaration.questionToken) { + !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 256) && !lastSeenNonAmbientDeclaration.questionToken) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } if (hasOverloads) { @@ -68850,9 +69479,9 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var d = _a[_i]; var declarationSpaces = getDeclarationSpaces(d); - var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 | 512); + var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 | 1024); if (effectiveDeclarationFlags & 1) { - if (effectiveDeclarationFlags & 512) { + if (effectiveDeclarationFlags & 1024) { defaultExportedDeclarationSpaces |= declarationSpaces; } else { @@ -68882,43 +69511,43 @@ var ts; function getDeclarationSpaces(decl) { var d = decl; switch (d.kind) { - case 258: - case 259: - case 345: - case 338: - case 339: - return 2; case 261: + case 262: + case 348: + case 341: + case 342: + return 2; + case 264: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 ? 4 | 1 : 4; - case 257: case 260: - case 299: + case 263: + case 302: return 2 | 1; - case 305: + case 308: return 2 | 1 | 4; - case 271: - case 221: + case 274: + case 223: var node_2 = d; var expression = ts.isExportAssignment(node_2) ? node_2.expression : node_2.right; if (!ts.isEntityNameExpression(expression)) { return 1; } d = expression; - case 265: case 268: - case 267: + case 271: + case 270: var result_12 = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_12 |= getDeclarationSpaces(d); }); return result_12; - case 254: - case 203: - case 256: - case 270: + case 257: + case 205: + case 259: + case 273: case 79: return 1; default: @@ -69169,20 +69798,20 @@ var ts; var headMessage; var expectedReturnType; switch (node.parent.kind) { - case 257: + case 260: headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 167: - case 164: + case 169: + case 166: headMessage = ts.Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any; expectedReturnType = voidType; break; - case 169: - case 172: - case 173: + case 171: + case 174: + case 175: headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); @@ -69230,15 +69859,15 @@ var ts; function getEntityNameForDecoratorMetadata(node) { if (node) { switch (node.kind) { - case 188: - case 187: - return getEntityNameForDecoratorMetadataFromTypeList(node.types); + case 190: case 189: - return getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]); + return getEntityNameForDecoratorMetadataFromTypeList(node.types); case 191: - case 197: + return getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]); + case 193: + case 199: return getEntityNameForDecoratorMetadata(node.type); - case 178: + case 180: return node.typeName; } } @@ -69247,13 +69876,13 @@ var ts; var commonEntityName; for (var _i = 0, types_21 = types; _i < types_21.length; _i++) { var typeNode = types_21[_i]; - while (typeNode.kind === 191 || typeNode.kind === 197) { + while (typeNode.kind === 193 || typeNode.kind === 199) { typeNode = typeNode.type; } - if (typeNode.kind === 143) { + if (typeNode.kind === 144) { continue; } - if (!strictNullChecks && (typeNode.kind === 196 && typeNode.literal.kind === 104 || typeNode.kind === 153)) { + if (!strictNullChecks && (typeNode.kind === 198 && typeNode.literal.kind === 104 || typeNode.kind === 155)) { continue; } var individualEntityName = getEntityNameForDecoratorMetadata(typeNode); @@ -69289,13 +69918,13 @@ var ts; return; } checkExternalEmitHelpers(firstDecorator, 8); - if (node.kind === 164) { + if (node.kind === 166) { checkExternalEmitHelpers(firstDecorator, 32); } if (compilerOptions.emitDecoratorMetadata) { checkExternalEmitHelpers(firstDecorator, 16); switch (node.kind) { - case 257: + case 260: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -69304,23 +69933,23 @@ var ts; } } break; - case 172: - case 173: - var otherKind = node.kind === 172 ? 173 : 172; + case 174: + case 175: + var otherKind = node.kind === 174 ? 175 : 174; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind); markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor)); break; - case 169: + case 171: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveReturnTypeNode(node)); break; - case 167: + case 169: markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveTypeAnnotationNode(node)); break; - case 164: + case 166: markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); var containingSignature = node.parent; for (var _d = 0, _e = containingSignature.parameters; _d < _e.length; _d++) { @@ -69421,7 +70050,7 @@ var ts; switch (node.kind) { case 79: return node; - case 206: + case 208: return node.name; default: return undefined; @@ -69432,7 +70061,7 @@ var ts; checkDecorators(node); checkSignatureDeclaration(node); var functionFlags = ts.getFunctionFlags(node); - if (node.name && node.name.kind === 162) { + if (node.name && node.name.kind === 164) { checkComputedPropertyName(node.name); } if (hasBindableName(node)) { @@ -69446,7 +70075,7 @@ var ts; checkFunctionOrConstructorSymbol(symbol); } } - var body = node.kind === 168 ? undefined : node.body; + var body = node.kind === 170 ? undefined : node.body; checkSourceElement(body); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, getReturnTypeFromAnnotation(node)); addLazyDiagnostic(checkFunctionOrMethodDeclarationDiagnostics); @@ -69483,42 +70112,42 @@ var ts; for (var _i = 0, potentiallyUnusedIdentifiers_1 = potentiallyUnusedIdentifiers; _i < potentiallyUnusedIdentifiers_1.length; _i++) { var node = potentiallyUnusedIdentifiers_1[_i]; switch (node.kind) { - case 257: - case 226: + case 260: + case 228: checkUnusedClassMembers(node, addDiagnostic); checkUnusedTypeParameters(node, addDiagnostic); break; - case 305: - case 261: - case 235: - case 263: - case 242: - case 243: - case 244: + case 308: + case 264: + case 238: + case 266: + case 245: + case 246: + case 247: checkUnusedLocalsAndParameters(node, addDiagnostic); break; - case 171: - case 213: - case 256: - case 214: - case 169: - case 172: case 173: + case 215: + case 259: + case 216: + case 171: + case 174: + case 175: if (node.body) { checkUnusedLocalsAndParameters(node, addDiagnostic); } checkUnusedTypeParameters(node, addDiagnostic); break; - case 168: - case 174: - case 175: - case 179: - case 180: - case 259: - case 258: + case 170: + case 176: + case 177: + case 181: + case 182: + case 262: + case 261: checkUnusedTypeParameters(node, addDiagnostic); break; - case 190: + case 192: checkUnusedInferTypeParameter(node, addDiagnostic); break; default: @@ -69538,11 +70167,11 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { + case 171: case 169: - case 167: - case 172: - case 173: - if (member.kind === 173 && member.symbol.flags & 32768) { + case 174: + case 175: + if (member.kind === 175 && member.symbol.flags & 32768) { break; } var symbol = getSymbolOfNode(member); @@ -69552,7 +70181,7 @@ var ts; addDiagnostic(member, 0, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol))); } break; - case 171: + case 173: for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; if (!parameter.symbol.isReferenced && ts.hasSyntacticModifier(parameter, 8)) { @@ -69560,9 +70189,9 @@ var ts; } } break; - case 176: - case 234: - case 170: + case 178: + case 237: + case 172: break; default: ts.Debug.fail("Unexpected class member"); @@ -69587,7 +70216,7 @@ var ts; continue; var name = ts.idText(typeParameter.name); var parent = typeParameter.parent; - if (parent.kind !== 190 && parent.typeParameters.every(isTypeParameterUnused)) { + if (parent.kind !== 192 && parent.typeParameters.every(isTypeParameterUnused)) { if (ts.tryAddToSet(seenParentsWithEveryUnused, parent)) { var sourceFile = ts.getSourceFileOfNode(parent); var range = ts.isJSDocTemplateTag(parent) @@ -69681,7 +70310,7 @@ var ts; var importDecl = importClause.parent; var nDeclarations = (importClause.name ? 1 : 0) + (importClause.namedBindings ? - (importClause.namedBindings.kind === 268 ? 1 : importClause.namedBindings.elements.length) + (importClause.namedBindings.kind === 271 ? 1 : importClause.namedBindings.elements.length) : 0); if (nDeclarations === unuseds.length) { addDiagnostic(importDecl, 0, unuseds.length === 1 @@ -69699,7 +70328,7 @@ var ts; var bindingPattern = _a[0], bindingElements = _a[1]; var kind = tryGetRootParameterDeclaration(bindingPattern.parent) ? 1 : 0; if (bindingPattern.elements.length === bindingElements.length) { - if (bindingElements.length === 1 && bindingPattern.parent.kind === 254 && bindingPattern.parent.parent.kind === 255) { + if (bindingElements.length === 1 && bindingPattern.parent.kind === 257 && bindingPattern.parent.parent.kind === 258) { addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId); } else { @@ -69720,7 +70349,7 @@ var ts; if (declarationList.declarations.length === declarations.length) { addDiagnostic(declarationList, 0, declarations.length === 1 ? ts.createDiagnosticForNode(ts.first(declarations).name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(ts.first(declarations).name)) - : ts.createDiagnosticForNode(declarationList.parent.kind === 237 ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); + : ts.createDiagnosticForNode(declarationList.parent.kind === 240 ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); } else { for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { @@ -69749,21 +70378,21 @@ var ts; switch (name.kind) { case 79: return ts.idText(name); - case 202: - case 201: + case 204: + case 203: return bindingNameText(ts.cast(ts.first(name.elements), ts.isBindingElement).name); default: return ts.Debug.assertNever(name); } } function isImportedDeclaration(node) { - return node.kind === 267 || node.kind === 270 || node.kind === 268; + return node.kind === 270 || node.kind === 273 || node.kind === 271; } function importClauseFromImported(decl) { - return decl.kind === 267 ? decl : decl.kind === 268 ? decl.parent : decl.parent.parent; + return decl.kind === 270 ? decl : decl.kind === 271 ? decl.parent : decl.parent.parent; } function checkBlock(node) { - if (node.kind === 235) { + if (node.kind === 238) { checkGrammarStatementInAmbientContext(node); } if (ts.isFunctionOrModuleBlock(node)) { @@ -69792,13 +70421,13 @@ var ts; if ((identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) !== name) { return false; } - if (node.kind === 167 || - node.kind === 166 || - node.kind === 169 || + if (node.kind === 169 || node.kind === 168 || - node.kind === 172 || - node.kind === 173 || - node.kind === 296) { + node.kind === 171 || + node.kind === 170 || + node.kind === 174 || + node.kind === 175 || + node.kind === 299) { return false; } if (node.flags & 16777216) { @@ -69856,7 +70485,7 @@ var ts; return; } var parent = getDeclarationContainer(node); - if (parent.kind === 305 && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 308 && ts.isExternalOrCommonJsModule(parent)) { errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -69868,7 +70497,7 @@ var ts; return; } var parent = getDeclarationContainer(node); - if (parent.kind === 305 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048) { + if (parent.kind === 308 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048) { errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -69939,7 +70568,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 3) !== 0 || ts.isParameterDeclaration(node)) { return; } - if (node.kind === 254 && !node.initializer) { + if (node.kind === 257 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -69951,15 +70580,15 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 255); - var container = varDeclList.parent.kind === 237 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 258); + var container = varDeclList.parent.kind === 240 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 235 && ts.isFunctionLike(container.parent) || - container.kind === 262 || - container.kind === 261 || - container.kind === 305); + (container.kind === 238 && ts.isFunctionLike(container.parent) || + container.kind === 265 || + container.kind === 264 || + container.kind === 308); if (!namesShareScope) { var name = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); @@ -69980,7 +70609,7 @@ var ts; if (!node.name) { return; } - if (node.name.kind === 162) { + if (node.name.kind === 164) { checkComputedPropertyName(node.name); if (ts.hasOnlyExpressionInitializer(node) && node.initializer) { checkExpressionCached(node.initializer); @@ -69997,7 +70626,7 @@ var ts; if (ts.isObjectBindingPattern(node.parent) && node.dotDotDotToken && languageVersion < 5) { checkExternalEmitHelpers(node, 4); } - if (node.propertyName && node.propertyName.kind === 162) { + if (node.propertyName && node.propertyName.kind === 164) { checkComputedPropertyName(node.propertyName); } var parent = node.parent.parent; @@ -70017,7 +70646,7 @@ var ts; } } if (ts.isBindingPattern(node.name)) { - if (node.name.kind === 202 && languageVersion < 2 && compilerOptions.downlevelIteration) { + if (node.name.kind === 204 && languageVersion < 2 && compilerOptions.downlevelIteration) { checkExternalEmitHelpers(node, 512); } ts.forEach(node.name.elements, checkSourceElement); @@ -70027,7 +70656,7 @@ var ts; return; } if (ts.isBindingPattern(node.name)) { - var needCheckInitializer = ts.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 243; + var needCheckInitializer = ts.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 246; var needCheckWidenedType = !ts.some(node.name.elements, ts.not(ts.isOmittedExpression)); if (needCheckInitializer || needCheckWidenedType) { var widenedType = getWidenedTypeForVariableLikeDeclaration(node); @@ -70052,7 +70681,7 @@ var ts; return; } var symbol = getSymbolOfNode(node); - if (symbol.flags & 2097152 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 203 ? node.parent.parent : node)) { + if (symbol.flags & 2097152 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 205 ? node.parent.parent : node)) { checkAliasSymbol(node); return; } @@ -70064,7 +70693,7 @@ var ts; ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || ts.isPrototypeAccess(node.name)) && !!((_a = symbol.exports) === null || _a === void 0 ? void 0 : _a.size); - if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 243) { + if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 246) { checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(initializer), type, node, initializer, undefined); } } @@ -70088,9 +70717,9 @@ var ts; error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name)); } } - if (node.kind !== 167 && node.kind !== 166) { + if (node.kind !== 169 && node.kind !== 168) { checkExportsOnMergedDeclarations(node); - if (node.kind === 254 || node.kind === 203) { + if (node.kind === 257 || node.kind === 205) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionsForDeclarationName(node, node.name); @@ -70098,7 +70727,7 @@ var ts; } function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) { var nextDeclarationName = ts.getNameOfDeclaration(nextDeclaration); - var message = nextDeclaration.kind === 167 || nextDeclaration.kind === 166 + var message = nextDeclaration.kind === 169 || nextDeclaration.kind === 168 ? ts.Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2 : ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2; var declName = ts.declarationNameToString(nextDeclarationName); @@ -70108,8 +70737,8 @@ var ts; } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 164 && right.kind === 254) || - (left.kind === 254 && right.kind === 164)) { + if ((left.kind === 166 && right.kind === 257) || + (left.kind === 257 && right.kind === 166)) { return true; } if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) { @@ -70117,8 +70746,8 @@ var ts; } var interestingFlags = 8 | 16 | + 512 | 256 | - 128 | 64 | 32; return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags); @@ -70144,15 +70773,15 @@ var ts; } function checkIfStatement(node) { checkGrammarStatementInAmbientContext(node); - checkTruthinessExpression(node.expression); - checkTestingKnownTruthyCallableOrAwaitableType(node.expression, node.thenStatement); + var type = checkTruthinessExpression(node.expression); + checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 236) { + if (node.thenStatement.kind === 239) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); } - function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, body) { + function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, condType, body) { if (!strictNullChecks) return; helper(condExpr, body); @@ -70167,7 +70796,7 @@ var ts; : condExpr; if (ts.isModuleExportsAccessExpression(location)) return; - var type = checkTruthinessExpression(location); + var type = location === condExpr ? condType : checkTruthinessExpression(location); var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression); if (!(getTypeFacts(type) & 4194304) || isPropertyExpressionCast) return; @@ -70270,12 +70899,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 255) { + if (node.initializer && node.initializer.kind === 258) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 255) { + if (node.initializer.kind === 258) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -70308,13 +70937,13 @@ var ts; else if (compilerOptions.downlevelIteration && languageVersion < 2) { checkExternalEmitHelpers(node, 256); } - if (node.initializer.kind === 255) { + if (node.initializer.kind === 258) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node); - if (varExpr.kind === 204 || varExpr.kind === 205) { + if (varExpr.kind === 206 || varExpr.kind === 207) { checkDestructuringAssignment(varExpr, iteratedType || errorType); } else { @@ -70333,7 +70962,7 @@ var ts; function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); var rightType = getNonNullableTypeIfNeeded(checkExpression(node.expression)); - if (node.initializer.kind === 255) { + if (node.initializer.kind === 258) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -70343,7 +70972,7 @@ var ts; else { var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 204 || varExpr.kind === 205) { + if (varExpr.kind === 206 || varExpr.kind === 207) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { @@ -70922,12 +71551,12 @@ var ts; var functionFlags = ts.getFunctionFlags(container); if (strictNullChecks || node.expression || returnType.flags & 131072) { var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; - if (container.kind === 173) { + if (container.kind === 175) { if (node.expression) { error(node, ts.Diagnostics.Setters_cannot_return_a_value); } } - else if (container.kind === 171) { + else if (container.kind === 173) { if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) { error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -70942,7 +71571,7 @@ var ts; } } } - else if (container.kind !== 171 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { + else if (container.kind !== 173 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); } } @@ -70967,7 +71596,7 @@ var ts; var expressionType = checkExpression(node.expression); var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 290 && !hasDuplicateDefaultClause) { + if (clause.kind === 293 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -70976,7 +71605,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (clause.kind === 289) { + if (clause.kind === 292) { addLazyDiagnostic(createLazyCaseClauseDiagnostics(clause)); } ts.forEach(clause.statements, checkSourceElement); @@ -71008,7 +71637,7 @@ var ts; if (ts.isFunctionLike(current)) { return "quit"; } - if (current.kind === 250 && current.label.escapedText === node.label.escapedText) { + if (current.kind === 253 && current.label.escapedText === node.label.escapedText) { grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label)); return true; } @@ -71097,11 +71726,11 @@ var ts; return; } var indexInfos = getApplicableIndexInfos(type, propNameType); - var interfaceDeclaration = ts.getObjectFlags(type) & 2 ? ts.getDeclarationOfKind(type.symbol, 258) : undefined; - var propDeclaration = declaration && declaration.kind === 221 || - name && name.kind === 162 ? declaration : undefined; + var interfaceDeclaration = ts.getObjectFlags(type) & 2 ? ts.getDeclarationOfKind(type.symbol, 261) : undefined; + var propDeclaration = declaration && declaration.kind === 223 || + name && name.kind === 164 ? declaration : undefined; var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined; - var _loop_30 = function (info) { + var _loop_31 = function (info) { var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined; var errorNode = localPropDeclaration || localIndexDeclaration || (interfaceDeclaration && !ts.some(getBaseTypes(type), function (base) { return !!getPropertyOfObjectType(base, prop.escapedName) && !!getIndexTypeOfType(base, info.keyType); }) ? interfaceDeclaration : undefined); @@ -71115,15 +71744,15 @@ var ts; }; for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) { var info = indexInfos_9[_i]; - _loop_30(info); + _loop_31(info); } } function checkIndexConstraintForIndexSignature(type, checkInfo) { var declaration = checkInfo.declaration; var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType); - var interfaceDeclaration = ts.getObjectFlags(type) & 2 ? ts.getDeclarationOfKind(type.symbol, 258) : undefined; + var interfaceDeclaration = ts.getObjectFlags(type) & 2 ? ts.getDeclarationOfKind(type.symbol, 261) : undefined; var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined; - var _loop_31 = function (info) { + var _loop_32 = function (info) { if (info === checkInfo) return "continue"; var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined; @@ -71135,7 +71764,7 @@ var ts; }; for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) { var info = indexInfos_10[_i]; - _loop_31(info); + _loop_32(info); } } function checkTypeNameIsReserved(name, message) { @@ -71229,7 +71858,7 @@ var ts; function checkTypeParametersNotReferenced(root, typeParameters, index) { visit(root); function visit(node) { - if (node.kind === 178) { + if (node.kind === 180) { var type = getTypeFromTypeReference(node); if (type.flags & 262144) { for (var i = index; i < typeParameters.length; i++) { @@ -71308,7 +71937,7 @@ var ts; if (firstDecorator && ts.some(node.members, function (p) { return ts.hasStaticModifier(p) && ts.isPrivateIdentifierClassElementDeclaration(p); })) { grammarErrorOnNode(firstDecorator, ts.Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator); } - if (!node.name && !ts.hasSyntacticModifier(node, 512)) { + if (!node.name && !ts.hasSyntacticModifier(node, 1024)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); } checkClassLikeDeclaration(node); @@ -71372,7 +72001,7 @@ var ts; } else { var constructSignatures = getSignaturesOfType(baseConstructorType, 1); - if (constructSignatures.some(function (signature) { return signature.flags & 4; }) && !ts.hasSyntacticModifier(node, 128)) { + if (constructSignatures.some(function (signature) { return signature.flags & 4; }) && !ts.hasSyntacticModifier(node, 256)) { error(node.name || node, ts.Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract); } } @@ -71430,7 +72059,7 @@ var ts; var baseTypes = baseTypeNode && getBaseTypes(type); var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined; var baseStaticType = getBaseConstructorTypeOfClass(type); - var _loop_32 = function (member) { + var _loop_33 = function (member) { if (ts.hasAmbientModifier(member)) { return "continue"; } @@ -71445,7 +72074,7 @@ var ts; }; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - _loop_32(member); + _loop_33(member); } } function checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, member, memberIsParameterProperty, reportErrors) { @@ -71520,7 +72149,7 @@ var ts; } function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) { var issuedMemberError = false; - var _loop_33 = function (member) { + var _loop_34 = function (member) { if (ts.isStatic(member)) { return "continue"; } @@ -71538,7 +72167,7 @@ var ts; }; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - _loop_33(member); + _loop_34(member); } if (!issuedMemberError) { checkTypeAssignableTo(typeWithThis, baseWithThis, node.name || node, broadDiag); @@ -71579,13 +72208,13 @@ var ts; } function getClassOrInterfaceDeclarationsOfSymbol(symbol) { return ts.filter(symbol.declarations, function (d) { - return d.kind === 257 || d.kind === 258; + return d.kind === 260 || d.kind === 261; }); } function checkKindsOfPropertyMemberOverrides(type, baseType) { var _a, _b, _c, _d; var baseProperties = getPropertiesOfType(baseType); - var _loop_34 = function (baseProperty) { + var _loop_35 = function (baseProperty) { var base = getTargetSymbol(baseProperty); if (base.flags & 4194304) { return "continue"; @@ -71599,7 +72228,7 @@ var ts; ts.Debug.assert(!!derived, "derived should point to something, even if it is the base class' declaration."); if (derived === base) { var derivedClassDecl = ts.getClassLikeDeclarationOfSymbol(type.symbol); - if (baseDeclarationFlags & 128 && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 128))) { + if (baseDeclarationFlags & 256 && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 256))) { for (var _e = 0, _f = getBaseTypes(type); _e < _f.length; _e++) { var otherBaseType = _f[_e]; if (otherBaseType === baseType) @@ -71610,7 +72239,7 @@ var ts; return "continue-basePropertyCheck"; } } - if (derivedClassDecl.kind === 226) { + if (derivedClassDecl.kind === 228) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -71643,11 +72272,11 @@ var ts; error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_1, symbolToString(base), typeToString(baseType), typeToString(type)); } else if (useDefineForClassFields) { - var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 167 && !d.initializer; }); + var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 169 && !d.initializer; }); if (uninitialized && !(derived.flags & 33554432) - && !(baseDeclarationFlags & 128) - && !(derivedDeclarationFlags & 128) + && !(baseDeclarationFlags & 256) + && !(derivedDeclarationFlags & 256) && !((_d = derived.declarations) === null || _d === void 0 ? void 0 : _d.some(function (d) { return !!(d.flags & 16777216); }))) { var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol)); var propName = uninitialized.name; @@ -71683,14 +72312,14 @@ var ts; }; basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) { var baseProperty = baseProperties_1[_i]; - var state_10 = _loop_34(baseProperty); - switch (state_10) { + var state_11 = _loop_35(baseProperty); + switch (state_11) { case "continue-basePropertyCheck": continue basePropertyCheck; } } } function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) { - return baseDeclarationFlags & 128 && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer) + return baseDeclarationFlags & 256 && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer) || ts.isInterfaceDeclaration(declaration.parent); } function getNonInheritedProperties(type, baseTypes, properties) { @@ -71772,7 +72401,7 @@ var ts; } } function isPropertyWithoutInitializer(node) { - return node.kind === 167 && + return node.kind === 169 && !ts.hasAbstractModifier(node) && !node.exclamationToken && !node.initializer; @@ -71812,7 +72441,7 @@ var ts; checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(symbol); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 258); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 261); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -71843,7 +72472,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0); checkExportsOnMergedDeclarations(node); checkTypeParameters(node.typeParameters); - if (node.type.kind === 138) { + if (node.type.kind === 139) { if (!intrinsicTypeKinds.has(node.name.escapedText) || ts.length(node.typeParameters) !== 1) { error(node.type, ts.Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types); } @@ -71922,7 +72551,7 @@ var ts; return value; function evaluate(expr) { switch (expr.kind) { - case 219: + case 221: var value_2 = evaluate(expr.operand); if (typeof value_2 === "number") { switch (expr.operator) { @@ -71932,7 +72561,7 @@ var ts; } } break; - case 221: + case 223: var left = evaluate(expr.left); var right = evaluate(expr.right); if (typeof left === "number" && typeof right === "number") { @@ -71961,7 +72590,7 @@ var ts; case 8: checkGrammarNumericLiteral(expr); return +expr.text; - case 212: + case 214: return evaluate(expr.expression); case 79: var identifier = expr; @@ -71969,13 +72598,13 @@ var ts; return +(identifier.escapedText); } return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText); - case 207: - case 206: + case 209: + case 208: if (isConstantMemberAccess(expr)) { var type = getTypeOfExpression(expr.expression); if (type.symbol && type.symbol.flags & 384) { var name = void 0; - if (expr.kind === 206) { + if (expr.kind === 208) { name = expr.name.escapedText; } else { @@ -72012,8 +72641,8 @@ var ts; return false; } return node.kind === 79 || - node.kind === 206 && isConstantMemberAccess(node.expression) || - node.kind === 207 && isConstantMemberAccess(node.expression) && + node.kind === 208 && isConstantMemberAccess(node.expression) || + node.kind === 209 && isConstantMemberAccess(node.expression) && ts.isStringLiteralLike(node.argumentExpression); } function checkEnumDeclaration(node) { @@ -72038,7 +72667,7 @@ var ts; } var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 260) { + if (declaration.kind !== 263) { return false; } var enumDeclaration = declaration; @@ -72067,8 +72696,8 @@ var ts; if (declarations) { for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { var declaration = declarations_9[_i]; - if ((declaration.kind === 257 || - (declaration.kind === 256 && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 260 || + (declaration.kind === 259 && ts.nodeIsPresent(declaration.body))) && !(declaration.flags & 16777216)) { return declaration; } @@ -72134,7 +72763,7 @@ var ts; error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); } } - var mergedClass = ts.getDeclarationOfKind(symbol, 257); + var mergedClass = ts.getDeclarationOfKind(symbol, 260); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768; @@ -72172,22 +72801,22 @@ var ts; function checkModuleAugmentationElement(node, isGlobalAugmentation) { var _a; switch (node.kind) { - case 237: + case 240: for (var _i = 0, _b = node.declarationList.declarations; _i < _b.length; _i++) { var decl = _b[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 271: - case 272: + case 274: + case 275: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 265: - case 266: + case 268: + case 269: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 203: - case 254: + case 205: + case 257: var name = node.name; if (ts.isBindingPattern(name)) { for (var _c = 0, _d = name.elements; _c < _d.length; _c++) { @@ -72196,12 +72825,12 @@ var ts; } break; } - case 257: case 260: - case 256: - case 258: - case 261: + case 263: case 259: + case 261: + case 264: + case 262: if (isGlobalAugmentation) { return; } @@ -72219,12 +72848,12 @@ var ts; switch (node.kind) { case 79: return node; - case 161: + case 163: do { node = node.left; } while (node.kind !== 79); return node; - case 206: + case 208: do { if (ts.isModuleExportsAccessExpression(node.expression) && !ts.isPrivateIdentifier(node.name)) { return node.name; @@ -72243,9 +72872,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 262 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 305 && !inAmbientExternalModule) { - error(moduleName, node.kind === 272 ? + var inAmbientExternalModule = node.parent.kind === 265 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 308 && !inAmbientExternalModule) { + error(moduleName, node.kind === 275 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -72279,8 +72908,8 @@ var ts; var errorNode = ts.isImportOrExportSpecifier(node) ? node.propertyName || node.name : ts.isNamedDeclaration(node) ? node.name : node; - ts.Debug.assert(node.kind !== 274); - if (node.kind === 275) { + ts.Debug.assert(node.kind !== 277); + if (node.kind === 278) { var diag = error(errorNode, ts.Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files); var alreadyExportedSymbol = (_b = (_a = ts.getSourceFileOfNode(node).symbol) === null || _a === void 0 ? void 0 : _a.exports) === null || _b === void 0 ? void 0 : _b.get((node.propertyName || node.name).escapedText); if (alreadyExportedSymbol === target) { @@ -72291,7 +72920,7 @@ var ts; } } else { - ts.Debug.assert(node.kind !== 254); + ts.Debug.assert(node.kind !== 257); var importDeclaration = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)); var moduleSpecifier = (_e = (importDeclaration && ((_d = ts.tryGetModuleSpecifierFromDeclaration(importDeclaration)) === null || _d === void 0 ? void 0 : _d.text))) !== null && _e !== void 0 ? _e : "..."; var importedIdentifier = ts.unescapeLeadingUnderscores(ts.isIdentifier(errorNode) ? errorNode.escapedText : symbol.escapedName); @@ -72303,7 +72932,7 @@ var ts; (symbol.flags & 788968 ? 788968 : 0) | (symbol.flags & 1920 ? 1920 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 275 ? + var message = node.kind === 278 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -72315,23 +72944,23 @@ var ts; var isType = !(target.flags & 111551); if (isType || typeOnlyAlias) { switch (node.kind) { - case 267: case 270: - case 265: { + case 273: + case 268: { if (compilerOptions.preserveValueImports) { ts.Debug.assertIsDefined(node.name, "An ImportClause with a symbol should have a name"); var message = isType ? ts.Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled : ts.Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled; - var name = ts.idText(node.kind === 270 ? node.propertyName || node.name : node.name); + var name = ts.idText(node.kind === 273 ? node.propertyName || node.name : node.name); addTypeOnlyDeclarationRelatedInfo(error(node, message, name), isType ? undefined : typeOnlyAlias, name); } - if (isType && node.kind === 265 && ts.hasEffectiveModifier(node, 1)) { + if (isType && node.kind === 268 && ts.hasEffectiveModifier(node, 1)) { error(node, ts.Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided); } break; } - case 275: { + case 278: { if (ts.getSourceFileOfNode(typeOnlyAlias) !== ts.getSourceFileOfNode(node)) { var message = isType ? ts.Diagnostics.Re_exporting_a_type_when_the_isolatedModules_flag_is_provided_requires_using_export_type @@ -72387,7 +73016,7 @@ var ts; function checkImportBinding(node) { checkCollisionsForDeclarationName(node, node.name); checkAliasSymbol(node); - if (node.kind === 270 && + if (node.kind === 273 && ts.idText(node.propertyName || node.name) === "default" && ts.getESModuleInterop(compilerOptions) && moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) { @@ -72436,7 +73065,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 268) { + if (importClause.namedBindings.kind === 271) { checkImportBinding(importClause.namedBindings); if (moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) && ts.getESModuleInterop(compilerOptions)) { checkExternalEmitHelpers(node, 65536); @@ -72463,7 +73092,7 @@ var ts; if (ts.hasSyntacticModifier(node, 1)) { markExportAsReferenced(node); } - if (node.moduleReference.kind !== 277) { + if (node.moduleReference.kind !== 280) { var target = resolveAlias(getSymbolOfNode(node)); if (target !== unknownSymbol) { if (target.flags & 111551) { @@ -72501,10 +73130,10 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause && !ts.isNamespaceExport(node.exportClause)) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 262 && ts.isAmbientModule(node.parent.parent); - var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 262 && + var inAmbientExternalModule = node.parent.kind === 265 && ts.isAmbientModule(node.parent.parent); + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 265 && !node.moduleSpecifier && node.flags & 16777216; - if (node.parent.kind !== 305 && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + if (node.parent.kind !== 308 && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -72533,7 +73162,7 @@ var ts; function checkGrammarExportDeclaration(node) { var _a; if (node.isTypeOnly) { - if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 273) { + if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 276) { return checkGrammarNamedImportsOrExports(node.exportClause); } else { @@ -72543,7 +73172,7 @@ var ts; return false; } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 305 || node.parent.kind === 262 || node.parent.kind === 261; + var isInAppropriateContext = node.parent.kind === 308 || node.parent.kind === 265 || node.parent.kind === 264; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -72620,8 +73249,8 @@ var ts; if (checkGrammarModuleElementContext(node, illegalContextMessage)) { return; } - var container = node.parent.kind === 305 ? node.parent : node.parent.parent; - if (container.kind === 261 && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 308 ? node.parent : node.parent.parent; + if (container.kind === 264 && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); } @@ -72741,180 +73370,180 @@ var ts; var kind = node.kind; if (cancellationToken) { switch (kind) { + case 264: + case 260: case 261: - case 257: - case 258: - case 256: + case 259: cancellationToken.throwIfCancellationRequested(); } } - if (kind >= 237 && kind <= 253 && node.flowNode && !isReachableFlowNode(node.flowNode)) { + if (kind >= 240 && kind <= 256 && node.flowNode && !isReachableFlowNode(node.flowNode)) { errorOrSuggestion(compilerOptions.allowUnreachableCode === false, node, ts.Diagnostics.Unreachable_code_detected); } switch (kind) { - case 163: + case 165: return checkTypeParameter(node); - case 164: - return checkParameter(node); - case 167: - return checkPropertyDeclaration(node); case 166: + return checkParameter(node); + case 169: + return checkPropertyDeclaration(node); + case 168: return checkPropertySignature(node); - case 180: - case 179: + case 182: + case 181: + case 176: + case 177: + case 178: + return checkSignatureDeclaration(node); + case 171: + case 170: + return checkMethodDeclaration(node); + case 172: + return checkClassStaticBlockDeclaration(node); + case 173: + return checkConstructorDeclaration(node); case 174: case 175: - case 176: - return checkSignatureDeclaration(node); - case 169: - case 168: - return checkMethodDeclaration(node); - case 170: - return checkClassStaticBlockDeclaration(node); - case 171: - return checkConstructorDeclaration(node); - case 172: - case 173: return checkAccessorDeclaration(node); - case 178: + case 180: return checkTypeReferenceNode(node); - case 177: + case 179: return checkTypePredicate(node); - case 181: - return checkTypeQuery(node); - case 182: - return checkTypeLiteral(node); case 183: - return checkArrayType(node); + return checkTypeQuery(node); case 184: + return checkTypeLiteral(node); + case 185: + return checkArrayType(node); + case 186: return checkTupleType(node); + case 189: + case 190: + return checkUnionOrIntersectionType(node); + case 193: case 187: case 188: - return checkUnionOrIntersectionType(node); - case 191: - case 185: - case 186: return checkSourceElement(node.type); - case 192: + case 194: return checkThisType(node); - case 193: + case 195: return checkTypeOperator(node); - case 189: + case 191: return checkConditionalType(node); - case 190: + case 192: return checkInferType(node); - case 198: - return checkTemplateLiteralType(node); case 200: + return checkTemplateLiteralType(node); + case 202: return checkImportType(node); - case 197: + case 199: return checkNamedTupleMember(node); - case 328: + case 331: return checkJSDocAugmentsTag(node); - case 329: + case 332: return checkJSDocImplementsTag(node); - case 345: - case 338: - case 339: + case 348: + case 341: + case 342: return checkJSDocTypeAliasTag(node); - case 344: - return checkJSDocTemplateTag(node); - case 343: - return checkJSDocTypeTag(node); - case 324: - case 325: - case 326: - return checkJSDocLinkLikeTag(node); - case 340: - return checkJSDocParameterTag(node); case 347: + return checkJSDocTemplateTag(node); + case 346: + return checkJSDocTypeTag(node); + case 327: + case 328: + case 329: + return checkJSDocLinkLikeTag(node); + case 343: + return checkJSDocParameterTag(node); + case 350: return checkJSDocPropertyTag(node); - case 317: + case 320: checkJSDocFunctionType(node); + case 318: + case 317: case 315: - case 314: - case 312: - case 313: - case 322: + case 316: + case 325: checkJSDocTypeIsInJsFile(node); ts.forEachChild(node, checkSourceElement); return; - case 318: + case 321: checkJSDocVariadicType(node); return; - case 309: + case 312: return checkSourceElement(node.type); - case 333: - case 335: - case 334: + case 336: + case 338: + case 337: return checkJSDocAccessibilityModifiers(node); - case 194: + case 196: return checkIndexedAccessType(node); - case 195: + case 197: return checkMappedType(node); - case 256: - return checkFunctionDeclaration(node); - case 235: - case 262: - return checkBlock(node); - case 237: - return checkVariableStatement(node); - case 238: - return checkExpressionStatement(node); - case 239: - return checkIfStatement(node); - case 240: - return checkDoStatement(node); - case 241: - return checkWhileStatement(node); - case 242: - return checkForStatement(node); - case 243: - return checkForInStatement(node); - case 244: - return checkForOfStatement(node); - case 245: - case 246: - return checkBreakOrContinueStatement(node); - case 247: - return checkReturnStatement(node); - case 248: - return checkWithStatement(node); - case 249: - return checkSwitchStatement(node); - case 250: - return checkLabeledStatement(node); - case 251: - return checkThrowStatement(node); - case 252: - return checkTryStatement(node); - case 254: - return checkVariableDeclaration(node); - case 203: - return checkBindingElement(node); - case 257: - return checkClassDeclaration(node); - case 258: - return checkInterfaceDeclaration(node); case 259: - return checkTypeAliasDeclaration(node); - case 260: - return checkEnumDeclaration(node); - case 261: - return checkModuleDeclaration(node); - case 266: - return checkImportDeclaration(node); + return checkFunctionDeclaration(node); + case 238: case 265: - return checkImportEqualsDeclaration(node); - case 272: - return checkExportDeclaration(node); - case 271: - return checkExportAssignment(node); - case 236: + return checkBlock(node); + case 240: + return checkVariableStatement(node); + case 241: + return checkExpressionStatement(node); + case 242: + return checkIfStatement(node); + case 243: + return checkDoStatement(node); + case 244: + return checkWhileStatement(node); + case 245: + return checkForStatement(node); + case 246: + return checkForInStatement(node); + case 247: + return checkForOfStatement(node); + case 248: + case 249: + return checkBreakOrContinueStatement(node); + case 250: + return checkReturnStatement(node); + case 251: + return checkWithStatement(node); + case 252: + return checkSwitchStatement(node); case 253: + return checkLabeledStatement(node); + case 254: + return checkThrowStatement(node); + case 255: + return checkTryStatement(node); + case 257: + return checkVariableDeclaration(node); + case 205: + return checkBindingElement(node); + case 260: + return checkClassDeclaration(node); + case 261: + return checkInterfaceDeclaration(node); + case 262: + return checkTypeAliasDeclaration(node); + case 263: + return checkEnumDeclaration(node); + case 264: + return checkModuleDeclaration(node); + case 269: + return checkImportDeclaration(node); + case 268: + return checkImportEqualsDeclaration(node); + case 275: + return checkExportDeclaration(node); + case 274: + return checkExportAssignment(node); + case 239: + case 256: checkGrammarStatementInAmbientContext(node); return; - case 276: + case 279: return checkMissingDeclaration(node); } } @@ -73002,33 +73631,33 @@ var ts; currentNode = node; instantiationCount = 0; switch (node.kind) { - case 208: - case 209: case 210: - case 165: - case 280: + case 211: + case 212: + case 167: + case 283: resolveUntypedCall(node); break; - case 213: - case 214: - case 169: - case 168: + case 215: + case 216: + case 171: + case 170: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 172: - case 173: + case 174: + case 175: checkAccessorDeclaration(node); break; - case 226: + case 228: checkClassExpressionDeferred(node); break; - case 163: + case 165: checkTypeParameterDeferred(node); break; - case 279: + case 282: checkJsxSelfClosingElementDeferred(node); break; - case 278: + case 281: checkJsxElementDeferred(node); break; } @@ -73178,27 +73807,27 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 305: + case 308: if (!ts.isExternalModule(location)) break; - case 261: + case 264: copyLocallyVisibleExportSymbols(getSymbolOfNode(location).exports, meaning & 2623475); break; - case 260: + case 263: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 226: + case 228: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } - case 257: - case 258: + case 260: + case 261: if (!isStaticSymbol) { copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 788968); } break; - case 213: + case 215: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -73231,7 +73860,7 @@ var ts; function copyLocallyVisibleExportSymbols(source, meaning) { if (meaning) { source.forEach(function (symbol) { - if (!ts.getDeclarationOfKind(symbol, 275) && !ts.getDeclarationOfKind(symbol, 274)) { + if (!ts.getDeclarationOfKind(symbol, 278) && !ts.getDeclarationOfKind(symbol, 277)) { copySymbol(symbol, meaning); } }); @@ -73245,35 +73874,35 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 163: - case 257: - case 258: - case 259: + case 165: case 260: - case 345: - case 338: - case 339: + case 261: + case 262: + case 263: + case 348: + case 341: + case 342: return true; - case 267: - return node.isTypeOnly; case 270: - case 275: + return node.isTypeOnly; + case 273: + case 278: return node.parent.parent.isTypeOnly; default: return false; } } function isTypeReferenceIdentifier(node) { - while (node.parent.kind === 161) { + while (node.parent.kind === 163) { node = node.parent; } - return node.parent.kind === 178; + return node.parent.kind === 180; } function isHeritageClauseElementIdentifier(node) { - while (node.parent.kind === 206) { + while (node.parent.kind === 208) { node = node.parent; } - return node.parent.kind === 228; + return node.parent.kind === 230; } function forEachEnclosingClass(node, callback) { var result; @@ -73301,13 +73930,13 @@ var ts; return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 161) { + while (nodeOnRightSide.parent.kind === 163) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 265) { + if (nodeOnRightSide.parent.kind === 268) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } - if (nodeOnRightSide.parent.kind === 271) { + if (nodeOnRightSide.parent.kind === 274) { return nodeOnRightSide.parent.expression === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } return undefined; @@ -73333,7 +73962,7 @@ var ts; node = parent; parent = parent.parent; } - if (parent && parent.kind === 200 && parent.qualifier === node) { + if (parent && parent.kind === 202 && parent.qualifier === node) { return parent; } return undefined; @@ -73343,7 +73972,7 @@ var ts; return getSymbolOfNode(name.parent); } if (ts.isInJSFile(name) && - name.parent.kind === 206 && + name.parent.kind === 208 && name.parent === name.parent.parent.left) { if (!ts.isPrivateIdentifier(name) && !ts.isJSDocMemberName(name)) { var specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(name); @@ -73352,14 +73981,14 @@ var ts; } } } - if (name.parent.kind === 271 && ts.isEntityNameExpression(name)) { + if (name.parent.kind === 274 && ts.isEntityNameExpression(name)) { var success = resolveEntityName(name, 111551 | 788968 | 1920 | 2097152, true); if (success && success !== unknownSymbol) { return success; } } else if (ts.isEntityName(name) && isInRightSideOfImportOrExportAssignment(name)) { - var importEqualsDeclaration = ts.getAncestor(name, 265); + var importEqualsDeclaration = ts.getAncestor(name, 268); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(name, true); } @@ -73376,7 +74005,7 @@ var ts; } if (isHeritageClauseElementIdentifier(name)) { var meaning = 0; - if (name.parent.kind === 228) { + if (name.parent.kind === 230) { meaning = 788968; if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(name.parent)) { meaning |= 111551; @@ -73391,10 +74020,10 @@ var ts; return entityNameSymbol; } } - if (name.parent.kind === 340) { + if (name.parent.kind === 343) { return ts.getParameterSymbolFromJSDoc(name.parent); } - if (name.parent.kind === 163 && name.parent.parent.kind === 344) { + if (name.parent.kind === 165 && name.parent.parent.kind === 347) { ts.Debug.assert(!ts.isInJSFile(name)); var typeParameter = ts.getTypeParameterFromJsDoc(name.parent); return typeParameter && typeParameter.symbol; @@ -73417,18 +74046,53 @@ var ts; return resolveJSDocMemberName(name, false, getSymbolOfNode(container)); } } + if (result && isJSDoc_1) { + var container = ts.getJSDocHost(name); + if (container && ts.isEnumMember(container) && container === result.valueDeclaration) { + return resolveEntityName(name, meaning, true, true, ts.getSourceFileOfNode(container)) || result; + } + } return result; } else if (ts.isPrivateIdentifier(name)) { return getSymbolForPrivateIdentifierExpression(name); } - else if (name.kind === 206 || name.kind === 161) { + else if (name.kind === 208 || name.kind === 163) { var links = getNodeLinks(name); if (links.resolvedSymbol) { return links.resolvedSymbol; } - if (name.kind === 206) { + if (name.kind === 208) { checkPropertyAccessExpression(name, 0); + if (!links.resolvedSymbol) { + var expressionType = checkExpressionCached(name.expression); + var infos = getApplicableIndexInfos(expressionType, getLiteralTypeFromPropertyName(name.name)); + if (infos.length && expressionType.members) { + var resolved = resolveStructuredTypeMembers(expressionType); + var symbol = resolved.members.get("__index"); + if (infos === getIndexInfosOfType(expressionType)) { + links.resolvedSymbol = symbol; + } + else if (symbol) { + var symbolLinks_1 = getSymbolLinks(symbol); + var declarationList = ts.mapDefined(infos, function (i) { return i.declaration; }); + var nodeListId = ts.map(declarationList, getNodeId).join(","); + if (!symbolLinks_1.filteredIndexSymbolCache) { + symbolLinks_1.filteredIndexSymbolCache = new ts.Map(); + } + if (symbolLinks_1.filteredIndexSymbolCache.has(nodeListId)) { + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + else { + var copy = createSymbol(131072, "__index"); + copy.declarations = ts.mapDefined(infos, function (i) { return i.declaration; }); + copy.parent = expressionType.aliasSymbol ? expressionType.aliasSymbol : expressionType.symbol ? expressionType.symbol : getSymbolAtLocation(copy.declarations[0].parent); + symbolLinks_1.filteredIndexSymbolCache.set(nodeListId, copy); + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + } + } + } } else { checkQualifiedName(name, 0); @@ -73443,11 +74107,11 @@ var ts; } } else if (isTypeReferenceIdentifier(name)) { - var meaning = name.parent.kind === 178 ? 788968 : 1920; + var meaning = name.parent.kind === 180 ? 788968 : 1920; var symbol = resolveEntityName(name, meaning, false, true); return symbol && symbol !== unknownSymbol ? symbol : getUnresolvedSymbolForEntityName(name); } - if (name.parent.kind === 177) { + if (name.parent.kind === 179) { return resolveEntityName(name, 1); } return undefined; @@ -73472,7 +74136,7 @@ var ts; } } function getSymbolAtLocation(node, ignoreErrors) { - if (node.kind === 305) { + if (node.kind === 308) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } var parent = node.parent; @@ -73493,8 +74157,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } - else if (parent.kind === 203 && - grandParent.kind === 201 && + else if (parent.kind === 205 && + grandParent.kind === 203 && node === parent.propertyName) { var typeOfPattern = getTypeOfNode(grandParent); var propertyDeclaration = getPropertyOfType(typeOfPattern, node.escapedText); @@ -73515,8 +74179,8 @@ var ts; switch (node.kind) { case 79: case 80: - case 206: - case 161: + case 208: + case 163: if (!ts.isThisInTypeQuery(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } @@ -73531,20 +74195,20 @@ var ts; if (ts.isInExpressionContext(node)) { return checkExpression(node).symbol; } - case 192: + case 194: return getTypeFromThisTypeNode(node).symbol; case 106: return checkExpression(node).symbol; - case 134: + case 135: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 171) { + if (constructorDeclaration && constructorDeclaration.kind === 173) { return constructorDeclaration.parent.symbol; } return undefined; case 10: case 14: if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 266 || node.parent.kind === 272) && node.parent.moduleSpecifier === node) || + ((node.parent.kind === 269 || node.parent.kind === 275) && node.parent.moduleSpecifier === node) || ((ts.isInJSFile(node) && ts.isRequireCall(node.parent, false)) || ts.isImportCall(node.parent)) || (ts.isLiteralTypeNode(node.parent) && ts.isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent)) { return resolveExternalModuleName(node, node, ignoreErrors); @@ -73564,14 +74228,14 @@ var ts; case 38: case 84: return getSymbolOfNode(node.parent); - case 200: + case 202: return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal, ignoreErrors) : undefined; case 93: return ts.isExportAssignment(node.parent) ? ts.Debug.checkDefined(node.parent.symbol) : undefined; case 100: case 103: return ts.isMetaProperty(node.parent) ? checkMetaPropertyKeyword(node.parent).symbol : undefined; - case 231: + case 233: return checkExpression(node).symbol; default: return undefined; @@ -73587,7 +74251,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 297) { + if (location && location.kind === 300) { return resolveEntityName(location.name, 111551 | 2097152); } return undefined; @@ -73657,16 +74321,16 @@ var ts; return errorType; } function getTypeOfAssignmentPattern(expr) { - ts.Debug.assert(expr.kind === 205 || expr.kind === 204); - if (expr.parent.kind === 244) { + ts.Debug.assert(expr.kind === 207 || expr.kind === 206); + if (expr.parent.kind === 247) { var iteratedType = checkRightHandSideOfForOf(expr.parent); return checkDestructuringAssignment(expr, iteratedType || errorType); } - if (expr.parent.kind === 221) { + if (expr.parent.kind === 223) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || errorType); } - if (expr.parent.kind === 296) { + if (expr.parent.kind === 299) { var node_3 = ts.cast(expr.parent.parent, ts.isObjectLiteralExpression); var typeOfParentObjectLiteral = getTypeOfAssignmentPattern(node_3) || errorType; var propertyIndex = ts.indexOfNode(node_3.properties, expr.parent); @@ -73701,7 +74365,7 @@ var ts; case 8: case 10: return getStringLiteralType(name.text); - case 162: + case 164: var nameType = checkComputedPropertyName(name); return isTypeAssignableToKind(nameType, 12288) ? nameType : stringType; default: @@ -73801,7 +74465,7 @@ var ts; } var parentSymbol_1 = getParentOfSymbol(symbol); if (parentSymbol_1) { - if (parentSymbol_1.flags & 512 && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 305) { + if (parentSymbol_1.flags & 512 && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 308) { var symbolFile = parentSymbol_1.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); var symbolIsUmdExport = symbolFile !== referenceFile; @@ -73818,7 +74482,7 @@ var ts; } var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier); if (node) { - var symbol = getReferencedValueSymbol(node); + var symbol = getReferencedValueOrAliasSymbol(node); if (isNonLocalAlias(symbol, 111551) && !getTypeOnlyAliasDeclaration(symbol)) { return getDeclarationOfAliasSymbol(symbol); } @@ -73828,7 +74492,7 @@ var ts; function isSymbolOfDestructuredElementOfCatchBinding(symbol) { return symbol.valueDeclaration && ts.isBindingElement(symbol.valueDeclaration) - && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 292; + && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 295; } function isSymbolOfDeclarationWithCollidingName(symbol) { if (symbol.flags & 418 && symbol.valueDeclaration && !ts.isSourceFile(symbol.valueDeclaration)) { @@ -73843,7 +74507,7 @@ var ts; else if (nodeLinks_1.flags & 262144) { var isDeclaredInLoop = nodeLinks_1.flags & 524288; var inLoopInitializer = ts.isIterationStatement(container, false); - var inLoopBodyBlock = container.kind === 235 && ts.isIterationStatement(container.parent, false); + var inLoopBodyBlock = container.kind === 238 && ts.isIterationStatement(container.parent, false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -73879,19 +74543,19 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 265: - return isAliasResolvedToValue(getSymbolOfNode(node)); - case 267: case 268: + return isAliasResolvedToValue(getSymbolOfNode(node)); case 270: - case 275: + case 271: + case 273: + case 278: var symbol = getSymbolOfNode(node); return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol); - case 272: + case 275: var exportClause = node.exportClause; return !!exportClause && (ts.isNamespaceExport(exportClause) || ts.some(exportClause.elements, isValueAliasDeclaration)); - case 271: + case 274: return node.expression && node.expression.kind === 79 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; @@ -73900,7 +74564,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(nodeIn) { var node = ts.getParseTreeNode(nodeIn, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 305 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 308 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); @@ -73995,15 +74659,15 @@ var ts; } function canHaveConstantValue(node) { switch (node.kind) { - case 299: - case 206: - case 207: + case 302: + case 208: + case 209: return true; } return false; } function getConstantValue(node) { - if (node.kind === 299) { + if (node.kind === 302) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -74091,7 +74755,7 @@ var ts; function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker, addUndefined) { var declaration = ts.getParseTreeNode(declarationIn, ts.isVariableLikeOrAccessor); if (!declaration) { - return ts.factory.createToken(130); + return ts.factory.createToken(131); } var symbol = getSymbolOfNode(declaration); var type = symbol && !(symbol.flags & (2048 | 131072)) @@ -74109,7 +74773,7 @@ var ts; function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) { var signatureDeclaration = ts.getParseTreeNode(signatureDeclarationIn, ts.isFunctionLike); if (!signatureDeclaration) { - return ts.factory.createToken(130); + return ts.factory.createToken(131); } var signature = getSignatureFromDeclaration(signatureDeclaration); return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, flags | 1024, tracker); @@ -74117,7 +74781,7 @@ var ts; function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) { var expr = ts.getParseTreeNode(exprIn, ts.isExpression); if (!expr) { - return ts.factory.createToken(130); + return ts.factory.createToken(131); } var type = getWidenedType(getRegularTypeOfExpression(expr)); return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024, tracker); @@ -74139,6 +74803,13 @@ var ts; } return resolveName(location, reference.escapedText, 111551 | 1048576 | 2097152, undefined, undefined, true); } + function getReferencedValueOrAliasSymbol(reference) { + var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; + if (resolvedSymbol && resolvedSymbol !== unknownSymbol) { + return resolvedSymbol; + } + return resolveName(reference, reference.escapedText, 111551 | 1048576 | 2097152, undefined, undefined, true, undefined, undefined); + } function getReferencedValueDeclaration(referenceIn) { if (!ts.isGeneratedIdentifier(referenceIn)) { var reference = ts.getParseTreeNode(referenceIn, ts.isIdentifier); @@ -74265,12 +74936,12 @@ var ts; getJsxFragmentFactoryEntity: getJsxFragmentFactoryEntity, getAllAccessorDeclarations: function (accessor) { accessor = ts.getParseTreeNode(accessor, ts.isGetOrSetAccessorDeclaration); - var otherKind = accessor.kind === 173 ? 172 : 173; + var otherKind = accessor.kind === 175 ? 174 : 175; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(accessor), otherKind); var firstAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? otherAccessor : accessor; var secondAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? accessor : otherAccessor; - var setAccessor = accessor.kind === 173 ? accessor : otherAccessor; - var getAccessor = accessor.kind === 172 ? accessor : otherAccessor; + var setAccessor = accessor.kind === 175 ? accessor : otherAccessor; + var getAccessor = accessor.kind === 174 ? accessor : otherAccessor; return { firstAccessor: firstAccessor, secondAccessor: secondAccessor, @@ -74286,7 +74957,7 @@ var ts; }, getDeclarationStatementsForSourceFile: function (node, flags, tracker, bundled) { var n = ts.getParseTreeNode(node); - ts.Debug.assert(n && n.kind === 305, "Non-sourcefile node passed into getDeclarationsForSourceFile"); + ts.Debug.assert(n && n.kind === 308, "Non-sourcefile node passed into getDeclarationsForSourceFile"); var sym = getSymbolOfNode(node); if (!sym) { return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker, bundled); @@ -74323,19 +74994,19 @@ var ts; return false; } function isInHeritageClause(node) { - return node.parent && node.parent.kind === 228 && node.parent.parent && node.parent.parent.kind === 291; + return node.parent && node.parent.kind === 230 && node.parent.parent && node.parent.parent.kind === 294; } function getTypeReferenceDirectivesForEntityName(node) { if (!fileToDirective) { return undefined; } var meaning; - if (node.parent.kind === 162) { + if (node.parent.kind === 164) { meaning = 111551 | 1048576; } else { meaning = 788968 | 1920; - if ((node.kind === 79 && isInTypeQuery(node)) || (node.kind === 206 && !isInHeritageClause(node))) { + if ((node.kind === 79 && isInTypeQuery(node)) || (node.kind === 208 && !isInHeritageClause(node))) { meaning = 111551 | 1048576; } } @@ -74376,7 +75047,7 @@ var ts; break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 305 && current.flags & 512) { + if (current.valueDeclaration && current.valueDeclaration.kind === 308 && current.flags & 512) { return false; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { @@ -74403,12 +75074,12 @@ var ts; } } function getExternalModuleFileFromDeclaration(declaration) { - var specifier = declaration.kind === 261 ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); + var specifier = declaration.kind === 264 ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, undefined); if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 305); + return ts.getDeclarationOfKind(moduleSymbol, 308); } function initializeTypeChecker() { for (var _i = 0, _a = host.getSourceFiles(); _i < _a.length; _i++) { @@ -74599,14 +75270,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node, node.parent, node.parent.parent)) { - if (node.kind === 169 && !ts.nodeIsPresent(node.body)) { + if (node.kind === 171 && !ts.nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } } - else if (node.kind === 172 || node.kind === 173) { + else if (node.kind === 174 || node.kind === 175) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (ts.hasDecorators(accessors.firstAccessor) && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -74625,26 +75296,26 @@ var ts; var modifier = _a[_i]; if (ts.isDecorator(modifier)) continue; - if (modifier.kind !== 145) { - if (node.kind === 166 || node.kind === 168) { + if (modifier.kind !== 146) { + if (node.kind === 168 || node.kind === 170) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 176 && (modifier.kind !== 124 || !ts.isClassLike(node.parent))) { + if (node.kind === 178 && (modifier.kind !== 124 || !ts.isClassLike(node.parent))) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } - if (modifier.kind !== 101 && modifier.kind !== 144) { - if (node.kind === 163) { + if (modifier.kind !== 101 && modifier.kind !== 145) { + if (node.kind === 165) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_parameter, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { case 85: - if (node.kind !== 260) { + if (node.kind !== 263) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(85)); } break; - case 159: + case 161: if (flags & 16384) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "override"); } @@ -74654,7 +75325,10 @@ var ts; else if (flags & 64) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "readonly"); } - else if (flags & 256) { + else if (flags & 128) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "accessor"); + } + else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "async"); } flags |= 16384; @@ -74673,16 +75347,19 @@ var ts; else if (flags & 32) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } + else if (flags & 128) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "accessor"); + } else if (flags & 64) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); } - else if (flags & 256) { + else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 262 || node.parent.kind === 305) { + else if (node.parent.kind === 265 || node.parent.kind === 308) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } - else if (flags & 128) { + else if (flags & 256) { if (modifier.kind === 121) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } @@ -74702,16 +75379,19 @@ var ts; else if (flags & 64) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly"); } - else if (flags & 256) { + else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 262 || node.parent.kind === 305) { + else if (flags & 128) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "accessor"); + } + else if (node.parent.kind === 265 || node.parent.kind === 308) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 164) { + else if (node.kind === 166) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } - else if (flags & 128) { + else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } else if (flags & 16384) { @@ -74720,11 +75400,26 @@ var ts; flags |= 32; lastStatic = modifier; break; - case 145: + case 127: + if (flags & 128) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "accessor"); + } + else if (flags & 64) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "readonly"); + } + else if (flags & 2) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "declare"); + } + else if (node.kind !== 169) { + return grammarErrorOnNode(modifier, ts.Diagnostics.accessor_modifier_can_only_appear_on_a_property_declaration); + } + flags |= 128; + break; + case 146: if (flags & 64) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 167 && node.kind !== 166 && node.kind !== 176 && node.kind !== 164) { + else if (node.kind !== 169 && node.kind !== 168 && node.kind !== 178 && node.kind !== 166) { return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } flags |= 64; @@ -74736,35 +75431,35 @@ var ts; else if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (flags & 128) { + else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "abstract"); } - else if (flags & 256) { + else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } else if (ts.isClassLike(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "export"); } - else if (node.kind === 164) { + else if (node.kind === 166) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1; break; case 88: - var container = node.parent.kind === 305 ? node.parent : node.parent.parent; - if (container.kind === 261 && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 308 ? node.parent : node.parent.parent; + if (container.kind === 264 && !ts.isAmbientModule(container)) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } else if (!(flags & 1)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "default"); } - flags |= 512; + flags |= 1024; break; - case 135: + case 136: if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (flags & 256) { + else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } else if (flags & 16384) { @@ -74773,10 +75468,10 @@ var ts; else if (ts.isClassLike(node.parent) && !ts.isPropertyDeclaration(node)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "declare"); } - else if (node.kind === 164) { + else if (node.kind === 166) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if ((node.parent.flags & 16777216) && node.parent.kind === 262) { + else if ((node.parent.flags & 16777216) && node.parent.kind === 265) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } else if (ts.isPrivateIdentifierClassElementDeclaration(node)) { @@ -74786,18 +75481,18 @@ var ts; lastDeclare = modifier; break; case 126: - if (flags & 128) { + if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 257 && - node.kind !== 180) { - if (node.kind !== 169 && - node.kind !== 167 && - node.kind !== 172 && - node.kind !== 173) { + if (node.kind !== 260 && + node.kind !== 182) { + if (node.kind !== 171 && + node.kind !== 169 && + node.kind !== 174 && + node.kind !== 175) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 257 && ts.hasSyntacticModifier(node.parent, 128))) { + if (!(node.parent.kind === 260 && ts.hasSyntacticModifier(node.parent, 256))) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32) { @@ -74806,39 +75501,42 @@ var ts; if (flags & 8) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract"); } - if (flags & 256 && lastAsync) { + if (flags & 512 && lastAsync) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); } if (flags & 16384) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "override"); } + if (flags & 128) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "accessor"); + } } if (ts.isNamedDeclaration(node) && node.name.kind === 80) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "abstract"); } - flags |= 128; + flags |= 256; break; - case 131: - if (flags & 256) { + case 132: + if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } else if (flags & 2 || node.parent.flags & 16777216) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 164) { + else if (node.kind === 166) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } - if (flags & 128) { + if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); } - flags |= 256; + flags |= 512; lastAsync = modifier; break; case 101: - case 144: + case 145: var inOutFlag = modifier.kind === 101 ? 32768 : 65536; var inOutText = modifier.kind === 101 ? "in" : "out"; - if (node.kind !== 163 || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) { + if (node.kind !== 165 || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText); } if (flags & inOutFlag) { @@ -74851,28 +75549,28 @@ var ts; break; } } - if (node.kind === 171) { + if (node.kind === 173) { if (flags & 32) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } if (flags & 16384) { return grammarErrorOnNode(lastOverride, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "override"); } - if (flags & 256) { + if (flags & 512) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); } return false; } - else if ((node.kind === 266 || node.kind === 265) && flags & 2) { + else if ((node.kind === 269 || node.kind === 268) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 164 && (flags & 16476) && ts.isBindingPattern(node.name)) { + else if (node.kind === 166 && (flags & 16476) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); } - else if (node.kind === 164 && (flags & 16476) && node.dotDotDotToken) { + else if (node.kind === 166 && (flags & 16476) && node.dotDotDotToken) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } - if (flags & 256) { + if (flags & 512) { return checkGrammarAsyncModifier(node, lastAsync); } return false; @@ -74886,47 +75584,47 @@ var ts; } function shouldReportBadModifier(node) { switch (node.kind) { - case 172: + case 174: + case 175: case 173: - case 171: - case 167: - case 166: case 169: case 168: - case 176: - case 261: - case 266: - case 265: - case 272: - case 271: - case 213: - case 214: - case 164: - case 163: - return false; + case 171: case 170: - case 296: - case 297: + case 178: case 264: - case 179: - case 276: + case 269: + case 268: + case 275: + case 274: + case 215: + case 216: + case 166: + case 165: + return false; + case 172: + case 299: + case 300: + case 267: + case 181: + case 279: return true; default: - if (node.parent.kind === 262 || node.parent.kind === 305) { + if (node.parent.kind === 265 || node.parent.kind === 308) { return false; } switch (node.kind) { - case 256: - return nodeHasAnyModifiersExcept(node, 131); - case 257: - case 180: - return nodeHasAnyModifiersExcept(node, 126); - case 226: - case 258: - case 237: case 259: - return true; + return nodeHasAnyModifiersExcept(node, 132); case 260: + case 182: + return nodeHasAnyModifiersExcept(node, 126); + case 228: + case 261: + case 240: + case 262: + return true; + case 263: return nodeHasAnyModifiersExcept(node, 85); default: ts.Debug.assertNever(node); @@ -74944,10 +75642,10 @@ var ts; } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { - case 169: - case 256: - case 213: - case 214: + case 171: + case 259: + case 215: + case 216: return false; } return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); @@ -75171,20 +75869,20 @@ var ts; return false; } function checkGrammarComputedPropertyName(node) { - if (node.kind !== 162) { + if (node.kind !== 164) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 221 && computedPropertyName.expression.operatorToken.kind === 27) { + if (computedPropertyName.expression.kind === 223 && computedPropertyName.expression.operatorToken.kind === 27) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } return false; } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 256 || - node.kind === 213 || - node.kind === 169); + ts.Debug.assert(node.kind === 259 || + node.kind === 215 || + node.kind === 171); if (node.flags & 16777216) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -75203,7 +75901,7 @@ var ts; var seen = new ts.Map(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 298) { + if (prop.kind === 301) { if (inDestructuring) { var expression = ts.skipParentheses(prop.expression); if (ts.isArrayLiteralExpression(expression) || ts.isObjectLiteralExpression(expression)) { @@ -75213,10 +75911,10 @@ var ts; continue; } var name = prop.name; - if (name.kind === 162) { + if (name.kind === 164) { checkGrammarComputedPropertyName(name); } - if (prop.kind === 297 && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 300 && !inDestructuring && prop.objectAssignmentInitializer) { grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern); } if (name.kind === 80) { @@ -75225,7 +75923,7 @@ var ts; if (ts.canHaveModifiers(prop) && prop.modifiers) { for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { var mod = _c[_b]; - if (ts.isModifier(mod) && (mod.kind !== 131 || prop.kind !== 169)) { + if (ts.isModifier(mod) && (mod.kind !== 132 || prop.kind !== 171)) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } } @@ -75238,8 +75936,8 @@ var ts; } var currentKind = void 0; switch (prop.kind) { - case 297: - case 296: + case 300: + case 299: checkGrammarForInvalidExclamationToken(prop.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name.kind === 8) { @@ -75247,13 +75945,13 @@ var ts; } currentKind = 4; break; - case 169: + case 171: currentKind = 8; break; - case 172: + case 174: currentKind = 1; break; - case 173: + case 175: currentKind = 2; break; default: @@ -75296,7 +75994,7 @@ var ts; var seen = new ts.Map(); for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 287) { + if (attr.kind === 290) { continue; } var name = attr.name, initializer = attr.initializer; @@ -75306,7 +76004,7 @@ var ts; else { return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } - if (initializer && initializer.kind === 288 && !initializer.expression) { + if (initializer && initializer.kind === 291 && !initializer.expression) { return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -75341,7 +76039,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.kind === 244 && forInOrOfStatement.awaitModifier) { + if (forInOrOfStatement.kind === 247 && forInOrOfStatement.awaitModifier) { if (!(forInOrOfStatement.flags & 32768)) { var sourceFile = ts.getSourceFileOfNode(forInOrOfStatement); if (ts.isInTopLevelContext(forInOrOfStatement)) { @@ -75372,7 +76070,7 @@ var ts; if (!hasParseDiagnostics(sourceFile)) { var diagnostic = ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); var func = ts.getContainingFunction(forInOrOfStatement); - if (func && func.kind !== 171) { + if (func && func.kind !== 173) { ts.Debug.assert((ts.getFunctionFlags(func) & 2) === 0, "Enclosing function should never be an async function."); var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); ts.addRelatedInfo(diagnostic, relatedInfo); @@ -75389,7 +76087,7 @@ var ts; grammarErrorOnNode(forInOrOfStatement.initializer, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async); return false; } - if (forInOrOfStatement.initializer.kind === 255) { + if (forInOrOfStatement.initializer.kind === 258) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -75397,20 +76095,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 243 + var diagnostic = forInOrOfStatement.kind === 246 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 243 + var diagnostic = forInOrOfStatement.kind === 246 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 243 + var diagnostic = forInOrOfStatement.kind === 246 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -75420,22 +76118,22 @@ var ts; return false; } function checkGrammarAccessor(accessor) { - if (!(accessor.flags & 16777216) && (accessor.parent.kind !== 182) && (accessor.parent.kind !== 258)) { + if (!(accessor.flags & 16777216) && (accessor.parent.kind !== 184) && (accessor.parent.kind !== 261)) { if (languageVersion < 1) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); } if (languageVersion < 2 && ts.isPrivateIdentifier(accessor.name)) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } - if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 128)) { + if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 256)) { return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } if (accessor.body) { - if (ts.hasSyntacticModifier(accessor, 128)) { + if (ts.hasSyntacticModifier(accessor, 256)) { return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); } - if (accessor.parent.kind === 182 || accessor.parent.kind === 258) { + if (accessor.parent.kind === 184 || accessor.parent.kind === 261) { return grammarErrorOnNode(accessor.body, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } } @@ -75443,11 +76141,11 @@ var ts; return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } if (!doesAccessorHaveCorrectParameterCount(accessor)) { - return grammarErrorOnNode(accessor.name, accessor.kind === 172 ? + return grammarErrorOnNode(accessor.name, accessor.kind === 174 ? ts.Diagnostics.A_get_accessor_cannot_have_parameters : ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - if (accessor.kind === 173) { + if (accessor.kind === 175) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -75465,17 +76163,17 @@ var ts; return false; } function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 172 ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 174 ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 172 ? 1 : 2)) { + if (accessor.parameters.length === (accessor.kind === 174 ? 1 : 2)) { return ts.getThisParameter(accessor); } } function checkGrammarTypeOperatorNode(node) { - if (node.operator === 154) { - if (node.type.kind !== 151) { - return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(151)); + if (node.operator === 156) { + if (node.type.kind !== 153) { + return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(153)); } var parent = ts.walkUpParenthesizedTypes(node.parent); if (ts.isInJSFile(parent) && ts.isJSDocTypeExpression(parent)) { @@ -75485,7 +76183,7 @@ var ts; } } switch (parent.kind) { - case 254: + case 257: var decl = parent; if (decl.name.kind !== 79) { return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name); @@ -75497,13 +76195,13 @@ var ts; return grammarErrorOnNode(parent.name, ts.Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const); } break; - case 167: + case 169: if (!ts.isStatic(parent) || !ts.hasEffectiveReadonlyModifier(parent)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly); } break; - case 166: + case 168: if (!ts.hasSyntacticModifier(parent, 64)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly); } @@ -75512,9 +76210,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_are_not_allowed_here); } } - else if (node.operator === 145) { - if (node.type.kind !== 183 && node.type.kind !== 184) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(151)); + else if (node.operator === 146) { + if (node.type.kind !== 185 && node.type.kind !== 186) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(153)); } } } @@ -75527,9 +76225,9 @@ var ts; if (checkGrammarFunctionLikeDeclaration(node)) { return true; } - if (node.kind === 169) { - if (node.parent.kind === 205) { - if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 131)) { + if (node.kind === 171) { + if (node.parent.kind === 207) { + if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 132)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } else if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { @@ -75553,14 +76251,14 @@ var ts; if (node.flags & 16777216) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.kind === 169 && !node.body) { + else if (node.kind === 171 && !node.body) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } - else if (node.parent.kind === 258) { + else if (node.parent.kind === 261) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.parent.kind === 182) { + else if (node.parent.kind === 184) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } @@ -75571,9 +76269,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 250: + case 253: if (node.label && current.label.escapedText === node.label.escapedText) { - var isMisplacedContinueLabel = node.kind === 245 + var isMisplacedContinueLabel = node.kind === 248 && !ts.isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -75581,8 +76279,8 @@ var ts; return false; } break; - case 249: - if (node.kind === 246 && !node.label) { + case 252: + if (node.kind === 249 && !node.label) { return false; } break; @@ -75595,13 +76293,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 246 + var message = node.kind === 249 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 246 + var message = node.kind === 249 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -75624,12 +76322,12 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return ts.isStringOrNumericLiteralLike(expr) || - expr.kind === 219 && expr.operator === 40 && + expr.kind === 221 && expr.operator === 40 && expr.operand.kind === 8; } function isBigIntLiteralExpression(expr) { return expr.kind === 9 || - expr.kind === 219 && expr.operator === 40 && + expr.kind === 221 && expr.operator === 40 && expr.operand.kind === 9; } function isSimpleLiteralEnumReference(expr) { @@ -75657,7 +76355,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 243 && node.parent.parent.kind !== 244) { + if (node.parent.parent.kind !== 246 && node.parent.parent.kind !== 247) { if (node.flags & 16777216) { checkAmbientInitializer(node); } @@ -75670,7 +76368,7 @@ var ts; } } } - if (node.exclamationToken && (node.parent.parent.kind !== 237 || !node.type || node.initializer || node.flags & 16777216)) { + if (node.exclamationToken && (node.parent.parent.kind !== 240 || !node.type || node.initializer || node.flags & 16777216)) { var message = node.initializer ? ts.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type @@ -75731,15 +76429,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 239: - case 240: - case 241: - case 248: case 242: case 243: case 244: + case 251: + case 245: + case 246: + case 247: return false; - case 250: + case 253: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -75833,8 +76531,14 @@ var ts; if (languageVersion < 2 && ts.isPrivateIdentifier(node.name)) { return grammarErrorOnNode(node.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } + if (languageVersion < 2 && ts.isAutoAccessorPropertyDeclaration(node)) { + return grammarErrorOnNode(node.name, ts.Diagnostics.Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher); + } + if (ts.isAutoAccessorPropertyDeclaration(node) && checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_accessor_property_cannot_be_declared_optional)) { + return true; + } } - else if (node.parent.kind === 258) { + else if (node.parent.kind === 261) { if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) { return true; } @@ -75866,14 +76570,14 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 258 || - node.kind === 259 || - node.kind === 266 || - node.kind === 265 || - node.kind === 272 || - node.kind === 271 || - node.kind === 264 || - ts.hasSyntacticModifier(node, 2 | 1 | 512)) { + if (node.kind === 261 || + node.kind === 262 || + node.kind === 269 || + node.kind === 268 || + node.kind === 275 || + node.kind === 274 || + node.kind === 267 || + ts.hasSyntacticModifier(node, 2 | 1 | 1024)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier); @@ -75881,7 +76585,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 237) { + if (ts.isDeclaration(decl) || decl.kind === 240) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -75898,7 +76602,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && (ts.isFunctionLike(node.parent) || ts.isAccessor(node.parent))) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 235 || node.parent.kind === 262 || node.parent.kind === 305) { + if (node.parent.kind === 238 || node.parent.kind === 265 || node.parent.kind === 308) { var links_2 = getNodeLinks(node.parent); if (!links_2.hasReportedStatementInAmbientContext) { return links_2.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -75915,10 +76619,10 @@ var ts; if (languageVersion >= 1) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 196)) { + else if (ts.isChildOfNodeWithKind(node, 198)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 299)) { + else if (ts.isChildOfNodeWithKind(node, 302)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -75979,7 +76683,7 @@ var ts; if (node.isTypeOnly && node.name && node.namedBindings) { return grammarErrorOnNode(node, ts.Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both); } - if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 269) { + if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 272) { return checkGrammarNamedImportsOrExports(node.namedBindings); } return false; @@ -75987,7 +76691,7 @@ var ts; function checkGrammarNamedImportsOrExports(namedBindings) { return !!ts.forEach(namedBindings.elements, function (specifier) { if (specifier.isTypeOnly) { - return grammarErrorOnFirstToken(specifier, specifier.kind === 270 + return grammarErrorOnFirstToken(specifier, specifier.kind === 273 ? ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement : ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement); } @@ -76001,7 +76705,7 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments); } var nodeArguments = node.arguments; - if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext) { + if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext && moduleKind !== ts.ModuleKind.Node16) { checkGrammarForDisallowedTrailingComma(nodeArguments); if (nodeArguments.length > 1) { var assertionArgument = nodeArguments[1]; @@ -76101,13 +76805,13 @@ var ts; return !ts.isAccessor(declaration); } function isNotOverload(declaration) { - return (declaration.kind !== 256 && declaration.kind !== 169) || + return (declaration.kind !== 259 && declaration.kind !== 171) || !!declaration.body; } function isDeclarationNameOrImportPropertyName(name) { switch (name.parent.kind) { - case 270: - case 275: + case 273: + case 278: return ts.isIdentifier(name); default: return ts.isDeclarationName(name); @@ -76143,6 +76847,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { + var _a; function visitNode(node, visitor, test, lift) { if (node === undefined || visitor === undefined) { return node; @@ -76320,9 +77025,10 @@ var ts; return updated; } ts.visitFunctionBody = visitFunctionBody; - function visitIterationBody(body, visitor, context) { + function visitIterationBody(body, visitor, context, nodeVisitor) { + if (nodeVisitor === void 0) { nodeVisitor = visitNode; } context.startBlockScope(); - var updated = visitNode(body, visitor, ts.isStatement, context.factory.liftToBlock); + var updated = nodeVisitor(body, visitor, ts.isStatement, context.factory.liftToBlock); var declarations = context.endBlockScope(); if (ts.some(declarations)) { if (ts.isBlock(updated)) { @@ -76341,437 +77047,428 @@ var ts; if (node === undefined) { return undefined; } - var kind = node.kind; - if ((kind > 0 && kind <= 160) || kind === 192) { - return node; - } - var factory = context.factory; - switch (kind) { - case 79: - ts.Debug.type(node); - return factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration)); - case 161: - ts.Debug.type(node); - return factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier)); - case 162: - ts.Debug.type(node); - return factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 163: - ts.Debug.type(node); - return factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode)); - case 164: - ts.Debug.type(node); - return factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 165: - ts.Debug.type(node); - return factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 166: - ts.Debug.type(node); - return factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 167: - ts.Debug.type(node); - return factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken || node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 168: - ts.Debug.type(node); - return factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 169: - ts.Debug.type(node); - return factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 171: - ts.Debug.type(node); - return factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 172: - ts.Debug.type(node); - return factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 173: - ts.Debug.type(node); - return factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 170: - ts.Debug.type(node); - context.startLexicalEnvironment(); - context.suspendLexicalEnvironment(); - return factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 174: - ts.Debug.type(node); - return factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 175: - ts.Debug.type(node); - return factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 176: - ts.Debug.type(node); - return factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 177: - ts.Debug.type(node); - return factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 178: - ts.Debug.type(node); - return factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 179: - ts.Debug.type(node); - return factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 180: - ts.Debug.type(node); - return factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 181: - ts.Debug.type(node); - return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 182: - ts.Debug.type(node); - return factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 183: - ts.Debug.type(node); - return factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode)); - case 184: - ts.Debug.type(node); - return factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode)); - case 185: - ts.Debug.type(node); - return factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 186: - ts.Debug.type(node); - return factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 187: - ts.Debug.type(node); - return factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 188: - ts.Debug.type(node); - return factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 189: - ts.Debug.type(node); - return factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode)); - case 190: - ts.Debug.type(node); - return factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); - case 200: - ts.Debug.type(node); - return factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isNode), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); - case 295: - ts.Debug.type(node); - return factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isNode), node.multiLine); - case 197: - ts.Debug.type(node); - return factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 191: - ts.Debug.type(node); - return factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 193: - ts.Debug.type(node); - return factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 194: - ts.Debug.type(node); - return factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode)); - case 195: - ts.Debug.type(node); - return factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 196: - ts.Debug.type(node); - return factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression)); - case 198: - ts.Debug.type(node); - return factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan)); - case 199: - ts.Debug.type(node); - return factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - case 201: - ts.Debug.type(node); - return factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); - case 202: - ts.Debug.type(node); - return factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); - case 203: - ts.Debug.type(node); - return factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 204: - ts.Debug.type(node); - return factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - case 205: - ts.Debug.type(node); - return factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); - case 206: - if (node.flags & 32) { - ts.Debug.type(node); - return factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName)); - } - ts.Debug.type(node); - return factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName)); - case 207: - if (node.flags & 32) { - ts.Debug.type(node); - return factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); - case 208: - if (node.flags & 32) { - ts.Debug.type(node); - return factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 209: - ts.Debug.type(node); - return factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 210: - ts.Debug.type(node); - return factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral)); - case 211: - ts.Debug.type(node); - return factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 212: - ts.Debug.type(node); - return factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 213: - ts.Debug.type(node); - return factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 214: - ts.Debug.type(node); - return factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 215: - ts.Debug.type(node); - return factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 216: - ts.Debug.type(node); - return factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 217: - ts.Debug.type(node); - return factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 218: - ts.Debug.type(node); - return factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 219: - ts.Debug.type(node); - return factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); - case 220: - ts.Debug.type(node); - return factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); - case 221: - ts.Debug.type(node); - return factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression)); - case 222: - ts.Debug.type(node); - return factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression)); - case 223: - ts.Debug.type(node); - return factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); - case 224: - ts.Debug.type(node); - return factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 225: - ts.Debug.type(node); - return factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 226: - ts.Debug.type(node); - return factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 228: - ts.Debug.type(node); - return factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 229: - ts.Debug.type(node); - return factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 230: - if (node.flags & 32) { - ts.Debug.type(node); - return factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 231: - ts.Debug.type(node); - return factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 233: - ts.Debug.type(node); - return factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - case 235: - ts.Debug.type(node); - return factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 237: - ts.Debug.type(node); - return factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 238: - ts.Debug.type(node); - return factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 239: - ts.Debug.type(node); - return factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, factory.liftToBlock)); - case 240: - ts.Debug.type(node); - return factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 241: - ts.Debug.type(node); - return factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 242: - ts.Debug.type(node); - return factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 243: - ts.Debug.type(node); - return factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 244: - ts.Debug.type(node); - return factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 245: - ts.Debug.type(node); - return factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); - case 246: - ts.Debug.type(node); - return factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); - case 247: - ts.Debug.type(node); - return factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 248: - ts.Debug.type(node); - return factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock)); - case 249: - ts.Debug.type(node); - return factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock)); - case 250: - ts.Debug.type(node); - return factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock)); - case 251: - ts.Debug.type(node); - return factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 252: - ts.Debug.type(node); - return factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock)); - case 254: - ts.Debug.type(node); - return factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 255: - ts.Debug.type(node); - return factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); - case 256: - ts.Debug.type(node); - return factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 257: - ts.Debug.type(node); - return factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 258: - ts.Debug.type(node); - return factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 259: - ts.Debug.type(node); - return factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 260: - ts.Debug.type(node); - return factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); - case 261: - ts.Debug.type(node); - return factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody)); - case 262: - ts.Debug.type(node); - return factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 263: - ts.Debug.type(node); - return factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 264: - ts.Debug.type(node); - return factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 265: - ts.Debug.type(node); - return factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference)); - case 266: - ts.Debug.type(node); - return factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); - case 293: - ts.Debug.type(node); - return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine); - case 294: - ts.Debug.type(node); - return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode)); - case 267: - ts.Debug.type(node); - return factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings)); - case 268: - ts.Debug.type(node); - return factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 274: - ts.Debug.type(node); - return factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 269: - ts.Debug.type(node); - return factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); - case 270: - ts.Debug.type(node); - return factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 271: - ts.Debug.type(node); - return factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 272: - ts.Debug.type(node); - return factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); - case 273: - ts.Debug.type(node); - return factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); - case 275: - ts.Debug.type(node); - return factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 277: - ts.Debug.type(node); - return factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 278: - ts.Debug.type(node); - return factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement)); - case 279: - ts.Debug.type(node); - return factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); - case 280: - ts.Debug.type(node); - return factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); - case 281: - ts.Debug.type(node); - return factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 282: - ts.Debug.type(node); - return factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment)); - case 285: - ts.Debug.type(node); - return factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 286: - ts.Debug.type(node); - return factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); - case 287: - ts.Debug.type(node); - return factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 288: - ts.Debug.type(node); - return factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 289: - ts.Debug.type(node); - return factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); - case 290: - ts.Debug.type(node); - return factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 291: - ts.Debug.type(node); - return factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 292: - ts.Debug.type(node); - return factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock)); - case 296: - ts.Debug.type(node); - return factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 297: - ts.Debug.type(node); - return factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 298: - ts.Debug.type(node); - return factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 299: - ts.Debug.type(node); - return factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 305: - ts.Debug.type(node); - return factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context)); - case 350: - ts.Debug.type(node); - return factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 351: - ts.Debug.type(node); - return factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - default: - return node; - } + var fn = visitEachChildTable[node.kind]; + return fn === undefined ? node : fn(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor); } ts.visitEachChild = visitEachChild; + var visitEachChildTable = (_a = {}, + _a[79] = function visitEachChildOfIdentifier(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration)); + }, + _a[163] = function visitEachChildOfQualifiedName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier)); + }, + _a[164] = function visitEachChildOfComputedPropertyName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[165] = function visitEachChildOfTypeParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode)); + }, + _a[166] = function visitEachChildOfParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[167] = function visitEachChildOfDecorator(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[168] = function visitEachChildOfPropertySignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[169] = function visitEachChildOfPropertyDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + var _a; + return context.factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor((_a = node.questionToken) !== null && _a !== void 0 ? _a : node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[170] = function visitEachChildOfMethodSignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[171] = function visitEachChildOfMethodDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[173] = function visitEachChildOfConstructorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[174] = function visitEachChildOfGetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[175] = function visitEachChildOfSetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[172] = function visitEachChildOfClassStaticBlockDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + context.startLexicalEnvironment(); + context.suspendLexicalEnvironment(); + return context.factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[176] = function visitEachChildOfCallSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[177] = function visitEachChildOfConstructSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[178] = function visitEachChildOfIndexSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[179] = function visitEachChildOfTypePredicateNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[180] = function visitEachChildOfTypeReferenceNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[181] = function visitEachChildOfFunctionTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[182] = function visitEachChildOfConstructorTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[183] = function visitEachChildOfTypeQueryNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[184] = function visitEachChildOfTypeLiteralNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[185] = function visitEachChildOfArrayTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode)); + }, + _a[186] = function visitEachChildOfTupleTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode)); + }, + _a[187] = function visitEachChildOfOptionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[188] = function visitEachChildOfRestTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[189] = function visitEachChildOfUnionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + }, + _a[190] = function visitEachChildOfIntersectionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + }, + _a[191] = function visitEachChildOfConditionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode)); + }, + _a[192] = function visitEachChildOfInferTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); + }, + _a[202] = function visitEachChildOfImportTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isImportTypeAssertionContainer), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); + }, + _a[298] = function visitEachChildOfImportTypeAssertionContainer(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isAssertClause), node.multiLine); + }, + _a[199] = function visitEachChildOfNamedTupleMember(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[193] = function visitEachChildOfParenthesizedType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[195] = function visitEachChildOfTypeOperatorNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[196] = function visitEachChildOfIndexedAccessType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode)); + }, + _a[197] = function visitEachChildOfMappedType(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[198] = function visitEachChildOfLiteralTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression)); + }, + _a[200] = function visitEachChildOfTemplateLiteralType(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan)); + }, + _a[201] = function visitEachChildOfTemplateLiteralTypeSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + }, + _a[203] = function visitEachChildOfObjectBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); + }, + _a[204] = function visitEachChildOfArrayBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); + }, + _a[205] = function visitEachChildOfBindingElement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[206] = function visitEachChildOfArrayLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + }, + _a[207] = function visitEachChildOfObjectLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); + }, + _a[208] = function visitEachChildOfPropertyAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isPropertyAccessChain(node) ? + context.factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName)) : + context.factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName)); + }, + _a[209] = function visitEachChildOfElementAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isElementAccessChain(node) ? + context.factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)) : + context.factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); + }, + _a[210] = function visitEachChildOfCallExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isCallChain(node) ? + context.factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)) : + context.factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + }, + _a[211] = function visitEachChildOfNewExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + }, + _a[212] = function visitEachChildOfTaggedTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral)); + }, + _a[213] = function visitEachChildOfTypeAssertionExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[214] = function visitEachChildOfParenthesizedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[215] = function visitEachChildOfFunctionExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[216] = function visitEachChildOfArrowFunction(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[217] = function visitEachChildOfDeleteExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[218] = function visitEachChildOfTypeOfExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[219] = function visitEachChildOfVoidExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[220] = function visitEachChildOfAwaitExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[221] = function visitEachChildOfPrefixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); + }, + _a[222] = function visitEachChildOfPostfixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); + }, + _a[223] = function visitEachChildOfBinaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression)); + }, + _a[224] = function visitEachChildOfConditionalExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression)); + }, + _a[225] = function visitEachChildOfTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); + }, + _a[226] = function visitEachChildOfYieldExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[227] = function visitEachChildOfSpreadElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[228] = function visitEachChildOfClassExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + }, + _a[230] = function visitEachChildOfExpressionWithTypeArguments(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[231] = function visitEachChildOfAsExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[235] = function visitEachChildOfSatisfiesExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSatisfiesExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[232] = function visitEachChildOfNonNullExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return ts.isOptionalChain(node) ? + context.factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression)) : + context.factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[233] = function visitEachChildOfMetaProperty(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[236] = function visitEachChildOfTemplateSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + }, + _a[238] = function visitEachChildOfBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[240] = function visitEachChildOfVariableStatement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList)); + }, + _a[241] = function visitEachChildOfExpressionStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[242] = function visitEachChildOfIfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, context.factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[243] = function visitEachChildOfDoStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context, nodeVisitor), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[244] = function visitEachChildOfWhileStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[245] = function visitEachChildOfForStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[246] = function visitEachChildOfForInStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[247] = function visitEachChildOfForOfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[248] = function visitEachChildOfContinueStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); + }, + _a[249] = function visitEachChildOfBreakStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); + }, + _a[250] = function visitEachChildOfReturnStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[251] = function visitEachChildOfWithStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[252] = function visitEachChildOfSwitchStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock)); + }, + _a[253] = function visitEachChildOfLabeledStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[254] = function visitEachChildOfThrowStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[255] = function visitEachChildOfTryStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock)); + }, + _a[257] = function visitEachChildOfVariableDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[258] = function visitEachChildOfVariableDeclarationList(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); + }, + _a[259] = function visitEachChildOfFunctionDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[260] = function visitEachChildOfClassDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + }, + _a[261] = function visitEachChildOfInterfaceDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[262] = function visitEachChildOfTypeAliasDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[263] = function visitEachChildOfEnumDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); + }, + _a[264] = function visitEachChildOfModuleDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody)); + }, + _a[265] = function visitEachChildOfModuleBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[266] = function visitEachChildOfCaseBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); + }, + _a[267] = function visitEachChildOfNamespaceExportDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[268] = function visitEachChildOfImportEqualsDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference)); + }, + _a[269] = function visitEachChildOfImportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); + }, + _a[296] = function visitEachChildOfAssertClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine); + }, + _a[297] = function visitEachChildOfAssertEntry(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpression)); + }, + _a[270] = function visitEachChildOfImportClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings)); + }, + _a[271] = function visitEachChildOfNamespaceImport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[277] = function visitEachChildOfNamespaceExport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[272] = function visitEachChildOfNamedImports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); + }, + _a[273] = function visitEachChildOfImportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[274] = function visitEachChildOfExportAssignment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[275] = function visitEachChildOfExportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); + }, + _a[276] = function visitEachChildOfNamedExports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); + }, + _a[278] = function visitEachChildOfExportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[280] = function visitEachChildOfExternalModuleReference(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[281] = function visitEachChildOfJsxElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement)); + }, + _a[282] = function visitEachChildOfJsxSelfClosingElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); + }, + _a[283] = function visitEachChildOfJsxOpeningElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); + }, + _a[284] = function visitEachChildOfJsxClosingElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression)); + }, + _a[285] = function visitEachChildOfJsxFragment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment)); + }, + _a[288] = function visitEachChildOfJsxAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); + }, + _a[289] = function visitEachChildOfJsxAttributes(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); + }, + _a[290] = function visitEachChildOfJsxSpreadAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[291] = function visitEachChildOfJsxExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[292] = function visitEachChildOfCaseClause(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[293] = function visitEachChildOfDefaultClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[294] = function visitEachChildOfHeritageClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); + }, + _a[295] = function visitEachChildOfCatchClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock)); + }, + _a[299] = function visitEachChildOfPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[300] = function visitEachChildOfShorthandPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression)); + }, + _a[301] = function visitEachChildOfSpreadAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[302] = function visitEachChildOfEnumMember(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[308] = function visitEachChildOfSourceFile(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context, undefined, undefined, nodesVisitor)); + }, + _a[353] = function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[354] = function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + }, + _a); function extractSingleNode(nodes) { ts.Debug.assert(nodes.length <= 1, "Too many nodes written to output."); return ts.singleOrUndefined(nodes); @@ -77400,7 +78097,7 @@ var ts; function chainBundle(context, transformSourceFile) { return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - return node.kind === 305 ? transformSourceFile(node) : transformBundle(node); + return node.kind === 308 ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -77449,7 +78146,7 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 266: + case 269: externalImports.push(node); if (!hasImportStar && getImportNeedsImportStarHelper(node)) { hasImportStar = true; @@ -77458,12 +78155,12 @@ var ts; hasImportDefault = true; } break; - case 265: - if (node.moduleReference.kind === 277) { + case 268: + if (node.moduleReference.kind === 280) { externalImports.push(node); } break; - case 272: + case 275: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -77489,12 +78186,12 @@ var ts; addExportedNamesForExportDeclaration(node); } break; - case 271: + case 274: if (node.isExportEquals && !exportEquals) { exportEquals = node; } break; - case 237: + case 240: if (ts.hasSyntacticModifier(node, 1)) { for (var _b = 0, _c = node.declarationList.declarations; _b < _c.length; _b++) { var decl = _c[_b]; @@ -77502,9 +78199,9 @@ var ts; } } break; - case 256: + case 259: if (ts.hasSyntacticModifier(node, 1)) { - if (ts.hasSyntacticModifier(node, 512)) { + if (ts.hasSyntacticModifier(node, 1024)) { if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); hasExportDefault = true; @@ -77520,9 +78217,9 @@ var ts; } } break; - case 257: + case 260: if (ts.hasSyntacticModifier(node, 1)) { - if (ts.hasSyntacticModifier(node, 512)) { + if (ts.hasSyntacticModifier(node, 1024)) { if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); hasExportDefault = true; @@ -77669,12 +78366,12 @@ var ts; return ts.isPropertyDeclaration(member) && ts.hasStaticModifier(member); } function isInitializedProperty(member) { - return member.kind === 167 + return member.kind === 169 && member.initializer !== undefined; } ts.isInitializedProperty = isInitializedProperty; function isNonStaticMethodOrAccessorWithPrivateName(member) { - return !ts.isStatic(member) && ts.isMethodOrAccessor(member) && ts.isPrivateIdentifier(member.name); + return !ts.isStatic(member) && (ts.isMethodOrAccessor(member) || ts.isAutoAccessorPropertyDeclaration(member)) && ts.isPrivateIdentifier(member.name); } ts.isNonStaticMethodOrAccessorWithPrivateName = isNonStaticMethodOrAccessorWithPrivateName; function getDecoratorsOfParameters(node) { @@ -77710,12 +78407,12 @@ var ts; ts.getAllDecoratorsOfClass = getAllDecoratorsOfClass; function getAllDecoratorsOfClassElement(member, parent) { switch (member.kind) { - case 172: - case 173: + case 174: + case 175: return getAllDecoratorsOfAccessors(member, parent); - case 169: + case 171: return getAllDecoratorsOfMethod(member); - case 167: + case 169: return getAllDecoratorsOfProperty(member); default: return undefined; @@ -78187,8 +78884,8 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(206); - context.enableSubstitution(207); + context.enableSubstitution(208); + context.enableSubstitution(209); var currentSourceFile; var currentNamespace; var currentNamespaceContainerName; @@ -78199,14 +78896,14 @@ var ts; var applicableSubstitutions; return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - if (node.kind === 306) { + if (node.kind === 309) { return transformBundle(node); } return transformSourceFile(node); } function transformBundle(node) { return factory.createBundle(node.sourceFiles.map(transformSourceFile), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 308) { + if (prepend.kind === 311) { return ts.createUnparsedSourceFile(prepend, "js"); } return prepend; @@ -78237,15 +78934,15 @@ var ts; } function onBeforeVisitNode(node) { switch (node.kind) { - case 305: - case 263: - case 262: - case 235: + case 308: + case 266: + case 265: + case 238: currentLexicalScope = node; currentScopeFirstDeclarationsOfName = undefined; break; - case 257: - case 256: + case 260: + case 259: if (ts.hasSyntacticModifier(node, 2)) { break; } @@ -78253,7 +78950,7 @@ var ts; recordEmittedDeclarationInScope(node); } else { - ts.Debug.assert(node.kind === 257 || ts.hasSyntacticModifier(node, 512)); + ts.Debug.assert(node.kind === 260 || ts.hasSyntacticModifier(node, 1024)); } break; } @@ -78272,10 +78969,10 @@ var ts; } function sourceElementVisitorWorker(node) { switch (node.kind) { - case 266: - case 265: - case 271: - case 272: + case 269: + case 268: + case 274: + case 275: return visitElidableStatement(node); default: return visitorWorker(node); @@ -78290,13 +78987,13 @@ var ts; return node; } switch (node.kind) { - case 266: + case 269: return visitImportDeclaration(node); - case 265: + case 268: return visitImportEqualsDeclaration(node); - case 271: + case 274: return visitExportAssignment(node); - case 272: + case 275: return visitExportDeclaration(node); default: ts.Debug.fail("Unhandled ellided statement"); @@ -78306,11 +79003,11 @@ var ts; return saveStateAndInvoke(node, namespaceElementVisitorWorker); } function namespaceElementVisitorWorker(node) { - if (node.kind === 272 || - node.kind === 266 || - node.kind === 267 || - (node.kind === 265 && - node.moduleReference.kind === 277)) { + if (node.kind === 275 || + node.kind === 269 || + node.kind === 270 || + (node.kind === 268 && + node.moduleReference.kind === 280)) { return undefined; } else if (node.transformFlags & 1 || ts.hasSyntacticModifier(node, 1)) { @@ -78323,21 +79020,21 @@ var ts; } function classElementVisitorWorker(node, parent) { switch (node.kind) { - case 171: - return visitConstructor(node); - case 167: - return visitPropertyDeclaration(node, parent); - case 172: - return visitGetAccessor(node, parent); case 173: - return visitSetAccessor(node, parent); + return visitConstructor(node); case 169: + return visitPropertyDeclaration(node, parent); + case 174: + return visitGetAccessor(node, parent); + case 175: + return visitSetAccessor(node, parent); + case 171: return visitMethodDeclaration(node, parent); - case 170: + case 172: return ts.visitEachChild(node, visitor, context); - case 234: + case 237: return node; - case 176: + case 178: return; default: return ts.Debug.failBadSyntaxKind(node); @@ -78348,15 +79045,15 @@ var ts; } function objectLiteralElementVisitorWorker(node, parent) { switch (node.kind) { - case 296: - case 297: - case 298: + case 299: + case 300: + case 301: return visitor(node); - case 172: + case 174: return visitGetAccessor(node, parent); - case 173: + case 175: return visitSetAccessor(node, parent); - case 169: + case 171: return visitMethodDeclaration(node, parent); default: return ts.Debug.failBadSyntaxKind(node); @@ -78365,7 +79062,7 @@ var ts; function modifierVisitor(node) { if (ts.isDecorator(node)) return undefined; - if (ts.modifierToFlag(node.kind) & 116958) { + if (ts.modifierToFlag(node.kind) & 117086) { return undefined; } else if (currentNamespace && node.kind === 93) { @@ -78385,99 +79082,101 @@ var ts; case 121: case 122: case 126: - case 159: + case 161: case 85: - case 135: - case 145: + case 136: + case 146: case 101: - case 144: - case 183: - case 184: + case 145: case 185: case 186: - case 182: - case 177: - case 163: - case 130: - case 155: - case 133: - case 150: - case 147: - case 143: - case 114: - case 151: - case 180: - case 179: - case 181: - case 178: case 187: case 188: + case 184: + case 179: + case 165: + case 131: + case 157: + case 134: + case 152: + case 148: + case 144: + case 114: + case 153: + case 182: + case 181: + case 183: + case 180: case 189: + case 190: case 191: - case 192: case 193: case 194: case 195: case 196: - case 176: + case 197: + case 198: + case 178: return undefined; - case 259: + case 262: return factory.createNotEmittedStatement(node); - case 264: + case 267: return undefined; - case 258: - return factory.createNotEmittedStatement(node); - case 257: - return visitClassDeclaration(node); - case 226: - return visitClassExpression(node); - case 291: - return visitHeritageClause(node); - case 228: - return visitExpressionWithTypeArguments(node); - case 205: - return visitObjectLiteralExpression(node); - case 171: - case 167: - case 169: - case 172: - case 173: - case 170: - return ts.Debug.fail("Class and object literal elements must be visited with their respective visitors"); - case 256: - return visitFunctionDeclaration(node); - case 213: - return visitFunctionExpression(node); - case 214: - return visitArrowFunction(node); - case 164: - return visitParameter(node); - case 212: - return visitParenthesizedExpression(node); - case 211: - case 229: - return visitAssertionExpression(node); - case 208: - return visitCallExpression(node); - case 209: - return visitNewExpression(node); - case 210: - return visitTaggedTemplateExpression(node); - case 230: - return visitNonNullExpression(node); - case 260: - return visitEnumDeclaration(node); - case 237: - return visitVariableStatement(node); - case 254: - return visitVariableDeclaration(node); case 261: + return factory.createNotEmittedStatement(node); + case 260: + return visitClassDeclaration(node); + case 228: + return visitClassExpression(node); + case 294: + return visitHeritageClause(node); + case 230: + return visitExpressionWithTypeArguments(node); + case 207: + return visitObjectLiteralExpression(node); + case 173: + case 169: + case 171: + case 174: + case 175: + case 172: + return ts.Debug.fail("Class and object literal elements must be visited with their respective visitors"); + case 259: + return visitFunctionDeclaration(node); + case 215: + return visitFunctionExpression(node); + case 216: + return visitArrowFunction(node); + case 166: + return visitParameter(node); + case 214: + return visitParenthesizedExpression(node); + case 213: + case 231: + return visitAssertionExpression(node); + case 235: + return visitSatisfiesExpression(node); + case 210: + return visitCallExpression(node); + case 211: + return visitNewExpression(node); + case 212: + return visitTaggedTemplateExpression(node); + case 232: + return visitNonNullExpression(node); + case 263: + return visitEnumDeclaration(node); + case 240: + return visitVariableStatement(node); + case 257: + return visitVariableDeclaration(node); + case 264: return visitModuleDeclaration(node); - case 265: + case 268: return visitImportEqualsDeclaration(node); - case 279: + case 282: return visitJsxSelfClosingElement(node); - case 280: + case 283: return visitJsxJsxOpeningElement(node); default: return ts.visitEachChild(node, visitor, context); @@ -78684,22 +79383,22 @@ var ts; } function shouldAddTypeMetadata(node) { var kind = node.kind; - return kind === 169 - || kind === 172 - || kind === 173 - || kind === 167; + return kind === 171 + || kind === 174 + || kind === 175 + || kind === 169; } function shouldAddReturnTypeMetadata(node) { - return node.kind === 169; + return node.kind === 171; } function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 257: - case 226: + case 260: + case 228: return ts.getFirstConstructorWithBody(node) !== undefined; - case 169: - case 172: - case 173: + case 171: + case 174: + case 175: return true; } return false; @@ -78747,7 +79446,7 @@ var ts; return !ts.nodeIsMissing(node.body); } function visitPropertyDeclaration(node, parent) { - var isAmbient = node.flags & 16777216 || ts.hasSyntacticModifier(node, 128); + var isAmbient = node.flags & 16777216 || ts.hasSyntacticModifier(node, 256); if (isAmbient && !ts.hasDecorators(node)) { return undefined; } @@ -78815,7 +79514,7 @@ var ts; return factory.updateMethodDeclaration(node, ts.concatenate(decorators, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifierLike)), node.asteriskToken, visitPropertyNameOfClassElement(node), undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context)); } function shouldEmitAccessorDeclaration(node) { - return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 128)); + return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 256)); } function visitGetAccessor(node, parent) { if (!(node.transformFlags & 1)) { @@ -78921,6 +79620,10 @@ var ts; var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression); return factory.createPartiallyEmittedExpression(expression, node); } + function visitSatisfiesExpression(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + return factory.createPartiallyEmittedExpression(expression, node); + } function visitCallExpression(node) { return factory.updateCallExpression(node, ts.visitNode(node.expression, visitor, ts.isExpression), undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression)); } @@ -79048,11 +79751,11 @@ var ts; function addVarForEnumOrModuleDeclaration(statements, node) { var statement = factory.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), factory.createVariableDeclarationList([ factory.createVariableDeclaration(factory.getLocalName(node, false, true)) - ], currentLexicalScope.kind === 305 ? 0 : 1)); + ], currentLexicalScope.kind === 308 ? 0 : 1)); ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { - if (node.kind === 260) { + if (node.kind === 263) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -79118,7 +79821,7 @@ var ts; var statementsLocation; var blockLocation; if (node.body) { - if (node.body.kind === 262) { + if (node.body.kind === 265) { saveStateAndInvoke(node.body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = node.body.statements; blockLocation = node.body; @@ -79143,13 +79846,13 @@ var ts; currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), statementsLocation), true); ts.setTextRange(block, blockLocation); - if (!node.body || node.body.kind !== 262) { + if (!node.body || node.body.kind !== 265) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 261) { + if (moduleDeclaration.body.kind === 264) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -79175,7 +79878,7 @@ var ts; return (name || namedBindings) ? factory.updateImportClause(node, false, name, namedBindings) : undefined; } function visitNamedImportBindings(node) { - if (node.kind === 268) { + if (node.kind === 271) { return shouldEmitAliasDeclaration(node) ? node : undefined; } else { @@ -79258,11 +79961,11 @@ var ts; } function isNamedExternalModuleExport(node) { return isExternalModuleExport(node) - && !ts.hasSyntacticModifier(node, 512); + && !ts.hasSyntacticModifier(node, 1024); } function isDefaultExternalModuleExport(node) { return isExternalModuleExport(node) - && ts.hasSyntacticModifier(node, 512); + && ts.hasSyntacticModifier(node, 1024); } function addExportMemberAssignment(statements, node) { var expression = factory.createAssignment(factory.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, false, true), factory.getLocalName(node)); @@ -79298,15 +80001,15 @@ var ts; if ((enabledSubstitutions & 2) === 0) { enabledSubstitutions |= 2; context.enableSubstitution(79); - context.enableSubstitution(297); - context.enableEmitNotification(261); + context.enableSubstitution(300); + context.enableEmitNotification(264); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 261; + return ts.getOriginalNode(node).kind === 264; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 260; + return ts.getOriginalNode(node).kind === 263; } function onEmitNode(hint, node, emitCallback) { var savedApplicableSubstitutions = applicableSubstitutions; @@ -79352,9 +80055,9 @@ var ts; switch (node.kind) { case 79: return substituteExpressionIdentifier(node); - case 206: + case 208: return substitutePropertyAccessExpression(node); - case 207: + case 209: return substituteElementAccessExpression(node); } return node; @@ -79366,9 +80069,9 @@ var ts; function trySubstituteNamespaceExportedName(node) { if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var container = resolver.getReferencedExportContainer(node, false); - if (container && container.kind !== 305) { - var substitute = (applicableSubstitutions & 2 && container.kind === 261) || - (applicableSubstitutions & 8 && container.kind === 260); + if (container && container.kind !== 308) { + var substitute = (applicableSubstitutions & 2 && container.kind === 264) || + (applicableSubstitutions & 8 && container.kind === 263); if (substitute) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(container), node), node); } @@ -79405,9 +80108,10 @@ var ts; return ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node) ? resolver.getConstantValue(node) : undefined; } function shouldEmitAliasDeclaration(node) { - return compilerOptions.preserveValueImports - ? resolver.isValueAliasDeclaration(node) - : resolver.isReferencedAliasDeclaration(node); + return ts.isInJSFile(node) || + (compilerOptions.preserveValueImports + ? resolver.isValueAliasDeclaration(node) + : resolver.isReferencedAliasDeclaration(node)); } } ts.transformTypeScript = transformTypeScript; @@ -79420,9 +80124,16 @@ var ts; var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); var useDefineForClassFields = ts.getUseDefineForClassFields(compilerOptions); + var shouldTransformInitializersUsingSet = !useDefineForClassFields; + var shouldTransformInitializersUsingDefine = useDefineForClassFields && languageVersion < 9; + var shouldTransformInitializers = shouldTransformInitializersUsingSet || shouldTransformInitializersUsingDefine; var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < 9; + var shouldTransformAutoAccessors = languageVersion < 99; var shouldTransformThisInStaticInitializers = languageVersion < 9; var shouldTransformSuperInStaticInitializers = shouldTransformThisInStaticInitializers && languageVersion >= 2; + var shouldTransformAnything = shouldTransformInitializers || + shouldTransformPrivateElementsOrClassStaticBlocks || + shouldTransformAutoAccessors; var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; var previousOnEmitNode = context.onEmitNode; @@ -79434,98 +80145,130 @@ var ts; var classLexicalEnvironmentStack = []; var classLexicalEnvironmentMap = new ts.Map(); var currentClassLexicalEnvironment; + var currentClassContainer; var currentComputedPropertyNameClassLexicalEnvironment; var currentStaticPropertyDeclarationOrStaticBlock; return ts.chainBundle(context, transformSourceFile); function transformSourceFile(node) { - var options = context.getCompilerOptions(); - if (node.isDeclarationFile - || useDefineForClassFields && ts.getEmitScriptTarget(options) >= 9) { + if (node.isDeclarationFile || !shouldTransformAnything) { return node; } var visited = ts.visitEachChild(node, visitor, context); ts.addEmitHelpers(visited, context.readEmitHelpers()); return visited; } - function visitorWorker(node, valueIsDiscarded) { - if (node.transformFlags & 16777216) { - switch (node.kind) { - case 226: - case 257: - return visitClassLike(node); - case 167: - return visitPropertyDeclaration(node); - case 237: - return visitVariableStatement(node); - case 80: - return visitPrivateIdentifier(node); - case 170: - return visitClassStaticBlockDeclaration(node); - } + function visitor(node) { + if (!(node.transformFlags & 16777216) && + !(node.transformFlags & 134234112)) { + return node; } - if (node.transformFlags & 16777216 || - node.transformFlags & 134217728 && - shouldTransformSuperInStaticInitializers && - currentStaticPropertyDeclarationOrStaticBlock && - currentClassLexicalEnvironment) { - switch (node.kind) { - case 219: - case 220: - return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); - case 221: - return visitBinaryExpression(node, valueIsDiscarded); - case 208: - return visitCallExpression(node); - case 210: - return visitTaggedTemplateExpression(node); - case 206: - return visitPropertyAccessExpression(node); - case 207: - return visitElementAccessExpression(node); - case 238: - return visitExpressionStatement(node); - case 242: - return visitForStatement(node); - case 256: - case 213: - case 171: - case 169: - case 172: - case 173: { - var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = undefined; - var result = ts.visitEachChild(node, visitor, context); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; - return result; - } + switch (node.kind) { + case 127: + return shouldTransformAutoAccessors ? undefined : node; + case 260: + return visitClassDeclaration(node); + case 228: + return visitClassExpression(node); + case 172: + return visitClassStaticBlockDeclaration(node); + case 169: + return visitPropertyDeclaration(node); + case 240: + return visitVariableStatement(node); + case 80: + return visitPrivateIdentifier(node); + case 208: + return visitPropertyAccessExpression(node); + case 209: + return visitElementAccessExpression(node); + case 221: + case 222: + return visitPreOrPostfixUnaryExpression(node, false); + case 223: + return visitBinaryExpression(node, false); + case 210: + return visitCallExpression(node); + case 241: + return visitExpressionStatement(node); + case 212: + return visitTaggedTemplateExpression(node); + case 245: + return visitForStatement(node); + case 259: + case 215: + case 173: + case 171: + case 174: + case 175: { + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd(undefined, fallbackVisitor, node); } + default: + return fallbackVisitor(node); } + } + function fallbackVisitor(node) { return ts.visitEachChild(node, visitor, context); } function discardedValueVisitor(node) { - return visitorWorker(node, true); - } - function visitor(node) { - return visitorWorker(node, false); + switch (node.kind) { + case 221: + case 222: + return visitPreOrPostfixUnaryExpression(node, true); + case 223: + return visitBinaryExpression(node, true); + default: + return visitor(node); + } } function heritageClauseVisitor(node) { switch (node.kind) { - case 291: + case 294: return ts.visitEachChild(node, heritageClauseVisitor, context); - case 228: - return visitExpressionWithTypeArguments(node); + case 230: + return visitExpressionWithTypeArgumentsInHeritageClause(node); + default: + return visitor(node); } - return visitor(node); } - function visitorDestructuringTarget(node) { + function assignmentTargetVisitor(node) { switch (node.kind) { - case 205: - case 204: + case 207: + case 206: return visitAssignmentPattern(node); default: return visitor(node); } } + function classElementVisitor(node) { + switch (node.kind) { + case 173: + return visitConstructorDeclaration(node); + case 174: + case 175: + case 171: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd(undefined, visitMethodOrAccessorDeclaration, node); + case 169: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd(undefined, visitPropertyDeclaration, node); + case 164: + return visitComputedPropertyName(node); + case 237: + return node; + default: + return visitor(node); + } + } + function accessorFieldResultVisitor(node) { + switch (node.kind) { + case 169: + return transformFieldInitializer(node); + case 174: + case 175: + return classElementVisitor(node); + default: + ts.Debug.assertMissingNode(node, "Expected node to either be a PropertyDeclaration, GetAccessorDeclaration, or SetAccessorDeclaration"); + break; + } + } function visitPrivateIdentifier(node) { if (!shouldTransformPrivateElementsOrClassStaticBlocks) { return node; @@ -79535,38 +80278,18 @@ var ts; } return ts.setOriginalNode(factory.createIdentifier(""), node); } - function visitPrivateIdentifierInInExpression(node) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return node; - } - var privId = node.left; - ts.Debug.assertNode(privId, ts.isPrivateIdentifier); - ts.Debug.assert(node.operatorToken.kind === 101); - var info = accessPrivateIdentifier(privId); + function isPrivateIdentifierInExpression(node) { + return ts.isPrivateIdentifier(node.left) + && node.operatorToken.kind === 101; + } + function transformPrivateIdentifierInInExpression(node) { + var info = accessPrivateIdentifier(node.left); if (info) { var receiver = ts.visitNode(node.right, visitor, ts.isExpression); return ts.setOriginalNode(context.getEmitHelperFactory().createClassPrivateFieldInHelper(info.brandCheckIdentifier, receiver), node); } return ts.visitEachChild(node, visitor, context); } - function classElementVisitor(node) { - switch (node.kind) { - case 171: - return undefined; - case 172: - case 173: - case 169: - return visitMethodOrAccessorDeclaration(node); - case 167: - return visitPropertyDeclaration(node); - case 162: - return visitComputedPropertyName(node); - case 234: - return node; - default: - return visitor(node); - } - } function visitVariableStatement(node) { var savedPendingStatements = pendingStatements; pendingStatements = []; @@ -79576,15 +80299,24 @@ var ts; pendingStatements = savedPendingStatements; return statement; } - function visitComputedPropertyName(name) { - var node = ts.visitEachChild(name, visitor, context); + function visitComputedPropertyName(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); if (ts.some(pendingExpressions)) { - var expressions = pendingExpressions; - expressions.push(node.expression); - pendingExpressions = []; - node = factory.updateComputedPropertyName(node, factory.inlineExpressions(expressions)); + if (ts.isParenthesizedExpression(expression)) { + expression = factory.updateParenthesizedExpression(expression, factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression.expression], false))); + } + else { + expression = factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression], false)); + } + pendingExpressions = undefined; } - return node; + return factory.updateComputedPropertyName(node, expression); + } + function visitConstructorDeclaration(node) { + if (currentClassContainer) { + return transformConstructor(node, currentClassContainer); + } + return fallbackVisitor(node); } function visitMethodOrAccessorDeclaration(node) { ts.Debug.assert(!ts.hasDecorators(node)); @@ -79598,10 +80330,17 @@ var ts; } var functionName = getHoistedFunctionName(node); if (functionName) { - getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return ts.isModifier(m) && !ts.isStaticModifier(m); }), node.asteriskToken, functionName, undefined, ts.visitParameterList(node.parameters, classElementVisitor, context), undefined, ts.visitFunctionBody(node.body, classElementVisitor, context)))); + getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return ts.isModifier(m) && !ts.isStaticModifier(m) && !ts.isAccessorModifier(m); }), node.asteriskToken, functionName, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context)))); } return undefined; } + function setCurrentStaticPropertyDeclarationOrStaticBlockAnd(current, visitor, arg) { + var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; + currentStaticPropertyDeclarationOrStaticBlock = current; + var result = visitor(arg); + currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; + return result; + } function getHoistedFunctionName(node) { ts.Debug.assert(ts.isPrivateIdentifier(node.name)); var info = accessPrivateIdentifier(node.name); @@ -79618,38 +80357,80 @@ var ts; } } } - function visitPropertyDeclaration(node) { - ts.Debug.assert(!ts.hasDecorators(node)); - if (ts.isPrivateIdentifier(node.name)) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - if (ts.isStatic(node)) { - return ts.visitEachChild(node, visitor, context); - } - return factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, undefined, undefined, undefined); - } + function transformAutoAccessor(node) { + ts.Debug.assertEachNode(node.modifiers, ts.isModifier); + var commentRange = ts.getCommentRange(node); + var sourceMapRange = ts.getSourceMapRange(node); + var name = node.name; + var getterName = name; + var setterName = name; + if (ts.isComputedPropertyName(name) && !ts.isSimpleInlineableExpression(name.expression)) { + var temp = factory.createTempVariable(hoistVariableDeclaration); + ts.setSourceMapRange(temp, name.expression); + var expression = ts.visitNode(name.expression, visitor, ts.isExpression); + var assignment = factory.createAssignment(temp, expression); + ts.setSourceMapRange(assignment, name.expression); + getterName = factory.updateComputedPropertyName(name, factory.inlineExpressions([assignment, temp])); + setterName = factory.updateComputedPropertyName(name, temp); + } + var backingField = ts.createAccessorPropertyBackingField(factory, node, node.modifiers, node.initializer); + ts.setOriginalNode(backingField, node); + ts.setEmitFlags(backingField, 1536); + ts.setSourceMapRange(backingField, sourceMapRange); + var getter = ts.createAccessorPropertyGetRedirector(factory, node, node.modifiers, getterName); + ts.setOriginalNode(getter, node); + ts.setCommentRange(getter, commentRange); + ts.setSourceMapRange(getter, sourceMapRange); + var setter = ts.createAccessorPropertySetRedirector(factory, node, node.modifiers, setterName); + ts.setOriginalNode(setter, node); + ts.setEmitFlags(setter, 1536); + ts.setSourceMapRange(setter, sourceMapRange); + return ts.visitArray([backingField, getter, setter], accessorFieldResultVisitor, ts.isClassElement); + } + function transformPrivateFieldInitializer(node) { + if (shouldTransformPrivateElementsOrClassStaticBlocks) { var info = accessPrivateIdentifier(node.name); ts.Debug.assert(info, "Undeclared private name for property declaration."); - if (!info.isValid) { - return node; + return info.isValid ? undefined : node; + } + if (shouldTransformInitializersUsingSet && !ts.isStatic(node)) { + return factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, undefined, undefined, undefined); + } + return ts.visitEachChild(node, visitor, context); + } + function transformPublicFieldInitializer(node) { + if (shouldTransformInitializers) { + var expr = getPropertyNameExpressionIfNeeded(node.name, !!node.initializer || useDefineForClassFields); + if (expr) { + getPendingExpressions().push(expr); } - } - var expr = getPropertyNameExpressionIfNeeded(node.name, !!node.initializer || useDefineForClassFields); - if (expr && !ts.isSimpleInlineableExpression(expr)) { - getPendingExpressions().push(expr); - } - if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks && !useDefineForClassFields) { - var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); - if (initializerStatement) { - var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); - ts.setOriginalNode(staticBlock, node); - ts.setCommentRange(staticBlock, node); - ts.setCommentRange(initializerStatement, { pos: -1, end: -1 }); - ts.setSyntheticLeadingComments(initializerStatement, undefined); - ts.setSyntheticTrailingComments(initializerStatement, undefined); - return staticBlock; + if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks) { + var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); + if (initializerStatement) { + var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); + ts.setOriginalNode(staticBlock, node); + ts.setCommentRange(staticBlock, node); + ts.setCommentRange(initializerStatement, { pos: -1, end: -1 }); + ts.setSyntheticLeadingComments(initializerStatement, undefined); + ts.setSyntheticTrailingComments(initializerStatement, undefined); + return staticBlock; + } } + return undefined; } - return undefined; + return ts.visitEachChild(node, classElementVisitor, context); + } + function transformFieldInitializer(node) { + ts.Debug.assert(!ts.hasDecorators(node), "Decorators should already have been transformed and elided."); + return ts.isPrivateIdentifierClassElementDeclaration(node) ? + transformPrivateFieldInitializer(node) : + transformPublicFieldInitializer(node); + } + function visitPropertyDeclaration(node) { + if (shouldTransformAutoAccessors && ts.isAutoAccessorPropertyDeclaration(node)) { + return transformAutoAccessor(node); + } + return transformFieldInitializer(node); } function createPrivateIdentifierAccess(info, receiver) { return createPrivateIdentifierAccessHelper(info, ts.visitNode(receiver, visitor, ts.isExpression)); @@ -79711,9 +80492,11 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitPreOrPostfixUnaryExpression(node, valueIsDiscarded) { - if (node.operator === 45 || node.operator === 46) { + if (node.operator === 45 || + node.operator === 46) { var operand = ts.skipParentheses(node.operand); - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(operand)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(operand)) { var info = void 0; if (info = accessPrivateIdentifier(operand.name)) { var receiver = ts.visitNode(operand.expression, visitor, ts.isExpression); @@ -79794,7 +80577,8 @@ var ts; return { readExpression: readExpression, initializeExpression: initializeExpression }; } function visitCallExpression(node) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) { var _a = factory.createCallBinding(node.expression, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; if (ts.isCallChain(node)) { return factory.updateCallChain(node, factory.createPropertyAccessChain(ts.visitNode(target, visitor), node.questionDotToken, "call"), undefined, undefined, __spreadArray([ts.visitNode(thisArg, visitor, ts.isExpression)], ts.visitNodes(node.arguments, visitor, ts.isExpression), true)); @@ -79813,7 +80597,8 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitTaggedTemplateExpression(node) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) { var _a = factory.createCallBinding(node.tag, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; return factory.updateTaggedTemplateExpression(node, factory.createCallExpression(factory.createPropertyAccessExpression(ts.visitNode(target, visitor), "bind"), undefined, [ts.visitNode(thisArg, visitor, ts.isExpression)]), undefined, ts.visitNode(node.template, visitor, ts.isTemplateLiteral)); } @@ -79834,11 +80619,8 @@ var ts; classLexicalEnvironmentMap.set(ts.getOriginalNodeId(node), currentClassLexicalEnvironment); } startLexicalEnvironment(); - var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = node; - var statements = ts.visitNodes(node.body.statements, visitor, ts.isStatement); + var statements = setCurrentStaticPropertyDeclarationOrStaticBlockAnd(node, function (statements) { return ts.visitNodes(statements, visitor, ts.isStatement); }, node.body.statements); statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; var iife = factory.createImmediatelyInvokedArrowFunction(statements); ts.setOriginalNode(iife, node); ts.setTextRange(iife, node); @@ -79850,7 +80632,7 @@ var ts; if (ts.isDestructuringAssignment(node)) { var savedPendingExpressions = pendingExpressions; pendingExpressions = undefined; - node = factory.updateBinaryExpression(node, ts.visitNode(node.left, visitorDestructuringTarget), node.operatorToken, ts.visitNode(node.right, visitor)); + node = factory.updateBinaryExpression(node, ts.visitNode(node.left, assignmentTargetVisitor), node.operatorToken, ts.visitNode(node.right, visitor)); var expr = ts.some(pendingExpressions) ? factory.inlineExpressions(ts.compact(__spreadArray(__spreadArray([], pendingExpressions, true), [node], false))) : node; @@ -79858,7 +80640,8 @@ var ts; return expr; } if (ts.isAssignmentExpression(node)) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.left)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.left)) { var info = accessPrivateIdentifier(node.left.name); if (info) { return ts.setTextRange(ts.setOriginalNode(createPrivateIdentifierAssignment(info, node.left.expression, node.right, node.operatorToken.kind), node), node); @@ -79907,8 +80690,9 @@ var ts; } } } - if (node.operatorToken.kind === 101 && ts.isPrivateIdentifier(node.left)) { - return visitPrivateIdentifierInInExpression(node); + if (shouldTransformPrivateElementsOrClassStaticBlocks && + isPrivateIdentifierInExpression(node)) { + return transformPrivateIdentifierInInExpression(node); } return ts.visitEachChild(node, visitor, context); } @@ -79932,33 +80716,6 @@ var ts; ts.Debug.assertNever(info, "Unknown private element type"); } } - function visitClassLike(node) { - if (!ts.forEach(node.members, doesClassElementNeedTransform)) { - return ts.visitEachChild(node, visitor, context); - } - var savedPendingExpressions = pendingExpressions; - pendingExpressions = undefined; - startClassLexicalEnvironment(); - if (shouldTransformPrivateElementsOrClassStaticBlocks) { - var name = ts.getNameOfDeclaration(node); - if (name && ts.isIdentifier(name)) { - getPrivateIdentifierEnvironment().className = ts.idText(name); - } - var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); - if (ts.some(privateInstanceMethodsAndAccessors)) { - getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); - } - } - var result = ts.isClassDeclaration(node) ? - visitClassDeclaration(node) : - visitClassExpression(node); - endClassLexicalEnvironment(); - pendingExpressions = savedPendingExpressions; - return result; - } - function doesClassElementNeedTransform(node) { - return ts.isPropertyDeclaration(node) || ts.isClassStaticBlockDeclaration(node) || (shouldTransformPrivateElementsOrClassStaticBlocks && node.name && ts.isPrivateIdentifier(node.name)); - } function getPrivateInstanceMethodsAndAccessors(node) { return ts.filter(node.members, ts.isNonStaticMethodOrAccessorWithPrivateName); } @@ -79972,7 +80729,7 @@ var ts; var member = _a[_i]; if (!ts.isStatic(member)) continue; - if (member.name && ts.isPrivateIdentifier(member.name) && shouldTransformPrivateElementsOrClassStaticBlocks) { + if (member.name && (ts.isPrivateIdentifier(member.name) || ts.isAutoAccessorPropertyDeclaration(member)) && shouldTransformPrivateElementsOrClassStaticBlocks) { facts |= 2; } if (ts.isPropertyDeclaration(member) || ts.isClassStaticBlockDeclaration(member)) { @@ -79991,7 +80748,7 @@ var ts; } return facts; } - function visitExpressionWithTypeArguments(node) { + function visitExpressionWithTypeArgumentsInHeritageClause(node) { var facts = (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.facts) || 0; if (facts & 4) { var temp = factory.createTempVariable(hoistVariableDeclaration, true); @@ -80000,7 +80757,22 @@ var ts; } return ts.visitEachChild(node, visitor, context); } - function visitClassDeclaration(node) { + function visitInNewClassLexicalEnvironment(node, visitor) { + var savedCurrentClassContainer = currentClassContainer; + var savedPendingExpressions = pendingExpressions; + currentClassContainer = node; + pendingExpressions = undefined; + startClassLexicalEnvironment(); + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + var name = ts.getNameOfDeclaration(node); + if (name && ts.isIdentifier(name)) { + getPrivateIdentifierEnvironment().className = name; + } + var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); + if (ts.some(privateInstanceMethodsAndAccessors)) { + getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); + } + } var facts = getClassFacts(node); if (facts) { getClassLexicalEnvironment().facts = facts; @@ -80008,41 +80780,51 @@ var ts; if (facts & 8) { enableSubstitutionForClassStaticThisOrSuperReference(); } + var result = visitor(node, facts); + endClassLexicalEnvironment(); + currentClassContainer = savedCurrentClassContainer; + pendingExpressions = savedPendingExpressions; + return result; + } + function visitClassDeclaration(node) { + return visitInNewClassLexicalEnvironment(node, visitClassDeclarationInNewClassLexicalEnvironment); + } + function visitClassDeclarationInNewClassLexicalEnvironment(node, facts) { var pendingClassReferenceAssignment; if (facts & 2) { var temp = factory.createTempVariable(hoistVariableDeclaration, true); getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); pendingClassReferenceAssignment = factory.createAssignment(temp, factory.getInternalName(node)); } - var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104); - var statements = [ - factory.updateClassDeclaration(node, node.modifiers, node.name, undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)) - ]; + var modifiers = ts.visitNodes(node.modifiers, visitor, ts.isModifierLike); + var heritageClauses = ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classDecl = factory.updateClassDeclaration(node, modifiers, node.name, undefined, heritageClauses, members); + var statements = []; + if (prologue) { + statements.push(factory.createExpressionStatement(prologue)); + } + statements.push(classDecl); if (pendingClassReferenceAssignment) { getPendingExpressions().unshift(pendingClassReferenceAssignment); } if (ts.some(pendingExpressions)) { statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))); } - var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node); - if (ts.some(staticProperties)) { - addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + if (shouldTransformInitializersUsingSet || shouldTransformPrivateElementsOrClassStaticBlocks) { + var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node); + if (ts.some(staticProperties)) { + addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + } } return statements; } function visitClassExpression(node) { - var facts = getClassFacts(node); - if (facts) { - getClassLexicalEnvironment().facts = facts; - } - if (facts & 8) { - enableSubstitutionForClassStaticThisOrSuperReference(); - } + return visitInNewClassLexicalEnvironment(node, visitClassExpressionInNewClassLexicalEnvironment); + } + function visitClassExpressionInNewClassLexicalEnvironment(node, facts) { var isDecoratedClassDeclaration = !!(facts & 1); var staticPropertiesOrClassStaticBlocks = ts.getStaticPropertiesAndClassStaticBlock(node); - var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104); var isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 16777216; var temp; function createClassTempVar() { @@ -80055,8 +80837,20 @@ var ts; temp = createClassTempVar(); getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); } - var classExpression = factory.updateClassExpression(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)); - var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(staticPropertiesOrClassStaticBlocks, function (p) { return ts.isClassStaticBlockDeclaration(p) || !!p.initializer || ts.isPrivateIdentifier(p.name); }); + var modifiers = ts.visitNodes(node.modifiers, visitor, ts.isModifierLike); + var heritageClauses = ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classExpression = factory.updateClassExpression(node, modifiers, node.name, undefined, heritageClauses, members); + var expressions = []; + if (prologue) { + expressions.push(prologue); + } + var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && + ts.some(staticPropertiesOrClassStaticBlocks, function (node) { + return ts.isClassStaticBlockDeclaration(node) || + ts.isPrivateIdentifierClassElementDeclaration(node) || + shouldTransformInitializers && ts.isInitializedProperty(node); + }); if (hasTransformableStatics || ts.some(pendingExpressions)) { if (isDecoratedClassDeclaration) { ts.Debug.assertIsDefined(pendingStatements, "Decorated classes transformed by TypeScript are expected to be within a variable declaration."); @@ -80067,12 +80861,16 @@ var ts; addPropertyOrClassStaticBlockStatements(pendingStatements, staticPropertiesOrClassStaticBlocks, factory.getInternalName(node)); } if (temp) { - return factory.inlineExpressions([factory.createAssignment(temp, classExpression), temp]); + expressions.push(ts.startOnNewLine(factory.createAssignment(temp, classExpression)), ts.startOnNewLine(temp)); + } + else { + expressions.push(classExpression); + if (prologue) { + ts.startOnNewLine(classExpression); + } } - return classExpression; } else { - var expressions = []; temp || (temp = createClassTempVar()); if (isClassWithConstructorReference) { enableSubstitutionForClassAliases(); @@ -80085,43 +80883,70 @@ var ts; ts.addRange(expressions, ts.map(pendingExpressions, ts.startOnNewLine)); ts.addRange(expressions, generateInitializedPropertyExpressionsOrClassStaticBlock(staticPropertiesOrClassStaticBlocks, temp)); expressions.push(ts.startOnNewLine(temp)); - return factory.inlineExpressions(expressions); } } - return classExpression; + else { + expressions.push(classExpression); + if (prologue) { + ts.startOnNewLine(classExpression); + } + } + return factory.inlineExpressions(expressions); } function visitClassStaticBlockDeclaration(node) { if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return ts.visitEachChild(node, classElementVisitor, context); + return ts.visitEachChild(node, visitor, context); } return undefined; } - function transformClassMembers(node, isDerivedClass) { - var members = []; + function transformClassMembers(node) { if (shouldTransformPrivateElementsOrClassStaticBlocks) { for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; if (ts.isPrivateIdentifierClassElementDeclaration(member)) { - addPrivateIdentifierToEnvironment(member); + addPrivateIdentifierToEnvironment(member, member.name, addPrivateIdentifierClassElementToEnvironment); } } if (ts.some(getPrivateInstanceMethodsAndAccessors(node))) { createBrandCheckWeakSetForPrivateMethods(); } + if (shouldTransformAutoAccessors) { + for (var _b = 0, _c = node.members; _b < _c.length; _b++) { + var member = _c[_b]; + if (ts.isAutoAccessorPropertyDeclaration(member)) { + var storageName = factory.getGeneratedPrivateNameForNode(member.name, undefined, "_accessor_storage"); + addPrivateIdentifierToEnvironment(member, storageName, addPrivateIdentifierPropertyDeclarationToEnvironment); + } + } + } } - var constructor = transformConstructor(node, isDerivedClass); - var visitedMembers = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement); - if (constructor) { - members.push(constructor); + var members = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement); + var syntheticConstructor; + if (!ts.some(members, ts.isConstructorDeclaration)) { + syntheticConstructor = transformConstructor(undefined, node); } + var prologue; + var syntheticStaticBlock; if (!shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(pendingExpressions)) { - members.push(factory.createClassStaticBlockDeclaration(factory.createBlock([ - factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)) - ]))); + var statement = factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)); + if (statement.transformFlags & 134234112) { + var temp = factory.createTempVariable(hoistVariableDeclaration); + var arrow = factory.createArrowFunction(undefined, undefined, [], undefined, undefined, factory.createBlock([statement])); + prologue = factory.createAssignment(temp, arrow); + statement = factory.createExpressionStatement(factory.createCallExpression(temp, undefined, [])); + } + var block = factory.createBlock([statement]); + syntheticStaticBlock = factory.createClassStaticBlockDeclaration(block); pendingExpressions = undefined; } - ts.addRange(members, visitedMembers); - return ts.setTextRange(factory.createNodeArray(members), node.members); + if (syntheticConstructor || syntheticStaticBlock) { + var membersArray = void 0; + membersArray = ts.append(membersArray, syntheticConstructor); + membersArray = ts.append(membersArray, syntheticStaticBlock); + membersArray = ts.addRange(membersArray, members); + members = ts.setTextRange(factory.createNodeArray(membersArray), node.members); + } + return { members: members, prologue: prologue }; } function createBrandCheckWeakSetForPrivateMethods() { var weakSetName = getPrivateIdentifierEnvironment().weakSetName; @@ -80129,32 +80954,37 @@ var ts; getPendingExpressions().push(factory.createAssignment(weakSetName, factory.createNewExpression(factory.createIdentifier("WeakSet"), undefined, []))); } function isClassElementThatRequiresConstructorStatement(member) { - if (ts.isStatic(member) || ts.hasSyntacticModifier(ts.getOriginalNode(member), 128)) { + if (ts.isStatic(member) || ts.hasAbstractModifier(ts.getOriginalNode(member))) { return false; } - if (useDefineForClassFields) { - return languageVersion < 9; - } - return ts.isInitializedProperty(member) || shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member); + return shouldTransformInitializersUsingDefine && ts.isPropertyDeclaration(member) || + shouldTransformInitializersUsingSet && ts.isInitializedProperty(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && shouldTransformAutoAccessors && ts.isAutoAccessorPropertyDeclaration(member); } - function transformConstructor(node, isDerivedClass) { - var constructor = ts.visitNode(ts.getFirstConstructorWithBody(node), visitor, ts.isConstructorDeclaration); - var elements = node.members.filter(isClassElementThatRequiresConstructorStatement); - if (!ts.some(elements)) { + function transformConstructor(constructor, container) { + constructor = ts.visitNode(constructor, visitor, ts.isConstructorDeclaration); + if (!ts.some(container.members, isClassElementThatRequiresConstructorStatement)) { return constructor; } + var extendsClauseElement = ts.getEffectiveBaseTypeNode(container); + var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104); var parameters = ts.visitParameterList(constructor ? constructor.parameters : undefined, visitor, context); - var body = transformConstructorBody(node, constructor, isDerivedClass); + var body = transformConstructorBody(container, constructor, isDerivedClass); if (!body) { - return undefined; + return constructor; } - return ts.startOnNewLine(ts.setOriginalNode(ts.setTextRange(factory.createConstructorDeclaration(undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || node), constructor)); + if (constructor) { + ts.Debug.assert(parameters); + return factory.updateConstructorDeclaration(constructor, undefined, parameters, body); + } + return ts.startOnNewLine(ts.setOriginalNode(ts.setTextRange(factory.createConstructorDeclaration(undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || container), constructor)); } function transformConstructorBody(node, constructor, isDerivedClass) { - var _a; + var _a, _b; var properties = ts.getProperties(node, false, false); if (!useDefineForClassFields) { - properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name); }); + properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name) || ts.hasAccessorModifier(property); }); } var privateMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); var needsConstructorBody = ts.some(properties) || ts.some(privateMethodsAndAccessors); @@ -80187,8 +81017,8 @@ var ts; statements = statements.filter(function (statement) { return !ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor); }); } else { - for (var _i = 0, _b = constructor.body.statements; _i < _b.length; _i++) { - var statement = _b[_i]; + for (var _i = 0, _c = constructor.body.statements; _i < _c.length; _i++) { + var statement = _c[_i]; if (ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) { parameterPropertyDeclarationCount++; } @@ -80215,7 +81045,13 @@ var ts; ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue)); } statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); - return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), constructor ? constructor.body.statements : node.members), true), constructor ? constructor.body : undefined); + if (statements.length === 0 && !constructor) { + return undefined; + } + var multiLine = (constructor === null || constructor === void 0 ? void 0 : constructor.body) && constructor.body.statements.length >= statements.length ? + (_b = constructor.body.multiLine) !== null && _b !== void 0 ? _b : statements.length > 0 : + statements.length > 0; + return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), constructor ? constructor.body.statements : node.members), multiLine), constructor ? constructor.body : undefined); function visitBodyStatement(statement) { if (useDefineForClassFields && ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) { return undefined; @@ -80244,9 +81080,10 @@ var ts; return undefined; } var statement = factory.createExpressionStatement(expression); + ts.setOriginalNode(statement, property); + ts.addEmitFlags(statement, ts.getEmitFlags(property) & 1536); ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)); ts.setCommentRange(statement, property); - ts.setOriginalNode(statement, property); ts.setSyntheticLeadingComments(expression, undefined); ts.setSyntheticTrailingComments(expression, undefined); return statement; @@ -80260,9 +81097,10 @@ var ts; continue; } ts.startOnNewLine(expression); + ts.setOriginalNode(expression, property); + ts.addEmitFlags(expression, ts.getEmitFlags(property) & 1536); ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)); ts.setCommentRange(expression, property); - ts.setOriginalNode(expression, property); expressions.push(expression); } return expressions; @@ -80281,9 +81119,11 @@ var ts; function transformPropertyWorker(property, receiver) { var _a; var emitAssignment = !useDefineForClassFields; - var propertyName = ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression) - ? factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) - : property.name; + var propertyName = ts.hasAccessorModifier(property) ? + factory.getGeneratedPrivateNameForNode(property.name) : + ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression) ? + factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) : + property.name; if (ts.hasStaticModifier(property)) { currentStaticPropertyDeclarationOrStaticBlock = property; } @@ -80310,7 +81150,7 @@ var ts; return undefined; } var propertyOriginalNode = ts.getOriginalNode(property); - if (ts.hasSyntacticModifier(propertyOriginalNode, 128)) { + if (ts.hasSyntacticModifier(propertyOriginalNode, 256)) { return undefined; } var initializer = property.initializer || emitAssignment ? (_a = ts.visitNode(property.initializer, visitor, ts.isExpression)) !== null && _a !== void 0 ? _a : factory.createVoidZero() @@ -80339,14 +81179,14 @@ var ts; if ((enabledSubstitutions & 2) === 0) { enabledSubstitutions |= 2; context.enableSubstitution(108); - context.enableEmitNotification(256); - context.enableEmitNotification(213); - context.enableEmitNotification(171); - context.enableEmitNotification(172); + context.enableEmitNotification(259); + context.enableEmitNotification(215); context.enableEmitNotification(173); + context.enableEmitNotification(174); + context.enableEmitNotification(175); + context.enableEmitNotification(171); context.enableEmitNotification(169); - context.enableEmitNotification(167); - context.enableEmitNotification(162); + context.enableEmitNotification(164); } } function addMethodStatements(statements, methods, receiver) { @@ -80378,12 +81218,12 @@ var ts; } } switch (node.kind) { - case 213: + case 215: if (ts.isArrowFunction(original) || ts.getEmitFlags(node) & 262144) { break; } - case 256: - case 171: { + case 259: + case 173: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentClassLexicalEnvironment = undefined; @@ -80393,10 +81233,10 @@ var ts; currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; return; } - case 172: - case 173: - case 169: - case 167: { + case 174: + case 175: + case 171: + case 169: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentComputedPropertyNameClassLexicalEnvironment = currentClassLexicalEnvironment; @@ -80406,7 +81246,7 @@ var ts; currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; return; } - case 162: { + case 164: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; @@ -80504,148 +81344,137 @@ var ts; function getPrivateIdentifierEnvironment() { var lex = getClassLexicalEnvironment(); lex.privateIdentifierEnvironment || (lex.privateIdentifierEnvironment = { - className: "", - identifiers: new ts.Map() + className: undefined, + weakSetName: undefined, + identifiers: undefined, + generatedIdentifiers: undefined, }); return lex.privateIdentifierEnvironment; } function getPendingExpressions() { - return pendingExpressions || (pendingExpressions = []); + return pendingExpressions !== null && pendingExpressions !== void 0 ? pendingExpressions : (pendingExpressions = []); } - function addPrivateIdentifierToEnvironment(node) { - var _a; - var text = ts.getTextOfPropertyName(node.name); - var lex = getClassLexicalEnvironment(); - var classConstructor = lex.classConstructor; - var privateEnv = getPrivateIdentifierEnvironment(); - var weakSetName = privateEnv.weakSetName; - var assignmentExpressions = []; - var privateName = node.name.escapedText; - var previousInfo = privateEnv.identifiers.get(privateName); - var isValid = !isReservedPrivateName(node.name) && previousInfo === undefined; - if (ts.hasStaticModifier(node)) { - ts.Debug.assert(classConstructor, "weakSetName should be set in private identifier environment"); - if (ts.isPropertyDeclaration(node)) { - var variableName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "f", - variableName: variableName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - else if (ts.isMethodDeclaration(node)) { - var functionName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "m", - methodName: functionName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - else if (ts.isGetAccessorDeclaration(node)) { - var getterName = createHoistedVariableForPrivateName(text + "_get", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" && previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a", - getterName: getterName, - setterName: undefined, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - } - else if (ts.isSetAccessorDeclaration(node)) { - var setterName = createHoistedVariableForPrivateName(text + "_set", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" && previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a", - getterName: undefined, - setterName: setterName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - } - else { - ts.Debug.assertNever(node, "Unknown class element type."); - } + function addPrivateIdentifierClassElementToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + if (ts.isAutoAccessorPropertyDeclaration(node)) { + addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); } else if (ts.isPropertyDeclaration(node)) { - var weakMapName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "f", - brandCheckIdentifier: weakMapName, - isStatic: false, - variableName: undefined, - isValid: isValid, - }); - assignmentExpressions.push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), undefined, []))); + addPrivateIdentifierPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); } else if (ts.isMethodDeclaration(node)) { - ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); - privateEnv.identifiers.set(privateName, { - kind: "m", - methodName: createHoistedVariableForPrivateName(text, node), - brandCheckIdentifier: weakSetName, - isStatic: false, + addPrivateIdentifierMethodDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isGetAccessorDeclaration(node)) { + addPrivateIdentifierGetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isSetAccessorDeclaration(node)) { + addPrivateIdentifierSetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + } + function addPrivateIdentifierPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + if (isStatic) { + ts.Debug.assert(lex.classConstructor, "classConstructor should be set in private identifier environment"); + var variableName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { + kind: "f", + brandCheckIdentifier: lex.classConstructor, + variableName: variableName, + isStatic: true, isValid: isValid, }); } - else if (ts.isAccessor(node)) { - ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); - if (ts.isGetAccessor(node)) { - var getterName = createHoistedVariableForPrivateName(text + "_get", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" && !previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a", - getterName: getterName, - setterName: undefined, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid: isValid, - }); - } - } - else { - var setterName = createHoistedVariableForPrivateName(text + "_set", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" && !previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a", - getterName: undefined, - setterName: setterName, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid: isValid, - }); - } - } + else { + var weakMapName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { + kind: "f", + brandCheckIdentifier: weakMapName, + variableName: undefined, + isStatic: false, + isValid: isValid, + }); + getPendingExpressions().push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), undefined, []))); + } + } + function addPrivateIdentifierMethodDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var methodName = createHoistedVariableForPrivateName(name); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "m", + methodName: methodName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + function addPrivateIdentifierGetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" && previousInfo.isStatic === isStatic && !previousInfo.getterName) { + previousInfo.getterName = getterName; } else { - ts.Debug.assertNever(node, "Unknown class element type."); + setPrivateIdentifier(privateEnv, name, { + kind: "a", + getterName: getterName, + setterName: undefined, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); } - (_a = getPendingExpressions()).push.apply(_a, assignmentExpressions); } - function createHoistedVariableForClass(name, node) { + function addPrivateIdentifierSetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" && previousInfo.isStatic === isStatic && !previousInfo.setterName) { + previousInfo.setterName = setterName; + } + else { + setPrivateIdentifier(privateEnv, name, { + kind: "a", + getterName: undefined, + setterName: setterName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + } + function addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "a", + getterName: getterName, + setterName: setterName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + function addPrivateIdentifierToEnvironment(node, name, addDeclaration) { + var lex = getClassLexicalEnvironment(); + var privateEnv = getPrivateIdentifierEnvironment(); + var previousInfo = getPrivateIdentifier(privateEnv, name); + var isStatic = ts.hasStaticModifier(node); + var isValid = !isReservedPrivateName(name) && previousInfo === undefined; + addDeclaration(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + function createHoistedVariableForClass(name, node, suffix) { var className = getPrivateIdentifierEnvironment().className; - var prefix = className ? "_".concat(className) : ""; - var identifier = factory.createUniqueName("".concat(prefix, "_").concat(name), 16); + var prefix = className ? { prefix: "_", node: className, suffix: "_" } : "_"; + var identifier = typeof name === "object" ? factory.getGeneratedNameForNode(name, 16 | 8, prefix, suffix) : + typeof name === "string" ? factory.createUniqueName(name, 16, prefix, suffix) : + factory.createTempVariable(undefined, true, prefix, suffix); if (resolver.getNodeCheckFlags(node) & 524288) { addBlockScopedVariable(identifier); } @@ -80654,13 +81483,28 @@ var ts; } return identifier; } - function createHoistedVariableForPrivateName(privateName, node) { - return createHoistedVariableForClass(privateName.substring(1), node.name); + function createHoistedVariableForPrivateName(name, suffix) { + var _a; + var text = ts.tryGetTextOfPropertyName(name); + return createHoistedVariableForClass((_a = text === null || text === void 0 ? void 0 : text.substring(1)) !== null && _a !== void 0 ? _a : name, name, suffix); } function accessPrivateIdentifier(name) { - var _a; + if (ts.isGeneratedPrivateIdentifier(name)) { + return accessGeneratedPrivateIdentifier(name); + } + else { + return accessPrivateIdentifierByText(name.escapedText); + } + } + function accessPrivateIdentifierByText(text) { + return accessPrivateIdentifierWorker(getPrivateIdentifierInfo, text); + } + function accessGeneratedPrivateIdentifier(name) { + return accessPrivateIdentifierWorker(getGeneratedPrivateIdentifierInfo, ts.getNodeForGeneratedName(name)); + } + function accessPrivateIdentifierWorker(getPrivateIdentifierInfo, privateIdentifierKey) { if (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.privateIdentifierEnvironment) { - var info = currentClassLexicalEnvironment.privateIdentifierEnvironment.identifiers.get(name.escapedText); + var info = getPrivateIdentifierInfo(currentClassLexicalEnvironment.privateIdentifierEnvironment, privateIdentifierKey); if (info) { return info; } @@ -80670,9 +81514,11 @@ var ts; if (!env) { continue; } - var info = (_a = env.privateIdentifierEnvironment) === null || _a === void 0 ? void 0 : _a.identifiers.get(name.escapedText); - if (info) { - return info; + if (env.privateIdentifierEnvironment) { + var info = getPrivateIdentifierInfo(env.privateIdentifierEnvironment, privateIdentifierKey); + if (info) { + return info; + } } } return undefined; @@ -80727,7 +81573,7 @@ var ts; } } } - return ts.visitNode(node, visitorDestructuringTarget); + return ts.visitNode(node, assignmentTargetVisitor); } function visitObjectAssignmentTarget(node) { if (ts.isObjectBindingOrAssignmentElement(node) && !ts.isShorthandPropertyAssignment(node)) { @@ -80760,10 +81606,10 @@ var ts; var initializer = ts.getInitializerOfBindingOrAssignmentElement(node); return factory.updatePropertyAssignment(node, ts.visitNode(node.name, visitor, ts.isPropertyName), wrapped ? initializer ? factory.createAssignment(wrapped, ts.visitNode(initializer, visitor)) : wrapped : - ts.visitNode(node.initializer, visitorDestructuringTarget, ts.isExpression)); + ts.visitNode(node.initializer, assignmentTargetVisitor, ts.isExpression)); } if (ts.isSpreadAssignment(node)) { - return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, visitorDestructuringTarget, ts.isExpression)); + return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, assignmentTargetVisitor, ts.isExpression)); } ts.Debug.assert(wrapped === undefined, "Should not have generated a wrapped target"); } @@ -80791,7 +81637,31 @@ var ts; return ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(weakSetName, "add"), undefined, [receiver]); } function isReservedPrivateName(node) { - return node.escapedText === "#constructor"; + return !ts.isGeneratedPrivateIdentifier(node) && node.escapedText === "#constructor"; + } + function getPrivateIdentifier(privateEnv, name) { + return ts.isGeneratedPrivateIdentifier(name) ? + getGeneratedPrivateIdentifierInfo(privateEnv, ts.getNodeForGeneratedName(name)) : + getPrivateIdentifierInfo(privateEnv, name.escapedText); + } + function setPrivateIdentifier(privateEnv, name, info) { + var _a, _b; + if (ts.isGeneratedPrivateIdentifier(name)) { + (_a = privateEnv.generatedIdentifiers) !== null && _a !== void 0 ? _a : (privateEnv.generatedIdentifiers = new ts.Map()); + privateEnv.generatedIdentifiers.set(ts.getNodeForGeneratedName(name), info); + } + else { + (_b = privateEnv.identifiers) !== null && _b !== void 0 ? _b : (privateEnv.identifiers = new ts.Map()); + privateEnv.identifiers.set(name.escapedText, info); + } + } + function getPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.identifiers) === null || _a === void 0 ? void 0 : _a.get(key); + } + function getGeneratedPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.generatedIdentifiers) === null || _a === void 0 ? void 0 : _a.get(key); } })(ts || (ts = {})); var ts; @@ -80827,15 +81697,15 @@ var ts; } function serializeTypeOfNode(node) { switch (node.kind) { - case 167: - case 164: - return serializeTypeNode(node.type); - case 173: - case 172: - return serializeTypeNode(getAccessorTypeNode(node)); - case 257: - case 226: case 169: + case 166: + return serializeTypeNode(node.type); + case 175: + case 174: + return serializeTypeNode(getAccessorTypeNode(node)); + case 260: + case 228: + case 171: return ts.factory.createIdentifier("Function"); default: return ts.factory.createVoidZero(); @@ -80867,7 +81737,7 @@ var ts; return ts.factory.createArrayLiteralExpression(expressions); } function getParametersOfDecoratedDeclaration(node, container) { - if (container && node.kind === 172) { + if (container && node.kind === 174) { var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; if (setAccessor) { return setAccessor.parameters; @@ -80891,65 +81761,65 @@ var ts; node = ts.skipTypeParentheses(node); switch (node.kind) { case 114: - case 153: - case 143: + case 155: + case 144: return ts.factory.createVoidZero(); - case 179: - case 180: + case 181: + case 182: return ts.factory.createIdentifier("Function"); - case 183: - case 184: + case 185: + case 186: return ts.factory.createIdentifier("Array"); - case 177: + case 179: return node.assertsModifier ? ts.factory.createVoidZero() : ts.factory.createIdentifier("Boolean"); - case 133: + case 134: return ts.factory.createIdentifier("Boolean"); - case 198: - case 150: + case 200: + case 152: return ts.factory.createIdentifier("String"); - case 148: + case 149: return ts.factory.createIdentifier("Object"); - case 196: + case 198: return serializeLiteralOfLiteralTypeNode(node.literal); - case 147: + case 148: return ts.factory.createIdentifier("Number"); - case 158: + case 160: return getGlobalConstructor("BigInt", 7); - case 151: + case 153: return getGlobalConstructor("Symbol", 2); - case 178: + case 180: return serializeTypeReferenceNode(node); - case 188: + case 190: return serializeUnionOrIntersectionConstituents(node.types, true); - case 187: - return serializeUnionOrIntersectionConstituents(node.types, false); case 189: + return serializeUnionOrIntersectionConstituents(node.types, false); + case 191: return serializeUnionOrIntersectionConstituents([node.trueType, node.falseType], false); - case 193: - if (node.operator === 145) { + case 195: + if (node.operator === 146) { return serializeTypeNode(node.type); } break; - case 181: + case 183: + case 196: + case 197: + case 184: + case 131: + case 157: case 194: - case 195: - case 182: - case 130: - case 155: - case 192: - case 200: + case 202: + break; + case 315: + case 316: + case 320: + case 321: + case 322: break; - case 312: - case 313: case 317: case 318: case 319: - break; - case 314: - case 315: - case 316: return serializeTypeNode(node.type); default: return ts.Debug.failBadSyntaxKind(node); @@ -80961,7 +81831,7 @@ var ts; case 10: case 14: return ts.factory.createIdentifier("String"); - case 219: { + case 221: { var operand = node.operand; switch (operand.kind) { case 8: @@ -80989,20 +81859,20 @@ var ts; for (var _i = 0, types_22 = types; _i < types_22.length; _i++) { var typeNode = types_22[_i]; typeNode = ts.skipTypeParentheses(typeNode); - if (typeNode.kind === 143) { + if (typeNode.kind === 144) { if (isIntersection) return ts.factory.createVoidZero(); continue; } - if (typeNode.kind === 155) { + if (typeNode.kind === 157) { if (!isIntersection) return ts.factory.createIdentifier("Object"); continue; } - if (typeNode.kind === 130) { + if (typeNode.kind === 131) { return ts.factory.createIdentifier("Object"); } - if (!strictNullChecks && ((ts.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104) || typeNode.kind === 153)) { + if (!strictNullChecks && ((ts.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104) || typeNode.kind === 155)) { continue; } var serializedConstituent = serializeTypeNode(typeNode); @@ -81104,7 +81974,7 @@ var ts; name.original = undefined; ts.setParent(name, ts.getParseTreeNode(currentLexicalScope)); return name; - case 161: + case 163: return serializeQualifiedNameAsExpression(node); } } @@ -81146,23 +82016,23 @@ var ts; return node; } switch (node.kind) { - case 165: - return undefined; - case 257: - return visitClassDeclaration(node); - case 226: - return visitClassExpression(node); - case 171: - return visitConstructorDeclaration(node); - case 169: - return visitMethodDeclaration(node); - case 173: - return visitSetAccessorDeclaration(node); - case 172: - return visitGetAccessorDeclaration(node); case 167: + return undefined; + case 260: + return visitClassDeclaration(node); + case 228: + return visitClassExpression(node); + case 173: + return visitConstructorDeclaration(node); + case 171: + return visitMethodDeclaration(node); + case 175: + return visitSetAccessorDeclaration(node); + case 174: + return visitGetAccessorDeclaration(node); + case 169: return visitPropertyDeclaration(node); - case 164: + case 166: return visitParameterDeclaration(node); default: return ts.visitEachChild(node, visitor, context); @@ -81321,7 +82191,7 @@ var ts; var prefix = getClassMemberPrefix(node, member); var memberName = getExpressionForPropertyName(member, !ts.hasSyntacticModifier(member, 2)); var descriptor = languageVersion > 0 - ? member.kind === 167 + ? ts.isPropertyDeclaration(member) && !ts.hasAccessorModifier(member) ? factory.createVoidZero() : factory.createNull() : undefined; @@ -81506,33 +82376,33 @@ var ts; return node; } switch (node.kind) { - case 131: + case 132: return undefined; - case 218: + case 220: return visitAwaitExpression(node); - case 169: + case 171: return doWithContext(1 | 2, visitMethodDeclaration, node); - case 256: + case 259: return doWithContext(1 | 2, visitFunctionDeclaration, node); - case 213: + case 215: return doWithContext(1 | 2, visitFunctionExpression, node); - case 214: + case 216: return doWithContext(1, visitArrowFunction, node); - case 206: + case 208: if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106) { capturedSuperProperties.add(node.name.escapedText); } return ts.visitEachChild(node, visitor, context); - case 207: + case 209: if (capturedSuperProperties && node.expression.kind === 106) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); - case 172: + case 174: + case 175: case 173: - case 171: - case 257: - case 226: + case 260: + case 228: return doWithContext(1 | 2, visitDefault, node); default: return ts.visitEachChild(node, visitor, context); @@ -81541,27 +82411,27 @@ var ts; function asyncBodyVisitor(node) { if (ts.isNodeWithPossibleHoistedDeclaration(node)) { switch (node.kind) { - case 237: - return visitVariableStatementInAsyncBody(node); - case 242: - return visitForStatementInAsyncBody(node); - case 243: - return visitForInStatementInAsyncBody(node); - case 244: - return visitForOfStatementInAsyncBody(node); - case 292: - return visitCatchClauseInAsyncBody(node); - case 235: - case 249: - case 263: - case 289: - case 290: - case 252: case 240: - case 241: - case 239: - case 248: - case 250: + return visitVariableStatementInAsyncBody(node); + case 245: + return visitForStatementInAsyncBody(node); + case 246: + return visitForInStatementInAsyncBody(node); + case 247: + return visitForOfStatementInAsyncBody(node); + case 295: + return visitCatchClauseInAsyncBody(node); + case 238: + case 252: + case 266: + case 292: + case 293: + case 255: + case 243: + case 244: + case 242: + case 251: + case 253: return ts.visitEachChild(node, asyncBodyVisitor, context); default: return ts.Debug.assertNever(node, "Unhandled node."); @@ -81713,7 +82583,7 @@ var ts; var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 214; + var isArrowFunction = node.kind === 216; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0; var savedEnclosingFunctionParameterNames = enclosingFunctionParameterNames; enclosingFunctionParameterNames = new ts.Set(); @@ -81794,15 +82664,15 @@ var ts; function enableSubstitutionForAsyncMethodsWithSuper() { if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; + context.enableSubstitution(210); context.enableSubstitution(208); - context.enableSubstitution(206); - context.enableSubstitution(207); - context.enableEmitNotification(257); - context.enableEmitNotification(169); - context.enableEmitNotification(172); - context.enableEmitNotification(173); + context.enableSubstitution(209); + context.enableEmitNotification(260); context.enableEmitNotification(171); - context.enableEmitNotification(237); + context.enableEmitNotification(174); + context.enableEmitNotification(175); + context.enableEmitNotification(173); + context.enableEmitNotification(240); } } function onEmitNode(hint, node, emitCallback) { @@ -81834,11 +82704,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 206: - return substitutePropertyAccessExpression(node); - case 207: - return substituteElementAccessExpression(node); case 208: + return substitutePropertyAccessExpression(node); + case 209: + return substituteElementAccessExpression(node); + case 210: return substituteCallExpression(node); } return node; @@ -81869,11 +82739,11 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 257 + return kind === 260 + || kind === 173 || kind === 171 - || kind === 169 - || kind === 172 - || kind === 173; + || kind === 174 + || kind === 175; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { if (enclosingSuperContainerFlags & 4096) { @@ -81963,7 +82833,7 @@ var ts; return visitorWorker(node, true); } function visitorNoAsyncModifier(node) { - if (node.kind === 131) { + if (node.kind === 132) { return undefined; } return node; @@ -81985,70 +82855,70 @@ var ts; return node; } switch (node.kind) { - case 218: + case 220: return visitAwaitExpression(node); - case 224: + case 226: return visitYieldExpression(node); - case 247: - return visitReturnStatement(node); case 250: + return visitReturnStatement(node); + case 253: return visitLabeledStatement(node); - case 205: + case 207: return visitObjectLiteralExpression(node); - case 221: + case 223: return visitBinaryExpression(node, expressionResultIsUnused); - case 351: + case 354: return visitCommaListExpression(node, expressionResultIsUnused); - case 292: + case 295: return visitCatchClause(node); - case 237: - return visitVariableStatement(node); - case 254: - return visitVariableDeclaration(node); case 240: - case 241: + return visitVariableStatement(node); + case 257: + return visitVariableDeclaration(node); case 243: - return doWithHierarchyFacts(visitDefault, node, 0, 2); case 244: + case 246: + return doWithHierarchyFacts(visitDefault, node, 0, 2); + case 247: return visitForOfStatement(node, undefined); - case 242: + case 245: return doWithHierarchyFacts(visitForStatement, node, 0, 2); - case 217: + case 219: return visitVoidExpression(node); - case 171: - return doWithHierarchyFacts(visitConstructorDeclaration, node, 2, 1); - case 169: - return doWithHierarchyFacts(visitMethodDeclaration, node, 2, 1); - case 172: - return doWithHierarchyFacts(visitGetAccessorDeclaration, node, 2, 1); case 173: + return doWithHierarchyFacts(visitConstructorDeclaration, node, 2, 1); + case 171: + return doWithHierarchyFacts(visitMethodDeclaration, node, 2, 1); + case 174: + return doWithHierarchyFacts(visitGetAccessorDeclaration, node, 2, 1); + case 175: return doWithHierarchyFacts(visitSetAccessorDeclaration, node, 2, 1); - case 256: + case 259: return doWithHierarchyFacts(visitFunctionDeclaration, node, 2, 1); - case 213: + case 215: return doWithHierarchyFacts(visitFunctionExpression, node, 2, 1); - case 214: + case 216: return doWithHierarchyFacts(visitArrowFunction, node, 2, 0); - case 164: + case 166: return visitParameter(node); - case 238: + case 241: return visitExpressionStatement(node); - case 212: + case 214: return visitParenthesizedExpression(node, expressionResultIsUnused); - case 210: + case 212: return visitTaggedTemplateExpression(node); - case 206: + case 208: if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106) { capturedSuperProperties.add(node.name.escapedText); } return ts.visitEachChild(node, visitor, context); - case 207: + case 209: if (capturedSuperProperties && node.expression.kind === 106) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); - case 257: - case 226: + case 260: + case 228: return doWithHierarchyFacts(visitDefault, node, 2, 1); default: return ts.visitEachChild(node, visitor, context); @@ -82081,7 +82951,7 @@ var ts; function visitLabeledStatement(node) { if (enclosingFunctionFlags & 2) { var statement = ts.unwrapInnermostStatementOfLabel(node); - if (statement.kind === 244 && statement.awaitModifier) { + if (statement.kind === 247 && statement.awaitModifier) { return visitForOfStatement(statement, node); } return factory.restoreEnclosingLabel(ts.visitNode(statement, visitor, ts.isStatement, factory.liftToBlock), node); @@ -82093,7 +82963,7 @@ var ts; var objects = []; for (var _i = 0, elements_5 = elements; _i < elements_5.length; _i++) { var e = elements_5[_i]; - if (e.kind === 298) { + if (e.kind === 301) { if (chunkObject) { objects.push(factory.createObjectLiteralExpression(chunkObject)); chunkObject = undefined; @@ -82102,7 +82972,7 @@ var ts; objects.push(ts.visitNode(target, visitor, ts.isExpression)); } else { - chunkObject = ts.append(chunkObject, e.kind === 296 + chunkObject = ts.append(chunkObject, e.kind === 299 ? factory.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression)) : ts.visitNode(e, visitor, ts.isObjectLiteralElementLike)); } @@ -82115,7 +82985,7 @@ var ts; function visitObjectLiteralExpression(node) { if (node.transformFlags & 65536) { var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 205) { + if (objects.length && objects[0].kind !== 207) { objects.unshift(factory.createObjectLiteralExpression()); } var expression = objects[0]; @@ -82543,15 +83413,15 @@ var ts; function enableSubstitutionForAsyncMethodsWithSuper() { if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; + context.enableSubstitution(210); context.enableSubstitution(208); - context.enableSubstitution(206); - context.enableSubstitution(207); - context.enableEmitNotification(257); - context.enableEmitNotification(169); - context.enableEmitNotification(172); - context.enableEmitNotification(173); + context.enableSubstitution(209); + context.enableEmitNotification(260); context.enableEmitNotification(171); - context.enableEmitNotification(237); + context.enableEmitNotification(174); + context.enableEmitNotification(175); + context.enableEmitNotification(173); + context.enableEmitNotification(240); } } function onEmitNode(hint, node, emitCallback) { @@ -82583,11 +83453,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 206: - return substitutePropertyAccessExpression(node); - case 207: - return substituteElementAccessExpression(node); case 208: + return substitutePropertyAccessExpression(node); + case 209: + return substituteElementAccessExpression(node); + case 210: return substituteCallExpression(node); } return node; @@ -82618,11 +83488,11 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 257 + return kind === 260 + || kind === 173 || kind === 171 - || kind === 169 - || kind === 172 - || kind === 173; + || kind === 174 + || kind === 175; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { if (enclosingSuperContainerFlags & 4096) { @@ -82651,7 +83521,7 @@ var ts; return node; } switch (node.kind) { - case 292: + case 295: return visitCatchClause(node); default: return ts.visitEachChild(node, visitor, context); @@ -82682,25 +83552,25 @@ var ts; return node; } switch (node.kind) { - case 208: { + case 210: { var updated = visitNonOptionalCallExpression(node, false); ts.Debug.assertNotNode(updated, ts.isSyntheticReference); return updated; } - case 206: - case 207: + case 208: + case 209: if (ts.isOptionalChain(node)) { var updated = visitOptionalExpression(node, false, false); ts.Debug.assertNotNode(updated, ts.isSyntheticReference); return updated; } return ts.visitEachChild(node, visitor, context); - case 221: + case 223: if (node.operatorToken.kind === 60) { return transformNullishCoalescingExpression(node); } return ts.visitEachChild(node, visitor, context); - case 215: + case 217: return visitDeleteExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -82739,7 +83609,7 @@ var ts; thisArg = expression; } } - expression = node.kind === 206 + expression = node.kind === 208 ? factory.updatePropertyAccessExpression(node, expression, ts.visitNode(node.name, visitor, ts.isIdentifier)) : factory.updateElementAccessExpression(node, expression, ts.visitNode(node.argumentExpression, visitor, ts.isExpression)); return thisArg ? factory.createSyntheticReferenceExpression(expression, thisArg) : expression; @@ -82760,10 +83630,10 @@ var ts; } function visitNonOptionalExpression(node, captureThisArg, isDelete) { switch (node.kind) { - case 212: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); - case 206: - case 207: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); - case 208: return visitNonOptionalCallExpression(node, captureThisArg); + case 214: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); + case 208: + case 209: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); + case 210: return visitNonOptionalCallExpression(node, captureThisArg); default: return ts.visitNode(node, visitor, ts.isExpression); } } @@ -82782,8 +83652,8 @@ var ts; for (var i = 0; i < chain.length; i++) { var segment = chain[i]; switch (segment.kind) { - case 206: - case 207: + case 208: + case 209: if (i === chain.length - 1 && captureThisArg) { if (!ts.isSimpleCopiableExpression(rightExpression)) { thisArg = factory.createTempVariable(hoistVariableDeclaration); @@ -82793,11 +83663,11 @@ var ts; thisArg = rightExpression; } } - rightExpression = segment.kind === 206 + rightExpression = segment.kind === 208 ? factory.createPropertyAccessExpression(rightExpression, ts.visitNode(segment.name, visitor, ts.isIdentifier)) : factory.createElementAccessExpression(rightExpression, ts.visitNode(segment.argumentExpression, visitor, ts.isExpression)); break; - case 208: + case 210: if (i === 0 && leftThisArg) { if (!ts.isGeneratedIdentifier(leftThisArg)) { leftThisArg = factory.cloneNode(leftThisArg); @@ -82854,7 +83724,7 @@ var ts; return node; } switch (node.kind) { - case 221: + case 223: var binaryExpression = node; if (ts.isLogicalOrCoalescingAssignmentExpression(binaryExpression)) { return transformLogicalAssignment(binaryExpression); @@ -83010,13 +83880,13 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 278: + case 281: return visitJsxElement(node, false); - case 279: - return visitJsxSelfClosingElement(node, false); case 282: + return visitJsxSelfClosingElement(node, false); + case 285: return visitJsxFragment(node, false); - case 288: + case 291: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -83026,13 +83896,13 @@ var ts; switch (node.kind) { case 11: return visitJsxText(node); - case 288: + case 291: return visitJsxExpression(node); - case 278: + case 281: return visitJsxElement(node, true); - case 279: - return visitJsxSelfClosingElement(node, true); case 282: + return visitJsxSelfClosingElement(node, true); + case 285: return visitJsxFragment(node, true); default: return ts.Debug.failBadSyntaxKind(node); @@ -83195,7 +84065,7 @@ var ts; var literal = factory.createStringLiteral(tryDecodeEntities(node.text) || node.text, singleQuote); return ts.setTextRange(literal, node); } - if (node.kind === 288) { + if (node.kind === 291) { if (node.expression === undefined) { return factory.createTrue(); } @@ -83262,7 +84132,7 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 278) { + if (node.kind === 281) { return getTagName(node.openingElement); } else { @@ -83563,7 +84433,7 @@ var ts; return node; } switch (node.kind) { - case 221: + case 223: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -83656,7 +84526,7 @@ var ts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { return (hierarchyFacts & 8192) !== 0 - && node.kind === 247 + && node.kind === 250 && !node.expression; } function isOrMayContainReturnCompletion(node) { @@ -83710,65 +84580,65 @@ var ts; switch (node.kind) { case 124: return undefined; - case 257: + case 260: return visitClassDeclaration(node); - case 226: + case 228: return visitClassExpression(node); - case 164: + case 166: return visitParameter(node); - case 256: + case 259: return visitFunctionDeclaration(node); - case 214: + case 216: return visitArrowFunction(node); - case 213: + case 215: return visitFunctionExpression(node); - case 254: + case 257: return visitVariableDeclaration(node); case 79: return visitIdentifier(node); - case 255: + case 258: return visitVariableDeclarationList(node); - case 249: + case 252: return visitSwitchStatement(node); - case 263: + case 266: return visitCaseBlock(node); - case 235: - return visitBlock(node, false); - case 246: - case 245: - return visitBreakOrContinueStatement(node); - case 250: - return visitLabeledStatement(node); - case 240: - case 241: - return visitDoOrWhileStatement(node, undefined); - case 242: - return visitForStatement(node, undefined); - case 243: - return visitForInStatement(node, undefined); - case 244: - return visitForOfStatement(node, undefined); case 238: + return visitBlock(node, false); + case 249: + case 248: + return visitBreakOrContinueStatement(node); + case 253: + return visitLabeledStatement(node); + case 243: + case 244: + return visitDoOrWhileStatement(node, undefined); + case 245: + return visitForStatement(node, undefined); + case 246: + return visitForInStatement(node, undefined); + case 247: + return visitForOfStatement(node, undefined); + case 241: return visitExpressionStatement(node); - case 205: + case 207: return visitObjectLiteralExpression(node); - case 292: + case 295: return visitCatchClause(node); - case 297: + case 300: return visitShorthandPropertyAssignment(node); - case 162: + case 164: return visitComputedPropertyName(node); - case 204: + case 206: return visitArrayLiteralExpression(node); - case 208: + case 210: return visitCallExpression(node); - case 209: + case 211: return visitNewExpression(node); - case 212: + case 214: return visitParenthesizedExpression(node, expressionResultIsUnused); - case 221: + case 223: return visitBinaryExpression(node, expressionResultIsUnused); - case 351: + case 354: return visitCommaListExpression(node, expressionResultIsUnused); case 14: case 15: @@ -83779,30 +84649,30 @@ var ts; return visitStringLiteral(node); case 8: return visitNumericLiteral(node); - case 210: + case 212: return visitTaggedTemplateExpression(node); - case 223: - return visitTemplateExpression(node); - case 224: - return visitYieldExpression(node); case 225: + return visitTemplateExpression(node); + case 226: + return visitYieldExpression(node); + case 227: return visitSpreadElement(node); case 106: return visitSuperKeyword(false); case 108: return visitThisKeyword(node); - case 231: + case 233: return visitMetaProperty(node); - case 169: + case 171: return visitMethodDeclaration(node); - case 172: - case 173: + case 174: + case 175: return visitAccessorDeclaration(node); - case 237: + case 240: return visitVariableStatement(node); - case 247: + case 250: return visitReturnStatement(node); - case 217: + case 219: return visitVoidExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -83886,14 +84756,14 @@ var ts; } function visitBreakOrContinueStatement(node) { if (convertedLoopState) { - var jump = node.kind === 246 ? 2 : 4; + var jump = node.kind === 249 ? 2 : 4; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(ts.idText(node.label))) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; var label = node.label; if (!label) { - if (node.kind === 246) { + if (node.kind === 249) { convertedLoopState.nonLocalJumps |= 2; labelMarker = "break"; } @@ -83903,7 +84773,7 @@ var ts; } } else { - if (node.kind === 246) { + if (node.kind === 249) { labelMarker = "break-".concat(label.escapedText); setLabeledJump(convertedLoopState, true, ts.idText(label), labelMarker); } @@ -83942,7 +84812,7 @@ var ts; ts.startOnNewLine(statement); statements.push(statement); if (ts.hasSyntacticModifier(node, 1)) { - var exportStatement = ts.hasSyntacticModifier(node, 512) + var exportStatement = ts.hasSyntacticModifier(node, 1024) ? factory.createExportDefault(factory.getLocalName(node)) : factory.createExternalModuleExport(factory.getLocalName(node)); ts.setOriginalNode(exportStatement, statement); @@ -84111,17 +84981,17 @@ var ts; }; } function isSufficientlyCoveredByReturnStatements(statement) { - if (statement.kind === 247) { + if (statement.kind === 250) { return true; } - else if (statement.kind === 239) { + else if (statement.kind === 242) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement); } } - else if (statement.kind === 235) { + else if (statement.kind === 238) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -84229,7 +85099,7 @@ var ts; return true; } function insertCaptureThisForNodeIfNeeded(statements, node) { - if (hierarchyFacts & 65536 && node.kind !== 214) { + if (hierarchyFacts & 65536 && node.kind !== 216) { insertCaptureThisForNode(statements, node, factory.createThis()); return true; } @@ -84254,18 +85124,18 @@ var ts; if (hierarchyFacts & 32768) { var newTarget = void 0; switch (node.kind) { - case 214: + case 216: return statements; - case 169: - case 172: - case 173: + case 171: + case 174: + case 175: newTarget = factory.createVoidZero(); break; - case 171: + case 173: newTarget = factory.createPropertyAccessExpression(ts.setEmitFlags(factory.createThis(), 4), "constructor"); break; - case 256: - case 213: + case 259: + case 215: newTarget = factory.createConditionalExpression(factory.createLogicalAnd(ts.setEmitFlags(factory.createThis(), 4), factory.createBinaryExpression(ts.setEmitFlags(factory.createThis(), 4), 102, factory.getLocalName(node))), undefined, factory.createPropertyAccessExpression(ts.setEmitFlags(factory.createThis(), 4), "constructor"), undefined, factory.createVoidZero()); break; default: @@ -84286,21 +85156,21 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 234: + case 237: statements.push(transformSemicolonClassElementToStatement(member)); break; - case 169: + case 171: statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; - case 172: - case 173: + case 174: + case 175: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; - case 171: - case 170: + case 173: + case 172: break; default: ts.Debug.failBadSyntaxKind(member, currentSourceFile && currentSourceFile.fileName); @@ -84432,7 +85302,7 @@ var ts; : enterSubtree(32670, 65); var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (hierarchyFacts & 32768 && !name && (node.kind === 256 || node.kind === 213)) { + if (hierarchyFacts & 32768 && !name && (node.kind === 259 || node.kind === 215)) { name = factory.getGeneratedNameForNode(node); } exitSubtree(ancestorFacts, 98304, 0); @@ -84465,7 +85335,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 214); + ts.Debug.assert(node.kind === 216); statementsLocation = ts.moveRangeEnd(body, -1); var equalsGreaterThanToken = node.equalsGreaterThanToken; if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) { @@ -84669,14 +85539,14 @@ var ts; } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { - case 240: - case 241: - return visitDoOrWhileStatement(node, outermostLabeledStatement); - case 242: - return visitForStatement(node, outermostLabeledStatement); case 243: - return visitForInStatement(node, outermostLabeledStatement); case 244: + return visitDoOrWhileStatement(node, outermostLabeledStatement); + case 245: + return visitForStatement(node, outermostLabeledStatement); + case 246: + return visitForInStatement(node, outermostLabeledStatement); + case 247: return visitForOfStatement(node, outermostLabeledStatement); } } @@ -84801,7 +85671,7 @@ var ts; var property = properties[i]; if ((property.transformFlags & 1048576 && hierarchyFacts & 4) - || (hasComputed = ts.Debug.checkDefined(property.name).kind === 162)) { + || (hasComputed = ts.Debug.checkDefined(property.name).kind === 164)) { numInitialProperties = i; break; } @@ -84907,11 +85777,11 @@ var ts; } function convertIterationStatementCore(node, initializerFunction, convertedLoopBody) { switch (node.kind) { - case 242: return convertForStatement(node, initializerFunction, convertedLoopBody); - case 243: return convertForInStatement(node, convertedLoopBody); - case 244: return convertForOfStatement(node, convertedLoopBody); - case 240: return convertDoStatement(node, convertedLoopBody); - case 241: return convertWhileStatement(node, convertedLoopBody); + case 245: return convertForStatement(node, initializerFunction, convertedLoopBody); + case 246: return convertForInStatement(node, convertedLoopBody); + case 247: return convertForOfStatement(node, convertedLoopBody); + case 243: return convertDoStatement(node, convertedLoopBody); + case 244: return convertWhileStatement(node, convertedLoopBody); default: return ts.Debug.failBadSyntaxKind(node, "IterationStatement expected"); } } @@ -84935,11 +85805,11 @@ var ts; function createConvertedLoopState(node) { var loopInitializer; switch (node.kind) { - case 242: - case 243: - case 244: + case 245: + case 246: + case 247: var initializer = node.initializer; - if (initializer && initializer.kind === 255) { + if (initializer && initializer.kind === 258) { loopInitializer = initializer; } break; @@ -85211,20 +86081,20 @@ var ts; for (var i = start; i < numProperties; i++) { var property = properties[i]; switch (property.kind) { - case 172: - case 173: + case 174: + case 175: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { expressions.push(transformAccessorsToExpression(receiver, accessors, node, !!node.multiLine)); } break; - case 169: + case 171: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 296: + case 299: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 297: + case 300: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -85295,7 +86165,7 @@ var ts; var updated; var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (node.kind === 172) { + if (node.kind === 174) { updated = factory.updateGetAccessorDeclaration(node, node.modifiers, node.name, parameters, node.type, body); } else { @@ -85522,13 +86392,13 @@ var ts; if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; context.enableSubstitution(108); - context.enableEmitNotification(171); - context.enableEmitNotification(169); - context.enableEmitNotification(172); context.enableEmitNotification(173); - context.enableEmitNotification(214); - context.enableEmitNotification(213); - context.enableEmitNotification(256); + context.enableEmitNotification(171); + context.enableEmitNotification(174); + context.enableEmitNotification(175); + context.enableEmitNotification(216); + context.enableEmitNotification(215); + context.enableEmitNotification(259); } } function onSubstituteNode(hint, node) { @@ -85552,10 +86422,10 @@ var ts; } function isNameOfDeclarationWithCollidingName(node) { switch (node.parent.kind) { - case 203: - case 257: + case 205: case 260: - case 254: + case 263: + case 257: return node.parent.name === node && resolver.isDeclarationWithCollidingName(node.parent); } @@ -85616,11 +86486,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 238) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 241) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 208) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 210) { return false; } var callTarget = statementExpression.expression; @@ -85628,7 +86498,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 225) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 227) { return false; } var expression = callArgument.expression; @@ -85647,24 +86517,24 @@ var ts; if (compilerOptions.jsx === 1 || compilerOptions.jsx === 3) { previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; - context.enableEmitNotification(280); - context.enableEmitNotification(281); - context.enableEmitNotification(279); + context.enableEmitNotification(283); + context.enableEmitNotification(284); + context.enableEmitNotification(282); noSubstitution = []; } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(206); - context.enableSubstitution(296); + context.enableSubstitution(208); + context.enableSubstitution(299); return ts.chainBundle(context, transformSourceFile); function transformSourceFile(node) { return node; } function onEmitNode(hint, node, emitCallback) { switch (node.kind) { - case 280: - case 281: - case 279: + case 283: + case 284: + case 282: var tagName = node.tagName; noSubstitution[ts.getOriginalNodeId(tagName)] = true; break; @@ -85784,13 +86654,13 @@ var ts; } function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 240: + case 243: return visitDoStatement(node); - case 241: + case 244: return visitWhileStatement(node); - case 249: + case 252: return visitSwitchStatement(node); - case 250: + case 253: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -85798,24 +86668,24 @@ var ts; } function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 256: + case 259: return visitFunctionDeclaration(node); - case 213: + case 215: return visitFunctionExpression(node); - case 172: - case 173: + case 174: + case 175: return visitAccessorDeclaration(node); - case 237: + case 240: return visitVariableStatement(node); - case 242: - return visitForStatement(node); - case 243: - return visitForInStatement(node); - case 246: - return visitBreakStatement(node); case 245: + return visitForStatement(node); + case 246: + return visitForInStatement(node); + case 249: + return visitBreakStatement(node); + case 248: return visitContinueStatement(node); - case 247: + case 250: return visitReturnStatement(node); default: if (node.transformFlags & 1048576) { @@ -85831,23 +86701,23 @@ var ts; } function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 221: + case 223: return visitBinaryExpression(node); - case 351: + case 354: return visitCommaListExpression(node); - case 222: - return visitConditionalExpression(node); case 224: + return visitConditionalExpression(node); + case 226: return visitYieldExpression(node); - case 204: + case 206: return visitArrayLiteralExpression(node); - case 205: - return visitObjectLiteralExpression(node); case 207: - return visitElementAccessExpression(node); - case 208: - return visitCallExpression(node); + return visitObjectLiteralExpression(node); case 209: + return visitElementAccessExpression(node); + case 210: + return visitCallExpression(node); + case 211: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -85855,9 +86725,9 @@ var ts; } function visitGenerator(node) { switch (node.kind) { - case 256: + case 259: return visitFunctionDeclaration(node); - case 213: + case 215: return visitFunctionExpression(node); default: return ts.Debug.failBadSyntaxKind(node); @@ -85994,10 +86864,10 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 206: + case 208: target = factory.updatePropertyAccessExpression(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 207: + case 209: target = factory.updateElementAccessExpression(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), cacheExpression(ts.visitNode(left.argumentExpression, visitor, ts.isExpression))); break; default: @@ -86209,35 +87079,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 235: - return transformAndEmitBlock(node); case 238: - return transformAndEmitExpressionStatement(node); - case 239: - return transformAndEmitIfStatement(node); - case 240: - return transformAndEmitDoStatement(node); + return transformAndEmitBlock(node); case 241: - return transformAndEmitWhileStatement(node); + return transformAndEmitExpressionStatement(node); case 242: - return transformAndEmitForStatement(node); + return transformAndEmitIfStatement(node); case 243: - return transformAndEmitForInStatement(node); + return transformAndEmitDoStatement(node); + case 244: + return transformAndEmitWhileStatement(node); case 245: - return transformAndEmitContinueStatement(node); + return transformAndEmitForStatement(node); case 246: - return transformAndEmitBreakStatement(node); - case 247: - return transformAndEmitReturnStatement(node); + return transformAndEmitForInStatement(node); case 248: - return transformAndEmitWithStatement(node); + return transformAndEmitContinueStatement(node); case 249: - return transformAndEmitSwitchStatement(node); + return transformAndEmitBreakStatement(node); case 250: - return transformAndEmitLabeledStatement(node); + return transformAndEmitReturnStatement(node); case 251: - return transformAndEmitThrowStatement(node); + return transformAndEmitWithStatement(node); case 252: + return transformAndEmitSwitchStatement(node); + case 253: + return transformAndEmitLabeledStatement(node); + case 254: + return transformAndEmitThrowStatement(node); + case 255: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement)); @@ -86531,7 +87401,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 290 && defaultClauseIndex === -1) { + if (clause.kind === 293 && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -86541,7 +87411,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 289) { + if (clause.kind === 292) { if (containsYield(clause.expression) && pendingClauses.length > 0) { break; } @@ -87346,12 +88216,12 @@ var ts; var previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(208); context.enableSubstitution(210); + context.enableSubstitution(212); context.enableSubstitution(79); - context.enableSubstitution(221); - context.enableSubstitution(297); - context.enableEmitNotification(305); + context.enableSubstitution(223); + context.enableSubstitution(300); + context.enableEmitNotification(308); var moduleInfoMap = []; var deferredExports = []; var currentSourceFile; @@ -87545,23 +88415,23 @@ var ts; } function topLevelVisitor(node) { switch (node.kind) { - case 266: + case 269: return visitImportDeclaration(node); - case 265: + case 268: return visitImportEqualsDeclaration(node); - case 272: + case 275: return visitExportDeclaration(node); - case 271: + case 274: return visitExportAssignment(node); - case 237: + case 240: return visitVariableStatement(node); - case 256: + case 259: return visitFunctionDeclaration(node); - case 257: + case 260: return visitClassDeclaration(node); - case 352: + case 355: return visitMergeDeclarationMarker(node); - case 353: + case 356: return visitEndOfDeclarationMarker(node); default: return visitor(node); @@ -87572,26 +88442,26 @@ var ts; return node; } switch (node.kind) { - case 242: + case 245: return visitForStatement(node); - case 238: + case 241: return visitExpressionStatement(node); - case 212: + case 214: return visitParenthesizedExpression(node, valueIsDiscarded); - case 350: + case 353: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 208: + case 210: if (ts.isImportCall(node) && currentSourceFile.impliedNodeFormat === undefined) { return visitImportCallExpression(node); } break; - case 221: + case 223: if (ts.isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 219: - case 220: + case 221: + case 222: return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); } return ts.visitEachChild(node, visitor, context); @@ -87607,24 +88477,24 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var elem = _a[_i]; switch (elem.kind) { - case 296: + case 299: if (destructuringNeedsFlattening(elem.initializer)) { return true; } break; - case 297: + case 300: if (destructuringNeedsFlattening(elem.name)) { return true; } break; - case 298: + case 301: if (destructuringNeedsFlattening(elem.expression)) { return true; } break; - case 169: - case 172: - case 173: + case 171: + case 174: + case 175: return false; default: ts.Debug.assertNever(elem, "Unhandled object member kind"); } @@ -88027,7 +88897,7 @@ var ts; } } function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 237) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -88059,10 +88929,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268: + case 271: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 269: + case 272: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding, true); @@ -88110,7 +88980,7 @@ var ts; return statements; } if (ts.hasSyntacticModifier(decl, 1)) { - var exportName = ts.hasSyntacticModifier(decl, 512) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); + var exportName = ts.hasSyntacticModifier(decl, 1024) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); statements = appendExportStatement(statements, exportName, factory.getLocalName(decl), decl); } if (decl.name) { @@ -88177,7 +89047,7 @@ var ts; return node; } function onEmitNode(hint, node, emitCallback) { - if (node.kind === 305) { + if (node.kind === 308) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; previousOnEmitNode(hint, node, emitCallback); @@ -88217,11 +89087,11 @@ var ts; switch (node.kind) { case 79: return substituteExpressionIdentifier(node); - case 208: - return substituteCallExpression(node); case 210: + return substituteCallExpression(node); + case 212: return substituteTaggedTemplateExpression(node); - case 221: + case 223: return substituteBinaryExpression(node); } return node; @@ -88257,7 +89127,7 @@ var ts; } else if (!(ts.isGeneratedIdentifier(node) && !(node.autoGenerateFlags & 64)) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 305) { + if (exportContainer && exportContainer.kind === 308) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.cloneNode(node)), node); } var importDeclaration = resolver.getReferencedImportDeclaration(node); @@ -88322,10 +89192,10 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(79); - context.enableSubstitution(297); - context.enableSubstitution(221); - context.enableSubstitution(231); - context.enableEmitNotification(305); + context.enableSubstitution(300); + context.enableSubstitution(223); + context.enableSubstitution(233); + context.enableEmitNotification(308); var moduleInfoMap = []; var deferredExports = []; var exportFunctionsMap = []; @@ -88415,7 +89285,7 @@ var ts; ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); var exportStarFunction = addExportStarIfNeeded(statements); var modifiers = node.transformFlags & 2097152 ? - factory.createModifiersFromModifierFlags(256) : + factory.createModifiersFromModifierFlags(512) : undefined; var moduleObject = factory.createObjectLiteralExpression([ factory.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), @@ -88432,7 +89302,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 272 && externalImport.exportClause) { + if (externalImport.kind === 275 && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -88493,15 +89363,21 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(factory, entry, currentSourceFile); switch (entry.kind) { - case 266: + case 269: if (!entry.importClause) { break; } - case 265: + case 268: ts.Debug.assert(importVariableName !== undefined); statements.push(factory.createExpressionStatement(factory.createAssignment(importVariableName, parameterName))); + if (ts.hasSyntacticModifier(entry, 1)) { + statements.push(factory.createExpressionStatement(factory.createCallExpression(exportFunction, undefined, [ + factory.createStringLiteral(ts.idText(importVariableName)), + parameterName, + ]))); + } break; - case 272: + case 275: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { if (ts.isNamedExports(entry.exportClause)) { @@ -88531,13 +89407,13 @@ var ts; } function topLevelVisitor(node) { switch (node.kind) { - case 266: + case 269: return visitImportDeclaration(node); - case 265: + case 268: return visitImportEqualsDeclaration(node); - case 272: + case 275: return visitExportDeclaration(node); - case 271: + case 274: return visitExportAssignment(node); default: return topLevelNestedVisitor(node); @@ -88662,7 +89538,7 @@ var ts; } function shouldHoistVariableDeclarationList(node) { return (ts.getEmitFlags(node) & 2097152) === 0 - && (enclosingBlockScopedContainer.kind === 305 + && (enclosingBlockScopedContainer.kind === 308 || (ts.getOriginalNode(node).flags & 3) === 0); } function transformInitializedVariable(node, isExportedDeclaration) { @@ -88684,7 +89560,7 @@ var ts; : preventSubstitution(ts.setTextRange(factory.createAssignment(name, value), location)); } function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 237) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasSyntacticModifier(node.original, 1); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -88723,10 +89599,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268: + case 271: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 269: + case 272: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -88782,7 +89658,7 @@ var ts; } var excludeName; if (ts.hasSyntacticModifier(decl, 1)) { - var exportName = ts.hasSyntacticModifier(decl, 512) ? factory.createStringLiteral("default") : decl.name; + var exportName = ts.hasSyntacticModifier(decl, 1024) ? factory.createStringLiteral("default") : decl.name; statements = appendExportStatement(statements, exportName, factory.getLocalName(decl)); excludeName = ts.getTextOfIdentifierOrLiteral(exportName); } @@ -88826,43 +89702,43 @@ var ts; } function topLevelNestedVisitor(node) { switch (node.kind) { - case 237: - return visitVariableStatement(node); - case 256: - return visitFunctionDeclaration(node); - case 257: - return visitClassDeclaration(node); - case 242: - return visitForStatement(node, true); - case 243: - return visitForInStatement(node); - case 244: - return visitForOfStatement(node); case 240: + return visitVariableStatement(node); + case 259: + return visitFunctionDeclaration(node); + case 260: + return visitClassDeclaration(node); + case 245: + return visitForStatement(node, true); + case 246: + return visitForInStatement(node); + case 247: + return visitForOfStatement(node); + case 243: return visitDoStatement(node); - case 241: + case 244: return visitWhileStatement(node); - case 250: + case 253: return visitLabeledStatement(node); - case 248: + case 251: return visitWithStatement(node); - case 249: - return visitSwitchStatement(node); - case 263: - return visitCaseBlock(node); - case 289: - return visitCaseClause(node); - case 290: - return visitDefaultClause(node); case 252: - return visitTryStatement(node); + return visitSwitchStatement(node); + case 266: + return visitCaseBlock(node); case 292: + return visitCaseClause(node); + case 293: + return visitDefaultClause(node); + case 255: + return visitTryStatement(node); + case 295: return visitCatchClause(node); - case 235: + case 238: return visitBlock(node); - case 352: + case 355: return visitMergeDeclarationMarker(node); - case 353: + case 356: return visitEndOfDeclarationMarker(node); default: return visitor(node); @@ -88959,26 +89835,26 @@ var ts; return node; } switch (node.kind) { - case 242: + case 245: return visitForStatement(node, false); - case 238: + case 241: return visitExpressionStatement(node); - case 212: + case 214: return visitParenthesizedExpression(node, valueIsDiscarded); - case 350: + case 353: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 221: + case 223: if (ts.isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 208: + case 210: if (ts.isImportCall(node)) { return visitImportCallExpression(node); } break; - case 219: - case 220: + case 221: + case 222: return visitPrefixOrPostfixUnaryExpression(node, valueIsDiscarded); } return ts.visitEachChild(node, visitor, context); @@ -89031,7 +89907,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 305; + return container !== undefined && container.kind === 308; } else { return false; @@ -89082,7 +89958,7 @@ var ts; return node; } function onEmitNode(hint, node, emitCallback) { - if (node.kind === 305) { + if (node.kind === 308) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -89118,7 +89994,7 @@ var ts; } function substituteUnspecified(node) { switch (node.kind) { - case 297: + case 300: return substituteShorthandPropertyAssignment(node); } return node; @@ -89143,9 +90019,9 @@ var ts; switch (node.kind) { case 79: return substituteExpressionIdentifier(node); - case 221: + case 223: return substituteBinaryExpression(node); - case 231: + case 233: return substituteMetaProperty(node); } return node; @@ -89203,7 +90079,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, false); - if (exportContainer && exportContainer.kind === 305) { + if (exportContainer && exportContainer.kind === 308) { exportedNames = ts.append(exportedNames, factory.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -89235,7 +90111,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(305); + context.enableEmitNotification(308); context.enableSubstitution(79); var helperNameSubstitutions; var currentSourceFile; @@ -89275,11 +90151,11 @@ var ts; } function visitor(node) { switch (node.kind) { - case 265: + case 268: return ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.Node16 ? visitImportEqualsDeclaration(node) : undefined; - case 271: + case 274: return visitExportAssignment(node); - case 272: + case 275: var exportDecl = node; return visitExportDeclaration(exportDecl); } @@ -89386,8 +90262,8 @@ var ts; var cjsOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(305); - context.enableEmitNotification(305); + context.enableSubstitution(308); + context.enableEmitNotification(308); var currentSourceFile; return transformSourceFileOrBundle; function onSubstituteNode(hint, node) { @@ -89431,7 +90307,7 @@ var ts; return result; } function transformSourceFileOrBundle(node) { - return node.kind === 305 ? transformSourceFile(node) : transformBundle(node); + return node.kind === 308 ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -89490,7 +90366,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257) { + else if (node.parent.kind === 260) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -89519,7 +90395,7 @@ var ts; ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257) { + else if (node.parent.kind === 260) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -89566,15 +90442,15 @@ var ts; return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: ".concat(ts.Debug.formatSyntaxKind(node.kind))); } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 254 || node.kind === 203) { + if (node.kind === 257 || node.kind === 205) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else if (node.kind === 167 || node.kind === 206 || node.kind === 166 || - (node.kind === 164 && ts.hasSyntacticModifier(node.parent, 8))) { + else if (node.kind === 169 || node.kind === 208 || node.kind === 168 || + (node.kind === 166 && ts.hasSyntacticModifier(node.parent, 8))) { if (ts.isStatic(node)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -89582,7 +90458,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 || node.kind === 164) { + else if (node.parent.kind === 260 || node.kind === 166) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -89606,7 +90482,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (node.kind === 173) { + if (node.kind === 175) { if (ts.isStatic(node)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 : @@ -89643,23 +90519,23 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 175: + case 177: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 174: + case 176: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 176: + case 178: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 169: - case 168: + case 171: + case 170: if (ts.isStatic(node)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -89667,7 +90543,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 257) { + else if (node.parent.kind === 260) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -89680,7 +90556,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 256: + case 259: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -89705,27 +90581,27 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 171: + case 173: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 175: - case 180: + case 177: + case 182: return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 174: + case 176: return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 176: + case 178: return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; - case 169: - case 168: + case 171: + case 170: if (ts.isStatic(node.parent)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -89733,7 +90609,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 257) { + else if (node.parent.parent.kind === 260) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -89745,15 +90621,15 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 256: - case 179: + case 259: + case 181: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; - case 173: - case 172: + case 175: + case 174: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -89766,39 +90642,39 @@ var ts; function getTypeParameterConstraintVisibilityError() { var diagnosticMessage; switch (node.parent.kind) { - case 257: + case 260: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 258: + case 261: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 195: + case 197: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1; break; - case 180: - case 175: + case 182: + case 177: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 174: + case 176: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 169: - case 168: + case 171: + case 170: if (ts.isStatic(node.parent)) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 257) { + else if (node.parent.parent.kind === 260) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 179: - case 256: + case 181: + case 259: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 259: + case 262: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -89860,7 +90736,7 @@ var ts; } function isInternalDeclaration(node, currentSourceFile) { var parseTreeNode = ts.getParseTreeNode(node); - if (parseTreeNode && parseTreeNode.kind === 164) { + if (parseTreeNode && parseTreeNode.kind === 166) { var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode); var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined; var text = currentSourceFile.text; @@ -90021,7 +90897,7 @@ var ts; var _a; var primaryDeclaration = (_a = parentSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.getSourceFileOfNode(d) === containingFile; }); var augmentingDeclarations = ts.filter(symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== containingFile; }); - if (augmentingDeclarations) { + if (primaryDeclaration && augmentingDeclarations) { for (var _i = 0, augmentingDeclarations_1 = augmentingDeclarations; _i < augmentingDeclarations_1.length; _i++) { var augmentations = augmentingDeclarations_1[_i]; context.addDiagnostic(ts.addRelatedInfo(ts.createDiagnosticForNode(augmentations, ts.Diagnostics.Declaration_augments_declaration_in_another_file_This_cannot_be_serialized), ts.createDiagnosticForNode(primaryDeclaration, ts.Diagnostics.This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_file))); @@ -90051,10 +90927,10 @@ var ts; return result; } function transformRoot(node) { - if (node.kind === 305 && node.isDeclarationFile) { + if (node.kind === 308 && node.isDeclarationFile) { return node; } - if (node.kind === 306) { + if (node.kind === 309) { isBundledEmit = true; refs = new ts.Map(); libs = new ts.Map(); @@ -90077,14 +90953,14 @@ var ts; resultHasExternalModuleIndicator = false; needsDeclare = false; var statements = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile, true)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements); - var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(135)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], true, [], [], false, []); + var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(136)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], true, [], [], false, []); return newFile; } needsDeclare = true; var updated = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements); return factory.updateSourceFile(sourceFile, transformAndReplaceLatePaintedStatements(updated), true, [], [], false, []); }), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 308) { + if (prepend.kind === 311) { var sourceFile = ts.createUnparsedSourceFile(prepend, "dts", stripInternal); hasNoDefaultLib_1 = hasNoDefaultLib_1 || !!sourceFile.hasNoDefaultLib; collectReferences(sourceFile, refs); @@ -90217,7 +91093,7 @@ var ts; return name; } else { - if (name.kind === 202) { + if (name.kind === 204) { return factory.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement)); } else { @@ -90225,7 +91101,7 @@ var ts; } } function visitBindingElement(elem) { - if (elem.kind === 227) { + if (elem.kind === 229) { return elem; } if (elem.propertyName && ts.isIdentifier(elem.propertyName) && ts.isIdentifier(elem.name) && !elem.symbol.isReferenced) { @@ -90262,17 +91138,17 @@ var ts; if (shouldPrintWithInitializer(node)) { return; } - var shouldUseResolverType = node.kind === 164 && + var shouldUseResolverType = node.kind === 166 && (resolver.isRequiredInitializedParameter(node) || resolver.isOptionalUninitializedParameterProperty(node)); if (type && !shouldUseResolverType) { return ts.visitNode(type, visitDeclarationSubtree); } if (!ts.getParseTreeNode(node)) { - return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(130); + return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(131); } - if (node.kind === 173) { - return factory.createKeywordTypeNode(130); + if (node.kind === 175) { + return factory.createKeywordTypeNode(131); } errorNameNode = node.name; var oldDiag; @@ -90280,12 +91156,12 @@ var ts; oldDiag = getSymbolAccessibilityDiagnostic; getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node); } - if (node.kind === 254 || node.kind === 203) { + if (node.kind === 257 || node.kind === 205) { return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); } - if (node.kind === 164 - || node.kind === 167 - || node.kind === 166) { + if (node.kind === 166 + || node.kind === 169 + || node.kind === 168) { if (ts.isPropertySignature(node) || !node.initializer) return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType)); return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType) || resolver.createTypeOfExpression(node.initializer, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); @@ -90296,27 +91172,27 @@ var ts; if (!suppressNewDiagnosticContexts) { getSymbolAccessibilityDiagnostic = oldDiag; } - return returnValue || factory.createKeywordTypeNode(130); + return returnValue || factory.createKeywordTypeNode(131); } } function isDeclarationAndNotVisible(node) { node = ts.getParseTreeNode(node); switch (node.kind) { - case 256: - case 261: - case 258: - case 257: case 259: + case 264: + case 261: case 260: + case 262: + case 263: return !resolver.isDeclarationVisible(node); - case 254: + case 257: return !getBindingNameVisible(node); - case 265: - case 266: - case 272: - case 271: + case 268: + case 269: + case 275: + case 274: return false; - case 170: + case 172: return true; } return false; @@ -90401,7 +91277,7 @@ var ts; function rewriteModuleSpecifier(parent, input) { if (!input) return undefined; - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 261 && parent.kind !== 200); + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 264 && parent.kind !== 202); if (ts.isStringLiteralLike(input)) { if (isBundledEmit) { var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent); @@ -90421,7 +91297,7 @@ var ts; function transformImportEqualsDeclaration(decl) { if (!resolver.isDeclarationVisible(decl)) return; - if (decl.moduleReference.kind === 277) { + if (decl.moduleReference.kind === 280) { var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl); return factory.updateImportEqualsDeclaration(decl, decl.modifiers, decl.isTypeOnly, decl.name, factory.updateExternalModuleReference(decl.moduleReference, rewriteModuleSpecifier(decl, specifier))); } @@ -90441,7 +91317,7 @@ var ts; if (!decl.importClause.namedBindings) { return visibleDefaultBinding && factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)); } - if (decl.importClause.namedBindings.kind === 268) { + if (decl.importClause.namedBindings.kind === 271) { var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : undefined; return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)) : undefined; } @@ -90518,7 +91394,7 @@ var ts; var oldDiag = getSymbolAccessibilityDiagnostic; var canProduceDiagnostic = ts.canProduceDiagnostics(input); var oldWithinObjectLiteralType = suppressNewDiagnosticContexts; - var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 182 || input.kind === 195) && input.parent.kind !== 259); + var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 184 || input.kind === 197) && input.parent.kind !== 262); if (ts.isMethodDeclaration(input) || ts.isMethodSignature(input)) { if (ts.hasEffectiveModifier(input, 8)) { if (input.symbol && input.symbol.declarations && input.symbol.declarations[0] !== input) @@ -90537,67 +91413,67 @@ var ts; } if (isProcessedComponent(input)) { switch (input.kind) { - case 228: { + case 230: { if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) { checkEntityNameVisibility(input.expression, enclosingDeclaration); } var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory.updateExpressionWithTypeArguments(node, node.expression, node.typeArguments)); } - case 178: { + case 180: { checkEntityNameVisibility(input.typeName, enclosingDeclaration); var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory.updateTypeReferenceNode(node, node.typeName, node.typeArguments)); } - case 175: + case 177: return cleanup(factory.updateConstructSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); - case 171: { + case 173: { var ctor = factory.createConstructorDeclaration(ensureModifiers(input), updateParamsList(input, input.parameters, 0), undefined); return cleanup(ctor); } - case 169: { + case 171: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(undefined); } var sig = factory.createMethodDeclaration(ensureModifiers(input), undefined, input.name, input.questionToken, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), undefined); return cleanup(sig); } - case 172: { + case 174: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(undefined); } var accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input)); return cleanup(factory.updateGetAccessorDeclaration(input, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8)), ensureType(input, accessorType), undefined)); } - case 173: { + case 175: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(undefined); } return cleanup(factory.updateSetAccessorDeclaration(input, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8)), undefined)); } - case 167: + case 169: if (ts.isPrivateIdentifier(input.name)) { return cleanup(undefined); } return cleanup(factory.updatePropertyDeclaration(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type), ensureNoInitializer(input))); - case 166: + case 168: if (ts.isPrivateIdentifier(input.name)) { return cleanup(undefined); } return cleanup(factory.updatePropertySignature(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type))); - case 168: { + case 170: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(undefined); } return cleanup(factory.updateMethodSignature(input, ensureModifiers(input), input.name, input.questionToken, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 174: { + case 176: { return cleanup(factory.updateCallSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 176: { - return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(130))); + case 178: { + return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(131))); } - case 254: { + case 257: { if (ts.isBindingPattern(input.name)) { return recreateBindingPattern(input.name); } @@ -90605,13 +91481,13 @@ var ts; suppressNewDiagnosticContexts = true; return cleanup(factory.updateVariableDeclaration(input, input.name, undefined, ensureType(input, input.type), ensureNoInitializer(input))); } - case 163: { + case 165: { if (isPrivateMethodTypeParameter(input) && (input.default || input.constraint)) { return cleanup(factory.updateTypeParameterDeclaration(input, input.modifiers, input.name, undefined, undefined)); } return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context)); } - case 189: { + case 191: { var checkType = ts.visitNode(input.checkType, visitDeclarationSubtree); var extendsType = ts.visitNode(input.extendsType, visitDeclarationSubtree); var oldEnclosingDecl = enclosingDeclaration; @@ -90621,13 +91497,13 @@ var ts; var falseType = ts.visitNode(input.falseType, visitDeclarationSubtree); return cleanup(factory.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType)); } - case 179: { + case 181: { return cleanup(factory.updateFunctionTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 180: { + case 182: { return cleanup(factory.updateConstructorTypeNode(input, ensureModifiers(input), ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 200: { + case 202: { if (!ts.isLiteralImportTypeNode(input)) return cleanup(input); return cleanup(factory.updateImportTypeNode(input, factory.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.assertions, input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf)); @@ -90659,7 +91535,7 @@ var ts; } } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 169 && ts.hasEffectiveModifier(node.parent, 8); + return node.parent.kind === 171 && ts.hasEffectiveModifier(node.parent, 8); } function visitDeclarationStatements(input) { if (!isPreservedDeclarationStatement(input)) { @@ -90668,14 +91544,14 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 272: { + case 275: { if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; } resultHasScopeMarker = true; return factory.updateExportDeclaration(input, input.modifiers, input.isTypeOnly, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier), ts.getResolutionModeOverrideForClause(input.assertClause) ? input.assertClause : undefined); } - case 271: { + case 274: { if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; } @@ -90692,7 +91568,7 @@ var ts; errorFallbackNode = input; var varDecl = factory.createVariableDeclaration(newId, undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), undefined); errorFallbackNode = undefined; - var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135)] : [], factory.createVariableDeclarationList([varDecl], 2)); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(136)] : [], factory.createVariableDeclarationList([varDecl], 2)); preserveJsDoc(statement, input); ts.removeAllComments(input); return [statement, factory.updateExportAssignment(input, input.modifiers, newId)]; @@ -90704,10 +91580,10 @@ var ts; return input; } function stripExportModifiers(statement) { - if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 512) || !ts.canHaveModifiers(statement)) { + if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 1024) || !ts.canHaveModifiers(statement)) { return statement; } - var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (257023 ^ 1)); + var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (258047 ^ 1)); return factory.updateModifiers(statement, modifiers); } function transformTopLevelDeclaration(input) { @@ -90718,10 +91594,10 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 265: { + case 268: { return transformImportEqualsDeclaration(input); } - case 266: { + case 269: { return transformImportDeclaration(input); } } @@ -90741,12 +91617,16 @@ var ts; } var previousNeedsDeclare = needsDeclare; switch (input.kind) { - case 259: - return cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); - case 258: { + case 262: { + needsDeclare = false; + var clean = cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); + needsDeclare = previousNeedsDeclare; + return clean; + } + case 261: { return cleanup(factory.updateInterfaceDeclaration(input, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree))); } - case 256: { + case 259: { var clean = cleanup(factory.updateFunctionDeclaration(input, ensureModifiers(input), undefined, input.name, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), undefined)); if (clean && resolver.isExpandoFunctionDeclaration(input) && shouldEmitFunctionProperties(input)) { var props = resolver.getPropertiesOfContainerFunction(input); @@ -90781,10 +91661,10 @@ var ts; })))); } var namespaceDecl = factory.createModuleDeclaration(ensureModifiers(input), input.name, factory.createModuleBlock(declarations), 16); - if (!ts.hasEffectiveModifier(clean, 512)) { + if (!ts.hasEffectiveModifier(clean, 1024)) { return [clean, namespaceDecl]; } - var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~513) | 2); + var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~1025) | 2); var cleanDeclaration = factory.updateFunctionDeclaration(clean, modifiers, undefined, clean.name, clean.typeParameters, clean.parameters, clean.type, undefined); var namespaceDeclaration = factory.updateModuleDeclaration(namespaceDecl, modifiers, namespaceDecl.name, namespaceDecl.body); var exportDefaultDeclaration = factory.createExportAssignment(undefined, false, namespaceDecl.name); @@ -90798,10 +91678,10 @@ var ts; return clean; } } - case 261: { + case 264: { needsDeclare = false; var inner = input.body; - if (inner && inner.kind === 262) { + if (inner && inner.kind === 265) { var oldNeedsScopeFix = needsScopeFixMarker; var oldHasScopeFix = resultHasScopeMarker; resultHasScopeMarker = false; @@ -90837,7 +91717,7 @@ var ts; return cleanup(factory.updateModuleDeclaration(input, mods, input.name, body)); } } - case 257: { + case 260: { errorNameNode = input.name; errorFallbackNode = input; var modifiers = factory.createNodeArray(ensureModifiers(input)); @@ -90889,7 +91769,7 @@ var ts; typeName: input.name }); }; var varDecl = factory.createVariableDeclaration(newId_1, undefined, resolver.createTypeOfExpression(extendsClause_1.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), undefined); - var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135)] : [], factory.createVariableDeclarationList([varDecl], 2)); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(136)] : [], factory.createVariableDeclarationList([varDecl], 2)); var heritageClauses = factory.createNodeArray(ts.map(input.heritageClauses, function (clause) { if (clause.token === 94) { var oldDiag_2 = getSymbolAccessibilityDiagnostic; @@ -90907,10 +91787,10 @@ var ts; return cleanup(factory.updateClassDeclaration(input, modifiers, input.name, typeParameters, heritageClauses, members)); } } - case 237: { + case 240: { return cleanup(transformVariableStatement(input)); } - case 260: { + case 263: { return cleanup(factory.updateEnumDeclaration(input, factory.createNodeArray(ensureModifiers(input)), input.name, factory.createNodeArray(ts.mapDefined(input.members, function (m) { if (shouldStripInternal(m)) return; @@ -90927,7 +91807,7 @@ var ts; if (canProdiceDiagnostic) { getSymbolAccessibilityDiagnostic = oldDiag; } - if (input.kind === 261) { + if (input.kind === 264) { needsDeclare = previousNeedsDeclare; } if (node === input) { @@ -90950,7 +91830,7 @@ var ts; return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e); })); } function recreateBindingElement(e) { - if (e.kind === 227) { + if (e.kind === 229) { return; } if (e.name) { @@ -90998,9 +91878,9 @@ var ts; return factory.createModifiersFromModifierFlags(newFlags); } function ensureModifierFlags(node) { - var mask = 257023 ^ (4 | 256 | 16384); + var mask = 258047 ^ (4 | 512 | 16384); var additions = (needsDeclare && !isAlwaysType(node)) ? 2 : 0; - var parentIsFile = node.parent.kind === 305; + var parentIsFile = node.parent.kind === 308; if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) { mask ^= 2; additions = 0; @@ -91027,7 +91907,7 @@ var ts; } ts.transformDeclarations = transformDeclarations; function isAlwaysType(node) { - if (node.kind === 258) { + if (node.kind === 261) { return true; } return false; @@ -91036,20 +91916,20 @@ var ts; return ts.factory.createModifiersFromModifierFlags(maskModifierFlags(node, modifierMask, modifierAdditions)); } function maskModifierFlags(node, modifierMask, modifierAdditions) { - if (modifierMask === void 0) { modifierMask = 257023 ^ 4; } + if (modifierMask === void 0) { modifierMask = 258047 ^ 4; } if (modifierAdditions === void 0) { modifierAdditions = 0; } var flags = (ts.getEffectiveModifierFlags(node) & modifierMask) | modifierAdditions; - if (flags & 512 && !(flags & 1)) { + if (flags & 1024 && !(flags & 1)) { flags ^= 1; } - if (flags & 512 && flags & 2) { + if (flags & 1024 && flags & 2) { flags ^= 2; } return flags; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 172 + return accessor.kind === 174 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type @@ -91058,52 +91938,52 @@ var ts; } function canHaveLiteralInitializer(node) { switch (node.kind) { - case 167: - case 166: + case 169: + case 168: return !ts.hasEffectiveModifier(node, 8); - case 164: - case 254: + case 166: + case 257: return true; } return false; } function isPreservedDeclarationStatement(node) { switch (node.kind) { - case 256: - case 261: - case 265: - case 258: - case 257: case 259: + case 264: + case 268: + case 261: case 260: - case 237: - case 266: - case 272: - case 271: + case 262: + case 263: + case 240: + case 269: + case 275: + case 274: return true; } return false; } function isProcessedComponent(node) { switch (node.kind) { - case 175: - case 171: - case 169: - case 172: + case 177: case 173: - case 167: - case 166: - case 168: + case 171: case 174: + case 175: + case 169: + case 168: + case 170: case 176: - case 254: - case 163: - case 228: case 178: - case 189: - case 179: + case 257: + case 165: + case 230: case 180: - case 200: + case 191: + case 181: + case 182: + case 202: return true; } return false; @@ -91212,7 +92092,7 @@ var ts; } ts.noEmitNotification = noEmitNotification; function transformNodes(resolver, host, factory, options, nodes, transformers, allowDtsFiles) { - var enabledSyntaxKindFeatures = new Array(355); + var enabledSyntaxKindFeatures = new Array(358); var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentStatements; @@ -91288,7 +92168,7 @@ var ts; var transformed = []; for (var _a = 0, nodes_3 = nodes; _a < nodes_3.length; _a++) { var node = nodes_3[_a]; - ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit", "transformNodes", node.kind === 305 ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); + ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit", "transformNodes", node.kind === 308 ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); transformed.push((allowDtsFiles ? transformation : transformRoot)(node)); ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop(); } @@ -91616,7 +92496,7 @@ var ts; ts.getOutputPathsForBundle = getOutputPathsForBundle; function getOutputPathsFor(sourceFile, host, forceDtsPaths) { var options = host.getCompilerOptions(); - if (sourceFile.kind === 306) { + if (sourceFile.kind === 309) { return getOutputPathsForBundle(options, forceDtsPaths); } else { @@ -91956,8 +92836,8 @@ var ts; } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) { var sourceFileOrBundle = transform.transformed[0]; - var bundle = sourceFileOrBundle.kind === 306 ? sourceFileOrBundle : undefined; - var sourceFile = sourceFileOrBundle.kind === 305 ? sourceFileOrBundle : undefined; + var bundle = sourceFileOrBundle.kind === 309 ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 308 ? sourceFileOrBundle : undefined; var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; var sourceMapGenerator; if (shouldEmitSourceMaps(mapOptions, sourceFileOrBundle)) { @@ -92002,7 +92882,7 @@ var ts; } function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) { return (mapOptions.sourceMap || mapOptions.inlineSourceMap) - && (sourceFileOrBundle.kind !== 305 || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json")); + && (sourceFileOrBundle.kind !== 308 || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json")); } function getSourceRoot(mapOptions) { var sourceRoot = ts.normalizeSlashes(mapOptions.sourceRoot || ""); @@ -92051,8 +92931,8 @@ var ts; return JSON.stringify(buildInfo); } ts.getBuildInfoText = getBuildInfoText; - function getBuildInfo(buildInfoText) { - return JSON.parse(buildInfoText); + function getBuildInfo(buildInfoFile, buildInfoText) { + return ts.readJsonOrUndefined(buildInfoFile, buildInfoText); } ts.getBuildInfo = getBuildInfo; ts.notImplementedResolver = { @@ -92126,17 +93006,16 @@ var ts; var _a = getOutputPathsForBundle(config.options, false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath; var buildInfo; if (host.getBuildInfo) { - var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); - if (!hostBuildInfo) - return buildInfoPath; - buildInfo = hostBuildInfo; + buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); } else { var buildInfoText = host.readFile(buildInfoPath); if (!buildInfoText) return buildInfoPath; - buildInfo = getBuildInfo(buildInfoText); + buildInfo = getBuildInfo(buildInfoPath, buildInfoText); } + if (!buildInfo) + return buildInfoPath; if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts)) return buildInfoPath; var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath)); @@ -92246,6 +93125,10 @@ var ts; var nodeIdToGeneratedName; var autoGeneratedIdToGeneratedName; var generatedNames; + var formattedNameTempFlagsStack; + var formattedNameTempFlags; + var privateNameTempFlagsStack; + var privateNameTempFlags; var tempFlagsStack; var tempFlags; var reservedNamesStack; @@ -92307,9 +93190,9 @@ var ts; break; } switch (node.kind) { - case 305: return printFile(node); - case 306: return printBundle(node); - case 307: return printUnparsedSource(node); + case 308: return printFile(node); + case 309: return printBundle(node); + case 310: return printUnparsedSource(node); } writeNode(hint, node, sourceFile, beginPrint()); return endPrint(); @@ -92498,6 +93381,10 @@ var ts; nodeIdToGeneratedName = []; autoGeneratedIdToGeneratedName = []; generatedNames = new ts.Set(); + formattedNameTempFlagsStack = []; + formattedNameTempFlags = new ts.Map(); + privateNameTempFlagsStack = []; + privateNameTempFlags = 0; tempFlagsStack = []; tempFlags = 0; reservedNamesStack = []; @@ -92631,294 +93518,294 @@ var ts; return emitIdentifier(node); case 80: return emitPrivateIdentifier(node); - case 161: - return emitQualifiedName(node); - case 162: - return emitComputedPropertyName(node); case 163: - return emitTypeParameter(node); + return emitQualifiedName(node); case 164: - return emitParameter(node); + return emitComputedPropertyName(node); case 165: - return emitDecorator(node); + return emitTypeParameter(node); case 166: - return emitPropertySignature(node); + return emitParameter(node); case 167: - return emitPropertyDeclaration(node); + return emitDecorator(node); case 168: - return emitMethodSignature(node); + return emitPropertySignature(node); case 169: - return emitMethodDeclaration(node); + return emitPropertyDeclaration(node); case 170: - return emitClassStaticBlockDeclaration(node); + return emitMethodSignature(node); case 171: - return emitConstructor(node); + return emitMethodDeclaration(node); case 172: + return emitClassStaticBlockDeclaration(node); case 173: - return emitAccessorDeclaration(node); + return emitConstructor(node); case 174: - return emitCallSignature(node); case 175: - return emitConstructSignature(node); + return emitAccessorDeclaration(node); case 176: - return emitIndexSignature(node); + return emitCallSignature(node); case 177: - return emitTypePredicate(node); + return emitConstructSignature(node); case 178: - return emitTypeReference(node); + return emitIndexSignature(node); case 179: - return emitFunctionType(node); + return emitTypePredicate(node); case 180: - return emitConstructorType(node); + return emitTypeReference(node); case 181: - return emitTypeQuery(node); + return emitFunctionType(node); case 182: - return emitTypeLiteral(node); + return emitConstructorType(node); case 183: - return emitArrayType(node); + return emitTypeQuery(node); case 184: - return emitTupleType(node); + return emitTypeLiteral(node); case 185: - return emitOptionalType(node); + return emitArrayType(node); + case 186: + return emitTupleType(node); case 187: - return emitUnionType(node); - case 188: - return emitIntersectionType(node); + return emitOptionalType(node); case 189: - return emitConditionalType(node); + return emitUnionType(node); case 190: - return emitInferType(node); + return emitIntersectionType(node); case 191: - return emitParenthesizedType(node); - case 228: - return emitExpressionWithTypeArguments(node); + return emitConditionalType(node); case 192: - return emitThisType(); + return emitInferType(node); case 193: - return emitTypeOperator(node); + return emitParenthesizedType(node); + case 230: + return emitExpressionWithTypeArguments(node); case 194: - return emitIndexedAccessType(node); + return emitThisType(); case 195: - return emitMappedType(node); + return emitTypeOperator(node); case 196: - return emitLiteralType(node); + return emitIndexedAccessType(node); case 197: - return emitNamedTupleMember(node); + return emitMappedType(node); case 198: - return emitTemplateType(node); + return emitLiteralType(node); case 199: - return emitTemplateTypeSpan(node); + return emitNamedTupleMember(node); case 200: - return emitImportTypeNode(node); + return emitTemplateType(node); case 201: - return emitObjectBindingPattern(node); + return emitTemplateTypeSpan(node); case 202: - return emitArrayBindingPattern(node); + return emitImportTypeNode(node); case 203: + return emitObjectBindingPattern(node); + case 204: + return emitArrayBindingPattern(node); + case 205: return emitBindingElement(node); - case 233: - return emitTemplateSpan(node); - case 234: - return emitSemicolonClassElement(); - case 235: - return emitBlock(node); - case 237: - return emitVariableStatement(node); case 236: - return emitEmptyStatement(false); + return emitTemplateSpan(node); + case 237: + return emitSemicolonClassElement(); case 238: - return emitExpressionStatement(node); - case 239: - return emitIfStatement(node); + return emitBlock(node); case 240: - return emitDoStatement(node); + return emitVariableStatement(node); + case 239: + return emitEmptyStatement(false); case 241: - return emitWhileStatement(node); + return emitExpressionStatement(node); case 242: - return emitForStatement(node); + return emitIfStatement(node); case 243: - return emitForInStatement(node); + return emitDoStatement(node); case 244: - return emitForOfStatement(node); + return emitWhileStatement(node); case 245: - return emitContinueStatement(node); + return emitForStatement(node); case 246: - return emitBreakStatement(node); + return emitForInStatement(node); case 247: - return emitReturnStatement(node); + return emitForOfStatement(node); case 248: - return emitWithStatement(node); + return emitContinueStatement(node); case 249: - return emitSwitchStatement(node); + return emitBreakStatement(node); case 250: - return emitLabeledStatement(node); + return emitReturnStatement(node); case 251: - return emitThrowStatement(node); + return emitWithStatement(node); case 252: - return emitTryStatement(node); + return emitSwitchStatement(node); case 253: - return emitDebuggerStatement(node); + return emitLabeledStatement(node); case 254: - return emitVariableDeclaration(node); + return emitThrowStatement(node); case 255: - return emitVariableDeclarationList(node); + return emitTryStatement(node); case 256: - return emitFunctionDeclaration(node); + return emitDebuggerStatement(node); case 257: - return emitClassDeclaration(node); + return emitVariableDeclaration(node); case 258: - return emitInterfaceDeclaration(node); + return emitVariableDeclarationList(node); case 259: - return emitTypeAliasDeclaration(node); + return emitFunctionDeclaration(node); case 260: - return emitEnumDeclaration(node); + return emitClassDeclaration(node); case 261: - return emitModuleDeclaration(node); + return emitInterfaceDeclaration(node); case 262: - return emitModuleBlock(node); + return emitTypeAliasDeclaration(node); case 263: - return emitCaseBlock(node); + return emitEnumDeclaration(node); case 264: - return emitNamespaceExportDeclaration(node); + return emitModuleDeclaration(node); case 265: - return emitImportEqualsDeclaration(node); + return emitModuleBlock(node); case 266: - return emitImportDeclaration(node); + return emitCaseBlock(node); case 267: - return emitImportClause(node); + return emitNamespaceExportDeclaration(node); case 268: - return emitNamespaceImport(node); - case 274: - return emitNamespaceExport(node); + return emitImportEqualsDeclaration(node); case 269: - return emitNamedImports(node); + return emitImportDeclaration(node); case 270: - return emitImportSpecifier(node); + return emitImportClause(node); case 271: - return emitExportAssignment(node); - case 272: - return emitExportDeclaration(node); - case 273: - return emitNamedExports(node); - case 275: - return emitExportSpecifier(node); - case 293: - return emitAssertClause(node); - case 294: - return emitAssertEntry(node); - case 276: - return; + return emitNamespaceImport(node); case 277: + return emitNamespaceExport(node); + case 272: + return emitNamedImports(node); + case 273: + return emitImportSpecifier(node); + case 274: + return emitExportAssignment(node); + case 275: + return emitExportDeclaration(node); + case 276: + return emitNamedExports(node); + case 278: + return emitExportSpecifier(node); + case 296: + return emitAssertClause(node); + case 297: + return emitAssertEntry(node); + case 279: + return; + case 280: return emitExternalModuleReference(node); case 11: return emitJsxText(node); - case 280: case 283: - return emitJsxOpeningElementOrFragment(node); - case 281: - case 284: - return emitJsxClosingElementOrFragment(node); - case 285: - return emitJsxAttribute(node); case 286: - return emitJsxAttributes(node); + return emitJsxOpeningElementOrFragment(node); + case 284: case 287: - return emitJsxSpreadAttribute(node); + return emitJsxClosingElementOrFragment(node); case 288: - return emitJsxExpression(node); + return emitJsxAttribute(node); case 289: - return emitCaseClause(node); + return emitJsxAttributes(node); case 290: - return emitDefaultClause(node); + return emitJsxSpreadAttribute(node); case 291: - return emitHeritageClause(node); + return emitJsxExpression(node); case 292: + return emitCaseClause(node); + case 293: + return emitDefaultClause(node); + case 294: + return emitHeritageClause(node); + case 295: return emitCatchClause(node); - case 296: - return emitPropertyAssignment(node); - case 297: - return emitShorthandPropertyAssignment(node); - case 298: - return emitSpreadAssignment(node); case 299: - return emitEnumMember(node); + return emitPropertyAssignment(node); case 300: - return writeUnparsedNode(node); - case 307: + return emitShorthandPropertyAssignment(node); case 301: - return emitUnparsedSourceOrPrepend(node); + return emitSpreadAssignment(node); case 302: + return emitEnumMember(node); case 303: - return emitUnparsedTextLike(node); - case 304: - return emitUnparsedSyntheticReference(node); - case 305: - return emitSourceFile(node); - case 306: - return ts.Debug.fail("Bundles should be printed using printBundle"); - case 308: - return ts.Debug.fail("InputFiles should not be printed"); - case 309: - return emitJSDocTypeExpression(node); + return writeUnparsedNode(node); case 310: - return emitJSDocNameReference(node); + case 304: + return emitUnparsedSourceOrPrepend(node); + case 305: + case 306: + return emitUnparsedTextLike(node); + case 307: + return emitUnparsedSyntheticReference(node); + case 308: + return emitSourceFile(node); + case 309: + return ts.Debug.fail("Bundles should be printed using printBundle"); + case 311: + return ts.Debug.fail("InputFiles should not be printed"); case 312: - return writePunctuation("*"); + return emitJSDocTypeExpression(node); case 313: - return writePunctuation("?"); - case 314: - return emitJSDocNullableType(node); + return emitJSDocNameReference(node); case 315: - return emitJSDocNonNullableType(node); + return writePunctuation("*"); case 316: - return emitJSDocOptionalType(node); + return writePunctuation("?"); case 317: - return emitJSDocFunctionType(node); - case 186: + return emitJSDocNullableType(node); case 318: - return emitRestOrJSDocVariadicType(node); + return emitJSDocNonNullableType(node); case 319: - return; + return emitJSDocOptionalType(node); case 320: - return emitJSDoc(node); + return emitJSDocFunctionType(node); + case 188: + case 321: + return emitRestOrJSDocVariadicType(node); case 322: - return emitJSDocTypeLiteral(node); - case 323: - return emitJSDocSignature(node); - case 327: - case 332: - case 337: - return emitJSDocSimpleTag(node); - case 328: - case 329: - return emitJSDocHeritageTag(node); - case 330: - case 331: return; + case 323: + return emitJSDoc(node); + case 325: + return emitJSDocTypeLiteral(node); + case 326: + return emitJSDocSignature(node); + case 330: + case 335: + case 340: + return emitJSDocSimpleTag(node); + case 331: + case 332: + return emitJSDocHeritageTag(node); case 333: case 334: - case 335: - case 336: return; + case 336: + case 337: case 338: - return emitJSDocCallbackTag(node); - case 340: - case 347: - return emitJSDocPropertyLikeTag(node); case 339: + return; case 341: - case 342: + return emitJSDocCallbackTag(node); case 343: - return emitJSDocSimpleTypedTag(node); + case 350: + return emitJSDocPropertyLikeTag(node); + case 342: case 344: - return emitJSDocTemplateTag(node); case 345: - return emitJSDocTypedefTag(node); case 346: - return emitJSDocSeeTag(node); + return emitJSDocSimpleTypedTag(node); + case 347: + return emitJSDocTemplateTag(node); + case 348: + return emitJSDocTypedefTag(node); case 349: - case 353: + return emitJSDocSeeTag(node); case 352: + case 356: + case 355: return; } if (ts.isExpression(node)) { @@ -92947,82 +93834,84 @@ var ts; return emitIdentifier(node); case 80: return emitPrivateIdentifier(node); - case 204: - return emitArrayLiteralExpression(node); - case 205: - return emitObjectLiteralExpression(node); case 206: - return emitPropertyAccessExpression(node); + return emitArrayLiteralExpression(node); case 207: - return emitElementAccessExpression(node); + return emitObjectLiteralExpression(node); case 208: - return emitCallExpression(node); + return emitPropertyAccessExpression(node); case 209: - return emitNewExpression(node); + return emitElementAccessExpression(node); case 210: - return emitTaggedTemplateExpression(node); + return emitCallExpression(node); case 211: - return emitTypeAssertionExpression(node); + return emitNewExpression(node); case 212: - return emitParenthesizedExpression(node); + return emitTaggedTemplateExpression(node); case 213: - return emitFunctionExpression(node); + return emitTypeAssertionExpression(node); case 214: - return emitArrowFunction(node); + return emitParenthesizedExpression(node); case 215: - return emitDeleteExpression(node); + return emitFunctionExpression(node); case 216: - return emitTypeOfExpression(node); + return emitArrowFunction(node); case 217: - return emitVoidExpression(node); + return emitDeleteExpression(node); case 218: - return emitAwaitExpression(node); + return emitTypeOfExpression(node); case 219: - return emitPrefixUnaryExpression(node); + return emitVoidExpression(node); case 220: - return emitPostfixUnaryExpression(node); + return emitAwaitExpression(node); case 221: - return emitBinaryExpression(node); + return emitPrefixUnaryExpression(node); case 222: - return emitConditionalExpression(node); + return emitPostfixUnaryExpression(node); case 223: - return emitTemplateExpression(node); + return emitBinaryExpression(node); case 224: - return emitYieldExpression(node); + return emitConditionalExpression(node); case 225: - return emitSpreadElement(node); + return emitTemplateExpression(node); case 226: - return emitClassExpression(node); + return emitYieldExpression(node); case 227: - return; - case 229: - return emitAsExpression(node); - case 230: - return emitNonNullExpression(node); + return emitSpreadElement(node); case 228: - return emitExpressionWithTypeArguments(node); + return emitClassExpression(node); + case 229: + return; case 231: - return emitMetaProperty(node); + return emitAsExpression(node); case 232: + return emitNonNullExpression(node); + case 230: + return emitExpressionWithTypeArguments(node); + case 235: + return emitSatisfiesExpression(node); + case 233: + return emitMetaProperty(node); + case 234: return ts.Debug.fail("SyntheticExpression should never be printed."); - case 278: + case 281: return emitJsxElement(node); - case 279: - return emitJsxSelfClosingElement(node); case 282: + return emitJsxSelfClosingElement(node); + case 285: return emitJsxFragment(node); - case 348: - return ts.Debug.fail("SyntaxList should not be printed"); - case 349: - return; - case 350: - return emitPartiallyEmittedExpression(node); case 351: - return emitCommaList(node); + return ts.Debug.fail("SyntaxList should not be printed"); case 352: - case 353: return; + case 353: + return emitPartiallyEmittedExpression(node); case 354: + return emitCommaList(node); + case 355: + case 356: + return; + case 357: return ts.Debug.fail("SyntheticReferenceExpression should not be printed"); } } @@ -93070,7 +93959,7 @@ var ts; } function emitHelpers(node) { var helpersEmitted = false; - var bundle = node.kind === 306 ? node : undefined; + var bundle = node.kind === 309 ? node : undefined; if (bundle && moduleKind === ts.ModuleKind.None) { return; } @@ -93144,7 +94033,7 @@ var ts; var pos = getTextPosWithWriteLine(); writeUnparsedNode(unparsed); if (bundleFileInfo) { - updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 302 ? + updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 305 ? "text" : "internal"); } @@ -93175,7 +94064,7 @@ var ts; nonEscapingWrite("}"); } function emitTabStop(hint, node, snippet) { - ts.Debug.assert(node.kind === 236, "A tab stop cannot be attached to a node of kind ".concat(ts.Debug.formatSyntaxKind(node.kind), ".")); + ts.Debug.assert(node.kind === 239, "A tab stop cannot be attached to a node of kind ".concat(ts.Debug.formatSyntaxKind(node.kind), ".")); ts.Debug.assert(hint !== 5, "A tab stop cannot be attached to an embedded statement."); nonEscapingWrite("$".concat(snippet.order)); } @@ -93227,7 +94116,7 @@ var ts; emit(node.dotDotDotToken); emitNodeWithWriter(node.name, writeParameter); emit(node.questionToken); - if (node.parent && node.parent.kind === 317 && !node.name) { + if (node.parent && node.parent.kind === 320 && !node.name) { emit(node.type); } else { @@ -93284,7 +94173,7 @@ var ts; } function emitAccessorDeclaration(node) { emitDecoratorsAndModifiers(node, node.modifiers); - writeKeyword(node.kind === 172 ? "get" : "set"); + writeKeyword(node.kind === 174 ? "get" : "set"); writeSpace(); emit(node.name); emitSignatureAndBody(node, emitSignatureHead); @@ -93454,7 +94343,7 @@ var ts; function emitTypeOperator(node) { writeTokenText(node.operator, writeKeyword); writeSpace(); - var parenthesizerRule = node.operator === 145 ? + var parenthesizerRule = node.operator === 146 ? parenthesizer.parenthesizeOperandOfReadonlyTypeOperator : parenthesizer.parenthesizeOperandOfTypeOperator; emit(node.type, parenthesizerRule); @@ -93477,7 +94366,7 @@ var ts; } if (node.readonlyToken) { emit(node.readonlyToken); - if (node.readonlyToken.kind !== 145) { + if (node.readonlyToken.kind !== 146) { writeKeyword("readonly"); } writeSpace(); @@ -93710,7 +94599,7 @@ var ts; emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } function emitAwaitExpression(node) { - emitTokenWithComment(132, node.pos, writeKeyword, node); + emitTokenWithComment(133, node.pos, writeKeyword, node); writeSpace(); emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } @@ -93723,7 +94612,7 @@ var ts; } function shouldEmitWhitespaceBeforeOperand(node) { var operand = node.operand; - return operand.kind === 219 + return operand.kind === 221 && ((node.operator === 39 && (operand.operator === 39 || operand.operator === 45)) || (node.operator === 40 && (operand.operator === 40 || operand.operator === 46))); } @@ -93871,6 +94760,15 @@ var ts; emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess); writeOperator("!"); } + function emitSatisfiesExpression(node) { + emitExpression(node.expression, undefined); + if (node.type) { + writeSpace(); + writeKeyword("satisfies"); + writeSpace(); + emit(node.type); + } + } function emitMetaProperty(node) { writeToken(node.keywordToken, node.pos, writePunctuation); writePunctuation("."); @@ -93918,7 +94816,7 @@ var ts; if (node.elseStatement) { writeLineOrSpace(node, node.thenStatement, node.elseStatement); emitTokenWithComment(91, node.thenStatement.end, writeKeyword, node); - if (node.elseStatement.kind === 239) { + if (node.elseStatement.kind === 242) { writeSpace(); emit(node.elseStatement); } @@ -93981,7 +94879,7 @@ var ts; emitTokenWithComment(20, openParenPos, writePunctuation, node); emitForBinding(node.initializer); writeSpace(); - emitTokenWithComment(160, node.initializer.end, writeKeyword, node); + emitTokenWithComment(162, node.initializer.end, writeKeyword, node); writeSpace(); emitExpression(node.expression); emitTokenWithComment(21, node.expression.end, writePunctuation, node); @@ -93989,7 +94887,7 @@ var ts; } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 255) { + if (node.kind === 258) { emit(node); } else { @@ -94026,7 +94924,7 @@ var ts; } pos = writeTokenText(token, writer, pos); if (isSimilarNode && contextNode.end !== pos) { - var isJsxExprContext = contextNode.kind === 288; + var isJsxExprContext = contextNode.kind === 291; emitTrailingCommentsOfPosition(pos, !isJsxExprContext, isJsxExprContext); } return pos; @@ -94321,7 +95219,7 @@ var ts; emitTokenWithComment(100, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - emitTokenWithComment(152, node.pos, writeKeyword, node); + emitTokenWithComment(154, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); @@ -94346,7 +95244,7 @@ var ts; if (node.importClause) { emit(node.importClause); writeSpace(); - emitTokenWithComment(156, node.importClause.end, writeKeyword, node); + emitTokenWithComment(158, node.importClause.end, writeKeyword, node); writeSpace(); } emitExpression(node.moduleSpecifier); @@ -94357,7 +95255,7 @@ var ts; } function emitImportClause(node) { if (node.isTypeOnly) { - emitTokenWithComment(152, node.pos, writeKeyword, node); + emitTokenWithComment(154, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); @@ -94370,7 +95268,7 @@ var ts; function emitNamespaceImport(node) { var asPos = emitTokenWithComment(41, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(127, asPos, writeKeyword, node); + emitTokenWithComment(128, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -94396,10 +95294,11 @@ var ts; writeTrailingSemicolon(); } function emitExportDeclaration(node) { + emitModifiers(node, node.modifiers); var nextPos = emitTokenWithComment(93, node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - nextPos = emitTokenWithComment(152, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(154, nextPos, writeKeyword, node); writeSpace(); } if (node.exportClause) { @@ -94411,7 +95310,7 @@ var ts; if (node.moduleSpecifier) { writeSpace(); var fromPos = node.exportClause ? node.exportClause.end : nextPos; - emitTokenWithComment(156, fromPos, writeKeyword, node); + emitTokenWithComment(158, fromPos, writeKeyword, node); writeSpace(); emitExpression(node.moduleSpecifier); } @@ -94421,7 +95320,7 @@ var ts; writeTrailingSemicolon(); } function emitAssertClause(node) { - emitTokenWithComment(129, node.pos, writeKeyword, node); + emitTokenWithComment(130, node.pos, writeKeyword, node); writeSpace(); var elements = node.elements; emitList(node, elements, 526226); @@ -94440,9 +95339,9 @@ var ts; function emitNamespaceExportDeclaration(node) { var nextPos = emitTokenWithComment(93, node.pos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(127, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(128, nextPos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(142, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(143, nextPos, writeKeyword, node); writeSpace(); emit(node.name); writeTrailingSemicolon(); @@ -94450,7 +95349,7 @@ var ts; function emitNamespaceExport(node) { var asPos = emitTokenWithComment(41, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(127, asPos, writeKeyword, node); + emitTokenWithComment(128, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -94473,7 +95372,7 @@ var ts; if (node.propertyName) { emit(node.propertyName); writeSpace(); - emitTokenWithComment(127, node.propertyName.end, writeKeyword, node); + emitTokenWithComment(128, node.propertyName.end, writeKeyword, node); writeSpace(); } emit(node.name); @@ -94667,7 +95566,7 @@ var ts; } } if (node.tags) { - if (node.tags.length === 1 && node.tags[0].kind === 343 && !node.comment) { + if (node.tags.length === 1 && node.tags[0].kind === 346 && !node.comment) { writeSpace(); emit(node.tags[0]); } @@ -94712,7 +95611,7 @@ var ts; function emitJSDocTypedefTag(tag) { emitJSDocTagName(tag.tagName); if (tag.typeExpression) { - if (tag.typeExpression.kind === 309) { + if (tag.typeExpression.kind === 312) { emitJSDocTypeExpression(tag.typeExpression); } else { @@ -94731,7 +95630,7 @@ var ts; emit(tag.fullName); } emitJSDocComment(tag.comment); - if (tag.typeExpression && tag.typeExpression.kind === 322) { + if (tag.typeExpression && tag.typeExpression.kind === 325) { emitJSDocTypeLiteral(tag.typeExpression); } } @@ -95568,13 +96467,13 @@ var ts; && (!currentSourceFile || ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile)); } function skipSynthesizedParentheses(node) { - while (node.kind === 212 && ts.nodeIsSynthesized(node)) { + while (node.kind === 214 && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; } function getTextOfNode(node, includeTrivia) { - if (ts.isGeneratedIdentifier(node)) { + if (ts.isGeneratedIdentifier(node) || ts.isGeneratedPrivateIdentifier(node)) { return generateName(node); } if (ts.isStringLiteral(node) && node.textSourceNode) { @@ -95598,7 +96497,7 @@ var ts; function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) { if (node.kind === 10 && node.textSourceNode) { var textSourceNode = node.textSourceNode; - if (ts.isIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) { + if (ts.isIdentifier(textSourceNode) || ts.isPrivateIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) { var text = ts.isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode(textSourceNode); return jsxAttributeEscape ? "\"".concat(ts.escapeJsxAttributeString(text), "\"") : neverAsciiEscape || (ts.getEmitFlags(node) & 16777216) ? "\"".concat(ts.escapeString(text), "\"") : @@ -95620,6 +96519,10 @@ var ts; } tempFlagsStack.push(tempFlags); tempFlags = 0; + privateNameTempFlagsStack.push(privateNameTempFlags); + privateNameTempFlags = 0; + formattedNameTempFlagsStack.push(formattedNameTempFlags); + formattedNameTempFlags = undefined; reservedNamesStack.push(reservedNames); } function popNameGenerationScope(node) { @@ -95627,6 +96530,8 @@ var ts; return; } tempFlags = tempFlagsStack.pop(); + privateNameTempFlags = privateNameTempFlagsStack.pop(); + formattedNameTempFlags = formattedNameTempFlagsStack.pop(); reservedNames = reservedNamesStack.pop(); } function reserveNameInNestedScopes(name) { @@ -95639,84 +96544,84 @@ var ts; if (!node) return; switch (node.kind) { - case 235: + case 238: ts.forEach(node.statements, generateNames); break; - case 250: - case 248: - case 240: - case 241: + case 253: + case 251: + case 243: + case 244: generateNames(node.statement); break; - case 239: + case 242: generateNames(node.thenStatement); generateNames(node.elseStatement); break; - case 242: - case 244: - case 243: + case 245: + case 247: + case 246: generateNames(node.initializer); generateNames(node.statement); break; - case 249: + case 252: generateNames(node.caseBlock); break; - case 263: + case 266: ts.forEach(node.clauses, generateNames); break; - case 289: - case 290: + case 292: + case 293: ts.forEach(node.statements, generateNames); break; - case 252: + case 255: generateNames(node.tryBlock); generateNames(node.catchClause); generateNames(node.finallyBlock); break; - case 292: + case 295: generateNames(node.variableDeclaration); generateNames(node.block); break; - case 237: + case 240: generateNames(node.declarationList); break; - case 255: + case 258: ts.forEach(node.declarations, generateNames); break; - case 254: - case 164: - case 203: case 257: + case 166: + case 205: + case 260: generateNameIfNeeded(node.name); break; - case 256: + case 259: generateNameIfNeeded(node.name); if (ts.getEmitFlags(node) & 524288) { ts.forEach(node.parameters, generateNames); generateNames(node.body); } break; - case 201: - case 202: + case 203: + case 204: ts.forEach(node.elements, generateNames); break; - case 266: + case 269: generateNames(node.importClause); break; - case 267: + case 270: generateNameIfNeeded(node.name); generateNames(node.namedBindings); break; - case 268: + case 271: generateNameIfNeeded(node.name); break; - case 274: + case 277: generateNameIfNeeded(node.name); break; - case 269: + case 272: ts.forEach(node.elements, generateNames); break; - case 270: + case 273: generateNameIfNeeded(node.propertyName || node.name); break; } @@ -95725,19 +96630,19 @@ var ts; if (!node) return; switch (node.kind) { - case 296: - case 297: - case 167: + case 299: + case 300: case 169: - case 172: - case 173: + case 171: + case 174: + case 175: generateNameIfNeeded(node.name); break; } } function generateNameIfNeeded(name) { if (name) { - if (ts.isGeneratedIdentifier(name)) { + if (ts.isGeneratedIdentifier(name) || ts.isGeneratedPrivateIdentifier(name)) { generateName(name); } else if (ts.isBindingPattern(name)) { @@ -95747,16 +96652,16 @@ var ts; } function generateName(name) { if ((name.autoGenerateFlags & 7) === 4) { - return generateNameCached(getNodeForGeneratedName(name), name.autoGenerateFlags); + return generateNameCached(ts.getNodeForGeneratedName(name), ts.isPrivateIdentifier(name), name.autoGenerateFlags, name.autoGeneratePrefix, name.autoGenerateSuffix); } else { var autoGenerateId = name.autoGenerateId; return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = makeName(name)); } } - function generateNameCached(node, flags) { + function generateNameCached(node, privateName, flags, prefix, suffix) { var nodeId = ts.getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, flags)); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, privateName, flags !== null && flags !== void 0 ? flags : 0, ts.formatGeneratedNamePart(prefix, generateName), ts.formatGeneratedNamePart(suffix))); } function isUniqueName(name) { return isFileLevelUniqueName(name) @@ -95777,15 +96682,47 @@ var ts; } return true; } - function makeTempVariableName(flags, reservedInNestedScopes) { + function getTempFlags(formattedNameKey) { + var _a; + switch (formattedNameKey) { + case "": + return tempFlags; + case "#": + return privateNameTempFlags; + default: + return (_a = formattedNameTempFlags === null || formattedNameTempFlags === void 0 ? void 0 : formattedNameTempFlags.get(formattedNameKey)) !== null && _a !== void 0 ? _a : 0; + } + } + function setTempFlags(formattedNameKey, flags) { + switch (formattedNameKey) { + case "": + tempFlags = flags; + break; + case "#": + privateNameTempFlags = flags; + break; + default: + formattedNameTempFlags !== null && formattedNameTempFlags !== void 0 ? formattedNameTempFlags : (formattedNameTempFlags = new ts.Map()); + formattedNameTempFlags.set(formattedNameKey, flags); + break; + } + } + function makeTempVariableName(flags, reservedInNestedScopes, privateName, prefix, suffix) { + if (prefix.length > 0 && prefix.charCodeAt(0) === 35) { + prefix = prefix.slice(1); + } + var key = ts.formatGeneratedName(privateName, prefix, "", suffix); + var tempFlags = getTempFlags(key); if (flags && !(tempFlags & flags)) { var name = flags === 268435456 ? "_i" : "_n"; - if (isUniqueName(name)) { + var fullName = ts.formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { tempFlags |= flags; if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } while (true) { @@ -95795,26 +96732,35 @@ var ts; var name = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); - if (isUniqueName(name)) { + var fullName = ts.formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } } } - function makeUniqueName(baseName, checkFn, optimistic, scoped) { + function makeUniqueName(baseName, checkFn, optimistic, scoped, privateName, prefix, suffix) { if (checkFn === void 0) { checkFn = isUniqueName; } + if (baseName.length > 0 && baseName.charCodeAt(0) === 35) { + baseName = baseName.slice(1); + } + if (prefix.length > 0 && prefix.charCodeAt(0) === 35) { + prefix = prefix.slice(1); + } if (optimistic) { - if (checkFn(baseName)) { + var fullName = ts.formatGeneratedName(privateName, prefix, baseName, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(baseName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(baseName); + generatedNames.add(fullName); } - return baseName; + return fullName; } } if (baseName.charCodeAt(baseName.length - 1) !== 95) { @@ -95822,95 +96768,88 @@ var ts; } var i = 1; while (true) { - var generatedName = baseName + i; - if (checkFn(generatedName)) { + var fullName = ts.formatGeneratedName(privateName, prefix, baseName + i, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(generatedName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(generatedName); + generatedNames.add(fullName); } - return generatedName; + return fullName; } i++; } } function makeFileLevelOptimisticUniqueName(name) { - return makeUniqueName(name, isFileLevelUniqueName, true); + return makeUniqueName(name, isFileLevelUniqueName, true, false, false, "", ""); } function generateNameForModuleOrEnum(node) { var name = getTextOfNode(node.name); - return isUniqueLocalName(name, node) ? name : makeUniqueName(name); + return isUniqueLocalName(name, node) ? name : makeUniqueName(name, isUniqueName, false, false, false, "", ""); } function generateNameForImportOrExportDeclaration(node) { var expr = ts.getExternalModuleName(node); var baseName = ts.isStringLiteral(expr) ? ts.makeIdentifierFromModuleName(expr.text) : "module"; - return makeUniqueName(baseName); + return makeUniqueName(baseName, isUniqueName, false, false, false, "", ""); } function generateNameForExportDefault() { - return makeUniqueName("default"); + return makeUniqueName("default", isUniqueName, false, false, false, "", ""); } function generateNameForClassExpression() { - return makeUniqueName("class"); + return makeUniqueName("class", isUniqueName, false, false, false, "", ""); } - function generateNameForMethodOrAccessor(node) { + function generateNameForMethodOrAccessor(node, privateName, prefix, suffix) { if (ts.isIdentifier(node.name)) { - return generateNameCached(node.name); + return generateNameCached(node.name, privateName); } - return makeTempVariableName(0); + return makeTempVariableName(0, false, privateName, prefix, suffix); } - function generateNameForNode(node, flags) { + function generateNameForNode(node, privateName, flags, prefix, suffix) { switch (node.kind) { case 79: - return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16), !!(flags & 8)); - case 261: - case 260: + case 80: + return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16), !!(flags & 8), privateName, prefix, suffix); + case 264: + case 263: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForModuleOrEnum(node); - case 266: - case 272: + case 269: + case 275: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForImportOrExportDeclaration(node); - case 256: - case 257: - case 271: + case 259: + case 260: + case 274: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForExportDefault(); - case 226: + case 228: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForClassExpression(); - case 169: - case 172: - case 173: - return generateNameForMethodOrAccessor(node); - case 162: - return makeTempVariableName(0, true); + case 171: + case 174: + case 175: + return generateNameForMethodOrAccessor(node, privateName, prefix, suffix); + case 164: + return makeTempVariableName(0, true, privateName, prefix, suffix); default: - return makeTempVariableName(0); + return makeTempVariableName(0, false, privateName, prefix, suffix); } } function makeName(name) { + var prefix = ts.formatGeneratedNamePart(name.autoGeneratePrefix, generateName); + var suffix = ts.formatGeneratedNamePart(name.autoGenerateSuffix); switch (name.autoGenerateFlags & 7) { case 1: - return makeTempVariableName(0, !!(name.autoGenerateFlags & 8)); + return makeTempVariableName(0, !!(name.autoGenerateFlags & 8), ts.isPrivateIdentifier(name), prefix, suffix); case 2: - return makeTempVariableName(268435456, !!(name.autoGenerateFlags & 8)); + ts.Debug.assertNode(name, ts.isIdentifier); + return makeTempVariableName(268435456, !!(name.autoGenerateFlags & 8), false, prefix, suffix); case 3: - return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16), !!(name.autoGenerateFlags & 8)); + return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16), !!(name.autoGenerateFlags & 8), ts.isPrivateIdentifier(name), prefix, suffix); } - return ts.Debug.fail("Unsupported GeneratedIdentifierKind."); - } - function getNodeForGeneratedName(name) { - var autoGenerateId = name.autoGenerateId; - var node = name; - var original = node.original; - while (original) { - node = original; - if (ts.isIdentifier(node) - && !!(node.autoGenerateFlags & 4) - && node.autoGenerateId !== autoGenerateId) { - break; - } - original = node.original; - } - return node; + return ts.Debug.fail("Unsupported GeneratedIdentifierKind: ".concat(ts.Debug.formatEnum(name.autoGenerateFlags & 7, ts.GeneratedIdentifierFlags, true), ".")); } function pipelineEmitWithComments(hint, node) { var pipelinePhase = getNextPipelinePhase(2, hint, node); @@ -95948,14 +96887,14 @@ var ts; var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0 || node.kind === 11; if ((pos > 0 || end > 0) && pos !== end) { if (!skipLeadingComments) { - emitLeadingComments(pos, node.kind !== 349); + emitLeadingComments(pos, node.kind !== 352); } if (!skipLeadingComments || (pos >= 0 && (emitFlags & 512) !== 0)) { containerPos = pos; } if (!skipTrailingComments || (end >= 0 && (emitFlags & 1024) !== 0)) { containerEnd = end; - if (node.kind === 255) { + if (node.kind === 258) { declarationListContainerEnd = end; } } @@ -95971,7 +96910,7 @@ var ts; containerPos = savedContainerPos; containerEnd = savedContainerEnd; declarationListContainerEnd = savedDeclarationListContainerEnd; - if (!skipTrailingComments && node.kind !== 349) { + if (!skipTrailingComments && node.kind !== 352) { emitTrailingComments(end); } } @@ -96228,7 +97167,7 @@ var ts; } else { var source = sourceMapRange.source || sourceMapSource; - if (node.kind !== 349 + if (node.kind !== 352 && (emitFlags & 16) === 0 && sourceMapRange.pos >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, skipSourceTrivia(source, sourceMapRange.pos)); @@ -96245,7 +97184,7 @@ var ts; if (emitFlags & 64) { sourceMapsDisabled = false; } - if (node.kind !== 349 + if (node.kind !== 352 && (emitFlags & 32) === 0 && sourceMapRange.end >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, sourceMapRange.end); @@ -96380,7 +97319,15 @@ var ts; return cachedReadDirectoryResult.get(ts.ensureTrailingDirectorySeparator(rootDirPath)); } function getCachedFileSystemEntriesForBaseDir(path) { - return getCachedFileSystemEntries(ts.getDirectoryPath(path)); + var entries = getCachedFileSystemEntries(ts.getDirectoryPath(path)); + if (!entries) { + return entries; + } + if (!entries.sortedAndCanonicalizedFiles) { + entries.sortedAndCanonicalizedFiles = entries.files.map(getCanonicalFileName).sort(); + entries.sortedAndCanonicalizedDirectories = entries.directories.map(getCanonicalFileName).sort(); + } + return entries; } function getBaseNameOfFileName(fileName) { return ts.getBaseFileName(ts.normalizePath(fileName)); @@ -96415,21 +97362,9 @@ var ts; return undefined; } } - function fileNameEqual(name1, name2) { - return getCanonicalFileName(name1) === getCanonicalFileName(name2); - } function hasEntry(entries, name) { - return ts.some(entries, function (file) { return fileNameEqual(file, name); }); - } - function updateFileSystemEntry(entries, baseName, isValid) { - if (hasEntry(entries, baseName)) { - if (!isValid) { - return ts.filterMutate(entries, function (entry) { return !fileNameEqual(entry, baseName); }); - } - } - else if (isValid) { - return entries.push(baseName); - } + var index = ts.binarySearch(entries, name, ts.identity, ts.compareStringsCaseSensitive); + return index >= 0; } function writeFile(fileName, data, writeByteOrderMark) { var path = toPath(fileName); @@ -96442,7 +97377,7 @@ var ts; function fileExists(fileName) { var path = toPath(fileName); var result = getCachedFileSystemEntriesForBaseDir(path); - return result && hasEntry(result.files, getBaseNameOfFileName(fileName)) || + return result && hasEntry(result.sortedAndCanonicalizedFiles, getCanonicalFileName(getBaseNameOfFileName(fileName))) || host.fileExists(fileName); } function directoryExists(dirPath) { @@ -96452,9 +97387,13 @@ var ts; function createDirectory(dirPath) { var path = toPath(dirPath); var result = getCachedFileSystemEntriesForBaseDir(path); - var baseFileName = getBaseNameOfFileName(dirPath); if (result) { - updateFileSystemEntry(result.directories, baseFileName, true); + var baseName = getBaseNameOfFileName(dirPath); + var canonicalizedBaseName = getCanonicalFileName(baseName); + var canonicalizedDirectories = result.sortedAndCanonicalizedDirectories; + if (ts.insertSorted(canonicalizedDirectories, canonicalizedBaseName, ts.compareStringsCaseSensitive)) { + result.directories.push(baseName); + } } host.createDirectory(dirPath); } @@ -96518,7 +97457,7 @@ var ts; fileExists: host.fileExists(fileOrDirectoryPath), directoryExists: host.directoryExists(fileOrDirectoryPath) }; - if (fsQueryResult.directoryExists || hasEntry(parentResult.directories, baseName)) { + if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) { clearCache(); } else { @@ -96536,7 +97475,21 @@ var ts; } } function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists) { - updateFileSystemEntry(parentResult.files, baseName, fileExists); + var canonicalizedFiles = parentResult.sortedAndCanonicalizedFiles; + var canonicalizedBaseName = getCanonicalFileName(baseName); + if (fileExists) { + if (ts.insertSorted(canonicalizedFiles, canonicalizedBaseName, ts.compareStringsCaseSensitive)) { + parentResult.files.push(baseName); + } + } + else { + var sortedIndex = ts.binarySearch(canonicalizedFiles, canonicalizedBaseName, ts.identity, ts.compareStringsCaseSensitive); + if (sortedIndex >= 0) { + canonicalizedFiles.splice(sortedIndex, 1); + var unsortedIndex = parentResult.files.findIndex(function (entry) { return getCanonicalFileName(entry) === canonicalizedBaseName; }); + parentResult.files.splice(unsortedIndex, 1); + } + } } function clearCache() { cachedReadDirectoryResult.clear(); @@ -97225,7 +98178,6 @@ var ts; return resolutions; } ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache; - ; function getModeForFileReference(ref, containingFileMode) { return (ts.isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode; } @@ -97471,7 +98423,7 @@ var ts; state.failedLookupLocations = packageJsonLocations; state.affectingLocations = packageJsonLocations; var packageJsonScope = ts.getPackageScopeForPath(fileName, state); - var impliedNodeFormat = (packageJsonScope === null || packageJsonScope === void 0 ? void 0 : packageJsonScope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS; + var impliedNodeFormat = (packageJsonScope === null || packageJsonScope === void 0 ? void 0 : packageJsonScope.contents.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS; return { impliedNodeFormat: impliedNodeFormat, packageJsonLocations: packageJsonLocations, packageJsonScope: packageJsonScope }; } } @@ -98520,86 +99472,89 @@ var ts; return diagnostics; function walk(node, parent) { switch (parent.kind) { - case 164: - case 167: + case 166: case 169: + case 171: if (parent.questionToken === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?")); return "skip"; } - case 168: - case 171: - case 172: + case 170: case 173: - case 213: - case 256: - case 214: - case 254: + case 174: + case 175: + case 215: + case 259: + case 216: + case 257: if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_annotations_can_only_be_used_in_TypeScript_files)); return "skip"; } } switch (node.kind) { - case 267: + case 270: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "import type")); return "skip"; } break; - case 272: + case 275: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "export type")); return "skip"; } break; - case 270: - case 275: + case 273: + case 278: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, ts.isImportSpecifier(node) ? "import...type" : "export...type")); return "skip"; } break; - case 265: + case 268: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_TypeScript_files)); return "skip"; - case 271: + case 274: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 291: + case 294: var heritageClause = node; if (heritageClause.token === 117) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 258: + case 261: var interfaceKeyword = ts.tokenToString(118); ts.Debug.assertIsDefined(interfaceKeyword); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, interfaceKeyword)); return "skip"; - case 261: - var moduleKeyword = node.flags & 16 ? ts.tokenToString(142) : ts.tokenToString(141); + case 264: + var moduleKeyword = node.flags & 16 ? ts.tokenToString(143) : ts.tokenToString(142); ts.Debug.assertIsDefined(moduleKeyword); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, moduleKeyword)); return "skip"; - case 259: + case 262: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files)); return "skip"; - case 260: + case 263: var enumKeyword = ts.Debug.checkDefined(ts.tokenToString(92)); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, enumKeyword)); return "skip"; - case 230: + case 232: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Non_null_assertions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 229: + case 231: diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_assertion_expressions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 211: + case 235: + diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files)); + return "skip"; + case 213: ts.Debug.fail(); } } @@ -98608,48 +99563,50 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning)); } switch (parent.kind) { - case 257: - case 226: - case 169: + case 260: + case 228: case 171: - case 172: case 173: - case 213: - case 256: - case 214: + case 174: + case 175: + case 215: + case 259: + case 216: if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files)); return "skip"; } - case 237: + case 240: if (nodes === parent.modifiers) { - checkModifiers(parent.modifiers, parent.kind === 237); + checkModifiers(parent.modifiers, parent.kind === 240); return "skip"; } break; - case 167: + case 169: if (nodes === parent.modifiers) { for (var _i = 0, _a = nodes; _i < _a.length; _i++) { var modifier = _a[_i]; - if (ts.isModifier(modifier) && modifier.kind !== 124) { + if (ts.isModifier(modifier) + && modifier.kind !== 124 + && modifier.kind !== 127) { diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind))); } } return "skip"; } break; - case 164: + case 166: if (nodes === parent.modifiers && ts.some(nodes, ts.isModifier)) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Parameter_modifiers_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 208: - case 209: - case 228: - case 279: - case 280: case 210: + case 211: + case 230: + case 282: + case 283: + case 212: if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_arguments_can_only_be_used_in_TypeScript_files)); return "skip"; @@ -98668,17 +99625,18 @@ var ts; case 123: case 121: case 122: - case 145: - case 135: + case 146: + case 136: case 126: - case 159: + case 161: case 101: - case 144: + case 145: diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind))); break; case 124: case 93: case 88: + case 127: } } } @@ -98966,7 +99924,7 @@ var ts; return result; } function getCreateSourceFileOptions(fileName, moduleResolutionCache, host, options) { - var result = getImpliedNodeFormatForFileWorker(toPath(fileName), moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options); + var result = getImpliedNodeFormatForFileWorker(ts.getNormalizedAbsolutePath(fileName, currentDirectory), moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options); var languageVersion = ts.getEmitScriptTarget(options); var setExternalModuleIndicator = ts.getSetExternalModuleIndicator(options); return typeof result === "object" ? __assign(__assign({}, result), { languageVersion: languageVersion, setExternalModuleIndicator: setExternalModuleIndicator }) : @@ -99509,10 +100467,12 @@ var ts; if (options.preserveConstEnums === false) { createDiagnosticForOptionName(ts.Diagnostics.Option_preserveConstEnums_cannot_be_disabled_when_isolatedModules_is_enabled, "preserveConstEnums", "isolatedModules"); } - var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !ts.isSourceFileJS(f) && !f.isDeclarationFile && f.scriptKind !== 6; }); - if (firstNonExternalModuleSourceFile) { - var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(firstNonExternalModuleSourceFile.fileName))); + for (var _a = 0, files_5 = files; _a < files_5.length; _a++) { + var file = files_5[_a]; + if (!ts.isExternalModule(file) && !ts.isSourceFileJS(file) && !file.isDeclarationFile && file.scriptKind !== 6) { + var span = ts.getErrorSpanForNode(file, file); + programDiagnostics.add(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(file.fileName))); + } } } else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 && options.module === ts.ModuleKind.None) { @@ -102720,7 +103680,7 @@ var ts; importedFileFromNodeModules = importedFileFromNodeModules || isInNodeModules; }); var sortedPaths = []; - var _loop_35 = function (directory) { + var _loop_36 = function (directory) { var directoryStart = ts.ensureTrailingDirectorySeparator(directory); var pathsInDirectory; allFileNames.forEach(function (_a, fileName) { @@ -102744,9 +103704,9 @@ var ts; }; var out_directory_1; for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) { - var state_11 = _loop_35(directory); + var state_12 = _loop_36(directory); directory = out_directory_1; - if (state_11 === "break") + if (state_12 === "break") break; } if (allFileNames.size) { @@ -102805,7 +103765,7 @@ var ts; } function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) { for (var key in paths) { - var _loop_36 = function (patternText_1) { + var _loop_37 = function (patternText_1) { var pattern = ts.normalizePath(patternText_1); var indexOfStar = pattern.indexOf("*"); var candidates = allowedEndings.map(function (ending) { return ({ @@ -102836,9 +103796,9 @@ var ts; }; for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) { var patternText_1 = _a[_i]; - var state_12 = _loop_36(patternText_1); - if (typeof state_12 === "object") - return state_12.value; + var state_13 = _loop_37(patternText_1); + if (typeof state_13 === "object") + return state_13.value; } } function validateEnding(_a) { @@ -102976,7 +103936,7 @@ var ts; var maybeBlockedByTypesVersions = false; var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath); if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) { - var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath)); + var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath)); var importMode = overrideMode || importingSourceFile.impliedNodeFormat; if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) { var conditions = ["node", importMode === ts.ModuleKind.ESNext ? "import" : "require", "types"]; @@ -103308,7 +104268,7 @@ var ts; break; case ts.ModuleKind.CommonJS: if (file.packageJsonScope) { - (result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(undefined, file.packageJsonScope.packageJsonContent.type ? + (result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(undefined, file.packageJsonScope.contents.packageJsonContent.type ? ts.Diagnostics.File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module : ts.Diagnostics.File_is_CommonJS_module_because_0_does_not_have_field_type, toFileName(ts.last(file.packageJsonLocations), fileNameConvertor))); } @@ -103690,18 +104650,14 @@ var ts; var buildInfo; if (host.getBuildInfo) { buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath); - if (!buildInfo) - return undefined; } else { var content = host.readFile(buildInfoPath); if (!content) return undefined; - buildInfo = ts.getBuildInfo(content); + buildInfo = ts.getBuildInfo(buildInfoPath, content); } - if (buildInfo.version !== ts.version) - return undefined; - if (!buildInfo.program) + if (!buildInfo || buildInfo.version !== ts.version || !buildInfo.program) return undefined; return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host); } @@ -103914,7 +104870,8 @@ var ts; } } var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution); - if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + 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 (hasChangedConfigFileParsingErrors) { if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); @@ -103933,6 +104890,11 @@ var ts; if (host.afterProgramCreate && program !== builderProgram) { host.afterProgramCreate(builderProgram); } + compilerHost.readFile = originalReadFile; + compilerHost.fileExists = originalFileExists; + compilerHost.directoryExists = originalDirectoryExists; + compilerHost.createDirectory = originalCreateDirectory; + compilerHost.writeFile = originalWriteFile; return builderProgram; } function createNewProgram(hasInvalidatedResolution) { @@ -104352,16 +105314,17 @@ var ts; UpToDateStatusType[UpToDateStatusType["UpToDateWithUpstreamTypes"] = 2] = "UpToDateWithUpstreamTypes"; UpToDateStatusType[UpToDateStatusType["OutOfDateWithPrepend"] = 3] = "OutOfDateWithPrepend"; UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing"; - UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf"; - UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream"; - UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo"; - UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate"; - UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked"; - UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream"; - UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate"; - UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText"; - UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly"; - UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild"; + UpToDateStatusType[UpToDateStatusType["ErrorReadingFile"] = 5] = "ErrorReadingFile"; + UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 6] = "OutOfDateWithSelf"; + UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 7] = "OutOfDateWithUpstream"; + UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 8] = "OutOfDateBuildInfo"; + UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 9] = "UpstreamOutOfDate"; + UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 10] = "UpstreamBlocked"; + UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 11] = "ComputingUpstream"; + UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 12] = "TsVersionOutputOfDate"; + UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 13] = "UpToDateWithInputFileText"; + UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 14] = "ContainerOnly"; + UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 15] = "ForceBuild"; })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {})); function resolveConfigFileProjectName(project) { if (ts.fileExtensionIs(project, ".json")) { @@ -104561,6 +105524,7 @@ var ts; if (value) { return isParsedCommandLine(value) ? value : undefined; } + ts.performance.mark("SolutionBuilder::beforeConfigFileParsing"); var diagnostic; var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host; var parsed; @@ -104575,6 +105539,8 @@ var ts; parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop; } configFileCache.set(configFilePath, parsed || diagnostic); + ts.performance.mark("SolutionBuilder::afterConfigFileParsing"); + ts.performance.measure("SolutionBuilder::Config file parsing", "SolutionBuilder::beforeConfigFileParsing", "SolutionBuilder::afterConfigFileParsing"); return parsed; } function resolveProjectName(state, name) { @@ -104767,6 +105733,7 @@ var ts; if (updateOutputFileStampsPending) { updateOutputTimestamps(state, config, projectPath); } + ts.performance.mark("SolutionBuilder::Timestamps only updates"); return doneInvalidatedProject(state, projectPath); } }; @@ -104860,6 +105827,10 @@ var ts; }; function done(cancellationToken, writeFile, customTransformers) { executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers); + if (kind === InvalidatedProjectKind.Build) + ts.performance.mark("SolutionBuilder::Projects built"); + else + ts.performance.mark("SolutionBuilder::Bundles updated"); return doneInvalidatedProject(state, projectPath); } function withProgramOrUndefined(action) { @@ -105026,13 +105997,13 @@ var ts; var emitterDiagnostics = ts.createDiagnosticCollection(); var emittedOutputs = new ts.Map(); var resultFlags = BuildResultFlags.DeclarationOutputUnchanged; - var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo; + var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo || undefined; outputFiles.forEach(function (_a) { var _b, _c; var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo; emittedOutputs.set(toPath(state, name), name); if (buildInfo) { - if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { + if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo === null || existingBuildInfo === void 0 ? void 0 : existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged; } setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags); @@ -105315,8 +106286,7 @@ var ts; return existing.buildInfo || undefined; } var value = state.readFileWithCache(buildInfoPath); - var buildInfo = value ? ts.getBuildInfo(value) : undefined; - ts.Debug.assert(modifiedTime || !buildInfo); + var buildInfo = value ? ts.getBuildInfo(buildInfoPath, value) : undefined; state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime }); return buildInfo; } @@ -105394,7 +106364,13 @@ var ts; missingOutputFileName: buildInfoPath }; } - var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime)); + var buildInfo = getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime); + if (!buildInfo) { + return { + type: ts.UpToDateStatusType.ErrorReadingFile, + fileName: buildInfoPath + }; + } if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) { return { type: ts.UpToDateStatusType.TsVersionOutputOfDate, @@ -105555,7 +106531,10 @@ var ts; if (prior !== undefined) { return prior; } + ts.performance.mark("SolutionBuilder::beforeUpToDateCheck"); var actual = getUpToDateStatusWorker(state, project, resolvedPath); + ts.performance.mark("SolutionBuilder::afterUpToDateCheck"); + ts.performance.measure("SolutionBuilder::Up-to-date check", "SolutionBuilder::beforeUpToDateCheck", "SolutionBuilder::afterUpToDateCheck"); state.projectStatus.set(resolvedPath, actual); return actual; } @@ -105682,6 +106661,13 @@ var ts; } } function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { + ts.performance.mark("SolutionBuilder::beforeBuild"); + var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences); + ts.performance.mark("SolutionBuilder::afterBuild"); + ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + return result; + } + function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { var buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ts.ExitStatus.InvalidProject_OutputsSkipped; @@ -105709,6 +106695,13 @@ var ts; : ts.ExitStatus.DiagnosticsPresent_OutputsSkipped; } function clean(state, project, onlyReferences) { + ts.performance.mark("SolutionBuilder::beforeClean"); + var result = cleanWorker(state, project, onlyReferences); + ts.performance.mark("SolutionBuilder::afterClean"); + ts.performance.measure("SolutionBuilder::Clean", "SolutionBuilder::beforeClean", "SolutionBuilder::afterClean"); + return result; + } + function cleanWorker(state, project, onlyReferences) { var buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ts.ExitStatus.InvalidProject_OutputsSkipped; @@ -105779,6 +106772,14 @@ var ts; state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected); } function buildNextInvalidatedProject(state, changeDetected) { + ts.performance.mark("SolutionBuilder::beforeBuild"); + var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected); + ts.performance.mark("SolutionBuilder::afterBuild"); + ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + if (buildOrder) + reportErrorSummary(state, buildOrder); + } + function buildNextInvalidatedProjectWorker(state, changeDetected) { state.timerToBuildInvalidatedProject = undefined; if (state.reportFileChangeDetected) { state.reportFileChangeDetected = false; @@ -105808,7 +106809,7 @@ var ts; } } disableCache(state); - reportErrorSummary(state, buildOrder); + return buildOrder; } function watchConfigFile(state, resolved, resolvedPath, parsed) { if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath)) @@ -105863,6 +106864,7 @@ var ts; function startWatching(state, buildOrder) { if (!state.watchAllProjectsPending) return; + ts.performance.mark("SolutionBuilder::beforeWatcherCreation"); state.watchAllProjectsPending = false; for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) { var resolved = _a[_i]; @@ -105876,6 +106878,8 @@ var ts; watchPackageJsonFiles(state, resolved, resolvedPath, cfg); } } + ts.performance.mark("SolutionBuilder::afterWatcherCreation"); + ts.performance.measure("SolutionBuilder::Watcher creation", "SolutionBuilder::beforeWatcherCreation", "SolutionBuilder::afterWatcherCreation"); } function stopWatching(state) { ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher); @@ -105985,6 +106989,8 @@ var ts; return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_1_is_older_than_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerProjectName)); case ts.UpToDateStatusType.OutputMissing: return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relName(state, configFileName), relName(state, status.missingOutputFileName)); + case ts.UpToDateStatusType.ErrorReadingFile: + return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_there_was_error_reading_file_1, relName(state, configFileName), relName(state, status.fileName)); case ts.UpToDateStatusType.OutOfDateBuildInfo: return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted, relName(state, configFileName), relName(state, status.buildInfoFile)); case ts.UpToDateStatusType.UpToDate: @@ -106025,6 +107031,12 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { + var StatisticType; + (function (StatisticType) { + StatisticType[StatisticType["time"] = 0] = "time"; + StatisticType[StatisticType["count"] = 1] = "count"; + StatisticType[StatisticType["memory"] = 2] = "memory"; + })(StatisticType = ts.StatisticType || (ts.StatisticType = {})); function countLines(program) { var counts = getCountsMap(); ts.forEach(program.getSourceFiles(), function (file) { @@ -106034,14 +107046,6 @@ var ts; }); return counts; } - function countNodes(program) { - var counts = getCountsMap(); - ts.forEach(program.getSourceFiles(), function (file) { - var key = getCountKey(program, file); - counts.set(key, counts.get(key) + file.nodeCount); - }); - return counts; - } function getCountsMap() { var counts = new ts.Map(); counts.set("Library", 0); @@ -106388,7 +107392,6 @@ var ts; var colors = createColors(sys); var header = []; var terminalWidth = (_b = (_a = sys.getWidthOfTerminal) === null || _a === void 0 ? void 0 : _a.call(sys)) !== null && _b !== void 0 ? _b : 0; - ; var tsIconLength = 5; var tsIconFirstLine = colors.blueBackground(ts.padLeft("", tsIconLength)); var tsIconSecondLine = colors.blueBackground(colors.brightWhite(ts.padLeft("TS ", tsIconLength))); @@ -106585,15 +107588,26 @@ var ts; if (reportWatchModeWithoutSysSupport(sys, reportDiagnostic)) return; var buildHost_1 = ts.createSolutionBuilderWithWatchHost(sys, undefined, reportDiagnostic, ts.createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)), createWatchStatusReporter(sys, buildOptions)); - updateSolutionBuilderHost(sys, cb, buildHost_1); + var solutionPerformance_1 = enableSolutionPerformance(sys, buildOptions); + updateSolutionBuilderHost(sys, cb, buildHost_1, solutionPerformance_1); + var onWatchStatusChange_1 = buildHost_1.onWatchStatusChange; + buildHost_1.onWatchStatusChange = function (d, newLine, options, errorCount) { + onWatchStatusChange_1 === null || onWatchStatusChange_1 === void 0 ? void 0 : onWatchStatusChange_1(d, newLine, options, errorCount); + if (d.code === ts.Diagnostics.Found_0_errors_Watching_for_file_changes.code || + d.code === ts.Diagnostics.Found_1_error_Watching_for_file_changes.code) { + reportSolutionBuilderTimes(builder_1, solutionPerformance_1); + } + }; var builder_1 = ts.createSolutionBuilderWithWatch(buildHost_1, projects, buildOptions, watchOptions); builder_1.build(); return builder_1; } var buildHost = ts.createSolutionBuilderHost(sys, undefined, reportDiagnostic, ts.createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)), createReportErrorSummary(sys, buildOptions)); - updateSolutionBuilderHost(sys, cb, buildHost); + var solutionPerformance = enableSolutionPerformance(sys, buildOptions); + updateSolutionBuilderHost(sys, cb, buildHost, solutionPerformance); var builder = ts.createSolutionBuilder(buildHost, projects, buildOptions); var exitStatus = buildOptions.clean ? builder.clean() : builder.build(); + reportSolutionBuilderTimes(builder, solutionPerformance); ts.dumpTracingLegend(); return sys.exit(exitStatus); } @@ -106618,7 +107632,7 @@ var ts; }; var program = ts.createProgram(programOptions); var exitStatus = ts.emitFilesAndReportErrorsAndGetExitStatus(program, reportDiagnostic, function (s) { return sys.write(s + sys.newLine); }, createReportErrorSummary(sys, options)); - reportStatistics(sys, program); + reportStatistics(sys, program, undefined); cb(program); return sys.exit(exitStatus); } @@ -106636,36 +107650,36 @@ var ts; reportDiagnostic: reportDiagnostic, reportErrorSummary: createReportErrorSummary(sys, options), afterProgramEmitAndDiagnostics: function (builderProgram) { - reportStatistics(sys, builderProgram.getProgram()); + reportStatistics(sys, builderProgram.getProgram(), undefined); cb(builderProgram); } }); return sys.exit(exitStatus); } - function updateSolutionBuilderHost(sys, cb, buildHost) { - updateCreateProgram(sys, buildHost); + function updateSolutionBuilderHost(sys, cb, buildHost, solutionPerformance) { + updateCreateProgram(sys, buildHost, true); buildHost.afterProgramEmitAndDiagnostics = function (program) { - reportStatistics(sys, program.getProgram()); + reportStatistics(sys, program.getProgram(), solutionPerformance); cb(program); }; buildHost.afterEmitBundle = cb; } - function updateCreateProgram(sys, host) { + function updateCreateProgram(sys, host, isBuildMode) { var compileUsingBuilder = host.createProgram; host.createProgram = function (rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences) { ts.Debug.assert(rootNames !== undefined || (options === undefined && !!oldProgram)); if (options !== undefined) { - enableStatisticsAndTracing(sys, options, true); + enableStatisticsAndTracing(sys, options, isBuildMode); } return compileUsingBuilder(rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences); }; } function updateWatchCompilationHost(sys, cb, watchCompilerHost) { - updateCreateProgram(sys, watchCompilerHost); + updateCreateProgram(sys, watchCompilerHost, false); var emitFilesUsingBuilder = watchCompilerHost.afterProgramCreate; watchCompilerHost.afterProgramCreate = function (builderProgram) { emitFilesUsingBuilder(builderProgram); - reportStatistics(sys, builderProgram.getProgram()); + reportStatistics(sys, builderProgram.getProgram(), undefined); cb(builderProgram); }; } @@ -106698,6 +107712,71 @@ var ts; updateWatchCompilationHost(system, cb, watchCompilerHost); return ts.createWatchProgram(watchCompilerHost); } + function enableSolutionPerformance(system, options) { + if (system === ts.sys && options.extendedDiagnostics) { + ts.performance.enable(); + return createSolutionPerfomrance(); + } + } + function createSolutionPerfomrance() { + var statistics; + return { + addAggregateStatistic: addAggregateStatistic, + forEachAggregateStatistics: forEachAggreateStatistics, + clear: clear, + }; + function addAggregateStatistic(s) { + var existing = statistics === null || statistics === void 0 ? void 0 : statistics.get(s.name); + if (existing) { + if (existing.type === StatisticType.memory) + existing.value = Math.max(existing.value, s.value); + else + existing.value += s.value; + } + else { + (statistics !== null && statistics !== void 0 ? statistics : (statistics = new ts.Map())).set(s.name, s); + } + } + function forEachAggreateStatistics(cb) { + statistics === null || statistics === void 0 ? void 0 : statistics.forEach(cb); + } + function clear() { + statistics = undefined; + } + } + function reportSolutionBuilderTimes(builder, solutionPerformance) { + if (!solutionPerformance) + return; + if (!ts.performance.isEnabled()) { + ts.sys.write(ts.Diagnostics.Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_native_implementation_of_the_Web_Performance_API_could_not_be_found.message + "\n"); + return; + } + var statistics = []; + statistics.push({ name: "Projects in scope", value: ts.getBuildOrderFromAnyBuildOrder(builder.getBuildOrder()).length, type: StatisticType.count }); + reportSolutionBuilderCountStatistic("SolutionBuilder::Projects built"); + reportSolutionBuilderCountStatistic("SolutionBuilder::Timestamps only updates"); + reportSolutionBuilderCountStatistic("SolutionBuilder::Bundles updated"); + solutionPerformance.forEachAggregateStatistics(function (s) { + s.name = "Aggregate ".concat(s.name); + statistics.push(s); + }); + ts.performance.forEachMeasure(function (name, duration) { + if (isSolutionMarkOrMeasure(name)) + statistics.push({ name: "".concat(getNameFromSolutionBuilderMarkOrMeasure(name), " time"), value: duration, type: StatisticType.time }); + }); + ts.performance.disable(); + ts.performance.enable(); + reportAllStatistics(ts.sys, statistics); + function reportSolutionBuilderCountStatistic(name) { + var value = ts.performance.getCount(name); + if (value) { + statistics.push({ name: getNameFromSolutionBuilderMarkOrMeasure(name), value: value, type: StatisticType.count }); + } + } + function getNameFromSolutionBuilderMarkOrMeasure(name) { + return name.replace("SolutionBuilder::", ""); + } + } function canReportDiagnostics(system, compilerOptions) { return system === ts.sys && (compilerOptions.diagnostics || compilerOptions.extendedDiagnostics); } @@ -106712,7 +107791,10 @@ var ts; ts.startTracing(isBuildMode ? "build" : "project", compilerOptions.generateTrace, compilerOptions.configFilePath); } } - function reportStatistics(sys, program) { + function isSolutionMarkOrMeasure(name) { + return ts.startsWith(name, "SolutionBuilder::"); + } + function reportStatistics(sys, program, solutionPerformance) { var compilerOptions = program.getCompilerOptions(); if (canTrace(sys, compilerOptions)) { ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.stopTracing(); @@ -106723,27 +107805,21 @@ var ts; var memoryUsed = sys.getMemoryUsage ? sys.getMemoryUsage() : -1; reportCountStatistic("Files", program.getSourceFiles().length); var lineCounts = countLines(program); - var nodeCounts = countNodes(program); if (compilerOptions.extendedDiagnostics) { for (var _i = 0, _a = ts.arrayFrom(lineCounts.keys()); _i < _a.length; _i++) { var key = _a[_i]; reportCountStatistic("Lines of " + key, lineCounts.get(key)); } - for (var _b = 0, _c = ts.arrayFrom(nodeCounts.keys()); _b < _c.length; _b++) { - var key = _c[_b]; - reportCountStatistic("Nodes of " + key, nodeCounts.get(key)); - } } else { reportCountStatistic("Lines", ts.reduceLeftIterator(lineCounts.values(), function (sum, count) { return sum + count; }, 0)); - reportCountStatistic("Nodes", ts.reduceLeftIterator(nodeCounts.values(), function (sum, count) { return sum + count; }, 0)); } reportCountStatistic("Identifiers", program.getIdentifierCount()); reportCountStatistic("Symbols", program.getSymbolCount()); reportCountStatistic("Types", program.getTypeCount()); reportCountStatistic("Instantiations", program.getInstantiationCount()); if (memoryUsed >= 0) { - reportStatisticalValue("Memory used", Math.round(memoryUsed / 1000) + "K"); + reportStatisticalValue({ name: "Memory used", value: memoryUsed, type: StatisticType.memory }, true); } var isPerformanceEnabled = ts.performance.isEnabled(); var programTime = isPerformanceEnabled ? ts.performance.getDuration("Program") : 0; @@ -106757,53 +107833,83 @@ var ts; reportCountStatistic("Subtype cache size", caches.subtype); reportCountStatistic("Strict subtype cache size", caches.strictSubtype); if (isPerformanceEnabled) { - ts.performance.forEachMeasure(function (name, duration) { return reportTimeStatistic("".concat(name, " time"), duration); }); + ts.performance.forEachMeasure(function (name, duration) { + if (!isSolutionMarkOrMeasure(name)) + reportTimeStatistic("".concat(name, " time"), duration, true); + }); } } else if (isPerformanceEnabled) { - reportTimeStatistic("I/O read", ts.performance.getDuration("I/O Read")); - reportTimeStatistic("I/O write", ts.performance.getDuration("I/O Write")); - reportTimeStatistic("Parse time", programTime); - reportTimeStatistic("Bind time", bindTime); - reportTimeStatistic("Check time", checkTime); - reportTimeStatistic("Emit time", emitTime); + reportTimeStatistic("I/O read", ts.performance.getDuration("I/O Read"), true); + reportTimeStatistic("I/O write", ts.performance.getDuration("I/O Write"), true); + reportTimeStatistic("Parse time", programTime, true); + reportTimeStatistic("Bind time", bindTime, true); + reportTimeStatistic("Check time", checkTime, true); + reportTimeStatistic("Emit time", emitTime, true); } if (isPerformanceEnabled) { - reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime); + reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime, false); } - reportStatistics(); + reportAllStatistics(sys, statistics); if (!isPerformanceEnabled) { sys.write(ts.Diagnostics.Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_native_implementation_of_the_Web_Performance_API_could_not_be_found.message + "\n"); } else { - ts.performance.disable(); - } - } - function reportStatistics() { - var nameSize = 0; - var valueSize = 0; - for (var _i = 0, statistics_1 = statistics; _i < statistics_1.length; _i++) { - var _a = statistics_1[_i], name = _a.name, value = _a.value; - if (name.length > nameSize) { - nameSize = name.length; + if (solutionPerformance) { + ts.performance.forEachMeasure(function (name) { + if (!isSolutionMarkOrMeasure(name)) + ts.performance.clearMeasures(name); + }); + ts.performance.forEachMark(function (name) { + if (!isSolutionMarkOrMeasure(name)) + ts.performance.clearMarks(name); + }); } - if (value.length > valueSize) { - valueSize = value.length; + else { + ts.performance.disable(); } } - for (var _b = 0, statistics_2 = statistics; _b < statistics_2.length; _b++) { - var _c = statistics_2[_b], name = _c.name, value = _c.value; - sys.write(ts.padRight(name + ":", nameSize + 2) + ts.padLeft(value.toString(), valueSize) + sys.newLine); - } } - function reportStatisticalValue(name, value) { - statistics.push({ name: name, value: value }); + function reportStatisticalValue(s, aggregate) { + statistics.push(s); + if (aggregate) + solutionPerformance === null || solutionPerformance === void 0 ? void 0 : solutionPerformance.addAggregateStatistic(s); } function reportCountStatistic(name, count) { - reportStatisticalValue(name, "" + count); + reportStatisticalValue({ name: name, value: count, type: StatisticType.count }, true); } - function reportTimeStatistic(name, time) { - reportStatisticalValue(name, (time / 1000).toFixed(2) + "s"); + function reportTimeStatistic(name, time, aggregate) { + reportStatisticalValue({ name: name, value: time, type: StatisticType.time }, aggregate); + } + } + function reportAllStatistics(sys, statistics) { + var nameSize = 0; + var valueSize = 0; + for (var _i = 0, statistics_1 = statistics; _i < statistics_1.length; _i++) { + var s = statistics_1[_i]; + if (s.name.length > nameSize) { + nameSize = s.name.length; + } + var value = statisticValue(s); + if (value.length > valueSize) { + valueSize = value.length; + } + } + for (var _a = 0, statistics_2 = statistics; _a < statistics_2.length; _a++) { + var s = statistics_2[_a]; + sys.write(ts.padRight(s.name + ":", nameSize + 2) + ts.padLeft(statisticValue(s).toString(), valueSize) + sys.newLine); + } + } + function statisticValue(s) { + switch (s.type) { + case StatisticType.count: + return "" + s.value; + case StatisticType.time: + return (s.value / 1000).toFixed(2) + "s"; + case StatisticType.memory: + return Math.round(s.value / 1000) + "K"; + default: + ts.Debug.assertNever(s.type); } } function writeConfigFile(sys, reportDiagnostic, options, fileNames) { diff --git a/lib/tsserver.js b/lib/tsserver.js index b696263504d..e67fc4a316e 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -105,11 +105,11 @@ var ts; (function (ts) { // WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values. // If changing the text in this section, be sure to test `configurePrerelease` too. - ts.versionMajorMinor = "4.8"; + ts.versionMajorMinor = "4.9"; // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types - ts.version = "4.8.3"; + ts.version = "".concat(ts.versionMajorMinor, ".0-beta"); /* @internal */ var Comparison; (function (Comparison) { @@ -130,8 +130,12 @@ var ts; function tryGetNativeMap() { // Internet Explorer's Map doesn't support iteration, so don't use it. var gMap = globals === null || globals === void 0 ? void 0 : globals.Map; - // eslint-disable-next-line no-in-operator - return typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; + // eslint-disable-next-line local/no-in-operator + var constructor = typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; + if (!constructor) { + throw new Error("No compatible Map implementation found."); + } + return constructor; } NativeCollections.tryGetNativeMap = tryGetNativeMap; /** @@ -140,24 +144,19 @@ var ts; function tryGetNativeSet() { // Internet Explorer's Set doesn't support iteration, so don't use it. var gSet = globals === null || globals === void 0 ? void 0 : globals.Set; - // eslint-disable-next-line no-in-operator - return typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; + // eslint-disable-next-line local/no-in-operator + var constructor = typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; + if (!constructor) { + throw new Error("No compatible Set implementation found."); + } + return constructor; } NativeCollections.tryGetNativeSet = tryGetNativeSet; })(NativeCollections || (NativeCollections = {})); /* @internal */ - ts.Map = getCollectionImplementation("Map", "tryGetNativeMap", "createMapShim"); + ts.Map = NativeCollections.tryGetNativeMap(); /* @internal */ - ts.Set = getCollectionImplementation("Set", "tryGetNativeSet", "createSetShim"); - /* @internal */ - function getCollectionImplementation(name, nativeFactory, shimFactory) { - var _a; - // NOTE: ts.ShimCollections will be defined for typescriptServices.js but not for tsc.js, so we must test for it. - var constructor = (_a = NativeCollections[nativeFactory]()) !== null && _a !== void 0 ? _a : ts.ShimCollections === null || ts.ShimCollections === void 0 ? void 0 : ts.ShimCollections[shimFactory](ts.getIterator); - if (constructor) - return constructor; - throw new Error("TypeScript requires an environment that provides a compatible native ".concat(name, " implementation.")); - } + ts.Set = NativeCollections.tryGetNativeSet(); })(ts || (ts = {})); /* @internal */ var ts; @@ -873,15 +872,18 @@ var ts; function insertSorted(array, insert, compare, allowDuplicates) { if (array.length === 0) { array.push(insert); - return; + return true; } var insertIndex = binarySearch(array, insert, identity, compare); if (insertIndex < 0) { array.splice(~insertIndex, 0, insert); + return true; } - else if (allowDuplicates) { + if (allowDuplicates) { array.splice(insertIndex, 0, insert); + return true; } + return false; } ts.insertSorted = insertSorted; function sortAndDeduplicate(array, comparer, equalityComparer) { @@ -1161,6 +1163,13 @@ var ts; : undefined; } ts.singleOrUndefined = singleOrUndefined; + /** + * Returns the only element of an array if it contains only one element; throws otherwise. + */ + function single(array) { + return ts.Debug.checkDefined(singleOrUndefined(array)); + } + ts.single = single; function singleOrMany(array) { return array && array.length === 1 ? array[0] @@ -2684,7 +2693,7 @@ var ts; if (typeof func !== "function") { return ""; } - else if (func.hasOwnProperty("name")) { + else if (ts.hasProperty(func, "name")) { return func.name; } else { @@ -2834,7 +2843,7 @@ var ts; Debug.formatControlFlowGraph = formatControlFlowGraph; var flowNodeProto; function attachFlowNodeDebugInfoWorker(flowNode) { - if (!("__debugFlowFlags" in flowNode)) { // eslint-disable-line no-in-operator + if (!("__debugFlowFlags" in flowNode)) { // eslint-disable-line local/no-in-operator Object.defineProperties(flowNode, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { @@ -2880,7 +2889,7 @@ var ts; Debug.attachFlowNodeDebugInfo = attachFlowNodeDebugInfo; var nodeArrayProto; function attachNodeArrayDebugInfoWorker(array) { - if (!("__tsDebuggerDisplay" in array)) { // eslint-disable-line no-in-operator + if (!("__tsDebuggerDisplay" in array)) { // eslint-disable-line local/no-in-operator Object.defineProperties(array, { __tsDebuggerDisplay: { value: function (defaultValue) { @@ -3009,7 +3018,7 @@ var ts; ]; for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) { var ctor = nodeConstructors_1[_i]; - if (!ctor.prototype.hasOwnProperty("__debugKind")) { + if (!ts.hasProperty(ctor.prototype, "__debugKind")) { Object.defineProperties(ctor.prototype, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { @@ -3562,6 +3571,8 @@ var ts; typeof performance.mark === "function" && typeof performance.measure === "function" && typeof performance.now === "function" && + typeof performance.clearMarks === "function" && + typeof performance.clearMeasures === "function" && typeof PerformanceObserver === "function"; } function tryGetWebPerformanceHooks() { @@ -3606,7 +3617,9 @@ var ts; if (end === "__performance.measure-fix__") { nodePerformance_1.clearMarks("__performance.measure-fix__"); } - } + }, + clearMarks: function (name) { return nodePerformance_1.clearMarks(name); }, + clearMeasures: function (name) { return nodePerformance_1.clearMeasures(name); }, }; } return { @@ -3739,6 +3752,30 @@ var ts; durations.forEach(function (duration, measureName) { return cb(measureName, duration); }); } performance.forEachMeasure = forEachMeasure; + function forEachMark(cb) { + marks.forEach(function (_time, markName) { return cb(markName); }); + } + performance.forEachMark = forEachMark; + function clearMeasures(name) { + if (name !== undefined) + durations.delete(name); + else + durations.clear(); + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMeasures(name); + } + performance.clearMeasures = clearMeasures; + function clearMarks(name) { + if (name !== undefined) { + counts.delete(name); + marks.delete(name); + } + else { + counts.clear(); + marks.clear(); + } + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMarks(name); + } + performance.clearMarks = clearMarks; /** * Indicates whether the performance API is enabled. */ @@ -3836,7 +3873,6 @@ var ts; var typeCatalog = []; // NB: id is index + 1 var legendPath; var legend = []; - ; /** Starts tracing for the given project. */ function startTracing(tracingMode, traceDir, configFilePath) { ts.Debug.assert(!ts.tracing, "Tracing already started"); @@ -4041,7 +4077,7 @@ var ts; var substitutionType = type; substitutionProperties = { substitutionBaseType: (_o = substitutionType.baseType) === null || _o === void 0 ? void 0 : _o.id, - substituteType: (_p = substitutionType.substitute) === null || _p === void 0 ? void 0 : _p.id, + constraintType: (_p = substitutionType.constraint) === null || _p === void 0 ? void 0 : _p.id, }; } var reverseMappedProperties = {}; @@ -4241,257 +4277,260 @@ var ts; SyntaxKind[SyntaxKind["YieldKeyword"] = 125] = "YieldKeyword"; // Contextual keywords SyntaxKind[SyntaxKind["AbstractKeyword"] = 126] = "AbstractKeyword"; - SyntaxKind[SyntaxKind["AsKeyword"] = 127] = "AsKeyword"; - SyntaxKind[SyntaxKind["AssertsKeyword"] = 128] = "AssertsKeyword"; - SyntaxKind[SyntaxKind["AssertKeyword"] = 129] = "AssertKeyword"; - SyntaxKind[SyntaxKind["AnyKeyword"] = 130] = "AnyKeyword"; - SyntaxKind[SyntaxKind["AsyncKeyword"] = 131] = "AsyncKeyword"; - SyntaxKind[SyntaxKind["AwaitKeyword"] = 132] = "AwaitKeyword"; - SyntaxKind[SyntaxKind["BooleanKeyword"] = 133] = "BooleanKeyword"; - SyntaxKind[SyntaxKind["ConstructorKeyword"] = 134] = "ConstructorKeyword"; - SyntaxKind[SyntaxKind["DeclareKeyword"] = 135] = "DeclareKeyword"; - SyntaxKind[SyntaxKind["GetKeyword"] = 136] = "GetKeyword"; - SyntaxKind[SyntaxKind["InferKeyword"] = 137] = "InferKeyword"; - SyntaxKind[SyntaxKind["IntrinsicKeyword"] = 138] = "IntrinsicKeyword"; - SyntaxKind[SyntaxKind["IsKeyword"] = 139] = "IsKeyword"; - SyntaxKind[SyntaxKind["KeyOfKeyword"] = 140] = "KeyOfKeyword"; - SyntaxKind[SyntaxKind["ModuleKeyword"] = 141] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["NamespaceKeyword"] = 142] = "NamespaceKeyword"; - SyntaxKind[SyntaxKind["NeverKeyword"] = 143] = "NeverKeyword"; - SyntaxKind[SyntaxKind["OutKeyword"] = 144] = "OutKeyword"; - SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 145] = "ReadonlyKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 146] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 147] = "NumberKeyword"; - SyntaxKind[SyntaxKind["ObjectKeyword"] = 148] = "ObjectKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 149] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 150] = "StringKeyword"; - SyntaxKind[SyntaxKind["SymbolKeyword"] = 151] = "SymbolKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 152] = "TypeKeyword"; - SyntaxKind[SyntaxKind["UndefinedKeyword"] = 153] = "UndefinedKeyword"; - SyntaxKind[SyntaxKind["UniqueKeyword"] = 154] = "UniqueKeyword"; - SyntaxKind[SyntaxKind["UnknownKeyword"] = 155] = "UnknownKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 156] = "FromKeyword"; - SyntaxKind[SyntaxKind["GlobalKeyword"] = 157] = "GlobalKeyword"; - SyntaxKind[SyntaxKind["BigIntKeyword"] = 158] = "BigIntKeyword"; - SyntaxKind[SyntaxKind["OverrideKeyword"] = 159] = "OverrideKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 160] = "OfKeyword"; + SyntaxKind[SyntaxKind["AccessorKeyword"] = 127] = "AccessorKeyword"; + SyntaxKind[SyntaxKind["AsKeyword"] = 128] = "AsKeyword"; + SyntaxKind[SyntaxKind["AssertsKeyword"] = 129] = "AssertsKeyword"; + SyntaxKind[SyntaxKind["AssertKeyword"] = 130] = "AssertKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 131] = "AnyKeyword"; + SyntaxKind[SyntaxKind["AsyncKeyword"] = 132] = "AsyncKeyword"; + SyntaxKind[SyntaxKind["AwaitKeyword"] = 133] = "AwaitKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 134] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 135] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 136] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 137] = "GetKeyword"; + SyntaxKind[SyntaxKind["InferKeyword"] = 138] = "InferKeyword"; + SyntaxKind[SyntaxKind["IntrinsicKeyword"] = 139] = "IntrinsicKeyword"; + SyntaxKind[SyntaxKind["IsKeyword"] = 140] = "IsKeyword"; + SyntaxKind[SyntaxKind["KeyOfKeyword"] = 141] = "KeyOfKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 142] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["NamespaceKeyword"] = 143] = "NamespaceKeyword"; + SyntaxKind[SyntaxKind["NeverKeyword"] = 144] = "NeverKeyword"; + SyntaxKind[SyntaxKind["OutKeyword"] = 145] = "OutKeyword"; + SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 146] = "ReadonlyKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 147] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 148] = "NumberKeyword"; + SyntaxKind[SyntaxKind["ObjectKeyword"] = 149] = "ObjectKeyword"; + SyntaxKind[SyntaxKind["SatisfiesKeyword"] = 150] = "SatisfiesKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 151] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 152] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 153] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 154] = "TypeKeyword"; + SyntaxKind[SyntaxKind["UndefinedKeyword"] = 155] = "UndefinedKeyword"; + SyntaxKind[SyntaxKind["UniqueKeyword"] = 156] = "UniqueKeyword"; + SyntaxKind[SyntaxKind["UnknownKeyword"] = 157] = "UnknownKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 158] = "FromKeyword"; + SyntaxKind[SyntaxKind["GlobalKeyword"] = 159] = "GlobalKeyword"; + SyntaxKind[SyntaxKind["BigIntKeyword"] = 160] = "BigIntKeyword"; + SyntaxKind[SyntaxKind["OverrideKeyword"] = 161] = "OverrideKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 162] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 161] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 162] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 163] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 164] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 163] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 164] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 165] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 165] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 166] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 167] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 166] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 167] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 168] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 169] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["ClassStaticBlockDeclaration"] = 170] = "ClassStaticBlockDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 171] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 172] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 173] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 174] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 175] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 176] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 168] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 169] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 170] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 171] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["ClassStaticBlockDeclaration"] = 172] = "ClassStaticBlockDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 173] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 174] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 175] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 176] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 177] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 178] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypePredicate"] = 177] = "TypePredicate"; - SyntaxKind[SyntaxKind["TypeReference"] = 178] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 179] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 180] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 181] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 182] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 183] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 184] = "TupleType"; - SyntaxKind[SyntaxKind["OptionalType"] = 185] = "OptionalType"; - SyntaxKind[SyntaxKind["RestType"] = 186] = "RestType"; - SyntaxKind[SyntaxKind["UnionType"] = 187] = "UnionType"; - SyntaxKind[SyntaxKind["IntersectionType"] = 188] = "IntersectionType"; - SyntaxKind[SyntaxKind["ConditionalType"] = 189] = "ConditionalType"; - SyntaxKind[SyntaxKind["InferType"] = 190] = "InferType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 191] = "ParenthesizedType"; - SyntaxKind[SyntaxKind["ThisType"] = 192] = "ThisType"; - SyntaxKind[SyntaxKind["TypeOperator"] = 193] = "TypeOperator"; - SyntaxKind[SyntaxKind["IndexedAccessType"] = 194] = "IndexedAccessType"; - SyntaxKind[SyntaxKind["MappedType"] = 195] = "MappedType"; - SyntaxKind[SyntaxKind["LiteralType"] = 196] = "LiteralType"; - SyntaxKind[SyntaxKind["NamedTupleMember"] = 197] = "NamedTupleMember"; - SyntaxKind[SyntaxKind["TemplateLiteralType"] = 198] = "TemplateLiteralType"; - SyntaxKind[SyntaxKind["TemplateLiteralTypeSpan"] = 199] = "TemplateLiteralTypeSpan"; - SyntaxKind[SyntaxKind["ImportType"] = 200] = "ImportType"; + SyntaxKind[SyntaxKind["TypePredicate"] = 179] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 180] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 181] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 182] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 183] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 184] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 185] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 186] = "TupleType"; + SyntaxKind[SyntaxKind["OptionalType"] = 187] = "OptionalType"; + SyntaxKind[SyntaxKind["RestType"] = 188] = "RestType"; + SyntaxKind[SyntaxKind["UnionType"] = 189] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 190] = "IntersectionType"; + SyntaxKind[SyntaxKind["ConditionalType"] = 191] = "ConditionalType"; + SyntaxKind[SyntaxKind["InferType"] = 192] = "InferType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 193] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ThisType"] = 194] = "ThisType"; + SyntaxKind[SyntaxKind["TypeOperator"] = 195] = "TypeOperator"; + SyntaxKind[SyntaxKind["IndexedAccessType"] = 196] = "IndexedAccessType"; + SyntaxKind[SyntaxKind["MappedType"] = 197] = "MappedType"; + SyntaxKind[SyntaxKind["LiteralType"] = 198] = "LiteralType"; + SyntaxKind[SyntaxKind["NamedTupleMember"] = 199] = "NamedTupleMember"; + SyntaxKind[SyntaxKind["TemplateLiteralType"] = 200] = "TemplateLiteralType"; + SyntaxKind[SyntaxKind["TemplateLiteralTypeSpan"] = 201] = "TemplateLiteralTypeSpan"; + SyntaxKind[SyntaxKind["ImportType"] = 202] = "ImportType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 201] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 202] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 203] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 203] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 204] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 205] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 204] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 205] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 206] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 207] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 208] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 209] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 210] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 211] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 212] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 213] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 214] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 215] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 216] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 217] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 218] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 219] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 220] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 221] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 222] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 223] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 224] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElement"] = 225] = "SpreadElement"; - SyntaxKind[SyntaxKind["ClassExpression"] = 226] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 227] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 228] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 229] = "AsExpression"; - SyntaxKind[SyntaxKind["NonNullExpression"] = 230] = "NonNullExpression"; - SyntaxKind[SyntaxKind["MetaProperty"] = 231] = "MetaProperty"; - SyntaxKind[SyntaxKind["SyntheticExpression"] = 232] = "SyntheticExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 206] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 207] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 208] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 209] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 210] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 211] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 212] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 213] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 214] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 215] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 216] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 217] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 218] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 219] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 220] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 221] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 222] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 223] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 224] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 225] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 226] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElement"] = 227] = "SpreadElement"; + SyntaxKind[SyntaxKind["ClassExpression"] = 228] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 229] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 230] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 231] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 232] = "NonNullExpression"; + SyntaxKind[SyntaxKind["MetaProperty"] = 233] = "MetaProperty"; + SyntaxKind[SyntaxKind["SyntheticExpression"] = 234] = "SyntheticExpression"; + SyntaxKind[SyntaxKind["SatisfiesExpression"] = 235] = "SatisfiesExpression"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 233] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 234] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 236] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 237] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 235] = "Block"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 236] = "EmptyStatement"; - SyntaxKind[SyntaxKind["VariableStatement"] = 237] = "VariableStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 238] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 239] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 240] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 241] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 242] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 243] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 244] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 245] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 246] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 247] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 248] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 249] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 250] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 251] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 252] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 253] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 254] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 255] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 256] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 257] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 258] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 259] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 260] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 261] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 262] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 263] = "CaseBlock"; - SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 264] = "NamespaceExportDeclaration"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 265] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 266] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 267] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 268] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 269] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 270] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 271] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 272] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 273] = "NamedExports"; - SyntaxKind[SyntaxKind["NamespaceExport"] = 274] = "NamespaceExport"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 275] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 276] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 238] = "Block"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 239] = "EmptyStatement"; + SyntaxKind[SyntaxKind["VariableStatement"] = 240] = "VariableStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 241] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 242] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 243] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 244] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 245] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 246] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 247] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 248] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 249] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 250] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 251] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 252] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 253] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 254] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 255] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 256] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 257] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 258] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 259] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 260] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 261] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 262] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 263] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 264] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 265] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 266] = "CaseBlock"; + SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 267] = "NamespaceExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 268] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 269] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 270] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 271] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 272] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 273] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 274] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 275] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 276] = "NamedExports"; + SyntaxKind[SyntaxKind["NamespaceExport"] = 277] = "NamespaceExport"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 278] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 279] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 277] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 280] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 278] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 279] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 280] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 281] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxFragment"] = 282] = "JsxFragment"; - SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 283] = "JsxOpeningFragment"; - SyntaxKind[SyntaxKind["JsxClosingFragment"] = 284] = "JsxClosingFragment"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 285] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxAttributes"] = 286] = "JsxAttributes"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 287] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 288] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 281] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 282] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 283] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 284] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxFragment"] = 285] = "JsxFragment"; + SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 286] = "JsxOpeningFragment"; + SyntaxKind[SyntaxKind["JsxClosingFragment"] = 287] = "JsxClosingFragment"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 288] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxAttributes"] = 289] = "JsxAttributes"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 290] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 291] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 289] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 290] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 291] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 292] = "CatchClause"; - SyntaxKind[SyntaxKind["AssertClause"] = 293] = "AssertClause"; - SyntaxKind[SyntaxKind["AssertEntry"] = 294] = "AssertEntry"; - SyntaxKind[SyntaxKind["ImportTypeAssertionContainer"] = 295] = "ImportTypeAssertionContainer"; + SyntaxKind[SyntaxKind["CaseClause"] = 292] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 293] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 294] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 295] = "CatchClause"; + SyntaxKind[SyntaxKind["AssertClause"] = 296] = "AssertClause"; + SyntaxKind[SyntaxKind["AssertEntry"] = 297] = "AssertEntry"; + SyntaxKind[SyntaxKind["ImportTypeAssertionContainer"] = 298] = "ImportTypeAssertionContainer"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 296] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 297] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 298] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 299] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 300] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 301] = "SpreadAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 299] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 302] = "EnumMember"; // Unparsed - SyntaxKind[SyntaxKind["UnparsedPrologue"] = 300] = "UnparsedPrologue"; - SyntaxKind[SyntaxKind["UnparsedPrepend"] = 301] = "UnparsedPrepend"; - SyntaxKind[SyntaxKind["UnparsedText"] = 302] = "UnparsedText"; - SyntaxKind[SyntaxKind["UnparsedInternalText"] = 303] = "UnparsedInternalText"; - SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 304] = "UnparsedSyntheticReference"; + SyntaxKind[SyntaxKind["UnparsedPrologue"] = 303] = "UnparsedPrologue"; + SyntaxKind[SyntaxKind["UnparsedPrepend"] = 304] = "UnparsedPrepend"; + SyntaxKind[SyntaxKind["UnparsedText"] = 305] = "UnparsedText"; + SyntaxKind[SyntaxKind["UnparsedInternalText"] = 306] = "UnparsedInternalText"; + SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 307] = "UnparsedSyntheticReference"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 305] = "SourceFile"; - SyntaxKind[SyntaxKind["Bundle"] = 306] = "Bundle"; - SyntaxKind[SyntaxKind["UnparsedSource"] = 307] = "UnparsedSource"; - SyntaxKind[SyntaxKind["InputFiles"] = 308] = "InputFiles"; + SyntaxKind[SyntaxKind["SourceFile"] = 308] = "SourceFile"; + SyntaxKind[SyntaxKind["Bundle"] = 309] = "Bundle"; + SyntaxKind[SyntaxKind["UnparsedSource"] = 310] = "UnparsedSource"; + SyntaxKind[SyntaxKind["InputFiles"] = 311] = "InputFiles"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 309] = "JSDocTypeExpression"; - SyntaxKind[SyntaxKind["JSDocNameReference"] = 310] = "JSDocNameReference"; - SyntaxKind[SyntaxKind["JSDocMemberName"] = 311] = "JSDocMemberName"; - SyntaxKind[SyntaxKind["JSDocAllType"] = 312] = "JSDocAllType"; - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 313] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 314] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 315] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 316] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 317] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 318] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocNamepathType"] = 319] = "JSDocNamepathType"; - SyntaxKind[SyntaxKind["JSDoc"] = 320] = "JSDoc"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 312] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocNameReference"] = 313] = "JSDocNameReference"; + SyntaxKind[SyntaxKind["JSDocMemberName"] = 314] = "JSDocMemberName"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 315] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 316] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 317] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 318] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 319] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 320] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 321] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocNamepathType"] = 322] = "JSDocNamepathType"; + SyntaxKind[SyntaxKind["JSDoc"] = 323] = "JSDoc"; /** @deprecated Use SyntaxKind.JSDoc */ - SyntaxKind[SyntaxKind["JSDocComment"] = 320] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocText"] = 321] = "JSDocText"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 322] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocSignature"] = 323] = "JSDocSignature"; - SyntaxKind[SyntaxKind["JSDocLink"] = 324] = "JSDocLink"; - SyntaxKind[SyntaxKind["JSDocLinkCode"] = 325] = "JSDocLinkCode"; - SyntaxKind[SyntaxKind["JSDocLinkPlain"] = 326] = "JSDocLinkPlain"; - SyntaxKind[SyntaxKind["JSDocTag"] = 327] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 328] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocImplementsTag"] = 329] = "JSDocImplementsTag"; - SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 330] = "JSDocAuthorTag"; - SyntaxKind[SyntaxKind["JSDocDeprecatedTag"] = 331] = "JSDocDeprecatedTag"; - SyntaxKind[SyntaxKind["JSDocClassTag"] = 332] = "JSDocClassTag"; - SyntaxKind[SyntaxKind["JSDocPublicTag"] = 333] = "JSDocPublicTag"; - SyntaxKind[SyntaxKind["JSDocPrivateTag"] = 334] = "JSDocPrivateTag"; - SyntaxKind[SyntaxKind["JSDocProtectedTag"] = 335] = "JSDocProtectedTag"; - SyntaxKind[SyntaxKind["JSDocReadonlyTag"] = 336] = "JSDocReadonlyTag"; - SyntaxKind[SyntaxKind["JSDocOverrideTag"] = 337] = "JSDocOverrideTag"; - SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 338] = "JSDocCallbackTag"; - SyntaxKind[SyntaxKind["JSDocEnumTag"] = 339] = "JSDocEnumTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 340] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 341] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocThisTag"] = 342] = "JSDocThisTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 343] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 344] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 345] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocSeeTag"] = 346] = "JSDocSeeTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 347] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocComment"] = 323] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocText"] = 324] = "JSDocText"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 325] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocSignature"] = 326] = "JSDocSignature"; + SyntaxKind[SyntaxKind["JSDocLink"] = 327] = "JSDocLink"; + SyntaxKind[SyntaxKind["JSDocLinkCode"] = 328] = "JSDocLinkCode"; + SyntaxKind[SyntaxKind["JSDocLinkPlain"] = 329] = "JSDocLinkPlain"; + SyntaxKind[SyntaxKind["JSDocTag"] = 330] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 331] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocImplementsTag"] = 332] = "JSDocImplementsTag"; + SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 333] = "JSDocAuthorTag"; + SyntaxKind[SyntaxKind["JSDocDeprecatedTag"] = 334] = "JSDocDeprecatedTag"; + SyntaxKind[SyntaxKind["JSDocClassTag"] = 335] = "JSDocClassTag"; + SyntaxKind[SyntaxKind["JSDocPublicTag"] = 336] = "JSDocPublicTag"; + SyntaxKind[SyntaxKind["JSDocPrivateTag"] = 337] = "JSDocPrivateTag"; + SyntaxKind[SyntaxKind["JSDocProtectedTag"] = 338] = "JSDocProtectedTag"; + SyntaxKind[SyntaxKind["JSDocReadonlyTag"] = 339] = "JSDocReadonlyTag"; + SyntaxKind[SyntaxKind["JSDocOverrideTag"] = 340] = "JSDocOverrideTag"; + SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 341] = "JSDocCallbackTag"; + SyntaxKind[SyntaxKind["JSDocEnumTag"] = 342] = "JSDocEnumTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 343] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 344] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocThisTag"] = 345] = "JSDocThisTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 346] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 347] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 348] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocSeeTag"] = 349] = "JSDocSeeTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 350] = "JSDocPropertyTag"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 348] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 351] = "SyntaxList"; // Transformation nodes - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 349] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 350] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["CommaListExpression"] = 351] = "CommaListExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 352] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 353] = "EndOfDeclarationMarker"; - SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 354] = "SyntheticReferenceExpression"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 352] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 353] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["CommaListExpression"] = 354] = "CommaListExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 355] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 356] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 357] = "SyntheticReferenceExpression"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 355] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 358] = "Count"; // Markers SyntaxKind[SyntaxKind["FirstAssignment"] = 63] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 78] = "LastAssignment"; @@ -4500,15 +4539,15 @@ var ts; SyntaxKind[SyntaxKind["FirstReservedWord"] = 81] = "FirstReservedWord"; SyntaxKind[SyntaxKind["LastReservedWord"] = 116] = "LastReservedWord"; SyntaxKind[SyntaxKind["FirstKeyword"] = 81] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 160] = "LastKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 162] = "LastKeyword"; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 117] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 125] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 177] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 200] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 179] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 202] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 18] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 78] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 160] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 162] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; @@ -4517,15 +4556,15 @@ var ts; SyntaxKind[SyntaxKind["LastTemplateToken"] = 17] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 29] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 78] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstStatement"] = 237] = "FirstStatement"; - SyntaxKind[SyntaxKind["LastStatement"] = 253] = "LastStatement"; - SyntaxKind[SyntaxKind["FirstNode"] = 161] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 309] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 347] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 327] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 347] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstStatement"] = 240] = "FirstStatement"; + SyntaxKind[SyntaxKind["LastStatement"] = 256] = "LastStatement"; + SyntaxKind[SyntaxKind["FirstNode"] = 163] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 312] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 350] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 330] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 350] = "LastJSDocTagNode"; /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 126] = "FirstContextualKeyword"; - /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 160] = "LastContextualKeyword"; + /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 162] = "LastContextualKeyword"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); var NodeFlags; (function (NodeFlags) { @@ -4590,9 +4629,10 @@ var ts; ModifierFlags[ModifierFlags["Protected"] = 16] = "Protected"; ModifierFlags[ModifierFlags["Static"] = 32] = "Static"; ModifierFlags[ModifierFlags["Readonly"] = 64] = "Readonly"; - ModifierFlags[ModifierFlags["Abstract"] = 128] = "Abstract"; - ModifierFlags[ModifierFlags["Async"] = 256] = "Async"; - ModifierFlags[ModifierFlags["Default"] = 512] = "Default"; + ModifierFlags[ModifierFlags["Accessor"] = 128] = "Accessor"; + ModifierFlags[ModifierFlags["Abstract"] = 256] = "Abstract"; + ModifierFlags[ModifierFlags["Async"] = 512] = "Async"; + ModifierFlags[ModifierFlags["Default"] = 1024] = "Default"; ModifierFlags[ModifierFlags["Const"] = 2048] = "Const"; ModifierFlags[ModifierFlags["HasComputedJSDocModifiers"] = 4096] = "HasComputedJSDocModifiers"; ModifierFlags[ModifierFlags["Deprecated"] = 8192] = "Deprecated"; @@ -4605,10 +4645,10 @@ var ts; // Accessibility modifiers and 'readonly' can be attached to a parameter in a constructor to make it a property. ModifierFlags[ModifierFlags["ParameterPropertyModifier"] = 16476] = "ParameterPropertyModifier"; ModifierFlags[ModifierFlags["NonPublicAccessibilityModifier"] = 24] = "NonPublicAccessibilityModifier"; - ModifierFlags[ModifierFlags["TypeScriptModifier"] = 116958] = "TypeScriptModifier"; - ModifierFlags[ModifierFlags["ExportDefault"] = 513] = "ExportDefault"; - ModifierFlags[ModifierFlags["All"] = 257023] = "All"; - ModifierFlags[ModifierFlags["Modifier"] = 125951] = "Modifier"; + ModifierFlags[ModifierFlags["TypeScriptModifier"] = 117086] = "TypeScriptModifier"; + ModifierFlags[ModifierFlags["ExportDefault"] = 1025] = "ExportDefault"; + ModifierFlags[ModifierFlags["All"] = 258047] = "All"; + ModifierFlags[ModifierFlags["Modifier"] = 126975] = "Modifier"; })(ModifierFlags = ts.ModifierFlags || (ts.ModifierFlags = {})); var JsxFlags; (function (JsxFlags) { @@ -4804,6 +4844,7 @@ var ts; NodeBuilderFlags[NodeBuilderFlags["AllowEmptyTuple"] = 524288] = "AllowEmptyTuple"; NodeBuilderFlags[NodeBuilderFlags["AllowUniqueESSymbolType"] = 1048576] = "AllowUniqueESSymbolType"; NodeBuilderFlags[NodeBuilderFlags["AllowEmptyIndexInfoType"] = 2097152] = "AllowEmptyIndexInfoType"; + /* @internal */ NodeBuilderFlags[NodeBuilderFlags["WriteComputedProps"] = 1073741824] = "WriteComputedProps"; // Errors (cont.) NodeBuilderFlags[NodeBuilderFlags["AllowNodeModulesRelativePaths"] = 67108864] = "AllowNodeModulesRelativePaths"; /* @internal */ NodeBuilderFlags[NodeBuilderFlags["DoNotIncludeSymbolChain"] = 134217728] = "DoNotIncludeSymbolChain"; @@ -4864,8 +4905,10 @@ var ts; SymbolFormatFlags[SymbolFormatFlags["AllowAnyNodeKind"] = 4] = "AllowAnyNodeKind"; // Prefer aliases which are not directly visible SymbolFormatFlags[SymbolFormatFlags["UseAliasDefinedOutsideCurrentScope"] = 8] = "UseAliasDefinedOutsideCurrentScope"; + // { [E.A]: 1 } + /* @internal */ SymbolFormatFlags[SymbolFormatFlags["WriteComputedProps"] = 16] = "WriteComputedProps"; // Skip building an accessible symbol chain - /* @internal */ SymbolFormatFlags[SymbolFormatFlags["DoNotIncludeSymbolChain"] = 16] = "DoNotIncludeSymbolChain"; + /* @internal */ SymbolFormatFlags[SymbolFormatFlags["DoNotIncludeSymbolChain"] = 32] = "DoNotIncludeSymbolChain"; })(SymbolFormatFlags = ts.SymbolFormatFlags || (ts.SymbolFormatFlags = {})); /* @internal */ var SymbolAccessibility; @@ -4979,6 +5022,7 @@ var ts; SymbolFlags[SymbolFlags["MethodExcludes"] = 103359] = "MethodExcludes"; SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 46015] = "GetAccessorExcludes"; SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 78783] = "SetAccessorExcludes"; + SymbolFlags[SymbolFlags["AccessorExcludes"] = 13247] = "AccessorExcludes"; SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 526824] = "TypeParameterExcludes"; SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 788968] = "TypeAliasExcludes"; SymbolFlags[SymbolFlags["AliasExcludes"] = 2097152] = "AliasExcludes"; @@ -6105,7 +6149,6 @@ var ts; var pollingChunkSize = createPollingIntervalBasedLevels(defaultChunkLevels); /* @internal */ ts.unchangedPollThresholds = createPollingIntervalBasedLevels(defaultChunkLevels); - /* @internal */ function setCustomPollingValues(system) { if (!system.getEnvironmentVariable) { return; @@ -6148,7 +6191,6 @@ var ts; createPollingIntervalBasedLevels(customLevels ? __assign(__assign({}, defaultLevels), customLevels) : defaultLevels); } } - ts.setCustomPollingValues = setCustomPollingValues; function pollWatchedFileQueue(host, queue, pollIndex, chunkSize, callbackOnWatchFileStat) { var definedValueCopyToIndex = pollIndex; // Max visit would be all elements of the queue @@ -6194,7 +6236,6 @@ var ts; } } } - /* @internal */ function createDynamicPriorityPollingWatchFile(host) { var watchedFiles = []; var changedFilesInLastPoll = []; @@ -6303,7 +6344,6 @@ var ts; pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === PollingInterval.Low ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval)); } } - ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile; function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) { // One file can have multiple watchers var fileWatcherCallbacks = ts.createMultiMap(); @@ -6382,42 +6422,38 @@ var ts; pollScheduled = host.setTimeout(pollQueue, PollingInterval.High); } } - /* @internal */ - function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) { - var cache = new ts.Map(); - var callbacksCache = ts.createMultiMap(); + function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) { var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); - return function (fileName, callback, pollingInterval, options) { - var path = toCanonicalFileName(fileName); - var existing = cache.get(path); - if (existing) { - existing.refCount++; + var path = toCanonicalFileName(name); + var existing = cache.get(path); + if (existing) { + existing.callbacks.push(callback); + } + else { + cache.set(path, { + watcher: createWatcher(( + // Cant infer types correctly so lets satisfy checker + function (param1, param2, param3) { var _a; return (_a = cache.get(path)) === null || _a === void 0 ? void 0 : _a.callbacks.slice().forEach(function (cb) { return cb(param1, param2, param3); }); })), + callbacks: [callback] + }); + } + return { + close: function () { + var watcher = cache.get(path); + // Watcher is not expected to be undefined, but if it is normally its because + // exception was thrown somewhere else and watch state is not what it should be + if (!watcher) + return; + if (!ts.orderedRemoveItem(watcher.callbacks, callback) || watcher.callbacks.length) + return; + cache.delete(path); + ts.closeFileWatcherOf(watcher); } - else { - cache.set(path, { - watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options), - refCount: 1 - }); - } - callbacksCache.add(path, callback); - return { - close: function () { - var watcher = ts.Debug.checkDefined(cache.get(path)); - callbacksCache.remove(path, callback); - watcher.refCount--; - if (watcher.refCount) - return; - cache.delete(path); - ts.closeFileWatcherOf(watcher); - } - }; }; } - ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName; /** * Returns true if file status changed */ - /*@internal*/ function onWatchedFileStat(watchedFile, modifiedTime) { var oldTime = watchedFile.mtime.getTime(); var newTime = modifiedTime.getTime(); @@ -6429,7 +6465,6 @@ var ts; } return false; } - ts.onWatchedFileStat = onWatchedFileStat; /*@internal*/ function getFileWatcherEventKind(oldTime, newTime) { return oldTime === 0 @@ -6457,7 +6492,6 @@ var ts; * that means if this is recursive watcher, watch the children directories as well * (eg on OS that dont support recursive watch using fs.watch use fs.watchFile) */ - /*@internal*/ function createDirectoryWatcherSupportingRecursive(_a) { var watchDirectory = _a.watchDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, fileSystemEntryExists = _a.fileSystemEntryExists, realpath = _a.realpath, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout; var cache = new ts.Map(); @@ -6666,18 +6700,15 @@ var ts; return ts.stringContains(toCanonicalFilePath(path), searchPath); } } - ts.createDirectoryWatcherSupportingRecursive = createDirectoryWatcherSupportingRecursive; /*@internal*/ var FileSystemEntryKind; (function (FileSystemEntryKind) { FileSystemEntryKind[FileSystemEntryKind["File"] = 0] = "File"; FileSystemEntryKind[FileSystemEntryKind["Directory"] = 1] = "Directory"; })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {})); - /*@internal*/ function createFileWatcherCallback(callback) { return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); }; } - ts.createFileWatcherCallback = createFileWatcherCallback; function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) { return function (eventName, _relativeFileName, modifiedTime) { if (eventName === "rename") { @@ -6711,7 +6742,10 @@ var ts; } /*@internal*/ function createSystemWatchFunctions(_a) { - var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog; + var pollingWatchFileWorker = _a.pollingWatchFileWorker, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog; + var pollingWatches = new ts.Map(); + var fsWatches = new ts.Map(); + var fsWatchesRecursive = new ts.Map(); var dynamicPollingWatchFile; var fixedChunkSizePollingWatchFile; var nonPollingWatchFile; @@ -6775,7 +6809,7 @@ var ts; // Use notifications from FS to watch with falling back to fs.watchFile generateWatchFileOptions(ts.WatchFileKind.UseFsEventsOnParentDirectory, ts.PollingWatchKind.PriorityInterval, options) : // Default to do not use fixed polling interval - { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.FixedPollingInterval }; + { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.UseFsEvents }; } } function generateWatchFileOptions(watchFile, fallbackPolling, options) { @@ -6846,7 +6880,13 @@ var ts; }; } } + function pollingWatchFile(fileName, callback, pollingInterval, options) { + return createSingleWatcherPerName(pollingWatches, useCaseSensitiveFileNames, fileName, callback, function (cb) { return pollingWatchFileWorker(fileName, cb, pollingInterval, options); }); + } function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { + return createSingleWatcherPerName(recursive ? fsWatchesRecursive : fsWatches, useCaseSensitiveFileNames, fileOrDirectory, callback, function (cb) { return fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, cb, recursive, fallbackPollingInterval, fallbackOptions); }); + } + function fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { var lastDirectoryPartWithDirectorySeparator; var lastDirectoryPart; if (inodeWatching) { @@ -7025,7 +7065,7 @@ var ts; var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin"); var getCurrentDirectory = ts.memoize(function () { return process.cwd(); }); var _b = createSystemWatchFunctions({ - pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames), + pollingWatchFileWorker: fsWatchFileWorker, getModifiedTime: getModifiedTime, setTimeout: setTimeout, clearTimeout: clearTimeout, @@ -7845,12 +7885,9 @@ var ts; * Normalize path separators, converting `\` into `/`. */ function normalizeSlashes(path) { - var index = path.indexOf("\\"); - if (index === -1) { - return path; - } - backslashRegExp.lastIndex = index; // prime regex with known position - return path.replace(backslashRegExp, ts.directorySeparator); + return path.indexOf("\\") !== -1 + ? path.replace(backslashRegExp, ts.directorySeparator) + : path; } ts.normalizeSlashes = normalizeSlashes; /** @@ -8433,6 +8470,8 @@ var ts; A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled: diag(1272, ts.DiagnosticCategory.Error, "A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_w_1272", "A type referenced in a decorated signature must be imported with 'import type' or a namespace import when 'isolatedModules' and 'emitDecoratorMetadata' are enabled."), _0_modifier_cannot_appear_on_a_type_parameter: diag(1273, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_type_parameter_1273", "'{0}' modifier cannot appear on a type parameter"), _0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias: diag(1274, ts.DiagnosticCategory.Error, "_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias_1274", "'{0}' modifier can only appear on a type parameter of a class, interface or type alias"), + accessor_modifier_can_only_appear_on_a_property_declaration: diag(1275, ts.DiagnosticCategory.Error, "accessor_modifier_can_only_appear_on_a_property_declaration_1275", "'accessor' modifier can only appear on a property declaration."), + An_accessor_property_cannot_be_declared_optional: diag(1276, ts.DiagnosticCategory.Error, "An_accessor_property_cannot_be_declared_optional_1276", "An 'accessor' property cannot be declared optional."), with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."), await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."), The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, ts.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."), @@ -8483,7 +8522,7 @@ var ts; An_enum_member_name_must_be_followed_by_a_or: diag(1357, ts.DiagnosticCategory.Error, "An_enum_member_name_must_be_followed_by_a_or_1357", "An enum member name must be followed by a ',', '=', or '}'."), Tagged_template_expressions_are_not_permitted_in_an_optional_chain: diag(1358, ts.DiagnosticCategory.Error, "Tagged_template_expressions_are_not_permitted_in_an_optional_chain_1358", "Tagged template expressions are not permitted in an optional chain."), Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here: diag(1359, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here_1359", "Identifier expected. '{0}' is a reserved word that cannot be used here."), - Class_constructor_may_not_be_a_generator: diag(1360, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1360", "Class constructor may not be a generator."), + Type_0_does_not_satisfy_the_expected_type_1: diag(1360, ts.DiagnosticCategory.Error, "Type_0_does_not_satisfy_the_expected_type_1_1360", "Type '{0}' does not satisfy the expected type '{1}'."), _0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type: diag(1361, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type_1361", "'{0}' cannot be used as a value because it was imported using 'import type'."), _0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type: diag(1362, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type_1362", "'{0}' cannot be used as a value because it was exported using 'export type'."), A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both: diag(1363, ts.DiagnosticCategory.Error, "A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both_1363", "A type-only import can specify a default import or named bindings, but not both."), @@ -8491,6 +8530,7 @@ var ts; Convert_all_re_exported_types_to_type_only_exports: diag(1365, ts.DiagnosticCategory.Message, "Convert_all_re_exported_types_to_type_only_exports_1365", "Convert all re-exported types to type-only exports"), Split_into_two_separate_import_declarations: diag(1366, ts.DiagnosticCategory.Message, "Split_into_two_separate_import_declarations_1366", "Split into two separate import declarations"), Split_all_invalid_type_only_imports: diag(1367, ts.DiagnosticCategory.Message, "Split_all_invalid_type_only_imports_1367", "Split all invalid type-only imports"), + Class_constructor_may_not_be_a_generator: diag(1368, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1368", "Class constructor may not be a generator."), Did_you_mean_0: diag(1369, ts.DiagnosticCategory.Message, "Did_you_mean_0_1369", "Did you mean '{0}'?"), This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error: diag(1371, ts.DiagnosticCategory.Error, "This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set__1371", "This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'."), Convert_to_type_only_import: diag(1373, ts.DiagnosticCategory.Message, "Convert_to_type_only_import_1373", "Convert to type-only import"), @@ -8664,14 +8704,12 @@ var ts; The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."), The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."), The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."), - The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360", "The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."), - The_right_hand_side_of_an_in_expression_must_not_be_a_primitive: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361", "The right-hand side of an 'in' expression must not be a primitive."), The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."), Operator_0_cannot_be_applied_to_types_1_and_2: diag(2365, ts.DiagnosticCategory.Error, "Operator_0_cannot_be_applied_to_types_1_and_2_2365", "Operator '{0}' cannot be applied to types '{1}' and '{2}'."), Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: diag(2366, ts.DiagnosticCategory.Error, "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", "Function lacks ending return statement and return type does not include 'undefined'."), - This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367", "This condition will always return '{0}' since the types '{1}' and '{2}' have no overlap."), + This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367", "This comparison appears to be unintentional because the types '{0}' and '{1}' have no overlap."), Type_parameter_name_cannot_be_0: diag(2368, ts.DiagnosticCategory.Error, "Type_parameter_name_cannot_be_0_2368", "Type parameter name cannot be '{0}'."), A_parameter_property_is_only_allowed_in_a_constructor_implementation: diag(2369, ts.DiagnosticCategory.Error, "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", "A parameter property is only allowed in a constructor implementation."), A_rest_parameter_must_be_of_an_array_type: diag(2370, ts.DiagnosticCategory.Error, "A_rest_parameter_must_be_of_an_array_type_2370", "A rest parameter must be of an array type."), @@ -8914,6 +8952,7 @@ var ts; Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."), Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation: diag(2636, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation_2636", "Type '{0}' is not assignable to type '{1}' as implied by variance annotation."), Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types: diag(2637, ts.DiagnosticCategory.Error, "Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_t_2637", "Variance annotations are only supported in type aliases for object, function, constructor, and mapped types."), + Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator: diag(2638, ts.DiagnosticCategory.Error, "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638", "Type '{0}' may represent a primitive value, which is not permitted as the right operand of the 'in' operator."), Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."), A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."), Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."), @@ -9094,6 +9133,7 @@ var ts; _0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation: diag(2842, ts.DiagnosticCategory.Error, "_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842", "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"), We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here: diag(2843, ts.DiagnosticCategory.Error, "We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843", "We can only write a type for '{0}' by adding a type for the entire parameter here."), Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, ts.DiagnosticCategory.Error, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."), + This_condition_will_always_return_0: diag(2845, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."), Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."), Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."), Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."), @@ -9551,6 +9591,7 @@ var ts; Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved: diag(6398, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."), Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes were not emitted"), Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs to update timestamps of output files that are older than input files"), + Project_0_is_out_of_date_because_there_was_error_reading_file_1: diag(6401, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401", "Project '{0}' is out of date because there was error reading file '{1}'"), The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"), The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."), The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."), @@ -9793,6 +9834,7 @@ var ts; The_tag_was_first_specified_here: diag(8034, ts.DiagnosticCategory.Error, "The_tag_was_first_specified_here_8034", "The tag was first specified here."), You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder: diag(8035, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder_8035", "You cannot rename elements that are defined in a 'node_modules' folder."), You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder: diag(8036, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder_8036", "You cannot rename elements that are defined in another 'node_modules' folder."), + Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files: diag(8037, ts.DiagnosticCategory.Error, "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037", "Type satisfaction expressions can only be used in TypeScript files."), Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."), Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."), JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17000, ts.DiagnosticCategory.Error, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."), @@ -9964,6 +10006,7 @@ var ts; Set_the_module_option_in_your_configuration_file_to_0: diag(95099, ts.DiagnosticCategory.Message, "Set_the_module_option_in_your_configuration_file_to_0_95099", "Set the 'module' option in your configuration file to '{0}'"), Convert_invalid_character_to_its_html_entity_code: diag(95100, ts.DiagnosticCategory.Message, "Convert_invalid_character_to_its_html_entity_code_95100", "Convert invalid character to its html entity code"), Convert_all_invalid_characters_to_HTML_entity_code: diag(95101, ts.DiagnosticCategory.Message, "Convert_all_invalid_characters_to_HTML_entity_code_95101", "Convert all invalid characters to HTML entity code"), + Convert_all_const_to_let: diag(95102, ts.DiagnosticCategory.Message, "Convert_all_const_to_let_95102", "Convert all 'const' to 'let'"), Convert_function_expression_0_to_arrow_function: diag(95105, ts.DiagnosticCategory.Message, "Convert_function_expression_0_to_arrow_function_95105", "Convert function expression '{0}' to arrow function"), Convert_function_declaration_0_to_arrow_function: diag(95106, ts.DiagnosticCategory.Message, "Convert_function_declaration_0_to_arrow_function_95106", "Convert function declaration '{0}' to arrow function"), Fix_all_implicit_this_errors: diag(95107, ts.DiagnosticCategory.Message, "Fix_all_implicit_this_errors_95107", "Fix all implicit-'this' errors"), @@ -10033,6 +10076,8 @@ var ts; Delete_unused_param_tag_0: diag(95171, ts.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"), Delete_all_unused_param_tags: diag(95172, ts.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"), Rename_param_tag_name_0_to_1: diag(95173, ts.DiagnosticCategory.Message, "Rename_param_tag_name_0_to_1_95173", "Rename '@param' tag name '{0}' to '{1}'"), + Use_0: diag(95174, ts.DiagnosticCategory.Message, "Use_0_95174", "Use `{0}`."), + Use_Number_isNaN_in_all_conditions: diag(95175, ts.DiagnosticCategory.Message, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."), No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."), Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."), JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, ts.DiagnosticCategory.Error, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"), @@ -10066,6 +10111,12 @@ var ts; _0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation: diag(18042, ts.DiagnosticCategory.Error, "_0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation_18042", "'{0}' is a type and cannot be imported in JavaScript files. Use '{1}' in a JSDoc type annotation."), Types_cannot_appear_in_export_declarations_in_JavaScript_files: diag(18043, ts.DiagnosticCategory.Error, "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043", "Types cannot appear in export declarations in JavaScript files."), _0_is_automatically_exported_here: diag(18044, ts.DiagnosticCategory.Message, "_0_is_automatically_exported_here_18044", "'{0}' is automatically exported here."), + Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher: diag(18045, ts.DiagnosticCategory.Error, "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045", "Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher."), + _0_is_of_type_unknown: diag(18046, ts.DiagnosticCategory.Error, "_0_is_of_type_unknown_18046", "'{0}' is of type 'unknown'."), + _0_is_possibly_null: diag(18047, ts.DiagnosticCategory.Error, "_0_is_possibly_null_18047", "'{0}' is possibly 'null'."), + _0_is_possibly_undefined: diag(18048, ts.DiagnosticCategory.Error, "_0_is_possibly_undefined_18048", "'{0}' is possibly 'undefined'."), + _0_is_possibly_null_or_undefined: diag(18049, ts.DiagnosticCategory.Error, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."), + The_value_0_cannot_be_used_here: diag(18050, ts.DiagnosticCategory.Error, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."), }; })(ts || (ts = {})); var ts; @@ -10084,12 +10135,13 @@ var ts; /** @internal */ ts.textToKeywordObj = (_a = { abstract: 126 /* SyntaxKind.AbstractKeyword */, - any: 130 /* SyntaxKind.AnyKeyword */, - as: 127 /* SyntaxKind.AsKeyword */, - asserts: 128 /* SyntaxKind.AssertsKeyword */, - assert: 129 /* SyntaxKind.AssertKeyword */, - bigint: 158 /* SyntaxKind.BigIntKeyword */, - boolean: 133 /* SyntaxKind.BooleanKeyword */, + accessor: 127 /* SyntaxKind.AccessorKeyword */, + any: 131 /* SyntaxKind.AnyKeyword */, + as: 128 /* SyntaxKind.AsKeyword */, + asserts: 129 /* SyntaxKind.AssertsKeyword */, + assert: 130 /* SyntaxKind.AssertKeyword */, + bigint: 160 /* SyntaxKind.BigIntKeyword */, + boolean: 134 /* SyntaxKind.BooleanKeyword */, break: 81 /* SyntaxKind.BreakKeyword */, case: 82 /* SyntaxKind.CaseKeyword */, catch: 83 /* SyntaxKind.CatchKeyword */, @@ -10097,9 +10149,9 @@ var ts; continue: 86 /* SyntaxKind.ContinueKeyword */, const: 85 /* SyntaxKind.ConstKeyword */ }, - _a["" + "constructor"] = 134 /* SyntaxKind.ConstructorKeyword */, + _a["" + "constructor"] = 135 /* SyntaxKind.ConstructorKeyword */, _a.debugger = 87 /* SyntaxKind.DebuggerKeyword */, - _a.declare = 135 /* SyntaxKind.DeclareKeyword */, + _a.declare = 136 /* SyntaxKind.DeclareKeyword */, _a.default = 88 /* SyntaxKind.DefaultKeyword */, _a.delete = 89 /* SyntaxKind.DeleteKeyword */, _a.do = 90 /* SyntaxKind.DoKeyword */, @@ -10110,60 +10162,61 @@ var ts; _a.false = 95 /* SyntaxKind.FalseKeyword */, _a.finally = 96 /* SyntaxKind.FinallyKeyword */, _a.for = 97 /* SyntaxKind.ForKeyword */, - _a.from = 156 /* SyntaxKind.FromKeyword */, + _a.from = 158 /* SyntaxKind.FromKeyword */, _a.function = 98 /* SyntaxKind.FunctionKeyword */, - _a.get = 136 /* SyntaxKind.GetKeyword */, + _a.get = 137 /* SyntaxKind.GetKeyword */, _a.if = 99 /* SyntaxKind.IfKeyword */, _a.implements = 117 /* SyntaxKind.ImplementsKeyword */, _a.import = 100 /* SyntaxKind.ImportKeyword */, _a.in = 101 /* SyntaxKind.InKeyword */, - _a.infer = 137 /* SyntaxKind.InferKeyword */, + _a.infer = 138 /* SyntaxKind.InferKeyword */, _a.instanceof = 102 /* SyntaxKind.InstanceOfKeyword */, _a.interface = 118 /* SyntaxKind.InterfaceKeyword */, - _a.intrinsic = 138 /* SyntaxKind.IntrinsicKeyword */, - _a.is = 139 /* SyntaxKind.IsKeyword */, - _a.keyof = 140 /* SyntaxKind.KeyOfKeyword */, + _a.intrinsic = 139 /* SyntaxKind.IntrinsicKeyword */, + _a.is = 140 /* SyntaxKind.IsKeyword */, + _a.keyof = 141 /* SyntaxKind.KeyOfKeyword */, _a.let = 119 /* SyntaxKind.LetKeyword */, - _a.module = 141 /* SyntaxKind.ModuleKeyword */, - _a.namespace = 142 /* SyntaxKind.NamespaceKeyword */, - _a.never = 143 /* SyntaxKind.NeverKeyword */, + _a.module = 142 /* SyntaxKind.ModuleKeyword */, + _a.namespace = 143 /* SyntaxKind.NamespaceKeyword */, + _a.never = 144 /* SyntaxKind.NeverKeyword */, _a.new = 103 /* SyntaxKind.NewKeyword */, _a.null = 104 /* SyntaxKind.NullKeyword */, - _a.number = 147 /* SyntaxKind.NumberKeyword */, - _a.object = 148 /* SyntaxKind.ObjectKeyword */, + _a.number = 148 /* SyntaxKind.NumberKeyword */, + _a.object = 149 /* SyntaxKind.ObjectKeyword */, _a.package = 120 /* SyntaxKind.PackageKeyword */, _a.private = 121 /* SyntaxKind.PrivateKeyword */, _a.protected = 122 /* SyntaxKind.ProtectedKeyword */, _a.public = 123 /* SyntaxKind.PublicKeyword */, - _a.override = 159 /* SyntaxKind.OverrideKeyword */, - _a.out = 144 /* SyntaxKind.OutKeyword */, - _a.readonly = 145 /* SyntaxKind.ReadonlyKeyword */, - _a.require = 146 /* SyntaxKind.RequireKeyword */, - _a.global = 157 /* SyntaxKind.GlobalKeyword */, + _a.override = 161 /* SyntaxKind.OverrideKeyword */, + _a.out = 145 /* SyntaxKind.OutKeyword */, + _a.readonly = 146 /* SyntaxKind.ReadonlyKeyword */, + _a.require = 147 /* SyntaxKind.RequireKeyword */, + _a.global = 159 /* SyntaxKind.GlobalKeyword */, _a.return = 105 /* SyntaxKind.ReturnKeyword */, - _a.set = 149 /* SyntaxKind.SetKeyword */, + _a.satisfies = 150 /* SyntaxKind.SatisfiesKeyword */, + _a.set = 151 /* SyntaxKind.SetKeyword */, _a.static = 124 /* SyntaxKind.StaticKeyword */, - _a.string = 150 /* SyntaxKind.StringKeyword */, + _a.string = 152 /* SyntaxKind.StringKeyword */, _a.super = 106 /* SyntaxKind.SuperKeyword */, _a.switch = 107 /* SyntaxKind.SwitchKeyword */, - _a.symbol = 151 /* SyntaxKind.SymbolKeyword */, + _a.symbol = 153 /* SyntaxKind.SymbolKeyword */, _a.this = 108 /* SyntaxKind.ThisKeyword */, _a.throw = 109 /* SyntaxKind.ThrowKeyword */, _a.true = 110 /* SyntaxKind.TrueKeyword */, _a.try = 111 /* SyntaxKind.TryKeyword */, - _a.type = 152 /* SyntaxKind.TypeKeyword */, + _a.type = 154 /* SyntaxKind.TypeKeyword */, _a.typeof = 112 /* SyntaxKind.TypeOfKeyword */, - _a.undefined = 153 /* SyntaxKind.UndefinedKeyword */, - _a.unique = 154 /* SyntaxKind.UniqueKeyword */, - _a.unknown = 155 /* SyntaxKind.UnknownKeyword */, + _a.undefined = 155 /* SyntaxKind.UndefinedKeyword */, + _a.unique = 156 /* SyntaxKind.UniqueKeyword */, + _a.unknown = 157 /* SyntaxKind.UnknownKeyword */, _a.var = 113 /* SyntaxKind.VarKeyword */, _a.void = 114 /* SyntaxKind.VoidKeyword */, _a.while = 115 /* SyntaxKind.WhileKeyword */, _a.with = 116 /* SyntaxKind.WithKeyword */, _a.yield = 125 /* SyntaxKind.YieldKeyword */, - _a.async = 131 /* SyntaxKind.AsyncKeyword */, - _a.await = 132 /* SyntaxKind.AwaitKeyword */, - _a.of = 160 /* SyntaxKind.OfKeyword */, + _a.async = 132 /* SyntaxKind.AsyncKeyword */, + _a.await = 133 /* SyntaxKind.AwaitKeyword */, + _a.of = 162 /* SyntaxKind.OfKeyword */, _a); var textToKeyword = new ts.Map(ts.getEntries(ts.textToKeywordObj)); var textToToken = new ts.Map(ts.getEntries(__assign(__assign({}, ts.textToKeywordObj), { "{": 18 /* SyntaxKind.OpenBraceToken */, "}": 19 /* SyntaxKind.CloseBraceToken */, "(": 20 /* SyntaxKind.OpenParenToken */, ")": 21 /* SyntaxKind.CloseParenToken */, "[": 22 /* SyntaxKind.OpenBracketToken */, "]": 23 /* SyntaxKind.CloseBracketToken */, ".": 24 /* SyntaxKind.DotToken */, "...": 25 /* SyntaxKind.DotDotDotToken */, ";": 26 /* SyntaxKind.SemicolonToken */, ",": 27 /* SyntaxKind.CommaToken */, "<": 29 /* SyntaxKind.LessThanToken */, ">": 31 /* SyntaxKind.GreaterThanToken */, "<=": 32 /* SyntaxKind.LessThanEqualsToken */, ">=": 33 /* SyntaxKind.GreaterThanEqualsToken */, "==": 34 /* SyntaxKind.EqualsEqualsToken */, "!=": 35 /* SyntaxKind.ExclamationEqualsToken */, "===": 36 /* SyntaxKind.EqualsEqualsEqualsToken */, "!==": 37 /* SyntaxKind.ExclamationEqualsEqualsToken */, "=>": 38 /* SyntaxKind.EqualsGreaterThanToken */, "+": 39 /* SyntaxKind.PlusToken */, "-": 40 /* SyntaxKind.MinusToken */, "**": 42 /* SyntaxKind.AsteriskAsteriskToken */, "*": 41 /* SyntaxKind.AsteriskToken */, "/": 43 /* SyntaxKind.SlashToken */, "%": 44 /* SyntaxKind.PercentToken */, "++": 45 /* SyntaxKind.PlusPlusToken */, "--": 46 /* SyntaxKind.MinusMinusToken */, "<<": 47 /* SyntaxKind.LessThanLessThanToken */, ">": 48 /* SyntaxKind.GreaterThanGreaterThanToken */, ">>>": 49 /* SyntaxKind.GreaterThanGreaterThanGreaterThanToken */, "&": 50 /* SyntaxKind.AmpersandToken */, "|": 51 /* SyntaxKind.BarToken */, "^": 52 /* SyntaxKind.CaretToken */, "!": 53 /* SyntaxKind.ExclamationToken */, "~": 54 /* SyntaxKind.TildeToken */, "&&": 55 /* SyntaxKind.AmpersandAmpersandToken */, "||": 56 /* SyntaxKind.BarBarToken */, "?": 57 /* SyntaxKind.QuestionToken */, "??": 60 /* SyntaxKind.QuestionQuestionToken */, "?.": 28 /* SyntaxKind.QuestionDotToken */, ":": 58 /* SyntaxKind.ColonToken */, "=": 63 /* SyntaxKind.EqualsToken */, "+=": 64 /* SyntaxKind.PlusEqualsToken */, "-=": 65 /* SyntaxKind.MinusEqualsToken */, "*=": 66 /* SyntaxKind.AsteriskEqualsToken */, "**=": 67 /* SyntaxKind.AsteriskAsteriskEqualsToken */, "/=": 68 /* SyntaxKind.SlashEqualsToken */, "%=": 69 /* SyntaxKind.PercentEqualsToken */, "<<=": 70 /* SyntaxKind.LessThanLessThanEqualsToken */, ">>=": 71 /* SyntaxKind.GreaterThanGreaterThanEqualsToken */, ">>>=": 72 /* SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 73 /* SyntaxKind.AmpersandEqualsToken */, "|=": 74 /* SyntaxKind.BarEqualsToken */, "^=": 78 /* SyntaxKind.CaretEqualsToken */, "||=": 75 /* SyntaxKind.BarBarEqualsToken */, "&&=": 76 /* SyntaxKind.AmpersandAmpersandEqualsToken */, "??=": 77 /* SyntaxKind.QuestionQuestionEqualsToken */, "@": 59 /* SyntaxKind.AtToken */, "#": 62 /* SyntaxKind.HashToken */, "`": 61 /* SyntaxKind.BacktickToken */ }))); @@ -10286,7 +10339,7 @@ var ts; ts.stringToToken = stringToToken; /* @internal */ function computeLineStarts(text) { - var result = new Array(); + var result = []; var pos = 0; var lineStart = 0; while (pos < text.length) { @@ -11847,12 +11900,36 @@ var ts; pos++; return token = 0 /* SyntaxKind.Unknown */; } - if (isIdentifierStart(codePointAt(text, pos + 1), languageVersion)) { + var charAfterHash = codePointAt(text, pos + 1); + if (charAfterHash === 92 /* CharacterCodes.backslash */) { pos++; - scanIdentifier(codePointAt(text, pos), languageVersion); + var extendedCookedChar_1 = peekExtendedUnicodeEscape(); + if (extendedCookedChar_1 >= 0 && isIdentifierStart(extendedCookedChar_1, languageVersion)) { + pos += 3; + tokenFlags |= 8 /* TokenFlags.ExtendedUnicodeEscape */; + tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts(); + return token = 80 /* SyntaxKind.PrivateIdentifier */; + } + var cookedChar_1 = peekUnicodeEscape(); + if (cookedChar_1 >= 0 && isIdentifierStart(cookedChar_1, languageVersion)) { + pos += 6; + tokenFlags |= 1024 /* TokenFlags.UnicodeEscape */; + tokenValue = "#" + String.fromCharCode(cookedChar_1) + scanIdentifierParts(); + return token = 80 /* SyntaxKind.PrivateIdentifier */; + } + pos--; + } + if (isIdentifierStart(charAfterHash, languageVersion)) { + pos++; + // We're relying on scanIdentifier's behavior and adjusting the token kind after the fact. + // Notably absent from this block is the fact that calling a function named "scanIdentifier", + // but identifiers don't include '#', and that function doesn't deal with it at all. + // This works because 'scanIdentifier' tries to reuse source characters and builds up substrings; + // however, it starts at the 'tokenPos' which includes the '#', and will "accidentally" prepend the '#' for us. + scanIdentifier(charAfterHash, languageVersion); } else { - tokenValue = String.fromCharCode(codePointAt(text, pos)); + tokenValue = "#"; error(ts.Diagnostics.Invalid_character, pos++, charSize(ch)); } return token = 80 /* SyntaxKind.PrivateIdentifier */; @@ -12603,9 +12680,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 163 /* SyntaxKind.TypeParameter */) { + if (d && d.kind === 165 /* SyntaxKind.TypeParameter */) { for (var current = d; current; current = current.parent) { - if (isFunctionLike(current) || isClassLike(current) || current.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (isFunctionLike(current) || isClassLike(current) || current.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return current; } } @@ -12613,7 +12690,7 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node, parent) { - return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) && parent.kind === 171 /* SyntaxKind.Constructor */; + return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) && parent.kind === 173 /* SyntaxKind.Constructor */; } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; function isEmptyBindingPattern(node) { @@ -12643,14 +12720,14 @@ var ts; node = walkUpBindingElementsAndPatterns(node); } var flags = getFlags(node); - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node && node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { flags |= getFlags(node); node = node.parent; } - if (node && node.kind === 237 /* SyntaxKind.VariableStatement */) { + if (node && node.kind === 240 /* SyntaxKind.VariableStatement */) { flags |= getFlags(node); } return flags; @@ -12823,30 +12900,30 @@ var ts; } // Covers remaining cases (returning undefined if none match). switch (hostNode.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: if (hostNode.declarationList && hostNode.declarationList.declarations[0]) { return getDeclarationIdentifier(hostNode.declarationList.declarations[0]); } break; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: var expr = hostNode.expression; - if (expr.kind === 221 /* SyntaxKind.BinaryExpression */ && expr.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (expr.kind === 223 /* SyntaxKind.BinaryExpression */ && expr.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { expr = expr.left; } switch (expr.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return expr.name; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var arg = expr.argumentExpression; if (ts.isIdentifier(arg)) { return arg; } } break; - case 212 /* SyntaxKind.ParenthesizedExpression */: { + case 214 /* SyntaxKind.ParenthesizedExpression */: { return getDeclarationIdentifier(hostNode.expression); } - case 250 /* SyntaxKind.LabeledStatement */: { + case 253 /* SyntaxKind.LabeledStatement */: { if (isDeclaration(hostNode.statement) || isExpression(hostNode.statement)) { return getDeclarationIdentifier(hostNode.statement); } @@ -12883,16 +12960,16 @@ var ts; switch (declaration.kind) { case 79 /* SyntaxKind.Identifier */: return declaration; - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: { + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: { var name = declaration.name; - if (name.kind === 161 /* SyntaxKind.QualifiedName */) { + if (name.kind === 163 /* SyntaxKind.QualifiedName */) { return name.right; } break; } - case 208 /* SyntaxKind.CallExpression */: - case 221 /* SyntaxKind.BinaryExpression */: { + case 210 /* SyntaxKind.CallExpression */: + case 223 /* SyntaxKind.BinaryExpression */: { var expr_1 = declaration; switch (ts.getAssignmentDeclarationKind(expr_1)) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -12908,15 +12985,15 @@ var ts; return undefined; } } - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return getNameOfJSDocTypedef(declaration); - case 339 /* SyntaxKind.JSDocEnumTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return nameForNamelessJSDocTypedef(declaration); - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var expression = declaration.expression; return ts.isIdentifier(expression) ? expression : undefined; } - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = declaration; if (ts.isBindableStaticElementAccessExpression(expr)) { return expr.argumentExpression; @@ -12960,7 +13037,7 @@ var ts; } ts.getDecorators = getDecorators; function getModifiers(node) { - if (ts.hasSyntacticModifier(node, 125951 /* ModifierFlags.Modifier */)) { + if (ts.hasSyntacticModifier(node, 126975 /* ModifierFlags.Modifier */)) { return ts.filter(node.modifiers, isModifier); } } @@ -13221,12 +13298,12 @@ var ts; /** Gets the text of a jsdoc comment, flattening links to their text. */ function getTextOfJSDocComment(comment) { return typeof comment === "string" ? comment - : comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 321 /* SyntaxKind.JSDocText */ ? c.text : formatJSDocLink(c); }).join(""); + : comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 324 /* SyntaxKind.JSDocText */ ? c.text : formatJSDocLink(c); }).join(""); } ts.getTextOfJSDocComment = getTextOfJSDocComment; function formatJSDocLink(link) { - var kind = link.kind === 324 /* SyntaxKind.JSDocLink */ ? "link" - : link.kind === 325 /* SyntaxKind.JSDocLinkCode */ ? "linkcode" + var kind = link.kind === 327 /* SyntaxKind.JSDocLink */ ? "link" + : link.kind === 328 /* SyntaxKind.JSDocLinkCode */ ? "linkcode" : "linkplain"; var name = link.name ? ts.entityNameToString(link.name) : ""; var space = link.name && link.text.startsWith("://") ? "" : " "; @@ -13247,7 +13324,7 @@ var ts; return ts.emptyArray; } if (ts.isJSDocTypeAlias(node)) { - ts.Debug.assert(node.parent.kind === 320 /* SyntaxKind.JSDoc */); + ts.Debug.assert(node.parent.kind === 323 /* SyntaxKind.JSDoc */); return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; }); } if (node.typeParameters) { @@ -13282,7 +13359,7 @@ var ts; ts.isMemberName = isMemberName; /* @internal */ function isGetOrSetAccessorDeclaration(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */ || node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */ || node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetOrSetAccessorDeclaration = isGetOrSetAccessorDeclaration; function isPropertyAccessChain(node) { @@ -13300,10 +13377,10 @@ var ts; function isOptionalChain(node) { var kind = node.kind; return !!(node.flags & 32 /* NodeFlags.OptionalChain */) && - (kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 207 /* SyntaxKind.ElementAccessExpression */ - || kind === 208 /* SyntaxKind.CallExpression */ - || kind === 230 /* SyntaxKind.NonNullExpression */); + (kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 209 /* SyntaxKind.ElementAccessExpression */ + || kind === 210 /* SyntaxKind.CallExpression */ + || kind === 232 /* SyntaxKind.NonNullExpression */); } ts.isOptionalChain = isOptionalChain; /* @internal */ @@ -13338,7 +13415,7 @@ var ts; } ts.isOutermostOptionalChain = isOutermostOptionalChain; function isNullishCoalesce(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */; } ts.isNullishCoalesce = isNullishCoalesce; function isConstTypeReference(node) { @@ -13355,17 +13432,17 @@ var ts; } ts.isNonNullChain = isNonNullChain; function isBreakOrContinueStatement(node) { - return node.kind === 246 /* SyntaxKind.BreakStatement */ || node.kind === 245 /* SyntaxKind.ContinueStatement */; + return node.kind === 249 /* SyntaxKind.BreakStatement */ || node.kind === 248 /* SyntaxKind.ContinueStatement */; } ts.isBreakOrContinueStatement = isBreakOrContinueStatement; function isNamedExportBindings(node) { - return node.kind === 274 /* SyntaxKind.NamespaceExport */ || node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 277 /* SyntaxKind.NamespaceExport */ || node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedExportBindings = isNamedExportBindings; function isUnparsedTextLike(node) { switch (node.kind) { - case 302 /* SyntaxKind.UnparsedText */: - case 303 /* SyntaxKind.UnparsedInternalText */: + case 305 /* SyntaxKind.UnparsedText */: + case 306 /* SyntaxKind.UnparsedInternalText */: return true; default: return false; @@ -13374,12 +13451,12 @@ var ts; ts.isUnparsedTextLike = isUnparsedTextLike; function isUnparsedNode(node) { return isUnparsedTextLike(node) || - node.kind === 300 /* SyntaxKind.UnparsedPrologue */ || - node.kind === 304 /* SyntaxKind.UnparsedSyntheticReference */; + node.kind === 303 /* SyntaxKind.UnparsedPrologue */ || + node.kind === 307 /* SyntaxKind.UnparsedSyntheticReference */; } ts.isUnparsedNode = isUnparsedNode; function isJSDocPropertyLikeTag(node) { - return node.kind === 347 /* SyntaxKind.JSDocPropertyTag */ || node.kind === 340 /* SyntaxKind.JSDocParameterTag */; + return node.kind === 350 /* SyntaxKind.JSDocPropertyTag */ || node.kind === 343 /* SyntaxKind.JSDocParameterTag */; } ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; // #endregion @@ -13395,7 +13472,7 @@ var ts; ts.isNode = isNode; /* @internal */ function isNodeKind(kind) { - return kind >= 161 /* SyntaxKind.FirstNode */; + return kind >= 163 /* SyntaxKind.FirstNode */; } ts.isNodeKind = isNodeKind; /** @@ -13404,7 +13481,7 @@ var ts; * Literals are considered tokens, except TemplateLiteral, but does include TemplateHead/Middle/Tail. */ function isTokenKind(kind) { - return kind >= 0 /* SyntaxKind.FirstToken */ && kind <= 160 /* SyntaxKind.LastToken */; + return kind >= 0 /* SyntaxKind.FirstToken */ && kind <= 162 /* SyntaxKind.LastToken */; } ts.isTokenKind = isTokenKind; /** @@ -13419,7 +13496,7 @@ var ts; // Node Arrays /* @internal */ function isNodeArray(array) { - return array.hasOwnProperty("pos") && array.hasOwnProperty("end"); + return ts.hasProperty(array, "pos") && ts.hasProperty(array, "end"); } ts.isNodeArray = isNodeArray; // Literals @@ -13435,11 +13512,11 @@ var ts; /** @internal */ function isLiteralExpressionOfObject(node) { switch (node.kind) { - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: return true; } return false; @@ -13467,13 +13544,13 @@ var ts; ts.isImportOrExportSpecifier = isImportOrExportSpecifier; function isTypeOnlyImportOrExportDeclaration(node) { switch (node.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return node.isTypeOnly || node.parent.parent.isTypeOnly; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.isTypeOnly; - case 267 /* SyntaxKind.ImportClause */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 270 /* SyntaxKind.ImportClause */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.isTypeOnly; default: return false; @@ -13494,6 +13571,11 @@ var ts; return ts.isIdentifier(node) && (node.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) > 0 /* GeneratedIdentifierFlags.None */; } ts.isGeneratedIdentifier = isGeneratedIdentifier; + /* @internal */ + function isGeneratedPrivateIdentifier(node) { + return ts.isPrivateIdentifier(node) && (node.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) > 0 /* GeneratedIdentifierFlags.None */; + } + ts.isGeneratedPrivateIdentifier = isGeneratedPrivateIdentifier; // Private Identifiers /*@internal*/ function isPrivateIdentifierClassElementDeclaration(node) { @@ -13510,19 +13592,20 @@ var ts; function isModifierKind(token) { switch (token) { case 126 /* SyntaxKind.AbstractKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 88 /* SyntaxKind.DefaultKeyword */: case 93 /* SyntaxKind.ExportKeyword */: case 101 /* SyntaxKind.InKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 144 /* SyntaxKind.OutKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 145 /* SyntaxKind.OutKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: return true; } return false; @@ -13535,7 +13618,10 @@ var ts; ts.isParameterPropertyModifier = isParameterPropertyModifier; /* @internal */ function isClassMemberModifier(idToken) { - return isParameterPropertyModifier(idToken) || idToken === 124 /* SyntaxKind.StaticKeyword */ || idToken === 159 /* SyntaxKind.OverrideKeyword */; + return isParameterPropertyModifier(idToken) || + idToken === 124 /* SyntaxKind.StaticKeyword */ || + idToken === 161 /* SyntaxKind.OverrideKeyword */ || + idToken === 127 /* SyntaxKind.AccessorKeyword */; } ts.isClassMemberModifier = isClassMemberModifier; function isModifier(node) { @@ -13544,7 +13630,7 @@ var ts; ts.isModifier = isModifier; function isEntityName(node) { var kind = node.kind; - return kind === 161 /* SyntaxKind.QualifiedName */ + return kind === 163 /* SyntaxKind.QualifiedName */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isEntityName = isEntityName; @@ -13554,14 +13640,14 @@ var ts; || kind === 80 /* SyntaxKind.PrivateIdentifier */ || kind === 10 /* SyntaxKind.StringLiteral */ || kind === 8 /* SyntaxKind.NumericLiteral */ - || kind === 162 /* SyntaxKind.ComputedPropertyName */; + || kind === 164 /* SyntaxKind.ComputedPropertyName */; } ts.isPropertyName = isPropertyName; function isBindingName(node) { var kind = node.kind; return kind === 79 /* SyntaxKind.Identifier */ - || kind === 201 /* SyntaxKind.ObjectBindingPattern */ - || kind === 202 /* SyntaxKind.ArrayBindingPattern */; + || kind === 203 /* SyntaxKind.ObjectBindingPattern */ + || kind === 204 /* SyntaxKind.ArrayBindingPattern */; } ts.isBindingName = isBindingName; // Functions @@ -13586,13 +13672,13 @@ var ts; ts.isBooleanLiteral = isBooleanLiteral; function isFunctionLikeDeclarationKind(kind) { switch (kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: return false; @@ -13601,14 +13687,14 @@ var ts; /* @internal */ function isFunctionLikeKind(kind) { switch (kind) { - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return true; default: return isFunctionLikeDeclarationKind(kind); @@ -13623,36 +13709,53 @@ var ts; // Classes function isClassElement(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 234 /* SyntaxKind.SemicolonClassElement */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 237 /* SyntaxKind.SemicolonClassElement */; } ts.isClassElement = isClassElement; function isClassLike(node) { - return node && (node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */); + return node && (node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */); } ts.isClassLike = isClassLike; function isAccessor(node) { - return node && (node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */); + return node && (node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */); } ts.isAccessor = isAccessor; + function isAutoAccessorPropertyDeclaration(node) { + return ts.isPropertyDeclaration(node) && ts.hasAccessorModifier(node); + } + ts.isAutoAccessorPropertyDeclaration = isAutoAccessorPropertyDeclaration; /* @internal */ function isMethodOrAccessor(node) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; default: return false; } } ts.isMethodOrAccessor = isMethodOrAccessor; + /* @internal */ + function isNamedClassElement(node) { + switch (node.kind) { + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + return true; + default: + return false; + } + } + ts.isNamedClassElement = isNamedClassElement; // Type members function isModifierLike(node) { return isModifier(node) || ts.isDecorator(node); @@ -13660,13 +13763,13 @@ var ts; ts.isModifierLike = isModifierLike; function isTypeElement(node) { var kind = node.kind; - return kind === 175 /* SyntaxKind.ConstructSignature */ - || kind === 174 /* SyntaxKind.CallSignature */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 177 /* SyntaxKind.ConstructSignature */ + || kind === 176 /* SyntaxKind.CallSignature */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.isTypeElement = isTypeElement; function isClassOrTypeElement(node) { @@ -13675,12 +13778,12 @@ var ts; ts.isClassOrTypeElement = isClassOrTypeElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 298 /* SyntaxKind.SpreadAssignment */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 301 /* SyntaxKind.SpreadAssignment */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; // Type @@ -13695,8 +13798,8 @@ var ts; ts.isTypeNode = isTypeNode; function isFunctionOrConstructorTypeNode(node) { switch (node.kind) { - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return true; } return false; @@ -13707,8 +13810,8 @@ var ts; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 202 /* SyntaxKind.ArrayBindingPattern */ - || kind === 201 /* SyntaxKind.ObjectBindingPattern */; + return kind === 204 /* SyntaxKind.ArrayBindingPattern */ + || kind === 203 /* SyntaxKind.ObjectBindingPattern */; } return false; } @@ -13716,15 +13819,15 @@ var ts; /* @internal */ function isAssignmentPattern(node) { var kind = node.kind; - return kind === 204 /* SyntaxKind.ArrayLiteralExpression */ - || kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return kind === 206 /* SyntaxKind.ArrayLiteralExpression */ + || kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isAssignmentPattern = isAssignmentPattern; /* @internal */ function isArrayBindingElement(node) { var kind = node.kind; - return kind === 203 /* SyntaxKind.BindingElement */ - || kind === 227 /* SyntaxKind.OmittedExpression */; + return kind === 205 /* SyntaxKind.BindingElement */ + || kind === 229 /* SyntaxKind.OmittedExpression */; } ts.isArrayBindingElement = isArrayBindingElement; /** @@ -13733,9 +13836,9 @@ var ts; /* @internal */ function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: return true; } return false; @@ -13756,8 +13859,8 @@ var ts; /* @internal */ function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return true; } return false; @@ -13766,10 +13869,10 @@ var ts; /* @internal */ function isObjectBindingOrAssignmentElement(node) { switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: // AssignmentProperty - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: // AssignmentProperty - case 298 /* SyntaxKind.SpreadAssignment */: // AssignmentRestProperty + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: // AssignmentProperty + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // AssignmentProperty + case 301 /* SyntaxKind.SpreadAssignment */: // AssignmentRestProperty return true; } return false; @@ -13781,8 +13884,8 @@ var ts; /* @internal */ function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return true; } return false; @@ -13791,26 +13894,26 @@ var ts; /* @internal */ function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) { var kind = node.kind; - return kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 161 /* SyntaxKind.QualifiedName */ - || kind === 200 /* SyntaxKind.ImportType */; + return kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 163 /* SyntaxKind.QualifiedName */ + || kind === 202 /* SyntaxKind.ImportType */; } ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode; // Expression function isPropertyAccessOrQualifiedName(node) { var kind = node.kind; - return kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 161 /* SyntaxKind.QualifiedName */; + return kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 163 /* SyntaxKind.QualifiedName */; } ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName; function isCallLikeExpression(node) { switch (node.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 165 /* SyntaxKind.Decorator */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 167 /* SyntaxKind.Decorator */: return true; default: return false; @@ -13818,12 +13921,12 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function isCallOrNewExpression(node) { - return node.kind === 208 /* SyntaxKind.CallExpression */ || node.kind === 209 /* SyntaxKind.NewExpression */; + return node.kind === 210 /* SyntaxKind.CallExpression */ || node.kind === 211 /* SyntaxKind.NewExpression */; } ts.isCallOrNewExpression = isCallOrNewExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 223 /* SyntaxKind.TemplateExpression */ + return kind === 225 /* SyntaxKind.TemplateExpression */ || kind === 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */; } ts.isTemplateLiteral = isTemplateLiteral; @@ -13834,19 +13937,19 @@ var ts; ts.isLeftHandSideExpression = isLeftHandSideExpression; function isLeftHandSideExpressionKind(kind) { switch (kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: // technically this is only an Expression if it's in a `#field in expr` BinaryExpression case 13 /* SyntaxKind.RegularExpressionLiteral */: @@ -13854,15 +13957,15 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 108 /* SyntaxKind.ThisKeyword */: case 110 /* SyntaxKind.TrueKeyword */: case 106 /* SyntaxKind.SuperKeyword */: - case 230 /* SyntaxKind.NonNullExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 231 /* SyntaxKind.MetaProperty */: + case 232 /* SyntaxKind.NonNullExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 233 /* SyntaxKind.MetaProperty */: case 100 /* SyntaxKind.ImportKeyword */: // technically this is only an Expression if it's in a CallExpression return true; default: @@ -13876,13 +13979,13 @@ var ts; ts.isUnaryExpression = isUnaryExpression; function isUnaryExpressionKind(kind) { switch (kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return true; default: return isLeftHandSideExpressionKind(kind); @@ -13891,9 +13994,9 @@ var ts; /* @internal */ function isUnaryExpressionWithWrite(expr) { switch (expr.kind) { - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return true; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 45 /* SyntaxKind.PlusPlusToken */ || expr.operator === 46 /* SyntaxKind.MinusMinusToken */; default: @@ -13912,15 +14015,16 @@ var ts; ts.isExpression = isExpression; function isExpressionKind(kind) { switch (kind) { - case 222 /* SyntaxKind.ConditionalExpression */: - case 224 /* SyntaxKind.YieldExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 221 /* SyntaxKind.BinaryExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 229 /* SyntaxKind.AsExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 351 /* SyntaxKind.CommaListExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 226 /* SyntaxKind.YieldExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 223 /* SyntaxKind.BinaryExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 231 /* SyntaxKind.AsExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 354 /* SyntaxKind.CommaListExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return true; default: return isUnaryExpressionKind(kind); @@ -13928,8 +14032,8 @@ var ts; } function isAssertionExpression(node) { var kind = node.kind; - return kind === 211 /* SyntaxKind.TypeAssertionExpression */ - || kind === 229 /* SyntaxKind.AsExpression */; + return kind === 213 /* SyntaxKind.TypeAssertionExpression */ + || kind === 231 /* SyntaxKind.AsExpression */; } ts.isAssertionExpression = isAssertionExpression; /* @internal */ @@ -13940,13 +14044,13 @@ var ts; ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return true; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -13975,7 +14079,7 @@ var ts; ts.isExternalModuleIndicator = isExternalModuleIndicator; /* @internal */ function isForInOrOfStatement(node) { - return node.kind === 243 /* SyntaxKind.ForInStatement */ || node.kind === 244 /* SyntaxKind.ForOfStatement */; + return node.kind === 246 /* SyntaxKind.ForInStatement */ || node.kind === 247 /* SyntaxKind.ForOfStatement */; } ts.isForInOrOfStatement = isForInOrOfStatement; // Element @@ -13999,115 +14103,115 @@ var ts; /* @internal */ function isModuleBody(node) { var kind = node.kind; - return kind === 262 /* SyntaxKind.ModuleBlock */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ + return kind === 265 /* SyntaxKind.ModuleBlock */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isModuleBody = isModuleBody; /* @internal */ function isNamespaceBody(node) { var kind = node.kind; - return kind === 262 /* SyntaxKind.ModuleBlock */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */; + return kind === 265 /* SyntaxKind.ModuleBlock */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isNamespaceBody = isNamespaceBody; /* @internal */ function isJSDocNamespaceBody(node) { var kind = node.kind; return kind === 79 /* SyntaxKind.Identifier */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */; + || kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isJSDocNamespaceBody = isJSDocNamespaceBody; /* @internal */ function isNamedImportBindings(node) { var kind = node.kind; - return kind === 269 /* SyntaxKind.NamedImports */ - || kind === 268 /* SyntaxKind.NamespaceImport */; + return kind === 272 /* SyntaxKind.NamedImports */ + || kind === 271 /* SyntaxKind.NamespaceImport */; } ts.isNamedImportBindings = isNamedImportBindings; /* @internal */ function isModuleOrEnumDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */ || node.kind === 260 /* SyntaxKind.EnumDeclaration */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */ || node.kind === 263 /* SyntaxKind.EnumDeclaration */; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 203 /* SyntaxKind.BindingElement */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 299 /* SyntaxKind.EnumMember */ - || kind === 275 /* SyntaxKind.ExportSpecifier */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 267 /* SyntaxKind.ImportClause */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 270 /* SyntaxKind.ImportSpecifier */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 285 /* SyntaxKind.JsxAttribute */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 268 /* SyntaxKind.NamespaceImport */ - || kind === 274 /* SyntaxKind.NamespaceExport */ - || kind === 164 /* SyntaxKind.Parameter */ - || kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 163 /* SyntaxKind.TypeParameter */ - || kind === 254 /* SyntaxKind.VariableDeclaration */ - || kind === 345 /* SyntaxKind.JSDocTypedefTag */ - || kind === 338 /* SyntaxKind.JSDocCallbackTag */ - || kind === 347 /* SyntaxKind.JSDocPropertyTag */; + return kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 205 /* SyntaxKind.BindingElement */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 302 /* SyntaxKind.EnumMember */ + || kind === 278 /* SyntaxKind.ExportSpecifier */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 270 /* SyntaxKind.ImportClause */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 273 /* SyntaxKind.ImportSpecifier */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 288 /* SyntaxKind.JsxAttribute */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 271 /* SyntaxKind.NamespaceImport */ + || kind === 277 /* SyntaxKind.NamespaceExport */ + || kind === 166 /* SyntaxKind.Parameter */ + || kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 165 /* SyntaxKind.TypeParameter */ + || kind === 257 /* SyntaxKind.VariableDeclaration */ + || kind === 348 /* SyntaxKind.JSDocTypedefTag */ + || kind === 341 /* SyntaxKind.JSDocCallbackTag */ + || kind === 350 /* SyntaxKind.JSDocPropertyTag */; } function isDeclarationStatementKind(kind) { - return kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 246 /* SyntaxKind.BreakStatement */ - || kind === 245 /* SyntaxKind.ContinueStatement */ - || kind === 253 /* SyntaxKind.DebuggerStatement */ - || kind === 240 /* SyntaxKind.DoStatement */ - || kind === 238 /* SyntaxKind.ExpressionStatement */ - || kind === 236 /* SyntaxKind.EmptyStatement */ - || kind === 243 /* SyntaxKind.ForInStatement */ - || kind === 244 /* SyntaxKind.ForOfStatement */ - || kind === 242 /* SyntaxKind.ForStatement */ - || kind === 239 /* SyntaxKind.IfStatement */ - || kind === 250 /* SyntaxKind.LabeledStatement */ - || kind === 247 /* SyntaxKind.ReturnStatement */ - || kind === 249 /* SyntaxKind.SwitchStatement */ - || kind === 251 /* SyntaxKind.ThrowStatement */ - || kind === 252 /* SyntaxKind.TryStatement */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 241 /* SyntaxKind.WhileStatement */ - || kind === 248 /* SyntaxKind.WithStatement */ - || kind === 349 /* SyntaxKind.NotEmittedStatement */ - || kind === 353 /* SyntaxKind.EndOfDeclarationMarker */ - || kind === 352 /* SyntaxKind.MergeDeclarationMarker */; + return kind === 249 /* SyntaxKind.BreakStatement */ + || kind === 248 /* SyntaxKind.ContinueStatement */ + || kind === 256 /* SyntaxKind.DebuggerStatement */ + || kind === 243 /* SyntaxKind.DoStatement */ + || kind === 241 /* SyntaxKind.ExpressionStatement */ + || kind === 239 /* SyntaxKind.EmptyStatement */ + || kind === 246 /* SyntaxKind.ForInStatement */ + || kind === 247 /* SyntaxKind.ForOfStatement */ + || kind === 245 /* SyntaxKind.ForStatement */ + || kind === 242 /* SyntaxKind.IfStatement */ + || kind === 253 /* SyntaxKind.LabeledStatement */ + || kind === 250 /* SyntaxKind.ReturnStatement */ + || kind === 252 /* SyntaxKind.SwitchStatement */ + || kind === 254 /* SyntaxKind.ThrowStatement */ + || kind === 255 /* SyntaxKind.TryStatement */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 244 /* SyntaxKind.WhileStatement */ + || kind === 251 /* SyntaxKind.WithStatement */ + || kind === 352 /* SyntaxKind.NotEmittedStatement */ + || kind === 356 /* SyntaxKind.EndOfDeclarationMarker */ + || kind === 355 /* SyntaxKind.MergeDeclarationMarker */; } /* @internal */ function isDeclaration(node) { - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { - return (node.parent && node.parent.kind !== 344 /* SyntaxKind.JSDocTemplateTag */) || ts.isInJSFile(node); + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { + return (node.parent && node.parent.kind !== 347 /* SyntaxKind.JSDocTemplateTag */) || ts.isInJSFile(node); } return isDeclarationKind(node.kind); } @@ -14134,10 +14238,10 @@ var ts; } ts.isStatement = isStatement; function isBlockStatement(node) { - if (node.kind !== 235 /* SyntaxKind.Block */) + if (node.kind !== 238 /* SyntaxKind.Block */) return false; if (node.parent !== undefined) { - if (node.parent.kind === 252 /* SyntaxKind.TryStatement */ || node.parent.kind === 292 /* SyntaxKind.CatchClause */) { + if (node.parent.kind === 255 /* SyntaxKind.TryStatement */ || node.parent.kind === 295 /* SyntaxKind.CatchClause */) { return false; } } @@ -14151,15 +14255,15 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 235 /* SyntaxKind.Block */; + || kind === 238 /* SyntaxKind.Block */; } ts.isStatementOrBlock = isStatementOrBlock; // Module references /* @internal */ function isModuleReference(node) { var kind = node.kind; - return kind === 277 /* SyntaxKind.ExternalModuleReference */ - || kind === 161 /* SyntaxKind.QualifiedName */ + return kind === 280 /* SyntaxKind.ExternalModuleReference */ + || kind === 163 /* SyntaxKind.QualifiedName */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isModuleReference = isModuleReference; @@ -14169,58 +14273,58 @@ var ts; var kind = node.kind; return kind === 108 /* SyntaxKind.ThisKeyword */ || kind === 79 /* SyntaxKind.Identifier */ - || kind === 206 /* SyntaxKind.PropertyAccessExpression */; + || kind === 208 /* SyntaxKind.PropertyAccessExpression */; } ts.isJsxTagNameExpression = isJsxTagNameExpression; /* @internal */ function isJsxChild(node) { var kind = node.kind; - return kind === 278 /* SyntaxKind.JsxElement */ - || kind === 288 /* SyntaxKind.JsxExpression */ - || kind === 279 /* SyntaxKind.JsxSelfClosingElement */ + return kind === 281 /* SyntaxKind.JsxElement */ + || kind === 291 /* SyntaxKind.JsxExpression */ + || kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || kind === 11 /* SyntaxKind.JsxText */ - || kind === 282 /* SyntaxKind.JsxFragment */; + || kind === 285 /* SyntaxKind.JsxFragment */; } ts.isJsxChild = isJsxChild; /* @internal */ function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 285 /* SyntaxKind.JsxAttribute */ - || kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return kind === 288 /* SyntaxKind.JsxAttribute */ + || kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } ts.isJsxAttributeLike = isJsxAttributeLike; /* @internal */ function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 10 /* SyntaxKind.StringLiteral */ - || kind === 288 /* SyntaxKind.JsxExpression */; + || kind === 291 /* SyntaxKind.JsxExpression */; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isJsxOpeningLikeElement(node) { var kind = node.kind; - return kind === 280 /* SyntaxKind.JsxOpeningElement */ - || kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return kind === 283 /* SyntaxKind.JsxOpeningElement */ + || kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; // Clauses function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 289 /* SyntaxKind.CaseClause */ - || kind === 290 /* SyntaxKind.DefaultClause */; + return kind === 292 /* SyntaxKind.CaseClause */ + || kind === 293 /* SyntaxKind.DefaultClause */; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; // JSDoc /** True if node is of some JSDoc syntax kind. */ /* @internal */ function isJSDocNode(node) { - return node.kind >= 309 /* SyntaxKind.FirstJSDocNode */ && node.kind <= 347 /* SyntaxKind.LastJSDocNode */; + return node.kind >= 312 /* SyntaxKind.FirstJSDocNode */ && node.kind <= 350 /* SyntaxKind.LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; /** True if node is of a kind that may contain comment text. */ function isJSDocCommentContainingNode(node) { - return node.kind === 320 /* SyntaxKind.JSDoc */ - || node.kind === 319 /* SyntaxKind.JSDocNamepathType */ - || node.kind === 321 /* SyntaxKind.JSDocText */ + return node.kind === 323 /* SyntaxKind.JSDoc */ + || node.kind === 322 /* SyntaxKind.JSDocNamepathType */ + || node.kind === 324 /* SyntaxKind.JSDocText */ || isJSDocLinkLike(node) || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) @@ -14230,15 +14334,15 @@ var ts; // TODO: determine what this does before making it public. /* @internal */ function isJSDocTag(node) { - return node.kind >= 327 /* SyntaxKind.FirstJSDocTagNode */ && node.kind <= 347 /* SyntaxKind.LastJSDocTagNode */; + return node.kind >= 330 /* SyntaxKind.FirstJSDocTagNode */ && node.kind <= 350 /* SyntaxKind.LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function isSetAccessor(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */; } ts.isSetAccessor = isSetAccessor; function isGetAccessor(node) { - return node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetAccessor = isGetAccessor; /** True if has jsdoc nodes attached to it. */ @@ -14264,12 +14368,12 @@ var ts; /** True if has initializer node attached to it. */ function hasOnlyExpressionInitializer(node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 299 /* SyntaxKind.EnumMember */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 302 /* SyntaxKind.EnumMember */: return true; default: return false; @@ -14277,12 +14381,12 @@ var ts; } ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer; function isObjectLiteralElement(node) { - return node.kind === 285 /* SyntaxKind.JsxAttribute */ || node.kind === 287 /* SyntaxKind.JsxSpreadAttribute */ || isObjectLiteralElementLike(node); + return node.kind === 288 /* SyntaxKind.JsxAttribute */ || node.kind === 290 /* SyntaxKind.JsxSpreadAttribute */ || isObjectLiteralElementLike(node); } ts.isObjectLiteralElement = isObjectLiteralElement; /* @internal */ function isTypeReferenceType(node) { - return node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } ts.isTypeReferenceType = isTypeReferenceType; var MAX_SMI_X86 = 1073741823; @@ -14315,7 +14419,7 @@ var ts; } ts.isStringLiteralLike = isStringLiteralLike; function isJSDocLinkLike(node) { - return node.kind === 324 /* SyntaxKind.JSDocLink */ || node.kind === 325 /* SyntaxKind.JSDocLinkCode */ || node.kind === 326 /* SyntaxKind.JSDocLinkPlain */; + return node.kind === 327 /* SyntaxKind.JSDocLink */ || node.kind === 328 /* SyntaxKind.JSDocLinkCode */ || node.kind === 329 /* SyntaxKind.JSDocLinkPlain */; } ts.isJSDocLinkLike = isJSDocLinkLike; function hasRestParameter(s) { @@ -14325,7 +14429,7 @@ var ts; ts.hasRestParameter = hasRestParameter; function isRestParameter(node) { var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type; - return node.dotDotDotToken !== undefined || !!type && type.kind === 318 /* SyntaxKind.JSDocVariadicType */; + return node.dotDotDotToken !== undefined || !!type && type.kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isRestParameter = isRestParameter; // #endregion @@ -14583,7 +14687,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 305 /* SyntaxKind.SourceFile */) { + while (node && node.kind !== 308 /* SyntaxKind.SourceFile */) { node = node.parent; } return node; @@ -14599,11 +14703,11 @@ var ts; ts.isPlainJsFile = isPlainJsFile; function isStatementWithLocals(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return true; } return false; @@ -14799,7 +14903,7 @@ var ts; // the syntax list itself considers them as normal trivia. Therefore if we simply skip // trivia for the list, we may have skipped the JSDocComment as well. So we should process its // first child to determine the actual position of its first token. - if (node.kind === 348 /* SyntaxKind.SyntaxList */ && node._children.length > 0) { + if (node.kind === 351 /* SyntaxKind.SyntaxList */ && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, @@ -14864,7 +14968,6 @@ var ts; return emitNode && emitNode.flags || 0; } ts.getEmitFlags = getEmitFlags; - ; function getScriptTargetFeatures() { return { es2015: { @@ -15037,7 +15140,7 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { @@ -15069,11 +15172,11 @@ var ts; ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { // The only kind of module that can be missing a body is a shorthand ambient module. - return !!node && node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && (!node.body); + return !!node && node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ || - node.kind === 261 /* SyntaxKind.ModuleDeclaration */ || + return node.kind === 308 /* SyntaxKind.SourceFile */ || + node.kind === 264 /* SyntaxKind.ModuleDeclaration */ || ts.isFunctionLikeOrClassStaticBlockDeclaration(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -15090,9 +15193,9 @@ var ts; // - defined in the top level scope and source file is an external module // - defined inside ambient module declaration located in the top level scope and source file not an external module switch (node.parent.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return ts.isExternalModule(node.parent); - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -15147,26 +15250,30 @@ var ts; return false; } ts.isEffectiveStrictModeSourceFile = isEffectiveStrictModeSourceFile; + function isAmbientPropertyDeclaration(node) { + return !!(node.flags & 16777216 /* NodeFlags.Ambient */) || hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */); + } + ts.isAmbientPropertyDeclaration = isAmbientPropertyDeclaration; function isBlockScope(node, parentNode) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 263 /* SyntaxKind.CaseBlock */: - case 292 /* SyntaxKind.CatchClause */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 266 /* SyntaxKind.CaseBlock */: + case 295 /* SyntaxKind.CatchClause */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block return !ts.isFunctionLikeOrClassStaticBlockDeclaration(parentNode); @@ -15176,9 +15283,9 @@ var ts; ts.isBlockScope = isBlockScope; function isDeclarationWithTypeParameters(node) { switch (node.kind) { - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 323 /* SyntaxKind.JSDocSignature */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 326 /* SyntaxKind.JSDocSignature */: return true; default: ts.assertType(node); @@ -15188,25 +15295,25 @@ var ts; ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters; function isDeclarationWithTypeParameterChildren(node) { switch (node.kind) { - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: ts.assertType(node); @@ -15216,8 +15323,8 @@ var ts; ts.isDeclarationWithTypeParameterChildren = isDeclarationWithTypeParameterChildren; function isAnyImportSyntax(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return true; default: return false; @@ -15230,15 +15337,15 @@ var ts; ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire; function isLateVisibilityPaintedStatement(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return true; default: return false; @@ -15279,19 +15386,19 @@ var ts; } ts.getNameFromIndexInfo = getNameFromIndexInfo; function isComputedNonLiteralName(name) { - return name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression); + return name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression); } ts.isComputedNonLiteralName = isComputedNonLiteralName; function tryGetTextOfPropertyName(name) { switch (name.kind) { case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: - return name.escapedText; + return name.autoGenerateFlags ? undefined : name.escapedText; case 10 /* SyntaxKind.StringLiteral */: case 8 /* SyntaxKind.NumericLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return ts.escapeLeadingUnderscores(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: if (isStringOrNumericLiteralLike(name.expression)) return ts.escapeLeadingUnderscores(name.expression.text); return undefined; @@ -15311,16 +15418,16 @@ var ts; case 80 /* SyntaxKind.PrivateIdentifier */: case 79 /* SyntaxKind.Identifier */: return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (ts.isIdentifier(name.name) || ts.isPrivateIdentifier(name.name)) { return entityNameToString(name.expression) + "." + entityNameToString(name.name); } else { return ts.Debug.assertNever(name.name); } - case 311 /* SyntaxKind.JSDocMemberName */: + case 314 /* SyntaxKind.JSDocMemberName */: return entityNameToString(name.left) + entityNameToString(name.right); default: return ts.Debug.assertNever(name); @@ -15410,7 +15517,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 235 /* SyntaxKind.Block */) { + if (node.body && node.body.kind === 238 /* SyntaxKind.Block */) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -15424,7 +15531,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file @@ -15433,29 +15540,29 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 268 /* SyntaxKind.NamespaceImport */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 271 /* SyntaxKind.NamespaceImport */: errorNode = node.name; break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return getErrorSpanForArrowFunction(sourceFile, node); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: var start = ts.skipTrivia(sourceFile.text, node.pos); var end = node.statements.length > 0 ? node.statements[0].pos : node.end; return ts.createTextSpanFromBounds(start, end); @@ -15507,11 +15614,11 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 208 /* SyntaxKind.CallExpression */ && n.expression.kind === 106 /* SyntaxKind.SuperKeyword */; + return n.kind === 210 /* SyntaxKind.CallExpression */ && n.expression.kind === 106 /* SyntaxKind.SuperKeyword */; } ts.isSuperCall = isSuperCall; function isImportCall(n) { - return n.kind === 208 /* SyntaxKind.CallExpression */ && n.expression.kind === 100 /* SyntaxKind.ImportKeyword */; + return n.kind === 210 /* SyntaxKind.CallExpression */ && n.expression.kind === 100 /* SyntaxKind.ImportKeyword */; } ts.isImportCall = isImportCall; function isImportMeta(n) { @@ -15525,7 +15632,7 @@ var ts; } ts.isLiteralImportTypeNode = isLiteralImportTypeNode; function isPrologueDirective(node) { - return node.kind === 238 /* SyntaxKind.ExpressionStatement */ + return node.kind === 241 /* SyntaxKind.ExpressionStatement */ && node.expression.kind === 10 /* SyntaxKind.StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; @@ -15553,13 +15660,13 @@ var ts; } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; function getJSDocCommentRanges(node, text) { - var commentRanges = (node.kind === 164 /* SyntaxKind.Parameter */ || - node.kind === 163 /* SyntaxKind.TypeParameter */ || - node.kind === 213 /* SyntaxKind.FunctionExpression */ || - node.kind === 214 /* SyntaxKind.ArrowFunction */ || - node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ || - node.kind === 254 /* SyntaxKind.VariableDeclaration */ || - node.kind === 275 /* SyntaxKind.ExportSpecifier */) ? + var commentRanges = (node.kind === 166 /* SyntaxKind.Parameter */ || + node.kind === 165 /* SyntaxKind.TypeParameter */ || + node.kind === 215 /* SyntaxKind.FunctionExpression */ || + node.kind === 216 /* SyntaxKind.ArrowFunction */ || + node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || + node.kind === 257 /* SyntaxKind.VariableDeclaration */ || + node.kind === 278 /* SyntaxKind.ExportSpecifier */) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : ts.getLeadingCommentRanges(text, node.pos); // True if the comment starts with '/**' but not if it is '/**/' @@ -15575,48 +15682,48 @@ var ts; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; var defaultLibReferenceRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (177 /* SyntaxKind.FirstTypeNode */ <= node.kind && node.kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (179 /* SyntaxKind.FirstTypeNode */ <= node.kind && node.kind <= 202 /* SyntaxKind.LastTypeNode */) { return true; } switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return true; case 114 /* SyntaxKind.VoidKeyword */: - return node.parent.kind !== 217 /* SyntaxKind.VoidExpression */; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + return node.parent.kind !== 219 /* SyntaxKind.VoidExpression */; + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node); - case 163 /* SyntaxKind.TypeParameter */: - return node.parent.kind === 195 /* SyntaxKind.MappedType */ || node.parent.kind === 190 /* SyntaxKind.InferType */; + case 165 /* SyntaxKind.TypeParameter */: + return node.parent.kind === 197 /* SyntaxKind.MappedType */ || node.parent.kind === 192 /* SyntaxKind.InferType */; // Identifiers and qualified names may be type nodes, depending on their context. Climb // above them to find the lowest container case 79 /* SyntaxKind.Identifier */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 161 /* SyntaxKind.QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 163 /* SyntaxKind.QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } // At this point, node is either a qualified name or an identifier - ts.Debug.assert(node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 161 /* SyntaxKind.QualifiedName */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + ts.Debug.assert(node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 163 /* SyntaxKind.QualifiedName */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); // falls through - case 161 /* SyntaxKind.QualifiedName */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: case 108 /* SyntaxKind.ThisKeyword */: { var parent = node.parent; - if (parent.kind === 181 /* SyntaxKind.TypeQuery */) { + if (parent.kind === 183 /* SyntaxKind.TypeQuery */) { return false; } - if (parent.kind === 200 /* SyntaxKind.ImportType */) { + if (parent.kind === 202 /* SyntaxKind.ImportType */) { return !parent.isTypeOf; } // Do not recursively call isPartOfTypeNode on the parent. In the example: @@ -15625,40 +15732,40 @@ var ts; // // Calling isPartOfTypeNode would consider the qualified name A.B a type node. // Only C and A.B.C are type nodes. - if (177 /* SyntaxKind.FirstTypeNode */ <= parent.kind && parent.kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (179 /* SyntaxKind.FirstTypeNode */ <= parent.kind && parent.kind <= 202 /* SyntaxKind.LastTypeNode */) { return true; } switch (parent.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isHeritageClause(parent.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(parent); - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return node === parent.constraint; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return node === parent.constraint; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 164 /* SyntaxKind.Parameter */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: return node === parent.type; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return node === parent.type; - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return node === parent.type; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return node === parent.type; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return ts.contains(parent.typeArguments, node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -15683,23 +15790,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitor(node); - case 263 /* SyntaxKind.CaseBlock */: - case 235 /* SyntaxKind.Block */: - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 250 /* SyntaxKind.LabeledStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 266 /* SyntaxKind.CaseBlock */: + case 238 /* SyntaxKind.Block */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 253 /* SyntaxKind.LabeledStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 295 /* SyntaxKind.CatchClause */: return ts.forEachChild(node, traverse); } } @@ -15709,23 +15816,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } return; - case 260 /* SyntaxKind.EnumDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // These are not allowed inside a generator now, but eventually they may be allowed // as local types. Regardless, skip them to avoid the work. return; default: if (ts.isFunctionLike(node)) { - if (node.name && node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name && node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // Note that we will not include methods/accessors of a class because they would require // first descending into the class. This is by design. traverse(node.name.expression); @@ -15748,10 +15855,10 @@ var ts; * @param node The type node. */ function getRestParameterElementType(node) { - if (node && node.kind === 183 /* SyntaxKind.ArrayType */) { + if (node && node.kind === 185 /* SyntaxKind.ArrayType */) { return node.elementType; } - else if (node && node.kind === 178 /* SyntaxKind.TypeReference */) { + else if (node && node.kind === 180 /* SyntaxKind.TypeReference */) { return ts.singleOrUndefined(node.typeArguments); } else { @@ -15761,12 +15868,12 @@ var ts; ts.getRestParameterElementType = getRestParameterElementType; function getMembersOfDeclaration(node) { switch (node.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 182 /* SyntaxKind.TypeLiteral */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 184 /* SyntaxKind.TypeLiteral */: return node.members; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return node.properties; } } @@ -15774,14 +15881,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 299 /* SyntaxKind.EnumMember */: - case 164 /* SyntaxKind.Parameter */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 302 /* SyntaxKind.EnumMember */: + case 166 /* SyntaxKind.Parameter */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; } } @@ -15793,8 +15900,8 @@ var ts; } ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor; function isVariableDeclarationInVariableStatement(node) { - return node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */ - && node.parent.parent.kind === 237 /* SyntaxKind.VariableStatement */; + return node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */ + && node.parent.parent.kind === 240 /* SyntaxKind.VariableStatement */; } ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement; function isCommonJsExportedExpression(node) { @@ -15818,13 +15925,13 @@ var ts; ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return true; } return false; @@ -15835,7 +15942,7 @@ var ts; if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 250 /* SyntaxKind.LabeledStatement */) { + if (node.statement.kind !== 253 /* SyntaxKind.LabeledStatement */) { return node.statement; } node = node.statement; @@ -15843,17 +15950,17 @@ var ts; } ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel; function isFunctionBlock(node) { - return node && node.kind === 235 /* SyntaxKind.Block */ && ts.isFunctionLike(node.parent); + return node && node.kind === 238 /* SyntaxKind.Block */ && ts.isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 169 /* SyntaxKind.MethodDeclaration */ && node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return node && node.kind === 171 /* SyntaxKind.MethodDeclaration */ && node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethodOrAccessor(node) { - return (node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */) && - (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || - node.parent.kind === 226 /* SyntaxKind.ClassExpression */); + return (node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */) && + (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || + node.parent.kind === 228 /* SyntaxKind.ClassExpression */); } ts.isObjectLiteralOrClassExpressionMethodOrAccessor = isObjectLiteralOrClassExpressionMethodOrAccessor; function isIdentifierTypePredicate(predicate) { @@ -15866,7 +15973,7 @@ var ts; ts.isThisTypePredicate = isThisTypePredicate; function getPropertyAssignment(objectLiteral, key, key2) { return objectLiteral.properties.filter(function (property) { - if (property.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (property.kind === 299 /* SyntaxKind.PropertyAssignment */) { var propName = tryGetTextOfPropertyName(property.name); return key === propName || (!!key2 && key2 === propName); } @@ -15928,14 +16035,14 @@ var ts; } ts.getContainingFunctionOrClassStaticBlock = getContainingFunctionOrClassStaticBlock; function getThisContainer(node, includeArrowFunctions) { - ts.Debug.assert(node.kind !== 305 /* SyntaxKind.SourceFile */); + ts.Debug.assert(node.kind !== 308 /* SyntaxKind.SourceFile */); while (true) { node = node.parent; if (!node) { return ts.Debug.fail(); // If we never pass in a SourceFile, this should be unreachable, since we'll stop when we reach that. } switch (node.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'this' container. // A computed property name in a class needs to be a this container @@ -15950,9 +16057,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 164 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { + if (node.parent.kind === 166 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -15963,27 +16070,27 @@ var ts; node = node.parent; } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: if (!includeArrowFunctions) { continue; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 305 /* SyntaxKind.SourceFile */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 308 /* SyntaxKind.SourceFile */: return node; } } @@ -15996,17 +16103,17 @@ var ts; switch (node.kind) { // Arrow functions use the same scope, but may do so in a "delayed" manner // For example, `const getThis = () => this` may be before a super() call in a derived constructor - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: switch (node.parent.kind) { - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Object properties can have computed names; only method-like bodies start a new scope return true; default: @@ -16030,9 +16137,9 @@ var ts; var container = getThisContainer(node, /*includeArrowFunctions*/ false); if (container) { switch (container.kind) { - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return container; } } @@ -16054,28 +16161,28 @@ var ts; return node; } switch (node.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: node = node.parent; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (!stopOnFunctions) { continue; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return node; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 164 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { + if (node.parent.kind === 166 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -16091,14 +16198,14 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 213 /* SyntaxKind.FunctionExpression */ || func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 215 /* SyntaxKind.FunctionExpression */ || func.kind === 216 /* SyntaxKind.ArrowFunction */) { var prev = func; var parent = func.parent; - while (parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { prev = parent; parent = parent.parent; } - if (parent.kind === 208 /* SyntaxKind.CallExpression */ && parent.expression === prev) { + if (parent.kind === 210 /* SyntaxKind.CallExpression */ && parent.expression === prev) { return parent; } } @@ -16114,7 +16221,7 @@ var ts; */ function isSuperProperty(node) { var kind = node.kind; - return (kind === 206 /* SyntaxKind.PropertyAccessExpression */ || kind === 207 /* SyntaxKind.ElementAccessExpression */) + return (kind === 208 /* SyntaxKind.PropertyAccessExpression */ || kind === 209 /* SyntaxKind.ElementAccessExpression */) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */; } ts.isSuperProperty = isSuperProperty; @@ -16123,7 +16230,7 @@ var ts; */ function isThisProperty(node) { var kind = node.kind; - return (kind === 206 /* SyntaxKind.PropertyAccessExpression */ || kind === 207 /* SyntaxKind.ElementAccessExpression */) + return (kind === 208 /* SyntaxKind.PropertyAccessExpression */ || kind === 209 /* SyntaxKind.ElementAccessExpression */) && node.expression.kind === 108 /* SyntaxKind.ThisKeyword */; } ts.isThisProperty = isThisProperty; @@ -16142,15 +16249,15 @@ var ts; ts.isThisInitializedObjectBindingExpression = isThisInitializedObjectBindingExpression; function getEntityNameFromTypeNode(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return isEntityNameExpression(node.expression) ? node.expression : undefined; // TODO(rbuckton): These aren't valid TypeNodes, but we treat them as such because of `isPartOfTypeNode`, which returns `true` for things that aren't `TypeNode`s. case 79 /* SyntaxKind.Identifier */: - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return node; } return undefined; @@ -16158,10 +16265,10 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { switch (node.kind) { - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return node.tag; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return node.tagName; default: return node.expression; @@ -16174,25 +16281,25 @@ var ts; return false; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // classes are valid targets return true; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return parent.kind === 257 /* SyntaxKind.ClassDeclaration */; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + return parent.kind === 260 /* SyntaxKind.ClassDeclaration */; + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. return node.body !== undefined - && parent.kind === 257 /* SyntaxKind.ClassDeclaration */; - case 164 /* SyntaxKind.Parameter */: + && parent.kind === 260 /* SyntaxKind.ClassDeclaration */; + case 166 /* SyntaxKind.Parameter */: // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; return parent.body !== undefined - && (parent.kind === 171 /* SyntaxKind.Constructor */ - || parent.kind === 169 /* SyntaxKind.MethodDeclaration */ - || parent.kind === 173 /* SyntaxKind.SetAccessor */) - && grandparent.kind === 257 /* SyntaxKind.ClassDeclaration */; + && (parent.kind === 173 /* SyntaxKind.Constructor */ + || parent.kind === 171 /* SyntaxKind.MethodDeclaration */ + || parent.kind === 175 /* SyntaxKind.SetAccessor */) + && grandparent.kind === 260 /* SyntaxKind.ClassDeclaration */; } return false; } @@ -16208,11 +16315,11 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node, parent) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return ts.some(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); }); // TODO: GH#18217 - case 169 /* SyntaxKind.MethodDeclaration */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: return ts.some(node.parameters, function (p) { return nodeIsDecorated(p, node, parent); }); // TODO: GH#18217 default: return false; @@ -16228,9 +16335,9 @@ var ts; ts.classOrConstructorParameterIsDecorated = classOrConstructorParameterIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 280 /* SyntaxKind.JsxOpeningElement */ || - parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */ || - parent.kind === 281 /* SyntaxKind.JsxClosingElement */) { + if (parent.kind === 283 /* SyntaxKind.JsxOpeningElement */ || + parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || + parent.kind === 284 /* SyntaxKind.JsxClosingElement */) { return parent.tagName === node; } return false; @@ -16243,53 +16350,54 @@ var ts; case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 229 /* SyntaxKind.AsExpression */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 221 /* SyntaxKind.BinaryExpression */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 223 /* SyntaxKind.TemplateExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: - case 224 /* SyntaxKind.YieldExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 231 /* SyntaxKind.MetaProperty */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 225 /* SyntaxKind.TemplateExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: + case 226 /* SyntaxKind.YieldExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 233 /* SyntaxKind.MetaProperty */: return true; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return !ts.isHeritageClause(node.parent); - case 161 /* SyntaxKind.QualifiedName */: - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + case 163 /* SyntaxKind.QualifiedName */: + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); - case 311 /* SyntaxKind.JSDocMemberName */: + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); + case 314 /* SyntaxKind.JSDocMemberName */: while (ts.isJSDocMemberName(node.parent)) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); case 80 /* SyntaxKind.PrivateIdentifier */: return ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 101 /* SyntaxKind.InKeyword */; case 79 /* SyntaxKind.Identifier */: - if (node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) { + if (node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) { return true; } // falls through @@ -16307,60 +16415,62 @@ var ts; function isInExpressionContext(node) { var parent = node.parent; switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 299 /* SyntaxKind.EnumMember */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 205 /* SyntaxKind.BindingElement */: return parent.initializer === node; - case 238 /* SyntaxKind.ExpressionStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 247 /* SyntaxKind.ReturnStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 289 /* SyntaxKind.CaseClause */: - case 251 /* SyntaxKind.ThrowStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 292 /* SyntaxKind.CaseClause */: + case 254 /* SyntaxKind.ThrowStatement */: return parent.expression === node; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) || forInStatement.expression === node; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return node === parent.expression; - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return node === parent.expression; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return node === parent.expression; - case 165 /* SyntaxKind.Decorator */: - case 288 /* SyntaxKind.JsxExpression */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 167 /* SyntaxKind.Decorator */: + case 291 /* SyntaxKind.JsxExpression */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + case 301 /* SyntaxKind.SpreadAssignment */: return true; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return parent.expression === node && !isPartOfTypeNode(parent); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return parent.objectAssignmentInitializer === node; + case 235 /* SyntaxKind.SatisfiesExpression */: + return node === parent.expression; default: return isExpressionNode(parent); } } ts.isInExpressionContext = isInExpressionContext; function isPartOfTypeQuery(node) { - while (node.kind === 161 /* SyntaxKind.QualifiedName */ || node.kind === 79 /* SyntaxKind.Identifier */) { + while (node.kind === 163 /* SyntaxKind.QualifiedName */ || node.kind === 79 /* SyntaxKind.Identifier */) { node = node.parent; } - return node.kind === 181 /* SyntaxKind.TypeQuery */; + return node.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isPartOfTypeQuery = isPartOfTypeQuery; function isNamespaceReexportDeclaration(node) { @@ -16368,7 +16478,7 @@ var ts; } ts.isNamespaceReexportDeclaration = isNamespaceReexportDeclaration; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -16381,7 +16491,7 @@ var ts; } ts.getExternalModuleRequireArgument = getExternalModuleRequireArgument; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind !== 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJS(file) { @@ -16413,11 +16523,11 @@ var ts; ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && node.typeArguments && node.typeArguments.length === 2 && - (node.typeArguments[0].kind === 150 /* SyntaxKind.StringKeyword */ || node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */); + (node.typeArguments[0].kind === 152 /* SyntaxKind.StringKeyword */ || node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */); } ts.isJSDocIndexSignature = isJSDocIndexSignature; function isRequireCall(callExpression, requireStringLiteralLikeArgument) { - if (callExpression.kind !== 208 /* SyntaxKind.CallExpression */) { + if (callExpression.kind !== 210 /* SyntaxKind.CallExpression */) { return false; } var _a = callExpression, expression = _a.expression, args = _a.arguments; @@ -16526,11 +16636,11 @@ var ts; function getExpandoInitializer(initializer, isPrototypeAssignment) { if (ts.isCallExpression(initializer)) { var e = skipParentheses(initializer.expression); - return e.kind === 213 /* SyntaxKind.FunctionExpression */ || e.kind === 214 /* SyntaxKind.ArrowFunction */ ? initializer : undefined; + return e.kind === 215 /* SyntaxKind.FunctionExpression */ || e.kind === 216 /* SyntaxKind.ArrowFunction */ ? initializer : undefined; } - if (initializer.kind === 213 /* SyntaxKind.FunctionExpression */ || - initializer.kind === 226 /* SyntaxKind.ClassExpression */ || - initializer.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (initializer.kind === 215 /* SyntaxKind.FunctionExpression */ || + initializer.kind === 228 /* SyntaxKind.ClassExpression */ || + initializer.kind === 216 /* SyntaxKind.ArrowFunction */) { return initializer; } if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) { @@ -16776,7 +16886,7 @@ var ts; ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment; function isSpecialPropertyDeclaration(expr) { return isInJSFile(expr) && - expr.parent && expr.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && + expr.parent && expr.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && (!ts.isElementAccessExpression(expr) || isLiteralLikeElementAccess(expr)) && !!ts.getJSDocTypeTag(expr.parent); } @@ -16797,17 +16907,17 @@ var ts; return false; } var decl = symbol.valueDeclaration; - return decl.kind === 256 /* SyntaxKind.FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); + return decl.kind === 259 /* SyntaxKind.FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); } ts.isFunctionSymbol = isFunctionSymbol; function tryGetModuleSpecifierFromDeclaration(node) { var _a, _b; switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return (_a = ts.findAncestor(node.initializer, function (node) { return isRequireCall(node, /*requireStringLiteralLikeArgument*/ true); })) === null || _a === void 0 ? void 0 : _a.arguments[0]; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike); default: ts.Debug.assertNever(node); @@ -16820,14 +16930,14 @@ var ts; ts.importFromModuleSpecifier = importFromModuleSpecifier; function tryGetImportFromModuleSpecifier(node) { switch (node.parent.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.parent; - case 277 /* SyntaxKind.ExternalModuleReference */: + case 280 /* SyntaxKind.ExternalModuleReference */: return node.parent.parent; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return isImportCall(node.parent) || isRequireCall(node.parent, /*checkArg*/ false) ? node.parent : undefined; - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: ts.Debug.assert(ts.isStringLiteral(node)); return ts.tryCast(node.parent.parent, ts.isImportTypeNode); default: @@ -16837,16 +16947,16 @@ var ts; ts.tryGetImportFromModuleSpecifier = tryGetImportFromModuleSpecifier; function getExternalModuleName(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.moduleSpecifier; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */ ? node.moduleReference.expression : undefined; - case 200 /* SyntaxKind.ImportType */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + return node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */ ? node.moduleReference.expression : undefined; + case 202 /* SyntaxKind.ImportType */: return isLiteralImportTypeNode(node) ? node.argument.literal : undefined; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return node.arguments[0]; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return node.name.kind === 10 /* SyntaxKind.StringLiteral */ ? node.name : undefined; default: return ts.Debug.assertNever(node); @@ -16855,11 +16965,11 @@ var ts; ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.exportClause && ts.tryCast(node.exportClause, ts.isNamespaceExport); default: return ts.Debug.assertNever(node); @@ -16867,7 +16977,7 @@ var ts; } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 266 /* SyntaxKind.ImportDeclaration */ && !!node.importClause && !!node.importClause.name; + return node.kind === 269 /* SyntaxKind.ImportDeclaration */ && !!node.importClause && !!node.importClause.name; } ts.isDefaultImport = isDefaultImport; function forEachImportClauseDeclaration(node, action) { @@ -16888,13 +16998,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 164 /* SyntaxKind.Parameter */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return node.questionToken !== undefined; } } @@ -16908,7 +17018,7 @@ var ts; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function isJSDocTypeAlias(node) { - return node.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || node.kind === 338 /* SyntaxKind.JSDocCallbackTag */ || node.kind === 339 /* SyntaxKind.JSDocEnumTag */; + return node.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || node.kind === 341 /* SyntaxKind.JSDocCallbackTag */ || node.kind === 342 /* SyntaxKind.JSDocEnumTag */; } ts.isJSDocTypeAlias = isJSDocTypeAlias; function isTypeAlias(node) { @@ -16933,12 +17043,12 @@ var ts; } function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: var v = getSingleVariableOfVariableStatement(node); return v && v.initializer; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return node.initializer; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return node.initializer; } } @@ -16950,7 +17060,7 @@ var ts; function getNestedModuleDeclaration(node) { return ts.isModuleDeclaration(node) && node.body && - node.body.kind === 261 /* SyntaxKind.ModuleDeclaration */ + node.body.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? node.body : undefined; } @@ -16965,11 +17075,11 @@ var ts; if (ts.hasJSDocNodes(node)) { result = ts.addRange(result, filterOwnedJSDocTags(hostNode, ts.last(node.jsDoc))); } - if (node.kind === 164 /* SyntaxKind.Parameter */) { + if (node.kind === 166 /* SyntaxKind.Parameter */) { result = ts.addRange(result, (noCache ? ts.getJSDocParameterTagsNoCache : ts.getJSDocParameterTags)(node)); break; } - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { result = ts.addRange(result, (noCache ? ts.getJSDocTypeParameterTagsNoCache : ts.getJSDocTypeParameterTags)(node)); break; } @@ -16998,11 +17108,11 @@ var ts; } function getNextJSDocCommentLocation(node) { var parent = node.parent; - if (parent.kind === 296 /* SyntaxKind.PropertyAssignment */ || - parent.kind === 271 /* SyntaxKind.ExportAssignment */ || - parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - parent.kind === 247 /* SyntaxKind.ReturnStatement */ || + if (parent.kind === 299 /* SyntaxKind.PropertyAssignment */ || + parent.kind === 274 /* SyntaxKind.ExportAssignment */ || + parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + parent.kind === 250 /* SyntaxKind.ReturnStatement */ || getNestedModuleDeclaration(parent) || ts.isBinaryExpression(node) && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { return parent; @@ -17112,34 +17222,34 @@ var ts; var parent = node.parent; while (true) { switch (parent.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 63 /* SyntaxKind.EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* AssignmentKind.Definite */ : 2 /* AssignmentKind.Compound */ : 0 /* AssignmentKind.None */; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: var unaryOperator = parent.operator; return unaryOperator === 45 /* SyntaxKind.PlusPlusToken */ || unaryOperator === 46 /* SyntaxKind.MinusMinusToken */ ? 2 /* AssignmentKind.Compound */ : 0 /* AssignmentKind.None */; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return parent.initializer === node ? 1 /* AssignmentKind.Definite */ : 0 /* AssignmentKind.None */; - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 232 /* SyntaxKind.NonNullExpression */: node = parent; break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: node = parent.parent; break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: if (parent.name !== node) { return 0 /* AssignmentKind.None */; } node = parent.parent; break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (parent.name === node) { return 0 /* AssignmentKind.None */; } @@ -17166,22 +17276,22 @@ var ts; */ function isNodeWithPossibleHoistedDeclaration(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 237 /* SyntaxKind.VariableStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 263 /* SyntaxKind.CaseBlock */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 250 /* SyntaxKind.LabeledStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 238 /* SyntaxKind.Block */: + case 240 /* SyntaxKind.VariableStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 266 /* SyntaxKind.CaseBlock */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 253 /* SyntaxKind.LabeledStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 295 /* SyntaxKind.CatchClause */: return true; } return false; @@ -17198,11 +17308,11 @@ var ts; return node; } function walkUpParenthesizedTypes(node) { - return walkUp(node, 191 /* SyntaxKind.ParenthesizedType */); + return walkUp(node, 193 /* SyntaxKind.ParenthesizedType */); } ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes; function walkUpParenthesizedExpressions(node) { - return walkUp(node, 212 /* SyntaxKind.ParenthesizedExpression */); + return walkUp(node, 214 /* SyntaxKind.ParenthesizedExpression */); } ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions; /** @@ -17212,7 +17322,7 @@ var ts; */ function walkUpParenthesizedTypesAndGetParentAndChild(node) { var child; - while (node && node.kind === 191 /* SyntaxKind.ParenthesizedType */) { + while (node && node.kind === 193 /* SyntaxKind.ParenthesizedType */) { child = node; node = node.parent; } @@ -17234,11 +17344,11 @@ var ts; ts.skipParentheses = skipParentheses; // a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped function isDeleteTarget(node) { - if (node.kind !== 206 /* SyntaxKind.PropertyAccessExpression */ && node.kind !== 207 /* SyntaxKind.ElementAccessExpression */) { + if (node.kind !== 208 /* SyntaxKind.PropertyAccessExpression */ && node.kind !== 209 /* SyntaxKind.ElementAccessExpression */) { return false; } node = walkUpParenthesizedExpressions(node.parent); - return node && node.kind === 215 /* SyntaxKind.DeleteExpression */; + return node && node.kind === 217 /* SyntaxKind.DeleteExpression */; } ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { @@ -17291,7 +17401,7 @@ var ts; ts.getDeclarationFromName = getDeclarationFromName; function isLiteralComputedPropertyDeclarationName(node) { return isStringOrNumericLiteralLike(node) && - node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */ && + node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */ && ts.isDeclaration(node.parent.parent); } ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; @@ -17299,29 +17409,29 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 299 /* SyntaxKind.EnumMember */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 302 /* SyntaxKind.EnumMember */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: // Name on right hand side of dot in a type query or type reference return parent.right === node; - case 203 /* SyntaxKind.BindingElement */: - case 270 /* SyntaxKind.ImportSpecifier */: + case 205 /* SyntaxKind.BindingElement */: + case 273 /* SyntaxKind.ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 275 /* SyntaxKind.ExportSpecifier */: - case 285 /* SyntaxKind.JsxAttribute */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 288 /* SyntaxKind.JsxAttribute */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: // Any name in an export specifier or JSX Attribute or Jsx Element return true; } @@ -17344,14 +17454,14 @@ var ts; // const x = require("...").y // const { x } = require("...").y function isAliasSymbolDeclaration(node) { - if (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ || - node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ || - node.kind === 267 /* SyntaxKind.ImportClause */ && !!node.name || - node.kind === 268 /* SyntaxKind.NamespaceImport */ || - node.kind === 274 /* SyntaxKind.NamespaceExport */ || - node.kind === 270 /* SyntaxKind.ImportSpecifier */ || - node.kind === 275 /* SyntaxKind.ExportSpecifier */ || - node.kind === 271 /* SyntaxKind.ExportAssignment */ && exportAssignmentIsAlias(node)) { + if (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ || + node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ || + node.kind === 270 /* SyntaxKind.ImportClause */ && !!node.name || + node.kind === 271 /* SyntaxKind.NamespaceImport */ || + node.kind === 277 /* SyntaxKind.NamespaceExport */ || + node.kind === 273 /* SyntaxKind.ImportSpecifier */ || + node.kind === 278 /* SyntaxKind.ExportSpecifier */ || + node.kind === 274 /* SyntaxKind.ExportAssignment */ && exportAssignmentIsAlias(node)) { return true; } return isInJSFile(node) && (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */ && exportAssignmentIsAlias(node) || @@ -17364,18 +17474,18 @@ var ts; ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getAliasDeclarationFromName(node) { switch (node.parent.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 271 /* SyntaxKind.ExportAssignment */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 274 /* SyntaxKind.NamespaceExport */: + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 274 /* SyntaxKind.ExportAssignment */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 277 /* SyntaxKind.NamespaceExport */: return node.parent; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.parent; - } while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */); + } while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */); return getAliasDeclarationFromName(node); } } @@ -17394,7 +17504,7 @@ var ts; } ts.getExportAssignmentExpression = getExportAssignmentExpression; function getPropertyAssignmentAliasLikeExpression(node) { - return node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? node.name : node.kind === 296 /* SyntaxKind.PropertyAssignment */ ? node.initializer : + return node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? node.name : node.kind === 299 /* SyntaxKind.PropertyAssignment */ ? node.initializer : node.parent.right; } ts.getPropertyAssignmentAliasLikeExpression = getPropertyAssignmentAliasLikeExpression; @@ -17460,11 +17570,11 @@ var ts; } ts.getAncestor = getAncestor; function isKeyword(token) { - return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 160 /* SyntaxKind.LastKeyword */; + return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 162 /* SyntaxKind.LastKeyword */; } ts.isKeyword = isKeyword; function isContextualKeyword(token) { - return 126 /* SyntaxKind.FirstContextualKeyword */ <= token && token <= 160 /* SyntaxKind.LastContextualKeyword */; + return 126 /* SyntaxKind.FirstContextualKeyword */ <= token && token <= 162 /* SyntaxKind.LastContextualKeyword */; } ts.isContextualKeyword = isContextualKeyword; function isNonContextualKeyword(token) { @@ -17508,15 +17618,15 @@ var ts; } var flags = 0 /* FunctionFlags.Normal */; switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: if (node.asteriskToken) { flags |= 1 /* FunctionFlags.Generator */; } // falls through - case 214 /* SyntaxKind.ArrowFunction */: - if (hasSyntacticModifier(node, 256 /* ModifierFlags.Async */)) { + case 216 /* SyntaxKind.ArrowFunction */: + if (hasSyntacticModifier(node, 512 /* ModifierFlags.Async */)) { flags |= 2 /* FunctionFlags.Async */; } break; @@ -17529,13 +17639,13 @@ var ts; ts.getFunctionFlags = getFunctionFlags; function isAsyncFunction(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: return node.body !== undefined && node.asteriskToken === undefined - && hasSyntacticModifier(node, 256 /* ModifierFlags.Async */); + && hasSyntacticModifier(node, 512 /* ModifierFlags.Async */); } return false; } @@ -17562,7 +17672,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - if (!(name.kind === 162 /* SyntaxKind.ComputedPropertyName */ || name.kind === 207 /* SyntaxKind.ElementAccessExpression */)) { + if (!(name.kind === 164 /* SyntaxKind.ComputedPropertyName */ || name.kind === 209 /* SyntaxKind.ElementAccessExpression */)) { return false; } var expr = ts.isElementAccessExpression(name) ? skipParentheses(name.argumentExpression) : name.expression; @@ -17578,7 +17688,7 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 8 /* SyntaxKind.NumericLiteral */: return ts.escapeLeadingUnderscores(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: var nameExpression = name.expression; if (isStringOrNumericLiteralLike(nameExpression)) { return ts.escapeLeadingUnderscores(nameExpression.text); @@ -17644,11 +17754,11 @@ var ts; ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 164 /* SyntaxKind.Parameter */; + return root.kind === 166 /* SyntaxKind.Parameter */; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 203 /* SyntaxKind.BindingElement */) { + while (node.kind === 205 /* SyntaxKind.BindingElement */) { node = node.parent.parent; } return node; @@ -17656,15 +17766,15 @@ var ts; ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 305 /* SyntaxKind.SourceFile */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 308 /* SyntaxKind.SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(range) { @@ -17683,23 +17793,23 @@ var ts; })(Associativity = ts.Associativity || (ts.Associativity = {})); function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 209 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 211 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return hasArguments ? 0 /* Associativity.Left */ : 1 /* Associativity.Right */; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 224 /* SyntaxKind.YieldExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 226 /* SyntaxKind.YieldExpression */: return 1 /* Associativity.Right */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (operator) { case 42 /* SyntaxKind.AsteriskAsteriskToken */: case 63 /* SyntaxKind.EqualsToken */: @@ -17726,15 +17836,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 209 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 211 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (expression.kind === 223 /* SyntaxKind.BinaryExpression */) { return expression.operatorToken.kind; } - else if (expression.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || expression.kind === 220 /* SyntaxKind.PostfixUnaryExpression */) { + else if (expression.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || expression.kind === 222 /* SyntaxKind.PostfixUnaryExpression */) { return expression.operator; } else { @@ -17913,15 +18023,15 @@ var ts; })(OperatorPrecedence = ts.OperatorPrecedence || (ts.OperatorPrecedence = {})); function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { switch (nodeKind) { - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return 0 /* OperatorPrecedence.Comma */; - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return 1 /* OperatorPrecedence.Spread */; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return 2 /* OperatorPrecedence.Yield */; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return 4 /* OperatorPrecedence.Conditional */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (operatorKind) { case 27 /* SyntaxKind.CommaToken */: return 0 /* OperatorPrecedence.Comma */; @@ -17946,26 +18056,27 @@ var ts; return getBinaryOperatorPrecedence(operatorKind); } // TODO: Should prefix `++` and `--` be moved to the `Update` precedence? - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 218 /* SyntaxKind.AwaitExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return 16 /* OperatorPrecedence.Unary */; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return 17 /* OperatorPrecedence.Update */; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return 18 /* OperatorPrecedence.LeftHandSide */; - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return hasArguments ? 19 /* OperatorPrecedence.Member */ : 18 /* OperatorPrecedence.LeftHandSide */; - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 231 /* SyntaxKind.MetaProperty */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 233 /* SyntaxKind.MetaProperty */: return 19 /* OperatorPrecedence.Member */; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return 11 /* OperatorPrecedence.Relational */; case 108 /* SyntaxKind.ThisKeyword */: case 106 /* SyntaxKind.SuperKeyword */: @@ -17977,19 +18088,19 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 226 /* SyntaxKind.ClassExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: case 13 /* SyntaxKind.RegularExpressionLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 225 /* SyntaxKind.TemplateExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: return 20 /* OperatorPrecedence.Primary */; default: return -1 /* OperatorPrecedence.Invalid */; @@ -18021,7 +18132,8 @@ var ts; case 33 /* SyntaxKind.GreaterThanEqualsToken */: case 102 /* SyntaxKind.InstanceOfKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: + case 150 /* SyntaxKind.SatisfiesKeyword */: return 11 /* OperatorPrecedence.Relational */; case 47 /* SyntaxKind.LessThanLessThanToken */: case 48 /* SyntaxKind.GreaterThanGreaterThanToken */: @@ -18045,7 +18157,7 @@ var ts; function getSemanticJsxChildren(children) { return ts.filter(children, function (i) { switch (i.kind) { - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return !!i.expression; case 11 /* SyntaxKind.JsxText */: return !i.containsOnlyTriviaWhiteSpaces; @@ -18101,7 +18213,7 @@ var ts; } diagnostics = nonFileDiagnostics; } - ts.insertSorted(diagnostics, diagnostic, compareDiagnostics); + ts.insertSorted(diagnostics, diagnostic, compareDiagnosticsSkipRelatedInformation); } function getGlobalDiagnostics() { hasReadNonFileDiagnostics = true; @@ -18637,7 +18749,7 @@ var ts; while (ts.isQualifiedName(node.parent) && node.parent.left === node) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */; + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isThisInTypeQuery = isThisInTypeQuery; function identifierIsThisKeyword(id) { @@ -18652,10 +18764,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 172 /* SyntaxKind.GetAccessor */) { + if (accessor.kind === 174 /* SyntaxKind.GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (accessor.kind === 175 /* SyntaxKind.SetAccessor */) { setAccessor = accessor; } else { @@ -18675,10 +18787,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 172 /* SyntaxKind.GetAccessor */ && !getAccessor) { + if (member.kind === 174 /* SyntaxKind.GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 173 /* SyntaxKind.SetAccessor */ && !setAccessor) { + if (member.kind === 175 /* SyntaxKind.SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -18727,7 +18839,7 @@ var ts; ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations; /** template tags are only available when a typedef isn't already using them */ function isNonTypeAliasTemplate(tag) { - return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 320 /* SyntaxKind.JSDoc */ && tag.parent.tags.some(isJSDocTypeAlias)); + return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 323 /* SyntaxKind.JSDoc */ && tag.parent.tags.some(isJSDocTypeAlias)); } /** * Gets the effective type annotation of the value parameter of a set accessor. If the node @@ -18960,13 +19072,17 @@ var ts; } ts.hasOverrideModifier = hasOverrideModifier; function hasAbstractModifier(node) { - return hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */); + return hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */); } ts.hasAbstractModifier = hasAbstractModifier; function hasAmbientModifier(node) { return hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */); } ts.hasAmbientModifier = hasAmbientModifier; + function hasAccessorModifier(node) { + return hasSyntacticModifier(node, 128 /* ModifierFlags.Accessor */); + } + ts.hasAccessorModifier = hasAccessorModifier; function hasEffectiveReadonlyModifier(node) { return hasEffectiveModifier(node, 64 /* ModifierFlags.Readonly */); } @@ -18984,7 +19100,7 @@ var ts; } ts.getSelectedSyntacticModifierFlags = getSelectedSyntacticModifierFlags; function getModifierFlagsWorker(node, includeJSDoc, alwaysIncludeJSDoc) { - if (node.kind >= 0 /* SyntaxKind.FirstToken */ && node.kind <= 160 /* SyntaxKind.LastToken */) { + if (node.kind >= 0 /* SyntaxKind.FirstToken */ && node.kind <= 162 /* SyntaxKind.LastToken */) { return 0 /* ModifierFlags.None */; } if (!(node.modifierFlagsCache & 536870912 /* ModifierFlags.HasComputedFlags */)) { @@ -19076,25 +19192,22 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: return 4 /* ModifierFlags.Public */; case 122 /* SyntaxKind.ProtectedKeyword */: return 16 /* ModifierFlags.Protected */; case 121 /* SyntaxKind.PrivateKeyword */: return 8 /* ModifierFlags.Private */; - case 126 /* SyntaxKind.AbstractKeyword */: return 128 /* ModifierFlags.Abstract */; + case 126 /* SyntaxKind.AbstractKeyword */: return 256 /* ModifierFlags.Abstract */; + case 127 /* SyntaxKind.AccessorKeyword */: return 128 /* ModifierFlags.Accessor */; case 93 /* SyntaxKind.ExportKeyword */: return 1 /* ModifierFlags.Export */; - case 135 /* SyntaxKind.DeclareKeyword */: return 2 /* ModifierFlags.Ambient */; + case 136 /* SyntaxKind.DeclareKeyword */: return 2 /* ModifierFlags.Ambient */; case 85 /* SyntaxKind.ConstKeyword */: return 2048 /* ModifierFlags.Const */; - case 88 /* SyntaxKind.DefaultKeyword */: return 512 /* ModifierFlags.Default */; - case 131 /* SyntaxKind.AsyncKeyword */: return 256 /* ModifierFlags.Async */; - case 145 /* SyntaxKind.ReadonlyKeyword */: return 64 /* ModifierFlags.Readonly */; - case 159 /* SyntaxKind.OverrideKeyword */: return 16384 /* ModifierFlags.Override */; + case 88 /* SyntaxKind.DefaultKeyword */: return 1024 /* ModifierFlags.Default */; + case 132 /* SyntaxKind.AsyncKeyword */: return 512 /* ModifierFlags.Async */; + case 146 /* SyntaxKind.ReadonlyKeyword */: return 64 /* ModifierFlags.Readonly */; + case 161 /* SyntaxKind.OverrideKeyword */: return 16384 /* ModifierFlags.Override */; case 101 /* SyntaxKind.InKeyword */: return 32768 /* ModifierFlags.In */; - case 144 /* SyntaxKind.OutKeyword */: return 65536 /* ModifierFlags.Out */; - case 165 /* SyntaxKind.Decorator */: return 131072 /* ModifierFlags.Decorator */; + case 145 /* SyntaxKind.OutKeyword */: return 65536 /* ModifierFlags.Out */; + case 167 /* SyntaxKind.Decorator */: return 131072 /* ModifierFlags.Decorator */; } return 0 /* ModifierFlags.None */; } ts.modifierToFlag = modifierToFlag; - function createModifiers(modifierFlags) { - return modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; - } - ts.createModifiers = createModifiers; function isLogicalOperator(token) { return token === 56 /* SyntaxKind.BarBarToken */ || token === 55 /* SyntaxKind.AmpersandAmpersandToken */ @@ -19144,8 +19257,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { var kind = node.left.kind; - return kind === 205 /* SyntaxKind.ObjectLiteralExpression */ - || kind === 204 /* SyntaxKind.ArrayLiteralExpression */; + return kind === 207 /* SyntaxKind.ObjectLiteralExpression */ + || kind === 206 /* SyntaxKind.ArrayLiteralExpression */; } return false; } @@ -19162,12 +19275,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.left; } while (node.kind !== 79 /* SyntaxKind.Identifier */); return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: do { node = node.expression; } while (node.kind !== 79 /* SyntaxKind.Identifier */); @@ -19179,9 +19292,9 @@ var ts; return node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 108 /* SyntaxKind.ThisKeyword */ || node.kind === 106 /* SyntaxKind.SuperKeyword */ - || node.kind === 231 /* SyntaxKind.MetaProperty */ - || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && isDottedName(node.expression) - || node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ && isDottedName(node.expression); + || node.kind === 233 /* SyntaxKind.MetaProperty */ + || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isDottedName(node.expression) + || node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ && isDottedName(node.expression); } ts.isDottedName = isDottedName; function isPropertyAccessEntityNameExpression(node) { @@ -19212,8 +19325,8 @@ var ts; } ts.isPrototypeAccess = isPrototypeAccess; function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 161 /* SyntaxKind.QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 163 /* SyntaxKind.QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isRightSideOfAccessExpression(node) { @@ -19228,12 +19341,12 @@ var ts; } ts.isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName = isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName; function isEmptyObjectLiteral(expression) { - return expression.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + return expression.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && expression.properties.length === 0; } ts.isEmptyObjectLiteral = isEmptyObjectLiteral; function isEmptyArrayLiteral(expression) { - return expression.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && + return expression.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && expression.elements.length === 0; } ts.isEmptyArrayLiteral = isEmptyArrayLiteral; @@ -19249,7 +19362,7 @@ var ts; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; function isExportDefaultSymbol(symbol) { - return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 512 /* ModifierFlags.Default */); + return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 1024 /* ModifierFlags.Default */); } /** Return ".ts", ".d.ts", or ".tsx", if that is the extension. */ function tryExtractTSExtension(fileName) { @@ -19394,21 +19507,17 @@ var ts; return getStringFromExpandedCharCodes(expandedCharCodes); } ts.base64decode = base64decode; + function readJsonOrUndefined(path, hostOrText) { + var jsonText = ts.isString(hostOrText) ? hostOrText : hostOrText.readFile(path); + if (!jsonText) + return undefined; + // gracefully handle if readFile fails or returns not JSON + var result = ts.parseConfigFileTextToJson(path, jsonText); + return !result.error ? result.config : undefined; + } + ts.readJsonOrUndefined = readJsonOrUndefined; function readJson(path, host) { - try { - var jsonText = host.readFile(path); - if (!jsonText) - return {}; - var result = ts.parseConfigFileTextToJson(path, jsonText); - if (result.error) { - return {}; - } - return result.config; - } - catch (e) { - // gracefully handle if readFile fails or returns not JSON - return {}; - } + return readJsonOrUndefined(path, host) || {}; } ts.readJson = readJson; function directoryProbablyExists(directoryName, host) { @@ -19567,8 +19676,8 @@ var ts; var parseNode = ts.getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return parseNode === parseNode.parent.name; } } @@ -19584,7 +19693,7 @@ var ts; } function isWatchSet(options) { // Firefox has Object.prototype.watch - return options.watch && options.hasOwnProperty("watch"); + return options.watch && ts.hasProperty(options, "watch"); } ts.isWatchSet = isWatchSet; function closeFileWatcher(watcher) { @@ -19648,35 +19757,35 @@ var ts; if (!parent) return 0 /* AccessKind.Read */; switch (parent.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return accessKind(parent); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var operator = parent.operator; return operator === 45 /* SyntaxKind.PlusPlusToken */ || operator === 46 /* SyntaxKind.MinusMinusToken */ ? writeOrReadWrite() : 0 /* AccessKind.Read */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var _a = parent, left = _a.left, operatorToken = _a.operatorToken; return left === node && isAssignmentOperator(operatorToken.kind) ? operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ ? 1 /* AccessKind.Write */ : writeOrReadWrite() : 0 /* AccessKind.Read */; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return parent.name !== node ? 0 /* AccessKind.Read */ : accessKind(parent); - case 296 /* SyntaxKind.PropertyAssignment */: { + case 299 /* SyntaxKind.PropertyAssignment */: { var parentAccess = accessKind(parent.parent); // In `({ x: varname }) = { x: 1 }`, the left `x` is a read, the right `x` is a write. return node === parent.name ? reverseAccessKind(parentAccess) : parentAccess; } - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // Assume it's the local variable being accessed, since we don't check public properties for --noUnusedLocals. return node === parent.objectAssignmentInitializer ? 0 /* AccessKind.Read */ : accessKind(parent.parent); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return accessKind(parent); default: return 0 /* AccessKind.Read */; } function writeOrReadWrite() { // If grandparent is not an ExpressionStatement, this is used as an expression in addition to having a side effect. - return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 238 /* SyntaxKind.ExpressionStatement */ ? 1 /* AccessKind.Write */ : 2 /* AccessKind.ReadWrite */; + return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 241 /* SyntaxKind.ExpressionStatement */ ? 1 /* AccessKind.Write */ : 2 /* AccessKind.ReadWrite */; } } function reverseAccessKind(a) { @@ -19758,7 +19867,7 @@ var ts; function isAbstractConstructorSymbol(symbol) { if (symbol.flags & 32 /* SymbolFlags.Class */) { var declaration = getClassLikeDeclarationOfSymbol(symbol); - return !!declaration && hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */); + return !!declaration && hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */); } return false; } @@ -19820,37 +19929,37 @@ var ts; } ts.isObjectTypeDeclaration = isObjectTypeDeclaration; function isTypeNodeKind(kind) { - return (kind >= 177 /* SyntaxKind.FirstTypeNode */ && kind <= 200 /* SyntaxKind.LastTypeNode */) - || kind === 130 /* SyntaxKind.AnyKeyword */ - || kind === 155 /* SyntaxKind.UnknownKeyword */ - || kind === 147 /* SyntaxKind.NumberKeyword */ - || kind === 158 /* SyntaxKind.BigIntKeyword */ - || kind === 148 /* SyntaxKind.ObjectKeyword */ - || kind === 133 /* SyntaxKind.BooleanKeyword */ - || kind === 150 /* SyntaxKind.StringKeyword */ - || kind === 151 /* SyntaxKind.SymbolKeyword */ + return (kind >= 179 /* SyntaxKind.FirstTypeNode */ && kind <= 202 /* SyntaxKind.LastTypeNode */) + || kind === 131 /* SyntaxKind.AnyKeyword */ + || kind === 157 /* SyntaxKind.UnknownKeyword */ + || kind === 148 /* SyntaxKind.NumberKeyword */ + || kind === 160 /* SyntaxKind.BigIntKeyword */ + || kind === 149 /* SyntaxKind.ObjectKeyword */ + || kind === 134 /* SyntaxKind.BooleanKeyword */ + || kind === 152 /* SyntaxKind.StringKeyword */ + || kind === 153 /* SyntaxKind.SymbolKeyword */ || kind === 114 /* SyntaxKind.VoidKeyword */ - || kind === 153 /* SyntaxKind.UndefinedKeyword */ - || kind === 143 /* SyntaxKind.NeverKeyword */ - || kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ - || kind === 312 /* SyntaxKind.JSDocAllType */ - || kind === 313 /* SyntaxKind.JSDocUnknownType */ - || kind === 314 /* SyntaxKind.JSDocNullableType */ - || kind === 315 /* SyntaxKind.JSDocNonNullableType */ - || kind === 316 /* SyntaxKind.JSDocOptionalType */ - || kind === 317 /* SyntaxKind.JSDocFunctionType */ - || kind === 318 /* SyntaxKind.JSDocVariadicType */; + || kind === 155 /* SyntaxKind.UndefinedKeyword */ + || kind === 144 /* SyntaxKind.NeverKeyword */ + || kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ + || kind === 315 /* SyntaxKind.JSDocAllType */ + || kind === 316 /* SyntaxKind.JSDocUnknownType */ + || kind === 317 /* SyntaxKind.JSDocNullableType */ + || kind === 318 /* SyntaxKind.JSDocNonNullableType */ + || kind === 319 /* SyntaxKind.JSDocOptionalType */ + || kind === 320 /* SyntaxKind.JSDocFunctionType */ + || kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isTypeNodeKind = isTypeNodeKind; function isAccessExpression(node) { - return node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 207 /* SyntaxKind.ElementAccessExpression */; + return node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 209 /* SyntaxKind.ElementAccessExpression */; } ts.isAccessExpression = isAccessExpression; function getNameOfAccessExpression(node) { - if (node.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { return node.name; } - ts.Debug.assert(node.kind === 207 /* SyntaxKind.ElementAccessExpression */); + ts.Debug.assert(node.kind === 209 /* SyntaxKind.ElementAccessExpression */); return node.argumentExpression; } ts.getNameOfAccessExpression = getNameOfAccessExpression; @@ -19865,7 +19974,7 @@ var ts; } ts.isBundleFileTextLike = isBundleFileTextLike; function isNamedImportsOrExports(node) { - return node.kind === 269 /* SyntaxKind.NamedImports */ || node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 272 /* SyntaxKind.NamedImports */ || node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedImportsOrExports = isNamedImportsOrExports; function getLeftmostAccessExpression(expr) { @@ -19880,13 +19989,13 @@ var ts; return walkAccessExpression(name.parent); } function walkAccessExpression(access) { - if (access.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (access.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var res = action(access.name); if (res !== undefined) { return res; } } - else if (access.kind === 207 /* SyntaxKind.ElementAccessExpression */) { + else if (access.kind === 209 /* SyntaxKind.ElementAccessExpression */) { if (ts.isIdentifier(access.argumentExpression) || ts.isStringLiteralLike(access.argumentExpression)) { var res = action(access.argumentExpression); if (res !== undefined) { @@ -19913,28 +20022,29 @@ var ts; function getLeftmostExpression(node, stopAtCallExpressions) { while (true) { switch (node.kind) { - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: node = node.operand; continue; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: node = node.left; continue; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: node = node.condition; continue; - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: node = node.tag; continue; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (stopAtCallExpressions) { return node; } // falls through - case 229 /* SyntaxKind.AsExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: node = node.expression; continue; } @@ -21170,17 +21280,17 @@ var ts; return ts.isIdentifier(useSite) && ts.isShorthandPropertyAssignment(useSite.parent) && useSite.parent.name === useSite; } function isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(node) { - while (node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { node = node.parent; } - if (node.kind !== 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.kind !== 164 /* SyntaxKind.ComputedPropertyName */) { return false; } - if (hasSyntacticModifier(node.parent, 128 /* ModifierFlags.Abstract */)) { + if (hasSyntacticModifier(node.parent, 256 /* ModifierFlags.Abstract */)) { return true; } var containerKind = node.parent.parent.kind; - return containerKind === 258 /* SyntaxKind.InterfaceDeclaration */ || containerKind === 182 /* SyntaxKind.TypeLiteral */; + return containerKind === 261 /* SyntaxKind.InterfaceDeclaration */ || containerKind === 184 /* SyntaxKind.TypeLiteral */; } /** Returns true for an identifier in 1) an `implements` clause, and 2) an `extends` clause of an interface. */ function isIdentifierInNonEmittingHeritageClause(node) { @@ -21188,16 +21298,16 @@ var ts; return false; var heritageClause = ts.findAncestor(node.parent, function (parent) { switch (parent.kind) { - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return true; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return false; default: return "quit"; } }); - return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 /* SyntaxKind.ImplementsKeyword */ || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 258 /* SyntaxKind.InterfaceDeclaration */; + return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 /* SyntaxKind.ImplementsKeyword */ || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 261 /* SyntaxKind.InterfaceDeclaration */; } function isIdentifierTypeReference(node) { return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName); @@ -21358,22 +21468,22 @@ var ts; if (!node.parent) return undefined; switch (node.kind) { - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: var parent_1 = node.parent; - return parent_1.kind === 190 /* SyntaxKind.InferType */ ? undefined : parent_1.typeParameters; - case 164 /* SyntaxKind.Parameter */: + return parent_1.kind === 192 /* SyntaxKind.InferType */ ? undefined : parent_1.typeParameters; + case 166 /* SyntaxKind.Parameter */: return node.parent.parameters; - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: + case 201 /* SyntaxKind.TemplateLiteralTypeSpan */: return node.parent.templateSpans; - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return node.parent.templateSpans; - case 165 /* SyntaxKind.Decorator */: { + case 167 /* SyntaxKind.Decorator */: { var parent_2 = node.parent; return ts.canHaveDecorators(parent_2) ? parent_2.modifiers : ts.canHaveIllegalDecorators(parent_2) ? parent_2.illegalDecorators : undefined; } - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return node.parent.heritageClauses; } var parent = node.parent; @@ -21381,45 +21491,45 @@ var ts; return ts.isJSDocTypeLiteral(node.parent) ? undefined : node.parent.tags; } switch (parent.kind) { - case 182 /* SyntaxKind.TypeLiteral */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.isTypeElement(node) ? parent.members : undefined; - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return parent.types; - case 184 /* SyntaxKind.TupleType */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 351 /* SyntaxKind.CommaListExpression */: - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 186 /* SyntaxKind.TupleType */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 354 /* SyntaxKind.CommaListExpression */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return parent.elements; - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 286 /* SyntaxKind.JsxAttributes */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 289 /* SyntaxKind.JsxAttributes */: return parent.properties; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return ts.isTypeNode(node) ? parent.typeArguments : parent.expression === node ? undefined : parent.arguments; - case 278 /* SyntaxKind.JsxElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 281 /* SyntaxKind.JsxElement */: + case 285 /* SyntaxKind.JsxFragment */: return ts.isJsxChild(node) ? parent.children : undefined; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return ts.isTypeNode(node) ? parent.typeArguments : undefined; - case 235 /* SyntaxKind.Block */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 265 /* SyntaxKind.ModuleBlock */: return parent.statements; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return parent.clauses; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.isClassElement(node) ? parent.members : undefined; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.isEnumMember(node) ? parent.members : undefined; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return parent.statements; } } @@ -21431,7 +21541,7 @@ var ts; if (ts.some(node.parameters, function (p) { return !getEffectiveTypeAnnotationNode(p); })) { return true; } - if (node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind !== 216 /* SyntaxKind.ArrowFunction */) { // If the first parameter is not an explicit 'this' parameter, then the function has // an implicit 'this' parameter which is subject to contextual typing. var parameter = ts.firstOrUndefined(node.parameters); @@ -21449,7 +21559,7 @@ var ts; } ts.isInfinityOrNaNString = isInfinityOrNaNString; function isCatchClauseVariableDeclaration(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function isParameterOrCatchClauseVariable(symbol) { @@ -21458,7 +21568,7 @@ var ts; } ts.isParameterOrCatchClauseVariable = isParameterOrCatchClauseVariable; function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 213 /* SyntaxKind.FunctionExpression */ || node.kind === 214 /* SyntaxKind.ArrowFunction */; + return node.kind === 215 /* SyntaxKind.FunctionExpression */ || node.kind === 216 /* SyntaxKind.ArrowFunction */; } ts.isFunctionExpressionOrArrowFunction = isFunctionExpressionOrArrowFunction; function escapeSnippetText(text) { @@ -21555,7 +21665,7 @@ var ts; ts.getNodeModulePathParts = getNodeModulePathParts; function getParameterTypeNode(parameter) { var _a; - return parameter.kind === 340 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; + return parameter.kind === 343 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; } ts.getParameterTypeNode = getParameterTypeNode; })(ts || (ts = {})); @@ -21680,10 +21790,10 @@ var ts; // // If `a ** d` is on the left of operator `**`, we need to parenthesize to preserve // the intended order of operations: `(a ** b) ** c` - var binaryOperatorPrecedence = ts.getOperatorPrecedence(221 /* SyntaxKind.BinaryExpression */, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(221 /* SyntaxKind.BinaryExpression */, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(223 /* SyntaxKind.BinaryExpression */, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(223 /* SyntaxKind.BinaryExpression */, binaryOperator); var emittedOperand = ts.skipPartiallyEmittedExpressions(operand); - if (!isLeftSideOfBinary && operand.kind === 214 /* SyntaxKind.ArrowFunction */ && binaryOperatorPrecedence > 3 /* OperatorPrecedence.Assignment */) { + if (!isLeftSideOfBinary && operand.kind === 216 /* SyntaxKind.ArrowFunction */ && binaryOperatorPrecedence > 3 /* OperatorPrecedence.Assignment */) { // We need to parenthesize arrow functions on the right side to avoid it being // parsed as parenthesized expression: `a && (() => {})` return true; @@ -21695,7 +21805,7 @@ var ts; // and is a yield expression, then we do not need parentheses. if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 /* Associativity.Right */ - && operand.kind === 224 /* SyntaxKind.YieldExpression */) { + && operand.kind === 226 /* SyntaxKind.YieldExpression */) { return false; } return true; @@ -21764,13 +21874,15 @@ var ts; // (a|b)|c -> a|(b|c) -> a|b|c // (a&b)&c -> a&(b&c) -> a&b&c // (a^b)^c -> a^(b^c) -> a^b^c + // (a,b),c -> a,(b,c) -> a,b,c // // While addition is associative in mathematics, JavaScript's `+` is not // guaranteed to be associative as it is overloaded with string concatenation. return binaryOperator === 41 /* SyntaxKind.AsteriskToken */ || binaryOperator === 51 /* SyntaxKind.BarToken */ || binaryOperator === 50 /* SyntaxKind.AmpersandToken */ - || binaryOperator === 52 /* SyntaxKind.CaretToken */; + || binaryOperator === 52 /* SyntaxKind.CaretToken */ + || binaryOperator === 27 /* SyntaxKind.CommaToken */; } /** * This function determines whether an expression consists of a homogeneous set of @@ -21783,7 +21895,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 39 /* SyntaxKind.PlusToken */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 39 /* SyntaxKind.PlusToken */) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -21809,7 +21921,7 @@ var ts; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = ts.skipPartiallyEmittedExpressions(operand); // If the resulting expression is already parenthesized, we do not need to do any further processing. - if (skipped.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (skipped.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) @@ -21826,7 +21938,7 @@ var ts; return ts.isCommaSequence(expression) ? factory.createParenthesizedExpression(expression) : expression; } function parenthesizeConditionOfConditionalExpression(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(222 /* SyntaxKind.ConditionalExpression */, 57 /* SyntaxKind.QuestionToken */); + var conditionalPrecedence = ts.getOperatorPrecedence(224 /* SyntaxKind.ConditionalExpression */, 57 /* SyntaxKind.QuestionToken */); var emittedCondition = ts.skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) !== 1 /* Comparison.GreaterThan */) { @@ -21859,8 +21971,8 @@ var ts; var needsParens = ts.isCommaSequence(check); if (!needsParens) { switch (ts.getLeftmostExpression(check, /*stopAtCallExpression*/ false).kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: needsParens = true; } } @@ -21873,9 +21985,9 @@ var ts; function parenthesizeExpressionOfNew(expression) { var leftmostExpr = ts.getLeftmostExpression(expression, /*stopAtCallExpressions*/ true); switch (leftmostExpr.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return factory.createParenthesizedExpression(expression); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return !leftmostExpr.arguments ? factory.createParenthesizedExpression(expression) : expression; // TODO(rbuckton): Verify this assertion holds @@ -21895,7 +22007,7 @@ var ts; // var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 209 /* SyntaxKind.NewExpression */ || emittedExpression.arguments) + && (emittedExpression.kind !== 211 /* SyntaxKind.NewExpression */ || emittedExpression.arguments) && (optionalChain || !ts.isOptionalChain(emittedExpression))) { // TODO(rbuckton): Verify whether this assertion holds. return expression; @@ -21918,7 +22030,7 @@ var ts; function parenthesizeExpressionForDisallowedComma(expression) { var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(221 /* SyntaxKind.BinaryExpression */, 27 /* SyntaxKind.CommaToken */); + var commaPrecedence = ts.getOperatorPrecedence(223 /* SyntaxKind.BinaryExpression */, 27 /* SyntaxKind.CommaToken */); // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return expressionPrecedence > commaPrecedence ? expression : ts.setTextRange(factory.createParenthesizedExpression(expression), expression); } @@ -21927,21 +22039,21 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = ts.skipPartiallyEmittedExpressions(callee).kind; - if (kind === 213 /* SyntaxKind.FunctionExpression */ || kind === 214 /* SyntaxKind.ArrowFunction */) { + if (kind === 215 /* SyntaxKind.FunctionExpression */ || kind === 216 /* SyntaxKind.ArrowFunction */) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. var updated = factory.updateCallExpression(emittedExpression, ts.setTextRange(factory.createParenthesizedExpression(callee), callee), emittedExpression.typeArguments, emittedExpression.arguments); return factory.restoreOuterExpressions(expression, updated, 8 /* OuterExpressionKinds.PartiallyEmittedExpressions */); } } var leftmostExpressionKind = ts.getLeftmostExpression(emittedExpression, /*stopAtCallExpressions*/ false).kind; - if (leftmostExpressionKind === 205 /* SyntaxKind.ObjectLiteralExpression */ || leftmostExpressionKind === 213 /* SyntaxKind.FunctionExpression */) { + if (leftmostExpressionKind === 207 /* SyntaxKind.ObjectLiteralExpression */ || leftmostExpressionKind === 215 /* SyntaxKind.FunctionExpression */) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return ts.setTextRange(factory.createParenthesizedExpression(expression), expression); } return expression; } function parenthesizeConciseBodyOfArrowFunction(body) { - if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 205 /* SyntaxKind.ObjectLiteralExpression */)) { + if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 207 /* SyntaxKind.ObjectLiteralExpression */)) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return ts.setTextRange(factory.createParenthesizedExpression(body), body); } @@ -21959,16 +22071,16 @@ var ts; // - The true and false branch types (the second and third `Type` non-terminals, above) allow any type function parenthesizeCheckTypeOfConditionalType(checkType) { switch (checkType.kind) { - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 189 /* SyntaxKind.ConditionalType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 191 /* SyntaxKind.ConditionalType */: return factory.createParenthesizedType(checkType); } return checkType; } function parenthesizeExtendsTypeOfConditionalType(extendsType) { switch (extendsType.kind) { - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return factory.createParenthesizedType(extendsType); } return extendsType; @@ -21980,8 +22092,8 @@ var ts; // - A union type constituent has the same precedence as the check type of a conditional type function parenthesizeConstituentTypeOfUnionType(type) { switch (type.kind) { - case 187 /* SyntaxKind.UnionType */: // Not strictly necessary, but a union containing a union should have been flattened - case 188 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests + case 189 /* SyntaxKind.UnionType */: // Not strictly necessary, but a union containing a union should have been flattened + case 190 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests return factory.createParenthesizedType(type); } return parenthesizeCheckTypeOfConditionalType(type); @@ -21996,8 +22108,8 @@ var ts; // - An intersection type constituent does not allow function, constructor, conditional, or union types (they must be parenthesized) function parenthesizeConstituentTypeOfIntersectionType(type) { switch (type.kind) { - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but an intersection containing an intersection should have been flattened + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but an intersection containing an intersection should have been flattened return factory.createParenthesizedType(type); } return parenthesizeConstituentTypeOfUnionType(type); @@ -22014,14 +22126,14 @@ var ts; // function parenthesizeOperandOfTypeOperator(type) { switch (type.kind) { - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return factory.createParenthesizedType(type); } return parenthesizeConstituentTypeOfIntersectionType(type); } function parenthesizeOperandOfReadonlyTypeOperator(type) { switch (type.kind) { - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return factory.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); @@ -22041,9 +22153,9 @@ var ts; // function parenthesizeNonArrayTypeOfPostfixType(type) { switch (type.kind) { - case 190 /* SyntaxKind.InferType */: - case 193 /* SyntaxKind.TypeOperator */: - case 181 /* SyntaxKind.TypeQuery */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests + case 192 /* SyntaxKind.InferType */: + case 195 /* SyntaxKind.TypeOperator */: + case 183 /* SyntaxKind.TypeQuery */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests return factory.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); @@ -22237,11 +22349,11 @@ var ts; } function convertToAssignmentPattern(node) { switch (node.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return convertToArrayAssignmentPattern(node); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return convertToObjectAssignmentPattern(node); } } @@ -22335,6 +22447,8 @@ var ts; createUniqueName: createUniqueName, getGeneratedNameForNode: getGeneratedNameForNode, createPrivateIdentifier: createPrivateIdentifier, + createUniquePrivateName: createUniquePrivateName, + getGeneratedPrivateNameForNode: getGeneratedPrivateNameForNode, createToken: createToken, createSuper: createSuper, createThis: createThis, @@ -22497,6 +22611,8 @@ var ts; updateAsExpression: updateAsExpression, createNonNullExpression: createNonNullExpression, updateNonNullExpression: updateNonNullExpression, + createSatisfiesExpression: createSatisfiesExpression, + updateSatisfiesExpression: updateSatisfiesExpression, createNonNullChain: createNonNullChain, updateNonNullChain: updateNonNullChain, createMetaProperty: createMetaProperty, @@ -22594,18 +22710,18 @@ var ts; createExternalModuleReference: createExternalModuleReference, updateExternalModuleReference: updateExternalModuleReference, // lazily load factory members for JSDoc types with similar structure - get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(312 /* SyntaxKind.JSDocAllType */); }, - get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(313 /* SyntaxKind.JSDocUnknownType */); }, - get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(315 /* SyntaxKind.JSDocNonNullableType */); }, - get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(315 /* SyntaxKind.JSDocNonNullableType */); }, - get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(314 /* SyntaxKind.JSDocNullableType */); }, - get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(314 /* SyntaxKind.JSDocNullableType */); }, - get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(316 /* SyntaxKind.JSDocOptionalType */); }, - get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(316 /* SyntaxKind.JSDocOptionalType */); }, - get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(318 /* SyntaxKind.JSDocVariadicType */); }, - get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(318 /* SyntaxKind.JSDocVariadicType */); }, - get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(319 /* SyntaxKind.JSDocNamepathType */); }, - get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(319 /* SyntaxKind.JSDocNamepathType */); }, + get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(315 /* SyntaxKind.JSDocAllType */); }, + get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(316 /* SyntaxKind.JSDocUnknownType */); }, + get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(318 /* SyntaxKind.JSDocNonNullableType */); }, + get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(318 /* SyntaxKind.JSDocNonNullableType */); }, + get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(317 /* SyntaxKind.JSDocNullableType */); }, + get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(317 /* SyntaxKind.JSDocNullableType */); }, + get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(319 /* SyntaxKind.JSDocOptionalType */); }, + get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(319 /* SyntaxKind.JSDocOptionalType */); }, + get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(321 /* SyntaxKind.JSDocVariadicType */); }, + get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(321 /* SyntaxKind.JSDocVariadicType */); }, + get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(322 /* SyntaxKind.JSDocNamepathType */); }, + get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(322 /* SyntaxKind.JSDocNamepathType */); }, createJSDocFunctionType: createJSDocFunctionType, updateJSDocFunctionType: updateJSDocFunctionType, createJSDocTypeLiteral: createJSDocTypeLiteral, @@ -22641,30 +22757,30 @@ var ts; createJSDocLinkPlain: createJSDocLinkPlain, updateJSDocLinkPlain: updateJSDocLinkPlain, // lazily load factory members for JSDoc tags with similar structure - get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(343 /* SyntaxKind.JSDocTypeTag */); }, - get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(343 /* SyntaxKind.JSDocTypeTag */); }, - get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(341 /* SyntaxKind.JSDocReturnTag */); }, - get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(341 /* SyntaxKind.JSDocReturnTag */); }, - get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(342 /* SyntaxKind.JSDocThisTag */); }, - get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(342 /* SyntaxKind.JSDocThisTag */); }, - get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(339 /* SyntaxKind.JSDocEnumTag */); }, - get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(339 /* SyntaxKind.JSDocEnumTag */); }, - get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(330 /* SyntaxKind.JSDocAuthorTag */); }, - get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(330 /* SyntaxKind.JSDocAuthorTag */); }, - get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(332 /* SyntaxKind.JSDocClassTag */); }, - get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(332 /* SyntaxKind.JSDocClassTag */); }, - get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(333 /* SyntaxKind.JSDocPublicTag */); }, - get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(333 /* SyntaxKind.JSDocPublicTag */); }, - get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(334 /* SyntaxKind.JSDocPrivateTag */); }, - get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(334 /* SyntaxKind.JSDocPrivateTag */); }, - get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(335 /* SyntaxKind.JSDocProtectedTag */); }, - get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(335 /* SyntaxKind.JSDocProtectedTag */); }, - get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(336 /* SyntaxKind.JSDocReadonlyTag */); }, - get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(336 /* SyntaxKind.JSDocReadonlyTag */); }, - get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(337 /* SyntaxKind.JSDocOverrideTag */); }, - get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(337 /* SyntaxKind.JSDocOverrideTag */); }, - get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(331 /* SyntaxKind.JSDocDeprecatedTag */); }, - get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(331 /* SyntaxKind.JSDocDeprecatedTag */); }, + get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(346 /* SyntaxKind.JSDocTypeTag */); }, + get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(346 /* SyntaxKind.JSDocTypeTag */); }, + get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(344 /* SyntaxKind.JSDocReturnTag */); }, + get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(344 /* SyntaxKind.JSDocReturnTag */); }, + get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(345 /* SyntaxKind.JSDocThisTag */); }, + get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(345 /* SyntaxKind.JSDocThisTag */); }, + get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(342 /* SyntaxKind.JSDocEnumTag */); }, + get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(342 /* SyntaxKind.JSDocEnumTag */); }, + get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(333 /* SyntaxKind.JSDocAuthorTag */); }, + get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(333 /* SyntaxKind.JSDocAuthorTag */); }, + get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(335 /* SyntaxKind.JSDocClassTag */); }, + get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(335 /* SyntaxKind.JSDocClassTag */); }, + get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(336 /* SyntaxKind.JSDocPublicTag */); }, + get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(336 /* SyntaxKind.JSDocPublicTag */); }, + get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(337 /* SyntaxKind.JSDocPrivateTag */); }, + get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(337 /* SyntaxKind.JSDocPrivateTag */); }, + get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(338 /* SyntaxKind.JSDocProtectedTag */); }, + get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(338 /* SyntaxKind.JSDocProtectedTag */); }, + get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(339 /* SyntaxKind.JSDocReadonlyTag */); }, + get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(339 /* SyntaxKind.JSDocReadonlyTag */); }, + get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(340 /* SyntaxKind.JSDocOverrideTag */); }, + get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(340 /* SyntaxKind.JSDocOverrideTag */); }, + get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(334 /* SyntaxKind.JSDocDeprecatedTag */); }, + get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(334 /* SyntaxKind.JSDocDeprecatedTag */); }, createJSDocUnknownTag: createJSDocUnknownTag, updateJSDocUnknownTag: updateJSDocUnknownTag, createJSDocText: createJSDocText, @@ -22867,11 +22983,11 @@ var ts; // don't propagate child flags. if (name) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: if (ts.isIdentifier(name)) { node.transformFlags |= propagateIdentifierNameFlags(name); break; @@ -23020,10 +23136,12 @@ var ts; node.escapedText = ts.escapeLeadingUnderscores(text); return node; } - function createBaseGeneratedIdentifier(text, autoGenerateFlags) { + function createBaseGeneratedIdentifier(text, autoGenerateFlags, prefix, suffix) { var node = createBaseIdentifier(text, /*originalKeywordKind*/ undefined); node.autoGenerateFlags = autoGenerateFlags; node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; nextAutoGenerateId++; return node; } @@ -23034,7 +23152,7 @@ var ts; // NOTE: we do not use `setChildren` here because typeArguments in an identifier do not contribute to transformations node.typeArguments = createNodeArray(typeArguments); } - if (node.originalKeywordKind === 132 /* SyntaxKind.AwaitKeyword */) { + if (node.originalKeywordKind === 133 /* SyntaxKind.AwaitKeyword */) { node.transformFlags |= 67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; } return node; @@ -23046,11 +23164,11 @@ var ts; : node; } // @api - function createTempVariable(recordTempVariable, reservedInNestedScopes) { + function createTempVariable(recordTempVariable, reservedInNestedScopes, prefix, suffix) { var flags = 1 /* GeneratedIdentifierFlags.Auto */; if (reservedInNestedScopes) flags |= 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */; - var name = createBaseGeneratedIdentifier("", flags); + var name = createBaseGeneratedIdentifier("", flags, prefix, suffix); if (recordTempVariable) { recordTempVariable(name); } @@ -23062,34 +23180,69 @@ var ts; var flags = 2 /* GeneratedIdentifierFlags.Loop */; if (reservedInNestedScopes) flags |= 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */; - return createBaseGeneratedIdentifier("", flags); + return createBaseGeneratedIdentifier("", flags, /*prefix*/ undefined, /*suffix*/ undefined); } /** Create a unique name based on the supplied text. */ // @api - function createUniqueName(text, flags) { + function createUniqueName(text, flags, prefix, suffix) { if (flags === void 0) { flags = 0 /* GeneratedIdentifierFlags.None */; } ts.Debug.assert(!(flags & 7 /* GeneratedIdentifierFlags.KindMask */), "Argument out of range: flags"); ts.Debug.assert((flags & (16 /* GeneratedIdentifierFlags.Optimistic */ | 32 /* GeneratedIdentifierFlags.FileLevel */)) !== 32 /* GeneratedIdentifierFlags.FileLevel */, "GeneratedIdentifierFlags.FileLevel cannot be set without also setting GeneratedIdentifierFlags.Optimistic"); - return createBaseGeneratedIdentifier(text, 3 /* GeneratedIdentifierFlags.Unique */ | flags); + return createBaseGeneratedIdentifier(text, 3 /* GeneratedIdentifierFlags.Unique */ | flags, prefix, suffix); } /** Create a unique name generated for a node. */ // @api - function getGeneratedNameForNode(node, flags) { + function getGeneratedNameForNode(node, flags, prefix, suffix) { if (flags === void 0) { flags = 0; } ts.Debug.assert(!(flags & 7 /* GeneratedIdentifierFlags.KindMask */), "Argument out of range: flags"); - var name = createBaseGeneratedIdentifier(node && ts.isIdentifier(node) ? ts.idText(node) : "", 4 /* GeneratedIdentifierFlags.Node */ | flags); + var text = !node ? "" : + ts.isMemberName(node) ? ts.formatGeneratedName(/*privateName*/ false, prefix, node, suffix, ts.idText) : + "generated@".concat(ts.getNodeId(node)); + if (prefix || suffix) + flags |= 16 /* GeneratedIdentifierFlags.Optimistic */; + var name = createBaseGeneratedIdentifier(text, 4 /* GeneratedIdentifierFlags.Node */ | flags, prefix, suffix); name.original = node; return name; } + function createBasePrivateIdentifier(text) { + var node = baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */); + node.escapedText = ts.escapeLeadingUnderscores(text); + node.transformFlags |= 16777216 /* TransformFlags.ContainsClassFields */; + return node; + } // @api function createPrivateIdentifier(text) { if (!ts.startsWith(text, "#")) ts.Debug.fail("First character of private identifier must be #: " + text); - var node = baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */); - node.escapedText = ts.escapeLeadingUnderscores(text); - node.transformFlags |= 16777216 /* TransformFlags.ContainsClassFields */; + return createBasePrivateIdentifier(text); + } + function createBaseGeneratedPrivateIdentifier(text, autoGenerateFlags, prefix, suffix) { + var node = createBasePrivateIdentifier(text); + node.autoGenerateFlags = autoGenerateFlags; + node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; + nextAutoGenerateId++; return node; } + /** Create a unique name based on the supplied text. */ + // @api + function createUniquePrivateName(text, prefix, suffix) { + if (text && !ts.startsWith(text, "#")) + ts.Debug.fail("First character of private identifier must be #: " + text); + var autoGenerateFlags = 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */ | + (text ? 3 /* GeneratedIdentifierFlags.Unique */ : 1 /* GeneratedIdentifierFlags.Auto */); + return createBaseGeneratedPrivateIdentifier(text !== null && text !== void 0 ? text : "", autoGenerateFlags, prefix, suffix); + } + // @api + function getGeneratedPrivateNameForNode(node, prefix, suffix) { + var text = ts.isMemberName(node) ? ts.formatGeneratedName(/*privateName*/ true, prefix, node, suffix, ts.idText) : + "#generated@".concat(ts.getNodeId(node)); + var flags = prefix || suffix ? 16 /* GeneratedIdentifierFlags.Optimistic */ : 0 /* GeneratedIdentifierFlags.None */; + var name = createBaseGeneratedPrivateIdentifier(text, 4 /* GeneratedIdentifierFlags.Node */ | flags, prefix, suffix); + name.original = node; + return name; + } // // Punctuation // @@ -23097,14 +23250,14 @@ var ts; return baseFactory.createBaseTokenNode(kind); } function createToken(token) { - ts.Debug.assert(token >= 0 /* SyntaxKind.FirstToken */ && token <= 160 /* SyntaxKind.LastToken */, "Invalid token"); + ts.Debug.assert(token >= 0 /* SyntaxKind.FirstToken */ && token <= 162 /* SyntaxKind.LastToken */, "Invalid token"); ts.Debug.assert(token <= 14 /* SyntaxKind.FirstTemplateToken */ || token >= 17 /* SyntaxKind.LastTemplateToken */, "Invalid token. Use 'createTemplateLiteralLikeNode' to create template literals."); ts.Debug.assert(token <= 8 /* SyntaxKind.FirstLiteralToken */ || token >= 14 /* SyntaxKind.LastLiteralToken */, "Invalid token. Use 'createLiteralLikeNode' to create literals."); ts.Debug.assert(token !== 79 /* SyntaxKind.Identifier */, "Invalid token. Use 'createIdentifier' to create identifiers"); var node = createBaseToken(token); var transformFlags = 0 /* TransformFlags.None */; switch (token) { - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // 'async' modifier is ES2017 (async functions) or ES2018 (async generators) transformFlags = 256 /* TransformFlags.ContainsES2017 */ | @@ -23113,24 +23266,24 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 130 /* SyntaxKind.AnyKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 145 /* SyntaxKind.OutKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: // `undefined` is an Identifier in the expression case. + case 157 /* SyntaxKind.UnknownKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: // `undefined` is an Identifier in the expression case. transformFlags = 1 /* TransformFlags.ContainsTypeScript */; break; case 106 /* SyntaxKind.SuperKeyword */: @@ -23139,6 +23292,9 @@ var ts; case 124 /* SyntaxKind.StaticKeyword */: transformFlags = 1024 /* TransformFlags.ContainsES2015 */; break; + case 127 /* SyntaxKind.AccessorKeyword */: + transformFlags = 16777216 /* TransformFlags.ContainsClassFields */; + break; case 108 /* SyntaxKind.ThisKeyword */: // 'this' indicates a lexical 'this' transformFlags = 16384 /* TransformFlags.ContainsLexicalThis */; @@ -23185,8 +23341,8 @@ var ts; if (flags & 1 /* ModifierFlags.Export */) result.push(createModifier(93 /* SyntaxKind.ExportKeyword */)); if (flags & 2 /* ModifierFlags.Ambient */) - result.push(createModifier(135 /* SyntaxKind.DeclareKeyword */)); - if (flags & 512 /* ModifierFlags.Default */) + result.push(createModifier(136 /* SyntaxKind.DeclareKeyword */)); + if (flags & 1024 /* ModifierFlags.Default */) result.push(createModifier(88 /* SyntaxKind.DefaultKeyword */)); if (flags & 2048 /* ModifierFlags.Const */) result.push(createModifier(85 /* SyntaxKind.ConstKeyword */)); @@ -23196,20 +23352,22 @@ var ts; result.push(createModifier(121 /* SyntaxKind.PrivateKeyword */)); if (flags & 16 /* ModifierFlags.Protected */) result.push(createModifier(122 /* SyntaxKind.ProtectedKeyword */)); - if (flags & 128 /* ModifierFlags.Abstract */) + if (flags & 256 /* ModifierFlags.Abstract */) result.push(createModifier(126 /* SyntaxKind.AbstractKeyword */)); if (flags & 32 /* ModifierFlags.Static */) result.push(createModifier(124 /* SyntaxKind.StaticKeyword */)); if (flags & 16384 /* ModifierFlags.Override */) - result.push(createModifier(159 /* SyntaxKind.OverrideKeyword */)); + result.push(createModifier(161 /* SyntaxKind.OverrideKeyword */)); if (flags & 64 /* ModifierFlags.Readonly */) - result.push(createModifier(145 /* SyntaxKind.ReadonlyKeyword */)); - if (flags & 256 /* ModifierFlags.Async */) - result.push(createModifier(131 /* SyntaxKind.AsyncKeyword */)); + result.push(createModifier(146 /* SyntaxKind.ReadonlyKeyword */)); + if (flags & 128 /* ModifierFlags.Accessor */) + result.push(createModifier(127 /* SyntaxKind.AccessorKeyword */)); + if (flags & 512 /* ModifierFlags.Async */) + result.push(createModifier(132 /* SyntaxKind.AsyncKeyword */)); if (flags & 32768 /* ModifierFlags.In */) result.push(createModifier(101 /* SyntaxKind.InKeyword */)); if (flags & 65536 /* ModifierFlags.Out */) - result.push(createModifier(144 /* SyntaxKind.OutKeyword */)); + result.push(createModifier(145 /* SyntaxKind.OutKeyword */)); return result.length ? result : undefined; } // @@ -23217,7 +23375,7 @@ var ts; // // @api function createQualifiedName(left, right) { - var node = createBaseNode(161 /* SyntaxKind.QualifiedName */); + var node = createBaseNode(163 /* SyntaxKind.QualifiedName */); node.left = left; node.right = asName(right); node.transformFlags |= @@ -23234,7 +23392,7 @@ var ts; } // @api function createComputedPropertyName(expression) { - var node = createBaseNode(162 /* SyntaxKind.ComputedPropertyName */); + var node = createBaseNode(164 /* SyntaxKind.ComputedPropertyName */); node.expression = parenthesizerRules().parenthesizeExpressionOfComputedPropertyName(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -23253,7 +23411,7 @@ var ts; // // @api function createTypeParameterDeclaration(modifiers, name, constraint, defaultType) { - var node = createBaseNamedDeclaration(163 /* SyntaxKind.TypeParameter */, modifiers, name); + var node = createBaseNamedDeclaration(165 /* SyntaxKind.TypeParameter */, modifiers, name); node.constraint = constraint; node.default = defaultType; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23270,7 +23428,7 @@ var ts; } // @api function createParameterDeclaration(modifiers, dotDotDotToken, name, questionToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(164 /* SyntaxKind.Parameter */, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); + var node = createBaseVariableLikeDeclaration(166 /* SyntaxKind.Parameter */, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.dotDotDotToken = dotDotDotToken; node.questionToken = questionToken; if (ts.isThisIdentifier(node.name)) { @@ -23302,7 +23460,7 @@ var ts; } // @api function createDecorator(expression) { - var node = createBaseNode(165 /* SyntaxKind.Decorator */); + var node = createBaseNode(167 /* SyntaxKind.Decorator */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.transformFlags |= propagateChildFlags(node.expression) | @@ -23322,7 +23480,7 @@ var ts; // // @api function createPropertySignature(modifiers, name, questionToken, type) { - var node = createBaseNamedDeclaration(166 /* SyntaxKind.PropertySignature */, modifiers, name); + var node = createBaseNamedDeclaration(168 /* SyntaxKind.PropertySignature */, modifiers, name); node.type = type; node.questionToken = questionToken; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23348,7 +23506,7 @@ var ts; } // @api function createPropertyDeclaration(modifiers, name, questionOrExclamationToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(167 /* SyntaxKind.PropertyDeclaration */, modifiers, name, type, initializer); + var node = createBaseVariableLikeDeclaration(169 /* SyntaxKind.PropertyDeclaration */, modifiers, name, type, initializer); node.questionToken = questionOrExclamationToken && ts.isQuestionToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.exclamationToken = questionOrExclamationToken && ts.isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.transformFlags |= @@ -23376,7 +23534,7 @@ var ts; } // @api function createMethodSignature(modifiers, name, questionToken, typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(168 /* SyntaxKind.MethodSignature */, modifiers, name, typeParameters, parameters, type); + var node = createBaseSignatureDeclaration(170 /* SyntaxKind.MethodSignature */, modifiers, name, typeParameters, parameters, type); node.questionToken = questionToken; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23394,7 +23552,7 @@ var ts; } // @api function createMethodDeclaration(modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(169 /* SyntaxKind.MethodDeclaration */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(171 /* SyntaxKind.MethodDeclaration */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; node.questionToken = questionToken; node.transformFlags |= @@ -23404,7 +23562,7 @@ var ts; if (questionToken) { node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; } - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -23440,7 +23598,7 @@ var ts; } // @api function createClassStaticBlockDeclaration(body) { - var node = createBaseGenericNamedDeclaration(170 /* SyntaxKind.ClassStaticBlockDeclaration */, + var node = createBaseGenericNamedDeclaration(172 /* SyntaxKind.ClassStaticBlockDeclaration */, /*modifiers*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined); @@ -23466,7 +23624,7 @@ var ts; } // @api function createConstructorDeclaration(modifiers, parameters, body) { - var node = createBaseFunctionLikeDeclaration(171 /* SyntaxKind.Constructor */, modifiers, + var node = createBaseFunctionLikeDeclaration(173 /* SyntaxKind.Constructor */, modifiers, /*name*/ undefined, /*typeParameters*/ undefined, parameters, /*type*/ undefined, body); @@ -23495,7 +23653,7 @@ var ts; } // @api function createGetAccessorDeclaration(modifiers, name, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(172 /* SyntaxKind.GetAccessor */, modifiers, name, + var node = createBaseFunctionLikeDeclaration(174 /* SyntaxKind.GetAccessor */, modifiers, name, /*typeParameters*/ undefined, parameters, type, body); // The following properties are used only to report grammar errors node.typeParameters = undefined; @@ -23519,7 +23677,7 @@ var ts; } // @api function createSetAccessorDeclaration(modifiers, name, parameters, body) { - var node = createBaseFunctionLikeDeclaration(173 /* SyntaxKind.SetAccessor */, modifiers, name, + var node = createBaseFunctionLikeDeclaration(175 /* SyntaxKind.SetAccessor */, modifiers, name, /*typeParameters*/ undefined, parameters, /*type*/ undefined, body); // The following properties are used only to report grammar errors @@ -23545,7 +23703,7 @@ var ts; } // @api function createCallSignature(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(174 /* SyntaxKind.CallSignature */, + var node = createBaseSignatureDeclaration(176 /* SyntaxKind.CallSignature */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23561,7 +23719,7 @@ var ts; } // @api function createConstructSignature(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(175 /* SyntaxKind.ConstructSignature */, + var node = createBaseSignatureDeclaration(177 /* SyntaxKind.ConstructSignature */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23577,7 +23735,7 @@ var ts; } // @api function createIndexSignature(modifiers, parameters, type) { - var node = createBaseSignatureDeclaration(176 /* SyntaxKind.IndexSignature */, modifiers, + var node = createBaseSignatureDeclaration(178 /* SyntaxKind.IndexSignature */, modifiers, /*name*/ undefined, /*typeParameters*/ undefined, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23593,7 +23751,7 @@ var ts; } // @api function createTemplateLiteralTypeSpan(type, literal) { - var node = createBaseNode(199 /* SyntaxKind.TemplateLiteralTypeSpan */); + var node = createBaseNode(201 /* SyntaxKind.TemplateLiteralTypeSpan */); node.type = type; node.literal = literal; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23615,7 +23773,7 @@ var ts; } // @api function createTypePredicateNode(assertsModifier, parameterName, type) { - var node = createBaseNode(177 /* SyntaxKind.TypePredicate */); + var node = createBaseNode(179 /* SyntaxKind.TypePredicate */); node.assertsModifier = assertsModifier; node.parameterName = asName(parameterName); node.type = type; @@ -23632,7 +23790,7 @@ var ts; } // @api function createTypeReferenceNode(typeName, typeArguments) { - var node = createBaseNode(178 /* SyntaxKind.TypeReference */); + var node = createBaseNode(180 /* SyntaxKind.TypeReference */); node.typeName = asName(typeName); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(createNodeArray(typeArguments)); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23647,7 +23805,7 @@ var ts; } // @api function createFunctionTypeNode(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(179 /* SyntaxKind.FunctionType */, + var node = createBaseSignatureDeclaration(181 /* SyntaxKind.FunctionType */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23680,7 +23838,7 @@ var ts; ts.Debug.fail("Incorrect number of arguments specified."); } function createConstructorTypeNode1(modifiers, typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(180 /* SyntaxKind.ConstructorType */, modifiers, + var node = createBaseSignatureDeclaration(182 /* SyntaxKind.ConstructorType */, modifiers, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23713,7 +23871,7 @@ var ts; } // @api function createTypeQueryNode(exprName, typeArguments) { - var node = createBaseNode(181 /* SyntaxKind.TypeQuery */); + var node = createBaseNode(183 /* SyntaxKind.TypeQuery */); node.exprName = exprName; node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23728,7 +23886,7 @@ var ts; } // @api function createTypeLiteralNode(members) { - var node = createBaseNode(182 /* SyntaxKind.TypeLiteral */); + var node = createBaseNode(184 /* SyntaxKind.TypeLiteral */); node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23741,7 +23899,7 @@ var ts; } // @api function createArrayTypeNode(elementType) { - var node = createBaseNode(183 /* SyntaxKind.ArrayType */); + var node = createBaseNode(185 /* SyntaxKind.ArrayType */); node.elementType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(elementType); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23754,7 +23912,7 @@ var ts; } // @api function createTupleTypeNode(elements) { - var node = createBaseNode(184 /* SyntaxKind.TupleType */); + var node = createBaseNode(186 /* SyntaxKind.TupleType */); node.elements = createNodeArray(parenthesizerRules().parenthesizeElementTypesOfTupleType(elements)); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23767,7 +23925,7 @@ var ts; } // @api function createNamedTupleMember(dotDotDotToken, name, questionToken, type) { - var node = createBaseNode(197 /* SyntaxKind.NamedTupleMember */); + var node = createBaseNode(199 /* SyntaxKind.NamedTupleMember */); node.dotDotDotToken = dotDotDotToken; node.name = name; node.questionToken = questionToken; @@ -23786,7 +23944,7 @@ var ts; } // @api function createOptionalTypeNode(type) { - var node = createBaseNode(185 /* SyntaxKind.OptionalType */); + var node = createBaseNode(187 /* SyntaxKind.OptionalType */); node.type = parenthesizerRules().parenthesizeTypeOfOptionalType(type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23799,7 +23957,7 @@ var ts; } // @api function createRestTypeNode(type) { - var node = createBaseNode(186 /* SyntaxKind.RestType */); + var node = createBaseNode(188 /* SyntaxKind.RestType */); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23823,7 +23981,7 @@ var ts; } // @api function createUnionTypeNode(types) { - return createUnionOrIntersectionTypeNode(187 /* SyntaxKind.UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); + return createUnionOrIntersectionTypeNode(189 /* SyntaxKind.UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); } // @api function updateUnionTypeNode(node, types) { @@ -23831,7 +23989,7 @@ var ts; } // @api function createIntersectionTypeNode(types) { - return createUnionOrIntersectionTypeNode(188 /* SyntaxKind.IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); + return createUnionOrIntersectionTypeNode(190 /* SyntaxKind.IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); } // @api function updateIntersectionTypeNode(node, types) { @@ -23839,7 +23997,7 @@ var ts; } // @api function createConditionalTypeNode(checkType, extendsType, trueType, falseType) { - var node = createBaseNode(189 /* SyntaxKind.ConditionalType */); + var node = createBaseNode(191 /* SyntaxKind.ConditionalType */); node.checkType = parenthesizerRules().parenthesizeCheckTypeOfConditionalType(checkType); node.extendsType = parenthesizerRules().parenthesizeExtendsTypeOfConditionalType(extendsType); node.trueType = trueType; @@ -23858,7 +24016,7 @@ var ts; } // @api function createInferTypeNode(typeParameter) { - var node = createBaseNode(190 /* SyntaxKind.InferType */); + var node = createBaseNode(192 /* SyntaxKind.InferType */); node.typeParameter = typeParameter; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23871,7 +24029,7 @@ var ts; } // @api function createTemplateLiteralType(head, templateSpans) { - var node = createBaseNode(198 /* SyntaxKind.TemplateLiteralType */); + var node = createBaseNode(200 /* SyntaxKind.TemplateLiteralType */); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23887,7 +24045,7 @@ var ts; // @api function createImportTypeNode(argument, assertions, qualifier, typeArguments, isTypeOf) { if (isTypeOf === void 0) { isTypeOf = false; } - var node = createBaseNode(200 /* SyntaxKind.ImportType */); + var node = createBaseNode(202 /* SyntaxKind.ImportType */); node.argument = argument; node.assertions = assertions; node.qualifier = qualifier; @@ -23909,7 +24067,7 @@ var ts; } // @api function createParenthesizedType(type) { - var node = createBaseNode(191 /* SyntaxKind.ParenthesizedType */); + var node = createBaseNode(193 /* SyntaxKind.ParenthesizedType */); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23922,15 +24080,15 @@ var ts; } // @api function createThisTypeNode() { - var node = createBaseNode(192 /* SyntaxKind.ThisType */); + var node = createBaseNode(194 /* SyntaxKind.ThisType */); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; } // @api function createTypeOperatorNode(operator, type) { - var node = createBaseNode(193 /* SyntaxKind.TypeOperator */); + var node = createBaseNode(195 /* SyntaxKind.TypeOperator */); node.operator = operator; - node.type = operator === 145 /* SyntaxKind.ReadonlyKeyword */ ? + node.type = operator === 146 /* SyntaxKind.ReadonlyKeyword */ ? parenthesizerRules().parenthesizeOperandOfReadonlyTypeOperator(type) : parenthesizerRules().parenthesizeOperandOfTypeOperator(type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23944,7 +24102,7 @@ var ts; } // @api function createIndexedAccessTypeNode(objectType, indexType) { - var node = createBaseNode(194 /* SyntaxKind.IndexedAccessType */); + var node = createBaseNode(196 /* SyntaxKind.IndexedAccessType */); node.objectType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(objectType); node.indexType = indexType; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23959,7 +24117,7 @@ var ts; } // @api function createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members) { - var node = createBaseNode(195 /* SyntaxKind.MappedType */); + var node = createBaseNode(197 /* SyntaxKind.MappedType */); node.readonlyToken = readonlyToken; node.typeParameter = typeParameter; node.nameType = nameType; @@ -23982,7 +24140,7 @@ var ts; } // @api function createLiteralTypeNode(literal) { - var node = createBaseNode(196 /* SyntaxKind.LiteralType */); + var node = createBaseNode(198 /* SyntaxKind.LiteralType */); node.literal = literal; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23998,7 +24156,7 @@ var ts; // // @api function createObjectBindingPattern(elements) { - var node = createBaseNode(201 /* SyntaxKind.ObjectBindingPattern */); + var node = createBaseNode(203 /* SyntaxKind.ObjectBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | @@ -24019,7 +24177,7 @@ var ts; } // @api function createArrayBindingPattern(elements) { - var node = createBaseNode(202 /* SyntaxKind.ArrayBindingPattern */); + var node = createBaseNode(204 /* SyntaxKind.ArrayBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | @@ -24035,7 +24193,7 @@ var ts; } // @api function createBindingElement(dotDotDotToken, propertyName, name, initializer) { - var node = createBaseBindingLikeDeclaration(203 /* SyntaxKind.BindingElement */, + var node = createBaseBindingLikeDeclaration(205 /* SyntaxKind.BindingElement */, /*modifiers*/ undefined, name, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.propertyName = asName(propertyName); node.dotDotDotToken = dotDotDotToken; @@ -24070,7 +24228,7 @@ var ts; } // @api function createArrayLiteralExpression(elements, multiLine) { - var node = createBaseExpression(204 /* SyntaxKind.ArrayLiteralExpression */); + var node = createBaseExpression(206 /* SyntaxKind.ArrayLiteralExpression */); // Ensure we add a trailing comma for something like `[NumericLiteral(1), NumericLiteral(2), OmittedExpresion]` so that // we end up with `[1, 2, ,]` instead of `[1, 2, ]` otherwise the `OmittedExpression` will just end up being treated like // a trailing comma. @@ -24089,7 +24247,7 @@ var ts; } // @api function createObjectLiteralExpression(properties, multiLine) { - var node = createBaseExpression(205 /* SyntaxKind.ObjectLiteralExpression */); + var node = createBaseExpression(207 /* SyntaxKind.ObjectLiteralExpression */); node.properties = createNodeArray(properties); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.properties); @@ -24103,7 +24261,7 @@ var ts; } // @api function createPropertyAccessExpression(expression, name) { - var node = createBaseExpression(206 /* SyntaxKind.PropertyAccessExpression */); + var node = createBaseExpression(208 /* SyntaxKind.PropertyAccessExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.name = asName(name); node.transformFlags = @@ -24132,7 +24290,7 @@ var ts; } // @api function createPropertyAccessChain(expression, questionDotToken, name) { - var node = createBaseExpression(206 /* SyntaxKind.PropertyAccessExpression */); + var node = createBaseExpression(208 /* SyntaxKind.PropertyAccessExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24159,7 +24317,7 @@ var ts; } // @api function createElementAccessExpression(expression, index) { - var node = createBaseExpression(207 /* SyntaxKind.ElementAccessExpression */); + var node = createBaseExpression(209 /* SyntaxKind.ElementAccessExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.argumentExpression = asExpression(index); node.transformFlags |= @@ -24186,7 +24344,7 @@ var ts; } // @api function createElementAccessChain(expression, questionDotToken, index) { - var node = createBaseExpression(207 /* SyntaxKind.ElementAccessExpression */); + var node = createBaseExpression(209 /* SyntaxKind.ElementAccessExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24211,7 +24369,7 @@ var ts; } // @api function createCallExpression(expression, typeArguments, argumentsArray) { - var node = createBaseExpression(208 /* SyntaxKind.CallExpression */); + var node = createBaseExpression(210 /* SyntaxKind.CallExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.typeArguments = asNodeArray(typeArguments); node.arguments = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(createNodeArray(argumentsArray)); @@ -24243,7 +24401,7 @@ var ts; } // @api function createCallChain(expression, questionDotToken, typeArguments, argumentsArray) { - var node = createBaseExpression(208 /* SyntaxKind.CallExpression */); + var node = createBaseExpression(210 /* SyntaxKind.CallExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24275,7 +24433,7 @@ var ts; } // @api function createNewExpression(expression, typeArguments, argumentsArray) { - var node = createBaseExpression(209 /* SyntaxKind.NewExpression */); + var node = createBaseExpression(211 /* SyntaxKind.NewExpression */); node.expression = parenthesizerRules().parenthesizeExpressionOfNew(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = argumentsArray ? parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(argumentsArray) : undefined; @@ -24299,7 +24457,7 @@ var ts; } // @api function createTaggedTemplateExpression(tag, typeArguments, template) { - var node = createBaseExpression(210 /* SyntaxKind.TaggedTemplateExpression */); + var node = createBaseExpression(212 /* SyntaxKind.TaggedTemplateExpression */); node.tag = parenthesizerRules().parenthesizeLeftSideOfAccess(tag, /*optionalChain*/ false); node.typeArguments = asNodeArray(typeArguments); node.template = template; @@ -24326,7 +24484,7 @@ var ts; } // @api function createTypeAssertion(type, expression) { - var node = createBaseExpression(211 /* SyntaxKind.TypeAssertionExpression */); + var node = createBaseExpression(213 /* SyntaxKind.TypeAssertionExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.type = type; node.transformFlags |= @@ -24344,7 +24502,7 @@ var ts; } // @api function createParenthesizedExpression(expression) { - var node = createBaseExpression(212 /* SyntaxKind.ParenthesizedExpression */); + var node = createBaseExpression(214 /* SyntaxKind.ParenthesizedExpression */); node.expression = expression; node.transformFlags = propagateChildFlags(node.expression); return node; @@ -24357,13 +24515,13 @@ var ts; } // @api function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(213 /* SyntaxKind.FunctionExpression */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(215 /* SyntaxKind.FunctionExpression */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; node.transformFlags |= propagateChildFlags(node.asteriskToken); if (node.typeParameters) { node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; } - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (node.asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -24390,13 +24548,13 @@ var ts; } // @api function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { - var node = createBaseFunctionLikeDeclaration(214 /* SyntaxKind.ArrowFunction */, modifiers, + var node = createBaseFunctionLikeDeclaration(216 /* SyntaxKind.ArrowFunction */, modifiers, /*name*/ undefined, typeParameters, parameters, type, parenthesizerRules().parenthesizeConciseBodyOfArrowFunction(body)); node.equalsGreaterThanToken = equalsGreaterThanToken !== null && equalsGreaterThanToken !== void 0 ? equalsGreaterThanToken : createToken(38 /* SyntaxKind.EqualsGreaterThanToken */); node.transformFlags |= propagateChildFlags(node.equalsGreaterThanToken) | 1024 /* TransformFlags.ContainsES2015 */; - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { node.transformFlags |= 256 /* TransformFlags.ContainsES2017 */ | 16384 /* TransformFlags.ContainsLexicalThis */; } return node; @@ -24414,7 +24572,7 @@ var ts; } // @api function createDeleteExpression(expression) { - var node = createBaseExpression(215 /* SyntaxKind.DeleteExpression */); + var node = createBaseExpression(217 /* SyntaxKind.DeleteExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24427,7 +24585,7 @@ var ts; } // @api function createTypeOfExpression(expression) { - var node = createBaseExpression(216 /* SyntaxKind.TypeOfExpression */); + var node = createBaseExpression(218 /* SyntaxKind.TypeOfExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24440,7 +24598,7 @@ var ts; } // @api function createVoidExpression(expression) { - var node = createBaseExpression(217 /* SyntaxKind.VoidExpression */); + var node = createBaseExpression(219 /* SyntaxKind.VoidExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24453,7 +24611,7 @@ var ts; } // @api function createAwaitExpression(expression) { - var node = createBaseExpression(218 /* SyntaxKind.AwaitExpression */); + var node = createBaseExpression(220 /* SyntaxKind.AwaitExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24470,7 +24628,7 @@ var ts; } // @api function createPrefixUnaryExpression(operator, operand) { - var node = createBaseExpression(219 /* SyntaxKind.PrefixUnaryExpression */); + var node = createBaseExpression(221 /* SyntaxKind.PrefixUnaryExpression */); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPrefixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -24492,7 +24650,7 @@ var ts; } // @api function createPostfixUnaryExpression(operand, operator) { - var node = createBaseExpression(220 /* SyntaxKind.PostfixUnaryExpression */); + var node = createBaseExpression(222 /* SyntaxKind.PostfixUnaryExpression */); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPostfixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -24513,7 +24671,7 @@ var ts; } // @api function createBinaryExpression(left, operator, right) { - var node = createBaseExpression(221 /* SyntaxKind.BinaryExpression */); + var node = createBaseExpression(223 /* SyntaxKind.BinaryExpression */); var operatorToken = asToken(operator); var operatorKind = operatorToken.kind; node.left = parenthesizerRules().parenthesizeLeftSideOfBinary(operatorKind, left); @@ -24585,7 +24743,7 @@ var ts; } // @api function createConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse) { - var node = createBaseExpression(222 /* SyntaxKind.ConditionalExpression */); + var node = createBaseExpression(224 /* SyntaxKind.ConditionalExpression */); node.condition = parenthesizerRules().parenthesizeConditionOfConditionalExpression(condition); node.questionToken = questionToken !== null && questionToken !== void 0 ? questionToken : createToken(57 /* SyntaxKind.QuestionToken */); node.whenTrue = parenthesizerRules().parenthesizeBranchOfConditionalExpression(whenTrue); @@ -24611,7 +24769,7 @@ var ts; } // @api function createTemplateExpression(head, templateSpans) { - var node = createBaseExpression(223 /* SyntaxKind.TemplateExpression */); + var node = createBaseExpression(225 /* SyntaxKind.TemplateExpression */); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags |= @@ -24681,7 +24839,7 @@ var ts; // @api function createYieldExpression(asteriskToken, expression) { ts.Debug.assert(!asteriskToken || !!expression, "A `YieldExpression` with an asteriskToken must have an expression."); - var node = createBaseExpression(224 /* SyntaxKind.YieldExpression */); + var node = createBaseExpression(226 /* SyntaxKind.YieldExpression */); node.expression = expression && parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.asteriskToken = asteriskToken; node.transformFlags |= @@ -24701,7 +24859,7 @@ var ts; } // @api function createSpreadElement(expression) { - var node = createBaseExpression(225 /* SyntaxKind.SpreadElement */); + var node = createBaseExpression(227 /* SyntaxKind.SpreadElement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24717,7 +24875,7 @@ var ts; } // @api function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseClassLikeDeclaration(226 /* SyntaxKind.ClassExpression */, modifiers, name, typeParameters, heritageClauses, members); + var node = createBaseClassLikeDeclaration(228 /* SyntaxKind.ClassExpression */, modifiers, name, typeParameters, heritageClauses, members); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; return node; } @@ -24733,11 +24891,11 @@ var ts; } // @api function createOmittedExpression() { - return createBaseExpression(227 /* SyntaxKind.OmittedExpression */); + return createBaseExpression(229 /* SyntaxKind.OmittedExpression */); } // @api function createExpressionWithTypeArguments(expression, typeArguments) { - var node = createBaseNode(228 /* SyntaxKind.ExpressionWithTypeArguments */); + var node = createBaseNode(230 /* SyntaxKind.ExpressionWithTypeArguments */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags |= @@ -24755,7 +24913,7 @@ var ts; } // @api function createAsExpression(expression, type) { - var node = createBaseExpression(229 /* SyntaxKind.AsExpression */); + var node = createBaseExpression(231 /* SyntaxKind.AsExpression */); node.expression = expression; node.type = type; node.transformFlags |= @@ -24773,7 +24931,7 @@ var ts; } // @api function createNonNullExpression(expression) { - var node = createBaseExpression(230 /* SyntaxKind.NonNullExpression */); + var node = createBaseExpression(232 /* SyntaxKind.NonNullExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24790,8 +24948,26 @@ var ts; : node; } // @api + function createSatisfiesExpression(expression, type) { + var node = createBaseExpression(235 /* SyntaxKind.SatisfiesExpression */); + node.expression = expression; + node.type = type; + node.transformFlags |= + propagateChildFlags(node.expression) | + propagateChildFlags(node.type) | + 1 /* TransformFlags.ContainsTypeScript */; + return node; + } + // @api + function updateSatisfiesExpression(node, expression, type) { + return node.expression !== expression + || node.type !== type + ? update(createSatisfiesExpression(expression, type), node) + : node; + } + // @api function createNonNullChain(expression) { - var node = createBaseExpression(230 /* SyntaxKind.NonNullExpression */); + var node = createBaseExpression(232 /* SyntaxKind.NonNullExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.transformFlags |= @@ -24808,7 +24984,7 @@ var ts; } // @api function createMetaProperty(keywordToken, name) { - var node = createBaseExpression(231 /* SyntaxKind.MetaProperty */); + var node = createBaseExpression(233 /* SyntaxKind.MetaProperty */); node.keywordToken = keywordToken; node.name = name; node.transformFlags |= propagateChildFlags(node.name); @@ -24835,7 +25011,7 @@ var ts; // // @api function createTemplateSpan(expression, literal) { - var node = createBaseNode(233 /* SyntaxKind.TemplateSpan */); + var node = createBaseNode(236 /* SyntaxKind.TemplateSpan */); node.expression = expression; node.literal = literal; node.transformFlags |= @@ -24853,7 +25029,7 @@ var ts; } // @api function createSemicolonClassElement() { - var node = createBaseNode(234 /* SyntaxKind.SemicolonClassElement */); + var node = createBaseNode(237 /* SyntaxKind.SemicolonClassElement */); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; return node; } @@ -24862,7 +25038,7 @@ var ts; // // @api function createBlock(statements, multiLine) { - var node = createBaseNode(235 /* SyntaxKind.Block */); + var node = createBaseNode(238 /* SyntaxKind.Block */); node.statements = createNodeArray(statements); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.statements); @@ -24876,7 +25052,7 @@ var ts; } // @api function createVariableStatement(modifiers, declarationList) { - var node = createBaseDeclaration(237 /* SyntaxKind.VariableStatement */); + var node = createBaseDeclaration(240 /* SyntaxKind.VariableStatement */); node.modifiers = asNodeArray(modifiers); node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; node.transformFlags |= @@ -24896,11 +25072,11 @@ var ts; } // @api function createEmptyStatement() { - return createBaseNode(236 /* SyntaxKind.EmptyStatement */); + return createBaseNode(239 /* SyntaxKind.EmptyStatement */); } // @api function createExpressionStatement(expression) { - var node = createBaseNode(238 /* SyntaxKind.ExpressionStatement */); + var node = createBaseNode(241 /* SyntaxKind.ExpressionStatement */); node.expression = parenthesizerRules().parenthesizeExpressionOfExpressionStatement(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24913,7 +25089,7 @@ var ts; } // @api function createIfStatement(expression, thenStatement, elseStatement) { - var node = createBaseNode(239 /* SyntaxKind.IfStatement */); + var node = createBaseNode(242 /* SyntaxKind.IfStatement */); node.expression = expression; node.thenStatement = asEmbeddedStatement(thenStatement); node.elseStatement = asEmbeddedStatement(elseStatement); @@ -24933,7 +25109,7 @@ var ts; } // @api function createDoStatement(statement, expression) { - var node = createBaseNode(240 /* SyntaxKind.DoStatement */); + var node = createBaseNode(243 /* SyntaxKind.DoStatement */); node.statement = asEmbeddedStatement(statement); node.expression = expression; node.transformFlags |= @@ -24950,7 +25126,7 @@ var ts; } // @api function createWhileStatement(expression, statement) { - var node = createBaseNode(241 /* SyntaxKind.WhileStatement */); + var node = createBaseNode(244 /* SyntaxKind.WhileStatement */); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -24967,7 +25143,7 @@ var ts; } // @api function createForStatement(initializer, condition, incrementor, statement) { - var node = createBaseNode(242 /* SyntaxKind.ForStatement */); + var node = createBaseNode(245 /* SyntaxKind.ForStatement */); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -24990,7 +25166,7 @@ var ts; } // @api function createForInStatement(initializer, expression, statement) { - var node = createBaseNode(243 /* SyntaxKind.ForInStatement */); + var node = createBaseNode(246 /* SyntaxKind.ForInStatement */); node.initializer = initializer; node.expression = expression; node.statement = asEmbeddedStatement(statement); @@ -25010,7 +25186,7 @@ var ts; } // @api function createForOfStatement(awaitModifier, initializer, expression, statement) { - var node = createBaseNode(244 /* SyntaxKind.ForOfStatement */); + var node = createBaseNode(247 /* SyntaxKind.ForOfStatement */); node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); @@ -25036,7 +25212,7 @@ var ts; } // @api function createContinueStatement(label) { - var node = createBaseNode(245 /* SyntaxKind.ContinueStatement */); + var node = createBaseNode(248 /* SyntaxKind.ContinueStatement */); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | @@ -25051,7 +25227,7 @@ var ts; } // @api function createBreakStatement(label) { - var node = createBaseNode(246 /* SyntaxKind.BreakStatement */); + var node = createBaseNode(249 /* SyntaxKind.BreakStatement */); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | @@ -25066,7 +25242,7 @@ var ts; } // @api function createReturnStatement(expression) { - var node = createBaseNode(247 /* SyntaxKind.ReturnStatement */); + var node = createBaseNode(250 /* SyntaxKind.ReturnStatement */); node.expression = expression; // return in an ES2018 async generator must be awaited node.transformFlags |= @@ -25083,7 +25259,7 @@ var ts; } // @api function createWithStatement(expression, statement) { - var node = createBaseNode(248 /* SyntaxKind.WithStatement */); + var node = createBaseNode(251 /* SyntaxKind.WithStatement */); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -25100,7 +25276,7 @@ var ts; } // @api function createSwitchStatement(expression, caseBlock) { - var node = createBaseNode(249 /* SyntaxKind.SwitchStatement */); + var node = createBaseNode(252 /* SyntaxKind.SwitchStatement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.caseBlock = caseBlock; node.transformFlags |= @@ -25117,7 +25293,7 @@ var ts; } // @api function createLabeledStatement(label, statement) { - var node = createBaseNode(250 /* SyntaxKind.LabeledStatement */); + var node = createBaseNode(253 /* SyntaxKind.LabeledStatement */); node.label = asName(label); node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -25134,7 +25310,7 @@ var ts; } // @api function createThrowStatement(expression) { - var node = createBaseNode(251 /* SyntaxKind.ThrowStatement */); + var node = createBaseNode(254 /* SyntaxKind.ThrowStatement */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -25147,7 +25323,7 @@ var ts; } // @api function createTryStatement(tryBlock, catchClause, finallyBlock) { - var node = createBaseNode(252 /* SyntaxKind.TryStatement */); + var node = createBaseNode(255 /* SyntaxKind.TryStatement */); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -25167,11 +25343,11 @@ var ts; } // @api function createDebuggerStatement() { - return createBaseNode(253 /* SyntaxKind.DebuggerStatement */); + return createBaseNode(256 /* SyntaxKind.DebuggerStatement */); } // @api function createVariableDeclaration(name, exclamationToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(254 /* SyntaxKind.VariableDeclaration */, + var node = createBaseVariableLikeDeclaration(257 /* SyntaxKind.VariableDeclaration */, /*modifiers*/ undefined, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.exclamationToken = exclamationToken; node.transformFlags |= propagateChildFlags(node.exclamationToken); @@ -25192,7 +25368,7 @@ var ts; // @api function createVariableDeclarationList(declarations, flags) { if (flags === void 0) { flags = 0 /* NodeFlags.None */; } - var node = createBaseNode(255 /* SyntaxKind.VariableDeclarationList */); + var node = createBaseNode(258 /* SyntaxKind.VariableDeclarationList */); node.flags |= flags & 3 /* NodeFlags.BlockScoped */; node.declarations = createNodeArray(declarations); node.transformFlags |= @@ -25213,7 +25389,7 @@ var ts; } // @api function createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(256 /* SyntaxKind.FunctionDeclaration */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(259 /* SyntaxKind.FunctionDeclaration */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; if (!node.body || ts.modifiersToFlags(node.modifiers) & 2 /* ModifierFlags.Ambient */) { node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -25222,7 +25398,7 @@ var ts; node.transformFlags |= propagateChildFlags(node.asteriskToken) | 4194304 /* TransformFlags.ContainsHoistedDeclarationOrCompletion */; - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (node.asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -25259,7 +25435,7 @@ var ts; } // @api function createClassDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseClassLikeDeclaration(257 /* SyntaxKind.ClassDeclaration */, modifiers, name, typeParameters, heritageClauses, members); + var node = createBaseClassLikeDeclaration(260 /* SyntaxKind.ClassDeclaration */, modifiers, name, typeParameters, heritageClauses, members); if (ts.modifiersToFlags(node.modifiers) & 2 /* ModifierFlags.Ambient */) { node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; } @@ -25283,7 +25459,7 @@ var ts; } // @api function createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseInterfaceOrClassLikeDeclaration(258 /* SyntaxKind.InterfaceDeclaration */, modifiers, name, typeParameters, heritageClauses); + var node = createBaseInterfaceOrClassLikeDeclaration(261 /* SyntaxKind.InterfaceDeclaration */, modifiers, name, typeParameters, heritageClauses); node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25308,7 +25484,7 @@ var ts; } // @api function createTypeAliasDeclaration(modifiers, name, typeParameters, type) { - var node = createBaseGenericNamedDeclaration(259 /* SyntaxKind.TypeAliasDeclaration */, modifiers, name, typeParameters); + var node = createBaseGenericNamedDeclaration(262 /* SyntaxKind.TypeAliasDeclaration */, modifiers, name, typeParameters); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25332,7 +25508,7 @@ var ts; } // @api function createEnumDeclaration(modifiers, name, members) { - var node = createBaseNamedDeclaration(260 /* SyntaxKind.EnumDeclaration */, modifiers, name); + var node = createBaseNamedDeclaration(263 /* SyntaxKind.EnumDeclaration */, modifiers, name); node.members = createNodeArray(members); node.transformFlags |= propagateChildrenFlags(node.members) | @@ -25359,7 +25535,7 @@ var ts; // @api function createModuleDeclaration(modifiers, name, body, flags) { if (flags === void 0) { flags = 0 /* NodeFlags.None */; } - var node = createBaseDeclaration(261 /* SyntaxKind.ModuleDeclaration */); + var node = createBaseDeclaration(264 /* SyntaxKind.ModuleDeclaration */); node.modifiers = asNodeArray(modifiers); node.flags |= flags & (16 /* NodeFlags.Namespace */ | 4 /* NodeFlags.NestedNamespace */ | 1024 /* NodeFlags.GlobalAugmentation */); node.name = name; @@ -25395,7 +25571,7 @@ var ts; } // @api function createModuleBlock(statements) { - var node = createBaseNode(262 /* SyntaxKind.ModuleBlock */); + var node = createBaseNode(265 /* SyntaxKind.ModuleBlock */); node.statements = createNodeArray(statements); node.transformFlags |= propagateChildrenFlags(node.statements); return node; @@ -25408,7 +25584,7 @@ var ts; } // @api function createCaseBlock(clauses) { - var node = createBaseNode(263 /* SyntaxKind.CaseBlock */); + var node = createBaseNode(266 /* SyntaxKind.CaseBlock */); node.clauses = createNodeArray(clauses); node.transformFlags |= propagateChildrenFlags(node.clauses); return node; @@ -25421,7 +25597,7 @@ var ts; } // @api function createNamespaceExportDeclaration(name) { - var node = createBaseNamedDeclaration(264 /* SyntaxKind.NamespaceExportDeclaration */, + var node = createBaseNamedDeclaration(267 /* SyntaxKind.NamespaceExportDeclaration */, /*modifiers*/ undefined, name); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25444,7 +25620,7 @@ var ts; } // @api function createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference) { - var node = createBaseNamedDeclaration(265 /* SyntaxKind.ImportEqualsDeclaration */, modifiers, name); + var node = createBaseNamedDeclaration(268 /* SyntaxKind.ImportEqualsDeclaration */, modifiers, name); node.isTypeOnly = isTypeOnly; node.moduleReference = moduleReference; node.transformFlags |= propagateChildFlags(node.moduleReference); @@ -25472,7 +25648,7 @@ var ts; } // @api function createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause) { - var node = createBaseDeclaration(266 /* SyntaxKind.ImportDeclaration */); + var node = createBaseDeclaration(269 /* SyntaxKind.ImportDeclaration */); node.modifiers = asNodeArray(modifiers); node.importClause = importClause; node.moduleSpecifier = moduleSpecifier; @@ -25502,7 +25678,7 @@ var ts; } // @api function createImportClause(isTypeOnly, name, namedBindings) { - var node = createBaseNode(267 /* SyntaxKind.ImportClause */); + var node = createBaseNode(270 /* SyntaxKind.ImportClause */); node.isTypeOnly = isTypeOnly; node.name = name; node.namedBindings = namedBindings; @@ -25525,7 +25701,7 @@ var ts; } // @api function createAssertClause(elements, multiLine) { - var node = createBaseNode(293 /* SyntaxKind.AssertClause */); + var node = createBaseNode(296 /* SyntaxKind.AssertClause */); node.elements = createNodeArray(elements); node.multiLine = multiLine; node.transformFlags |= 4 /* TransformFlags.ContainsESNext */; @@ -25540,7 +25716,7 @@ var ts; } // @api function createAssertEntry(name, value) { - var node = createBaseNode(294 /* SyntaxKind.AssertEntry */); + var node = createBaseNode(297 /* SyntaxKind.AssertEntry */); node.name = name; node.value = value; node.transformFlags |= 4 /* TransformFlags.ContainsESNext */; @@ -25555,7 +25731,7 @@ var ts; } // @api function createImportTypeAssertionContainer(clause, multiLine) { - var node = createBaseNode(295 /* SyntaxKind.ImportTypeAssertionContainer */); + var node = createBaseNode(298 /* SyntaxKind.ImportTypeAssertionContainer */); node.assertClause = clause; node.multiLine = multiLine; return node; @@ -25569,7 +25745,7 @@ var ts; } // @api function createNamespaceImport(name) { - var node = createBaseNode(268 /* SyntaxKind.NamespaceImport */); + var node = createBaseNode(271 /* SyntaxKind.NamespaceImport */); node.name = name; node.transformFlags |= propagateChildFlags(node.name); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25583,7 +25759,7 @@ var ts; } // @api function createNamespaceExport(name) { - var node = createBaseNode(274 /* SyntaxKind.NamespaceExport */); + var node = createBaseNode(277 /* SyntaxKind.NamespaceExport */); node.name = name; node.transformFlags |= propagateChildFlags(node.name) | @@ -25599,7 +25775,7 @@ var ts; } // @api function createNamedImports(elements) { - var node = createBaseNode(269 /* SyntaxKind.NamedImports */); + var node = createBaseNode(272 /* SyntaxKind.NamedImports */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25613,7 +25789,7 @@ var ts; } // @api function createImportSpecifier(isTypeOnly, propertyName, name) { - var node = createBaseNode(270 /* SyntaxKind.ImportSpecifier */); + var node = createBaseNode(273 /* SyntaxKind.ImportSpecifier */); node.isTypeOnly = isTypeOnly; node.propertyName = propertyName; node.name = name; @@ -25633,7 +25809,7 @@ var ts; } // @api function createExportAssignment(modifiers, isExportEquals, expression) { - var node = createBaseDeclaration(271 /* SyntaxKind.ExportAssignment */); + var node = createBaseDeclaration(274 /* SyntaxKind.ExportAssignment */); node.modifiers = asNodeArray(modifiers); node.isExportEquals = isExportEquals; node.expression = isExportEquals @@ -25660,7 +25836,7 @@ var ts; } // @api function createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause) { - var node = createBaseDeclaration(272 /* SyntaxKind.ExportDeclaration */); + var node = createBaseDeclaration(275 /* SyntaxKind.ExportDeclaration */); node.modifiers = asNodeArray(modifiers); node.isTypeOnly = isTypeOnly; node.exportClause = exportClause; @@ -25693,7 +25869,7 @@ var ts; } // @api function createNamedExports(elements) { - var node = createBaseNode(273 /* SyntaxKind.NamedExports */); + var node = createBaseNode(276 /* SyntaxKind.NamedExports */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25707,7 +25883,7 @@ var ts; } // @api function createExportSpecifier(isTypeOnly, propertyName, name) { - var node = createBaseNode(275 /* SyntaxKind.ExportSpecifier */); + var node = createBaseNode(278 /* SyntaxKind.ExportSpecifier */); node.isTypeOnly = isTypeOnly; node.propertyName = asName(propertyName); node.name = asName(name); @@ -25727,7 +25903,7 @@ var ts; } // @api function createMissingDeclaration() { - var node = createBaseDeclaration(276 /* SyntaxKind.MissingDeclaration */); + var node = createBaseDeclaration(279 /* SyntaxKind.MissingDeclaration */); return node; } // @@ -25735,7 +25911,7 @@ var ts; // // @api function createExternalModuleReference(expression) { - var node = createBaseNode(277 /* SyntaxKind.ExternalModuleReference */); + var node = createBaseNode(280 /* SyntaxKind.ExternalModuleReference */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25793,7 +25969,7 @@ var ts; } // @api function createJSDocFunctionType(parameters, type) { - var node = createBaseSignatureDeclaration(317 /* SyntaxKind.JSDocFunctionType */, + var node = createBaseSignatureDeclaration(320 /* SyntaxKind.JSDocFunctionType */, /*modifiers*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined, parameters, type); @@ -25809,7 +25985,7 @@ var ts; // @api function createJSDocTypeLiteral(propertyTags, isArrayType) { if (isArrayType === void 0) { isArrayType = false; } - var node = createBaseNode(322 /* SyntaxKind.JSDocTypeLiteral */); + var node = createBaseNode(325 /* SyntaxKind.JSDocTypeLiteral */); node.jsDocPropertyTags = asNodeArray(propertyTags); node.isArrayType = isArrayType; return node; @@ -25823,7 +25999,7 @@ var ts; } // @api function createJSDocTypeExpression(type) { - var node = createBaseNode(309 /* SyntaxKind.JSDocTypeExpression */); + var node = createBaseNode(312 /* SyntaxKind.JSDocTypeExpression */); node.type = type; return node; } @@ -25835,7 +26011,7 @@ var ts; } // @api function createJSDocSignature(typeParameters, parameters, type) { - var node = createBaseNode(323 /* SyntaxKind.JSDocSignature */); + var node = createBaseNode(326 /* SyntaxKind.JSDocSignature */); node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; @@ -25864,7 +26040,7 @@ var ts; } // @api function createJSDocTemplateTag(tagName, constraint, typeParameters, comment) { - var node = createBaseJSDocTag(344 /* SyntaxKind.JSDocTemplateTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); + var node = createBaseJSDocTag(347 /* SyntaxKind.JSDocTemplateTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); node.constraint = constraint; node.typeParameters = createNodeArray(typeParameters); return node; @@ -25881,7 +26057,7 @@ var ts; } // @api function createJSDocTypedefTag(tagName, typeExpression, fullName, comment) { - var node = createBaseJSDocTag(345 /* SyntaxKind.JSDocTypedefTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); + var node = createBaseJSDocTag(348 /* SyntaxKind.JSDocTypedefTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = ts.getJSDocTypeAliasName(fullName); @@ -25899,7 +26075,7 @@ var ts; } // @api function createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - var node = createBaseJSDocTag(340 /* SyntaxKind.JSDocParameterTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); + var node = createBaseJSDocTag(343 /* SyntaxKind.JSDocParameterTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -25920,7 +26096,7 @@ var ts; } // @api function createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - var node = createBaseJSDocTag(347 /* SyntaxKind.JSDocPropertyTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); + var node = createBaseJSDocTag(350 /* SyntaxKind.JSDocPropertyTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -25941,7 +26117,7 @@ var ts; } // @api function createJSDocCallbackTag(tagName, typeExpression, fullName, comment) { - var node = createBaseJSDocTag(338 /* SyntaxKind.JSDocCallbackTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); + var node = createBaseJSDocTag(341 /* SyntaxKind.JSDocCallbackTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = ts.getJSDocTypeAliasName(fullName); @@ -25959,7 +26135,7 @@ var ts; } // @api function createJSDocAugmentsTag(tagName, className, comment) { - var node = createBaseJSDocTag(328 /* SyntaxKind.JSDocAugmentsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); + var node = createBaseJSDocTag(331 /* SyntaxKind.JSDocAugmentsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); node.class = className; return node; } @@ -25974,13 +26150,13 @@ var ts; } // @api function createJSDocImplementsTag(tagName, className, comment) { - var node = createBaseJSDocTag(329 /* SyntaxKind.JSDocImplementsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); + var node = createBaseJSDocTag(332 /* SyntaxKind.JSDocImplementsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); node.class = className; return node; } // @api function createJSDocSeeTag(tagName, name, comment) { - var node = createBaseJSDocTag(346 /* SyntaxKind.JSDocSeeTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); + var node = createBaseJSDocTag(349 /* SyntaxKind.JSDocSeeTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); node.name = name; return node; } @@ -25994,7 +26170,7 @@ var ts; } // @api function createJSDocNameReference(name) { - var node = createBaseNode(310 /* SyntaxKind.JSDocNameReference */); + var node = createBaseNode(313 /* SyntaxKind.JSDocNameReference */); node.name = name; return node; } @@ -26006,7 +26182,7 @@ var ts; } // @api function createJSDocMemberName(left, right) { - var node = createBaseNode(311 /* SyntaxKind.JSDocMemberName */); + var node = createBaseNode(314 /* SyntaxKind.JSDocMemberName */); node.left = left; node.right = right; node.transformFlags |= @@ -26023,7 +26199,7 @@ var ts; } // @api function createJSDocLink(name, text) { - var node = createBaseNode(324 /* SyntaxKind.JSDocLink */); + var node = createBaseNode(327 /* SyntaxKind.JSDocLink */); node.name = name; node.text = text; return node; @@ -26036,7 +26212,7 @@ var ts; } // @api function createJSDocLinkCode(name, text) { - var node = createBaseNode(325 /* SyntaxKind.JSDocLinkCode */); + var node = createBaseNode(328 /* SyntaxKind.JSDocLinkCode */); node.name = name; node.text = text; return node; @@ -26049,7 +26225,7 @@ var ts; } // @api function createJSDocLinkPlain(name, text) { - var node = createBaseNode(326 /* SyntaxKind.JSDocLinkPlain */); + var node = createBaseNode(329 /* SyntaxKind.JSDocLinkPlain */); node.name = name; node.text = text; return node; @@ -26121,7 +26297,7 @@ var ts; } // @api function createJSDocUnknownTag(tagName, comment) { - var node = createBaseJSDocTag(327 /* SyntaxKind.JSDocTag */, tagName, comment); + var node = createBaseJSDocTag(330 /* SyntaxKind.JSDocTag */, tagName, comment); return node; } // @api @@ -26133,7 +26309,7 @@ var ts; } // @api function createJSDocText(text) { - var node = createBaseNode(321 /* SyntaxKind.JSDocText */); + var node = createBaseNode(324 /* SyntaxKind.JSDocText */); node.text = text; return node; } @@ -26145,7 +26321,7 @@ var ts; } // @api function createJSDocComment(comment, tags) { - var node = createBaseNode(320 /* SyntaxKind.JSDoc */); + var node = createBaseNode(323 /* SyntaxKind.JSDoc */); node.comment = comment; node.tags = asNodeArray(tags); return node; @@ -26162,7 +26338,7 @@ var ts; // // @api function createJsxElement(openingElement, children, closingElement) { - var node = createBaseNode(278 /* SyntaxKind.JsxElement */); + var node = createBaseNode(281 /* SyntaxKind.JsxElement */); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -26183,7 +26359,7 @@ var ts; } // @api function createJsxSelfClosingElement(tagName, typeArguments, attributes) { - var node = createBaseNode(279 /* SyntaxKind.JsxSelfClosingElement */); + var node = createBaseNode(282 /* SyntaxKind.JsxSelfClosingElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -26207,7 +26383,7 @@ var ts; } // @api function createJsxOpeningElement(tagName, typeArguments, attributes) { - var node = createBaseNode(280 /* SyntaxKind.JsxOpeningElement */); + var node = createBaseNode(283 /* SyntaxKind.JsxOpeningElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -26231,7 +26407,7 @@ var ts; } // @api function createJsxClosingElement(tagName) { - var node = createBaseNode(281 /* SyntaxKind.JsxClosingElement */); + var node = createBaseNode(284 /* SyntaxKind.JsxClosingElement */); node.tagName = tagName; node.transformFlags |= propagateChildFlags(node.tagName) | @@ -26246,7 +26422,7 @@ var ts; } // @api function createJsxFragment(openingFragment, children, closingFragment) { - var node = createBaseNode(282 /* SyntaxKind.JsxFragment */); + var node = createBaseNode(285 /* SyntaxKind.JsxFragment */); node.openingFragment = openingFragment; node.children = createNodeArray(children); node.closingFragment = closingFragment; @@ -26282,19 +26458,19 @@ var ts; } // @api function createJsxOpeningFragment() { - var node = createBaseNode(283 /* SyntaxKind.JsxOpeningFragment */); + var node = createBaseNode(286 /* SyntaxKind.JsxOpeningFragment */); node.transformFlags |= 2 /* TransformFlags.ContainsJsx */; return node; } // @api function createJsxJsxClosingFragment() { - var node = createBaseNode(284 /* SyntaxKind.JsxClosingFragment */); + var node = createBaseNode(287 /* SyntaxKind.JsxClosingFragment */); node.transformFlags |= 2 /* TransformFlags.ContainsJsx */; return node; } // @api function createJsxAttribute(name, initializer) { - var node = createBaseNode(285 /* SyntaxKind.JsxAttribute */); + var node = createBaseNode(288 /* SyntaxKind.JsxAttribute */); node.name = name; node.initializer = initializer; node.transformFlags |= @@ -26312,7 +26488,7 @@ var ts; } // @api function createJsxAttributes(properties) { - var node = createBaseNode(286 /* SyntaxKind.JsxAttributes */); + var node = createBaseNode(289 /* SyntaxKind.JsxAttributes */); node.properties = createNodeArray(properties); node.transformFlags |= propagateChildrenFlags(node.properties) | @@ -26327,7 +26503,7 @@ var ts; } // @api function createJsxSpreadAttribute(expression) { - var node = createBaseNode(287 /* SyntaxKind.JsxSpreadAttribute */); + var node = createBaseNode(290 /* SyntaxKind.JsxSpreadAttribute */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression) | @@ -26342,7 +26518,7 @@ var ts; } // @api function createJsxExpression(dotDotDotToken, expression) { - var node = createBaseNode(288 /* SyntaxKind.JsxExpression */); + var node = createBaseNode(291 /* SyntaxKind.JsxExpression */); node.dotDotDotToken = dotDotDotToken; node.expression = expression; node.transformFlags |= @@ -26362,7 +26538,7 @@ var ts; // // @api function createCaseClause(expression, statements) { - var node = createBaseNode(289 /* SyntaxKind.CaseClause */); + var node = createBaseNode(292 /* SyntaxKind.CaseClause */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.statements = createNodeArray(statements); node.transformFlags |= @@ -26379,7 +26555,7 @@ var ts; } // @api function createDefaultClause(statements) { - var node = createBaseNode(290 /* SyntaxKind.DefaultClause */); + var node = createBaseNode(293 /* SyntaxKind.DefaultClause */); node.statements = createNodeArray(statements); node.transformFlags = propagateChildrenFlags(node.statements); return node; @@ -26392,7 +26568,7 @@ var ts; } // @api function createHeritageClause(token, types) { - var node = createBaseNode(291 /* SyntaxKind.HeritageClause */); + var node = createBaseNode(294 /* SyntaxKind.HeritageClause */); node.token = token; node.types = createNodeArray(types); node.transformFlags |= propagateChildrenFlags(node.types); @@ -26416,7 +26592,7 @@ var ts; } // @api function createCatchClause(variableDeclaration, block) { - var node = createBaseNode(292 /* SyntaxKind.CatchClause */); + var node = createBaseNode(295 /* SyntaxKind.CatchClause */); if (typeof variableDeclaration === "string" || variableDeclaration && !ts.isVariableDeclaration(variableDeclaration)) { variableDeclaration = createVariableDeclaration(variableDeclaration, /*exclamationToken*/ undefined, @@ -26444,7 +26620,7 @@ var ts; // // @api function createPropertyAssignment(name, initializer) { - var node = createBaseNamedDeclaration(296 /* SyntaxKind.PropertyAssignment */, + var node = createBaseNamedDeclaration(299 /* SyntaxKind.PropertyAssignment */, /*modifiers*/ undefined, name); node.initializer = parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= @@ -26476,7 +26652,7 @@ var ts; } // @api function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - var node = createBaseNamedDeclaration(297 /* SyntaxKind.ShorthandPropertyAssignment */, + var node = createBaseNamedDeclaration(300 /* SyntaxKind.ShorthandPropertyAssignment */, /*modifiers*/ undefined, name); node.objectAssignmentInitializer = objectAssignmentInitializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(objectAssignmentInitializer); node.transformFlags |= @@ -26510,7 +26686,7 @@ var ts; } // @api function createSpreadAssignment(expression) { - var node = createBaseNode(298 /* SyntaxKind.SpreadAssignment */); + var node = createBaseNode(301 /* SyntaxKind.SpreadAssignment */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -26529,7 +26705,7 @@ var ts; // // @api function createEnumMember(name, initializer) { - var node = createBaseNode(299 /* SyntaxKind.EnumMember */); + var node = createBaseNode(302 /* SyntaxKind.EnumMember */); node.name = asName(name); node.initializer = initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= @@ -26550,7 +26726,7 @@ var ts; // // @api function createSourceFile(statements, endOfFileToken, flags) { - var node = baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */); + var node = baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */); node.statements = createNodeArray(statements); node.endOfFileToken = endOfFileToken; node.flags |= flags; @@ -26567,7 +26743,7 @@ var ts; return node; } function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) { - var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */)); + var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */)); for (var p in source) { if (p === "emitNode" || ts.hasProperty(node, p) || !ts.hasProperty(source, p)) continue; @@ -26606,7 +26782,7 @@ var ts; // @api function createBundle(sourceFiles, prepends) { if (prepends === void 0) { prepends = ts.emptyArray; } - var node = createBaseNode(306 /* SyntaxKind.Bundle */); + var node = createBaseNode(309 /* SyntaxKind.Bundle */); node.prepends = prepends; node.sourceFiles = sourceFiles; return node; @@ -26621,7 +26797,7 @@ var ts; } // @api function createUnparsedSource(prologues, syntheticReferences, texts) { - var node = createBaseNode(307 /* SyntaxKind.UnparsedSource */); + var node = createBaseNode(310 /* SyntaxKind.UnparsedSource */); node.prologues = prologues; node.syntheticReferences = syntheticReferences; node.texts = texts; @@ -26639,28 +26815,28 @@ var ts; } // @api function createUnparsedPrologue(data) { - return createBaseUnparsedNode(300 /* SyntaxKind.UnparsedPrologue */, data); + return createBaseUnparsedNode(303 /* SyntaxKind.UnparsedPrologue */, data); } // @api function createUnparsedPrepend(data, texts) { - var node = createBaseUnparsedNode(301 /* SyntaxKind.UnparsedPrepend */, data); + var node = createBaseUnparsedNode(304 /* SyntaxKind.UnparsedPrepend */, data); node.texts = texts; return node; } // @api function createUnparsedTextLike(data, internal) { - return createBaseUnparsedNode(internal ? 303 /* SyntaxKind.UnparsedInternalText */ : 302 /* SyntaxKind.UnparsedText */, data); + return createBaseUnparsedNode(internal ? 306 /* SyntaxKind.UnparsedInternalText */ : 305 /* SyntaxKind.UnparsedText */, data); } // @api function createUnparsedSyntheticReference(section) { - var node = createBaseNode(304 /* SyntaxKind.UnparsedSyntheticReference */); + var node = createBaseNode(307 /* SyntaxKind.UnparsedSyntheticReference */); node.data = section.data; node.section = section; return node; } // @api function createInputFiles() { - var node = createBaseNode(308 /* SyntaxKind.InputFiles */); + var node = createBaseNode(311 /* SyntaxKind.InputFiles */); node.javascriptText = ""; node.declarationText = ""; return node; @@ -26671,7 +26847,7 @@ var ts; // @api function createSyntheticExpression(type, isSpread, tupleNameSource) { if (isSpread === void 0) { isSpread = false; } - var node = createBaseNode(232 /* SyntaxKind.SyntheticExpression */); + var node = createBaseNode(234 /* SyntaxKind.SyntheticExpression */); node.type = type; node.isSpread = isSpread; node.tupleNameSource = tupleNameSource; @@ -26679,7 +26855,7 @@ var ts; } // @api function createSyntaxList(children) { - var node = createBaseNode(348 /* SyntaxKind.SyntaxList */); + var node = createBaseNode(351 /* SyntaxKind.SyntaxList */); node._children = children; return node; } @@ -26694,7 +26870,7 @@ var ts; */ // @api function createNotEmittedStatement(original) { - var node = createBaseNode(349 /* SyntaxKind.NotEmittedStatement */); + var node = createBaseNode(352 /* SyntaxKind.NotEmittedStatement */); node.original = original; ts.setTextRange(node, original); return node; @@ -26708,7 +26884,7 @@ var ts; */ // @api function createPartiallyEmittedExpression(expression, original) { - var node = createBaseNode(350 /* SyntaxKind.PartiallyEmittedExpression */); + var node = createBaseNode(353 /* SyntaxKind.PartiallyEmittedExpression */); node.expression = expression; node.original = original; node.transformFlags |= @@ -26736,7 +26912,7 @@ var ts; } // @api function createCommaListExpression(elements) { - var node = createBaseNode(351 /* SyntaxKind.CommaListExpression */); + var node = createBaseNode(354 /* SyntaxKind.CommaListExpression */); node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)); node.transformFlags |= propagateChildrenFlags(node.elements); return node; @@ -26753,7 +26929,7 @@ var ts; */ // @api function createEndOfDeclarationMarker(original) { - var node = createBaseNode(353 /* SyntaxKind.EndOfDeclarationMarker */); + var node = createBaseNode(356 /* SyntaxKind.EndOfDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -26764,14 +26940,14 @@ var ts; */ // @api function createMergeDeclarationMarker(original) { - var node = createBaseNode(352 /* SyntaxKind.MergeDeclarationMarker */); + var node = createBaseNode(355 /* SyntaxKind.MergeDeclarationMarker */); node.emitNode = {}; node.original = original; return node; } // @api function createSyntheticReferenceExpression(expression, thisArg) { - var node = createBaseNode(354 /* SyntaxKind.SyntheticReferenceExpression */); + var node = createBaseNode(357 /* SyntaxKind.SyntheticReferenceExpression */); node.expression = expression; node.thisArg = thisArg; node.transformFlags |= @@ -26793,7 +26969,7 @@ var ts; if (node === undefined) { return node; } - var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */) : + var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */) : ts.isIdentifier(node) ? baseFactory.createBaseIdentifierNode(79 /* SyntaxKind.Identifier */) : ts.isPrivateIdentifier(node) ? baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */) : !ts.isNodeKind(node.kind) ? baseFactory.createBaseTokenNode(node.kind) : @@ -26802,7 +26978,7 @@ var ts; clone.transformFlags = node.transformFlags; setOriginalNode(clone, node); for (var key in node) { - if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { + if (ts.hasProperty(clone, key) || !ts.hasProperty(node, key)) { continue; } clone[key] = node[key]; @@ -26910,11 +27086,12 @@ var ts; } function updateOuterExpression(outerExpression, expression) { switch (outerExpression.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: return updateParenthesizedExpression(outerExpression, expression); - case 211 /* SyntaxKind.TypeAssertionExpression */: return updateTypeAssertion(outerExpression, outerExpression.type, expression); - case 229 /* SyntaxKind.AsExpression */: return updateAsExpression(outerExpression, expression, outerExpression.type); - case 230 /* SyntaxKind.NonNullExpression */: return updateNonNullExpression(outerExpression, expression); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: return updatePartiallyEmittedExpression(outerExpression, expression); + case 214 /* SyntaxKind.ParenthesizedExpression */: return updateParenthesizedExpression(outerExpression, expression); + case 213 /* SyntaxKind.TypeAssertionExpression */: return updateTypeAssertion(outerExpression, outerExpression.type, expression); + case 231 /* SyntaxKind.AsExpression */: return updateAsExpression(outerExpression, expression, outerExpression.type); + case 235 /* SyntaxKind.SatisfiesExpression */: return updateSatisfiesExpression(outerExpression, expression, outerExpression.type); + case 232 /* SyntaxKind.NonNullExpression */: return updateNonNullExpression(outerExpression, expression); + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return updatePartiallyEmittedExpression(outerExpression, expression); } } /** @@ -26968,13 +27145,13 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: return false; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return target.properties.length > 0; default: return true; @@ -27400,24 +27577,24 @@ var ts; } function getDefaultTagNameForKind(kind) { switch (kind) { - case 343 /* SyntaxKind.JSDocTypeTag */: return "type"; - case 341 /* SyntaxKind.JSDocReturnTag */: return "returns"; - case 342 /* SyntaxKind.JSDocThisTag */: return "this"; - case 339 /* SyntaxKind.JSDocEnumTag */: return "enum"; - case 330 /* SyntaxKind.JSDocAuthorTag */: return "author"; - case 332 /* SyntaxKind.JSDocClassTag */: return "class"; - case 333 /* SyntaxKind.JSDocPublicTag */: return "public"; - case 334 /* SyntaxKind.JSDocPrivateTag */: return "private"; - case 335 /* SyntaxKind.JSDocProtectedTag */: return "protected"; - case 336 /* SyntaxKind.JSDocReadonlyTag */: return "readonly"; - case 337 /* SyntaxKind.JSDocOverrideTag */: return "override"; - case 344 /* SyntaxKind.JSDocTemplateTag */: return "template"; - case 345 /* SyntaxKind.JSDocTypedefTag */: return "typedef"; - case 340 /* SyntaxKind.JSDocParameterTag */: return "param"; - case 347 /* SyntaxKind.JSDocPropertyTag */: return "prop"; - case 338 /* SyntaxKind.JSDocCallbackTag */: return "callback"; - case 328 /* SyntaxKind.JSDocAugmentsTag */: return "augments"; - case 329 /* SyntaxKind.JSDocImplementsTag */: return "implements"; + case 346 /* SyntaxKind.JSDocTypeTag */: return "type"; + case 344 /* SyntaxKind.JSDocReturnTag */: return "returns"; + case 345 /* SyntaxKind.JSDocThisTag */: return "this"; + case 342 /* SyntaxKind.JSDocEnumTag */: return "enum"; + case 333 /* SyntaxKind.JSDocAuthorTag */: return "author"; + case 335 /* SyntaxKind.JSDocClassTag */: return "class"; + case 336 /* SyntaxKind.JSDocPublicTag */: return "public"; + case 337 /* SyntaxKind.JSDocPrivateTag */: return "private"; + case 338 /* SyntaxKind.JSDocProtectedTag */: return "protected"; + case 339 /* SyntaxKind.JSDocReadonlyTag */: return "readonly"; + case 340 /* SyntaxKind.JSDocOverrideTag */: return "override"; + case 347 /* SyntaxKind.JSDocTemplateTag */: return "template"; + case 348 /* SyntaxKind.JSDocTypedefTag */: return "typedef"; + case 343 /* SyntaxKind.JSDocParameterTag */: return "param"; + case 350 /* SyntaxKind.JSDocPropertyTag */: return "prop"; + case 341 /* SyntaxKind.JSDocCallbackTag */: return "callback"; + case 331 /* SyntaxKind.JSDocAugmentsTag */: return "augments"; + case 332 /* SyntaxKind.JSDocImplementsTag */: return "implements"; default: return ts.Debug.fail("Unsupported kind: ".concat(ts.Debug.formatSyntaxKind(kind))); } @@ -27497,69 +27674,70 @@ var ts; */ /* @internal */ function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 177 /* SyntaxKind.FirstTypeNode */ && kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (kind >= 179 /* SyntaxKind.FirstTypeNode */ && kind <= 202 /* SyntaxKind.LastTypeNode */) { return -2 /* TransformFlags.TypeExcludes */; } switch (kind) { - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return -2147450880 /* TransformFlags.ArrayLiteralOrCallOrNewExcludes */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return -1941676032 /* TransformFlags.ModuleExcludes */; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return -2147483648 /* TransformFlags.ParameterExcludes */; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return -2072174592 /* TransformFlags.ArrowFunctionExcludes */; - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return -1937940480 /* TransformFlags.FunctionExcludes */; - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return -2146893824 /* TransformFlags.VariableDeclarationListExcludes */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return -2147344384 /* TransformFlags.ClassExcludes */; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return -1937948672 /* TransformFlags.ConstructorExcludes */; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return -2013249536 /* TransformFlags.PropertyExcludes */; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return -2005057536 /* TransformFlags.MethodOrAccessorExcludes */; - case 130 /* SyntaxKind.AnyKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 163 /* SyntaxKind.TypeParameter */: - case 166 /* SyntaxKind.PropertySignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: + case 168 /* SyntaxKind.PropertySignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return -2 /* TransformFlags.TypeExcludes */; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return -2147278848 /* TransformFlags.ObjectLiteralExcludes */; - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return -2147418112 /* TransformFlags.CatchClauseExcludes */; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return -2147450880 /* TransformFlags.BindingPatternExcludes */; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: case 106 /* SyntaxKind.SuperKeyword */: return -2147483648 /* TransformFlags.OuterExpressionExcludes */; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return -2147483648 /* TransformFlags.PropertyAccessExcludes */; default: return -2147483648 /* TransformFlags.NodeExcludes */; @@ -27759,9 +27937,10 @@ var ts; }; var buildInfo_1; var getAndCacheBuildInfo_1 = function (getText) { + var _a; if (buildInfo_1 === undefined) { var result = getText(); - buildInfo_1 = result !== undefined ? ts.getBuildInfo(result) : false; + buildInfo_1 = result !== undefined ? (_a = ts.getBuildInfo(node.buildInfoPath, result)) !== null && _a !== void 0 ? _a : false : false; } return buildInfo_1 || undefined; }; @@ -27815,7 +27994,7 @@ var ts; } ts.setOriginalNode = setOriginalNode; function mergeEmitNode(sourceEmitNode, destEmitNode) { - var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine; + var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine, snippetElement = sourceEmitNode.snippetElement; if (!destEmitNode) destEmitNode = {}; // We are using `.slice()` here in case `destEmitNode.leadingComments` is pushed to later. @@ -27841,6 +28020,8 @@ var ts; } if (startsOnNewLine !== undefined) destEmitNode.startsOnNewLine = startsOnNewLine; + if (snippetElement !== undefined) + destEmitNode.snippetElement = snippetElement; return destEmitNode; } function mergeTokenSourceMapRanges(sourceRanges, destRanges) { @@ -27866,7 +28047,7 @@ var ts; // To avoid holding onto transformation artifacts, we keep track of any // parse tree node we are annotating. This allows us to clean them up after // all transformations have completed. - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = (_a = ts.getSourceFileOfNode(ts.getParseTreeNode(ts.getSourceFileOfNode(node)))) !== null && _a !== void 0 ? _a : ts.Debug.fail("Could not determine parsed source file."); @@ -28944,22 +29125,22 @@ var ts; ts.isExportModifier = isExportModifier; /* @internal */ function isAsyncModifier(node) { - return node.kind === 131 /* SyntaxKind.AsyncKeyword */; + return node.kind === 132 /* SyntaxKind.AsyncKeyword */; } ts.isAsyncModifier = isAsyncModifier; /* @internal */ function isAssertsKeyword(node) { - return node.kind === 128 /* SyntaxKind.AssertsKeyword */; + return node.kind === 129 /* SyntaxKind.AssertsKeyword */; } ts.isAssertsKeyword = isAssertsKeyword; /* @internal */ function isAwaitKeyword(node) { - return node.kind === 132 /* SyntaxKind.AwaitKeyword */; + return node.kind === 133 /* SyntaxKind.AwaitKeyword */; } ts.isAwaitKeyword = isAwaitKeyword; /* @internal */ function isReadonlyKeyword(node) { - return node.kind === 145 /* SyntaxKind.ReadonlyKeyword */; + return node.kind === 146 /* SyntaxKind.ReadonlyKeyword */; } ts.isReadonlyKeyword = isReadonlyKeyword; /* @internal */ @@ -28974,9 +29155,14 @@ var ts; ts.isAbstractModifier = isAbstractModifier; /* @internal */ function isOverrideModifier(node) { - return node.kind === 159 /* SyntaxKind.OverrideKeyword */; + return node.kind === 161 /* SyntaxKind.OverrideKeyword */; } ts.isOverrideModifier = isOverrideModifier; + /* @internal */ + function isAccessorModifier(node) { + return node.kind === 127 /* SyntaxKind.AccessorKeyword */; + } + ts.isAccessorModifier = isAccessorModifier; /*@internal*/ function isSuperKeyword(node) { return node.kind === 106 /* SyntaxKind.SuperKeyword */; @@ -28989,605 +29175,609 @@ var ts; ts.isImportKeyword = isImportKeyword; // Names function isQualifiedName(node) { - return node.kind === 161 /* SyntaxKind.QualifiedName */; + return node.kind === 163 /* SyntaxKind.QualifiedName */; } ts.isQualifiedName = isQualifiedName; function isComputedPropertyName(node) { - return node.kind === 162 /* SyntaxKind.ComputedPropertyName */; + return node.kind === 164 /* SyntaxKind.ComputedPropertyName */; } ts.isComputedPropertyName = isComputedPropertyName; // Signature elements function isTypeParameterDeclaration(node) { - return node.kind === 163 /* SyntaxKind.TypeParameter */; + return node.kind === 165 /* SyntaxKind.TypeParameter */; } ts.isTypeParameterDeclaration = isTypeParameterDeclaration; // TODO(rbuckton): Rename to 'isParameterDeclaration' function isParameter(node) { - return node.kind === 164 /* SyntaxKind.Parameter */; + return node.kind === 166 /* SyntaxKind.Parameter */; } ts.isParameter = isParameter; function isDecorator(node) { - return node.kind === 165 /* SyntaxKind.Decorator */; + return node.kind === 167 /* SyntaxKind.Decorator */; } ts.isDecorator = isDecorator; // TypeMember function isPropertySignature(node) { - return node.kind === 166 /* SyntaxKind.PropertySignature */; + return node.kind === 168 /* SyntaxKind.PropertySignature */; } ts.isPropertySignature = isPropertySignature; function isPropertyDeclaration(node) { - return node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + return node.kind === 169 /* SyntaxKind.PropertyDeclaration */; } ts.isPropertyDeclaration = isPropertyDeclaration; function isMethodSignature(node) { - return node.kind === 168 /* SyntaxKind.MethodSignature */; + return node.kind === 170 /* SyntaxKind.MethodSignature */; } ts.isMethodSignature = isMethodSignature; function isMethodDeclaration(node) { - return node.kind === 169 /* SyntaxKind.MethodDeclaration */; + return node.kind === 171 /* SyntaxKind.MethodDeclaration */; } ts.isMethodDeclaration = isMethodDeclaration; function isClassStaticBlockDeclaration(node) { - return node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + return node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; } ts.isClassStaticBlockDeclaration = isClassStaticBlockDeclaration; function isConstructorDeclaration(node) { - return node.kind === 171 /* SyntaxKind.Constructor */; + return node.kind === 173 /* SyntaxKind.Constructor */; } ts.isConstructorDeclaration = isConstructorDeclaration; function isGetAccessorDeclaration(node) { - return node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetAccessorDeclaration = isGetAccessorDeclaration; function isSetAccessorDeclaration(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */; } ts.isSetAccessorDeclaration = isSetAccessorDeclaration; function isCallSignatureDeclaration(node) { - return node.kind === 174 /* SyntaxKind.CallSignature */; + return node.kind === 176 /* SyntaxKind.CallSignature */; } ts.isCallSignatureDeclaration = isCallSignatureDeclaration; function isConstructSignatureDeclaration(node) { - return node.kind === 175 /* SyntaxKind.ConstructSignature */; + return node.kind === 177 /* SyntaxKind.ConstructSignature */; } ts.isConstructSignatureDeclaration = isConstructSignatureDeclaration; function isIndexSignatureDeclaration(node) { - return node.kind === 176 /* SyntaxKind.IndexSignature */; + return node.kind === 178 /* SyntaxKind.IndexSignature */; } ts.isIndexSignatureDeclaration = isIndexSignatureDeclaration; // Type function isTypePredicateNode(node) { - return node.kind === 177 /* SyntaxKind.TypePredicate */; + return node.kind === 179 /* SyntaxKind.TypePredicate */; } ts.isTypePredicateNode = isTypePredicateNode; function isTypeReferenceNode(node) { - return node.kind === 178 /* SyntaxKind.TypeReference */; + return node.kind === 180 /* SyntaxKind.TypeReference */; } ts.isTypeReferenceNode = isTypeReferenceNode; function isFunctionTypeNode(node) { - return node.kind === 179 /* SyntaxKind.FunctionType */; + return node.kind === 181 /* SyntaxKind.FunctionType */; } ts.isFunctionTypeNode = isFunctionTypeNode; function isConstructorTypeNode(node) { - return node.kind === 180 /* SyntaxKind.ConstructorType */; + return node.kind === 182 /* SyntaxKind.ConstructorType */; } ts.isConstructorTypeNode = isConstructorTypeNode; function isTypeQueryNode(node) { - return node.kind === 181 /* SyntaxKind.TypeQuery */; + return node.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isTypeQueryNode = isTypeQueryNode; function isTypeLiteralNode(node) { - return node.kind === 182 /* SyntaxKind.TypeLiteral */; + return node.kind === 184 /* SyntaxKind.TypeLiteral */; } ts.isTypeLiteralNode = isTypeLiteralNode; function isArrayTypeNode(node) { - return node.kind === 183 /* SyntaxKind.ArrayType */; + return node.kind === 185 /* SyntaxKind.ArrayType */; } ts.isArrayTypeNode = isArrayTypeNode; function isTupleTypeNode(node) { - return node.kind === 184 /* SyntaxKind.TupleType */; + return node.kind === 186 /* SyntaxKind.TupleType */; } ts.isTupleTypeNode = isTupleTypeNode; function isNamedTupleMember(node) { - return node.kind === 197 /* SyntaxKind.NamedTupleMember */; + return node.kind === 199 /* SyntaxKind.NamedTupleMember */; } ts.isNamedTupleMember = isNamedTupleMember; function isOptionalTypeNode(node) { - return node.kind === 185 /* SyntaxKind.OptionalType */; + return node.kind === 187 /* SyntaxKind.OptionalType */; } ts.isOptionalTypeNode = isOptionalTypeNode; function isRestTypeNode(node) { - return node.kind === 186 /* SyntaxKind.RestType */; + return node.kind === 188 /* SyntaxKind.RestType */; } ts.isRestTypeNode = isRestTypeNode; function isUnionTypeNode(node) { - return node.kind === 187 /* SyntaxKind.UnionType */; + return node.kind === 189 /* SyntaxKind.UnionType */; } ts.isUnionTypeNode = isUnionTypeNode; function isIntersectionTypeNode(node) { - return node.kind === 188 /* SyntaxKind.IntersectionType */; + return node.kind === 190 /* SyntaxKind.IntersectionType */; } ts.isIntersectionTypeNode = isIntersectionTypeNode; function isConditionalTypeNode(node) { - return node.kind === 189 /* SyntaxKind.ConditionalType */; + return node.kind === 191 /* SyntaxKind.ConditionalType */; } ts.isConditionalTypeNode = isConditionalTypeNode; function isInferTypeNode(node) { - return node.kind === 190 /* SyntaxKind.InferType */; + return node.kind === 192 /* SyntaxKind.InferType */; } ts.isInferTypeNode = isInferTypeNode; function isParenthesizedTypeNode(node) { - return node.kind === 191 /* SyntaxKind.ParenthesizedType */; + return node.kind === 193 /* SyntaxKind.ParenthesizedType */; } ts.isParenthesizedTypeNode = isParenthesizedTypeNode; function isThisTypeNode(node) { - return node.kind === 192 /* SyntaxKind.ThisType */; + return node.kind === 194 /* SyntaxKind.ThisType */; } ts.isThisTypeNode = isThisTypeNode; function isTypeOperatorNode(node) { - return node.kind === 193 /* SyntaxKind.TypeOperator */; + return node.kind === 195 /* SyntaxKind.TypeOperator */; } ts.isTypeOperatorNode = isTypeOperatorNode; function isIndexedAccessTypeNode(node) { - return node.kind === 194 /* SyntaxKind.IndexedAccessType */; + return node.kind === 196 /* SyntaxKind.IndexedAccessType */; } ts.isIndexedAccessTypeNode = isIndexedAccessTypeNode; function isMappedTypeNode(node) { - return node.kind === 195 /* SyntaxKind.MappedType */; + return node.kind === 197 /* SyntaxKind.MappedType */; } ts.isMappedTypeNode = isMappedTypeNode; function isLiteralTypeNode(node) { - return node.kind === 196 /* SyntaxKind.LiteralType */; + return node.kind === 198 /* SyntaxKind.LiteralType */; } ts.isLiteralTypeNode = isLiteralTypeNode; function isImportTypeNode(node) { - return node.kind === 200 /* SyntaxKind.ImportType */; + return node.kind === 202 /* SyntaxKind.ImportType */; } ts.isImportTypeNode = isImportTypeNode; function isTemplateLiteralTypeSpan(node) { - return node.kind === 199 /* SyntaxKind.TemplateLiteralTypeSpan */; + return node.kind === 201 /* SyntaxKind.TemplateLiteralTypeSpan */; } ts.isTemplateLiteralTypeSpan = isTemplateLiteralTypeSpan; function isTemplateLiteralTypeNode(node) { - return node.kind === 198 /* SyntaxKind.TemplateLiteralType */; + return node.kind === 200 /* SyntaxKind.TemplateLiteralType */; } ts.isTemplateLiteralTypeNode = isTemplateLiteralTypeNode; // Binding patterns function isObjectBindingPattern(node) { - return node.kind === 201 /* SyntaxKind.ObjectBindingPattern */; + return node.kind === 203 /* SyntaxKind.ObjectBindingPattern */; } ts.isObjectBindingPattern = isObjectBindingPattern; function isArrayBindingPattern(node) { - return node.kind === 202 /* SyntaxKind.ArrayBindingPattern */; + return node.kind === 204 /* SyntaxKind.ArrayBindingPattern */; } ts.isArrayBindingPattern = isArrayBindingPattern; function isBindingElement(node) { - return node.kind === 203 /* SyntaxKind.BindingElement */; + return node.kind === 205 /* SyntaxKind.BindingElement */; } ts.isBindingElement = isBindingElement; // Expression function isArrayLiteralExpression(node) { - return node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */; + return node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 206 /* SyntaxKind.PropertyAccessExpression */; + return node.kind === 208 /* SyntaxKind.PropertyAccessExpression */; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 207 /* SyntaxKind.ElementAccessExpression */; + return node.kind === 209 /* SyntaxKind.ElementAccessExpression */; } ts.isElementAccessExpression = isElementAccessExpression; function isCallExpression(node) { - return node.kind === 208 /* SyntaxKind.CallExpression */; + return node.kind === 210 /* SyntaxKind.CallExpression */; } ts.isCallExpression = isCallExpression; function isNewExpression(node) { - return node.kind === 209 /* SyntaxKind.NewExpression */; + return node.kind === 211 /* SyntaxKind.NewExpression */; } ts.isNewExpression = isNewExpression; function isTaggedTemplateExpression(node) { - return node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */; + return node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */; } ts.isTaggedTemplateExpression = isTaggedTemplateExpression; function isTypeAssertionExpression(node) { - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */; } ts.isTypeAssertionExpression = isTypeAssertionExpression; function isParenthesizedExpression(node) { - return node.kind === 212 /* SyntaxKind.ParenthesizedExpression */; + return node.kind === 214 /* SyntaxKind.ParenthesizedExpression */; } ts.isParenthesizedExpression = isParenthesizedExpression; function isFunctionExpression(node) { - return node.kind === 213 /* SyntaxKind.FunctionExpression */; + return node.kind === 215 /* SyntaxKind.FunctionExpression */; } ts.isFunctionExpression = isFunctionExpression; function isArrowFunction(node) { - return node.kind === 214 /* SyntaxKind.ArrowFunction */; + return node.kind === 216 /* SyntaxKind.ArrowFunction */; } ts.isArrowFunction = isArrowFunction; function isDeleteExpression(node) { - return node.kind === 215 /* SyntaxKind.DeleteExpression */; + return node.kind === 217 /* SyntaxKind.DeleteExpression */; } ts.isDeleteExpression = isDeleteExpression; function isTypeOfExpression(node) { - return node.kind === 216 /* SyntaxKind.TypeOfExpression */; + return node.kind === 218 /* SyntaxKind.TypeOfExpression */; } ts.isTypeOfExpression = isTypeOfExpression; function isVoidExpression(node) { - return node.kind === 217 /* SyntaxKind.VoidExpression */; + return node.kind === 219 /* SyntaxKind.VoidExpression */; } ts.isVoidExpression = isVoidExpression; function isAwaitExpression(node) { - return node.kind === 218 /* SyntaxKind.AwaitExpression */; + return node.kind === 220 /* SyntaxKind.AwaitExpression */; } ts.isAwaitExpression = isAwaitExpression; function isPrefixUnaryExpression(node) { - return node.kind === 219 /* SyntaxKind.PrefixUnaryExpression */; + return node.kind === 221 /* SyntaxKind.PrefixUnaryExpression */; } ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function isPostfixUnaryExpression(node) { - return node.kind === 220 /* SyntaxKind.PostfixUnaryExpression */; + return node.kind === 222 /* SyntaxKind.PostfixUnaryExpression */; } ts.isPostfixUnaryExpression = isPostfixUnaryExpression; function isBinaryExpression(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 222 /* SyntaxKind.ConditionalExpression */; + return node.kind === 224 /* SyntaxKind.ConditionalExpression */; } ts.isConditionalExpression = isConditionalExpression; function isTemplateExpression(node) { - return node.kind === 223 /* SyntaxKind.TemplateExpression */; + return node.kind === 225 /* SyntaxKind.TemplateExpression */; } ts.isTemplateExpression = isTemplateExpression; function isYieldExpression(node) { - return node.kind === 224 /* SyntaxKind.YieldExpression */; + return node.kind === 226 /* SyntaxKind.YieldExpression */; } ts.isYieldExpression = isYieldExpression; function isSpreadElement(node) { - return node.kind === 225 /* SyntaxKind.SpreadElement */; + return node.kind === 227 /* SyntaxKind.SpreadElement */; } ts.isSpreadElement = isSpreadElement; function isClassExpression(node) { - return node.kind === 226 /* SyntaxKind.ClassExpression */; + return node.kind === 228 /* SyntaxKind.ClassExpression */; } ts.isClassExpression = isClassExpression; function isOmittedExpression(node) { - return node.kind === 227 /* SyntaxKind.OmittedExpression */; + return node.kind === 229 /* SyntaxKind.OmittedExpression */; } ts.isOmittedExpression = isOmittedExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isAsExpression(node) { - return node.kind === 229 /* SyntaxKind.AsExpression */; + return node.kind === 231 /* SyntaxKind.AsExpression */; } ts.isAsExpression = isAsExpression; + function isSatisfiesExpression(node) { + return node.kind === 235 /* SyntaxKind.SatisfiesExpression */; + } + ts.isSatisfiesExpression = isSatisfiesExpression; function isNonNullExpression(node) { - return node.kind === 230 /* SyntaxKind.NonNullExpression */; + return node.kind === 232 /* SyntaxKind.NonNullExpression */; } ts.isNonNullExpression = isNonNullExpression; function isMetaProperty(node) { - return node.kind === 231 /* SyntaxKind.MetaProperty */; + return node.kind === 233 /* SyntaxKind.MetaProperty */; } ts.isMetaProperty = isMetaProperty; function isSyntheticExpression(node) { - return node.kind === 232 /* SyntaxKind.SyntheticExpression */; + return node.kind === 234 /* SyntaxKind.SyntheticExpression */; } ts.isSyntheticExpression = isSyntheticExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 350 /* SyntaxKind.PartiallyEmittedExpression */; + return node.kind === 353 /* SyntaxKind.PartiallyEmittedExpression */; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isCommaListExpression(node) { - return node.kind === 351 /* SyntaxKind.CommaListExpression */; + return node.kind === 354 /* SyntaxKind.CommaListExpression */; } ts.isCommaListExpression = isCommaListExpression; // Misc function isTemplateSpan(node) { - return node.kind === 233 /* SyntaxKind.TemplateSpan */; + return node.kind === 236 /* SyntaxKind.TemplateSpan */; } ts.isTemplateSpan = isTemplateSpan; function isSemicolonClassElement(node) { - return node.kind === 234 /* SyntaxKind.SemicolonClassElement */; + return node.kind === 237 /* SyntaxKind.SemicolonClassElement */; } ts.isSemicolonClassElement = isSemicolonClassElement; // Elements function isBlock(node) { - return node.kind === 235 /* SyntaxKind.Block */; + return node.kind === 238 /* SyntaxKind.Block */; } ts.isBlock = isBlock; function isVariableStatement(node) { - return node.kind === 237 /* SyntaxKind.VariableStatement */; + return node.kind === 240 /* SyntaxKind.VariableStatement */; } ts.isVariableStatement = isVariableStatement; function isEmptyStatement(node) { - return node.kind === 236 /* SyntaxKind.EmptyStatement */; + return node.kind === 239 /* SyntaxKind.EmptyStatement */; } ts.isEmptyStatement = isEmptyStatement; function isExpressionStatement(node) { - return node.kind === 238 /* SyntaxKind.ExpressionStatement */; + return node.kind === 241 /* SyntaxKind.ExpressionStatement */; } ts.isExpressionStatement = isExpressionStatement; function isIfStatement(node) { - return node.kind === 239 /* SyntaxKind.IfStatement */; + return node.kind === 242 /* SyntaxKind.IfStatement */; } ts.isIfStatement = isIfStatement; function isDoStatement(node) { - return node.kind === 240 /* SyntaxKind.DoStatement */; + return node.kind === 243 /* SyntaxKind.DoStatement */; } ts.isDoStatement = isDoStatement; function isWhileStatement(node) { - return node.kind === 241 /* SyntaxKind.WhileStatement */; + return node.kind === 244 /* SyntaxKind.WhileStatement */; } ts.isWhileStatement = isWhileStatement; function isForStatement(node) { - return node.kind === 242 /* SyntaxKind.ForStatement */; + return node.kind === 245 /* SyntaxKind.ForStatement */; } ts.isForStatement = isForStatement; function isForInStatement(node) { - return node.kind === 243 /* SyntaxKind.ForInStatement */; + return node.kind === 246 /* SyntaxKind.ForInStatement */; } ts.isForInStatement = isForInStatement; function isForOfStatement(node) { - return node.kind === 244 /* SyntaxKind.ForOfStatement */; + return node.kind === 247 /* SyntaxKind.ForOfStatement */; } ts.isForOfStatement = isForOfStatement; function isContinueStatement(node) { - return node.kind === 245 /* SyntaxKind.ContinueStatement */; + return node.kind === 248 /* SyntaxKind.ContinueStatement */; } ts.isContinueStatement = isContinueStatement; function isBreakStatement(node) { - return node.kind === 246 /* SyntaxKind.BreakStatement */; + return node.kind === 249 /* SyntaxKind.BreakStatement */; } ts.isBreakStatement = isBreakStatement; function isReturnStatement(node) { - return node.kind === 247 /* SyntaxKind.ReturnStatement */; + return node.kind === 250 /* SyntaxKind.ReturnStatement */; } ts.isReturnStatement = isReturnStatement; function isWithStatement(node) { - return node.kind === 248 /* SyntaxKind.WithStatement */; + return node.kind === 251 /* SyntaxKind.WithStatement */; } ts.isWithStatement = isWithStatement; function isSwitchStatement(node) { - return node.kind === 249 /* SyntaxKind.SwitchStatement */; + return node.kind === 252 /* SyntaxKind.SwitchStatement */; } ts.isSwitchStatement = isSwitchStatement; function isLabeledStatement(node) { - return node.kind === 250 /* SyntaxKind.LabeledStatement */; + return node.kind === 253 /* SyntaxKind.LabeledStatement */; } ts.isLabeledStatement = isLabeledStatement; function isThrowStatement(node) { - return node.kind === 251 /* SyntaxKind.ThrowStatement */; + return node.kind === 254 /* SyntaxKind.ThrowStatement */; } ts.isThrowStatement = isThrowStatement; function isTryStatement(node) { - return node.kind === 252 /* SyntaxKind.TryStatement */; + return node.kind === 255 /* SyntaxKind.TryStatement */; } ts.isTryStatement = isTryStatement; function isDebuggerStatement(node) { - return node.kind === 253 /* SyntaxKind.DebuggerStatement */; + return node.kind === 256 /* SyntaxKind.DebuggerStatement */; } ts.isDebuggerStatement = isDebuggerStatement; function isVariableDeclaration(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 255 /* SyntaxKind.VariableDeclarationList */; + return node.kind === 258 /* SyntaxKind.VariableDeclarationList */; } ts.isVariableDeclarationList = isVariableDeclarationList; function isFunctionDeclaration(node) { - return node.kind === 256 /* SyntaxKind.FunctionDeclaration */; + return node.kind === 259 /* SyntaxKind.FunctionDeclaration */; } ts.isFunctionDeclaration = isFunctionDeclaration; function isClassDeclaration(node) { - return node.kind === 257 /* SyntaxKind.ClassDeclaration */; + return node.kind === 260 /* SyntaxKind.ClassDeclaration */; } ts.isClassDeclaration = isClassDeclaration; function isInterfaceDeclaration(node) { - return node.kind === 258 /* SyntaxKind.InterfaceDeclaration */; + return node.kind === 261 /* SyntaxKind.InterfaceDeclaration */; } ts.isInterfaceDeclaration = isInterfaceDeclaration; function isTypeAliasDeclaration(node) { - return node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */; + return node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */; } ts.isTypeAliasDeclaration = isTypeAliasDeclaration; function isEnumDeclaration(node) { - return node.kind === 260 /* SyntaxKind.EnumDeclaration */; + return node.kind === 263 /* SyntaxKind.EnumDeclaration */; } ts.isEnumDeclaration = isEnumDeclaration; function isModuleDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isModuleDeclaration = isModuleDeclaration; function isModuleBlock(node) { - return node.kind === 262 /* SyntaxKind.ModuleBlock */; + return node.kind === 265 /* SyntaxKind.ModuleBlock */; } ts.isModuleBlock = isModuleBlock; function isCaseBlock(node) { - return node.kind === 263 /* SyntaxKind.CaseBlock */; + return node.kind === 266 /* SyntaxKind.CaseBlock */; } ts.isCaseBlock = isCaseBlock; function isNamespaceExportDeclaration(node) { - return node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration; function isImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportDeclaration(node) { - return node.kind === 266 /* SyntaxKind.ImportDeclaration */; + return node.kind === 269 /* SyntaxKind.ImportDeclaration */; } ts.isImportDeclaration = isImportDeclaration; function isImportClause(node) { - return node.kind === 267 /* SyntaxKind.ImportClause */; + return node.kind === 270 /* SyntaxKind.ImportClause */; } ts.isImportClause = isImportClause; function isImportTypeAssertionContainer(node) { - return node.kind === 295 /* SyntaxKind.ImportTypeAssertionContainer */; + return node.kind === 298 /* SyntaxKind.ImportTypeAssertionContainer */; } ts.isImportTypeAssertionContainer = isImportTypeAssertionContainer; function isAssertClause(node) { - return node.kind === 293 /* SyntaxKind.AssertClause */; + return node.kind === 296 /* SyntaxKind.AssertClause */; } ts.isAssertClause = isAssertClause; function isAssertEntry(node) { - return node.kind === 294 /* SyntaxKind.AssertEntry */; + return node.kind === 297 /* SyntaxKind.AssertEntry */; } ts.isAssertEntry = isAssertEntry; function isNamespaceImport(node) { - return node.kind === 268 /* SyntaxKind.NamespaceImport */; + return node.kind === 271 /* SyntaxKind.NamespaceImport */; } ts.isNamespaceImport = isNamespaceImport; function isNamespaceExport(node) { - return node.kind === 274 /* SyntaxKind.NamespaceExport */; + return node.kind === 277 /* SyntaxKind.NamespaceExport */; } ts.isNamespaceExport = isNamespaceExport; function isNamedImports(node) { - return node.kind === 269 /* SyntaxKind.NamedImports */; + return node.kind === 272 /* SyntaxKind.NamedImports */; } ts.isNamedImports = isNamedImports; function isImportSpecifier(node) { - return node.kind === 270 /* SyntaxKind.ImportSpecifier */; + return node.kind === 273 /* SyntaxKind.ImportSpecifier */; } ts.isImportSpecifier = isImportSpecifier; function isExportAssignment(node) { - return node.kind === 271 /* SyntaxKind.ExportAssignment */; + return node.kind === 274 /* SyntaxKind.ExportAssignment */; } ts.isExportAssignment = isExportAssignment; function isExportDeclaration(node) { - return node.kind === 272 /* SyntaxKind.ExportDeclaration */; + return node.kind === 275 /* SyntaxKind.ExportDeclaration */; } ts.isExportDeclaration = isExportDeclaration; function isNamedExports(node) { - return node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 275 /* SyntaxKind.ExportSpecifier */; + return node.kind === 278 /* SyntaxKind.ExportSpecifier */; } ts.isExportSpecifier = isExportSpecifier; function isMissingDeclaration(node) { - return node.kind === 276 /* SyntaxKind.MissingDeclaration */; + return node.kind === 279 /* SyntaxKind.MissingDeclaration */; } ts.isMissingDeclaration = isMissingDeclaration; function isNotEmittedStatement(node) { - return node.kind === 349 /* SyntaxKind.NotEmittedStatement */; + return node.kind === 352 /* SyntaxKind.NotEmittedStatement */; } ts.isNotEmittedStatement = isNotEmittedStatement; /* @internal */ function isSyntheticReference(node) { - return node.kind === 354 /* SyntaxKind.SyntheticReferenceExpression */; + return node.kind === 357 /* SyntaxKind.SyntheticReferenceExpression */; } ts.isSyntheticReference = isSyntheticReference; /* @internal */ function isMergeDeclarationMarker(node) { - return node.kind === 352 /* SyntaxKind.MergeDeclarationMarker */; + return node.kind === 355 /* SyntaxKind.MergeDeclarationMarker */; } ts.isMergeDeclarationMarker = isMergeDeclarationMarker; /* @internal */ function isEndOfDeclarationMarker(node) { - return node.kind === 353 /* SyntaxKind.EndOfDeclarationMarker */; + return node.kind === 356 /* SyntaxKind.EndOfDeclarationMarker */; } ts.isEndOfDeclarationMarker = isEndOfDeclarationMarker; // Module References function isExternalModuleReference(node) { - return node.kind === 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 280 /* SyntaxKind.ExternalModuleReference */; } ts.isExternalModuleReference = isExternalModuleReference; // JSX function isJsxElement(node) { - return node.kind === 278 /* SyntaxKind.JsxElement */; + return node.kind === 281 /* SyntaxKind.JsxElement */; } ts.isJsxElement = isJsxElement; function isJsxSelfClosingElement(node) { - return node.kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return node.kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } ts.isJsxSelfClosingElement = isJsxSelfClosingElement; function isJsxOpeningElement(node) { - return node.kind === 280 /* SyntaxKind.JsxOpeningElement */; + return node.kind === 283 /* SyntaxKind.JsxOpeningElement */; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 281 /* SyntaxKind.JsxClosingElement */; + return node.kind === 284 /* SyntaxKind.JsxClosingElement */; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxFragment(node) { - return node.kind === 282 /* SyntaxKind.JsxFragment */; + return node.kind === 285 /* SyntaxKind.JsxFragment */; } ts.isJsxFragment = isJsxFragment; function isJsxOpeningFragment(node) { - return node.kind === 283 /* SyntaxKind.JsxOpeningFragment */; + return node.kind === 286 /* SyntaxKind.JsxOpeningFragment */; } ts.isJsxOpeningFragment = isJsxOpeningFragment; function isJsxClosingFragment(node) { - return node.kind === 284 /* SyntaxKind.JsxClosingFragment */; + return node.kind === 287 /* SyntaxKind.JsxClosingFragment */; } ts.isJsxClosingFragment = isJsxClosingFragment; function isJsxAttribute(node) { - return node.kind === 285 /* SyntaxKind.JsxAttribute */; + return node.kind === 288 /* SyntaxKind.JsxAttribute */; } ts.isJsxAttribute = isJsxAttribute; function isJsxAttributes(node) { - return node.kind === 286 /* SyntaxKind.JsxAttributes */; + return node.kind === 289 /* SyntaxKind.JsxAttributes */; } ts.isJsxAttributes = isJsxAttributes; function isJsxSpreadAttribute(node) { - return node.kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return node.kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxExpression(node) { - return node.kind === 288 /* SyntaxKind.JsxExpression */; + return node.kind === 291 /* SyntaxKind.JsxExpression */; } ts.isJsxExpression = isJsxExpression; // Clauses function isCaseClause(node) { - return node.kind === 289 /* SyntaxKind.CaseClause */; + return node.kind === 292 /* SyntaxKind.CaseClause */; } ts.isCaseClause = isCaseClause; function isDefaultClause(node) { - return node.kind === 290 /* SyntaxKind.DefaultClause */; + return node.kind === 293 /* SyntaxKind.DefaultClause */; } ts.isDefaultClause = isDefaultClause; function isHeritageClause(node) { - return node.kind === 291 /* SyntaxKind.HeritageClause */; + return node.kind === 294 /* SyntaxKind.HeritageClause */; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClause = isCatchClause; // Property assignments function isPropertyAssignment(node) { - return node.kind === 296 /* SyntaxKind.PropertyAssignment */; + return node.kind === 299 /* SyntaxKind.PropertyAssignment */; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */; + return node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isSpreadAssignment(node) { - return node.kind === 298 /* SyntaxKind.SpreadAssignment */; + return node.kind === 301 /* SyntaxKind.SpreadAssignment */; } ts.isSpreadAssignment = isSpreadAssignment; // Enum function isEnumMember(node) { - return node.kind === 299 /* SyntaxKind.EnumMember */; + return node.kind === 302 /* SyntaxKind.EnumMember */; } ts.isEnumMember = isEnumMember; // Unparsed // TODO(rbuckton): isUnparsedPrologue function isUnparsedPrepend(node) { - return node.kind === 301 /* SyntaxKind.UnparsedPrepend */; + return node.kind === 304 /* SyntaxKind.UnparsedPrepend */; } ts.isUnparsedPrepend = isUnparsedPrepend; // TODO(rbuckton): isUnparsedText @@ -29595,176 +29785,176 @@ var ts; // TODO(rbuckton): isUnparsedSyntheticReference // Top-level nodes function isSourceFile(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */; + return node.kind === 308 /* SyntaxKind.SourceFile */; } ts.isSourceFile = isSourceFile; function isBundle(node) { - return node.kind === 306 /* SyntaxKind.Bundle */; + return node.kind === 309 /* SyntaxKind.Bundle */; } ts.isBundle = isBundle; function isUnparsedSource(node) { - return node.kind === 307 /* SyntaxKind.UnparsedSource */; + return node.kind === 310 /* SyntaxKind.UnparsedSource */; } ts.isUnparsedSource = isUnparsedSource; // TODO(rbuckton): isInputFiles // JSDoc Elements function isJSDocTypeExpression(node) { - return node.kind === 309 /* SyntaxKind.JSDocTypeExpression */; + return node.kind === 312 /* SyntaxKind.JSDocTypeExpression */; } ts.isJSDocTypeExpression = isJSDocTypeExpression; function isJSDocNameReference(node) { - return node.kind === 310 /* SyntaxKind.JSDocNameReference */; + return node.kind === 313 /* SyntaxKind.JSDocNameReference */; } ts.isJSDocNameReference = isJSDocNameReference; function isJSDocMemberName(node) { - return node.kind === 311 /* SyntaxKind.JSDocMemberName */; + return node.kind === 314 /* SyntaxKind.JSDocMemberName */; } ts.isJSDocMemberName = isJSDocMemberName; function isJSDocLink(node) { - return node.kind === 324 /* SyntaxKind.JSDocLink */; + return node.kind === 327 /* SyntaxKind.JSDocLink */; } ts.isJSDocLink = isJSDocLink; function isJSDocLinkCode(node) { - return node.kind === 325 /* SyntaxKind.JSDocLinkCode */; + return node.kind === 328 /* SyntaxKind.JSDocLinkCode */; } ts.isJSDocLinkCode = isJSDocLinkCode; function isJSDocLinkPlain(node) { - return node.kind === 326 /* SyntaxKind.JSDocLinkPlain */; + return node.kind === 329 /* SyntaxKind.JSDocLinkPlain */; } ts.isJSDocLinkPlain = isJSDocLinkPlain; function isJSDocAllType(node) { - return node.kind === 312 /* SyntaxKind.JSDocAllType */; + return node.kind === 315 /* SyntaxKind.JSDocAllType */; } ts.isJSDocAllType = isJSDocAllType; function isJSDocUnknownType(node) { - return node.kind === 313 /* SyntaxKind.JSDocUnknownType */; + return node.kind === 316 /* SyntaxKind.JSDocUnknownType */; } ts.isJSDocUnknownType = isJSDocUnknownType; function isJSDocNullableType(node) { - return node.kind === 314 /* SyntaxKind.JSDocNullableType */; + return node.kind === 317 /* SyntaxKind.JSDocNullableType */; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 315 /* SyntaxKind.JSDocNonNullableType */; + return node.kind === 318 /* SyntaxKind.JSDocNonNullableType */; } ts.isJSDocNonNullableType = isJSDocNonNullableType; function isJSDocOptionalType(node) { - return node.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return node.kind === 319 /* SyntaxKind.JSDocOptionalType */; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 317 /* SyntaxKind.JSDocFunctionType */; + return node.kind === 320 /* SyntaxKind.JSDocFunctionType */; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 318 /* SyntaxKind.JSDocVariadicType */; + return node.kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isJSDocVariadicType = isJSDocVariadicType; function isJSDocNamepathType(node) { - return node.kind === 319 /* SyntaxKind.JSDocNamepathType */; + return node.kind === 322 /* SyntaxKind.JSDocNamepathType */; } ts.isJSDocNamepathType = isJSDocNamepathType; function isJSDoc(node) { - return node.kind === 320 /* SyntaxKind.JSDoc */; + return node.kind === 323 /* SyntaxKind.JSDoc */; } ts.isJSDoc = isJSDoc; function isJSDocTypeLiteral(node) { - return node.kind === 322 /* SyntaxKind.JSDocTypeLiteral */; + return node.kind === 325 /* SyntaxKind.JSDocTypeLiteral */; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; function isJSDocSignature(node) { - return node.kind === 323 /* SyntaxKind.JSDocSignature */; + return node.kind === 326 /* SyntaxKind.JSDocSignature */; } ts.isJSDocSignature = isJSDocSignature; // JSDoc Tags function isJSDocAugmentsTag(node) { - return node.kind === 328 /* SyntaxKind.JSDocAugmentsTag */; + return node.kind === 331 /* SyntaxKind.JSDocAugmentsTag */; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocAuthorTag(node) { - return node.kind === 330 /* SyntaxKind.JSDocAuthorTag */; + return node.kind === 333 /* SyntaxKind.JSDocAuthorTag */; } ts.isJSDocAuthorTag = isJSDocAuthorTag; function isJSDocClassTag(node) { - return node.kind === 332 /* SyntaxKind.JSDocClassTag */; + return node.kind === 335 /* SyntaxKind.JSDocClassTag */; } ts.isJSDocClassTag = isJSDocClassTag; function isJSDocCallbackTag(node) { - return node.kind === 338 /* SyntaxKind.JSDocCallbackTag */; + return node.kind === 341 /* SyntaxKind.JSDocCallbackTag */; } ts.isJSDocCallbackTag = isJSDocCallbackTag; function isJSDocPublicTag(node) { - return node.kind === 333 /* SyntaxKind.JSDocPublicTag */; + return node.kind === 336 /* SyntaxKind.JSDocPublicTag */; } ts.isJSDocPublicTag = isJSDocPublicTag; function isJSDocPrivateTag(node) { - return node.kind === 334 /* SyntaxKind.JSDocPrivateTag */; + return node.kind === 337 /* SyntaxKind.JSDocPrivateTag */; } ts.isJSDocPrivateTag = isJSDocPrivateTag; function isJSDocProtectedTag(node) { - return node.kind === 335 /* SyntaxKind.JSDocProtectedTag */; + return node.kind === 338 /* SyntaxKind.JSDocProtectedTag */; } ts.isJSDocProtectedTag = isJSDocProtectedTag; function isJSDocReadonlyTag(node) { - return node.kind === 336 /* SyntaxKind.JSDocReadonlyTag */; + return node.kind === 339 /* SyntaxKind.JSDocReadonlyTag */; } ts.isJSDocReadonlyTag = isJSDocReadonlyTag; function isJSDocOverrideTag(node) { - return node.kind === 337 /* SyntaxKind.JSDocOverrideTag */; + return node.kind === 340 /* SyntaxKind.JSDocOverrideTag */; } ts.isJSDocOverrideTag = isJSDocOverrideTag; function isJSDocDeprecatedTag(node) { - return node.kind === 331 /* SyntaxKind.JSDocDeprecatedTag */; + return node.kind === 334 /* SyntaxKind.JSDocDeprecatedTag */; } ts.isJSDocDeprecatedTag = isJSDocDeprecatedTag; function isJSDocSeeTag(node) { - return node.kind === 346 /* SyntaxKind.JSDocSeeTag */; + return node.kind === 349 /* SyntaxKind.JSDocSeeTag */; } ts.isJSDocSeeTag = isJSDocSeeTag; function isJSDocEnumTag(node) { - return node.kind === 339 /* SyntaxKind.JSDocEnumTag */; + return node.kind === 342 /* SyntaxKind.JSDocEnumTag */; } ts.isJSDocEnumTag = isJSDocEnumTag; function isJSDocParameterTag(node) { - return node.kind === 340 /* SyntaxKind.JSDocParameterTag */; + return node.kind === 343 /* SyntaxKind.JSDocParameterTag */; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 341 /* SyntaxKind.JSDocReturnTag */; + return node.kind === 344 /* SyntaxKind.JSDocReturnTag */; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocThisTag(node) { - return node.kind === 342 /* SyntaxKind.JSDocThisTag */; + return node.kind === 345 /* SyntaxKind.JSDocThisTag */; } ts.isJSDocThisTag = isJSDocThisTag; function isJSDocTypeTag(node) { - return node.kind === 343 /* SyntaxKind.JSDocTypeTag */; + return node.kind === 346 /* SyntaxKind.JSDocTypeTag */; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 344 /* SyntaxKind.JSDocTemplateTag */; + return node.kind === 347 /* SyntaxKind.JSDocTemplateTag */; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 345 /* SyntaxKind.JSDocTypedefTag */; + return node.kind === 348 /* SyntaxKind.JSDocTypedefTag */; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocUnknownTag(node) { - return node.kind === 327 /* SyntaxKind.JSDocTag */; + return node.kind === 330 /* SyntaxKind.JSDocTag */; } ts.isJSDocUnknownTag = isJSDocUnknownTag; function isJSDocPropertyTag(node) { - return node.kind === 347 /* SyntaxKind.JSDocPropertyTag */; + return node.kind === 350 /* SyntaxKind.JSDocPropertyTag */; } ts.isJSDocPropertyTag = isJSDocPropertyTag; function isJSDocImplementsTag(node) { - return node.kind === 329 /* SyntaxKind.JSDocImplementsTag */; + return node.kind === 332 /* SyntaxKind.JSDocImplementsTag */; } ts.isJSDocImplementsTag = isJSDocImplementsTag; // Synthesized list /* @internal */ function isSyntaxList(n) { - return n.kind === 348 /* SyntaxKind.SyntaxList */; + return n.kind === 351 /* SyntaxKind.SyntaxList */; } ts.isSyntaxList = isSyntaxList; })(ts || (ts = {})); @@ -29963,14 +30153,14 @@ var ts; ts.Debug.failBadSyntaxKind(property.name, "Private identifiers are not allowed in object literals."); } switch (property.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return createExpressionForAccessorDeclaration(factory, node.properties, property, receiver, !!node.multiLine); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return createExpressionForPropertyAssignment(factory, property, receiver); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return createExpressionForShorthandPropertyAssignment(factory, property, receiver); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return createExpressionForMethodDeclaration(factory, property, receiver); } } @@ -30078,8 +30268,8 @@ var ts; } ts.startsWithUseStrict = startsWithUseStrict; function isCommaSequence(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ || - node.kind === 351 /* SyntaxKind.CommaListExpression */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ || + node.kind === 354 /* SyntaxKind.CommaListExpression */; } ts.isCommaSequence = isCommaSequence; function isJSDocTypeAssertion(node) { @@ -30097,17 +30287,18 @@ var ts; function isOuterExpression(node, kinds) { if (kinds === void 0) { kinds = 15 /* OuterExpressionKinds.All */; } switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: if (kinds & 16 /* OuterExpressionKinds.ExcludeJSDocTypeAssertion */ && isJSDocTypeAssertion(node)) { return false; } return (kinds & 1 /* OuterExpressionKinds.Parentheses */) !== 0; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return (kinds & 2 /* OuterExpressionKinds.TypeAssertions */) !== 0; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return (kinds & 4 /* OuterExpressionKinds.NonNullAssertions */) !== 0; - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return (kinds & 8 /* OuterExpressionKinds.PartiallyEmittedExpressions */) !== 0; } return false; @@ -30228,10 +30419,10 @@ var ts; var name = namespaceDeclaration.name; return ts.isGeneratedIdentifier(name) ? name : factory.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name)); } - if (node.kind === 266 /* SyntaxKind.ImportDeclaration */ && node.importClause) { + if (node.kind === 269 /* SyntaxKind.ImportDeclaration */ && node.importClause) { return factory.getGeneratedNameForNode(node); } - if (node.kind === 272 /* SyntaxKind.ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 275 /* SyntaxKind.ExportDeclaration */ && node.moduleSpecifier) { return factory.getGeneratedNameForNode(node); } return undefined; @@ -30350,7 +30541,7 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // `b` in `({ a: b } = ...)` // `b` in `({ a: b = 1 } = ...)` // `{b}` in `({ a: {b} } = ...)` @@ -30362,11 +30553,11 @@ var ts; // `b[0]` in `({ a: b[0] } = ...)` // `b[0]` in `({ a: b[0] = 1 } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // `a` in `({ a } = ...)` // `a` in `({ a = 1 } = ...)` return bindingElement.name; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: // `a` in `({ ...a } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } @@ -30398,12 +30589,12 @@ var ts; */ function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: // `...` in `let [...a] = ...` return bindingElement.dotDotDotToken; - case 225 /* SyntaxKind.SpreadElement */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 227 /* SyntaxKind.SpreadElement */: + case 301 /* SyntaxKind.SpreadAssignment */: // `...` in `[...a] = ...` return bindingElement; } @@ -30421,7 +30612,7 @@ var ts; ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; function tryGetPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: // `a` in `let { a: b } = ...` // `[a]` in `let { [a]: b } = ...` // `"a"` in `let { "a": b } = ...` @@ -30436,7 +30627,7 @@ var ts; : propertyName; } break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // `a` in `({ a: b } = ...)` // `[a]` in `({ [a]: b } = ...)` // `"a"` in `({ "a": b } = ...)` @@ -30451,7 +30642,7 @@ var ts; : propertyName; } break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: // `a` in `({ ...a } = ...)` if (bindingElement.name && ts.isPrivateIdentifier(bindingElement.name)) { return ts.Debug.failBadSyntaxKind(bindingElement.name); @@ -30474,13 +30665,13 @@ var ts; */ function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: // `a` in `{a}` // `a` in `[a]` return name.elements; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: // `a` in `{a}` return name.properties; } @@ -30501,46 +30692,46 @@ var ts; ts.getJSDocTypeAliasName = getJSDocTypeAliasName; function canHaveIllegalType(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.canHaveIllegalType = canHaveIllegalType; function canHaveIllegalTypeParameters(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.canHaveIllegalTypeParameters = canHaveIllegalTypeParameters; function canHaveIllegalDecorators(node) { var kind = node.kind; - return kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */; + return kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */; } ts.canHaveIllegalDecorators = canHaveIllegalDecorators; function canHaveIllegalModifiers(node) { var kind = node.kind; - return kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 179 /* SyntaxKind.FunctionType */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 181 /* SyntaxKind.FunctionType */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } ts.canHaveIllegalModifiers = canHaveIllegalModifiers; ts.isTypeNodeOrTypeParameterDeclaration = ts.or(ts.isTypeNode, ts.isTypeParameterDeclaration); @@ -30814,6 +31005,83 @@ var ts; return ts.setTextRange(factory.createNodeArray([], nodes.hasTrailingComma), nodes); } ts.elideNodes = elideNodes; + /** + * Gets the node from which a name should be generated. + */ + function getNodeForGeneratedName(name) { + if (name.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) { + var autoGenerateId = name.autoGenerateId; + var node = name; + var original = node.original; + while (original) { + node = original; + // if "node" is a different generated name (having a different "autoGenerateId"), use it and stop traversing. + if (ts.isMemberName(node) + && !!(node.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) + && node.autoGenerateId !== autoGenerateId) { + break; + } + original = node.original; + } + // otherwise, return the original node for the source + return node; + } + return name; + } + ts.getNodeForGeneratedName = getNodeForGeneratedName; + function formatGeneratedNamePart(part, generateName) { + return typeof part === "object" ? formatGeneratedName(/*privateName*/ false, part.prefix, part.node, part.suffix, generateName) : + typeof part === "string" ? part.length > 0 && part.charCodeAt(0) === 35 /* CharacterCodes.hash */ ? part.slice(1) : part : + ""; + } + ts.formatGeneratedNamePart = formatGeneratedNamePart; + function formatIdentifier(name, generateName) { + return typeof name === "string" ? name : + formatIdentifierWorker(name, ts.Debug.checkDefined(generateName)); + } + function formatIdentifierWorker(node, generateName) { + return ts.isGeneratedPrivateIdentifier(node) ? generateName(node).slice(1) : + ts.isGeneratedIdentifier(node) ? generateName(node) : + ts.isPrivateIdentifier(node) ? node.escapedText.slice(1) : + ts.idText(node); + } + function formatGeneratedName(privateName, prefix, baseName, suffix, generateName) { + prefix = formatGeneratedNamePart(prefix, generateName); + suffix = formatGeneratedNamePart(suffix, generateName); + baseName = formatIdentifier(baseName, generateName); + return "".concat(privateName ? "#" : "").concat(prefix).concat(baseName).concat(suffix); + } + ts.formatGeneratedName = formatGeneratedName; + /** + * Creates a private backing field for an `accessor` {@link PropertyDeclaration}. + */ + function createAccessorPropertyBackingField(factory, node, modifiers, initializer) { + return factory.updatePropertyDeclaration(node, modifiers, factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage"), + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, initializer); + } + ts.createAccessorPropertyBackingField = createAccessorPropertyBackingField; + /** + * Creates a {@link GetAccessorDeclaration} that reads from a private backing field. + */ + function createAccessorPropertyGetRedirector(factory, node, modifiers, name) { + return factory.createGetAccessorDeclaration(modifiers, name, [], + /*type*/ undefined, factory.createBlock([ + factory.createReturnStatement(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage"))) + ])); + } + ts.createAccessorPropertyGetRedirector = createAccessorPropertyGetRedirector; + /** + * Creates a {@link SetAccessorDeclaration} that writes to a private backing field. + */ + function createAccessorPropertySetRedirector(factory, node, modifiers, name) { + return factory.createSetAccessorDeclaration(modifiers, name, [factory.createParameterDeclaration( + /*modifiers*/ undefined, + /*dotdotDotToken*/ undefined, "value")], factory.createBlock([ + factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage")), factory.createIdentifier("value"))) + ])); + } + ts.createAccessorPropertySetRedirector = createAccessorPropertySetRedirector; })(ts || (ts = {})); var ts; (function (ts) { @@ -30823,47 +31091,48 @@ var ts; ts.setTextRange = setTextRange; function canHaveModifiers(node) { var kind = node.kind; - return kind === 163 /* SyntaxKind.TypeParameter */ - || kind === 164 /* SyntaxKind.Parameter */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 180 /* SyntaxKind.ConstructorType */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */ - || kind === 272 /* SyntaxKind.ExportDeclaration */; + return kind === 165 /* SyntaxKind.TypeParameter */ + || kind === 166 /* SyntaxKind.Parameter */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 182 /* SyntaxKind.ConstructorType */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */ + || kind === 275 /* SyntaxKind.ExportDeclaration */; } ts.canHaveModifiers = canHaveModifiers; function canHaveDecorators(node) { var kind = node.kind; - return kind === 164 /* SyntaxKind.Parameter */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 257 /* SyntaxKind.ClassDeclaration */; + return kind === 166 /* SyntaxKind.Parameter */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 260 /* SyntaxKind.ClassDeclaration */; } ts.canHaveDecorators = canHaveDecorators; })(ts || (ts = {})); var ts; (function (ts) { + var _a; var SignatureFlags; (function (SignatureFlags) { SignatureFlags[SignatureFlags["None"] = 0] = "None"; @@ -30951,6 +31220,718 @@ var ts; function isImportMeta(node) { return ts.isMetaProperty(node) && node.keywordToken === 100 /* SyntaxKind.ImportKeyword */ && node.name.escapedText === "meta"; } + var forEachChildTable = (_a = {}, + _a[163 /* SyntaxKind.QualifiedName */] = function forEachChildInQualifiedName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + }, + _a[165 /* SyntaxKind.TypeParameter */] = function forEachChildInTypeParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.default) || + visitNode(cbNode, node.expression); + }, + _a[300 /* SyntaxKind.ShorthandPropertyAssignment */] = function forEachChildInShorthandPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.equalsToken) || + visitNode(cbNode, node.objectAssignmentInitializer); + }, + _a[301 /* SyntaxKind.SpreadAssignment */] = function forEachChildInSpreadAssignment(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[166 /* SyntaxKind.Parameter */] = function forEachChildInParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[169 /* SyntaxKind.PropertyDeclaration */] = function forEachChildInPropertyDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[168 /* SyntaxKind.PropertySignature */] = function forEachChildInPropertySignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[299 /* SyntaxKind.PropertyAssignment */] = function forEachChildInPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.initializer); + }, + _a[257 /* SyntaxKind.VariableDeclaration */] = function forEachChildInVariableDeclaration(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[205 /* SyntaxKind.BindingElement */] = function forEachChildInBindingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[178 /* SyntaxKind.IndexSignature */] = function forEachChildInIndexSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[182 /* SyntaxKind.ConstructorType */] = function forEachChildInConstructorType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[181 /* SyntaxKind.FunctionType */] = function forEachChildInFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[176 /* SyntaxKind.CallSignature */] = forEachChildInCallOrConstructSignature, + _a[177 /* SyntaxKind.ConstructSignature */] = forEachChildInCallOrConstructSignature, + _a[171 /* SyntaxKind.MethodDeclaration */] = function forEachChildInMethodDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[170 /* SyntaxKind.MethodSignature */] = function forEachChildInMethodSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[173 /* SyntaxKind.Constructor */] = function forEachChildInConstructor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[174 /* SyntaxKind.GetAccessor */] = function forEachChildInGetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[175 /* SyntaxKind.SetAccessor */] = function forEachChildInSetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[259 /* SyntaxKind.FunctionDeclaration */] = function forEachChildInFunctionDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[215 /* SyntaxKind.FunctionExpression */] = function forEachChildInFunctionExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[216 /* SyntaxKind.ArrowFunction */] = function forEachChildInArrowFunction(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.equalsGreaterThanToken) || + visitNode(cbNode, node.body); + }, + _a[172 /* SyntaxKind.ClassStaticBlockDeclaration */] = function forEachChildInClassStaticBlockDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.body); + }, + _a[180 /* SyntaxKind.TypeReference */] = function forEachChildInTypeReference(node, cbNode, cbNodes) { + return visitNode(cbNode, node.typeName) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[179 /* SyntaxKind.TypePredicate */] = function forEachChildInTypePredicate(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertsModifier) || + visitNode(cbNode, node.parameterName) || + visitNode(cbNode, node.type); + }, + _a[183 /* SyntaxKind.TypeQuery */] = function forEachChildInTypeQuery(node, cbNode, cbNodes) { + return visitNode(cbNode, node.exprName) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[184 /* SyntaxKind.TypeLiteral */] = function forEachChildInTypeLiteral(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.members); + }, + _a[185 /* SyntaxKind.ArrayType */] = function forEachChildInArrayType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.elementType); + }, + _a[186 /* SyntaxKind.TupleType */] = function forEachChildInTupleType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[189 /* SyntaxKind.UnionType */] = forEachChildInUnionOrIntersectionType, + _a[190 /* SyntaxKind.IntersectionType */] = forEachChildInUnionOrIntersectionType, + _a[191 /* SyntaxKind.ConditionalType */] = function forEachChildInConditionalType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.checkType) || + visitNode(cbNode, node.extendsType) || + visitNode(cbNode, node.trueType) || + visitNode(cbNode, node.falseType); + }, + _a[192 /* SyntaxKind.InferType */] = function forEachChildInInferType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.typeParameter); + }, + _a[202 /* SyntaxKind.ImportType */] = function forEachChildInImportType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.argument) || + visitNode(cbNode, node.assertions) || + visitNode(cbNode, node.qualifier) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[298 /* SyntaxKind.ImportTypeAssertionContainer */] = function forEachChildInImportTypeAssertionContainer(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertClause); + }, + _a[193 /* SyntaxKind.ParenthesizedType */] = forEachChildInParenthesizedTypeOrTypeOperator, + _a[195 /* SyntaxKind.TypeOperator */] = forEachChildInParenthesizedTypeOrTypeOperator, + _a[196 /* SyntaxKind.IndexedAccessType */] = function forEachChildInIndexedAccessType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.objectType) || + visitNode(cbNode, node.indexType); + }, + _a[197 /* SyntaxKind.MappedType */] = function forEachChildInMappedType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.readonlyToken) || + visitNode(cbNode, node.typeParameter) || + visitNode(cbNode, node.nameType) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[198 /* SyntaxKind.LiteralType */] = function forEachChildInLiteralType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.literal); + }, + _a[199 /* SyntaxKind.NamedTupleMember */] = function forEachChildInNamedTupleMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type); + }, + _a[203 /* SyntaxKind.ObjectBindingPattern */] = forEachChildInObjectOrArrayBindingPattern, + _a[204 /* SyntaxKind.ArrayBindingPattern */] = forEachChildInObjectOrArrayBindingPattern, + _a[206 /* SyntaxKind.ArrayLiteralExpression */] = function forEachChildInArrayLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[207 /* SyntaxKind.ObjectLiteralExpression */] = function forEachChildInObjectLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, + _a[208 /* SyntaxKind.PropertyAccessExpression */] = function forEachChildInPropertyAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNode(cbNode, node.name); + }, + _a[209 /* SyntaxKind.ElementAccessExpression */] = function forEachChildInElementAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNode(cbNode, node.argumentExpression); + }, + _a[210 /* SyntaxKind.CallExpression */] = forEachChildInCallOrNewExpression, + _a[211 /* SyntaxKind.NewExpression */] = forEachChildInCallOrNewExpression, + _a[212 /* SyntaxKind.TaggedTemplateExpression */] = function forEachChildInTaggedTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tag) || + visitNode(cbNode, node.questionDotToken) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNode(cbNode, node.template); + }, + _a[213 /* SyntaxKind.TypeAssertionExpression */] = function forEachChildInTypeAssertionExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.expression); + }, + _a[214 /* SyntaxKind.ParenthesizedExpression */] = function forEachChildInParenthesizedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[217 /* SyntaxKind.DeleteExpression */] = function forEachChildInDeleteExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[218 /* SyntaxKind.TypeOfExpression */] = function forEachChildInTypeOfExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[219 /* SyntaxKind.VoidExpression */] = function forEachChildInVoidExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[221 /* SyntaxKind.PrefixUnaryExpression */] = function forEachChildInPrefixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, + _a[226 /* SyntaxKind.YieldExpression */] = function forEachChildInYieldExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + }, + _a[220 /* SyntaxKind.AwaitExpression */] = function forEachChildInAwaitExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[222 /* SyntaxKind.PostfixUnaryExpression */] = function forEachChildInPostfixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, + _a[223 /* SyntaxKind.BinaryExpression */] = function forEachChildInBinaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.operatorToken) || + visitNode(cbNode, node.right); + }, + _a[231 /* SyntaxKind.AsExpression */] = function forEachChildInAsExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.type); + }, + _a[232 /* SyntaxKind.NonNullExpression */] = function forEachChildInNonNullExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[235 /* SyntaxKind.SatisfiesExpression */] = function forEachChildInSatisfiesExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); + }, + _a[233 /* SyntaxKind.MetaProperty */] = function forEachChildInMetaProperty(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[224 /* SyntaxKind.ConditionalExpression */] = function forEachChildInConditionalExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.condition) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.whenTrue) || + visitNode(cbNode, node.colonToken) || + visitNode(cbNode, node.whenFalse); + }, + _a[227 /* SyntaxKind.SpreadElement */] = function forEachChildInSpreadElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[238 /* SyntaxKind.Block */] = forEachChildInBlock, + _a[265 /* SyntaxKind.ModuleBlock */] = forEachChildInBlock, + _a[308 /* SyntaxKind.SourceFile */] = function forEachChildInSourceFile(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements) || + visitNode(cbNode, node.endOfFileToken); + }, + _a[240 /* SyntaxKind.VariableStatement */] = function forEachChildInVariableStatement(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.declarationList); + }, + _a[258 /* SyntaxKind.VariableDeclarationList */] = function forEachChildInVariableDeclarationList(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.declarations); + }, + _a[241 /* SyntaxKind.ExpressionStatement */] = function forEachChildInExpressionStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[242 /* SyntaxKind.IfStatement */] = function forEachChildInIfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.thenStatement) || + visitNode(cbNode, node.elseStatement); + }, + _a[243 /* SyntaxKind.DoStatement */] = function forEachChildInDoStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.statement) || + visitNode(cbNode, node.expression); + }, + _a[244 /* SyntaxKind.WhileStatement */] = function forEachChildInWhileStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[245 /* SyntaxKind.ForStatement */] = function forEachChildInForStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.incrementor) || + visitNode(cbNode, node.statement); + }, + _a[246 /* SyntaxKind.ForInStatement */] = function forEachChildInForInStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[247 /* SyntaxKind.ForOfStatement */] = function forEachChildInForOfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.awaitModifier) || + visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[248 /* SyntaxKind.ContinueStatement */] = forEachChildInContinueOrBreakStatement, + _a[249 /* SyntaxKind.BreakStatement */] = forEachChildInContinueOrBreakStatement, + _a[250 /* SyntaxKind.ReturnStatement */] = function forEachChildInReturnStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[251 /* SyntaxKind.WithStatement */] = function forEachChildInWithStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[252 /* SyntaxKind.SwitchStatement */] = function forEachChildInSwitchStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.caseBlock); + }, + _a[266 /* SyntaxKind.CaseBlock */] = function forEachChildInCaseBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.clauses); + }, + _a[292 /* SyntaxKind.CaseClause */] = function forEachChildInCaseClause(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNodes(cbNode, cbNodes, node.statements); + }, + _a[293 /* SyntaxKind.DefaultClause */] = function forEachChildInDefaultClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + }, + _a[253 /* SyntaxKind.LabeledStatement */] = function forEachChildInLabeledStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + }, + _a[254 /* SyntaxKind.ThrowStatement */] = function forEachChildInThrowStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[255 /* SyntaxKind.TryStatement */] = function forEachChildInTryStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tryBlock) || + visitNode(cbNode, node.catchClause) || + visitNode(cbNode, node.finallyBlock); + }, + _a[295 /* SyntaxKind.CatchClause */] = function forEachChildInCatchClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.variableDeclaration) || + visitNode(cbNode, node.block); + }, + _a[167 /* SyntaxKind.Decorator */] = function forEachChildInDecorator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[260 /* SyntaxKind.ClassDeclaration */] = forEachChildInClassDeclarationOrExpression, + _a[228 /* SyntaxKind.ClassExpression */] = forEachChildInClassDeclarationOrExpression, + _a[261 /* SyntaxKind.InterfaceDeclaration */] = function forEachChildInInterfaceDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[262 /* SyntaxKind.TypeAliasDeclaration */] = function forEachChildInTypeAliasDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNode(cbNode, node.type); + }, + _a[263 /* SyntaxKind.EnumDeclaration */] = function forEachChildInEnumDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[302 /* SyntaxKind.EnumMember */] = function forEachChildInEnumMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[264 /* SyntaxKind.ModuleDeclaration */] = function forEachChildInModuleDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); + }, + _a[268 /* SyntaxKind.ImportEqualsDeclaration */] = function forEachChildInImportEqualsDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.moduleReference); + }, + _a[269 /* SyntaxKind.ImportDeclaration */] = function forEachChildInImportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.importClause) || + visitNode(cbNode, node.moduleSpecifier) || + visitNode(cbNode, node.assertClause); + }, + _a[270 /* SyntaxKind.ImportClause */] = function forEachChildInImportClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.namedBindings); + }, + _a[296 /* SyntaxKind.AssertClause */] = function forEachChildInAssertClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[297 /* SyntaxKind.AssertEntry */] = function forEachChildInAssertEntry(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.value); + }, + _a[267 /* SyntaxKind.NamespaceExportDeclaration */] = function forEachChildInNamespaceExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNode(cbNode, node.name); + }, + _a[271 /* SyntaxKind.NamespaceImport */] = function forEachChildInNamespaceImport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[277 /* SyntaxKind.NamespaceExport */] = function forEachChildInNamespaceExport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[272 /* SyntaxKind.NamedImports */] = forEachChildInNamedImportsOrExports, + _a[276 /* SyntaxKind.NamedExports */] = forEachChildInNamedImportsOrExports, + _a[275 /* SyntaxKind.ExportDeclaration */] = function forEachChildInExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.exportClause) || + visitNode(cbNode, node.moduleSpecifier) || + visitNode(cbNode, node.assertClause); + }, + _a[273 /* SyntaxKind.ImportSpecifier */] = forEachChildInImportOrExportSpecifier, + _a[278 /* SyntaxKind.ExportSpecifier */] = forEachChildInImportOrExportSpecifier, + _a[274 /* SyntaxKind.ExportAssignment */] = function forEachChildInExportAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.expression); + }, + _a[225 /* SyntaxKind.TemplateExpression */] = function forEachChildInTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || + visitNodes(cbNode, cbNodes, node.templateSpans); + }, + _a[236 /* SyntaxKind.TemplateSpan */] = function forEachChildInTemplateSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.literal); + }, + _a[200 /* SyntaxKind.TemplateLiteralType */] = function forEachChildInTemplateLiteralType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || + visitNodes(cbNode, cbNodes, node.templateSpans); + }, + _a[201 /* SyntaxKind.TemplateLiteralTypeSpan */] = function forEachChildInTemplateLiteralTypeSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.literal); + }, + _a[164 /* SyntaxKind.ComputedPropertyName */] = function forEachChildInComputedPropertyName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[294 /* SyntaxKind.HeritageClause */] = function forEachChildInHeritageClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + }, + _a[230 /* SyntaxKind.ExpressionWithTypeArguments */] = function forEachChildInExpressionWithTypeArguments(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[280 /* SyntaxKind.ExternalModuleReference */] = function forEachChildInExternalModuleReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[279 /* SyntaxKind.MissingDeclaration */] = function forEachChildInMissingDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers); + }, + _a[354 /* SyntaxKind.CommaListExpression */] = function forEachChildInCommaListExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[281 /* SyntaxKind.JsxElement */] = function forEachChildInJsxElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingElement) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingElement); + }, + _a[285 /* SyntaxKind.JsxFragment */] = function forEachChildInJsxFragment(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingFragment) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingFragment); + }, + _a[282 /* SyntaxKind.JsxSelfClosingElement */] = forEachChildInJsxOpeningOrSelfClosingElement, + _a[283 /* SyntaxKind.JsxOpeningElement */] = forEachChildInJsxOpeningOrSelfClosingElement, + _a[289 /* SyntaxKind.JsxAttributes */] = function forEachChildInJsxAttributes(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, + _a[288 /* SyntaxKind.JsxAttribute */] = function forEachChildInJsxAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[290 /* SyntaxKind.JsxSpreadAttribute */] = function forEachChildInJsxSpreadAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[291 /* SyntaxKind.JsxExpression */] = function forEachChildInJsxExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.expression); + }, + _a[284 /* SyntaxKind.JsxClosingElement */] = function forEachChildInJsxClosingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tagName); + }, + _a[187 /* SyntaxKind.OptionalType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[188 /* SyntaxKind.RestType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[312 /* SyntaxKind.JSDocTypeExpression */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[318 /* SyntaxKind.JSDocNonNullableType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[317 /* SyntaxKind.JSDocNullableType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[319 /* SyntaxKind.JSDocOptionalType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[321 /* SyntaxKind.JSDocVariadicType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[320 /* SyntaxKind.JSDocFunctionType */] = function forEachChildInJSDocFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[323 /* SyntaxKind.JSDoc */] = function forEachChildInJSDoc(node, cbNode, cbNodes) { + return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) + || visitNodes(cbNode, cbNodes, node.tags); + }, + _a[349 /* SyntaxKind.JSDocSeeTag */] = function forEachChildInJSDocSeeTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.name) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[313 /* SyntaxKind.JSDocNameReference */] = function forEachChildInJSDocNameReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[314 /* SyntaxKind.JSDocMemberName */] = function forEachChildInJSDocMemberName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + }, + _a[343 /* SyntaxKind.JSDocParameterTag */] = forEachChildInJSDocParameterOrPropertyTag, + _a[350 /* SyntaxKind.JSDocPropertyTag */] = forEachChildInJSDocParameterOrPropertyTag, + _a[333 /* SyntaxKind.JSDocAuthorTag */] = function forEachChildInJSDocAuthorTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[332 /* SyntaxKind.JSDocImplementsTag */] = function forEachChildInJSDocImplementsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.class) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[331 /* SyntaxKind.JSDocAugmentsTag */] = function forEachChildInJSDocAugmentsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.class) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[347 /* SyntaxKind.JSDocTemplateTag */] = function forEachChildInJSDocTemplateTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.constraint) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[348 /* SyntaxKind.JSDocTypedefTag */] = function forEachChildInJSDocTypedefTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (node.typeExpression && + node.typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */ + ? visitNode(cbNode, node.typeExpression) || + visitNode(cbNode, node.fullName) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) + : visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); + }, + _a[341 /* SyntaxKind.JSDocCallbackTag */] = function forEachChildInJSDocCallbackTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[344 /* SyntaxKind.JSDocReturnTag */] = forEachChildInJSDocReturnTag, + _a[346 /* SyntaxKind.JSDocTypeTag */] = forEachChildInJSDocReturnTag, + _a[345 /* SyntaxKind.JSDocThisTag */] = forEachChildInJSDocReturnTag, + _a[342 /* SyntaxKind.JSDocEnumTag */] = forEachChildInJSDocReturnTag, + _a[326 /* SyntaxKind.JSDocSignature */] = function forEachChildInJSDocSignature(node, cbNode, _cbNodes) { + return ts.forEach(node.typeParameters, cbNode) || + ts.forEach(node.parameters, cbNode) || + visitNode(cbNode, node.type); + }, + _a[327 /* SyntaxKind.JSDocLink */] = forEachChildInJSDocLinkCodeOrPlain, + _a[328 /* SyntaxKind.JSDocLinkCode */] = forEachChildInJSDocLinkCodeOrPlain, + _a[329 /* SyntaxKind.JSDocLinkPlain */] = forEachChildInJSDocLinkCodeOrPlain, + _a[325 /* SyntaxKind.JSDocTypeLiteral */] = function forEachChildInJSDocTypeLiteral(node, cbNode, _cbNodes) { + return ts.forEach(node.jsDocPropertyTags, cbNode); + }, + _a[330 /* SyntaxKind.JSDocTag */] = forEachChildInJSDocTag, + _a[335 /* SyntaxKind.JSDocClassTag */] = forEachChildInJSDocTag, + _a[336 /* SyntaxKind.JSDocPublicTag */] = forEachChildInJSDocTag, + _a[337 /* SyntaxKind.JSDocPrivateTag */] = forEachChildInJSDocTag, + _a[338 /* SyntaxKind.JSDocProtectedTag */] = forEachChildInJSDocTag, + _a[339 /* SyntaxKind.JSDocReadonlyTag */] = forEachChildInJSDocTag, + _a[334 /* SyntaxKind.JSDocDeprecatedTag */] = forEachChildInJSDocTag, + _a[340 /* SyntaxKind.JSDocOverrideTag */] = forEachChildInJSDocTag, + _a[353 /* SyntaxKind.PartiallyEmittedExpression */] = forEachChildInPartiallyEmittedExpression, + _a); + // shared + function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + } + function forEachChildInUnionOrIntersectionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + } + function forEachChildInParenthesizedTypeOrTypeOperator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInObjectOrArrayBindingPattern(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInCallOrNewExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + // TODO: should we separate these branches out? + visitNode(cbNode, node.questionDotToken) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNodes(cbNode, cbNodes, node.arguments); + } + function forEachChildInBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + } + function forEachChildInContinueOrBreakStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label); + } + function forEachChildInClassDeclarationOrExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); + } + function forEachChildInNamedImportsOrExports(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInImportOrExportSpecifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name); + } + function forEachChildInJsxOpeningOrSelfClosingElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNode(cbNode, node.attributes); + } + function forEachChildInOptionalRestOrJSDocParameterModifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInJSDocParameterOrPropertyTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (node.isNameFirst + ? visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression) + : visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name)) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocReturnTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocLinkCodeOrPlain(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + } + function forEachChildInJSDocTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) + || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInPartiallyEmittedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + } /** * Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes * stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise, @@ -30965,562 +31946,11 @@ var ts; * that they appear in the source code. The language service depends on this property to locate nodes by position. */ function forEachChild(node, cbNode, cbNodes) { - if (!node || node.kind <= 160 /* SyntaxKind.LastToken */) { + if (node === undefined || node.kind <= 162 /* SyntaxKind.LastToken */) { return; } - switch (node.kind) { - case 161 /* SyntaxKind.QualifiedName */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); - case 163 /* SyntaxKind.TypeParameter */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.constraint) || - visitNode(cbNode, node.default) || - visitNode(cbNode, node.expression); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.equalsToken) || - visitNode(cbNode, node.objectAssignmentInitializer); - case 298 /* SyntaxKind.SpreadAssignment */: - return visitNode(cbNode, node.expression); - case 164 /* SyntaxKind.Parameter */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 166 /* SyntaxKind.PropertySignature */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 296 /* SyntaxKind.PropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.initializer); - case 254 /* SyntaxKind.VariableDeclaration */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 203 /* SyntaxKind.BindingElement */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 176 /* SyntaxKind.IndexSignature */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 180 /* SyntaxKind.ConstructorType */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 179 /* SyntaxKind.FunctionType */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - return visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 169 /* SyntaxKind.MethodDeclaration */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 168 /* SyntaxKind.MethodSignature */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 171 /* SyntaxKind.Constructor */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 172 /* SyntaxKind.GetAccessor */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 173 /* SyntaxKind.SetAccessor */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 256 /* SyntaxKind.FunctionDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 213 /* SyntaxKind.FunctionExpression */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 214 /* SyntaxKind.ArrowFunction */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.equalsGreaterThanToken) || - visitNode(cbNode, node.body); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.body); - case 178 /* SyntaxKind.TypeReference */: - return visitNode(cbNode, node.typeName) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 177 /* SyntaxKind.TypePredicate */: - return visitNode(cbNode, node.assertsModifier) || - visitNode(cbNode, node.parameterName) || - visitNode(cbNode, node.type); - case 181 /* SyntaxKind.TypeQuery */: - return visitNode(cbNode, node.exprName) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 182 /* SyntaxKind.TypeLiteral */: - return visitNodes(cbNode, cbNodes, node.members); - case 183 /* SyntaxKind.ArrayType */: - return visitNode(cbNode, node.elementType); - case 184 /* SyntaxKind.TupleType */: - return visitNodes(cbNode, cbNodes, node.elements); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - return visitNodes(cbNode, cbNodes, node.types); - case 189 /* SyntaxKind.ConditionalType */: - return visitNode(cbNode, node.checkType) || - visitNode(cbNode, node.extendsType) || - visitNode(cbNode, node.trueType) || - visitNode(cbNode, node.falseType); - case 190 /* SyntaxKind.InferType */: - return visitNode(cbNode, node.typeParameter); - case 200 /* SyntaxKind.ImportType */: - return visitNode(cbNode, node.argument) || - visitNode(cbNode, node.assertions) || - visitNode(cbNode, node.qualifier) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 295 /* SyntaxKind.ImportTypeAssertionContainer */: - return visitNode(cbNode, node.assertClause); - case 191 /* SyntaxKind.ParenthesizedType */: - case 193 /* SyntaxKind.TypeOperator */: - return visitNode(cbNode, node.type); - case 194 /* SyntaxKind.IndexedAccessType */: - return visitNode(cbNode, node.objectType) || - visitNode(cbNode, node.indexType); - case 195 /* SyntaxKind.MappedType */: - return visitNode(cbNode, node.readonlyToken) || - visitNode(cbNode, node.typeParameter) || - visitNode(cbNode, node.nameType) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNodes(cbNode, cbNodes, node.members); - case 196 /* SyntaxKind.LiteralType */: - return visitNode(cbNode, node.literal); - case 197 /* SyntaxKind.NamedTupleMember */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - return visitNodes(cbNode, cbNodes, node.elements); - case 204 /* SyntaxKind.ArrayLiteralExpression */: - return visitNodes(cbNode, cbNodes, node.elements); - case 205 /* SyntaxKind.ObjectLiteralExpression */: - return visitNodes(cbNode, cbNodes, node.properties); - case 206 /* SyntaxKind.PropertyAccessExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNode(cbNode, node.name); - case 207 /* SyntaxKind.ElementAccessExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNode(cbNode, node.argumentExpression); - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNodes(cbNode, cbNodes, node.arguments); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - return visitNode(cbNode, node.tag) || - visitNode(cbNode, node.questionDotToken) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNode(cbNode, node.template); - case 211 /* SyntaxKind.TypeAssertionExpression */: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.expression); - case 212 /* SyntaxKind.ParenthesizedExpression */: - return visitNode(cbNode, node.expression); - case 215 /* SyntaxKind.DeleteExpression */: - return visitNode(cbNode, node.expression); - case 216 /* SyntaxKind.TypeOfExpression */: - return visitNode(cbNode, node.expression); - case 217 /* SyntaxKind.VoidExpression */: - return visitNode(cbNode, node.expression); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - return visitNode(cbNode, node.operand); - case 224 /* SyntaxKind.YieldExpression */: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); - case 218 /* SyntaxKind.AwaitExpression */: - return visitNode(cbNode, node.expression); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - return visitNode(cbNode, node.operand); - case 221 /* SyntaxKind.BinaryExpression */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.operatorToken) || - visitNode(cbNode, node.right); - case 229 /* SyntaxKind.AsExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.type); - case 230 /* SyntaxKind.NonNullExpression */: - return visitNode(cbNode, node.expression); - case 231 /* SyntaxKind.MetaProperty */: - return visitNode(cbNode, node.name); - case 222 /* SyntaxKind.ConditionalExpression */: - return visitNode(cbNode, node.condition) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.whenTrue) || - visitNode(cbNode, node.colonToken) || - visitNode(cbNode, node.whenFalse); - case 225 /* SyntaxKind.SpreadElement */: - return visitNode(cbNode, node.expression); - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - return visitNodes(cbNode, cbNodes, node.statements); - case 305 /* SyntaxKind.SourceFile */: - return visitNodes(cbNode, cbNodes, node.statements) || - visitNode(cbNode, node.endOfFileToken); - case 237 /* SyntaxKind.VariableStatement */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.declarationList); - case 255 /* SyntaxKind.VariableDeclarationList */: - return visitNodes(cbNode, cbNodes, node.declarations); - case 238 /* SyntaxKind.ExpressionStatement */: - return visitNode(cbNode, node.expression); - case 239 /* SyntaxKind.IfStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.thenStatement) || - visitNode(cbNode, node.elseStatement); - case 240 /* SyntaxKind.DoStatement */: - return visitNode(cbNode, node.statement) || - visitNode(cbNode, node.expression); - case 241 /* SyntaxKind.WhileStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 242 /* SyntaxKind.ForStatement */: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.condition) || - visitNode(cbNode, node.incrementor) || - visitNode(cbNode, node.statement); - case 243 /* SyntaxKind.ForInStatement */: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 244 /* SyntaxKind.ForOfStatement */: - return visitNode(cbNode, node.awaitModifier) || - visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: - return visitNode(cbNode, node.label); - case 247 /* SyntaxKind.ReturnStatement */: - return visitNode(cbNode, node.expression); - case 248 /* SyntaxKind.WithStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 249 /* SyntaxKind.SwitchStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.caseBlock); - case 263 /* SyntaxKind.CaseBlock */: - return visitNodes(cbNode, cbNodes, node.clauses); - case 289 /* SyntaxKind.CaseClause */: - return visitNode(cbNode, node.expression) || - visitNodes(cbNode, cbNodes, node.statements); - case 290 /* SyntaxKind.DefaultClause */: - return visitNodes(cbNode, cbNodes, node.statements); - case 250 /* SyntaxKind.LabeledStatement */: - return visitNode(cbNode, node.label) || - visitNode(cbNode, node.statement); - case 251 /* SyntaxKind.ThrowStatement */: - return visitNode(cbNode, node.expression); - case 252 /* SyntaxKind.TryStatement */: - return visitNode(cbNode, node.tryBlock) || - visitNode(cbNode, node.catchClause) || - visitNode(cbNode, node.finallyBlock); - case 292 /* SyntaxKind.CatchClause */: - return visitNode(cbNode, node.variableDeclaration) || - visitNode(cbNode, node.block); - case 165 /* SyntaxKind.Decorator */: - return visitNode(cbNode, node.expression); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.heritageClauses) || - visitNodes(cbNode, cbNodes, node.members); - case 258 /* SyntaxKind.InterfaceDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.heritageClauses) || - visitNodes(cbNode, cbNodes, node.members); - case 259 /* SyntaxKind.TypeAliasDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNode(cbNode, node.type); - case 260 /* SyntaxKind.EnumDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.members); - case 299 /* SyntaxKind.EnumMember */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 261 /* SyntaxKind.ModuleDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.body); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.moduleReference); - case 266 /* SyntaxKind.ImportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.importClause) || - visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); - case 267 /* SyntaxKind.ImportClause */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.namedBindings); - case 293 /* SyntaxKind.AssertClause */: - return visitNodes(cbNode, cbNodes, node.elements); - case 294 /* SyntaxKind.AssertEntry */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.value); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNode(cbNode, node.name); - case 268 /* SyntaxKind.NamespaceImport */: - return visitNode(cbNode, node.name); - case 274 /* SyntaxKind.NamespaceExport */: - return visitNode(cbNode, node.name); - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: - return visitNodes(cbNode, cbNodes, node.elements); - case 272 /* SyntaxKind.ExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.exportClause) || - visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: - return visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name); - case 271 /* SyntaxKind.ExportAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.expression); - case 223 /* SyntaxKind.TemplateExpression */: - return visitNode(cbNode, node.head) || - visitNodes(cbNode, cbNodes, node.templateSpans); - case 233 /* SyntaxKind.TemplateSpan */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.literal); - case 198 /* SyntaxKind.TemplateLiteralType */: - return visitNode(cbNode, node.head) || - visitNodes(cbNode, cbNodes, node.templateSpans); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.literal); - case 162 /* SyntaxKind.ComputedPropertyName */: - return visitNode(cbNode, node.expression); - case 291 /* SyntaxKind.HeritageClause */: - return visitNodes(cbNode, cbNodes, node.types); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - return visitNode(cbNode, node.expression) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 277 /* SyntaxKind.ExternalModuleReference */: - return visitNode(cbNode, node.expression); - case 276 /* SyntaxKind.MissingDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers); - case 351 /* SyntaxKind.CommaListExpression */: - return visitNodes(cbNode, cbNodes, node.elements); - case 278 /* SyntaxKind.JsxElement */: - return visitNode(cbNode, node.openingElement) || - visitNodes(cbNode, cbNodes, node.children) || - visitNode(cbNode, node.closingElement); - case 282 /* SyntaxKind.JsxFragment */: - return visitNode(cbNode, node.openingFragment) || - visitNodes(cbNode, cbNodes, node.children) || - visitNode(cbNode, node.closingFragment); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - return visitNode(cbNode, node.tagName) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNode(cbNode, node.attributes); - case 286 /* SyntaxKind.JsxAttributes */: - return visitNodes(cbNode, cbNodes, node.properties); - case 285 /* SyntaxKind.JsxAttribute */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 287 /* SyntaxKind.JsxSpreadAttribute */: - return visitNode(cbNode, node.expression); - case 288 /* SyntaxKind.JsxExpression */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.expression); - case 281 /* SyntaxKind.JsxClosingElement */: - return visitNode(cbNode, node.tagName); - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 316 /* SyntaxKind.JSDocOptionalType */: - case 318 /* SyntaxKind.JSDocVariadicType */: - return visitNode(cbNode, node.type); - case 317 /* SyntaxKind.JSDocFunctionType */: - return visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 320 /* SyntaxKind.JSDoc */: - return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - || visitNodes(cbNode, cbNodes, node.tags); - case 346 /* SyntaxKind.JSDocSeeTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.name) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 310 /* SyntaxKind.JSDocNameReference */: - return visitNode(cbNode, node.name); - case 311 /* SyntaxKind.JSDocMemberName */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - return visitNode(cbNode, node.tagName) || - (node.isNameFirst - ? visitNode(cbNode, node.name) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - : visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.name) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); - case 330 /* SyntaxKind.JSDocAuthorTag */: - return visitNode(cbNode, node.tagName) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 329 /* SyntaxKind.JSDocImplementsTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.class) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 328 /* SyntaxKind.JSDocAugmentsTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.class) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 344 /* SyntaxKind.JSDocTemplateTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.constraint) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 345 /* SyntaxKind.JSDocTypedefTag */: - return visitNode(cbNode, node.tagName) || - (node.typeExpression && - node.typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */ - ? visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.fullName) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - : visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); - case 338 /* SyntaxKind.JSDocCallbackTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 341 /* SyntaxKind.JSDocReturnTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: - case 342 /* SyntaxKind.JSDocThisTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 323 /* SyntaxKind.JSDocSignature */: - return ts.forEach(node.typeParameters, cbNode) || - ts.forEach(node.parameters, cbNode) || - visitNode(cbNode, node.type); - case 324 /* SyntaxKind.JSDocLink */: - case 325 /* SyntaxKind.JSDocLinkCode */: - case 326 /* SyntaxKind.JSDocLinkPlain */: - return visitNode(cbNode, node.name); - case 322 /* SyntaxKind.JSDocTypeLiteral */: - return ts.forEach(node.jsDocPropertyTags, cbNode); - case 327 /* SyntaxKind.JSDocTag */: - case 332 /* SyntaxKind.JSDocClassTag */: - case 333 /* SyntaxKind.JSDocPublicTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 336 /* SyntaxKind.JSDocReadonlyTag */: - case 331 /* SyntaxKind.JSDocDeprecatedTag */: - return visitNode(cbNode, node.tagName) - || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - return visitNode(cbNode, node.expression); - } + var fn = forEachChildTable[node.kind]; + return fn === undefined ? undefined : fn(node, cbNode, cbNodes); } ts.forEachChild = forEachChild; /** @internal */ @@ -31567,7 +31997,7 @@ var ts; continue; return res; } - if (current.kind >= 161 /* SyntaxKind.FirstNode */) { + if (current.kind >= 163 /* SyntaxKind.FirstNode */) { // add children in reverse order to the queue, so popping gives the first child for (var _i = 0, _a = gatherPossibleChildren(current); _i < _a.length; _i++) { var child = _a[_i]; @@ -32392,7 +32822,7 @@ var ts; } // If we have a 'await' keyword, and we're in the [Await] context, then 'await' is // considered a keyword and is not an identifier. - if (token() === 132 /* SyntaxKind.AwaitKeyword */ && inAwaitContext()) { + if (token() === 133 /* SyntaxKind.AwaitKeyword */ && inAwaitContext()) { return false; } return token() > 116 /* SyntaxKind.LastReservedWord */; @@ -32638,7 +33068,7 @@ var ts; ts.isTemplateLiteralKind(kind) ? factory.createTemplateLiteralLikeNode(kind, "", "", /*templateFlags*/ undefined) : kind === 8 /* SyntaxKind.NumericLiteral */ ? factory.createNumericLiteral("", /*numericLiteralFlags*/ undefined) : kind === 10 /* SyntaxKind.StringLiteral */ ? factory.createStringLiteral("", /*isSingleQuote*/ undefined) : - kind === 276 /* SyntaxKind.MissingDeclaration */ ? factory.createMissingDeclaration() : + kind === 279 /* SyntaxKind.MissingDeclaration */ ? factory.createMissingDeclaration() : factory.createToken(kind); return finishNode(result, pos); } @@ -32737,7 +33167,7 @@ var ts; } function parsePrivateIdentifier() { var pos = getNodePos(); - var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenText())); + var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenValue())); nextToken(); return finishNode(node, pos); } @@ -32761,15 +33191,16 @@ var ts; if (token() === 88 /* SyntaxKind.DefaultKeyword */) { return lookAhead(nextTokenCanFollowDefaultKeyword); } - if (token() === 152 /* SyntaxKind.TypeKeyword */) { + if (token() === 154 /* SyntaxKind.TypeKeyword */) { return lookAhead(nextTokenCanFollowExportModifier); } return canFollowExportModifier(); case 88 /* SyntaxKind.DefaultKeyword */: return nextTokenCanFollowDefaultKeyword(); + case 127 /* SyntaxKind.AccessorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: nextToken(); return canFollowModifier(); default: @@ -32778,7 +33209,7 @@ var ts; } function canFollowExportModifier() { return token() !== 41 /* SyntaxKind.AsteriskToken */ - && token() !== 127 /* SyntaxKind.AsKeyword */ + && token() !== 128 /* SyntaxKind.AsKeyword */ && token() !== 18 /* SyntaxKind.OpenBraceToken */ && canFollowModifier(); } @@ -32801,7 +33232,7 @@ var ts; return token() === 84 /* SyntaxKind.ClassKeyword */ || token() === 98 /* SyntaxKind.FunctionKeyword */ || token() === 118 /* SyntaxKind.InterfaceKeyword */ || (token() === 126 /* SyntaxKind.AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine)) || - (token() === 131 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); + (token() === 132 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); } // True if positioned at the start of a list element function isListElement(parsingContext, inErrorRecovery) { @@ -33181,20 +33612,20 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 176 /* SyntaxKind.IndexSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 234 /* SyntaxKind.SemicolonClassElement */: + case 173 /* SyntaxKind.Constructor */: + case 178 /* SyntaxKind.IndexSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 237 /* SyntaxKind.SemicolonClassElement */: return true; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // Method declarations are not necessarily reusable. An object-literal // may have a method calls "constructor(...)" and we must reparse that // into an actual .ConstructorDeclaration. var methodDeclaration = node; var nameIsConstructor = methodDeclaration.name.kind === 79 /* SyntaxKind.Identifier */ && - methodDeclaration.name.originalKeywordKind === 134 /* SyntaxKind.ConstructorKeyword */; + methodDeclaration.name.originalKeywordKind === 135 /* SyntaxKind.ConstructorKeyword */; return !nameIsConstructor; } } @@ -33203,8 +33634,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: return true; } } @@ -33213,58 +33644,58 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 235 /* SyntaxKind.Block */: - case 239 /* SyntaxKind.IfStatement */: - case 238 /* SyntaxKind.ExpressionStatement */: - case 251 /* SyntaxKind.ThrowStatement */: - case 247 /* SyntaxKind.ReturnStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 236 /* SyntaxKind.EmptyStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 250 /* SyntaxKind.LabeledStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 253 /* SyntaxKind.DebuggerStatement */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 238 /* SyntaxKind.Block */: + case 242 /* SyntaxKind.IfStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 254 /* SyntaxKind.ThrowStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 239 /* SyntaxKind.EmptyStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 253 /* SyntaxKind.LabeledStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 299 /* SyntaxKind.EnumMember */; + return node.kind === 302 /* SyntaxKind.EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 166 /* SyntaxKind.PropertySignature */: - case 174 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 168 /* SyntaxKind.PropertySignature */: + case 176 /* SyntaxKind.CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 254 /* SyntaxKind.VariableDeclaration */) { + if (node.kind !== 257 /* SyntaxKind.VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -33285,7 +33716,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 164 /* SyntaxKind.Parameter */) { + if (node.kind !== 166 /* SyntaxKind.Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -33578,14 +34009,14 @@ var ts; // If true, we should abort parsing an error function. function typeHasArrowFunctionBlockingParseError(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return ts.nodeIsMissing(node.typeName); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: { + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: { var _a = node, parameters = _a.parameters, type = _a.type; return isMissingList(parameters) || typeHasArrowFunctionBlockingParseError(type); } - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return typeHasArrowFunctionBlockingParseError(node.type); default: return false; @@ -33664,7 +34095,7 @@ var ts; function parseJSDocType() { scanner.setInJSDocType(true); var pos = getNodePos(); - if (parseOptional(141 /* SyntaxKind.ModuleKeyword */)) { + if (parseOptional(142 /* SyntaxKind.ModuleKeyword */)) { // TODO(rbuckton): We never set the type for a JSDocNamepathType. What should we put here? var moduleTag = factory.createJSDocNamepathType(/*type*/ undefined); terminate: while (true) { @@ -33880,14 +34311,14 @@ var ts; function parseSignatureMember(kind) { var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); - if (kind === 175 /* SyntaxKind.ConstructSignature */) { + if (kind === 177 /* SyntaxKind.ConstructSignature */) { parseExpected(103 /* SyntaxKind.NewKeyword */); } var typeParameters = parseTypeParameters(); var parameters = parseParameters(4 /* SignatureFlags.Type */); var type = parseReturnType(58 /* SyntaxKind.ColonToken */, /*isType*/ true); parseTypeMemberSemicolon(); - var node = kind === 174 /* SyntaxKind.CallSignature */ + var node = kind === 176 /* SyntaxKind.CallSignature */ ? factory.createCallSignature(typeParameters, parameters, type) : factory.createConstructSignature(typeParameters, parameters, type); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -33981,8 +34412,8 @@ var ts; // Return true if we have the start of a signature member if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || - token() === 136 /* SyntaxKind.GetKeyword */ || - token() === 149 /* SyntaxKind.SetKeyword */) { + token() === 137 /* SyntaxKind.GetKeyword */ || + token() === 151 /* SyntaxKind.SetKeyword */) { return true; } var idToken = false; @@ -34014,19 +34445,19 @@ var ts; } function parseTypeMember() { if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */) { - return parseSignatureMember(174 /* SyntaxKind.CallSignature */); + return parseSignatureMember(176 /* SyntaxKind.CallSignature */); } if (token() === 103 /* SyntaxKind.NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) { - return parseSignatureMember(175 /* SyntaxKind.ConstructSignature */); + return parseSignatureMember(177 /* SyntaxKind.ConstructSignature */); } var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); var modifiers = parseModifiers(); - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 172 /* SyntaxKind.GetAccessor */, 4 /* SignatureFlags.Type */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 174 /* SyntaxKind.GetAccessor */, 4 /* SignatureFlags.Type */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 173 /* SyntaxKind.SetAccessor */, 4 /* SignatureFlags.Type */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 175 /* SyntaxKind.SetAccessor */, 4 /* SignatureFlags.Type */); } if (isIndexSignature()) { return parseIndexSignatureDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers); @@ -34067,9 +34498,9 @@ var ts; function isStartOfMappedType() { nextToken(); if (token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { - return nextToken() === 145 /* SyntaxKind.ReadonlyKeyword */; + return nextToken() === 146 /* SyntaxKind.ReadonlyKeyword */; } - if (token() === 145 /* SyntaxKind.ReadonlyKeyword */) { + if (token() === 146 /* SyntaxKind.ReadonlyKeyword */) { nextToken(); } return token() === 22 /* SyntaxKind.OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 101 /* SyntaxKind.InKeyword */; @@ -34085,15 +34516,15 @@ var ts; var pos = getNodePos(); parseExpected(18 /* SyntaxKind.OpenBraceToken */); var readonlyToken; - if (token() === 145 /* SyntaxKind.ReadonlyKeyword */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { + if (token() === 146 /* SyntaxKind.ReadonlyKeyword */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { readonlyToken = parseTokenNode(); - if (readonlyToken.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { - parseExpected(145 /* SyntaxKind.ReadonlyKeyword */); + if (readonlyToken.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { + parseExpected(146 /* SyntaxKind.ReadonlyKeyword */); } } parseExpected(22 /* SyntaxKind.OpenBracketToken */); var typeParameter = parseMappedTypeParameter(); - var nameType = parseOptional(127 /* SyntaxKind.AsKeyword */) ? parseType() : undefined; + var nameType = parseOptional(128 /* SyntaxKind.AsKeyword */) ? parseType() : undefined; parseExpected(23 /* SyntaxKind.CloseBracketToken */); var questionToken; if (token() === 57 /* SyntaxKind.QuestionToken */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { @@ -34207,7 +34638,7 @@ var ts; var openBracePosition = scanner.getTokenPos(); parseExpected(18 /* SyntaxKind.OpenBraceToken */); var multiLine = scanner.hasPrecedingLineBreak(); - parseExpected(129 /* SyntaxKind.AssertKeyword */); + parseExpected(130 /* SyntaxKind.AssertKeyword */); parseExpected(58 /* SyntaxKind.ColonToken */); var clause = parseAssertClause(/*skipAssertKeyword*/ true); if (!parseExpected(19 /* SyntaxKind.CloseBraceToken */)) { @@ -34240,16 +34671,16 @@ var ts; } function parseNonArrayType() { switch (token()) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: // If these are followed by a dot, then parse these out as a dotted type reference instead. return tryParse(parseKeywordAndNoDot) || parseTypeReference(); case 66 /* SyntaxKind.AsteriskEqualsToken */: @@ -34282,7 +34713,7 @@ var ts; return parseTokenNode(); case 108 /* SyntaxKind.ThisKeyword */: { var thisKeyword = parseThisTypeNode(); - if (token() === 139 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 140 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { return parseThisTypePredicate(thisKeyword); } else { @@ -34299,7 +34730,7 @@ var ts; return parseParenthesizedType(); case 100 /* SyntaxKind.ImportKeyword */: return parseImportType(); - case 128 /* SyntaxKind.AssertsKeyword */: + case 129 /* SyntaxKind.AssertsKeyword */: return lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine) ? parseAssertsTypePredicate() : parseTypeReference(); case 15 /* SyntaxKind.TemplateHead */: return parseTemplateType(); @@ -34309,21 +34740,21 @@ var ts; } function isStartOfType(inStartOfParameter) { switch (token()) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 108 /* SyntaxKind.ThisKeyword */: case 112 /* SyntaxKind.TypeOfKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: case 18 /* SyntaxKind.OpenBraceToken */: case 22 /* SyntaxKind.OpenBracketToken */: case 29 /* SyntaxKind.LessThanToken */: @@ -34335,14 +34766,14 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 41 /* SyntaxKind.AsteriskToken */: case 57 /* SyntaxKind.QuestionToken */: case 53 /* SyntaxKind.ExclamationToken */: case 25 /* SyntaxKind.DotDotDotToken */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: case 100 /* SyntaxKind.ImportKeyword */: - case 128 /* SyntaxKind.AssertsKeyword */: + case 129 /* SyntaxKind.AssertsKeyword */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 15 /* SyntaxKind.TemplateHead */: return true; @@ -34419,17 +34850,17 @@ var ts; } function parseInferType() { var pos = getNodePos(); - parseExpected(137 /* SyntaxKind.InferKeyword */); + parseExpected(138 /* SyntaxKind.InferKeyword */); return finishNode(factory.createInferTypeNode(parseTypeParameterOfInferType()), pos); } function parseTypeOperatorOrHigher() { var operator = token(); switch (operator) { - case 140 /* SyntaxKind.KeyOfKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: return parseTypeOperator(operator); - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: return parseInferType(); } return allowConditionalTypesAnd(parsePostfixTypeOrHigher); @@ -34549,16 +34980,16 @@ var ts; } function parseTypePredicatePrefix() { var id = parseIdentifier(); - if (token() === 139 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 140 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { nextToken(); return id; } } function parseAssertsTypePredicate() { var pos = getNodePos(); - var assertsModifier = parseExpectedToken(128 /* SyntaxKind.AssertsKeyword */); + var assertsModifier = parseExpectedToken(129 /* SyntaxKind.AssertsKeyword */); var parameterName = token() === 108 /* SyntaxKind.ThisKeyword */ ? parseThisTypeNode() : parseIdentifier(); - var type = parseOptional(139 /* SyntaxKind.IsKeyword */) ? parseType() : undefined; + var type = parseOptional(140 /* SyntaxKind.IsKeyword */) ? parseType() : undefined; return finishNode(factory.createTypePredicateNode(assertsModifier, parameterName, type), pos); } function parseType() { @@ -34628,7 +35059,7 @@ var ts; case 45 /* SyntaxKind.PlusPlusToken */: case 46 /* SyntaxKind.MinusMinusToken */: case 29 /* SyntaxKind.LessThanToken */: - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: case 125 /* SyntaxKind.YieldKeyword */: case 80 /* SyntaxKind.PrivateIdentifier */: // Yield/await always starts an expression. Either it is an identifier (in which case @@ -34816,7 +35247,7 @@ var ts; // Unknown -> There *might* be a parenthesized arrow function here. // Speculatively look ahead to be sure, and rollback if not. function isParenthesizedArrowFunctionExpression() { - if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || token() === 132 /* SyntaxKind.AsyncKeyword */) { return lookAhead(isParenthesizedArrowFunctionExpressionWorker); } if (token() === 38 /* SyntaxKind.EqualsGreaterThanToken */) { @@ -34829,7 +35260,7 @@ var ts; return 0 /* Tristate.False */; } function isParenthesizedArrowFunctionExpressionWorker() { - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { nextToken(); if (scanner.hasPrecedingLineBreak()) { return 0 /* Tristate.False */; @@ -34873,8 +35304,8 @@ var ts; // Check for "(xxx yyy", where xxx is a modifier and yyy is an identifier. This // isn't actually allowed, but we want to treat it as a lambda so we can provide // a good error message. - if (ts.isModifierKind(second) && second !== 131 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) { - if (nextToken() === 127 /* SyntaxKind.AsKeyword */) { + if (ts.isModifierKind(second) && second !== 132 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) { + if (nextToken() === 128 /* SyntaxKind.AsKeyword */) { // https://github.com/microsoft/TypeScript/issues/44466 return 0 /* Tristate.False */; } @@ -34956,7 +35387,7 @@ var ts; } function tryParseAsyncSimpleArrowFunctionExpression(allowReturnTypeInArrowFunction) { // We do a check here so that we won't be doing unnecessarily call to "lookAhead" - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* Tristate.True */) { var pos = getNodePos(); var asyncModifier = parseModifiersForArrowFunction(); @@ -34970,7 +35401,7 @@ var ts; // AsyncArrowFunctionExpression: // 1) async[no LineTerminator here]AsyncArrowBindingIdentifier[?Yield][no LineTerminator here]=>AsyncConciseBody[?In] // 2) CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In] - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { nextToken(); // If the "async" is followed by "=>" token then it is not a beginning of an async arrow-function // but instead a simple arrow-function which will be parsed inside "parseAssignmentExpressionOrHigher" @@ -35036,7 +35467,7 @@ var ts; // // So we need just a bit of lookahead to ensure that it can only be a signature. var unwrappedType = type; - while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 191 /* SyntaxKind.ParenthesizedType */) { + while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 193 /* SyntaxKind.ParenthesizedType */) { unwrappedType = unwrappedType.type; // Skip parens if need be } var hasJSDocFunctionType = unwrappedType && ts.isJSDocFunctionType(unwrappedType); @@ -35131,7 +35562,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand, pos); } function isInOrOfKeyword(t) { - return t === 101 /* SyntaxKind.InKeyword */ || t === 160 /* SyntaxKind.OfKeyword */; + return t === 101 /* SyntaxKind.InKeyword */ || t === 162 /* SyntaxKind.OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand, pos) { while (true) { @@ -35169,7 +35600,7 @@ var ts; if (token() === 101 /* SyntaxKind.InKeyword */ && inDisallowInContext()) { break; } - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */ || token() === 150 /* SyntaxKind.SatisfiesKeyword */) { // Make sure we *do* perform ASI for constructs like this: // var x = foo // as (Bar) @@ -35179,8 +35610,10 @@ var ts; break; } else { + var keywordKind = token(); nextToken(); - leftOperand = makeAsExpression(leftOperand, parseType()); + leftOperand = keywordKind === 150 /* SyntaxKind.SatisfiesKeyword */ ? makeSatisfiesExpression(leftOperand, parseType()) : + makeAsExpression(leftOperand, parseType()); } } else { @@ -35195,6 +35628,9 @@ var ts; } return ts.getBinaryOperatorPrecedence(token()) > 0; } + function makeSatisfiesExpression(left, right) { + return finishNode(factory.createSatisfiesExpression(left, right), left.pos); + } function makeBinaryExpression(left, operatorToken, right, pos) { return finishNode(factory.createBinaryExpression(left, operatorToken, right), pos); } @@ -35218,7 +35654,7 @@ var ts; return finishNode(factory.createVoidExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos); } function isAwaitExpression() { - if (token() === 132 /* SyntaxKind.AwaitKeyword */) { + if (token() === 133 /* SyntaxKind.AwaitKeyword */) { if (inAwaitContext()) { return true; } @@ -35271,7 +35707,7 @@ var ts; if (token() === 42 /* SyntaxKind.AsteriskAsteriskToken */) { var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); var end = simpleUnaryExpression.end; - if (simpleUnaryExpression.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (simpleUnaryExpression.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { parseErrorAt(pos, end, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { @@ -35312,7 +35748,7 @@ var ts; // UnaryExpression (modified): // < type > UnaryExpression return parseTypeAssertion(); - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: if (isAwaitExpression()) { return parseAwaitExpression(); } @@ -35342,7 +35778,7 @@ var ts; case 89 /* SyntaxKind.DeleteKeyword */: case 112 /* SyntaxKind.TypeOfKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: return false; case 29 /* SyntaxKind.LessThanToken */: // If we are not in JSX context, we are parsing TypeAssertion which is an UnaryExpression @@ -35525,11 +35961,11 @@ var ts; var pos = getNodePos(); var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); var result; - if (opening.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (opening.kind === 283 /* SyntaxKind.JsxOpeningElement */) { var children = parseJsxChildren(opening); var closingElement = void 0; var lastChild = children[children.length - 1]; - if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 278 /* SyntaxKind.JsxElement */ + if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 281 /* SyntaxKind.JsxElement */ && !tagNamesAreEquivalent(lastChild.openingElement.tagName, lastChild.closingElement.tagName) && tagNamesAreEquivalent(opening.tagName, lastChild.closingElement.tagName)) { // when an unclosed JsxOpeningElement incorrectly parses its parent's JsxClosingElement, @@ -35555,11 +35991,11 @@ var ts; } result = finishNode(factory.createJsxElement(opening, children, closingElement), pos); } - else if (opening.kind === 283 /* SyntaxKind.JsxOpeningFragment */) { + else if (opening.kind === 286 /* SyntaxKind.JsxOpeningFragment */) { result = finishNode(factory.createJsxFragment(opening, parseJsxChildren(opening), parseJsxClosingFragment(inExpressionContext)), pos); } else { - ts.Debug.assert(opening.kind === 279 /* SyntaxKind.JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 282 /* SyntaxKind.JsxSelfClosingElement */); // Nothing else to do for self-closing elements result = opening; } @@ -35629,7 +36065,7 @@ var ts; break; list.push(child); if (ts.isJsxOpeningElement(openingTag) - && (child === null || child === void 0 ? void 0 : child.kind) === 278 /* SyntaxKind.JsxElement */ + && (child === null || child === void 0 ? void 0 : child.kind) === 281 /* SyntaxKind.JsxElement */ && !tagNamesAreEquivalent(child.openingElement.tagName, child.closingElement.tagName) && tagNamesAreEquivalent(openingTag.tagName, child.closingElement.tagName)) { // stop after parsing a mismatched child like

...(
) in order to reattach the higher @@ -35874,7 +36310,7 @@ var ts; } if (isTemplateStartOfTaggedTemplate()) { // Absorb type arguments into TemplateExpression when preceding expression is ExpressionWithTypeArguments - expression = !questionDotToken && expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ ? + expression = !questionDotToken && expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ ? parseTaggedTemplateRest(pos, expression.expression, questionDotToken, expression.typeArguments) : parseTaggedTemplateRest(pos, expression, questionDotToken, /*typeArguments*/ undefined); continue; @@ -35921,7 +36357,7 @@ var ts; } if (typeArguments || token() === 20 /* SyntaxKind.OpenParenToken */) { // Absorb type arguments into CallExpression when preceding expression is ExpressionWithTypeArguments - if (!questionDotToken && expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (!questionDotToken && expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -36007,7 +36443,7 @@ var ts; return parseArrayLiteralExpression(); case 18 /* SyntaxKind.OpenBraceToken */: return parseObjectLiteralExpression(); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // Async arrow functions are parsed earlier in parseAssignmentExpressionOrHigher. // If we encounter `async [no LineTerminator here] function` then this is an async // function; otherwise, its an identifier. @@ -36074,11 +36510,11 @@ var ts; } var decorators = parseDecorators(); var modifiers = parseModifiers(); - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 174 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 175 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); } var asteriskToken = parseOptionalToken(41 /* SyntaxKind.AsteriskToken */); var tokenIsIdentifier = isIdentifier(); @@ -36166,7 +36602,7 @@ var ts; var expression = parseMemberExpressionRest(expressionPos, parsePrimaryExpression(), /*allowOptionalChain*/ false); var typeArguments; // Absorb type arguments into NewExpression when preceding expression is ExpressionWithTypeArguments - if (expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -36270,7 +36706,7 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(97 /* SyntaxKind.ForKeyword */); - var awaitToken = parseOptionalToken(132 /* SyntaxKind.AwaitKeyword */); + var awaitToken = parseOptionalToken(133 /* SyntaxKind.AwaitKeyword */); parseExpected(20 /* SyntaxKind.OpenParenToken */); var initializer; if (token() !== 26 /* SyntaxKind.SemicolonToken */) { @@ -36282,7 +36718,7 @@ var ts; } } var node; - if (awaitToken ? parseExpected(160 /* SyntaxKind.OfKeyword */) : parseOptional(160 /* SyntaxKind.OfKeyword */)) { + if (awaitToken ? parseExpected(162 /* SyntaxKind.OfKeyword */) : parseOptional(162 /* SyntaxKind.OfKeyword */)) { var expression = allowInAnd(function () { return parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true); }); parseExpected(21 /* SyntaxKind.CloseParenToken */); node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement()); @@ -36309,10 +36745,10 @@ var ts; function parseBreakOrContinueStatement(kind) { var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(kind === 246 /* SyntaxKind.BreakStatement */ ? 81 /* SyntaxKind.BreakKeyword */ : 86 /* SyntaxKind.ContinueKeyword */); + parseExpected(kind === 249 /* SyntaxKind.BreakStatement */ ? 81 /* SyntaxKind.BreakKeyword */ : 86 /* SyntaxKind.ContinueKeyword */); var label = canParseSemicolon() ? undefined : parseIdentifier(); parseSemicolon(); - var node = kind === 246 /* SyntaxKind.BreakStatement */ + var node = kind === 249 /* SyntaxKind.BreakStatement */ ? factory.createBreakStatement(label) : factory.createContinueStatement(label); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -36503,25 +36939,26 @@ var ts; // // could be legal, it would add complexity for very little gain. case 118 /* SyntaxKind.InterfaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: return nextTokenIsIdentifierOnSameLine(); - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); case 126 /* SyntaxKind.AbstractKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: nextToken(); // ASI takes effect for this modifier. if (scanner.hasPrecedingLineBreak()) { return false; } continue; - case 157 /* SyntaxKind.GlobalKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: nextToken(); return token() === 18 /* SyntaxKind.OpenBraceToken */ || token() === 79 /* SyntaxKind.Identifier */ || token() === 93 /* SyntaxKind.ExportKeyword */; case 100 /* SyntaxKind.ImportKeyword */: @@ -36530,12 +36967,12 @@ var ts; token() === 18 /* SyntaxKind.OpenBraceToken */ || ts.tokenIsIdentifierOrKeyword(token()); case 93 /* SyntaxKind.ExportKeyword */: var currentToken_1 = nextToken(); - if (currentToken_1 === 152 /* SyntaxKind.TypeKeyword */) { + if (currentToken_1 === 154 /* SyntaxKind.TypeKeyword */) { currentToken_1 = lookAhead(nextToken); } if (currentToken_1 === 63 /* SyntaxKind.EqualsToken */ || currentToken_1 === 41 /* SyntaxKind.AsteriskToken */ || currentToken_1 === 18 /* SyntaxKind.OpenBraceToken */ || currentToken_1 === 88 /* SyntaxKind.DefaultKeyword */ || - currentToken_1 === 127 /* SyntaxKind.AsKeyword */) { + currentToken_1 === 128 /* SyntaxKind.AsKeyword */) { return true; } continue; @@ -36583,20 +37020,21 @@ var ts; case 85 /* SyntaxKind.ConstKeyword */: case 93 /* SyntaxKind.ExportKeyword */: return isStartOfDeclaration(); - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: // When these don't start a declaration, they're an identifier in an expression statement return true; + case 127 /* SyntaxKind.AccessorKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: // When these don't start a declaration, they may be the start of a class member if an identifier // immediately follows. Otherwise they're an identifier in an expression statement. return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); @@ -36639,9 +37077,9 @@ var ts; case 97 /* SyntaxKind.ForKeyword */: return parseForOrForInOrForOfStatement(); case 86 /* SyntaxKind.ContinueKeyword */: - return parseBreakOrContinueStatement(245 /* SyntaxKind.ContinueStatement */); + return parseBreakOrContinueStatement(248 /* SyntaxKind.ContinueStatement */); case 81 /* SyntaxKind.BreakKeyword */: - return parseBreakOrContinueStatement(246 /* SyntaxKind.BreakStatement */); + return parseBreakOrContinueStatement(249 /* SyntaxKind.BreakStatement */); case 105 /* SyntaxKind.ReturnKeyword */: return parseReturnStatement(); case 116 /* SyntaxKind.WithKeyword */: @@ -36660,12 +37098,12 @@ var ts; return parseDebuggerStatement(); case 59 /* SyntaxKind.AtToken */: return parseDeclaration(); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 85 /* SyntaxKind.ConstKeyword */: case 92 /* SyntaxKind.EnumKeyword */: case 93 /* SyntaxKind.ExportKeyword */: @@ -36674,9 +37112,10 @@ var ts; case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -36685,7 +37124,7 @@ var ts; return parseExpressionOrLabeledStatement(); } function isDeclareModifier(modifier) { - return modifier.kind === 135 /* SyntaxKind.DeclareKeyword */; + return modifier.kind === 136 /* SyntaxKind.DeclareKeyword */; } function parseDeclaration() { // `parseListElement` attempted to get the reused node at this position, @@ -36731,13 +37170,13 @@ var ts; return parseClassDeclaration(pos, hasJSDoc, decorators, modifiers); case 118 /* SyntaxKind.InterfaceKeyword */: return parseInterfaceDeclaration(pos, hasJSDoc, decorators, modifiers); - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: return parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers); case 92 /* SyntaxKind.EnumKeyword */: return parseEnumDeclaration(pos, hasJSDoc, decorators, modifiers); - case 157 /* SyntaxKind.GlobalKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: return parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers); case 100 /* SyntaxKind.ImportKeyword */: return parseImportDeclarationOrImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers); @@ -36747,7 +37186,7 @@ var ts; case 88 /* SyntaxKind.DefaultKeyword */: case 63 /* SyntaxKind.EqualsToken */: return parseExportAssignment(pos, hasJSDoc, decorators, modifiers); - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: return parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers); default: return parseExportDeclaration(pos, hasJSDoc, decorators, modifiers); @@ -36756,7 +37195,7 @@ var ts; if (decorators || modifiers) { // We reached this point because we encountered decorators and/or modifiers and assumed a declaration // would follow. For recovery and error reporting purposes, return an incomplete declaration. - var missing = createMissingNode(276 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var missing = createMissingNode(279 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); ts.setTextRangePos(missing, pos); missing.illegalDecorators = decorators; missing.modifiers = modifiers; @@ -36882,7 +37321,7 @@ var ts; // this context. // The checker will then give an error that there is an empty declaration list. var declarations; - if (token() === 160 /* SyntaxKind.OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 162 /* SyntaxKind.OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { declarations = createMissingList(); } else { @@ -36910,9 +37349,9 @@ var ts; parseExpected(98 /* SyntaxKind.FunctionKeyword */); var asteriskToken = parseOptionalToken(41 /* SyntaxKind.AsteriskToken */); // We don't parse the name here in await context, instead we will report a grammar error in the checker. - var name = modifierFlags & 512 /* ModifierFlags.Default */ ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); + var name = modifierFlags & 1024 /* ModifierFlags.Default */ ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); var isGenerator = asteriskToken ? 1 /* SignatureFlags.Yield */ : 0 /* SignatureFlags.None */; - var isAsync = modifierFlags & 256 /* ModifierFlags.Async */ ? 2 /* SignatureFlags.Await */ : 0 /* SignatureFlags.None */; + var isAsync = modifierFlags & 512 /* ModifierFlags.Async */ ? 2 /* SignatureFlags.Await */ : 0 /* SignatureFlags.None */; var typeParameters = parseTypeParameters(); if (modifierFlags & 1 /* ModifierFlags.Export */) setAwaitContext(/*value*/ true); @@ -36925,8 +37364,8 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseConstructorName() { - if (token() === 134 /* SyntaxKind.ConstructorKeyword */) { - return parseExpected(134 /* SyntaxKind.ConstructorKeyword */); + if (token() === 135 /* SyntaxKind.ConstructorKeyword */) { + return parseExpected(135 /* SyntaxKind.ConstructorKeyword */); } if (token() === 10 /* SyntaxKind.StringLiteral */ && lookAhead(nextToken) === 20 /* SyntaxKind.OpenParenToken */) { return tryParse(function () { @@ -36988,7 +37427,7 @@ var ts; var parameters = parseParameters(0 /* SignatureFlags.None */); var type = parseReturnType(58 /* SyntaxKind.ColonToken */, /*isType*/ false); var body = parseFunctionBlockOrSemicolon(flags); - var node = kind === 172 /* SyntaxKind.GetAccessor */ + var node = kind === 174 /* SyntaxKind.GetAccessor */ ? factory.createGetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, type, body) : factory.createSetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, body); // Keep track of `typeParameters` (for both) and `type` (for setters) if they were parsed those indicate grammar errors @@ -37032,7 +37471,7 @@ var ts; // If we were able to get any potential identifier... if (idToken !== undefined) { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. - if (!ts.isKeyword(idToken) || idToken === 149 /* SyntaxKind.SetKeyword */ || idToken === 136 /* SyntaxKind.GetKeyword */) { + if (!ts.isKeyword(idToken) || idToken === 151 /* SyntaxKind.SetKeyword */ || idToken === 137 /* SyntaxKind.GetKeyword */) { return true; } // If it *is* a keyword, but not an accessor, check a little farther along @@ -37075,7 +37514,7 @@ var ts; return body; } function parseDecoratorExpression() { - if (inAwaitContext() && token() === 132 /* SyntaxKind.AwaitKeyword */) { + if (inAwaitContext() && token() === 133 /* SyntaxKind.AwaitKeyword */) { // `@await` is is disallowed in an [Await] context, but can cause parsing to go off the rails // This simply parses the missing identifier and moves on. var pos = getNodePos(); @@ -37153,10 +37592,10 @@ var ts; } function parseModifiersForArrowFunction() { var modifiers; - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { var pos = getNodePos(); nextToken(); - var modifier = finishNode(factory.createToken(131 /* SyntaxKind.AsyncKeyword */), pos); + var modifier = finishNode(factory.createToken(132 /* SyntaxKind.AsyncKeyword */), pos); modifiers = createNodeArray([modifier], pos); } return modifiers; @@ -37173,13 +37612,13 @@ var ts; if (token() === 124 /* SyntaxKind.StaticKeyword */ && lookAhead(nextTokenIsOpenBrace)) { return parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers); } - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 174 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 175 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); } - if (token() === 134 /* SyntaxKind.ConstructorKeyword */ || token() === 10 /* SyntaxKind.StringLiteral */) { + if (token() === 135 /* SyntaxKind.ConstructorKeyword */ || token() === 10 /* SyntaxKind.StringLiteral */) { var constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers); if (constructorDeclaration) { return constructorDeclaration; @@ -37216,10 +37655,10 @@ var ts; return ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined, 226 /* SyntaxKind.ClassExpression */); + return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined, 228 /* SyntaxKind.ClassExpression */); } function parseClassDeclaration(pos, hasJSDoc, decorators, modifiers) { - return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 257 /* SyntaxKind.ClassDeclaration */); + return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 260 /* SyntaxKind.ClassDeclaration */); } function parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, kind) { var savedAwaitContext = inAwaitContext(); @@ -37241,7 +37680,7 @@ var ts; members = createMissingList(); } setAwaitContext(savedAwaitContext); - var node = kind === 257 /* SyntaxKind.ClassDeclaration */ + var node = kind === 260 /* SyntaxKind.ClassDeclaration */ ? factory.createClassDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members) : factory.createClassExpression(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -37278,7 +37717,7 @@ var ts; function parseExpressionWithTypeArguments() { var pos = getNodePos(); var expression = parseLeftHandSideExpressionOrHigher(); - if (expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { return expression; } var typeArguments = tryParseTypeArguments(); @@ -37305,11 +37744,11 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers) { - parseExpected(152 /* SyntaxKind.TypeKeyword */); + parseExpected(154 /* SyntaxKind.TypeKeyword */); var name = parseIdentifier(); var typeParameters = parseTypeParameters(); parseExpected(63 /* SyntaxKind.EqualsToken */); - var type = token() === 138 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); + var type = token() === 139 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); parseSemicolon(); var node = factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type); node.illegalDecorators = decorators; @@ -37368,7 +37807,7 @@ var ts; function parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { var flags = 0; var name; - if (token() === 157 /* SyntaxKind.GlobalKeyword */) { + if (token() === 159 /* SyntaxKind.GlobalKeyword */) { // parse 'global' as name of global scope augmentation name = parseIdentifier(); flags |= 1024 /* NodeFlags.GlobalAugmentation */; @@ -37390,15 +37829,15 @@ var ts; } function parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { var flags = 0; - if (token() === 157 /* SyntaxKind.GlobalKeyword */) { + if (token() === 159 /* SyntaxKind.GlobalKeyword */) { // global augmentation return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); } - else if (parseOptional(142 /* SyntaxKind.NamespaceKeyword */)) { + else if (parseOptional(143 /* SyntaxKind.NamespaceKeyword */)) { flags |= 16 /* NodeFlags.Namespace */; } else { - parseExpected(141 /* SyntaxKind.ModuleKeyword */); + parseExpected(142 /* SyntaxKind.ModuleKeyword */); if (token() === 10 /* SyntaxKind.StringLiteral */) { return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); } @@ -37406,7 +37845,7 @@ var ts; return parseModuleOrNamespaceDeclaration(pos, hasJSDoc, decorators, modifiers, flags); } function isExternalModuleReference() { - return token() === 146 /* SyntaxKind.RequireKeyword */ && + return token() === 147 /* SyntaxKind.RequireKeyword */ && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { @@ -37419,8 +37858,8 @@ var ts; return nextToken() === 43 /* SyntaxKind.SlashToken */; } function parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers) { - parseExpected(127 /* SyntaxKind.AsKeyword */); - parseExpected(142 /* SyntaxKind.NamespaceKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); + parseExpected(143 /* SyntaxKind.NamespaceKeyword */); var name = parseIdentifier(); parseSemicolon(); var node = factory.createNamespaceExportDeclaration(name); @@ -37438,7 +37877,7 @@ var ts; identifier = parseIdentifier(); } var isTypeOnly = false; - if (token() !== 156 /* SyntaxKind.FromKeyword */ && + if (token() !== 158 /* SyntaxKind.FromKeyword */ && (identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) === "type" && (isIdentifier() || tokenAfterImportDefinitelyProducesImportDeclaration())) { isTypeOnly = true; @@ -37456,11 +37895,11 @@ var ts; token() === 18 /* SyntaxKind.OpenBraceToken */ // import { ) { importClause = parseImportClause(identifier, afterImportPos, isTypeOnly); - parseExpected(156 /* SyntaxKind.FromKeyword */); + parseExpected(158 /* SyntaxKind.FromKeyword */); } var moduleSpecifier = parseModuleSpecifier(); var assertClause; - if (token() === 129 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 130 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -37478,7 +37917,7 @@ var ts; function parseAssertClause(skipAssertKeyword) { var pos = getNodePos(); if (!skipAssertKeyword) { - parseExpected(129 /* SyntaxKind.AssertKeyword */); + parseExpected(130 /* SyntaxKind.AssertKeyword */); } var openBracePosition = scanner.getTokenPos(); if (parseExpected(18 /* SyntaxKind.OpenBraceToken */)) { @@ -37503,7 +37942,7 @@ var ts; function tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration() { // In `import id ___`, the current token decides whether to produce // an ImportDeclaration or ImportEqualsDeclaration. - return token() === 27 /* SyntaxKind.CommaToken */ || token() === 156 /* SyntaxKind.FromKeyword */; + return token() === 27 /* SyntaxKind.CommaToken */ || token() === 158 /* SyntaxKind.FromKeyword */; } function parseImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers, identifier, isTypeOnly) { parseExpected(63 /* SyntaxKind.EqualsToken */); @@ -37526,7 +37965,7 @@ var ts; var namedBindings; if (!identifier || parseOptional(27 /* SyntaxKind.CommaToken */)) { - namedBindings = token() === 41 /* SyntaxKind.AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(269 /* SyntaxKind.NamedImports */); + namedBindings = token() === 41 /* SyntaxKind.AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(272 /* SyntaxKind.NamedImports */); } return finishNode(factory.createImportClause(isTypeOnly, identifier, namedBindings), pos); } @@ -37537,7 +37976,7 @@ var ts; } function parseExternalModuleReference() { var pos = getNodePos(); - parseExpected(146 /* SyntaxKind.RequireKeyword */); + parseExpected(147 /* SyntaxKind.RequireKeyword */); parseExpected(20 /* SyntaxKind.OpenParenToken */); var expression = parseModuleSpecifier(); parseExpected(21 /* SyntaxKind.CloseParenToken */); @@ -37561,7 +38000,7 @@ var ts; // * as ImportedBinding var pos = getNodePos(); parseExpected(41 /* SyntaxKind.AsteriskToken */); - parseExpected(127 /* SyntaxKind.AsKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); var name = parseIdentifier(); return finishNode(factory.createNamespaceImport(name), pos); } @@ -37574,17 +38013,17 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - var node = kind === 269 /* SyntaxKind.NamedImports */ + var node = kind === 272 /* SyntaxKind.NamedImports */ ? factory.createNamedImports(parseBracketedList(23 /* ParsingContext.ImportOrExportSpecifiers */, parseImportSpecifier, 18 /* SyntaxKind.OpenBraceToken */, 19 /* SyntaxKind.CloseBraceToken */)) : factory.createNamedExports(parseBracketedList(23 /* ParsingContext.ImportOrExportSpecifiers */, parseExportSpecifier, 18 /* SyntaxKind.OpenBraceToken */, 19 /* SyntaxKind.CloseBraceToken */)); return finishNode(node, pos); } function parseExportSpecifier() { var hasJSDoc = hasPrecedingJSDocComment(); - return withJSDoc(parseImportOrExportSpecifier(275 /* SyntaxKind.ExportSpecifier */), hasJSDoc); + return withJSDoc(parseImportOrExportSpecifier(278 /* SyntaxKind.ExportSpecifier */), hasJSDoc); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(270 /* SyntaxKind.ImportSpecifier */); + return parseImportOrExportSpecifier(273 /* SyntaxKind.ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var pos = getNodePos(); @@ -37609,10 +38048,10 @@ var ts; // import { type as } from "mod"; - isTypeOnly: true, name: as // import { type as as } from "mod"; - isTypeOnly: false, name: as, propertyName: type // import { type as as as } from "mod"; - isTypeOnly: true, name: as, propertyName: as - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */) { // { type as ...? } var firstAs = parseIdentifierName(); - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */) { // { type as as ...? } var secondAs = parseIdentifierName(); if (ts.tokenIsIdentifierOrKeyword(token())) { @@ -37647,15 +38086,15 @@ var ts; name = parseNameWithKeywordCheck(); } } - if (canParseAsKeyword && token() === 127 /* SyntaxKind.AsKeyword */) { + if (canParseAsKeyword && token() === 128 /* SyntaxKind.AsKeyword */) { propertyName = name; - parseExpected(127 /* SyntaxKind.AsKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); name = parseNameWithKeywordCheck(); } - if (kind === 270 /* SyntaxKind.ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 273 /* SyntaxKind.ImportSpecifier */ && checkIdentifierIsKeyword) { parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected); } - var node = kind === 270 /* SyntaxKind.ImportSpecifier */ + var node = kind === 273 /* SyntaxKind.ImportSpecifier */ ? factory.createImportSpecifier(isTypeOnly, propertyName, name) : factory.createExportSpecifier(isTypeOnly, propertyName, name); return finishNode(node, pos); @@ -37675,26 +38114,26 @@ var ts; var exportClause; var moduleSpecifier; var assertClause; - var isTypeOnly = parseOptional(152 /* SyntaxKind.TypeKeyword */); + var isTypeOnly = parseOptional(154 /* SyntaxKind.TypeKeyword */); var namespaceExportPos = getNodePos(); if (parseOptional(41 /* SyntaxKind.AsteriskToken */)) { - if (parseOptional(127 /* SyntaxKind.AsKeyword */)) { + if (parseOptional(128 /* SyntaxKind.AsKeyword */)) { exportClause = parseNamespaceExport(namespaceExportPos); } - parseExpected(156 /* SyntaxKind.FromKeyword */); + parseExpected(158 /* SyntaxKind.FromKeyword */); moduleSpecifier = parseModuleSpecifier(); } else { - exportClause = parseNamedImportsOrExports(273 /* SyntaxKind.NamedExports */); + exportClause = parseNamedImportsOrExports(276 /* SyntaxKind.NamedExports */); // It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios, // the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`) // If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect. - if (token() === 156 /* SyntaxKind.FromKeyword */ || (token() === 10 /* SyntaxKind.StringLiteral */ && !scanner.hasPrecedingLineBreak())) { - parseExpected(156 /* SyntaxKind.FromKeyword */); + if (token() === 158 /* SyntaxKind.FromKeyword */ || (token() === 10 /* SyntaxKind.StringLiteral */ && !scanner.hasPrecedingLineBreak())) { + parseExpected(158 /* SyntaxKind.FromKeyword */); moduleSpecifier = parseModuleSpecifier(); } } - if (moduleSpecifier && token() === 129 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (moduleSpecifier && token() === 130 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -38307,9 +38746,9 @@ var ts; } function isObjectOrObjectArrayTypeReference(node) { switch (node.kind) { - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return true; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return isObjectOrObjectArrayTypeReference(node.elementType); default: return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && !node.typeArguments; @@ -38341,12 +38780,12 @@ var ts; var child = void 0; var children = void 0; while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) { - if (child.kind === 340 /* SyntaxKind.JSDocParameterTag */ || child.kind === 347 /* SyntaxKind.JSDocPropertyTag */) { + if (child.kind === 343 /* SyntaxKind.JSDocParameterTag */ || child.kind === 350 /* SyntaxKind.JSDocPropertyTag */) { children = ts.append(children, child); } } if (children) { - var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 183 /* SyntaxKind.ArrayType */), pos); + var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 185 /* SyntaxKind.ArrayType */), pos); return finishNode(factory.createJSDocTypeExpression(literal), pos); } } @@ -38464,7 +38903,7 @@ var ts; var hasChildren = false; while (child = tryParse(function () { return parseChildPropertyTag(indent); })) { hasChildren = true; - if (child.kind === 343 /* SyntaxKind.JSDocTypeTag */) { + if (child.kind === 346 /* SyntaxKind.JSDocTypeTag */) { if (childTypeTag) { var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); if (lastError) { @@ -38481,7 +38920,7 @@ var ts; } } if (hasChildren) { - var isArrayType = typeExpression && typeExpression.type.kind === 183 /* SyntaxKind.ArrayType */; + var isArrayType = typeExpression && typeExpression.type.kind === 185 /* SyntaxKind.ArrayType */; var jsdocTypeLiteral = factory.createJSDocTypeLiteral(jsDocPropertyTags, isArrayType); typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ? childTypeTag.typeExpression : @@ -38533,7 +38972,7 @@ var ts; var returnTag = tryParse(function () { if (parseOptionalJsdoc(59 /* SyntaxKind.AtToken */)) { var tag = parseTag(indent); - if (tag && tag.kind === 341 /* SyntaxKind.JSDocReturnTag */) { + if (tag && tag.kind === 344 /* SyntaxKind.JSDocReturnTag */) { return tag; } } @@ -38568,7 +39007,7 @@ var ts; case 59 /* SyntaxKind.AtToken */: if (canParseTag) { var child = tryParseChildTag(target, indent); - if (child && (child.kind === 340 /* SyntaxKind.JSDocParameterTag */ || child.kind === 347 /* SyntaxKind.JSDocPropertyTag */) && + if (child && (child.kind === 343 /* SyntaxKind.JSDocParameterTag */ || child.kind === 350 /* SyntaxKind.JSDocPropertyTag */) && target !== 4 /* PropertyLikeParse.CallbackParameter */ && name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; @@ -39538,6 +39977,7 @@ var ts; ["es2019.object", "lib.es2019.object.d.ts"], ["es2019.string", "lib.es2019.string.d.ts"], ["es2019.symbol", "lib.es2019.symbol.d.ts"], + ["es2019.intl", "lib.es2019.intl.d.ts"], ["es2020.bigint", "lib.es2020.bigint.d.ts"], ["es2020.date", "lib.es2020.date.d.ts"], ["es2020.promise", "lib.es2020.promise.d.ts"], @@ -39658,6 +40098,7 @@ var ts; shortName: "h", type: "boolean", showInSimplifiedHelpView: true, + isCommandLineOnly: true, category: ts.Diagnostics.Command_line_Options, description: ts.Diagnostics.Print_this_message, defaultValueDescription: false, @@ -39666,6 +40107,8 @@ var ts; name: "help", shortName: "?", type: "boolean", + isCommandLineOnly: true, + category: ts.Diagnostics.Command_line_Options, defaultValueDescription: false, }, { @@ -41397,7 +41840,7 @@ var ts; var _a; var rootExpression = (_a = sourceFile.statements[0]) === null || _a === void 0 ? void 0 : _a.expression; var knownRootOptions = reportOptionsErrors ? getTsconfigRootOptionsMap() : undefined; - if (rootExpression && rootExpression.kind !== 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (rootExpression && rootExpression.kind !== 207 /* SyntaxKind.ObjectLiteralExpression */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, rootExpression, ts.Diagnostics.The_root_value_of_a_0_file_must_be_an_object, ts.getBaseFileName(sourceFile.fileName) === "jsconfig.json" ? "jsconfig.json" : "tsconfig.json")); // Last-ditch error recovery. Somewhat useful because the JSON parser will recover from some parse errors by // synthesizing a top-level array literal expression. There's a reasonable chance the first element of that @@ -41437,7 +41880,7 @@ var ts; function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) { var result = returnValue ? {} : undefined; var _loop_4 = function (element) { - if (element.kind !== 296 /* SyntaxKind.PropertyAssignment */) { + if (element.kind !== 299 /* SyntaxKind.PropertyAssignment */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); return "continue"; } @@ -41531,13 +41974,13 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: reportInvalidOptionValue(option && option.type !== "number"); return validateValue(Number(valueExpression.text)); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: if (valueExpression.operator !== 40 /* SyntaxKind.MinusToken */ || valueExpression.operand.kind !== 8 /* SyntaxKind.NumericLiteral */) { break; // not valid JSON syntax } reportInvalidOptionValue(option && option.type !== "number"); return validateValue(-Number(valueExpression.operand.text)); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: reportInvalidOptionValue(option && option.type !== "object"); var objectLiteralExpression = valueExpression; // Currently having element option declaration in the tsconfig with type "object" @@ -41554,7 +41997,7 @@ var ts; return validateValue(convertObjectLiteralExpressionToJson(objectLiteralExpression, /* knownOptions*/ undefined, /*extraKeyDiagnosticMessage */ undefined, /*parentOption*/ undefined)); } - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: reportInvalidOptionValue(option && option.type !== "list"); return validateValue(convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element)); } @@ -42738,7 +43181,7 @@ var ts; function convertCompilerOptionsForTelemetry(opts) { var out = {}; for (var key in opts) { - if (opts.hasOwnProperty(key)) { + if (ts.hasProperty(opts, key)) { var type = getOptionFromName(key); if (type !== undefined) { // Ignore unknown options out[key] = getOptionValueWithEmptyStrings(opts[key], type); @@ -42804,7 +43247,7 @@ var ts; function withPackageId(packageInfo, r) { var packageId; if (r && packageInfo) { - var packageJsonContent = packageInfo.packageJsonContent; + var packageJsonContent = packageInfo.contents.packageJsonContent; if (typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string") { packageId = { name: packageJsonContent.name, @@ -44123,16 +44566,16 @@ var ts; function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson) { if (considerPackageJson === void 0) { considerPackageJson = true; } var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : undefined; - var packageJsonContent = packageInfo && packageInfo.packageJsonContent; - var versionPaths = packageInfo && packageInfo.versionPaths; + var packageJsonContent = packageInfo && packageInfo.contents.packageJsonContent; + var versionPaths = packageInfo && packageInfo.contents.versionPaths; return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths)); } /* @internal */ function getEntrypointsFromPackageJsonInfo(packageJsonInfo, options, host, cache, resolveJs) { - if (!resolveJs && packageJsonInfo.resolvedEntrypoints !== undefined) { + if (!resolveJs && packageJsonInfo.contents.resolvedEntrypoints !== undefined) { // Cached value excludes resolutions to JS files - those could be // cached separately, but they're used rarely. - return packageJsonInfo.resolvedEntrypoints; + return packageJsonInfo.contents.resolvedEntrypoints; } var entrypoints; var extensions = resolveJs ? Extensions.JavaScript : Extensions.TypeScript; @@ -44141,13 +44584,13 @@ var ts; requireState.conditions = ["node", "require", "types"]; requireState.requestContainingDirectory = packageJsonInfo.packageDirectory; var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory, - /*onlyRecordFailures*/ false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths); + /*onlyRecordFailures*/ false, requireState, packageJsonInfo.contents.packageJsonContent, packageJsonInfo.contents.versionPaths); entrypoints = ts.append(entrypoints, requireResolution === null || requireResolution === void 0 ? void 0 : requireResolution.path); - if (features & NodeResolutionFeatures.Exports && packageJsonInfo.packageJsonContent.exports) { + if (features & NodeResolutionFeatures.Exports && packageJsonInfo.contents.packageJsonContent.exports) { for (var _i = 0, _a = [["node", "import", "types"], ["node", "require", "types"]]; _i < _a.length; _i++) { var conditions = _a[_i]; var exportState = __assign(__assign({}, requireState), { failedLookupLocations: [], conditions: conditions }); - var exportResolutions = loadEntrypointsFromExportMap(packageJsonInfo, packageJsonInfo.packageJsonContent.exports, exportState, extensions); + var exportResolutions = loadEntrypointsFromExportMap(packageJsonInfo, packageJsonInfo.contents.packageJsonContent.exports, exportState, extensions); if (exportResolutions) { for (var _b = 0, exportResolutions_1 = exportResolutions; _b < exportResolutions_1.length; _b++) { var resolution = exportResolutions_1[_b]; @@ -44156,7 +44599,7 @@ var ts; } } } - return packageJsonInfo.resolvedEntrypoints = entrypoints || false; + return packageJsonInfo.contents.resolvedEntrypoints = entrypoints || false; } ts.getEntrypointsFromPackageJsonInfo = getEntrypointsFromPackageJsonInfo; function loadEntrypointsFromExportMap(scope, exports, state, extensions) { @@ -44260,7 +44703,9 @@ var ts; if (traceEnabled) trace(host, ts.Diagnostics.File_0_exists_according_to_earlier_cached_lookups, packageJsonPath); state.affectingLocations.push(packageJsonPath); - return existing; + return existing.packageDirectory === packageDirectory ? + existing : + { packageDirectory: packageDirectory, contents: existing.contents }; } else { if (existing && traceEnabled) @@ -44276,7 +44721,7 @@ var ts; trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); } var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state); - var result = { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined }; + var result = { packageDirectory: packageDirectory, contents: { packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined } }; (_b = state.packageJsonInfoCache) === null || _b === void 0 ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result); state.affectingLocations.push(packageJsonPath); return result; @@ -44401,17 +44846,16 @@ var ts; } function loadModuleFromSelfNameReference(extensions, moduleName, directory, state, cache, redirectedReference) { var _a, _b; - var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames; - var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames)); + var directoryPath = ts.getNormalizedAbsolutePath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)); var scope = getPackageScopeForPath(directoryPath, state); - if (!scope || !scope.packageJsonContent.exports) { + if (!scope || !scope.contents.packageJsonContent.exports) { return undefined; } - if (typeof scope.packageJsonContent.name !== "string") { + if (typeof scope.contents.packageJsonContent.name !== "string") { return undefined; } var parts = ts.getPathComponents(moduleName); // unrooted paths should have `""` as their 0th entry - var nameParts = ts.getPathComponents(scope.packageJsonContent.name); + var nameParts = ts.getPathComponents(scope.contents.packageJsonContent.name); if (!ts.every(nameParts, function (p, i) { return parts[i] === p; })) { return undefined; } @@ -44419,30 +44863,30 @@ var ts; return loadModuleFromExports(scope, extensions, !ts.length(trailingParts) ? "." : ".".concat(ts.directorySeparator).concat(trailingParts.join(ts.directorySeparator)), state, cache, redirectedReference); } function loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference) { - if (!scope.packageJsonContent.exports) { + if (!scope.contents.packageJsonContent.exports) { return undefined; } if (subpath === ".") { var mainExport = void 0; - if (typeof scope.packageJsonContent.exports === "string" || Array.isArray(scope.packageJsonContent.exports) || (typeof scope.packageJsonContent.exports === "object" && noKeyStartsWithDot(scope.packageJsonContent.exports))) { - mainExport = scope.packageJsonContent.exports; + if (typeof scope.contents.packageJsonContent.exports === "string" || Array.isArray(scope.contents.packageJsonContent.exports) || (typeof scope.contents.packageJsonContent.exports === "object" && noKeyStartsWithDot(scope.contents.packageJsonContent.exports))) { + mainExport = scope.contents.packageJsonContent.exports; } - else if (ts.hasProperty(scope.packageJsonContent.exports, ".")) { - mainExport = scope.packageJsonContent.exports["."]; + else if (ts.hasProperty(scope.contents.packageJsonContent.exports, ".")) { + mainExport = scope.contents.packageJsonContent.exports["."]; } if (mainExport) { var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, subpath, scope, /*isImports*/ false); return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false); } } - else if (allKeysStartWithDot(scope.packageJsonContent.exports)) { - if (typeof scope.packageJsonContent.exports !== "object") { + else if (allKeysStartWithDot(scope.contents.packageJsonContent.exports)) { + if (typeof scope.contents.packageJsonContent.exports !== "object") { if (state.traceEnabled) { trace(state.host, ts.Diagnostics.Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1, subpath, scope.packageDirectory); } return toSearchResult(/*value*/ undefined); } - var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, subpath, scope.packageJsonContent.exports, scope, /*isImports*/ false); + var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, subpath, scope.contents.packageJsonContent.exports, scope, /*isImports*/ false); if (result) { return result; } @@ -44460,8 +44904,7 @@ var ts; } return toSearchResult(/*value*/ undefined); } - var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames; - var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames)); + var directoryPath = ts.getNormalizedAbsolutePath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)); var scope = getPackageScopeForPath(directoryPath, state); if (!scope) { if (state.traceEnabled) { @@ -44469,13 +44912,13 @@ var ts; } return toSearchResult(/*value*/ undefined); } - if (!scope.packageJsonContent.imports) { + if (!scope.contents.packageJsonContent.imports) { if (state.traceEnabled) { trace(state.host, ts.Diagnostics.package_json_scope_0_has_no_imports_defined, scope.packageDirectory); } return toSearchResult(/*value*/ undefined); } - var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, scope.packageJsonContent.imports, scope, /*isImports*/ true); + var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, scope.contents.packageJsonContent.imports, scope, /*isImports*/ true); if (result) { return result; } @@ -44820,7 +45263,7 @@ var ts; if (fromFile) { return noPackageId(fromFile); } - var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.packageJsonContent, packageInfo.versionPaths); + var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.contents.packageJsonContent, packageInfo.contents.versionPaths); return withPackageId(packageInfo, fromDirectory); } } @@ -44828,14 +45271,14 @@ var ts; 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.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { + 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.packageJsonContent, packageInfo && packageInfo.versionPaths); + loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths); if (!pathAndExtension && packageInfo // eslint-disable-next-line no-null/no-null - && (packageInfo.packageJsonContent.exports === undefined || packageInfo.packageJsonContent.exports === null) + && (packageInfo.contents.packageJsonContent.exports === undefined || packageInfo.contents.packageJsonContent.exports === null) && state.features & NodeResolutionFeatures.EsmMode) { // EsmMode disables index lookup in `loadNodeModuleFromDirectoryWorker` generally, however non-relative package resolutions still assume // a default `index.js` entrypoint if no `main` or `exports` are present @@ -44847,12 +45290,12 @@ var ts; 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. packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state); - if (packageInfo && packageInfo.versionPaths) { + 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.versionPaths.version, ts.version, rest); + 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.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); + var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); if (fromPaths) { return fromPaths.value; } @@ -45065,26 +45508,26 @@ var ts; // A module is uninstantiated if it contains only switch (node.kind) { // 1. interface declarations, type alias declarations - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return 0 /* ModuleInstanceState.NonInstantiated */; // 2. const enum declarations - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (ts.isEnumConst(node)) { return 2 /* ModuleInstanceState.ConstEnumOnly */; } break; // 3. non-exported import declarations - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: if (!(ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */))) { return 0 /* ModuleInstanceState.NonInstantiated */; } break; // 4. Export alias declarations pointing at only uninstantiated modules or things uninstantiated modules contain - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportDeclaration = node; - if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 273 /* SyntaxKind.NamedExports */) { + if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 276 /* SyntaxKind.NamedExports */) { var state = 0 /* ModuleInstanceState.NonInstantiated */; for (var _i = 0, _a = exportDeclaration.exportClause.elements; _i < _a.length; _i++) { var specifier = _a[_i]; @@ -45100,7 +45543,7 @@ var ts; } break; // 5. other uninstantiated module declarations. - case 262 /* SyntaxKind.ModuleBlock */: { + case 265 /* SyntaxKind.ModuleBlock */: { var state_1 = 0 /* ModuleInstanceState.NonInstantiated */; ts.forEachChild(node, function (n) { var childState = getModuleInstanceStateCached(n, visited); @@ -45122,7 +45565,7 @@ var ts; }); return state_1; } - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return getModuleInstanceState(node, visited); case 79 /* SyntaxKind.Identifier */: // Only jsdoc typedef definition can exist in jsdoc namespace, and it should @@ -45323,7 +45766,7 @@ var ts; // Should not be called on a declaration with a computed property name, // unless it is a well known Symbol. function getDeclarationName(node) { - if (node.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (node.kind === 274 /* SyntaxKind.ExportAssignment */) { return node.isExportEquals ? "export=" /* InternalSymbolName.ExportEquals */ : "default" /* InternalSymbolName.Default */; } var name = ts.getNameOfDeclaration(node); @@ -45332,7 +45775,7 @@ var ts; var moduleName = ts.getTextOfIdentifierOrLiteral(name); return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"".concat(moduleName, "\"")); } - if (name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { var nameExpression = name.expression; // treat computed property names where expression is string/numeric literal as just string/numeric literal if (ts.isStringOrNumericLiteralLike(nameExpression)) { @@ -45358,36 +45801,36 @@ var ts; return ts.isPropertyNameLiteral(name) ? ts.getEscapedTextOfIdentifierOrLiteral(name) : undefined; } switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "__constructor" /* InternalSymbolName.Constructor */; - case 179 /* SyntaxKind.FunctionType */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: return "__call" /* InternalSymbolName.Call */; - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return "__new" /* InternalSymbolName.New */; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return "__index" /* InternalSymbolName.Index */; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return "__export" /* InternalSymbolName.ExportStar */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // json file should behave as // module.exports = ... return "export=" /* InternalSymbolName.ExportEquals */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */) { // module.exports = ... return "export=" /* InternalSymbolName.ExportEquals */; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return (ts.isJSDocConstructSignature(node) ? "__new" /* InternalSymbolName.New */ : "__call" /* InternalSymbolName.Call */); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Parameters with names are handled at the top of this function. Parameters // without names can only come from JSDocFunctionTypes. - ts.Debug.assert(node.parent.kind === 317 /* SyntaxKind.JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); }); + ts.Debug.assert(node.parent.kind === 320 /* SyntaxKind.JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); }); var functionType = node.parent; var index = functionType.parameters.indexOf(node); return "arg" + index; @@ -45406,7 +45849,7 @@ var ts; */ function declareSymbol(symbolTable, parent, node, includes, excludes, isReplaceableByMethod, isComputedName) { ts.Debug.assert(isComputedName || !ts.hasDynamicName(node)); - var isDefaultExport = ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) || ts.isExportSpecifier(node) && node.name.escapedText === "default"; + var isDefaultExport = ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) || ts.isExportSpecifier(node) && node.name.escapedText === "default"; // The exported symbol for an export default function/class node is always named "default" var name = isComputedName ? "__computed" /* InternalSymbolName.Computed */ : isDefaultExport && parent ? "default" /* InternalSymbolName.Default */ @@ -45489,7 +45932,7 @@ var ts; // 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default // 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers) if (symbol.declarations && symbol.declarations.length && - (node.kind === 271 /* SyntaxKind.ExportAssignment */ && !node.isExportEquals)) { + (node.kind === 274 /* SyntaxKind.ExportAssignment */ && !node.isExportEquals)) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; messageNeedsName_1 = false; multipleDefaultExports_1 = true; @@ -45528,7 +45971,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = !!(ts.getCombinedModifierFlags(node) & 1 /* ModifierFlags.Export */) || jsdocTreatAsExported(node); if (symbolFlags & 2097152 /* SymbolFlags.Alias */) { - if (node.kind === 275 /* SyntaxKind.ExportSpecifier */ || (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 278 /* SyntaxKind.ExportSpecifier */ || (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -45553,7 +45996,7 @@ var ts; if (ts.isJSDocTypeAlias(node)) ts.Debug.assert(ts.isInJSFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file. if (!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 64 /* NodeFlags.ExportContext */)) { - if (!container.locals || (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) && !getDeclarationName(node))) { + if (!container.locals || (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) && !getDeclarationName(node))) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); // No local symbol for an unnamed default! } var exportKind = symbolFlags & 111551 /* SymbolFlags.Value */ ? 1048576 /* SymbolFlags.ExportValue */ : 0; @@ -45617,7 +46060,7 @@ var ts; // for it. We must clear this so we don't accidentally move any stale data forward from // a previous compilation. if (containerFlags & 1 /* ContainerFlags.IsContainer */) { - if (node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind !== 216 /* SyntaxKind.ArrowFunction */) { thisParentContainer = container; } container = blockScopeContainer = node; @@ -45639,10 +46082,10 @@ var ts; var saveActiveLabelList = activeLabelList; var saveHasExplicitReturn = hasExplicitReturn; var isImmediatelyInvoked = (containerFlags & 16 /* ContainerFlags.IsFunctionExpression */ && - !ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Async */) && + !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Async */) && !node.asteriskToken && !!ts.getImmediatelyInvokedFunctionExpression(node)) || - node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; // A non-async, non-generator IIFE is considered part of the containing control flow. Return statements behave // similarly to break statements that exit to a label just past the statement body. if (!isImmediatelyInvoked) { @@ -45653,7 +46096,7 @@ var ts; } // We create a return control flow graph for IIFEs and constructors. For constructors // we use the return control flow graph in strict property initialization checks. - currentReturnTarget = isImmediatelyInvoked || node.kind === 171 /* SyntaxKind.Constructor */ || (ts.isInJSFile(node) && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */)) ? createBranchLabel() : undefined; + currentReturnTarget = isImmediatelyInvoked || node.kind === 173 /* SyntaxKind.Constructor */ || (ts.isInJSFile(node) && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */)) ? createBranchLabel() : undefined; currentExceptionTarget = undefined; currentBreakTarget = undefined; currentContinueTarget = undefined; @@ -45668,14 +46111,14 @@ var ts; node.flags |= 512 /* NodeFlags.HasExplicitReturn */; node.endFlowNode = currentFlow; } - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { node.flags |= emitFlags; node.endFlowNode = currentFlow; } if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); currentFlow = finishFlowLabel(currentReturnTarget); - if (node.kind === 171 /* SyntaxKind.Constructor */ || node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ || (ts.isInJSFile(node) && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */))) { + if (node.kind === 173 /* SyntaxKind.Constructor */ || node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ || (ts.isInJSFile(node) && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */))) { node.returnFlowNode = currentFlow; } } @@ -45702,8 +46145,8 @@ var ts; blockScopeContainer = savedBlockScopeContainer; } function bindEachFunctionsFirst(nodes) { - bindEach(nodes, function (n) { return n.kind === 256 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); - bindEach(nodes, function (n) { return n.kind !== 256 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind === 259 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind !== 259 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); } function bindEach(nodes, bindFunction) { if (bindFunction === void 0) { bindFunction = bind; } @@ -45726,59 +46169,59 @@ var ts; inAssignmentPattern = saveInAssignmentPattern; return; } - if (node.kind >= 237 /* SyntaxKind.FirstStatement */ && node.kind <= 253 /* SyntaxKind.LastStatement */ && !options.allowUnreachableCode) { + if (node.kind >= 240 /* SyntaxKind.FirstStatement */ && node.kind <= 256 /* SyntaxKind.LastStatement */ && !options.allowUnreachableCode) { node.flowNode = currentFlow; } switch (node.kind) { - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: bindWhileStatement(node); break; - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: bindDoStatement(node); break; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: bindForStatement(node); break; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: bindForInOrForOfStatement(node); break; - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: bindIfStatement(node); break; - case 247 /* SyntaxKind.ReturnStatement */: - case 251 /* SyntaxKind.ThrowStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 254 /* SyntaxKind.ThrowStatement */: bindReturnOrThrow(node); break; - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: bindTryStatement(node); break; - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: bindSwitchStatement(node); break; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: bindCaseBlock(node); break; - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: bindCaseClause(node); break; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: bindExpressionStatement(node); break; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: bindLabeledStatement(node); break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: bindPrefixUnaryExpressionFlow(node); break; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: bindPostfixUnaryExpressionFlow(node); break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { // Carry over whether we are in an assignment pattern to // binary expressions that could actually be an initializer @@ -45788,47 +46231,50 @@ var ts; } bindBinaryExpressionFlow(node); break; - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: bindDeleteExpressionFlow(node); break; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: bindConditionalExpressionFlow(node); break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: bindVariableDeclarationFlow(node); break; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: bindAccessExpressionFlow(node); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: bindCallExpressionFlow(node); break; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: bindNonNullExpressionFlow(node); break; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: bindJSDocTypeAlias(node); break; // In source files and blocks, bind functions first to match hoisting that occurs at runtime - case 305 /* SyntaxKind.SourceFile */: { + case 308 /* SyntaxKind.SourceFile */: { bindEachFunctionsFirst(node.statements); bind(node.endOfFileToken); break; } - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: bindEachFunctionsFirst(node.statements); break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: bindBindingElementFlow(node); break; - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 225 /* SyntaxKind.SpreadElement */: + case 166 /* SyntaxKind.Parameter */: + bindParameterFlow(node); + break; + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 227 /* SyntaxKind.SpreadElement */: // Carry over whether we are in an assignment pattern of Object and Array literals // as well as their children that are valid assignment targets. inAssignmentPattern = saveInAssignmentPattern; @@ -45845,19 +46291,19 @@ var ts; case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: case 108 /* SyntaxKind.ThisKeyword */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return containsNarrowableReference(expr); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return hasNarrowableArgument(expr); - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return isNarrowingExpression(expr.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isNarrowingBinaryExpression(expr); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 53 /* SyntaxKind.ExclamationToken */ && isNarrowingExpression(expr.operand); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return isNarrowingExpression(expr.expression); } return false; @@ -45881,7 +46327,7 @@ var ts; } } } - if (expr.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + if (expr.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && containsNarrowableReference(expr.expression.expression)) { return true; } @@ -45914,9 +46360,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isNarrowableOperand(expr.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (expr.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: return isNarrowableOperand(expr.left); @@ -45992,26 +46438,26 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: return parent.expression === node; - case 242 /* SyntaxKind.ForStatement */: - case 222 /* SyntaxKind.ConditionalExpression */: + case 245 /* SyntaxKind.ForStatement */: + case 224 /* SyntaxKind.ConditionalExpression */: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (node.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { node = node.expression; } - else if (node.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && node.operator === 53 /* SyntaxKind.ExclamationToken */) { + else if (node.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && node.operator === 53 /* SyntaxKind.ExclamationToken */) { node = node.operand; } else { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ || node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */); } @@ -46057,7 +46503,7 @@ var ts; } function setContinueTarget(node, target) { var label = activeLabelList; - while (label && node.parent.kind === 250 /* SyntaxKind.LabeledStatement */) { + while (label && node.parent.kind === 253 /* SyntaxKind.LabeledStatement */) { label.continueTarget = target; label = label.next; node = node.parent; @@ -46108,12 +46554,12 @@ var ts; bind(node.expression); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; - if (node.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.kind === 247 /* SyntaxKind.ForOfStatement */) { bind(node.awaitModifier); } addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -46135,7 +46581,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 247 /* SyntaxKind.ReturnStatement */) { + if (node.kind === 250 /* SyntaxKind.ReturnStatement */) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -46152,7 +46598,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 246 /* SyntaxKind.BreakStatement */ ? breakTarget : continueTarget; + var flowLabel = node.kind === 249 /* SyntaxKind.BreakStatement */ ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -46257,7 +46703,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 290 /* SyntaxKind.DefaultClause */; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 293 /* SyntaxKind.DefaultClause */; }); // We mark a switch statement as possibly exhaustive if it has no default clause and if all // case clauses have unreachable end points (e.g. they all return). Note, we no longer need // this property in control flow analysis, it's there only for backwards compatibility. @@ -46305,7 +46751,7 @@ var ts; function maybeBindExpressionFlowIfCall(node) { // A top level or comma expression call expression with a dotted function name and at least one argument // is potentially an assertion and is therefore included in the control flow. - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { var call = node; if (call.expression.kind !== 106 /* SyntaxKind.SuperKeyword */ && ts.isDottedName(call.expression)) { currentFlow = createFlowCall(currentFlow, call); @@ -46331,7 +46777,7 @@ var ts; currentFlow = finishFlowLabel(postStatementLabel); } function bindDestructuringTargetFlow(node) { - if (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { bindAssignmentTargetFlow(node.left); } else { @@ -46342,10 +46788,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowMutation(16 /* FlowFlags.Assignment */, currentFlow, node); } - else if (node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */) { + else if (node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 225 /* SyntaxKind.SpreadElement */) { + if (e.kind === 227 /* SyntaxKind.SpreadElement */) { bindAssignmentTargetFlow(e.expression); } else { @@ -46353,16 +46799,16 @@ var ts; } } } - else if (node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + else if (node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (p.kind === 299 /* SyntaxKind.PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + else if (p.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (p.kind === 301 /* SyntaxKind.SpreadAssignment */) { bindAssignmentTargetFlow(p.expression); } } @@ -46499,7 +46945,7 @@ var ts; var operator = node.operatorToken.kind; if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 63 /* SyntaxKind.EqualsToken */ && node.left.kind === 207 /* SyntaxKind.ElementAccessExpression */) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && node.left.kind === 209 /* SyntaxKind.ElementAccessExpression */) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowMutation(256 /* FlowFlags.ArrayMutation */, currentFlow, node); @@ -46527,7 +46973,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { bindAssignmentTargetFlow(node.expression); } } @@ -46565,24 +47011,42 @@ var ts; } } function bindBindingElementFlow(node) { - if (ts.isBindingPattern(node.name)) { - // When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per: - // - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization - // - `BindingElement: BindingPattern Initializer?` - // - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization - // - `BindingElement: BindingPattern Initializer?` - bind(node.dotDotDotToken); - bind(node.propertyName); - bind(node.initializer); - bind(node.name); + // When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per: + // - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization + // - `BindingElement: BindingPattern Initializer?` + // - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization + // - `BindingElement: BindingPattern Initializer?` + bind(node.dotDotDotToken); + bind(node.propertyName); + bindInitializer(node.initializer); + bind(node.name); + } + function bindParameterFlow(node) { + bindEach(node.modifiers); + bind(node.dotDotDotToken); + bind(node.questionToken); + bind(node.type); + bindInitializer(node.initializer); + bind(node.name); + } + // a BindingElement/Parameter does not have side effects if initializers are not evaluated and used. (see GH#49759) + function bindInitializer(node) { + if (!node) { + return; } - else { - bindEachChild(node); + var entryFlow = currentFlow; + bind(node); + if (entryFlow === unreachableFlow || entryFlow === currentFlow) { + return; } + var exitFlow = createBranchLabel(); + addAntecedent(exitFlow, entryFlow); + addAntecedent(exitFlow, currentFlow); + currentFlow = finishFlowLabel(exitFlow); } function bindJSDocTypeAlias(node) { bind(node.tagName); - if (node.kind !== 339 /* SyntaxKind.JSDocEnumTag */ && node.fullName) { + if (node.kind !== 342 /* SyntaxKind.JSDocEnumTag */ && node.fullName) { // don't bind the type name yet; that's delayed until delayedBindJSDocTypedefTag ts.setParent(node.fullName, node); ts.setParentRecursive(node.fullName, /*incremental*/ false); @@ -46594,7 +47058,7 @@ var ts; function bindJSDocClassTag(node) { bindEachChild(node); var host = ts.getHostSignatureFromJSDoc(node); - if (host && host.kind !== 169 /* SyntaxKind.MethodDeclaration */) { + if (host && host.kind !== 171 /* SyntaxKind.MethodDeclaration */) { addDeclarationToSymbol(host.symbol, host, 32 /* SymbolFlags.Class */); } } @@ -46607,15 +47071,15 @@ var ts; } function bindOptionalChainRest(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: bind(node.questionDotToken); bind(node.name); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: bind(node.questionDotToken); bind(node.argumentExpression); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: bind(node.questionDotToken); bindEach(node.typeArguments); bindEach(node.arguments); @@ -46680,7 +47144,7 @@ var ts; // an immediately invoked function expression (IIFE). Initialize the flowNode property to // the current control flow (which includes evaluation of the IIFE arguments). var expr = ts.skipParentheses(node.expression); - if (expr.kind === 213 /* SyntaxKind.FunctionExpression */ || expr.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (expr.kind === 215 /* SyntaxKind.FunctionExpression */ || expr.kind === 216 /* SyntaxKind.ArrowFunction */) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -46692,7 +47156,7 @@ var ts; } } } - if (node.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var propertyAccess = node.expression; if (ts.isIdentifier(propertyAccess.name) && isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowMutation(256 /* FlowFlags.ArrayMutation */, currentFlow, node); @@ -46701,55 +47165,55 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 286 /* SyntaxKind.JsxAttributes */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 289 /* SyntaxKind.JsxAttributes */: return 1 /* ContainerFlags.IsContainer */; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return 1 /* ContainerFlags.IsContainer */ | 64 /* ContainerFlags.IsInterface */; - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 195 /* SyntaxKind.MappedType */: - case 176 /* SyntaxKind.IndexSignature */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 197 /* SyntaxKind.MappedType */: + case 178 /* SyntaxKind.IndexSignature */: return 1 /* ContainerFlags.IsContainer */ | 32 /* ContainerFlags.HasLocals */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: if (ts.isObjectLiteralOrClassExpressionMethodOrAccessor(node)) { return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */ | 128 /* ContainerFlags.IsObjectLiteralOrClassExpressionMethodOrAccessor */; } // falls through - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 179 /* SyntaxKind.FunctionType */: - case 175 /* SyntaxKind.ConstructSignature */: - case 180 /* SyntaxKind.ConstructorType */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 181 /* SyntaxKind.FunctionType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */ | 16 /* ContainerFlags.IsFunctionExpression */; - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return 4 /* ContainerFlags.IsControlFlowContainer */; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return node.initializer ? 4 /* ContainerFlags.IsControlFlowContainer */ : 0; - case 292 /* SyntaxKind.CatchClause */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 263 /* SyntaxKind.CaseBlock */: + case 295 /* SyntaxKind.CatchClause */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 266 /* SyntaxKind.CaseBlock */: return 2 /* ContainerFlags.IsBlockScopedContainer */; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: // do not treat blocks directly inside a function as a block-scoped-container. // Locals that reside in this block should go to the function locals. Otherwise 'x' // would not appear to be a redeclaration of a block scoped local in the following @@ -46782,46 +47246,46 @@ var ts; // members are declared (for example, a member of a class will go into a specific // symbol table depending on if it is static or not). We defer to specialized // handlers to take care of declaring these child members. - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 286 /* SyntaxKind.JsxAttributes */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 289 /* SyntaxKind.JsxAttributes */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the // object / type / interface declaring them). An exception is type parameters, // which are in scope without qualification (similar to 'locals'). return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 195 /* SyntaxKind.MappedType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 197 /* SyntaxKind.MappedType */: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, // they're only accessed 'lexically' (i.e. from code that exists underneath @@ -46929,10 +47393,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (ts.isExternalOrCommonJsModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -47029,7 +47493,7 @@ var ts; node.originalKeywordKind <= 125 /* SyntaxKind.LastFutureReservedWord */) { file.bindDiagnostics.push(createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); } - else if (node.originalKeywordKind === 132 /* SyntaxKind.AwaitKeyword */) { + else if (node.originalKeywordKind === 133 /* SyntaxKind.AwaitKeyword */) { if (ts.isExternalModule(file) && ts.isInTopLevelContext(node)) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module, ts.declarationNameToString(node))); } @@ -47131,8 +47595,8 @@ var ts; function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { // Report error if function is not top level function declaration - if (blockScopeContainer.kind !== 305 /* SyntaxKind.SourceFile */ && - blockScopeContainer.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && + if (blockScopeContainer.kind !== 308 /* SyntaxKind.SourceFile */ && + blockScopeContainer.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isFunctionLikeOrClassStaticBlockDeclaration(blockScopeContainer)) { // We check first if the name is inside class declaration or class expression; if so give explicit message // otherwise report generic error message. @@ -47229,7 +47693,7 @@ var ts; // the current 'container' node when it changes. This helps us know which symbol table // a local should go into for example. Since terminal nodes are known not to have // children, as an optimization we don't process those. - if (node.kind > 160 /* SyntaxKind.LastToken */) { + if (node.kind > 162 /* SyntaxKind.LastToken */) { var saveParent = parent; parent = node; var containerFlags = getContainerFlags(node); @@ -47305,23 +47769,23 @@ var ts; } // falls through case 108 /* SyntaxKind.ThisKeyword */: - if (currentFlow && (ts.isExpression(node) || parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkContextualIdentifier(node); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: if (currentFlow && ts.isPartOfTypeQuery(node)) { node.flowNode = currentFlow; } break; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: case 106 /* SyntaxKind.SuperKeyword */: node.flowNode = currentFlow; break; case 80 /* SyntaxKind.PrivateIdentifier */: return checkPrivateIdentifier(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = node; if (currentFlow && isNarrowableReference(expr)) { expr.flowNode = currentFlow; @@ -47336,7 +47800,7 @@ var ts; declareSymbol(file.locals, /*parent*/ undefined, expr.expression, 1 /* SymbolFlags.FunctionScopedVariable */ | 134217728 /* SymbolFlags.ModuleExports */, 111550 /* SymbolFlags.FunctionScopedVariableExcludes */); } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var specialKind = ts.getAssignmentDeclarationKind(node); switch (specialKind) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -47372,78 +47836,78 @@ var ts; ts.Debug.fail("Unknown binary expression special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return checkStrictModeCatchClause(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return checkStrictModeDeleteExpression(node); case 8 /* SyntaxKind.NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return checkStrictModeWithStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return checkStrictModeLabeledStatement(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: seenThisKeyword = true; return; - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: break; // Binding the children will handle everything - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return bindTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return bindParameter(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return bindVariableDeclarationOrBindingElement(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: node.flowNode = currentFlow; return bindVariableDeclarationOrBindingElement(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return bindPropertyWorker(node); - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* SymbolFlags.Property */, 0 /* SymbolFlags.PropertyExcludes */); - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* SymbolFlags.EnumMember */, 900095 /* SymbolFlags.EnumMemberExcludes */); - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* SymbolFlags.Signature */, 0 /* SymbolFlags.None */); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: // If this is an ObjectLiteralExpression method, then it sits in the same space // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes // so that it will conflict with any other object literal members with the same // name. return bindPropertyOrMethodOrAccessor(node, 8192 /* SymbolFlags.Method */ | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), ts.isObjectLiteralMethod(node) ? 0 /* SymbolFlags.PropertyExcludes */ : 103359 /* SymbolFlags.MethodExcludes */); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return bindFunctionDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* SymbolFlags.Constructor */, /*symbolExcludes:*/ 0 /* SymbolFlags.None */); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* SymbolFlags.GetAccessor */, 46015 /* SymbolFlags.GetAccessorExcludes */); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SymbolFlags.SetAccessor */, 78783 /* SymbolFlags.SetAccessorExcludes */); - case 179 /* SyntaxKind.FunctionType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 323 /* SyntaxKind.JSDocSignature */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 326 /* SyntaxKind.JSDocSignature */: + case 182 /* SyntaxKind.ConstructorType */: return bindFunctionOrConstructorType(node); - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 195 /* SyntaxKind.MappedType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 197 /* SyntaxKind.MappedType */: return bindAnonymousTypeWorker(node); - case 332 /* SyntaxKind.JSDocClassTag */: + case 335 /* SyntaxKind.JSDocClassTag */: return bindJSDocClassTag(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return bindFunctionExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: var assignmentKind = ts.getAssignmentDeclarationKind(node); switch (assignmentKind) { case 7 /* AssignmentDeclarationKind.ObjectDefinePropertyValue */: @@ -47462,70 +47926,73 @@ var ts; } break; // Members of classes, interfaces, and modules - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return bindClassLikeDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* SymbolFlags.Interface */, 788872 /* SymbolFlags.InterfaceExcludes */); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* SymbolFlags.TypeAlias */, 788968 /* SymbolFlags.TypeAliasExcludes */); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return bindEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return bindModuleDeclaration(node); // Jsx-attributes - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return bindJsxAttributes(node); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return bindJsxAttribute(node, 4 /* SymbolFlags.Property */, 0 /* SymbolFlags.PropertyExcludes */); // Imports and exports - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 2097152 /* SymbolFlags.Alias */, 2097152 /* SymbolFlags.AliasExcludes */); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return bindNamespaceExportDeclaration(node); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return bindImportClause(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return bindExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return bindExportAssignment(node); - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (!ts.isFunctionLikeOrClassStaticBlockDeclaration(node.parent)) { return; } // falls through - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return updateStrictModeStatementList(node.statements); - case 340 /* SyntaxKind.JSDocParameterTag */: - if (node.parent.kind === 323 /* SyntaxKind.JSDocSignature */) { + case 343 /* SyntaxKind.JSDocParameterTag */: + if (node.parent.kind === 326 /* SyntaxKind.JSDocSignature */) { return bindParameter(node); } - if (node.parent.kind !== 322 /* SyntaxKind.JSDocTypeLiteral */) { + if (node.parent.kind !== 325 /* SyntaxKind.JSDocTypeLiteral */) { break; } // falls through - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: var propTag = node; - var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */ ? + var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */ ? 4 /* SymbolFlags.Property */ | 16777216 /* SymbolFlags.Optional */ : 4 /* SymbolFlags.Property */; return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* SymbolFlags.PropertyExcludes */); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return (delayedTypeAliases || (delayedTypeAliases = [])).push(node); } } function bindPropertyWorker(node) { - return bindPropertyOrMethodOrAccessor(node, 4 /* SymbolFlags.Property */ | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), 0 /* SymbolFlags.PropertyExcludes */); + var isAutoAccessor = ts.isAutoAccessorPropertyDeclaration(node); + var includes = isAutoAccessor ? 98304 /* SymbolFlags.Accessor */ : 4 /* SymbolFlags.Property */; + var excludes = isAutoAccessor ? 13247 /* SymbolFlags.AccessorExcludes */ : 0 /* SymbolFlags.PropertyExcludes */; + return bindPropertyOrMethodOrAccessor(node, includes | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), excludes); } function bindAnonymousTypeWorker(node) { return bindAnonymousDeclaration(node, 2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */); @@ -47685,8 +48152,8 @@ var ts; } var thisContainer = ts.getThisContainer(node, /*includeArrowFunctions*/ false); switch (thisContainer.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: var constructorSymbol = thisContainer.symbol; // For `f.prototype.m = function() { this.x = 0; }`, `this.x = 0` should modify `f`'s members, not the function expression. if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { @@ -47708,12 +48175,12 @@ var ts; addDeclarationToSymbol(constructorSymbol, constructorSymbol.valueDeclaration, 32 /* SymbolFlags.Class */); } break; - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // this.foo assignment in a JavaScript class // Bind this property to the containing class var containingClass = thisContainer.parent; @@ -47725,7 +48192,7 @@ var ts; declareSymbol(symbolTable, containingClass.symbol, node, 4 /* SymbolFlags.Property */ | 67108864 /* SymbolFlags.Assignment */, 0 /* SymbolFlags.None */, /*isReplaceableByMethod*/ true); } break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // this.property = assignment in a source file -- declare symbol in exports for a module, in locals for a script if (ts.hasDynamicName(node)) { break; @@ -47754,7 +48221,7 @@ var ts; if (node.expression.kind === 108 /* SyntaxKind.ThisKeyword */) { bindThisPropertyAssignment(node); } - else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 308 /* SyntaxKind.SourceFile */) { if (ts.isPrototypeAccess(node.expression)) { bindPrototypePropertyAssignment(node, node.parent); } @@ -47794,7 +48261,7 @@ var ts; } function bindObjectDefinePropertyAssignment(node) { var namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0]); - var isToplevel = node.parent.parent.kind === 305 /* SyntaxKind.SourceFile */; + var isToplevel = node.parent.parent.kind === 308 /* SyntaxKind.SourceFile */; namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, node.arguments[0], isToplevel, /*isPrototypeProperty*/ false, /*containerIsClass*/ false); bindPotentiallyNewExpandoMemberToNamespace(node, namespaceSymbol, /*isPrototypeProperty*/ false); } @@ -47903,8 +48370,8 @@ var ts; } function isTopLevelNamespaceAssignment(propertyAccess) { return ts.isBinaryExpression(propertyAccess.parent) - ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 305 /* SyntaxKind.SourceFile */ - : propertyAccess.parent.parent.kind === 305 /* SyntaxKind.SourceFile */; + ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 308 /* SyntaxKind.SourceFile */ + : propertyAccess.parent.parent.kind === 308 /* SyntaxKind.SourceFile */; } function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty, containerIsClass) { var namespaceSymbol = lookupSymbolForPropertyAccess(name, container) || lookupSymbolForPropertyAccess(name, blockScopeContainer); @@ -47983,7 +48450,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 257 /* SyntaxKind.ClassDeclaration */) { + if (node.kind === 260 /* SyntaxKind.ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* SymbolFlags.Class */, 899503 /* SymbolFlags.ClassExcludes */); } else { @@ -48025,7 +48492,7 @@ var ts; checkStrictModeEvalOrArguments(node, node.name); } if (!ts.isBindingPattern(node.name)) { - var possibleVariableDecl = node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? node : node.parent.parent; + var possibleVariableDecl = node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? node : node.parent.parent; if (ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !ts.getJSDocTypeTag(node) && @@ -48053,7 +48520,7 @@ var ts; } } function bindParameter(node) { - if (node.kind === 340 /* SyntaxKind.JSDocParameterTag */ && container.kind !== 323 /* SyntaxKind.JSDocSignature */) { + if (node.kind === 343 /* SyntaxKind.JSDocParameterTag */ && container.kind !== 326 /* SyntaxKind.JSDocSignature */) { return; } if (inStrictMode && !(node.flags & 16777216 /* NodeFlags.Ambient */)) { @@ -48130,7 +48597,7 @@ var ts; declareSymbolAndAddToSymbolTable(node, 262144 /* SymbolFlags.TypeParameter */, 526824 /* SymbolFlags.TypeParameterExcludes */); } } - else if (node.parent.kind === 190 /* SyntaxKind.InferType */) { + else if (node.parent.kind === 192 /* SyntaxKind.InferType */) { var container_2 = getInferTypeContainer(node.parent); if (container_2) { if (!container_2.locals) { @@ -48158,11 +48625,11 @@ var ts; if (currentFlow === unreachableFlow) { var reportError = // report error on all statements except empty ones - (ts.isStatementButNotDeclaration(node) && node.kind !== 236 /* SyntaxKind.EmptyStatement */) || + (ts.isStatementButNotDeclaration(node) && node.kind !== 239 /* SyntaxKind.EmptyStatement */) || // report error on class declarations - node.kind === 257 /* SyntaxKind.ClassDeclaration */ || + node.kind === 260 /* SyntaxKind.ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)); + (node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)); if (reportError) { currentFlow = reportedUnreachableFlow; if (!options.allowUnreachableCode) { @@ -48206,12 +48673,12 @@ var ts; } function isPurelyTypeDeclaration(s) { switch (s.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return getModuleInstanceState(s) !== 1 /* ModuleInstanceState.Instantiated */; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.hasSyntacticModifier(s, 2048 /* ModifierFlags.Const */); default: return false; @@ -48412,7 +48879,7 @@ var ts; // (their type resolved directly to the member deeply referenced) // So to get the intervening symbols, we need to check if there's a type // query node on any of the symbol's declarations and get symbols there - if (d.type && d.type.kind === 181 /* SyntaxKind.TypeQuery */) { + if (d.type && d.type.kind === 183 /* SyntaxKind.TypeQuery */) { var query = d.type; var entity = getResolvedSymbol(getFirstIdentifier(query.exprName)); visitSymbol(entity); @@ -48823,6 +49290,7 @@ var ts; getTypeOfPropertyOfType: function (type, name) { return getTypeOfPropertyOfType(type, ts.escapeLeadingUnderscores(name)); }, getIndexInfoOfType: function (type, kind) { return getIndexInfoOfType(type, kind === 0 /* IndexKind.String */ ? stringType : numberType); }, getIndexInfosOfType: getIndexInfosOfType, + getIndexInfosOfIndexSymbol: getIndexInfosOfIndexSymbol, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: function (type, kind) { return getIndexTypeOfType(type, kind === 0 /* IndexKind.String */ ? stringType : numberType); }, getIndexType: function (type) { return getIndexType(type); }, @@ -48848,6 +49316,7 @@ var ts; signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration, symbolToEntityName: nodeBuilder.symbolToEntityName, symbolToExpression: nodeBuilder.symbolToExpression, + symbolToNode: nodeBuilder.symbolToNode, symbolToTypeParameterDeclarations: nodeBuilder.symbolToTypeParameterDeclarations, symbolToParameterDeclaration: nodeBuilder.symbolToParameterDeclaration, typeParameterToDeclaration: nodeBuilder.typeParameterToDeclaration, @@ -49096,6 +49565,7 @@ var ts; isPropertyAccessible: isPropertyAccessible, getTypeOnlyAliasDeclaration: getTypeOnlyAliasDeclaration, getMemberOverrideModifierStatus: getMemberOverrideModifierStatus, + isTypeParameterPossiblyReferenced: isTypeParameterPossiblyReferenced, }; function runWithInferenceBlockedFromSourceNode(node, fn) { var containingCall = ts.findAncestor(node, ts.isCallLikeExpression); @@ -49153,6 +49623,7 @@ var ts; var wildcardType = createIntrinsicType(1 /* TypeFlags.Any */, "any"); var errorType = createIntrinsicType(1 /* TypeFlags.Any */, "error"); var unresolvedType = createIntrinsicType(1 /* TypeFlags.Any */, "unresolved"); + var nonInferrableAnyType = createIntrinsicType(1 /* TypeFlags.Any */, "any", 65536 /* ObjectFlags.ContainsWideningType */); var intrinsicMarkerType = createIntrinsicType(1 /* TypeFlags.Any */, "intrinsic"); var unknownType = createIntrinsicType(2 /* TypeFlags.Unknown */, "unknown"); var nonNullUnknownType = createIntrinsicType(2 /* TypeFlags.Unknown */, "unknown"); @@ -49214,7 +49685,8 @@ var ts; var emptyTypeLiteralSymbol = createSymbol(2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */); emptyTypeLiteralSymbol.members = ts.createSymbolTable(); var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); - var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType; + var unknownEmptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); + var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType; var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); emptyGenericType.instantiations = new ts.Map(); var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); @@ -49328,6 +49800,8 @@ var ts; var deferredGlobalOmitSymbol; var deferredGlobalAwaitedSymbol; var deferredGlobalBigIntType; + var deferredGlobalNaNSymbol; + var deferredGlobalRecordSymbol; var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name var flowLoopStart = 0; var flowLoopCount = 0; @@ -49517,10 +49991,10 @@ var ts; } // Issue errors globally var file = ts.getSourceFileOfNode(location); - addErrorOrSuggestion(isError, "message" in message ? ts.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForFileFromMessageChain(file, message)); // eslint-disable-line no-in-operator + addErrorOrSuggestion(isError, "message" in message ? ts.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForFileFromMessageChain(file, message)); // eslint-disable-line local/no-in-operator return; } - addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line no-in-operator + addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line local/no-in-operator } function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, arg0, arg1, arg2, arg3) { var diagnostic = error(location, message, arg0, arg1, arg2, arg3); @@ -49749,7 +50223,7 @@ var ts; if (unidirectional === void 0) { unidirectional = false; } source.forEach(function (sourceSymbol, id) { var targetSymbol = target.get(id); - target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol); + target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol)); }); } function mergeModuleAugmentation(moduleName) { @@ -49837,7 +50311,7 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = new NodeLinks()); } function isGlobalSourceFile(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -49896,17 +50370,17 @@ var ts; } if (declaration.pos <= usage.pos && !(ts.isPropertyDeclaration(declaration) && ts.isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) { // declaration is before usage - if (declaration.kind === 203 /* SyntaxKind.BindingElement */) { + if (declaration.kind === 205 /* SyntaxKind.BindingElement */) { // still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2]) - var errorBindingElement = ts.getAncestor(usage, 203 /* SyntaxKind.BindingElement */); + var errorBindingElement = ts.getAncestor(usage, 205 /* SyntaxKind.BindingElement */); if (errorBindingElement) { return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) || declaration.pos < errorBindingElement.pos; } // or it might be illegal if usage happens before parent variable is declared (eg var [a] = a) - return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 254 /* SyntaxKind.VariableDeclaration */), usage); + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 257 /* SyntaxKind.VariableDeclaration */), usage); } - else if (declaration.kind === 254 /* SyntaxKind.VariableDeclaration */) { + else if (declaration.kind === 257 /* SyntaxKind.VariableDeclaration */) { // still might be illegal if usage is in the initializer of the variable declaration (eg var a = a) return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } @@ -49936,12 +50410,12 @@ var ts; // or if usage is in a type context: // 1. inside a type query (typeof in type position) // 2. inside a jsdoc comment - if (usage.parent.kind === 275 /* SyntaxKind.ExportSpecifier */ || (usage.parent.kind === 271 /* SyntaxKind.ExportAssignment */ && usage.parent.isExportEquals)) { + if (usage.parent.kind === 278 /* SyntaxKind.ExportSpecifier */ || (usage.parent.kind === 274 /* SyntaxKind.ExportAssignment */ && usage.parent.isExportEquals)) { // export specifiers do not use the variable, they only make it available for use return true; } // When resolving symbols for exports, the `usage` location passed in can be the export site directly - if (usage.kind === 271 /* SyntaxKind.ExportAssignment */ && usage.isExportEquals) { + if (usage.kind === 274 /* SyntaxKind.ExportAssignment */ && usage.isExportEquals) { return true; } if (!!(usage.flags & 8388608 /* NodeFlags.JSDoc */) || isInTypeQuery(usage) || usageInTypeDeclaration()) { @@ -49963,9 +50437,9 @@ var ts; } function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { switch (declaration.parent.parent.kind) { - case 237 /* SyntaxKind.VariableStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 240 /* SyntaxKind.VariableStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: // variable statement/for/for-of statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) if (isSameScopeDescendentOf(usage, declaration, declContainer)) { @@ -49993,7 +50467,7 @@ var ts; var initializerOfProperty = propertyDeclaration.initializer === current; if (initializerOfProperty) { if (ts.isStatic(current.parent)) { - if (declaration.kind === 169 /* SyntaxKind.MethodDeclaration */) { + if (declaration.kind === 171 /* SyntaxKind.MethodDeclaration */) { return true; } if (ts.isPropertyDeclaration(declaration) && ts.getContainingClass(usage) === ts.getContainingClass(declaration)) { @@ -50008,7 +50482,7 @@ var ts; } } else { - var isDeclarationInstanceProperty = declaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(declaration); + var isDeclarationInstanceProperty = declaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(declaration); if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) { return true; } @@ -50031,19 +50505,19 @@ var ts; return "quit"; } switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return true; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // even when stopping at any property declaration, they need to come from the same class return stopAtAnyPropertyDeclaration && (ts.isPropertyDeclaration(declaration) && node.parent === declaration.parent || ts.isParameterPropertyDeclaration(declaration, declaration.parent) && node.parent === declaration.parent.parent) ? "quit" : true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: switch (node.parent.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 175 /* SyntaxKind.SetAccessor */: return true; default: return false; @@ -50083,18 +50557,18 @@ var ts; } function requiresScopeChangeWorker(node) { switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: // do not descend into these return false; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 299 /* SyntaxKind.PropertyAssignment */: return requiresScopeChangeWorker(node.name); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // static properties in classes introduce temporary variables if (ts.hasStaticModifier(node)) { return target < 99 /* ScriptTarget.ESNext */ || !useDefineForClassFields; @@ -50123,12 +50597,13 @@ var ts; * the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with * the given name can be found. * + * @param nameNotFoundMessage If defined, we will report errors found during resolve. * @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters. */ - function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions) { + function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions) { if (excludeGlobals === void 0) { excludeGlobals = false; } - if (getSpellingSuggstions === void 0) { getSpellingSuggstions = true; } - return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions, getSymbol); + if (getSpellingSuggestions === void 0) { getSpellingSuggestions = true; } + return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol); } function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) { var _a, _b, _c; @@ -50159,14 +50634,14 @@ var ts; // - parameters are only in the scope of function body // This restriction does not apply to JSDoc comment types because they are parented // at a higher level than type parameters would normally be - if (meaning & result.flags & 788968 /* SymbolFlags.Type */ && lastLocation.kind !== 320 /* SyntaxKind.JSDoc */) { + if (meaning & result.flags & 788968 /* SymbolFlags.Type */ && lastLocation.kind !== 323 /* SyntaxKind.JSDoc */) { useResult = result.flags & 262144 /* SymbolFlags.TypeParameter */ // type parameters are visible in parameter list, return type and type parameter list ? lastLocation === location.type || - lastLocation.kind === 164 /* SyntaxKind.Parameter */ || - lastLocation.kind === 340 /* SyntaxKind.JSDocParameterTag */ || - lastLocation.kind === 341 /* SyntaxKind.JSDocReturnTag */ || - lastLocation.kind === 163 /* SyntaxKind.TypeParameter */ + lastLocation.kind === 166 /* SyntaxKind.Parameter */ || + lastLocation.kind === 343 /* SyntaxKind.JSDocParameterTag */ || + lastLocation.kind === 344 /* SyntaxKind.JSDocReturnTag */ || + lastLocation.kind === 165 /* SyntaxKind.TypeParameter */ // local types not visible outside the function body : false; } @@ -50181,13 +50656,13 @@ var ts; // however it is detected separately when checking initializers of parameters // to make sure that they reference no variables declared after them. useResult = - lastLocation.kind === 164 /* SyntaxKind.Parameter */ || + lastLocation.kind === 166 /* SyntaxKind.Parameter */ || (lastLocation === location.type && !!ts.findAncestor(result.valueDeclaration, ts.isParameter)); } } } - else if (location.kind === 189 /* SyntaxKind.ConditionalType */) { + else if (location.kind === 191 /* SyntaxKind.ConditionalType */) { // A type parameter declared using 'infer T' in a conditional type is visible only in // the true branch of the conditional type. useResult = lastLocation === location.trueType; @@ -50202,14 +50677,14 @@ var ts; } withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation); switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var moduleExports = ((_a = getSymbolOfNode(location)) === null || _a === void 0 ? void 0 : _a.exports) || emptySymbols; - if (location.kind === 305 /* SyntaxKind.SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 16777216 /* NodeFlags.Ambient */ && !ts.isGlobalScopeAugmentation(location))) { + if (location.kind === 308 /* SyntaxKind.SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 16777216 /* NodeFlags.Ambient */ && !ts.isGlobalScopeAugmentation(location))) { // It's an external module. First see if the module has an export default and if the local // name of that export default matches. if (result = moduleExports.get("default" /* InternalSymbolName.Default */)) { @@ -50233,7 +50708,7 @@ var ts; var moduleExport = moduleExports.get(name); if (moduleExport && moduleExport.flags === 2097152 /* SymbolFlags.Alias */ && - (ts.getDeclarationOfKind(moduleExport, 275 /* SyntaxKind.ExportSpecifier */) || ts.getDeclarationOfKind(moduleExport, 274 /* SyntaxKind.NamespaceExport */))) { + (ts.getDeclarationOfKind(moduleExport, 278 /* SyntaxKind.ExportSpecifier */) || ts.getDeclarationOfKind(moduleExport, 277 /* SyntaxKind.NamespaceExport */))) { break; } } @@ -50247,12 +50722,12 @@ var ts; } } break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (result = lookup(((_c = getSymbolOfNode(location)) === null || _c === void 0 ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* SymbolFlags.EnumMember */)) { break loop; } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // TypeScript 1.0 spec (April 2014): 8.4.1 // Initializer expressions for instance member variables are evaluated in the scope // of the class constructor body but are not permitted to reference parameters or @@ -50270,9 +50745,9 @@ var ts; } } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // The below is used to lookup type parameters within a class or interface, as they are added to the class/interface locals // These can never be latebound, so the symbol's raw members are sufficient. `getMembersOfNode` cannot be used, as it would // trigger resolving late-bound names, which we may already be in the process of doing while we're here! @@ -50286,12 +50761,14 @@ var ts; // TypeScript 1.0 spec (April 2014): 3.4.1 // The scope of a type parameter extends over the entire declaration with which the type // parameter list is associated, with the exception of static member declarations in classes. - error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + if (nameNotFoundMessage) { + error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + } return undefined; } break loop; } - if (location.kind === 226 /* SyntaxKind.ClassExpression */ && meaning & 32 /* SymbolFlags.Class */) { + if (location.kind === 228 /* SyntaxKind.ClassExpression */ && meaning & 32 /* SymbolFlags.Class */) { var className = location.name; if (className && name === className.escapedText) { result = location.symbol; @@ -50299,7 +50776,7 @@ var ts; } } break; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // The type parameters of a class are not in scope in the base class expression. if (lastLocation === location.expression && location.parent.token === 94 /* SyntaxKind.ExtendsKeyword */) { var container = location.parent.parent; @@ -50319,34 +50796,36 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968 /* SymbolFlags.Type */)) { - error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + if (nameNotFoundMessage) { + error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + } return undefined; } } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // when targeting ES6 or higher there is no 'arguments' in an arrow function // for lower compile targets the resolved symbol is used to emit an error if (ts.getEmitScriptTarget(compilerOptions) >= 2 /* ScriptTarget.ES2015 */) { break; } // falls through - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (meaning & 3 /* SymbolFlags.Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (meaning & 3 /* SymbolFlags.Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -50359,7 +50838,7 @@ var ts; } } break; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -50368,7 +50847,7 @@ var ts; // method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter. // } // - if (location.parent && location.parent.kind === 164 /* SyntaxKind.Parameter */) { + if (location.parent && location.parent.kind === 166 /* SyntaxKind.Parameter */) { location = location.parent; } // @@ -50383,20 +50862,20 @@ var ts; // declare function y(x: T): any; // @param(1 as T) // <-- T should resolve to the type alias outside of class C // class C {} - if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 257 /* SyntaxKind.ClassDeclaration */)) { + if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 260 /* SyntaxKind.ClassDeclaration */)) { location = location.parent; } break; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: // js type aliases do not resolve names from their host, so skip past it var root = ts.getJSDocRoot(location); if (root) { location = root.parent; } break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts.isBindingPattern(lastLocation))) { if (!associatedDeclarationForContainingInitializerOrBindingName) { @@ -50404,7 +50883,7 @@ var ts; } } break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts.isBindingPattern(lastLocation))) { if (ts.isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) { @@ -50412,7 +50891,7 @@ var ts; } } break; - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: if (meaning & 262144 /* SymbolFlags.TypeParameter */) { var parameterName = location.typeParameter.name; if (parameterName && name === parameterName.escapedText) { @@ -50438,7 +50917,7 @@ var ts; } if (!result) { if (lastLocation) { - ts.Debug.assert(lastLocation.kind === 305 /* SyntaxKind.SourceFile */); + ts.Debug.assert(lastLocation.kind === 308 /* SyntaxKind.SourceFile */); if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) { return lastLocation.symbol; } @@ -50520,7 +50999,7 @@ var ts; } return undefined; } - else if (checkAndReportErrorForInvalidInitializer()) { + else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) { return undefined; } // Perform extra checks only if error reporting was requested @@ -50568,7 +51047,7 @@ var ts; if (result && errorLocation && meaning & 111551 /* SymbolFlags.Value */ && result.flags & 2097152 /* SymbolFlags.Alias */ && !(result.flags & 111551 /* SymbolFlags.Value */) && !ts.isValidTypeOnlyAliasUseSite(errorLocation)) { var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result); if (typeOnlyDeclaration) { - var message = typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */ + var message = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type; var unescapedName = ts.unescapeLeadingUnderscores(name); @@ -50582,31 +51061,31 @@ var ts; function addTypeOnlyDeclarationRelatedInfo(diagnostic, typeOnlyDeclaration, unescapedName) { if (!typeOnlyDeclaration) return diagnostic; - return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName)); + return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName)); } function getIsDeferredContext(location, lastLocation) { - if (location.kind !== 214 /* SyntaxKind.ArrowFunction */ && location.kind !== 213 /* SyntaxKind.FunctionExpression */) { + if (location.kind !== 216 /* SyntaxKind.ArrowFunction */ && location.kind !== 215 /* SyntaxKind.FunctionExpression */) { // initializers in instance property declaration of class like entities are executed in constructor and thus deferred return ts.isTypeQueryNode(location) || ((ts.isFunctionLikeDeclaration(location) || - (location.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred + (location.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred } if (lastLocation && lastLocation === location.name) { return false; } // generator functions and async functions are not inlined in control flow when immediately invoked - if (location.asteriskToken || ts.hasSyntacticModifier(location, 256 /* ModifierFlags.Async */)) { + if (location.asteriskToken || ts.hasSyntacticModifier(location, 512 /* ModifierFlags.Async */)) { return true; } return !ts.getImmediatelyInvokedFunctionExpression(location); } function isSelfReferenceLocation(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: // For `namespace N { N; }` + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // For `namespace N { N; }` return true; default: return false; @@ -50619,7 +51098,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - if (decl.kind === 163 /* SyntaxKind.TypeParameter */) { + if (decl.kind === 165 /* SyntaxKind.TypeParameter */) { var parent = ts.isJSDocTemplateTag(decl.parent) ? ts.getJSDocHost(decl.parent) : decl.parent; if (parent === container) { return !(ts.isJSDocTemplateTag(decl.parent) && ts.find(decl.parent.parent.tags, ts.isJSDocTypeAlias)); @@ -50676,9 +51155,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: if (ts.isEntityNameExpression(node.expression)) { return node.expression; } @@ -50722,7 +51201,7 @@ var ts; return name === "any" || name === "string" || name === "number" || name === "boolean" || name === "never" || name === "unknown"; } function checkAndReportErrorForExportingPrimitiveType(errorLocation, name) { - if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) { + if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) { error(errorLocation, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, name); return true; } @@ -50813,7 +51292,7 @@ var ts; return; } // Block-scoped variables cannot be used before their definition - var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 260 /* SyntaxKind.EnumDeclaration */); }); + var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 263 /* SyntaxKind.EnumDeclaration */); }); if (declaration === undefined) return ts.Debug.fail("checkResolvedBlockScopedVariable could not find block-scoped declaration"); if (!(declaration.flags & 16777216 /* NodeFlags.Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { @@ -50850,13 +51329,13 @@ var ts; } function getAnyImportSyntax(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return node.parent; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent; default: return undefined; @@ -50881,24 +51360,24 @@ var ts; * const { x } = require ... */ function isAliasSymbolDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || node.kind === 267 /* SyntaxKind.ImportClause */ && !!node.name - || node.kind === 268 /* SyntaxKind.NamespaceImport */ - || node.kind === 274 /* SyntaxKind.NamespaceExport */ - || node.kind === 270 /* SyntaxKind.ImportSpecifier */ - || node.kind === 275 /* SyntaxKind.ExportSpecifier */ - || node.kind === 271 /* SyntaxKind.ExportAssignment */ && ts.exportAssignmentIsAlias(node) + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || node.kind === 270 /* SyntaxKind.ImportClause */ && !!node.name + || node.kind === 271 /* SyntaxKind.NamespaceImport */ + || node.kind === 277 /* SyntaxKind.NamespaceExport */ + || node.kind === 273 /* SyntaxKind.ImportSpecifier */ + || node.kind === 278 /* SyntaxKind.ExportSpecifier */ + || node.kind === 274 /* SyntaxKind.ExportAssignment */ && ts.exportAssignmentIsAlias(node) || ts.isBinaryExpression(node) && ts.getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */ && ts.exportAssignmentIsAlias(node) || ts.isAccessExpression(node) && ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && isAliasableOrJsExpression(node.parent.right) - || node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || node.kind === 296 /* SyntaxKind.PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) - || node.kind === 254 /* SyntaxKind.VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) - || node.kind === 203 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); + || node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || node.kind === 299 /* SyntaxKind.PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) + || node.kind === 257 /* SyntaxKind.VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) + || node.kind === 205 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); } function isAliasableOrJsExpression(e) { return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e); @@ -50911,7 +51390,7 @@ var ts; ? resolveSymbol(getPropertyOfType(resolveExternalModuleTypeByLiteral(name), commonJSPropertyAccess.name.escapedText)) : undefined; } - if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { var immediate = resolveExternalModuleName(node, ts.getExternalModuleRequireArgument(node) || ts.getExternalModuleImportEqualsDeclarationExpression(node)); var resolved_4 = resolveExternalModuleSymbol(immediate); markSymbolOfAliasDeclarationIfTypeOnly(node, immediate, resolved_4, /*overwriteEmpty*/ false); @@ -50924,7 +51403,7 @@ var ts; function checkAndReportErrorForResolvingImportAliasToTypeOnlySymbol(node, resolved) { if (markSymbolOfAliasDeclarationIfTypeOnly(node, /*immediateTarget*/ undefined, resolved, /*overwriteEmpty*/ false) && !node.isTypeOnly) { var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(getSymbolOfNode(node)); - var isExport = typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */; + var isExport = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */; var message = isExport ? ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type : ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type; @@ -50943,7 +51422,7 @@ var ts; return resolved; } function isSyntacticDefault(node) { - return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) || ts.isExportSpecifier(node)); + return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) || ts.isExportSpecifier(node)); } function getUsageModeForExpression(usage) { return ts.isStringLiteralLike(usage) ? ts.getModeForUsageLocation(ts.getSourceFileOfNode(usage), usage) : undefined; @@ -51043,11 +51522,11 @@ var ts; } function getModuleSpecifierForImportOrExport(node) { switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; - case 268 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier; - case 270 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier; - case 275 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier; + case 270 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier; + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier; + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier; + case 278 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier; default: return ts.Debug.assertNever(node); } } @@ -51316,31 +51795,31 @@ var ts; function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { if (dontRecursivelyResolve === void 0) { dontRecursivelyResolve = false; } switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return getTargetOfImportClause(node, dontRecursivelyResolve); - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return getTargetOfNamespaceImport(node, dontRecursivelyResolve); - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: return getTargetOfNamespaceExport(node, dontRecursivelyResolve); - case 270 /* SyntaxKind.ImportSpecifier */: - case 203 /* SyntaxKind.BindingElement */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 205 /* SyntaxKind.BindingElement */: return getTargetOfImportSpecifier(node, dontRecursivelyResolve); - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return getTargetOfExportSpecifier(node, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, dontRecursivelyResolve); - case 271 /* SyntaxKind.ExportAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: + case 274 /* SyntaxKind.ExportAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: return getTargetOfExportAssignment(node, dontRecursivelyResolve); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return resolveEntityName(node.name, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ true, dontRecursivelyResolve); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getTargetOfAliasLikeExpression(node.initializer, dontRecursivelyResolve); - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return getTargetOfAccessExpression(node, dontRecursivelyResolve); default: return ts.Debug.fail(); @@ -51492,18 +51971,18 @@ var ts; entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 79 /* SyntaxKind.Identifier */ || entityName.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + if (entityName.kind === 79 /* SyntaxKind.Identifier */ || entityName.parent.kind === 163 /* SyntaxKind.QualifiedName */) { return resolveEntityName(entityName, 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */); return resolveEntityName(entityName, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } } function getFullyQualifiedName(symbol, containingLocation) { - return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, /*meaning*/ undefined, 16 /* SymbolFormatFlags.DoNotIncludeSymbolChain */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, /*meaning*/ undefined, 32 /* SymbolFormatFlags.DoNotIncludeSymbolChain */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); } function getContainingQualifiedNameNode(node) { while (ts.isQualifiedName(node.parent)) { @@ -51544,9 +52023,9 @@ var ts; return getMergedSymbol(symbolFromJSPrototype); } } - else if (name.kind === 161 /* SyntaxKind.QualifiedName */ || name.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { - var left = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.left : name.expression; - var right = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.right : name.name; + else if (name.kind === 163 /* SyntaxKind.QualifiedName */ || name.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { + var left = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.left : name.expression; + var right = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, namespaceMeaning, ignoreErrors, /*dontResolveAlias*/ false, location); if (!namespace || ts.nodeIsMissing(right)) { return undefined; @@ -51604,7 +52083,7 @@ var ts; throw ts.Debug.assertNever(name, "Unknown entity name kind."); } ts.Debug.assert((ts.getCheckFlags(symbol) & 1 /* CheckFlags.Instantiated */) === 0, "Should never get an instantiated symbol here."); - if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 /* SymbolFlags.Alias */ || name.parent.kind === 271 /* SyntaxKind.ExportAssignment */)) { + if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 /* SymbolFlags.Alias */ || name.parent.kind === 274 /* SyntaxKind.ExportAssignment */)) { markSymbolOfAliasDeclarationIfTypeOnly(ts.getAliasDeclarationFromName(name), symbol, /*finalTarget*/ undefined, /*overwriteEmpty*/ true); } return (symbol.flags & meaning) || dontResolveAlias ? symbol : resolveAlias(symbol); @@ -51754,7 +52233,7 @@ var ts; if (ext === ".ts" /* Extension.Ts */ || ext === ".js" /* Extension.Js */ || ext === ".tsx" /* Extension.Tsx */ || ext === ".jsx" /* Extension.Jsx */) { var scope = currentSourceFile.packageJsonScope; var targetExt = ext === ".ts" /* Extension.Ts */ ? ".mts" /* Extension.Mts */ : ext === ".js" /* Extension.Js */ ? ".mjs" /* Extension.Mjs */ : undefined; - if (scope && !scope.packageJsonContent.type) { + if (scope && !scope.contents.packageJsonContent.type) { if (targetExt) { diagnosticDetails = ts.chainDiagnosticMessages( /*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1, targetExt, ts.combinePaths(scope.packageDirectory, "package.json")); @@ -51927,7 +52406,7 @@ var ts; var _a; var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); if (!dontResolveAlias && symbol) { - if (!suppressInteropError && !(symbol.flags & (1536 /* SymbolFlags.Module */ | 3 /* SymbolFlags.Variable */)) && !ts.getDeclarationOfKind(symbol, 305 /* SyntaxKind.SourceFile */)) { + if (!suppressInteropError && !(symbol.flags & (1536 /* SymbolFlags.Module */ | 3 /* SymbolFlags.Variable */)) && !ts.getDeclarationOfKind(symbol, 308 /* SyntaxKind.SourceFile */)) { var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop"; @@ -52293,7 +52772,7 @@ var ts; var members = node.members; for (var _i = 0, members_3 = members; _i < members_3.length; _i++) { var member = members_3[_i]; - if (member.kind === 171 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 173 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } @@ -52401,12 +52880,12 @@ var ts; } } switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var sym = getSymbolOfNode(location); // `sym` may not have exports if this module declaration is backed by the symbol for a `const` that's being rewritten // into a namespace - in such cases, it's best to just let the namespace appear empty (the const members couldn't have referred @@ -52415,9 +52894,9 @@ var ts; return { value: result }; } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // Type parameters are bound into `members` lists so they can merge across declarations // This is troublesome, since in all other respects, they behave like locals :cries: // TODO: the below is shared with similar code in `resolveName` - in fact, rephrasing all this symbol @@ -52512,7 +52991,7 @@ var ts; && (isLocalNameLookup ? !ts.some(symbolFromSymbolTable.declarations, ts.isNamespaceReexportDeclaration) : true) // While exports are generally considered to be in scope, export-specifier declared symbols are _not_ // See similar comment in `resolveName` for details - && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 275 /* SyntaxKind.ExportSpecifier */))) { + && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */))) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); var candidate = getCandidateListForSymbol(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification); if (candidate) { @@ -52556,7 +53035,7 @@ var ts; return true; } // Qualify if the symbol from symbol table has same meaning as expected - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 275 /* SyntaxKind.ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -52571,10 +53050,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: continue; default: return false; @@ -52704,10 +53183,10 @@ var ts; return node && getSymbolOfNode(node); } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasNonGlobalAugmentationExternalModuleSymbol(declaration) { - return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -52775,14 +53254,14 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 181 /* SyntaxKind.TypeQuery */ || - entityName.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) || - entityName.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (entityName.parent.kind === 183 /* SyntaxKind.TypeQuery */ || + entityName.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) || + entityName.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // Typeof value meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } - else if (entityName.kind === 161 /* SyntaxKind.QualifiedName */ || entityName.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - entityName.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + else if (entityName.kind === 163 /* SyntaxKind.QualifiedName */ || entityName.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + entityName.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1920 /* SymbolFlags.Namespace */; @@ -52818,15 +53297,18 @@ var ts; if (flags & 8 /* SymbolFormatFlags.UseAliasDefinedOutsideCurrentScope */) { nodeFlags |= 16384 /* NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope */; } - if (flags & 16 /* SymbolFormatFlags.DoNotIncludeSymbolChain */) { + if (flags & 32 /* SymbolFormatFlags.DoNotIncludeSymbolChain */) { nodeFlags |= 134217728 /* NodeBuilderFlags.DoNotIncludeSymbolChain */; } - var builder = flags & 4 /* SymbolFormatFlags.AllowAnyNodeKind */ ? nodeBuilder.symbolToExpression : nodeBuilder.symbolToEntityName; + if (flags & 16 /* SymbolFormatFlags.WriteComputedProps */) { + nodeFlags |= 1073741824 /* NodeBuilderFlags.WriteComputedProps */; + } + var builder = flags & 4 /* SymbolFormatFlags.AllowAnyNodeKind */ ? nodeBuilder.symbolToNode : nodeBuilder.symbolToEntityName; return writer ? symbolToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(symbolToStringWorker); function symbolToStringWorker(writer) { var entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags); // TODO: GH#18217 // add neverAsciiEscape for GH#39027 - var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 305 /* SyntaxKind.SourceFile */ ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true }); + var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 308 /* SyntaxKind.SourceFile */ ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true }); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); printer.writeNode(4 /* EmitHint.Unspecified */, entity, /*sourceFile*/ sourceFile, writer); return writer; @@ -52838,10 +53320,10 @@ var ts; function signatureToStringWorker(writer) { var sigOutput; if (flags & 262144 /* TypeFormatFlags.WriteArrowStyleSignature */) { - sigOutput = kind === 1 /* SignatureKind.Construct */ ? 180 /* SyntaxKind.ConstructorType */ : 179 /* SyntaxKind.FunctionType */; + sigOutput = kind === 1 /* SignatureKind.Construct */ ? 182 /* SyntaxKind.ConstructorType */ : 181 /* SyntaxKind.FunctionType */; } else { - sigOutput = kind === 1 /* SignatureKind.Construct */ ? 175 /* SyntaxKind.ConstructSignature */ : 174 /* SyntaxKind.CallSignature */; + sigOutput = kind === 1 /* SignatureKind.Construct */ ? 177 /* SyntaxKind.ConstructSignature */ : 176 /* SyntaxKind.CallSignature */; } var sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */); var printer = ts.createPrinter({ removeComments: true, omitTrailingSemicolon: true }); @@ -52921,7 +53403,25 @@ var ts; symbolTableToDeclarationStatements: function (symbolTable, enclosingDeclaration, flags, tracker, bundled) { return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolTableToDeclarationStatements(symbolTable, context, bundled); }); }, + symbolToNode: function (symbol, meaning, enclosingDeclaration, flags, tracker) { + return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolToNode(symbol, context, meaning); }); + }, }; + function symbolToNode(symbol, context, meaning) { + if (context.flags & 1073741824 /* NodeBuilderFlags.WriteComputedProps */) { + if (symbol.valueDeclaration) { + var name = ts.getNameOfDeclaration(symbol.valueDeclaration); + if (name && ts.isComputedPropertyName(name)) + return name; + } + var nameType = getSymbolLinks(symbol).nameType; + if (nameType && nameType.flags & (1024 /* TypeFlags.EnumLiteral */ | 8192 /* TypeFlags.UniqueESSymbol */)) { + context.enclosingDeclaration = nameType.symbol.valueDeclaration; + return ts.factory.createComputedPropertyName(symbolToExpression(nameType.symbol, context, meaning)); + } + } + return symbolToExpression(symbol, context, meaning); + } function withContext(enclosingDeclaration, flags, tracker, cb) { var _a, _b; ts.Debug.assert(enclosingDeclaration === undefined || (enclosingDeclaration.flags & 8 /* NodeFlags.Synthesized */) === 0); @@ -53006,7 +53506,7 @@ var ts; return undefined; // TODO: GH#18217 } context.approximateLength += 3; - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } if (!(context.flags & 536870912 /* NodeBuilderFlags.NoTypeReduction */)) { type = getReducedType(type); @@ -53016,29 +53516,29 @@ var ts; return ts.factory.createTypeReferenceNode(symbolToEntityNameNode(type.aliasSymbol), mapToTypeNodes(type.aliasTypeArguments, context)); } if (type === unresolvedType) { - return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */), 3 /* SyntaxKind.MultiLineCommentTrivia */, "unresolved"); + return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */), 3 /* SyntaxKind.MultiLineCommentTrivia */, "unresolved"); } context.approximateLength += 3; - return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 138 /* SyntaxKind.IntrinsicKeyword */ : 130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 139 /* SyntaxKind.IntrinsicKeyword */ : 131 /* SyntaxKind.AnyKeyword */); } if (type.flags & 2 /* TypeFlags.Unknown */) { - return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */); + return ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */); } if (type.flags & 4 /* TypeFlags.String */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(150 /* SyntaxKind.StringKeyword */); + return ts.factory.createKeywordTypeNode(152 /* SyntaxKind.StringKeyword */); } if (type.flags & 8 /* TypeFlags.Number */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(147 /* SyntaxKind.NumberKeyword */); + return ts.factory.createKeywordTypeNode(148 /* SyntaxKind.NumberKeyword */); } if (type.flags & 64 /* TypeFlags.BigInt */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(158 /* SyntaxKind.BigIntKeyword */); + return ts.factory.createKeywordTypeNode(160 /* SyntaxKind.BigIntKeyword */); } if (type.flags & 16 /* TypeFlags.Boolean */ && !type.aliasSymbol) { context.approximateLength += 7; - return ts.factory.createKeywordTypeNode(133 /* SyntaxKind.BooleanKeyword */); + return ts.factory.createKeywordTypeNode(134 /* SyntaxKind.BooleanKeyword */); } if (type.flags & 1024 /* TypeFlags.EnumLiteral */ && !(type.flags & 1048576 /* TypeFlags.Union */)) { var parentSymbol = getParentOfSymbol(type.symbol); @@ -53092,7 +53592,7 @@ var ts; } } context.approximateLength += 13; - return ts.factory.createTypeOperatorNode(154 /* SyntaxKind.UniqueKeyword */, ts.factory.createKeywordTypeNode(151 /* SyntaxKind.SymbolKeyword */)); + return ts.factory.createTypeOperatorNode(156 /* SyntaxKind.UniqueKeyword */, ts.factory.createKeywordTypeNode(153 /* SyntaxKind.SymbolKeyword */)); } if (type.flags & 16384 /* TypeFlags.Void */) { context.approximateLength += 4; @@ -53100,7 +53600,7 @@ var ts; } if (type.flags & 32768 /* TypeFlags.Undefined */) { context.approximateLength += 9; - return ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */); + return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */); } if (type.flags & 65536 /* TypeFlags.Null */) { context.approximateLength += 4; @@ -53108,15 +53608,15 @@ var ts; } if (type.flags & 131072 /* TypeFlags.Never */) { context.approximateLength += 5; - return ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */); + return ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */); } if (type.flags & 4096 /* TypeFlags.ESSymbol */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(151 /* SyntaxKind.SymbolKeyword */); + return ts.factory.createKeywordTypeNode(153 /* SyntaxKind.SymbolKeyword */); } if (type.flags & 67108864 /* TypeFlags.NonPrimitive */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(148 /* SyntaxKind.ObjectKeyword */); + return ts.factory.createKeywordTypeNode(149 /* SyntaxKind.ObjectKeyword */); } if (ts.isThisTypeParameter(type)) { if (context.flags & 4194304 /* NodeBuilderFlags.InObjectTypeLiteral */) { @@ -53205,7 +53705,7 @@ var ts; var indexedType = type.type; context.approximateLength += 6; var indexTypeNode = typeToTypeNodeHelper(indexedType, context); - return ts.factory.createTypeOperatorNode(140 /* SyntaxKind.KeyOfKeyword */, indexTypeNode); + return ts.factory.createTypeOperatorNode(141 /* SyntaxKind.KeyOfKeyword */, indexTypeNode); } if (type.flags & 134217728 /* TypeFlags.TemplateLiteral */) { var texts_1 = type.texts; @@ -53257,7 +53757,7 @@ var ts; // On the other hand, // checkType extends infer T extends checkType ? T extends extendsType ? trueType : falseType : never; // may also work with `infer ... extends ...` in, but would produce declarations only compatible with the latest TS. - return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)), ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)); + return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)), ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)); } var saveInferTypeParameters = context.inferTypeParameters; context.inferTypeParameters = type.root.inferTypeParameters; @@ -53299,7 +53799,7 @@ var ts; var name = typeParameterToName(newParam, context); newTypeVariable = ts.factory.createTypeReferenceNode(name); } - appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(140 /* SyntaxKind.KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)); + appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(141 /* SyntaxKind.KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)); } else { appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type), context); @@ -53315,7 +53815,7 @@ var ts; // wrap it with a conditional like `SomeModifiersType extends infer U ? {..the mapped type...} : never` to ensure the resulting // type stays homomorphic var originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode(type.declaration.typeParameter.constraint.type)) || unknownType, type.mapper); - return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 /* TypeFlags.Unknown */ ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)); + return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 /* TypeFlags.Unknown */ ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)); } return result; } @@ -53363,7 +53863,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* SymbolFlags.Function */) && (symbol.parent || // is exported function symbol ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 305 /* SyntaxKind.SourceFile */ || declaration.parent.kind === 262 /* SyntaxKind.ModuleBlock */; + return declaration.parent.kind === 308 /* SyntaxKind.SourceFile */ || declaration.parent.kind === 265 /* SyntaxKind.ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -53452,12 +53952,12 @@ var ts; } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { var signature = resolved.callSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 179 /* SyntaxKind.FunctionType */, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 181 /* SyntaxKind.FunctionType */, context); return signatureNode; } if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { var signature = resolved.constructSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 180 /* SyntaxKind.ConstructorType */, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 182 /* SyntaxKind.ConstructorType */, context); return signatureNode; } } @@ -53500,7 +54000,7 @@ var ts; } var elementType = typeToTypeNodeHelper(typeArguments[0], context); var arrayType = ts.factory.createArrayTypeNode(elementType); - return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, arrayType); + return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, arrayType); } else if (type.target.objectFlags & 8 /* ObjectFlags.Tuple */) { typeArguments = ts.sameMap(typeArguments, function (t, i) { return removeMissingType(t, !!(type.target.elementFlags[i] & 2 /* ElementFlags.Optional */)); }); @@ -53525,12 +54025,12 @@ var ts; } } var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode(tupleConstituentNodes), 1 /* EmitFlags.SingleLine */); - return type.target.readonly ? ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; } } if (context.encounteredError || (context.flags & 524288 /* NodeBuilderFlags.AllowEmptyTuple */)) { var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode([]), 1 /* EmitFlags.SingleLine */); - return type.target.readonly ? ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; } context.encounteredError = true; return undefined; // TODO: GH#18217 @@ -53637,13 +54137,13 @@ var ts; var typeElements = []; for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 174 /* SyntaxKind.CallSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 176 /* SyntaxKind.CallSignature */, context)); } for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; if (signature.flags & 4 /* SignatureFlags.Abstract */) continue; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 175 /* SyntaxKind.ConstructSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 177 /* SyntaxKind.ConstructSignature */, context)); } for (var _d = 0, _e = resolvedType.indexInfos; _d < _e.length; _d++) { var info = _e[_d]; @@ -53680,7 +54180,7 @@ var ts; if (!(context.flags & 1 /* NodeBuilderFlags.NoTruncation */)) { return ts.factory.createTypeReferenceNode(ts.factory.createIdentifier("..."), /*typeArguments*/ undefined); } - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } function shouldUsePlaceholderForProperty(propertySymbol, context) { var _a; @@ -53730,7 +54230,7 @@ var ts; var signatures = getSignaturesOfType(filterType(propertyType, function (t) { return !(t.flags & 32768 /* TypeFlags.Undefined */); }), 0 /* SignatureKind.Call */); for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) { var signature = signatures_1[_i]; - var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 168 /* SyntaxKind.MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); + var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 170 /* SyntaxKind.MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); typeElements.push(preserveCommentsOn(methodDeclaration)); } } @@ -53744,12 +54244,12 @@ var ts; context.reverseMappedStack || (context.reverseMappedStack = []); context.reverseMappedStack.push(propertySymbol); } - propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); if (propertyIsReverseMapped) { context.reverseMappedStack.pop(); } } - var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(145 /* SyntaxKind.ReadonlyKeyword */)] : undefined; + var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(146 /* SyntaxKind.ReadonlyKeyword */)] : undefined; if (modifiers) { context.approximateLength += 9; } @@ -53758,8 +54258,8 @@ var ts; } function preserveCommentsOn(node) { var _a; - if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 347 /* SyntaxKind.JSDocPropertyTag */; })) { - var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 347 /* SyntaxKind.JSDocPropertyTag */; }); + if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 350 /* SyntaxKind.JSDocPropertyTag */; })) { + var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 350 /* SyntaxKind.JSDocPropertyTag */; }); var commentText = ts.getTextOfJSDocComment(d.comment); if (commentText) { ts.setSyntheticLeadingComments(node, [{ kind: 3 /* SyntaxKind.MultiLineCommentTrivia */, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]); @@ -53858,7 +54358,7 @@ var ts; context.encounteredError = true; } context.approximateLength += (name.length + 4); - return ts.factory.createIndexSignature(indexInfo.isReadonly ? [ts.factory.createToken(145 /* SyntaxKind.ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); + return ts.factory.createIndexSignature(indexInfo.isReadonly ? [ts.factory.createToken(146 /* SyntaxKind.ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); } function signatureToSignatureDeclarationHelper(signature, kind, context, options) { var _a, _b, _c, _d; @@ -53876,7 +54376,7 @@ var ts; } var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0]; // If the expanded parameter list had a variadic in a non-trailing position, don't expand it - var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* CheckFlags.RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 171 /* SyntaxKind.Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); + var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* CheckFlags.RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 173 /* SyntaxKind.Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); var thisParameter = context.flags & 33554432 /* NodeBuilderFlags.OmitThisParameter */ ? undefined : tryGetThisParameterDeclaration(signature, context); if (thisParameter) { parameters.unshift(thisParameter); @@ -53885,7 +54385,7 @@ var ts; var typePredicate = getTypePredicateOfSignature(signature); if (typePredicate) { var assertsModifier = typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? - ts.factory.createToken(128 /* SyntaxKind.AssertsKeyword */) : + ts.factory.createToken(129 /* SyntaxKind.AssertsKeyword */) : undefined; var parameterName = typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.setEmitFlags(ts.factory.createIdentifier(typePredicate.parameterName), 16777216 /* EmitFlags.NoAsciiEscaping */) : @@ -53899,28 +54399,28 @@ var ts; returnTypeNode = serializeReturnTypeForSignature(context, returnType, signature, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); } else if (!suppressAny) { - returnTypeNode = ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + returnTypeNode = ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } } var modifiers = options === null || options === void 0 ? void 0 : options.modifiers; - if ((kind === 180 /* SyntaxKind.ConstructorType */) && signature.flags & 4 /* SignatureFlags.Abstract */) { + if ((kind === 182 /* SyntaxKind.ConstructorType */) && signature.flags & 4 /* SignatureFlags.Abstract */) { var flags = ts.modifiersToFlags(modifiers); - modifiers = ts.factory.createModifiersFromModifierFlags(flags | 128 /* ModifierFlags.Abstract */); + modifiers = ts.factory.createModifiersFromModifierFlags(flags | 256 /* ModifierFlags.Abstract */); } - var node = kind === 174 /* SyntaxKind.CallSignature */ ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : - kind === 175 /* SyntaxKind.ConstructSignature */ ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : - kind === 168 /* SyntaxKind.MethodSignature */ ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : - kind === 169 /* SyntaxKind.MethodDeclaration */ ? ts.factory.createMethodDeclaration(modifiers, /*asteriskToken*/ undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), /*questionToken*/ undefined, typeParameters, parameters, returnTypeNode, /*body*/ undefined) : - kind === 171 /* SyntaxKind.Constructor */ ? ts.factory.createConstructorDeclaration(modifiers, parameters, /*body*/ undefined) : - kind === 172 /* SyntaxKind.GetAccessor */ ? ts.factory.createGetAccessorDeclaration(modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, /*body*/ undefined) : - kind === 173 /* SyntaxKind.SetAccessor */ ? ts.factory.createSetAccessorDeclaration(modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, /*body*/ undefined) : - kind === 176 /* SyntaxKind.IndexSignature */ ? ts.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : - kind === 317 /* SyntaxKind.JSDocFunctionType */ ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : - kind === 179 /* SyntaxKind.FunctionType */ ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : - kind === 180 /* SyntaxKind.ConstructorType */ ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : - kind === 256 /* SyntaxKind.FunctionDeclaration */ ? ts.factory.createFunctionDeclaration(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, /*body*/ undefined) : - kind === 213 /* SyntaxKind.FunctionExpression */ ? ts.factory.createFunctionExpression(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) : - kind === 214 /* SyntaxKind.ArrowFunction */ ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, /*equalsGreaterThanToken*/ undefined, ts.factory.createBlock([])) : + var node = kind === 176 /* SyntaxKind.CallSignature */ ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : + kind === 177 /* SyntaxKind.ConstructSignature */ ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : + kind === 170 /* SyntaxKind.MethodSignature */ ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : + kind === 171 /* SyntaxKind.MethodDeclaration */ ? ts.factory.createMethodDeclaration(modifiers, /*asteriskToken*/ undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), /*questionToken*/ undefined, typeParameters, parameters, returnTypeNode, /*body*/ undefined) : + kind === 173 /* SyntaxKind.Constructor */ ? ts.factory.createConstructorDeclaration(modifiers, parameters, /*body*/ undefined) : + kind === 174 /* SyntaxKind.GetAccessor */ ? ts.factory.createGetAccessorDeclaration(modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, /*body*/ undefined) : + kind === 175 /* SyntaxKind.SetAccessor */ ? ts.factory.createSetAccessorDeclaration(modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, /*body*/ undefined) : + kind === 178 /* SyntaxKind.IndexSignature */ ? ts.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : + kind === 320 /* SyntaxKind.JSDocFunctionType */ ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : + kind === 181 /* SyntaxKind.FunctionType */ ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : + kind === 182 /* SyntaxKind.ConstructorType */ ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : + kind === 259 /* SyntaxKind.FunctionDeclaration */ ? ts.factory.createFunctionDeclaration(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, /*body*/ undefined) : + kind === 215 /* SyntaxKind.FunctionExpression */ ? ts.factory.createFunctionExpression(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) : + kind === 216 /* SyntaxKind.ArrowFunction */ ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, /*equalsGreaterThanToken*/ undefined, ts.factory.createBlock([])) : ts.Debug.assertNever(kind); if (typeArguments) { node.typeArguments = ts.factory.createNodeArray(typeArguments); @@ -53957,9 +54457,9 @@ var ts; return typeParameterToDeclarationWithConstraint(type, context, constraintNode); } function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) { - var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 164 /* SyntaxKind.Parameter */); + var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 166 /* SyntaxKind.Parameter */); if (!parameterDeclaration && !ts.isTransientSymbol(parameterSymbol)) { - parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 340 /* SyntaxKind.JSDocParameterTag */); + parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 343 /* SyntaxKind.JSDocParameterTag */); } var parameterType = getTypeOfSymbol(parameterSymbol); if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) { @@ -53971,7 +54471,7 @@ var ts; var dotDotDotToken = isRest ? ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */) : undefined; var name = parameterDeclaration ? parameterDeclaration.name ? parameterDeclaration.name.kind === 79 /* SyntaxKind.Identifier */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name), 16777216 /* EmitFlags.NoAsciiEscaping */) : - parameterDeclaration.name.kind === 161 /* SyntaxKind.QualifiedName */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216 /* EmitFlags.NoAsciiEscaping */) : + parameterDeclaration.name.kind === 163 /* SyntaxKind.QualifiedName */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216 /* EmitFlags.NoAsciiEscaping */) : cloneBindingName(parameterDeclaration.name) : ts.symbolName(parameterSymbol) : ts.symbolName(parameterSymbol); @@ -53982,22 +54482,15 @@ var ts; context.approximateLength += ts.symbolName(parameterSymbol).length + 3; return parameterNode; function cloneBindingName(node) { - return elideInitializerAndPropertyRenamingAndSetEmitFlags(node); - function elideInitializerAndPropertyRenamingAndSetEmitFlags(node) { + return elideInitializerAndSetEmitFlags(node); + function elideInitializerAndSetEmitFlags(node) { if (context.tracker.trackSymbol && ts.isComputedPropertyName(node) && isLateBindableName(node)) { trackComputedName(node.expression, context.enclosingDeclaration, context); } - var visited = ts.visitEachChild(node, elideInitializerAndPropertyRenamingAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndPropertyRenamingAndSetEmitFlags); + var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndSetEmitFlags); if (ts.isBindingElement(visited)) { - if (visited.propertyName && ts.isIdentifier(visited.propertyName) && ts.isIdentifier(visited.name)) { - visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, - /* propertyName*/ undefined, visited.propertyName, - /*initializer*/ undefined); - } - else { - visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name, - /*initializer*/ undefined); - } + visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name, + /*initializer*/ undefined); } if (!ts.nodeIsSynthesized(visited)) { visited = ts.factory.cloneNode(visited); @@ -54142,11 +54635,11 @@ var ts; } function getSpecifierForModuleSymbol(symbol, context, overrideImportMode) { var _a; - var file = ts.getDeclarationOfKind(symbol, 305 /* SyntaxKind.SourceFile */); + var file = ts.getDeclarationOfKind(symbol, 308 /* SyntaxKind.SourceFile */); if (!file) { var equivalentFileSymbol = ts.firstDefined(symbol.declarations, function (d) { return getFileSymbolIfFileSymbolExportEqualsContainer(d, symbol); }); if (equivalentFileSymbol) { - file = ts.getDeclarationOfKind(equivalentFileSymbol, 305 /* SyntaxKind.SourceFile */); + file = ts.getDeclarationOfKind(equivalentFileSymbol, 308 /* SyntaxKind.SourceFile */); } } if (file && file.moduleName !== undefined) { @@ -54614,17 +55107,17 @@ var ts; return transformed === existing ? ts.setTextRange(ts.factory.cloneNode(existing), existing) : transformed; function visitExistingNodeTreeSymbols(node) { // We don't _actually_ support jsdoc namepath types, emit `any` instead - if (ts.isJSDocAllType(node) || node.kind === 319 /* SyntaxKind.JSDocNamepathType */) { - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + if (ts.isJSDocAllType(node) || node.kind === 322 /* SyntaxKind.JSDocNamepathType */) { + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } if (ts.isJSDocUnknownType(node)) { - return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */); + return ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */); } if (ts.isJSDocNullableType(node)) { return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createLiteralTypeNode(ts.factory.createNull())]); } if (ts.isJSDocOptionalType(node)) { - return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)]); + return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)]); } if (ts.isJSDocNonNullableType(node)) { return ts.visitNode(node.type, visitExistingNodeTreeSymbols); @@ -54638,11 +55131,11 @@ var ts; var typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode(node), name.escapedText); var overrideTypeNode = typeViaParent && t.typeExpression && getTypeFromTypeNode(t.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : undefined; return ts.factory.createPropertySignature( - /*modifiers*/ undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*modifiers*/ undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); })); } if (ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "") { - return ts.setOriginalNode(ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */), node); + return ts.setOriginalNode(ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */), node); } if ((ts.isExpressionWithTypeArguments(node) || ts.isTypeReferenceNode(node)) && ts.isJSDocIndexSignature(node)) { return ts.factory.createTypeLiteralNode([ts.factory.createIndexSignature( @@ -54657,12 +55150,12 @@ var ts; return ts.factory.createConstructorTypeNode( /*modifiers*/ undefined, ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.mapDefined(node.parameters, function (p, i) { return p.name && ts.isIdentifier(p.name) && p.name.escapedText === "new" ? (newTypeNode_1 = p.type, undefined) : ts.factory.createParameterDeclaration( /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), - /*initializer*/ undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*initializer*/ undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } else { return ts.factory.createFunctionTypeNode(ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.map(node.parameters, function (p, i) { return ts.factory.createParameterDeclaration( /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), - /*initializer*/ undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*initializer*/ undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } } if (ts.isTypeReferenceNode(node) && ts.isInJSDoc(node) && (!existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(node, getTypeFromTypeNode(node)) || getIntendedTypeFromJSDocTypeReference(node) || unknownSymbol === resolveTypeReferenceName(node, 788968 /* SymbolFlags.Type */, /*ignoreErrors*/ true))) { @@ -54730,8 +55223,8 @@ var ts; } } function symbolTableToDeclarationStatements(symbolTable, context, bundled) { - var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 169 /* SyntaxKind.MethodDeclaration */, /*useAcessors*/ true); - var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 168 /* SyntaxKind.MethodSignature */, /*useAcessors*/ false); + var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 171 /* SyntaxKind.MethodDeclaration */, /*useAcessors*/ true); + var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 170 /* SyntaxKind.MethodSignature */, /*useAcessors*/ false); // TODO: Use `setOriginalNode` on original declaration names where possible so these declarations see some kind of // declaration mapping // We save the enclosing declaration off here so it's not adjusted by well-meaning declaration @@ -54969,7 +55462,7 @@ var ts; if (needsPostExportDefault || needsExportDeclaration) { isPrivate = true; } - var modifierFlags = (!isPrivate ? 1 /* ModifierFlags.Export */ : 0) | (isDefault && !needsPostExportDefault ? 512 /* ModifierFlags.Default */ : 0); + var modifierFlags = (!isPrivate ? 1 /* ModifierFlags.Export */ : 0) | (isDefault && !needsPostExportDefault ? 1024 /* ModifierFlags.Default */ : 0); var isConstMergedWithNS = symbol.flags & 1536 /* SymbolFlags.Module */ && symbol.flags & (2 /* SymbolFlags.BlockScopedVariable */ | 1 /* SymbolFlags.FunctionScopedVariable */ | 4 /* SymbolFlags.Property */) && symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */; @@ -55153,8 +55646,8 @@ var ts; // Classes, namespaces, variables, enums, and functions all need `declare` modifiers to be valid in a declaration file top-level scope newModifierFlags |= 2 /* ModifierFlags.Ambient */; } - if ((additionalModifierFlags & 512 /* ModifierFlags.Default */) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) { - newModifierFlags |= 512 /* ModifierFlags.Default */; + if ((additionalModifierFlags & 1024 /* ModifierFlags.Default */) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) { + newModifierFlags |= 1024 /* ModifierFlags.Default */; } if (newModifierFlags) { node = ts.factory.updateModifiers(node, newModifierFlags | ts.getEffectiveModifierFlags(node)); @@ -55188,8 +55681,8 @@ var ts; var baseTypes = getBaseTypes(interfaceType); var baseType = ts.length(baseTypes) ? getIntersectionType(baseTypes) : undefined; var members = ts.flatMap(getPropertiesOfType(interfaceType), function (p) { return serializePropertySymbolForInterface(p, baseType); }); - var callSignatures = serializeSignatures(0 /* SignatureKind.Call */, interfaceType, baseType, 174 /* SyntaxKind.CallSignature */); - var constructSignatures = serializeSignatures(1 /* SignatureKind.Construct */, interfaceType, baseType, 175 /* SyntaxKind.ConstructSignature */); + var callSignatures = serializeSignatures(0 /* SignatureKind.Call */, interfaceType, baseType, 176 /* SyntaxKind.CallSignature */); + var constructSignatures = serializeSignatures(1 /* SignatureKind.Construct */, interfaceType, baseType, 177 /* SyntaxKind.ConstructSignature */); var indexSignatures = serializeIndexSignatures(interfaceType, baseType); var heritageClauses = !ts.length(baseTypes) ? undefined : [ts.factory.createHeritageClause(94 /* SyntaxKind.ExtendsKeyword */, ts.mapDefined(baseTypes, function (b) { return trySerializeAsTypeReference(b, 111551 /* SymbolFlags.Value */); }))]; addResult(ts.factory.createInterfaceDeclaration( @@ -55254,7 +55747,7 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var sig = signatures_2[_i]; // Each overload becomes a separate function declaration, in order - var decl = signatureToSignatureDeclarationHelper(sig, 256 /* SyntaxKind.FunctionDeclaration */, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); + var decl = signatureToSignatureDeclarationHelper(sig, 259 /* SyntaxKind.FunctionDeclaration */, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); addResult(ts.setTextRange(decl, getSignatureTextRangeLocation(sig)), modifierFlags); } // Module symbol emit will take care of module-y members, provided it has exports @@ -55412,7 +55905,7 @@ var ts; !ts.some(getSignaturesOfType(staticType, 1 /* SignatureKind.Construct */)); var constructors = isNonConstructableClassLikeInJsFile ? [ts.factory.createConstructorDeclaration(ts.factory.createModifiersFromModifierFlags(8 /* ModifierFlags.Private */), [], /*body*/ undefined)] : - serializeSignatures(1 /* SignatureKind.Construct */, staticType, staticBaseType, 171 /* SyntaxKind.Constructor */); + serializeSignatures(1 /* SignatureKind.Construct */, staticType, staticBaseType, 173 /* SyntaxKind.Constructor */); var indexSignatures = serializeIndexSignatures(classType, baseTypes[0]); context.enclosingDeclaration = oldEnclosing; addResult(ts.setTextRange(ts.factory.createClassDeclaration( @@ -55461,8 +55954,8 @@ var ts; var targetName = getInternalSymbolName(target, verbatimTargetName); includePrivateSymbol(target); // the target may be within the same scope - attempt to serialize it first switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 254 /* SyntaxKind.VariableDeclaration */) { + case 205 /* SyntaxKind.BindingElement */: + if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 257 /* SyntaxKind.VariableDeclaration */) { // const { SomeClass } = require('./lib'); var specifier_1 = getSpecifierForModuleSymbol(target.parent || target, context); // './lib' var propertyName = node.propertyName; @@ -55475,13 +55968,13 @@ var ts; // We don't know how to serialize this (nested?) binding element ts.Debug.failBadSyntaxKind(((_c = node.parent) === null || _c === void 0 ? void 0 : _c.parent) || node, "Unhandled binding element grandparent kind in declaration serialization"); break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 221 /* SyntaxKind.BinaryExpression */) { + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 223 /* SyntaxKind.BinaryExpression */) { // module.exports = { SomeClass } serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), targetName); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: // commonjs require: const x = require('y') if (ts.isPropertyAccessExpression(node.initializer)) { // const x = require('y').z @@ -55499,7 +55992,7 @@ var ts; break; } // else fall through and treat commonjs require just like import= - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // This _specifically_ only exists to handle json declarations - where we make aliases, but since // we emit no declarations for the json document, must not refer to it in the declarations if (target.escapedName === "export=" /* InternalSymbolName.ExportEquals */ && ts.some(target.declarations, ts.isJsonSourceFile)) { @@ -55515,13 +56008,13 @@ var ts; ? symbolToName(target, context, 67108863 /* SymbolFlags.All */, /*expectsIdentifier*/ false) : ts.factory.createExternalModuleReference(ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)))), isLocalImport ? modifierFlags : 0 /* ModifierFlags.None */); break; - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: // export as namespace foo // TODO: Not part of a file's local or export symbol tables // Is bound into file.symbol.globalExports instead, which we don't currently traverse addResult(ts.factory.createNamespaceExportDeclaration(ts.idText(node.name)), 0 /* ModifierFlags.None */); break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, ts.factory.createIdentifier(localName), /*namedBindings*/ undefined), // We use `target.parent || target` below as `target.parent` is unset when the target is a module which has been export assigned @@ -55530,17 +56023,17 @@ var ts; ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, /*importClause*/ undefined, ts.factory.createNamespaceImport(ts.factory.createIdentifier(localName))), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: addResult(ts.factory.createExportDeclaration( /*modifiers*/ undefined, /*isTypeOnly*/ false, ts.factory.createNamespaceExport(ts.factory.createIdentifier(localName)), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context))), 0 /* ModifierFlags.None */); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause( /*isTypeOnly*/ false, @@ -55550,7 +56043,7 @@ var ts; ])), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: // does not use localName because the symbol name in this case refers to the name in the exports table, // which we must exactly preserve var specifier = node.parent.parent.moduleSpecifier; @@ -55558,12 +56051,12 @@ var ts; // another file serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), specifier ? verbatimTargetName : targetName, specifier && ts.isStringLiteralLike(specifier) ? ts.factory.createStringLiteral(specifier.text) : undefined); break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: serializeMaybeAliasAssignment(symbol); break; - case 221 /* SyntaxKind.BinaryExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // Could be best encoded as though an export specifier or as though an export assignment // If name is default or export=, do an export assignment // Otherwise do an export specifier @@ -55707,7 +56200,7 @@ var ts; && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName)))) { return []; } - var flag = (modifierFlags & ~256 /* ModifierFlags.Async */) | (isStatic ? 32 /* ModifierFlags.Static */ : 0); + var flag = (modifierFlags & ~512 /* ModifierFlags.Async */) | (isStatic ? 32 /* ModifierFlags.Static */ : 0); var name = getPropertyNameNodeForSymbol(p, context); var firstPropertyLikeDecl = (_a = p.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.or(ts.isPropertyDeclaration, ts.isAccessor, ts.isVariableDeclaration, ts.isPropertySignature, ts.isBinaryExpression, ts.isPropertyAccessExpression)); if (p.flags & 98304 /* SymbolFlags.Accessor */ && useAccessors) { @@ -55729,7 +56222,7 @@ var ts; // This is an else/if as accessors and properties can't merge in TS, but might in JS // If this happens, we assume the accessor takes priority, as it imposes more constraints else if (p.flags & (4 /* SymbolFlags.Property */ | 3 /* SymbolFlags.Variable */ | 98304 /* SymbolFlags.Accessor */)) { - return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* ModifierFlags.Readonly */ : 0) | flag), name, p.flags & 16777216 /* SymbolFlags.Optional */ ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), + return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* ModifierFlags.Readonly */ : 0) | flag), name, p.flags & 16777216 /* SymbolFlags.Optional */ ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), // TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357 // interface members can't have initializers, however class members _can_ /*initializer*/ undefined), ((_d = p.declarations) === null || _d === void 0 ? void 0 : _d.find(ts.or(ts.isPropertyDeclaration, ts.isVariableDeclaration))) || firstPropertyLikeDecl); @@ -55919,7 +56412,7 @@ var ts; if (flags === void 0) { flags = 16384 /* TypeFormatFlags.UseAliasDefinedOutsideCurrentScope */; } return writer ? typePredicateToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(typePredicateToStringWorker); function typePredicateToStringWorker(writer) { - var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createToken(128 /* SyntaxKind.AssertsKeyword */) : undefined, typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */) // TODO: GH#18217 + var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createToken(129 /* SyntaxKind.AssertsKeyword */) : undefined, typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */) // TODO: GH#18217 ); var printer = ts.createPrinter({ removeComments: true }); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); @@ -55966,7 +56459,7 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* SymbolFlags.TypeLiteral */ && type.symbol.declarations) { var node = ts.walkUpParenthesizedTypes(type.symbol.declarations[0].parent); - if (node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + if (node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -55974,11 +56467,11 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && + node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isExternalModuleAugmentation(node.parent.parent); } function isDefaultBindingContext(location) { - return location.kind === 305 /* SyntaxKind.SourceFile */ || ts.isAmbientModule(location); + return location.kind === 308 /* SyntaxKind.SourceFile */ || ts.isAmbientModule(location); } function getNameOfSymbolFromNameType(symbol, context) { var nameType = getSymbolLinks(symbol).nameType; @@ -56037,17 +56530,17 @@ var ts; if (!declaration) { declaration = symbol.declarations[0]; // Declaration may be nameless, but we'll try anyway } - if (declaration.parent && declaration.parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (declaration.parent && declaration.parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { return ts.declarationNameToString(declaration.parent.name); } switch (declaration.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (context && !context.encounteredError && !(context.flags & 131072 /* NodeBuilderFlags.AllowAnonymousIdentifier */)) { context.encounteredError = true; } - return declaration.kind === 226 /* SyntaxKind.ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; + return declaration.kind === 228 /* SyntaxKind.ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; } } var name = getNameOfSymbolFromNameType(symbol, context); @@ -56064,28 +56557,28 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: // Top-level jsdoc type aliases are considered exported // First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent)); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return isDeclarationVisible(node.parent.parent); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { // If the binding pattern is empty, this variable declaration is not visible return false; } // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // external module augmentation is always visible if (ts.isExternalModuleAugmentation(node)) { return true; @@ -56093,55 +56586,55 @@ var ts; var parent = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedModifierFlags(node) & 1 /* ModifierFlags.Export */) && - !(node.kind !== 265 /* SyntaxKind.ImportEqualsDeclaration */ && parent.kind !== 305 /* SyntaxKind.SourceFile */ && parent.flags & 16777216 /* NodeFlags.Ambient */)) { + !(node.kind !== 268 /* SyntaxKind.ImportEqualsDeclaration */ && parent.kind !== 308 /* SyntaxKind.SourceFile */ && parent.flags & 16777216 /* NodeFlags.Ambient */)) { return isGlobalSourceFile(parent); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible return isDeclarationVisible(parent); - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.hasEffectiveModifier(node, 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */)) { // Private/protected properties/methods are not visible return false; } // Public properties/methods are visible if its parents are visible, so: // falls through - case 171 /* SyntaxKind.Constructor */: - case 175 /* SyntaxKind.ConstructSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 164 /* SyntaxKind.Parameter */: - case 262 /* SyntaxKind.ModuleBlock */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 178 /* SyntaxKind.TypeReference */: - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 173 /* SyntaxKind.Constructor */: + case 177 /* SyntaxKind.ConstructSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 166 /* SyntaxKind.Parameter */: + case 265 /* SyntaxKind.ModuleBlock */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 180 /* SyntaxKind.TypeReference */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: return false; // Type parameters are always visible - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: // Source file and namespace export are always visible // falls through - case 305 /* SyntaxKind.SourceFile */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return true; // Export assignments do not create name bindings outside the module - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return false; default: return false; @@ -56150,10 +56643,10 @@ var ts; } function collectLinkedAliases(node, setVisibility) { var exportSymbol; - if (node.parent && node.parent.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (node.parent && node.parent.kind === 274 /* SyntaxKind.ExportAssignment */) { exportSymbol = resolveName(node, node.escapedText, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false); } - else if (node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) { + else if (node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) { exportSymbol = getTargetOfExportSpecifier(node.parent, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */); } var result; @@ -56260,12 +56753,12 @@ var ts; function getDeclarationContainer(node) { return ts.findAncestor(ts.getRootDeclaration(node), function (node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 255 /* SyntaxKind.VariableDeclarationList */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 269 /* SyntaxKind.NamedImports */: - case 268 /* SyntaxKind.NamespaceImport */: - case 267 /* SyntaxKind.ImportClause */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 258 /* SyntaxKind.VariableDeclarationList */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 272 /* SyntaxKind.NamedImports */: + case 271 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: return false; default: return true; @@ -56395,23 +56888,23 @@ var ts; function getParentElementAccess(node) { var ancestor = node.parent.parent; switch (ancestor.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: return getSyntheticElementAccess(ancestor); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getSyntheticElementAccess(node.parent); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ancestor.initializer; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return ancestor.right; } } function getDestructuringPropertyName(node) { var parent = node.parent; - if (node.kind === 203 /* SyntaxKind.BindingElement */ && parent.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (node.kind === 205 /* SyntaxKind.BindingElement */ && parent.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { return getLiteralPropertyNameText(node.propertyName || node.name); } - if (node.kind === 296 /* SyntaxKind.PropertyAssignment */ || node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.kind === 299 /* SyntaxKind.PropertyAssignment */ || node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return getLiteralPropertyNameText(node.name); } return "" + parent.elements.indexOf(node); @@ -56441,7 +56934,7 @@ var ts; parentType = getTypeWithFacts(parentType, 524288 /* TypeFacts.NEUndefined */); } var type; - if (pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (declaration.dotDotDotToken) { parentType = getReducedType(parentType); if (parentType.flags & 2 /* TypeFlags.Unknown */ || !isValidSpreadType(parentType)) { @@ -56512,7 +57005,7 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node, /*excludeJSDocTypeAssertions*/ true); - return expr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && expr.elements.length === 0; + return expr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && expr.elements.length === 0; } function addOptionality(type, isProperty, isOptional) { if (isProperty === void 0) { isProperty = false; } @@ -56523,11 +57016,11 @@ var ts; function getTypeForVariableLikeDeclaration(declaration, includeOptionality, checkMode) { // A variable declared in a for..in statement is of type string, or of type keyof T when the // right hand expression is of a type parameter type. - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression, /*checkMode*/ checkMode))); return indexType.flags & (262144 /* TypeFlags.TypeParameter */ | 4194304 /* TypeFlags.Index */) ? getExtractStringType(indexType) : stringType; } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { // checkRightHandSideOfForOf will return undefined if the for-of expression type was // missing properties/signatures required to get its iteratedType (like // [Symbol.iterator] or next). This may be because we accessed properties from anyType, @@ -56538,7 +57031,7 @@ var ts; if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } - var isProperty = ts.isPropertyDeclaration(declaration) || ts.isPropertySignature(declaration); + var isProperty = ts.isPropertyDeclaration(declaration) && !ts.hasAccessorModifier(declaration) || ts.isPropertySignature(declaration); var isOptional = includeOptionality && (isProperty && !!declaration.questionToken || ts.isParameter(declaration) && (!!declaration.questionToken || isJSDocOptionalParameter(declaration)) || isOptionalJSDocPropertyLikeTag(declaration)); @@ -56565,8 +57058,8 @@ var ts; if (ts.isParameter(declaration)) { var func = declaration.parent; // For a parameter of a set accessor, use the type of the get accessor if one is present - if (func.kind === 173 /* SyntaxKind.SetAccessor */ && hasBindableName(func)) { - var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 172 /* SyntaxKind.GetAccessor */); + if (func.kind === 175 /* SyntaxKind.SetAccessor */ && hasBindableName(func)) { + var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 174 /* SyntaxKind.GetAccessor */); if (getter) { var getterSignature = getSignatureFromDeclaration(getter); var thisParameter = getAccessorThisParameter(func); @@ -56578,11 +57071,9 @@ var ts; return getReturnTypeOfSignature(getterSignature); } } - if (ts.isInJSFile(declaration)) { - var type_1 = getParameterTypeOfTypeTag(func, declaration); - if (type_1) - return type_1; - } + var parameterTypeOfTypeTag = getParameterTypeOfTypeTag(func, declaration); + if (parameterTypeOfTypeTag) + return parameterTypeOfTypeTag; // Use contextual parameter type if one is available var type = declaration.symbol.escapedName === "this" /* InternalSymbolName.This */ ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration); if (type) { @@ -56643,7 +57134,7 @@ var ts; links.isConstructorDeclaredProperty = !!getDeclaringConstructor(symbol) && ts.every(symbol.declarations, function (declaration) { return ts.isBinaryExpression(declaration) && isPossiblyAliasedThisProperty(declaration) && - (declaration.left.kind !== 207 /* SyntaxKind.ElementAccessExpression */ || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && + (declaration.left.kind !== 209 /* SyntaxKind.ElementAccessExpression */ || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && !getAnnotatedTypeForAssignmentDeclaration(/*declaredType*/ undefined, declaration, symbol, declaration); }); } @@ -56665,11 +57156,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; var container = ts.getThisContainer(declaration, /*includeArrowFunctions*/ false); - if (container && (container.kind === 171 /* SyntaxKind.Constructor */ || isJSConstructor(container))) { + if (container && (container.kind === 173 /* SyntaxKind.Constructor */ || isJSConstructor(container))) { return container; } } - ; } /** Create a synthetic property access flow node after the last statement of the file */ function getFlowTypeFromCommonJSExport(symbol) { @@ -56962,9 +57452,9 @@ var ts; var thisContainer = ts.getThisContainer(expression, /*includeArrowFunctions*/ false); // Properties defined in a constructor (or base constructor, or javascript constructor function) don't get undefined added. // Function expressions that are assigned to the prototype count as methods. - return thisContainer.kind === 171 /* SyntaxKind.Constructor */ || - thisContainer.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - (thisContainer.kind === 213 /* SyntaxKind.FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); + return thisContainer.kind === 173 /* SyntaxKind.Constructor */ || + thisContainer.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + (thisContainer.kind === 215 /* SyntaxKind.FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); } function getConstructorDefinedThisAssignmentTypes(types, declarations) { ts.Debug.assert(types.length === declarations.length); @@ -56992,7 +57482,11 @@ var ts; if (reportErrors && !declarationBelongsToPrivateAmbientMember(element)) { reportImplicitAny(element, anyType); } - return anyType; + // When we're including the pattern in the type (an indication we're obtaining a contextual type), we + // use a non-inferrable any type. Inference will never directly infer this type, but it is possible + // to infer a type that contains it, e.g. for a binding pattern like [foo] or { foo }. In such cases, + // widening of the binding pattern type substitutes a regular any for the non-inferrable any. + return includePatternInType ? nonInferrableAnyType : anyType; } // Return the type implied by an object binding pattern function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) { @@ -57030,7 +57524,7 @@ var ts; function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) { var elements = pattern.elements; var lastElement = ts.lastOrUndefined(elements); - var restElement = lastElement && lastElement.kind === 203 /* SyntaxKind.BindingElement */ && lastElement.dotDotDotToken ? lastElement : undefined; + var restElement = lastElement && lastElement.kind === 205 /* SyntaxKind.BindingElement */ && lastElement.dotDotDotToken ? lastElement : undefined; if (elements.length === 0 || elements.length === 1 && restElement) { return languageVersion >= 2 /* ScriptTarget.ES2015 */ ? createIterableType(anyType) : anyArrayType; } @@ -57055,7 +57549,7 @@ var ts; function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { if (includePatternInType === void 0) { includePatternInType = false; } if (reportErrors === void 0) { reportErrors = false; } - return pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ + return pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -57103,7 +57597,7 @@ var ts; } function declarationBelongsToPrivateAmbientMember(declaration) { var root = ts.getRootDeclaration(declaration); - var memberDeclaration = root.kind === 164 /* SyntaxKind.Parameter */ ? root.parent : root; + var memberDeclaration = root.kind === 166 /* SyntaxKind.Parameter */ ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function tryGetTypeFromEffectiveTypeNode(node) { @@ -57158,9 +57652,9 @@ var ts; if (typeNode === undefined) { return useUnknownInCatchVariables ? unknownType : anyType; } - var type_2 = getTypeOfNode(typeNode); + var type_1 = getTypeOfNode(typeNode); // an errorType will make `checkTryStatement` issue an error - return isTypeAny(type_2) || type_2 === unknownType ? type_2 : errorType; + return isTypeAny(type_1) || type_1 === unknownType ? type_1 : errorType; } // Handle export default expressions if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) { @@ -57183,7 +57677,7 @@ var ts; return reportCircularityError(symbol); } var type; - if (declaration.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (declaration.kind === 274 /* SyntaxKind.ExportAssignment */) { type = widenTypeForVariableLikeDeclaration(tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionCached(declaration.expression), declaration); } else if (ts.isBinaryExpression(declaration) || @@ -57251,13 +57745,17 @@ var ts; } function getAnnotatedAccessorTypeNode(accessor) { if (accessor) { - if (accessor.kind === 172 /* SyntaxKind.GetAccessor */) { - var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); - return getterTypeAnnotation; - } - else { - var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation; + switch (accessor.kind) { + case 174 /* SyntaxKind.GetAccessor */: + var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); + return getterTypeAnnotation; + case 175 /* SyntaxKind.SetAccessor */: + var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); + return setterTypeAnnotation; + case 169 /* SyntaxKind.PropertyDeclaration */: + ts.Debug.assert(ts.hasAccessorModifier(accessor)); + var accessorTypeAnnotation = ts.getEffectiveTypeAnnotationNode(accessor); + return accessorTypeAnnotation; } } return undefined; @@ -57279,14 +57777,17 @@ var ts; if (!pushTypeResolution(symbol, 0 /* TypeSystemPropertyName.Type */)) { return errorType; } - var getter = ts.getDeclarationOfKind(symbol, 172 /* SyntaxKind.GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 174 /* SyntaxKind.GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */); + var accessor = ts.tryCast(ts.getDeclarationOfKind(symbol, 169 /* SyntaxKind.PropertyDeclaration */), ts.isAutoAccessorPropertyDeclaration); // We try to resolve a getter type annotation, a setter type annotation, or a getter function // body return type inference, in that order. var type = getter && ts.isInJSFile(getter) && getTypeForDeclarationFromJSDocComment(getter) || getAnnotatedAccessorType(getter) || getAnnotatedAccessorType(setter) || - getter && getter.body && getReturnTypeFromBody(getter); + getAnnotatedAccessorType(accessor) || + getter && getter.body && getReturnTypeFromBody(getter) || + accessor && accessor.initializer && getWidenedTypeForVariableLikeDeclaration(accessor, /*includeOptionality*/ true); if (!type) { if (setter && !isPrivateWithinAmbient(setter)) { errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol)); @@ -57294,6 +57795,9 @@ var ts; else if (getter && !isPrivateWithinAmbient(getter)) { errorOrSuggestion(noImplicitAny, getter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol)); } + else if (accessor && !isPrivateWithinAmbient(accessor)) { + errorOrSuggestion(noImplicitAny, accessor, ts.Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), "any"); + } type = anyType; } if (!popTypeResolution()) { @@ -57303,6 +57807,9 @@ var ts; else if (getAnnotatedAccessorTypeNode(setter)) { error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); } + else if (getAnnotatedAccessorTypeNode(accessor)) { + error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } else if (getter && noImplicitAny) { error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } @@ -57313,12 +57820,13 @@ var ts; return links.type; } function getWriteTypeOfAccessors(symbol) { + var _a; var links = getSymbolLinks(symbol); if (!links.writeType) { if (!pushTypeResolution(symbol, 8 /* TypeSystemPropertyName.WriteType */)) { return errorType; } - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var setter = (_a = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */)) !== null && _a !== void 0 ? _a : ts.tryCast(ts.getDeclarationOfKind(symbol, 169 /* SyntaxKind.PropertyDeclaration */), ts.isAutoAccessorPropertyDeclaration); var writeType = getAnnotatedAccessorType(setter); if (!popTypeResolution()) { if (getAnnotatedAccessorTypeNode(setter)) { @@ -57358,9 +57866,9 @@ var ts; if (symbol.flags & 1536 /* SymbolFlags.Module */ && ts.isShorthandAmbientModuleSymbol(symbol)) { return anyType; } - else if (declaration && (declaration.kind === 221 /* SyntaxKind.BinaryExpression */ || + else if (declaration && (declaration.kind === 223 /* SyntaxKind.BinaryExpression */ || ts.isAccessExpression(declaration) && - declaration.parent.kind === 221 /* SyntaxKind.BinaryExpression */)) { + declaration.parent.kind === 223 /* SyntaxKind.BinaryExpression */)) { return getWidenedTypeForAssignmentDeclaration(symbol); } else if (symbol.flags & 512 /* SymbolFlags.ValueModule */ && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) { @@ -57370,11 +57878,11 @@ var ts; return errorType; } var exportEquals = getMergedSymbol(symbol.exports.get("export=" /* InternalSymbolName.ExportEquals */)); - var type_3 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule); + var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule); if (!popTypeResolution()) { return reportCircularityError(symbol); } - return type_3; + return type_2; } } var type = createObjectType(16 /* ObjectFlags.Anonymous */, symbol); @@ -57425,7 +57933,7 @@ var ts; return errorType; } // Check if variable has initializer that circularly references the variable itself - if (noImplicitAny && (declaration.kind !== 164 /* SyntaxKind.Parameter */ || declaration.initializer)) { + if (noImplicitAny && (declaration.kind !== 166 /* SyntaxKind.Parameter */ || declaration.initializer)) { error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); } // Circularities could also result from parameters in function expressions that end up @@ -57557,46 +58065,46 @@ var ts; return undefined; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 195 /* SyntaxKind.MappedType */: - case 189 /* SyntaxKind.ConditionalType */: { + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 197 /* SyntaxKind.MappedType */: + case 191 /* SyntaxKind.ConditionalType */: { var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); - if (node.kind === 195 /* SyntaxKind.MappedType */) { + if (node.kind === 197 /* SyntaxKind.MappedType */) { return ts.append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter))); } - else if (node.kind === 189 /* SyntaxKind.ConditionalType */) { + else if (node.kind === 191 /* SyntaxKind.ConditionalType */) { return ts.concatenate(outerTypeParameters, getInferTypeParameters(node)); } var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node)); var thisType = includeThisTypes && - (node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */ || node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || isJSConstructor(node)) && + (node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */ || node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || isJSConstructor(node)) && getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters; } - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: var paramSymbol = ts.getParameterSymbolFromJSDoc(node); if (paramSymbol) { node = paramSymbol.valueDeclaration; } break; - case 320 /* SyntaxKind.JSDoc */: { + case 323 /* SyntaxKind.JSDoc */: { var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); return node.tags ? appendTypeParameters(outerTypeParameters, ts.flatMap(node.tags, function (t) { return ts.isJSDocTemplateTag(t) ? t.typeParameters : undefined; })) @@ -57607,7 +58115,7 @@ var ts; } // The outer type parameters are those defined by enclosing generic classes, methods, or functions. function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 /* SymbolFlags.Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 258 /* SyntaxKind.InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* SymbolFlags.Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.InterfaceDeclaration */); ts.Debug.assert(!!declaration, "Class was missing valueDeclaration -OR- non-class had no interface declarations"); return getOuterTypeParameters(declaration); } @@ -57620,9 +58128,9 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - node.kind === 257 /* SyntaxKind.ClassDeclaration */ || - node.kind === 226 /* SyntaxKind.ClassExpression */ || + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + node.kind === 260 /* SyntaxKind.ClassDeclaration */ || + node.kind === 228 /* SyntaxKind.ClassExpression */ || isJSConstructor(node) || ts.isTypeAlias(node)) { var declaration = node; @@ -57774,7 +58282,7 @@ var ts; if (!popTypeResolution() && type.symbol.declarations) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ || declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ || declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { reportCircularBaseType(declaration, type); } } @@ -57870,7 +58378,7 @@ var ts; if (type.symbol.declarations) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getReducedType(getTypeFromTypeNode(node)); @@ -57910,7 +58418,7 @@ var ts; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { if (declaration.flags & 128 /* NodeFlags.ContainsThis */) { return false; } @@ -57989,7 +58497,7 @@ var ts; } else { type = errorType; - if (declaration.kind === 339 /* SyntaxKind.JSDocEnumTag */) { + if (declaration.kind === 342 /* SyntaxKind.JSDocEnumTag */) { error(declaration.typeExpression.type, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } else { @@ -58004,7 +58512,7 @@ var ts; if (ts.isStringLiteralLike(expr)) { return true; } - else if (expr.kind === 221 /* SyntaxKind.BinaryExpression */) { + else if (expr.kind === 223 /* SyntaxKind.BinaryExpression */) { return isStringConcatExpression(expr.left) && isStringConcatExpression(expr.right); } return false; @@ -58019,12 +58527,12 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return true; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 8 /* SyntaxKind.NumericLiteral */; case 79 /* SyntaxKind.Identifier */: return ts.nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isStringConcatExpression(expr); default: return false; @@ -58039,7 +58547,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind === 263 /* SyntaxKind.EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (member.initializer && ts.isStringLiteralLike(member.initializer)) { @@ -58068,7 +58576,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind === 263 /* SyntaxKind.EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; var value = getEnumMemberValue(member); @@ -58141,22 +58649,22 @@ var ts; */ function isThislessType(node) { switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 196 /* SyntaxKind.LiteralType */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 198 /* SyntaxKind.LiteralType */: return true; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return isThislessType(node.elementType); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return !node.typeArguments || node.typeArguments.every(isThislessType); } return false; @@ -58182,7 +58690,7 @@ var ts; function isThislessFunctionLikeDeclaration(node) { var returnType = ts.getEffectiveReturnTypeNode(node); var typeParameters = ts.getEffectiveTypeParameterDeclarations(node); - return (node.kind === 171 /* SyntaxKind.Constructor */ || (!!returnType && isThislessType(returnType))) && + return (node.kind === 173 /* SyntaxKind.Constructor */ || (!!returnType && isThislessType(returnType))) && node.parameters.every(isThislessVariableLikeDeclaration) && typeParameters.every(isThislessTypeParameter); } @@ -58198,14 +58706,14 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return isThislessVariableLikeDeclaration(declaration); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return isThislessFunctionLikeDeclaration(declaration); } } @@ -58416,8 +58924,10 @@ var ts; if (members) { for (var _b = 0, members_5 = members; _b < members_5.length; _b++) { var member = members_5[_b]; - if (isStatic_1 === ts.hasStaticModifier(member) && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic_1 === ts.hasStaticModifier(member)) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -58432,8 +58942,10 @@ var ts; || ts.isBinaryExpression(member) && isPossiblyAliasedThisProperty(member, assignmentKind) || assignmentKind === 9 /* AssignmentDeclarationKind.ObjectDefinePrototypeProperty */ || assignmentKind === 6 /* AssignmentDeclarationKind.Prototype */; // A straight `Prototype` assignment probably can never have a computed name - if (isStatic_1 === !isInstanceMember && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic_1 === !isInstanceMember) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -58620,7 +59132,7 @@ var ts; var baseConstructorType = getBaseConstructorTypeOfClass(classType); var baseSignatures = getSignaturesOfType(baseConstructorType, 1 /* SignatureKind.Construct */); var declaration = ts.getClassLikeDeclarationOfSymbol(classType.symbol); - var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */); + var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */); if (baseSignatures.length === 0) { return [createSignature(undefined, classType.localTypeParameters, undefined, ts.emptyArray, classType, /*resolvedTypePredicate*/ undefined, 0, isAbstract ? 4 /* SignatureFlags.Abstract */ : 0 /* SignatureFlags.None */)]; } @@ -59093,6 +59605,12 @@ var ts; return mapType(type, getLowerBoundOfKeyType); } if (type.flags & 2097152 /* TypeFlags.Intersection */) { + // Similarly to getTypeFromIntersectionTypeNode, we preserve the special string & {}, number & {}, + // and bigint & {} intersections that are used to prevent subtype reduction in union types. + var types = type.types; + if (types.length === 2 && !!(types[0].flags & (4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) && types[1] === emptyTypeLiteralType) { + return type; + } return getIntersectionType(ts.sameMap(type.types, getLowerBoundOfKeyType)); } return type; @@ -59236,8 +59754,8 @@ var ts; } function isMappedTypeWithKeyofConstraintDeclaration(type) { var constraintDeclaration = getConstraintDeclarationForMappedType(type); // TODO: GH#18217 - return constraintDeclaration.kind === 193 /* SyntaxKind.TypeOperator */ && - constraintDeclaration.operator === 140 /* SyntaxKind.KeyOfKeyword */; + return constraintDeclaration.kind === 195 /* SyntaxKind.TypeOperator */ && + constraintDeclaration.operator === 141 /* SyntaxKind.KeyOfKeyword */; } function getModifiersTypeFromMappedType(type) { if (!type.modifiersType) { @@ -59597,10 +60115,10 @@ var ts; var baseTypes = []; var different = false; for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var type_4 = types_7[_i]; - var baseType = getBaseConstraint(type_4); + var type_3 = types_7[_i]; + var baseType = getBaseConstraint(type_3); if (baseType) { - if (baseType !== type_4) { + if (baseType !== type_3) { different = true; } baseTypes.push(baseType); @@ -59644,7 +60162,7 @@ var ts; return constraint && getBaseConstraint(constraint); } if (t.flags & 33554432 /* TypeFlags.Substitution */) { - return getBaseConstraint(t.substitute); + return getBaseConstraint(getSubstitutionIntersection(t)); } return t; } @@ -59771,7 +60289,7 @@ var ts; var isInstantiation = (getTargetSymbol(prop) || prop) === (getTargetSymbol(singleProp) || singleProp); // If the symbols are instances of one another with identical types - consider the symbols // equivalent and just use the first one, which thus allows us to avoid eliding private - // members when intersecting a (this-)instantiations of a class with it's raw base or another instance + // members when intersecting a (this-)instantiations of a class with its raw base or another instance if (isInstantiation && compareProperties(singleProp, prop, function (a, b) { return a === b ? -1 /* Ternary.True */ : 0 /* Ternary.False */; }) === -1 /* Ternary.True */) { // If we merged instantiations of a generic type, we replicate the symbol parent resetting behavior we used // to do when we recorded multiple distinct symbols so that we still get, eg, `Array.length` printed @@ -59819,7 +60337,11 @@ var ts; } } } - if (!singleProp || isUnion && (propSet || checkFlags & 48 /* CheckFlags.Partial */) && checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */)) { + if (!singleProp || + isUnion && + (propSet || checkFlags & 48 /* CheckFlags.Partial */) && + checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */) && + !(propSet && getCommonDeclarationsOfSymbols(ts.arrayFrom(propSet.values())))) { // No property was found, or, in a union, a property has a private or protected declaration in one // constituent, but is missing or has a different declaration in another constituent. return undefined; @@ -59921,6 +60443,33 @@ var ts; } return property; } + function getCommonDeclarationsOfSymbols(symbols) { + var commonDeclarations; + var _loop_14 = function (symbol) { + if (!symbol.declarations) { + return { value: undefined }; + } + if (!commonDeclarations) { + commonDeclarations = new ts.Set(symbol.declarations); + return "continue"; + } + commonDeclarations.forEach(function (declaration) { + if (!ts.contains(symbol.declarations, declaration)) { + commonDeclarations.delete(declaration); + } + }); + if (commonDeclarations.size === 0) { + return { value: undefined }; + } + }; + for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) { + var symbol = symbols_3[_i]; + var state_4 = _loop_14(symbol); + if (typeof state_4 === "object") + return state_4.value; + } + return commonDeclarations; + } function getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment) { var property = getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment); // We need to filter out partial properties in union types @@ -60124,10 +60673,10 @@ var ts; function isJSDocOptionalParameter(node) { return ts.isInJSFile(node) && ( // node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType - node.type && node.type.kind === 316 /* SyntaxKind.JSDocOptionalType */ + node.type && node.type.kind === 319 /* SyntaxKind.JSDocOptionalType */ || ts.getJSDocParameterTags(node).some(function (_a) { var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */; })); } function tryFindAmbientModule(moduleName, withAugmentations) { @@ -60160,14 +60709,14 @@ var ts; return false; } function isOptionalPropertyDeclaration(node) { - return ts.isPropertyDeclaration(node) && node.questionToken; + return ts.isPropertyDeclaration(node) && !ts.hasAccessorModifier(node) && node.questionToken; } function isOptionalJSDocPropertyLikeTag(node) { if (!ts.isJSDocPropertyLikeTag(node)) { return false; } var isBracketed = node.isBracketed, typeExpression = node.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */; } function createTypePredicate(kind, parameterName, parameterIndex, type) { return { kind: kind, parameterName: parameterName, parameterIndex: parameterIndex, type: type }; @@ -60249,7 +60798,7 @@ var ts; else { parameters.push(paramSymbol); } - if (type && type.kind === 196 /* SyntaxKind.LiteralType */) { + if (type && type.kind === 198 /* SyntaxKind.LiteralType */) { flags |= 2 /* SignatureFlags.HasLiteralTypes */; } // Record a new minimum argument count if this is not an optional parameter @@ -60262,24 +60811,24 @@ var ts; } } // If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation - if ((declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) && + if ((declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) && hasBindableName(declaration) && (!hasThisParameter || !thisParameter)) { - var otherKind = declaration.kind === 172 /* SyntaxKind.GetAccessor */ ? 173 /* SyntaxKind.SetAccessor */ : 172 /* SyntaxKind.GetAccessor */; + var otherKind = declaration.kind === 174 /* SyntaxKind.GetAccessor */ ? 175 /* SyntaxKind.SetAccessor */ : 174 /* SyntaxKind.GetAccessor */; var other = ts.getDeclarationOfKind(getSymbolOfNode(declaration), otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); } } - var classType = declaration.kind === 171 /* SyntaxKind.Constructor */ ? + var classType = declaration.kind === 173 /* SyntaxKind.Constructor */ ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration); if (ts.hasRestParameter(declaration) || ts.isInJSFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters)) { flags |= 1 /* SignatureFlags.HasRestParameter */; } - if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */) || - ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 128 /* ModifierFlags.Abstract */)) { + if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */) || + ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 256 /* ModifierFlags.Abstract */)) { flags |= 4 /* SignatureFlags.Abstract */; } links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, @@ -60358,16 +60907,16 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node.escapedText === argumentsSymbol.escapedName && getReferencedValueSymbol(node) === argumentsSymbol; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && traverse(node.name); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return traverse(node.expression); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return traverse(node.initializer); default: return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && !!ts.forEachChild(node, traverse); @@ -60391,7 +60940,12 @@ var ts; continue; } } - result.push(getSignatureFromDeclaration(decl)); + // If this is a function or method declaration, get the signature from the @type tag for the sake of optional parameters. + // Exclude contextually-typed kinds because we already apply the @type tag to the context, plus applying it here to the initializer would supress checks that the two are compatible. + result.push((!ts.isFunctionExpressionOrArrowFunction(decl) && + !ts.isObjectLiteralMethod(decl) && + getSignatureOfTypeTag(decl)) || + getSignatureFromDeclaration(decl)); } return result; } @@ -60422,7 +60976,7 @@ var ts; else { var type = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration); var jsdocPredicate = void 0; - if (!type && ts.isInJSFile(signature.declaration)) { + if (!type) { var jsdocSignature = getSignatureOfTypeTag(signature.declaration); if (jsdocSignature && signature !== jsdocSignature) { jsdocPredicate = getTypePredicateOfSignature(jsdocSignature); @@ -60439,7 +60993,7 @@ var ts; function createTypePredicateFromTypePredicateNode(node, signature) { var parameterName = node.parameterName; var type = node.type && getTypeFromTypeNode(node.type); - return parameterName.kind === 192 /* SyntaxKind.ThisType */ ? + return parameterName.kind === 194 /* SyntaxKind.ThisType */ ? createTypePredicate(node.assertsModifier ? 2 /* TypePredicateKind.AssertsThis */ : 0 /* TypePredicateKind.This */, /*parameterName*/ undefined, /*parameterIndex*/ undefined, type) : createTypePredicate(node.assertsModifier ? 3 /* TypePredicateKind.AssertsIdentifier */ : 1 /* TypePredicateKind.Identifier */, parameterName.escapedText, ts.findIndex(signature.parameters, function (p) { return p.escapedName === parameterName.escapedText; }), type); } @@ -60485,7 +61039,7 @@ var ts; return signature.resolvedReturnType; } function getReturnTypeFromAnnotation(declaration) { - if (declaration.kind === 171 /* SyntaxKind.Constructor */) { + if (declaration.kind === 173 /* SyntaxKind.Constructor */) { return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)); } if (ts.isJSDocConstructSignature(declaration)) { @@ -60495,12 +61049,12 @@ var ts; if (typeNode) { return getTypeFromTypeNode(typeNode); } - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ && hasBindableName(declaration)) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ && hasBindableName(declaration)) { var jsDocType = ts.isInJSFile(declaration) && getTypeForDeclarationFromJSDocComment(declaration); if (jsDocType) { return jsDocType; } - var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 173 /* SyntaxKind.SetAccessor */); + var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 175 /* SyntaxKind.SetAccessor */); var setterType = getAnnotatedAccessorType(setter); if (setterType) { return setterType; @@ -60603,7 +61157,7 @@ var ts; if (!signature.isolatedSignatureType) { var kind = (_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind; // If declaration is undefined, it is likely to be the signature of the default constructor. - var isConstructor = kind === undefined || kind === 171 /* SyntaxKind.Constructor */ || kind === 175 /* SyntaxKind.ConstructSignature */ || kind === 180 /* SyntaxKind.ConstructorType */; + var isConstructor = kind === undefined || kind === 173 /* SyntaxKind.Constructor */ || kind === 177 /* SyntaxKind.ConstructSignature */ || kind === 182 /* SyntaxKind.ConstructorType */; var type = createObjectType(16 /* ObjectFlags.Anonymous */); type.members = emptySymbols; type.properties = ts.emptyArray; @@ -60630,7 +61184,7 @@ var ts; function getIndexInfosOfIndexSymbol(indexSymbol) { if (indexSymbol.declarations) { var indexInfos_4 = []; - var _loop_14 = function (declaration) { + var _loop_15 = function (declaration) { if (declaration.parameters.length === 1) { var parameter = declaration.parameters[0]; if (parameter.type) { @@ -60644,7 +61198,7 @@ var ts; }; for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - _loop_14(declaration); + _loop_15(declaration); } return indexInfos_4; } @@ -60661,14 +61215,14 @@ var ts; var _a; var inferences; if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) { - var _loop_15 = function (declaration) { - if (declaration.parent.kind === 190 /* SyntaxKind.InferType */) { + var _loop_16 = function (declaration) { + if (declaration.parent.kind === 192 /* SyntaxKind.InferType */) { // When an 'infer T' declaration is immediately contained in a type reference node // (such as 'Foo'), T's constraint is inferred from the constraint of the // corresponding type parameter in 'Foo'. When multiple 'infer T' declarations are // present, we form an intersection of the inferred constraint types. var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1]; - if (grandParent.kind === 178 /* SyntaxKind.TypeReference */ && !omitTypeReferences) { + if (grandParent.kind === 180 /* SyntaxKind.TypeReference */ && !omitTypeReferences) { var typeReference_1 = grandParent; var typeParameters_1 = getTypeParametersForTypeReference(typeReference_1); if (typeParameters_1) { @@ -60695,27 +61249,27 @@ var ts; } // When an 'infer T' declaration is immediately contained in a rest parameter declaration, a rest type // or a named rest tuple element, we infer an 'unknown[]' constraint. - else if (grandParent.kind === 164 /* SyntaxKind.Parameter */ && grandParent.dotDotDotToken || - grandParent.kind === 186 /* SyntaxKind.RestType */ || - grandParent.kind === 197 /* SyntaxKind.NamedTupleMember */ && grandParent.dotDotDotToken) { + else if (grandParent.kind === 166 /* SyntaxKind.Parameter */ && grandParent.dotDotDotToken || + grandParent.kind === 188 /* SyntaxKind.RestType */ || + grandParent.kind === 199 /* SyntaxKind.NamedTupleMember */ && grandParent.dotDotDotToken) { inferences = ts.append(inferences, createArrayType(unknownType)); } // When an 'infer T' declaration is immediately contained in a string template type, we infer a 'string' // constraint. - else if (grandParent.kind === 199 /* SyntaxKind.TemplateLiteralTypeSpan */) { + else if (grandParent.kind === 201 /* SyntaxKind.TemplateLiteralTypeSpan */) { inferences = ts.append(inferences, stringType); } // When an 'infer T' declaration is in the constraint position of a mapped type, we infer a 'keyof any' // constraint. - else if (grandParent.kind === 163 /* SyntaxKind.TypeParameter */ && grandParent.parent.kind === 195 /* SyntaxKind.MappedType */) { + else if (grandParent.kind === 165 /* SyntaxKind.TypeParameter */ && grandParent.parent.kind === 197 /* SyntaxKind.MappedType */) { inferences = ts.append(inferences, keyofConstraintType); } // When an 'infer T' declaration is the template of a mapped type, and that mapped type is the extends // clause of a conditional whose check type is also a mapped type, give it a constraint equal to the template // of the check type's mapped type - else if (grandParent.kind === 195 /* SyntaxKind.MappedType */ && grandParent.type && - ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 189 /* SyntaxKind.ConditionalType */ && - grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 195 /* SyntaxKind.MappedType */ && + else if (grandParent.kind === 197 /* SyntaxKind.MappedType */ && grandParent.type && + ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 191 /* SyntaxKind.ConditionalType */ && + grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 197 /* SyntaxKind.MappedType */ && grandParent.parent.checkType.type) { var checkMappedType_1 = grandParent.parent.checkType; var nodeType = getTypeFromTypeNode(checkMappedType_1.type); @@ -60725,7 +61279,7 @@ var ts; }; for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) { var declaration = _b[_i]; - _loop_15(declaration); + _loop_16(declaration); } } return inferences && getIntersectionType(inferences); @@ -60747,7 +61301,7 @@ var ts; if (type.flags & 1 /* TypeFlags.Any */ && !isErrorType(type)) { // Allow errorType to propegate to keep downstream errors suppressed // use keyofConstraintType as the base constraint for mapped type key constraints (unknown isn;t assignable to that, but `any` was), // use unknown otherwise - type = constraintDeclaration.parent.parent.kind === 195 /* SyntaxKind.MappedType */ ? keyofConstraintType : unknownType; + type = constraintDeclaration.parent.parent.kind === 197 /* SyntaxKind.MappedType */ ? keyofConstraintType : unknownType; } typeParameter.constraint = type; } @@ -60756,7 +61310,7 @@ var ts; return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - var tp = ts.getDeclarationOfKind(typeParameter.symbol, 163 /* SyntaxKind.TypeParameter */); + var tp = ts.getDeclarationOfKind(typeParameter.symbol, 165 /* SyntaxKind.TypeParameter */); var host = ts.isJSDocTemplateTag(tp.parent) ? ts.getEffectiveContainerForJSDocTemplateTag(tp.parent) : tp.parent; return host && getSymbolOfNode(host); } @@ -60842,8 +61396,8 @@ var ts; } var node = type.node; var typeArguments = !node ? ts.emptyArray : - node.kind === 178 /* SyntaxKind.TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : - node.kind === 183 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : + node.kind === 180 /* SyntaxKind.TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : + node.kind === 185 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); if (popTypeResolution()) { type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments; @@ -60885,7 +61439,7 @@ var ts; return errorType; } } - if (node.kind === 178 /* SyntaxKind.TypeReference */ && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) { return createDeferredTypeReference(type, node, /*mapper*/ undefined); } // In a type reference, the outer type parameters of the referenced class or interface are automatically @@ -60956,9 +61510,9 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // We only support expressions that are simple qualified names. For other // expressions this produces undefined. var expr = node.expression; @@ -60973,13 +61527,13 @@ var ts; return symbol.parent ? "".concat(getSymbolPath(symbol.parent), ".").concat(symbol.escapedName) : symbol.escapedName; } function getUnresolvedSymbolForEntityName(name) { - var identifier = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.right : - name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ ? name.name : + var identifier = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.right : + name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? name.name : name; var text = identifier.escapedText; if (text) { - var parentSymbol = name.kind === 161 /* SyntaxKind.QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) : - name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) : + var parentSymbol = name.kind === 163 /* SyntaxKind.QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) : + name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) : undefined; var path = parentSymbol ? "".concat(getSymbolPath(parentSymbol), ".").concat(text) : text; var result = unresolvedSymbols.get(path); @@ -61040,7 +61594,7 @@ var ts; var valueType = getTypeOfSymbol(symbol); var typeType = valueType; if (symbol.valueDeclaration) { - var isImportTypeWithQualifier = node.kind === 200 /* SyntaxKind.ImportType */ && node.qualifier; + var isImportTypeWithQualifier = node.kind === 202 /* SyntaxKind.ImportType */ && node.qualifier; // valueType might not have a symbol, eg, {import('./b').STRING_LITERAL} if (valueType.symbol && valueType.symbol !== symbol && isImportTypeWithQualifier) { typeType = getTypeReferenceType(node, valueType.symbol); @@ -61050,23 +61604,27 @@ var ts; } return links.resolvedJSDocType; } - function getSubstitutionType(baseType, substitute) { - if (substitute.flags & 3 /* TypeFlags.AnyOrUnknown */ || substitute === baseType) { + function getSubstitutionType(baseType, constraint) { + if (constraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || constraint === baseType || + !isGenericType(baseType) && !isGenericType(constraint)) { return baseType; } - var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(substitute)); + var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(constraint)); var cached = substitutionTypes.get(id); if (cached) { return cached; } var result = createType(33554432 /* TypeFlags.Substitution */); result.baseType = baseType; - result.substitute = substitute; + result.constraint = constraint; substitutionTypes.set(id, result); return result; } + function getSubstitutionIntersection(substitutionType) { + return getIntersectionType([substitutionType.constraint, substitutionType.baseType]); + } function isUnaryTupleTypeNode(node) { - return node.kind === 184 /* SyntaxKind.TupleType */ && node.elements.length === 1; + return node.kind === 186 /* SyntaxKind.TupleType */ && node.elements.length === 1; } function getImpliedConstraint(type, checkNode, extendsNode) { return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(type, checkNode.elements[0], extendsNode.elements[0]) : @@ -61076,16 +61634,16 @@ var ts; function getConditionalFlowTypeOfType(type, node) { var constraints; var covariant = true; - while (node && !ts.isStatement(node) && node.kind !== 320 /* SyntaxKind.JSDoc */) { + while (node && !ts.isStatement(node) && node.kind !== 323 /* SyntaxKind.JSDoc */) { var parent = node.parent; // only consider variance flipped by parameter locations - `keyof` types would usually be considered variance inverting, but // often get used in indexed accesses where they behave sortof invariantly, but our checking is lax - if (parent.kind === 164 /* SyntaxKind.Parameter */) { + if (parent.kind === 166 /* SyntaxKind.Parameter */) { covariant = !covariant; } // Always substitute on type parameters, regardless of variance, since even // in contravariant positions, they may rely on substituted constraints to be valid - if ((covariant || type.flags & 8650752 /* TypeFlags.TypeVariable */) && parent.kind === 189 /* SyntaxKind.ConditionalType */ && node === parent.trueType) { + if ((covariant || type.flags & 8650752 /* TypeFlags.TypeVariable */) && parent.kind === 191 /* SyntaxKind.ConditionalType */ && node === parent.trueType) { var constraint = getImpliedConstraint(type, parent.checkType, parent.extendsType); if (constraint) { constraints = ts.append(constraints, constraint); @@ -61093,7 +61651,7 @@ var ts; } // Given a homomorphic mapped type { [K in keyof T]: XXX }, where T is constrained to an array or tuple type, in the // template type XXX, K has an added constraint of number | `${number}`. - else if (type.flags & 262144 /* TypeFlags.TypeParameter */ && parent.kind === 195 /* SyntaxKind.MappedType */ && node === parent.type) { + else if (type.flags & 262144 /* TypeFlags.TypeParameter */ && parent.kind === 197 /* SyntaxKind.MappedType */ && node === parent.type) { var mappedType = getTypeFromTypeNode(parent); if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) { var typeParameter = getHomomorphicTypeVariable(mappedType); @@ -61107,10 +61665,10 @@ var ts; } node = parent; } - return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type; + return constraints ? getSubstitutionType(type, getIntersectionType(constraints)) : type; } function isJSDocTypeReference(node) { - return !!(node.flags & 8388608 /* NodeFlags.JSDoc */) && (node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 200 /* SyntaxKind.ImportType */); + return !!(node.flags & 8388608 /* NodeFlags.JSDoc */) && (node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 202 /* SyntaxKind.ImportType */); } function checkNoTypeArguments(node, symbol) { if (node.typeArguments) { @@ -61225,9 +61783,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return declaration; } } @@ -61378,6 +61936,13 @@ var ts; function getGlobalBigIntType() { return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType; } + function getGlobalNaNSymbol() { + return (deferredGlobalNaNSymbol || (deferredGlobalNaNSymbol = getGlobalValueSymbol("NaN", /*reportErrors*/ false))); + } + function getGlobalRecordSymbol() { + deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol); + return deferredGlobalRecordSymbol === unknownSymbol ? undefined : deferredGlobalRecordSymbol; + } /** * Instantiates a global type that is generic with some element type, and returns that instantiation. */ @@ -61395,11 +61960,11 @@ var ts; } function getTupleElementFlags(node) { switch (node.kind) { - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return 2 /* ElementFlags.Optional */; - case 186 /* SyntaxKind.RestType */: + case 188 /* SyntaxKind.RestType */: return getRestTypeElementFlags(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return node.questionToken ? 2 /* ElementFlags.Optional */ : node.dotDotDotToken ? getRestTypeElementFlags(node) : 1 /* ElementFlags.Required */; @@ -61417,14 +61982,14 @@ var ts; return readonly ? globalReadonlyArrayType : globalArrayType; } var elementFlags = ts.map(node.elements, getTupleElementFlags); - var missingName = ts.some(node.elements, function (e) { return e.kind !== 197 /* SyntaxKind.NamedTupleMember */; }); + var missingName = ts.some(node.elements, function (e) { return e.kind !== 199 /* SyntaxKind.NamedTupleMember */; }); return getTupleTargetType(elementFlags, readonly, /*associatedNames*/ missingName ? undefined : node.elements); } // Return true if the given type reference node is directly aliased or if it needs to be deferred // because it is possibly contained in a circular chain of eagerly resolved types. function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) { - return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 183 /* SyntaxKind.ArrayType */ ? mayResolveTypeAlias(node.elementType) : - node.kind === 184 /* SyntaxKind.TupleType */ ? ts.some(node.elements, mayResolveTypeAlias) : + return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 185 /* SyntaxKind.ArrayType */ ? mayResolveTypeAlias(node.elementType) : + node.kind === 186 /* SyntaxKind.TupleType */ ? ts.some(node.elements, mayResolveTypeAlias) : hasDefaultTypeArguments || ts.some(node.typeArguments, mayResolveTypeAlias)); } // Return true when the given node is transitively contained in type constructs that eagerly @@ -61433,18 +61998,18 @@ var ts; function isResolvedByTypeAlias(node) { var parent = node.parent; switch (parent.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: - case 178 /* SyntaxKind.TypeReference */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 189 /* SyntaxKind.ConditionalType */: - case 193 /* SyntaxKind.TypeOperator */: - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: + case 180 /* SyntaxKind.TypeReference */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 191 /* SyntaxKind.ConditionalType */: + case 195 /* SyntaxKind.TypeOperator */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return isResolvedByTypeAlias(parent); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; } return false; @@ -61453,28 +62018,28 @@ var ts; // of a type alias. function mayResolveTypeAlias(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return isJSDocTypeReference(node) || !!(resolveTypeReferenceName(node, 788968 /* SymbolFlags.Type */).flags & 524288 /* SymbolFlags.TypeAlias */); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return true; - case 193 /* SyntaxKind.TypeOperator */: - return node.operator !== 154 /* SyntaxKind.UniqueKeyword */ && mayResolveTypeAlias(node.type); - case 191 /* SyntaxKind.ParenthesizedType */: - case 185 /* SyntaxKind.OptionalType */: - case 197 /* SyntaxKind.NamedTupleMember */: - case 316 /* SyntaxKind.JSDocOptionalType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 195 /* SyntaxKind.TypeOperator */: + return node.operator !== 156 /* SyntaxKind.UniqueKeyword */ && mayResolveTypeAlias(node.type); + case 193 /* SyntaxKind.ParenthesizedType */: + case 187 /* SyntaxKind.OptionalType */: + case 199 /* SyntaxKind.NamedTupleMember */: + case 319 /* SyntaxKind.JSDocOptionalType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return mayResolveTypeAlias(node.type); - case 186 /* SyntaxKind.RestType */: - return node.type.kind !== 183 /* SyntaxKind.ArrayType */ || mayResolveTypeAlias(node.type.elementType); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 188 /* SyntaxKind.RestType */: + return node.type.kind !== 185 /* SyntaxKind.ArrayType */ || mayResolveTypeAlias(node.type.elementType); + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return ts.some(node.types, mayResolveTypeAlias); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return mayResolveTypeAlias(node.objectType) || mayResolveTypeAlias(node.indexType); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return mayResolveTypeAlias(node.checkType) || mayResolveTypeAlias(node.extendsType) || mayResolveTypeAlias(node.trueType) || mayResolveTypeAlias(node.falseType); } @@ -61487,19 +62052,19 @@ var ts; if (target === emptyGenericType) { links.resolvedType = emptyObjectType; } - else if (!(node.kind === 184 /* SyntaxKind.TupleType */ && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8 /* ElementFlags.Variadic */); })) && isDeferredTypeReferenceNode(node)) { - links.resolvedType = node.kind === 184 /* SyntaxKind.TupleType */ && node.elements.length === 0 ? target : + else if (!(node.kind === 186 /* SyntaxKind.TupleType */ && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8 /* ElementFlags.Variadic */); })) && isDeferredTypeReferenceNode(node)) { + links.resolvedType = node.kind === 186 /* SyntaxKind.TupleType */ && node.elements.length === 0 ? target : createDeferredTypeReference(target, node, /*mapper*/ undefined); } else { - var elementTypes = node.kind === 183 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); + var elementTypes = node.kind === 185 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); links.resolvedType = createNormalizedTypeReference(target, elementTypes); } } return links.resolvedType; } function isReadonlyTypeOperator(node) { - return ts.isTypeOperatorNode(node) && node.operator === 145 /* SyntaxKind.ReadonlyKeyword */; + return ts.isTypeOperatorNode(node) && node.operator === 146 /* SyntaxKind.ReadonlyKeyword */; } function createTupleType(elementTypes, elementFlags, readonly, namedMemberDeclarations) { if (readonly === void 0) { readonly = false; } @@ -61614,7 +62179,7 @@ var ts; var lastRequiredIndex = -1; var firstRestIndex = -1; var lastOptionalOrRestIndex = -1; - var _loop_16 = function (i) { + var _loop_17 = function (i) { var type = elementTypes[i]; var flags = target.elementFlags[i]; if (flags & 8 /* ElementFlags.Variadic */) { @@ -61644,9 +62209,9 @@ var ts; } }; for (var i = 0; i < elementTypes.length; i++) { - var state_4 = _loop_16(i); - if (typeof state_4 === "object") - return state_4.value; + var state_5 = _loop_17(i); + if (typeof state_5 === "object") + return state_5.value; } // Turn optional elements preceding the last required element into required elements for (var i = 0; i < lastRequiredIndex; i++) { @@ -61674,7 +62239,7 @@ var ts; if (flags & (2 /* ElementFlags.Optional */ | 4 /* ElementFlags.Rest */)) { lastOptionalOrRestIndex = expandedFlags.length; } - expandedTypes.push(type); + expandedTypes.push(flags & 2 /* ElementFlags.Optional */ ? addOptionality(type, /*isProperty*/ true) : type); expandedFlags.push(flags); if (expandedDeclarations && declaration) { expandedDeclarations.push(declaration); @@ -61840,7 +62405,7 @@ var ts; var templates = ts.filter(types, isPatternLiteralType); if (templates.length) { var i = types.length; - var _loop_17 = function () { + var _loop_18 = function () { i--; var t = types[i]; if (t.flags & 128 /* TypeFlags.StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) { @@ -61848,7 +62413,7 @@ var ts; } }; while (i > 0) { - _loop_17(); + _loop_18(); } } } @@ -61925,14 +62490,14 @@ var ts; var namedUnions = []; addNamedUnions(namedUnions, types); var reducedTypes = []; - var _loop_18 = function (t) { + var _loop_19 = function (t) { if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) { reducedTypes.push(t); } }; for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) { var t = typeSet_1[_i]; - _loop_18(t); + _loop_19(t); } if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) { return namedUnions[0]; @@ -62422,7 +62987,7 @@ var ts; type.flags & 16777216 /* TypeFlags.Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* TypeFlags.UnionOrIntersection */ | 134217728 /* TypeFlags.TemplateLiteral */) ? ts.every(type.types, isDistributive) : type.flags & 8388608 /* TypeFlags.IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : - type.flags & 33554432 /* TypeFlags.Substitution */ ? isDistributive(type.substitute) : + type.flags & 33554432 /* TypeFlags.Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* TypeFlags.StringMapping */ ? isDistributive(type.type) : false; } @@ -62503,15 +63068,15 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { switch (node.operator) { - case 140 /* SyntaxKind.KeyOfKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: links.resolvedType = getIndexType(getTypeFromTypeNode(node.type)); break; - case 154 /* SyntaxKind.UniqueKeyword */: - links.resolvedType = node.type.kind === 151 /* SyntaxKind.SymbolKeyword */ + case 156 /* SyntaxKind.UniqueKeyword */: + links.resolvedType = node.type.kind === 153 /* SyntaxKind.SymbolKeyword */ ? getESSymbolLikeTypeForNode(ts.walkUpParenthesizedTypes(node.parent)) : errorType; break; - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: links.resolvedType = getTypeFromTypeNode(node.type); break; default: @@ -62703,7 +63268,7 @@ var ts; } function getPropertyTypeForIndexType(originalObjectType, objectType, indexType, fullIndexType, accessNode, accessFlags) { var _a; - var accessExpression = accessNode && accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ ? accessNode : undefined; var propName = accessNode && ts.isPrivateIdentifier(accessNode) ? undefined : getPropertyNameFromIndex(indexType, accessNode); if (propName !== undefined) { if (accessFlags & 256 /* AccessFlags.Contextual */) { @@ -62874,9 +63439,9 @@ var ts; } } function getIndexNodeForAccessExpression(accessNode) { - return accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ ? accessNode.argumentExpression : - accessNode.kind === 194 /* SyntaxKind.IndexedAccessType */ ? accessNode.indexType : - accessNode.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? accessNode.expression : + return accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ ? accessNode.argumentExpression : + accessNode.kind === 196 /* SyntaxKind.IndexedAccessType */ ? accessNode.indexType : + accessNode.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? accessNode.expression : accessNode; } function isPatternLiteralPlaceholderType(type) { @@ -62905,7 +63470,7 @@ var ts; if (type.flags & 33554432 /* TypeFlags.Substitution */) { if (!(type.objectFlags & 2097152 /* ObjectFlags.IsGenericTypeComputed */)) { type.objectFlags |= 2097152 /* ObjectFlags.IsGenericTypeComputed */ | - getGenericObjectFlags(type.substitute) | getGenericObjectFlags(type.baseType); + getGenericObjectFlags(type.baseType) | getGenericObjectFlags(type.constraint); } return type.objectFlags & 12582912 /* ObjectFlags.IsGenericType */; } @@ -63056,7 +63621,7 @@ var ts; // for a generic T and a non-generic K, we eagerly resolve T[K] if it originates in an expression. This is to // preserve backwards compatibility. For example, an element access 'this["foo"]' has always been resolved // eagerly using the constraint type of 'this' at the given location. - if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 194 /* SyntaxKind.IndexedAccessType */ ? + if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 196 /* SyntaxKind.IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) { if (objectType.flags & 3 /* TypeFlags.AnyOrUnknown */) { @@ -63108,11 +63673,7 @@ var ts; var objectType = getTypeFromTypeNode(node.objectType); var indexType = getTypeFromTypeNode(node.indexType); var potentialAlias = getAliasSymbolForTypeNode(node); - var resolved = getIndexedAccessType(objectType, indexType, 0 /* AccessFlags.None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); - links.resolvedType = resolved.flags & 8388608 /* TypeFlags.IndexedAccess */ && - resolved.objectType === objectType && - resolved.indexType === indexType ? - getConditionalFlowTypeOfType(resolved, node) : resolved; + links.resolvedType = getIndexedAccessType(objectType, indexType, 0 /* AccessFlags.None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); } return links.resolvedType; } @@ -63166,7 +63727,7 @@ var ts; var result; var extraTypes; var tailCount = 0; - var _loop_19 = function () { + var _loop_20 = function () { if (tailCount === 1000) { error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite); result = errorType; @@ -63287,10 +63848,10 @@ var ts; // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive // cases we increment the tail recursion counter and stop after 1000 iterations. while (true) { - var state_5 = _loop_19(); - if (typeof state_5 === "object") - return state_5.value; - if (state_5 === "break") + var state_6 = _loop_20(); + if (typeof state_6 === "object") + return state_6.value; + if (state_6 === "break") break; } return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result; @@ -63483,7 +64044,7 @@ var ts; } function getAliasSymbolForTypeNode(node) { var host = node.parent; - while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { + while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { host = host.parent; } return ts.isTypeAlias(host) ? getSymbolOfNode(host) : undefined; @@ -63728,7 +64289,7 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */)) { if (!ts.isStatic(container) && (!ts.isConstructorDeclaration(container) || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; @@ -63763,17 +64324,17 @@ var ts; } function getArrayElementTypeNode(node) { switch (node.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return getArrayElementTypeNode(node.type); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: if (node.elements.length === 1) { node = node.elements[0]; - if (node.kind === 186 /* SyntaxKind.RestType */ || node.kind === 197 /* SyntaxKind.NamedTupleMember */ && node.dotDotDotToken) { + if (node.kind === 188 /* SyntaxKind.RestType */ || node.kind === 199 /* SyntaxKind.NamedTupleMember */ && node.dotDotDotToken) { return getArrayElementTypeNode(node.type); } } break; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return node.elementType; } return undefined; @@ -63789,99 +64350,99 @@ var ts; } function getTypeFromTypeNodeWorker(node) { switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: + case 131 /* SyntaxKind.AnyKeyword */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return anyType; - case 155 /* SyntaxKind.UnknownKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: return unknownType; - case 150 /* SyntaxKind.StringKeyword */: + case 152 /* SyntaxKind.StringKeyword */: return stringType; - case 147 /* SyntaxKind.NumberKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: return numberType; - case 158 /* SyntaxKind.BigIntKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: return bigintType; - case 133 /* SyntaxKind.BooleanKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: return booleanType; - case 151 /* SyntaxKind.SymbolKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: return esSymbolType; case 114 /* SyntaxKind.VoidKeyword */: return voidType; - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: return undefinedType; case 104 /* SyntaxKind.NullKeyword */: // TODO(rbuckton): `NullKeyword` is no longer a `TypeNode`, but we defensively allow it here because of incorrect casts in the Language Service. return nullType; - case 143 /* SyntaxKind.NeverKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return neverType; - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return node.flags & 262144 /* NodeFlags.JavaScriptFile */ && !noImplicitAny ? anyType : nonPrimitiveType; - case 138 /* SyntaxKind.IntrinsicKeyword */: + case 139 /* SyntaxKind.IntrinsicKeyword */: return intrinsicMarkerType; - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 108 /* SyntaxKind.ThisKeyword */: // TODO(rbuckton): `ThisKeyword` is no longer a `TypeNode`, but we defensively allow it here because of incorrect casts in the Language Service and because of `isPartOfTypeNode`. return getTypeFromThisTypeNode(node); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return getTypeFromLiteralTypeNode(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return getTypeFromTypeReference(node); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return node.assertsModifier ? voidType : booleanType; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return getTypeFromTypeQueryNode(node); - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return getTypeFromArrayOrTupleTypeNode(node); - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return getTypeFromOptionalTypeNode(node); - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return getTypeFromUnionTypeNode(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return getTypeFromJSDocNullableTypeNode(node); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return addOptionality(getTypeFromTypeNode(node.type)); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return getTypeFromNamedTupleTypeNode(node); - case 191 /* SyntaxKind.ParenthesizedType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return getTypeFromTypeNode(node.type); - case 186 /* SyntaxKind.RestType */: + case 188 /* SyntaxKind.RestType */: return getTypeFromRestTypeNode(node); - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 323 /* SyntaxKind.JSDocSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 326 /* SyntaxKind.JSDocSignature */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return getTypeFromTypeOperatorNode(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return getTypeFromIndexedAccessTypeNode(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return getTypeFromMappedTypeNode(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return getTypeFromConditionalTypeNode(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return getTypeFromInferTypeNode(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return getTypeFromTemplateTypeNode(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return getTypeFromImportTypeNode(node); // This function assumes that an identifier, qualified name, or property access expression is a type expression // Callers should first ensure this by calling `isPartOfTypeNode` // TODO(rbuckton): These aren't valid TypeNodes, but we treat them as such because of `isPartOfTypeNode`, which returns `true` for things that aren't `TypeNode`s. case 79 /* SyntaxKind.Identifier */: - case 161 /* SyntaxKind.QualifiedName */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var symbol = getSymbolAtLocation(node); return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType; default: @@ -63988,8 +64549,8 @@ var ts; return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* TypeMapKind.Merged */, mapper, makeUnaryTypeMapper(source, target)); } function getRestrictiveTypeParameter(tp) { - return tp.constraint === unknownType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), - tp.restrictiveInstantiation.constraint = unknownType, + return !tp.constraint && !getConstraintDeclaration(tp) || tp.constraint === noConstraintType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), + tp.restrictiveInstantiation.constraint = noConstraintType, tp.restrictiveInstantiation); } function cloneTypeParameter(typeParameter) { @@ -64103,17 +64664,18 @@ var ts; return type; } function maybeTypeParameterReference(node) { - return !(node.parent.kind === 178 /* SyntaxKind.TypeReference */ && node.parent.typeArguments && node === node.parent.typeName || - node.parent.kind === 200 /* SyntaxKind.ImportType */ && node.parent.typeArguments && node === node.parent.qualifier); + return !(node.parent.kind === 180 /* SyntaxKind.TypeReference */ && node.parent.typeArguments && node === node.parent.typeName || + node.parent.kind === 202 /* SyntaxKind.ImportType */ && node.parent.typeArguments && node === node.parent.qualifier); } function isTypeParameterPossiblyReferenced(tp, node) { - // If the type parameter doesn't have exactly one declaration, if there are invening statement blocks + // If the type parameter doesn't have exactly one declaration, if there are intervening statement blocks // between the node and the type parameter declaration, if the node contains actual references to the - // type parameter, or if the node contains type queries, we consider the type parameter possibly referenced. + // type parameter, or if the node contains type queries that we can't prove couldn't contain references to the type parameter, + // we consider the type parameter possibly referenced. if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) { var container = tp.symbol.declarations[0].parent; for (var n = node; n !== container; n = n.parent) { - if (!n || n.kind === 235 /* SyntaxKind.Block */ || n.kind === 189 /* SyntaxKind.ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) { + if (!n || n.kind === 238 /* SyntaxKind.Block */ || n.kind === 191 /* SyntaxKind.ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) { return true; } } @@ -64122,15 +64684,36 @@ var ts; return true; function containsReference(node) { switch (node.kind) { - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return !!tp.isThisType; case 79 /* SyntaxKind.Identifier */: return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) && getTypeFromTypeNodeWorker(node) === tp; // use worker because we're looking for === equality - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: + var entityName = node.exprName; + var firstIdentifier = ts.getFirstIdentifier(entityName); + var firstIdentifierSymbol = getResolvedSymbol(firstIdentifier); + var tpDeclaration = tp.symbol.declarations[0]; // There is exactly one declaration, otherwise `containsReference` is not called + var tpScope_1; + if (tpDeclaration.kind === 165 /* SyntaxKind.TypeParameter */) { // Type parameter is a regular type parameter, e.g. foo + tpScope_1 = tpDeclaration.parent; + } + else if (tp.isThisType) { + // Type parameter is the this type, and its declaration is the class declaration. + tpScope_1 = tpDeclaration; + } + else { + // Type parameter's declaration was unrecognized. + // This could happen if the type parameter comes from e.g. a JSDoc annotation, so we default to returning true. + return true; + } + if (firstIdentifierSymbol.declarations) { + return ts.some(firstIdentifierSymbol.declarations, function (idDecl) { return ts.isNodeDescendantOf(idDecl, tpScope_1); }) || + ts.some(node.typeArguments, containsReference); + } return true; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return !node.type && !!node.body || ts.some(node.typeParameters, containsReference) || ts.some(node.parameters, containsReference) || @@ -64352,17 +64935,18 @@ var ts; return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments); } if (flags & 33554432 /* TypeFlags.Substitution */) { - var maybeVariable = instantiateType(type.baseType, mapper); - if (maybeVariable.flags & 8650752 /* TypeFlags.TypeVariable */) { - return getSubstitutionType(maybeVariable, instantiateType(type.substitute, mapper)); + var newBaseType = instantiateType(type.baseType, mapper); + var newConstraint = instantiateType(type.constraint, mapper); + // A substitution type originates in the true branch of a conditional type and can be resolved + // to just the base type in the same cases as the conditional type resolves to its true branch + // (because the base type is then known to satisfy the constraint). + if (newBaseType.flags & 8650752 /* TypeFlags.TypeVariable */ && isGenericType(newConstraint)) { + return getSubstitutionType(newBaseType, newConstraint); } - else { - var sub = instantiateType(type.substitute, mapper); - if (sub.flags & 3 /* TypeFlags.AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) { - return maybeVariable; - } - return sub; + if (newConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(newBaseType), getRestrictiveInstantiation(newConstraint))) { + return newBaseType; } + return newBaseType.flags & 8650752 /* TypeFlags.TypeVariable */ ? getSubstitutionType(newBaseType, newConstraint) : getIntersectionType([newConstraint, newBaseType]); } return type; } @@ -64411,35 +64995,35 @@ var ts; // Returns true if the given expression contains (at any level of nesting) a function or arrow expression // that is subject to contextual typing. function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type return isContextSensitiveFunctionLikeDeclaration(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return ts.some(node.properties, isContextSensitive); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return ts.some(node.elements, isContextSensitive); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ || node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */) && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return isContextSensitive(node.initializer); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isContextSensitive(node.expression); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return ts.some(node.properties, isContextSensitive) || ts.isJsxOpeningElement(node.parent) && ts.some(node.parent.parent.children, isContextSensitive); - case 285 /* SyntaxKind.JsxAttribute */: { + case 288 /* SyntaxKind.JsxAttribute */: { // If there is no initializer, JSX attribute has a boolean value of true which is not context sensitive. var initializer = node.initializer; return !!initializer && isContextSensitive(initializer); } - case 288 /* SyntaxKind.JsxExpression */: { + case 291 /* SyntaxKind.JsxExpression */: { // It is possible to that node.expression is undefined (e.g
) var expression = node.expression; return !!expression && isContextSensitive(expression); @@ -64448,15 +65032,14 @@ var ts; return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return (!ts.isFunctionDeclaration(node) || ts.isInJSFile(node) && !!getTypeForDeclarationFromJSDocComment(node)) && - (ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node)); + return ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node); } function hasContextSensitiveReturnExpression(node) { // TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value. - return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 235 /* SyntaxKind.Block */ && isContextSensitive(node.body); + return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 238 /* SyntaxKind.Block */ && isContextSensitive(node.body); } function isContextSensitiveFunctionOrObjectLiteralMethod(func) { - return (ts.isInJSFile(func) && ts.isFunctionDeclaration(func) || ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && + return (ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func); } function getTypeWithoutSignatures(type) { @@ -64557,23 +65140,23 @@ var ts; return true; } switch (node.kind) { - case 288 /* SyntaxKind.JsxExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 291 /* SyntaxKind.JsxExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (node.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: case 27 /* SyntaxKind.CommaToken */: return elaborateError(node.right, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); } break; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return elaborateJsxComponents(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return elaborateArrowFunction(node, source, target, relation, containingMessageChain, errorOutputContainer); } return false; @@ -64782,7 +65365,7 @@ var ts; } function getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic) { switch (child.kind) { - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: // child is of the type of the expression return { errorNode: child, innerExpression: child.expression, nameType: nameType }; case 11 /* SyntaxKind.JsxText */: @@ -64791,9 +65374,9 @@ var ts; } // child is a string return { errorNode: child, innerExpression: undefined, nameType: nameType, errorMessage: getInvalidTextDiagnostic() }; - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: // child is of type JSX.Element return { errorNode: child, innerExpression: child, nameType: nameType }; default: @@ -64941,11 +65524,11 @@ var ts; } _b = prop.kind; switch (_b) { - case 173 /* SyntaxKind.SetAccessor */: return [3 /*break*/, 2]; - case 172 /* SyntaxKind.GetAccessor */: return [3 /*break*/, 2]; - case 169 /* SyntaxKind.MethodDeclaration */: return [3 /*break*/, 2]; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: return [3 /*break*/, 2]; - case 296 /* SyntaxKind.PropertyAssignment */: return [3 /*break*/, 4]; + case 175 /* SyntaxKind.SetAccessor */: return [3 /*break*/, 2]; + case 174 /* SyntaxKind.GetAccessor */: return [3 /*break*/, 2]; + case 171 /* SyntaxKind.MethodDeclaration */: return [3 /*break*/, 2]; + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return [3 /*break*/, 2]; + case 299 /* SyntaxKind.PropertyAssignment */: return [3 /*break*/, 4]; } return [3 /*break*/, 6]; case 2: return [4 /*yield*/, { errorNode: prop.name, innerExpression: undefined, nameType: type }]; @@ -65018,8 +65601,8 @@ var ts; void instantiateType(sourceRestType || targetRestType, reportUnreliableMarkers); } var kind = target.declaration ? target.declaration.kind : 0 /* SyntaxKind.Unknown */; - var strictVariance = !(checkMode & 3 /* SignatureCheckMode.Callback */) && strictFunctionTypes && kind !== 169 /* SyntaxKind.MethodDeclaration */ && - kind !== 168 /* SyntaxKind.MethodSignature */ && kind !== 171 /* SyntaxKind.Constructor */; + var strictVariance = !(checkMode & 3 /* SignatureCheckMode.Callback */) && strictFunctionTypes && kind !== 171 /* SyntaxKind.MethodDeclaration */ && + kind !== 170 /* SyntaxKind.MethodSignature */ && kind !== 173 /* SyntaxKind.Constructor */; var result = -1 /* Ternary.True */; var sourceThisType = getThisTypeOfSignature(source); if (sourceThisType && sourceThisType !== voidType) { @@ -65316,7 +65899,7 @@ var ts; var t = isFreshLiteralType(type) ? type.regularType : ts.getObjectFlags(type) & 4 /* ObjectFlags.Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 /* TypeFlags.UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : - type.flags & 33554432 /* TypeFlags.Substitution */ ? writing ? type.baseType : type.substitute : + type.flags & 33554432 /* TypeFlags.Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 /* TypeFlags.Simplifiable */ ? getSimplifiedType(type, writing) : type; if (t === type) @@ -65723,7 +66306,8 @@ var ts; return 0 /* Ternary.False */; } } - var isPerformingCommonPropertyChecks = relation !== comparableRelation && !(intersectionState & 2 /* IntersectionState.Target */) && + var isPerformingCommonPropertyChecks = (relation !== comparableRelation || !(source.flags & 1048576 /* TypeFlags.Union */) && isLiteralType(source)) && + !(intersectionState & 2 /* IntersectionState.Target */) && source.flags & (131068 /* TypeFlags.Primitive */ | 524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && source !== globalObjectType && target.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && isWeakType(target) && (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source)); @@ -65882,7 +66466,7 @@ var ts; reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target); checkTypes = reducedTarget.flags & 1048576 /* TypeFlags.Union */ ? reducedTarget.types : [reducedTarget]; } - var _loop_20 = function (prop) { + var _loop_21 = function (prop) { if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) { if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) { if (reportErrors) { @@ -65945,9 +66529,9 @@ var ts; }; for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) { var prop = _b[_i]; - var state_6 = _loop_20(prop); - if (typeof state_6 === "object") - return state_6.value; + var state_7 = _loop_21(prop); + if (typeof state_7 === "object") + return state_7.value; } return false; } @@ -65975,11 +66559,15 @@ var ts; // parameter 'T extends 1 | 2', the intersection 'T & 1' should be reduced to '1' such that it doesn't // appear to be comparable to '2'. if (relation === comparableRelation && target.flags & 131068 /* TypeFlags.Primitive */) { - var constraints = ts.sameMap(source.types, getBaseConstraintOrType); + var constraints = ts.sameMap(source.types, function (t) { return t.flags & 465829888 /* TypeFlags.Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t; }); if (constraints !== source.types) { source = getIntersectionType(constraints); + if (source.flags & 131072 /* TypeFlags.Never */) { + return 0 /* Ternary.False */; + } if (!(source.flags & 2097152 /* TypeFlags.Intersection */)) { - return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false); + return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false) || + isRelatedTo(target, source, 1 /* RecursionFlags.Source */, /*reportErrors*/ false); } } } @@ -66297,7 +66885,7 @@ var ts; // the type param can be compared with itself in the target (with the influence of its constraint to match other parts) // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)` var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */)); - if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself + if (constraint && !(constraint.flags & 131072 /* TypeFlags.Never */) && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState); } @@ -66349,7 +66937,11 @@ var ts; } } if (sourceFlags & 33554432 /* TypeFlags.Substitution */) { - return isRelatedTo(source.substitute, target.substitute, 3 /* RecursionFlags.Both */, /*reportErrors*/ false); + if (result = isRelatedTo(source.baseType, target.baseType, 3 /* RecursionFlags.Both */, /*reportErrors*/ false)) { + if (result &= isRelatedTo(source.constraint, target.constraint, 3 /* RecursionFlags.Both */, /*reportErrors*/ false)) { + return result; + } + } } if (!(sourceFlags & 524288 /* TypeFlags.Object */)) { return 0 /* Ternary.False */; @@ -66930,11 +67522,11 @@ var ts; // constituents of 'target'. If any combination does not have a match then 'source' is not relatable. var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes); var matchingTypes = []; - var _loop_21 = function (combination) { + var _loop_22 = function (combination) { var hasMatch = false; outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) { var type = _d[_c]; - var _loop_22 = function (i) { + var _loop_23 = function (i) { var sourceProperty = sourcePropertiesFiltered[i]; var targetProperty = getPropertyOfType(type, sourceProperty.escapedName); if (!targetProperty) @@ -66950,8 +67542,8 @@ var ts; } }; for (var i = 0; i < sourcePropertiesFiltered.length; i++) { - var state_8 = _loop_22(i); - switch (state_8) { + var state_9 = _loop_23(i); + switch (state_9) { case "continue-outer": continue outer; } } @@ -66964,9 +67556,9 @@ var ts; }; for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) { var combination = discriminantCombinations_1[_a]; - var state_7 = _loop_21(combination); - if (typeof state_7 === "object") - return state_7.value; + var state_8 = _loop_22(combination); + if (typeof state_8 === "object") + return state_8.value; } // Compare the remaining non-discriminant properties of each match. var result = -1 /* Ternary.True */; @@ -67101,7 +67693,7 @@ var ts; shouldSkipElaboration = true; // Retain top-level error for interface implementing issues, otherwise omit it } if (props.length === 1) { - var propName = symbolToString(unmatchedProperty); + var propName = symbolToString(unmatchedProperty, /*enclosingDeclaration*/ undefined, 0 /* SymbolFlags.None */, 4 /* SymbolFormatFlags.AllowAnyNodeKind */ | 16 /* SymbolFormatFlags.WriteComputedProps */); reportError.apply(void 0, __spreadArray([ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName], getTypeNamesForErrorDisplay(source, target), false)); if (ts.length(unmatchedProperty.declarations)) { associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName)); @@ -67350,7 +67942,7 @@ var ts; var targetSignature = ts.first(targetSignatures); result = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors, incompatibleReporter(sourceSignature, targetSignature)); if (!result && reportErrors && kind === 1 /* SignatureKind.Construct */ && (sourceObjectFlags & targetObjectFlags) && - (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 171 /* SyntaxKind.Constructor */ || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 171 /* SyntaxKind.Constructor */)) { + (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 173 /* SyntaxKind.Constructor */ || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 173 /* SyntaxKind.Constructor */)) { var constructSignatureToString = function (signature) { return signatureToString(signature, /*enclosingDeclaration*/ undefined, 262144 /* TypeFormatFlags.WriteArrowStyleSignature */, kind); }; @@ -67671,7 +68263,7 @@ var ts; ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* tracing.Phase.CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) }); links.variances = ts.emptyArray; var variances = []; - var _loop_23 = function (tp) { + var _loop_24 = function (tp) { var modifiers = getVarianceModifiers(tp); var variance = modifiers & 65536 /* ModifierFlags.Out */ ? modifiers & 32768 /* ModifierFlags.In */ ? 0 /* VarianceFlags.Invariant */ : 1 /* VarianceFlags.Covariant */ : @@ -67709,7 +68301,7 @@ var ts; }; for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) { var tp = typeParameters_2[_i]; - _loop_23(tp); + _loop_24(tp); } links.variances = variances; ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) }); @@ -68115,7 +68707,7 @@ var ts; var baseTypeNode = getBaseTypeNodeOfClass(target); // A base type expression may circularly reference the class itself (e.g. as an argument to function call), so we only // check for base types specified as simple qualified names. - if (baseTypeNode && baseTypeNode.expression.kind !== 79 /* SyntaxKind.Identifier */ && baseTypeNode.expression.kind !== 206 /* SyntaxKind.PropertyAccessExpression */) { + if (baseTypeNode && baseTypeNode.expression.kind !== 79 /* SyntaxKind.Identifier */ && baseTypeNode.expression.kind !== 208 /* SyntaxKind.PropertyAccessExpression */) { return undefined; } } @@ -68206,7 +68798,7 @@ var ts; if (!isLiteralOfContextualType(type, contextualType)) { type = getWidenedUniqueESSymbolType(getWidenedLiteralType(type)); } - return type; + return getRegularTypeOfLiteralType(type); } function getWidenedLiteralLikeTypeForContextualReturnTypeIfNeeded(type, contextualSignatureReturnType, isAsync) { if (type && isUnitType(type)) { @@ -68301,7 +68893,8 @@ var ts; function getOptionalType(type, isProperty) { if (isProperty === void 0) { isProperty = false; } ts.Debug.assert(strictNullChecks); - return type.flags & 32768 /* TypeFlags.Undefined */ ? type : getUnionType([type, isProperty ? missingType : undefinedType]); + var missingOrUndefined = isProperty ? missingType : undefinedType; + return type.flags & 32768 /* TypeFlags.Undefined */ || type.flags & 1048576 /* TypeFlags.Union */ && type.types[0] === missingOrUndefined ? type : getUnionType([type, missingOrUndefined]); } function getGlobalNonNullableTypeInstantiation(type) { if (!deferredGlobalNonNullableTypeAlias) { @@ -68590,12 +69183,12 @@ var ts; } var diagnostic; switch (declaration.kind) { - case 221 /* SyntaxKind.BinaryExpression */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 223 /* SyntaxKind.BinaryExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: diagnostic = noImplicitAny ? ts.Diagnostics.Member_0_implicitly_has_an_1_type : ts.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: var param = declaration; if (ts.isIdentifier(param.name) && (ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) && @@ -68611,23 +69204,23 @@ var ts; noImplicitAny ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage : noImplicitAny ? ts.Diagnostics.Parameter_0_implicitly_has_an_1_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; if (!noImplicitAny) { // Don't issue a suggestion for binding elements since the codefix doesn't yet support them. return; } break; - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: error(declaration, ts.Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (noImplicitAny && !declaration.name) { if (wideningKind === 3 /* WideningKind.GeneratorYield */) { error(declaration, ts.Diagnostics.Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation, typeAsString); @@ -68641,7 +69234,7 @@ var ts; wideningKind === 3 /* WideningKind.GeneratorYield */ ? ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type : ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; break; - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: if (noImplicitAny) { error(declaration, ts.Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type); } @@ -68758,7 +69351,7 @@ var ts; if (context.intraExpressionInferenceSites) { for (var _i = 0, _a = context.intraExpressionInferenceSites; _i < _a.length; _i++) { var _b = _a[_i], node = _b.node, type = _b.type; - var contextualType = node.kind === 169 /* SyntaxKind.MethodDeclaration */ ? + var contextualType = node.kind === 171 /* SyntaxKind.MethodDeclaration */ ? getContextualTypeForObjectLiteralMethod(node, 2 /* ContextFlags.NoConstraints */) : getContextualType(node, 2 /* ContextFlags.NoConstraints */); if (contextualType) { @@ -68821,8 +69414,8 @@ var ts; } function isNonGenericTopLevelType(type) { if (type.aliasSymbol && !type.aliasTypeArguments) { - var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 259 /* SyntaxKind.TypeAliasDeclaration */); - return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 305 /* SyntaxKind.SourceFile */ ? true : n.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? false : "quit"; })); + var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 262 /* SyntaxKind.TypeAliasDeclaration */); + return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 308 /* SyntaxKind.SourceFile */ ? true : n.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? false : "quit"; })); } return false; } @@ -69280,7 +69873,10 @@ var ts; // // This flag is infectious; if we produce Box (where never is silentNeverType), Box is // also non-inferrable. - if (ts.getObjectFlags(source) & 262144 /* ObjectFlags.NonInferrableType */) { + // + // As a special case, also ignore nonInferrableAnyType, which is a special form of the any type + // used as a stand-in for binding elements when they are being inferred. + if (ts.getObjectFlags(source) & 262144 /* ObjectFlags.NonInferrableType */ || source === nonInferrableAnyType) { return; } if (!inference.isFixed) { @@ -69353,7 +69949,7 @@ var ts; } else if (source.flags & 33554432 /* TypeFlags.Substitution */) { inferFromTypes(source.baseType, target); - inferWithPriority(source.substitute, target, 4 /* InferencePriority.SubstituteSource */); // Make substitute inference at a lower priority + inferWithPriority(getSubstitutionIntersection(source), target, 4 /* InferencePriority.SubstituteSource */); // Make substitute inference at a lower priority } else if (target.flags & 16777216 /* TypeFlags.Conditional */) { invokeOnce(source, target, inferToConditionalType); @@ -69663,7 +70259,7 @@ var ts; // upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might // succeed. That would be a pointless and confusing outcome. if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) { - var _loop_24 = function (i) { + var _loop_25 = function (i) { var source_1 = matches ? matches[i] : neverType; var target_3 = types[i]; // If we are inferring from a string literal type to a type variable whose constraint includes one of the @@ -69713,7 +70309,7 @@ var ts; inferFromTypes(source_1, target_3); }; for (var i = 0; i < types.length; i++) { - _loop_24(i); + _loop_25(i); } } } @@ -69835,7 +70431,7 @@ var ts; var saveBivariant = bivariant; var kind = target.declaration ? target.declaration.kind : 0 /* SyntaxKind.Unknown */; // Once we descend into a bivariant signature we remain bivariant for all nested inferences - bivariant = bivariant || kind === 169 /* SyntaxKind.MethodDeclaration */ || kind === 168 /* SyntaxKind.MethodSignature */ || kind === 171 /* SyntaxKind.Constructor */; + bivariant = bivariant || kind === 171 /* SyntaxKind.MethodDeclaration */ || kind === 170 /* SyntaxKind.MethodSignature */ || kind === 173 /* SyntaxKind.Constructor */; applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes); bivariant = saveBivariant; applyToReturnTypes(source, target, inferFromTypes); @@ -70034,7 +70630,7 @@ var ts; } // falls through default: - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer; } else { @@ -70055,7 +70651,7 @@ var ts; // TypeScript 1.0 spec (April 2014): 3.6.3 // A type query consists of the keyword typeof followed by an expression. // The expression is restricted to a single identifier or a sequence of identifiers separated by periods - return !!ts.findAncestor(node, function (n) { return n.kind === 181 /* SyntaxKind.TypeQuery */ ? true : n.kind === 79 /* SyntaxKind.Identifier */ || n.kind === 161 /* SyntaxKind.QualifiedName */ ? false : "quit"; }); + return !!ts.findAncestor(node, function (n) { return n.kind === 183 /* SyntaxKind.TypeQuery */ ? true : n.kind === 79 /* SyntaxKind.Identifier */ || n.kind === 163 /* SyntaxKind.QualifiedName */ ? false : "quit"; }); } // Return the flow cache key for a "dotted name" (i.e. a sequence of identifiers // separated by dots). The key consists of the id of the symbol referenced by the @@ -70071,26 +70667,26 @@ var ts; // falls through case 108 /* SyntaxKind.ThisKeyword */: return "0|".concat(flowContainer ? getNodeId(flowContainer) : "-1", "|").concat(getTypeId(declaredType), "|").concat(getTypeId(initialType)); - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: var left = getFlowCacheKey(node.left, declaredType, initialType, flowContainer); return left && left + "." + node.right.escapedText; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var propName = getAccessedPropertyName(node); if (propName !== undefined) { var key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); return key && key + "." + propName; } break; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: // Handle pseudo-references originating in getNarrowedTypeOfSymbol. return "".concat(getNodeId(node), "#").concat(getTypeId(declaredType)); } @@ -70098,16 +70694,16 @@ var ts; } function isMatchingReference(source, target) { switch (target.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return isMatchingReference(source, target.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (ts.isAssignmentExpression(target) && isMatchingReference(source, target.left)) || (ts.isBinaryExpression(target) && target.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && isMatchingReference(source, target.right)); } switch (source.kind) { - case 231 /* SyntaxKind.MetaProperty */: - return target.kind === 231 /* SyntaxKind.MetaProperty */ + case 233 /* SyntaxKind.MetaProperty */: + return target.kind === 233 /* SyntaxKind.MetaProperty */ && source.keywordToken === target.keywordToken && source.name.escapedText === target.name.escapedText; case 79 /* SyntaxKind.Identifier */: @@ -70115,26 +70711,26 @@ var ts; return ts.isThisInTypeQuery(source) ? target.kind === 108 /* SyntaxKind.ThisKeyword */ : target.kind === 79 /* SyntaxKind.Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 254 /* SyntaxKind.VariableDeclaration */ || target.kind === 203 /* SyntaxKind.BindingElement */) && + (target.kind === 257 /* SyntaxKind.VariableDeclaration */ || target.kind === 205 /* SyntaxKind.BindingElement */) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 108 /* SyntaxKind.ThisKeyword */: return target.kind === 108 /* SyntaxKind.ThisKeyword */; case 106 /* SyntaxKind.SuperKeyword */: return target.kind === 106 /* SyntaxKind.SuperKeyword */; - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isMatchingReference(source.expression, target); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var sourcePropertyName = getAccessedPropertyName(source); var targetPropertyName = ts.isAccessExpression(target) ? getAccessedPropertyName(target) : undefined; return sourcePropertyName !== undefined && targetPropertyName !== undefined && targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return ts.isAccessExpression(target) && source.right.escapedText === getAccessedPropertyName(target) && isMatchingReference(source.left, target.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (ts.isBinaryExpression(source) && source.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && isMatchingReference(source.right, target)); } return false; @@ -70177,7 +70773,7 @@ var ts; return name; } } - if (ts.hasOnlyExpressionInitializer(declaration)) { + if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) { var initializer = ts.getEffectiveInitializer(declaration); return initializer && tryGetNameFromType(getTypeOfExpression(initializer)); } @@ -70237,7 +70833,7 @@ var ts; function mapTypesByKeyProperty(types, name) { var map = new ts.Map(); var count = 0; - var _loop_25 = function (type) { + var _loop_26 = function (type) { if (type.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */)) { var discriminant = getTypeOfPropertyOfType(type, name); if (discriminant) { @@ -70263,9 +70859,9 @@ var ts; }; for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { var type = types_15[_i]; - var state_9 = _loop_25(type); - if (typeof state_9 === "object") - return state_9.value; + var state_10 = _loop_26(type); + if (typeof state_10 === "object") + return state_10.value; } return count >= 10 && count * 2 >= types.length ? map : undefined; } @@ -70306,7 +70902,7 @@ var ts; } function getMatchingUnionConstituentForObjectLiteral(unionType, node) { var keyPropertyName = getKeyPropertyName(unionType); - var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 296 /* SyntaxKind.PropertyAssignment */ && + var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 299 /* SyntaxKind.PropertyAssignment */ && p.symbol.escapedName === keyPropertyName && isPossiblyDiscriminantValue(p.initializer); }); var propType = propNode && getContextFreeTypeOfExpression(propNode.initializer); return propType && getConstituentTypeForKeyType(unionType, propType); @@ -70323,7 +70919,7 @@ var ts; } } } - if (expression.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + if (expression.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isOrContainsMatchingReference(reference, expression.expression.expression)) { return true; } @@ -70523,15 +71119,15 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(65 /* IterationUse.Destructuring */, type, undefinedType, /*errorNode*/ undefined) || errorType); } function getAssignedTypeOfBinaryExpression(node) { - var isDestructuringDefaultAssignment = node.parent.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || - node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); + var isDestructuringDefaultAssignment = node.parent.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || + node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } function isDestructuringAssignmentTarget(parent) { - return parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.parent.left === parent || - parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */ && parent.parent.initializer === parent; + return parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.parent.left === parent || + parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */ && parent.parent.initializer === parent; } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element)); @@ -70548,21 +71144,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return stringType; - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return checkRightHandSideOfForOf(parent) || errorType; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return getAssignedTypeOfBinaryExpression(parent); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return undefinedType; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return getAssignedTypeOfSpreadExpression(parent); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return errorType; @@ -70570,7 +71166,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ ? + var type = pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) : @@ -70588,30 +71184,30 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (node.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { return stringType; } - if (node.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { return checkRightHandSideOfForOf(node.parent.parent) || errorType; } return errorType; } function getInitialType(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function isEmptyArrayAssignment(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.initializer && + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 203 /* SyntaxKind.BindingElement */ && node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + node.kind !== 205 /* SyntaxKind.BindingElement */ && node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getReferenceCandidate(node.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (node.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: case 75 /* SyntaxKind.BarBarEqualsToken */: @@ -70626,13 +71222,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */ || - parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.left === node || - parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && parent.right === node ? + return parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || + parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.left === node || + parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { return getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); } return neverType; @@ -70651,13 +71247,13 @@ var ts; // Get the type names from all cases in a switch on `typeof`. The default clause and/or duplicate type names are // represented as undefined. Return undefined if one or more case clause expressions are not string literals. function getSwitchClauseTypeOfWitnesses(switchStatement) { - if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 289 /* SyntaxKind.CaseClause */ && !ts.isStringLiteralLike(clause.expression); })) { + if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 292 /* SyntaxKind.CaseClause */ && !ts.isStringLiteralLike(clause.expression); })) { return undefined; } var witnesses = []; for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) { var clause = _a[_i]; - var text = clause.kind === 289 /* SyntaxKind.CaseClause */ ? clause.expression.text : undefined; + var text = clause.kind === 292 /* SyntaxKind.CaseClause */ ? clause.expression.text : undefined; witnesses.push(text && !ts.contains(witnesses, text) ? text : undefined); } return witnesses; @@ -70844,12 +71440,12 @@ var ts; var root = getReferenceRoot(node); var parent = root.parent; var isLengthPushOrUnshift = ts.isPropertyAccessExpression(parent) && (parent.name.escapedText === "length" || - parent.parent.kind === 208 /* SyntaxKind.CallExpression */ + parent.parent.kind === 210 /* SyntaxKind.CallExpression */ && ts.isIdentifier(parent.name) && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && + var isElementAssignment = parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && parent.expression === root && - parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -70877,7 +71473,7 @@ var ts; if (isDeclarationWithExplicitTypeAnnotation(declaration)) { return getTypeOfSymbol(symbol); } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { var statement = declaration.parent.parent; var expressionType = getTypeOfDottedName(statement.expression, /*diagnostic*/ undefined); if (expressionType) { @@ -70905,7 +71501,7 @@ var ts; return getExplicitThisType(node); case 106 /* SyntaxKind.SuperKeyword */: return checkSuperExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: { + case 208 /* SyntaxKind.PropertyAccessExpression */: { var type = getTypeOfDottedName(node.expression, diagnostic); if (type) { var name = node.name; @@ -70923,7 +71519,7 @@ var ts; } return undefined; } - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getTypeOfDottedName(node.expression, diagnostic); } } @@ -70937,7 +71533,7 @@ var ts; // circularities in control flow analysis, we use getTypeOfDottedName when resolving the call // target expression of an assertion. var funcType = void 0; - if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */) { + if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */) { funcType = getTypeOfDottedName(node.expression, /*diagnostic*/ undefined); } else if (node.expression.kind !== 106 /* SyntaxKind.SuperKeyword */) { @@ -70981,7 +71577,7 @@ var ts; } function isFalseExpression(expr) { var node = ts.skipParentheses(expr, /*excludeJSDocTypeAssertions*/ true); - return node.kind === 95 /* SyntaxKind.FalseKeyword */ || node.kind === 221 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ && (isFalseExpression(node.left) || isFalseExpression(node.right)) || + return node.kind === 95 /* SyntaxKind.FalseKeyword */ || node.kind === 223 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ && (isFalseExpression(node.left) || isFalseExpression(node.right)) || node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ && isFalseExpression(node.left) && isFalseExpression(node.right)); } function isReachableFlowNodeWorker(flow, noCacheCheck) { @@ -71102,8 +71698,8 @@ var ts; var symbol = getResolvedSymbol(node); return isConstVariable(symbol) || ts.isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol); } - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // The resolvedSymbol property is initialized by checkPropertyAccess or checkElementAccess before we get here. return isConstantReference(node.expression) && isReadonlySymbol(getNodeLinks(node).resolvedSymbol || unknownSymbol); } @@ -71130,7 +71726,7 @@ var ts; // on empty arrays are possible without implicit any errors and new element types can be inferred without // type mismatch errors. var resultType = ts.getObjectFlags(evolvedType) & 256 /* ObjectFlags.EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType); - if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 230 /* SyntaxKind.NonNullExpression */ && !(resultType.flags & 131072 /* TypeFlags.Never */) && getTypeWithFacts(resultType, 2097152 /* TypeFacts.NEUndefinedOrNull */).flags & 131072 /* TypeFlags.Never */) { + if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 232 /* SyntaxKind.NonNullExpression */ && !(resultType.flags & 131072 /* TypeFlags.Never */) && getTypeWithFacts(resultType, 2097152 /* TypeFacts.NEUndefinedOrNull */).flags & 131072 /* TypeFlags.Never */) { return declaredType; } // The non-null unknown type should never escape control flow analysis. @@ -71215,8 +71811,8 @@ var ts; // Check if we should continue with the control flow of the containing function. var container = flow.node; if (container && container !== flowContainer && - reference.kind !== 206 /* SyntaxKind.PropertyAccessExpression */ && - reference.kind !== 207 /* SyntaxKind.ElementAccessExpression */ && + reference.kind !== 208 /* SyntaxKind.PropertyAccessExpression */ && + reference.kind !== 209 /* SyntaxKind.ElementAccessExpression */ && reference.kind !== 108 /* SyntaxKind.ThisKeyword */) { flow = container.flowNode; continue; @@ -71241,7 +71837,7 @@ var ts; } function getInitialOrAssignedType(flow) { var node = flow.node; - return getNarrowableTypeForReference(node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */ ? + return getNarrowableTypeForReference(node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */ ? getInitialType(node) : getAssignedType(node), reference); } @@ -71281,14 +71877,14 @@ var ts; // in which case we continue control flow analysis back to the function's declaration if (ts.isVariableDeclaration(node) && (ts.isInJSFile(node) || ts.isVarConst(node))) { var init = ts.getDeclaredExpandoInitializer(node); - if (init && (init.kind === 213 /* SyntaxKind.FunctionExpression */ || init.kind === 214 /* SyntaxKind.ArrowFunction */)) { + if (init && (init.kind === 215 /* SyntaxKind.FunctionExpression */ || init.kind === 216 /* SyntaxKind.ArrowFunction */)) { return getTypeAtFlowNode(flow.antecedent); } } return declaredType; } // for (const _ in ref) acts as a nonnull on ref - if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) { + if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) { return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)))); } // Assignment doesn't affect reference @@ -71299,7 +71895,7 @@ var ts; if (node.kind === 95 /* SyntaxKind.FalseKeyword */) { return unreachableNeverType; } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */) { if (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */) { return narrowTypeByAssertion(narrowTypeByAssertion(type, node.left), node.right); } @@ -71330,7 +71926,7 @@ var ts; function getTypeAtFlowArrayMutation(flow) { if (declaredType === autoType || declaredType === autoArrayType) { var node = flow.node; - var expr = node.kind === 208 /* SyntaxKind.CallExpression */ ? + var expr = node.kind === 210 /* SyntaxKind.CallExpression */ ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -71338,7 +71934,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (ts.getObjectFlags(type) & 256 /* ObjectFlags.EvolvingArray */) { var evolvedType_1 = type; - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -71386,7 +71982,7 @@ var ts; if (isMatchingReference(reference, expr)) { type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } - else if (expr.kind === 216 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { + else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } else { @@ -71394,7 +71990,7 @@ var ts; if (optionalChainContainsReference(expr, reference)) { type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & (32768 /* TypeFlags.Undefined */ | 131072 /* TypeFlags.Never */)); }); } - else if (expr.kind === 216 /* SyntaxKind.TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { + else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & 131072 /* TypeFlags.Never */ || t.flags & 128 /* TypeFlags.StringLiteral */ && t.value === "undefined"); }); } } @@ -71622,7 +72218,7 @@ var ts; var narrowedPropType = narrowType(propType); return filterType(type, function (t) { var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName); - return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType); + return !(discriminantType.flags & 131072 /* TypeFlags.Never */) && !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType); }); } function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) { @@ -71664,18 +72260,26 @@ var ts; } function isTypePresencePossible(type, propName, assumeTrue) { var prop = getPropertyOfType(type, propName); - if (prop) { - return prop.flags & 16777216 /* SymbolFlags.Optional */ ? true : assumeTrue; - } - return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue; + return prop ? + !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue : + !!getApplicableIndexInfoForName(type, propName) || !assumeTrue; } - function narrowByInKeyword(type, name, assumeTrue) { - if (type.flags & 1048576 /* TypeFlags.Union */ - || type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type)) - || ts.isThisTypeParameter(type) - || type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) { + function narrowByInKeyword(type, nameType, assumeTrue) { + var name = getPropertyNameFromType(nameType); + var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); }); + if (isKnownProperty) { + // If the check is for a known property (i.e. a property declared in some constituent of + // the target type), we filter the target type by presence of absence of the property. return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); }); } + if (assumeTrue) { + // If the check is for an unknown property, we intersect the target type with `Record`, + // where X is the name of the property. + var recordSymbol = getGlobalRecordSymbol(); + if (recordSymbol) { + return getIntersectionType([type, getTypeAliasInstantiation(recordSymbol, [nameType, unknownType])]); + } + } return type; } function narrowTypeByBinaryExpression(type, expr, assumeTrue) { @@ -71692,10 +72296,10 @@ var ts; var operator = expr.operatorToken.kind; var left = getReferenceCandidate(expr.left); var right = getReferenceCandidate(expr.right); - if (left.kind === 216 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(right)) { + if (left.kind === 218 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(right)) { return narrowTypeByTypeof(type, left, operator, right, assumeTrue); } - if (right.kind === 216 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(left)) { + if (right.kind === 218 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(left)) { return narrowTypeByTypeof(type, right, operator, left, assumeTrue); } if (isMatchingReference(reference, left)) { @@ -71734,15 +72338,14 @@ var ts; return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue); } var target = getReferenceCandidate(expr.right); - var leftType = getTypeOfNode(expr.left); - if (leftType.flags & 128 /* TypeFlags.StringLiteral */) { - var name = ts.escapeLeadingUnderscores(leftType.value); + var leftType = getTypeOfExpression(expr.left); + if (leftType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */) { if (containsMissingType(type) && ts.isAccessExpression(reference) && isMatchingReference(reference.expression, target) && - getAccessedPropertyName(reference) === name) { + getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) { return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */); } if (isMatchingReference(reference, target)) { - return narrowByInKeyword(type, name, assumeTrue); + return narrowByInKeyword(type, leftType, assumeTrue); } } break; @@ -71804,24 +72407,11 @@ var ts; assumeTrue = !assumeTrue; } var valueType = getTypeOfExpression(value); - if (((type.flags & 2 /* TypeFlags.Unknown */) || isEmptyAnonymousObjectType(type) && !(valueType.flags & 98304 /* TypeFlags.Nullable */)) && - assumeTrue && - (operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */)) { - if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */)) { - return valueType; - } - if (valueType.flags & 524288 /* TypeFlags.Object */) { - return nonPrimitiveType; - } - if (type.flags & 2 /* TypeFlags.Unknown */) { - return type; - } - } + var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */; if (valueType.flags & 98304 /* TypeFlags.Nullable */) { if (!strictNullChecks) { return type; } - var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */; var facts = doubleEquals ? assumeTrue ? 262144 /* TypeFacts.EQUndefinedOrNull */ : 2097152 /* TypeFacts.NEUndefinedOrNull */ : valueType.flags & 65536 /* TypeFlags.Null */ ? @@ -71830,10 +72420,16 @@ var ts; return getAdjustedTypeWithFacts(type, facts); } if (assumeTrue) { - var filterFn = operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? - function (t) { return areTypesComparable(t, valueType) || isCoercibleUnderDoubleEquals(t, valueType); } : - function (t) { return areTypesComparable(t, valueType); }; - return replacePrimitivesWithLiterals(filterType(type, filterFn), valueType); + if (!doubleEquals && (type.flags & 2 /* TypeFlags.Unknown */ || someType(type, isEmptyAnonymousObjectType))) { + if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) { + return valueType; + } + if (valueType.flags & 524288 /* TypeFlags.Object */) { + return nonPrimitiveType; + } + } + var filteredType = filterType(type, function (t) { return areTypesComparable(t, valueType) || doubleEquals && isCoercibleUnderDoubleEquals(t, valueType); }); + return replacePrimitivesWithLiterals(filteredType, valueType); } if (isUnitType(valueType)) { return filterType(type, function (t) { return !(isUnitLikeType(t) && areTypesComparable(t, valueType)); }); @@ -71847,11 +72443,18 @@ var ts; } var target = getReferenceCandidate(typeOfExpr.expression); if (!isMatchingReference(reference, target)) { + var propertyAccess = getDiscriminantPropertyAccess(typeOfExpr.expression, type); + if (propertyAccess) { + return narrowTypeByDiscriminant(type, propertyAccess, function (t) { return narrowTypeByLiteralExpression(t, literal, assumeTrue); }); + } if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) { return getAdjustedTypeWithFacts(type, 2097152 /* TypeFacts.NEUndefinedOrNull */); } return type; } + return narrowTypeByLiteralExpression(type, literal, assumeTrue); + } + function narrowTypeByLiteralExpression(type, literal, assumeTrue) { return assumeTrue ? narrowTypeByTypeName(type, literal.text) : getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768 /* TypeFacts.TypeofNEHostObject */); @@ -71937,7 +72540,7 @@ var ts; return type; } // Equal start and end denotes implicit fallthrough; undefined marks explicit default clause. - var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 290 /* SyntaxKind.DefaultClause */; }); + var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 293 /* SyntaxKind.DefaultClause */; }); var hasDefaultClause = clauseStart === clauseEnd || (defaultIndex >= clauseStart && defaultIndex < clauseEnd); if (hasDefaultClause) { // In the default clause we filter constituents down to those that are not-equal to all handled cases. @@ -72141,17 +72744,17 @@ var ts; // falls through case 108 /* SyntaxKind.ThisKeyword */: case 106 /* SyntaxKind.SuperKeyword */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return narrowTypeByCallExpression(type, expr, assumeTrue); - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return narrowType(type, expr.expression, assumeTrue); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: if (expr.operator === 53 /* SyntaxKind.ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -72200,9 +72803,9 @@ var ts; function getControlFlowContainer(node) { return ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 262 /* SyntaxKind.ModuleBlock */ || - node.kind === 305 /* SyntaxKind.SourceFile */ || - node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + node.kind === 265 /* SyntaxKind.ModuleBlock */ || + node.kind === 308 /* SyntaxKind.SourceFile */ || + node.kind === 169 /* SyntaxKind.PropertyDeclaration */; }); } // Check if a parameter or catch variable is assigned anywhere @@ -72245,7 +72848,7 @@ var ts; function removeOptionalityFromDeclaredType(declaredType, declaration) { if (pushTypeResolution(declaration.symbol, 2 /* TypeSystemPropertyName.DeclaredType */)) { var annotationIncludesUndefined = strictNullChecks && - declaration.kind === 164 /* SyntaxKind.Parameter */ && + declaration.kind === 166 /* SyntaxKind.Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* TypeFacts.IsUndefined */ && !(getTypeFacts(checkExpression(declaration.initializer)) & 16777216 /* TypeFacts.IsUndefined */); @@ -72262,10 +72865,10 @@ var ts; // In an element access obj[x], we consider obj to be in a constraint position, except when obj is of // a generic type without a nullable constraint and x is a generic type. This is because when both obj // and x are of generic types T and K, we want the resulting type to be T[K]. - return parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - parent.kind === 161 /* SyntaxKind.QualifiedName */ || - parent.kind === 208 /* SyntaxKind.CallExpression */ && parent.expression === node || - parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && parent.expression === node && + return parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + parent.kind === 163 /* SyntaxKind.QualifiedName */ || + parent.kind === 210 /* SyntaxKind.CallExpression */ && parent.expression === node || + parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && parent.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression))); } function isGenericTypeWithUnionConstraint(type) { @@ -72364,15 +72967,16 @@ var ts; // destructuring from the narrowed parent type. if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) { var parent = declaration.parent.parent; - if (parent.kind === 254 /* SyntaxKind.VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* NodeFlags.Const */ || parent.kind === 164 /* SyntaxKind.Parameter */) { + if (parent.kind === 257 /* SyntaxKind.VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* NodeFlags.Const */ || parent.kind === 166 /* SyntaxKind.Parameter */) { var links = getNodeLinks(parent); if (!(links.flags & 268435456 /* NodeCheckFlags.InCheckIdentifier */)) { links.flags |= 268435456 /* NodeCheckFlags.InCheckIdentifier */; var parentType = getTypeForBindingElementParent(parent, 0 /* CheckMode.Normal */); + var parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType); links.flags &= ~268435456 /* NodeCheckFlags.InCheckIdentifier */; - if (parentType && parentType.flags & 1048576 /* TypeFlags.Union */ && !(parent.kind === 164 /* SyntaxKind.Parameter */ && isSymbolAssigned(symbol))) { + if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* TypeFlags.Union */ && !(parent.kind === 166 /* SyntaxKind.Parameter */ && isSymbolAssigned(symbol))) { var pattern = declaration.parent; - var narrowedType = getFlowTypeOfReference(pattern, parentType, parentType, /*flowContainer*/ undefined, location.flowNode); + var narrowedType = getFlowTypeOfReference(pattern, parentTypeConstraint, parentTypeConstraint, /*flowContainer*/ undefined, location.flowNode); if (narrowedType.flags & 131072 /* TypeFlags.Never */) { return neverType; } @@ -72439,10 +73043,10 @@ var ts; } var container = ts.getContainingFunction(node); if (languageVersion < 2 /* ScriptTarget.ES2015 */) { - if (container.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (container.kind === 216 /* SyntaxKind.ArrowFunction */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } - else if (ts.hasSyntacticModifier(container, 256 /* ModifierFlags.Async */)) { + else if (ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); } } @@ -72462,7 +73066,7 @@ var ts; // Due to the emit for class decorators, any reference to the class from inside of the class body // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind // behavior of class names in ES6. - if (declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ + if (declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ && ts.nodeIsDecorated(declaration)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -72474,12 +73078,12 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration.kind === 226 /* SyntaxKind.ClassExpression */) { + else if (declaration.kind === 228 /* SyntaxKind.ClassExpression */) { // When we emit a class expression with static members that contain a reference // to the constructor in the initializer, we will need to substitute that // binding with an alias as the class name is not in scope. var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); - while (container.kind !== 305 /* SyntaxKind.SourceFile */) { + while (container.kind !== 308 /* SyntaxKind.SourceFile */) { if (container.parent === declaration) { if (ts.isPropertyDeclaration(container) && ts.isStatic(container) || ts.isClassStaticBlockDeclaration(container)) { getNodeLinks(declaration).flags |= 16777216 /* NodeCheckFlags.ClassWithConstructorReference */; @@ -72537,7 +73141,7 @@ var ts; // The declaration container is the innermost function that encloses the declaration of the variable // or parameter. The flow container is the innermost function starting with which we analyze the control // flow graph to determine the control flow based type. - var isParameter = ts.getRootDeclaration(declaration).kind === 164 /* SyntaxKind.Parameter */; + var isParameter = ts.getRootDeclaration(declaration).kind === 166 /* SyntaxKind.Parameter */; var declarationContainer = getControlFlowContainer(declaration); var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; @@ -72546,8 +73150,8 @@ var ts; // When the control flow originates in a function expression or arrow function and we are referencing // a const variable or parameter from an outer function, we extend the origin of the control flow // analysis to include the immediately enclosing function. - while (flowContainer !== declarationContainer && (flowContainer.kind === 213 /* SyntaxKind.FunctionExpression */ || - flowContainer.kind === 214 /* SyntaxKind.ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 215 /* SyntaxKind.FunctionExpression */ || + flowContainer.kind === 216 /* SyntaxKind.ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter && !isSymbolAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } @@ -72556,9 +73160,9 @@ var ts; // declaration container are the same). var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || ts.isBindingElement(declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* TypeFlags.AnyOrUnknown */ | 16384 /* TypeFlags.Void */)) !== 0 || - isInTypeQuery(node) || node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) || - node.parent.kind === 230 /* SyntaxKind.NonNullExpression */ || - declaration.kind === 254 /* SyntaxKind.VariableDeclaration */ && declaration.exclamationToken || + isInTypeQuery(node) || node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) || + node.parent.kind === 232 /* SyntaxKind.NonNullExpression */ || + declaration.kind === 257 /* SyntaxKind.VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* NodeFlags.Ambient */; var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) : type === autoType || type === autoArrayType ? undefinedType : @@ -72616,7 +73220,7 @@ var ts; (symbol.flags & (2 /* SymbolFlags.BlockScopedVariable */ | 32 /* SymbolFlags.Class */)) === 0 || !symbol.valueDeclaration || ts.isSourceFile(symbol.valueDeclaration) || - symbol.valueDeclaration.parent.kind === 292 /* SyntaxKind.CatchClause */) { + symbol.valueDeclaration.parent.kind === 295 /* SyntaxKind.CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -72631,7 +73235,7 @@ var ts; // mark iteration statement as containing block-scoped binding captured in some function var capturesBlockScopeBindingInLoopBody = true; if (ts.isForStatement(container)) { - var varDeclList = ts.getAncestor(symbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); + var varDeclList = ts.getAncestor(symbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); if (varDeclList && varDeclList.parent === container) { var part = getPartOfForStatementContainingNode(node.parent, container); if (part) { @@ -72652,7 +73256,7 @@ var ts; // mark variables that are declared in loop initializer and reassigned inside the body of ForStatement. // if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back. if (ts.isForStatement(container)) { - var varDeclList = ts.getAncestor(symbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); + var varDeclList = ts.getAncestor(symbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); if (varDeclList && varDeclList.parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 4194304 /* NodeCheckFlags.NeedsLoopOutParameter */; } @@ -72671,7 +73275,7 @@ var ts; function isAssignedInBodyOfForStatement(node, container) { // skip parenthesized nodes var current = node; - while (current.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (current.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { current = current.parent; } // check if node is used as LHS in some assignment expression @@ -72679,7 +73283,7 @@ var ts; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || current.parent.kind === 220 /* SyntaxKind.PostfixUnaryExpression */)) { + else if ((current.parent.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || current.parent.kind === 222 /* SyntaxKind.PostfixUnaryExpression */)) { var expr = current.parent; isAssigned = expr.operator === 45 /* SyntaxKind.PlusPlusToken */ || expr.operator === 46 /* SyntaxKind.MinusMinusToken */; } @@ -72692,7 +73296,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* NodeCheckFlags.LexicalThis */; - if (container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || container.kind === 171 /* SyntaxKind.Constructor */) { + if (container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || container.kind === 173 /* SyntaxKind.Constructor */) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* NodeCheckFlags.CaptureThis */; } @@ -72739,31 +73343,31 @@ var ts; // tell whether 'this' needs to be captured. var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var capturedByArrowFunction = false; - if (container.kind === 171 /* SyntaxKind.Constructor */) { + if (container.kind === 173 /* SyntaxKind.Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (container.kind === 216 /* SyntaxKind.ArrowFunction */) { container = ts.getThisContainer(container, /* includeArrowFunctions */ false); capturedByArrowFunction = true; } checkThisInStaticClassFieldInitializerInDecoratedClass(node, container); switch (container.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks } break; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -72851,7 +73455,7 @@ var ts; } function getClassNameFromPrototypeMethod(container) { // Check if it's the RHS of a x.prototype.y = function [name]() { .... } - if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && + if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && ts.isBinaryExpression(container.parent) && ts.getAssignmentDeclarationKind(container.parent) === 3 /* AssignmentDeclarationKind.PrototypeProperty */) { // Get the 'x' of 'x.prototype.y = container' @@ -72861,16 +73465,16 @@ var ts; .expression; // x } // x.prototype = { method() { } } - else if (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && - container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + else if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && + container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && ts.isBinaryExpression(container.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent) === 6 /* AssignmentDeclarationKind.Prototype */) { return container.parent.parent.left.expression; } // x.prototype = { method: function() { } } - else if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && - container.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ && - container.parent.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + else if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && + container.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ && + container.parent.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && ts.isBinaryExpression(container.parent.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent.parent) === 6 /* AssignmentDeclarationKind.Prototype */) { return container.parent.parent.parent.left.expression; @@ -72878,7 +73482,7 @@ var ts; // Object.defineProperty(x, "method", { value: function() { } }); // Object.defineProperty(x, "method", { set: (x: () => void) => void }); // Object.defineProperty(x, "method", { get: () => function() { }) }); - else if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && + else if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && ts.isPropertyAssignment(container.parent) && ts.isIdentifier(container.parent.name) && (container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") && @@ -72903,7 +73507,7 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 317 /* SyntaxKind.JSDocFunctionType */) { + if (jsdocType && jsdocType.kind === 320 /* SyntaxKind.JSDocFunctionType */) { var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && @@ -72917,16 +73521,16 @@ var ts; } } function isInConstructorArgumentInitializer(node, constructorDecl) { - return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 164 /* SyntaxKind.Parameter */ && n.parent === constructorDecl; }); + return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 166 /* SyntaxKind.Parameter */ && n.parent === constructorDecl; }); } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 208 /* SyntaxKind.CallExpression */ && node.parent.expression === node; + var isCallExpression = node.parent.kind === 210 /* SyntaxKind.CallExpression */ && node.parent.expression === node; var immediateContainer = ts.getSuperContainer(node, /*stopOnFunctions*/ true); var container = immediateContainer; var needToCaptureLexicalThis = false; // adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting if (!isCallExpression) { - while (container && container.kind === 214 /* SyntaxKind.ArrowFunction */) { + while (container && container.kind === 216 /* SyntaxKind.ArrowFunction */) { container = ts.getSuperContainer(container, /*stopOnFunctions*/ true); needToCaptureLexicalThis = languageVersion < 2 /* ScriptTarget.ES2015 */; } @@ -72939,14 +73543,14 @@ var ts; // class B { // [super.foo()]() {} // } - var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 162 /* SyntaxKind.ComputedPropertyName */; }); - if (current && current.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 164 /* SyntaxKind.ComputedPropertyName */; }); + if (current && current.kind === 164 /* SyntaxKind.ComputedPropertyName */) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } - else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -72954,7 +73558,7 @@ var ts; } return errorType; } - if (!isCallExpression && immediateContainer.kind === 171 /* SyntaxKind.Constructor */) { + if (!isCallExpression && immediateContainer.kind === 173 /* SyntaxKind.Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); } if (ts.isStatic(container) || isCallExpression) { @@ -73035,7 +73639,7 @@ var ts; // as a call expression cannot be used as the target of a destructuring assignment while a property access can. // // For element access expressions (`super[x]`), we emit a generic helper that forwards the element access in both situations. - if (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && ts.hasSyntacticModifier(container, 256 /* ModifierFlags.Async */)) { + if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) { if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */; } @@ -73049,7 +73653,7 @@ var ts; // in this case they should also use correct lexical this captureLexicalThis(node.parent, container); } - if (container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return errorType; @@ -73070,7 +73674,7 @@ var ts; if (!baseClassType) { return errorType; } - if (container.kind === 171 /* SyntaxKind.Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 173 /* SyntaxKind.Constructor */ && isInConstructorArgumentInitializer(node, container)) { // issue custom error message for super property access in constructor arguments (to be aligned with old compiler) error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return errorType; @@ -73085,7 +73689,7 @@ var ts; if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes - return container.kind === 171 /* SyntaxKind.Constructor */; + return container.kind === 173 /* SyntaxKind.Constructor */; } else { // TS 1.0 SPEC (April 2014) @@ -73093,23 +73697,23 @@ var ts; // - In a constructor, instance member function, instance member accessor, or instance member variable initializer where this references a derived class instance // - In a static member function or static member accessor // topmost container must be something that is directly nested in the class declaration\object literal expression - if (ts.isClassLike(container.parent) || container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (ts.isClassLike(container.parent) || container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { if (ts.isStatic(container)) { - return container.kind === 169 /* SyntaxKind.MethodDeclaration */ || - container.kind === 168 /* SyntaxKind.MethodSignature */ || - container.kind === 172 /* SyntaxKind.GetAccessor */ || - container.kind === 173 /* SyntaxKind.SetAccessor */ || - container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - container.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + return container.kind === 171 /* SyntaxKind.MethodDeclaration */ || + container.kind === 170 /* SyntaxKind.MethodSignature */ || + container.kind === 174 /* SyntaxKind.GetAccessor */ || + container.kind === 175 /* SyntaxKind.SetAccessor */ || + container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + container.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; } else { - return container.kind === 169 /* SyntaxKind.MethodDeclaration */ || - container.kind === 168 /* SyntaxKind.MethodSignature */ || - container.kind === 172 /* SyntaxKind.GetAccessor */ || - container.kind === 173 /* SyntaxKind.SetAccessor */ || - container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - container.kind === 166 /* SyntaxKind.PropertySignature */ || - container.kind === 171 /* SyntaxKind.Constructor */; + return container.kind === 171 /* SyntaxKind.MethodDeclaration */ || + container.kind === 170 /* SyntaxKind.MethodSignature */ || + container.kind === 174 /* SyntaxKind.GetAccessor */ || + container.kind === 175 /* SyntaxKind.SetAccessor */ || + container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + container.kind === 168 /* SyntaxKind.PropertySignature */ || + container.kind === 173 /* SyntaxKind.Constructor */; } } } @@ -73117,10 +73721,10 @@ var ts; } } function getContainingObjectLiteral(func) { - return (func.kind === 169 /* SyntaxKind.MethodDeclaration */ || - func.kind === 172 /* SyntaxKind.GetAccessor */ || - func.kind === 173 /* SyntaxKind.SetAccessor */) && func.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ ? func.parent : - func.kind === 213 /* SyntaxKind.FunctionExpression */ && func.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ ? func.parent.parent : + return (func.kind === 171 /* SyntaxKind.MethodDeclaration */ || + func.kind === 174 /* SyntaxKind.GetAccessor */ || + func.kind === 175 /* SyntaxKind.SetAccessor */) && func.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ ? func.parent : + func.kind === 215 /* SyntaxKind.FunctionExpression */ && func.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ ? func.parent.parent : undefined; } function getThisTypeArgument(type) { @@ -73132,7 +73736,7 @@ var ts; }); } function getContextualThisParameterType(func) { - if (func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 216 /* SyntaxKind.ArrowFunction */) { return undefined; } if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { @@ -73159,7 +73763,7 @@ var ts; if (thisType) { return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral))); } - if (literal.parent.kind !== 296 /* SyntaxKind.PropertyAssignment */) { + if (literal.parent.kind !== 299 /* SyntaxKind.PropertyAssignment */) { break; } literal = literal.parent.parent; @@ -73173,7 +73777,7 @@ var ts; // In an assignment of the form 'obj.xxx = function(...)' or 'obj[xxx] = function(...)', the // contextual type for 'this' is 'obj'. var parent = ts.walkUpParenthesizedExpressions(func.parent); - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { var target = parent.left; if (ts.isAccessExpression(target)) { var expression = target.expression; @@ -73226,11 +73830,11 @@ var ts; return getTypeFromTypeNode(typeNode); } switch (declaration.kind) { - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return getContextuallyTypedParameterType(declaration); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getContextualTypeForBindingElement(declaration, contextFlags); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (ts.isStatic(declaration)) { return getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags); } @@ -73241,10 +73845,10 @@ var ts; var parent = declaration.parent.parent; var name = declaration.propertyName || declaration.name; var parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || - parent.kind !== 203 /* SyntaxKind.BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* CheckMode.RestBindingElement */ : 0 /* CheckMode.Normal */); + parent.kind !== 205 /* SyntaxKind.BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* CheckMode.RestBindingElement */ : 0 /* CheckMode.Normal */); if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name)) return undefined; - if (parent.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */) { + if (parent.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */) { var index = ts.indexOfNode(declaration.parent.elements, declaration); if (index < 0) return undefined; @@ -73401,7 +74005,7 @@ var ts; getTypeAtPosition(signature, argIndex); } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (template.parent.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -73520,9 +74124,11 @@ var ts; case 1 /* AssignmentDeclarationKind.ExportsProperty */: case 6 /* AssignmentDeclarationKind.Prototype */: case 3 /* AssignmentDeclarationKind.PrototypeProperty */: - var valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; - // falls through case 2 /* AssignmentDeclarationKind.ModuleExports */: + var valueDeclaration = void 0; + if (kind !== 2 /* AssignmentDeclarationKind.ModuleExports */) { + valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; + } valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration); var annotated = valueDeclaration && ts.getEffectiveTypeAnnotationNode(valueDeclaration); return annotated ? getTypeFromTypeNode(annotated) : undefined; @@ -73699,21 +74305,21 @@ var ts; case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 79 /* SyntaxKind.Identifier */: - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: return true; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isPossiblyDiscriminantValue(node.expression); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return !node.expression || isPossiblyDiscriminantValue(node.expression); } return false; } function discriminateContextualTypeByObjectMembers(node, contextualType) { - return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 296 /* SyntaxKind.PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); + return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 299 /* SyntaxKind.PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); } function discriminateContextualTypeByJSXAttributes(node, contextualType) { - return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 285 /* SyntaxKind.JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); + return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 288 /* SyntaxKind.JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); } // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily // be "pushed" onto a node using the contextualType property. @@ -73796,60 +74402,62 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 205 /* SyntaxKind.BindingElement */: return getContextualTypeForInitializerExpression(node, contextFlags); - case 214 /* SyntaxKind.ArrowFunction */: - case 247 /* SyntaxKind.ReturnStatement */: + case 216 /* SyntaxKind.ArrowFunction */: + case 250 /* SyntaxKind.ReturnStatement */: return getContextualTypeForReturnExpression(node, contextFlags); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return getContextualTypeForYieldOperand(parent, contextFlags); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return getContextualTypeForAwaitOperand(parent, contextFlags); - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return getContextualTypeForArgument(parent, node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return ts.isConstTypeReference(parent.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(parent.type); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return getContextualTypeForBinaryOperand(node, contextFlags); - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent, contextFlags); - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return getContextualType(parent.parent, contextFlags); - case 204 /* SyntaxKind.ArrayLiteralExpression */: { + case 206 /* SyntaxKind.ArrayLiteralExpression */: { var arrayLiteral = parent; var type = getApparentTypeOfContextualType(arrayLiteral, contextFlags); return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node)); } - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return getContextualTypeForConditionalOperand(node, contextFlags); - case 233 /* SyntaxKind.TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 223 /* SyntaxKind.TemplateExpression */); + case 236 /* SyntaxKind.TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 225 /* SyntaxKind.TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 212 /* SyntaxKind.ParenthesizedExpression */: { + case 214 /* SyntaxKind.ParenthesizedExpression */: { // Like in `checkParenthesizedExpression`, an `/** @type {xyz} */` comment before a parenthesized expression acts as a type cast. var tag = ts.isInJSFile(parent) ? ts.getJSDocTypeTag(parent) : undefined; return !tag ? getContextualType(parent, contextFlags) : ts.isJSDocTypeTag(tag) && ts.isConstTypeReference(tag.typeExpression.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(tag.typeExpression.type); } - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return getContextualType(parent, contextFlags); - case 271 /* SyntaxKind.ExportAssignment */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return getTypeFromTypeNode(parent.type); + case 274 /* SyntaxKind.ExportAssignment */: return tryGetTypeFromEffectiveTypeNode(parent); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return getContextualTypeForJsxExpression(parent, contextFlags); - case 285 /* SyntaxKind.JsxAttribute */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent, contextFlags); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return getContextualJsxElementAttributesType(parent, contextFlags); } return undefined; @@ -73975,9 +74583,16 @@ var ts; if (!isErrorType(intrinsicClassAttribs)) { var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); var hostClassType = getReturnTypeOfSignature(sig); - apparentAttributesType = intersectTypes(typeParams - ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context))) - : intrinsicClassAttribs, apparentAttributesType); + var libraryManagedAttributeType = void 0; + if (typeParams) { + // apply JSX.IntrinsicClassElements + var inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context)); + libraryManagedAttributeType = instantiateType(intrinsicClassAttribs, createTypeMapper(typeParams, inferredArgs)); + } + // or JSX.IntrinsicClassElements has no generics. + else + libraryManagedAttributeType = intrinsicClassAttribs; + apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType); } var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); if (!isErrorType(intrinsicAttribs)) { @@ -74100,7 +74715,7 @@ var ts; // all identical ignoring their return type, the result is same signature but with return type as // union type of return types from these signatures function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var typeTagSignature = getSignatureOfTypeTag(node); if (typeTagSignature) { return typeTagSignature; @@ -74148,8 +74763,8 @@ var ts; return node.isSpread ? getIndexedAccessType(node.type, numberType) : node.type; } function hasDefaultValue(node) { - return (node.kind === 203 /* SyntaxKind.BindingElement */ && !!node.initializer) || - (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */); + return (node.kind === 205 /* SyntaxKind.BindingElement */ && !!node.initializer) || + (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */); } function checkArrayLiteral(node, checkMode, forceTuple) { var elements = node.elements; @@ -74162,7 +74777,7 @@ var ts; var hasOmittedExpression = false; for (var i = 0; i < elementCount; i++) { var e = elements[i]; - if (e.kind === 225 /* SyntaxKind.SpreadElement */) { + if (e.kind === 227 /* SyntaxKind.SpreadElement */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { checkExternalEmitHelpers(e, compilerOptions.downlevelIteration ? 1536 /* ExternalEmitHelpers.SpreadIncludes */ : 1024 /* ExternalEmitHelpers.SpreadArray */); } @@ -74195,7 +74810,7 @@ var ts; elementFlags.push(4 /* ElementFlags.Rest */); } } - else if (exactOptionalPropertyTypes && e.kind === 227 /* SyntaxKind.OmittedExpression */) { + else if (exactOptionalPropertyTypes && e.kind === 229 /* SyntaxKind.OmittedExpression */) { hasOmittedExpression = true; elementTypes.push(missingType); elementFlags.push(2 /* ElementFlags.Optional */); @@ -74235,7 +74850,7 @@ var ts; } function isNumericName(name) { switch (name.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return isNumericComputedName(name); case 79 /* SyntaxKind.Identifier */: return ts.isNumericLiteralName(name.escapedText); @@ -74256,7 +74871,7 @@ var ts; if (!links.resolvedType) { if ((ts.isTypeLiteralNode(node.parent.parent) || ts.isClassLike(node.parent.parent) || ts.isInterfaceDeclaration(node.parent.parent)) && ts.isBinaryExpression(node.expression) && node.expression.operatorToken.kind === 101 /* SyntaxKind.InKeyword */ - && node.parent.kind !== 172 /* SyntaxKind.GetAccessor */ && node.parent.kind !== 173 /* SyntaxKind.SetAccessor */) { + && node.parent.kind !== 174 /* SyntaxKind.GetAccessor */ && node.parent.kind !== 175 /* SyntaxKind.SetAccessor */) { return links.resolvedType = errorType; } links.resolvedType = checkExpression(node.expression); @@ -74329,7 +74944,7 @@ var ts; var spread = emptyObjectType; var contextualType = getApparentTypeOfContextualType(node, /*contextFlags*/ undefined); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ || contextualType.pattern.kind === 205 /* SyntaxKind.ObjectLiteralExpression */); + (contextualType.pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ || contextualType.pattern.kind === 207 /* SyntaxKind.ObjectLiteralExpression */); var inConstContext = isConstContext(node); var checkFlags = inConstContext ? 8 /* CheckFlags.Readonly */ : 0; var isInJavascript = ts.isInJSFile(node) && !ts.isInJsonFile(node); @@ -74353,16 +74968,16 @@ var ts; for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var memberDecl = _c[_b]; var member = getSymbolOfNode(memberDecl); - var computedNameType = memberDecl.name && memberDecl.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? + var computedNameType = memberDecl.name && memberDecl.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : undefined; - if (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ || - memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ || + if (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ || + memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { - var type = memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : + var type = memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : // avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring // for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`. // we don't want to say "could not find 'a'". - memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : + memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode); if (isInJavascript) { var jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl); @@ -74385,8 +75000,8 @@ var ts; if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. - var isOptional = (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 16777216 /* SymbolFlags.Optional */; } @@ -74412,14 +75027,14 @@ var ts; member = prop; allPropertiesTable === null || allPropertiesTable === void 0 ? void 0 : allPropertiesTable.set(prop.escapedName, prop); if (contextualType && checkMode && checkMode & 2 /* CheckMode.Inferential */ && !(checkMode & 4 /* CheckMode.SkipContextSensitive */) && - (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ || memberDecl.kind === 169 /* SyntaxKind.MethodDeclaration */) && isContextSensitive(memberDecl)) { + (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ || memberDecl.kind === 171 /* SyntaxKind.MethodDeclaration */) && isContextSensitive(memberDecl)) { var inferenceContext = getInferenceContext(node); ts.Debug.assert(inferenceContext); // In CheckMode.Inferential we should always have an inference context - var inferenceNode = memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ ? memberDecl.initializer : memberDecl; + var inferenceNode = memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ ? memberDecl.initializer : memberDecl; addIntraExpressionInferenceSite(inferenceContext, inferenceNode, type); } } - else if (memberDecl.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (memberDecl.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { checkExternalEmitHelpers(memberDecl, 2 /* ExternalEmitHelpers.Assign */); } @@ -74455,7 +75070,7 @@ var ts; // an ordinary function declaration(section 6.1) with no parameters. // A set accessor declaration is processed in the same manner // as an ordinary function declaration with a single parameter and a Void return type. - ts.Debug.assert(memberDecl.kind === 172 /* SyntaxKind.GetAccessor */ || memberDecl.kind === 173 /* SyntaxKind.SetAccessor */); + ts.Debug.assert(memberDecl.kind === 174 /* SyntaxKind.GetAccessor */ || memberDecl.kind === 175 /* SyntaxKind.SetAccessor */); checkNodeDeferred(memberDecl); } if (computedNameType && !(computedNameType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */)) { @@ -74482,16 +75097,30 @@ var ts; // If object literal is contextually typed by the implied type of a binding pattern, augment the result // type with those properties for which the binding pattern specifies a default value. // If the object literal is spread into another object literal, skip this step and let the top-level object - // literal handle it instead. - if (contextualTypeHasPattern && node.parent.kind !== 298 /* SyntaxKind.SpreadAssignment */) { - for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { - var prop = _e[_d]; - if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { - if (!(prop.flags & 16777216 /* SymbolFlags.Optional */)) { - error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + // literal handle it instead. Note that this might require full traversal to the root pattern's parent + // as it's the guaranteed to be the common ancestor of the pattern node and the current object node. + // It's not possible to check if the immediate parent node is a spread assignment + // since the type flows in non-obvious ways through conditional expressions, IIFEs and more. + if (contextualTypeHasPattern) { + var rootPatternParent_1 = ts.findAncestor(contextualType.pattern.parent, function (n) { + return n.kind === 257 /* SyntaxKind.VariableDeclaration */ || + n.kind === 223 /* SyntaxKind.BinaryExpression */ || + n.kind === 166 /* SyntaxKind.Parameter */; + }); + var spreadOrOutsideRootObject = ts.findAncestor(node, function (n) { + return n === rootPatternParent_1 || + n.kind === 301 /* SyntaxKind.SpreadAssignment */; + }); + if (spreadOrOutsideRootObject.kind !== 301 /* SyntaxKind.SpreadAssignment */) { + for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { + var prop = _e[_d]; + if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { + if (!(prop.flags & 16777216 /* SymbolFlags.Optional */)) { + error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + propertiesTable.set(prop.escapedName, prop); + propertiesArray.push(prop); } - propertiesTable.set(prop.escapedName, prop); - propertiesArray.push(prop); } } } @@ -74599,6 +75228,7 @@ var ts; */ function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) { var attributes = openingLikeElement.attributes; + var attributesType = getContextualType(attributes, 0 /* ContextFlags.None */); var allAttributesTable = strictNullChecks ? ts.createSymbolTable() : undefined; var attributesTable = ts.createSymbolTable(); var spread = emptyJsxObjectType; @@ -74626,9 +75256,15 @@ var ts; if (attributeDecl.name.escapedText === jsxChildrenPropertyName) { explicitlySpecifyChildrenAttribute = true; } + if (attributesType) { + var prop = getPropertyOfType(attributesType, member.escapedName); + if (prop && prop.declarations && isDeprecatedSymbol(prop)) { + addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText); + } + } } else { - ts.Debug.assert(attributeDecl.kind === 287 /* SyntaxKind.JsxSpreadAttribute */); + ts.Debug.assert(attributeDecl.kind === 290 /* SyntaxKind.JsxSpreadAttribute */); if (attributesTable.size > 0) { spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, /*readonly*/ false); attributesTable = ts.createSymbolTable(); @@ -74655,7 +75291,7 @@ var ts; } } // Handle children attribute - var parent = openingLikeElement.parent.kind === 278 /* SyntaxKind.JsxElement */ ? openingLikeElement.parent : undefined; + var parent = openingLikeElement.parent.kind === 281 /* SyntaxKind.JsxElement */ ? openingLikeElement.parent : undefined; // We have to check that openingElement of the parent is the one we are visiting as this may not be true for selfClosingElement if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) { var childrenTypes = checkJsxChildren(parent, checkMode); @@ -74712,7 +75348,7 @@ var ts; childrenTypes.push(stringType); } } - else if (child.kind === 288 /* SyntaxKind.JsxExpression */ && !child.expression) { + else if (child.kind === 291 /* SyntaxKind.JsxExpression */ && !child.expression) { continue; // empty jsx expressions don't *really* count as present children } else { @@ -75144,9 +75780,9 @@ var ts; function checkPropertyAccessibility(node, isSuper, writing, type, prop, reportError) { if (reportError === void 0) { reportError = true; } var errorNode = !reportError ? undefined : - node.kind === 161 /* SyntaxKind.QualifiedName */ ? node.right : - node.kind === 200 /* SyntaxKind.ImportType */ ? node : - node.kind === 203 /* SyntaxKind.BindingElement */ && node.propertyName ? node.propertyName : node.name; + node.kind === 163 /* SyntaxKind.QualifiedName */ ? node.right : + node.kind === 202 /* SyntaxKind.ImportType */ ? node : + node.kind === 205 /* SyntaxKind.BindingElement */ && node.propertyName ? node.propertyName : node.name; return checkPropertyAccessibilityAtLocation(node, isSuper, writing, type, prop, errorNode); } /** @@ -75177,7 +75813,7 @@ var ts; return false; } } - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { // A method cannot be accessed in a super property access if the method is abstract. // This error could mask a private property access error. But, a member // cannot simultaneously be private and abstract, so this will trigger an @@ -75189,7 +75825,7 @@ var ts; } } // Referencing abstract properties within their own constructors is not allowed - if ((flags & 128 /* ModifierFlags.Abstract */) && symbolHasNonMethodDeclaration(prop) && + if ((flags & 256 /* ModifierFlags.Abstract */) && symbolHasNonMethodDeclaration(prop) && (ts.isThisProperty(location) || ts.isThisInitializedObjectBindingExpression(location) || ts.isObjectBindingPattern(location.parent) && ts.isThisInitializedDeclaration(location.parent.parent))) { var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) { @@ -75283,10 +75919,27 @@ var ts; return isNullableType(type) ? getNonNullableType(type) : type; } function reportObjectPossiblyNullOrUndefinedError(node, facts) { - error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? - ts.Diagnostics.Object_is_possibly_null_or_undefined : - ts.Diagnostics.Object_is_possibly_undefined : - ts.Diagnostics.Object_is_possibly_null); + var nodeText = ts.isEntityNameExpression(node) ? ts.entityNameToString(node) : undefined; + if (node.kind === 104 /* SyntaxKind.NullKeyword */) { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "null"); + return; + } + if (nodeText !== undefined && nodeText.length < 100) { + if (ts.isIdentifier(node) && nodeText === "undefined") { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "undefined"); + return; + } + error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? + ts.Diagnostics._0_is_possibly_null_or_undefined : + ts.Diagnostics._0_is_possibly_undefined : + ts.Diagnostics._0_is_possibly_null, nodeText); + } + else { + error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + } } function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) { error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? @@ -75296,6 +75949,13 @@ var ts; } function checkNonNullTypeWithReporter(type, node, reportError) { if (strictNullChecks && type.flags & 2 /* TypeFlags.Unknown */) { + if (ts.isEntityNameExpression(node)) { + var nodeText = ts.entityNameToString(node); + if (nodeText.length < 100) { + error(node, ts.Diagnostics._0_is_of_type_unknown, nodeText); + return errorType; + } + } error(node, ts.Diagnostics.Object_is_of_type_unknown); return errorType; } @@ -75313,6 +75973,17 @@ var ts; function checkNonNullNonVoidType(type, node) { var nonNullType = checkNonNullType(type, node); if (nonNullType.flags & 16384 /* TypeFlags.Void */) { + if (ts.isEntityNameExpression(node)) { + var nodeText = ts.entityNameToString(node); + if (ts.isIdentifier(node) && nodeText === "undefined") { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, nodeText); + return nonNullType; + } + if (nodeText.length < 100) { + error(node, ts.Diagnostics._0_is_possibly_undefined, nodeText); + return nonNullType; + } + } error(node, ts.Diagnostics.Object_is_possibly_undefined); } return nonNullType; @@ -75331,7 +76002,7 @@ var ts; return checkPropertyAccessExpressionOrQualifiedName(node, node.left, leftType, node.right, checkMode); } function isMethodAccessForCall(node) { - while (node.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (node.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { node = node.parent; } return ts.isCallOrNewExpression(node.parent) && node.parent.expression === node; @@ -75471,7 +76142,7 @@ var ts; } return isErrorType(apparentType) ? errorType : apparentType; } - prop = getPropertyOfType(apparentType, right.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ node.kind === 161 /* SyntaxKind.QualifiedName */); + prop = getPropertyOfType(apparentType, right.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ node.kind === 163 /* SyntaxKind.QualifiedName */); } // In `Foo.Bar.Baz`, 'Foo' is not referenced if 'Bar' is a const enum or a module containing only const enums. // `Foo` is also not referenced in `enum FooCopy { Bar = Foo.Bar }`, because the enum member value gets inlined @@ -75481,7 +76152,7 @@ var ts; // 1. if 'isolatedModules' is enabled, because the const enum value will not be inlined, and // 2. if 'preserveConstEnums' is enabled and the expression is itself an export, e.g. `export = Foo.Bar.Baz`. if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules || - !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* SymbolFlags.EnumMember */ && node.parent.kind === 299 /* SyntaxKind.EnumMember */)) || + !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* SymbolFlags.EnumMember */ && node.parent.kind === 302 /* SyntaxKind.EnumMember */)) || ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) { markAliasReferenced(parentSymbol, node); } @@ -75583,7 +76254,7 @@ var ts; if (declaration && isPropertyWithoutInitializer(declaration)) { if (!ts.isStatic(declaration)) { var flowContainer = getControlFlowContainer(node); - if (flowContainer.kind === 171 /* SyntaxKind.Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { + if (flowContainer.kind === 173 /* SyntaxKind.Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { assumeUninitialized = true; } } @@ -75618,8 +76289,8 @@ var ts; && (compilerOptions.useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) { diagnosticMessage = error(right, ts.Diagnostics.Property_0_is_used_before_its_initialization, declarationName); } - else if (valueDeclaration.kind === 257 /* SyntaxKind.ClassDeclaration */ && - node.parent.kind !== 178 /* SyntaxKind.TypeReference */ && + else if (valueDeclaration.kind === 260 /* SyntaxKind.ClassDeclaration */ && + node.parent.kind !== 180 /* SyntaxKind.TypeReference */ && !(valueDeclaration.flags & 16777216 /* NodeFlags.Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) { diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName); @@ -75631,25 +76302,25 @@ var ts; function isInPropertyInitializerOrClassStaticBlock(node) { return !!ts.findAncestor(node, function (node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 296 /* SyntaxKind.PropertyAssignment */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 298 /* SyntaxKind.SpreadAssignment */: - case 162 /* SyntaxKind.ComputedPropertyName */: - case 233 /* SyntaxKind.TemplateSpan */: - case 288 /* SyntaxKind.JsxExpression */: - case 285 /* SyntaxKind.JsxAttribute */: - case 286 /* SyntaxKind.JsxAttributes */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 291 /* SyntaxKind.HeritageClause */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 301 /* SyntaxKind.SpreadAssignment */: + case 164 /* SyntaxKind.ComputedPropertyName */: + case 236 /* SyntaxKind.TemplateSpan */: + case 291 /* SyntaxKind.JsxExpression */: + case 288 /* SyntaxKind.JsxAttribute */: + case 289 /* SyntaxKind.JsxAttributes */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 294 /* SyntaxKind.HeritageClause */: return false; - case 214 /* SyntaxKind.ArrowFunction */: - case 238 /* SyntaxKind.ExpressionStatement */: + case 216 /* SyntaxKind.ArrowFunction */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.isBlock(node.parent) && ts.isClassStaticBlockDeclaration(node.parent.parent) ? true : "quit"; default: return ts.isExpressionNode(node) ? false : "quit"; @@ -75844,7 +76515,6 @@ var ts; } return false; } - ; var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get"; if (!hasProp(suggestedMethod)) { return undefined; @@ -75924,11 +76594,11 @@ var ts; } function isValidPropertyAccess(node, propertyName) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return isValidPropertyAccessWithType(node, node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, propertyName, getWidenedType(checkExpression(node.expression))); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getWidenedType(checkExpression(node.left))); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getTypeFromTypeNode(node)); } } @@ -75943,7 +76613,7 @@ var ts; * @param property the accessed property's symbol. */ function isValidPropertyAccessForCompletions(node, type, property) { - return isPropertyAccessible(node, node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, + return isPropertyAccessible(node, node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, /* isWrite */ false, type, property); // Previously we validated the 'this' type of methods but this adversely affected performance. See #31377 for more context. } @@ -75983,7 +76653,7 @@ var ts; */ function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -76012,7 +76682,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 243 /* SyntaxKind.ForInStatement */ && + if (node.kind === 246 /* SyntaxKind.ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -76061,13 +76731,13 @@ var ts; // This gets us diagnostics for the type arguments and marks them as referenced. ts.forEach(node.typeArguments, checkSourceElement); } - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { checkExpression(node.template); } else if (ts.isJsxOpeningLikeElement(node)) { checkExpression(node.attributes); } - else if (node.kind !== 165 /* SyntaxKind.Decorator */) { + else if (node.kind !== 167 /* SyntaxKind.Decorator */) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -76131,7 +76801,7 @@ var ts; } } function isSpreadArgument(arg) { - return !!arg && (arg.kind === 225 /* SyntaxKind.SpreadElement */ || arg.kind === 232 /* SyntaxKind.SyntheticExpression */ && arg.isSpread); + return !!arg && (arg.kind === 227 /* SyntaxKind.SpreadElement */ || arg.kind === 234 /* SyntaxKind.SyntheticExpression */ && arg.isSpread); } function getSpreadArgumentIndex(args) { return ts.findIndex(args, isSpreadArgument); @@ -76148,9 +76818,9 @@ var ts; var callIsIncomplete = false; // In incomplete call we want to be lenient when we have too few arguments var effectiveParameterCount = getParameterCount(signature); var effectiveMinimumArguments = getMinArgumentCount(signature); - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { argCount = args.length; - if (node.template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (node.template.kind === 225 /* SyntaxKind.TemplateExpression */) { // If a tagged template expression lacks a tail literal, the call is incomplete. // Specifically, a template only can end in a TemplateTail or a Missing literal. var lastSpan = ts.last(node.template.templateSpans); // we should always have at least one span. @@ -76165,7 +76835,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 165 /* SyntaxKind.Decorator */) { + else if (node.kind === 167 /* SyntaxKind.Decorator */) { argCount = getDecoratorArgumentCount(node, signature); } else if (ts.isJsxOpeningLikeElement(node)) { @@ -76179,7 +76849,7 @@ var ts; } else if (!node.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(node.kind === 209 /* SyntaxKind.NewExpression */); + ts.Debug.assert(node.kind === 211 /* SyntaxKind.NewExpression */); return getMinArgumentCount(signature) === 0; } else { @@ -76282,7 +76952,7 @@ var ts; // example, given a 'function wrap(cb: (x: T) => U): (x: T) => U' and a call expression // 'let f: (x: string) => number = wrap(s => s.length)', we infer from the declared type of 'f' to the // return type of 'wrap'. - if (node.kind !== 165 /* SyntaxKind.Decorator */) { + if (node.kind !== 167 /* SyntaxKind.Decorator */) { var skipBindingPatterns = ts.every(signature.typeParameters, function (p) { return !!getDefaultFromTypeParameter(p); }); var contextualType = getContextualType(node, skipBindingPatterns ? 8 /* ContextFlags.SkipBindingPatterns */ : 0 /* ContextFlags.None */); if (contextualType) { @@ -76346,7 +77016,7 @@ var ts; } for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 227 /* SyntaxKind.OmittedExpression */ && !(checkMode & 32 /* CheckMode.IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) { + if (arg.kind !== 229 /* SyntaxKind.OmittedExpression */ && !(checkMode & 32 /* CheckMode.IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) { var paramType = getTypeAtPosition(signature, i); if (couldContainTypeVariables(paramType)) { var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode); @@ -76372,7 +77042,7 @@ var ts; if (isSpreadArgument(arg)) { // We are inferring from a spread expression in the last argument position, i.e. both the parameter // and the argument are ...x forms. - return getMutableArrayOrTupleType(arg.kind === 232 /* SyntaxKind.SyntheticExpression */ ? arg.type : + return getMutableArrayOrTupleType(arg.kind === 234 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode)); } } @@ -76382,13 +77052,13 @@ var ts; for (var i = index; i < argCount; i++) { var arg = args[i]; if (isSpreadArgument(arg)) { - var spreadType = arg.kind === 232 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpression(arg.expression); + var spreadType = arg.kind === 234 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpression(arg.expression); if (isArrayLikeType(spreadType)) { types.push(spreadType); flags.push(8 /* ElementFlags.Variadic */); } else { - types.push(checkIteratedTypeOrElementType(33 /* IterationUse.Spread */, spreadType, undefinedType, arg.kind === 225 /* SyntaxKind.SpreadElement */ ? arg.expression : arg)); + types.push(checkIteratedTypeOrElementType(33 /* IterationUse.Spread */, spreadType, undefinedType, arg.kind === 227 /* SyntaxKind.SpreadElement */ ? arg.expression : arg)); flags.push(4 /* ElementFlags.Rest */); } } @@ -76399,7 +77069,7 @@ var ts; types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType)); flags.push(1 /* ElementFlags.Required */); } - if (arg.kind === 232 /* SyntaxKind.SyntheticExpression */ && arg.tupleNameSource) { + if (arg.kind === 234 /* SyntaxKind.SyntheticExpression */ && arg.tupleNameSource) { names.push(arg.tupleNameSource); } } @@ -76543,7 +77213,7 @@ var ts; return undefined; } var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 209 /* SyntaxKind.NewExpression */) { + if (thisType && thisType !== voidType && node.kind !== 211 /* SyntaxKind.NewExpression */) { // If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType // If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible. // If the expression is a new expression, then the check is skipped. @@ -76561,7 +77231,7 @@ var ts; var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length; for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 227 /* SyntaxKind.OmittedExpression */) { + if (arg.kind !== 229 /* SyntaxKind.OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = checkExpressionWithContextualType(arg, paramType, /*inferenceContext*/ undefined, checkMode); // If one or more arguments are still excluded (as indicated by CheckMode.SkipContextSensitive), @@ -76606,8 +77276,8 @@ var ts; * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise. */ function getThisArgumentOfCall(node) { - var expression = node.kind === 208 /* SyntaxKind.CallExpression */ ? node.expression : - node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */ ? node.tag : undefined; + var expression = node.kind === 210 /* SyntaxKind.CallExpression */ ? node.expression : + node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */ ? node.tag : undefined; if (expression) { var callee = ts.skipOuterExpressions(expression); if (ts.isAccessExpression(callee)) { @@ -76625,17 +77295,17 @@ var ts; * Returns the effective arguments for an expression that works like a function invocation. */ function getEffectiveCallArguments(node) { - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { var template = node.template; var args_3 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())]; - if (template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (template.kind === 225 /* SyntaxKind.TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args_3.push(span.expression); }); } return args_3; } - if (node.kind === 165 /* SyntaxKind.Decorator */) { + if (node.kind === 167 /* SyntaxKind.Decorator */) { return getEffectiveDecoratorArguments(node); } if (ts.isJsxOpeningLikeElement(node)) { @@ -76646,10 +77316,10 @@ var ts; if (spreadIndex >= 0) { // Create synthetic arguments from spreads of tuple types. var effectiveArgs_1 = args.slice(0, spreadIndex); - var _loop_26 = function (i) { + var _loop_27 = function (i) { var arg = args[i]; // We can call checkExpressionCached because spread expressions never have a contextual type. - var spreadType = arg.kind === 225 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); + var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); if (spreadType && isTupleType(spreadType)) { ts.forEach(getTypeArguments(spreadType), function (t, i) { var _a; @@ -76663,7 +77333,7 @@ var ts; } }; for (var i = spreadIndex; i < args.length; i++) { - _loop_26(i); + _loop_27(i); } return effectiveArgs_1; } @@ -76676,30 +77346,30 @@ var ts; var parent = node.parent; var expr = node.expression; switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: // For a class decorator, the `target` is the type of the class (e.g. the // "static" or "constructor" side of the class). return [ createSyntheticExpression(expr, getTypeOfSymbol(getSymbolOfNode(parent))) ]; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // A parameter declaration decorator will have three arguments (see // `ParameterDecorator` in core.d.ts). var func = parent.parent; return [ - createSyntheticExpression(expr, parent.parent.kind === 171 /* SyntaxKind.Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), + createSyntheticExpression(expr, parent.parent.kind === 173 /* SyntaxKind.Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), createSyntheticExpression(expr, anyType), createSyntheticExpression(expr, numberType) ]; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // A method or accessor declaration decorator will have two or three arguments (see // `PropertyDecorator` and `MethodDecorator` in core.d.ts). If we are emitting decorators // for ES3, we will only pass two arguments. - var hasPropDesc = parent.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && languageVersion !== 0 /* ScriptTarget.ES3 */; + var hasPropDesc = languageVersion !== 0 /* ScriptTarget.ES3 */ && (!ts.isPropertyDeclaration(parent) || ts.hasAccessorModifier(parent)); return [ createSyntheticExpression(expr, getParentTypeOfClassElement(parent)), createSyntheticExpression(expr, getClassElementPropertyKeyType(parent)), @@ -76713,17 +77383,17 @@ var ts; */ function getDecoratorArgumentCount(node, signature) { switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return 1; - case 167 /* SyntaxKind.PropertyDeclaration */: - return 2; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + return ts.hasAccessorModifier(node.parent) ? 3 : 2; + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // For ES3 or decorators with only two parameters we supply only two arguments return languageVersion === 0 /* ScriptTarget.ES3 */ || signature.parameters.length <= 2 ? 2 : 3; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return 3; default: return ts.Debug.fail(); @@ -76865,8 +77535,8 @@ var ts; return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount); } function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags, fallbackError) { - var isTaggedTemplate = node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */; - var isDecorator = node.kind === 165 /* SyntaxKind.Decorator */; + var isTaggedTemplate = node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */; + var isDecorator = node.kind === 167 /* SyntaxKind.Decorator */; var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node); var reportErrors = !candidatesOutArray; var typeArguments; @@ -76929,7 +77599,7 @@ var ts; var result; // If we are in signature help, a trailing comma indicates that we intend to provide another argument, // so we will only accept overloads with arity at least 1 higher than the current number of provided arguments. - var signatureHelpTrailingComma = !!(checkMode & 16 /* CheckMode.IsForSignatureHelp */) && node.kind === 208 /* SyntaxKind.CallExpression */ && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = !!(checkMode & 16 /* CheckMode.IsForSignatureHelp */) && node.kind === 210 /* SyntaxKind.CallExpression */ && node.arguments.hasTrailingComma; // Section 4.12.1: // if the candidate list contains one or more signatures for which the type of each argument // expression is a subtype of each corresponding parameter type, the return type of the first @@ -76992,7 +77662,7 @@ var ts; var min_3 = Number.MAX_VALUE; var minIndex = 0; var i_1 = 0; - var _loop_27 = function (c) { + var _loop_28 = function (c) { var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); }; var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* CheckMode.Normal */, /*reportErrors*/ true, chain_2); if (diags_2) { @@ -77010,7 +77680,7 @@ var ts; }; for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) { var c = candidatesForArgumentError_1[_a]; - _loop_27(c); + _loop_28(c); } var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics); ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures"); @@ -77168,7 +77838,7 @@ var ts; } var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max; var parameters = []; - var _loop_28 = function (i) { + var _loop_29 = function (i) { var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ? i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) : i < s.parameters.length ? s.parameters[i] : undefined; }); @@ -77176,7 +77846,7 @@ var ts; parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); }))); }; for (var i = 0; i < maxNonRestParam; i++) { - _loop_28(i); + _loop_29(i); } var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; }); var flags = 0 /* SignatureFlags.None */; @@ -77418,7 +78088,7 @@ var ts; return resolveErrorCall(node); } var valueDecl = expressionType.symbol && ts.getClassLikeDeclarationOfSymbol(expressionType.symbol); - if (valueDecl && ts.hasSyntacticModifier(valueDecl, 128 /* ModifierFlags.Abstract */)) { + if (valueDecl && ts.hasSyntacticModifier(valueDecl, 256 /* ModifierFlags.Abstract */)) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_an_abstract_class); return resolveErrorCall(node); } @@ -77489,7 +78159,7 @@ var ts; var declaration = signature.declaration; var modifiers = ts.getSelectedEffectiveModifierFlags(declaration, 24 /* ModifierFlags.NonPublicAccessibilityModifier */); // (1) Public constructors and (2) constructor functions are always accessible. - if (!modifiers || declaration.kind !== 171 /* SyntaxKind.Constructor */) { + if (!modifiers || declaration.kind !== 173 /* SyntaxKind.Constructor */) { return true; } var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(declaration.parent.symbol); @@ -77633,16 +78303,16 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; default: return ts.Debug.fail(); @@ -77688,7 +78358,7 @@ var ts; // file would probably be preferable. var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 788968 /* SymbolFlags.Type */); var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 788968 /* SymbolFlags.Type */, node); - var declaration = ts.factory.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + var declaration = ts.factory.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); var parameterSymbol = createSymbol(1 /* SymbolFlags.FunctionScopedVariable */, "props"); parameterSymbol.type = result; return createSignature(declaration, @@ -77737,16 +78407,16 @@ var ts; } function resolveSignature(node, candidatesOutArray, checkMode) { switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return resolveCallExpression(node, candidatesOutArray, checkMode); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return resolveNewExpression(node, candidatesOutArray, checkMode); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return resolveDecorator(node, candidatesOutArray, checkMode); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode); } throw ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable."); @@ -77790,12 +78460,15 @@ var ts; return false; } var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node : - ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer : + (ts.isVariableDeclaration(node) || ts.isPropertyAssignment(node)) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer : undefined; if (func) { - // If the node has a @class tag, treat it like a constructor. + // If the node has a @class or @constructor tag, treat it like a constructor. if (ts.getJSDocClassTag(node)) return true; + // If the node is a property of an object literal. + if (ts.isPropertyAssignment(ts.walkUpParenthesizedExpressions(func.parent))) + return false; // If the symbol of the node has members, treat it like a constructor. var symbol = getSymbolOfNode(func); return !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.members) === null || _a === void 0 ? void 0 : _a.size); @@ -77878,7 +78551,7 @@ var ts; return false; } var parent = node.parent; - while (parent && parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (parent && parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { parent = parent.parent; } if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { @@ -77904,12 +78577,12 @@ var ts; if (node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { return voidType; } - if (node.kind === 209 /* SyntaxKind.NewExpression */) { + if (node.kind === 211 /* SyntaxKind.NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 171 /* SyntaxKind.Constructor */ && - declaration.kind !== 175 /* SyntaxKind.ConstructSignature */ && - declaration.kind !== 180 /* SyntaxKind.ConstructorType */ && + declaration.kind !== 173 /* SyntaxKind.Constructor */ && + declaration.kind !== 177 /* SyntaxKind.ConstructSignature */ && + declaration.kind !== 182 /* SyntaxKind.ConstructorType */ && !ts.isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) { // When resolved signature is a call signature (and not a construct signature) the result type is any @@ -77929,7 +78602,7 @@ var ts; if (returnType.flags & 12288 /* TypeFlags.ESSymbolLike */ && isSymbolOrSymbolForCall(node)) { return getESSymbolLikeTypeForNode(ts.walkUpParenthesizedExpressions(node.parent)); } - if (node.kind === 208 /* SyntaxKind.CallExpression */ && !node.questionDotToken && node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && + if (node.kind === 210 /* SyntaxKind.CallExpression */ && !node.questionDotToken && node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && returnType.flags & 16384 /* TypeFlags.Void */ && getTypePredicateOfSignature(signature)) { if (!ts.isDottedName(node.expression)) { error(node.expression, ts.Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name); @@ -77959,20 +78632,20 @@ var ts; function getDeprecatedSuggestionNode(node) { node = ts.skipParentheses(node); switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: - case 165 /* SyntaxKind.Decorator */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 167 /* SyntaxKind.Decorator */: + case 211 /* SyntaxKind.NewExpression */: return getDeprecatedSuggestionNode(node.expression); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return getDeprecatedSuggestionNode(node.tag); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return getDeprecatedSuggestionNode(node.tagName); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return node.argumentExpression; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.name; - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: var typeReference = node; return ts.isQualifiedName(typeReference.typeName) ? typeReference.typeName.right : typeReference; default: @@ -78043,8 +78716,8 @@ var ts; if (hasDefaultOnly && type && !isErrorType(type)) { var synthType = type; if (!synthType.defaultOnlyType) { - var type_5 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); - synthType.defaultOnlyType = type_5; + var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); + synthType.defaultOnlyType = type_4; } return synthType.defaultOnlyType; } @@ -78087,9 +78760,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 /* SymbolFlags.Function */ - ? 256 /* SyntaxKind.FunctionDeclaration */ + ? 259 /* SyntaxKind.FunctionDeclaration */ : resolvedRequire.flags & 3 /* SymbolFlags.Variable */ - ? 254 /* SyntaxKind.VariableDeclaration */ + ? 257 /* SyntaxKind.VariableDeclaration */ : 0 /* SyntaxKind.Unknown */; if (targetDeclarationKind !== 0 /* SyntaxKind.Unknown */) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -78109,7 +78782,7 @@ var ts; return getReturnTypeOfSignature(signature); } function checkAssertion(node) { - if (node.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (node.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { var file = ts.getSourceFileOfNode(node); if (file && ts.fileExtensionIsOneOf(file.fileName, [".cts" /* Extension.Cts */, ".mts" /* Extension.Mts */])) { grammarErrorOnNode(node, ts.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead); @@ -78125,19 +78798,19 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 223 /* SyntaxKind.TemplateExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return true; - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isValidConstAssertionArgument(node.expression); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var op = node.operator; var arg = node.operand; return op === 40 /* SyntaxKind.MinusToken */ && (arg.kind === 8 /* SyntaxKind.NumericLiteral */ || arg.kind === 9 /* SyntaxKind.BigIntLiteral */) || op === 39 /* SyntaxKind.PlusToken */ && arg.kind === 8 /* SyntaxKind.NumericLiteral */; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = node.expression; var symbol = getTypeOfNode(expr).symbol; if (symbol && symbol.flags & 2097152 /* SymbolFlags.Alias */) { @@ -78179,7 +78852,7 @@ var ts; } function checkExpressionWithTypeArguments(node) { checkGrammarExpressionWithTypeArguments(node); - var exprType = node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ ? checkExpression(node.expression) : + var exprType = node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ ? checkExpression(node.expression) : ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName); var typeArguments = node.typeArguments; @@ -78243,6 +78916,16 @@ var ts; }); } } + function checkSatisfiesExpression(node) { + checkSourceElement(node.type); + var targetType = getTypeFromTypeNode(node.type); + if (isErrorType(targetType)) { + return targetType; + } + var exprType = checkExpression(node.expression); + checkTypeAssignableToAndOptionallyElaborate(exprType, targetType, node.type, node.expression, ts.Diagnostics.Type_0_does_not_satisfy_the_expected_type_1); + return exprType; + } function checkMetaProperty(node) { checkGrammarMetaProperty(node); if (node.keywordToken === 103 /* SyntaxKind.NewKeyword */) { @@ -78270,7 +78953,7 @@ var ts; error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); return errorType; } - else if (container.kind === 171 /* SyntaxKind.Constructor */) { + else if (container.kind === 173 /* SyntaxKind.Constructor */) { var symbol = getSymbolOfNode(container.parent); return getTypeOfSymbol(symbol); } @@ -78322,7 +79005,7 @@ var ts; } function getParameterIdentifierNameAtPosition(signature, pos) { var _a; - if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 317 /* SyntaxKind.JSDocFunctionType */) { + if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 320 /* SyntaxKind.JSDocFunctionType */) { return undefined; } var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -78354,7 +79037,7 @@ var ts; return symbol.valueDeclaration && ts.isParameter(symbol.valueDeclaration) && ts.isIdentifier(symbol.valueDeclaration.name); } function isValidDeclarationForTupleLabel(d) { - return d.kind === 197 /* SyntaxKind.NamedTupleMember */ || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name)); + return d.kind === 199 /* SyntaxKind.NamedTupleMember */ || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name)); } function getNameableDeclarationAtPosition(signature, pos) { var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -78646,7 +79329,7 @@ var ts; var yieldType; var nextType; var fallbackReturnType = voidType; - if (func.body.kind !== 235 /* SyntaxKind.Block */) { // Async or normal arrow function + if (func.body.kind !== 238 /* SyntaxKind.Block */) { // Async or normal arrow function returnType = checkExpressionCached(func.body, checkMode && checkMode & ~8 /* CheckMode.SkipGenericFunctions */); if (isAsync) { // From within an async function you can return either a non-promise value or a promise. Any @@ -78798,7 +79481,7 @@ var ts; return links.isExhaustive !== undefined ? links.isExhaustive : (links.isExhaustive = computeExhaustiveSwitchStatement(node)); } function computeExhaustiveSwitchStatement(node) { - if (node.expression.kind === 216 /* SyntaxKind.TypeOfExpression */) { + if (node.expression.kind === 218 /* SyntaxKind.TypeOfExpression */) { var witnesses = getSwitchClauseTypeOfWitnesses(node); if (!witnesses) { return false; @@ -78864,11 +79547,11 @@ var ts; } function mayReturnNever(func) { switch (func.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; - case 169 /* SyntaxKind.MethodDeclaration */: - return func.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + case 171 /* SyntaxKind.MethodDeclaration */: + return func.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; default: return false; } @@ -78894,7 +79577,7 @@ var ts; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. // also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw - if (func.kind === 168 /* SyntaxKind.MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 235 /* SyntaxKind.Block */ || !functionHasImplicitReturn(func)) { + if (func.kind === 170 /* SyntaxKind.MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 238 /* SyntaxKind.Block */ || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 512 /* NodeFlags.HasExplicitReturn */; @@ -78928,7 +79611,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); checkNodeDeferred(node); if (ts.isFunctionExpression(node)) { checkCollisionsForDeclarationName(node, node.name); @@ -78955,7 +79638,7 @@ var ts; } // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (!hasGrammarError && node.kind === 215 /* SyntaxKind.FunctionExpression */) { checkGrammarForGenerator(node); } contextuallyCheckFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -79006,7 +79689,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var functionFlags = ts.getFunctionFlags(node); var returnType = getReturnTypeFromAnnotation(node); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); @@ -79019,7 +79702,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 235 /* SyntaxKind.Block */) { + if (node.body.kind === 238 /* SyntaxKind.Block */) { checkSourceElement(node.body); } else { @@ -79109,7 +79792,7 @@ var ts; expr.expression.kind === 108 /* SyntaxKind.ThisKeyword */) { // Look for if this is the constructor for the class that `symbol` is a property of. var ctor = ts.getContainingFunction(expr); - if (!(ctor && (ctor.kind === 171 /* SyntaxKind.Constructor */ || isJSConstructor(ctor)))) { + if (!(ctor && (ctor.kind === 173 /* SyntaxKind.Constructor */ || isJSConstructor(ctor)))) { return true; } if (symbol.valueDeclaration) { @@ -79134,7 +79817,7 @@ var ts; var symbol_2 = getNodeLinks(node).resolvedSymbol; if (symbol_2.flags & 2097152 /* SymbolFlags.Alias */) { var declaration = getDeclarationOfAliasSymbol(symbol_2); - return !!declaration && declaration.kind === 268 /* SyntaxKind.NamespaceImport */; + return !!declaration && declaration.kind === 271 /* SyntaxKind.NamespaceImport */; } } } @@ -79234,7 +79917,7 @@ var ts; if (!hasParseDiagnostics(sourceFile)) { var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos); var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); - if (container && container.kind !== 171 /* SyntaxKind.Constructor */ && (ts.getFunctionFlags(container) & 2 /* FunctionFlags.Async */) === 0) { + if (container && container.kind !== 173 /* SyntaxKind.Constructor */ && (ts.getFunctionFlags(container) & 2 /* FunctionFlags.Async */) === 0) { var relatedInfo = ts.createDiagnosticForNode(container, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); ts.addRelatedInfo(diagnostic, relatedInfo); } @@ -79402,6 +80085,9 @@ var ts; } return booleanType; } + function hasEmptyObjectIntersection(type) { + return someType(type, function (t) { return t === unknownEmptyObjectType || !!(t.flags & 2097152 /* TypeFlags.Intersection */) && ts.some(t.types, isEmptyAnonymousObjectType); }); + } function checkInExpression(left, right, leftType, rightType) { if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; @@ -79418,40 +80104,20 @@ var ts; } } else { - leftType = checkNonNullType(leftType, left); - // TypeScript 1.0 spec (April 2014): 4.15.5 - // Require the left operand to be of type Any, the String primitive type, or the Number primitive type. - if (!(allTypesAssignableToKind(leftType, 402653316 /* TypeFlags.StringLike */ | 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */) || - isTypeAssignableToKind(leftType, 4194304 /* TypeFlags.Index */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */ | 262144 /* TypeFlags.TypeParameter */))) { - error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol); + // The type of the lef operand must be assignable to string, number, or symbol. + checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left); + } + // The type of the right operand must be assignable to 'object'. + if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) { + // The {} type is assignable to the object type, yet {} might represent a primitive type. Here we + // detect and error on {} that results from narrowing the unknown type, as well as intersections + // that include {} (we know that the other types in such intersections are assignable to object + // since we already checked for that). + if (hasEmptyObjectIntersection(rightType)) { + error(right, ts.Diagnostics.Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator, typeToString(rightType)); } } - rightType = checkNonNullType(rightType, right); - // TypeScript 1.0 spec (April 2014): 4.15.5 - // The in operator requires the right operand to be - // - // 1. assignable to the non-primitive type, - // 2. an unconstrained type parameter, - // 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the - // the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the - // non-primitive type, or - // 4. a type parameter whose constraint is - // i. an object type, - // ii. the non-primitive type, or - // iii. a union or intersection with at least one constituent assignable to an object or non-primitive type. - // - // The divergent behavior for type parameters and unions containing type parameters is a workaround for type - // parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance - // it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error - // unless *all* instantiations would result in an error. - // // The result is always of the Boolean primitive type. - var rightTypeConstraint = getConstraintOfType(rightType); - if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) || - rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) || - !maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) { - error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive); - } return booleanType; } function checkObjectLiteralAssignment(node, sourceType, rightIsThis) { @@ -79469,7 +80135,7 @@ var ts; if (rightIsThis === void 0) { rightIsThis = false; } var properties = node.properties; var property = properties[propertyIndex]; - if (property.kind === 296 /* SyntaxKind.PropertyAssignment */ || property.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (property.kind === 299 /* SyntaxKind.PropertyAssignment */ || property.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var name = property.name; var exprType = getLiteralTypeFromPropertyName(name); if (isTypeUsableAsPropertyName(exprType)) { @@ -79482,9 +80148,9 @@ var ts; } var elementType = getIndexedAccessType(objectLiteralType, exprType, 32 /* AccessFlags.ExpressionPosition */, name); var type = getFlowTypeOfDestructuring(property, elementType); - return checkDestructuringAssignment(property.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? property : property.initializer, type); + return checkDestructuringAssignment(property.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? property : property.initializer, type); } - else if (property.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (property.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (propertyIndex < properties.length - 1) { error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } @@ -79522,7 +80188,7 @@ var ts; var inBoundsType = compilerOptions.noUncheckedIndexedAccess ? undefined : possiblyOutOfBoundsType; for (var i = 0; i < elements.length; i++) { var type = possiblyOutOfBoundsType; - if (node.elements[i].kind === 225 /* SyntaxKind.SpreadElement */) { + if (node.elements[i].kind === 227 /* SyntaxKind.SpreadElement */) { type = inBoundsType = inBoundsType !== null && inBoundsType !== void 0 ? inBoundsType : (checkIteratedTypeOrElementType(65 /* IterationUse.Destructuring */, sourceType, undefinedType, node) || errorType); } checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, type, checkMode); @@ -79532,8 +80198,8 @@ var ts; function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 227 /* SyntaxKind.OmittedExpression */) { - if (element.kind !== 225 /* SyntaxKind.SpreadElement */) { + if (element.kind !== 229 /* SyntaxKind.OmittedExpression */) { + if (element.kind !== 227 /* SyntaxKind.SpreadElement */) { var indexType = getNumberLiteralType(elementIndex); if (isArrayLikeType(sourceType)) { // We create a synthetic expression so that getIndexedAccessType doesn't get confused @@ -79551,7 +80217,7 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 221 /* SyntaxKind.BinaryExpression */ && restExpression.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (restExpression.kind === 223 /* SyntaxKind.BinaryExpression */ && restExpression.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -79567,7 +80233,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode, rightIsThis) { var target; - if (exprOrAssignment.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { // In strict null checking mode, if a default value of a non-undefined type is specified, remove @@ -79583,7 +80249,7 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 221 /* SyntaxKind.BinaryExpression */ && target.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (target.kind === 223 /* SyntaxKind.BinaryExpression */ && target.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { checkBinaryExpression(target, checkMode); target = target.left; // A default value is specified, so remove undefined from the final type. @@ -79591,20 +80257,20 @@ var ts; sourceType = getTypeWithFacts(sourceType, 524288 /* TypeFacts.NEUndefined */); } } - if (target.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (target.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType, rightIsThis); } - if (target.kind === 204 /* SyntaxKind.ArrayLiteralExpression */) { + if (target.kind === 206 /* SyntaxKind.ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, checkMode); } return checkReferenceAssignment(target, sourceType, checkMode); } function checkReferenceAssignment(target, sourceType, checkMode) { var targetType = checkExpression(target, checkMode); - var error = target.parent.kind === 298 /* SyntaxKind.SpreadAssignment */ ? + var error = target.parent.kind === 301 /* SyntaxKind.SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; - var optionalError = target.parent.kind === 298 /* SyntaxKind.SpreadAssignment */ ? + var optionalError = target.parent.kind === 301 /* SyntaxKind.SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access; if (checkReferenceExpression(target, error, optionalError)) { @@ -79629,36 +80295,36 @@ var ts; case 79 /* SyntaxKind.Identifier */: case 10 /* SyntaxKind.StringLiteral */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 223 /* SyntaxKind.TemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 8 /* SyntaxKind.NumericLiteral */: case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 278 /* SyntaxKind.JsxElement */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 281 /* SyntaxKind.JsxElement */: return true; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: // Unary operators ~, !, +, and - have no side effects. // The rest do. switch (node.operator) { @@ -79670,9 +80336,9 @@ var ts; } return false; // Some forms listed here for clarity - case 217 /* SyntaxKind.VoidExpression */: // Explicit opt-out - case 211 /* SyntaxKind.TypeAssertionExpression */: // Not SEF, but can produce useful type warnings - case 229 /* SyntaxKind.AsExpression */: // Not SEF, but can produce useful type warnings + case 219 /* SyntaxKind.VoidExpression */: // Explicit opt-out + case 213 /* SyntaxKind.TypeAssertionExpression */: // Not SEF, but can produce useful type warnings + case 231 /* SyntaxKind.AsExpression */: // Not SEF, but can produce useful type warnings default: return false; } @@ -79709,7 +80375,7 @@ var ts; } checkGrammarNullishCoalesceWithLogicalExpression(node); var operator = node.operatorToken.kind; - if (operator === 63 /* SyntaxKind.EqualsToken */ && (node.left.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || node.left.kind === 204 /* SyntaxKind.ArrayLiteralExpression */)) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && (node.left.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || node.left.kind === 206 /* SyntaxKind.ArrayLiteralExpression */)) { state.skip = true; setLastResult(state, checkDestructuringAssignment(node.left, checkExpression(node.right, checkMode), checkMode, node.right.kind === 108 /* SyntaxKind.ThisKeyword */)); return state; @@ -79731,11 +80397,11 @@ var ts; if (operator === 55 /* SyntaxKind.AmpersandAmpersandToken */ || operator === 56 /* SyntaxKind.BarBarToken */ || operator === 60 /* SyntaxKind.QuestionQuestionToken */) { if (operator === 55 /* SyntaxKind.AmpersandAmpersandToken */) { var parent = node.parent; - while (parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */ + while (parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || ts.isBinaryExpression(parent) && (parent.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || parent.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */)) { parent = parent.parent; } - checkTestingKnownTruthyCallableOrAwaitableType(node.left, ts.isIfStatement(parent) ? parent.thenStatement : undefined); + checkTestingKnownTruthyCallableOrAwaitableType(node.left, leftType, ts.isIfStatement(parent) ? parent.thenStatement : undefined); } checkTruthinessOfType(leftType, node.left); } @@ -79806,7 +80472,7 @@ var ts; // expression-wide checks and does not use a work stack to fold nested binary expressions into the same callstack frame function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { var operator = operatorToken.kind; - if (operator === 63 /* SyntaxKind.EqualsToken */ && (left.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || left.kind === 204 /* SyntaxKind.ArrayLiteralExpression */)) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && (left.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || left.kind === 206 /* SyntaxKind.ArrayLiteralExpression */)) { return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 108 /* SyntaxKind.ThisKeyword */); } var leftType; @@ -79962,6 +80628,7 @@ var ts; var eqType = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */; error(errorNode, ts.Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true"); } + checkNaNEquality(errorNode, operator, left, right); reportOperatorErrorUnless(function (left, right) { return isTypeEqualityComparableTo(left, right) || isTypeEqualityComparableTo(right, left); }); return booleanType; case 102 /* SyntaxKind.InstanceOfKeyword */: @@ -80157,20 +80824,35 @@ var ts; } } function tryGiveBetterPrimaryError(errNode, maybeMissingAwait, leftStr, rightStr) { - var typeName; switch (operatorToken.kind) { case 36 /* SyntaxKind.EqualsEqualsEqualsToken */: case 34 /* SyntaxKind.EqualsEqualsToken */: - typeName = "false"; - break; case 37 /* SyntaxKind.ExclamationEqualsEqualsToken */: case 35 /* SyntaxKind.ExclamationEqualsToken */: - typeName = "true"; + return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap, leftStr, rightStr); + default: + return undefined; } - if (typeName) { - return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap, typeName, leftStr, rightStr); + } + function checkNaNEquality(errorNode, operator, left, right) { + var isLeftNaN = isGlobalNaN(ts.skipParentheses(left)); + var isRightNaN = isGlobalNaN(ts.skipParentheses(right)); + if (isLeftNaN || isRightNaN) { + var err = error(errorNode, ts.Diagnostics.This_condition_will_always_return_0, ts.tokenToString(operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? 95 /* SyntaxKind.FalseKeyword */ : 110 /* SyntaxKind.TrueKeyword */)); + if (isLeftNaN && isRightNaN) + return; + var operatorString = operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ ? ts.tokenToString(53 /* SyntaxKind.ExclamationToken */) : ""; + var location = isLeftNaN ? right : left; + var expression = ts.skipParentheses(location); + ts.addRelatedInfo(err, ts.createDiagnosticForNode(location, ts.Diagnostics.Did_you_mean_0, "".concat(operatorString, "Number.isNaN(").concat(ts.isEntityNameExpression(expression) ? ts.entityNameToString(expression) : "...", ")"))); } - return undefined; + } + function isGlobalNaN(expr) { + if (ts.isIdentifier(expr) && expr.escapedText === "NaN") { + var globalNaNSymbol = getGlobalNaNSymbol(); + return !!globalNaNSymbol && globalNaNSymbol === getResolvedSymbol(expr); + } + return false; } } function getBaseTypesIfUnrelated(leftType, rightType, isRelated) { @@ -80251,8 +80933,8 @@ var ts; } } function checkConditionalExpression(node, checkMode) { - checkTruthinessExpression(node.condition); - checkTestingKnownTruthyCallableOrAwaitableType(node.condition, node.whenTrue); + var type = checkTruthinessExpression(node.condition); + checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue); var type1 = checkExpression(node.whenTrue, checkMode); var type2 = checkExpression(node.whenFalse, checkMode); return getUnionType([type1, type2], 2 /* UnionReduction.Subtype */); @@ -80281,7 +80963,7 @@ var ts; type.flags & 58982400 /* TypeFlags.InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* TypeFlags.StringLike */)); } function getContextNode(node) { - if (node.kind === 286 /* SyntaxKind.JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) { + if (node.kind === 289 /* SyntaxKind.JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) { return node.parent.parent; // Needs to be the root JsxElement, so it encompasses the attributes _and_ the children (which are essentially part of the attributes) } return node; @@ -80335,8 +81017,8 @@ var ts; } function isTypeAssertion(node) { node = ts.skipParentheses(node, /*excludeJSDocTypeAssertions*/ true); - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */ || - node.kind === 229 /* SyntaxKind.AsExpression */ || + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */ || + node.kind === 231 /* SyntaxKind.AsExpression */ || ts.isJSDocTypeAssertion(node); } function checkDeclarationInitializer(declaration, checkMode, contextualType) { @@ -80345,7 +81027,7 @@ var ts; (contextualType ? checkExpressionWithContextualType(initializer, contextualType, /*inferenceContext*/ undefined, checkMode || 0 /* CheckMode.Normal */) : checkExpressionCached(initializer, checkMode)); - return ts.isParameter(declaration) && declaration.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && + return ts.isParameter(declaration) && declaration.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ? padTupleType(type, declaration.name) : type; } @@ -80355,7 +81037,7 @@ var ts; var elementFlags = type.target.elementFlags.slice(); for (var i = getTypeReferenceArity(type); i < patternElements.length; i++) { var e = patternElements[i]; - if (i < patternElements.length - 1 || !(e.kind === 203 /* SyntaxKind.BindingElement */ && e.dotDotDotToken)) { + if (i < patternElements.length - 1 || !(e.kind === 205 /* SyntaxKind.BindingElement */ && e.dotDotDotToken)) { elementTypes.push(!ts.isOmittedExpression(e) && hasDefaultValue(e) ? getTypeFromBindingElement(e, /*includePatternInType*/ false, /*reportErrors*/ false) : anyType); elementFlags.push(2 /* ElementFlags.Optional */); if (!ts.isOmittedExpression(e) && !hasDefaultValue(e)) { @@ -80423,7 +81105,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } return checkExpressionForMutableLocation(node.initializer, checkMode); @@ -80434,7 +81116,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -80677,11 +81359,11 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 161 /* SyntaxKind.QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || - (node.parent.kind === 181 /* SyntaxKind.TypeQuery */ && node.parent.exprName === node)) || - (node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */); // We allow reexporting const enums + var ok = (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 163 /* SyntaxKind.QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || + (node.parent.kind === 183 /* SyntaxKind.TypeQuery */ && node.parent.exprName === node)) || + (node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */); // We allow reexporting const enums if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query); } @@ -80706,9 +81388,9 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } } @@ -80739,80 +81421,82 @@ var ts; return trueType; case 95 /* SyntaxKind.FalseKeyword */: return falseType; - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return checkTemplateExpression(node); case 13 /* SyntaxKind.RegularExpressionLiteral */: return globalRegExpType; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return checkArrayLiteral(node, checkMode, forceTuple); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return checkObjectLiteral(node, checkMode); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return checkPropertyAccessExpression(node, checkMode); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return checkQualifiedName(node, checkMode); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return checkIndexedAccess(node, checkMode); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (node.expression.kind === 100 /* SyntaxKind.ImportKeyword */) { return checkImportCallExpression(node); } // falls through - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return checkCallExpression(node, checkMode); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return checkParenthesizedExpression(node, checkMode); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return checkClassExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return checkTypeOfExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return checkAssertion(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return checkNonNullAssertion(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return checkExpressionWithTypeArguments(node); - case 231 /* SyntaxKind.MetaProperty */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return checkSatisfiesExpression(node); + case 233 /* SyntaxKind.MetaProperty */: return checkMetaProperty(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return checkDeleteExpression(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return checkVoidExpression(node); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return checkAwaitExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return checkBinaryExpression(node, checkMode); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return checkConditionalExpression(node, checkMode); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return checkSpreadExpression(node, checkMode); - case 227 /* SyntaxKind.OmittedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: return undefinedWideningType; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return checkYieldExpression(node); - case 232 /* SyntaxKind.SyntheticExpression */: + case 234 /* SyntaxKind.SyntheticExpression */: return checkSyntheticExpression(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return checkJsxExpression(node, checkMode); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return checkJsxElement(node, checkMode); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return checkJsxSelfClosingElement(node, checkMode); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return checkJsxFragment(node); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return checkJsxAttributes(node, checkMode); - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return errorType; @@ -80871,10 +81555,10 @@ var ts; checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); if (ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */)) { - if (!(func.kind === 171 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 173 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } - if (func.kind === 171 /* SyntaxKind.Constructor */ && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { + if (func.kind === 173 /* SyntaxKind.Constructor */ && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { error(node.name, ts.Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name); } } @@ -80885,13 +81569,13 @@ var ts; if (func.parameters.indexOf(node) !== 0) { error(node, ts.Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText); } - if (func.kind === 171 /* SyntaxKind.Constructor */ || func.kind === 175 /* SyntaxKind.ConstructSignature */ || func.kind === 180 /* SyntaxKind.ConstructorType */) { + if (func.kind === 173 /* SyntaxKind.Constructor */ || func.kind === 177 /* SyntaxKind.ConstructSignature */ || func.kind === 182 /* SyntaxKind.ConstructorType */) { error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); } - if (func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 216 /* SyntaxKind.ArrowFunction */) { error(node, ts.Diagnostics.An_arrow_function_cannot_have_a_this_parameter); } - if (func.kind === 172 /* SyntaxKind.GetAccessor */ || func.kind === 173 /* SyntaxKind.SetAccessor */) { + if (func.kind === 174 /* SyntaxKind.GetAccessor */ || func.kind === 175 /* SyntaxKind.SetAccessor */) { error(node, ts.Diagnostics.get_and_set_accessors_cannot_declare_this_parameters); } } @@ -80949,13 +81633,13 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 174 /* SyntaxKind.CallSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 179 /* SyntaxKind.FunctionType */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 181 /* SyntaxKind.FunctionType */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: var parent = node.parent; if (node === parent.type) { return parent; @@ -80973,7 +81657,7 @@ var ts; error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ || name.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + else if (name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ || name.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } @@ -80982,13 +81666,13 @@ var ts; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 176 /* SyntaxKind.IndexSignature */) { + if (node.kind === 178 /* SyntaxKind.IndexSignature */) { checkGrammarIndexSignature(node); } // TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled - else if (node.kind === 179 /* SyntaxKind.FunctionType */ || node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 180 /* SyntaxKind.ConstructorType */ || - node.kind === 174 /* SyntaxKind.CallSignature */ || node.kind === 171 /* SyntaxKind.Constructor */ || - node.kind === 175 /* SyntaxKind.ConstructSignature */) { + else if (node.kind === 181 /* SyntaxKind.FunctionType */ || node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 182 /* SyntaxKind.ConstructorType */ || + node.kind === 176 /* SyntaxKind.CallSignature */ || node.kind === 173 /* SyntaxKind.Constructor */ || + node.kind === 177 /* SyntaxKind.ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } var functionFlags = ts.getFunctionFlags(node); @@ -81020,10 +81704,10 @@ var ts; var returnTypeNode = ts.getEffectiveReturnTypeNode(node); if (noImplicitAny && !returnTypeNode) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -81053,7 +81737,7 @@ var ts; checkAsyncFunctionReturnType(node, returnTypeNode); } } - if (node.kind !== 176 /* SyntaxKind.IndexSignature */ && node.kind !== 317 /* SyntaxKind.JSDocFunctionType */) { + if (node.kind !== 178 /* SyntaxKind.IndexSignature */ && node.kind !== 320 /* SyntaxKind.JSDocFunctionType */) { registerForUnusedIdentifiersCheck(node); } } @@ -81065,7 +81749,7 @@ var ts; var privateIdentifiers = new ts.Map(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 171 /* SyntaxKind.Constructor */) { + if (member.kind === 173 /* SyntaxKind.Constructor */) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; if (ts.isParameterPropertyDeclaration(param, member) && !ts.isBindingPattern(param.name)) { @@ -81087,16 +81771,16 @@ var ts; var memberName = name && ts.getPropertyNameForPropertyNameNode(name); if (memberName) { switch (member.kind) { - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: addName(names, name, memberName, 1 /* DeclarationMeaning.GetAccessor */ | privateStaticFlags); break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: addName(names, name, memberName, 2 /* DeclarationMeaning.SetAccessor */ | privateStaticFlags); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: addName(names, name, memberName, 3 /* DeclarationMeaning.GetOrSetAccessor */ | privateStaticFlags); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: addName(names, name, memberName, 8 /* DeclarationMeaning.Method */ | privateStaticFlags); break; } @@ -81168,7 +81852,7 @@ var ts; var names = new ts.Map(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 166 /* SyntaxKind.PropertySignature */) { + if (member.kind === 168 /* SyntaxKind.PropertySignature */) { var memberName = void 0; var name = member.name; switch (name.kind) { @@ -81193,7 +81877,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); // in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration // to prevent this run check only for the first declaration of a given kind @@ -81207,7 +81891,7 @@ var ts; var indexSymbol = getIndexSymbol(getSymbolOfNode(node)); if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) { var indexSignatureMap_1 = new ts.Map(); - var _loop_29 = function (declaration) { + var _loop_30 = function (declaration) { if (declaration.parameters.length === 1 && declaration.parameters[0].type) { forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) { var entry = indexSignatureMap_1.get(getTypeId(type)); @@ -81222,7 +81906,7 @@ var ts; }; for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - _loop_29(declaration); + _loop_30(declaration); } indexSignatureMap_1.forEach(function (entry) { if (entry.declarations.length > 1) { @@ -81241,7 +81925,7 @@ var ts; checkVariableLikeDeclaration(node); setNodeLinksForPrivateIdentifierScope(node); // property signatures already report "initializer not allowed in ambient context" elsewhere - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */) && node.kind === 167 /* SyntaxKind.PropertyDeclaration */ && node.initializer) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */) && node.kind === 169 /* SyntaxKind.PropertyDeclaration */ && node.initializer) { error(node, ts.Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } } @@ -81261,7 +81945,7 @@ var ts; // Grammar checking for modifiers is done inside the function checkGrammarFunctionLikeDeclaration checkFunctionOrMethodDeclaration(node); // method signatures already report "implementation not allowed in ambient context" elsewhere - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */) && node.kind === 169 /* SyntaxKind.MethodDeclaration */ && node.body) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */) && node.kind === 171 /* SyntaxKind.MethodDeclaration */ && node.body) { error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } // Private named methods are only allowed in class declarations @@ -81314,7 +81998,7 @@ var ts; if (ts.isPrivateIdentifierClassElementDeclaration(n)) { return true; } - return n.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + return n.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(n) && !!n.initializer; } @@ -81397,7 +82081,7 @@ var ts; checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { if (!(node.flags & 16777216 /* NodeFlags.Ambient */) && ts.nodeIsPresent(node.body) && (node.flags & 256 /* NodeFlags.HasImplicitReturn */)) { if (!(node.flags & 512 /* NodeFlags.HasExplicitReturn */)) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); @@ -81407,20 +82091,20 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } if (hasBindableName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. var symbol = getSymbolOfNode(node); - var getter = ts.getDeclarationOfKind(symbol, 172 /* SyntaxKind.GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 174 /* SyntaxKind.GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */); if (getter && setter && !(getNodeCheckFlags(getter) & 1 /* NodeCheckFlags.TypeChecked */)) { getNodeLinks(getter).flags |= 1 /* NodeCheckFlags.TypeChecked */; var getterFlags = ts.getEffectiveModifierFlags(getter); var setterFlags = ts.getEffectiveModifierFlags(setter); - if ((getterFlags & 128 /* ModifierFlags.Abstract */) !== (setterFlags & 128 /* ModifierFlags.Abstract */)) { + if ((getterFlags & 256 /* ModifierFlags.Abstract */) !== (setterFlags & 256 /* ModifierFlags.Abstract */)) { error(getter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); error(setter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); } @@ -81437,7 +82121,7 @@ var ts; } } var returnType = getTypeOfAccessors(getSymbolOfNode(node)); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } @@ -81446,7 +82130,7 @@ var ts; checkDecorators(node); } function getEffectiveTypeArgumentAtIndex(node, typeParameters, index) { - if (index < typeParameters.length) { + if (node.typeArguments && index < node.typeArguments.length) { return getTypeFromTypeNode(node.typeArguments[index]); } return getEffectiveTypeArguments(node, typeParameters)[index]; @@ -81483,7 +82167,7 @@ var ts; } function checkTypeReferenceNode(node) { checkGrammarTypeArguments(node, node.typeArguments); - if (node.kind === 178 /* SyntaxKind.TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { grammarErrorAtPos(node, node.typeName.jsdocDotPos, 1, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); } ts.forEach(node.typeArguments, checkSourceElement); @@ -81541,7 +82225,7 @@ var ts; var hasNamedElement = ts.some(elementTypes, ts.isNamedTupleMember); for (var _i = 0, elementTypes_1 = elementTypes; _i < elementTypes_1.length; _i++) { var e = elementTypes_1[_i]; - if (e.kind !== 197 /* SyntaxKind.NamedTupleMember */ && hasNamedElement) { + if (e.kind !== 199 /* SyntaxKind.NamedTupleMember */ && hasNamedElement) { grammarErrorOnNode(e, ts.Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names); break; } @@ -81590,7 +82274,7 @@ var ts; var objectType = type.objectType; var indexType = type.indexType; if (isTypeAssignableTo(indexType, getIndexType(objectType, /*stringsOnly*/ false))) { - if (accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && + if (accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && ts.getObjectFlags(objectType) & 32 /* ObjectFlags.Mapped */ && getMappedTypeModifiers(objectType) & 1 /* MappedTypeModifiers.IncludeReadonly */) { error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); } @@ -81655,7 +82339,7 @@ var ts; ts.forEachChild(node, checkSourceElement); } function checkInferType(node) { - if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 189 /* SyntaxKind.ConditionalType */ && n.parent.extendsType === n; })) { + if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 191 /* SyntaxKind.ConditionalType */ && n.parent.extendsType === n; })) { grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type); } checkSourceElement(node.typeParameter); @@ -81665,7 +82349,7 @@ var ts; if (!links.typeParametersChecked) { links.typeParametersChecked = true; var typeParameter = getDeclaredTypeOfTypeParameter(symbol); - var declarations = ts.getDeclarationsOfKind(symbol, 163 /* SyntaxKind.TypeParameter */); + var declarations = ts.getDeclarationsOfKind(symbol, 165 /* SyntaxKind.TypeParameter */); if (!areTypeParametersIdentical(declarations, [typeParameter], function (decl) { return [decl]; })) { // Report an error on every conflicting declaration. var name = symbolToString(symbol); @@ -81706,10 +82390,10 @@ var ts; if (node.dotDotDotToken && node.questionToken) { grammarErrorOnNode(node, ts.Diagnostics.A_tuple_member_cannot_be_both_optional_and_rest); } - if (node.type.kind === 185 /* SyntaxKind.OptionalType */) { + if (node.type.kind === 187 /* SyntaxKind.OptionalType */) { grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type); } - if (node.type.kind === 186 /* SyntaxKind.RestType */) { + if (node.type.kind === 188 /* SyntaxKind.RestType */) { grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type); } checkSourceElement(node.type); @@ -81722,9 +82406,9 @@ var ts; var flags = ts.getCombinedModifierFlags(n); // children of classes (even ambient classes) should not be marked as ambient or export // because those flags have no useful semantics there. - if (n.parent.kind !== 258 /* SyntaxKind.InterfaceDeclaration */ && - n.parent.kind !== 257 /* SyntaxKind.ClassDeclaration */ && - n.parent.kind !== 226 /* SyntaxKind.ClassExpression */ && + if (n.parent.kind !== 261 /* SyntaxKind.InterfaceDeclaration */ && + n.parent.kind !== 260 /* SyntaxKind.ClassDeclaration */ && + n.parent.kind !== 228 /* SyntaxKind.ClassExpression */ && n.flags & 16777216 /* NodeFlags.Ambient */) { if (!(flags & 2 /* ModifierFlags.Ambient */) && !(ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent))) { // It is nested in an ambient context, which means it is automatically exported @@ -81764,7 +82448,7 @@ var ts; else if (deviation & (8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */)) { error(ts.getNameOfDeclaration(o) || o, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } - else if (deviation & 128 /* ModifierFlags.Abstract */) { + else if (deviation & 256 /* ModifierFlags.Abstract */) { error(ts.getNameOfDeclaration(o), ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract); } }); @@ -81781,7 +82465,7 @@ var ts; }); } } - var flagsToCheck = 1 /* ModifierFlags.Export */ | 2 /* ModifierFlags.Ambient */ | 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | 128 /* ModifierFlags.Abstract */; + var flagsToCheck = 1 /* ModifierFlags.Export */ | 2 /* ModifierFlags.Ambient */ | 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | 256 /* ModifierFlags.Abstract */; var someNodeFlags = 0 /* ModifierFlags.None */; var allNodeFlags = flagsToCheck; var someHaveQuestionToken = false; @@ -81820,7 +82504,7 @@ var ts; // Both are literal property names that are the same. ts.isPropertyNameLiteral(node.name) && ts.isPropertyNameLiteral(subsequentName) && ts.getEscapedTextOfIdentifierOrLiteral(node.name) === ts.getEscapedTextOfIdentifierOrLiteral(subsequentName))) { - var reportError = (node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 168 /* SyntaxKind.MethodSignature */) && + var reportError = (node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 170 /* SyntaxKind.MethodSignature */) && ts.isStatic(node) !== ts.isStatic(subsequentNode); // we can get here in two cases // 1. mixed static and instance class members @@ -81845,7 +82529,7 @@ var ts; else { // Report different errors regarding non-consecutive blocks of declarations depending on whether // the node in question is abstract. - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)) { error(errorNode, ts.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive); } else { @@ -81862,7 +82546,7 @@ var ts; var current = declarations_5[_i]; var node = current; var inAmbientContext = node.flags & 16777216 /* NodeFlags.Ambient */; - var inAmbientContextOrInterface = node.parent && (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || node.parent.kind === 182 /* SyntaxKind.TypeLiteral */) || inAmbientContext; + var inAmbientContextOrInterface = node.parent && (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || node.parent.kind === 184 /* SyntaxKind.TypeLiteral */) || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -81873,10 +82557,10 @@ var ts; // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one previousDeclaration = undefined; } - if ((node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */) && !inAmbientContext) { + if ((node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */) && !inAmbientContext) { hasNonAmbientClass = true; } - if (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 168 /* SyntaxKind.MethodSignature */ || node.kind === 171 /* SyntaxKind.Constructor */) { + if (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 170 /* SyntaxKind.MethodSignature */ || node.kind === 173 /* SyntaxKind.Constructor */) { functionDeclarations.push(node); var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; @@ -81921,12 +82605,12 @@ var ts; }); } if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 /* SymbolFlags.Function */ && declarations) { - var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 257 /* SyntaxKind.ClassDeclaration */; }) + var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 260 /* SyntaxKind.ClassDeclaration */; }) .map(function (d) { return ts.createDiagnosticForNode(d, ts.Diagnostics.Consider_adding_a_declare_modifier_to_this_class); }); ts.forEach(declarations, function (declaration) { - var diagnostic = declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ + var diagnostic = declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ ? ts.Diagnostics.Class_declaration_cannot_implement_overload_list_for_0 - : declaration.kind === 256 /* SyntaxKind.FunctionDeclaration */ + : declaration.kind === 259 /* SyntaxKind.FunctionDeclaration */ ? ts.Diagnostics.Function_with_bodies_can_only_merge_with_classes_that_are_ambient : undefined; if (diagnostic) { @@ -81936,7 +82620,7 @@ var ts; } // Abstract methods can't have an implementation -- in particular, they don't need one. if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && - !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 128 /* ModifierFlags.Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) { + !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 256 /* ModifierFlags.Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } if (hasOverloads) { @@ -81982,9 +82666,9 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var d = _a[_i]; var declarationSpaces = getDeclarationSpaces(d); - var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* ModifierFlags.Export */ | 512 /* ModifierFlags.Default */); + var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* ModifierFlags.Export */ | 1024 /* ModifierFlags.Default */); if (effectiveDeclarationFlags & 1 /* ModifierFlags.Export */) { - if (effectiveDeclarationFlags & 512 /* ModifierFlags.Default */) { + if (effectiveDeclarationFlags & 1024 /* ModifierFlags.Default */) { defaultExportedDeclarationSpaces |= declarationSpaces; } else { @@ -82017,26 +82701,26 @@ var ts; function getDeclarationSpaces(decl) { var d = decl; switch (d.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // A jsdoc typedef and callback are, by definition, type aliases. // falls through - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return 2 /* DeclarationSpaces.ExportType */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* ModuleInstanceState.NonInstantiated */ ? 4 /* DeclarationSpaces.ExportNamespace */ | 1 /* DeclarationSpaces.ExportValue */ : 4 /* DeclarationSpaces.ExportNamespace */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: return 2 /* DeclarationSpaces.ExportType */ | 1 /* DeclarationSpaces.ExportValue */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 2 /* DeclarationSpaces.ExportType */ | 1 /* DeclarationSpaces.ExportValue */ | 4 /* DeclarationSpaces.ExportNamespace */; - case 271 /* SyntaxKind.ExportAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: + case 274 /* SyntaxKind.ExportAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: var node_2 = d; var expression = ts.isExportAssignment(node_2) ? node_2.expression : node_2.right; // Export assigned entity name expressions act as aliases and should fall through, otherwise they export values @@ -82046,19 +82730,19 @@ var ts; d = expression; // The below options all declare an Alias, which is allowed to merge with other values within the importing module. // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 267 /* SyntaxKind.ImportClause */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: var result_12 = 0 /* DeclarationSpaces.None */; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_12 |= getDeclarationSpaces(d); }); return result_12; - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 case 79 /* SyntaxKind.Identifier */: // https://github.com/microsoft/TypeScript/issues/36098 // Identifiers are used as declarations of assignment declarations whose parents may be // SyntaxKind.CallExpression - `Object.defineProperty(thing, "aField", {value: 42});` @@ -82471,20 +83155,20 @@ var ts; var headMessage; var expectedReturnType; switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: headMessage = ts.Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any; expectedReturnType = voidType; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); @@ -82543,15 +83227,15 @@ var ts; function getEntityNameForDecoratorMetadata(node) { if (node) { switch (node.kind) { - case 188 /* SyntaxKind.IntersectionType */: - case 187 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: return getEntityNameForDecoratorMetadataFromTypeList(node.types); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]); - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: return getEntityNameForDecoratorMetadata(node.type); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; } } @@ -82560,13 +83244,13 @@ var ts; var commonEntityName; for (var _i = 0, types_21 = types; _i < types_21.length; _i++) { var typeNode = types_21[_i]; - while (typeNode.kind === 191 /* SyntaxKind.ParenthesizedType */ || typeNode.kind === 197 /* SyntaxKind.NamedTupleMember */) { + while (typeNode.kind === 193 /* SyntaxKind.ParenthesizedType */ || typeNode.kind === 199 /* SyntaxKind.NamedTupleMember */) { typeNode = typeNode.type; // Skip parens if need be } - if (typeNode.kind === 143 /* SyntaxKind.NeverKeyword */) { + if (typeNode.kind === 144 /* SyntaxKind.NeverKeyword */) { continue; // Always elide `never` from the union/intersection if possible } - if (!strictNullChecks && (typeNode.kind === 196 /* SyntaxKind.LiteralType */ && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */ || typeNode.kind === 153 /* SyntaxKind.UndefinedKeyword */)) { + if (!strictNullChecks && (typeNode.kind === 198 /* SyntaxKind.LiteralType */ && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */ || typeNode.kind === 155 /* SyntaxKind.UndefinedKeyword */)) { continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks } var individualEntityName = getEntityNameForDecoratorMetadata(typeNode); @@ -82612,14 +83296,14 @@ var ts; return; } checkExternalEmitHelpers(firstDecorator, 8 /* ExternalEmitHelpers.Decorate */); - if (node.kind === 164 /* SyntaxKind.Parameter */) { + if (node.kind === 166 /* SyntaxKind.Parameter */) { checkExternalEmitHelpers(firstDecorator, 32 /* ExternalEmitHelpers.Param */); } if (compilerOptions.emitDecoratorMetadata) { checkExternalEmitHelpers(firstDecorator, 16 /* ExternalEmitHelpers.Metadata */); // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -82628,23 +83312,23 @@ var ts; } } break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - var otherKind = node.kind === 172 /* SyntaxKind.GetAccessor */ ? 173 /* SyntaxKind.SetAccessor */ : 172 /* SyntaxKind.GetAccessor */; + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + var otherKind = node.kind === 174 /* SyntaxKind.GetAccessor */ ? 175 /* SyntaxKind.SetAccessor */ : 174 /* SyntaxKind.GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind); markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor)); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveReturnTypeNode(node)); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveTypeAnnotationNode(node)); break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); var containingSignature = node.parent; for (var _d = 0, _e = containingSignature.parameters; _d < _e.length; _d++) { @@ -82746,7 +83430,7 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.name; default: return undefined; @@ -82760,7 +83444,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name && node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name && node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -82786,7 +83470,7 @@ var ts; checkFunctionOrConstructorSymbol(symbol); } } - var body = node.kind === 168 /* SyntaxKind.MethodSignature */ ? undefined : node.body; + var body = node.kind === 170 /* SyntaxKind.MethodSignature */ ? undefined : node.body; checkSourceElement(body); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, getReturnTypeFromAnnotation(node)); addLazyDiagnostic(checkFunctionOrMethodDeclarationDiagnostics); @@ -82832,42 +83516,42 @@ var ts; for (var _i = 0, potentiallyUnusedIdentifiers_1 = potentiallyUnusedIdentifiers; _i < potentiallyUnusedIdentifiers_1.length; _i++) { var node = potentiallyUnusedIdentifiers_1[_i]; switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: checkUnusedClassMembers(node, addDiagnostic); checkUnusedTypeParameters(node, addDiagnostic); break; - case 305 /* SyntaxKind.SourceFile */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 308 /* SyntaxKind.SourceFile */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: checkUnusedLocalsAndParameters(node, addDiagnostic); break; - case 171 /* SyntaxKind.Constructor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: if (node.body) { // Don't report unused parameters in overloads checkUnusedLocalsAndParameters(node, addDiagnostic); } checkUnusedTypeParameters(node, addDiagnostic); break; - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: checkUnusedTypeParameters(node, addDiagnostic); break; - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: checkUnusedInferTypeParameter(node, addDiagnostic); break; default: @@ -82887,11 +83571,11 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - if (member.kind === 173 /* SyntaxKind.SetAccessor */ && member.symbol.flags & 32768 /* SymbolFlags.GetAccessor */) { + case 171 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + if (member.kind === 175 /* SyntaxKind.SetAccessor */ && member.symbol.flags & 32768 /* SymbolFlags.GetAccessor */) { // Already would have reported an error on the getter. break; } @@ -82902,7 +83586,7 @@ var ts; addDiagnostic(member, 0 /* UnusedKind.Local */, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol))); } break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; if (!parameter.symbol.isReferenced && ts.hasSyntacticModifier(parameter, 8 /* ModifierFlags.Private */)) { @@ -82910,9 +83594,9 @@ var ts; } } break; - case 176 /* SyntaxKind.IndexSignature */: - case 234 /* SyntaxKind.SemicolonClassElement */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: + case 237 /* SyntaxKind.SemicolonClassElement */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // Can't be private break; default: @@ -82940,7 +83624,7 @@ var ts; continue; var name = ts.idText(typeParameter.name); var parent = typeParameter.parent; - if (parent.kind !== 190 /* SyntaxKind.InferType */ && parent.typeParameters.every(isTypeParameterUnused)) { + if (parent.kind !== 192 /* SyntaxKind.InferType */ && parent.typeParameters.every(isTypeParameterUnused)) { if (ts.tryAddToSet(seenParentsWithEveryUnused, parent)) { var sourceFile = ts.getSourceFileOfNode(parent); var range = ts.isJSDocTemplateTag(parent) @@ -83046,7 +83730,7 @@ var ts; var importDecl = importClause.parent; var nDeclarations = (importClause.name ? 1 : 0) + (importClause.namedBindings ? - (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? 1 : importClause.namedBindings.elements.length) + (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? 1 : importClause.namedBindings.elements.length) : 0); if (nDeclarations === unuseds.length) { addDiagnostic(importDecl, 0 /* UnusedKind.Local */, unuseds.length === 1 @@ -83064,7 +83748,7 @@ var ts; var bindingPattern = _a[0], bindingElements = _a[1]; var kind = tryGetRootParameterDeclaration(bindingPattern.parent) ? 1 /* UnusedKind.Parameter */ : 0 /* UnusedKind.Local */; if (bindingPattern.elements.length === bindingElements.length) { - if (bindingElements.length === 1 && bindingPattern.parent.kind === 254 /* SyntaxKind.VariableDeclaration */ && bindingPattern.parent.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (bindingElements.length === 1 && bindingPattern.parent.kind === 257 /* SyntaxKind.VariableDeclaration */ && bindingPattern.parent.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */) { addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId); } else { @@ -83085,7 +83769,7 @@ var ts; if (declarationList.declarations.length === declarations.length) { addDiagnostic(declarationList, 0 /* UnusedKind.Local */, declarations.length === 1 ? ts.createDiagnosticForNode(ts.first(declarations).name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(ts.first(declarations).name)) - : ts.createDiagnosticForNode(declarationList.parent.kind === 237 /* SyntaxKind.VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); + : ts.createDiagnosticForNode(declarationList.parent.kind === 240 /* SyntaxKind.VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); } else { for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { @@ -83115,22 +83799,22 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return ts.idText(name); - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return bindingNameText(ts.cast(ts.first(name.elements), ts.isBindingElement).name); default: return ts.Debug.assertNever(name); } } function isImportedDeclaration(node) { - return node.kind === 267 /* SyntaxKind.ImportClause */ || node.kind === 270 /* SyntaxKind.ImportSpecifier */ || node.kind === 268 /* SyntaxKind.NamespaceImport */; + return node.kind === 270 /* SyntaxKind.ImportClause */ || node.kind === 273 /* SyntaxKind.ImportSpecifier */ || node.kind === 271 /* SyntaxKind.NamespaceImport */; } function importClauseFromImported(decl) { - return decl.kind === 267 /* SyntaxKind.ImportClause */ ? decl : decl.kind === 268 /* SyntaxKind.NamespaceImport */ ? decl.parent : decl.parent.parent; + return decl.kind === 270 /* SyntaxKind.ImportClause */ ? decl : decl.kind === 271 /* SyntaxKind.NamespaceImport */ ? decl.parent : decl.parent.parent; } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 235 /* SyntaxKind.Block */) { + if (node.kind === 238 /* SyntaxKind.Block */) { checkGrammarStatementInAmbientContext(node); } if (ts.isFunctionOrModuleBlock(node)) { @@ -83165,13 +83849,13 @@ var ts; if ((identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) !== name) { return false; } - if (node.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - node.kind === 166 /* SyntaxKind.PropertySignature */ || - node.kind === 169 /* SyntaxKind.MethodDeclaration */ || - node.kind === 168 /* SyntaxKind.MethodSignature */ || - node.kind === 172 /* SyntaxKind.GetAccessor */ || - node.kind === 173 /* SyntaxKind.SetAccessor */ || - node.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (node.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + node.kind === 168 /* SyntaxKind.PropertySignature */ || + node.kind === 171 /* SyntaxKind.MethodDeclaration */ || + node.kind === 170 /* SyntaxKind.MethodSignature */ || + node.kind === 174 /* SyntaxKind.GetAccessor */ || + node.kind === 175 /* SyntaxKind.SetAccessor */ || + node.kind === 299 /* SyntaxKind.PropertyAssignment */) { // it is ok to have member named '_super', '_this', `Promise`, etc. - member access is always qualified return false; } @@ -83237,7 +83921,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -83252,7 +83936,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048 /* NodeFlags.HasAsyncFunctions */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048 /* NodeFlags.HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -83352,7 +84036,7 @@ var ts; // skip variable declarations that don't have initializers // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern // so we'll always treat binding elements as initialized - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ && !node.initializer) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -83364,17 +84048,17 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* SymbolFlags.BlockScopedVariable */) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* NodeFlags.BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); - var container = varDeclList.parent.kind === 237 /* SyntaxKind.VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); + var container = varDeclList.parent.kind === 240 /* SyntaxKind.VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; // names of block-scoped and function scoped variables can collide only // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) var namesShareScope = container && - (container.kind === 235 /* SyntaxKind.Block */ && ts.isFunctionLike(container.parent) || - container.kind === 262 /* SyntaxKind.ModuleBlock */ || - container.kind === 261 /* SyntaxKind.ModuleDeclaration */ || - container.kind === 305 /* SyntaxKind.SourceFile */); + (container.kind === 238 /* SyntaxKind.Block */ && ts.isFunctionLike(container.parent) || + container.kind === 265 /* SyntaxKind.ModuleBlock */ || + container.kind === 264 /* SyntaxKind.ModuleDeclaration */ || + container.kind === 308 /* SyntaxKind.SourceFile */); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error // otherwise if variable has an initializer - show error that initialization will fail @@ -83405,7 +84089,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); if (ts.hasOnlyExpressionInitializer(node) && node.initializer) { checkExpressionCached(node.initializer); @@ -83427,7 +84111,7 @@ var ts; checkExternalEmitHelpers(node, 4 /* ExternalEmitHelpers.Rest */); } // check computed properties inside property names of binding elements - if (node.propertyName && node.propertyName.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.propertyName && node.propertyName.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.propertyName); } // check private/protected variable access @@ -83449,7 +84133,7 @@ var ts; } // For a binding pattern, check contained binding elements if (ts.isBindingPattern(node.name)) { - if (node.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && languageVersion < 2 /* ScriptTarget.ES2015 */ && compilerOptions.downlevelIteration) { + if (node.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && languageVersion < 2 /* ScriptTarget.ES2015 */ && compilerOptions.downlevelIteration) { checkExternalEmitHelpers(node, 512 /* ExternalEmitHelpers.Read */); } ts.forEach(node.name.elements, checkSourceElement); @@ -83461,7 +84145,7 @@ var ts; } // For a binding pattern, validate the initializer and exit if (ts.isBindingPattern(node.name)) { - var needCheckInitializer = ts.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */; + var needCheckInitializer = ts.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */; var needCheckWidenedType = !ts.some(node.name.elements, ts.not(ts.isOmittedExpression)); if (needCheckInitializer || needCheckWidenedType) { // Don't validate for-in initializer as it is already an error @@ -83489,7 +84173,7 @@ var ts; } // For a commonjs `const x = require`, validate the alias and exit var symbol = getSymbolOfNode(node); - if (symbol.flags & 2097152 /* SymbolFlags.Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 203 /* SyntaxKind.BindingElement */ ? node.parent.parent : node)) { + if (symbol.flags & 2097152 /* SymbolFlags.Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 205 /* SyntaxKind.BindingElement */ ? node.parent.parent : node)) { checkAliasSymbol(node); return; } @@ -83503,7 +84187,7 @@ var ts; ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || ts.isPrototypeAccess(node.name)) && !!((_a = symbol.exports) === null || _a === void 0 ? void 0 : _a.size); - if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */) { + if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */) { checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(initializer), type, node, initializer, /*headMessage*/ undefined); } } @@ -83529,10 +84213,10 @@ var ts; error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name)); } } - if (node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 166 /* SyntaxKind.PropertySignature */) { + if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 168 /* SyntaxKind.PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionsForDeclarationName(node, node.name); @@ -83540,7 +84224,7 @@ var ts; } function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) { var nextDeclarationName = ts.getNameOfDeclaration(nextDeclaration); - var message = nextDeclaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ || nextDeclaration.kind === 166 /* SyntaxKind.PropertySignature */ + var message = nextDeclaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ || nextDeclaration.kind === 168 /* SyntaxKind.PropertySignature */ ? ts.Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2 : ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2; var declName = ts.declarationNameToString(nextDeclarationName); @@ -83550,8 +84234,8 @@ var ts; } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 164 /* SyntaxKind.Parameter */ && right.kind === 254 /* SyntaxKind.VariableDeclaration */) || - (left.kind === 254 /* SyntaxKind.VariableDeclaration */ && right.kind === 164 /* SyntaxKind.Parameter */)) { + if ((left.kind === 166 /* SyntaxKind.Parameter */ && right.kind === 257 /* SyntaxKind.VariableDeclaration */) || + (left.kind === 257 /* SyntaxKind.VariableDeclaration */ && right.kind === 166 /* SyntaxKind.Parameter */)) { // Differences in optionality between parameters and variables are allowed. return true; } @@ -83560,8 +84244,8 @@ var ts; } var interestingFlags = 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | - 256 /* ModifierFlags.Async */ | - 128 /* ModifierFlags.Abstract */ | + 512 /* ModifierFlags.Async */ | + 256 /* ModifierFlags.Abstract */ | 64 /* ModifierFlags.Readonly */ | 32 /* ModifierFlags.Static */; return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags); @@ -83590,15 +84274,15 @@ var ts; function checkIfStatement(node) { // Grammar checking checkGrammarStatementInAmbientContext(node); - checkTruthinessExpression(node.expression); - checkTestingKnownTruthyCallableOrAwaitableType(node.expression, node.thenStatement); + var type = checkTruthinessExpression(node.expression); + checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 236 /* SyntaxKind.EmptyStatement */) { + if (node.thenStatement.kind === 239 /* SyntaxKind.EmptyStatement */) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); } - function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, body) { + function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, condType, body) { if (!strictNullChecks) return; helper(condExpr, body); @@ -83613,7 +84297,7 @@ var ts; : condExpr; if (ts.isModuleExportsAccessExpression(location)) return; - var type = checkTruthinessExpression(location); + var type = location === condExpr ? condType : checkTruthinessExpression(location); var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression); if (!(getTypeFacts(type) & 4194304 /* TypeFacts.Truthy */) || isPropertyExpressionCast) return; @@ -83727,12 +84411,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -83772,14 +84456,14 @@ var ts; // via checkRightHandSideOfForOf. // If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference. // Then check that the RHS is assignable to it. - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node); // There may be a destructuring assignment on the left side - if (varExpr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (varExpr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // iteratedType may be undefined. In this case, we still want to check the structure of // varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like // to short circuit the type relation checking as much as possible, so we pass the unknownType. @@ -83811,7 +84495,7 @@ var ts; // for (let VarDecl in Expr) Statement // VarDecl must be a variable declaration without a type annotation that declares a variable of type Any, // and Expr must be an expression of type Any, an object type, or a type parameter type. - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -83825,7 +84509,7 @@ var ts; // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (varExpr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { @@ -84625,12 +85309,12 @@ var ts; var functionFlags = ts.getFunctionFlags(container); if (strictNullChecks || node.expression || returnType.flags & 131072 /* TypeFlags.Never */) { var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; - if (container.kind === 173 /* SyntaxKind.SetAccessor */) { + if (container.kind === 175 /* SyntaxKind.SetAccessor */) { if (node.expression) { error(node, ts.Diagnostics.Setters_cannot_return_a_value); } } - else if (container.kind === 171 /* SyntaxKind.Constructor */) { + else if (container.kind === 173 /* SyntaxKind.Constructor */) { if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) { error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -84648,7 +85332,7 @@ var ts; } } } - else if (container.kind !== 171 /* SyntaxKind.Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { + else if (container.kind !== 173 /* SyntaxKind.Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { // The function has a return type, but the return statement doesn't have an expression. error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); } @@ -84677,7 +85361,7 @@ var ts; var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 290 /* SyntaxKind.DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 293 /* SyntaxKind.DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -84686,7 +85370,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { addLazyDiagnostic(createLazyCaseClauseDiagnostics(clause)); } ts.forEach(clause.statements, checkSourceElement); @@ -84723,7 +85407,7 @@ var ts; if (ts.isFunctionLike(current)) { return "quit"; } - if (current.kind === 250 /* SyntaxKind.LabeledStatement */ && current.label.escapedText === node.label.escapedText) { + if (current.kind === 253 /* SyntaxKind.LabeledStatement */ && current.label.escapedText === node.label.escapedText) { grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label)); return true; } @@ -84818,11 +85502,11 @@ var ts; return; } var indexInfos = getApplicableIndexInfos(type, propNameType); - var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* SyntaxKind.InterfaceDeclaration */) : undefined; - var propDeclaration = declaration && declaration.kind === 221 /* SyntaxKind.BinaryExpression */ || - name && name.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined; + var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined; + var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ || + name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined; var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined; - var _loop_30 = function (info) { + var _loop_31 = function (info) { var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined; // We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared // in the containing type, or (c) the containing type is an interface and no base interface contains both the property and @@ -84839,15 +85523,15 @@ var ts; }; for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) { var info = indexInfos_9[_i]; - _loop_30(info); + _loop_31(info); } } function checkIndexConstraintForIndexSignature(type, checkInfo) { var declaration = checkInfo.declaration; var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType); - var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* SyntaxKind.InterfaceDeclaration */) : undefined; + var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined; var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined; - var _loop_31 = function (info) { + var _loop_32 = function (info) { if (info === checkInfo) return "continue"; var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined; @@ -84862,7 +85546,7 @@ var ts; }; for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) { var info = indexInfos_10[_i]; - _loop_31(info); + _loop_32(info); } } function checkTypeNameIsReserved(name, message) { @@ -84965,7 +85649,7 @@ var ts; function checkTypeParametersNotReferenced(root, typeParameters, index) { visit(root); function visit(node) { - if (node.kind === 178 /* SyntaxKind.TypeReference */) { + if (node.kind === 180 /* SyntaxKind.TypeReference */) { var type = getTypeFromTypeReference(node); if (type.flags & 262144 /* TypeFlags.TypeParameter */) { for (var i = index; i < typeParameters.length; i++) { @@ -85055,7 +85739,7 @@ var ts; if (firstDecorator && ts.some(node.members, function (p) { return ts.hasStaticModifier(p) && ts.isPrivateIdentifierClassElementDeclaration(p); })) { grammarErrorOnNode(firstDecorator, ts.Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator); } - if (!node.name && !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (!node.name && !ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); } checkClassLikeDeclaration(node); @@ -85122,7 +85806,7 @@ var ts; } else { var constructSignatures = getSignaturesOfType(baseConstructorType, 1 /* SignatureKind.Construct */); - if (constructSignatures.some(function (signature) { return signature.flags & 4 /* SignatureFlags.Abstract */; }) && !ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)) { + if (constructSignatures.some(function (signature) { return signature.flags & 4 /* SignatureFlags.Abstract */; }) && !ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)) { error(node.name || node, ts.Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract); } } @@ -85182,7 +85866,7 @@ var ts; var baseTypes = baseTypeNode && getBaseTypes(type); var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined; var baseStaticType = getBaseConstructorTypeOfClass(type); - var _loop_32 = function (member) { + var _loop_33 = function (member) { if (ts.hasAmbientModifier(member)) { return "continue"; } @@ -85199,7 +85883,7 @@ var ts; }; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - _loop_32(member); + _loop_33(member); } } /** @@ -85287,7 +85971,7 @@ var ts; function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) { // iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible var issuedMemberError = false; - var _loop_33 = function (member) { + var _loop_34 = function (member) { if (ts.isStatic(member)) { return "continue"; } @@ -85306,7 +85990,7 @@ var ts; }; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - _loop_33(member); + _loop_34(member); } if (!issuedMemberError) { // check again with diagnostics to generate a less-specific error @@ -85357,7 +86041,7 @@ var ts; } function getClassOrInterfaceDeclarationsOfSymbol(symbol) { return ts.filter(symbol.declarations, function (d) { - return d.kind === 257 /* SyntaxKind.ClassDeclaration */ || d.kind === 258 /* SyntaxKind.InterfaceDeclaration */; + return d.kind === 260 /* SyntaxKind.ClassDeclaration */ || d.kind === 261 /* SyntaxKind.InterfaceDeclaration */; }); } function checkKindsOfPropertyMemberOverrides(type, baseType) { @@ -85377,7 +86061,7 @@ var ts; var _a, _b, _c, _d; // NOTE: assignability is checked in checkClassDeclaration var baseProperties = getPropertiesOfType(baseType); - var _loop_34 = function (baseProperty) { + var _loop_35 = function (baseProperty) { var base = getTargetSymbol(baseProperty); if (base.flags & 4194304 /* SymbolFlags.Prototype */) { return "continue"; @@ -85398,7 +86082,7 @@ var ts; // It is an error to inherit an abstract member without implementing it or being declared abstract. // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. - if (baseDeclarationFlags & 128 /* ModifierFlags.Abstract */ && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 128 /* ModifierFlags.Abstract */))) { + if (baseDeclarationFlags & 256 /* ModifierFlags.Abstract */ && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 256 /* ModifierFlags.Abstract */))) { // Searches other base types for a declaration that would satisfy the inherited abstract member. // (The class may have more than one base type via declaration merging with an interface with the // same name.) @@ -85412,7 +86096,7 @@ var ts; return "continue-basePropertyCheck"; } } - if (derivedClassDecl.kind === 226 /* SyntaxKind.ClassExpression */) { + if (derivedClassDecl.kind === 228 /* SyntaxKind.ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -85447,11 +86131,11 @@ var ts; error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_1, symbolToString(base), typeToString(baseType), typeToString(type)); } else if (useDefineForClassFields) { - var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !d.initializer; }); + var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !d.initializer; }); if (uninitialized && !(derived.flags & 33554432 /* SymbolFlags.Transient */) - && !(baseDeclarationFlags & 128 /* ModifierFlags.Abstract */) - && !(derivedDeclarationFlags & 128 /* ModifierFlags.Abstract */) + && !(baseDeclarationFlags & 256 /* ModifierFlags.Abstract */) + && !(derivedDeclarationFlags & 256 /* ModifierFlags.Abstract */) && !((_d = derived.declarations) === null || _d === void 0 ? void 0 : _d.some(function (d) { return !!(d.flags & 16777216 /* NodeFlags.Ambient */); }))) { var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol)); var propName = uninitialized.name; @@ -85487,14 +86171,14 @@ var ts; }; basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) { var baseProperty = baseProperties_1[_i]; - var state_10 = _loop_34(baseProperty); - switch (state_10) { + var state_11 = _loop_35(baseProperty); + switch (state_11) { case "continue-basePropertyCheck": continue basePropertyCheck; } } } function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) { - return baseDeclarationFlags & 128 /* ModifierFlags.Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer) + return baseDeclarationFlags & 256 /* ModifierFlags.Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer) || ts.isInterfaceDeclaration(declaration.parent); } function getNonInheritedProperties(type, baseTypes, properties) { @@ -85576,7 +86260,7 @@ var ts; } } function isPropertyWithoutInitializer(node) { - return node.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + return node.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.hasAbstractModifier(node) && !node.exclamationToken && !node.initializer; @@ -85619,7 +86303,7 @@ var ts; var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(symbol); // Only check this symbol once - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 258 /* SyntaxKind.InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.InterfaceDeclaration */); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -85652,7 +86336,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0); checkExportsOnMergedDeclarations(node); checkTypeParameters(node.typeParameters); - if (node.type.kind === 138 /* SyntaxKind.IntrinsicKeyword */) { + if (node.type.kind === 139 /* SyntaxKind.IntrinsicKeyword */) { if (!intrinsicTypeKinds.has(node.name.escapedText) || ts.length(node.typeParameters) !== 1) { error(node.type, ts.Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types); } @@ -85738,7 +86422,7 @@ var ts; return value; function evaluate(expr) { switch (expr.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var value_2 = evaluate(expr.operand); if (typeof value_2 === "number") { switch (expr.operator) { @@ -85748,7 +86432,7 @@ var ts; } } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var left = evaluate(expr.left); var right = evaluate(expr.right); if (typeof left === "number" && typeof right === "number") { @@ -85777,7 +86461,7 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: checkGrammarNumericLiteral(expr); return +expr.text; - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return evaluate(expr.expression); case 79 /* SyntaxKind.Identifier */: var identifier = expr; @@ -85785,13 +86469,13 @@ var ts; return +(identifier.escapedText); } return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText); - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (isConstantMemberAccess(expr)) { var type = getTypeOfExpression(expr.expression); if (type.symbol && type.symbol.flags & 384 /* SymbolFlags.Enum */) { var name = void 0; - if (expr.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (expr.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { name = expr.name.escapedText; } else { @@ -85828,8 +86512,8 @@ var ts; return false; } return node.kind === 79 /* SyntaxKind.Identifier */ || - node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || - node.kind === 207 /* SyntaxKind.ElementAccessExpression */ && isConstantMemberAccess(node.expression) && + node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || + node.kind === 209 /* SyntaxKind.ElementAccessExpression */ && isConstantMemberAccess(node.expression) && ts.isStringLiteralLike(node.argumentExpression); } function checkEnumDeclaration(node) { @@ -85863,7 +86547,7 @@ var ts; var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind !== 263 /* SyntaxKind.EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -85892,8 +86576,8 @@ var ts; if (declarations) { for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { var declaration = declarations_9[_i]; - if ((declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ || - (declaration.kind === 256 /* SyntaxKind.FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ || + (declaration.kind === 259 /* SyntaxKind.FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { return declaration; } @@ -85964,7 +86648,7 @@ var ts; } // if the module merges with a class declaration in the same lexical scope, // we need to track this to ensure the correct emit. - var mergedClass = ts.getDeclarationOfKind(symbol, 257 /* SyntaxKind.ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 260 /* SyntaxKind.ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* NodeCheckFlags.LexicalModuleMergesWithClass */; @@ -86009,23 +86693,23 @@ var ts; function checkModuleAugmentationElement(node, isGlobalAugmentation) { var _a; switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // error each individual name in variable statement instead of marking the entire variable statement for (var _i = 0, _b = node.declarationList.declarations; _i < _b.length; _i++) { var decl = _b[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 203 /* SyntaxKind.BindingElement */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: var name = node.name; if (ts.isBindingPattern(name)) { for (var _c = 0, _d = name.elements; _c < _d.length; _c++) { @@ -86036,12 +86720,12 @@ var ts; break; } // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: if (isGlobalAugmentation) { return; } @@ -86064,12 +86748,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.left; } while (node.kind !== 79 /* SyntaxKind.Identifier */); return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: do { if (ts.isModuleExportsAccessExpression(node.expression) && !ts.isPrivateIdentifier(node.name)) { return node.name; @@ -86089,9 +86773,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 305 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 272 /* SyntaxKind.ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 308 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 275 /* SyntaxKind.ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -86138,8 +86822,8 @@ var ts; var errorNode = ts.isImportOrExportSpecifier(node) ? node.propertyName || node.name : ts.isNamedDeclaration(node) ? node.name : node; - ts.Debug.assert(node.kind !== 274 /* SyntaxKind.NamespaceExport */); - if (node.kind === 275 /* SyntaxKind.ExportSpecifier */) { + ts.Debug.assert(node.kind !== 277 /* SyntaxKind.NamespaceExport */); + if (node.kind === 278 /* SyntaxKind.ExportSpecifier */) { var diag = error(errorNode, ts.Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files); var alreadyExportedSymbol = (_b = (_a = ts.getSourceFileOfNode(node).symbol) === null || _a === void 0 ? void 0 : _a.exports) === null || _b === void 0 ? void 0 : _b.get((node.propertyName || node.name).escapedText); if (alreadyExportedSymbol === target) { @@ -86150,7 +86834,7 @@ var ts; } } else { - ts.Debug.assert(node.kind !== 254 /* SyntaxKind.VariableDeclaration */); + ts.Debug.assert(node.kind !== 257 /* SyntaxKind.VariableDeclaration */); var importDeclaration = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)); var moduleSpecifier = (_e = (importDeclaration && ((_d = ts.tryGetModuleSpecifierFromDeclaration(importDeclaration)) === null || _d === void 0 ? void 0 : _d.text))) !== null && _e !== void 0 ? _e : "..."; var importedIdentifier = ts.unescapeLeadingUnderscores(ts.isIdentifier(errorNode) ? errorNode.escapedText : symbol.escapedName); @@ -86162,7 +86846,7 @@ var ts; (symbol.flags & 788968 /* SymbolFlags.Type */ ? 788968 /* SymbolFlags.Type */ : 0) | (symbol.flags & 1920 /* SymbolFlags.Namespace */ ? 1920 /* SymbolFlags.Namespace */ : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 275 /* SyntaxKind.ExportSpecifier */ ? + var message = node.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -86174,23 +86858,23 @@ var ts; var isType = !(target.flags & 111551 /* SymbolFlags.Value */); if (isType || typeOnlyAlias) { switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { if (compilerOptions.preserveValueImports) { ts.Debug.assertIsDefined(node.name, "An ImportClause with a symbol should have a name"); var message = isType ? ts.Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled : ts.Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled; - var name = ts.idText(node.kind === 270 /* SyntaxKind.ImportSpecifier */ ? node.propertyName || node.name : node.name); + var name = ts.idText(node.kind === 273 /* SyntaxKind.ImportSpecifier */ ? node.propertyName || node.name : node.name); addTypeOnlyDeclarationRelatedInfo(error(node, message, name), isType ? undefined : typeOnlyAlias, name); } - if (isType && node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && ts.hasEffectiveModifier(node, 1 /* ModifierFlags.Export */)) { + if (isType && node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && ts.hasEffectiveModifier(node, 1 /* ModifierFlags.Export */)) { error(node, ts.Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided); } break; } - case 275 /* SyntaxKind.ExportSpecifier */: { + case 278 /* SyntaxKind.ExportSpecifier */: { // Don't allow re-exporting an export that will be elided when `--isolatedModules` is set. // The exception is that `import type { A } from './a'; export { A }` is allowed // because single-file analysis can determine that the export should be dropped. @@ -86249,7 +86933,7 @@ var ts; function checkImportBinding(node) { checkCollisionsForDeclarationName(node, node.name); checkAliasSymbol(node); - if (node.kind === 270 /* SyntaxKind.ImportSpecifier */ && + if (node.kind === 273 /* SyntaxKind.ImportSpecifier */ && ts.idText(node.propertyName || node.name) === "default" && ts.getESModuleInterop(compilerOptions) && moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) { @@ -86299,7 +86983,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { checkImportBinding(importClause.namedBindings); if (moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) && ts.getESModuleInterop(compilerOptions)) { // import * as ns from "foo"; @@ -86328,7 +87012,7 @@ var ts; if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { markExportAsReferenced(node); } - if (node.moduleReference.kind !== 277 /* SyntaxKind.ExternalModuleReference */) { + if (node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */) { var target = resolveAlias(getSymbolOfNode(node)); if (target !== unknownSymbol) { if (target.flags & 111551 /* SymbolFlags.Value */) { @@ -86371,10 +87055,10 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && + var inAmbientExternalModule = node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && !node.moduleSpecifier && node.flags & 16777216 /* NodeFlags.Ambient */; - if (node.parent.kind !== 305 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + if (node.parent.kind !== 308 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -86409,7 +87093,7 @@ var ts; function checkGrammarExportDeclaration(node) { var _a; if (node.isTypeOnly) { - if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 273 /* SyntaxKind.NamedExports */) { + if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 276 /* SyntaxKind.NamedExports */) { return checkGrammarNamedImportsOrExports(node.exportClause); } else { @@ -86419,7 +87103,7 @@ var ts; return false; } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 305 /* SyntaxKind.SourceFile */ || node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */; + var isInAppropriateContext = node.parent.kind === 308 /* SyntaxKind.SourceFile */ || node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -86499,8 +87183,8 @@ var ts; // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors. return; } - var container = node.parent.kind === 305 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 261 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 308 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); } @@ -86632,181 +87316,181 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } - if (kind >= 237 /* SyntaxKind.FirstStatement */ && kind <= 253 /* SyntaxKind.LastStatement */ && node.flowNode && !isReachableFlowNode(node.flowNode)) { + if (kind >= 240 /* SyntaxKind.FirstStatement */ && kind <= 256 /* SyntaxKind.LastStatement */ && node.flowNode && !isReachableFlowNode(node.flowNode)) { errorOrSuggestion(compilerOptions.allowUnreachableCode === false, node, ts.Diagnostics.Unreachable_code_detected); } switch (kind) { - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return checkTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return checkParameter(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return checkPropertyDeclaration(node); - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return checkPropertySignature(node); - case 180 /* SyntaxKind.ConstructorType */: - case 179 /* SyntaxKind.FunctionType */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return checkSignatureDeclaration(node); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return checkMethodDeclaration(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return checkClassStaticBlockDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return checkConstructorDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return checkAccessorDeclaration(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return checkTypeReferenceNode(node); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return checkTypePredicate(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return checkTypeQuery(node); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return checkTypeLiteral(node); - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return checkArrayType(node); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return checkTupleType(node); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return checkUnionOrIntersectionType(node); - case 191 /* SyntaxKind.ParenthesizedType */: - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 187 /* SyntaxKind.OptionalType */: + case 188 /* SyntaxKind.RestType */: return checkSourceElement(node.type); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return checkThisType(node); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return checkTypeOperator(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return checkConditionalType(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return checkInferType(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return checkTemplateLiteralType(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return checkImportType(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return checkNamedTupleMember(node); - case 328 /* SyntaxKind.JSDocAugmentsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: return checkJSDocAugmentsTag(node); - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return checkJSDocImplementsTag(node); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return checkJSDocTypeAliasTag(node); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return checkJSDocTemplateTag(node); - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return checkJSDocTypeTag(node); - case 324 /* SyntaxKind.JSDocLink */: - case 325 /* SyntaxKind.JSDocLinkCode */: - case 326 /* SyntaxKind.JSDocLinkPlain */: + case 327 /* SyntaxKind.JSDocLink */: + case 328 /* SyntaxKind.JSDocLinkCode */: + case 329 /* SyntaxKind.JSDocLinkPlain */: return checkJSDocLinkLikeTag(node); - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return checkJSDocParameterTag(node); - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return checkJSDocPropertyTag(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: checkJSDocFunctionType(node); // falls through - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: checkJSDocTypeIsInJsFile(node); ts.forEachChild(node, checkSourceElement); return; - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: checkJSDocVariadicType(node); return; - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return checkSourceElement(node.type); - case 333 /* SyntaxKind.JSDocPublicTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: + case 336 /* SyntaxKind.JSDocPublicTag */: + case 338 /* SyntaxKind.JSDocProtectedTag */: + case 337 /* SyntaxKind.JSDocPrivateTag */: return checkJSDocAccessibilityModifiers(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return checkIndexedAccessType(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return checkMappedType(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return checkFunctionDeclaration(node); - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: return checkBlock(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return checkVariableStatement(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return checkExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return checkIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return checkDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return checkWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return checkForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return checkForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return checkForOfStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: return checkBreakOrContinueStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return checkReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return checkWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return checkSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return checkLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return checkThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return checkTryStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checkVariableDeclaration(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return checkBindingElement(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return checkClassDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return checkEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return checkModuleDeclaration(node); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return checkImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return checkExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return checkExportAssignment(node); - case 236 /* SyntaxKind.EmptyStatement */: - case 253 /* SyntaxKind.DebuggerStatement */: + case 239 /* SyntaxKind.EmptyStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 276 /* SyntaxKind.MissingDeclaration */: + case 279 /* SyntaxKind.MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -86913,36 +87597,36 @@ var ts; currentNode = node; instantiationCount = 0; switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 165 /* SyntaxKind.Decorator */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 167 /* SyntaxKind.Decorator */: + case 283 /* SyntaxKind.JsxOpeningElement */: // These node kinds are deferred checked when overload resolution fails // To save on work, we ensure the arguments are checked just once, in // a deferred way resolveUntypedCall(node); break; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: checkAccessorDeclaration(node); break; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: checkClassExpressionDeferred(node); break; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: checkTypeParameterDeferred(node); break; - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: checkJsxSelfClosingElementDeferred(node); break; - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: checkJsxElementDeferred(node); break; } @@ -87115,17 +87799,17 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalModule(location)) break; // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: copyLocallyVisibleExportSymbols(getSymbolOfNode(location).exports, meaning & 2623475 /* SymbolFlags.ModuleMember */); break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* SymbolFlags.EnumMember */); break; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: var className = location.name; if (className) { copySymbol(location.symbol, meaning); @@ -87133,8 +87817,8 @@ var ts; // this fall-through is necessary because we would like to handle // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration. // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // If we didn't come from static member of class or interface, // add the type parameters into the symbol table // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol. @@ -87143,7 +87827,7 @@ var ts; copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 788968 /* SymbolFlags.Type */); } break; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -87187,7 +87871,7 @@ var ts; if (meaning) { source.forEach(function (symbol) { // Similar condition as in `resolveNameHelper` - if (!ts.getDeclarationOfKind(symbol, 275 /* SyntaxKind.ExportSpecifier */) && !ts.getDeclarationOfKind(symbol, 274 /* SyntaxKind.NamespaceExport */)) { + if (!ts.getDeclarationOfKind(symbol, 278 /* SyntaxKind.ExportSpecifier */) && !ts.getDeclarationOfKind(symbol, 277 /* SyntaxKind.NamespaceExport */)) { copySymbol(symbol, meaning); } }); @@ -87201,19 +87885,19 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 163 /* SyntaxKind.TypeParameter */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 165 /* SyntaxKind.TypeParameter */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return true; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return node.isTypeOnly; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.isTypeOnly; default: return false; @@ -87221,16 +87905,16 @@ var ts; } // True if the given identifier is part of a type reference function isTypeReferenceIdentifier(node) { - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } - return node.parent.kind === 178 /* SyntaxKind.TypeReference */; + return node.parent.kind === 180 /* SyntaxKind.TypeReference */; } function isHeritageClauseElementIdentifier(node) { - while (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { node = node.parent; } - return node.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } function forEachEnclosingClass(node, callback) { var result; @@ -87258,13 +87942,13 @@ var ts; return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (nodeOnRightSide.parent.kind === 163 /* SyntaxKind.QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } - if (nodeOnRightSide.parent.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 274 /* SyntaxKind.ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } return undefined; @@ -87290,7 +87974,7 @@ var ts; node = parent; parent = parent.parent; } - if (parent && parent.kind === 200 /* SyntaxKind.ImportType */ && parent.qualifier === node) { + if (parent && parent.kind === 202 /* SyntaxKind.ImportType */ && parent.qualifier === node) { return parent; } return undefined; @@ -87300,7 +87984,7 @@ var ts; return getSymbolOfNode(name.parent); } if (ts.isInJSFile(name) && - name.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + name.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && name.parent === name.parent.parent.left) { // Check if this is a special property assignment if (!ts.isPrivateIdentifier(name) && !ts.isJSDocMemberName(name)) { @@ -87310,7 +87994,7 @@ var ts; } } } - if (name.parent.kind === 271 /* SyntaxKind.ExportAssignment */ && ts.isEntityNameExpression(name)) { + if (name.parent.kind === 274 /* SyntaxKind.ExportAssignment */ && ts.isEntityNameExpression(name)) { // Even an entity name expression that doesn't resolve as an entityname may still typecheck as a property access expression var success = resolveEntityName(name, /*all meanings*/ 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */, /*ignoreErrors*/ true); @@ -87320,7 +88004,7 @@ var ts; } else if (ts.isEntityName(name) && isInRightSideOfImportOrExportAssignment(name)) { // Since we already checked for ExportAssignment, this really could only be an Import - var importEqualsDeclaration = ts.getAncestor(name, 265 /* SyntaxKind.ImportEqualsDeclaration */); + var importEqualsDeclaration = ts.getAncestor(name, 268 /* SyntaxKind.ImportEqualsDeclaration */); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(name, /*dontResolveAlias*/ true); } @@ -87338,7 +88022,7 @@ var ts; if (isHeritageClauseElementIdentifier(name)) { var meaning = 0 /* SymbolFlags.None */; // In an interface or class, we're definitely interested in a type. - if (name.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (name.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { meaning = 788968 /* SymbolFlags.Type */; // In a class 'extends' clause we are also looking for a value. if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(name.parent)) { @@ -87354,10 +88038,10 @@ var ts; return entityNameSymbol; } } - if (name.parent.kind === 340 /* SyntaxKind.JSDocParameterTag */) { + if (name.parent.kind === 343 /* SyntaxKind.JSDocParameterTag */) { return ts.getParameterSymbolFromJSDoc(name.parent); } - if (name.parent.kind === 163 /* SyntaxKind.TypeParameter */ && name.parent.parent.kind === 344 /* SyntaxKind.JSDocTemplateTag */) { + if (name.parent.kind === 165 /* SyntaxKind.TypeParameter */ && name.parent.parent.kind === 347 /* SyntaxKind.JSDocTemplateTag */) { ts.Debug.assert(!ts.isInJSFile(name)); // Otherwise `isDeclarationName` would have been true. var typeParameter = ts.getTypeParameterFromJsDoc(name.parent); return typeParameter && typeParameter.symbol; @@ -87381,18 +88065,53 @@ var ts; return resolveJSDocMemberName(name, /*ignoreErrors*/ false, getSymbolOfNode(container)); } } + if (result && isJSDoc_1) { + var container = ts.getJSDocHost(name); + if (container && ts.isEnumMember(container) && container === result.valueDeclaration) { + return resolveEntityName(name, meaning, /*ignoreErrors*/ true, /* dontResolveAlias */ true, ts.getSourceFileOfNode(container)) || result; + } + } return result; } else if (ts.isPrivateIdentifier(name)) { return getSymbolForPrivateIdentifierExpression(name); } - else if (name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || name.kind === 161 /* SyntaxKind.QualifiedName */) { + else if (name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || name.kind === 163 /* SyntaxKind.QualifiedName */) { var links = getNodeLinks(name); if (links.resolvedSymbol) { return links.resolvedSymbol; } - if (name.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (name.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { checkPropertyAccessExpression(name, 0 /* CheckMode.Normal */); + if (!links.resolvedSymbol) { + var expressionType = checkExpressionCached(name.expression); + var infos = getApplicableIndexInfos(expressionType, getLiteralTypeFromPropertyName(name.name)); + if (infos.length && expressionType.members) { + var resolved = resolveStructuredTypeMembers(expressionType); + var symbol = resolved.members.get("__index" /* InternalSymbolName.Index */); + if (infos === getIndexInfosOfType(expressionType)) { + links.resolvedSymbol = symbol; + } + else if (symbol) { + var symbolLinks_1 = getSymbolLinks(symbol); + var declarationList = ts.mapDefined(infos, function (i) { return i.declaration; }); + var nodeListId = ts.map(declarationList, getNodeId).join(","); + if (!symbolLinks_1.filteredIndexSymbolCache) { + symbolLinks_1.filteredIndexSymbolCache = new ts.Map(); + } + if (symbolLinks_1.filteredIndexSymbolCache.has(nodeListId)) { + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + else { + var copy = createSymbol(131072 /* SymbolFlags.Signature */, "__index" /* InternalSymbolName.Index */); + copy.declarations = ts.mapDefined(infos, function (i) { return i.declaration; }); + copy.parent = expressionType.aliasSymbol ? expressionType.aliasSymbol : expressionType.symbol ? expressionType.symbol : getSymbolAtLocation(copy.declarations[0].parent); + symbolLinks_1.filteredIndexSymbolCache.set(nodeListId, copy); + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + } + } + } } else { checkQualifiedName(name, 0 /* CheckMode.Normal */); @@ -87407,11 +88126,11 @@ var ts; } } else if (isTypeReferenceIdentifier(name)) { - var meaning = name.parent.kind === 178 /* SyntaxKind.TypeReference */ ? 788968 /* SymbolFlags.Type */ : 1920 /* SymbolFlags.Namespace */; + var meaning = name.parent.kind === 180 /* SyntaxKind.TypeReference */ ? 788968 /* SymbolFlags.Type */ : 1920 /* SymbolFlags.Namespace */; var symbol = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); return symbol && symbol !== unknownSymbol ? symbol : getUnresolvedSymbolForEntityName(name); } - if (name.parent.kind === 177 /* SyntaxKind.TypePredicate */) { + if (name.parent.kind === 179 /* SyntaxKind.TypePredicate */) { return resolveEntityName(name, /*meaning*/ 1 /* SymbolFlags.FunctionScopedVariable */); } return undefined; @@ -87445,7 +88164,7 @@ var ts; } } function getSymbolAtLocation(node, ignoreErrors) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } var parent = node.parent; @@ -87468,8 +88187,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } - else if (parent.kind === 203 /* SyntaxKind.BindingElement */ && - grandParent.kind === 201 /* SyntaxKind.ObjectBindingPattern */ && + else if (parent.kind === 205 /* SyntaxKind.BindingElement */ && + grandParent.kind === 203 /* SyntaxKind.ObjectBindingPattern */ && node === parent.propertyName) { var typeOfPattern = getTypeOfNode(grandParent); var propertyDeclaration = getPropertyOfType(typeOfPattern, node.escapedText); @@ -87496,8 +88215,8 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: if (!ts.isThisInTypeQuery(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } @@ -87514,14 +88233,14 @@ var ts; return checkExpression(node).symbol; } // falls through - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return getTypeFromThisTypeNode(node).symbol; case 106 /* SyntaxKind.SuperKeyword */: return checkExpression(node).symbol; - case 134 /* SyntaxKind.ConstructorKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 171 /* SyntaxKind.Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 173 /* SyntaxKind.Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; @@ -87532,7 +88251,7 @@ var ts; // 3). Dynamic import call or require in javascript // 4). type A = import("./f/*gotToDefinitionHere*/oo") if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 266 /* SyntaxKind.ImportDeclaration */ || node.parent.kind === 272 /* SyntaxKind.ExportDeclaration */) && node.parent.moduleSpecifier === node) || + ((node.parent.kind === 269 /* SyntaxKind.ImportDeclaration */ || node.parent.kind === 275 /* SyntaxKind.ExportDeclaration */) && node.parent.moduleSpecifier === node) || ((ts.isInJSFile(node) && ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false)) || ts.isImportCall(node.parent)) || (ts.isLiteralTypeNode(node.parent) && ts.isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent)) { return resolveExternalModuleName(node, node, ignoreErrors); @@ -87554,14 +88273,14 @@ var ts; case 38 /* SyntaxKind.EqualsGreaterThanToken */: case 84 /* SyntaxKind.ClassKeyword */: return getSymbolOfNode(node.parent); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal, ignoreErrors) : undefined; case 93 /* SyntaxKind.ExportKeyword */: return ts.isExportAssignment(node.parent) ? ts.Debug.checkDefined(node.parent.symbol) : undefined; case 100 /* SyntaxKind.ImportKeyword */: case 103 /* SyntaxKind.NewKeyword */: return ts.isMetaProperty(node.parent) ? checkMetaPropertyKeyword(node.parent).symbol : undefined; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return checkExpression(node).symbol; default: return undefined; @@ -87577,7 +88296,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (location && location.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 111551 /* SymbolFlags.Value */ | 2097152 /* SymbolFlags.Alias */); } return undefined; @@ -87659,23 +88378,23 @@ var ts; // [ a ] from // [a] = [ some array ...] function getTypeOfAssignmentPattern(expr) { - ts.Debug.assert(expr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || expr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */); + ts.Debug.assert(expr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || expr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */); // If this is from "for of" // for ( { a } of elems) { // } - if (expr.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (expr.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { var iteratedType = checkRightHandSideOfForOf(expr.parent); return checkDestructuringAssignment(expr, iteratedType || errorType); } // If this is from "for" initializer // for ({a } = elems[0];.....) { } - if (expr.parent.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (expr.parent.kind === 223 /* SyntaxKind.BinaryExpression */) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || errorType); } // If this is from nested object binding pattern // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { - if (expr.parent.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (expr.parent.kind === 299 /* SyntaxKind.PropertyAssignment */) { var node_3 = ts.cast(expr.parent.parent, ts.isObjectLiteralExpression); var typeOfParentObjectLiteral = getTypeOfAssignmentPattern(node_3) || errorType; var propertyIndex = ts.indexOfNode(node_3.properties, expr.parent); @@ -87723,7 +88442,7 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 10 /* SyntaxKind.StringLiteral */: return getStringLiteralType(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: var nameType = checkComputedPropertyName(name); return isTypeAssignableToKind(nameType, 12288 /* TypeFlags.ESSymbolLike */) ? nameType : stringType; default: @@ -87841,7 +88560,7 @@ var ts; } var parentSymbol_1 = getParentOfSymbol(symbol); if (parentSymbol_1) { - if (parentSymbol_1.flags & 512 /* SymbolFlags.ValueModule */ && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 305 /* SyntaxKind.SourceFile */) { + if (parentSymbol_1.flags & 512 /* SymbolFlags.ValueModule */ && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 308 /* SyntaxKind.SourceFile */) { var symbolFile = parentSymbol_1.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); // If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined. @@ -87861,7 +88580,7 @@ var ts; } var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier); if (node) { - var symbol = getReferencedValueSymbol(node); + var symbol = getReferencedValueOrAliasSymbol(node); // We should only get the declaration of an alias if there isn't a local value // declaration for the symbol if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol)) { @@ -87873,7 +88592,7 @@ var ts; function isSymbolOfDestructuredElementOfCatchBinding(symbol) { return symbol.valueDeclaration && ts.isBindingElement(symbol.valueDeclaration) - && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 292 /* SyntaxKind.CatchClause */; + && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 295 /* SyntaxKind.CatchClause */; } function isSymbolOfDeclarationWithCollidingName(symbol) { if (symbol.flags & 418 /* SymbolFlags.BlockScoped */ && symbol.valueDeclaration && !ts.isSourceFile(symbol.valueDeclaration)) { @@ -87904,7 +88623,7 @@ var ts; // they will not collide with anything var isDeclaredInLoop = nodeLinks_1.flags & 524288 /* NodeCheckFlags.BlockScopedBindingInLoop */; var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false); - var inLoopBodyBlock = container.kind === 235 /* SyntaxKind.Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + var inLoopBodyBlock = container.kind === 238 /* SyntaxKind.Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -87945,19 +88664,19 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: var symbol = getSymbolOfNode(node); return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportClause = node.exportClause; return !!exportClause && (ts.isNamespaceExport(exportClause) || ts.some(exportClause.elements, isValueAliasDeclaration)); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return node.expression && node.expression.kind === 79 /* SyntaxKind.Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; @@ -87966,7 +88685,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(nodeIn) { var node = ts.getParseTreeNode(nodeIn, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 305 /* SyntaxKind.SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 308 /* SyntaxKind.SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -88076,15 +88795,15 @@ var ts; } function canHaveConstantValue(node) { switch (node.kind) { - case 299 /* SyntaxKind.EnumMember */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 302 /* SyntaxKind.EnumMember */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return true; } return false; } function getConstantValue(node) { - if (node.kind === 299 /* SyntaxKind.EnumMember */) { + if (node.kind === 302 /* SyntaxKind.EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -88177,7 +88896,7 @@ var ts; function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker, addUndefined) { var declaration = ts.getParseTreeNode(declarationIn, ts.isVariableLikeOrAccessor); if (!declaration) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } // Get type of the symbol if this is the valid symbol otherwise get type at location var symbol = getSymbolOfNode(declaration); @@ -88196,7 +88915,7 @@ var ts; function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) { var signatureDeclaration = ts.getParseTreeNode(signatureDeclarationIn, ts.isFunctionLike); if (!signatureDeclaration) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } var signature = getSignatureFromDeclaration(signatureDeclaration); return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, flags | 1024 /* NodeBuilderFlags.MultilineObjectLiterals */, tracker); @@ -88204,7 +88923,7 @@ var ts; function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) { var expr = ts.getParseTreeNode(exprIn, ts.isExpression); if (!expr) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } var type = getWidenedType(getRegularTypeOfExpression(expr)); return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024 /* NodeBuilderFlags.MultilineObjectLiterals */, tracker); @@ -88228,6 +88947,25 @@ var ts; } return resolveName(location, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true); } + /** + * Get either a value-meaning symbol or an alias symbol. + * Unlike `getReferencedValueSymbol`, if the cached resolved symbol is the unknown symbol, + * we call `resolveName` to find a symbol. + * This is because when caching the resolved symbol, we only consider value symbols, but here + * we want to also get an alias symbol if one exists. + */ + function getReferencedValueOrAliasSymbol(reference) { + var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; + if (resolvedSymbol && resolvedSymbol !== unknownSymbol) { + return resolvedSymbol; + } + return resolveName(reference, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, + /*nodeNotFoundMessage*/ undefined, + /*nameArg*/ undefined, + /*isUse*/ true, + /*excludeGlobals*/ undefined, + /*getSpellingSuggestions*/ undefined); + } function getReferencedValueDeclaration(referenceIn) { if (!ts.isGeneratedIdentifier(referenceIn)) { var reference = ts.getParseTreeNode(referenceIn, ts.isIdentifier); @@ -88361,12 +89099,12 @@ var ts; getJsxFragmentFactoryEntity: getJsxFragmentFactoryEntity, getAllAccessorDeclarations: function (accessor) { accessor = ts.getParseTreeNode(accessor, ts.isGetOrSetAccessorDeclaration); // TODO: GH#18217 - var otherKind = accessor.kind === 173 /* SyntaxKind.SetAccessor */ ? 172 /* SyntaxKind.GetAccessor */ : 173 /* SyntaxKind.SetAccessor */; + var otherKind = accessor.kind === 175 /* SyntaxKind.SetAccessor */ ? 174 /* SyntaxKind.GetAccessor */ : 175 /* SyntaxKind.SetAccessor */; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(accessor), otherKind); var firstAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? otherAccessor : accessor; var secondAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? accessor : otherAccessor; - var setAccessor = accessor.kind === 173 /* SyntaxKind.SetAccessor */ ? accessor : otherAccessor; - var getAccessor = accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? accessor : otherAccessor; + var setAccessor = accessor.kind === 175 /* SyntaxKind.SetAccessor */ ? accessor : otherAccessor; + var getAccessor = accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? accessor : otherAccessor; return { firstAccessor: firstAccessor, secondAccessor: secondAccessor, @@ -88382,7 +89120,7 @@ var ts; }, getDeclarationStatementsForSourceFile: function (node, flags, tracker, bundled) { var n = ts.getParseTreeNode(node); - ts.Debug.assert(n && n.kind === 305 /* SyntaxKind.SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile"); + ts.Debug.assert(n && n.kind === 308 /* SyntaxKind.SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile"); var sym = getSymbolOfNode(node); if (!sym) { return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker, bundled); @@ -88419,7 +89157,7 @@ var ts; return false; } function isInHeritageClause(node) { - return node.parent && node.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 291 /* SyntaxKind.HeritageClause */; + return node.parent && node.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 294 /* SyntaxKind.HeritageClause */; } // defined here to avoid outer scope pollution function getTypeReferenceDirectivesForEntityName(node) { @@ -88432,12 +89170,12 @@ var ts; // qualified names can only be used as types\namespaces // identifiers are treated as values only if they appear in type queries var meaning; - if (node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } else { meaning = 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */; - if ((node.kind === 79 /* SyntaxKind.Identifier */ && isInTypeQuery(node)) || (node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && !isInHeritageClause(node))) { + if ((node.kind === 79 /* SyntaxKind.Identifier */ && isInTypeQuery(node)) || (node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && !isInHeritageClause(node))) { meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } } @@ -88486,7 +89224,7 @@ var ts; break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 305 /* SyntaxKind.SourceFile */ && current.flags & 512 /* SymbolFlags.ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 308 /* SyntaxKind.SourceFile */ && current.flags & 512 /* SymbolFlags.ValueModule */) { return false; } // check that at least one declaration of top level symbol originates from type declaration file @@ -88514,12 +89252,12 @@ var ts; } } function getExternalModuleFileFromDeclaration(declaration) { - var specifier = declaration.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); + var specifier = declaration.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, /*moduleNotFoundError*/ undefined); // TODO: GH#18217 if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 305 /* SyntaxKind.SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 308 /* SyntaxKind.SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors @@ -88731,14 +89469,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node, node.parent, node.parent.parent)) { - if (node.kind === 169 /* SyntaxKind.MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { + if (node.kind === 171 /* SyntaxKind.MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } } - else if (node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (ts.hasDecorators(accessors.firstAccessor) && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -88757,26 +89495,26 @@ var ts; var modifier = _a[_i]; if (ts.isDecorator(modifier)) continue; - if (modifier.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { - if (node.kind === 166 /* SyntaxKind.PropertySignature */ || node.kind === 168 /* SyntaxKind.MethodSignature */) { + if (modifier.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { + if (node.kind === 168 /* SyntaxKind.PropertySignature */ || node.kind === 170 /* SyntaxKind.MethodSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 176 /* SyntaxKind.IndexSignature */ && (modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ || !ts.isClassLike(node.parent))) { + if (node.kind === 178 /* SyntaxKind.IndexSignature */ && (modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ || !ts.isClassLike(node.parent))) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } - if (modifier.kind !== 101 /* SyntaxKind.InKeyword */ && modifier.kind !== 144 /* SyntaxKind.OutKeyword */) { - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { + if (modifier.kind !== 101 /* SyntaxKind.InKeyword */ && modifier.kind !== 145 /* SyntaxKind.OutKeyword */) { + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_parameter, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { case 85 /* SyntaxKind.ConstKeyword */: - if (node.kind !== 260 /* SyntaxKind.EnumDeclaration */) { + if (node.kind !== 263 /* SyntaxKind.EnumDeclaration */) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(85 /* SyntaxKind.ConstKeyword */)); } break; - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "override"); @@ -88787,7 +89525,10 @@ var ts; else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "accessor"); + } + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "async"); } flags |= 16384 /* ModifierFlags.Override */; @@ -88806,16 +89547,19 @@ var ts; else if (flags & 32 /* ModifierFlags.Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "accessor"); + } else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { if (modifier.kind === 121 /* SyntaxKind.PrivateKeyword */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } @@ -88835,16 +89579,19 @@ var ts; else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "accessor"); + } + else if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } else if (flags & 16384 /* ModifierFlags.Override */) { @@ -88853,11 +89600,26 @@ var ts; flags |= 32 /* ModifierFlags.Static */; lastStatic = modifier; break; - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "accessor"); + } + else if (flags & 64 /* ModifierFlags.Readonly */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "readonly"); + } + else if (flags & 2 /* ModifierFlags.Ambient */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "declare"); + } + else if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */) { + return grammarErrorOnNode(modifier, ts.Diagnostics.accessor_modifier_can_only_appear_on_a_property_declaration); + } + flags |= 128 /* ModifierFlags.Accessor */; + break; + case 146 /* SyntaxKind.ReadonlyKeyword */: if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 166 /* SyntaxKind.PropertySignature */ && node.kind !== 176 /* SyntaxKind.IndexSignature */ && node.kind !== 164 /* SyntaxKind.Parameter */) { + else if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 168 /* SyntaxKind.PropertySignature */ && node.kind !== 178 /* SyntaxKind.IndexSignature */ && node.kind !== 166 /* SyntaxKind.Parameter */) { // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } @@ -88870,35 +89632,35 @@ var ts; else if (flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "abstract"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } else if (ts.isClassLike(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "export"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1 /* ModifierFlags.Export */; break; case 88 /* SyntaxKind.DefaultKeyword */: - var container = node.parent.kind === 305 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 261 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 308 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } else if (!(flags & 1 /* ModifierFlags.Export */)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "default"); } - flags |= 512 /* ModifierFlags.Default */; + flags |= 1024 /* ModifierFlags.Default */; break; - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: if (flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } else if (flags & 16384 /* ModifierFlags.Override */) { @@ -88907,10 +89669,10 @@ var ts; else if (ts.isClassLike(node.parent) && !ts.isPropertyDeclaration(node)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "declare"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if ((node.parent.flags & 16777216 /* NodeFlags.Ambient */) && node.parent.kind === 262 /* SyntaxKind.ModuleBlock */) { + else if ((node.parent.flags & 16777216 /* NodeFlags.Ambient */) && node.parent.kind === 265 /* SyntaxKind.ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } else if (ts.isPrivateIdentifierClassElementDeclaration(node)) { @@ -88920,18 +89682,18 @@ var ts; lastDeclare = modifier; break; case 126 /* SyntaxKind.AbstractKeyword */: - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 257 /* SyntaxKind.ClassDeclaration */ && - node.kind !== 180 /* SyntaxKind.ConstructorType */) { - if (node.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && - node.kind !== 172 /* SyntaxKind.GetAccessor */ && - node.kind !== 173 /* SyntaxKind.SetAccessor */) { + if (node.kind !== 260 /* SyntaxKind.ClassDeclaration */ && + node.kind !== 182 /* SyntaxKind.ConstructorType */) { + if (node.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && + node.kind !== 174 /* SyntaxKind.GetAccessor */ && + node.kind !== 175 /* SyntaxKind.SetAccessor */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ && ts.hasSyntacticModifier(node.parent, 128 /* ModifierFlags.Abstract */))) { + if (!(node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ && ts.hasSyntacticModifier(node.parent, 256 /* ModifierFlags.Abstract */))) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32 /* ModifierFlags.Static */) { @@ -88940,39 +89702,42 @@ var ts; if (flags & 8 /* ModifierFlags.Private */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract"); } - if (flags & 256 /* ModifierFlags.Async */ && lastAsync) { + if (flags & 512 /* ModifierFlags.Async */ && lastAsync) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); } if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "override"); } + if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "accessor"); + } } if (ts.isNamedDeclaration(node) && node.name.kind === 80 /* SyntaxKind.PrivateIdentifier */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "abstract"); } - flags |= 128 /* ModifierFlags.Abstract */; + flags |= 256 /* ModifierFlags.Abstract */; break; - case 131 /* SyntaxKind.AsyncKeyword */: - if (flags & 256 /* ModifierFlags.Async */) { + case 132 /* SyntaxKind.AsyncKeyword */: + if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } else if (flags & 2 /* ModifierFlags.Ambient */ || node.parent.flags & 16777216 /* NodeFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); } - flags |= 256 /* ModifierFlags.Async */; + flags |= 512 /* ModifierFlags.Async */; lastAsync = modifier; break; case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: var inOutFlag = modifier.kind === 101 /* SyntaxKind.InKeyword */ ? 32768 /* ModifierFlags.In */ : 65536 /* ModifierFlags.Out */; var inOutText = modifier.kind === 101 /* SyntaxKind.InKeyword */ ? "in" : "out"; - if (node.kind !== 163 /* SyntaxKind.TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) { + if (node.kind !== 165 /* SyntaxKind.TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText); } if (flags & inOutFlag) { @@ -88985,28 +89750,28 @@ var ts; break; } } - if (node.kind === 171 /* SyntaxKind.Constructor */) { + if (node.kind === 173 /* SyntaxKind.Constructor */) { if (flags & 32 /* ModifierFlags.Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(lastOverride, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "override"); // TODO: GH#18217 } - if (flags & 256 /* ModifierFlags.Async */) { + if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); } return false; } - else if ((node.kind === 266 /* SyntaxKind.ImportDeclaration */ || node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) && flags & 2 /* ModifierFlags.Ambient */) { + else if ((node.kind === 269 /* SyntaxKind.ImportDeclaration */ || node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) && flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 166 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); } - else if (node.kind === 164 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && node.dotDotDotToken) { + else if (node.kind === 166 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && node.dotDotDotToken) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } - if (flags & 256 /* ModifierFlags.Async */) { + if (flags & 512 /* ModifierFlags.Async */) { return checkGrammarAsyncModifier(node, lastAsync); } return false; @@ -89024,47 +89789,47 @@ var ts; } function shouldReportBadModifier(node) { switch (node.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 164 /* SyntaxKind.Parameter */: - case 163 /* SyntaxKind.TypeParameter */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 166 /* SyntaxKind.Parameter */: + case 165 /* SyntaxKind.TypeParameter */: return false; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - case 179 /* SyntaxKind.FunctionType */: - case 276 /* SyntaxKind.MissingDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: + case 181 /* SyntaxKind.FunctionType */: + case 279 /* SyntaxKind.MissingDeclaration */: return true; default: - if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return false; } switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - return nodeHasAnyModifiersExcept(node, 131 /* SyntaxKind.AsyncKeyword */); - case 257 /* SyntaxKind.ClassDeclaration */: - case 180 /* SyntaxKind.ConstructorType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + return nodeHasAnyModifiersExcept(node, 132 /* SyntaxKind.AsyncKeyword */); + case 260 /* SyntaxKind.ClassDeclaration */: + case 182 /* SyntaxKind.ConstructorType */: return nodeHasAnyModifiersExcept(node, 126 /* SyntaxKind.AbstractKeyword */); - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return nodeHasAnyModifiersExcept(node, 85 /* SyntaxKind.ConstKeyword */); default: ts.Debug.assertNever(node); @@ -89082,10 +89847,10 @@ var ts; } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return false; } return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); @@ -89314,20 +90079,20 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.kind !== 164 /* SyntaxKind.ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 221 /* SyntaxKind.BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { + if (computedPropertyName.expression.kind === 223 /* SyntaxKind.BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } return false; } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - node.kind === 213 /* SyntaxKind.FunctionExpression */ || - node.kind === 169 /* SyntaxKind.MethodDeclaration */); + ts.Debug.assert(node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + node.kind === 215 /* SyntaxKind.FunctionExpression */ || + node.kind === 171 /* SyntaxKind.MethodDeclaration */); if (node.flags & 16777216 /* NodeFlags.Ambient */) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -89346,7 +90111,7 @@ var ts; var seen = new ts.Map(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 298 /* SyntaxKind.SpreadAssignment */) { + if (prop.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (inDestructuring) { // a rest property cannot be destructured any further var expression = ts.skipParentheses(prop.expression); @@ -89357,11 +90122,11 @@ var ts; continue; } var name = prop.name; - if (name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name); } - if (prop.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern); @@ -89373,7 +90138,7 @@ var ts; if (ts.canHaveModifiers(prop) && prop.modifiers) { for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { var mod = _c[_b]; - if (ts.isModifier(mod) && (mod.kind !== 131 /* SyntaxKind.AsyncKeyword */ || prop.kind !== 169 /* SyntaxKind.MethodDeclaration */)) { + if (ts.isModifier(mod) && (mod.kind !== 132 /* SyntaxKind.AsyncKeyword */ || prop.kind !== 171 /* SyntaxKind.MethodDeclaration */)) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } } @@ -89394,8 +90159,8 @@ var ts; // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = void 0; switch (prop.kind) { - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidExclamationToken(prop.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); @@ -89404,13 +90169,13 @@ var ts; } currentKind = 4 /* DeclarationMeaning.PropertyAssignment */; break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: currentKind = 8 /* DeclarationMeaning.Method */; break; - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: currentKind = 1 /* DeclarationMeaning.GetAccessor */; break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: currentKind = 2 /* DeclarationMeaning.SetAccessor */; break; default: @@ -89453,7 +90218,7 @@ var ts; var seen = new ts.Map(); for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 287 /* SyntaxKind.JsxSpreadAttribute */) { + if (attr.kind === 290 /* SyntaxKind.JsxSpreadAttribute */) { continue; } var name = attr.name, initializer = attr.initializer; @@ -89463,7 +90228,7 @@ var ts; else { return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } - if (initializer && initializer.kind === 288 /* SyntaxKind.JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 291 /* SyntaxKind.JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -89498,7 +90263,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.kind === 244 /* SyntaxKind.ForOfStatement */ && forInOrOfStatement.awaitModifier) { + if (forInOrOfStatement.kind === 247 /* SyntaxKind.ForOfStatement */ && forInOrOfStatement.awaitModifier) { if (!(forInOrOfStatement.flags & 32768 /* NodeFlags.AwaitContext */)) { var sourceFile = ts.getSourceFileOfNode(forInOrOfStatement); if (ts.isInTopLevelContext(forInOrOfStatement)) { @@ -89532,7 +90297,7 @@ var ts; if (!hasParseDiagnostics(sourceFile)) { var diagnostic = ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); var func = ts.getContainingFunction(forInOrOfStatement); - if (func && func.kind !== 171 /* SyntaxKind.Constructor */) { + if (func && func.kind !== 173 /* SyntaxKind.Constructor */) { ts.Debug.assert((ts.getFunctionFlags(func) & 2 /* FunctionFlags.Async */) === 0, "Enclosing function should never be an async function."); var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); ts.addRelatedInfo(diagnostic, relatedInfo); @@ -89549,7 +90314,7 @@ var ts; grammarErrorOnNode(forInOrOfStatement.initializer, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async); return false; } - if (forInOrOfStatement.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -89564,20 +90329,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -89587,22 +90352,22 @@ var ts; return false; } function checkGrammarAccessor(accessor) { - if (!(accessor.flags & 16777216 /* NodeFlags.Ambient */) && (accessor.parent.kind !== 182 /* SyntaxKind.TypeLiteral */) && (accessor.parent.kind !== 258 /* SyntaxKind.InterfaceDeclaration */)) { + if (!(accessor.flags & 16777216 /* NodeFlags.Ambient */) && (accessor.parent.kind !== 184 /* SyntaxKind.TypeLiteral */) && (accessor.parent.kind !== 261 /* SyntaxKind.InterfaceDeclaration */)) { if (languageVersion < 1 /* ScriptTarget.ES5 */) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); } if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isPrivateIdentifier(accessor.name)) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } - if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 128 /* ModifierFlags.Abstract */)) { + if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 256 /* ModifierFlags.Abstract */)) { return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } if (accessor.body) { - if (ts.hasSyntacticModifier(accessor, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(accessor, 256 /* ModifierFlags.Abstract */)) { return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); } - if (accessor.parent.kind === 182 /* SyntaxKind.TypeLiteral */ || accessor.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (accessor.parent.kind === 184 /* SyntaxKind.TypeLiteral */ || accessor.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return grammarErrorOnNode(accessor.body, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } } @@ -89610,11 +90375,11 @@ var ts; return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } if (!doesAccessorHaveCorrectParameterCount(accessor)) { - return grammarErrorOnNode(accessor.name, accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? + return grammarErrorOnNode(accessor.name, accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? ts.Diagnostics.A_get_accessor_cannot_have_parameters : ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - if (accessor.kind === 173 /* SyntaxKind.SetAccessor */) { + if (accessor.kind === 175 /* SyntaxKind.SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -89636,17 +90401,17 @@ var ts; * A set accessor has one parameter or a `this` parameter and one more parameter. */ function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? 1 : 2)) { + if (accessor.parameters.length === (accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? 1 : 2)) { return ts.getThisParameter(accessor); } } function checkGrammarTypeOperatorNode(node) { - if (node.operator === 154 /* SyntaxKind.UniqueKeyword */) { - if (node.type.kind !== 151 /* SyntaxKind.SymbolKeyword */) { - return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(151 /* SyntaxKind.SymbolKeyword */)); + if (node.operator === 156 /* SyntaxKind.UniqueKeyword */) { + if (node.type.kind !== 153 /* SyntaxKind.SymbolKeyword */) { + return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(153 /* SyntaxKind.SymbolKeyword */)); } var parent = ts.walkUpParenthesizedTypes(node.parent); if (ts.isInJSFile(parent) && ts.isJSDocTypeExpression(parent)) { @@ -89656,7 +90421,7 @@ var ts; } } switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: var decl = parent; if (decl.name.kind !== 79 /* SyntaxKind.Identifier */) { return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name); @@ -89668,13 +90433,13 @@ var ts; return grammarErrorOnNode(parent.name, ts.Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const); } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (!ts.isStatic(parent) || !ts.hasEffectiveReadonlyModifier(parent)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly); } break; - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (!ts.hasSyntacticModifier(parent, 64 /* ModifierFlags.Readonly */)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly); } @@ -89683,9 +90448,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_are_not_allowed_here); } } - else if (node.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { - if (node.type.kind !== 183 /* SyntaxKind.ArrayType */ && node.type.kind !== 184 /* SyntaxKind.TupleType */) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(151 /* SyntaxKind.SymbolKeyword */)); + else if (node.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { + if (node.type.kind !== 185 /* SyntaxKind.ArrayType */ && node.type.kind !== 186 /* SyntaxKind.TupleType */) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(153 /* SyntaxKind.SymbolKeyword */)); } } } @@ -89698,10 +90463,10 @@ var ts; if (checkGrammarFunctionLikeDeclaration(node)) { return true; } - if (node.kind === 169 /* SyntaxKind.MethodDeclaration */) { - if (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (node.kind === 171 /* SyntaxKind.MethodDeclaration */) { + if (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // We only disallow modifier on a method declaration if it is a property of object-literal-expression - if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 131 /* SyntaxKind.AsyncKeyword */)) { + if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 132 /* SyntaxKind.AsyncKeyword */)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } else if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { @@ -89730,14 +90495,14 @@ var ts; if (node.flags & 16777216 /* NodeFlags.Ambient */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.kind === 169 /* SyntaxKind.MethodDeclaration */ && !node.body) { + else if (node.kind === 171 /* SyntaxKind.MethodDeclaration */ && !node.body) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } - else if (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + else if (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.parent.kind === 182 /* SyntaxKind.TypeLiteral */) { + else if (node.parent.kind === 184 /* SyntaxKind.TypeLiteral */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } @@ -89748,11 +90513,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: if (node.label && current.label.escapedText === node.label.escapedText) { // found matching label - verify that label usage is correct // continue can only target labels that are on iteration statements - var isMisplacedContinueLabel = node.kind === 245 /* SyntaxKind.ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 248 /* SyntaxKind.ContinueStatement */ && !ts.isIterationStatement(current.statement, /*lookInLabeledStatement*/ true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -89760,8 +90525,8 @@ var ts; return false; } break; - case 249 /* SyntaxKind.SwitchStatement */: - if (node.kind === 246 /* SyntaxKind.BreakStatement */ && !node.label) { + case 252 /* SyntaxKind.SwitchStatement */: + if (node.kind === 249 /* SyntaxKind.BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -89776,13 +90541,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 246 /* SyntaxKind.BreakStatement */ + var message = node.kind === 249 /* SyntaxKind.BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 246 /* SyntaxKind.BreakStatement */ + var message = node.kind === 249 /* SyntaxKind.BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -89806,12 +90571,12 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return ts.isStringOrNumericLiteralLike(expr) || - expr.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && + expr.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 8 /* SyntaxKind.NumericLiteral */; } function isBigIntLiteralExpression(expr) { return expr.kind === 9 /* SyntaxKind.BigIntLiteral */ || - expr.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && + expr.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 9 /* SyntaxKind.BigIntLiteral */; } function isSimpleLiteralEnumReference(expr) { @@ -89839,7 +90604,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */ && node.parent.parent.kind !== 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */ && node.parent.parent.kind !== 247 /* SyntaxKind.ForOfStatement */) { if (node.flags & 16777216 /* NodeFlags.Ambient */) { checkAmbientInitializer(node); } @@ -89852,7 +90617,7 @@ var ts; } } } - if (node.exclamationToken && (node.parent.parent.kind !== 237 /* SyntaxKind.VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* NodeFlags.Ambient */)) { + if (node.exclamationToken && (node.parent.parent.kind !== 240 /* SyntaxKind.VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* NodeFlags.Ambient */)) { var message = node.initializer ? ts.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type @@ -89919,15 +90684,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return false; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -90021,8 +90786,14 @@ var ts; if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isPrivateIdentifier(node.name)) { return grammarErrorOnNode(node.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } + if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isAutoAccessorPropertyDeclaration(node)) { + return grammarErrorOnNode(node.name, ts.Diagnostics.Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher); + } + if (ts.isAutoAccessorPropertyDeclaration(node) && checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_accessor_property_cannot_be_declared_optional)) { + return true; + } } - else if (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + else if (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) { return true; } @@ -90068,14 +90839,14 @@ var ts; // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */ || - node.kind === 266 /* SyntaxKind.ImportDeclaration */ || - node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ || - node.kind === 272 /* SyntaxKind.ExportDeclaration */ || - node.kind === 271 /* SyntaxKind.ExportAssignment */ || - node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ || - ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */ | 1 /* ModifierFlags.Export */ | 512 /* ModifierFlags.Default */)) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */ || + node.kind === 269 /* SyntaxKind.ImportDeclaration */ || + node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ || + node.kind === 275 /* SyntaxKind.ExportDeclaration */ || + node.kind === 274 /* SyntaxKind.ExportAssignment */ || + node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ || + ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */ | 1 /* ModifierFlags.Export */ | 1024 /* ModifierFlags.Default */)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier); @@ -90083,7 +90854,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 237 /* SyntaxKind.VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 240 /* SyntaxKind.VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -90106,7 +90877,7 @@ var ts; // to prevent noisiness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 235 /* SyntaxKind.Block */ || node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.parent.kind === 238 /* SyntaxKind.Block */ || node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { var links_2 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_2.hasReportedStatementInAmbientContext) { @@ -90128,10 +90899,10 @@ var ts; if (languageVersion >= 1 /* ScriptTarget.ES5 */) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 196 /* SyntaxKind.LiteralType */)) { + else if (ts.isChildOfNodeWithKind(node, 198 /* SyntaxKind.LiteralType */)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 299 /* SyntaxKind.EnumMember */)) { + else if (ts.isChildOfNodeWithKind(node, 302 /* SyntaxKind.EnumMember */)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -90203,7 +90974,7 @@ var ts; if (node.isTypeOnly && node.name && node.namedBindings) { return grammarErrorOnNode(node, ts.Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both); } - if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 269 /* SyntaxKind.NamedImports */) { + if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 272 /* SyntaxKind.NamedImports */) { return checkGrammarNamedImportsOrExports(node.namedBindings); } return false; @@ -90211,7 +90982,7 @@ var ts; function checkGrammarNamedImportsOrExports(namedBindings) { return !!ts.forEach(namedBindings.elements, function (specifier) { if (specifier.isTypeOnly) { - return grammarErrorOnFirstToken(specifier, specifier.kind === 270 /* SyntaxKind.ImportSpecifier */ + return grammarErrorOnFirstToken(specifier, specifier.kind === 273 /* SyntaxKind.ImportSpecifier */ ? ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement : ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement); } @@ -90225,7 +90996,7 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments); } var nodeArguments = node.arguments; - if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext) { + if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext && moduleKind !== ts.ModuleKind.Node16) { // We are allowed trailing comma after proposal-import-assertions. checkGrammarForDisallowedTrailingComma(nodeArguments); if (nodeArguments.length > 1) { @@ -90334,14 +91105,14 @@ var ts; return !ts.isAccessor(declaration); } function isNotOverload(declaration) { - return (declaration.kind !== 256 /* SyntaxKind.FunctionDeclaration */ && declaration.kind !== 169 /* SyntaxKind.MethodDeclaration */) || + return (declaration.kind !== 259 /* SyntaxKind.FunctionDeclaration */ && declaration.kind !== 171 /* SyntaxKind.MethodDeclaration */) || !!declaration.body; } /** Like 'isDeclarationName', but returns true for LHS of `import { x as y }` or `export { x as y }`. */ function isDeclarationNameOrImportPropertyName(name) { switch (name.parent.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return ts.isIdentifier(name); default: return ts.isDeclarationName(name); @@ -90377,6 +91148,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { + var _a; function visitNode(node, visitor, test, lift) { if (node === undefined || visitor === undefined) { return node; @@ -90443,7 +91215,6 @@ var ts; return nodes; } ts.visitNodes = visitNodes; - /* @internal */ function visitArray(nodes, visitor, test, start, count) { if (nodes === undefined) { return nodes; @@ -90591,12 +91362,10 @@ var ts; return updated; } ts.visitFunctionBody = visitFunctionBody; - /** - * Visits an iteration body, adding any block-scoped variables required by the transformation. - */ - function visitIterationBody(body, visitor, context) { + function visitIterationBody(body, visitor, context, nodeVisitor) { + if (nodeVisitor === void 0) { nodeVisitor = visitNode; } context.startBlockScope(); - var updated = visitNode(body, visitor, ts.isStatement, context.factory.liftToBlock); + var updated = nodeVisitor(body, visitor, ts.isStatement, context.factory.liftToBlock); var declarations = context.endBlockScope(); if (ts.some(declarations)) { if (ts.isBlock(updated)) { @@ -90615,456 +91384,446 @@ var ts; if (node === undefined) { return undefined; } - var kind = node.kind; - // No need to visit nodes with no children. - if ((kind > 0 /* SyntaxKind.FirstToken */ && kind <= 160 /* SyntaxKind.LastToken */) || kind === 192 /* SyntaxKind.ThisType */) { - return node; - } - var factory = context.factory; - switch (kind) { - // Names - case 79 /* SyntaxKind.Identifier */: - ts.Debug.type(node); - return factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration)); - case 161 /* SyntaxKind.QualifiedName */: - ts.Debug.type(node); - return factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier)); - case 162 /* SyntaxKind.ComputedPropertyName */: - ts.Debug.type(node); - return factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Signature elements - case 163 /* SyntaxKind.TypeParameter */: - ts.Debug.type(node); - return factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode)); - case 164 /* SyntaxKind.Parameter */: - ts.Debug.type(node); - return factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 165 /* SyntaxKind.Decorator */: - ts.Debug.type(node); - return factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Type elements - case 166 /* SyntaxKind.PropertySignature */: - ts.Debug.type(node); - return factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 167 /* SyntaxKind.PropertyDeclaration */: - ts.Debug.type(node); - return factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), - // QuestionToken and ExclamationToken is uniqued in Property Declaration and the signature of 'updateProperty' is that too - nodeVisitor(node.questionToken || node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 168 /* SyntaxKind.MethodSignature */: - ts.Debug.type(node); - return factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 169 /* SyntaxKind.MethodDeclaration */: - ts.Debug.type(node); - return factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 171 /* SyntaxKind.Constructor */: - ts.Debug.type(node); - return factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 172 /* SyntaxKind.GetAccessor */: - ts.Debug.type(node); - return factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 173 /* SyntaxKind.SetAccessor */: - ts.Debug.type(node); - return factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - ts.Debug.type(node); - context.startLexicalEnvironment(); - context.suspendLexicalEnvironment(); - return factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 174 /* SyntaxKind.CallSignature */: - ts.Debug.type(node); - return factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 175 /* SyntaxKind.ConstructSignature */: - ts.Debug.type(node); - return factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 176 /* SyntaxKind.IndexSignature */: - ts.Debug.type(node); - return factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - // Types - case 177 /* SyntaxKind.TypePredicate */: - ts.Debug.type(node); - return factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 178 /* SyntaxKind.TypeReference */: - ts.Debug.type(node); - return factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 179 /* SyntaxKind.FunctionType */: - ts.Debug.type(node); - return factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 180 /* SyntaxKind.ConstructorType */: - ts.Debug.type(node); - return factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 181 /* SyntaxKind.TypeQuery */: - ts.Debug.type(node); - return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 182 /* SyntaxKind.TypeLiteral */: - ts.Debug.type(node); - return factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 183 /* SyntaxKind.ArrayType */: - ts.Debug.type(node); - return factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode)); - case 184 /* SyntaxKind.TupleType */: - ts.Debug.type(node); - return factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode)); - case 185 /* SyntaxKind.OptionalType */: - ts.Debug.type(node); - return factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 186 /* SyntaxKind.RestType */: - ts.Debug.type(node); - return factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 187 /* SyntaxKind.UnionType */: - ts.Debug.type(node); - return factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 188 /* SyntaxKind.IntersectionType */: - ts.Debug.type(node); - return factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 189 /* SyntaxKind.ConditionalType */: - ts.Debug.type(node); - return factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode)); - case 190 /* SyntaxKind.InferType */: - ts.Debug.type(node); - return factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); - case 200 /* SyntaxKind.ImportType */: - ts.Debug.type(node); - return factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isNode), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); - case 295 /* SyntaxKind.ImportTypeAssertionContainer */: - ts.Debug.type(node); - return factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isNode), node.multiLine); - case 197 /* SyntaxKind.NamedTupleMember */: - ts.Debug.type(node); - return factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 191 /* SyntaxKind.ParenthesizedType */: - ts.Debug.type(node); - return factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 193 /* SyntaxKind.TypeOperator */: - ts.Debug.type(node); - return factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 194 /* SyntaxKind.IndexedAccessType */: - ts.Debug.type(node); - return factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode)); - case 195 /* SyntaxKind.MappedType */: - ts.Debug.type(node); - return factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 196 /* SyntaxKind.LiteralType */: - ts.Debug.type(node); - return factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression)); - case 198 /* SyntaxKind.TemplateLiteralType */: - ts.Debug.type(node); - return factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan)); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: - ts.Debug.type(node); - return factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - // Binding patterns - case 201 /* SyntaxKind.ObjectBindingPattern */: - ts.Debug.type(node); - return factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); - case 202 /* SyntaxKind.ArrayBindingPattern */: - ts.Debug.type(node); - return factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); - case 203 /* SyntaxKind.BindingElement */: - ts.Debug.type(node); - return factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - // Expression - case 204 /* SyntaxKind.ArrayLiteralExpression */: - ts.Debug.type(node); - return factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - case 205 /* SyntaxKind.ObjectLiteralExpression */: - ts.Debug.type(node); - return factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); - case 206 /* SyntaxKind.PropertyAccessExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName)); - } - ts.Debug.type(node); - return factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName)); - case 207 /* SyntaxKind.ElementAccessExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); - case 208 /* SyntaxKind.CallExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 209 /* SyntaxKind.NewExpression */: - ts.Debug.type(node); - return factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - ts.Debug.type(node); - return factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral)); - case 211 /* SyntaxKind.TypeAssertionExpression */: - ts.Debug.type(node); - return factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 212 /* SyntaxKind.ParenthesizedExpression */: - ts.Debug.type(node); - return factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 213 /* SyntaxKind.FunctionExpression */: - ts.Debug.type(node); - return factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 214 /* SyntaxKind.ArrowFunction */: - ts.Debug.type(node); - return factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 215 /* SyntaxKind.DeleteExpression */: - ts.Debug.type(node); - return factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 216 /* SyntaxKind.TypeOfExpression */: - ts.Debug.type(node); - return factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 217 /* SyntaxKind.VoidExpression */: - ts.Debug.type(node); - return factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 218 /* SyntaxKind.AwaitExpression */: - ts.Debug.type(node); - return factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - ts.Debug.type(node); - return factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - ts.Debug.type(node); - return factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); - case 221 /* SyntaxKind.BinaryExpression */: - ts.Debug.type(node); - return factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression)); - case 222 /* SyntaxKind.ConditionalExpression */: - ts.Debug.type(node); - return factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression)); - case 223 /* SyntaxKind.TemplateExpression */: - ts.Debug.type(node); - return factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); - case 224 /* SyntaxKind.YieldExpression */: - ts.Debug.type(node); - return factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 225 /* SyntaxKind.SpreadElement */: - ts.Debug.type(node); - return factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 226 /* SyntaxKind.ClassExpression */: - ts.Debug.type(node); - return factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - ts.Debug.type(node); - return factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 229 /* SyntaxKind.AsExpression */: - ts.Debug.type(node); - return factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 230 /* SyntaxKind.NonNullExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 231 /* SyntaxKind.MetaProperty */: - ts.Debug.type(node); - return factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - // Misc - case 233 /* SyntaxKind.TemplateSpan */: - ts.Debug.type(node); - return factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - // Element - case 235 /* SyntaxKind.Block */: - ts.Debug.type(node); - return factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 237 /* SyntaxKind.VariableStatement */: - ts.Debug.type(node); - return factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 238 /* SyntaxKind.ExpressionStatement */: - ts.Debug.type(node); - return factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 239 /* SyntaxKind.IfStatement */: - ts.Debug.type(node); - return factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, factory.liftToBlock)); - case 240 /* SyntaxKind.DoStatement */: - ts.Debug.type(node); - return factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 241 /* SyntaxKind.WhileStatement */: - ts.Debug.type(node); - return factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 242 /* SyntaxKind.ForStatement */: - ts.Debug.type(node); - return factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 243 /* SyntaxKind.ForInStatement */: - ts.Debug.type(node); - return factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 244 /* SyntaxKind.ForOfStatement */: - ts.Debug.type(node); - return factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 245 /* SyntaxKind.ContinueStatement */: - ts.Debug.type(node); - return factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); - case 246 /* SyntaxKind.BreakStatement */: - ts.Debug.type(node); - return factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); - case 247 /* SyntaxKind.ReturnStatement */: - ts.Debug.type(node); - return factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 248 /* SyntaxKind.WithStatement */: - ts.Debug.type(node); - return factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock)); - case 249 /* SyntaxKind.SwitchStatement */: - ts.Debug.type(node); - return factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock)); - case 250 /* SyntaxKind.LabeledStatement */: - ts.Debug.type(node); - return factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock)); - case 251 /* SyntaxKind.ThrowStatement */: - ts.Debug.type(node); - return factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 252 /* SyntaxKind.TryStatement */: - ts.Debug.type(node); - return factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock)); - case 254 /* SyntaxKind.VariableDeclaration */: - ts.Debug.type(node); - return factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 255 /* SyntaxKind.VariableDeclarationList */: - ts.Debug.type(node); - return factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); - case 256 /* SyntaxKind.FunctionDeclaration */: - ts.Debug.type(node); - return factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 257 /* SyntaxKind.ClassDeclaration */: - ts.Debug.type(node); - return factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 258 /* SyntaxKind.InterfaceDeclaration */: - ts.Debug.type(node); - return factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 259 /* SyntaxKind.TypeAliasDeclaration */: - ts.Debug.type(node); - return factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 260 /* SyntaxKind.EnumDeclaration */: - ts.Debug.type(node); - return factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); - case 261 /* SyntaxKind.ModuleDeclaration */: - ts.Debug.type(node); - return factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody)); - case 262 /* SyntaxKind.ModuleBlock */: - ts.Debug.type(node); - return factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 263 /* SyntaxKind.CaseBlock */: - ts.Debug.type(node); - return factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - ts.Debug.type(node); - return factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - ts.Debug.type(node); - return factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference)); - case 266 /* SyntaxKind.ImportDeclaration */: - ts.Debug.type(node); - return factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); - case 293 /* SyntaxKind.AssertClause */: - ts.Debug.type(node); - return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine); - case 294 /* SyntaxKind.AssertEntry */: - ts.Debug.type(node); - return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode)); - case 267 /* SyntaxKind.ImportClause */: - ts.Debug.type(node); - return factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings)); - case 268 /* SyntaxKind.NamespaceImport */: - ts.Debug.type(node); - return factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 274 /* SyntaxKind.NamespaceExport */: - ts.Debug.type(node); - return factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 269 /* SyntaxKind.NamedImports */: - ts.Debug.type(node); - return factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); - case 270 /* SyntaxKind.ImportSpecifier */: - ts.Debug.type(node); - return factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 271 /* SyntaxKind.ExportAssignment */: - ts.Debug.type(node); - return factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 272 /* SyntaxKind.ExportDeclaration */: - ts.Debug.type(node); - return factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); - case 273 /* SyntaxKind.NamedExports */: - ts.Debug.type(node); - return factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); - case 275 /* SyntaxKind.ExportSpecifier */: - ts.Debug.type(node); - return factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); - // Module references - case 277 /* SyntaxKind.ExternalModuleReference */: - ts.Debug.type(node); - return factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // JSX - case 278 /* SyntaxKind.JsxElement */: - ts.Debug.type(node); - return factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement)); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - ts.Debug.type(node); - return factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); - case 280 /* SyntaxKind.JsxOpeningElement */: - ts.Debug.type(node); - return factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); - case 281 /* SyntaxKind.JsxClosingElement */: - ts.Debug.type(node); - return factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 282 /* SyntaxKind.JsxFragment */: - ts.Debug.type(node); - return factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment)); - case 285 /* SyntaxKind.JsxAttribute */: - ts.Debug.type(node); - return factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 286 /* SyntaxKind.JsxAttributes */: - ts.Debug.type(node); - return factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); - case 287 /* SyntaxKind.JsxSpreadAttribute */: - ts.Debug.type(node); - return factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 288 /* SyntaxKind.JsxExpression */: - ts.Debug.type(node); - return factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Clauses - case 289 /* SyntaxKind.CaseClause */: - ts.Debug.type(node); - return factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); - case 290 /* SyntaxKind.DefaultClause */: - ts.Debug.type(node); - return factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 291 /* SyntaxKind.HeritageClause */: - ts.Debug.type(node); - return factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 292 /* SyntaxKind.CatchClause */: - ts.Debug.type(node); - return factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock)); - // Property assignments - case 296 /* SyntaxKind.PropertyAssignment */: - ts.Debug.type(node); - return factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - ts.Debug.type(node); - return factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 298 /* SyntaxKind.SpreadAssignment */: - ts.Debug.type(node); - return factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Enum - case 299 /* SyntaxKind.EnumMember */: - ts.Debug.type(node); - return factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - // Top-level nodes - case 305 /* SyntaxKind.SourceFile */: - ts.Debug.type(node); - return factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context)); - // Transformation nodes - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - ts.Debug.type(node); - return factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 351 /* SyntaxKind.CommaListExpression */: - ts.Debug.type(node); - return factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - default: - // No need to visit nodes with no children. - return node; - } + var fn = visitEachChildTable[node.kind]; + return fn === undefined ? node : fn(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor); } ts.visitEachChild = visitEachChild; + // NOTE: Before you can add a new method to `visitEachChildTable`, you must first ensure the `Node` subtype you + // wish to add is defined in the `HasChildren` union in types.ts. + var visitEachChildTable = (_a = {}, + _a[79 /* SyntaxKind.Identifier */] = function visitEachChildOfIdentifier(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration)); + }, + _a[163 /* SyntaxKind.QualifiedName */] = function visitEachChildOfQualifiedName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier)); + }, + _a[164 /* SyntaxKind.ComputedPropertyName */] = function visitEachChildOfComputedPropertyName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Signature elements + _a[165 /* SyntaxKind.TypeParameter */] = function visitEachChildOfTypeParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode)); + }, + _a[166 /* SyntaxKind.Parameter */] = function visitEachChildOfParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[167 /* SyntaxKind.Decorator */] = function visitEachChildOfDecorator(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Type elements + _a[168 /* SyntaxKind.PropertySignature */] = function visitEachChildOfPropertySignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[169 /* SyntaxKind.PropertyDeclaration */] = function visitEachChildOfPropertyDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + var _a; + return context.factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), + // QuestionToken and ExclamationToken are mutually exclusive in PropertyDeclaration + nodeVisitor((_a = node.questionToken) !== null && _a !== void 0 ? _a : node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[170 /* SyntaxKind.MethodSignature */] = function visitEachChildOfMethodSignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[171 /* SyntaxKind.MethodDeclaration */] = function visitEachChildOfMethodDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[173 /* SyntaxKind.Constructor */] = function visitEachChildOfConstructorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[174 /* SyntaxKind.GetAccessor */] = function visitEachChildOfGetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[175 /* SyntaxKind.SetAccessor */] = function visitEachChildOfSetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[172 /* SyntaxKind.ClassStaticBlockDeclaration */] = function visitEachChildOfClassStaticBlockDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + context.startLexicalEnvironment(); + context.suspendLexicalEnvironment(); + return context.factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[176 /* SyntaxKind.CallSignature */] = function visitEachChildOfCallSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[177 /* SyntaxKind.ConstructSignature */] = function visitEachChildOfConstructSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[178 /* SyntaxKind.IndexSignature */] = function visitEachChildOfIndexSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + // Types + _a[179 /* SyntaxKind.TypePredicate */] = function visitEachChildOfTypePredicateNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[180 /* SyntaxKind.TypeReference */] = function visitEachChildOfTypeReferenceNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[181 /* SyntaxKind.FunctionType */] = function visitEachChildOfFunctionTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[182 /* SyntaxKind.ConstructorType */] = function visitEachChildOfConstructorTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[183 /* SyntaxKind.TypeQuery */] = function visitEachChildOfTypeQueryNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[184 /* SyntaxKind.TypeLiteral */] = function visitEachChildOfTypeLiteralNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[185 /* SyntaxKind.ArrayType */] = function visitEachChildOfArrayTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode)); + }, + _a[186 /* SyntaxKind.TupleType */] = function visitEachChildOfTupleTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode)); + }, + _a[187 /* SyntaxKind.OptionalType */] = function visitEachChildOfOptionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[188 /* SyntaxKind.RestType */] = function visitEachChildOfRestTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[189 /* SyntaxKind.UnionType */] = function visitEachChildOfUnionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + }, + _a[190 /* SyntaxKind.IntersectionType */] = function visitEachChildOfIntersectionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + }, + _a[191 /* SyntaxKind.ConditionalType */] = function visitEachChildOfConditionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode)); + }, + _a[192 /* SyntaxKind.InferType */] = function visitEachChildOfInferTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); + }, + _a[202 /* SyntaxKind.ImportType */] = function visitEachChildOfImportTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isImportTypeAssertionContainer), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); + }, + _a[298 /* SyntaxKind.ImportTypeAssertionContainer */] = function visitEachChildOfImportTypeAssertionContainer(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isAssertClause), node.multiLine); + }, + _a[199 /* SyntaxKind.NamedTupleMember */] = function visitEachChildOfNamedTupleMember(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[193 /* SyntaxKind.ParenthesizedType */] = function visitEachChildOfParenthesizedType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[195 /* SyntaxKind.TypeOperator */] = function visitEachChildOfTypeOperatorNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[196 /* SyntaxKind.IndexedAccessType */] = function visitEachChildOfIndexedAccessType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode)); + }, + _a[197 /* SyntaxKind.MappedType */] = function visitEachChildOfMappedType(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[198 /* SyntaxKind.LiteralType */] = function visitEachChildOfLiteralTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression)); + }, + _a[200 /* SyntaxKind.TemplateLiteralType */] = function visitEachChildOfTemplateLiteralType(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan)); + }, + _a[201 /* SyntaxKind.TemplateLiteralTypeSpan */] = function visitEachChildOfTemplateLiteralTypeSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + }, + // Binding patterns + _a[203 /* SyntaxKind.ObjectBindingPattern */] = function visitEachChildOfObjectBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); + }, + _a[204 /* SyntaxKind.ArrayBindingPattern */] = function visitEachChildOfArrayBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); + }, + _a[205 /* SyntaxKind.BindingElement */] = function visitEachChildOfBindingElement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + // Expression + _a[206 /* SyntaxKind.ArrayLiteralExpression */] = function visitEachChildOfArrayLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + }, + _a[207 /* SyntaxKind.ObjectLiteralExpression */] = function visitEachChildOfObjectLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); + }, + _a[208 /* SyntaxKind.PropertyAccessExpression */] = function visitEachChildOfPropertyAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isPropertyAccessChain(node) ? + context.factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName)) : + context.factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName)); + }, + _a[209 /* SyntaxKind.ElementAccessExpression */] = function visitEachChildOfElementAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isElementAccessChain(node) ? + context.factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)) : + context.factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); + }, + _a[210 /* SyntaxKind.CallExpression */] = function visitEachChildOfCallExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isCallChain(node) ? + context.factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)) : + context.factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + }, + _a[211 /* SyntaxKind.NewExpression */] = function visitEachChildOfNewExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + }, + _a[212 /* SyntaxKind.TaggedTemplateExpression */] = function visitEachChildOfTaggedTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral)); + }, + _a[213 /* SyntaxKind.TypeAssertionExpression */] = function visitEachChildOfTypeAssertionExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[214 /* SyntaxKind.ParenthesizedExpression */] = function visitEachChildOfParenthesizedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[215 /* SyntaxKind.FunctionExpression */] = function visitEachChildOfFunctionExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[216 /* SyntaxKind.ArrowFunction */] = function visitEachChildOfArrowFunction(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[217 /* SyntaxKind.DeleteExpression */] = function visitEachChildOfDeleteExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[218 /* SyntaxKind.TypeOfExpression */] = function visitEachChildOfTypeOfExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[219 /* SyntaxKind.VoidExpression */] = function visitEachChildOfVoidExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[220 /* SyntaxKind.AwaitExpression */] = function visitEachChildOfAwaitExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[221 /* SyntaxKind.PrefixUnaryExpression */] = function visitEachChildOfPrefixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); + }, + _a[222 /* SyntaxKind.PostfixUnaryExpression */] = function visitEachChildOfPostfixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); + }, + _a[223 /* SyntaxKind.BinaryExpression */] = function visitEachChildOfBinaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression)); + }, + _a[224 /* SyntaxKind.ConditionalExpression */] = function visitEachChildOfConditionalExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression)); + }, + _a[225 /* SyntaxKind.TemplateExpression */] = function visitEachChildOfTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); + }, + _a[226 /* SyntaxKind.YieldExpression */] = function visitEachChildOfYieldExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[227 /* SyntaxKind.SpreadElement */] = function visitEachChildOfSpreadElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[228 /* SyntaxKind.ClassExpression */] = function visitEachChildOfClassExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + }, + _a[230 /* SyntaxKind.ExpressionWithTypeArguments */] = function visitEachChildOfExpressionWithTypeArguments(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[231 /* SyntaxKind.AsExpression */] = function visitEachChildOfAsExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[235 /* SyntaxKind.SatisfiesExpression */] = function visitEachChildOfSatisfiesExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSatisfiesExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[232 /* SyntaxKind.NonNullExpression */] = function visitEachChildOfNonNullExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return ts.isOptionalChain(node) ? + context.factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression)) : + context.factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[233 /* SyntaxKind.MetaProperty */] = function visitEachChildOfMetaProperty(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + // Misc + _a[236 /* SyntaxKind.TemplateSpan */] = function visitEachChildOfTemplateSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + }, + // Element + _a[238 /* SyntaxKind.Block */] = function visitEachChildOfBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[240 /* SyntaxKind.VariableStatement */] = function visitEachChildOfVariableStatement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList)); + }, + _a[241 /* SyntaxKind.ExpressionStatement */] = function visitEachChildOfExpressionStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[242 /* SyntaxKind.IfStatement */] = function visitEachChildOfIfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, context.factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[243 /* SyntaxKind.DoStatement */] = function visitEachChildOfDoStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context, nodeVisitor), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[244 /* SyntaxKind.WhileStatement */] = function visitEachChildOfWhileStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[245 /* SyntaxKind.ForStatement */] = function visitEachChildOfForStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[246 /* SyntaxKind.ForInStatement */] = function visitEachChildOfForInStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[247 /* SyntaxKind.ForOfStatement */] = function visitEachChildOfForOfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[248 /* SyntaxKind.ContinueStatement */] = function visitEachChildOfContinueStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); + }, + _a[249 /* SyntaxKind.BreakStatement */] = function visitEachChildOfBreakStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); + }, + _a[250 /* SyntaxKind.ReturnStatement */] = function visitEachChildOfReturnStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[251 /* SyntaxKind.WithStatement */] = function visitEachChildOfWithStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[252 /* SyntaxKind.SwitchStatement */] = function visitEachChildOfSwitchStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock)); + }, + _a[253 /* SyntaxKind.LabeledStatement */] = function visitEachChildOfLabeledStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[254 /* SyntaxKind.ThrowStatement */] = function visitEachChildOfThrowStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[255 /* SyntaxKind.TryStatement */] = function visitEachChildOfTryStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock)); + }, + _a[257 /* SyntaxKind.VariableDeclaration */] = function visitEachChildOfVariableDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[258 /* SyntaxKind.VariableDeclarationList */] = function visitEachChildOfVariableDeclarationList(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); + }, + _a[259 /* SyntaxKind.FunctionDeclaration */] = function visitEachChildOfFunctionDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[260 /* SyntaxKind.ClassDeclaration */] = function visitEachChildOfClassDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + }, + _a[261 /* SyntaxKind.InterfaceDeclaration */] = function visitEachChildOfInterfaceDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[262 /* SyntaxKind.TypeAliasDeclaration */] = function visitEachChildOfTypeAliasDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[263 /* SyntaxKind.EnumDeclaration */] = function visitEachChildOfEnumDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); + }, + _a[264 /* SyntaxKind.ModuleDeclaration */] = function visitEachChildOfModuleDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody)); + }, + _a[265 /* SyntaxKind.ModuleBlock */] = function visitEachChildOfModuleBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[266 /* SyntaxKind.CaseBlock */] = function visitEachChildOfCaseBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); + }, + _a[267 /* SyntaxKind.NamespaceExportDeclaration */] = function visitEachChildOfNamespaceExportDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[268 /* SyntaxKind.ImportEqualsDeclaration */] = function visitEachChildOfImportEqualsDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference)); + }, + _a[269 /* SyntaxKind.ImportDeclaration */] = function visitEachChildOfImportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); + }, + _a[296 /* SyntaxKind.AssertClause */] = function visitEachChildOfAssertClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine); + }, + _a[297 /* SyntaxKind.AssertEntry */] = function visitEachChildOfAssertEntry(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpression)); + }, + _a[270 /* SyntaxKind.ImportClause */] = function visitEachChildOfImportClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings)); + }, + _a[271 /* SyntaxKind.NamespaceImport */] = function visitEachChildOfNamespaceImport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[277 /* SyntaxKind.NamespaceExport */] = function visitEachChildOfNamespaceExport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[272 /* SyntaxKind.NamedImports */] = function visitEachChildOfNamedImports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); + }, + _a[273 /* SyntaxKind.ImportSpecifier */] = function visitEachChildOfImportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[274 /* SyntaxKind.ExportAssignment */] = function visitEachChildOfExportAssignment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[275 /* SyntaxKind.ExportDeclaration */] = function visitEachChildOfExportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); + }, + _a[276 /* SyntaxKind.NamedExports */] = function visitEachChildOfNamedExports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); + }, + _a[278 /* SyntaxKind.ExportSpecifier */] = function visitEachChildOfExportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + // Module references + _a[280 /* SyntaxKind.ExternalModuleReference */] = function visitEachChildOfExternalModuleReference(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // JSX + _a[281 /* SyntaxKind.JsxElement */] = function visitEachChildOfJsxElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement)); + }, + _a[282 /* SyntaxKind.JsxSelfClosingElement */] = function visitEachChildOfJsxSelfClosingElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); + }, + _a[283 /* SyntaxKind.JsxOpeningElement */] = function visitEachChildOfJsxOpeningElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); + }, + _a[284 /* SyntaxKind.JsxClosingElement */] = function visitEachChildOfJsxClosingElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression)); + }, + _a[285 /* SyntaxKind.JsxFragment */] = function visitEachChildOfJsxFragment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment)); + }, + _a[288 /* SyntaxKind.JsxAttribute */] = function visitEachChildOfJsxAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); + }, + _a[289 /* SyntaxKind.JsxAttributes */] = function visitEachChildOfJsxAttributes(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); + }, + _a[290 /* SyntaxKind.JsxSpreadAttribute */] = function visitEachChildOfJsxSpreadAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[291 /* SyntaxKind.JsxExpression */] = function visitEachChildOfJsxExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Clauses + _a[292 /* SyntaxKind.CaseClause */] = function visitEachChildOfCaseClause(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[293 /* SyntaxKind.DefaultClause */] = function visitEachChildOfDefaultClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[294 /* SyntaxKind.HeritageClause */] = function visitEachChildOfHeritageClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); + }, + _a[295 /* SyntaxKind.CatchClause */] = function visitEachChildOfCatchClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock)); + }, + // Property assignments + _a[299 /* SyntaxKind.PropertyAssignment */] = function visitEachChildOfPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[300 /* SyntaxKind.ShorthandPropertyAssignment */] = function visitEachChildOfShorthandPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression)); + }, + _a[301 /* SyntaxKind.SpreadAssignment */] = function visitEachChildOfSpreadAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Enum + _a[302 /* SyntaxKind.EnumMember */] = function visitEachChildOfEnumMember(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + // Top-level nodes + _a[308 /* SyntaxKind.SourceFile */] = function visitEachChildOfSourceFile(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context, /*start*/ undefined, /*ensureUseStrict*/ undefined, nodesVisitor)); + }, + // Transformation nodes + _a[353 /* SyntaxKind.PartiallyEmittedExpression */] = function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[354 /* SyntaxKind.CommaListExpression */] = function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + }, + _a); /** * Extracts the single node from a NodeArray. * @@ -91132,7 +91891,7 @@ var ts; exit(); return sourceIndex; } - /* eslint-disable boolean-trivia, no-null/no-null */ + /* eslint-disable local/boolean-trivia, no-null/no-null */ function setSourceContent(sourceIndex, content) { enter(); if (content !== null) { @@ -91145,7 +91904,7 @@ var ts; } exit(); } - /* eslint-enable boolean-trivia, no-null/no-null */ + /* eslint-enable local/boolean-trivia, no-null/no-null */ function addName(name) { enter(); if (!nameToNameIndexMap) @@ -91747,7 +92506,7 @@ var ts; function chainBundle(context, transformSourceFile) { return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -91798,7 +92557,7 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: // import "mod" // import x from "mod" // import * as x from "mod" @@ -91811,13 +92570,13 @@ var ts; hasImportDefault = true; } break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - if (node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + if (node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { // import x = require("mod") externalImports.push(node); } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -91848,13 +92607,13 @@ var ts; addExportedNamesForExportDeclaration(node); } break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; } break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { for (var _b = 0, _c = node.declarationList.declarations; _b < _c.length; _b++) { var decl = _c[_b]; @@ -91862,9 +92621,9 @@ var ts; } } break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - if (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { // export default function() { } if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); @@ -91882,9 +92641,9 @@ var ts; } } break; - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - if (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { // export default class { } if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); @@ -92062,7 +92821,7 @@ var ts; * @param isStatic A value indicating whether the member should be a static or instance member. */ function isInitializedProperty(member) { - return member.kind === 167 /* SyntaxKind.PropertyDeclaration */ + return member.kind === 169 /* SyntaxKind.PropertyDeclaration */ && member.initializer !== undefined; } ts.isInitializedProperty = isInitializedProperty; @@ -92072,7 +92831,7 @@ var ts; * @param member The class element node. */ function isNonStaticMethodOrAccessorWithPrivateName(member) { - return !ts.isStatic(member) && ts.isMethodOrAccessor(member) && ts.isPrivateIdentifier(member.name); + return !ts.isStatic(member) && (ts.isMethodOrAccessor(member) || ts.isAutoAccessorPropertyDeclaration(member)) && ts.isPrivateIdentifier(member.name); } ts.isNonStaticMethodOrAccessorWithPrivateName = isNonStaticMethodOrAccessorWithPrivateName; /** @@ -92126,12 +92885,12 @@ var ts; */ function getAllDecoratorsOfClassElement(member, parent) { switch (member.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return getAllDecoratorsOfAccessors(member, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return getAllDecoratorsOfMethod(member); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return getAllDecoratorsOfProperty(member); default: return undefined; @@ -92792,8 +93551,8 @@ var ts; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; // Enable substitution for property/element access to emit const enum values. - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // These variables contain state that changes as we descend into the tree. var currentSourceFile; var currentNamespace; @@ -92813,14 +93572,14 @@ var ts; var applicableSubstitutions; return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - if (node.kind === 306 /* SyntaxKind.Bundle */) { + if (node.kind === 309 /* SyntaxKind.Bundle */) { return transformBundle(node); } return transformSourceFile(node); } function transformBundle(node) { return factory.createBundle(node.sourceFiles.map(transformSourceFile), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 308 /* SyntaxKind.InputFiles */) { + if (prepend.kind === 311 /* SyntaxKind.InputFiles */) { return ts.createUnparsedSourceFile(prepend, "js"); } return prepend; @@ -92869,15 +93628,15 @@ var ts; */ function onBeforeVisitNode(node) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 263 /* SyntaxKind.CaseBlock */: - case 262 /* SyntaxKind.ModuleBlock */: - case 235 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 266 /* SyntaxKind.CaseBlock */: + case 265 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: currentLexicalScope = node; currentScopeFirstDeclarationsOfName = undefined; break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */)) { break; } @@ -92889,7 +93648,7 @@ var ts; // These nodes should always have names unless they are default-exports; // however, class declaration parsing allows for undefined names, so syntactically invalid // programs may also have an undefined name. - ts.Debug.assert(node.kind === 257 /* SyntaxKind.ClassDeclaration */ || ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)); + ts.Debug.assert(node.kind === 260 /* SyntaxKind.ClassDeclaration */ || ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)); } break; } @@ -92928,10 +93687,10 @@ var ts; */ function sourceElementVisitorWorker(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitElidableStatement(node); default: return visitorWorker(node); @@ -92952,13 +93711,13 @@ var ts; return node; } switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); default: ts.Debug.fail("Unhandled ellided statement"); @@ -92978,11 +93737,11 @@ var ts; * @param node The node to visit. */ function namespaceElementVisitorWorker(node) { - if (node.kind === 272 /* SyntaxKind.ExportDeclaration */ || - node.kind === 266 /* SyntaxKind.ImportDeclaration */ || - node.kind === 267 /* SyntaxKind.ImportClause */ || - (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && - node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */)) { + if (node.kind === 275 /* SyntaxKind.ExportDeclaration */ || + node.kind === 269 /* SyntaxKind.ImportDeclaration */ || + node.kind === 270 /* SyntaxKind.ImportClause */ || + (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && + node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */)) { // do not emit ES6 imports and exports since they are illegal inside a namespace return undefined; } @@ -93006,27 +93765,27 @@ var ts; */ function classElementVisitorWorker(node, parent) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return visitConstructor(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // Property declarations are not TypeScript syntax, but they must be visited // for the decorator transformation. return visitPropertyDeclaration(node, parent); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node, parent); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node, parent); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return ts.visitEachChild(node, visitor, context); - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: return node; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Index signatures are elided return; default: @@ -93038,17 +93797,17 @@ var ts; } function objectLiteralElementVisitorWorker(node, parent) { switch (node.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return visitor(node); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node, parent); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node, parent); @@ -93059,7 +93818,7 @@ var ts; function modifierVisitor(node) { if (ts.isDecorator(node)) return undefined; - if (ts.modifierToFlag(node.kind) & 116958 /* ModifierFlags.TypeScriptModifier */) { + if (ts.modifierToFlag(node.kind) & 117086 /* ModifierFlags.TypeScriptModifier */) { return undefined; } else if (currentNamespace && node.kind === 93 /* SyntaxKind.ExportKeyword */) { @@ -93087,58 +93846,58 @@ var ts; case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: // TypeScript accessibility and readonly modifiers are elided // falls through - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 177 /* SyntaxKind.TypePredicate */: - case 163 /* SyntaxKind.TypeParameter */: - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: + case 187 /* SyntaxKind.OptionalType */: + case 188 /* SyntaxKind.RestType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 179 /* SyntaxKind.TypePredicate */: + case 165 /* SyntaxKind.TypeParameter */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 180 /* SyntaxKind.ConstructorType */: - case 179 /* SyntaxKind.FunctionType */: - case 181 /* SyntaxKind.TypeQuery */: - case 178 /* SyntaxKind.TypeReference */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 189 /* SyntaxKind.ConditionalType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 192 /* SyntaxKind.ThisType */: - case 193 /* SyntaxKind.TypeOperator */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 195 /* SyntaxKind.MappedType */: - case 196 /* SyntaxKind.LiteralType */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 182 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 183 /* SyntaxKind.TypeQuery */: + case 180 /* SyntaxKind.TypeReference */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 191 /* SyntaxKind.ConditionalType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 194 /* SyntaxKind.ThisType */: + case 195 /* SyntaxKind.TypeOperator */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 197 /* SyntaxKind.MappedType */: + case 198 /* SyntaxKind.LiteralType */: // TypeScript type nodes are elided. // falls through - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // TypeScript index signatures are elided. return undefined; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // TypeScript type-only declarations are elided. return factory.createNotEmittedStatement(node); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: // TypeScript namespace export declarations are elided. return undefined; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // TypeScript interfaces are elided, but some comments may be preserved. // See the implementation of `getLeadingComments` in comments.ts for more details. return factory.createNotEmittedStatement(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // This may be a class declaration with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -93148,7 +93907,7 @@ var ts; // - index signatures // - method overload signatures return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: // This may be a class expression with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -93158,34 +93917,34 @@ var ts; // - index signatures // - method overload signatures return visitClassExpression(node); - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: // This may be a heritage clause with TypeScript syntax extensions. // // TypeScript heritage clause extensions include: // - `implements` clause return visitHeritageClause(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // TypeScript supports type arguments on an expression in an `extends` heritage clause. return visitExpressionWithTypeArguments(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return ts.Debug.fail("Class and object literal elements must be visited with their respective visitors"); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: // Typescript function declarations can have modifiers, decorators, and type annotations. return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: // TypeScript function expressions can have modifiers and type annotations. return visitFunctionExpression(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // TypeScript arrow functions can have modifiers and type annotations. return visitArrowFunction(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // This may be a parameter declaration with TypeScript syntax extensions. // // TypeScript parameter declaration syntax extensions include: @@ -93195,40 +93954,42 @@ var ts; // - type annotations // - this parameters return visitParameter(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: // ParenthesizedExpressions are TypeScript if their expression is a // TypeAssertion or AsExpression return visitParenthesizedExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: // TypeScript type assertions are removed, but their subtrees are preserved. return visitAssertionExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return visitSatisfiesExpression(node); + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: // TypeScript non-null expressions are removed, but their subtrees are preserved. return visitNonNullExpression(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: // TypeScript enum declarations do not exist in ES6 and must be rewritten. return visitEnumDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // TypeScript namespace exports for variable statements must be transformed. return visitVariableStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // TypeScript namespace declarations must be transformed. return visitModuleDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // TypeScript namespace or external module import. return visitImportEqualsDeclaration(node); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node); - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: return visitJsxJsxOpeningElement(node); default: // node contains some other TypeScript syntax @@ -93498,10 +94259,10 @@ var ts; */ function shouldAddTypeMetadata(node) { var kind = node.kind; - return kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */; + return kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */; } /** * Determines whether to emit the "design:returntype" metadata based on the node's kind. @@ -93511,7 +94272,7 @@ var ts; * @param node The node to test. */ function shouldAddReturnTypeMetadata(node) { - return node.kind === 169 /* SyntaxKind.MethodDeclaration */; + return node.kind === 171 /* SyntaxKind.MethodDeclaration */; } /** * Determines whether to emit the "design:paramtypes" metadata based on the node's kind. @@ -93522,12 +94283,12 @@ var ts; */ function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.getFirstConstructorWithBody(node) !== undefined; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; } return false; @@ -93617,7 +94378,7 @@ var ts; return !ts.nodeIsMissing(node.body); } function visitPropertyDeclaration(node, parent) { - var isAmbient = node.flags & 16777216 /* NodeFlags.Ambient */ || ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */); + var isAmbient = node.flags & 16777216 /* NodeFlags.Ambient */ || ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */); if (isAmbient && !ts.hasDecorators(node)) { return undefined; } @@ -93725,7 +94486,7 @@ var ts; * @param node The declaration node. */ function shouldEmitAccessorDeclaration(node) { - return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)); + return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)); } function visitGetAccessor(node, parent) { if (!(node.transformFlags & 1 /* TransformFlags.ContainsTypeScript */)) { @@ -93867,6 +94628,10 @@ var ts; var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression); return factory.createPartiallyEmittedExpression(expression, node); } + function visitSatisfiesExpression(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + return factory.createPartiallyEmittedExpression(expression, node); + } function visitCallExpression(node) { return factory.updateCallExpression(node, ts.visitNode(node.expression, visitor, ts.isExpression), /*typeArguments*/ undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression)); @@ -94080,12 +94845,12 @@ var ts; // enums in any other scope are emitted as a `let` declaration. var statement = factory.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), factory.createVariableDeclarationList([ factory.createVariableDeclaration(factory.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)) - ], currentLexicalScope.kind === 305 /* SyntaxKind.SourceFile */ ? 0 /* NodeFlags.None */ : 1 /* NodeFlags.Let */)); + ], currentLexicalScope.kind === 308 /* SyntaxKind.SourceFile */ ? 0 /* NodeFlags.None */ : 1 /* NodeFlags.Let */)); ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { // Adjust the source map emit to match the old emitter. - if (node.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (node.kind === 263 /* SyntaxKind.EnumDeclaration */) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -94210,7 +94975,7 @@ var ts; var statementsLocation; var blockLocation; if (node.body) { - if (node.body.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (node.body.kind === 265 /* SyntaxKind.ModuleBlock */) { saveStateAndInvoke(node.body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = node.body.statements; blockLocation = node.body; @@ -94257,13 +95022,13 @@ var ts; // })(hi = hello.hi || (hello.hi = {})); // })(hello || (hello = {})); // We only want to emit comment on the namespace which contains block body itself, not the containing namespaces. - if (!node.body || node.body.kind !== 262 /* SyntaxKind.ModuleBlock */) { + if (!node.body || node.body.kind !== 265 /* SyntaxKind.ModuleBlock */) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* EmitFlags.NoComments */); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 264 /* SyntaxKind.ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -94310,7 +95075,7 @@ var ts; * @param node The named import bindings node. */ function visitNamedImportBindings(node) { - if (node.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (node.kind === 271 /* SyntaxKind.NamespaceImport */) { // Elide a namespace import if it is not referenced. return shouldEmitAliasDeclaration(node) ? node : undefined; } @@ -94468,7 +95233,7 @@ var ts; */ function isNamedExternalModuleExport(node) { return isExternalModuleExport(node) - && !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */); + && !ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */); } /** * Gets a value indicating whether the node is the default export of an external module. @@ -94477,7 +95242,7 @@ var ts; */ function isDefaultExternalModuleExport(node) { return isExternalModuleExport(node) - && ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */); + && ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */); } function addExportMemberAssignment(statements, node) { var expression = factory.createAssignment(factory.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true), factory.getLocalName(node)); @@ -94522,16 +95287,16 @@ var ts; // We need to enable substitutions for identifiers and shorthand property assignments. This allows us to // substitute the names of exported members of a namespace. context.enableSubstitution(79 /* SyntaxKind.Identifier */); - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // We need to be notified when entering and exiting namespaces. - context.enableEmitNotification(261 /* SyntaxKind.ModuleDeclaration */); + context.enableEmitNotification(264 /* SyntaxKind.ModuleDeclaration */); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 261 /* SyntaxKind.ModuleDeclaration */; + return ts.getOriginalNode(node).kind === 264 /* SyntaxKind.ModuleDeclaration */; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 260 /* SyntaxKind.EnumDeclaration */; + return ts.getOriginalNode(node).kind === 263 /* SyntaxKind.EnumDeclaration */; } /** * Hook for node emit. @@ -94592,9 +95357,9 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); } return node; @@ -94609,9 +95374,9 @@ var ts; // If we are nested within a namespace declaration, we may need to qualifiy // an identifier that is exported from a merged namespace. var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false); - if (container && container.kind !== 305 /* SyntaxKind.SourceFile */) { - var substitute = (applicableSubstitutions & 2 /* TypeScriptSubstitutionFlags.NamespaceExports */ && container.kind === 261 /* SyntaxKind.ModuleDeclaration */) || - (applicableSubstitutions & 8 /* TypeScriptSubstitutionFlags.NonQualifiedEnumMembers */ && container.kind === 260 /* SyntaxKind.EnumDeclaration */); + if (container && container.kind !== 308 /* SyntaxKind.SourceFile */) { + var substitute = (applicableSubstitutions & 2 /* TypeScriptSubstitutionFlags.NamespaceExports */ && container.kind === 264 /* SyntaxKind.ModuleDeclaration */) || + (applicableSubstitutions & 8 /* TypeScriptSubstitutionFlags.NonQualifiedEnumMembers */ && container.kind === 263 /* SyntaxKind.EnumDeclaration */); if (substitute) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(container), node), /*location*/ node); @@ -94650,9 +95415,10 @@ var ts; return ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node) ? resolver.getConstantValue(node) : undefined; } function shouldEmitAliasDeclaration(node) { - return compilerOptions.preserveValueImports - ? resolver.isValueAliasDeclaration(node) - : resolver.isReferencedAliasDeclaration(node); + return ts.isInJSFile(node) || + (compilerOptions.preserveValueImports + ? resolver.isValueAliasDeclaration(node) + : resolver.isReferencedAliasDeclaration(node)); } } ts.transformTypeScript = transformTypeScript; @@ -94700,13 +95466,24 @@ var ts; var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); var useDefineForClassFields = ts.getUseDefineForClassFields(compilerOptions); + // Always transform field initializers using Set semantics when `useDefineForClassFields: false`. + var shouldTransformInitializersUsingSet = !useDefineForClassFields; + // Transform field initializers using Define semantics when `useDefineForClassFields: true` and target < ES2022. + var shouldTransformInitializersUsingDefine = useDefineForClassFields && languageVersion < 9 /* ScriptTarget.ES2022 */; + var shouldTransformInitializers = shouldTransformInitializersUsingSet || shouldTransformInitializersUsingDefine; + // We need to transform private members and class static blocks when target < ES2022. var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < 9 /* ScriptTarget.ES2022 */; + // We need to transform `accessor` fields when target < ESNext + var shouldTransformAutoAccessors = languageVersion < 99 /* ScriptTarget.ESNext */; // We need to transform `this` in a static initializer into a reference to the class - // when targeting < ES2022 since the assignment will be moved outside of the class body. + // when target < ES2022 since the assignment will be moved outside of the class body. var shouldTransformThisInStaticInitializers = languageVersion < 9 /* ScriptTarget.ES2022 */; - // We don't need to transform `super` property access when targeting ES5, ES3 because + // We don't need to transform `super` property access when target <= ES5 because // the es2015 transformation handles those. var shouldTransformSuperInStaticInitializers = shouldTransformThisInStaticInitializers && languageVersion >= 2 /* ScriptTarget.ES2015 */; + var shouldTransformAnything = shouldTransformInitializers || + shouldTransformPrivateElementsOrClassStaticBlocks || + shouldTransformAutoAccessors; var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; var previousOnEmitNode = context.onEmitNode; @@ -94726,98 +95503,149 @@ var ts; var classLexicalEnvironmentStack = []; var classLexicalEnvironmentMap = new ts.Map(); var currentClassLexicalEnvironment; + var currentClassContainer; var currentComputedPropertyNameClassLexicalEnvironment; var currentStaticPropertyDeclarationOrStaticBlock; return ts.chainBundle(context, transformSourceFile); function transformSourceFile(node) { - var options = context.getCompilerOptions(); - if (node.isDeclarationFile - || useDefineForClassFields && ts.getEmitScriptTarget(options) >= 9 /* ScriptTarget.ES2022 */) { + if (node.isDeclarationFile || !shouldTransformAnything) { return node; } var visited = ts.visitEachChild(node, visitor, context); ts.addEmitHelpers(visited, context.readEmitHelpers()); return visited; } - function visitorWorker(node, valueIsDiscarded) { - if (node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */) { - switch (node.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - return visitClassLike(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitPropertyDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: - return visitVariableStatement(node); - case 80 /* SyntaxKind.PrivateIdentifier */: - return visitPrivateIdentifier(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitClassStaticBlockDeclaration(node); - } + function visitor(node) { + if (!(node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */) && + !(node.transformFlags & 134234112 /* TransformFlags.ContainsLexicalThisOrSuper */)) { + return node; } - if (node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */ || - node.transformFlags & 134217728 /* TransformFlags.ContainsLexicalSuper */ && - shouldTransformSuperInStaticInitializers && - currentStaticPropertyDeclarationOrStaticBlock && - currentClassLexicalEnvironment) { - switch (node.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); - case 221 /* SyntaxKind.BinaryExpression */: - return visitBinaryExpression(node, valueIsDiscarded); - case 208 /* SyntaxKind.CallExpression */: - return visitCallExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - return visitTaggedTemplateExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: - return visitPropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: - return visitElementAccessExpression(node); - case 238 /* SyntaxKind.ExpressionStatement */: - return visitExpressionStatement(node); - case 242 /* SyntaxKind.ForStatement */: - return visitForStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: { - var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = undefined; - var result = ts.visitEachChild(node, visitor, context); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; - return result; - } + switch (node.kind) { + case 127 /* SyntaxKind.AccessorKeyword */: + return shouldTransformAutoAccessors ? undefined : node; + case 260 /* SyntaxKind.ClassDeclaration */: + return visitClassDeclaration(node); + case 228 /* SyntaxKind.ClassExpression */: + return visitClassExpression(node); + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + return visitClassStaticBlockDeclaration(node); + case 169 /* SyntaxKind.PropertyDeclaration */: + return visitPropertyDeclaration(node); + case 240 /* SyntaxKind.VariableStatement */: + return visitVariableStatement(node); + case 80 /* SyntaxKind.PrivateIdentifier */: + return visitPrivateIdentifier(node); + case 208 /* SyntaxKind.PropertyAccessExpression */: + return visitPropertyAccessExpression(node); + case 209 /* SyntaxKind.ElementAccessExpression */: + return visitElementAccessExpression(node); + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + return visitPreOrPostfixUnaryExpression(node, /*valueIsDiscarded*/ false); + case 223 /* SyntaxKind.BinaryExpression */: + return visitBinaryExpression(node, /*valueIsDiscarded*/ false); + case 210 /* SyntaxKind.CallExpression */: + return visitCallExpression(node); + case 241 /* SyntaxKind.ExpressionStatement */: + return visitExpressionStatement(node); + case 212 /* SyntaxKind.TaggedTemplateExpression */: + return visitTaggedTemplateExpression(node); + case 245 /* SyntaxKind.ForStatement */: + return visitForStatement(node); + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: { + // If we are descending into a new scope, clear the current static property or block + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, fallbackVisitor, node); } + default: + return fallbackVisitor(node); } + } + function fallbackVisitor(node) { return ts.visitEachChild(node, visitor, context); } + /** + * Visits a node in an expression whose result is discarded. + */ function discardedValueVisitor(node) { - return visitorWorker(node, /*valueIsDiscarded*/ true); - } - function visitor(node) { - return visitorWorker(node, /*valueIsDiscarded*/ false); + switch (node.kind) { + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + return visitPreOrPostfixUnaryExpression(node, /*valueIsDiscarded*/ true); + case 223 /* SyntaxKind.BinaryExpression */: + return visitBinaryExpression(node, /*valueIsDiscarded*/ true); + default: + return visitor(node); + } } + /** + * Visits a node in a {@link HeritageClause}. + */ function heritageClauseVisitor(node) { switch (node.kind) { - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return ts.visitEachChild(node, heritageClauseVisitor, context); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - return visitExpressionWithTypeArguments(node); + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + return visitExpressionWithTypeArgumentsInHeritageClause(node); + default: + return visitor(node); } - return visitor(node); } - function visitorDestructuringTarget(node) { + /** + * Visits the assignment target of a destructuring assignment. + */ + function assignmentTargetVisitor(node) { switch (node.kind) { - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitAssignmentPattern(node); default: return visitor(node); } } + /** + * Visits a member of a class. + */ + function classElementVisitor(node) { + switch (node.kind) { + case 173 /* SyntaxKind.Constructor */: + return visitConstructorDeclaration(node); + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, visitMethodOrAccessorDeclaration, node); + case 169 /* SyntaxKind.PropertyDeclaration */: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, visitPropertyDeclaration, node); + case 164 /* SyntaxKind.ComputedPropertyName */: + return visitComputedPropertyName(node); + case 237 /* SyntaxKind.SemicolonClassElement */: + return node; + default: + return visitor(node); + } + } + /** + * Visits the results of an auto-accessor field transformation in a second pass. + */ + function accessorFieldResultVisitor(node) { + switch (node.kind) { + case 169 /* SyntaxKind.PropertyDeclaration */: + return transformFieldInitializer(node); + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return classElementVisitor(node); + default: + ts.Debug.assertMissingNode(node, "Expected node to either be a PropertyDeclaration, GetAccessorDeclaration, or SetAccessorDeclaration"); + break; + } + } /** * If we visit a private name, this means it is an undeclared private name. * Replace it with an empty identifier to indicate a problem with the code, @@ -94833,17 +95661,15 @@ var ts; } return ts.setOriginalNode(factory.createIdentifier(""), node); } + function isPrivateIdentifierInExpression(node) { + return ts.isPrivateIdentifier(node.left) + && node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */; + } /** * Visits `#id in expr` */ - function visitPrivateIdentifierInInExpression(node) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return node; - } - var privId = node.left; - ts.Debug.assertNode(privId, ts.isPrivateIdentifier); - ts.Debug.assert(node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */); - var info = accessPrivateIdentifier(privId); + function transformPrivateIdentifierInInExpression(node) { + var info = accessPrivateIdentifier(node.left); if (info) { var receiver = ts.visitNode(node.right, visitor, ts.isExpression); return ts.setOriginalNode(context.getEmitHelperFactory().createClassPrivateFieldInHelper(info.brandCheckIdentifier, receiver), node); @@ -94851,31 +95677,6 @@ var ts; // Private name has not been declared. Subsequent transformers will handle this error return ts.visitEachChild(node, visitor, context); } - /** - * Visits the members of a class that has fields. - * - * @param node The node to visit. - */ - function classElementVisitor(node) { - switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - // Constructors for classes using class fields are transformed in - // `visitClassDeclaration` or `visitClassExpression`. - return undefined; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - return visitMethodOrAccessorDeclaration(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitPropertyDeclaration(node); - case 162 /* SyntaxKind.ComputedPropertyName */: - return visitComputedPropertyName(node); - case 234 /* SyntaxKind.SemicolonClassElement */: - return node; - default: - return visitor(node); - } - } function visitVariableStatement(node) { var savedPendingStatements = pendingStatements; pendingStatements = []; @@ -94885,15 +95686,24 @@ var ts; pendingStatements = savedPendingStatements; return statement; } - function visitComputedPropertyName(name) { - var node = ts.visitEachChild(name, visitor, context); + function visitComputedPropertyName(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); if (ts.some(pendingExpressions)) { - var expressions = pendingExpressions; - expressions.push(node.expression); - pendingExpressions = []; - node = factory.updateComputedPropertyName(node, factory.inlineExpressions(expressions)); + if (ts.isParenthesizedExpression(expression)) { + expression = factory.updateParenthesizedExpression(expression, factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression.expression], false))); + } + else { + expression = factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression], false)); + } + pendingExpressions = undefined; } - return node; + return factory.updateComputedPropertyName(node, expression); + } + function visitConstructorDeclaration(node) { + if (currentClassContainer) { + return transformConstructor(node, currentClassContainer); + } + return fallbackVisitor(node); } function visitMethodOrAccessorDeclaration(node) { ts.Debug.assert(!ts.hasDecorators(node)); @@ -94908,13 +95718,20 @@ var ts; } var functionName = getHoistedFunctionName(node); if (functionName) { - getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return ts.isModifier(m) && !ts.isStaticModifier(m); }), node.asteriskToken, functionName, - /* typeParameters */ undefined, ts.visitParameterList(node.parameters, classElementVisitor, context), - /* type */ undefined, ts.visitFunctionBody(node.body, classElementVisitor, context)))); + getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return ts.isModifier(m) && !ts.isStaticModifier(m) && !ts.isAccessorModifier(m); }), node.asteriskToken, functionName, + /* typeParameters */ undefined, ts.visitParameterList(node.parameters, visitor, context), + /* type */ undefined, ts.visitFunctionBody(node.body, visitor, context)))); } // remove method declaration from class return undefined; } + function setCurrentStaticPropertyDeclarationOrStaticBlockAnd(current, visitor, arg) { + var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; + currentStaticPropertyDeclarationOrStaticBlock = current; + var result = visitor(arg); + currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; + return result; + } function getHoistedFunctionName(node) { ts.Debug.assert(ts.isPrivateIdentifier(node.name)); var info = accessPrivateIdentifier(node.name); @@ -94931,49 +95748,104 @@ var ts; } } } - function visitPropertyDeclaration(node) { - ts.Debug.assert(!ts.hasDecorators(node)); - if (ts.isPrivateIdentifier(node.name)) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - if (ts.isStatic(node)) { - // static fields are left as is - return ts.visitEachChild(node, visitor, context); - } - // Initializer is elided as the field is initialized in transformConstructor. - return factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, - /*questionOrExclamationToken*/ undefined, - /*type*/ undefined, - /*initializer*/ undefined); - } - // leave invalid code untransformed + function transformAutoAccessor(node) { + // transforms: + // accessor x = 1; + // into: + // #x = 1; + // get x() { return this.#x; } + // set x(value) { this.#x = value; } + ts.Debug.assertEachNode(node.modifiers, ts.isModifier); + var commentRange = ts.getCommentRange(node); + var sourceMapRange = ts.getSourceMapRange(node); + // Since we're creating two declarations where there was previously one, cache + // the expression for any computed property names. + var name = node.name; + var getterName = name; + var setterName = name; + if (ts.isComputedPropertyName(name) && !ts.isSimpleInlineableExpression(name.expression)) { + var temp = factory.createTempVariable(hoistVariableDeclaration); + ts.setSourceMapRange(temp, name.expression); + var expression = ts.visitNode(name.expression, visitor, ts.isExpression); + var assignment = factory.createAssignment(temp, expression); + ts.setSourceMapRange(assignment, name.expression); + getterName = factory.updateComputedPropertyName(name, factory.inlineExpressions([assignment, temp])); + setterName = factory.updateComputedPropertyName(name, temp); + } + var backingField = ts.createAccessorPropertyBackingField(factory, node, node.modifiers, node.initializer); + ts.setOriginalNode(backingField, node); + ts.setEmitFlags(backingField, 1536 /* EmitFlags.NoComments */); + ts.setSourceMapRange(backingField, sourceMapRange); + var getter = ts.createAccessorPropertyGetRedirector(factory, node, node.modifiers, getterName); + ts.setOriginalNode(getter, node); + ts.setCommentRange(getter, commentRange); + ts.setSourceMapRange(getter, sourceMapRange); + var setter = ts.createAccessorPropertySetRedirector(factory, node, node.modifiers, setterName); + ts.setOriginalNode(setter, node); + ts.setEmitFlags(setter, 1536 /* EmitFlags.NoComments */); + ts.setSourceMapRange(setter, sourceMapRange); + return ts.visitArray([backingField, getter, setter], accessorFieldResultVisitor, ts.isClassElement); + } + function transformPrivateFieldInitializer(node) { + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + // If we are transforming private elements into WeakMap/WeakSet, we should elide the node. var info = accessPrivateIdentifier(node.name); ts.Debug.assert(info, "Undeclared private name for property declaration."); - if (!info.isValid) { - return node; + // Leave invalid code untransformed; otherwise, elide the node as it is transformed elsewhere. + return info.isValid ? undefined : node; + } + if (shouldTransformInitializersUsingSet && !ts.isStatic(node)) { + // If we are transforming initializers using Set semantics we will elide the initializer as it will + // be moved to the constructor to preserve evaluation order next to public instance fields. We don't + // need to do this transformation for private static fields since public static fields can be + // transformed into `static {}` blocks. + return factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, + /*initializer*/ undefined); + } + return ts.visitEachChild(node, visitor, context); + } + function transformPublicFieldInitializer(node) { + if (shouldTransformInitializers) { + // Create a temporary variable to store a computed property name (if necessary). + // If it's not inlineable, then we emit an expression after the class which assigns + // the property name to the temporary variable. + var expr = getPropertyNameExpressionIfNeeded(node.name, /*shouldHoist*/ !!node.initializer || useDefineForClassFields); + if (expr) { + getPendingExpressions().push(expr); } - } - // Create a temporary variable to store a computed property name (if necessary). - // If it's not inlineable, then we emit an expression after the class which assigns - // the property name to the temporary variable. - var expr = getPropertyNameExpressionIfNeeded(node.name, !!node.initializer || useDefineForClassFields); - if (expr && !ts.isSimpleInlineableExpression(expr)) { - getPendingExpressions().push(expr); - } - if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks && !useDefineForClassFields) { - var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); - if (initializerStatement) { - var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); - ts.setOriginalNode(staticBlock, node); - ts.setCommentRange(staticBlock, node); - // Set the comment range for the statement to an empty synthetic range - // and drop synthetic comments from the statement to avoid printing them twice. - ts.setCommentRange(initializerStatement, { pos: -1, end: -1 }); - ts.setSyntheticLeadingComments(initializerStatement, undefined); - ts.setSyntheticTrailingComments(initializerStatement, undefined); - return staticBlock; + if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks) { + var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); + if (initializerStatement) { + var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); + ts.setOriginalNode(staticBlock, node); + ts.setCommentRange(staticBlock, node); + // Set the comment range for the statement to an empty synthetic range + // and drop synthetic comments from the statement to avoid printing them twice. + ts.setCommentRange(initializerStatement, { pos: -1, end: -1 }); + ts.setSyntheticLeadingComments(initializerStatement, undefined); + ts.setSyntheticTrailingComments(initializerStatement, undefined); + return staticBlock; + } } + return undefined; } - return undefined; + return ts.visitEachChild(node, classElementVisitor, context); + } + function transformFieldInitializer(node) { + ts.Debug.assert(!ts.hasDecorators(node), "Decorators should already have been transformed and elided."); + return ts.isPrivateIdentifierClassElementDeclaration(node) ? + transformPrivateFieldInitializer(node) : + transformPublicFieldInitializer(node); + } + function visitPropertyDeclaration(node) { + // If this is an auto-accessor, we defer to `transformAutoAccessor`. That function + // will in turn call `transformFieldInitializer` as needed. + if (shouldTransformAutoAccessors && ts.isAutoAccessorPropertyDeclaration(node)) { + return transformAutoAccessor(node); + } + return transformFieldInitializer(node); } function createPrivateIdentifierAccess(info, receiver) { return createPrivateIdentifierAccessHelper(info, ts.visitNode(receiver, visitor, ts.isExpression)); @@ -95037,9 +95909,11 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitPreOrPostfixUnaryExpression(node, valueIsDiscarded) { - if (node.operator === 45 /* SyntaxKind.PlusPlusToken */ || node.operator === 46 /* SyntaxKind.MinusMinusToken */) { + if (node.operator === 45 /* SyntaxKind.PlusPlusToken */ || + node.operator === 46 /* SyntaxKind.MinusMinusToken */) { var operand = ts.skipParentheses(node.operand); - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(operand)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(operand)) { var info = void 0; if (info = accessPrivateIdentifier(operand.name)) { var receiver = ts.visitNode(operand.expression, visitor, ts.isExpression); @@ -95128,7 +96002,9 @@ var ts; return { readExpression: readExpression, initializeExpression: initializeExpression }; } function visitCallExpression(node) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) { + // obj.#x() // Transform call expressions of private names to properly bind the `this` parameter. var _a = factory.createCallBinding(node.expression, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; if (ts.isCallChain(node)) { @@ -95143,6 +96019,8 @@ var ts; ts.isSuperProperty(node.expression) && currentStaticPropertyDeclarationOrStaticBlock && (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.classConstructor)) { + // super.x() + // super[x]() // converts `super.f(...)` into `Reflect.get(_baseTemp, "f", _classTemp).call(_classTemp, ...)` var invocation = factory.createFunctionCallCall(ts.visitNode(node.expression, visitor, ts.isExpression), currentClassLexicalEnvironment.classConstructor, ts.visitNodes(node.arguments, visitor, ts.isExpression)); ts.setOriginalNode(invocation, node); @@ -95152,7 +96030,8 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitTaggedTemplateExpression(node) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) { // Bind the `this` correctly for tagged template literals when the tag is a private identifier property access. var _a = factory.createCallBinding(node.tag, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; return factory.updateTaggedTemplateExpression(node, factory.createCallExpression(factory.createPropertyAccessExpression(ts.visitNode(target, visitor), "bind"), @@ -95178,11 +96057,8 @@ var ts; classLexicalEnvironmentMap.set(ts.getOriginalNodeId(node), currentClassLexicalEnvironment); } startLexicalEnvironment(); - var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = node; - var statements = ts.visitNodes(node.body.statements, visitor, ts.isStatement); + var statements = setCurrentStaticPropertyDeclarationOrStaticBlockAnd(node, function (statements) { return ts.visitNodes(statements, visitor, ts.isStatement); }, node.body.statements); statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; var iife = factory.createImmediatelyInvokedArrowFunction(statements); ts.setOriginalNode(iife, node); ts.setTextRange(iife, node); @@ -95192,9 +96068,12 @@ var ts; } function visitBinaryExpression(node, valueIsDiscarded) { if (ts.isDestructuringAssignment(node)) { + // ({ x: obj.#x } = ...) + // ({ x: super.x } = ...) + // ({ x: super[x] } = ...) var savedPendingExpressions = pendingExpressions; pendingExpressions = undefined; - node = factory.updateBinaryExpression(node, ts.visitNode(node.left, visitorDestructuringTarget), node.operatorToken, ts.visitNode(node.right, visitor)); + node = factory.updateBinaryExpression(node, ts.visitNode(node.left, assignmentTargetVisitor), node.operatorToken, ts.visitNode(node.right, visitor)); var expr = ts.some(pendingExpressions) ? factory.inlineExpressions(ts.compact(__spreadArray(__spreadArray([], pendingExpressions, true), [node], false))) : node; @@ -95202,7 +96081,9 @@ var ts; return expr; } if (ts.isAssignmentExpression(node)) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.left)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.left)) { + // obj.#x = ... var info = accessPrivateIdentifier(node.left.name); if (info) { return ts.setTextRange(ts.setOriginalNode(createPrivateIdentifierAssignment(info, node.left.expression, node.right, node.operatorToken.kind), node), node); @@ -95212,6 +96093,10 @@ var ts; ts.isSuperProperty(node.left) && currentStaticPropertyDeclarationOrStaticBlock && currentClassLexicalEnvironment) { + // super.x = ... + // super[x] = ... + // super.x += ... + // super.x -= ... var classConstructor = currentClassLexicalEnvironment.classConstructor, superClassReference = currentClassLexicalEnvironment.superClassReference, facts = currentClassLexicalEnvironment.facts; if (facts & 1 /* ClassFacts.ClassWasDecorated */) { return factory.updateBinaryExpression(node, visitInvalidSuperProperty(node.left), node.operatorToken, ts.visitNode(node.right, visitor, ts.isExpression)); @@ -95255,8 +96140,10 @@ var ts; } } } - if (node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */ && ts.isPrivateIdentifier(node.left)) { - return visitPrivateIdentifierInInExpression(node); + if (shouldTransformPrivateElementsOrClassStaticBlocks && + isPrivateIdentifierInExpression(node)) { + // #x in obj + return transformPrivateIdentifierInInExpression(node); } return ts.visitEachChild(node, visitor, context); } @@ -95281,36 +96168,6 @@ var ts; ts.Debug.assertNever(info, "Unknown private element type"); } } - /** - * Set up the environment for a class. - */ - function visitClassLike(node) { - if (!ts.forEach(node.members, doesClassElementNeedTransform)) { - return ts.visitEachChild(node, visitor, context); - } - var savedPendingExpressions = pendingExpressions; - pendingExpressions = undefined; - startClassLexicalEnvironment(); - if (shouldTransformPrivateElementsOrClassStaticBlocks) { - var name = ts.getNameOfDeclaration(node); - if (name && ts.isIdentifier(name)) { - getPrivateIdentifierEnvironment().className = ts.idText(name); - } - var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); - if (ts.some(privateInstanceMethodsAndAccessors)) { - getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); - } - } - var result = ts.isClassDeclaration(node) ? - visitClassDeclaration(node) : - visitClassExpression(node); - endClassLexicalEnvironment(); - pendingExpressions = savedPendingExpressions; - return result; - } - function doesClassElementNeedTransform(node) { - return ts.isPropertyDeclaration(node) || ts.isClassStaticBlockDeclaration(node) || (shouldTransformPrivateElementsOrClassStaticBlocks && node.name && ts.isPrivateIdentifier(node.name)); - } function getPrivateInstanceMethodsAndAccessors(node) { return ts.filter(node.members, ts.isNonStaticMethodOrAccessorWithPrivateName); } @@ -95324,7 +96181,7 @@ var ts; var member = _a[_i]; if (!ts.isStatic(member)) continue; - if (member.name && ts.isPrivateIdentifier(member.name) && shouldTransformPrivateElementsOrClassStaticBlocks) { + if (member.name && (ts.isPrivateIdentifier(member.name) || ts.isAutoAccessorPropertyDeclaration(member)) && shouldTransformPrivateElementsOrClassStaticBlocks) { facts |= 2 /* ClassFacts.NeedsClassConstructorReference */; } if (ts.isPropertyDeclaration(member) || ts.isClassStaticBlockDeclaration(member)) { @@ -95343,7 +96200,7 @@ var ts; } return facts; } - function visitExpressionWithTypeArguments(node) { + function visitExpressionWithTypeArgumentsInHeritageClause(node) { var facts = (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.facts) || 0 /* ClassFacts.None */; if (facts & 4 /* ClassFacts.NeedsClassSuperReference */) { var temp = factory.createTempVariable(hoistVariableDeclaration, /*reserveInNestedScopes*/ true); @@ -95353,7 +96210,22 @@ var ts; } return ts.visitEachChild(node, visitor, context); } - function visitClassDeclaration(node) { + function visitInNewClassLexicalEnvironment(node, visitor) { + var savedCurrentClassContainer = currentClassContainer; + var savedPendingExpressions = pendingExpressions; + currentClassContainer = node; + pendingExpressions = undefined; + startClassLexicalEnvironment(); + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + var name = ts.getNameOfDeclaration(node); + if (name && ts.isIdentifier(name)) { + getPrivateIdentifierEnvironment().className = name; + } + var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); + if (ts.some(privateInstanceMethodsAndAccessors)) { + getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); + } + } var facts = getClassFacts(node); if (facts) { getClassLexicalEnvironment().facts = facts; @@ -95361,6 +96233,16 @@ var ts; if (facts & 8 /* ClassFacts.NeedsSubstitutionForThisInClassStaticField */) { enableSubstitutionForClassStaticThisOrSuperReference(); } + var result = visitor(node, facts); + endClassLexicalEnvironment(); + currentClassContainer = savedCurrentClassContainer; + pendingExpressions = savedPendingExpressions; + return result; + } + function visitClassDeclaration(node) { + return visitInNewClassLexicalEnvironment(node, visitClassDeclarationInNewClassLexicalEnvironment); + } + function visitClassDeclarationInNewClassLexicalEnvironment(node, facts) { // If a class has private static fields, or a static field has a `this` or `super` reference, // then we need to allocate a temp variable to hold on to that reference. var pendingClassReferenceAssignment; @@ -95369,12 +96251,16 @@ var ts; getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); pendingClassReferenceAssignment = factory.createAssignment(temp, factory.getInternalName(node)); } - var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); - var statements = [ - factory.updateClassDeclaration(node, node.modifiers, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)) - ]; + var modifiers = ts.visitNodes(node.modifiers, visitor, ts.isModifierLike); + var heritageClauses = ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classDecl = factory.updateClassDeclaration(node, modifiers, node.name, + /*typeParameters*/ undefined, heritageClauses, members); + var statements = []; + if (prologue) { + statements.push(factory.createExpressionStatement(prologue)); + } + statements.push(classDecl); if (pendingClassReferenceAssignment) { getPendingExpressions().unshift(pendingClassReferenceAssignment); } @@ -95382,25 +96268,23 @@ var ts; if (ts.some(pendingExpressions)) { statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))); } - // Emit static property assignment. Because classDeclaration is lexically evaluated, - // it is safe to emit static property assignment after classDeclaration - // From ES6 specification: - // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using - // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. - var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node); - if (ts.some(staticProperties)) { - addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + if (shouldTransformInitializersUsingSet || shouldTransformPrivateElementsOrClassStaticBlocks) { + // Emit static property assignment. Because classDeclaration is lexically evaluated, + // it is safe to emit static property assignment after classDeclaration + // From ES6 specification: + // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using + // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. + var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node); + if (ts.some(staticProperties)) { + addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + } } return statements; } function visitClassExpression(node) { - var facts = getClassFacts(node); - if (facts) { - getClassLexicalEnvironment().facts = facts; - } - if (facts & 8 /* ClassFacts.NeedsSubstitutionForThisInClassStaticField */) { - enableSubstitutionForClassStaticThisOrSuperReference(); - } + return visitInNewClassLexicalEnvironment(node, visitClassExpressionInNewClassLexicalEnvironment); + } + function visitClassExpressionInNewClassLexicalEnvironment(node, facts) { // If this class expression is a transformation of a decorated class declaration, // then we want to output the pendingExpressions as statements, not as inlined // expressions with the class statement. @@ -95410,8 +96294,6 @@ var ts; // these statements after the class expression variable statement. var isDecoratedClassDeclaration = !!(facts & 1 /* ClassFacts.ClassWasDecorated */); var staticPropertiesOrClassStaticBlocks = ts.getStaticPropertiesAndClassStaticBlock(node); - var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); var isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 16777216 /* NodeCheckFlags.ClassWithConstructorReference */; var temp; function createClassTempVar() { @@ -95424,9 +96306,23 @@ var ts; temp = createClassTempVar(); getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); } - var classExpression = factory.updateClassExpression(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)); - var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(staticPropertiesOrClassStaticBlocks, function (p) { return ts.isClassStaticBlockDeclaration(p) || !!p.initializer || ts.isPrivateIdentifier(p.name); }); + var modifiers = ts.visitNodes(node.modifiers, visitor, ts.isModifierLike); + var heritageClauses = ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classExpression = factory.updateClassExpression(node, modifiers, node.name, + /*typeParameters*/ undefined, heritageClauses, members); + var expressions = []; + if (prologue) { + expressions.push(prologue); + } + // Static initializers are transformed to `static {}` blocks when `useDefineForClassFields: false` + // and not also transforming static blocks. + var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && + ts.some(staticPropertiesOrClassStaticBlocks, function (node) { + return ts.isClassStaticBlockDeclaration(node) || + ts.isPrivateIdentifierClassElementDeclaration(node) || + shouldTransformInitializers && ts.isInitializedProperty(node); + }); if (hasTransformableStatics || ts.some(pendingExpressions)) { if (isDecoratedClassDeclaration) { ts.Debug.assertIsDefined(pendingStatements, "Decorated classes transformed by TypeScript are expected to be within a variable declaration."); @@ -95438,12 +96334,16 @@ var ts; addPropertyOrClassStaticBlockStatements(pendingStatements, staticPropertiesOrClassStaticBlocks, factory.getInternalName(node)); } if (temp) { - return factory.inlineExpressions([factory.createAssignment(temp, classExpression), temp]); + expressions.push(ts.startOnNewLine(factory.createAssignment(temp, classExpression)), ts.startOnNewLine(temp)); + } + else { + expressions.push(classExpression); + if (prologue) { + ts.startOnNewLine(classExpression); + } } - return classExpression; } else { - var expressions = []; temp || (temp = createClassTempVar()); if (isClassWithConstructorReference) { // record an alias as the class name is not in scope for statics. @@ -95460,45 +96360,87 @@ var ts; ts.addRange(expressions, ts.map(pendingExpressions, ts.startOnNewLine)); ts.addRange(expressions, generateInitializedPropertyExpressionsOrClassStaticBlock(staticPropertiesOrClassStaticBlocks, temp)); expressions.push(ts.startOnNewLine(temp)); - return factory.inlineExpressions(expressions); } } - return classExpression; + else { + expressions.push(classExpression); + if (prologue) { + ts.startOnNewLine(classExpression); + } + } + return factory.inlineExpressions(expressions); } function visitClassStaticBlockDeclaration(node) { if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return ts.visitEachChild(node, classElementVisitor, context); + return ts.visitEachChild(node, visitor, context); } // ClassStaticBlockDeclaration for classes are transformed in `visitClassDeclaration` or `visitClassExpression`. return undefined; } - function transformClassMembers(node, isDerivedClass) { - var members = []; + function transformClassMembers(node) { + // Declare private names if (shouldTransformPrivateElementsOrClassStaticBlocks) { - // Declare private names. for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; if (ts.isPrivateIdentifierClassElementDeclaration(member)) { - addPrivateIdentifierToEnvironment(member); + addPrivateIdentifierToEnvironment(member, member.name, addPrivateIdentifierClassElementToEnvironment); } } if (ts.some(getPrivateInstanceMethodsAndAccessors(node))) { createBrandCheckWeakSetForPrivateMethods(); } + if (shouldTransformAutoAccessors) { + for (var _b = 0, _c = node.members; _b < _c.length; _b++) { + var member = _c[_b]; + if (ts.isAutoAccessorPropertyDeclaration(member)) { + var storageName = factory.getGeneratedPrivateNameForNode(member.name, /*prefix*/ undefined, "_accessor_storage"); + addPrivateIdentifierToEnvironment(member, storageName, addPrivateIdentifierPropertyDeclarationToEnvironment); + } + } + } } - var constructor = transformConstructor(node, isDerivedClass); - var visitedMembers = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement); - if (constructor) { - members.push(constructor); + var members = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement); + // Create a synthetic constructor if necessary + var syntheticConstructor; + if (!ts.some(members, ts.isConstructorDeclaration)) { + syntheticConstructor = transformConstructor(/*constructor*/ undefined, node); } + var prologue; + // If there are pending expressions create a class static block in which to evaluate them, but only if + // class static blocks are not also being transformed. This block will be injected at the top of the class + // to ensure that expressions from computed property names are evaluated before any other static + // initializers. + var syntheticStaticBlock; if (!shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(pendingExpressions)) { - members.push(factory.createClassStaticBlockDeclaration(factory.createBlock([ - factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)) - ]))); + var statement = factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)); + if (statement.transformFlags & 134234112 /* TransformFlags.ContainsLexicalThisOrSuper */) { + // If there are `this` or `super` references from computed property names, shift the expression + // into an arrow function to be evaluated in the outer scope so that `this` and `super` are + // properly captured. + var temp = factory.createTempVariable(hoistVariableDeclaration); + var arrow = factory.createArrowFunction( + /*modifiers*/ undefined, + /*typeParameters*/ undefined, + /*parameters*/ [], + /*type*/ undefined, + /*equalsGreaterThanToken*/ undefined, factory.createBlock([statement])); + prologue = factory.createAssignment(temp, arrow); + statement = factory.createExpressionStatement(factory.createCallExpression(temp, /*typeArguments*/ undefined, [])); + } + var block = factory.createBlock([statement]); + syntheticStaticBlock = factory.createClassStaticBlockDeclaration(block); pendingExpressions = undefined; } - ts.addRange(members, visitedMembers); - return ts.setTextRange(factory.createNodeArray(members), /*location*/ node.members); + // If we created a synthetic constructor or class static block, add them to the visited members + // and return a new array. + if (syntheticConstructor || syntheticStaticBlock) { + var membersArray = void 0; + membersArray = ts.append(membersArray, syntheticConstructor); + membersArray = ts.append(membersArray, syntheticStaticBlock); + membersArray = ts.addRange(membersArray, members); + members = ts.setTextRange(factory.createNodeArray(membersArray), /*location*/ node.members); + } + return { members: members, prologue: prologue }; } function createBrandCheckWeakSetForPrivateMethods() { var weakSetName = getPrivateIdentifierEnvironment().weakSetName; @@ -95507,35 +96449,38 @@ var ts; /*typeArguments*/ undefined, []))); } function isClassElementThatRequiresConstructorStatement(member) { - if (ts.isStatic(member) || ts.hasSyntacticModifier(ts.getOriginalNode(member), 128 /* ModifierFlags.Abstract */)) { + if (ts.isStatic(member) || ts.hasAbstractModifier(ts.getOriginalNode(member))) { return false; } - if (useDefineForClassFields) { - // If we are using define semantics and targeting ESNext or higher, - // then we don't need to transform any class properties. - return languageVersion < 9 /* ScriptTarget.ES2022 */; - } - return ts.isInitializedProperty(member) || shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member); + return shouldTransformInitializersUsingDefine && ts.isPropertyDeclaration(member) || + shouldTransformInitializersUsingSet && ts.isInitializedProperty(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && shouldTransformAutoAccessors && ts.isAutoAccessorPropertyDeclaration(member); } - function transformConstructor(node, isDerivedClass) { - var constructor = ts.visitNode(ts.getFirstConstructorWithBody(node), visitor, ts.isConstructorDeclaration); - var elements = node.members.filter(isClassElementThatRequiresConstructorStatement); - if (!ts.some(elements)) { + function transformConstructor(constructor, container) { + constructor = ts.visitNode(constructor, visitor, ts.isConstructorDeclaration); + if (!ts.some(container.members, isClassElementThatRequiresConstructorStatement)) { return constructor; } + var extendsClauseElement = ts.getEffectiveBaseTypeNode(container); + var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); var parameters = ts.visitParameterList(constructor ? constructor.parameters : undefined, visitor, context); - var body = transformConstructorBody(node, constructor, isDerivedClass); + var body = transformConstructorBody(container, constructor, isDerivedClass); if (!body) { - return undefined; + return constructor; + } + if (constructor) { + ts.Debug.assert(parameters); + return factory.updateConstructorDeclaration(constructor, /*modifiers*/ undefined, parameters, body); } return ts.startOnNewLine(ts.setOriginalNode(ts.setTextRange(factory.createConstructorDeclaration( - /*modifiers*/ undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || node), constructor)); + /*modifiers*/ undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || container), constructor)); } function transformConstructorBody(node, constructor, isDerivedClass) { - var _a; + var _a, _b; var properties = ts.getProperties(node, /*requireInitializer*/ false, /*isStatic*/ false); if (!useDefineForClassFields) { - properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name); }); + properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name) || ts.hasAccessorModifier(property); }); } var privateMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); var needsConstructorBody = ts.some(properties) || ts.some(privateMethodsAndAccessors); @@ -95587,8 +96532,8 @@ var ts; statements = statements.filter(function (statement) { return !ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor); }); } else { - for (var _i = 0, _b = constructor.body.statements; _i < _b.length; _i++) { - var statement = _b[_i]; + for (var _i = 0, _c = constructor.body.statements; _i < _c.length; _i++) { + var statement = _c[_i]; if (ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) { parameterPropertyDeclarationCount++; } @@ -95620,9 +96565,14 @@ var ts; ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue)); } statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); + if (statements.length === 0 && !constructor) { + return undefined; + } + var multiLine = (constructor === null || constructor === void 0 ? void 0 : constructor.body) && constructor.body.statements.length >= statements.length ? + (_b = constructor.body.multiLine) !== null && _b !== void 0 ? _b : statements.length > 0 : + statements.length > 0; return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), - /*location*/ constructor ? constructor.body.statements : node.members), - /*multiLine*/ true), + /*location*/ constructor ? constructor.body.statements : node.members), multiLine), /*location*/ constructor ? constructor.body : undefined); function visitBodyStatement(statement) { if (useDefineForClassFields && ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) { @@ -95658,9 +96608,10 @@ var ts; return undefined; } var statement = factory.createExpressionStatement(expression); + ts.setOriginalNode(statement, property); + ts.addEmitFlags(statement, ts.getEmitFlags(property) & 1536 /* EmitFlags.NoComments */); ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)); ts.setCommentRange(statement, property); - ts.setOriginalNode(statement, property); // `setOriginalNode` *copies* the `emitNode` from `property`, so now both // `statement` and `expression` have a copy of the synthesized comments. // Drop the comments from expression to avoid printing them twice. @@ -95683,9 +96634,10 @@ var ts; continue; } ts.startOnNewLine(expression); + ts.setOriginalNode(expression, property); + ts.addEmitFlags(expression, ts.getEmitFlags(property) & 1536 /* EmitFlags.NoComments */); ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)); ts.setCommentRange(expression, property); - ts.setOriginalNode(expression, property); expressions.push(expression); } return expressions; @@ -95712,9 +96664,11 @@ var ts; var _a; // We generate a name here in order to reuse the value cached by the relocated computed name expression (which uses the same generated name) var emitAssignment = !useDefineForClassFields; - var propertyName = ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression) - ? factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) - : property.name; + var propertyName = ts.hasAccessorModifier(property) ? + factory.getGeneratedPrivateNameForNode(property.name) : + ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression) ? + factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) : + property.name; if (ts.hasStaticModifier(property)) { currentStaticPropertyDeclarationOrStaticBlock = property; } @@ -95741,7 +96695,7 @@ var ts; return undefined; } var propertyOriginalNode = ts.getOriginalNode(property); - if (ts.hasSyntacticModifier(propertyOriginalNode, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(propertyOriginalNode, 256 /* ModifierFlags.Abstract */)) { return undefined; } var initializer = property.initializer || emitAssignment ? (_a = ts.visitNode(property.initializer, visitor, ts.isExpression)) !== null && _a !== void 0 ? _a : factory.createVoidZero() @@ -95775,17 +96729,17 @@ var ts; // substitute `this` in a static field initializer context.enableSubstitution(108 /* SyntaxKind.ThisKeyword */); // these push a new lexical environment that is not the class lexical environment - context.enableEmitNotification(256 /* SyntaxKind.FunctionDeclaration */); - context.enableEmitNotification(213 /* SyntaxKind.FunctionExpression */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(259 /* SyntaxKind.FunctionDeclaration */); + context.enableEmitNotification(215 /* SyntaxKind.FunctionExpression */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // these push a new lexical environment that is not the class lexical environment, except // when they have a computed property name - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(167 /* SyntaxKind.PropertyDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(169 /* SyntaxKind.PropertyDeclaration */); // class lexical environments are restored when entering a computed property name - context.enableEmitNotification(162 /* SyntaxKind.ComputedPropertyName */); + context.enableEmitNotification(164 /* SyntaxKind.ComputedPropertyName */); } } /** @@ -95824,13 +96778,13 @@ var ts; } } switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (ts.isArrowFunction(original) || ts.getEmitFlags(node) & 262144 /* EmitFlags.AsyncFunctionBody */) { break; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 171 /* SyntaxKind.Constructor */: { + case 259 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentClassLexicalEnvironment = undefined; @@ -95840,10 +96794,10 @@ var ts; currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; return; } - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentComputedPropertyNameClassLexicalEnvironment = currentClassLexicalEnvironment; @@ -95853,7 +96807,7 @@ var ts; currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; return; } - case 162 /* SyntaxKind.ComputedPropertyName */: { + case 164 /* SyntaxKind.ComputedPropertyName */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; @@ -95967,149 +96921,138 @@ var ts; function getPrivateIdentifierEnvironment() { var lex = getClassLexicalEnvironment(); lex.privateIdentifierEnvironment || (lex.privateIdentifierEnvironment = { - className: "", - identifiers: new ts.Map() + className: undefined, + weakSetName: undefined, + identifiers: undefined, + generatedIdentifiers: undefined, }); return lex.privateIdentifierEnvironment; } function getPendingExpressions() { - return pendingExpressions || (pendingExpressions = []); + return pendingExpressions !== null && pendingExpressions !== void 0 ? pendingExpressions : (pendingExpressions = []); } - function addPrivateIdentifierToEnvironment(node) { - var _a; - var text = ts.getTextOfPropertyName(node.name); - var lex = getClassLexicalEnvironment(); - var classConstructor = lex.classConstructor; - var privateEnv = getPrivateIdentifierEnvironment(); - var weakSetName = privateEnv.weakSetName; - var assignmentExpressions = []; - var privateName = node.name.escapedText; - var previousInfo = privateEnv.identifiers.get(privateName); - var isValid = !isReservedPrivateName(node.name) && previousInfo === undefined; - if (ts.hasStaticModifier(node)) { - ts.Debug.assert(classConstructor, "weakSetName should be set in private identifier environment"); - if (ts.isPropertyDeclaration(node)) { - var variableName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "f" /* PrivateIdentifierKind.Field */, - variableName: variableName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - else if (ts.isMethodDeclaration(node)) { - var functionName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "m" /* PrivateIdentifierKind.Method */, - methodName: functionName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - else if (ts.isGetAccessorDeclaration(node)) { - var getterName = createHoistedVariableForPrivateName(text + "_get", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: getterName, - setterName: undefined, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - } - else if (ts.isSetAccessorDeclaration(node)) { - var setterName = createHoistedVariableForPrivateName(text + "_set", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: undefined, - setterName: setterName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - } - else { - ts.Debug.assertNever(node, "Unknown class element type."); - } + function addPrivateIdentifierClassElementToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + if (ts.isAutoAccessorPropertyDeclaration(node)) { + addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); } else if (ts.isPropertyDeclaration(node)) { - var weakMapName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "f" /* PrivateIdentifierKind.Field */, - brandCheckIdentifier: weakMapName, - isStatic: false, - variableName: undefined, - isValid: isValid, - }); - assignmentExpressions.push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), - /*typeArguments*/ undefined, []))); + addPrivateIdentifierPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); } else if (ts.isMethodDeclaration(node)) { - ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); - privateEnv.identifiers.set(privateName, { - kind: "m" /* PrivateIdentifierKind.Method */, - methodName: createHoistedVariableForPrivateName(text, node), - brandCheckIdentifier: weakSetName, - isStatic: false, + addPrivateIdentifierMethodDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isGetAccessorDeclaration(node)) { + addPrivateIdentifierGetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isSetAccessorDeclaration(node)) { + addPrivateIdentifierSetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + } + function addPrivateIdentifierPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + if (isStatic) { + ts.Debug.assert(lex.classConstructor, "classConstructor should be set in private identifier environment"); + var variableName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { + kind: "f" /* PrivateIdentifierKind.Field */, + brandCheckIdentifier: lex.classConstructor, + variableName: variableName, + isStatic: true, isValid: isValid, }); } - else if (ts.isAccessor(node)) { - ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); - if (ts.isGetAccessor(node)) { - var getterName = createHoistedVariableForPrivateName(text + "_get", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && !previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: getterName, - setterName: undefined, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid: isValid, - }); - } - } - else { - var setterName = createHoistedVariableForPrivateName(text + "_set", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && !previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: undefined, - setterName: setterName, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid: isValid, - }); - } - } + else { + var weakMapName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { + kind: "f" /* PrivateIdentifierKind.Field */, + brandCheckIdentifier: weakMapName, + variableName: undefined, + isStatic: false, + isValid: isValid, + }); + getPendingExpressions().push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), + /*typeArguments*/ undefined, []))); + } + } + function addPrivateIdentifierMethodDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var methodName = createHoistedVariableForPrivateName(name); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "m" /* PrivateIdentifierKind.Method */, + methodName: methodName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + function addPrivateIdentifierGetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic === isStatic && !previousInfo.getterName) { + previousInfo.getterName = getterName; } else { - ts.Debug.assertNever(node, "Unknown class element type."); + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: getterName, + setterName: undefined, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); } - (_a = getPendingExpressions()).push.apply(_a, assignmentExpressions); } - function createHoistedVariableForClass(name, node) { + function addPrivateIdentifierSetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic === isStatic && !previousInfo.setterName) { + previousInfo.setterName = setterName; + } + else { + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: undefined, + setterName: setterName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + } + function addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: getterName, + setterName: setterName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + function addPrivateIdentifierToEnvironment(node, name, addDeclaration) { + var lex = getClassLexicalEnvironment(); + var privateEnv = getPrivateIdentifierEnvironment(); + var previousInfo = getPrivateIdentifier(privateEnv, name); + var isStatic = ts.hasStaticModifier(node); + var isValid = !isReservedPrivateName(name) && previousInfo === undefined; + addDeclaration(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + function createHoistedVariableForClass(name, node, suffix) { var className = getPrivateIdentifierEnvironment().className; - var prefix = className ? "_".concat(className) : ""; - var identifier = factory.createUniqueName("".concat(prefix, "_").concat(name), 16 /* GeneratedIdentifierFlags.Optimistic */); + var prefix = className ? { prefix: "_", node: className, suffix: "_" } : "_"; + var identifier = typeof name === "object" ? factory.getGeneratedNameForNode(name, 16 /* GeneratedIdentifierFlags.Optimistic */ | 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */, prefix, suffix) : + typeof name === "string" ? factory.createUniqueName(name, 16 /* GeneratedIdentifierFlags.Optimistic */, prefix, suffix) : + factory.createTempVariable(/*recordTempVariable*/ undefined, /*reserveInNestedScopes*/ true, prefix, suffix); if (resolver.getNodeCheckFlags(node) & 524288 /* NodeCheckFlags.BlockScopedBindingInLoop */) { addBlockScopedVariable(identifier); } @@ -96118,13 +97061,33 @@ var ts; } return identifier; } - function createHoistedVariableForPrivateName(privateName, node) { - return createHoistedVariableForClass(privateName.substring(1), node.name); - } - function accessPrivateIdentifier(name) { + function createHoistedVariableForPrivateName(name, suffix) { var _a; + var text = ts.tryGetTextOfPropertyName(name); + return createHoistedVariableForClass((_a = text === null || text === void 0 ? void 0 : text.substring(1)) !== null && _a !== void 0 ? _a : name, name, suffix); + } + /** + * Access an already defined {@link PrivateIdentifier} in the current {@link PrivateIdentifierEnvironment}. + * + * @seealso {@link addPrivateIdentifierToEnvironment} + */ + function accessPrivateIdentifier(name) { + if (ts.isGeneratedPrivateIdentifier(name)) { + return accessGeneratedPrivateIdentifier(name); + } + else { + return accessPrivateIdentifierByText(name.escapedText); + } + } + function accessPrivateIdentifierByText(text) { + return accessPrivateIdentifierWorker(getPrivateIdentifierInfo, text); + } + function accessGeneratedPrivateIdentifier(name) { + return accessPrivateIdentifierWorker(getGeneratedPrivateIdentifierInfo, ts.getNodeForGeneratedName(name)); + } + function accessPrivateIdentifierWorker(getPrivateIdentifierInfo, privateIdentifierKey) { if (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.privateIdentifierEnvironment) { - var info = currentClassLexicalEnvironment.privateIdentifierEnvironment.identifiers.get(name.escapedText); + var info = getPrivateIdentifierInfo(currentClassLexicalEnvironment.privateIdentifierEnvironment, privateIdentifierKey); if (info) { return info; } @@ -96134,9 +97097,11 @@ var ts; if (!env) { continue; } - var info = (_a = env.privateIdentifierEnvironment) === null || _a === void 0 ? void 0 : _a.identifiers.get(name.escapedText); - if (info) { - return info; + if (env.privateIdentifierEnvironment) { + var info = getPrivateIdentifierInfo(env.privateIdentifierEnvironment, privateIdentifierKey); + if (info) { + return info; + } } } return undefined; @@ -96193,7 +97158,7 @@ var ts; } } } - return ts.visitNode(node, visitorDestructuringTarget); + return ts.visitNode(node, assignmentTargetVisitor); } function visitObjectAssignmentTarget(node) { if (ts.isObjectBindingOrAssignmentElement(node) && !ts.isShorthandPropertyAssignment(node)) { @@ -96226,10 +97191,10 @@ var ts; var initializer = ts.getInitializerOfBindingOrAssignmentElement(node); return factory.updatePropertyAssignment(node, ts.visitNode(node.name, visitor, ts.isPropertyName), wrapped ? initializer ? factory.createAssignment(wrapped, ts.visitNode(initializer, visitor)) : wrapped : - ts.visitNode(node.initializer, visitorDestructuringTarget, ts.isExpression)); + ts.visitNode(node.initializer, assignmentTargetVisitor, ts.isExpression)); } if (ts.isSpreadAssignment(node)) { - return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, visitorDestructuringTarget, ts.isExpression)); + return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, assignmentTargetVisitor, ts.isExpression)); } ts.Debug.assert(wrapped === undefined, "Should not have generated a wrapped target"); } @@ -96275,7 +97240,31 @@ var ts; /*typeArguments*/ undefined, [receiver]); } function isReservedPrivateName(node) { - return node.escapedText === "#constructor"; + return !ts.isGeneratedPrivateIdentifier(node) && node.escapedText === "#constructor"; + } + function getPrivateIdentifier(privateEnv, name) { + return ts.isGeneratedPrivateIdentifier(name) ? + getGeneratedPrivateIdentifierInfo(privateEnv, ts.getNodeForGeneratedName(name)) : + getPrivateIdentifierInfo(privateEnv, name.escapedText); + } + function setPrivateIdentifier(privateEnv, name, info) { + var _a, _b; + if (ts.isGeneratedPrivateIdentifier(name)) { + (_a = privateEnv.generatedIdentifiers) !== null && _a !== void 0 ? _a : (privateEnv.generatedIdentifiers = new ts.Map()); + privateEnv.generatedIdentifiers.set(ts.getNodeForGeneratedName(name), info); + } + else { + (_b = privateEnv.identifiers) !== null && _b !== void 0 ? _b : (privateEnv.identifiers = new ts.Map()); + privateEnv.identifiers.set(name.escapedText, info); + } + } + function getPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.identifiers) === null || _a === void 0 ? void 0 : _a.get(key); + } + function getGeneratedPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.generatedIdentifiers) === null || _a === void 0 ? void 0 : _a.get(key); } })(ts || (ts = {})); /*@internal*/ @@ -96316,15 +97305,15 @@ var ts; */ function serializeTypeOfNode(node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: return serializeTypeNode(node.type); - case 173 /* SyntaxKind.SetAccessor */: - case 172 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return serializeTypeNode(getAccessorTypeNode(node)); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: return ts.factory.createIdentifier("Function"); default: return ts.factory.createVoidZero(); @@ -96360,7 +97349,7 @@ var ts; return ts.factory.createArrayLiteralExpression(expressions); } function getParametersOfDecoratedDeclaration(node, container) { - if (container && node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (container && node.kind === 174 /* SyntaxKind.GetAccessor */) { var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; if (setAccessor) { return setAccessor.parameters; @@ -96406,66 +97395,66 @@ var ts; node = ts.skipTypeParentheses(node); switch (node.kind) { case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return ts.factory.createVoidZero(); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return ts.factory.createIdentifier("Function"); - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return ts.factory.createIdentifier("Array"); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return node.assertsModifier ? ts.factory.createVoidZero() : ts.factory.createIdentifier("Boolean"); - case 133 /* SyntaxKind.BooleanKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: return ts.factory.createIdentifier("Boolean"); - case 198 /* SyntaxKind.TemplateLiteralType */: - case 150 /* SyntaxKind.StringKeyword */: + case 200 /* SyntaxKind.TemplateLiteralType */: + case 152 /* SyntaxKind.StringKeyword */: return ts.factory.createIdentifier("String"); - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return ts.factory.createIdentifier("Object"); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return serializeLiteralOfLiteralTypeNode(node.literal); - case 147 /* SyntaxKind.NumberKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: return ts.factory.createIdentifier("Number"); - case 158 /* SyntaxKind.BigIntKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: return getGlobalConstructor("BigInt", 7 /* ScriptTarget.ES2020 */); - case 151 /* SyntaxKind.SymbolKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: return getGlobalConstructor("Symbol", 2 /* ScriptTarget.ES2015 */); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return serializeTypeReferenceNode(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return serializeUnionOrIntersectionConstituents(node.types, /*isIntersection*/ true); - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return serializeUnionOrIntersectionConstituents(node.types, /*isIntersection*/ false); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return serializeUnionOrIntersectionConstituents([node.trueType, node.falseType], /*isIntersection*/ false); - case 193 /* SyntaxKind.TypeOperator */: - if (node.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { + case 195 /* SyntaxKind.TypeOperator */: + if (node.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { return serializeTypeNode(node.type); } break; - case 181 /* SyntaxKind.TypeQuery */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 195 /* SyntaxKind.MappedType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 192 /* SyntaxKind.ThisType */: - case 200 /* SyntaxKind.ImportType */: + case 183 /* SyntaxKind.TypeQuery */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 197 /* SyntaxKind.MappedType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 194 /* SyntaxKind.ThisType */: + case 202 /* SyntaxKind.ImportType */: break; // handle JSDoc types from an invalid parse - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 318 /* SyntaxKind.JSDocVariadicType */: - case 319 /* SyntaxKind.JSDocNamepathType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 321 /* SyntaxKind.JSDocVariadicType */: + case 322 /* SyntaxKind.JSDocNamepathType */: break; - case 314 /* SyntaxKind.JSDocNullableType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 316 /* SyntaxKind.JSDocOptionalType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return serializeTypeNode(node.type); default: return ts.Debug.failBadSyntaxKind(node); @@ -96477,7 +97466,7 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return ts.factory.createIdentifier("String"); - case 219 /* SyntaxKind.PrefixUnaryExpression */: { + case 221 /* SyntaxKind.PrefixUnaryExpression */: { var operand = node.operand; switch (operand.kind) { case 8 /* SyntaxKind.NumericLiteral */: @@ -96506,20 +97495,20 @@ var ts; for (var _i = 0, types_22 = types; _i < types_22.length; _i++) { var typeNode = types_22[_i]; typeNode = ts.skipTypeParentheses(typeNode); - if (typeNode.kind === 143 /* SyntaxKind.NeverKeyword */) { + if (typeNode.kind === 144 /* SyntaxKind.NeverKeyword */) { if (isIntersection) return ts.factory.createVoidZero(); // Reduce to `never` in an intersection continue; // Elide `never` in a union } - if (typeNode.kind === 155 /* SyntaxKind.UnknownKeyword */) { + if (typeNode.kind === 157 /* SyntaxKind.UnknownKeyword */) { if (!isIntersection) return ts.factory.createIdentifier("Object"); // Reduce to `unknown` in a union continue; // Elide `unknown` in an intersection } - if (typeNode.kind === 130 /* SyntaxKind.AnyKeyword */) { + if (typeNode.kind === 131 /* SyntaxKind.AnyKeyword */) { return ts.factory.createIdentifier("Object"); // Reduce to `any` in a union or intersection } - if (!strictNullChecks && ((ts.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */) || typeNode.kind === 153 /* SyntaxKind.UndefinedKeyword */)) { + if (!strictNullChecks && ((ts.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */) || typeNode.kind === 155 /* SyntaxKind.UndefinedKeyword */)) { continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks } var serializedConstituent = serializeTypeNode(typeNode); @@ -96667,7 +97656,7 @@ var ts; name.original = undefined; ts.setParent(name, ts.getParseTreeNode(currentLexicalScope)); // ensure the parent is set to a parse tree node. return name; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return serializeQualifiedNameAsExpression(node); } } @@ -96722,24 +97711,24 @@ var ts; return node; } switch (node.kind) { - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are elided. They will be emitted as part of `visitClassDeclaration`. return undefined; - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return visitClassExpression(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return visitConstructorDeclaration(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return visitMethodDeclaration(node); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitSetAccessorDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return visitGetAccessorDeclaration(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return visitPropertyDeclaration(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameterDeclaration(node); default: return ts.visitEachChild(node, visitor, context); @@ -97095,7 +98084,7 @@ var ts; var prefix = getClassMemberPrefix(node, member); var memberName = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ !ts.hasSyntacticModifier(member, 2 /* ModifierFlags.Ambient */)); var descriptor = languageVersion > 0 /* ScriptTarget.ES3 */ - ? member.kind === 167 /* SyntaxKind.PropertyDeclaration */ + ? ts.isPropertyDeclaration(member) && !ts.hasAccessorModifier(member) // We emit `void 0` here to indicate to `__decorate` that it can invoke `Object.defineProperty` directly, but that it // should not invoke `Object.getOwnPropertyDescriptor`. ? factory.createVoidZero() @@ -97358,34 +98347,34 @@ var ts; return node; } switch (node.kind) { - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // ES2017 async modifier should be elided for targets < ES2017 return undefined; - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return visitAwaitExpression(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitMethodDeclaration, node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitFunctionDeclaration, node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitFunctionExpression, node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return doWithContext(1 /* ContextFlags.NonTopLevel */, visitArrowFunction, node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { capturedSuperProperties.add(node.name.escapedText); } return ts.visitEachChild(node, visitor, context); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (capturedSuperProperties && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitDefault, node); default: return ts.visitEachChild(node, visitor, context); @@ -97394,27 +98383,27 @@ var ts; function asyncBodyVisitor(node) { if (ts.isNodeWithPossibleHoistedDeclaration(node)) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatementInAsyncBody(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatementInAsyncBody(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatementInAsyncBody(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatementInAsyncBody(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClauseInAsyncBody(node); - case 235 /* SyntaxKind.Block */: - case 249 /* SyntaxKind.SwitchStatement */: - case 263 /* SyntaxKind.CaseBlock */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 252 /* SyntaxKind.TryStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 250 /* SyntaxKind.LabeledStatement */: + case 238 /* SyntaxKind.Block */: + case 252 /* SyntaxKind.SwitchStatement */: + case 266 /* SyntaxKind.CaseBlock */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 255 /* SyntaxKind.TryStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return ts.visitEachChild(node, asyncBodyVisitor, context); default: return ts.Debug.assertNever(node, "Unhandled node."); @@ -97617,7 +98606,7 @@ var ts; var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 /* ScriptTarget.ES2015 */ ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 214 /* SyntaxKind.ArrowFunction */; + var isArrowFunction = node.kind === 216 /* SyntaxKind.ArrowFunction */; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* NodeCheckFlags.CaptureArguments */) !== 0; // An async function is emit as an outer function that calls an inner // generator function. To preserve lexical bindings, we pass the current @@ -97708,17 +98697,17 @@ var ts; enabledSubstitutions |= 1 /* ES2017SubstitutionFlags.AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(257 /* SyntaxKind.ClassDeclaration */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(260 /* SyntaxKind.ClassDeclaration */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // We need to be notified when entering the generated accessor arrow functions. - context.enableEmitNotification(237 /* SyntaxKind.VariableStatement */); + context.enableEmitNotification(240 /* SyntaxKind.VariableStatement */); } } /** @@ -97766,11 +98755,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); } return node; @@ -97802,11 +98791,11 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { @@ -97963,7 +98952,7 @@ var ts; return visitorWorker(node, /*expressionResultIsUnused*/ true); } function visitorNoAsyncModifier(node) { - if (node.kind === 131 /* SyntaxKind.AsyncKeyword */) { + if (node.kind === 132 /* SyntaxKind.AsyncKeyword */) { return undefined; } return node; @@ -97989,70 +98978,70 @@ var ts; return node; } switch (node.kind) { - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return visitAwaitExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node, expressionResultIsUnused); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node, expressionResultIsUnused); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 246 /* SyntaxKind.ForInStatement */: return doWithHierarchyFacts(visitDefault, node, 0 /* HierarchyFacts.IterationStatementExcludes */, 2 /* HierarchyFacts.IterationStatementIncludes */); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return doWithHierarchyFacts(visitForStatement, node, 0 /* HierarchyFacts.IterationStatementExcludes */, 2 /* HierarchyFacts.IterationStatementIncludes */); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return visitVoidExpression(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return doWithHierarchyFacts(visitConstructorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return doWithHierarchyFacts(visitMethodDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return doWithHierarchyFacts(visitGetAccessorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return doWithHierarchyFacts(visitSetAccessorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return doWithHierarchyFacts(visitFunctionDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return doWithHierarchyFacts(visitFunctionExpression, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return doWithHierarchyFacts(visitArrowFunction, node, 2 /* HierarchyFacts.ArrowFunctionExcludes */, 0 /* HierarchyFacts.ArrowFunctionIncludes */); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameter(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, expressionResultIsUnused); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { capturedSuperProperties.add(node.name.escapedText); } return ts.visitEachChild(node, visitor, context); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (capturedSuperProperties && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return doWithHierarchyFacts(visitDefault, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); default: return ts.visitEachChild(node, visitor, context); @@ -98088,7 +99077,7 @@ var ts; function visitLabeledStatement(node) { if (enclosingFunctionFlags & 2 /* FunctionFlags.Async */) { var statement = ts.unwrapInnermostStatementOfLabel(node); - if (statement.kind === 244 /* SyntaxKind.ForOfStatement */ && statement.awaitModifier) { + if (statement.kind === 247 /* SyntaxKind.ForOfStatement */ && statement.awaitModifier) { return visitForOfStatement(statement, node); } return factory.restoreEnclosingLabel(ts.visitNode(statement, visitor, ts.isStatement, factory.liftToBlock), node); @@ -98100,7 +99089,7 @@ var ts; var objects = []; for (var _i = 0, elements_5 = elements; _i < elements_5.length; _i++) { var e = elements_5[_i]; - if (e.kind === 298 /* SyntaxKind.SpreadAssignment */) { + if (e.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (chunkObject) { objects.push(factory.createObjectLiteralExpression(chunkObject)); chunkObject = undefined; @@ -98109,7 +99098,7 @@ var ts; objects.push(ts.visitNode(target, visitor, ts.isExpression)); } else { - chunkObject = ts.append(chunkObject, e.kind === 296 /* SyntaxKind.PropertyAssignment */ + chunkObject = ts.append(chunkObject, e.kind === 299 /* SyntaxKind.PropertyAssignment */ ? factory.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression)) : ts.visitNode(e, visitor, ts.isObjectLiteralElementLike)); } @@ -98143,7 +99132,7 @@ var ts; // If we translate the above to `__assign({}, k, l)`, the `l` will evaluate before `k` is spread and we // end up with `{ a: 1, b: 2, c: 3 }` var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (objects.length && objects[0].kind !== 207 /* SyntaxKind.ObjectLiteralExpression */) { objects.unshift(factory.createObjectLiteralExpression()); } var expression = objects[0]; @@ -98651,17 +99640,17 @@ var ts; enabledSubstitutions |= 1 /* ESNextSubstitutionFlags.AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(257 /* SyntaxKind.ClassDeclaration */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(260 /* SyntaxKind.ClassDeclaration */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // We need to be notified when entering the generated accessor arrow functions. - context.enableEmitNotification(237 /* SyntaxKind.VariableStatement */); + context.enableEmitNotification(240 /* SyntaxKind.VariableStatement */); } } /** @@ -98709,11 +99698,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); } return node; @@ -98745,11 +99734,11 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { @@ -98781,7 +99770,7 @@ var ts; return node; } switch (node.kind) { - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); default: return ts.visitEachChild(node, visitor, context); @@ -98813,25 +99802,25 @@ var ts; return node; } switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: { + case 210 /* SyntaxKind.CallExpression */: { var updated = visitNonOptionalCallExpression(node, /*captureThisArg*/ false); ts.Debug.assertNotNode(updated, ts.isSyntheticReference); return updated; } - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (ts.isOptionalChain(node)) { var updated = visitOptionalExpression(node, /*captureThisArg*/ false, /*isDelete*/ false); ts.Debug.assertNotNode(updated, ts.isSyntheticReference); return updated; } return ts.visitEachChild(node, visitor, context); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */) { return transformNullishCoalescingExpression(node); } return ts.visitEachChild(node, visitor, context); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return visitDeleteExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -98873,7 +99862,7 @@ var ts; thisArg = expression; } } - expression = node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ + expression = node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? factory.updatePropertyAccessExpression(node, expression, ts.visitNode(node.name, visitor, ts.isIdentifier)) : factory.updateElementAccessExpression(node, expression, ts.visitNode(node.argumentExpression, visitor, ts.isExpression)); return thisArg ? factory.createSyntheticReferenceExpression(expression, thisArg) : expression; @@ -98896,10 +99885,10 @@ var ts; } function visitNonOptionalExpression(node, captureThisArg, isDelete) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); - case 208 /* SyntaxKind.CallExpression */: return visitNonOptionalCallExpression(node, captureThisArg); + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); + case 210 /* SyntaxKind.CallExpression */: return visitNonOptionalCallExpression(node, captureThisArg); default: return ts.visitNode(node, visitor, ts.isExpression); } } @@ -98918,8 +99907,8 @@ var ts; for (var i = 0; i < chain.length; i++) { var segment = chain[i]; switch (segment.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (i === chain.length - 1 && captureThisArg) { if (!ts.isSimpleCopiableExpression(rightExpression)) { thisArg = factory.createTempVariable(hoistVariableDeclaration); @@ -98929,11 +99918,11 @@ var ts; thisArg = rightExpression; } } - rightExpression = segment.kind === 206 /* SyntaxKind.PropertyAccessExpression */ + rightExpression = segment.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? factory.createPropertyAccessExpression(rightExpression, ts.visitNode(segment.name, visitor, ts.isIdentifier)) : factory.createElementAccessExpression(rightExpression, ts.visitNode(segment.argumentExpression, visitor, ts.isExpression)); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (i === 0 && leftThisArg) { if (!ts.isGeneratedIdentifier(leftThisArg)) { leftThisArg = factory.cloneNode(leftThisArg); @@ -98994,7 +99983,7 @@ var ts; return node; } switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var binaryExpression = node; if (ts.isLogicalOrCoalescingAssignmentExpression(binaryExpression)) { return transformLogicalAssignment(binaryExpression); @@ -99163,13 +100152,13 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return visitJsxElement(node, /*isChild*/ false); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ false); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return visitJsxFragment(node, /*isChild*/ false); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -99179,13 +100168,13 @@ var ts; switch (node.kind) { case 11 /* SyntaxKind.JsxText */: return visitJsxText(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return visitJsxExpression(node); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return visitJsxElement(node, /*isChild*/ true); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ true); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return visitJsxFragment(node, /*isChild*/ true); default: return ts.Debug.failBadSyntaxKind(node); @@ -99366,7 +100355,7 @@ var ts; var literal = factory.createStringLiteral(tryDecodeEntities(node.text) || node.text, singleQuote); return ts.setTextRange(literal, node); } - if (node.kind === 288 /* SyntaxKind.JsxExpression */) { + if (node.kind === 291 /* SyntaxKind.JsxExpression */) { if (node.expression === undefined) { return factory.createTrue(); } @@ -99467,7 +100456,7 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 278 /* SyntaxKind.JsxElement */) { + if (node.kind === 281 /* SyntaxKind.JsxElement */) { return getTagName(node.openingElement); } else { @@ -99774,7 +100763,7 @@ var ts; return node; } switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -99999,7 +100988,7 @@ var ts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { return (hierarchyFacts & 8192 /* HierarchyFacts.ConstructorWithCapturedSuper */) !== 0 - && node.kind === 247 /* SyntaxKind.ReturnStatement */ + && node.kind === 250 /* SyntaxKind.ReturnStatement */ && !node.expression; } function isOrMayContainReturnCompletion(node) { @@ -100053,65 +101042,65 @@ var ts; switch (node.kind) { case 124 /* SyntaxKind.StaticKeyword */: return undefined; // elide static keyword - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return visitClassExpression(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameter(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return visitArrowFunction(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); case 79 /* SyntaxKind.Identifier */: return visitIdentifier(node); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return visitVariableDeclarationList(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return visitCaseBlock(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return visitBlock(node, /*isFunctionBody*/ false); - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return visitBreakOrContinueStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*outermostLabeledStatement*/ undefined); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node, /*outermostLabeledStatement*/ undefined); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return visitShorthandPropertyAssignment(node); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return visitComputedPropertyName(node); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, expressionResultIsUnused); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node, expressionResultIsUnused); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node, expressionResultIsUnused); case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 15 /* SyntaxKind.TemplateHead */: @@ -100122,30 +101111,30 @@ var ts; return visitStringLiteral(node); case 8 /* SyntaxKind.NumericLiteral */: return visitNumericLiteral(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return visitTemplateExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return visitSpreadElement(node); case 106 /* SyntaxKind.SuperKeyword */: return visitSuperKeyword(/*isExpressionOfCall*/ false); case 108 /* SyntaxKind.ThisKeyword */: return visitThisKeyword(node); - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return visitMetaProperty(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return visitMethodDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitAccessorDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return visitVoidExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -100235,14 +101224,14 @@ var ts; // it is possible if either // - break/continue is labeled and label is located inside the converted loop // - break/continue is non-labeled and located in non-converted loop/switch statement - var jump = node.kind === 246 /* SyntaxKind.BreakStatement */ ? 2 /* Jump.Break */ : 4 /* Jump.Continue */; + var jump = node.kind === 249 /* SyntaxKind.BreakStatement */ ? 2 /* Jump.Break */ : 4 /* Jump.Continue */; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(ts.idText(node.label))) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; var label = node.label; if (!label) { - if (node.kind === 246 /* SyntaxKind.BreakStatement */) { + if (node.kind === 249 /* SyntaxKind.BreakStatement */) { convertedLoopState.nonLocalJumps |= 2 /* Jump.Break */; labelMarker = "break"; } @@ -100253,7 +101242,7 @@ var ts; } } else { - if (node.kind === 246 /* SyntaxKind.BreakStatement */) { + if (node.kind === 249 /* SyntaxKind.BreakStatement */) { labelMarker = "break-".concat(label.escapedText); setLabeledJump(convertedLoopState, /*isBreak*/ true, ts.idText(label), labelMarker); } @@ -100309,7 +101298,7 @@ var ts; statements.push(statement); // Add an `export default` statement for default exports (for `--target es5 --module es6`) if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - var exportStatement = ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) + var exportStatement = ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) ? factory.createExportDefault(factory.getLocalName(node)) : factory.createExternalModuleExport(factory.getLocalName(node)); ts.setOriginalNode(exportStatement, statement); @@ -100678,11 +101667,11 @@ var ts; */ function isSufficientlyCoveredByReturnStatements(statement) { // A return statement is considered covered. - if (statement.kind === 247 /* SyntaxKind.ReturnStatement */) { + if (statement.kind === 250 /* SyntaxKind.ReturnStatement */) { return true; } // An if-statement with two covered branches is covered. - else if (statement.kind === 239 /* SyntaxKind.IfStatement */) { + else if (statement.kind === 242 /* SyntaxKind.IfStatement */) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && @@ -100690,7 +101679,7 @@ var ts; } } // A block is covered if it has a last statement which is covered. - else if (statement.kind === 235 /* SyntaxKind.Block */) { + else if (statement.kind === 238 /* SyntaxKind.Block */) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -100890,7 +101879,7 @@ var ts; * @param node A node. */ function insertCaptureThisForNodeIfNeeded(statements, node) { - if (hierarchyFacts & 65536 /* HierarchyFacts.CapturedLexicalThis */ && node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (hierarchyFacts & 65536 /* HierarchyFacts.CapturedLexicalThis */ && node.kind !== 216 /* SyntaxKind.ArrowFunction */) { insertCaptureThisForNode(statements, node, factory.createThis()); return true; } @@ -100924,22 +101913,22 @@ var ts; if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */) { var newTarget = void 0; switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return statements; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Methods and accessors cannot be constructors, so 'new.target' will // always return 'undefined'. newTarget = factory.createVoidZero(); break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: // Class constructors can only be called with `new`, so `this.constructor` // should be relatively safe to use. newTarget = factory.createPropertyAccessExpression(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), "constructor"); break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: // Functions can be called or constructed, and may have a `this` due to // being a member or when calling an imported function via `other_1.f()`. newTarget = factory.createConditionalExpression(factory.createLogicalAnd(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), factory.createBinaryExpression(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), 102 /* SyntaxKind.InstanceOfKeyword */, factory.getLocalName(node))), @@ -100974,21 +101963,21 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: statements.push(transformSemicolonClassElementToStatement(member)); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; - case 171 /* SyntaxKind.Constructor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // Constructors are handled in visitClassExpression/visitClassDeclaration break; default: @@ -101187,7 +102176,7 @@ var ts; : enterSubtree(32670 /* HierarchyFacts.FunctionExcludes */, 65 /* HierarchyFacts.FunctionIncludes */); var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */ && !name && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */)) { + if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */ && !name && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */)) { name = factory.getGeneratedNameForNode(node); } exitSubtree(ancestorFacts, 98304 /* HierarchyFacts.FunctionSubtreeExcludes */, 0 /* HierarchyFacts.None */); @@ -101233,7 +102222,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 214 /* SyntaxKind.ArrowFunction */); + ts.Debug.assert(node.kind === 216 /* SyntaxKind.ArrowFunction */); // To align with the old emitter, we use a synthetic end position on the location // for the statement list we synthesize when we down-level an arrow function with // an expression function body. This prevents both comments and source maps from @@ -101540,14 +102529,14 @@ var ts; } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitDoOrWhileStatement(node, outermostLabeledStatement); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, outermostLabeledStatement); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node, outermostLabeledStatement); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, outermostLabeledStatement); } } @@ -101733,7 +102722,7 @@ var ts; var property = properties[i]; if ((property.transformFlags & 1048576 /* TransformFlags.ContainsYield */ && hierarchyFacts & 4 /* HierarchyFacts.AsyncFunctionBody */) - || (hasComputed = ts.Debug.checkDefined(property.name).kind === 162 /* SyntaxKind.ComputedPropertyName */)) { + || (hasComputed = ts.Debug.checkDefined(property.name).kind === 164 /* SyntaxKind.ComputedPropertyName */)) { numInitialProperties = i; break; } @@ -101849,11 +102838,11 @@ var ts; } function convertIterationStatementCore(node, initializerFunction, convertedLoopBody) { switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody); - case 243 /* SyntaxKind.ForInStatement */: return convertForInStatement(node, convertedLoopBody); - case 244 /* SyntaxKind.ForOfStatement */: return convertForOfStatement(node, convertedLoopBody); - case 240 /* SyntaxKind.DoStatement */: return convertDoStatement(node, convertedLoopBody); - case 241 /* SyntaxKind.WhileStatement */: return convertWhileStatement(node, convertedLoopBody); + case 245 /* SyntaxKind.ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody); + case 246 /* SyntaxKind.ForInStatement */: return convertForInStatement(node, convertedLoopBody); + case 247 /* SyntaxKind.ForOfStatement */: return convertForOfStatement(node, convertedLoopBody); + case 243 /* SyntaxKind.DoStatement */: return convertDoStatement(node, convertedLoopBody); + case 244 /* SyntaxKind.WhileStatement */: return convertWhileStatement(node, convertedLoopBody); default: return ts.Debug.failBadSyntaxKind(node, "IterationStatement expected"); } } @@ -101878,11 +102867,11 @@ var ts; function createConvertedLoopState(node) { var loopInitializer; switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: var initializer = node.initializer; - if (initializer && initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (initializer && initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { loopInitializer = initializer; } break; @@ -102298,20 +103287,20 @@ var ts; for (var i = start; i < numProperties; i++) { var property = properties[i]; switch (property.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { expressions.push(transformAccessorsToExpression(receiver, accessors, node, !!node.multiLine)); } break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -102418,7 +103407,7 @@ var ts; var updated; var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { updated = factory.updateGetAccessorDeclaration(node, node.modifiers, node.name, parameters, node.type, body); } else { @@ -102878,13 +103867,13 @@ var ts; if ((enabledSubstitutions & 1 /* ES2015SubstitutionFlags.CapturedThis */) === 0) { enabledSubstitutions |= 1 /* ES2015SubstitutionFlags.CapturedThis */; context.enableSubstitution(108 /* SyntaxKind.ThisKeyword */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(214 /* SyntaxKind.ArrowFunction */); - context.enableEmitNotification(213 /* SyntaxKind.FunctionExpression */); - context.enableEmitNotification(256 /* SyntaxKind.FunctionDeclaration */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(216 /* SyntaxKind.ArrowFunction */); + context.enableEmitNotification(215 /* SyntaxKind.FunctionExpression */); + context.enableEmitNotification(259 /* SyntaxKind.FunctionDeclaration */); } } /** @@ -102925,10 +103914,10 @@ var ts; */ function isNameOfDeclarationWithCollidingName(node) { switch (node.parent.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return node.parent.name === node && resolver.isDeclarationWithCollidingName(node.parent); } @@ -103010,11 +103999,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 238 /* SyntaxKind.ExpressionStatement */) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 241 /* SyntaxKind.ExpressionStatement */) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 208 /* SyntaxKind.CallExpression */) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 210 /* SyntaxKind.CallExpression */) { return false; } var callTarget = statementExpression.expression; @@ -103022,7 +104011,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 225 /* SyntaxKind.SpreadElement */) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 227 /* SyntaxKind.SpreadElement */) { return false; } var expression = callArgument.expression; @@ -103048,15 +104037,15 @@ var ts; if (compilerOptions.jsx === 1 /* JsxEmit.Preserve */ || compilerOptions.jsx === 3 /* JsxEmit.ReactNative */) { previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; - context.enableEmitNotification(280 /* SyntaxKind.JsxOpeningElement */); - context.enableEmitNotification(281 /* SyntaxKind.JsxClosingElement */); - context.enableEmitNotification(279 /* SyntaxKind.JsxSelfClosingElement */); + context.enableEmitNotification(283 /* SyntaxKind.JsxOpeningElement */); + context.enableEmitNotification(284 /* SyntaxKind.JsxClosingElement */); + context.enableEmitNotification(282 /* SyntaxKind.JsxSelfClosingElement */); noSubstitution = []; } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(296 /* SyntaxKind.PropertyAssignment */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(299 /* SyntaxKind.PropertyAssignment */); return ts.chainBundle(context, transformSourceFile); /** * Transforms an ES5 source file to ES3. @@ -103075,9 +104064,9 @@ var ts; */ function onEmitNode(hint, node, emitCallback) { switch (node.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: var tagName = node.tagName; noSubstitution[ts.getOriginalNodeId(tagName)] = true; break; @@ -103412,13 +104401,13 @@ var ts; */ function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return visitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitWhileStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -103431,24 +104420,24 @@ var ts; */ function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitAccessorDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return visitBreakStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return visitContinueStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); default: if (node.transformFlags & 1048576 /* TransformFlags.ContainsYield */) { @@ -103469,23 +104458,23 @@ var ts; */ function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return visitConditionalExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return visitElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -103498,9 +104487,9 @@ var ts; */ function visitGenerator(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); default: return ts.Debug.failBadSyntaxKind(node); @@ -103707,7 +104696,7 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // [source] // a.b = yield; // @@ -103719,7 +104708,7 @@ var ts; // _a.b = %sent%; target = factory.updatePropertyAccessExpression(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // [source] // a[b] = yield; // @@ -104113,35 +105102,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return transformAndEmitBlock(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return transformAndEmitExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return transformAndEmitIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return transformAndEmitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return transformAndEmitWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return transformAndEmitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return transformAndEmitForInStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return transformAndEmitContinueStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return transformAndEmitBreakStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return transformAndEmitReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return transformAndEmitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return transformAndEmitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return transformAndEmitLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return transformAndEmitThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement)); @@ -104571,7 +105560,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 290 /* SyntaxKind.DefaultClause */ && defaultClauseIndex === -1) { + if (clause.kind === 293 /* SyntaxKind.DefaultClause */ && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -104584,7 +105573,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { if (containsYield(clause.expression) && pendingClauses.length > 0) { break; } @@ -105744,12 +106733,12 @@ var ts; var previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. - context.enableSubstitution(210 /* SyntaxKind.TaggedTemplateExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. + context.enableSubstitution(212 /* SyntaxKind.TaggedTemplateExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. context.enableSubstitution(79 /* SyntaxKind.Identifier */); // Substitutes expression identifiers with imported/exported symbols. - context.enableSubstitution(221 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(223 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var currentSourceFile; // The current file. @@ -106077,23 +107066,23 @@ var ts; */ function topLevelVisitor(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return visitor(node); @@ -106106,26 +107095,26 @@ var ts; return node; } switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, valueIsDiscarded); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(node) && currentSourceFile.impliedNodeFormat === undefined) { return visitImportCallExpression(node); } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); } return ts.visitEachChild(node, visitor, context); @@ -106141,24 +107130,24 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var elem = _a[_i]; switch (elem.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (destructuringNeedsFlattening(elem.initializer)) { return true; } break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: if (destructuringNeedsFlattening(elem.name)) { return true; } break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: if (destructuringNeedsFlattening(elem.expression)) { return true; } break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return false; default: ts.Debug.assertNever(elem, "Unhandled object member kind"); } @@ -106744,7 +107733,7 @@ var ts; // // To balance the declaration, add the exports of the elided variable // statement. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 237 /* SyntaxKind.VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240 /* SyntaxKind.VariableStatement */) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -106799,10 +107788,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding, /* liveBinding */ true); @@ -106886,7 +107875,7 @@ var ts; return statements; } if (ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */)) { - var exportName = ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); + var exportName = ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); statements = appendExportStatement(statements, exportName, factory.getLocalName(decl), /*location*/ decl); } if (decl.name) { @@ -107015,7 +108004,7 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; previousOnEmitNode(hint, node, emitCallback); @@ -107077,11 +108066,11 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return substituteTaggedTemplateExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return substituteBinaryExpression(node); } return node; @@ -107125,7 +108114,7 @@ var ts; } else if (!(ts.isGeneratedIdentifier(node) && !(node.autoGenerateFlags & 64 /* GeneratedIdentifierFlags.AllowNameSubstitution */)) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 305 /* SyntaxKind.SourceFile */) { + if (exportContainer && exportContainer.kind === 308 /* SyntaxKind.SourceFile */) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.cloneNode(node)), /*location*/ node); } @@ -107215,10 +108204,10 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(79 /* SyntaxKind.Identifier */); // Substitutes expression identifiers for imported symbols. - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols - context.enableSubstitution(221 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(231 /* SyntaxKind.MetaProperty */); // Substitutes 'import.meta' - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols + context.enableSubstitution(223 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(233 /* SyntaxKind.MetaProperty */); // Substitutes 'import.meta' + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var exportFunctionsMap = []; // The export function associated with a source file. @@ -107408,7 +108397,7 @@ var ts; ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); var exportStarFunction = addExportStarIfNeeded(statements); // TODO: GH#18217 var modifiers = node.transformFlags & 2097152 /* TransformFlags.ContainsAwait */ ? - factory.createModifiersFromModifierFlags(256 /* ModifierFlags.Async */) : + factory.createModifiersFromModifierFlags(512 /* ModifierFlags.Async */) : undefined; var moduleObject = factory.createObjectLiteralExpression([ factory.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), @@ -107442,7 +108431,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 272 /* SyntaxKind.ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 275 /* SyntaxKind.ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -107531,19 +108520,26 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(factory, entry, currentSourceFile); // TODO: GH#18217 switch (entry.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: if (!entry.importClause) { // 'import "..."' case // module is imported only for side-effects, no emit required break; } // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: ts.Debug.assert(importVariableName !== undefined); // save import into the local statements.push(factory.createExpressionStatement(factory.createAssignment(importVariableName, parameterName))); + if (ts.hasSyntacticModifier(entry, 1 /* ModifierFlags.Export */)) { + statements.push(factory.createExpressionStatement(factory.createCallExpression(exportFunction, + /*typeArguments*/ undefined, [ + factory.createStringLiteral(ts.idText(importVariableName)), + parameterName, + ]))); + } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { if (ts.isNamedExports(entry.exportClause)) { @@ -107602,13 +108598,13 @@ var ts; */ function topLevelVisitor(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); default: return topLevelNestedVisitor(node); @@ -107787,7 +108783,7 @@ var ts; function shouldHoistVariableDeclarationList(node) { // hoist only non-block scoped declarations or block scoped declarations parented by source file return (ts.getEmitFlags(node) & 2097152 /* EmitFlags.NoHoisting */) === 0 - && (enclosingBlockScopedContainer.kind === 305 /* SyntaxKind.SourceFile */ + && (enclosingBlockScopedContainer.kind === 308 /* SyntaxKind.SourceFile */ || (ts.getOriginalNode(node).flags & 3 /* NodeFlags.BlockScoped */) === 0); } /** @@ -107851,7 +108847,7 @@ var ts; // // To balance the declaration, we defer the exports of the elided variable // statement until we visit this declaration's `EndOfDeclarationMarker`. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 237 /* SyntaxKind.VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240 /* SyntaxKind.VariableStatement */) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasSyntacticModifier(node.original, 1 /* ModifierFlags.Export */); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -107913,10 +108909,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -108011,7 +109007,7 @@ var ts; } var excludeName; if (ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */)) { - var exportName = ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */) ? factory.createStringLiteral("default") : decl.name; + var exportName = ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */) ? factory.createStringLiteral("default") : decl.name; statements = appendExportStatement(statements, exportName, factory.getLocalName(decl)); excludeName = ts.getTextOfIdentifierOrLiteral(exportName); } @@ -108096,43 +109092,43 @@ var ts; */ function topLevelNestedVisitor(node) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*isTopLevel*/ true); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return visitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitWhileStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return visitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return visitCaseBlock(node); - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return visitCaseClause(node); - case 290 /* SyntaxKind.DefaultClause */: + case 293 /* SyntaxKind.DefaultClause */: return visitDefaultClause(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return visitTryStatement(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return visitBlock(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return visitor(node); @@ -108318,26 +109314,26 @@ var ts; return node; } switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*isTopLevel*/ false); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, valueIsDiscarded); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(node)) { return visitImportCallExpression(node); } break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return visitPrefixOrPostfixUnaryExpression(node, valueIsDiscarded); } return ts.visitEachChild(node, visitor, context); @@ -108417,7 +109413,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 305 /* SyntaxKind.SourceFile */; + return container !== undefined && container.kind === 308 /* SyntaxKind.SourceFile */; } else { return false; @@ -108495,7 +109491,7 @@ var ts; * @param emitCallback A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -108545,7 +109541,7 @@ var ts; */ function substituteUnspecified(node) { switch (node.kind) { - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return substituteShorthandPropertyAssignment(node); } return node; @@ -108582,9 +109578,9 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return substituteBinaryExpression(node); - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return substituteMetaProperty(node); } return node; @@ -108674,7 +109670,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); - if (exportContainer && exportContainer.kind === 305 /* SyntaxKind.SourceFile */) { + if (exportContainer && exportContainer.kind === 308 /* SyntaxKind.SourceFile */) { exportedNames = ts.append(exportedNames, factory.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -108717,7 +109713,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); context.enableSubstitution(79 /* SyntaxKind.Identifier */); var helperNameSubstitutions; var currentSourceFile; @@ -108757,14 +109753,14 @@ var ts; } function visitor(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // Though an error in es2020 modules, in node-flavor es2020 modules, we can helpfully transform this to a synthetic `require` call // To give easy access to a synchronous `require` in node-flavor esm. We do the transform even in scenarios where we error, but `import.meta.url` // is available, just because the output is reasonable for a node-like runtime. return ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.Node16 ? visitImportEqualsDeclaration(node) : undefined; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportDecl = node; return visitExportDeclaration(exportDecl); } @@ -108921,8 +109917,8 @@ var ts; var cjsOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(305 /* SyntaxKind.SourceFile */); - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); + context.enableSubstitution(308 /* SyntaxKind.SourceFile */); + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); var currentSourceFile; return transformSourceFileOrBundle; function onSubstituteNode(hint, node) { @@ -108969,7 +109965,7 @@ var ts; return result; } function transformSourceFileOrBundle(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -109029,7 +110025,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109058,7 +110054,7 @@ var ts; ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109105,7 +110101,7 @@ var ts; return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: ".concat(ts.Debug.formatSyntaxKind(node.kind))); } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109114,8 +110110,8 @@ var ts; } // This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit // The only exception here is if the constructor was marked as private. we are not emitting the constructor parameters at all. - else if (node.kind === 167 /* SyntaxKind.PropertyDeclaration */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 166 /* SyntaxKind.PropertySignature */ || - (node.kind === 164 /* SyntaxKind.Parameter */ && ts.hasSyntacticModifier(node.parent, 8 /* ModifierFlags.Private */))) { + else if (node.kind === 169 /* SyntaxKind.PropertyDeclaration */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 168 /* SyntaxKind.PropertySignature */ || + (node.kind === 166 /* SyntaxKind.Parameter */ && ts.hasSyntacticModifier(node.parent, 8 /* ModifierFlags.Private */))) { // TODO(jfreeman): Deal with computed properties in error reporting. if (ts.isStatic(node)) { return symbolAccessibilityResult.errorModuleName ? @@ -109124,7 +110120,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 166 /* SyntaxKind.Parameter */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109149,7 +110145,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (node.kind === 173 /* SyntaxKind.SetAccessor */) { + if (node.kind === 175 /* SyntaxKind.SetAccessor */) { // Getters can infer the return type from the returned expression, but setters cannot, so the // "_from_external_module_1_but_cannot_be_named" case cannot occur. if (ts.isStatic(node)) { @@ -109188,26 +110184,26 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? @@ -109215,7 +110211,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -109229,7 +110225,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -109254,30 +110250,30 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 175 /* SyntaxKind.ConstructSignature */: - case 180 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node.parent)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? @@ -109285,7 +110281,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109298,15 +110294,15 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 256 /* SyntaxKind.FunctionDeclaration */: - case 179 /* SyntaxKind.FunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 181 /* SyntaxKind.FunctionType */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; - case 173 /* SyntaxKind.SetAccessor */: - case 172 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109320,39 +110316,39 @@ var ts; // Type parameter constraints are named by user so we should always be able to name it var diagnosticMessage; switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1; break; - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node.parent)) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 179 /* SyntaxKind.FunctionType */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 181 /* SyntaxKind.FunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -109418,7 +110414,7 @@ var ts; } function isInternalDeclaration(node, currentSourceFile) { var parseTreeNode = ts.getParseTreeNode(node); - if (parseTreeNode && parseTreeNode.kind === 164 /* SyntaxKind.Parameter */) { + if (parseTreeNode && parseTreeNode.kind === 166 /* SyntaxKind.Parameter */) { var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode); var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined; var text = currentSourceFile.text; @@ -109594,7 +110590,7 @@ var ts; var _a; var primaryDeclaration = (_a = parentSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.getSourceFileOfNode(d) === containingFile; }); var augmentingDeclarations = ts.filter(symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== containingFile; }); - if (augmentingDeclarations) { + if (primaryDeclaration && augmentingDeclarations) { for (var _i = 0, augmentingDeclarations_1 = augmentingDeclarations; _i < augmentingDeclarations_1.length; _i++) { var augmentations = augmentingDeclarations_1[_i]; context.addDiagnostic(ts.addRelatedInfo(ts.createDiagnosticForNode(augmentations, ts.Diagnostics.Declaration_augments_declaration_in_another_file_This_cannot_be_serialized), ts.createDiagnosticForNode(primaryDeclaration, ts.Diagnostics.This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_file))); @@ -109624,10 +110620,10 @@ var ts; return result; } function transformRoot(node) { - if (node.kind === 305 /* SyntaxKind.SourceFile */ && node.isDeclarationFile) { + if (node.kind === 308 /* SyntaxKind.SourceFile */ && node.isDeclarationFile) { return node; } - if (node.kind === 306 /* SyntaxKind.Bundle */) { + if (node.kind === 309 /* SyntaxKind.Bundle */) { isBundledEmit = true; refs = new ts.Map(); libs = new ts.Map(); @@ -109650,14 +110646,14 @@ var ts; resultHasExternalModuleIndicator = false; // unused in external module bundle emit (all external modules are within module blocks, therefore are known to be modules) needsDeclare = false; var statements = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile, /*bundled*/ true)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements); - var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); + var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); return newFile; } needsDeclare = true; var updated = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements); return factory.updateSourceFile(sourceFile, transformAndReplaceLatePaintedStatements(updated), /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); }), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 308 /* SyntaxKind.InputFiles */) { + if (prepend.kind === 311 /* SyntaxKind.InputFiles */) { var sourceFile = ts.createUnparsedSourceFile(prepend, "dts", stripInternal); hasNoDefaultLib_1 = hasNoDefaultLib_1 || !!sourceFile.hasNoDefaultLib; collectReferences(sourceFile, refs); @@ -109798,7 +110794,7 @@ var ts; return name; } else { - if (name.kind === 202 /* SyntaxKind.ArrayBindingPattern */) { + if (name.kind === 204 /* SyntaxKind.ArrayBindingPattern */) { return factory.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement)); } else { @@ -109806,7 +110802,7 @@ var ts; } } function visitBindingElement(elem) { - if (elem.kind === 227 /* SyntaxKind.OmittedExpression */) { + if (elem.kind === 229 /* SyntaxKind.OmittedExpression */) { return elem; } if (elem.propertyName && ts.isIdentifier(elem.propertyName) && ts.isIdentifier(elem.name) && !elem.symbol.isReferenced) { @@ -109848,19 +110844,19 @@ var ts; // Literal const declarations will have an initializer ensured rather than a type return; } - var shouldUseResolverType = node.kind === 164 /* SyntaxKind.Parameter */ && + var shouldUseResolverType = node.kind === 166 /* SyntaxKind.Parameter */ && (resolver.isRequiredInitializedParameter(node) || resolver.isOptionalUninitializedParameterProperty(node)); if (type && !shouldUseResolverType) { return ts.visitNode(type, visitDeclarationSubtree); } if (!ts.getParseTreeNode(node)) { - return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } - if (node.kind === 173 /* SyntaxKind.SetAccessor */) { + if (node.kind === 175 /* SyntaxKind.SetAccessor */) { // Set accessors with no associated type node (from it's param or get accessor return) are `any` since they are never contextually typed right now // (The inferred type here will be void, but the old declaration emitter printed `any`, so this replicates that) - return factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } errorNameNode = node.name; var oldDiag; @@ -109868,12 +110864,12 @@ var ts; oldDiag = getSymbolAccessibilityDiagnostic; getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node); } - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); } - if (node.kind === 164 /* SyntaxKind.Parameter */ - || node.kind === 167 /* SyntaxKind.PropertyDeclaration */ - || node.kind === 166 /* SyntaxKind.PropertySignature */) { + if (node.kind === 166 /* SyntaxKind.Parameter */ + || node.kind === 169 /* SyntaxKind.PropertyDeclaration */ + || node.kind === 168 /* SyntaxKind.PropertySignature */) { if (ts.isPropertySignature(node) || !node.initializer) return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType)); return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType) || resolver.createTypeOfExpression(node.initializer, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); @@ -109884,28 +110880,28 @@ var ts; if (!suppressNewDiagnosticContexts) { getSymbolAccessibilityDiagnostic = oldDiag; } - return returnValue || factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return returnValue || factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } } function isDeclarationAndNotVisible(node) { node = ts.getParseTreeNode(node); switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return !resolver.isDeclarationVisible(node); // The following should be doing their own visibility checks based on filtering their members - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return !getBindingNameVisible(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: return false; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return true; } return false; @@ -109994,7 +110990,7 @@ var ts; function rewriteModuleSpecifier(parent, input) { if (!input) return undefined; // TODO: GH#18217 - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && parent.kind !== 200 /* SyntaxKind.ImportType */); + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && parent.kind !== 202 /* SyntaxKind.ImportType */); if (ts.isStringLiteralLike(input)) { if (isBundledEmit) { var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent); @@ -110014,7 +111010,7 @@ var ts; function transformImportEqualsDeclaration(decl) { if (!resolver.isDeclarationVisible(decl)) return; - if (decl.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + if (decl.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { // Rewrite external module names if necessary var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl); return factory.updateImportEqualsDeclaration(decl, decl.modifiers, decl.isTypeOnly, decl.name, factory.updateExternalModuleReference(decl.moduleReference, rewriteModuleSpecifier(decl, specifier))); @@ -110039,7 +111035,7 @@ var ts; return visibleDefaultBinding && factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, /*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)); } - if (decl.importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (decl.importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { // Namespace import (optionally with visible default) var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined; return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)) : undefined; @@ -110142,7 +111138,7 @@ var ts; // We'd see a TDZ violation at runtime var canProduceDiagnostic = ts.canProduceDiagnostics(input); var oldWithinObjectLiteralType = suppressNewDiagnosticContexts; - var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 182 /* SyntaxKind.TypeLiteral */ || input.kind === 195 /* SyntaxKind.MappedType */) && input.parent.kind !== 259 /* SyntaxKind.TypeAliasDeclaration */); + var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 184 /* SyntaxKind.TypeLiteral */ || input.kind === 197 /* SyntaxKind.MappedType */) && input.parent.kind !== 262 /* SyntaxKind.TypeAliasDeclaration */); // Emit methods which are private as properties with no type information if (ts.isMethodDeclaration(input) || ts.isMethodSignature(input)) { if (ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)) { @@ -110163,28 +111159,28 @@ var ts; } if (isProcessedComponent(input)) { switch (input.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: { + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: { if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) { checkEntityNameVisibility(input.expression, enclosingDeclaration); } var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory.updateExpressionWithTypeArguments(node, node.expression, node.typeArguments)); } - case 178 /* SyntaxKind.TypeReference */: { + case 180 /* SyntaxKind.TypeReference */: { checkEntityNameVisibility(input.typeName, enclosingDeclaration); var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory.updateTypeReferenceNode(node, node.typeName, node.typeArguments)); } - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return cleanup(factory.updateConstructSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); - case 171 /* SyntaxKind.Constructor */: { + case 173 /* SyntaxKind.Constructor */: { // A constructor declaration may not have a type annotation var ctor = factory.createConstructorDeclaration( /*modifiers*/ ensureModifiers(input), updateParamsList(input, input.parameters, 0 /* ModifierFlags.None */), /*body*/ undefined); return cleanup(ctor); } - case 169 /* SyntaxKind.MethodDeclaration */: { + case 171 /* SyntaxKind.MethodDeclaration */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } @@ -110193,7 +111189,7 @@ var ts; /*body*/ undefined); return cleanup(sig); } - case 172 /* SyntaxKind.GetAccessor */: { + case 174 /* SyntaxKind.GetAccessor */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } @@ -110201,36 +111197,36 @@ var ts; return cleanup(factory.updateGetAccessorDeclaration(input, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)), ensureType(input, accessorType), /*body*/ undefined)); } - case 173 /* SyntaxKind.SetAccessor */: { + case 175 /* SyntaxKind.SetAccessor */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updateSetAccessorDeclaration(input, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)), /*body*/ undefined)); } - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updatePropertyDeclaration(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type), ensureNoInitializer(input))); - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updatePropertySignature(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type))); - case 168 /* SyntaxKind.MethodSignature */: { + case 170 /* SyntaxKind.MethodSignature */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updateMethodSignature(input, ensureModifiers(input), input.name, input.questionToken, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 174 /* SyntaxKind.CallSignature */: { + case 176 /* SyntaxKind.CallSignature */: { return cleanup(factory.updateCallSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 176 /* SyntaxKind.IndexSignature */: { - return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */))); + case 178 /* SyntaxKind.IndexSignature */: { + return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */))); } - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { if (ts.isBindingPattern(input.name)) { return recreateBindingPattern(input.name); } @@ -110238,13 +111234,13 @@ var ts; suppressNewDiagnosticContexts = true; // Variable declaration types also suppress new diagnostic contexts, provided the contexts wouldn't be made for binding pattern types return cleanup(factory.updateVariableDeclaration(input, input.name, /*exclamationToken*/ undefined, ensureType(input, input.type), ensureNoInitializer(input))); } - case 163 /* SyntaxKind.TypeParameter */: { + case 165 /* SyntaxKind.TypeParameter */: { if (isPrivateMethodTypeParameter(input) && (input.default || input.constraint)) { return cleanup(factory.updateTypeParameterDeclaration(input, input.modifiers, input.name, /*constraint*/ undefined, /*defaultType*/ undefined)); } return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context)); } - case 189 /* SyntaxKind.ConditionalType */: { + case 191 /* SyntaxKind.ConditionalType */: { // We have to process conditional types in a special way because for visibility purposes we need to push a new enclosingDeclaration // just for the `infer` types in the true branch. It's an implicit declaration scope that only applies to _part_ of the type. var checkType = ts.visitNode(input.checkType, visitDeclarationSubtree); @@ -110256,13 +111252,13 @@ var ts; var falseType = ts.visitNode(input.falseType, visitDeclarationSubtree); return cleanup(factory.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType)); } - case 179 /* SyntaxKind.FunctionType */: { + case 181 /* SyntaxKind.FunctionType */: { return cleanup(factory.updateFunctionTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 180 /* SyntaxKind.ConstructorType */: { + case 182 /* SyntaxKind.ConstructorType */: { return cleanup(factory.updateConstructorTypeNode(input, ensureModifiers(input), ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 200 /* SyntaxKind.ImportType */: { + case 202 /* SyntaxKind.ImportType */: { if (!ts.isLiteralImportTypeNode(input)) return cleanup(input); return cleanup(factory.updateImportTypeNode(input, factory.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.assertions, input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf)); @@ -110294,7 +111290,7 @@ var ts; } } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 169 /* SyntaxKind.MethodDeclaration */ && ts.hasEffectiveModifier(node.parent, 8 /* ModifierFlags.Private */); + return node.parent.kind === 171 /* SyntaxKind.MethodDeclaration */ && ts.hasEffectiveModifier(node.parent, 8 /* ModifierFlags.Private */); } function visitDeclarationStatements(input) { if (!isPreservedDeclarationStatement(input)) { @@ -110304,7 +111300,7 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 272 /* SyntaxKind.ExportDeclaration */: { + case 275 /* SyntaxKind.ExportDeclaration */: { if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; } @@ -110313,7 +111309,7 @@ var ts; // Rewrite external module names if necessary return factory.updateExportDeclaration(input, input.modifiers, input.isTypeOnly, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier), ts.getResolutionModeOverrideForClause(input.assertClause) ? input.assertClause : undefined); } - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { // Always visible if the parent node isn't dropped for being not visible if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; @@ -110331,7 +111327,7 @@ var ts; errorFallbackNode = input; var varDecl = factory.createVariableDeclaration(newId, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); errorFallbackNode = undefined; - var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); preserveJsDoc(statement, input); ts.removeAllComments(input); return [statement, factory.updateExportAssignment(input, input.modifiers, newId)]; @@ -110344,12 +111340,12 @@ var ts; return input; } function stripExportModifiers(statement) { - if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 512 /* ModifierFlags.Default */) || !ts.canHaveModifiers(statement)) { + if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 1024 /* ModifierFlags.Default */) || !ts.canHaveModifiers(statement)) { // `export import` statements should remain as-is, as imports are _not_ implicitly exported in an ambient namespace // Likewise, `export default` classes and the like and just be `default`, so we preserve their `export` modifiers, too return statement; } - var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (257023 /* ModifierFlags.All */ ^ 1 /* ModifierFlags.Export */)); + var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (258047 /* ModifierFlags.All */ ^ 1 /* ModifierFlags.Export */)); return factory.updateModifiers(statement, modifiers); } function transformTopLevelDeclaration(input) { @@ -110360,10 +111356,10 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { return transformImportEqualsDeclaration(input); } - case 266 /* SyntaxKind.ImportDeclaration */: { + case 269 /* SyntaxKind.ImportDeclaration */: { return transformImportDeclaration(input); } } @@ -110384,12 +111380,16 @@ var ts; } var previousNeedsDeclare = needsDeclare; switch (input.kind) { - case 259 /* SyntaxKind.TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all - return cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); - case 258 /* SyntaxKind.InterfaceDeclaration */: { + case 262 /* SyntaxKind.TypeAliasDeclaration */: { + needsDeclare = false; + var clean = cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); + needsDeclare = previousNeedsDeclare; + return clean; + } + case 261 /* SyntaxKind.InterfaceDeclaration */: { return cleanup(factory.updateInterfaceDeclaration(input, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree))); } - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { // Generators lose their generator-ness, excepting their return type var clean = cleanup(factory.updateFunctionDeclaration(input, ensureModifiers(input), /*asteriskToken*/ undefined, input.name, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), @@ -110430,10 +111430,10 @@ var ts; })))); } var namespaceDecl = factory.createModuleDeclaration(ensureModifiers(input), input.name, factory.createModuleBlock(declarations), 16 /* NodeFlags.Namespace */); - if (!ts.hasEffectiveModifier(clean, 512 /* ModifierFlags.Default */)) { + if (!ts.hasEffectiveModifier(clean, 1024 /* ModifierFlags.Default */)) { return [clean, namespaceDecl]; } - var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~513 /* ModifierFlags.ExportDefault */) | 2 /* ModifierFlags.Ambient */); + var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~1025 /* ModifierFlags.ExportDefault */) | 2 /* ModifierFlags.Ambient */); var cleanDeclaration = factory.updateFunctionDeclaration(clean, modifiers, /*asteriskToken*/ undefined, clean.name, clean.typeParameters, clean.parameters, clean.type, /*body*/ undefined); @@ -110451,10 +111451,10 @@ var ts; return clean; } } - case 261 /* SyntaxKind.ModuleDeclaration */: { + case 264 /* SyntaxKind.ModuleDeclaration */: { needsDeclare = false; var inner = input.body; - if (inner && inner.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (inner && inner.kind === 265 /* SyntaxKind.ModuleBlock */) { var oldNeedsScopeFix = needsScopeFixMarker; var oldHasScopeFix = resultHasScopeMarker; resultHasScopeMarker = false; @@ -110495,7 +111495,7 @@ var ts; return cleanup(factory.updateModuleDeclaration(input, mods, input.name, body)); } } - case 257 /* SyntaxKind.ClassDeclaration */: { + case 260 /* SyntaxKind.ClassDeclaration */: { errorNameNode = input.name; errorFallbackNode = input; var modifiers = factory.createNodeArray(ensureModifiers(input)); @@ -110557,7 +111557,7 @@ var ts; typeName: input.name }); }; var varDecl = factory.createVariableDeclaration(newId_1, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(extendsClause_1.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); - var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); var heritageClauses = factory.createNodeArray(ts.map(input.heritageClauses, function (clause) { if (clause.token === 94 /* SyntaxKind.ExtendsKeyword */) { var oldDiag_2 = getSymbolAccessibilityDiagnostic; @@ -110575,10 +111575,10 @@ var ts; return cleanup(factory.updateClassDeclaration(input, modifiers, input.name, typeParameters, heritageClauses, members)); } } - case 237 /* SyntaxKind.VariableStatement */: { + case 240 /* SyntaxKind.VariableStatement */: { return cleanup(transformVariableStatement(input)); } - case 260 /* SyntaxKind.EnumDeclaration */: { + case 263 /* SyntaxKind.EnumDeclaration */: { return cleanup(factory.updateEnumDeclaration(input, factory.createNodeArray(ensureModifiers(input)), input.name, factory.createNodeArray(ts.mapDefined(input.members, function (m) { if (shouldStripInternal(m)) return; @@ -110597,7 +111597,7 @@ var ts; if (canProdiceDiagnostic) { getSymbolAccessibilityDiagnostic = oldDiag; } - if (input.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (input.kind === 264 /* SyntaxKind.ModuleDeclaration */) { needsDeclare = previousNeedsDeclare; } if (node === input) { @@ -110620,7 +111620,7 @@ var ts; return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e); })); } function recreateBindingElement(e) { - if (e.kind === 227 /* SyntaxKind.OmittedExpression */) { + if (e.kind === 229 /* SyntaxKind.OmittedExpression */) { return; } if (e.name) { @@ -110668,9 +111668,9 @@ var ts; return factory.createModifiersFromModifierFlags(newFlags); } function ensureModifierFlags(node) { - var mask = 257023 /* ModifierFlags.All */ ^ (4 /* ModifierFlags.Public */ | 256 /* ModifierFlags.Async */ | 16384 /* ModifierFlags.Override */); // No async and override modifiers in declaration files + var mask = 258047 /* ModifierFlags.All */ ^ (4 /* ModifierFlags.Public */ | 512 /* ModifierFlags.Async */ | 16384 /* ModifierFlags.Override */); // No async and override modifiers in declaration files var additions = (needsDeclare && !isAlwaysType(node)) ? 2 /* ModifierFlags.Ambient */ : 0 /* ModifierFlags.None */; - var parentIsFile = node.parent.kind === 305 /* SyntaxKind.SourceFile */; + var parentIsFile = node.parent.kind === 308 /* SyntaxKind.SourceFile */; if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) { mask ^= 2 /* ModifierFlags.Ambient */; additions = 0 /* ModifierFlags.None */; @@ -110699,7 +111699,7 @@ var ts; } ts.transformDeclarations = transformDeclarations; function isAlwaysType(node) { - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return true; } return false; @@ -110709,22 +111709,22 @@ var ts; return ts.factory.createModifiersFromModifierFlags(maskModifierFlags(node, modifierMask, modifierAdditions)); } function maskModifierFlags(node, modifierMask, modifierAdditions) { - if (modifierMask === void 0) { modifierMask = 257023 /* ModifierFlags.All */ ^ 4 /* ModifierFlags.Public */; } + if (modifierMask === void 0) { modifierMask = 258047 /* ModifierFlags.All */ ^ 4 /* ModifierFlags.Public */; } if (modifierAdditions === void 0) { modifierAdditions = 0 /* ModifierFlags.None */; } var flags = (ts.getEffectiveModifierFlags(node) & modifierMask) | modifierAdditions; - if (flags & 512 /* ModifierFlags.Default */ && !(flags & 1 /* ModifierFlags.Export */)) { + if (flags & 1024 /* ModifierFlags.Default */ && !(flags & 1 /* ModifierFlags.Export */)) { // A non-exported default is a nonsequitor - we usually try to remove all export modifiers // from statements in ambient declarations; but a default export must retain its export modifier to be syntactically valid flags ^= 1 /* ModifierFlags.Export */; } - if (flags & 512 /* ModifierFlags.Default */ && flags & 2 /* ModifierFlags.Ambient */) { + if (flags & 1024 /* ModifierFlags.Default */ && flags & 2 /* ModifierFlags.Ambient */) { flags ^= 2 /* ModifierFlags.Ambient */; // `declare` is never required alongside `default` (and would be an error if printed) } return flags; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 172 /* SyntaxKind.GetAccessor */ + return accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? accessor.type // Getter - return type : accessor.parameters.length > 0 ? accessor.parameters[0].type // Setter parameter type @@ -110733,52 +111733,52 @@ var ts; } function canHaveLiteralInitializer(node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return !ts.hasEffectiveModifier(node, 8 /* ModifierFlags.Private */); - case 164 /* SyntaxKind.Parameter */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; } return false; } function isPreservedDeclarationStatement(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: return true; } return false; } function isProcessedComponent(node) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 254 /* SyntaxKind.VariableDeclaration */: - case 163 /* SyntaxKind.TypeParameter */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 178 /* SyntaxKind.TypeReference */: - case 189 /* SyntaxKind.ConditionalType */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 200 /* SyntaxKind.ImportType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: + case 191 /* SyntaxKind.ConditionalType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 202 /* SyntaxKind.ImportType */: return true; } return false; @@ -110918,7 +111918,7 @@ var ts; * @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files. */ function transformNodes(resolver, host, factory, options, nodes, transformers, allowDtsFiles) { - var enabledSyntaxKindFeatures = new Array(355 /* SyntaxKind.Count */); + var enabledSyntaxKindFeatures = new Array(358 /* SyntaxKind.Count */); var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentStatements; @@ -111000,7 +112000,7 @@ var ts; var transformed = []; for (var _a = 0, nodes_3 = nodes; _a < nodes_3.length; _a++) { var node = nodes_3[_a]; - ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* tracing.Phase.Emit */, "transformNodes", node.kind === 305 /* SyntaxKind.SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); + ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* tracing.Phase.Emit */, "transformNodes", node.kind === 308 /* SyntaxKind.SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); transformed.push((allowDtsFiles ? transformation : transformRoot)(node)); ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop(); } @@ -111406,7 +112406,7 @@ var ts; /*@internal*/ function getOutputPathsFor(sourceFile, host, forceDtsPaths) { var options = host.getCompilerOptions(); - if (sourceFile.kind === 306 /* SyntaxKind.Bundle */) { + if (sourceFile.kind === 309 /* SyntaxKind.Bundle */) { return getOutputPathsForBundle(options, forceDtsPaths); } else { @@ -111775,8 +112775,8 @@ var ts; } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) { var sourceFileOrBundle = transform.transformed[0]; - var bundle = sourceFileOrBundle.kind === 306 /* SyntaxKind.Bundle */ ? sourceFileOrBundle : undefined; - var sourceFile = sourceFileOrBundle.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFileOrBundle : undefined; + var bundle = sourceFileOrBundle.kind === 309 /* SyntaxKind.Bundle */ ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFileOrBundle : undefined; var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; var sourceMapGenerator; if (shouldEmitSourceMaps(mapOptions, sourceFileOrBundle)) { @@ -111826,7 +112826,7 @@ var ts; } function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) { return (mapOptions.sourceMap || mapOptions.inlineSourceMap) - && (sourceFileOrBundle.kind !== 305 /* SyntaxKind.SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Extension.Json */)); + && (sourceFileOrBundle.kind !== 308 /* SyntaxKind.SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Extension.Json */)); } function getSourceRoot(mapOptions) { // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the @@ -111889,8 +112889,8 @@ var ts; } ts.getBuildInfoText = getBuildInfoText; /*@internal*/ - function getBuildInfo(buildInfoText) { - return JSON.parse(buildInfoText); + function getBuildInfo(buildInfoFile, buildInfoText) { + return ts.readJsonOrUndefined(buildInfoFile, buildInfoText); } ts.getBuildInfo = getBuildInfo; /*@internal*/ @@ -111968,17 +112968,16 @@ var ts; var buildInfo; if (host.getBuildInfo) { // If host directly provides buildinfo we can get it directly. This allows host to cache the buildinfo - var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); - if (!hostBuildInfo) - return buildInfoPath; - buildInfo = hostBuildInfo; + buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); } else { var buildInfoText = host.readFile(buildInfoPath); if (!buildInfoText) return buildInfoPath; - buildInfo = getBuildInfo(buildInfoText); + buildInfo = getBuildInfo(buildInfoPath, buildInfoText); } + if (!buildInfo) + return buildInfoPath; if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts)) return buildInfoPath; var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath)); @@ -112104,6 +113103,10 @@ var ts; var nodeIdToGeneratedName; // Map of generated names for specific nodes. var autoGeneratedIdToGeneratedName; // Map of generated names for temp and loop variables. var generatedNames; // Set of names generated by the NameGenerator. + var formattedNameTempFlagsStack; + var formattedNameTempFlags; + var privateNameTempFlagsStack; // Stack of enclosing name generation scopes. + var privateNameTempFlags; // TempFlags for the current name generation scope. var tempFlagsStack; // Stack of enclosing name generation scopes. var tempFlags; // TempFlags for the current name generation scope. var reservedNamesStack; // Stack of TempFlags reserved in enclosing name generation scopes. @@ -112169,9 +113172,9 @@ var ts; break; } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: return printFile(node); - case 306 /* SyntaxKind.Bundle */: return printBundle(node); - case 307 /* SyntaxKind.UnparsedSource */: return printUnparsedSource(node); + case 308 /* SyntaxKind.SourceFile */: return printFile(node); + case 309 /* SyntaxKind.Bundle */: return printBundle(node); + case 310 /* SyntaxKind.UnparsedSource */: return printUnparsedSource(node); } writeNode(hint, node, sourceFile, beginPrint()); return endPrint(); @@ -112362,6 +113365,10 @@ var ts; nodeIdToGeneratedName = []; autoGeneratedIdToGeneratedName = []; generatedNames = new ts.Set(); + formattedNameTempFlagsStack = []; + formattedNameTempFlags = new ts.Map(); + privateNameTempFlagsStack = []; + privateNameTempFlags = 0 /* TempFlags.Auto */; tempFlagsStack = []; tempFlags = 0 /* TempFlags.Auto */; reservedNamesStack = []; @@ -112505,315 +113512,315 @@ var ts; return emitPrivateIdentifier(node); // Parse tree nodes // Names - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return emitQualifiedName(node); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return emitComputedPropertyName(node); // Signature elements - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return emitTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return emitParameter(node); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return emitDecorator(node); // Type members - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return emitPropertySignature(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return emitPropertyDeclaration(node); - case 168 /* SyntaxKind.MethodSignature */: + case 170 /* SyntaxKind.MethodSignature */: return emitMethodSignature(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return emitMethodDeclaration(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return emitClassStaticBlockDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return emitConstructor(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return emitAccessorDeclaration(node); - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: return emitCallSignature(node); - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return emitConstructSignature(node); - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return emitIndexSignature(node); // Types - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return emitTypePredicate(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return emitTypeReference(node); - case 179 /* SyntaxKind.FunctionType */: + case 181 /* SyntaxKind.FunctionType */: return emitFunctionType(node); - case 180 /* SyntaxKind.ConstructorType */: + case 182 /* SyntaxKind.ConstructorType */: return emitConstructorType(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return emitTypeQuery(node); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return emitTypeLiteral(node); - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return emitArrayType(node); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return emitTupleType(node); - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return emitOptionalType(node); // SyntaxKind.RestType is handled below - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return emitUnionType(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return emitIntersectionType(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return emitConditionalType(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return emitInferType(node); - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return emitParenthesizedType(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return emitThisType(); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return emitTypeOperator(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return emitIndexedAccessType(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return emitMappedType(node); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return emitLiteralType(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return emitNamedTupleMember(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return emitTemplateType(node); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: + case 201 /* SyntaxKind.TemplateLiteralTypeSpan */: return emitTemplateTypeSpan(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return emitImportTypeNode(node); // Binding patterns - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return emitBindingElement(node); // Misc - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return emitTemplateSpan(node); - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: return emitSemicolonClassElement(); // Statements - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return emitBlock(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return emitVariableStatement(node); - case 236 /* SyntaxKind.EmptyStatement */: + case 239 /* SyntaxKind.EmptyStatement */: return emitEmptyStatement(/*isEmbeddedStatement*/ false); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return emitExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return emitIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return emitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return emitWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return emitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return emitForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return emitForOfStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return emitContinueStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return emitBreakStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return emitReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return emitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return emitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return emitLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return emitThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return emitTryStatement(node); - case 253 /* SyntaxKind.DebuggerStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: return emitDebuggerStatement(node); // Declarations - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return emitVariableDeclaration(node); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return emitVariableDeclarationList(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return emitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return emitClassDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return emitEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return emitModuleDeclaration(node); - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return emitModuleBlock(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return emitCaseBlock(node); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return emitNamespaceExportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return emitImportDeclaration(node); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return emitImportClause(node); - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return emitNamespaceImport(node); - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: return emitNamespaceExport(node); - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: return emitNamedImports(node); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return emitImportSpecifier(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return emitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return emitExportDeclaration(node); - case 273 /* SyntaxKind.NamedExports */: + case 276 /* SyntaxKind.NamedExports */: return emitNamedExports(node); - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return emitExportSpecifier(node); - case 293 /* SyntaxKind.AssertClause */: + case 296 /* SyntaxKind.AssertClause */: return emitAssertClause(node); - case 294 /* SyntaxKind.AssertEntry */: + case 297 /* SyntaxKind.AssertEntry */: return emitAssertEntry(node); - case 276 /* SyntaxKind.MissingDeclaration */: + case 279 /* SyntaxKind.MissingDeclaration */: return; // Module references - case 277 /* SyntaxKind.ExternalModuleReference */: + case 280 /* SyntaxKind.ExternalModuleReference */: return emitExternalModuleReference(node); // JSX (non-expression) case 11 /* SyntaxKind.JsxText */: return emitJsxText(node); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 283 /* SyntaxKind.JsxOpeningFragment */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 286 /* SyntaxKind.JsxOpeningFragment */: return emitJsxOpeningElementOrFragment(node); - case 281 /* SyntaxKind.JsxClosingElement */: - case 284 /* SyntaxKind.JsxClosingFragment */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 287 /* SyntaxKind.JsxClosingFragment */: return emitJsxClosingElementOrFragment(node); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return emitJsxAttribute(node); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return emitJsxAttributes(node); - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: return emitJsxSpreadAttribute(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return emitJsxExpression(node); // Clauses - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return emitCaseClause(node); - case 290 /* SyntaxKind.DefaultClause */: + case 293 /* SyntaxKind.DefaultClause */: return emitDefaultClause(node); - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return emitHeritageClause(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return emitCatchClause(node); // Property assignments - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return emitPropertyAssignment(node); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return emitSpreadAssignment(node); // Enum - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return emitEnumMember(node); // Unparsed - case 300 /* SyntaxKind.UnparsedPrologue */: + case 303 /* SyntaxKind.UnparsedPrologue */: return writeUnparsedNode(node); - case 307 /* SyntaxKind.UnparsedSource */: - case 301 /* SyntaxKind.UnparsedPrepend */: + case 310 /* SyntaxKind.UnparsedSource */: + case 304 /* SyntaxKind.UnparsedPrepend */: return emitUnparsedSourceOrPrepend(node); - case 302 /* SyntaxKind.UnparsedText */: - case 303 /* SyntaxKind.UnparsedInternalText */: + case 305 /* SyntaxKind.UnparsedText */: + case 306 /* SyntaxKind.UnparsedInternalText */: return emitUnparsedTextLike(node); - case 304 /* SyntaxKind.UnparsedSyntheticReference */: + case 307 /* SyntaxKind.UnparsedSyntheticReference */: return emitUnparsedSyntheticReference(node); // Top-level nodes - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return emitSourceFile(node); - case 306 /* SyntaxKind.Bundle */: + case 309 /* SyntaxKind.Bundle */: return ts.Debug.fail("Bundles should be printed using printBundle"); // SyntaxKind.UnparsedSource (handled above) - case 308 /* SyntaxKind.InputFiles */: + case 311 /* SyntaxKind.InputFiles */: return ts.Debug.fail("InputFiles should not be printed"); // JSDoc nodes (only used in codefixes currently) - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return emitJSDocTypeExpression(node); - case 310 /* SyntaxKind.JSDocNameReference */: + case 313 /* SyntaxKind.JSDocNameReference */: return emitJSDocNameReference(node); - case 312 /* SyntaxKind.JSDocAllType */: + case 315 /* SyntaxKind.JSDocAllType */: return writePunctuation("*"); - case 313 /* SyntaxKind.JSDocUnknownType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return writePunctuation("?"); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return emitJSDocNullableType(node); - case 315 /* SyntaxKind.JSDocNonNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: return emitJSDocNonNullableType(node); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return emitJSDocOptionalType(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return emitJSDocFunctionType(node); - case 186 /* SyntaxKind.RestType */: - case 318 /* SyntaxKind.JSDocVariadicType */: + case 188 /* SyntaxKind.RestType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return emitRestOrJSDocVariadicType(node); - case 319 /* SyntaxKind.JSDocNamepathType */: + case 322 /* SyntaxKind.JSDocNamepathType */: return; - case 320 /* SyntaxKind.JSDoc */: + case 323 /* SyntaxKind.JSDoc */: return emitJSDoc(node); - case 322 /* SyntaxKind.JSDocTypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: return emitJSDocTypeLiteral(node); - case 323 /* SyntaxKind.JSDocSignature */: + case 326 /* SyntaxKind.JSDocSignature */: return emitJSDocSignature(node); - case 327 /* SyntaxKind.JSDocTag */: - case 332 /* SyntaxKind.JSDocClassTag */: - case 337 /* SyntaxKind.JSDocOverrideTag */: + case 330 /* SyntaxKind.JSDocTag */: + case 335 /* SyntaxKind.JSDocClassTag */: + case 340 /* SyntaxKind.JSDocOverrideTag */: return emitJSDocSimpleTag(node); - case 328 /* SyntaxKind.JSDocAugmentsTag */: - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return emitJSDocHeritageTag(node); - case 330 /* SyntaxKind.JSDocAuthorTag */: - case 331 /* SyntaxKind.JSDocDeprecatedTag */: + case 333 /* SyntaxKind.JSDocAuthorTag */: + case 334 /* SyntaxKind.JSDocDeprecatedTag */: return; // SyntaxKind.JSDocClassTag (see JSDocTag, above) - case 333 /* SyntaxKind.JSDocPublicTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 336 /* SyntaxKind.JSDocReadonlyTag */: + case 336 /* SyntaxKind.JSDocPublicTag */: + case 337 /* SyntaxKind.JSDocPrivateTag */: + case 338 /* SyntaxKind.JSDocProtectedTag */: + case 339 /* SyntaxKind.JSDocReadonlyTag */: return; - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return emitJSDocCallbackTag(node); // SyntaxKind.JSDocEnumTag (see below) - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return emitJSDocPropertyLikeTag(node); - case 339 /* SyntaxKind.JSDocEnumTag */: - case 341 /* SyntaxKind.JSDocReturnTag */: - case 342 /* SyntaxKind.JSDocThisTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: + case 345 /* SyntaxKind.JSDocThisTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return emitJSDocSimpleTypedTag(node); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return emitJSDocTemplateTag(node); - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return emitJSDocTypedefTag(node); - case 346 /* SyntaxKind.JSDocSeeTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: return emitJSDocSeeTag(node); // SyntaxKind.JSDocPropertyTag (see JSDocParameterTag, above) // Transformation nodes - case 349 /* SyntaxKind.NotEmittedStatement */: - case 353 /* SyntaxKind.EndOfDeclarationMarker */: - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 352 /* SyntaxKind.NotEmittedStatement */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return; } if (ts.isExpression(node)) { @@ -112845,85 +113852,87 @@ var ts; case 80 /* SyntaxKind.PrivateIdentifier */: return emitPrivateIdentifier(node); // Expressions - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return emitArrayLiteralExpression(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return emitObjectLiteralExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return emitPropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return emitElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return emitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return emitNewExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return emitTypeAssertionExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return emitParenthesizedExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return emitFunctionExpression(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return emitArrowFunction(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return emitDeleteExpression(node); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return emitTypeOfExpression(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return emitVoidExpression(node); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return emitAwaitExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return emitBinaryExpression(node); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return emitConditionalExpression(node); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return emitTemplateExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return emitYieldExpression(node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return emitSpreadElement(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return emitClassExpression(node); - case 227 /* SyntaxKind.OmittedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: return; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: return emitAsExpression(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return emitNonNullExpression(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 231 /* SyntaxKind.MetaProperty */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return emitSatisfiesExpression(node); + case 233 /* SyntaxKind.MetaProperty */: return emitMetaProperty(node); - case 232 /* SyntaxKind.SyntheticExpression */: + case 234 /* SyntaxKind.SyntheticExpression */: return ts.Debug.fail("SyntheticExpression should never be printed."); // JSX - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return emitJsxElement(node); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return emitJsxFragment(node); // Synthesized list - case 348 /* SyntaxKind.SyntaxList */: + case 351 /* SyntaxKind.SyntaxList */: return ts.Debug.fail("SyntaxList should not be printed"); // Transformation nodes - case 349 /* SyntaxKind.NotEmittedStatement */: + case 352 /* SyntaxKind.NotEmittedStatement */: return; - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return emitCommaList(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return; - case 354 /* SyntaxKind.SyntheticReferenceExpression */: + case 357 /* SyntaxKind.SyntheticReferenceExpression */: return ts.Debug.fail("SyntheticReferenceExpression should not be printed"); } } @@ -112971,7 +113980,7 @@ var ts; } function emitHelpers(node) { var helpersEmitted = false; - var bundle = node.kind === 306 /* SyntaxKind.Bundle */ ? node : undefined; + var bundle = node.kind === 309 /* SyntaxKind.Bundle */ ? node : undefined; if (bundle && moduleKind === ts.ModuleKind.None) { return; } @@ -113071,7 +114080,7 @@ var ts; var pos = getTextPosWithWriteLine(); writeUnparsedNode(unparsed); if (bundleFileInfo) { - updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 302 /* SyntaxKind.UnparsedText */ ? + updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 305 /* SyntaxKind.UnparsedText */ ? "text" /* BundleFileSectionKind.Text */ : "internal" /* BundleFileSectionKind.Internal */); } @@ -113108,7 +114117,7 @@ var ts; } function emitTabStop(hint, node, snippet) { // A tab stop should only be attached to an empty node, i.e. a node that doesn't emit any text. - ts.Debug.assert(node.kind === 236 /* SyntaxKind.EmptyStatement */, "A tab stop cannot be attached to a node of kind ".concat(ts.Debug.formatSyntaxKind(node.kind), ".")); + ts.Debug.assert(node.kind === 239 /* SyntaxKind.EmptyStatement */, "A tab stop cannot be attached to a node of kind ".concat(ts.Debug.formatSyntaxKind(node.kind), ".")); ts.Debug.assert(hint !== 5 /* EmitHint.EmbeddedStatement */, "A tab stop cannot be attached to an embedded statement."); nonEscapingWrite("$".concat(snippet.order)); } @@ -113169,7 +114178,7 @@ var ts; emit(node.dotDotDotToken); emitNodeWithWriter(node.name, writeParameter); emit(node.questionToken); - if (node.parent && node.parent.kind === 317 /* SyntaxKind.JSDocFunctionType */ && !node.name) { + if (node.parent && node.parent.kind === 320 /* SyntaxKind.JSDocFunctionType */ && !node.name) { emit(node.type); } else { @@ -113230,7 +114239,7 @@ var ts; } function emitAccessorDeclaration(node) { emitDecoratorsAndModifiers(node, node.modifiers); - writeKeyword(node.kind === 172 /* SyntaxKind.GetAccessor */ ? "get" : "set"); + writeKeyword(node.kind === 174 /* SyntaxKind.GetAccessor */ ? "get" : "set"); writeSpace(); emit(node.name); emitSignatureAndBody(node, emitSignatureHead); @@ -113403,7 +114412,7 @@ var ts; function emitTypeOperator(node) { writeTokenText(node.operator, writeKeyword); writeSpace(); - var parenthesizerRule = node.operator === 145 /* SyntaxKind.ReadonlyKeyword */ ? + var parenthesizerRule = node.operator === 146 /* SyntaxKind.ReadonlyKeyword */ ? parenthesizer.parenthesizeOperandOfReadonlyTypeOperator : parenthesizer.parenthesizeOperandOfTypeOperator; emit(node.type, parenthesizerRule); @@ -113426,7 +114435,7 @@ var ts; } if (node.readonlyToken) { emit(node.readonlyToken); - if (node.readonlyToken.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { + if (node.readonlyToken.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { writeKeyword("readonly"); } writeSpace(); @@ -113672,7 +114681,7 @@ var ts; emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } function emitAwaitExpression(node) { - emitTokenWithComment(132 /* SyntaxKind.AwaitKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(133 /* SyntaxKind.AwaitKeyword */, node.pos, writeKeyword, node); writeSpace(); emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } @@ -113697,7 +114706,7 @@ var ts; // expression a prefix increment whose operand is a plus expression - (++(+x)) // The same is true of minus of course. var operand = node.operand; - return operand.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ + return operand.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && ((node.operator === 39 /* SyntaxKind.PlusToken */ && (operand.operator === 39 /* SyntaxKind.PlusToken */ || operand.operator === 45 /* SyntaxKind.PlusPlusToken */)) || (node.operator === 40 /* SyntaxKind.MinusToken */ && (operand.operator === 40 /* SyntaxKind.MinusToken */ || operand.operator === 46 /* SyntaxKind.MinusMinusToken */))); } @@ -113845,6 +114854,15 @@ var ts; emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess); writeOperator("!"); } + function emitSatisfiesExpression(node) { + emitExpression(node.expression, /*parenthesizerRules*/ undefined); + if (node.type) { + writeSpace(); + writeKeyword("satisfies"); + writeSpace(); + emit(node.type); + } + } function emitMetaProperty(node) { writeToken(node.keywordToken, node.pos, writePunctuation); writePunctuation("."); @@ -113902,7 +114920,7 @@ var ts; if (node.elseStatement) { writeLineOrSpace(node, node.thenStatement, node.elseStatement); emitTokenWithComment(91 /* SyntaxKind.ElseKeyword */, node.thenStatement.end, writeKeyword, node); - if (node.elseStatement.kind === 239 /* SyntaxKind.IfStatement */) { + if (node.elseStatement.kind === 242 /* SyntaxKind.IfStatement */) { writeSpace(); emit(node.elseStatement); } @@ -113965,7 +114983,7 @@ var ts; emitTokenWithComment(20 /* SyntaxKind.OpenParenToken */, openParenPos, writePunctuation, node); emitForBinding(node.initializer); writeSpace(); - emitTokenWithComment(160 /* SyntaxKind.OfKeyword */, node.initializer.end, writeKeyword, node); + emitTokenWithComment(162 /* SyntaxKind.OfKeyword */, node.initializer.end, writeKeyword, node); writeSpace(); emitExpression(node.expression); emitTokenWithComment(21 /* SyntaxKind.CloseParenToken */, node.expression.end, writePunctuation, node); @@ -113973,7 +114991,7 @@ var ts; } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { emit(node); } else { @@ -114010,7 +115028,7 @@ var ts; } pos = writeTokenText(token, writer, pos); if (isSimilarNode && contextNode.end !== pos) { - var isJsxExprContext = contextNode.kind === 288 /* SyntaxKind.JsxExpression */; + var isJsxExprContext = contextNode.kind === 291 /* SyntaxKind.JsxExpression */; emitTrailingCommentsOfPosition(pos, /*prefixSpace*/ !isJsxExprContext, /*forceNoNewline*/ isJsxExprContext); } return pos; @@ -114320,7 +115338,7 @@ var ts; emitTokenWithComment(100 /* SyntaxKind.ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114345,7 +115363,7 @@ var ts; if (node.importClause) { emit(node.importClause); writeSpace(); - emitTokenWithComment(156 /* SyntaxKind.FromKeyword */, node.importClause.end, writeKeyword, node); + emitTokenWithComment(158 /* SyntaxKind.FromKeyword */, node.importClause.end, writeKeyword, node); writeSpace(); } emitExpression(node.moduleSpecifier); @@ -114356,7 +115374,7 @@ var ts; } function emitImportClause(node) { if (node.isTypeOnly) { - emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114369,7 +115387,7 @@ var ts; function emitNamespaceImport(node) { var asPos = emitTokenWithComment(41 /* SyntaxKind.AsteriskToken */, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -114395,10 +115413,11 @@ var ts; writeTrailingSemicolon(); } function emitExportDeclaration(node) { + emitModifiers(node, node.modifiers); var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - nextPos = emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, nextPos, writeKeyword, node); writeSpace(); } if (node.exportClause) { @@ -114410,7 +115429,7 @@ var ts; if (node.moduleSpecifier) { writeSpace(); var fromPos = node.exportClause ? node.exportClause.end : nextPos; - emitTokenWithComment(156 /* SyntaxKind.FromKeyword */, fromPos, writeKeyword, node); + emitTokenWithComment(158 /* SyntaxKind.FromKeyword */, fromPos, writeKeyword, node); writeSpace(); emitExpression(node.moduleSpecifier); } @@ -114420,7 +115439,7 @@ var ts; writeTrailingSemicolon(); } function emitAssertClause(node) { - emitTokenWithComment(129 /* SyntaxKind.AssertKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(130 /* SyntaxKind.AssertKeyword */, node.pos, writeKeyword, node); writeSpace(); var elements = node.elements; emitList(node, elements, 526226 /* ListFormat.ImportClauseEntries */); @@ -114440,9 +115459,9 @@ var ts; function emitNamespaceExportDeclaration(node) { var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, nextPos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(142 /* SyntaxKind.NamespaceKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(143 /* SyntaxKind.NamespaceKeyword */, nextPos, writeKeyword, node); writeSpace(); emit(node.name); writeTrailingSemicolon(); @@ -114450,7 +115469,7 @@ var ts; function emitNamespaceExport(node) { var asPos = emitTokenWithComment(41 /* SyntaxKind.AsteriskToken */, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -114473,7 +115492,7 @@ var ts; if (node.propertyName) { emit(node.propertyName); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, node.propertyName.end, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, node.propertyName.end, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114694,7 +115713,7 @@ var ts; } } if (node.tags) { - if (node.tags.length === 1 && node.tags[0].kind === 343 /* SyntaxKind.JSDocTypeTag */ && !node.comment) { + if (node.tags.length === 1 && node.tags[0].kind === 346 /* SyntaxKind.JSDocTypeTag */ && !node.comment) { writeSpace(); emit(node.tags[0]); } @@ -114739,7 +115758,7 @@ var ts; function emitJSDocTypedefTag(tag) { emitJSDocTagName(tag.tagName); if (tag.typeExpression) { - if (tag.typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */) { + if (tag.typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */) { emitJSDocTypeExpression(tag.typeExpression); } else { @@ -114758,7 +115777,7 @@ var ts; emit(tag.fullName); } emitJSDocComment(tag.comment); - if (tag.typeExpression && tag.typeExpression.kind === 322 /* SyntaxKind.JSDocTypeLiteral */) { + if (tag.typeExpression && tag.typeExpression.kind === 325 /* SyntaxKind.JSDocTypeLiteral */) { emitJSDocTypeLiteral(tag.typeExpression); } } @@ -115691,13 +116710,13 @@ var ts; && (!currentSourceFile || ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile)); } function skipSynthesizedParentheses(node) { - while (node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { + while (node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; } function getTextOfNode(node, includeTrivia) { - if (ts.isGeneratedIdentifier(node)) { + if (ts.isGeneratedIdentifier(node) || ts.isGeneratedPrivateIdentifier(node)) { return generateName(node); } if (ts.isStringLiteral(node) && node.textSourceNode) { @@ -115721,7 +116740,7 @@ var ts; function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) { if (node.kind === 10 /* SyntaxKind.StringLiteral */ && node.textSourceNode) { var textSourceNode = node.textSourceNode; - if (ts.isIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) { + if (ts.isIdentifier(textSourceNode) || ts.isPrivateIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) { var text = ts.isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode(textSourceNode); return jsxAttributeEscape ? "\"".concat(ts.escapeJsxAttributeString(text), "\"") : neverAsciiEscape || (ts.getEmitFlags(node) & 16777216 /* EmitFlags.NoAsciiEscaping */) ? "\"".concat(ts.escapeString(text), "\"") : @@ -115745,7 +116764,11 @@ var ts; return; } tempFlagsStack.push(tempFlags); - tempFlags = 0; + tempFlags = 0 /* TempFlags.Auto */; + privateNameTempFlagsStack.push(privateNameTempFlags); + privateNameTempFlags = 0 /* TempFlags.Auto */; + formattedNameTempFlagsStack.push(formattedNameTempFlags); + formattedNameTempFlags = undefined; reservedNamesStack.push(reservedNames); } /** @@ -115756,6 +116779,8 @@ var ts; return; } tempFlags = tempFlagsStack.pop(); + privateNameTempFlags = privateNameTempFlagsStack.pop(); + formattedNameTempFlags = formattedNameTempFlagsStack.pop(); reservedNames = reservedNamesStack.pop(); } function reserveNameInNestedScopes(name) { @@ -115768,84 +116793,84 @@ var ts; if (!node) return; switch (node.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: ts.forEach(node.statements, generateNames); break; - case 250 /* SyntaxKind.LabeledStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 253 /* SyntaxKind.LabeledStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: generateNames(node.statement); break; - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: generateNames(node.thenStatement); generateNames(node.elseStatement); break; - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: generateNames(node.initializer); generateNames(node.statement); break; - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: generateNames(node.caseBlock); break; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: ts.forEach(node.clauses, generateNames); break; - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: ts.forEach(node.statements, generateNames); break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: generateNames(node.tryBlock); generateNames(node.catchClause); generateNames(node.finallyBlock); break; - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: generateNames(node.variableDeclaration); generateNames(node.block); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: generateNames(node.declarationList); break; - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: ts.forEach(node.declarations, generateNames); break; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: generateNameIfNeeded(node.name); break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: generateNameIfNeeded(node.name); if (ts.getEmitFlags(node) & 524288 /* EmitFlags.ReuseTempVariableScope */) { ts.forEach(node.parameters, generateNames); generateNames(node.body); } break; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: ts.forEach(node.elements, generateNames); break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: generateNames(node.importClause); break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: generateNameIfNeeded(node.name); generateNames(node.namedBindings); break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: generateNameIfNeeded(node.name); break; - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: generateNameIfNeeded(node.name); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: ts.forEach(node.elements, generateNames); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: generateNameIfNeeded(node.propertyName || node.name); break; } @@ -115854,19 +116879,19 @@ var ts; if (!node) return; switch (node.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: generateNameIfNeeded(node.name); break; } } function generateNameIfNeeded(name) { if (name) { - if (ts.isGeneratedIdentifier(name)) { + if (ts.isGeneratedIdentifier(name) || ts.isGeneratedPrivateIdentifier(name)) { generateName(name); } else if (ts.isBindingPattern(name)) { @@ -115881,7 +116906,7 @@ var ts; if ((name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) === 4 /* GeneratedIdentifierFlags.Node */) { // Node names generate unique names based on their original node // and are cached based on that node's id. - return generateNameCached(getNodeForGeneratedName(name), name.autoGenerateFlags); + return generateNameCached(ts.getNodeForGeneratedName(name), ts.isPrivateIdentifier(name), name.autoGenerateFlags, name.autoGeneratePrefix, name.autoGenerateSuffix); } else { // Auto, Loop, and Unique names are cached based on their unique @@ -115890,9 +116915,9 @@ var ts; return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = makeName(name)); } } - function generateNameCached(node, flags) { + function generateNameCached(node, privateName, flags, prefix, suffix) { var nodeId = ts.getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, flags)); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, privateName, flags !== null && flags !== void 0 ? flags : 0 /* GeneratedIdentifierFlags.None */, ts.formatGeneratedNamePart(prefix, generateName), ts.formatGeneratedNamePart(suffix))); } /** * Returns a value indicating whether a name is unique globally, within the current file, @@ -115924,20 +116949,53 @@ var ts; } return true; } + function getTempFlags(formattedNameKey) { + var _a; + switch (formattedNameKey) { + case "": + return tempFlags; + case "#": + return privateNameTempFlags; + default: + return (_a = formattedNameTempFlags === null || formattedNameTempFlags === void 0 ? void 0 : formattedNameTempFlags.get(formattedNameKey)) !== null && _a !== void 0 ? _a : 0 /* TempFlags.Auto */; + } + } + function setTempFlags(formattedNameKey, flags) { + switch (formattedNameKey) { + case "": + tempFlags = flags; + break; + case "#": + privateNameTempFlags = flags; + break; + default: + formattedNameTempFlags !== null && formattedNameTempFlags !== void 0 ? formattedNameTempFlags : (formattedNameTempFlags = new ts.Map()); + formattedNameTempFlags.set(formattedNameKey, flags); + break; + } + } /** * Return the next available name in the pattern _a ... _z, _0, _1, ... * TempFlags._i or TempFlags._n may be used to express a preference for that dedicated name. * Note that names generated by makeTempVariableName and makeUniqueName will never conflict. */ - function makeTempVariableName(flags, reservedInNestedScopes) { + function makeTempVariableName(flags, reservedInNestedScopes, privateName, prefix, suffix) { + if (prefix.length > 0 && prefix.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + prefix = prefix.slice(1); + } + // Generate a key to use to acquire a TempFlags counter based on the fixed portions of the generated name. + var key = ts.formatGeneratedName(privateName, prefix, "", suffix); + var tempFlags = getTempFlags(key); if (flags && !(tempFlags & flags)) { var name = flags === 268435456 /* TempFlags._i */ ? "_i" : "_n"; - if (isUniqueName(name)) { + var fullName = ts.formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { tempFlags |= flags; if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } while (true) { @@ -115948,11 +117006,13 @@ var ts; var name = count < 26 ? "_" + String.fromCharCode(97 /* CharacterCodes.a */ + count) : "_" + (count - 26); - if (isUniqueName(name)) { + var fullName = ts.formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } } @@ -115964,17 +117024,24 @@ var ts; * makeUniqueName are guaranteed to never conflict. * If `optimistic` is set, the first instance will use 'baseName' verbatim instead of 'baseName_1' */ - function makeUniqueName(baseName, checkFn, optimistic, scoped) { + function makeUniqueName(baseName, checkFn, optimistic, scoped, privateName, prefix, suffix) { if (checkFn === void 0) { checkFn = isUniqueName; } + if (baseName.length > 0 && baseName.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + baseName = baseName.slice(1); + } + if (prefix.length > 0 && prefix.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + prefix = prefix.slice(1); + } if (optimistic) { - if (checkFn(baseName)) { + var fullName = ts.formatGeneratedName(privateName, prefix, baseName, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(baseName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(baseName); + generatedNames.add(fullName); } - return baseName; + return fullName; } } // Find the first unique 'name_n', where n is a positive number @@ -115983,21 +117050,21 @@ var ts; } var i = 1; while (true) { - var generatedName = baseName + i; - if (checkFn(generatedName)) { + var fullName = ts.formatGeneratedName(privateName, prefix, baseName + i, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(generatedName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(generatedName); + generatedNames.add(fullName); } - return generatedName; + return fullName; } i++; } } function makeFileLevelOptimisticUniqueName(name) { - return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true); + return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a ModuleDeclaration or EnumDeclaration. @@ -116005,7 +117072,7 @@ var ts; function generateNameForModuleOrEnum(node) { var name = getTextOfNode(node.name); // Use module/enum name itself if it is unique, otherwise make a unique variation - return isUniqueLocalName(name, node) ? name : makeUniqueName(name); + return isUniqueLocalName(name, node) ? name : makeUniqueName(name, isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for an ImportDeclaration or ExportDeclaration. @@ -116014,89 +117081,76 @@ var ts; var expr = ts.getExternalModuleName(node); // TODO: GH#18217 var baseName = ts.isStringLiteral(expr) ? ts.makeIdentifierFromModuleName(expr.text) : "module"; - return makeUniqueName(baseName); + return makeUniqueName(baseName, isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a default export. */ function generateNameForExportDefault() { - return makeUniqueName("default"); + return makeUniqueName("default", isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a class expression. */ function generateNameForClassExpression() { - return makeUniqueName("class"); + return makeUniqueName("class", isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } - function generateNameForMethodOrAccessor(node) { + function generateNameForMethodOrAccessor(node, privateName, prefix, suffix) { if (ts.isIdentifier(node.name)) { - return generateNameCached(node.name); + return generateNameCached(node.name, privateName); } - return makeTempVariableName(0 /* TempFlags.Auto */); + return makeTempVariableName(0 /* TempFlags.Auto */, /*reservedInNestedScopes*/ false, privateName, prefix, suffix); } /** * Generates a unique name from a node. */ - function generateNameForNode(node, flags) { + function generateNameForNode(node, privateName, flags, prefix, suffix) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(flags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 80 /* SyntaxKind.PrivateIdentifier */: + return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(flags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), privateName, prefix, suffix); + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForModuleOrEnum(node); - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForImportOrExportDeclaration(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForExportDefault(); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForClassExpression(); - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return generateNameForMethodOrAccessor(node); - case 162 /* SyntaxKind.ComputedPropertyName */: - return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ true); + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return generateNameForMethodOrAccessor(node, privateName, prefix, suffix); + case 164 /* SyntaxKind.ComputedPropertyName */: + return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ true, privateName, prefix, suffix); default: - return makeTempVariableName(0 /* TempFlags.Auto */); + return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ false, privateName, prefix, suffix); } } /** * Generates a unique identifier for a node. */ function makeName(name) { + var prefix = ts.formatGeneratedNamePart(name.autoGeneratePrefix, generateName); + var suffix = ts.formatGeneratedNamePart(name.autoGenerateSuffix); switch (name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) { case 1 /* GeneratedIdentifierFlags.Auto */: - return makeTempVariableName(0 /* TempFlags.Auto */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + return makeTempVariableName(0 /* TempFlags.Auto */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), ts.isPrivateIdentifier(name), prefix, suffix); case 2 /* GeneratedIdentifierFlags.Loop */: - return makeTempVariableName(268435456 /* TempFlags._i */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + ts.Debug.assertNode(name, ts.isIdentifier); + return makeTempVariableName(268435456 /* TempFlags._i */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), /*privateName*/ false, prefix, suffix); case 3 /* GeneratedIdentifierFlags.Unique */: - return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32 /* GeneratedIdentifierFlags.FileLevel */) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32 /* GeneratedIdentifierFlags.FileLevel */) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), ts.isPrivateIdentifier(name), prefix, suffix); } - return ts.Debug.fail("Unsupported GeneratedIdentifierKind."); - } - /** - * Gets the node from which a name should be generated. - */ - function getNodeForGeneratedName(name) { - var autoGenerateId = name.autoGenerateId; - var node = name; - var original = node.original; - while (original) { - node = original; - // if "node" is a different generated name (having a different - // "autoGenerateId"), use it and stop traversing. - if (ts.isIdentifier(node) - && !!(node.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) - && node.autoGenerateId !== autoGenerateId) { - break; - } - original = node.original; - } - // otherwise, return the original node for the source; - return node; + return ts.Debug.fail("Unsupported GeneratedIdentifierKind: ".concat(ts.Debug.formatEnum(name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */, ts.GeneratedIdentifierFlags, /*isFlags*/ true), ".")); } // Comments function pipelineEmitWithComments(hint, node) { @@ -116142,7 +117196,7 @@ var ts; // Emit leading comments if the position is not synthesized and the node // has not opted out from emitting leading comments. if (!skipLeadingComments) { - emitLeadingComments(pos, /*isEmittedNode*/ node.kind !== 349 /* SyntaxKind.NotEmittedStatement */); + emitLeadingComments(pos, /*isEmittedNode*/ node.kind !== 352 /* SyntaxKind.NotEmittedStatement */); } if (!skipLeadingComments || (pos >= 0 && (emitFlags & 512 /* EmitFlags.NoLeadingComments */) !== 0)) { // Advance the container position if comments get emitted or if they've been disabled explicitly using NoLeadingComments. @@ -116153,7 +117207,7 @@ var ts; containerEnd = end; // To avoid invalid comment emit in a down-level binding pattern, we // keep track of the last declaration list container's end - if (node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { declarationListContainerEnd = end; } } @@ -116172,7 +117226,7 @@ var ts; declarationListContainerEnd = savedDeclarationListContainerEnd; // Emit trailing comments if the position is not synthesized and the node // has not opted out from emitting leading comments and is an emitted node. - if (!skipTrailingComments && node.kind !== 349 /* SyntaxKind.NotEmittedStatement */) { + if (!skipTrailingComments && node.kind !== 352 /* SyntaxKind.NotEmittedStatement */) { emitTrailingComments(end); } } @@ -116453,7 +117507,7 @@ var ts; } else { var source = sourceMapRange.source || sourceMapSource; - if (node.kind !== 349 /* SyntaxKind.NotEmittedStatement */ + if (node.kind !== 352 /* SyntaxKind.NotEmittedStatement */ && (emitFlags & 16 /* EmitFlags.NoLeadingSourceMap */) === 0 && sourceMapRange.pos >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, skipSourceTrivia(source, sourceMapRange.pos)); @@ -116471,7 +117525,7 @@ var ts; if (emitFlags & 64 /* EmitFlags.NoNestedSourceMaps */) { sourceMapsDisabled = false; } - if (node.kind !== 349 /* SyntaxKind.NotEmittedStatement */ + if (node.kind !== 352 /* SyntaxKind.NotEmittedStatement */ && (emitFlags & 32 /* EmitFlags.NoTrailingSourceMap */) === 0 && sourceMapRange.end >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, sourceMapRange.end); @@ -116636,7 +117690,16 @@ var ts; return cachedReadDirectoryResult.get(ts.ensureTrailingDirectorySeparator(rootDirPath)); } function getCachedFileSystemEntriesForBaseDir(path) { - return getCachedFileSystemEntries(ts.getDirectoryPath(path)); + var entries = getCachedFileSystemEntries(ts.getDirectoryPath(path)); + if (!entries) { + return entries; + } + // If we're looking for the base directory, we're definitely going to search the entries + if (!entries.sortedAndCanonicalizedFiles) { + entries.sortedAndCanonicalizedFiles = entries.files.map(getCanonicalFileName).sort(); + entries.sortedAndCanonicalizedDirectories = entries.directories.map(getCanonicalFileName).sort(); + } + return entries; } function getBaseNameOfFileName(fileName) { return ts.getBaseFileName(ts.normalizePath(fileName)); @@ -116679,21 +117742,10 @@ var ts; return undefined; } } - function fileNameEqual(name1, name2) { - return getCanonicalFileName(name1) === getCanonicalFileName(name2); - } function hasEntry(entries, name) { - return ts.some(entries, function (file) { return fileNameEqual(file, name); }); - } - function updateFileSystemEntry(entries, baseName, isValid) { - if (hasEntry(entries, baseName)) { - if (!isValid) { - return ts.filterMutate(entries, function (entry) { return !fileNameEqual(entry, baseName); }); - } - } - else if (isValid) { - return entries.push(baseName); - } + // Case-sensitive comparison since already canonicalized + var index = ts.binarySearch(entries, name, ts.identity, ts.compareStringsCaseSensitive); + return index >= 0; } function writeFile(fileName, data, writeByteOrderMark) { var path = toPath(fileName); @@ -116706,7 +117758,7 @@ var ts; function fileExists(fileName) { var path = toPath(fileName); var result = getCachedFileSystemEntriesForBaseDir(path); - return result && hasEntry(result.files, getBaseNameOfFileName(fileName)) || + return result && hasEntry(result.sortedAndCanonicalizedFiles, getCanonicalFileName(getBaseNameOfFileName(fileName))) || host.fileExists(fileName); } function directoryExists(dirPath) { @@ -116716,9 +117768,14 @@ var ts; function createDirectory(dirPath) { var path = toPath(dirPath); var result = getCachedFileSystemEntriesForBaseDir(path); - var baseFileName = getBaseNameOfFileName(dirPath); if (result) { - updateFileSystemEntry(result.directories, baseFileName, /*isValid*/ true); + var baseName = getBaseNameOfFileName(dirPath); + var canonicalizedBaseName = getCanonicalFileName(baseName); + var canonicalizedDirectories = result.sortedAndCanonicalizedDirectories; + // Case-sensitive comparison since already canonicalized + if (ts.insertSorted(canonicalizedDirectories, canonicalizedBaseName, ts.compareStringsCaseSensitive)) { + result.directories.push(baseName); + } } host.createDirectory(dirPath); } @@ -116787,7 +117844,7 @@ var ts; fileExists: host.fileExists(fileOrDirectoryPath), directoryExists: host.directoryExists(fileOrDirectoryPath) }; - if (fsQueryResult.directoryExists || hasEntry(parentResult.directories, baseName)) { + if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) { // Folder added or removed, clear the cache instead of updating the folder and its structure clearCache(); } @@ -116807,7 +117864,23 @@ var ts; } } function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists) { - updateFileSystemEntry(parentResult.files, baseName, fileExists); + var canonicalizedFiles = parentResult.sortedAndCanonicalizedFiles; + var canonicalizedBaseName = getCanonicalFileName(baseName); + if (fileExists) { + // Case-sensitive comparison since already canonicalized + if (ts.insertSorted(canonicalizedFiles, canonicalizedBaseName, ts.compareStringsCaseSensitive)) { + parentResult.files.push(baseName); + } + } + else { + // Case-sensitive comparison since already canonicalized + var sortedIndex = ts.binarySearch(canonicalizedFiles, canonicalizedBaseName, ts.identity, ts.compareStringsCaseSensitive); + if (sortedIndex >= 0) { + canonicalizedFiles.splice(sortedIndex, 1); + var unsortedIndex = parentResult.files.findIndex(function (entry) { return getCanonicalFileName(entry) === canonicalizedBaseName; }); + parentResult.files.splice(unsortedIndex, 1); + } + } } function clearCache() { cachedReadDirectoryResult.clear(); @@ -117567,7 +118640,6 @@ var ts; return resolutions; } ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache; - ; /** * Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly * provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file. @@ -117872,7 +118944,7 @@ var ts; state.failedLookupLocations = packageJsonLocations; state.affectingLocations = packageJsonLocations; var packageJsonScope = ts.getPackageScopeForPath(fileName, state); - var impliedNodeFormat = (packageJsonScope === null || packageJsonScope === void 0 ? void 0 : packageJsonScope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS; + var impliedNodeFormat = (packageJsonScope === null || packageJsonScope === void 0 ? void 0 : packageJsonScope.contents.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS; return { impliedNodeFormat: impliedNodeFormat, packageJsonLocations: packageJsonLocations, packageJsonScope: packageJsonScope }; } } @@ -119112,22 +120184,22 @@ var ts; // Return directly from the case if the given node doesnt want to visit each child // Otherwise break to visit each child switch (parent.kind) { - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: if (parent.questionToken === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?")); return "skip"; } // falls through - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 257 /* SyntaxKind.VariableDeclaration */: // type annotation if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_annotations_can_only_be_used_in_TypeScript_files)); @@ -119135,65 +120207,68 @@ var ts; } } switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "import type")); return "skip"; } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "export type")); return "skip"; } break; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, ts.isImportSpecifier(node) ? "import...type" : "export...type")); return "skip"; } break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_TypeScript_files)); return "skip"; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: var heritageClause = node; if (heritageClause.token === 117 /* SyntaxKind.ImplementsKeyword */) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: var interfaceKeyword = ts.tokenToString(118 /* SyntaxKind.InterfaceKeyword */); ts.Debug.assertIsDefined(interfaceKeyword); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, interfaceKeyword)); return "skip"; - case 261 /* SyntaxKind.ModuleDeclaration */: - var moduleKeyword = node.flags & 16 /* NodeFlags.Namespace */ ? ts.tokenToString(142 /* SyntaxKind.NamespaceKeyword */) : ts.tokenToString(141 /* SyntaxKind.ModuleKeyword */); + case 264 /* SyntaxKind.ModuleDeclaration */: + var moduleKeyword = node.flags & 16 /* NodeFlags.Namespace */ ? ts.tokenToString(143 /* SyntaxKind.NamespaceKeyword */) : ts.tokenToString(142 /* SyntaxKind.ModuleKeyword */); ts.Debug.assertIsDefined(moduleKeyword); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, moduleKeyword)); return "skip"; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files)); return "skip"; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: var enumKeyword = ts.Debug.checkDefined(ts.tokenToString(92 /* SyntaxKind.EnumKeyword */)); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, enumKeyword)); return "skip"; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Non_null_assertions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_assertion_expressions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files)); + return "skip"; + case 213 /* SyntaxKind.TypeAssertionExpression */: ts.Debug.fail(); // Won't parse these in a JS file anyway, as they are interpreted as JSX. } } @@ -119202,53 +120277,55 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning)); } switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: // Check type parameters if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files)); return "skip"; } // falls through - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // Check modifiers if (nodes === parent.modifiers) { - checkModifiers(parent.modifiers, parent.kind === 237 /* SyntaxKind.VariableStatement */); + checkModifiers(parent.modifiers, parent.kind === 240 /* SyntaxKind.VariableStatement */); return "skip"; } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // Check modifiers of property declaration if (nodes === parent.modifiers) { for (var _i = 0, _a = nodes; _i < _a.length; _i++) { var modifier = _a[_i]; - if (ts.isModifier(modifier) && modifier.kind !== 124 /* SyntaxKind.StaticKeyword */) { + if (ts.isModifier(modifier) + && modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ + && modifier.kind !== 127 /* SyntaxKind.AccessorKeyword */) { diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind))); } } return "skip"; } break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Check modifiers of parameter declaration if (nodes === parent.modifiers && ts.some(nodes, ts.isModifier)) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Parameter_modifiers_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // Check type arguments if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_arguments_can_only_be_used_in_TypeScript_files)); @@ -119270,18 +120347,19 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind))); break; // These are all legal modifiers. case 124 /* SyntaxKind.StaticKeyword */: case 93 /* SyntaxKind.ExportKeyword */: case 88 /* SyntaxKind.DefaultKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: } } } @@ -119603,7 +120681,7 @@ var ts; // It's a _little odd_ that we can't set `impliedNodeFormat` until the program step - but it's the first and only time we have a resolution cache // and a freshly made source file node on hand at the same time, and we need both to set the field. Persisting the resolution cache all the way // to the check and emit steps would be bad - so we much prefer detecting and storing the format information on the source file node upfront. - var result = getImpliedNodeFormatForFileWorker(toPath(fileName), moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options); + var result = getImpliedNodeFormatForFileWorker(ts.getNormalizedAbsolutePath(fileName, currentDirectory), moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options); var languageVersion = ts.getEmitScriptTarget(options); var setExternalModuleIndicator = ts.getSetExternalModuleIndicator(options); return typeof result === "object" ? __assign(__assign({}, result), { languageVersion: languageVersion, setExternalModuleIndicator: setExternalModuleIndicator }) : @@ -120206,10 +121284,12 @@ var ts; if (options.preserveConstEnums === false) { createDiagnosticForOptionName(ts.Diagnostics.Option_preserveConstEnums_cannot_be_disabled_when_isolatedModules_is_enabled, "preserveConstEnums", "isolatedModules"); } - var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !ts.isSourceFileJS(f) && !f.isDeclarationFile && f.scriptKind !== 6 /* ScriptKind.JSON */; }); - if (firstNonExternalModuleSourceFile) { - var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(firstNonExternalModuleSourceFile.fileName))); + for (var _a = 0, files_5 = files; _a < files_5.length; _a++) { + var file = files_5[_a]; + if (!ts.isExternalModule(file) && !ts.isSourceFileJS(file) && !file.isDeclarationFile && file.scriptKind !== 6 /* ScriptKind.JSON */) { + var span = ts.getErrorSpanForNode(file, file); + programDiagnostics.add(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(file.fileName))); + } } } else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 /* ScriptTarget.ES2015 */ && options.module === ts.ModuleKind.None) { @@ -123936,7 +125016,7 @@ var ts; }); // Sort by paths closest to importing file Name directory var sortedPaths = []; - var _loop_35 = function (directory) { + var _loop_36 = function (directory) { var directoryStart = ts.ensureTrailingDirectorySeparator(directory); var pathsInDirectory; allFileNames.forEach(function (_a, fileName) { @@ -123960,9 +125040,9 @@ var ts; }; var out_directory_1; for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) { - var state_11 = _loop_35(directory); + var state_12 = _loop_36(directory); directory = out_directory_1; - if (state_11 === "break") + if (state_12 === "break") break; } if (allFileNames.size) { @@ -124031,7 +125111,7 @@ var ts; } function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) { for (var key in paths) { - var _loop_36 = function (patternText_1) { + var _loop_37 = function (patternText_1) { var pattern = ts.normalizePath(patternText_1); var indexOfStar = pattern.indexOf("*"); // In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly, @@ -124098,9 +125178,9 @@ var ts; }; for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) { var patternText_1 = _a[_i]; - var state_12 = _loop_36(patternText_1); - if (typeof state_12 === "object") - return state_12.value; + var state_13 = _loop_37(patternText_1); + if (typeof state_13 === "object") + return state_13.value; } } function validateEnding(_a) { @@ -124264,7 +125344,7 @@ var ts; var maybeBlockedByTypesVersions = false; var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath); if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) { - var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath)); + var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath)); var importMode = overrideMode || importingSourceFile.impliedNodeFormat; if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) { var conditions = ["node", importMode === ts.ModuleKind.ESNext ? "import" : "require", "types"]; @@ -124626,7 +125706,7 @@ var ts; case ts.ModuleKind.CommonJS: if (file.packageJsonScope) { (result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages( - /*details*/ undefined, file.packageJsonScope.packageJsonContent.type ? + /*details*/ undefined, file.packageJsonScope.contents.packageJsonContent.type ? ts.Diagnostics.File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module : ts.Diagnostics.File_is_CommonJS_module_because_0_does_not_have_field_type, toFileName(ts.last(file.packageJsonLocations), fileNameConvertor))); } @@ -125045,18 +126125,14 @@ var ts; if (host.getBuildInfo) { // host provides buildinfo, get it from there. This allows host to cache it buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath); - if (!buildInfo) - return undefined; } else { var content = host.readFile(buildInfoPath); if (!content) return undefined; - buildInfo = ts.getBuildInfo(content); + buildInfo = ts.getBuildInfo(buildInfoPath, content); } - if (buildInfo.version !== ts.version) - return undefined; - if (!buildInfo.program) + if (!buildInfo || buildInfo.version !== ts.version || !buildInfo.program) return undefined; return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host); } @@ -125278,7 +126354,8 @@ var ts; } // All resolutions are invalid if user provided resolutions var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution); - if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + 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 (hasChangedConfigFileParsingErrors) { if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); @@ -125297,6 +126374,11 @@ var ts; if (host.afterProgramCreate && program !== builderProgram) { host.afterProgramCreate(builderProgram); } + compilerHost.readFile = originalReadFile; + compilerHost.fileExists = originalFileExists; + compilerHost.directoryExists = originalDirectoryExists; + compilerHost.createDirectory = originalCreateDirectory; + compilerHost.writeFile = originalWriteFile; return builderProgram; } function createNewProgram(hasInvalidatedResolution) { @@ -125774,19 +126856,20 @@ var ts; */ UpToDateStatusType[UpToDateStatusType["OutOfDateWithPrepend"] = 3] = "OutOfDateWithPrepend"; UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing"; - UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf"; - UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream"; - UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo"; - UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate"; - UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked"; - UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream"; - UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate"; - UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText"; + UpToDateStatusType[UpToDateStatusType["ErrorReadingFile"] = 5] = "ErrorReadingFile"; + UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 6] = "OutOfDateWithSelf"; + UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 7] = "OutOfDateWithUpstream"; + UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 8] = "OutOfDateBuildInfo"; + UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 9] = "UpstreamOutOfDate"; + UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 10] = "UpstreamBlocked"; + UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 11] = "ComputingUpstream"; + UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 12] = "TsVersionOutputOfDate"; + UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 13] = "UpToDateWithInputFileText"; /** * Projects with no outputs (i.e. "solution" files) */ - UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly"; - UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild"; + UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 14] = "ContainerOnly"; + UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 15] = "ForceBuild"; })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {})); function resolveConfigFileProjectName(project) { if (ts.fileExtensionIs(project, ".json" /* Extension.Json */)) { @@ -126004,6 +127087,7 @@ var ts; if (value) { return isParsedCommandLine(value) ? value : undefined; } + ts.performance.mark("SolutionBuilder::beforeConfigFileParsing"); var diagnostic; var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host; var parsed; @@ -126018,6 +127102,8 @@ var ts; parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop; } configFileCache.set(configFilePath, parsed || diagnostic); + ts.performance.mark("SolutionBuilder::afterConfigFileParsing"); + ts.performance.measure("SolutionBuilder::Config file parsing", "SolutionBuilder::beforeConfigFileParsing", "SolutionBuilder::afterConfigFileParsing"); return parsed; } function resolveProjectName(state, name) { @@ -126217,6 +127303,7 @@ var ts; if (updateOutputFileStampsPending) { updateOutputTimestamps(state, config, projectPath); } + ts.performance.mark("SolutionBuilder::Timestamps only updates"); return doneInvalidatedProject(state, projectPath); } }; @@ -126310,6 +127397,10 @@ var ts; }; function done(cancellationToken, writeFile, customTransformers) { executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers); + if (kind === InvalidatedProjectKind.Build) + ts.performance.mark("SolutionBuilder::Projects built"); + else + ts.performance.mark("SolutionBuilder::Bundles updated"); return doneInvalidatedProject(state, projectPath); } function withProgramOrUndefined(action) { @@ -126488,13 +127579,13 @@ var ts; var emitterDiagnostics = ts.createDiagnosticCollection(); var emittedOutputs = new ts.Map(); var resultFlags = BuildResultFlags.DeclarationOutputUnchanged; - var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo; + var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo || undefined; outputFiles.forEach(function (_a) { var _b, _c; var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo; emittedOutputs.set(toPath(state, name), name); if (buildInfo) { - if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { + if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo === null || existingBuildInfo === void 0 ? void 0 : existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged; } setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags); @@ -126787,8 +127878,7 @@ var ts; return existing.buildInfo || undefined; } var value = state.readFileWithCache(buildInfoPath); - var buildInfo = value ? ts.getBuildInfo(value) : undefined; - ts.Debug.assert(modifiedTime || !buildInfo); + var buildInfo = value ? ts.getBuildInfo(buildInfoPath, value) : undefined; state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime }); return buildInfo; } @@ -126873,7 +127963,14 @@ var ts; missingOutputFileName: buildInfoPath }; } - var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime)); + var buildInfo = getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime); + if (!buildInfo) { + // Error reading buildInfo + return { + type: ts.UpToDateStatusType.ErrorReadingFile, + fileName: buildInfoPath + }; + } if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) { return { type: ts.UpToDateStatusType.TsVersionOutputOfDate, @@ -127058,7 +128155,10 @@ var ts; if (prior !== undefined) { return prior; } + ts.performance.mark("SolutionBuilder::beforeUpToDateCheck"); var actual = getUpToDateStatusWorker(state, project, resolvedPath); + ts.performance.mark("SolutionBuilder::afterUpToDateCheck"); + ts.performance.measure("SolutionBuilder::Up-to-date check", "SolutionBuilder::beforeUpToDateCheck", "SolutionBuilder::afterUpToDateCheck"); state.projectStatus.set(resolvedPath, actual); return actual; } @@ -127196,6 +128296,13 @@ var ts; } } function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { + ts.performance.mark("SolutionBuilder::beforeBuild"); + var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences); + ts.performance.mark("SolutionBuilder::afterBuild"); + ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + return result; + } + function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { var buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ts.ExitStatus.InvalidProject_OutputsSkipped; @@ -127223,6 +128330,13 @@ var ts; : ts.ExitStatus.DiagnosticsPresent_OutputsSkipped; } function clean(state, project, onlyReferences) { + ts.performance.mark("SolutionBuilder::beforeClean"); + var result = cleanWorker(state, project, onlyReferences); + ts.performance.mark("SolutionBuilder::afterClean"); + ts.performance.measure("SolutionBuilder::Clean", "SolutionBuilder::beforeClean", "SolutionBuilder::afterClean"); + return result; + } + function cleanWorker(state, project, onlyReferences) { var buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ts.ExitStatus.InvalidProject_OutputsSkipped; @@ -127296,6 +128410,14 @@ var ts; state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected); } function buildNextInvalidatedProject(state, changeDetected) { + ts.performance.mark("SolutionBuilder::beforeBuild"); + var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected); + ts.performance.mark("SolutionBuilder::afterBuild"); + ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + if (buildOrder) + reportErrorSummary(state, buildOrder); + } + function buildNextInvalidatedProjectWorker(state, changeDetected) { state.timerToBuildInvalidatedProject = undefined; if (state.reportFileChangeDetected) { state.reportFileChangeDetected = false; @@ -127328,7 +128450,7 @@ var ts; } } disableCache(state); - reportErrorSummary(state, buildOrder); + return buildOrder; } function watchConfigFile(state, resolved, resolvedPath, parsed) { if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath)) @@ -127383,6 +128505,7 @@ var ts; function startWatching(state, buildOrder) { if (!state.watchAllProjectsPending) return; + ts.performance.mark("SolutionBuilder::beforeWatcherCreation"); state.watchAllProjectsPending = false; for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) { var resolved = _a[_i]; @@ -127400,6 +128523,8 @@ var ts; watchPackageJsonFiles(state, resolved, resolvedPath, cfg); } } + ts.performance.mark("SolutionBuilder::afterWatcherCreation"); + ts.performance.measure("SolutionBuilder::Watcher creation", "SolutionBuilder::beforeWatcherCreation", "SolutionBuilder::afterWatcherCreation"); } function stopWatching(state) { ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher); @@ -127513,6 +128638,8 @@ var ts; return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_1_is_older_than_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerProjectName)); case ts.UpToDateStatusType.OutputMissing: return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relName(state, configFileName), relName(state, status.missingOutputFileName)); + case ts.UpToDateStatusType.ErrorReadingFile: + return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_there_was_error_reading_file_1, relName(state, configFileName), relName(state, status.fileName)); case ts.UpToDateStatusType.OutOfDateBuildInfo: return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted, relName(state, configFileName), relName(state, status.buildInfoFile)); case ts.UpToDateStatusType.UpToDate: @@ -127801,6 +128928,8 @@ var ts; * interface Y { foo:number; } */ ScriptElementKind["memberVariableElement"] = "property"; + /** class X { [public|private]* accessor foo: number; } */ + ScriptElementKind["memberAccessorVariableElement"] = "accessor"; /** * class X { constructor() { } } * class X { static { } } @@ -127933,37 +129062,37 @@ var ts; })(SemanticMeaning = ts.SemanticMeaning || (ts.SemanticMeaning = {})); function getMeaningFromDeclaration(node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.isInJSFile(node) && ts.getJSDocEnumTag(node) ? 7 /* SemanticMeaning.All */ : 1 /* SemanticMeaning.Value */; - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 292 /* SyntaxKind.CatchClause */: - case 285 /* SyntaxKind.JsxAttribute */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 295 /* SyntaxKind.CatchClause */: + case 288 /* SyntaxKind.JsxAttribute */: return 1 /* SemanticMeaning.Value */; - case 163 /* SyntaxKind.TypeParameter */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: + case 165 /* SyntaxKind.TypeParameter */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: return 2 /* SemanticMeaning.Type */; - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: // If it has no name node, it shares the name with the value declaration below it. return node.name === undefined ? 1 /* SemanticMeaning.Value */ | 2 /* SemanticMeaning.Type */ : 2 /* SemanticMeaning.Type */; - case 299 /* SyntaxKind.EnumMember */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 260 /* SyntaxKind.ClassDeclaration */: return 1 /* SemanticMeaning.Value */ | 2 /* SemanticMeaning.Type */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.isAmbientModule(node)) { return 4 /* SemanticMeaning.Namespace */ | 1 /* SemanticMeaning.Value */; } @@ -127973,16 +129102,16 @@ var ts; else { return 4 /* SemanticMeaning.Namespace */; } - case 260 /* SyntaxKind.EnumDeclaration */: - case 269 /* SyntaxKind.NamedImports */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 272 /* SyntaxKind.NamedImports */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: return 7 /* SemanticMeaning.All */; // An external module can be a Value - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 4 /* SemanticMeaning.Namespace */ | 1 /* SemanticMeaning.Value */; } return 7 /* SemanticMeaning.All */; @@ -127991,7 +129120,7 @@ var ts; function getMeaningFromLocation(node) { node = getAdjustedReferenceLocation(node); var parent = node.parent; - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return 1 /* SemanticMeaning.Value */; } else if (ts.isExportAssignment(parent) @@ -128034,11 +129163,11 @@ var ts; // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - var name = node.kind === 161 /* SyntaxKind.QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined; - return name && name.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ ? 7 /* SemanticMeaning.All */ : 4 /* SemanticMeaning.Namespace */; + var name = node.kind === 163 /* SyntaxKind.QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined; + return name && name.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? 7 /* SemanticMeaning.All */ : 4 /* SemanticMeaning.Namespace */; } function isInRightSideOfInternalImportEqualsDeclaration(node) { - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; @@ -128050,27 +129179,27 @@ var ts; function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 161 /* SyntaxKind.QualifiedName */) { - while (root.parent && root.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + if (root.parent.kind === 163 /* SyntaxKind.QualifiedName */) { + while (root.parent && root.parent.kind === 163 /* SyntaxKind.QualifiedName */) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 178 /* SyntaxKind.TypeReference */ && !isLastClause; + return root.parent.kind === 180 /* SyntaxKind.TypeReference */ && !isLastClause; } function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (root.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && root.parent.parent.kind === 291 /* SyntaxKind.HeritageClause */) { + if (!isLastClause && root.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && root.parent.parent.kind === 294 /* SyntaxKind.HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 257 /* SyntaxKind.ClassDeclaration */ && root.parent.parent.token === 117 /* SyntaxKind.ImplementsKeyword */) || - (decl.kind === 258 /* SyntaxKind.InterfaceDeclaration */ && root.parent.parent.token === 94 /* SyntaxKind.ExtendsKeyword */); + return (decl.kind === 260 /* SyntaxKind.ClassDeclaration */ && root.parent.parent.token === 117 /* SyntaxKind.ImplementsKeyword */) || + (decl.kind === 261 /* SyntaxKind.InterfaceDeclaration */ && root.parent.parent.token === 94 /* SyntaxKind.ExtendsKeyword */); } return false; } @@ -128081,15 +129210,15 @@ var ts; switch (node.kind) { case 108 /* SyntaxKind.ThisKeyword */: return !ts.isExpressionNode(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return true; } switch (node.parent.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return true; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return !node.parent.isTypeOf; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isPartOfTypeNode(node.parent); } return false; @@ -128156,7 +129285,7 @@ var ts; ts.climbPastPropertyOrElementAccess = climbPastPropertyOrElementAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 250 /* SyntaxKind.LabeledStatement */ && referenceNode.label.escapedText === labelName) { + if (referenceNode.kind === 253 /* SyntaxKind.LabeledStatement */ && referenceNode.label.escapedText === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -128217,22 +129346,22 @@ var ts; ts.isNameOfFunctionDeclaration = isNameOfFunctionDeclaration; function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { switch (node.parent.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 299 /* SyntaxKind.EnumMember */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 302 /* SyntaxKind.EnumMember */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.getNameOfDeclaration(node.parent) === node; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return node.parent.argumentExpression === node; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return true; - case 196 /* SyntaxKind.LiteralType */: - return node.parent.parent.kind === 194 /* SyntaxKind.IndexedAccessType */; + case 198 /* SyntaxKind.LiteralType */: + return node.parent.parent.kind === 196 /* SyntaxKind.IndexedAccessType */; default: return false; } @@ -128256,17 +129385,17 @@ var ts; return undefined; } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return node; } } @@ -128274,56 +129403,56 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return ts.isExternalModule(node) ? "module" /* ScriptElementKind.moduleElement */ : "script" /* ScriptElementKind.scriptElement */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return "module" /* ScriptElementKind.moduleElement */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return "class" /* ScriptElementKind.classElement */; - case 258 /* SyntaxKind.InterfaceDeclaration */: return "interface" /* ScriptElementKind.interfaceElement */; - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return "interface" /* ScriptElementKind.interfaceElement */; + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return "type" /* ScriptElementKind.typeElement */; - case 260 /* SyntaxKind.EnumDeclaration */: return "enum" /* ScriptElementKind.enumElement */; - case 254 /* SyntaxKind.VariableDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return "enum" /* ScriptElementKind.enumElement */; + case 257 /* SyntaxKind.VariableDeclaration */: return getKindOfVariableDeclaration(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return "function" /* ScriptElementKind.functionElement */; - case 172 /* SyntaxKind.GetAccessor */: return "getter" /* ScriptElementKind.memberGetAccessorElement */; - case 173 /* SyntaxKind.SetAccessor */: return "setter" /* ScriptElementKind.memberSetAccessorElement */; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: return "getter" /* ScriptElementKind.memberGetAccessorElement */; + case 175 /* SyntaxKind.SetAccessor */: return "setter" /* ScriptElementKind.memberSetAccessorElement */; + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return "method" /* ScriptElementKind.memberFunctionElement */; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: var initializer = node.initializer; return ts.isFunctionLike(initializer) ? "method" /* ScriptElementKind.memberFunctionElement */ : "property" /* ScriptElementKind.memberVariableElement */; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return "property" /* ScriptElementKind.memberVariableElement */; - case 176 /* SyntaxKind.IndexSignature */: return "index" /* ScriptElementKind.indexSignatureElement */; - case 175 /* SyntaxKind.ConstructSignature */: return "construct" /* ScriptElementKind.constructSignatureElement */; - case 174 /* SyntaxKind.CallSignature */: return "call" /* ScriptElementKind.callSignatureElement */; - case 171 /* SyntaxKind.Constructor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: return "index" /* ScriptElementKind.indexSignatureElement */; + case 177 /* SyntaxKind.ConstructSignature */: return "construct" /* ScriptElementKind.constructSignatureElement */; + case 176 /* SyntaxKind.CallSignature */: return "call" /* ScriptElementKind.callSignatureElement */; + case 173 /* SyntaxKind.Constructor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return "constructor" /* ScriptElementKind.constructorImplementationElement */; - case 163 /* SyntaxKind.TypeParameter */: return "type parameter" /* ScriptElementKind.typeParameterElement */; - case 299 /* SyntaxKind.EnumMember */: return "enum member" /* ScriptElementKind.enumMemberElement */; - case 164 /* SyntaxKind.Parameter */: return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) ? "property" /* ScriptElementKind.memberVariableElement */ : "parameter" /* ScriptElementKind.parameterElement */; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: - case 274 /* SyntaxKind.NamespaceExport */: + case 165 /* SyntaxKind.TypeParameter */: return "type parameter" /* ScriptElementKind.typeParameterElement */; + case 302 /* SyntaxKind.EnumMember */: return "enum member" /* ScriptElementKind.enumMemberElement */; + case 166 /* SyntaxKind.Parameter */: return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) ? "property" /* ScriptElementKind.memberVariableElement */ : "parameter" /* ScriptElementKind.parameterElement */; + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: + case 277 /* SyntaxKind.NamespaceExport */: return "alias" /* ScriptElementKind.alias */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var kind = ts.getAssignmentDeclarationKind(node); var right = node.right; switch (kind) { @@ -128352,7 +129481,7 @@ var ts; } case 79 /* SyntaxKind.Identifier */: return ts.isImportClause(node.parent) ? "alias" /* ScriptElementKind.alias */ : "" /* ScriptElementKind.unknown */; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: var scriptKind = getNodeKind(node.expression); // If the expression didn't come back with something (like it does for an identifiers) return scriptKind === "" /* ScriptElementKind.unknown */ ? "const" /* ScriptElementKind.constElement */ : scriptKind; @@ -128375,7 +129504,7 @@ var ts; return true; case 79 /* SyntaxKind.Identifier */: // 'this' as a parameter - return ts.identifierIsThisKeyword(node) && node.parent.kind === 164 /* SyntaxKind.Parameter */; + return ts.identifierIsThisKeyword(node) && node.parent.kind === 166 /* SyntaxKind.Parameter */; default: return false; } @@ -128440,42 +129569,42 @@ var ts; return false; } switch (n.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 182 /* SyntaxKind.TypeLiteral */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - case 263 /* SyntaxKind.CaseBlock */: - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 184 /* SyntaxKind.TypeLiteral */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: + case 266 /* SyntaxKind.CaseBlock */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return nodeEndsWith(n, 19 /* SyntaxKind.CloseBraceToken */, sourceFile); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return isCompletedNode(n.block, sourceFile); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: if (!n.arguments) { return true; } // falls through - case 208 /* SyntaxKind.CallExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 191 /* SyntaxKind.ParenthesizedType */: + case 210 /* SyntaxKind.CallExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 193 /* SyntaxKind.ParenthesizedType */: return nodeEndsWith(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return isCompletedNode(n.type, sourceFile); - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 214 /* SyntaxKind.ArrowFunction */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 216 /* SyntaxKind.ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -128485,65 +129614,65 @@ var ts; // Even though type parameters can be unclosed, we can get away with // having at least a closing paren. return hasChildOfKind(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return !!n.body && isCompletedNode(n.body, sourceFile); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 26 /* SyntaxKind.SemicolonToken */, sourceFile); - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 162 /* SyntaxKind.ComputedPropertyName */: - case 184 /* SyntaxKind.TupleType */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 164 /* SyntaxKind.ComputedPropertyName */: + case 186 /* SyntaxKind.TupleType */: return nodeEndsWith(n, 23 /* SyntaxKind.CloseBracketToken */, sourceFile); - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 23 /* SyntaxKind.CloseBracketToken */, sourceFile); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed return false; - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; return hasChildOfKind(n, 115 /* SyntaxKind.WhileKeyword */, sourceFile) ? nodeEndsWith(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile) : isCompletedNode(n.statement, sourceFile); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 216 /* SyntaxKind.TypeOfExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 224 /* SyntaxKind.YieldExpression */: - case 225 /* SyntaxKind.SpreadElement */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 226 /* SyntaxKind.YieldExpression */: + case 227 /* SyntaxKind.SpreadElement */: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 272 /* SyntaxKind.ExportDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.nodeIsPresent(n.moduleSpecifier); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -128668,13 +129797,13 @@ var ts; function getAdjustedLocationForDeclaration(node, forRename) { if (!forRename) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return getAdjustedLocationForClass(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return getAdjustedLocationForFunction(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return node; } } @@ -128769,11 +129898,11 @@ var ts; node.kind === 98 /* SyntaxKind.FunctionKeyword */ ? ts.isFunctionDeclaration(parent) || ts.isFunctionExpression(node) : node.kind === 118 /* SyntaxKind.InterfaceKeyword */ ? ts.isInterfaceDeclaration(parent) : node.kind === 92 /* SyntaxKind.EnumKeyword */ ? ts.isEnumDeclaration(parent) : - node.kind === 152 /* SyntaxKind.TypeKeyword */ ? ts.isTypeAliasDeclaration(parent) : - node.kind === 142 /* SyntaxKind.NamespaceKeyword */ || node.kind === 141 /* SyntaxKind.ModuleKeyword */ ? ts.isModuleDeclaration(parent) : + node.kind === 154 /* SyntaxKind.TypeKeyword */ ? ts.isTypeAliasDeclaration(parent) : + node.kind === 143 /* SyntaxKind.NamespaceKeyword */ || node.kind === 142 /* SyntaxKind.ModuleKeyword */ ? ts.isModuleDeclaration(parent) : node.kind === 100 /* SyntaxKind.ImportKeyword */ ? ts.isImportEqualsDeclaration(parent) : - node.kind === 136 /* SyntaxKind.GetKeyword */ ? ts.isGetAccessorDeclaration(parent) : - node.kind === 149 /* SyntaxKind.SetKeyword */ && ts.isSetAccessorDeclaration(parent)) { + node.kind === 137 /* SyntaxKind.GetKeyword */ ? ts.isGetAccessorDeclaration(parent) : + node.kind === 151 /* SyntaxKind.SetKeyword */ && ts.isSetAccessorDeclaration(parent)) { var location = getAdjustedLocationForDeclaration(parent, forRename); if (location) { return location; @@ -128787,7 +129916,7 @@ var ts; return decl.name; } } - if (node.kind === 152 /* SyntaxKind.TypeKeyword */) { + if (node.kind === 154 /* SyntaxKind.TypeKeyword */) { // import /**/type [|name|] from ...; // import /**/type { [|name|] } from ...; // import /**/type { propertyName as [|name|] } from ...; @@ -128813,7 +129942,7 @@ var ts; // import * /**/as [|name|] ... // export { propertyName /**/as [|name|] } ... // export * /**/as [|name|] ... - if (node.kind === 127 /* SyntaxKind.AsKeyword */) { + if (node.kind === 128 /* SyntaxKind.AsKeyword */) { if (ts.isImportSpecifier(parent) && parent.propertyName || ts.isExportSpecifier(parent) && parent.propertyName || ts.isNamespaceImport(parent) || @@ -128854,12 +129983,12 @@ var ts; } } // import name = /**/require("[|module|]"); - if (node.kind === 146 /* SyntaxKind.RequireKeyword */ && ts.isExternalModuleReference(parent)) { + if (node.kind === 147 /* SyntaxKind.RequireKeyword */ && ts.isExternalModuleReference(parent)) { return parent.expression; } // import ... /**/from "[|module|]"; // export ... /**/from "[|module|]"; - if (node.kind === 156 /* SyntaxKind.FromKeyword */ && (ts.isImportDeclaration(parent) || ts.isExportDeclaration(parent)) && parent.moduleSpecifier) { + if (node.kind === 158 /* SyntaxKind.FromKeyword */ && (ts.isImportDeclaration(parent) || ts.isExportDeclaration(parent)) && parent.moduleSpecifier) { return parent.moduleSpecifier; } // class ... /**/extends [|name|] ... @@ -128884,7 +130013,7 @@ var ts; } } // ... T extends /**/infer [|U|] ? ... - if (node.kind === 137 /* SyntaxKind.InferKeyword */ && ts.isInferTypeNode(parent)) { + if (node.kind === 138 /* SyntaxKind.InferKeyword */ && ts.isInferTypeNode(parent)) { return parent.typeParameter.name; } // { [ [|K|] /**/in keyof T]: ... } @@ -128892,12 +130021,12 @@ var ts; return parent.name; } // /**/keyof [|T|] - if (node.kind === 140 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 140 /* SyntaxKind.KeyOfKeyword */ && + if (node.kind === 141 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 141 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeReferenceNode(parent.type)) { return parent.type.typeName; } // /**/readonly [|name|][] - if (node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 145 /* SyntaxKind.ReadonlyKeyword */ && + if (node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isArrayTypeNode(parent.type) && ts.isTypeReferenceNode(parent.type.elementType)) { return parent.type.elementType.typeName; } @@ -128915,7 +130044,7 @@ var ts; if (node.kind === 103 /* SyntaxKind.NewKeyword */ && ts.isNewExpression(parent) || node.kind === 114 /* SyntaxKind.VoidKeyword */ && ts.isVoidExpression(parent) || node.kind === 112 /* SyntaxKind.TypeOfKeyword */ && ts.isTypeOfExpression(parent) || - node.kind === 132 /* SyntaxKind.AwaitKeyword */ && ts.isAwaitExpression(parent) || + node.kind === 133 /* SyntaxKind.AwaitKeyword */ && ts.isAwaitExpression(parent) || node.kind === 125 /* SyntaxKind.YieldKeyword */ && ts.isYieldExpression(parent) || node.kind === 89 /* SyntaxKind.DeleteKeyword */ && ts.isDeleteExpression(parent)) { if (parent.expression) { @@ -128928,13 +130057,13 @@ var ts; return ts.skipOuterExpressions(parent.right); } // left /**/as [|name|] - if (node.kind === 127 /* SyntaxKind.AsKeyword */ && ts.isAsExpression(parent) && ts.isTypeReferenceNode(parent.type)) { + if (node.kind === 128 /* SyntaxKind.AsKeyword */ && ts.isAsExpression(parent) && ts.isTypeReferenceNode(parent.type)) { return parent.type.typeName; } // for (... /**/in [|name|]) // for (... /**/of [|name|]) if (node.kind === 101 /* SyntaxKind.InKeyword */ && ts.isForInStatement(parent) || - node.kind === 160 /* SyntaxKind.OfKeyword */ && ts.isForOfStatement(parent)) { + node.kind === 162 /* SyntaxKind.OfKeyword */ && ts.isForOfStatement(parent)) { return ts.skipOuterExpressions(parent.expression); } } @@ -129166,7 +130295,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 305 /* SyntaxKind.SourceFile */ || n.kind === 1 /* SyntaxKind.EndOfFileToken */ || ts.isJSDocCommentContainingNode(n)); + ts.Debug.assert(startNode !== undefined || n.kind === 308 /* SyntaxKind.SourceFile */ || n.kind === 1 /* SyntaxKind.EndOfFileToken */ || ts.isJSDocCommentContainingNode(n)); // Here we know that none of child token nodes embrace the position, // the only known case is when position is at the end of the file. // Try to find the rightmost token in the file without filtering. @@ -129197,7 +130326,7 @@ var ts; for (var i = exclusiveStartPosition - 1; i >= 0; i--) { var child = children[i]; if (isWhiteSpaceOnlyJsxText(child)) { - if (i === 0 && (parentKind === 11 /* SyntaxKind.JsxText */ || parentKind === 279 /* SyntaxKind.JsxSelfClosingElement */)) { + if (i === 0 && (parentKind === 11 /* SyntaxKind.JsxText */ || parentKind === 282 /* SyntaxKind.JsxSelfClosingElement */)) { ts.Debug.fail("`JsxText` tokens should not be the first child of `JsxElement | JsxSelfClosingElement`"); } } @@ -129241,17 +130370,17 @@ var ts; return true; } //
{ |
or
- if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 288 /* SyntaxKind.JsxExpression */) { + if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 291 /* SyntaxKind.JsxExpression */) { return true; } //
{ // | // } < /div> - if (token && token.kind === 19 /* SyntaxKind.CloseBraceToken */ && token.parent.kind === 288 /* SyntaxKind.JsxExpression */) { + if (token && token.kind === 19 /* SyntaxKind.CloseBraceToken */ && token.parent.kind === 291 /* SyntaxKind.JsxExpression */) { return true; } //
|
- if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 281 /* SyntaxKind.JsxClosingElement */) { + if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 284 /* SyntaxKind.JsxClosingElement */) { return true; } return false; @@ -129282,7 +130411,7 @@ var ts; function isInsideJsxElement(sourceFile, position) { function isInsideJsxElementTraversal(node) { while (node) { - if (node.kind >= 279 /* SyntaxKind.JsxSelfClosingElement */ && node.kind <= 288 /* SyntaxKind.JsxExpression */ + if (node.kind >= 282 /* SyntaxKind.JsxSelfClosingElement */ && node.kind <= 291 /* SyntaxKind.JsxExpression */ || node.kind === 11 /* SyntaxKind.JsxText */ || node.kind === 29 /* SyntaxKind.LessThanToken */ || node.kind === 31 /* SyntaxKind.GreaterThanToken */ @@ -129292,7 +130421,7 @@ var ts; || node.kind === 43 /* SyntaxKind.SlashToken */) { node = node.parent; } - else if (node.kind === 278 /* SyntaxKind.JsxElement */) { + else if (node.kind === 281 /* SyntaxKind.JsxElement */) { if (position > node.getStart(sourceFile)) return true; node = node.parent; @@ -129440,7 +130569,7 @@ var ts; // falls through case 112 /* SyntaxKind.TypeOfKeyword */: case 94 /* SyntaxKind.ExtendsKeyword */: - case 140 /* SyntaxKind.KeyOfKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: case 24 /* SyntaxKind.DotToken */: case 51 /* SyntaxKind.BarToken */: case 57 /* SyntaxKind.QuestionToken */: @@ -129461,7 +130590,7 @@ var ts; /** * Returns true if the cursor at position in sourceFile is within a comment. * - * @param tokenAtPosition Must equal `getTokenAtPosition(sourceFile, position) + * @param tokenAtPosition Must equal `getTokenAtPosition(sourceFile, position)` * @param predicate Additional predicate to test on the comment range. */ function isInComment(sourceFile, position, tokenAtPosition) { @@ -129492,7 +130621,7 @@ var ts; result.push("public" /* ScriptElementKindModifier.publicMemberModifier */); if (flags & 32 /* ModifierFlags.Static */ || ts.isClassStaticBlockDeclaration(node)) result.push("static" /* ScriptElementKindModifier.staticModifier */); - if (flags & 128 /* ModifierFlags.Abstract */) + if (flags & 256 /* ModifierFlags.Abstract */) result.push("abstract" /* ScriptElementKindModifier.abstractModifier */); if (flags & 1 /* ModifierFlags.Export */) result.push("export" /* ScriptElementKindModifier.exportedModifier */); @@ -129500,16 +130629,16 @@ var ts; result.push("deprecated" /* ScriptElementKindModifier.deprecatedModifier */); if (node.flags & 16777216 /* NodeFlags.Ambient */) result.push("declare" /* ScriptElementKindModifier.ambientModifier */); - if (node.kind === 271 /* SyntaxKind.ExportAssignment */) + if (node.kind === 274 /* SyntaxKind.ExportAssignment */) result.push("export" /* ScriptElementKindModifier.exportedModifier */); return result.length > 0 ? result.join(",") : "" /* ScriptElementKindModifier.none */; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 210 /* SyntaxKind.CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return node.typeParameters; } return undefined; @@ -129554,18 +130683,18 @@ var ts; } ts.cloneCompilerOptions = cloneCompilerOptions; function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || - node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || + node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // [a,b,c] from: // [a, b, c] = someExpression; - if (node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + if (node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && node.parent.left === node && node.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { return true; } // [a, b, c] from: // for([a, b, c] of expression) - if (node.parent.kind === 244 /* SyntaxKind.ForOfStatement */ && + if (node.parent.kind === 247 /* SyntaxKind.ForOfStatement */ && node.parent.initializer === node) { return true; } @@ -129573,7 +130702,7 @@ var ts; // [x, [a, b, c] ] = someExpression // or // {x, a: {a, b, c} } = someExpression - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ ? node.parent.parent : node.parent)) { return true; } } @@ -129635,32 +130764,32 @@ var ts; } ts.createTextChange = createTextChange; ts.typeKeywords = [ - 130 /* SyntaxKind.AnyKeyword */, - 128 /* SyntaxKind.AssertsKeyword */, - 158 /* SyntaxKind.BigIntKeyword */, - 133 /* SyntaxKind.BooleanKeyword */, + 131 /* SyntaxKind.AnyKeyword */, + 129 /* SyntaxKind.AssertsKeyword */, + 160 /* SyntaxKind.BigIntKeyword */, + 134 /* SyntaxKind.BooleanKeyword */, 95 /* SyntaxKind.FalseKeyword */, - 137 /* SyntaxKind.InferKeyword */, - 140 /* SyntaxKind.KeyOfKeyword */, - 143 /* SyntaxKind.NeverKeyword */, + 138 /* SyntaxKind.InferKeyword */, + 141 /* SyntaxKind.KeyOfKeyword */, + 144 /* SyntaxKind.NeverKeyword */, 104 /* SyntaxKind.NullKeyword */, - 147 /* SyntaxKind.NumberKeyword */, - 148 /* SyntaxKind.ObjectKeyword */, - 145 /* SyntaxKind.ReadonlyKeyword */, - 150 /* SyntaxKind.StringKeyword */, - 151 /* SyntaxKind.SymbolKeyword */, + 148 /* SyntaxKind.NumberKeyword */, + 149 /* SyntaxKind.ObjectKeyword */, + 146 /* SyntaxKind.ReadonlyKeyword */, + 152 /* SyntaxKind.StringKeyword */, + 153 /* SyntaxKind.SymbolKeyword */, 110 /* SyntaxKind.TrueKeyword */, 114 /* SyntaxKind.VoidKeyword */, - 153 /* SyntaxKind.UndefinedKeyword */, - 154 /* SyntaxKind.UniqueKeyword */, - 155 /* SyntaxKind.UnknownKeyword */, + 155 /* SyntaxKind.UndefinedKeyword */, + 156 /* SyntaxKind.UniqueKeyword */, + 157 /* SyntaxKind.UnknownKeyword */, ]; function isTypeKeyword(kind) { return ts.contains(ts.typeKeywords, kind); } ts.isTypeKeyword = isTypeKeyword; function isTypeKeywordToken(node) { - return node.kind === 152 /* SyntaxKind.TypeKeyword */; + return node.kind === 154 /* SyntaxKind.TypeKeyword */; } ts.isTypeKeywordToken = isTypeKeywordToken; function isTypeKeywordTokenOrIdentifier(node) { @@ -129697,7 +130826,7 @@ var ts; } ts.skipConstraint = skipConstraint; function getNameFromPropertyName(name) { - return name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + return name.kind === 164 /* SyntaxKind.ComputedPropertyName */ // treat computed property names where expression is string/numeric literal as just string/numeric literal ? ts.isStringOrNumericLiteralLike(name.expression) ? name.expression.text : undefined : ts.isPrivateIdentifier(name) ? ts.idText(name) : ts.getTextOfIdentifierOrLiteral(name); @@ -129847,7 +130976,7 @@ var ts; ts.findModifier = findModifier; function insertImports(changes, sourceFile, imports, blankLineBetween) { var decl = ts.isArray(imports) ? imports[0] : imports; - var importKindPredicate = decl.kind === 237 /* SyntaxKind.VariableStatement */ ? ts.isRequireVariableStatement : ts.isAnyImportSyntax; + var importKindPredicate = decl.kind === 240 /* SyntaxKind.VariableStatement */ ? ts.isRequireVariableStatement : ts.isAnyImportSyntax; var existingImportStatements = ts.filter(sourceFile.statements, importKindPredicate); var sortedNewImports = ts.isArray(imports) ? ts.stableSort(imports, ts.OrganizeImports.compareImportsOrRequireStatements) : [imports]; if (!existingImportStatements.length) { @@ -130521,15 +131650,15 @@ var ts; function getContextualTypeFromParent(node, checker) { var parent = node.parent; switch (parent.kind) { - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return checker.getContextualType(parent); - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var _a = parent, left = _a.left, operatorToken = _a.operatorToken, right = _a.right; return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node); } - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return parent.expression === node ? getSwitchedType(parent, checker) : undefined; default: return checker.getContextualType(node); @@ -130559,8 +131688,8 @@ var ts; switch (node.kind) { case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return true; default: return false; @@ -130594,38 +131723,38 @@ var ts; } ts.getTypeNodeIfAccessible = getTypeNodeIfAccessible; function syntaxRequiresTrailingCommaOrSemicolonOrASI(kind) { - return kind === 174 /* SyntaxKind.CallSignature */ - || kind === 175 /* SyntaxKind.ConstructSignature */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 168 /* SyntaxKind.MethodSignature */; + return kind === 176 /* SyntaxKind.CallSignature */ + || kind === 177 /* SyntaxKind.ConstructSignature */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 170 /* SyntaxKind.MethodSignature */; } function syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI(kind) { - return kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function syntaxRequiresTrailingModuleBlockOrSemicolonOrASI(kind) { - return kind === 261 /* SyntaxKind.ModuleDeclaration */; + return kind === 264 /* SyntaxKind.ModuleDeclaration */; } function syntaxRequiresTrailingSemicolonOrASI(kind) { - return kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 238 /* SyntaxKind.ExpressionStatement */ - || kind === 240 /* SyntaxKind.DoStatement */ - || kind === 245 /* SyntaxKind.ContinueStatement */ - || kind === 246 /* SyntaxKind.BreakStatement */ - || kind === 247 /* SyntaxKind.ReturnStatement */ - || kind === 251 /* SyntaxKind.ThrowStatement */ - || kind === 253 /* SyntaxKind.DebuggerStatement */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */; + return kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 241 /* SyntaxKind.ExpressionStatement */ + || kind === 243 /* SyntaxKind.DoStatement */ + || kind === 248 /* SyntaxKind.ContinueStatement */ + || kind === 249 /* SyntaxKind.BreakStatement */ + || kind === 250 /* SyntaxKind.ReturnStatement */ + || kind === 254 /* SyntaxKind.ThrowStatement */ + || kind === 256 /* SyntaxKind.DebuggerStatement */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */; } ts.syntaxRequiresTrailingSemicolonOrASI = syntaxRequiresTrailingSemicolonOrASI; ts.syntaxMayBeASICandidate = ts.or(syntaxRequiresTrailingCommaOrSemicolonOrASI, syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI, syntaxRequiresTrailingModuleBlockOrSemicolonOrASI, syntaxRequiresTrailingSemicolonOrASI); @@ -130655,7 +131784,7 @@ var ts; return false; } // See comment in parser’s `parseDoStatement` - if (node.kind === 240 /* SyntaxKind.DoStatement */) { + if (node.kind === 243 /* SyntaxKind.DoStatement */) { return true; } var topNode = ts.findAncestor(node, function (ancestor) { return !ancestor.parent; }); @@ -131259,14 +132388,16 @@ var ts; search: function (importingFile, preferCapitalized, matches, action) { if (importingFile !== usableByFileName) return; - exportInfo.forEach(function (info, key) { + return ts.forEachEntry(exportInfo, function (info, key) { var _a = parseKey(key), symbolName = _a.symbolName, ambientModuleName = _a.ambientModuleName; var name = preferCapitalized && info[0].capitalizedSymbolName || symbolName; if (matches(name, info[0].targetFlags)) { var rehydrated = info.map(rehydrateCachedInfo); var filtered = rehydrated.filter(function (r, i) { return isNotShadowedByDeeperNodeModulesPackage(r, info[i].packageName); }); if (filtered.length) { - action(filtered, name, !!ambientModuleName, key); + var res = action(filtered, name, !!ambientModuleName, key); + if (res !== undefined) + return res; } } }); @@ -131654,11 +132785,11 @@ var ts; angleBracketStack--; } break; - case 130 /* SyntaxKind.AnyKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: if (angleBracketStack > 0 && !syntacticClassifierAbsent) { // If it looks like we're could be in something generic, don't classify this // as a keyword. We may just get overwritten by the syntactic classifier, @@ -131847,10 +132978,11 @@ var ts; return true; } switch (keyword2) { - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - case 134 /* SyntaxKind.ConstructorKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: return true; // Allow things like "public get", "public constructor" and "public static". default: return false; // Any other keyword following "public" is actually an identifier, not a real keyword. @@ -131897,7 +133029,8 @@ var ts; case 33 /* SyntaxKind.GreaterThanEqualsToken */: case 102 /* SyntaxKind.InstanceOfKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: + case 150 /* SyntaxKind.SatisfiesKeyword */: case 34 /* SyntaxKind.EqualsEqualsToken */: case 35 /* SyntaxKind.ExclamationEqualsToken */: case 36 /* SyntaxKind.EqualsEqualsEqualsToken */: @@ -131993,13 +133126,13 @@ var ts; // That means we're calling back into the host around every 1.2k of the file we process. // Lib.d.ts has similar numbers. switch (kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } } @@ -132221,46 +133354,46 @@ var ts; pos = tag.tagName.end; var commentStart = tag.tagName.end; switch (tag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: var param = tag; processJSDocParameterTag(param); commentStart = param.isNameFirst && ((_a = param.typeExpression) === null || _a === void 0 ? void 0 : _a.end) || param.name.end; break; - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: var prop = tag; commentStart = prop.isNameFirst && ((_b = prop.typeExpression) === null || _b === void 0 ? void 0 : _b.end) || prop.name.end; break; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: processJSDocTemplateTag(tag); pos = tag.end; commentStart = tag.typeParameters.end; break; - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: var type = tag; - commentStart = ((_c = type.typeExpression) === null || _c === void 0 ? void 0 : _c.kind) === 309 /* SyntaxKind.JSDocTypeExpression */ && ((_d = type.fullName) === null || _d === void 0 ? void 0 : _d.end) || ((_e = type.typeExpression) === null || _e === void 0 ? void 0 : _e.end) || commentStart; + commentStart = ((_c = type.typeExpression) === null || _c === void 0 ? void 0 : _c.kind) === 312 /* SyntaxKind.JSDocTypeExpression */ && ((_d = type.fullName) === null || _d === void 0 ? void 0 : _d.end) || ((_e = type.typeExpression) === null || _e === void 0 ? void 0 : _e.end) || commentStart; break; - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: commentStart = tag.typeExpression.end; break; - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: processElement(tag.typeExpression); pos = tag.end; commentStart = tag.typeExpression.end; break; - case 342 /* SyntaxKind.JSDocThisTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 345 /* SyntaxKind.JSDocThisTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: commentStart = tag.typeExpression.end; break; - case 341 /* SyntaxKind.JSDocReturnTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: processElement(tag.typeExpression); pos = tag.end; commentStart = ((_f = tag.typeExpression) === null || _f === void 0 ? void 0 : _f.end) || commentStart; break; - case 346 /* SyntaxKind.JSDocSeeTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: commentStart = ((_g = tag.name) === null || _g === void 0 ? void 0 : _g.end) || commentStart; break; - case 328 /* SyntaxKind.JSDocAugmentsTag */: - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: commentStart = tag.class.end; break; } @@ -132307,7 +133440,7 @@ var ts; // defined in `ts.commentPragmas` would be excessive, but we can avoid // some obvious false positives (e.g. in XML-like doc comments) by // checking the element name. - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (!match[3] || !(match[3] in ts.commentPragmas)) { return false; } @@ -132417,22 +133550,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: if (token.parent.tagName === token) { return 19 /* ClassificationType.jsxOpenTagName */; } break; - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: if (token.parent.tagName === token) { return 20 /* ClassificationType.jsxCloseTagName */; } break; - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: if (token.parent.tagName === token) { return 21 /* ClassificationType.jsxSelfClosingTagName */; } break; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: if (token.parent.name === token) { return 22 /* ClassificationType.jsxAttribute */; } @@ -132461,17 +133594,17 @@ var ts; var parent = token.parent; if (tokenKind === 63 /* SyntaxKind.EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (parent.kind === 254 /* SyntaxKind.VariableDeclaration */ || - parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - parent.kind === 164 /* SyntaxKind.Parameter */ || - parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + if (parent.kind === 257 /* SyntaxKind.VariableDeclaration */ || + parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + parent.kind === 166 /* SyntaxKind.Parameter */ || + parent.kind === 288 /* SyntaxKind.JsxAttribute */) { return 5 /* ClassificationType.operator */; } } - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ || - parent.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || - parent.kind === 220 /* SyntaxKind.PostfixUnaryExpression */ || - parent.kind === 222 /* SyntaxKind.ConditionalExpression */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ || + parent.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || + parent.kind === 222 /* SyntaxKind.PostfixUnaryExpression */ || + parent.kind === 224 /* SyntaxKind.ConditionalExpression */) { return 5 /* ClassificationType.operator */; } } @@ -132484,7 +133617,7 @@ var ts; return 25 /* ClassificationType.bigintLiteral */; } else if (tokenKind === 10 /* SyntaxKind.StringLiteral */) { - return token && token.parent.kind === 285 /* SyntaxKind.JsxAttribute */ ? 24 /* ClassificationType.jsxAttributeStringLiteralValue */ : 6 /* ClassificationType.stringLiteral */; + return token && token.parent.kind === 288 /* SyntaxKind.JsxAttribute */ ? 24 /* ClassificationType.jsxAttributeStringLiteralValue */ : 6 /* ClassificationType.stringLiteral */; } else if (tokenKind === 13 /* SyntaxKind.RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. @@ -132500,32 +133633,32 @@ var ts; else if (tokenKind === 79 /* SyntaxKind.Identifier */) { if (token) { switch (token.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: if (token.parent.name === token) { return 11 /* ClassificationType.className */; } return; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: if (token.parent.name === token) { return 15 /* ClassificationType.typeParameterName */; } return; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* ClassificationType.interfaceName */; } return; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (token.parent.name === token) { return 12 /* ClassificationType.enumName */; } return; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (token.parent.name === token) { return 14 /* ClassificationType.moduleName */; } return; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: if (token.parent.name === token) { return ts.isThisIdentifier(token) ? 3 /* ClassificationType.keyword */ : 17 /* ClassificationType.parameterName */; } @@ -132630,13 +133763,13 @@ var ts; var inJSXElement = false; function visit(node) { switch (node.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } if (!node || !ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth()) || node.getFullWidth() === 0) { @@ -132676,7 +133809,7 @@ var ts; if (modifiers & 32 /* ModifierFlags.Static */) { modifierSet |= 1 << 1 /* TokenModifier.static */; } - if (modifiers & 256 /* ModifierFlags.Async */) { + if (modifiers & 512 /* ModifierFlags.Async */) { modifierSet |= 1 << 2 /* TokenModifier.async */; } if (typeIdx !== 0 /* TokenType.class */ && typeIdx !== 2 /* TokenType.interface */) { @@ -132782,25 +133915,25 @@ var ts; return (ts.isQualifiedName(node.parent) && node.parent.right === node) || (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node); } var tokenFromDeclarationMapping = new ts.Map([ - [254 /* SyntaxKind.VariableDeclaration */, 7 /* TokenType.variable */], - [164 /* SyntaxKind.Parameter */, 6 /* TokenType.parameter */], - [167 /* SyntaxKind.PropertyDeclaration */, 9 /* TokenType.property */], - [261 /* SyntaxKind.ModuleDeclaration */, 3 /* TokenType.namespace */], - [260 /* SyntaxKind.EnumDeclaration */, 1 /* TokenType.enum */], - [299 /* SyntaxKind.EnumMember */, 8 /* TokenType.enumMember */], - [257 /* SyntaxKind.ClassDeclaration */, 0 /* TokenType.class */], - [169 /* SyntaxKind.MethodDeclaration */, 11 /* TokenType.member */], - [256 /* SyntaxKind.FunctionDeclaration */, 10 /* TokenType.function */], - [213 /* SyntaxKind.FunctionExpression */, 10 /* TokenType.function */], - [168 /* SyntaxKind.MethodSignature */, 11 /* TokenType.member */], - [172 /* SyntaxKind.GetAccessor */, 9 /* TokenType.property */], - [173 /* SyntaxKind.SetAccessor */, 9 /* TokenType.property */], - [166 /* SyntaxKind.PropertySignature */, 9 /* TokenType.property */], - [258 /* SyntaxKind.InterfaceDeclaration */, 2 /* TokenType.interface */], - [259 /* SyntaxKind.TypeAliasDeclaration */, 5 /* TokenType.type */], - [163 /* SyntaxKind.TypeParameter */, 4 /* TokenType.typeParameter */], - [296 /* SyntaxKind.PropertyAssignment */, 9 /* TokenType.property */], - [297 /* SyntaxKind.ShorthandPropertyAssignment */, 9 /* TokenType.property */] + [257 /* SyntaxKind.VariableDeclaration */, 7 /* TokenType.variable */], + [166 /* SyntaxKind.Parameter */, 6 /* TokenType.parameter */], + [169 /* SyntaxKind.PropertyDeclaration */, 9 /* TokenType.property */], + [264 /* SyntaxKind.ModuleDeclaration */, 3 /* TokenType.namespace */], + [263 /* SyntaxKind.EnumDeclaration */, 1 /* TokenType.enum */], + [302 /* SyntaxKind.EnumMember */, 8 /* TokenType.enumMember */], + [260 /* SyntaxKind.ClassDeclaration */, 0 /* TokenType.class */], + [171 /* SyntaxKind.MethodDeclaration */, 11 /* TokenType.member */], + [259 /* SyntaxKind.FunctionDeclaration */, 10 /* TokenType.function */], + [215 /* SyntaxKind.FunctionExpression */, 10 /* TokenType.function */], + [170 /* SyntaxKind.MethodSignature */, 11 /* TokenType.member */], + [174 /* SyntaxKind.GetAccessor */, 9 /* TokenType.property */], + [175 /* SyntaxKind.SetAccessor */, 9 /* TokenType.property */], + [168 /* SyntaxKind.PropertySignature */, 9 /* TokenType.property */], + [261 /* SyntaxKind.InterfaceDeclaration */, 2 /* TokenType.interface */], + [262 /* SyntaxKind.TypeAliasDeclaration */, 5 /* TokenType.type */], + [165 /* SyntaxKind.TypeParameter */, 4 /* TokenType.typeParameter */], + [299 /* SyntaxKind.PropertyAssignment */, 9 /* TokenType.property */], + [300 /* SyntaxKind.ShorthandPropertyAssignment */, 9 /* TokenType.property */] ]); })(v2020 = classifier.v2020 || (classifier.v2020 = {})); })(classifier = ts.classifier || (ts.classifier = {})); @@ -132934,18 +134067,18 @@ var ts; function getStringLiteralCompletionEntries(sourceFile, node, position, typeChecker, compilerOptions, host, preferences) { var parent = walkUpParentheses(node.parent); switch (parent.kind) { - case 196 /* SyntaxKind.LiteralType */: { + case 198 /* SyntaxKind.LiteralType */: { var grandParent_1 = walkUpParentheses(parent.parent); switch (grandParent_1.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 178 /* SyntaxKind.TypeReference */: { + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: { var typeArgument = ts.findAncestor(parent, function (n) { return n.parent === grandParent_1; }); if (typeArgument) { return { kind: 2 /* StringLiteralCompletionKind.Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(typeArgument)), isNewIdentifier: false }; } return undefined; } - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: // Get all apparent property names // i.e. interface Foo { // foo: string; @@ -132957,9 +134090,9 @@ var ts; return undefined; } return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(objectType)); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return { kind: 0 /* StringLiteralCompletionKind.Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) }; - case 187 /* SyntaxKind.UnionType */: { + case 189 /* SyntaxKind.UnionType */: { if (!ts.isTypeReferenceNode(grandParent_1.parent)) { return undefined; } @@ -132971,7 +134104,7 @@ var ts; return undefined; } } - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (ts.isObjectLiteralExpression(parent.parent) && parent.name === node) { // Get quoted name of properties of the object literal expression // i.e. interface ConfigFiles { @@ -132988,7 +134121,7 @@ var ts; return stringLiteralCompletionsForObjectLiteral(typeChecker, parent.parent); } return fromContextualType(); - case 207 /* SyntaxKind.ElementAccessExpression */: { + case 209 /* SyntaxKind.ElementAccessExpression */: { var _b = parent, expression = _b.expression, argumentExpression = _b.argumentExpression; if (node === ts.skipParentheses(argumentExpression)) { // Get all names of properties on the expression @@ -133001,20 +134134,20 @@ var ts; } return undefined; } - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 285 /* SyntaxKind.JsxAttribute */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 288 /* SyntaxKind.JsxAttribute */: if (!isRequireCallArgument(node) && !ts.isImportCall(parent)) { - var argumentInfo = ts.SignatureHelp.getArgumentInfoForCompletions(parent.kind === 285 /* SyntaxKind.JsxAttribute */ ? parent.parent : node, position, sourceFile); + var argumentInfo = ts.SignatureHelp.getArgumentInfoForCompletions(parent.kind === 288 /* SyntaxKind.JsxAttribute */ ? parent.parent : node, position, sourceFile); // Get string literal completions from specialized signatures of the target // i.e. declare function f(a: 'A'); // f("/*completion position*/") - return argumentInfo ? getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) : fromContextualType(); + return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(); } // falls through (is `require("")` or `require(""` or `import("")`) - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 277 /* SyntaxKind.ExternalModuleReference */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 280 /* SyntaxKind.ExternalModuleReference */: // Get all known external module names or complete a path to a module // i.e. import * as ns from "/*completion position*/"; // var y = import("/*completion position*/"); @@ -133033,9 +134166,9 @@ var ts; } function walkUpParentheses(node) { switch (node.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return ts.walkUpParenthesizedTypes(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return ts.walkUpParenthesizedExpressions(node); default: return node; @@ -133065,7 +134198,7 @@ var ts; isNewIdentifier = isNewIdentifier || !!(type.flags & 4 /* TypeFlags.String */); return getStringLiteralTypes(type, uniques); }); - return { kind: 2 /* StringLiteralCompletionKind.Types */, types: types, isNewIdentifier: isNewIdentifier }; + return ts.length(types) ? { kind: 2 /* StringLiteralCompletionKind.Types */, types: types, isNewIdentifier: isNewIdentifier } : undefined; } function stringLiteralCompletionsFromProperties(type) { return type && { @@ -133583,7 +134716,7 @@ var ts; if (!dependencies) continue; for (var dep in dependencies) { - if (dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, "@types/")) { + if (ts.hasProperty(dependencies, dep) && !ts.startsWith(dep, "@types/")) { result.push(dep); } } @@ -133958,7 +135091,7 @@ var ts; } function keywordFiltersFromSyntaxKind(keywordCompletion) { switch (keywordCompletion) { - case 152 /* SyntaxKind.TypeKeyword */: return 8 /* KeywordCompletionFilters.TypeKeyword */; + case 154 /* SyntaxKind.TypeKeyword */: return 8 /* KeywordCompletionFilters.TypeKeyword */; default: ts.Debug.fail("Unknown mapping from SyntaxKind to KeywordCompletionFilters"); } } @@ -133967,7 +135100,7 @@ var ts; return (location === null || location === void 0 ? void 0 : location.kind) === 79 /* SyntaxKind.Identifier */ ? ts.createTextSpanFromNode(location) : undefined; } function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) { - var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag, importCompletionNode = completionData.importCompletionNode, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports; + var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag, importStatementCompletion = completionData.importStatementCompletion, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports; // Verify if the file is JSX language variant if (ts.getLanguageVariant(sourceFile.scriptKind) === 1 /* LanguageVariant.JSX */) { var completionInfo = getJsxClosingTagCompletion(location, sourceFile); @@ -133981,7 +135114,7 @@ var ts; return undefined; } var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, - /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag); + /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag); if (keywordFilters !== 0 /* KeywordCompletionFilters.None */) { for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) { var keywordEntry = _a[_i]; @@ -134034,12 +135167,12 @@ var ts; // We wanna walk up the tree till we find a JSX closing element var jsxClosingElement = ts.findAncestor(location, function (node) { switch (node.kind) { - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: return true; case 43 /* SyntaxKind.SlashToken */: case 31 /* SyntaxKind.GreaterThanToken */: case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return false; default: return "quit"; @@ -134099,7 +135232,7 @@ var ts; function createCompletionEntryForLiteral(sourceFile, preferences, literal) { return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* ScriptElementKind.string */, kindModifiers: "" /* ScriptElementKindModifier.none */, sortText: Completions.SortText.LocationPriority }; } - function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) { + function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) { var _a, _b; var insertText; var replacementSpan = ts.getReplacementSpanForContextToken(replacementToken); @@ -134155,8 +135288,8 @@ var ts; } if (originIsResolvedExport(origin)) { sourceDisplay = [ts.textPart(origin.moduleSpecifier)]; - if (importCompletionNode) { - (_a = getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, contextToken, origin, useSemicolons, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan); + if (importStatementCompletion) { + (_a = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan); isSnippet = preferences.includeCompletionsWithSnippetText ? true : undefined; } } @@ -134211,7 +135344,7 @@ var ts; } if (originIsExport(origin) || originIsResolvedExport(origin)) { data = originToCompletionEntryData(origin); - hasAction = !importCompletionNode; + hasAction = !importStatementCompletion; } // TODO(drosen): Right now we just permit *all* semantic meanings when calling // 'getSymbolKind' which is permissible given that it is backwards compatible; but @@ -134234,7 +135367,7 @@ var ts; labelDetails: labelDetails, isSnippet: isSnippet, isPackageJsonImport: originIsPackageJsonImport(origin) || undefined, - isImportStatementCompletion: !!importCompletionNode || undefined, + isImportStatementCompletion: !!importStatementCompletion || undefined, data: data, }; } @@ -134313,7 +135446,7 @@ var ts; // Whether the suggested member should be abstract. // e.g. in `abstract class C { abstract | }`, we should offer abstract method signatures at position `|`. var _a = getPresentModifiers(contextToken), presentModifiers = _a.modifiers, modifiersSpan = _a.span; - var isAbstract = !!(presentModifiers & 128 /* ModifierFlags.Abstract */); + var isAbstract = !!(presentModifiers & 256 /* ModifierFlags.Abstract */); var completionNodes = []; ts.codefix.addNewNodeForMemberSymbol(symbol, classLikeDeclaration, sourceFile, { program: program, host: host }, preferences, importAdder, // `addNewNodeForMemberSymbol` calls this callback function for each new member node @@ -134326,7 +135459,7 @@ var ts; function (node) { var requiredModifiers = 0 /* ModifierFlags.None */; if (isAbstract) { - requiredModifiers |= 128 /* ModifierFlags.Abstract */; + requiredModifiers |= 256 /* ModifierFlags.Abstract */; } if (ts.isClassElement(node) && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node) === 1 /* MemberOverrideStatus.NeedsOverride */) { @@ -134387,7 +135520,7 @@ var ts; span = ts.createTextSpanFromNode(contextToken); } if (ts.isPropertyDeclaration(contextToken.parent)) { - modifiers |= ts.modifiersToFlags(contextToken.parent.modifiers) & 125951 /* ModifierFlags.Modifier */; + modifiers |= ts.modifiersToFlags(contextToken.parent.modifiers) & 126975 /* ModifierFlags.Modifier */; span = ts.createTextSpanFromNode(contextToken.parent); } return { modifiers: modifiers, span: span }; @@ -134436,7 +135569,6 @@ var ts; var labelDetails = { detail: signaturePrinter.printNode(4 /* EmitHint.Unspecified */, methodSignature, sourceFile) }; return { isSnippet: isSnippet, insertText: insertText, labelDetails: labelDetails }; } - ; function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences) { var declarations = symbol.getDeclarations(); if (!(declarations && declarations.length)) { @@ -134449,10 +135581,10 @@ var ts; var quotePreference = ts.getQuotePreference(sourceFile, preferences); var builderFlags = 33554432 /* NodeBuilderFlags.OmitThisParameter */ | (quotePreference === 0 /* QuotePreference.Single */ ? 268435456 /* NodeBuilderFlags.UseSingleQuotesForStringLiteralType */ : 0 /* NodeBuilderFlags.None */); switch (declaration.kind) { - case 166 /* SyntaxKind.PropertySignature */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: { + case 168 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: { var effectiveType = type.flags & 1048576 /* TypeFlags.Union */ && type.types.length < 10 ? checker.getUnionType(type.types, 2 /* UnionReduction.Subtype */) : type; @@ -134486,7 +135618,8 @@ var ts; } var parameters = typeNode.parameters.map(function (typedParam) { return ts.factory.createParameterDeclaration( - /*modifiers*/ undefined, typedParam.dotDotDotToken, typedParam.name, typedParam.questionToken, + /*modifiers*/ undefined, typedParam.dotDotDotToken, typedParam.name, + /*questionToken*/ undefined, /*type*/ undefined, typedParam.initializer); }); return ts.factory.createMethodDeclaration( @@ -134606,20 +135739,17 @@ var ts; }; return unresolvedOrigin; } - function getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, contextToken, origin, useSemicolons, options, preferences) { - var _a, _b, _c; - var sourceFile = importCompletionNode.getSourceFile(); - var replacementSpan = ts.createTextSpanFromNode(ts.findAncestor(importCompletionNode, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)) || importCompletionNode, sourceFile); + function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) { + var replacementSpan = importStatementCompletion.replacementSpan; var quotedModuleSpecifier = ts.quote(sourceFile, preferences, origin.moduleSpecifier); var exportKind = origin.isDefaultExport ? 1 /* ExportKind.Default */ : origin.exportName === "export=" /* InternalSymbolName.ExportEquals */ ? 2 /* ExportKind.ExportEquals */ : 0 /* ExportKind.Named */; var tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : ""; var importKind = ts.codefix.getImportKind(sourceFile, exportKind, options, /*forceImportKeyword*/ true); - var isTopLevelTypeOnly = ((_b = (_a = ts.tryCast(importCompletionNode, ts.isImportDeclaration)) === null || _a === void 0 ? void 0 : _a.importClause) === null || _b === void 0 ? void 0 : _b.isTypeOnly) || ((_c = ts.tryCast(importCompletionNode, ts.isImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.isTypeOnly); - var isImportSpecifierTypeOnly = couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken); - var topLevelTypeOnlyText = isTopLevelTypeOnly ? " ".concat(ts.tokenToString(152 /* SyntaxKind.TypeKeyword */), " ") : " "; - var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? "".concat(ts.tokenToString(152 /* SyntaxKind.TypeKeyword */), " ") : ""; + var isImportSpecifierTypeOnly = importStatementCompletion.couldBeTypeOnlyImportSpecifier; + var topLevelTypeOnlyText = importStatementCompletion.isTopLevelTypeOnly ? " ".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : " "; + var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? "".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : ""; var suffix = useSemicolons ? ";" : ""; switch (importKind) { case 3 /* ImportKind.CommonJS */: return { replacementSpan: replacementSpan, insertText: "import".concat(topLevelTypeOnlyText).concat(ts.escapeSnippetText(name)).concat(tabStop, " = require(").concat(quotedModuleSpecifier, ")").concat(suffix) }; @@ -134652,7 +135782,7 @@ var ts; return CompletionSource.TypeOnlyAlias; } } - function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) { + function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) { var _a; var start = ts.timestamp(); var variableDeclaration = getVariableDeclaration(location); @@ -134673,7 +135803,7 @@ var ts; var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess; var originalSortText = (_a = symbolToSortTextMap === null || symbolToSortTextMap === void 0 ? void 0 : symbolToSortTextMap[ts.getSymbolId(symbol)]) !== null && _a !== void 0 ? _a : Completions.SortText.LocationPriority; var sortText = (isDeprecated(symbol, typeChecker) ? Completions.SortText.Deprecated(originalSortText) : originalSortText); - var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, compilerOptions, preferences, kind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag); + var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, compilerOptions, preferences, kind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag); if (!entry) { continue; } @@ -134833,7 +135963,7 @@ var ts; } case "symbol": { var symbol = symbolCompletion.symbol, location = symbolCompletion.location, contextToken_2 = symbolCompletion.contextToken, origin = symbolCompletion.origin, previousToken = symbolCompletion.previousToken; - var _a = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken_2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; + var _a = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken_2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay); // TODO: GH#18217 } case "literal": { @@ -134862,9 +135992,9 @@ var ts; return { name: name, kindModifiers: kindModifiers, kind: kind, displayParts: displayParts, documentation: documentation, tags: tags, codeActions: codeActions, source: source, sourceDisplay: source }; } Completions.createCompletionDetails = createCompletionDetails; - function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source) { + function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken) { if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) { - if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementNode) { + if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementSpan) { // Import statement completion: 'import c|' return { codeActions: undefined, sourceDisplay: [ts.textPart(data.moduleSpecifier)] }; } @@ -134894,7 +136024,7 @@ var ts; var moduleSymbol = origin.moduleSymbol; var targetSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker)); var isJsxOpeningTagName = (contextToken === null || contextToken === void 0 ? void 0 : contextToken.kind) === 29 /* SyntaxKind.LessThanToken */ && ts.isJsxOpeningLikeElement(contextToken.parent); - var _a = ts.codefix.getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), isJsxOpeningTagName), isJsxOpeningTagName, host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences), moduleSpecifier = _a.moduleSpecifier, codeAction = _a.codeAction; + var _a = ts.codefix.getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), isJsxOpeningTagName), isJsxOpeningTagName, host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences, cancellationToken), moduleSpecifier = _a.moduleSpecifier, codeAction = _a.codeAction; ts.Debug.assert(!(data === null || data === void 0 ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier); return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] }; } @@ -134937,11 +136067,11 @@ var ts; return ts.getContextualTypeFromParent(previousToken, checker); case 63 /* SyntaxKind.EqualsToken */: switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checker.getContextualType(parent.initializer); // TODO: GH#18217 - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return checker.getTypeAtLocation(parent.left); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return checker.getContextualTypeForJsxAttribute(parent); default: return undefined; @@ -134972,7 +136102,7 @@ var ts; } function isModuleSymbol(symbol) { var _a; - return !!((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.kind === 305 /* SyntaxKind.SourceFile */; })); + return !!((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.kind === 308 /* SyntaxKind.SourceFile */; })); } function getCompletionData(program, log, sourceFile, compilerOptions, position, preferences, detailsEntryId, host, formatContext, cancellationToken) { var typeChecker = program.getTypeChecker(); @@ -135029,7 +136159,7 @@ var ts; currentToken = ts.getTokenAtPosition(sourceFile, position); if (!currentToken || (!ts.isDeclarationName(currentToken) && - (currentToken.parent.kind !== 347 /* SyntaxKind.JSDocPropertyTag */ || + (currentToken.parent.kind !== 350 /* SyntaxKind.JSDocPropertyTag */ || currentToken.parent.name !== currentToken))) { // Use as type location if inside tag's type expression insideJsDocTagTypeExpression = isCurrentlyEditingNode(typeExpression); @@ -135065,34 +136195,34 @@ var ts; var isStartingCloseTag = false; var isJsxInitializer = false; var isJsxIdentifierExpected = false; - var importCompletionNode; + var importStatementCompletion; var location = ts.getTouchingPropertyName(sourceFile, position); var keywordFilters = 0 /* KeywordCompletionFilters.None */; var isNewIdentifierLocation = false; var flags = 0 /* CompletionInfoFlags.None */; if (contextToken) { - var importStatementCompletion = getImportStatementCompletionInfo(contextToken); - isNewIdentifierLocation = importStatementCompletion.isNewIdentifierLocation; - if (importStatementCompletion.keywordCompletion) { - if (importStatementCompletion.isKeywordOnlyCompletion) { + var importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken); + if (importStatementCompletionInfo.keywordCompletion) { + if (importStatementCompletionInfo.isKeywordOnlyCompletion) { return { kind: 4 /* CompletionDataKind.Keywords */, - keywordCompletions: [keywordToCompletionEntry(importStatementCompletion.keywordCompletion)], - isNewIdentifierLocation: isNewIdentifierLocation, + keywordCompletions: [keywordToCompletionEntry(importStatementCompletionInfo.keywordCompletion)], + isNewIdentifierLocation: importStatementCompletionInfo.isNewIdentifierLocation, }; } - keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletion.keywordCompletion); + keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletionInfo.keywordCompletion); } - if (importStatementCompletion.replacementNode && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) { + if (importStatementCompletionInfo.replacementSpan && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) { // Import statement completions use `insertText`, and also require the `data` property of `CompletionEntryIdentifier` // added in TypeScript 4.3 to be sent back from the client during `getCompletionEntryDetails`. Since this feature // is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients // to opt in with the `includeCompletionsForImportStatements` user preference. - importCompletionNode = importStatementCompletion.replacementNode; flags |= 2 /* CompletionInfoFlags.IsImportStatementCompletion */; + importStatementCompletion = importStatementCompletionInfo; + isNewIdentifierLocation = importStatementCompletionInfo.isNewIdentifierLocation; } // Bail out if this is a known invalid completion location - if (!importCompletionNode && isCompletionListBlocker(contextToken)) { + if (!importStatementCompletionInfo.replacementSpan && isCompletionListBlocker(contextToken)) { log("Returning an empty list because completion was requested in an invalid position."); return keywordFilters ? keywordCompletionData(keywordFilters, isJsOnlyLocation, isNewIdentifierDefinitionLocation()) @@ -135103,7 +136233,7 @@ var ts; isRightOfDot = contextToken.kind === 24 /* SyntaxKind.DotToken */; isRightOfQuestionDot = contextToken.kind === 28 /* SyntaxKind.QuestionDotToken */; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: propertyAccessToConvert = parent; node = propertyAccessToConvert.expression; var leftmostAccessExpression = ts.getLeftmostAccessExpression(propertyAccessToConvert); @@ -135119,16 +136249,16 @@ var ts; return undefined; } break; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: node = parent.left; break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: node = parent.name; break; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: node = parent; break; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: node = parent.getFirstToken(sourceFile); ts.Debug.assert(node.kind === 100 /* SyntaxKind.ImportKeyword */ || node.kind === 103 /* SyntaxKind.NewKeyword */); break; @@ -135138,11 +136268,11 @@ var ts; return undefined; } } - else if (!importCompletionNode && sourceFile.languageVariant === 1 /* LanguageVariant.JSX */) { + else if (!importStatementCompletion) { // // If the tagname is a property access expression, we will then walk up to the top most of property access expression. // Then, try to get a JSX container and its associated attributes type. - if (parent && parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (parent && parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { contextToken = parent; parent = parent.parent; } @@ -135150,46 +136280,46 @@ var ts; if (currentToken.parent === location) { switch (currentToken.kind) { case 31 /* SyntaxKind.GreaterThanToken */: - if (currentToken.parent.kind === 278 /* SyntaxKind.JsxElement */ || currentToken.parent.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (currentToken.parent.kind === 281 /* SyntaxKind.JsxElement */ || currentToken.parent.kind === 283 /* SyntaxKind.JsxOpeningElement */) { location = currentToken; } break; case 43 /* SyntaxKind.SlashToken */: - if (currentToken.parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */) { + if (currentToken.parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */) { location = currentToken; } break; } } switch (parent.kind) { - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: if (contextToken.kind === 43 /* SyntaxKind.SlashToken */) { isStartingCloseTag = true; location = contextToken; } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (!binaryExpressionMayBeOpenTag(parent)) { break; } // falls through - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 278 /* SyntaxKind.JsxElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 281 /* SyntaxKind.JsxElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: isJsxIdentifierExpected = true; if (contextToken.kind === 29 /* SyntaxKind.LessThanToken */) { isRightOfOpenTag = true; location = contextToken; } break; - case 288 /* SyntaxKind.JsxExpression */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 291 /* SyntaxKind.JsxExpression */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: // For `
`, `parent` will be `{true}` and `previousToken` will be `}` if (previousToken.kind === 19 /* SyntaxKind.CloseBraceToken */ && currentToken.kind === 31 /* SyntaxKind.GreaterThanToken */) { isJsxIdentifierExpected = true; } break; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: // For `
`, `parent` will be JsxAttribute and `previousToken` will be its initializer if (parent.initializer === previousToken && previousToken.end < position) { @@ -135281,19 +136411,19 @@ var ts; isTypeOnlyLocation: isTypeOnlyLocation, isJsxIdentifierExpected: isJsxIdentifierExpected, isRightOfOpenTag: isRightOfOpenTag, - importCompletionNode: importCompletionNode, + importStatementCompletion: importStatementCompletion, hasUnresolvedAutoImports: hasUnresolvedAutoImports, flags: flags, }; function isTagWithTypeExpression(tag) { switch (tag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 341 /* SyntaxKind.JSDocReturnTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return true; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return !!tag.constraint; default: return false; @@ -135302,7 +136432,7 @@ var ts; function tryGetTypeExpressionFromTag(tag) { if (isTagWithTypeExpression(tag)) { var typeExpression = ts.isJSDocTemplateTag(tag) ? tag.constraint : tag.typeExpression; - return typeExpression && typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */ ? typeExpression : undefined; + return typeExpression && typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */ ? typeExpression : undefined; } return undefined; } @@ -135345,7 +136475,7 @@ var ts; // If the module is merged with a value, we must get the type of the class and add its propertes (for inherited static methods). if (!isTypeLocation && symbol.declarations && - symbol.declarations.some(function (d) { return d.kind !== 305 /* SyntaxKind.SourceFile */ && d.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && d.kind !== 260 /* SyntaxKind.EnumDeclaration */; })) { + symbol.declarations.some(function (d) { return d.kind !== 308 /* SyntaxKind.SourceFile */ && d.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && d.kind !== 263 /* SyntaxKind.EnumDeclaration */; })) { var type = typeChecker.getTypeOfSymbolAtLocation(symbol, node).getNonOptionalType(); var insertQuestionDot = false; if (type.isNullableType()) { @@ -135391,7 +136521,7 @@ var ts; if (isRightOfQuestionDot && ts.some(type.getCallSignatures())) { isNewIdentifierLocation = true; } - var propertyAccess = node.kind === 200 /* SyntaxKind.ImportType */ ? node : node.parent; + var propertyAccess = node.kind === 202 /* SyntaxKind.ImportType */ ? node : node.parent; if (inCheckedFile) { for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) { var symbol = _a[_i]; @@ -135535,7 +136665,7 @@ var ts; return 1 /* GlobalsSearch.Success */; } function tryGetImportCompletionSymbols() { - if (!importCompletionNode) + if (!importStatementCompletion) return 0 /* GlobalsSearch.Continue */; isNewIdentifierLocation = true; collectAutoImports(); @@ -135598,7 +136728,7 @@ var ts; } } // Need to insert 'this.' before properties of `this` type, so only do that if `includeInsertTextCompletions` - if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 305 /* SyntaxKind.SourceFile */) { + if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 308 /* SyntaxKind.SourceFile */) { var thisType = typeChecker.tryGetThisTypeAt(scopeNode, /*includeGlobalThis*/ false, ts.isClassLike(scopeNode.parent) ? scopeNode : undefined); if (thisType && !isProbablyGlobalType(thisType, sourceFile, typeChecker)) { for (var _i = 0, _a = getPropertiesForCompletion(thisType, typeChecker); _i < _a.length; _i++) { @@ -135618,7 +136748,7 @@ var ts; } function shouldOfferImportCompletions() { // If already typing an import statement, provide completions for it. - if (importCompletionNode) + if (importStatementCompletion) return true; // If current completion is for non-contextual Object literal shortahands, ignore auto-import symbols if (isNonContextualObjectLiteral) @@ -135637,10 +136767,10 @@ var ts; } function isSnippetScope(scopeNode) { switch (scopeNode.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 223 /* SyntaxKind.TemplateExpression */: - case 288 /* SyntaxKind.JsxExpression */: - case 235 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 225 /* SyntaxKind.TemplateExpression */: + case 291 /* SyntaxKind.JsxExpression */: + case 238 /* SyntaxKind.Block */: return true; default: return ts.isStatement(scopeNode); @@ -135648,7 +136778,7 @@ var ts; } function isTypeOnlyCompletion() { return insideJsDocTagTypeExpression - || !!importCompletionNode && ts.isTypeOnlyImportOrExportDeclaration(location.parent) + || !!importStatementCompletion && ts.isTypeOnlyImportOrExportDeclaration(location.parent) || !isContextTokenValueLocation(contextToken) && (ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker) || ts.isPartOfTypeNode(location) @@ -135657,28 +136787,30 @@ var ts; function isContextTokenValueLocation(contextToken) { return contextToken && ((contextToken.kind === 112 /* SyntaxKind.TypeOfKeyword */ && - (contextToken.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isTypeOfExpression(contextToken.parent))) || - (contextToken.kind === 128 /* SyntaxKind.AssertsKeyword */ && contextToken.parent.kind === 177 /* SyntaxKind.TypePredicate */)); + (contextToken.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isTypeOfExpression(contextToken.parent))) || + (contextToken.kind === 129 /* SyntaxKind.AssertsKeyword */ && contextToken.parent.kind === 179 /* SyntaxKind.TypePredicate */)); } function isContextTokenTypeLocation(contextToken) { if (contextToken) { var parentKind = contextToken.parent.kind; switch (contextToken.kind) { case 58 /* SyntaxKind.ColonToken */: - return parentKind === 167 /* SyntaxKind.PropertyDeclaration */ || - parentKind === 166 /* SyntaxKind.PropertySignature */ || - parentKind === 164 /* SyntaxKind.Parameter */ || - parentKind === 254 /* SyntaxKind.VariableDeclaration */ || + return parentKind === 169 /* SyntaxKind.PropertyDeclaration */ || + parentKind === 168 /* SyntaxKind.PropertySignature */ || + parentKind === 166 /* SyntaxKind.Parameter */ || + parentKind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isFunctionLikeKind(parentKind); case 63 /* SyntaxKind.EqualsToken */: - return parentKind === 259 /* SyntaxKind.TypeAliasDeclaration */; - case 127 /* SyntaxKind.AsKeyword */: - return parentKind === 229 /* SyntaxKind.AsExpression */; + return parentKind === 262 /* SyntaxKind.TypeAliasDeclaration */; + case 128 /* SyntaxKind.AsKeyword */: + return parentKind === 231 /* SyntaxKind.AsExpression */; case 29 /* SyntaxKind.LessThanToken */: - return parentKind === 178 /* SyntaxKind.TypeReference */ || - parentKind === 211 /* SyntaxKind.TypeAssertionExpression */; + return parentKind === 180 /* SyntaxKind.TypeReference */ || + parentKind === 213 /* SyntaxKind.TypeAssertionExpression */; case 94 /* SyntaxKind.ExtendsKeyword */: - return parentKind === 163 /* SyntaxKind.TypeParameter */; + return parentKind === 165 /* SyntaxKind.TypeParameter */; + case 150 /* SyntaxKind.SatisfiesKeyword */: + return parentKind === 235 /* SyntaxKind.SatisfiesExpression */; } } return false; @@ -135696,8 +136828,7 @@ var ts; flags |= 1 /* CompletionInfoFlags.MayIncludeAutoImports */; // import { type | -> token text should be blank var isAfterTypeOnlyImportSpecifierModifier = previousToken === contextToken - && importCompletionNode - && couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken); + && importStatementCompletion; var lowerCaseTokenText = isAfterTypeOnlyImportSpecifierModifier ? "" : previousToken && ts.isIdentifier(previousToken) ? previousToken.text.toLowerCase() : ""; @@ -135705,14 +136836,14 @@ var ts; var exportInfo = ts.getExportInfoMap(sourceFile, host, program, preferences, cancellationToken); var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host); var packageJsonFilter = detailsEntryId ? undefined : ts.createPackageJsonImportFilter(sourceFile, preferences, host); - resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importCompletionNode, ts.isValidTypeOnlyAliasUseSite(location), function (context) { + resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importStatementCompletion, ts.isValidTypeOnlyAliasUseSite(location), function (context) { exportInfo.search(sourceFile.path, /*preferCapitalized*/ isRightOfOpenTag, function (symbolName, targetFlags) { if (!ts.isIdentifierText(symbolName, ts.getEmitScriptTarget(host.getCompilationSettings()))) return false; if (!detailsEntryId && ts.isStringANonContextualKeyword(symbolName)) return false; - if (!isTypeOnlyLocation && !importCompletionNode && !(targetFlags & 111551 /* SymbolFlags.Value */)) + if (!isTypeOnlyLocation && !importStatementCompletion && !(targetFlags & 111551 /* SymbolFlags.Value */)) return false; if (isTypeOnlyLocation && !(targetFlags & (1536 /* SymbolFlags.Module */ | 788968 /* SymbolFlags.Type */))) return false; @@ -135793,7 +136924,7 @@ var ts; return; } symbolToOriginInfoMap[symbols.length] = origin; - symbolToSortTextMap[symbolId] = importCompletionNode ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions; + symbolToSortTextMap[symbolId] = importStatementCompletion ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions; symbols.push(symbol); } /* Mutates `symbols` and `symbolToOriginInfoMap`. */ @@ -135869,18 +137000,18 @@ var ts; // - contextToken: GreaterThanToken (before cursor) // - location: JsxSelfClosingElement or JsxOpeningElement // - contextToken.parent === location - if (location === contextToken.parent && (location.kind === 280 /* SyntaxKind.JsxOpeningElement */ || location.kind === 279 /* SyntaxKind.JsxSelfClosingElement */)) { + if (location === contextToken.parent && (location.kind === 283 /* SyntaxKind.JsxOpeningElement */ || location.kind === 282 /* SyntaxKind.JsxSelfClosingElement */)) { return false; } - if (contextToken.parent.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (contextToken.parent.kind === 283 /* SyntaxKind.JsxOpeningElement */) { //
/**/ // - contextToken: GreaterThanToken (before cursor) // - location: JSXElement // - different parents (JSXOpeningElement, JSXElement) - return location.parent.kind !== 280 /* SyntaxKind.JsxOpeningElement */; + return location.parent.kind !== 283 /* SyntaxKind.JsxOpeningElement */; } - if (contextToken.parent.kind === 281 /* SyntaxKind.JsxClosingElement */ || contextToken.parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */) { - return !!contextToken.parent.parent && contextToken.parent.parent.kind === 278 /* SyntaxKind.JsxElement */; + if (contextToken.parent.kind === 284 /* SyntaxKind.JsxClosingElement */ || contextToken.parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */) { + return !!contextToken.parent.parent && contextToken.parent.parent.kind === 281 /* SyntaxKind.JsxElement */; } } return false; @@ -135892,44 +137023,44 @@ var ts; // Previous token may have been a keyword that was converted to an identifier. switch (tokenKind) { case 27 /* SyntaxKind.CommaToken */: - return containingNodeKind === 208 /* SyntaxKind.CallExpression */ // func( a, | - || containingNodeKind === 171 /* SyntaxKind.Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ - || containingNodeKind === 209 /* SyntaxKind.NewExpression */ // new C(a, | - || containingNodeKind === 204 /* SyntaxKind.ArrayLiteralExpression */ // [a, | - || containingNodeKind === 221 /* SyntaxKind.BinaryExpression */ // const x = (a, | - || containingNodeKind === 179 /* SyntaxKind.FunctionType */ // var x: (s: string, list| - || containingNodeKind === 205 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { x, | + return containingNodeKind === 210 /* SyntaxKind.CallExpression */ // func( a, | + || containingNodeKind === 173 /* SyntaxKind.Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ + || containingNodeKind === 211 /* SyntaxKind.NewExpression */ // new C(a, | + || containingNodeKind === 206 /* SyntaxKind.ArrayLiteralExpression */ // [a, | + || containingNodeKind === 223 /* SyntaxKind.BinaryExpression */ // const x = (a, | + || containingNodeKind === 181 /* SyntaxKind.FunctionType */ // var x: (s: string, list| + || containingNodeKind === 207 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { x, | case 20 /* SyntaxKind.OpenParenToken */: - return containingNodeKind === 208 /* SyntaxKind.CallExpression */ // func( | - || containingNodeKind === 171 /* SyntaxKind.Constructor */ // constructor( | - || containingNodeKind === 209 /* SyntaxKind.NewExpression */ // new C(a| - || containingNodeKind === 212 /* SyntaxKind.ParenthesizedExpression */ // const x = (a| - || containingNodeKind === 191 /* SyntaxKind.ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ + return containingNodeKind === 210 /* SyntaxKind.CallExpression */ // func( | + || containingNodeKind === 173 /* SyntaxKind.Constructor */ // constructor( | + || containingNodeKind === 211 /* SyntaxKind.NewExpression */ // new C(a| + || containingNodeKind === 214 /* SyntaxKind.ParenthesizedExpression */ // const x = (a| + || containingNodeKind === 193 /* SyntaxKind.ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ case 22 /* SyntaxKind.OpenBracketToken */: - return containingNodeKind === 204 /* SyntaxKind.ArrayLiteralExpression */ // [ | - || containingNodeKind === 176 /* SyntaxKind.IndexSignature */ // [ | : string ] - || containingNodeKind === 162 /* SyntaxKind.ComputedPropertyName */; // [ | /* this can become an index signature */ - case 141 /* SyntaxKind.ModuleKeyword */: // module | - case 142 /* SyntaxKind.NamespaceKeyword */: // namespace | + return containingNodeKind === 206 /* SyntaxKind.ArrayLiteralExpression */ // [ | + || containingNodeKind === 178 /* SyntaxKind.IndexSignature */ // [ | : string ] + || containingNodeKind === 164 /* SyntaxKind.ComputedPropertyName */; // [ | /* this can become an index signature */ + case 142 /* SyntaxKind.ModuleKeyword */: // module | + case 143 /* SyntaxKind.NamespaceKeyword */: // namespace | case 100 /* SyntaxKind.ImportKeyword */: // import | return true; case 24 /* SyntaxKind.DotToken */: - return containingNodeKind === 261 /* SyntaxKind.ModuleDeclaration */; // module A.| + return containingNodeKind === 264 /* SyntaxKind.ModuleDeclaration */; // module A.| case 18 /* SyntaxKind.OpenBraceToken */: - return containingNodeKind === 257 /* SyntaxKind.ClassDeclaration */ // class A { | - || containingNodeKind === 205 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { | + return containingNodeKind === 260 /* SyntaxKind.ClassDeclaration */ // class A { | + || containingNodeKind === 207 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { | case 63 /* SyntaxKind.EqualsToken */: - return containingNodeKind === 254 /* SyntaxKind.VariableDeclaration */ // const x = a| - || containingNodeKind === 221 /* SyntaxKind.BinaryExpression */; // x = a| + return containingNodeKind === 257 /* SyntaxKind.VariableDeclaration */ // const x = a| + || containingNodeKind === 223 /* SyntaxKind.BinaryExpression */; // x = a| case 15 /* SyntaxKind.TemplateHead */: - return containingNodeKind === 223 /* SyntaxKind.TemplateExpression */; // `aa ${| + return containingNodeKind === 225 /* SyntaxKind.TemplateExpression */; // `aa ${| case 16 /* SyntaxKind.TemplateMiddle */: - return containingNodeKind === 233 /* SyntaxKind.TemplateSpan */; // `aa ${10} dd ${| - case 131 /* SyntaxKind.AsyncKeyword */: - return containingNodeKind === 169 /* SyntaxKind.MethodDeclaration */ // const obj = { async c|() - || containingNodeKind === 297 /* SyntaxKind.ShorthandPropertyAssignment */; // const obj = { async c| + return containingNodeKind === 236 /* SyntaxKind.TemplateSpan */; // `aa ${10} dd ${| + case 132 /* SyntaxKind.AsyncKeyword */: + return containingNodeKind === 171 /* SyntaxKind.MethodDeclaration */ // const obj = { async c|() + || containingNodeKind === 300 /* SyntaxKind.ShorthandPropertyAssignment */; // const obj = { async c| case 41 /* SyntaxKind.AsteriskToken */: - return containingNodeKind === 169 /* SyntaxKind.MethodDeclaration */; // const obj = { * c| + return containingNodeKind === 171 /* SyntaxKind.MethodDeclaration */; // const obj = { * c| } if (isClassMemberCompletionKeyword(tokenKind)) { return true; @@ -135979,7 +137110,7 @@ var ts; completionKind = 0 /* CompletionKind.ObjectPropertyDeclaration */; var typeMembers; var existingMembers; - if (objectLikeContainer.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { var instantiatedType = tryGetObjectLiteralContextualType(objectLikeContainer, typeChecker); // Check completions for Object property value shorthand if (instantiatedType === undefined) { @@ -136004,7 +137135,7 @@ var ts; } } else { - ts.Debug.assert(objectLikeContainer.kind === 201 /* SyntaxKind.ObjectBindingPattern */); + ts.Debug.assert(objectLikeContainer.kind === 203 /* SyntaxKind.ObjectBindingPattern */); // We are *only* completing on properties from the type being destructured. isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); @@ -136015,12 +137146,12 @@ var ts; // through type declaration or inference. // Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed - // type of parameter will flow in from the contextual type of the function - var canGetType = ts.hasInitializer(rootDeclaration) || !!ts.getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */; - if (!canGetType && rootDeclaration.kind === 164 /* SyntaxKind.Parameter */) { + var canGetType = ts.hasInitializer(rootDeclaration) || !!ts.getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */; + if (!canGetType && rootDeclaration.kind === 166 /* SyntaxKind.Parameter */) { if (ts.isExpression(rootDeclaration.parent)) { canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); } - else if (rootDeclaration.parent.kind === 169 /* SyntaxKind.MethodDeclaration */ || rootDeclaration.parent.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (rootDeclaration.parent.kind === 171 /* SyntaxKind.MethodDeclaration */ || rootDeclaration.parent.kind === 175 /* SyntaxKind.SetAccessor */) { canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); } } @@ -136039,7 +137170,7 @@ var ts; var filteredMembers = filterObjectMembersList(typeMembers, ts.Debug.checkDefined(existingMembers)); symbols = ts.concatenate(symbols, filteredMembers); setSortTextToOptionalMember(); - if (objectLikeContainer.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ + if (objectLikeContainer.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && preferences.includeCompletionsWithObjectLiteralMethodSnippets && preferences.includeCompletionsWithInsertText) { transformObjectLiteralMembersSortText(symbolsStartIndex); @@ -136074,10 +137205,10 @@ var ts; keywordFilters = 8 /* KeywordCompletionFilters.TypeKeyword */; } // try to show exported member for imported/re-exported module - var moduleSpecifier = (namedImportsOrExports.kind === 269 /* SyntaxKind.NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier; + var moduleSpecifier = (namedImportsOrExports.kind === 272 /* SyntaxKind.NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier; if (!moduleSpecifier) { isNewIdentifierLocation = true; - return namedImportsOrExports.kind === 269 /* SyntaxKind.NamedImports */ ? 2 /* GlobalsSearch.Fail */ : 0 /* GlobalsSearch.Continue */; + return namedImportsOrExports.kind === 272 /* SyntaxKind.NamedImports */ ? 2 /* GlobalsSearch.Fail */ : 0 /* GlobalsSearch.Continue */; } var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); // TODO: GH#18217 if (!moduleSpecifierSymbol) { @@ -136222,11 +137353,11 @@ var ts; case 30 /* SyntaxKind.LessThanSlashToken */: case 43 /* SyntaxKind.SlashToken */: case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 286 /* SyntaxKind.JsxAttributes */: - case 285 /* SyntaxKind.JsxAttribute */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - if (parent && (parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */ || parent.kind === 280 /* SyntaxKind.JsxOpeningElement */)) { + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 289 /* SyntaxKind.JsxAttributes */: + case 288 /* SyntaxKind.JsxAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + if (parent && (parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || parent.kind === 283 /* SyntaxKind.JsxOpeningElement */)) { if (contextToken.kind === 31 /* SyntaxKind.GreaterThanToken */) { var precedingToken = ts.findPrecedingToken(contextToken.pos, sourceFile, /*startNode*/ undefined); if (!parent.typeArguments || (precedingToken && precedingToken.kind === 43 /* SyntaxKind.SlashToken */)) @@ -136234,7 +137365,7 @@ var ts; } return parent; } - else if (parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + else if (parent.kind === 288 /* SyntaxKind.JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136246,7 +137377,7 @@ var ts; // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 10 /* SyntaxKind.StringLiteral */: - if (parent && ((parent.kind === 285 /* SyntaxKind.JsxAttribute */) || (parent.kind === 287 /* SyntaxKind.JsxSpreadAttribute */))) { + if (parent && ((parent.kind === 288 /* SyntaxKind.JsxAttribute */) || (parent.kind === 290 /* SyntaxKind.JsxSpreadAttribute */))) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136256,8 +137387,8 @@ var ts; break; case 19 /* SyntaxKind.CloseBraceToken */: if (parent && - parent.kind === 288 /* SyntaxKind.JsxExpression */ && - parent.parent && parent.parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + parent.kind === 291 /* SyntaxKind.JsxExpression */ && + parent.parent && parent.parent.kind === 288 /* SyntaxKind.JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136265,7 +137396,7 @@ var ts; // each JsxAttribute can have initializer as JsxExpression return parent.parent.parent.parent; } - if (parent && parent.kind === 287 /* SyntaxKind.JsxSpreadAttribute */) { + if (parent && parent.kind === 290 /* SyntaxKind.JsxSpreadAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136285,54 +137416,54 @@ var ts; var containingNodeKind = parent.kind; switch (contextToken.kind) { case 27 /* SyntaxKind.CommaToken */: - return containingNodeKind === 254 /* SyntaxKind.VariableDeclaration */ || + return containingNodeKind === 257 /* SyntaxKind.VariableDeclaration */ || isVariableDeclarationListButNotTypeArgument(contextToken) || - containingNodeKind === 237 /* SyntaxKind.VariableStatement */ || - containingNodeKind === 260 /* SyntaxKind.EnumDeclaration */ || // enum a { foo, | + containingNodeKind === 240 /* SyntaxKind.VariableStatement */ || + containingNodeKind === 263 /* SyntaxKind.EnumDeclaration */ || // enum a { foo, | isFunctionLikeButNotConstructor(containingNodeKind) || - containingNodeKind === 258 /* SyntaxKind.InterfaceDeclaration */ || // interface A= contextToken.pos); case 24 /* SyntaxKind.DotToken */: - return containingNodeKind === 202 /* SyntaxKind.ArrayBindingPattern */; // var [.| + return containingNodeKind === 204 /* SyntaxKind.ArrayBindingPattern */; // var [.| case 58 /* SyntaxKind.ColonToken */: - return containingNodeKind === 203 /* SyntaxKind.BindingElement */; // var {x :html| + return containingNodeKind === 205 /* SyntaxKind.BindingElement */; // var {x :html| case 22 /* SyntaxKind.OpenBracketToken */: - return containingNodeKind === 202 /* SyntaxKind.ArrayBindingPattern */; // var [x| + return containingNodeKind === 204 /* SyntaxKind.ArrayBindingPattern */; // var [x| case 20 /* SyntaxKind.OpenParenToken */: - return containingNodeKind === 292 /* SyntaxKind.CatchClause */ || + return containingNodeKind === 295 /* SyntaxKind.CatchClause */ || isFunctionLikeButNotConstructor(containingNodeKind); case 18 /* SyntaxKind.OpenBraceToken */: - return containingNodeKind === 260 /* SyntaxKind.EnumDeclaration */; // enum a { | + return containingNodeKind === 263 /* SyntaxKind.EnumDeclaration */; // enum a { | case 29 /* SyntaxKind.LessThanToken */: - return containingNodeKind === 257 /* SyntaxKind.ClassDeclaration */ || // class A< | - containingNodeKind === 226 /* SyntaxKind.ClassExpression */ || // var C = class D< | - containingNodeKind === 258 /* SyntaxKind.InterfaceDeclaration */ || // interface A< | - containingNodeKind === 259 /* SyntaxKind.TypeAliasDeclaration */ || // type List< | + return containingNodeKind === 260 /* SyntaxKind.ClassDeclaration */ || // class A< | + containingNodeKind === 228 /* SyntaxKind.ClassExpression */ || // var C = class D< | + containingNodeKind === 261 /* SyntaxKind.InterfaceDeclaration */ || // interface A< | + containingNodeKind === 262 /* SyntaxKind.TypeAliasDeclaration */ || // type List< | ts.isFunctionLikeKind(containingNodeKind); case 124 /* SyntaxKind.StaticKeyword */: - return containingNodeKind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isClassLike(parent.parent); + return containingNodeKind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isClassLike(parent.parent); case 25 /* SyntaxKind.DotDotDotToken */: - return containingNodeKind === 164 /* SyntaxKind.Parameter */ || - (!!parent.parent && parent.parent.kind === 202 /* SyntaxKind.ArrayBindingPattern */); // var [...z| + return containingNodeKind === 166 /* SyntaxKind.Parameter */ || + (!!parent.parent && parent.parent.kind === 204 /* SyntaxKind.ArrayBindingPattern */); // var [...z| case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - return containingNodeKind === 164 /* SyntaxKind.Parameter */ && !ts.isConstructorDeclaration(parent.parent); - case 127 /* SyntaxKind.AsKeyword */: - return containingNodeKind === 270 /* SyntaxKind.ImportSpecifier */ || - containingNodeKind === 275 /* SyntaxKind.ExportSpecifier */ || - containingNodeKind === 268 /* SyntaxKind.NamespaceImport */; - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: + return containingNodeKind === 166 /* SyntaxKind.Parameter */ && !ts.isConstructorDeclaration(parent.parent); + case 128 /* SyntaxKind.AsKeyword */: + return containingNodeKind === 273 /* SyntaxKind.ImportSpecifier */ || + containingNodeKind === 278 /* SyntaxKind.ExportSpecifier */ || + containingNodeKind === 271 /* SyntaxKind.NamespaceImport */; + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: return !isFromObjectTypeDeclaration(contextToken); case 79 /* SyntaxKind.Identifier */: - if (containingNodeKind === 270 /* SyntaxKind.ImportSpecifier */ && + if (containingNodeKind === 273 /* SyntaxKind.ImportSpecifier */ && contextToken === parent.name && contextToken.text === "type") { // import { type | } @@ -136347,11 +137478,11 @@ var ts; case 100 /* SyntaxKind.ImportKeyword */: case 119 /* SyntaxKind.LetKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: return true; - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: // import { type foo| } - return containingNodeKind !== 270 /* SyntaxKind.ImportSpecifier */; + return containingNodeKind !== 273 /* SyntaxKind.ImportSpecifier */; case 41 /* SyntaxKind.AsteriskToken */: return ts.isFunctionLike(contextToken.parent) && !ts.isMethodDeclaration(contextToken.parent); } @@ -136376,7 +137507,7 @@ var ts; case 126 /* SyntaxKind.AbstractKeyword */: case 84 /* SyntaxKind.ClassKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 92 /* SyntaxKind.EnumKeyword */: case 98 /* SyntaxKind.FunctionKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: @@ -136387,7 +137518,7 @@ var ts; case 124 /* SyntaxKind.StaticKeyword */: case 113 /* SyntaxKind.VarKeyword */: return true; - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: return ts.isPropertyDeclaration(contextToken.parent); } // If we are inside a class declaration, and `constructor` is totally not present, @@ -136396,7 +137527,7 @@ var ts; if (ancestorClassLike && contextToken === previousToken && isPreviousPropertyDeclarationTerminated(contextToken, position)) { return false; // Don't block completions. } - var ancestorPropertyDeclaraion = ts.getAncestor(contextToken.parent, 167 /* SyntaxKind.PropertyDeclaration */); + var ancestorPropertyDeclaraion = ts.getAncestor(contextToken.parent, 169 /* SyntaxKind.PropertyDeclaration */); // If we are inside a class declaration and typing `constructor` after property declaration... if (ancestorPropertyDeclaraion && contextToken !== previousToken @@ -136428,7 +137559,7 @@ var ts; || !ts.positionsAreOnSameLine(contextToken.end, position, sourceFile)); } function isFunctionLikeButNotConstructor(kind) { - return ts.isFunctionLikeKind(kind) && kind !== 171 /* SyntaxKind.Constructor */; + return ts.isFunctionLikeKind(kind) && kind !== 173 /* SyntaxKind.Constructor */; } function isDotOfNumericLiteral(contextToken) { if (contextToken.kind === 8 /* SyntaxKind.NumericLiteral */) { @@ -136438,7 +137569,7 @@ var ts; return false; } function isVariableDeclarationListButNotTypeArgument(node) { - return node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */ + return node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */ && !ts.isPossiblyTypeArgumentPosition(node, sourceFile, typeChecker); } /** @@ -136456,13 +137587,13 @@ var ts; for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 296 /* SyntaxKind.PropertyAssignment */ && - m.kind !== 297 /* SyntaxKind.ShorthandPropertyAssignment */ && - m.kind !== 203 /* SyntaxKind.BindingElement */ && - m.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - m.kind !== 172 /* SyntaxKind.GetAccessor */ && - m.kind !== 173 /* SyntaxKind.SetAccessor */ && - m.kind !== 298 /* SyntaxKind.SpreadAssignment */) { + if (m.kind !== 299 /* SyntaxKind.PropertyAssignment */ && + m.kind !== 300 /* SyntaxKind.ShorthandPropertyAssignment */ && + m.kind !== 205 /* SyntaxKind.BindingElement */ && + m.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + m.kind !== 174 /* SyntaxKind.GetAccessor */ && + m.kind !== 175 /* SyntaxKind.SetAccessor */ && + m.kind !== 301 /* SyntaxKind.SpreadAssignment */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -136553,10 +137684,10 @@ var ts; for (var _i = 0, existingMembers_2 = existingMembers; _i < existingMembers_2.length; _i++) { var m = existingMembers_2[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && - m.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - m.kind !== 172 /* SyntaxKind.GetAccessor */ && - m.kind !== 173 /* SyntaxKind.SetAccessor */) { + if (m.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && + m.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + m.kind !== 174 /* SyntaxKind.GetAccessor */ && + m.kind !== 175 /* SyntaxKind.SetAccessor */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -136598,7 +137729,7 @@ var ts; if (isCurrentlyEditingNode(attr)) { continue; } - if (attr.kind === 285 /* SyntaxKind.JsxAttribute */) { + if (attr.kind === 288 /* SyntaxKind.JsxAttribute */) { seenNames.add(attr.name.escapedText); } else if (ts.isJsxSpreadAttribute(attr)) { @@ -136696,7 +137827,7 @@ var ts; var _keywordCompletions = []; var allKeywordsCompletions = ts.memoize(function () { var res = []; - for (var i = 81 /* SyntaxKind.FirstKeyword */; i <= 160 /* SyntaxKind.LastKeyword */; i++) { + for (var i = 81 /* SyntaxKind.FirstKeyword */; i <= 162 /* SyntaxKind.LastKeyword */; i++) { res.push({ name: ts.tokenToString(i), kind: "keyword" /* ScriptElementKind.keyword */, @@ -136722,12 +137853,12 @@ var ts; return false; case 1 /* KeywordCompletionFilters.All */: return isFunctionLikeBodyKeyword(kind) - || kind === 135 /* SyntaxKind.DeclareKeyword */ - || kind === 141 /* SyntaxKind.ModuleKeyword */ - || kind === 152 /* SyntaxKind.TypeKeyword */ - || kind === 142 /* SyntaxKind.NamespaceKeyword */ + || kind === 136 /* SyntaxKind.DeclareKeyword */ + || kind === 142 /* SyntaxKind.ModuleKeyword */ + || kind === 154 /* SyntaxKind.TypeKeyword */ + || kind === 143 /* SyntaxKind.NamespaceKeyword */ || kind === 126 /* SyntaxKind.AbstractKeyword */ - || ts.isTypeKeyword(kind) && kind !== 153 /* SyntaxKind.UndefinedKeyword */; + || ts.isTypeKeyword(kind) && kind !== 155 /* SyntaxKind.UndefinedKeyword */; case 5 /* KeywordCompletionFilters.FunctionLikeBodyKeywords */: return isFunctionLikeBodyKeyword(kind); case 2 /* KeywordCompletionFilters.ClassElementKeywords */: @@ -136741,7 +137872,7 @@ var ts; case 7 /* KeywordCompletionFilters.TypeKeywords */: return ts.isTypeKeyword(kind); case 8 /* KeywordCompletionFilters.TypeKeyword */: - return kind === 152 /* SyntaxKind.TypeKeyword */; + return kind === 154 /* SyntaxKind.TypeKeyword */; default: return ts.Debug.assertNever(keywordFilter); } @@ -136750,59 +137881,61 @@ var ts; function isTypeScriptOnlyKeyword(kind) { switch (kind) { case 126 /* SyntaxKind.AbstractKeyword */: - case 130 /* SyntaxKind.AnyKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 92 /* SyntaxKind.EnumKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: case 117 /* SyntaxKind.ImplementsKeyword */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 139 /* SyntaxKind.IsKeyword */: - case 140 /* SyntaxKind.KeyOfKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 140 /* SyntaxKind.IsKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: return true; default: return false; } } function isInterfaceOrTypeLiteralCompletionKeyword(kind) { - return kind === 145 /* SyntaxKind.ReadonlyKeyword */; + return kind === 146 /* SyntaxKind.ReadonlyKeyword */; } function isClassMemberCompletionKeyword(kind) { switch (kind) { case 126 /* SyntaxKind.AbstractKeyword */: - case 134 /* SyntaxKind.ConstructorKeyword */: - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: return true; default: return ts.isClassMemberModifier(kind); } } function isFunctionLikeBodyKeyword(kind) { - return kind === 131 /* SyntaxKind.AsyncKeyword */ - || kind === 132 /* SyntaxKind.AwaitKeyword */ - || kind === 127 /* SyntaxKind.AsKeyword */ - || kind === 152 /* SyntaxKind.TypeKeyword */ + return kind === 132 /* SyntaxKind.AsyncKeyword */ + || kind === 133 /* SyntaxKind.AwaitKeyword */ + || kind === 128 /* SyntaxKind.AsKeyword */ + || kind === 150 /* SyntaxKind.SatisfiesKeyword */ + || kind === 154 /* SyntaxKind.TypeKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind); } function keywordForNode(node) { @@ -136827,7 +137960,7 @@ var ts; && contextToken === parent.moduleSpecifier && tokenLine === currentLine) { entries.push({ - name: ts.tokenToString(129 /* SyntaxKind.AssertKeyword */), + name: ts.tokenToString(130 /* SyntaxKind.AssertKeyword */), kind: "keyword" /* ScriptElementKind.keyword */, kindModifiers: "" /* ScriptElementKindModifier.none */, sortText: Completions.SortText.GlobalsOrKeywords, @@ -136893,7 +138026,7 @@ var ts; function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location, position) { // class c { method() { } | method2() { } } switch (location.kind) { - case 348 /* SyntaxKind.SyntaxList */: + case 351 /* SyntaxKind.SyntaxList */: return ts.tryCast(location.parent, ts.isObjectTypeDeclaration); case 1 /* SyntaxKind.EndOfFileToken */: var cls = ts.tryCast(ts.lastOrUndefined(ts.cast(location.parent, ts.isSourceFile).statements), ts.isObjectTypeDeclaration); @@ -136919,7 +138052,7 @@ var ts; if (!contextToken) return undefined; // class C { blah; constructor/**/ } and so on - if (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ + if (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ // class C { blah \n constructor/**/ } || (ts.isIdentifier(contextToken) && ts.isPropertyDeclaration(contextToken.parent) && ts.isClassLike(location))) { return ts.findAncestor(contextToken, ts.isClassLike); @@ -136962,7 +138095,7 @@ var ts; case 26 /* SyntaxKind.SemicolonToken */: case 27 /* SyntaxKind.CommaToken */: case 79 /* SyntaxKind.Identifier */: - if (parent.kind === 166 /* SyntaxKind.PropertySignature */ && ts.isTypeLiteralNode(parent.parent)) { + if (parent.kind === 168 /* SyntaxKind.PropertySignature */ && ts.isTypeLiteralNode(parent.parent)) { return parent.parent; } break; @@ -136979,11 +138112,11 @@ var ts; if (!t) return undefined; switch (node.kind) { - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return checker.getTypeOfPropertyOfContextualType(t, node.symbol.escapedName); - case 188 /* SyntaxKind.IntersectionType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 187 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 189 /* SyntaxKind.UnionType */: return t; } } @@ -137011,7 +138144,7 @@ var ts; ? !!ts.tryGetImportFromModuleSpecifier(contextToken) : contextToken.kind === 43 /* SyntaxKind.SlashToken */ && ts.isJsxClosingElement(contextToken.parent)); case " ": - return !!contextToken && ts.isImportKeyword(contextToken) && contextToken.parent.kind === 305 /* SyntaxKind.SourceFile */; + return !!contextToken && ts.isImportKeyword(contextToken) && contextToken.parent.kind === 308 /* SyntaxKind.SourceFile */; default: return ts.Debug.assertNever(triggerCharacter); } @@ -137058,21 +138191,22 @@ var ts; return undefined; } function getImportStatementCompletionInfo(contextToken) { + var _a, _b, _c; var keywordCompletion; var isKeywordOnlyCompletion = false; var candidate = getCandidate(); return { isKeywordOnlyCompletion: isKeywordOnlyCompletion, keywordCompletion: keywordCompletion, - isNewIdentifierLocation: !!(candidate || keywordCompletion === 152 /* SyntaxKind.TypeKeyword */), - replacementNode: candidate && ts.rangeIsOnSingleLine(candidate, candidate.getSourceFile()) - ? candidate - : undefined + isNewIdentifierLocation: !!(candidate || keywordCompletion === 154 /* SyntaxKind.TypeKeyword */), + isTopLevelTypeOnly: !!((_b = (_a = ts.tryCast(candidate, ts.isImportDeclaration)) === null || _a === void 0 ? void 0 : _a.importClause) === null || _b === void 0 ? void 0 : _b.isTypeOnly) || !!((_c = ts.tryCast(candidate, ts.isImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.isTypeOnly), + couldBeTypeOnlyImportSpecifier: !!candidate && couldBeTypeOnlyImportSpecifier(candidate, contextToken), + replacementSpan: getSingleLineReplacementSpanForImportCompletionNode(candidate), }; function getCandidate() { var parent = contextToken.parent; if (ts.isImportEqualsDeclaration(parent)) { - keywordCompletion = contextToken.kind === 152 /* SyntaxKind.TypeKeyword */ ? undefined : 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = contextToken.kind === 154 /* SyntaxKind.TypeKeyword */ ? undefined : 154 /* SyntaxKind.TypeKeyword */; return isModuleSpecifierMissingOrEmpty(parent.moduleReference) ? parent : undefined; } if (couldBeTypeOnlyImportSpecifier(parent, contextToken) && canCompleteFromNamedBindings(parent.parent)) { @@ -137082,13 +138216,13 @@ var ts; if (!parent.parent.isTypeOnly && (contextToken.kind === 18 /* SyntaxKind.OpenBraceToken */ || contextToken.kind === 100 /* SyntaxKind.ImportKeyword */ || contextToken.kind === 27 /* SyntaxKind.CommaToken */)) { - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; } if (canCompleteFromNamedBindings(parent)) { // At `import { ... } |` or `import * as Foo |`, the only possible completion is `from` if (contextToken.kind === 19 /* SyntaxKind.CloseBraceToken */ || contextToken.kind === 79 /* SyntaxKind.Identifier */) { isKeywordOnlyCompletion = true; - keywordCompletion = 156 /* SyntaxKind.FromKeyword */; + keywordCompletion = 158 /* SyntaxKind.FromKeyword */; } else { return parent.parent.parent; @@ -137098,25 +138232,82 @@ var ts; } if (ts.isImportKeyword(contextToken) && ts.isSourceFile(parent)) { // A lone import keyword with nothing following it does not parse as a statement at all - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; return contextToken; } if (ts.isImportKeyword(contextToken) && ts.isImportDeclaration(parent)) { // `import s| from` - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; return isModuleSpecifierMissingOrEmpty(parent.moduleSpecifier) ? parent : undefined; } return undefined; } } + function getSingleLineReplacementSpanForImportCompletionNode(node) { + var _a, _b, _c; + if (!node) + return undefined; + var top = (_a = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration))) !== null && _a !== void 0 ? _a : node; + var sourceFile = top.getSourceFile(); + if (ts.rangeIsOnSingleLine(top, sourceFile)) { + return ts.createTextSpanFromNode(top, sourceFile); + } + // ImportKeyword was necessarily on one line; ImportSpecifier was necessarily parented in an ImportDeclaration + ts.Debug.assert(top.kind !== 100 /* SyntaxKind.ImportKeyword */ && top.kind !== 273 /* SyntaxKind.ImportSpecifier */); + // Guess which point in the import might actually be a later statement parsed as part of the import + // during parser recovery - either in the middle of named imports, or the module specifier. + var potentialSplitPoint = top.kind === 269 /* SyntaxKind.ImportDeclaration */ + ? (_c = getPotentiallyInvalidImportSpecifier((_b = top.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings)) !== null && _c !== void 0 ? _c : top.moduleSpecifier + : top.moduleReference; + var withoutModuleSpecifier = { + pos: top.getFirstToken().getStart(), + end: potentialSplitPoint.pos, + }; + // The module specifier/reference was previously found to be missing, empty, or + // not a string literal - in this last case, it's likely that statement on a following + // line was parsed as the module specifier of a partially-typed import, e.g. + // import Foo| + // interface Blah {} + // This appears to be a multiline-import, and editors can't replace multiple lines. + // But if everything but the "module specifier" is on one line, by this point we can + // assume that the "module specifier" is actually just another statement, and return + // the single-line range of the import excluding that probable statement. + if (ts.rangeIsOnSingleLine(withoutModuleSpecifier, sourceFile)) { + return ts.createTextSpanFromRange(withoutModuleSpecifier); + } + } + // Tries to identify the first named import that is not really a named import, but rather + // just parser recovery for a situation like: + // import { Foo| + // interface Bar {} + // in which `Foo`, `interface`, and `Bar` are all parsed as import specifiers. The caller + // will also check if this token is on a separate line from the rest of the import. + function getPotentiallyInvalidImportSpecifier(namedBindings) { + var _a; + return ts.find((_a = ts.tryCast(namedBindings, ts.isNamedImports)) === null || _a === void 0 ? void 0 : _a.elements, function (e) { + var _a; + return !e.propertyName && + ts.isStringANonContextualKeyword(e.name.text) && + ((_a = ts.findPrecedingToken(e.name.pos, namedBindings.getSourceFile(), namedBindings)) === null || _a === void 0 ? void 0 : _a.kind) !== 27 /* SyntaxKind.CommaToken */; + }); + } function couldBeTypeOnlyImportSpecifier(importSpecifier, contextToken) { return ts.isImportSpecifier(importSpecifier) && (importSpecifier.isTypeOnly || contextToken === importSpecifier.name && ts.isTypeKeywordTokenOrIdentifier(contextToken)); } function canCompleteFromNamedBindings(namedBindings) { - return isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) - && (ts.isNamespaceImport(namedBindings) || namedBindings.elements.length < 2) - && !namedBindings.parent.name; + if (!isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) || namedBindings.parent.name) { + return false; + } + if (ts.isNamedImports(namedBindings)) { + // We can only complete on named imports if there are no other named imports already, + // but parser recovery sometimes puts later statements in the named imports list, so + // we try to only consider the probably-valid ones. + var invalidNamedImport = getPotentiallyInvalidImportSpecifier(namedBindings); + var validImports = invalidNamedImport ? namedBindings.elements.indexOf(invalidNamedImport) : namedBindings.elements.length; + return validImports < 2; + } + return true; } function isModuleSpecifierMissingOrEmpty(specifier) { var _a; @@ -137135,7 +138326,6 @@ var ts; function isArrowFunctionBody(node) { return node.parent && ts.isArrowFunction(node.parent) && node.parent.body === node; } - ; /** True if symbol is a type or a module containing at least one type. */ function symbolCanBeReferencedAtTypeLocation(symbol, checker, seenModules) { if (seenModules === void 0) { seenModules = new ts.Map(); } @@ -137284,14 +138474,14 @@ var ts; case 115 /* SyntaxKind.WhileKeyword */: case 90 /* SyntaxKind.DoKeyword */: return useParent(node.parent, function (n) { return ts.isIterationStatement(n, /*lookInLabeledStatements*/ true); }, getLoopBreakContinueOccurrences); - case 134 /* SyntaxKind.ConstructorKeyword */: - return getFromAllDeclarations(ts.isConstructorDeclaration, [134 /* SyntaxKind.ConstructorKeyword */]); - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - return getFromAllDeclarations(ts.isAccessor, [136 /* SyntaxKind.GetKeyword */, 149 /* SyntaxKind.SetKeyword */]); - case 132 /* SyntaxKind.AwaitKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: + return getFromAllDeclarations(ts.isConstructorDeclaration, [135 /* SyntaxKind.ConstructorKeyword */]); + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + return getFromAllDeclarations(ts.isAccessor, [137 /* SyntaxKind.GetKeyword */, 151 /* SyntaxKind.SetKeyword */]); + case 133 /* SyntaxKind.AwaitKeyword */: return useParent(node.parent, ts.isAwaitExpression, getAsyncAndAwaitOccurrences); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: return highlightSpans(getAsyncAndAwaitOccurrences(node)); case 125 /* SyntaxKind.YieldKeyword */: return highlightSpans(getYieldOccurrences(node)); @@ -137338,7 +138528,7 @@ var ts; var child = throwStatement; while (child.parent) { var parent = child.parent; - if (ts.isFunctionBlock(parent) || parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (ts.isFunctionBlock(parent) || parent.kind === 308 /* SyntaxKind.SourceFile */) { return parent; } // A throw-statement is only owned by a try-statement if the try-statement has @@ -137370,16 +138560,16 @@ var ts; function getBreakOrContinueOwner(statement) { return ts.findAncestor(statement, function (node) { switch (node.kind) { - case 249 /* SyntaxKind.SwitchStatement */: - if (statement.kind === 245 /* SyntaxKind.ContinueStatement */) { + case 252 /* SyntaxKind.SwitchStatement */: + if (statement.kind === 248 /* SyntaxKind.ContinueStatement */) { return false; } // falls through - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: return !statement.label || isLabeledBy(node, statement.label.escapedText); default: // Don't cross function boundaries. @@ -137395,26 +138585,26 @@ var ts; // Types of node whose children might have modifiers. var container = declaration.parent; switch (container.kind) { - case 262 /* SyntaxKind.ModuleBlock */: - case 305 /* SyntaxKind.SourceFile */: - case 235 /* SyntaxKind.Block */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 265 /* SyntaxKind.ModuleBlock */: + case 308 /* SyntaxKind.SourceFile */: + case 238 /* SyntaxKind.Block */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // Container is either a class declaration or the declaration is a classDeclaration - if (modifierFlag & 128 /* ModifierFlags.Abstract */ && ts.isClassDeclaration(declaration)) { + if (modifierFlag & 256 /* ModifierFlags.Abstract */ && ts.isClassDeclaration(declaration)) { return __spreadArray(__spreadArray([], declaration.members, true), [declaration], false); } else { return container.statements; } - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return __spreadArray(__spreadArray([], container.parameters, true), (ts.isClassLike(container.parent) ? container.parent.members : []), true); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: var nodes = container.members; // If we're an accessibility modifier, we're in an instance member and should search // the constructor's parameter list for instance members as well. @@ -137424,12 +138614,12 @@ var ts; return __spreadArray(__spreadArray([], nodes, true), constructor.parameters, true); } } - else if (modifierFlag & 128 /* ModifierFlags.Abstract */) { + else if (modifierFlag & 256 /* ModifierFlags.Abstract */) { return __spreadArray(__spreadArray([], nodes, true), [container], false); } return nodes; // Syntactically invalid positions that the parser might produce anyway - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return undefined; default: ts.Debug.assertNever(container, "Invalid container kind."); @@ -137450,7 +138640,7 @@ var ts; var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 97 /* SyntaxKind.ForKeyword */, 115 /* SyntaxKind.WhileKeyword */, 90 /* SyntaxKind.DoKeyword */)) { // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 240 /* SyntaxKind.DoStatement */) { + if (loopNode.kind === 243 /* SyntaxKind.DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 115 /* SyntaxKind.WhileKeyword */)) { @@ -137470,13 +138660,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -137549,13 +138739,13 @@ var ts; var keywords = []; if (func.modifiers) { func.modifiers.forEach(function (modifier) { - pushKeywordIf(keywords, modifier, 131 /* SyntaxKind.AsyncKeyword */); + pushKeywordIf(keywords, modifier, 132 /* SyntaxKind.AsyncKeyword */); }); } ts.forEachChild(func, function (child) { traverseWithoutCrossingFunction(child, function (node) { if (ts.isAwaitExpression(node)) { - pushKeywordIf(keywords, node.getFirstToken(), 132 /* SyntaxKind.AwaitKeyword */); + pushKeywordIf(keywords, node.getFirstToken(), 133 /* SyntaxKind.AwaitKeyword */); } }); }); @@ -137939,14 +139129,14 @@ var ts; if (cancellationToken) cancellationToken.throwIfCancellationRequested(); switch (direct.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(direct)) { handleImportCall(direct); break; } if (!isAvailableThroughGlobal) { var parent = direct.parent; - if (exportKind === 2 /* ExportKind.ExportEquals */ && parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (exportKind === 2 /* ExportKind.ExportEquals */ && parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { var name = parent.name; if (name.kind === 79 /* SyntaxKind.Identifier */) { directImports.push(name); @@ -137957,25 +139147,25 @@ var ts; break; case 79 /* SyntaxKind.Identifier */: // for 'const x = require("y"); break; // TODO: GH#23879 - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: handleNamespaceImport(direct, direct.name, ts.hasSyntacticModifier(direct, 1 /* ModifierFlags.Export */), /*alreadyAddedDirect*/ false); break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: directImports.push(direct); var namedBindings = direct.importClause && direct.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings && namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { handleNamespaceImport(direct, namedBindings.name, /*isReExport*/ false, /*alreadyAddedDirect*/ true); } else if (!isAvailableThroughGlobal && ts.isDefaultImport(direct)) { addIndirectUser(getSourceFileLikeForImportDeclaration(direct)); // Add a check for indirect uses to handle synthetic default imports } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (!direct.exportClause) { // This is `export * from "foo"`, so imports of this module may import the export too. handleDirectImports(getContainingModuleSymbol(direct, checker)); } - else if (direct.exportClause.kind === 274 /* SyntaxKind.NamespaceExport */) { + else if (direct.exportClause.kind === 277 /* SyntaxKind.NamespaceExport */) { // `export * as foo from "foo"` add to indirect uses addIndirectUser(getSourceFileLikeForImportDeclaration(direct), /** addTransitiveDependencies */ true); } @@ -137984,7 +139174,7 @@ var ts; directImports.push(direct); } break; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: // Only check for typeof import('xyz') if (direct.isTypeOf && !direct.qualifier && isExported(direct)) { addIndirectUser(direct.getSourceFile(), /** addTransitiveDependencies */ true); @@ -138017,7 +139207,7 @@ var ts; } else if (!isAvailableThroughGlobal) { var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration); - ts.Debug.assert(sourceFileLike.kind === 305 /* SyntaxKind.SourceFile */ || sourceFileLike.kind === 261 /* SyntaxKind.ModuleDeclaration */); + ts.Debug.assert(sourceFileLike.kind === 308 /* SyntaxKind.SourceFile */ || sourceFileLike.kind === 264 /* SyntaxKind.ModuleDeclaration */); if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) { addIndirectUser(sourceFileLike, /** addTransitiveDependencies */ true); } @@ -138073,7 +139263,7 @@ var ts; } return { importSearches: importSearches, singleReferences: singleReferences }; function handleImport(decl) { - if (decl.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (decl.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { if (isExternalModuleImportEquals(decl)) { handleNamespaceImportLike(decl.name); } @@ -138083,7 +139273,7 @@ var ts; handleNamespaceImportLike(decl); return; } - if (decl.kind === 200 /* SyntaxKind.ImportType */) { + if (decl.kind === 202 /* SyntaxKind.ImportType */) { if (decl.qualifier) { var firstIdentifier = ts.getFirstIdentifier(decl.qualifier); if (firstIdentifier.escapedText === ts.symbolName(exportSymbol)) { @@ -138099,7 +139289,7 @@ var ts; if (decl.moduleSpecifier.kind !== 10 /* SyntaxKind.StringLiteral */) { return; } - if (decl.kind === 272 /* SyntaxKind.ExportDeclaration */) { + if (decl.kind === 275 /* SyntaxKind.ExportDeclaration */) { if (decl.exportClause && ts.isNamedExports(decl.exportClause)) { searchForNamedImport(decl.exportClause); } @@ -138108,10 +139298,10 @@ var ts; var _a = decl.importClause || { name: undefined, namedBindings: undefined }, name = _a.name, namedBindings = _a.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: handleNamespaceImportLike(namedBindings.name); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: // 'default' might be accessed as a named import `{ default as foo }`. if (exportKind === 0 /* ExportKind.Named */ || exportKind === 1 /* ExportKind.Default */) { searchForNamedImport(namedBindings); @@ -138161,7 +139351,7 @@ var ts; } } else { - var localSymbol = element.kind === 275 /* SyntaxKind.ExportSpecifier */ && element.propertyName + var localSymbol = element.kind === 278 /* SyntaxKind.ExportSpecifier */ && element.propertyName ? checker.getExportSpecifierLocalTargetSymbol(element) // For re-exporting under a different name, we want to get the re-exported symbol. : checker.getSymbolAtLocation(name); addSearch(name, localSymbol); @@ -138190,7 +139380,7 @@ var ts; for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { var referencingFile = sourceFiles_1[_i]; var searchSourceFile = searchModuleSymbol.valueDeclaration; - if ((searchSourceFile === null || searchSourceFile === void 0 ? void 0 : searchSourceFile.kind) === 305 /* SyntaxKind.SourceFile */) { + if ((searchSourceFile === null || searchSourceFile === void 0 ? void 0 : searchSourceFile.kind) === 308 /* SyntaxKind.SourceFile */) { for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) { var ref = _b[_a]; if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) { @@ -138238,7 +139428,7 @@ var ts; } /** Iterates over all statements at the top level or in module declarations. Returns the first truthy result. */ function forEachPossibleImportOrExportStatement(sourceFileLike, action) { - return ts.forEach(sourceFileLike.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { + return ts.forEach(sourceFileLike.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { return action(statement) || (isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action)); }); } @@ -138253,15 +139443,15 @@ var ts; else { forEachPossibleImportOrExportStatement(sourceFile, function (statement) { switch (statement.kind) { - case 272 /* SyntaxKind.ExportDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: { + case 275 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: { var decl = statement; if (decl.moduleSpecifier && ts.isStringLiteral(decl.moduleSpecifier)) { action(decl, decl.moduleSpecifier); } break; } - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { var decl = statement; if (isExternalModuleImportEquals(decl)) { action(decl, decl.moduleReference.expression); @@ -138286,7 +139476,7 @@ var ts; var parent = node.parent; var grandparent = parent.parent; if (symbol.exportSymbol) { - if (parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { // When accessing an export of a JS module, there's no alias. The symbol will still be flagged as an export even though we're at the use. // So check that we are at the declaration. return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d === parent; })) && ts.isBinaryExpression(grandparent) @@ -138370,6 +139560,8 @@ var ts; // Similarly, skip past the symbol for 'export =' if (importedSymbol.escapedName === "export=") { importedSymbol = getExportEqualsLocalSymbol(importedSymbol, checker); + if (importedSymbol === undefined) + return undefined; } // If the import has a different name than the export, do not continue searching. // If `importedName` is undefined, do continue searching as the export is anonymous. @@ -138385,25 +139577,25 @@ var ts; } // Not meant for use with export specifiers or export assignment. function getExportKindForDeclaration(node) { - return ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) ? 1 /* ExportKind.Default */ : 0 /* ExportKind.Named */; + return ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) ? 1 /* ExportKind.Default */ : 0 /* ExportKind.Named */; } } FindAllReferences.getImportOrExportSymbol = getImportOrExportSymbol; function getExportEqualsLocalSymbol(importedSymbol, checker) { if (importedSymbol.flags & 2097152 /* SymbolFlags.Alias */) { - return ts.Debug.checkDefined(checker.getImmediateAliasedSymbol(importedSymbol)); + return checker.getImmediateAliasedSymbol(importedSymbol); } var decl = ts.Debug.checkDefined(importedSymbol.valueDeclaration); if (ts.isExportAssignment(decl)) { // `export = class {}` - return ts.Debug.checkDefined(decl.expression.symbol); + return decl.expression.symbol; } else if (ts.isBinaryExpression(decl)) { // `module.exports = class {}` - return ts.Debug.checkDefined(decl.right.symbol); + return decl.right.symbol; } else if (ts.isSourceFile(decl)) { // json module - return ts.Debug.checkDefined(decl.symbol); + return decl.symbol; } - return ts.Debug.fail(); + return undefined; } // If a reference is a class expression, the exported node would be its parent. // If a reference is a variable declaration, the exported node would be the variable statement. @@ -138420,16 +139612,16 @@ var ts; function isNodeImport(node) { var parent = node.parent; switch (parent.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return parent.name === node && isExternalModuleImportEquals(parent); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: // For a rename import `{ foo as bar }`, don't search for the imported symbol. Just find local uses of `bar`. return !parent.propertyName; - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: ts.Debug.assert(parent.name === node); return true; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(parent.parent.parent); default: return false; @@ -138470,21 +139662,21 @@ var ts; return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol); } function getSourceFileLikeForImportDeclaration(node) { - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { return node.getSourceFile(); } var parent = node.parent; - if (parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */) { return parent; } - ts.Debug.assert(parent.kind === 262 /* SyntaxKind.ModuleBlock */); + ts.Debug.assert(parent.kind === 265 /* SyntaxKind.ModuleBlock */); return ts.cast(parent.parent, isAmbientModuleDeclaration); } function isAmbientModuleDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && node.name.kind === 10 /* SyntaxKind.StringLiteral */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && node.name.kind === 10 /* SyntaxKind.StringLiteral */; } function isExternalModuleImportEquals(eq) { - return eq.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* SyntaxKind.StringLiteral */; + return eq.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* SyntaxKind.StringLiteral */; } })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); @@ -138578,7 +139770,7 @@ var ts; ((ts.isImportOrExportSpecifier(node.parent) || ts.isBindingElement(node.parent)) && node.parent.propertyName === node) || // Is default export - (node.kind === 88 /* SyntaxKind.DefaultKeyword */ && ts.hasSyntacticModifier(node.parent, 513 /* ModifierFlags.ExportDefault */))) { + (node.kind === 88 /* SyntaxKind.DefaultKeyword */ && ts.hasSyntacticModifier(node.parent, 1025 /* ModifierFlags.ExportDefault */))) { return getContextNode(node.parent); } return undefined; @@ -138587,7 +139779,7 @@ var ts; if (!node) return undefined; switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return !ts.isVariableDeclarationList(node.parent) || node.parent.declarations.length !== 1 ? node : ts.isVariableStatement(node.parent.parent) ? @@ -138595,28 +139787,28 @@ var ts; ts.isForInOrOfStatement(node.parent.parent) ? getContextNode(node.parent.parent) : node.parent; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getContextNode(node.parent.parent); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent; - case 275 /* SyntaxKind.ExportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent; - case 267 /* SyntaxKind.ImportClause */: - case 274 /* SyntaxKind.NamespaceExport */: + case 270 /* SyntaxKind.ImportClause */: + case 277 /* SyntaxKind.NamespaceExport */: return node.parent; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return ts.isExpressionStatement(node.parent) ? node.parent : node; - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return { start: node.initializer, end: node.expression }; - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent) ? getContextNode(ts.findAncestor(node.parent, function (node) { return ts.isBinaryExpression(node) || ts.isForInOrOfStatement(node); @@ -138677,15 +139869,15 @@ var ts; return node.kind === 88 /* SyntaxKind.DefaultKeyword */ || !!ts.getDeclarationFromName(node) || ts.isLiteralComputedPropertyDeclarationName(node) - || (node.kind === 134 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent)); + || (node.kind === 135 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent)); } function getImplementationsAtPosition(program, cancellationToken, sourceFiles, sourceFile, position) { var node = ts.getTouchingPropertyName(sourceFile, position); var referenceEntries; var entries = getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position); - if (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || node.parent.kind === 203 /* SyntaxKind.BindingElement */ - || node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ + if (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || node.parent.kind === 205 /* SyntaxKind.BindingElement */ + || node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ || node.kind === 106 /* SyntaxKind.SuperKeyword */) { referenceEntries = entries && __spreadArray([], entries, true); } @@ -138709,13 +139901,13 @@ var ts; } FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition; function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return undefined; } var checker = program.getTypeChecker(); // If invoked directly on a shorthand property assignment, then return // the declaration of the symbol being assigned (not the symbol being assigned to). - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var result_2 = []; Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_2.push(nodeEntry(node)); }); return result_2; @@ -138891,13 +140083,13 @@ var ts; if (symbol) { return getDefinitionKindAndDisplayParts(symbol, checker, node); } - else if (node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + else if (node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return { kind: "interface" /* ScriptElementKind.interfaceElement */, displayParts: [ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */), ts.textPart("object literal"), ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)] }; } - else if (node.kind === 226 /* SyntaxKind.ClassExpression */) { + else if (node.kind === 228 /* SyntaxKind.ClassExpression */) { return { kind: "local class" /* ScriptElementKind.localClassElement */, displayParts: [ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */), ts.textPart("anonymous local class"), ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)] @@ -138951,7 +140143,7 @@ var ts; var source = ts.getDeclarationFromName(node) || (node.kind === 88 /* SyntaxKind.DefaultKeyword */ ? node.parent : ts.isLiteralComputedPropertyDeclarationName(node) ? node.parent.parent - : node.kind === 134 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent) ? node.parent.parent + : node.kind === 135 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent) ? node.parent.parent : undefined); var commonjsSource = source && ts.isBinaryExpression(source) ? source.left : undefined; return !!(source && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d === source || d === commonjsSource; }))); @@ -138966,47 +140158,47 @@ var ts; if (!!(decl.flags & 16777216 /* NodeFlags.Ambient */)) return true; switch (decl.kind) { - case 221 /* SyntaxKind.BinaryExpression */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: case 88 /* SyntaxKind.DefaultKeyword */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: // default import - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 285 /* SyntaxKind.JsxAttribute */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 274 /* SyntaxKind.NamespaceExport */: - case 164 /* SyntaxKind.Parameter */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 163 /* SyntaxKind.TypeParameter */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: // default import + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 288 /* SyntaxKind.JsxAttribute */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 277 /* SyntaxKind.NamespaceExport */: + case 166 /* SyntaxKind.Parameter */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: return true; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // In `({ x: y } = 0);`, `x` is not a write access. (Won't call this function for `y`.) return !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(decl.parent); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return !!decl.body; - case 254 /* SyntaxKind.VariableDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return !!decl.initializer || ts.isCatchClause(decl.parent); - case 168 /* SyntaxKind.MethodSignature */: - case 166 /* SyntaxKind.PropertySignature */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: + case 170 /* SyntaxKind.MethodSignature */: + case 168 /* SyntaxKind.PropertySignature */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return false; default: return ts.Debug.failBadSyntaxKind(decl); @@ -139232,10 +140424,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; switch (decl.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // Don't include the source file itself. (This may not be ideal behavior, but awkward to include an entire file as a reference.) break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (sourceFilesSet.has(decl.getSourceFile().fileName)) { references.push(nodeEntry(decl.name)); } @@ -139264,9 +140456,9 @@ var ts; } /** As in a `readonly prop: any` or `constructor(readonly prop: any)`, not a `readonly any[]`. */ function isReadonlyTypeOperator(node) { - return node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ + return node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(node.parent) - && node.parent.operator === 145 /* SyntaxKind.ReadonlyKeyword */; + && node.parent.operator === 146 /* SyntaxKind.ReadonlyKeyword */; } /** getReferencedSymbols for special node kinds. */ function getReferencedSymbolsSpecial(node, sourceFiles, cancellationToken) { @@ -139277,12 +140469,12 @@ var ts; } // A modifier readonly (like on a property declaration) is not special; // a readonly type keyword (like `readonly string[]`) is. - if (node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ && !isReadonlyTypeOperator(node)) { + if (node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && !isReadonlyTypeOperator(node)) { return undefined; } // Likewise, when we *are* looking for a special keyword, make sure we // *don’t* include readonly member modifiers. - return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken, node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ ? isReadonlyTypeOperator : undefined); + return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken, node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ ? isReadonlyTypeOperator : undefined); } if (ts.isImportMeta(node.parent) && node.parent.name === node) { return getAllReferencesForImportMeta(sourceFiles, cancellationToken); @@ -139349,8 +140541,8 @@ var ts; } function getSpecialSearchKind(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 134 /* SyntaxKind.ConstructorKeyword */: + case 173 /* SyntaxKind.Constructor */: + case 135 /* SyntaxKind.ConstructorKeyword */: return 1 /* SpecialSearchKind.Constructor */; case 79 /* SyntaxKind.Identifier */: if (ts.isClassLike(node.parent)) { @@ -139598,7 +140790,7 @@ var ts; // If this is the symbol of a named function expression or named class expression, // then named references are limited to its own scope. var declarations = symbol.declarations, flags = symbol.flags, parent = symbol.parent, valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 213 /* SyntaxKind.FunctionExpression */ || valueDeclaration.kind === 226 /* SyntaxKind.ClassExpression */)) { + if (valueDeclaration && (valueDeclaration.kind === 215 /* SyntaxKind.FunctionExpression */ || valueDeclaration.kind === 228 /* SyntaxKind.ClassExpression */)) { return valueDeclaration; } if (!declarations) { @@ -139608,7 +140800,7 @@ var ts; if (flags & (4 /* SymbolFlags.Property */ | 8192 /* SymbolFlags.Method */)) { var privateDeclaration = ts.find(declarations, function (d) { return ts.hasEffectiveModifier(d, 8 /* ModifierFlags.Private */) || ts.isPrivateIdentifierClassElementDeclaration(d); }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 257 /* SyntaxKind.ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 260 /* SyntaxKind.ClassDeclaration */); } // Else this is a public property and could be accessed from anywhere. return undefined; @@ -139637,7 +140829,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (!container || container.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { + if (!container || container.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { // This is a global variable and not an external module, any declaration defined // within this scope is visible outside the file return undefined; @@ -139895,7 +141087,7 @@ var ts; } // Use the parent symbol if the location is commonjs require syntax on javascript files only. if (ts.isInJSFile(referenceLocation) - && referenceLocation.parent.kind === 203 /* SyntaxKind.BindingElement */ + && referenceLocation.parent.kind === 205 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(referenceLocation.parent.parent.parent)) { referenceSymbol = referenceLocation.parent.symbol; // The parent will not have a symbol if it's an ObjectBindingPattern (when destructuring is used). In @@ -140002,7 +141194,7 @@ var ts; } } function addReference(referenceLocation, relatedSymbol, state) { - var _a = "kind" in relatedSymbol ? relatedSymbol : { kind: undefined, symbol: relatedSymbol }, kind = _a.kind, symbol = _a.symbol; // eslint-disable-line no-in-operator + var _a = "kind" in relatedSymbol ? relatedSymbol : { kind: undefined, symbol: relatedSymbol }, kind = _a.kind, symbol = _a.symbol; // eslint-disable-line local/no-in-operator // if rename symbol from default export anonymous function, for example `export default function() {}`, we do not need to add reference if (state.options.use === 2 /* FindReferencesUse.Rename */ && referenceLocation.kind === 88 /* SyntaxKind.DefaultKeyword */) { return; @@ -140068,15 +141260,15 @@ var ts; if (constructorSymbol && constructorSymbol.declarations) { for (var _i = 0, _a = constructorSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - var ctrKeyword = ts.findChildOfKind(decl, 134 /* SyntaxKind.ConstructorKeyword */, sourceFile); - ts.Debug.assert(decl.kind === 171 /* SyntaxKind.Constructor */ && !!ctrKeyword); + var ctrKeyword = ts.findChildOfKind(decl, 135 /* SyntaxKind.ConstructorKeyword */, sourceFile); + ts.Debug.assert(decl.kind === 173 /* SyntaxKind.Constructor */ && !!ctrKeyword); addNode(ctrKeyword); } } if (classSymbol.exports) { classSymbol.exports.forEach(function (member) { var decl = member.valueDeclaration; - if (decl && decl.kind === 169 /* SyntaxKind.MethodDeclaration */) { + if (decl && decl.kind === 171 /* SyntaxKind.MethodDeclaration */) { var body = decl.body; if (body) { forEachDescendantOfKind(body, 108 /* SyntaxKind.ThisKeyword */, function (thisKeyword) { @@ -140100,7 +141292,7 @@ var ts; } for (var _i = 0, _a = constructor.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - ts.Debug.assert(decl.kind === 171 /* SyntaxKind.Constructor */); + ts.Debug.assert(decl.kind === 173 /* SyntaxKind.Constructor */); var body = decl.body; if (body) { forEachDescendantOfKind(body, 106 /* SyntaxKind.SuperKeyword */, function (node) { @@ -140130,7 +141322,7 @@ var ts; if (refNode.kind !== 79 /* SyntaxKind.Identifier */) { return; } - if (refNode.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (refNode.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { // Go ahead and dereference the shorthand assignment by going to its definition getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference); } @@ -140150,7 +141342,7 @@ var ts; } else if (ts.isFunctionLike(typeHavingNode) && typeHavingNode.body) { var body = typeHavingNode.body; - if (body.kind === 235 /* SyntaxKind.Block */) { + if (body.kind === 238 /* SyntaxKind.Block */) { ts.forEachReturnStatement(body, function (returnStatement) { if (returnStatement.expression) addIfImplementation(returnStatement.expression); @@ -140178,13 +141370,13 @@ var ts; */ function isImplementationExpression(node) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isImplementationExpression(node.expression); - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return true; default: return false; @@ -140237,13 +141429,13 @@ var ts; // Whether 'super' occurs in a static context within a class. var staticFlag = 32 /* ModifierFlags.Static */; switch (searchSpaceNode.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; @@ -140264,43 +141456,43 @@ var ts; return [{ definition: { type: 0 /* DefinitionKind.Symbol */, symbol: searchSpaceNode.symbol }, references: references }]; } function isParameterName(node) { - return node.kind === 79 /* SyntaxKind.Identifier */ && node.parent.kind === 164 /* SyntaxKind.Parameter */ && node.parent.name === node; + return node.kind === 79 /* SyntaxKind.Identifier */ && node.parent.kind === 166 /* SyntaxKind.Parameter */ && node.parent.name === node; } function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles, cancellationToken) { var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); // Whether 'this' occurs in a static context within a class. var staticFlag = 32 /* ModifierFlags.Static */; switch (searchSpaceNode.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode)) { staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning object literals break; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (ts.isExternalModule(searchSpaceNode) || isParameterName(thisOrSuperKeyword)) { return undefined; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: break; // Computed properties in classes are not handled here because references to this are illegal, // so there is no point finding references to them. default: return undefined; } - var references = ts.flatMap(searchSpaceNode.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) { + var references = ts.flatMap(searchSpaceNode.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) { cancellationToken.throwIfCancellationRequested(); return getPossibleSymbolReferenceNodes(sourceFile, "this", ts.isSourceFile(searchSpaceNode) ? sourceFile : searchSpaceNode).filter(function (node) { if (!ts.isThis(node)) { @@ -140308,20 +141500,20 @@ var ts; } var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); switch (searchSpaceNode.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return searchSpaceNode.symbol === container.symbol; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol; - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: // Make sure the container belongs to the same class/object literals // and has the appropriate static modifier from the original container. return container.parent && searchSpaceNode.symbol === container.parent.symbol && ts.isStatic(container) === !!staticFlag; - case 305 /* SyntaxKind.SourceFile */: - return container.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node); + case 308 /* SyntaxKind.SourceFile */: + return container.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node); } }); }).map(function (n) { return nodeEntry(n); }); @@ -140432,7 +141624,7 @@ var ts; ts.Debug.assert(paramProps.length === 2 && !!(paramProps[0].flags & 1 /* SymbolFlags.FunctionScopedVariable */) && !!(paramProps[1].flags & 4 /* SymbolFlags.Property */)); // is [parameter, property] return fromRoot(symbol.flags & 1 /* SymbolFlags.FunctionScopedVariable */ ? paramProps[1] : paramProps[0]); } - var exportSpecifier = ts.getDeclarationOfKind(symbol, 275 /* SyntaxKind.ExportSpecifier */); + var exportSpecifier = ts.getDeclarationOfKind(symbol, 278 /* SyntaxKind.ExportSpecifier */); if (!isForRenamePopulateSearchSymbolSet || exportSpecifier && !exportSpecifier.propertyName) { var localSymbol = exportSpecifier && checker.getExportSpecifierLocalTargetSymbol(exportSpecifier); if (localSymbol) { @@ -140477,7 +141669,7 @@ var ts; }); } function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker) { - var bindingElement = ts.getDeclarationOfKind(symbol, 203 /* SyntaxKind.BindingElement */); + var bindingElement = ts.getDeclarationOfKind(symbol, 205 /* SyntaxKind.BindingElement */); if (bindingElement && ts.isObjectBindingElementWithoutPropertyName(bindingElement)) { return ts.getPropertySymbolFromBindingElement(checker, bindingElement); } @@ -140740,16 +141932,16 @@ var ts; return; } switch (node.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - if (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + if (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return (_a = ts.getAssignedName(node.parent)) === null || _a === void 0 ? void 0 : _a.getText(); } return (_b = ts.getNameOfDeclaration(node.parent)) === null || _b === void 0 ? void 0 : _b.getText(); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.isModuleBlock(node.parent) && ts.isIdentifier(node.parent.parent.name)) { return node.parent.parent.name.getText(); } @@ -140964,61 +142156,65 @@ var ts; } switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // do not descend into nodes that cannot contain callable nodes return; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: recordCallSite(node); return; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: // do not descend into the type side of an assertion collect(node.expression); return; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: // do not descend into the type of a variable or parameter declaration collect(node.name); collect(node.initializer); return; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: // do not descend into the type arguments of a call expression recordCallSite(node); collect(node.expression); ts.forEach(node.arguments, collect); return; - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: // do not descend into the type arguments of a new expression recordCallSite(node); collect(node.expression); ts.forEach(node.arguments, collect); return; - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // do not descend into the type arguments of a tagged template expression recordCallSite(node); collect(node.tag); collect(node.template); return; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: // do not descend into the type arguments of a JsxOpeningLikeElement recordCallSite(node); collect(node.tagName); collect(node.attributes); return; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: recordCallSite(node); collect(node.expression); return; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: recordCallSite(node); ts.forEachChild(node, collect); break; + case 235 /* SyntaxKind.SatisfiesExpression */: + // do not descend into the type side of an assertion + collect(node.expression); + return; } if (ts.isPartOfTypeNode(node)) { // do not descend into types @@ -141073,25 +142269,25 @@ var ts; var callSites = []; var collect = createCallSiteCollector(program, callSites); switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: collectCallSitesOfSourceFile(node, collect); break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: collectCallSitesOfModuleDeclaration(node, collect); break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: collectCallSitesOfFunctionLikeDeclaration(program.getTypeChecker(), node, collect); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: collectCallSitesOfClassLikeDeclaration(node, collect); break; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: collectCallSitesOfClassStaticBlockDeclaration(node, collect); break; default: @@ -141362,7 +142558,7 @@ var ts; } var parent = node.parent; var typeChecker = program.getTypeChecker(); - if (node.kind === 159 /* SyntaxKind.OverrideKeyword */ || (ts.isJSDocOverrideTag(node) && ts.rangeContainsPosition(node.tagName, position))) { + if (node.kind === 161 /* SyntaxKind.OverrideKeyword */ || (ts.isIdentifier(node) && ts.isJSDocOverrideTag(parent) && parent.tagName === node)) { return getDefinitionFromOverriddenMember(typeChecker, node) || ts.emptyArray; } // Labels @@ -141438,7 +142634,7 @@ var ts; // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var shorthandSymbol_1 = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); var definitions = (shorthandSymbol_1 === null || shorthandSymbol_1 === void 0 ? void 0 : shorthandSymbol_1.declarations) ? shorthandSymbol_1.declarations.map(function (decl) { return createDefinitionInfo(decl, typeChecker, shorthandSymbol_1, node, /*unverified*/ false, failedAliasResolution); }) : ts.emptyArray; return ts.concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node) || ts.emptyArray); @@ -141644,7 +142840,7 @@ var ts; if (node.parent === declaration) { return true; } - if (declaration.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (declaration.kind === 271 /* SyntaxKind.NamespaceImport */) { return false; } return true; @@ -141686,7 +142882,7 @@ var ts; function getConstructSignatureDefinition() { // Applicable only if we are in a new expression, or we are on a constructor declaration // and in either case the symbol has a construct signature definition, i.e. class - if (symbol.flags & 32 /* SymbolFlags.Class */ && !(symbol.flags & (16 /* SymbolFlags.Function */ | 3 /* SymbolFlags.Variable */)) && (ts.isNewExpressionTarget(node) || node.kind === 134 /* SyntaxKind.ConstructorKeyword */)) { + if (symbol.flags & 32 /* SymbolFlags.Class */ && !(symbol.flags & (16 /* SymbolFlags.Function */ | 3 /* SymbolFlags.Variable */)) && (ts.isNewExpressionTarget(node) || node.kind === 135 /* SyntaxKind.ConstructorKeyword */)) { var cls = ts.find(filteredDeclarations, ts.isClassLike) || ts.Debug.fail("Expected declaration to have at least one class-like declaration"); return getSignatureDefinition(cls.members, /*selectConstructors*/ true); } @@ -141738,22 +142934,22 @@ var ts; return isDefinitionVisible(checker, declaration.parent); // Handle some exceptions here like arrow function, members of class and object literal expression which are technically not visible but we want the definition to be determined by its parent switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: // Private/protected properties/methods are not visible if (ts.hasEffectiveModifier(declaration, 8 /* ModifierFlags.Private */)) return false; // Public properties/methods are visible if its parents are visible, so: // falls through - case 171 /* SyntaxKind.Constructor */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: return isDefinitionVisible(checker, declaration.parent); default: return false; @@ -141791,9 +142987,9 @@ var ts; } function isConstructorLike(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 173 /* SyntaxKind.Constructor */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return true; default: return false; @@ -141899,17 +143095,17 @@ var ts; ts.forEachUnique(declarations, function (declaration) { for (var _i = 0, _a = getCommentHavingNodes(declaration); _i < _a.length; _i++) { var jsdoc = _a[_i]; - var inheritDoc = ts.isJSDoc(jsdoc) && jsdoc.tags && ts.find(jsdoc.tags, function (t) { return t.kind === 327 /* SyntaxKind.JSDocTag */ && (t.tagName.escapedText === "inheritDoc" || t.tagName.escapedText === "inheritdoc"); }); + var inheritDoc = ts.isJSDoc(jsdoc) && jsdoc.tags && ts.find(jsdoc.tags, function (t) { return t.kind === 330 /* SyntaxKind.JSDocTag */ && (t.tagName.escapedText === "inheritDoc" || t.tagName.escapedText === "inheritdoc"); }); // skip comments containing @typedefs since they're not associated with particular declarations // Exceptions: // - @typedefs are themselves declarations with associated comments // - @param or @return indicate that the author thinks of it as a 'local' @typedef that's part of the function documentation if (jsdoc.comment === undefined && !inheritDoc || ts.isJSDoc(jsdoc) - && declaration.kind !== 345 /* SyntaxKind.JSDocTypedefTag */ && declaration.kind !== 338 /* SyntaxKind.JSDocCallbackTag */ + && declaration.kind !== 348 /* SyntaxKind.JSDocTypedefTag */ && declaration.kind !== 341 /* SyntaxKind.JSDocCallbackTag */ && jsdoc.tags - && jsdoc.tags.some(function (t) { return t.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 338 /* SyntaxKind.JSDocCallbackTag */; }) - && !jsdoc.tags.some(function (t) { return t.kind === 340 /* SyntaxKind.JSDocParameterTag */ || t.kind === 341 /* SyntaxKind.JSDocReturnTag */; })) { + && jsdoc.tags.some(function (t) { return t.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 341 /* SyntaxKind.JSDocCallbackTag */; }) + && !jsdoc.tags.some(function (t) { return t.kind === 343 /* SyntaxKind.JSDocParameterTag */ || t.kind === 344 /* SyntaxKind.JSDocReturnTag */; })) { continue; } var newparts = jsdoc.comment ? getDisplayPartsFromComment(jsdoc.comment, checker) : []; @@ -141929,11 +143125,11 @@ var ts; } function getCommentHavingNodes(declaration) { switch (declaration.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return [declaration]; - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return [declaration, declaration.parent]; default: return ts.getJSDocCommentsAndTags(declaration); @@ -141947,8 +143143,8 @@ var ts; // skip comments containing @typedefs since they're not associated with particular declarations // Exceptions: // - @param or @return indicate that the author thinks of it as a 'local' @typedef that's part of the function documentation - if (tags.some(function (t) { return t.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 338 /* SyntaxKind.JSDocCallbackTag */; }) - && !tags.some(function (t) { return t.kind === 340 /* SyntaxKind.JSDocParameterTag */ || t.kind === 341 /* SyntaxKind.JSDocReturnTag */; })) { + if (tags.some(function (t) { return t.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 341 /* SyntaxKind.JSDocCallbackTag */; }) + && !tags.some(function (t) { return t.kind === 343 /* SyntaxKind.JSDocParameterTag */ || t.kind === 344 /* SyntaxKind.JSDocReturnTag */; })) { return; } for (var _i = 0, tags_1 = tags; _i < tags_1.length; _i++) { @@ -141963,17 +143159,17 @@ var ts; if (typeof comment === "string") { return [ts.textPart(comment)]; } - return ts.flatMap(comment, function (node) { return node.kind === 321 /* SyntaxKind.JSDocText */ ? [ts.textPart(node.text)] : ts.buildLinkParts(node, checker); }); + return ts.flatMap(comment, function (node) { return node.kind === 324 /* SyntaxKind.JSDocText */ ? [ts.textPart(node.text)] : ts.buildLinkParts(node, checker); }); } function getCommentDisplayParts(tag, checker) { var comment = tag.comment, kind = tag.kind; var namePart = getTagNameDisplayPart(kind); switch (kind) { - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return withNode(tag.class); - case 328 /* SyntaxKind.JSDocAugmentsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: return withNode(tag.class); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: var templateTag = tag; var displayParts_3 = []; if (templateTag.constraint) { @@ -141995,13 +143191,13 @@ var ts; displayParts_3.push.apply(displayParts_3, __spreadArray([ts.spacePart()], getDisplayPartsFromComment(comment, checker), true)); } return displayParts_3; - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return withNode(tag.typeExpression); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: - case 346 /* SyntaxKind.JSDocSeeTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: var name = tag.name; return name ? withNode(name) : comment === undefined ? undefined @@ -142028,14 +143224,14 @@ var ts; } function getTagNameDisplayPart(kind) { switch (kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return ts.parameterNamePart; - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return ts.propertyNamePart; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return ts.typeParameterNamePart; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return ts.typeAliasNamePart; default: return ts.textPart; @@ -142206,24 +143402,24 @@ var ts; } function getCommentOwnerInfoWorker(commentOwner, options) { switch (commentOwner.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 168 /* SyntaxKind.MethodSignature */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 170 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: var host = commentOwner; return { commentOwner: commentOwner, parameters: host.parameters, hasReturn: hasReturn(host, options) }; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getCommentOwnerInfoWorker(commentOwner.initializer, options); - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return { commentOwner: commentOwner }; - case 237 /* SyntaxKind.VariableStatement */: { + case 240 /* SyntaxKind.VariableStatement */: { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; var host_1 = varDeclarations.length === 1 && varDeclarations[0].initializer @@ -142233,16 +143429,16 @@ var ts; ? { commentOwner: commentOwner, parameters: host_1.parameters, hasReturn: hasReturn(host_1, options) } : { commentOwner: commentOwner }; } - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return "quit"; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // If in walking up the tree, we hit a a nested namespace declaration, // then we must be somewhere within a dotted namespace name; however we don't // want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'. - return commentOwner.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? undefined : { commentOwner: commentOwner }; - case 238 /* SyntaxKind.ExpressionStatement */: + return commentOwner.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? undefined : { commentOwner: commentOwner }; + case 241 /* SyntaxKind.ExpressionStatement */: return getCommentOwnerInfoWorker(commentOwner.expression, options); - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var be = commentOwner; if (ts.getAssignmentDeclarationKind(be) === 0 /* AssignmentDeclarationKind.None */) { return "quit"; @@ -142251,7 +143447,7 @@ var ts; ? { commentOwner: commentOwner, parameters: be.right.parameters, hasReturn: hasReturn(be.right, options) } : { commentOwner: commentOwner }; } - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: var init = commentOwner.initializer; if (init && (ts.isFunctionExpression(init) || ts.isArrowFunction(init))) { return { commentOwner: commentOwner, parameters: init.parameters, hasReturn: hasReturn(init, options) }; @@ -142264,14 +143460,14 @@ var ts; || ts.isFunctionLikeDeclaration(node) && node.body && ts.isBlock(node.body) && !!ts.forEachReturnStatement(node.body, function (n) { return n; })); } function getRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (rightHandSide.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return rightHandSide; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return ts.find(rightHandSide.members, ts.isConstructorDeclaration); } } @@ -142330,9 +143526,9 @@ var ts; } function shouldKeepItem(declaration, checker) { switch (declaration.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: var importer = checker.getSymbolAtLocation(declaration.name); // TODO: GH#18217 var imported = checker.getAliasedSymbol(importer); return importer.escapedName !== imported.escapedName; @@ -142342,7 +143538,7 @@ var ts; } function tryAddSingleDeclarationName(declaration, containers) { var name = ts.getNameOfDeclaration(declaration); - return !!name && (pushLiteral(name, containers) || name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers)); + return !!name && (pushLiteral(name, containers) || name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers)); } // Only added the names of computed properties if they're simple dotted expressions, like: // @@ -142359,7 +143555,7 @@ var ts; // First, if we started with a computed property name, then add all but the last // portion into the container array. var name = ts.getNameOfDeclaration(declaration); - if (name && name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) { + if (name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) { return ts.emptyArray; } // Don't include the last portion. @@ -142576,7 +143772,7 @@ var ts; */ function hasNavigationBarName(node) { return !ts.hasDynamicName(node) || - (node.kind !== 221 /* SyntaxKind.BinaryExpression */ && + (node.kind !== 223 /* SyntaxKind.BinaryExpression */ && ts.isPropertyAccessExpression(node.name.expression) && ts.isIdentifier(node.name.expression.expression) && ts.idText(node.name.expression.expression) === "Symbol"); @@ -142589,7 +143785,7 @@ var ts; return; } switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: // Get parameter properties, and treat them as being on the *same* level as the constructor, not under it. var ctr = node; addNodeWithRecursiveChild(ctr, ctr.body); @@ -142601,25 +143797,25 @@ var ts; } } break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 170 /* SyntaxKind.MethodSignature */: if (hasNavigationBarName(node)) { addNodeWithRecursiveChild(node, node.body); } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (hasNavigationBarName(node)) { addNodeWithRecursiveInitializer(node); } break; - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (hasNavigationBarName(node)) { addLeafNode(node); } break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: var importClause = node; // Handle default import case e.g.: // import d from "mod"; @@ -142631,7 +143827,7 @@ var ts; // import {a, b as B} from "mod"; var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { addLeafNode(namedBindings); } else { @@ -142642,17 +143838,17 @@ var ts; } } break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: addNodeWithRecursiveChild(node, node.name); break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: var expression = node.expression; // Use the expression as the name of the SpreadAssignment, otherwise show as . ts.isIdentifier(expression) ? addLeafNode(node, expression) : addLeafNode(node); break; - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 254 /* SyntaxKind.VariableDeclaration */: { + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: { var child = node; if (ts.isBindingPattern(child.name)) { addChildrenRecursively(child.name); @@ -142662,7 +143858,7 @@ var ts; } break; } - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: var nameNode = node.name; // If we see a function declaration track as a possible ES5 class if (nameNode && ts.isIdentifier(nameNode)) { @@ -142670,11 +143866,11 @@ var ts; } addNodeWithRecursiveChild(node, node.body); break; - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: addNodeWithRecursiveChild(node, node.body); break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: startNode(node); for (var _e = 0, _f = node.members; _e < _f.length; _e++) { var member = _f[_e]; @@ -142684,9 +143880,9 @@ var ts; } endNode(); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: startNode(node); for (var _g = 0, _h = node.members; _g < _h.length; _g++) { var member = _h[_g]; @@ -142694,10 +143890,10 @@ var ts; } endNode(); break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var expression_1 = node.expression; var child = ts.isObjectLiteralExpression(expression_1) || ts.isCallExpression(expression_1) ? expression_1 : ts.isArrowFunction(expression_1) || ts.isFunctionExpression(expression_1) ? expression_1.body : undefined; @@ -142711,16 +143907,16 @@ var ts; } break; } - case 275 /* SyntaxKind.ExportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 176 /* SyntaxKind.IndexSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: addLeafNode(node); break; - case 208 /* SyntaxKind.CallExpression */: - case 221 /* SyntaxKind.BinaryExpression */: { + case 210 /* SyntaxKind.CallExpression */: + case 223 /* SyntaxKind.BinaryExpression */: { var special = ts.getAssignmentDeclarationKind(node); switch (special) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -142960,12 +144156,12 @@ var ts; return false; } switch (a.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return ts.isStatic(a) === ts.isStatic(b); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return areSameModule(a, b) && getFullyQualifiedModuleName(a) === getFullyQualifiedModuleName(b); default: @@ -142987,7 +144183,7 @@ var ts; if (!a.body || !b.body) { return a.body === b.body; } - return a.body.kind === b.body.kind && (a.body.kind !== 261 /* SyntaxKind.ModuleDeclaration */ || areSameModule(a.body, b.body)); + return a.body.kind === b.body.kind && (a.body.kind !== 264 /* SyntaxKind.ModuleDeclaration */ || areSameModule(a.body, b.body)); } /** Merge source into target. Source should be thrown away after this is called. */ function merge(target, source) { @@ -143017,7 +144213,7 @@ var ts; * So `new()` can still come before an `aardvark` method. */ function tryGetName(node) { - if (node.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (node.kind === 264 /* SyntaxKind.ModuleDeclaration */) { return getModuleName(node); } var declName = ts.getNameOfDeclaration(node); @@ -143026,16 +144222,16 @@ var ts; return propertyName && ts.unescapeLeadingUnderscores(propertyName); } switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 226 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: return getFunctionOrClassName(node); default: return undefined; } } function getItemName(node, name) { - if (node.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (node.kind === 264 /* SyntaxKind.ModuleDeclaration */) { return cleanText(getModuleName(node)); } if (name) { @@ -143047,32 +144243,32 @@ var ts; } } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"".concat(ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))), "\"") : ""; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return ts.isExportAssignment(node) && node.isExportEquals ? "export=" /* InternalSymbolName.ExportEquals */ : "default" /* InternalSymbolName.Default */; - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - if (ts.getSyntacticModifierFlags(node) & 512 /* ModifierFlags.Default */) { + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + if (ts.getSyntacticModifierFlags(node) & 1024 /* ModifierFlags.Default */) { return "default"; } // We may get a string with newlines or other whitespace in the case of an object dereference // (eg: "app\n.onactivated"), so we should remove the whitespace for readability in the // navigation bar. return getFunctionOrClassName(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "constructor"; - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return "new()"; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: return "()"; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return "[]"; default: return ""; @@ -143105,19 +144301,19 @@ var ts; } // Some nodes are otherwise important enough to always include in the primary navigation menu. switch (navigationBarNodeKind(item)) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 305 /* SyntaxKind.SourceFile */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return true; - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return isTopLevelFunctionDeclaration(item); default: return false; @@ -143127,10 +144323,10 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 262 /* SyntaxKind.ModuleBlock */: - case 305 /* SyntaxKind.SourceFile */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 265 /* SyntaxKind.ModuleBlock */: + case 308 /* SyntaxKind.SourceFile */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: return true; default: return false; @@ -143192,7 +144388,7 @@ var ts; function getFullyQualifiedModuleName(moduleDeclaration) { // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = [ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)]; - while (moduleDeclaration.body && moduleDeclaration.body.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 264 /* SyntaxKind.ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)); } @@ -143206,13 +144402,13 @@ var ts; return decl.body && ts.isModuleDeclaration(decl.body) ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { - return !member.name || member.name.kind === 162 /* SyntaxKind.ComputedPropertyName */; + return !member.name || member.name.kind === 164 /* SyntaxKind.ComputedPropertyName */; } function getNodeSpan(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); } function getModifiers(node) { - if (node.parent && node.parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (node.parent && node.parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { node = node.parent; } return ts.getNodeModifiers(node); @@ -143235,7 +144431,7 @@ var ts; return nodeText(parent.name); } // Default exports are named "default" - else if (ts.getSyntacticModifierFlags(node) & 512 /* ModifierFlags.Default */) { + else if (ts.getSyntacticModifierFlags(node) & 1024 /* ModifierFlags.Default */) { return "default"; } else if (ts.isClassLike(node)) { @@ -143270,9 +144466,9 @@ var ts; } function isFunctionOrClassExpression(node) { switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: return true; default: return false; @@ -143673,11 +144869,11 @@ var ts; function getModuleSpecifierExpression(declaration) { var _a; switch (declaration.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return (_a = ts.tryCast(declaration.moduleReference, ts.isExternalModuleReference)) === null || _a === void 0 ? void 0 : _a.expression; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return declaration.moduleSpecifier; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return declaration.declarationList.declarations[0].initializer.arguments[0]; } } @@ -143716,19 +144912,19 @@ var ts; function getImportKindOrder(s1) { var _a; switch (s1.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: if (!s1.importClause) return 0; if (s1.importClause.isTypeOnly) return 1; - if (((_a = s1.importClause.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 268 /* SyntaxKind.NamespaceImport */) + if (((_a = s1.importClause.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 271 /* SyntaxKind.NamespaceImport */) return 2; if (s1.importClause.name) return 3; return 4; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return 5; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return 6; } } @@ -143917,7 +145113,7 @@ var ts; } function getOutliningSpanForNode(n, sourceFile) { switch (n.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionLike(n.parent)) { return functionSpan(n.parent, n, sourceFile); } @@ -143925,16 +145121,16 @@ var ts; // If the latter, we want to collapse the block, but consider its hint span // to be the entire span of the parent. switch (n.parent.kind) { - case 240 /* SyntaxKind.DoStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 243 /* SyntaxKind.DoStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 295 /* SyntaxKind.CatchClause */: return spanForNode(n.parent); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // Could be the try-block, or the finally-block. var tryStatement = n.parent; if (tryStatement.tryBlock === n) { @@ -143951,42 +145147,42 @@ var ts; // the span of the block, independent of any parent span. return createOutliningSpan(ts.createTextSpanFromNode(n, sourceFile), "code" /* OutliningSpanKind.Code */); } - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return spanForNode(n.parent); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 263 /* SyntaxKind.CaseBlock */: - case 182 /* SyntaxKind.TypeLiteral */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 266 /* SyntaxKind.CaseBlock */: + case 184 /* SyntaxKind.TypeLiteral */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return spanForNode(n); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return spanForNode(n, /*autoCollapse*/ false, /*useFullStart*/ !ts.isTupleTypeNode(n.parent), 22 /* SyntaxKind.OpenBracketToken */); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: return spanForNodeArray(n.statements); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return spanForObjectOrArrayLiteral(n); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return spanForObjectOrArrayLiteral(n, 22 /* SyntaxKind.OpenBracketToken */); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return spanForJSXElement(n); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return spanForJSXFragment(n); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: return spanForJSXAttributes(n.attributes); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return spanForTemplateLiteral(n); - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return spanForNode(n, /*autoCollapse*/ false, /*useFullStart*/ !ts.isBindingElement(n.parent), 22 /* SyntaxKind.OpenBracketToken */); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return spanForArrowFunction(n); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return spanForCallExpression(n); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return spanForParenthesizedExpression(n); } function spanForCallExpression(node) { @@ -144059,7 +145255,7 @@ var ts; function functionSpan(node, body, sourceFile) { var openToken = tryGetFunctionOpenToken(node, body, sourceFile); var closeToken = ts.findChildOfKind(body, 19 /* SyntaxKind.CloseBraceToken */, sourceFile); - return openToken && closeToken && spanBetweenTokens(openToken, closeToken, node, sourceFile, /*autoCollapse*/ node.kind !== 214 /* SyntaxKind.ArrowFunction */); + return openToken && closeToken && spanBetweenTokens(openToken, closeToken, node, sourceFile, /*autoCollapse*/ node.kind !== 216 /* SyntaxKind.ArrowFunction */); } function spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart) { if (autoCollapse === void 0) { autoCollapse = false; } @@ -144603,10 +145799,10 @@ var ts; */ function tryConsumeDeclare() { var token = ts.scanner.getToken(); - if (token === 135 /* SyntaxKind.DeclareKeyword */) { + if (token === 136 /* SyntaxKind.DeclareKeyword */) { // declare module "mod" token = nextToken(); - if (token === 141 /* SyntaxKind.ModuleKeyword */) { + if (token === 142 /* SyntaxKind.ModuleKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { recordAmbientExternalModule(); @@ -144640,10 +145836,10 @@ var ts; return true; } else { - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); - return token !== 156 /* SyntaxKind.FromKeyword */ && (token === 41 /* SyntaxKind.AsteriskToken */ || + return token !== 158 /* SyntaxKind.FromKeyword */ && (token === 41 /* SyntaxKind.AsteriskToken */ || token === 18 /* SyntaxKind.OpenBraceToken */ || token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)); @@ -144654,7 +145850,7 @@ var ts; } if (token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import d from "mod"; @@ -144685,7 +145881,7 @@ var ts; } if (token === 19 /* SyntaxKind.CloseBraceToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import {a as A} from "mod"; @@ -144697,11 +145893,11 @@ var ts; } else if (token === 41 /* SyntaxKind.AsteriskToken */) { token = nextToken(); - if (token === 127 /* SyntaxKind.AsKeyword */) { + if (token === 128 /* SyntaxKind.AsKeyword */) { token = nextToken(); if (token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import * as NS from "mod" @@ -144722,7 +145918,7 @@ var ts; if (token === 93 /* SyntaxKind.ExportKeyword */) { markAsExternalModuleIfTopLevel(); token = nextToken(); - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); return token === 41 /* SyntaxKind.AsteriskToken */ || @@ -144741,7 +145937,7 @@ var ts; } if (token === 19 /* SyntaxKind.CloseBraceToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // export {a as A} from "mod"; @@ -144753,7 +145949,7 @@ var ts; } else if (token === 41 /* SyntaxKind.AsteriskToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // export * from "mod" @@ -144763,7 +145959,7 @@ var ts; } else if (token === 100 /* SyntaxKind.ImportKeyword */) { token = nextToken(); - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); return token === 79 /* SyntaxKind.Identifier */ || @@ -144789,7 +145985,7 @@ var ts; function tryConsumeRequireCall(skipCurrentToken, allowTemplateLiterals) { if (allowTemplateLiterals === void 0) { allowTemplateLiterals = false; } var token = skipCurrentToken ? nextToken() : ts.scanner.getToken(); - if (token === 146 /* SyntaxKind.RequireKeyword */) { + if (token === 147 /* SyntaxKind.RequireKeyword */) { token = nextToken(); if (token === 20 /* SyntaxKind.OpenParenToken */) { token = nextToken(); @@ -145001,7 +146197,7 @@ var ts; return getRenameInfoError(wouldRenameNodeModules); } var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); - var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) + var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) ? ts.stripQuotes(ts.getTextOfIdentifierOrLiteral(node)) : undefined; var displayName = specifierName || typeChecker.symbolToString(symbol); @@ -145146,6 +146342,10 @@ var ts; pushSelectionCommentRange(comment.pos, comment.end); } if (positionShouldSnapToNode(sourceFile, pos, node)) { + if (ts.isFunctionBody(node) + && ts.isFunctionLikeDeclaration(parentNode) && !ts.positionsAreOnSameLine(node.getStart(sourceFile), node.getEnd(), sourceFile)) { + pushSelectionRange(node.getStart(sourceFile), node.getEnd()); + } // 1. Blocks are effectively redundant with SyntaxLists. // 2. TemplateSpans, along with the SyntaxLists containing them, are a somewhat unintuitive grouping // of things that should be considered independently. @@ -145283,14 +146483,14 @@ var ts; ts.Debug.assertEqual(closeBraceToken.kind, 19 /* SyntaxKind.CloseBraceToken */); // Group `-/+readonly` and `-/+?` var groupedWithPlusMinusTokens = groupChildren(children, function (child) { - return child === node.readonlyToken || child.kind === 145 /* SyntaxKind.ReadonlyKeyword */ || + return child === node.readonlyToken || child.kind === 146 /* SyntaxKind.ReadonlyKeyword */ || child === node.questionToken || child.kind === 57 /* SyntaxKind.QuestionToken */; }); // Group type parameter with surrounding brackets var groupedWithBrackets = groupChildren(groupedWithPlusMinusTokens, function (_a) { var kind = _a.kind; return kind === 22 /* SyntaxKind.OpenBracketToken */ || - kind === 163 /* SyntaxKind.TypeParameter */ || + kind === 165 /* SyntaxKind.TypeParameter */ || kind === 23 /* SyntaxKind.CloseBracketToken */; }); return [ @@ -145308,7 +146508,7 @@ var ts; var children = groupChildren(node.getChildren(), function (child) { return child === node.name || ts.contains(node.modifiers, child); }); - var firstJSDocChild = ((_a = children[0]) === null || _a === void 0 ? void 0 : _a.kind) === 320 /* SyntaxKind.JSDoc */ ? children[0] : undefined; + var firstJSDocChild = ((_a = children[0]) === null || _a === void 0 ? void 0 : _a.kind) === 323 /* SyntaxKind.JSDoc */ ? children[0] : undefined; var withJSDocSeparated = firstJSDocChild ? children.slice(1) : children; var splittedChildren = splitChildren(withJSDocSeparated, function (_a) { var kind = _a.kind; @@ -145407,22 +146607,22 @@ var ts; return kind === 18 /* SyntaxKind.OpenBraceToken */ || kind === 22 /* SyntaxKind.OpenBracketToken */ || kind === 20 /* SyntaxKind.OpenParenToken */ - || kind === 280 /* SyntaxKind.JsxOpeningElement */; + || kind === 283 /* SyntaxKind.JsxOpeningElement */; } function isListCloser(token) { var kind = token && token.kind; return kind === 19 /* SyntaxKind.CloseBraceToken */ || kind === 23 /* SyntaxKind.CloseBracketToken */ || kind === 21 /* SyntaxKind.CloseParenToken */ - || kind === 281 /* SyntaxKind.JsxClosingElement */; + || kind === 284 /* SyntaxKind.JsxClosingElement */; } function getEndPos(sourceFile, node) { switch (node.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 342 /* SyntaxKind.JSDocThisTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 345 /* SyntaxKind.JSDocThisTag */: return sourceFile.getLineEndOfPosition(node.getStart()); default: return node.getEnd(); @@ -145632,10 +146832,10 @@ var ts; } return undefined; } - else if (ts.isTemplateHead(node) && parent.parent.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + else if (ts.isTemplateHead(node) && parent.parent.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { var templateExpression = parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 223 /* SyntaxKind.TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 225 /* SyntaxKind.TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position, sourceFile) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } @@ -145707,17 +146907,17 @@ var ts; return undefined; var parent = startingToken.parent; switch (parent.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: var info = getArgumentOrParameterListInfo(startingToken, position, sourceFile); if (!info) return undefined; var argumentIndex = info.argumentIndex, argumentCount = info.argumentCount, argumentsSpan = info.argumentsSpan; var contextualType = ts.isMethodDeclaration(parent) ? checker.getContextualTypeForObjectLiteralElement(parent) : checker.getContextualType(parent); return contextualType && { contextualType: contextualType, argumentIndex: argumentIndex, argumentCount: argumentCount, argumentsSpan: argumentsSpan }; - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var highestBinary = getHighestBinary(parent); var contextualType_1 = checker.getContextualType(highestBinary); var argumentIndex_1 = startingToken.kind === 20 /* SyntaxKind.OpenParenToken */ ? 0 : countBinaryExpressionParameters(parent) - 1; @@ -145788,11 +146988,11 @@ var ts; // not enough to put us in the substitution expression; we should consider ourselves part of // the *next* span's expression by offsetting the index (argIndex = (spanIndex + 1) + 1). // - /* eslint-disable no-double-space */ + /* eslint-disable local/no-double-space */ // Example: f `# abcd $#{# 1 + 1# }# efghi ${ #"#hello"# } # ` // ^ ^ ^ ^ ^ ^ ^ ^ ^ // Case: 1 1 3 2 1 3 2 2 1 - /* eslint-enable no-double-space */ + /* eslint-enable local/no-double-space */ ts.Debug.assert(position >= node.getStart(), "Assumed 'position' could not occur before node."); if (ts.isTemplateLiteralToken(node)) { if (ts.isInsideTemplateLiteral(node, position, sourceFile)) { @@ -145841,7 +147041,7 @@ var ts; // | | // This is because a Missing node has no width. However, what we actually want is to include trivia // leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail. - if (template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (template.kind === 225 /* SyntaxKind.TemplateExpression */) { var lastSpan = ts.last(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); @@ -146046,14 +147246,14 @@ var ts; return; } switch (node.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } if (!ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth())) { @@ -146197,7 +147397,7 @@ var ts; } function isHintableLiteral(node) { switch (node.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: { + case 221 /* SyntaxKind.PrefixUnaryExpression */: { var operand = node.operand; return ts.isLiteralExpression(operand) || ts.isIdentifier(operand) && ts.isInfinityOrNaNString(operand.escapedText); } @@ -146205,7 +147405,7 @@ var ts; case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return true; case 79 /* SyntaxKind.Identifier */: { var name = node.escapedText; @@ -146526,11 +147726,11 @@ var ts; function containsTopLevelCommonjs(sourceFile) { return sourceFile.statements.some(function (statement) { switch (statement.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return statement.declarationList.declarations.some(function (decl) { return !!decl.initializer && ts.isRequireCall(propertyAccessLeftHandSide(decl.initializer), /*checkArgumentIsStringLiteralLike*/ true); }); - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; if (!ts.isBinaryExpression(expression)) return ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true); @@ -146547,12 +147747,12 @@ var ts; } function importNameForConvertToDefaultImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var importClause = node.importClause, moduleSpecifier = node.moduleSpecifier; - return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ && ts.isStringLiteral(moduleSpecifier) + return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ && ts.isStringLiteral(moduleSpecifier) ? importClause.namedBindings.name : undefined; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.name; default: return undefined; @@ -146628,20 +147828,20 @@ var ts; // should be kept up to date with getTransformationBody in convertToAsyncFunction.ts function isFixablePromiseArgument(arg, checker) { switch (arg.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: var functionFlags = ts.getFunctionFlags(arg); if (functionFlags & 1 /* FunctionFlags.Generator */) { return false; } // falls through - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: visitedNestedConvertibleFunctions.set(getKeyFromNode(arg), true); // falls through case 104 /* SyntaxKind.NullKeyword */: return true; case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: { + case 208 /* SyntaxKind.PropertyAccessExpression */: { var symbol = checker.getSymbolAtLocation(arg); if (!symbol) { return false; @@ -146658,24 +147858,24 @@ var ts; } function canBeConvertedToClass(node, checker) { var _a, _b, _c, _d; - if (node.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (node.kind === 215 /* SyntaxKind.FunctionExpression */) { if (ts.isVariableDeclaration(node.parent) && ((_a = node.symbol.members) === null || _a === void 0 ? void 0 : _a.size)) { return true; } var symbol = checker.getSymbolOfExpando(node, /*allowDeclaration*/ false); return !!(symbol && (((_b = symbol.exports) === null || _b === void 0 ? void 0 : _b.size) || ((_c = symbol.members) === null || _c === void 0 ? void 0 : _c.size))); } - if (node.kind === 256 /* SyntaxKind.FunctionDeclaration */) { + if (node.kind === 259 /* SyntaxKind.FunctionDeclaration */) { return !!((_d = node.symbol.members) === null || _d === void 0 ? void 0 : _d.size); } return false; } function canBeConvertedToAsync(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: return false; @@ -146697,7 +147897,7 @@ var ts; } var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol); if (flags & 32 /* SymbolFlags.Class */) { - return ts.getDeclarationOfKind(symbol, 226 /* SyntaxKind.ClassExpression */) ? + return ts.getDeclarationOfKind(symbol, 228 /* SyntaxKind.ClassExpression */) ? "local class" /* ScriptElementKind.localClassElement */ : "class" /* ScriptElementKind.classElement */; } if (flags & 384 /* SymbolFlags.Enum */) @@ -146760,6 +147960,8 @@ var ts; return "method" /* ScriptElementKind.memberFunctionElement */; if (flags & 16384 /* SymbolFlags.Constructor */) return "constructor" /* ScriptElementKind.constructorImplementationElement */; + if (flags & 131072 /* SymbolFlags.Signature */) + return "index" /* ScriptElementKind.indexSignatureElement */; if (flags & 4 /* SymbolFlags.Property */) { if (flags & 33554432 /* SymbolFlags.Transient */ && symbol.checkFlags & 6 /* CheckFlags.Synthetic */) { // If union property is result of union of non method (property/accessors/variables), it is labeled as property @@ -146843,12 +148045,15 @@ var ts; var declaration = ts.find(symbol.declarations, function (declaration) { return declaration.name === location; }); if (declaration) { switch (declaration.kind) { - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: symbolKind = "getter" /* ScriptElementKind.memberGetAccessorElement */; break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: symbolKind = "setter" /* ScriptElementKind.memberSetAccessorElement */; break; + case 169 /* SyntaxKind.PropertyDeclaration */: + symbolKind = "accessor" /* ScriptElementKind.memberAccessorVariableElement */; + break; default: ts.Debug.assertNever(declaration); } @@ -146859,7 +148064,7 @@ var ts; } var signature = void 0; type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); - if (location.parent && location.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var right = location.parent.name; // Either the location is on the right of a property access, or on the left and the right is missing if (right === location || (right && right.getFullWidth() === 0)) { @@ -146879,7 +148084,7 @@ var ts; } if (callExpressionLike) { signature = typeChecker.getResolvedSignature(callExpressionLike); // TODO: GH#18217 - var useConstructSignatures = callExpressionLike.kind === 209 /* SyntaxKind.NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 106 /* SyntaxKind.SuperKeyword */); + var useConstructSignatures = callExpressionLike.kind === 211 /* SyntaxKind.NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 106 /* SyntaxKind.SuperKeyword */); var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (signature && !ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { // Get the first signature if there is one -- allSignatures may contain @@ -146943,29 +148148,29 @@ var ts; } } else if ((ts.isNameOfFunctionDeclaration(location) && !(symbolFlags & 98304 /* SymbolFlags.Accessor */)) || // name of function declaration - (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ && location.parent.kind === 171 /* SyntaxKind.Constructor */)) { // At constructor keyword of constructor declaration + (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ && location.parent.kind === 173 /* SyntaxKind.Constructor */)) { // At constructor keyword of constructor declaration // get the signature from the declaration and write it var functionDeclaration_1 = location.parent; // Use function declaration to write the signatures only if the symbol corresponding to this declaration var locationIsSymbolDeclaration = symbol.declarations && ts.find(symbol.declarations, function (declaration) { - return declaration === (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1); + return declaration === (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1); }); if (locationIsSymbolDeclaration) { - var allSignatures = functionDeclaration_1.kind === 171 /* SyntaxKind.Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); + var allSignatures = functionDeclaration_1.kind === 173 /* SyntaxKind.Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration_1)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration_1); // TODO: GH#18217 } else { signature = allSignatures[0]; } - if (functionDeclaration_1.kind === 171 /* SyntaxKind.Constructor */) { + if (functionDeclaration_1.kind === 173 /* SyntaxKind.Constructor */) { // show (constructor) Type(...) signature symbolKind = "constructor" /* ScriptElementKind.constructorImplementationElement */; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { // (function/method) symbol(..signature) - addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 174 /* SyntaxKind.CallSignature */ && + addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 176 /* SyntaxKind.CallSignature */ && !(type.symbol.flags & 2048 /* SymbolFlags.TypeLiteral */ || type.symbol.flags & 4096 /* SymbolFlags.ObjectLiteral */) ? type.symbol : symbol, symbolKind); } if (signature) { @@ -146978,7 +148183,7 @@ var ts; } if (symbolFlags & 32 /* SymbolFlags.Class */ && !hasAddedSymbolInfo && !isThisExpression) { addAliasPrefixIfNecessary(); - if (ts.getDeclarationOfKind(symbol, 226 /* SyntaxKind.ClassExpression */)) { + if (ts.getDeclarationOfKind(symbol, 228 /* SyntaxKind.ClassExpression */)) { // Special case for class expressions because we would like to indicate that // the class name is local to the class body (similar to function expression) // (local class) class @@ -147001,7 +148206,7 @@ var ts; } if ((symbolFlags & 524288 /* SymbolFlags.TypeAlias */) && (semanticMeaning & 2 /* SemanticMeaning.Type */)) { prefixNextMeaning(); - displayParts.push(ts.keywordPart(152 /* SyntaxKind.TypeKeyword */)); + displayParts.push(ts.keywordPart(154 /* SyntaxKind.TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); @@ -147022,9 +148227,9 @@ var ts; } if (symbolFlags & 1536 /* SymbolFlags.Module */ && !isThisExpression) { prefixNextMeaning(); - var declaration = ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.ModuleDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 264 /* SyntaxKind.ModuleDeclaration */); var isNamespace = declaration && declaration.name && declaration.name.kind === 79 /* SyntaxKind.Identifier */; - displayParts.push(ts.keywordPart(isNamespace ? 142 /* SyntaxKind.NamespaceKeyword */ : 141 /* SyntaxKind.ModuleKeyword */)); + displayParts.push(ts.keywordPart(isNamespace ? 143 /* SyntaxKind.NamespaceKeyword */ : 142 /* SyntaxKind.ModuleKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } @@ -147043,7 +148248,7 @@ var ts; } else { // Method/function type parameter - var decl = ts.getDeclarationOfKind(symbol, 163 /* SyntaxKind.TypeParameter */); + var decl = ts.getDeclarationOfKind(symbol, 165 /* SyntaxKind.TypeParameter */); if (decl === undefined) return ts.Debug.fail(); var declaration = decl.parent; @@ -147051,21 +148256,21 @@ var ts; if (ts.isFunctionLikeKind(declaration.kind)) { addInPrefix(); var signature = typeChecker.getSignatureFromDeclaration(declaration); // TODO: GH#18217 - if (declaration.kind === 175 /* SyntaxKind.ConstructSignature */) { + if (declaration.kind === 177 /* SyntaxKind.ConstructSignature */) { displayParts.push(ts.keywordPart(103 /* SyntaxKind.NewKeyword */)); displayParts.push(ts.spacePart()); } - else if (declaration.kind !== 174 /* SyntaxKind.CallSignature */ && declaration.name) { + else if (declaration.kind !== 176 /* SyntaxKind.CallSignature */ && declaration.name) { addFullSymbolName(declaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* TypeFormatFlags.WriteTypeArgumentsOfSignature */)); } - else if (declaration.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + else if (declaration.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { // Type alias type parameter // For example // type list = T[]; // Both T will go through same code path addInPrefix(); - displayParts.push(ts.keywordPart(152 /* SyntaxKind.TypeKeyword */)); + displayParts.push(ts.keywordPart(154 /* SyntaxKind.TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(declaration.symbol); writeTypeParametersOfSymbol(declaration.symbol, sourceFile); @@ -147077,7 +148282,7 @@ var ts; symbolKind = "enum member" /* ScriptElementKind.enumMemberElement */; addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]; - if ((declaration === null || declaration === void 0 ? void 0 : declaration.kind) === 299 /* SyntaxKind.EnumMember */) { + if ((declaration === null || declaration === void 0 ? void 0 : declaration.kind) === 302 /* SyntaxKind.EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -147113,17 +148318,17 @@ var ts; } if (symbol.declarations) { switch (symbol.declarations[0].kind) { - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(142 /* SyntaxKind.NamespaceKeyword */)); + displayParts.push(ts.keywordPart(143 /* SyntaxKind.NamespaceKeyword */)); break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(symbol.declarations[0].isExportEquals ? 63 /* SyntaxKind.EqualsToken */ : 88 /* SyntaxKind.DefaultKeyword */)); break; - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); break; default: @@ -147133,13 +148338,13 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (declaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); displayParts.push(ts.operatorPart(63 /* SyntaxKind.EqualsToken */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(146 /* SyntaxKind.RequireKeyword */)); + displayParts.push(ts.keywordPart(147 /* SyntaxKind.RequireKeyword */)); displayParts.push(ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */)); displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), ts.SymbolDisplayPartKind.stringLiteral)); displayParts.push(ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)); @@ -147169,16 +148374,18 @@ var ts; } // For properties, variables and local vars: show the type if (symbolKind === "property" /* ScriptElementKind.memberVariableElement */ || + symbolKind === "accessor" /* ScriptElementKind.memberAccessorVariableElement */ || symbolKind === "getter" /* ScriptElementKind.memberGetAccessorElement */ || symbolKind === "setter" /* ScriptElementKind.memberSetAccessorElement */ || symbolKind === "JSX attribute" /* ScriptElementKind.jsxAttribute */ || symbolFlags & 3 /* SymbolFlags.Variable */ || symbolKind === "local var" /* ScriptElementKind.localVariableElement */ || + symbolKind === "index" /* ScriptElementKind.indexSignatureElement */ || isThisExpression) { displayParts.push(ts.punctuationPart(58 /* SyntaxKind.ColonToken */)); displayParts.push(ts.spacePart()); // If the type is type parameter, format it specially - if (type.symbol && type.symbol.flags & 262144 /* SymbolFlags.TypeParameter */) { + if (type.symbol && type.symbol.flags & 262144 /* SymbolFlags.TypeParameter */ && symbolKind !== "index" /* ScriptElementKind.indexSignatureElement */) { var typeParameterParts = ts.mapToDisplayParts(function (writer) { var param = typeChecker.typeParameterToDeclaration(type, enclosingDeclaration, symbolDisplayNodeBuilderFlags); getPrinter().writeNode(4 /* EmitHint.Unspecified */, param, ts.getSourceFileOfNode(ts.getParseTreeNode(enclosingDeclaration)), writer); @@ -147222,10 +148429,10 @@ var ts; // For some special property access expressions like `exports.foo = foo` or `module.exports.foo = foo` // there documentation comments might be attached to the right hand side symbol of their declarations. // The pattern of such special property access is that the parent symbol is the symbol of the file. - if (symbol.parent && symbol.declarations && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 305 /* SyntaxKind.SourceFile */; })) { + if (symbol.parent && symbol.declarations && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 308 /* SyntaxKind.SourceFile */; })) { for (var _i = 0, _b = symbol.declarations; _i < _b.length; _i++) { var declaration = _b[_i]; - if (!declaration.parent || declaration.parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (!declaration.parent || declaration.parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { continue; } var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); @@ -147286,10 +148493,34 @@ var ts; displayParts.push(ts.spacePart()); } function addFullSymbolName(symbolToDisplay, enclosingDeclaration) { + var indexInfos; if (alias && symbolToDisplay === symbol) { symbolToDisplay = alias; } - var fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay, enclosingDeclaration || sourceFile, /*meaning*/ undefined, 1 /* SymbolFormatFlags.WriteTypeParametersOrArguments */ | 2 /* SymbolFormatFlags.UseOnlyExternalAliasing */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + if (symbolKind === "index" /* ScriptElementKind.indexSignatureElement */) { + indexInfos = typeChecker.getIndexInfosOfIndexSymbol(symbolToDisplay); + } + var fullSymbolDisplayParts = []; + if (symbolToDisplay.flags & 131072 /* SymbolFlags.Signature */ && indexInfos) { + if (symbolToDisplay.parent) { + fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay.parent); + } + fullSymbolDisplayParts.push(ts.punctuationPart(22 /* SyntaxKind.OpenBracketToken */)); + //Needed to handle more than one type of index + indexInfos.forEach(function (info, i) { + //Needed to handle template literals + fullSymbolDisplayParts.push.apply(fullSymbolDisplayParts, ts.typeToDisplayParts(typeChecker, info.keyType)); + if (i !== indexInfos.length - 1) { + fullSymbolDisplayParts.push(ts.spacePart()); + fullSymbolDisplayParts.push(ts.punctuationPart(51 /* SyntaxKind.BarToken */)); + fullSymbolDisplayParts.push(ts.spacePart()); + } + }); + fullSymbolDisplayParts.push(ts.punctuationPart(23 /* SyntaxKind.CloseBracketToken */)); + } + else { + fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay, enclosingDeclaration || sourceFile, /*meaning*/ undefined, 1 /* SymbolFormatFlags.WriteTypeParametersOrArguments */ | 2 /* SymbolFormatFlags.UseOnlyExternalAliasing */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + } ts.addRange(displayParts, fullSymbolDisplayParts); if (symbol.flags & 16777216 /* SymbolFlags.Optional */) { displayParts.push(ts.punctuationPart(57 /* SyntaxKind.QuestionToken */)); @@ -147355,16 +148586,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (declaration.kind === 215 /* SyntaxKind.FunctionExpression */) { return true; } - if (declaration.kind !== 254 /* SyntaxKind.VariableDeclaration */ && declaration.kind !== 256 /* SyntaxKind.FunctionDeclaration */) { + if (declaration.kind !== 257 /* SyntaxKind.VariableDeclaration */ && declaration.kind !== 259 /* SyntaxKind.FunctionDeclaration */) { return false; } // If the parent is not sourceFile or module block it is local variable for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { // Reached source file or module block - if (parent.kind === 305 /* SyntaxKind.SourceFile */ || parent.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ || parent.kind === 265 /* SyntaxKind.ModuleBlock */) { return false; } } @@ -147669,10 +148900,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 285 /* SyntaxKind.JsxAttribute */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 288 /* SyntaxKind.JsxAttribute */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: // May parse an identifier like `module-layout`; that will be scanned as a keyword at first, but we should parse the whole thing to get an identifier. return ts.isKeyword(node.kind) || node.kind === 79 /* SyntaxKind.Identifier */; } @@ -147865,7 +149096,7 @@ var ts; (function (formatting) { function getAllRules() { var allTokens = []; - for (var token = 0 /* SyntaxKind.FirstToken */; token <= 160 /* SyntaxKind.LastToken */; token++) { + for (var token = 0 /* SyntaxKind.FirstToken */; token <= 162 /* SyntaxKind.LastToken */; token++) { if (token !== 1 /* SyntaxKind.EndOfFileToken */) { allTokens.push(token); } @@ -147880,9 +149111,9 @@ var ts; var anyToken = { tokens: allTokens, isSpecific: false }; var anyTokenIncludingMultilineComments = tokenRangeFrom(__spreadArray(__spreadArray([], allTokens, true), [3 /* SyntaxKind.MultiLineCommentTrivia */], false)); var anyTokenIncludingEOF = tokenRangeFrom(__spreadArray(__spreadArray([], allTokens, true), [1 /* SyntaxKind.EndOfFileToken */], false)); - var keywords = tokenRangeFromRange(81 /* SyntaxKind.FirstKeyword */, 160 /* SyntaxKind.LastKeyword */); + var keywords = tokenRangeFromRange(81 /* SyntaxKind.FirstKeyword */, 162 /* SyntaxKind.LastKeyword */); var binaryOperators = tokenRangeFromRange(29 /* SyntaxKind.FirstBinaryOperator */, 78 /* SyntaxKind.LastBinaryOperator */); - var binaryKeywordOperators = [101 /* SyntaxKind.InKeyword */, 102 /* SyntaxKind.InstanceOfKeyword */, 160 /* SyntaxKind.OfKeyword */, 127 /* SyntaxKind.AsKeyword */, 139 /* SyntaxKind.IsKeyword */]; + var binaryKeywordOperators = [101 /* SyntaxKind.InKeyword */, 102 /* SyntaxKind.InstanceOfKeyword */, 162 /* SyntaxKind.OfKeyword */, 128 /* SyntaxKind.AsKeyword */, 140 /* SyntaxKind.IsKeyword */]; var unaryPrefixOperators = [45 /* SyntaxKind.PlusPlusToken */, 46 /* SyntaxKind.MinusMinusToken */, 54 /* SyntaxKind.TildeToken */, 53 /* SyntaxKind.ExclamationToken */]; var unaryPrefixExpressions = [ 8 /* SyntaxKind.NumericLiteral */, 9 /* SyntaxKind.BigIntLiteral */, 79 /* SyntaxKind.Identifier */, 20 /* SyntaxKind.OpenParenToken */, @@ -147913,7 +149144,7 @@ var ts; rule("SpaceAfterQuestionMarkInConditionalOperator", 57 /* SyntaxKind.QuestionToken */, anyToken, [isNonJsxSameLineTokenContext, isConditionalOperatorContext], 4 /* RuleAction.InsertSpace */), // in other cases there should be no space between '?' and next token rule("NoSpaceAfterQuestionMark", 57 /* SyntaxKind.QuestionToken */, anyToken, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), - rule("NoSpaceBeforeDot", anyToken, [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceBeforeDot", anyToken, [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], [isNonJsxSameLineTokenContext, isNotPropertyAccessOnIntegerLiteral], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceAfterDot", [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], anyToken, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceBetweenImportParenInImportType", 100 /* SyntaxKind.ImportKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext, isImportTypeContext], 16 /* RuleAction.DeleteSpace */), // Special handling of unary operators. @@ -147956,11 +149187,11 @@ var ts; // Though, we do extra check on the context to make sure we are dealing with get/set node. Example: // get x() {} // set x(val) {} - rule("SpaceAfterGetSetInMember", [136 /* SyntaxKind.GetKeyword */, 149 /* SyntaxKind.SetKeyword */], 79 /* SyntaxKind.Identifier */, [isFunctionDeclContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceAfterGetSetInMember", [137 /* SyntaxKind.GetKeyword */, 151 /* SyntaxKind.SetKeyword */], 79 /* SyntaxKind.Identifier */, [isFunctionDeclContext], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBetweenYieldKeywordAndStar", 125 /* SyntaxKind.YieldKeyword */, 41 /* SyntaxKind.AsteriskToken */, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 16 /* RuleAction.DeleteSpace */), rule("SpaceBetweenYieldOrYieldStarAndOperand", [125 /* SyntaxKind.YieldKeyword */, 41 /* SyntaxKind.AsteriskToken */], anyToken, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBetweenReturnAndSemicolon", 105 /* SyntaxKind.ReturnKeyword */, 26 /* SyntaxKind.SemicolonToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), - rule("SpaceAfterCertainKeywords", [113 /* SyntaxKind.VarKeyword */, 109 /* SyntaxKind.ThrowKeyword */, 103 /* SyntaxKind.NewKeyword */, 89 /* SyntaxKind.DeleteKeyword */, 105 /* SyntaxKind.ReturnKeyword */, 112 /* SyntaxKind.TypeOfKeyword */, 132 /* SyntaxKind.AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceAfterCertainKeywords", [113 /* SyntaxKind.VarKeyword */, 109 /* SyntaxKind.ThrowKeyword */, 103 /* SyntaxKind.NewKeyword */, 89 /* SyntaxKind.DeleteKeyword */, 105 /* SyntaxKind.ReturnKeyword */, 112 /* SyntaxKind.TypeOfKeyword */, 133 /* SyntaxKind.AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), rule("SpaceAfterLetConstInVariableDeclaration", [119 /* SyntaxKind.LetKeyword */, 85 /* SyntaxKind.ConstKeyword */], anyToken, [isNonJsxSameLineTokenContext, isStartOfVariableDeclarationList], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBeforeOpenParenInFuncCall", anyToken, 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext, isFunctionCallOrNewContext, isPreviousTokenNotComma], 16 /* RuleAction.DeleteSpace */), // Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options. @@ -147968,8 +149199,8 @@ var ts; rule("SpaceAfterBinaryKeywordOperator", binaryKeywordOperators, anyToken, [isNonJsxSameLineTokenContext, isBinaryOpContext], 4 /* RuleAction.InsertSpace */), rule("SpaceAfterVoidOperator", 114 /* SyntaxKind.VoidKeyword */, anyToken, [isNonJsxSameLineTokenContext, isVoidOpContext], 4 /* RuleAction.InsertSpace */), // Async-await - rule("SpaceBetweenAsyncAndOpenParen", 131 /* SyntaxKind.AsyncKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("SpaceBetweenAsyncAndFunctionKeyword", 131 /* SyntaxKind.AsyncKeyword */, [98 /* SyntaxKind.FunctionKeyword */, 79 /* SyntaxKind.Identifier */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenAsyncAndOpenParen", 132 /* SyntaxKind.AsyncKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenAsyncAndFunctionKeyword", 132 /* SyntaxKind.AsyncKeyword */, [98 /* SyntaxKind.FunctionKeyword */, 79 /* SyntaxKind.Identifier */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Template string rule("NoSpaceBetweenTagAndTemplateString", [79 /* SyntaxKind.Identifier */, 21 /* SyntaxKind.CloseParenToken */], [14 /* SyntaxKind.NoSubstitutionTemplateLiteral */, 15 /* SyntaxKind.TemplateHead */], [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // JSX opening elements @@ -147980,34 +149211,35 @@ var ts; rule("NoSpaceAfterEqualInJsxAttribute", 63 /* SyntaxKind.EqualsToken */, anyToken, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // TypeScript-specific rules // Use of module as a function call. e.g.: import m2 = module("m2"); - rule("NoSpaceAfterModuleImport", [141 /* SyntaxKind.ModuleKeyword */, 146 /* SyntaxKind.RequireKeyword */], 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceAfterModuleImport", [142 /* SyntaxKind.ModuleKeyword */, 147 /* SyntaxKind.RequireKeyword */], 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // Add a space around certain TypeScript keywords rule("SpaceAfterCertainTypeScriptKeywords", [ 126 /* SyntaxKind.AbstractKeyword */, + 127 /* SyntaxKind.AccessorKeyword */, 84 /* SyntaxKind.ClassKeyword */, - 135 /* SyntaxKind.DeclareKeyword */, + 136 /* SyntaxKind.DeclareKeyword */, 88 /* SyntaxKind.DefaultKeyword */, 92 /* SyntaxKind.EnumKeyword */, 93 /* SyntaxKind.ExportKeyword */, 94 /* SyntaxKind.ExtendsKeyword */, - 136 /* SyntaxKind.GetKeyword */, + 137 /* SyntaxKind.GetKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 100 /* SyntaxKind.ImportKeyword */, 118 /* SyntaxKind.InterfaceKeyword */, - 141 /* SyntaxKind.ModuleKeyword */, - 142 /* SyntaxKind.NamespaceKeyword */, + 142 /* SyntaxKind.ModuleKeyword */, + 143 /* SyntaxKind.NamespaceKeyword */, 121 /* SyntaxKind.PrivateKeyword */, 123 /* SyntaxKind.PublicKeyword */, 122 /* SyntaxKind.ProtectedKeyword */, - 145 /* SyntaxKind.ReadonlyKeyword */, - 149 /* SyntaxKind.SetKeyword */, + 146 /* SyntaxKind.ReadonlyKeyword */, + 151 /* SyntaxKind.SetKeyword */, 124 /* SyntaxKind.StaticKeyword */, - 152 /* SyntaxKind.TypeKeyword */, - 156 /* SyntaxKind.FromKeyword */, - 140 /* SyntaxKind.KeyOfKeyword */, - 137 /* SyntaxKind.InferKeyword */, + 154 /* SyntaxKind.TypeKeyword */, + 158 /* SyntaxKind.FromKeyword */, + 141 /* SyntaxKind.KeyOfKeyword */, + 138 /* SyntaxKind.InferKeyword */, ], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [94 /* SyntaxKind.ExtendsKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 156 /* SyntaxKind.FromKeyword */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [94 /* SyntaxKind.ExtendsKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 158 /* SyntaxKind.FromKeyword */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { rule("SpaceAfterModuleName", 10 /* SyntaxKind.StringLiteral */, 18 /* SyntaxKind.OpenBraceToken */, [isModuleDeclContext], 4 /* RuleAction.InsertSpace */), // Lambda expressions @@ -148038,8 +149270,8 @@ var ts; 123 /* SyntaxKind.PublicKeyword */, 121 /* SyntaxKind.PrivateKeyword */, 122 /* SyntaxKind.ProtectedKeyword */, - 136 /* SyntaxKind.GetKeyword */, - 149 /* SyntaxKind.SetKeyword */, + 137 /* SyntaxKind.GetKeyword */, + 151 /* SyntaxKind.SetKeyword */, 22 /* SyntaxKind.OpenBracketToken */, 41 /* SyntaxKind.AsteriskToken */, ], [isEndOfDecoratorContextOnSameLine], 4 /* RuleAction.InsertSpace */), @@ -148050,8 +149282,8 @@ var ts; // These rules are applied after high priority var userConfigurableRules = [ // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses - rule("SpaceAfterConstructor", 134 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("NoSpaceAfterConstructor", 134 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("SpaceAfterConstructor", 135 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("NoSpaceAfterConstructor", 135 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("SpaceAfterComma", 27 /* SyntaxKind.CommaToken */, anyToken, [isOptionEnabled("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNextTokenNotCloseBracket, isNextTokenNotCloseParen], 4 /* RuleAction.InsertSpace */), rule("NoSpaceAfterComma", 27 /* SyntaxKind.CommaToken */, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext], 16 /* RuleAction.DeleteSpace */), // Insert space after function keyword for anonymous functions @@ -148125,11 +149357,11 @@ var ts; rule("SpaceBeforeOpenBraceInTypeScriptDeclWithBlock", typeScriptOpenBraceLeftTokenRange, 18 /* SyntaxKind.OpenBraceToken */, [isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForFunctions"), isTypeScriptDeclWithBlockContext, isNotFormatOnEnter, isSameLineTokenOrBeforeBlockContext], 4 /* RuleAction.InsertSpace */, 1 /* RuleFlags.CanDeleteNewLines */), rule("NoSpaceBeforeComma", anyToken, 27 /* SyntaxKind.CommaToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // No space before and after indexer `x[]` - rule("NoSpaceBeforeOpenBracket", anyTokenExcept(131 /* SyntaxKind.AsyncKeyword */, 82 /* SyntaxKind.CaseKeyword */), 22 /* SyntaxKind.OpenBracketToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceBeforeOpenBracket", anyTokenExcept(132 /* SyntaxKind.AsyncKeyword */, 82 /* SyntaxKind.CaseKeyword */), 22 /* SyntaxKind.OpenBracketToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceAfterCloseBracket", 23 /* SyntaxKind.CloseBracketToken */, anyToken, [isNonJsxSameLineTokenContext, isNotBeforeBlockInFunctionDeclarationContext], 16 /* RuleAction.DeleteSpace */), rule("SpaceAfterSemicolon", 26 /* SyntaxKind.SemicolonToken */, anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Remove extra space between for and await - rule("SpaceBetweenForAndAwaitKeyword", 97 /* SyntaxKind.ForKeyword */, 132 /* SyntaxKind.AwaitKeyword */, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenForAndAwaitKeyword", 97 /* SyntaxKind.ForKeyword */, 133 /* SyntaxKind.AwaitKeyword */, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Add a space between statements. All keywords except (do,else,case) has open/close parens after them. // So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any] rule("SpaceBetweenStatements", [21 /* SyntaxKind.CloseParenToken */, 90 /* SyntaxKind.DoKeyword */, 91 /* SyntaxKind.ElseKeyword */, 82 /* SyntaxKind.CaseKeyword */], anyToken, [isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNotForContext], 4 /* RuleAction.InsertSpace */), @@ -148178,69 +149410,70 @@ var ts; return function (context) { return context.options && context.options[optionName] === optionValue; }; } function isOptionEnabled(optionName) { - return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !!context.options[optionName]; }; + return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !!context.options[optionName]; }; } function isOptionDisabled(optionName) { - return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !context.options[optionName]; }; + return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !context.options[optionName]; }; } function isOptionDisabledOrUndefined(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName]; }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName]; }; } function isOptionDisabledOrUndefinedOrTokensOnSameLine(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); }; } function isOptionEnabledOrUndefined(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName]; }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !!context.options[optionName]; }; } function isForContext(context) { - return context.contextNode.kind === 242 /* SyntaxKind.ForStatement */; + return context.contextNode.kind === 245 /* SyntaxKind.ForStatement */; } function isNotForContext(context) { return !isForContext(context); } function isBinaryOpContext(context) { switch (context.contextNode.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return context.contextNode.operatorToken.kind !== 27 /* SyntaxKind.CommaToken */; - case 222 /* SyntaxKind.ConditionalExpression */: - case 189 /* SyntaxKind.ConditionalType */: - case 229 /* SyntaxKind.AsExpression */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 177 /* SyntaxKind.TypePredicate */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 191 /* SyntaxKind.ConditionalType */: + case 231 /* SyntaxKind.AsExpression */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 179 /* SyntaxKind.TypePredicate */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 235 /* SyntaxKind.SatisfiesExpression */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: // equals in type X = ... // falls through - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // equal in import a = module('a'); // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // equal in export = 1 // falls through - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: // equal in let a = 0 // falls through - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: // equal in p = 0 // falls through - case 164 /* SyntaxKind.Parameter */: - case 299 /* SyntaxKind.EnumMember */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 302 /* SyntaxKind.EnumMember */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return context.currentTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */ || context.nextTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */; // "in" keyword in for (let x in []) { } - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: // "in" keyword in [P in keyof T]: T[P] // falls through - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return context.currentTokenSpan.kind === 101 /* SyntaxKind.InKeyword */ || context.nextTokenSpan.kind === 101 /* SyntaxKind.InKeyword */ || context.currentTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */ || context.nextTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 244 /* SyntaxKind.ForOfStatement */: - return context.currentTokenSpan.kind === 160 /* SyntaxKind.OfKeyword */ || context.nextTokenSpan.kind === 160 /* SyntaxKind.OfKeyword */; + case 247 /* SyntaxKind.ForOfStatement */: + return context.currentTokenSpan.kind === 162 /* SyntaxKind.OfKeyword */ || context.nextTokenSpan.kind === 162 /* SyntaxKind.OfKeyword */; } return false; } @@ -148252,22 +149485,22 @@ var ts; } function isTypeAnnotationContext(context) { var contextKind = context.contextNode.kind; - return contextKind === 167 /* SyntaxKind.PropertyDeclaration */ || - contextKind === 166 /* SyntaxKind.PropertySignature */ || - contextKind === 164 /* SyntaxKind.Parameter */ || - contextKind === 254 /* SyntaxKind.VariableDeclaration */ || + return contextKind === 169 /* SyntaxKind.PropertyDeclaration */ || + contextKind === 168 /* SyntaxKind.PropertySignature */ || + contextKind === 166 /* SyntaxKind.Parameter */ || + contextKind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isFunctionLikeKind(contextKind); } function isConditionalOperatorContext(context) { - return context.contextNode.kind === 222 /* SyntaxKind.ConditionalExpression */ || - context.contextNode.kind === 189 /* SyntaxKind.ConditionalType */; + return context.contextNode.kind === 224 /* SyntaxKind.ConditionalExpression */ || + context.contextNode.kind === 191 /* SyntaxKind.ConditionalType */; } function isSameLineTokenOrBeforeBlockContext(context) { return context.TokensAreOnSameLine() || isBeforeBlockContext(context); } function isBraceWrappedContext(context) { - return context.contextNode.kind === 201 /* SyntaxKind.ObjectBindingPattern */ || - context.contextNode.kind === 195 /* SyntaxKind.MappedType */ || + return context.contextNode.kind === 203 /* SyntaxKind.ObjectBindingPattern */ || + context.contextNode.kind === 197 /* SyntaxKind.MappedType */ || isSingleLineBlockContext(context); } // This check is done before an open brace in a control construct, a function, or a typescript block declaration @@ -148293,34 +149526,34 @@ var ts; return true; } switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 265 /* SyntaxKind.ModuleBlock */: return true; } return false; } function isFunctionDeclContext(context) { switch (context.contextNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: // case SyntaxKind.MemberFunctionDeclaration: // falls through - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // case SyntaxKind.MethodSignature: // falls through - case 174 /* SyntaxKind.CallSignature */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 214 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 216 /* SyntaxKind.ArrowFunction */: // case SyntaxKind.ConstructorDeclaration: // case SyntaxKind.SimpleArrowFunctionExpression: // case SyntaxKind.ParenthesizedArrowFunctionExpression: // falls through - case 258 /* SyntaxKind.InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one + case 261 /* SyntaxKind.InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one return true; } return false; @@ -148329,40 +149562,40 @@ var ts; return !isFunctionDeclContext(context); } function isFunctionDeclarationOrFunctionExpressionContext(context) { - return context.contextNode.kind === 256 /* SyntaxKind.FunctionDeclaration */ || context.contextNode.kind === 213 /* SyntaxKind.FunctionExpression */; + return context.contextNode.kind === 259 /* SyntaxKind.FunctionDeclaration */ || context.contextNode.kind === 215 /* SyntaxKind.FunctionExpression */; } function isTypeScriptDeclWithBlockContext(context) { return nodeIsTypeScriptDeclWithBlockContext(context.contextNode); } function nodeIsTypeScriptDeclWithBlockContext(node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 273 /* SyntaxKind.NamedExports */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 269 /* SyntaxKind.NamedImports */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 276 /* SyntaxKind.NamedExports */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 272 /* SyntaxKind.NamedImports */: return true; } return false; } function isAfterCodeBlockContext(context) { switch (context.currentTokenParent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 292 /* SyntaxKind.CatchClause */: - case 262 /* SyntaxKind.ModuleBlock */: - case 249 /* SyntaxKind.SwitchStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 295 /* SyntaxKind.CatchClause */: + case 265 /* SyntaxKind.ModuleBlock */: + case 252 /* SyntaxKind.SwitchStatement */: return true; - case 235 /* SyntaxKind.Block */: { + case 238 /* SyntaxKind.Block */: { var blockParent = context.currentTokenParent.parent; // In a codefix scenario, we can't rely on parents being set. So just always return true. - if (!blockParent || blockParent.kind !== 214 /* SyntaxKind.ArrowFunction */ && blockParent.kind !== 213 /* SyntaxKind.FunctionExpression */) { + if (!blockParent || blockParent.kind !== 216 /* SyntaxKind.ArrowFunction */ && blockParent.kind !== 215 /* SyntaxKind.FunctionExpression */) { return true; } } @@ -148371,32 +149604,32 @@ var ts; } function isControlDeclContext(context) { switch (context.contextNode.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 248 /* SyntaxKind.WithStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 251 /* SyntaxKind.WithStatement */: // TODO // case SyntaxKind.ElseClause: // falls through - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return true; default: return false; } } function isObjectContext(context) { - return context.contextNode.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return context.contextNode.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } function isFunctionCallContext(context) { - return context.contextNode.kind === 208 /* SyntaxKind.CallExpression */; + return context.contextNode.kind === 210 /* SyntaxKind.CallExpression */; } function isNewContext(context) { - return context.contextNode.kind === 209 /* SyntaxKind.NewExpression */; + return context.contextNode.kind === 211 /* SyntaxKind.NewExpression */; } function isFunctionCallOrNewContext(context) { return isFunctionCallContext(context) || isNewContext(context); @@ -148411,10 +149644,10 @@ var ts; return context.nextTokenSpan.kind !== 21 /* SyntaxKind.CloseParenToken */; } function isArrowFunctionContext(context) { - return context.contextNode.kind === 214 /* SyntaxKind.ArrowFunction */; + return context.contextNode.kind === 216 /* SyntaxKind.ArrowFunction */; } function isImportTypeContext(context) { - return context.contextNode.kind === 200 /* SyntaxKind.ImportType */; + return context.contextNode.kind === 202 /* SyntaxKind.ImportType */; } function isNonJsxSameLineTokenContext(context) { return context.TokensAreOnSameLine() && context.contextNode.kind !== 11 /* SyntaxKind.JsxText */; @@ -148423,19 +149656,19 @@ var ts; return context.contextNode.kind !== 11 /* SyntaxKind.JsxText */; } function isNonJsxElementOrFragmentContext(context) { - return context.contextNode.kind !== 278 /* SyntaxKind.JsxElement */ && context.contextNode.kind !== 282 /* SyntaxKind.JsxFragment */; + return context.contextNode.kind !== 281 /* SyntaxKind.JsxElement */ && context.contextNode.kind !== 285 /* SyntaxKind.JsxFragment */; } function isJsxExpressionContext(context) { - return context.contextNode.kind === 288 /* SyntaxKind.JsxExpression */ || context.contextNode.kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return context.contextNode.kind === 291 /* SyntaxKind.JsxExpression */ || context.contextNode.kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } function isNextTokenParentJsxAttribute(context) { - return context.nextTokenParent.kind === 285 /* SyntaxKind.JsxAttribute */; + return context.nextTokenParent.kind === 288 /* SyntaxKind.JsxAttribute */; } function isJsxAttributeContext(context) { - return context.contextNode.kind === 285 /* SyntaxKind.JsxAttribute */; + return context.contextNode.kind === 288 /* SyntaxKind.JsxAttribute */; } function isJsxSelfClosingElementContext(context) { - return context.contextNode.kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return context.contextNode.kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } function isNotBeforeBlockInFunctionDeclarationContext(context) { return !isFunctionDeclContext(context) && !isBeforeBlockContext(context); @@ -148450,45 +149683,45 @@ var ts; while (ts.isExpressionNode(node)) { node = node.parent; } - return node.kind === 165 /* SyntaxKind.Decorator */; + return node.kind === 167 /* SyntaxKind.Decorator */; } function isStartOfVariableDeclarationList(context) { - return context.currentTokenParent.kind === 255 /* SyntaxKind.VariableDeclarationList */ && + return context.currentTokenParent.kind === 258 /* SyntaxKind.VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; } function isNotFormatOnEnter(context) { return context.formattingRequestKind !== 2 /* FormattingRequestKind.FormatOnEnter */; } function isModuleDeclContext(context) { - return context.contextNode.kind === 261 /* SyntaxKind.ModuleDeclaration */; + return context.contextNode.kind === 264 /* SyntaxKind.ModuleDeclaration */; } function isObjectTypeContext(context) { - return context.contextNode.kind === 182 /* SyntaxKind.TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; + return context.contextNode.kind === 184 /* SyntaxKind.TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; } function isConstructorSignatureContext(context) { - return context.contextNode.kind === 175 /* SyntaxKind.ConstructSignature */; + return context.contextNode.kind === 177 /* SyntaxKind.ConstructSignature */; } function isTypeArgumentOrParameterOrAssertion(token, parent) { if (token.kind !== 29 /* SyntaxKind.LessThanToken */ && token.kind !== 31 /* SyntaxKind.GreaterThanToken */) { return false; } switch (parent.kind) { - case 178 /* SyntaxKind.TypeReference */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return true; default: return false; @@ -148499,28 +149732,28 @@ var ts; isTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); } function isTypeAssertionContext(context) { - return context.contextNode.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return context.contextNode.kind === 213 /* SyntaxKind.TypeAssertionExpression */; } function isVoidOpContext(context) { - return context.currentTokenSpan.kind === 114 /* SyntaxKind.VoidKeyword */ && context.currentTokenParent.kind === 217 /* SyntaxKind.VoidExpression */; + return context.currentTokenSpan.kind === 114 /* SyntaxKind.VoidKeyword */ && context.currentTokenParent.kind === 219 /* SyntaxKind.VoidExpression */; } function isYieldOrYieldStarWithOperand(context) { - return context.contextNode.kind === 224 /* SyntaxKind.YieldExpression */ && context.contextNode.expression !== undefined; + return context.contextNode.kind === 226 /* SyntaxKind.YieldExpression */ && context.contextNode.expression !== undefined; } function isNonNullAssertionContext(context) { - return context.contextNode.kind === 230 /* SyntaxKind.NonNullExpression */; + return context.contextNode.kind === 232 /* SyntaxKind.NonNullExpression */; } function isNotStatementConditionContext(context) { return !isStatementConditionContext(context); } function isStatementConditionContext(context) { switch (context.contextNode.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return true; default: return false; @@ -148545,12 +149778,12 @@ var ts; return nextTokenKind === 19 /* SyntaxKind.CloseBraceToken */ || nextTokenKind === 1 /* SyntaxKind.EndOfFileToken */; } - if (nextTokenKind === 234 /* SyntaxKind.SemicolonClassElement */ || + if (nextTokenKind === 237 /* SyntaxKind.SemicolonClassElement */ || nextTokenKind === 26 /* SyntaxKind.SemicolonToken */) { return false; } - if (context.contextNode.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - context.contextNode.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + if (context.contextNode.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + context.contextNode.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { // Can’t remove semicolon after `foo`; it would parse as a method declaration: // // interface I { @@ -148564,9 +149797,9 @@ var ts; if (ts.isPropertyDeclaration(context.currentTokenParent)) { return !context.currentTokenParent.initializer; } - return context.currentTokenParent.kind !== 242 /* SyntaxKind.ForStatement */ - && context.currentTokenParent.kind !== 236 /* SyntaxKind.EmptyStatement */ - && context.currentTokenParent.kind !== 234 /* SyntaxKind.SemicolonClassElement */ + return context.currentTokenParent.kind !== 245 /* SyntaxKind.ForStatement */ + && context.currentTokenParent.kind !== 239 /* SyntaxKind.EmptyStatement */ + && context.currentTokenParent.kind !== 237 /* SyntaxKind.SemicolonClassElement */ && nextTokenKind !== 22 /* SyntaxKind.OpenBracketToken */ && nextTokenKind !== 20 /* SyntaxKind.OpenParenToken */ && nextTokenKind !== 39 /* SyntaxKind.PlusToken */ @@ -148574,7 +149807,7 @@ var ts; && nextTokenKind !== 43 /* SyntaxKind.SlashToken */ && nextTokenKind !== 13 /* SyntaxKind.RegularExpressionLiteral */ && nextTokenKind !== 27 /* SyntaxKind.CommaToken */ - && nextTokenKind !== 223 /* SyntaxKind.TemplateExpression */ + && nextTokenKind !== 225 /* SyntaxKind.TemplateExpression */ && nextTokenKind !== 15 /* SyntaxKind.TemplateHead */ && nextTokenKind !== 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */ && nextTokenKind !== 24 /* SyntaxKind.DotToken */; @@ -148582,6 +149815,11 @@ var ts; function isSemicolonInsertionContext(context) { return ts.positionIsASICandidate(context.currentTokenSpan.end, context.currentTokenParent, context.sourceFile); } + function isNotPropertyAccessOnIntegerLiteral(context) { + return !ts.isPropertyAccessExpression(context.contextNode) + || !ts.isNumericLiteral(context.contextNode.expression) + || context.contextNode.expression.getText().indexOf(".") !== -1; + } })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); /* @internal */ @@ -148665,12 +149903,12 @@ var ts; return map; } function getRuleBucketIndex(row, column) { - ts.Debug.assert(row <= 160 /* SyntaxKind.LastKeyword */ && column <= 160 /* SyntaxKind.LastKeyword */, "Must compute formatting context from tokens"); + ts.Debug.assert(row <= 162 /* SyntaxKind.LastKeyword */ && column <= 162 /* SyntaxKind.LastKeyword */, "Must compute formatting context from tokens"); return (row * mapRowLength) + column; } var maskBitSize = 5; var mask = 31; // MaskBitSize bits - var mapRowLength = 160 /* SyntaxKind.LastToken */ + 1; + var mapRowLength = 162 /* SyntaxKind.LastToken */ + 1; var RulesPosition; (function (RulesPosition) { RulesPosition[RulesPosition["StopRulesSpecific"] = 0] = "StopRulesSpecific"; @@ -148858,17 +150096,17 @@ var ts; // i.e. parent is class declaration with the list of members and node is one of members. function isListElement(parent, node) { switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var body = parent.body; - return !!body && body.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.rangeContainsRange(body.statements, node); - case 305 /* SyntaxKind.SourceFile */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + return !!body && body.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.rangeContainsRange(body.statements, node); + case 308 /* SyntaxKind.SourceFile */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -149131,19 +150369,19 @@ var ts; return modifier.kind; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: return 84 /* SyntaxKind.ClassKeyword */; - case 258 /* SyntaxKind.InterfaceDeclaration */: return 118 /* SyntaxKind.InterfaceKeyword */; - case 256 /* SyntaxKind.FunctionDeclaration */: return 98 /* SyntaxKind.FunctionKeyword */; - case 260 /* SyntaxKind.EnumDeclaration */: return 260 /* SyntaxKind.EnumDeclaration */; - case 172 /* SyntaxKind.GetAccessor */: return 136 /* SyntaxKind.GetKeyword */; - case 173 /* SyntaxKind.SetAccessor */: return 149 /* SyntaxKind.SetKeyword */; - case 169 /* SyntaxKind.MethodDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return 84 /* SyntaxKind.ClassKeyword */; + case 261 /* SyntaxKind.InterfaceDeclaration */: return 118 /* SyntaxKind.InterfaceKeyword */; + case 259 /* SyntaxKind.FunctionDeclaration */: return 98 /* SyntaxKind.FunctionKeyword */; + case 263 /* SyntaxKind.EnumDeclaration */: return 263 /* SyntaxKind.EnumDeclaration */; + case 174 /* SyntaxKind.GetAccessor */: return 137 /* SyntaxKind.GetKeyword */; + case 175 /* SyntaxKind.SetAccessor */: return 151 /* SyntaxKind.SetKeyword */; + case 171 /* SyntaxKind.MethodDeclaration */: if (node.asteriskToken) { return 41 /* SyntaxKind.AsteriskToken */; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: var name = ts.getNameOfDeclaration(node); if (name) { return name.kind; @@ -149200,15 +150438,15 @@ var ts; case 43 /* SyntaxKind.SlashToken */: case 31 /* SyntaxKind.GreaterThanToken */: switch (container.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return false; } break; case 22 /* SyntaxKind.OpenBracketToken */: case 23 /* SyntaxKind.CloseBracketToken */: - if (container.kind !== 195 /* SyntaxKind.MappedType */) { + if (container.kind !== 197 /* SyntaxKind.MappedType */) { return false; } break; @@ -149312,11 +150550,11 @@ var ts; return inheritedIndentation; } } - var effectiveParentStartLine = child.kind === 165 /* SyntaxKind.Decorator */ ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 167 /* SyntaxKind.Decorator */ ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; - if (isFirstListItem && parent.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && inheritedIndentation === -1 /* Constants.Unknown */) { + if (isFirstListItem && parent.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && inheritedIndentation === -1 /* Constants.Unknown */) { inheritedIndentation = childIndentation.indentation; } return inheritedIndentation; @@ -149774,18 +151012,18 @@ var ts; formatting.getRangeOfEnclosingComment = getRangeOfEnclosingComment; function getOpenTokenForList(node, list) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 214 /* SyntaxKind.ArrowFunction */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: if (node.typeParameters === list) { return 29 /* SyntaxKind.LessThanToken */; } @@ -149793,8 +151031,8 @@ var ts; return 20 /* SyntaxKind.OpenParenToken */; } break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: if (node.typeArguments === list) { return 29 /* SyntaxKind.LessThanToken */; } @@ -149802,24 +151040,24 @@ var ts; return 20 /* SyntaxKind.OpenParenToken */; } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: if (node.typeParameters === list) { return 29 /* SyntaxKind.LessThanToken */; } break; - case 178 /* SyntaxKind.TypeReference */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 181 /* SyntaxKind.TypeQuery */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 200 /* SyntaxKind.ImportType */: + case 180 /* SyntaxKind.TypeReference */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 183 /* SyntaxKind.TypeQuery */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 202 /* SyntaxKind.ImportType */: if (node.typeArguments === list) { return 29 /* SyntaxKind.LessThanToken */; } break; - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return 18 /* SyntaxKind.OpenBraceToken */; } return 0 /* SyntaxKind.Unknown */; @@ -149955,11 +151193,11 @@ var ts; // y: undefined, // } // ``` - var isObjectLiteral = currentToken.kind === 18 /* SyntaxKind.OpenBraceToken */ && currentToken.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + var isObjectLiteral = currentToken.kind === 18 /* SyntaxKind.OpenBraceToken */ && currentToken.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; if (options.indentStyle === ts.IndentStyle.Block || isObjectLiteral) { return getBlockIndent(sourceFile, position, options); } - if (precedingToken.kind === 27 /* SyntaxKind.CommaToken */ && precedingToken.parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (precedingToken.kind === 27 /* SyntaxKind.CommaToken */ && precedingToken.parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1 /* Value.Unknown */) { @@ -149969,7 +151207,7 @@ var ts; var containerList = getListByPosition(position, precedingToken.parent, sourceFile); // use list position if the preceding token is before any list items if (containerList && !ts.rangeContainsRange(containerList, precedingToken)) { - var useTheSameBaseIndentation = [213 /* SyntaxKind.FunctionExpression */, 214 /* SyntaxKind.ArrowFunction */].indexOf(currentToken.parent.kind) !== -1; + var useTheSameBaseIndentation = [215 /* SyntaxKind.FunctionExpression */, 216 /* SyntaxKind.ArrowFunction */].indexOf(currentToken.parent.kind) !== -1; var indentSize = useTheSameBaseIndentation ? 0 : options.indentSize; return getActualIndentationForListStartLine(containerList, sourceFile, options) + indentSize; // TODO: GH#18217 } @@ -150134,7 +151372,7 @@ var ts; // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually // - parent and child are not on the same line var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && - (parent.kind === 305 /* SyntaxKind.SourceFile */ || !parentAndChildShareLine); + (parent.kind === 308 /* SyntaxKind.SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Value.Unknown */; } @@ -150182,7 +151420,7 @@ var ts; } SmartIndenter.isArgumentAndStartLineOverlapsExpressionBeingCalled = isArgumentAndStartLineOverlapsExpressionBeingCalled; function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 239 /* SyntaxKind.IfStatement */ && parent.elseStatement === child) { + if (parent.kind === 242 /* SyntaxKind.IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 91 /* SyntaxKind.ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -150263,42 +151501,42 @@ var ts; } function getListByRange(start, end, node, sourceFile) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return getList(node.typeArguments); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return getList(node.properties); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getList(node.elements); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return getList(node.members); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 171 /* SyntaxKind.Constructor */: - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 173 /* SyntaxKind.Constructor */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return getList(node.typeParameters) || getList(node.parameters); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return getList(node.parameters); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return getList(node.typeParameters); - case 209 /* SyntaxKind.NewExpression */: - case 208 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: return getList(node.typeArguments) || getList(node.arguments); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return getList(node.declarations); - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return getList(node.elements); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return getList(node.elements); } function getList(list) { @@ -150321,7 +151559,7 @@ var ts; return findColumnForFirstNonWhitespaceCharacterInLine(sourceFile.getLineAndCharacterOfPosition(list.pos), sourceFile, options); } function getActualIndentationForListItem(node, sourceFile, options, listIndentsChild) { - if (node.parent && node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.parent && node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */) { // VariableDeclarationList has no wrapping tokens return -1 /* Value.Unknown */; } @@ -150394,96 +151632,96 @@ var ts; function nodeWillIndentChild(settings, parent, child, sourceFile, indentByDefault) { var childKind = child ? child.kind : 0 /* SyntaxKind.Unknown */; switch (parent.kind) { - case 238 /* SyntaxKind.ExpressionStatement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 182 /* SyntaxKind.TypeLiteral */: - case 195 /* SyntaxKind.MappedType */: - case 184 /* SyntaxKind.TupleType */: - case 263 /* SyntaxKind.CaseBlock */: - case 290 /* SyntaxKind.DefaultClause */: - case 289 /* SyntaxKind.CaseClause */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 237 /* SyntaxKind.VariableStatement */: - case 271 /* SyntaxKind.ExportAssignment */: - case 247 /* SyntaxKind.ReturnStatement */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 283 /* SyntaxKind.JsxOpeningFragment */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 288 /* SyntaxKind.JsxExpression */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 164 /* SyntaxKind.Parameter */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 273 /* SyntaxKind.NamedExports */: - case 269 /* SyntaxKind.NamedImports */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 184 /* SyntaxKind.TypeLiteral */: + case 197 /* SyntaxKind.MappedType */: + case 186 /* SyntaxKind.TupleType */: + case 266 /* SyntaxKind.CaseBlock */: + case 293 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 240 /* SyntaxKind.VariableStatement */: + case 274 /* SyntaxKind.ExportAssignment */: + case 250 /* SyntaxKind.ReturnStatement */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 286 /* SyntaxKind.JsxOpeningFragment */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 291 /* SyntaxKind.JsxExpression */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 166 /* SyntaxKind.Parameter */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 276 /* SyntaxKind.NamedExports */: + case 272 /* SyntaxKind.NamedImports */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: - if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 205 /* SyntaxKind.ObjectLiteralExpression */) { // TODO: GH#18217 + case 257 /* SyntaxKind.VariableDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: + if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // TODO: GH#18217 return rangeIsOnOneLine(sourceFile, child); } - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ && sourceFile && child && childKind === 278 /* SyntaxKind.JsxElement */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ && sourceFile && child && childKind === 281 /* SyntaxKind.JsxElement */) { var parentStartLine = sourceFile.getLineAndCharacterOfPosition(ts.skipTrivia(sourceFile.text, parent.pos)).line; var childStartLine = sourceFile.getLineAndCharacterOfPosition(ts.skipTrivia(sourceFile.text, child.pos)).line; return parentStartLine !== childStartLine; } - if (parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { return true; } break; - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return childKind !== 235 /* SyntaxKind.Block */; - case 214 /* SyntaxKind.ArrowFunction */: - if (sourceFile && childKind === 212 /* SyntaxKind.ParenthesizedExpression */) { + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return childKind !== 238 /* SyntaxKind.Block */; + case 216 /* SyntaxKind.ArrowFunction */: + if (sourceFile && childKind === 214 /* SyntaxKind.ParenthesizedExpression */) { return rangeIsOnOneLine(sourceFile, child); } - return childKind !== 235 /* SyntaxKind.Block */; - case 272 /* SyntaxKind.ExportDeclaration */: - return childKind !== 273 /* SyntaxKind.NamedExports */; - case 266 /* SyntaxKind.ImportDeclaration */: - return childKind !== 267 /* SyntaxKind.ImportClause */ || - (!!child.namedBindings && child.namedBindings.kind !== 269 /* SyntaxKind.NamedImports */); - case 278 /* SyntaxKind.JsxElement */: - return childKind !== 281 /* SyntaxKind.JsxClosingElement */; - case 282 /* SyntaxKind.JsxFragment */: - return childKind !== 284 /* SyntaxKind.JsxClosingFragment */; - case 188 /* SyntaxKind.IntersectionType */: - case 187 /* SyntaxKind.UnionType */: - if (childKind === 182 /* SyntaxKind.TypeLiteral */ || childKind === 184 /* SyntaxKind.TupleType */) { + return childKind !== 238 /* SyntaxKind.Block */; + case 275 /* SyntaxKind.ExportDeclaration */: + return childKind !== 276 /* SyntaxKind.NamedExports */; + case 269 /* SyntaxKind.ImportDeclaration */: + return childKind !== 270 /* SyntaxKind.ImportClause */ || + (!!child.namedBindings && child.namedBindings.kind !== 272 /* SyntaxKind.NamedImports */); + case 281 /* SyntaxKind.JsxElement */: + return childKind !== 284 /* SyntaxKind.JsxClosingElement */; + case 285 /* SyntaxKind.JsxFragment */: + return childKind !== 287 /* SyntaxKind.JsxClosingFragment */; + case 190 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + if (childKind === 184 /* SyntaxKind.TypeLiteral */ || childKind === 186 /* SyntaxKind.TupleType */) { return false; } break; @@ -150494,11 +151732,11 @@ var ts; SmartIndenter.nodeWillIndentChild = nodeWillIndentChild; function isControlFlowEndingStatement(kind, parent) { switch (kind) { - case 247 /* SyntaxKind.ReturnStatement */: - case 251 /* SyntaxKind.ThrowStatement */: - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: - return parent.kind !== 235 /* SyntaxKind.Block */; + case 250 /* SyntaxKind.ReturnStatement */: + case 254 /* SyntaxKind.ThrowStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + return parent.kind !== 238 /* SyntaxKind.Block */; default: return false; } @@ -150715,7 +151953,7 @@ var ts; * Checks if 'candidate' argument is a legal separator in the list that contains 'node' as an element */ function isSeparator(node, candidate) { - return !!candidate && !!node.parent && (candidate.kind === 27 /* SyntaxKind.CommaToken */ || (candidate.kind === 26 /* SyntaxKind.SemicolonToken */ && node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */)); + return !!candidate && !!node.parent && (candidate.kind === 27 /* SyntaxKind.CommaToken */ || (candidate.kind === 26 /* SyntaxKind.SemicolonToken */ && node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */)); } function isThisTypeAnnotatable(containingFunction) { return ts.isFunctionExpression(containingFunction) || ts.isFunctionDeclaration(containingFunction); @@ -150947,7 +152185,7 @@ var ts; } } else { - endNode = (_a = (node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? node.exclamationToken : node.questionToken)) !== null && _a !== void 0 ? _a : node.name; + endNode = (_a = (node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? node.exclamationToken : node.questionToken)) !== null && _a !== void 0 ? _a : node.name; } this.insertNodeAt(sourceFile, endNode.end, type, { prefix: ": " }); return true; @@ -151113,18 +152351,18 @@ var ts; }; ChangeTracker.prototype.getInsertNodeAfterOptionsWorker = function (node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return { prefix: this.newLineCharacter, suffix: this.newLineCharacter }; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: case 10 /* SyntaxKind.StringLiteral */: case 79 /* SyntaxKind.Identifier */: return { prefix: ", " }; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return { suffix: "," + this.newLineCharacter }; case 93 /* SyntaxKind.ExportKeyword */: return { prefix: " " }; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return {}; default: ts.Debug.assert(ts.isStatement(node) || ts.isClassOrTypeElement(node)); // Else we haven't handled this kind of node yet -- add it @@ -151133,7 +152371,7 @@ var ts; }; ChangeTracker.prototype.insertName = function (sourceFile, node, name) { ts.Debug.assert(!node.name); - if (node.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind === 216 /* SyntaxKind.ArrowFunction */) { var arrow = ts.findChildOfKind(node, 38 /* SyntaxKind.EqualsGreaterThanToken */, sourceFile); var lparen = ts.findChildOfKind(node, 20 /* SyntaxKind.OpenParenToken */, sourceFile); if (lparen) { @@ -151147,14 +152385,14 @@ var ts; // Replacing full range of arrow to get rid of the leading space -- replace ` =>` with `)` this.replaceRange(sourceFile, arrow, ts.factory.createToken(21 /* SyntaxKind.CloseParenToken */)); } - if (node.body.kind !== 235 /* SyntaxKind.Block */) { + if (node.body.kind !== 238 /* SyntaxKind.Block */) { // `() => 0` => `function f() { return 0; }` this.insertNodesAt(sourceFile, node.body.getStart(sourceFile), [ts.factory.createToken(18 /* SyntaxKind.OpenBraceToken */), ts.factory.createToken(105 /* SyntaxKind.ReturnKeyword */)], { joiner: " ", suffix: " " }); this.insertNodesAt(sourceFile, node.body.end, [ts.factory.createToken(26 /* SyntaxKind.SemicolonToken */), ts.factory.createToken(19 /* SyntaxKind.CloseBraceToken */)], { joiner: " " }); } } else { - var pos = ts.findChildOfKind(node, node.kind === 213 /* SyntaxKind.FunctionExpression */ ? 98 /* SyntaxKind.FunctionKeyword */ : 84 /* SyntaxKind.ClassKeyword */, sourceFile).end; + var pos = ts.findChildOfKind(node, node.kind === 215 /* SyntaxKind.FunctionExpression */ ? 98 /* SyntaxKind.FunctionKeyword */ : 84 /* SyntaxKind.ClassKeyword */, sourceFile).end; this.insertNodeAt(sourceFile, pos, ts.factory.createIdentifier(name), { prefix: " " }); } }; @@ -151331,10 +152569,10 @@ var ts; }()); textChanges_3.ChangeTracker = ChangeTracker; function updateJSDocHost(parent) { - if (parent.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (parent.kind !== 216 /* SyntaxKind.ArrowFunction */) { return parent; } - var jsDocNode = parent.parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ ? + var jsDocNode = parent.parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ ? parent.parent : parent.parent.parent; jsDocNode.jsDoc = parent.jsDoc; @@ -151346,16 +152584,16 @@ var ts; return undefined; } switch (oldTag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: { + case 343 /* SyntaxKind.JSDocParameterTag */: { var oldParam = oldTag; var newParam = newTag; return ts.isIdentifier(oldParam.name) && ts.isIdentifier(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText ? ts.factory.createJSDocParameterTag(/*tagName*/ undefined, newParam.name, /*isBracketed*/ false, newParam.typeExpression, newParam.isNameFirst, oldParam.comment) : undefined; } - case 341 /* SyntaxKind.JSDocReturnTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: return ts.factory.createJSDocReturnTag(/*tagName*/ undefined, newTag.typeExpression, oldTag.comment); - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return ts.factory.createJSDocTypeTag(/*tagName*/ undefined, newTag.typeExpression, oldTag.comment); } } @@ -151749,14 +152987,14 @@ var ts; } textChanges_3.isValidLocationToAddComment = isValidLocationToAddComment; function needSemicolonBetween(a, b) { - return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ || ts.isStatementButNotDeclaration(a) && ts.isStatementButNotDeclaration(b); // TODO: only if b would start with a `(` or `[` } var deleteDeclaration; (function (deleteDeclaration_1) { function deleteDeclaration(changes, deletedNodesInLists, sourceFile, node) { switch (node.kind) { - case 164 /* SyntaxKind.Parameter */: { + case 166 /* SyntaxKind.Parameter */: { var oldFunction = node.parent; if (ts.isArrowFunction(oldFunction) && oldFunction.parameters.length === 1 && @@ -151771,17 +153009,17 @@ var ts; } break; } - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: var isFirstImport = sourceFile.imports.length && node === ts.first(sourceFile.imports).parent || node === ts.find(sourceFile.statements, ts.isAnyImportSyntax); // For first import, leave header comment in place, otherwise only delete JSDoc comments deleteNode(changes, sourceFile, node, { leadingTriviaOption: isFirstImport ? LeadingTriviaOption.Exclude : ts.hasJSDocNodes(node) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine, }); break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: var pattern = node.parent; - var preserveComma = pattern.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && node !== ts.last(pattern.elements); + var preserveComma = pattern.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && node !== ts.last(pattern.elements); if (preserveComma) { deleteNode(changes, sourceFile, node); } @@ -151789,13 +153027,13 @@ var ts; deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node); break; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: var namedImports = node.parent; if (namedImports.elements.length === 1) { deleteImportBinding(changes, sourceFile, namedImports); @@ -151804,7 +153042,7 @@ var ts; deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: deleteImportBinding(changes, sourceFile, node); break; case 26 /* SyntaxKind.SemicolonToken */: @@ -151813,8 +153051,8 @@ var ts; case 98 /* SyntaxKind.FunctionKeyword */: deleteNode(changes, sourceFile, node, { leadingTriviaOption: LeadingTriviaOption.Exclude }); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: deleteNode(changes, sourceFile, node, { leadingTriviaOption: ts.hasJSDocNodes(node) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine }); break; default: @@ -151865,13 +153103,13 @@ var ts; // Delete the entire import declaration // |import * as ns from './file'| // |import { a } from './file'| - var importDecl = ts.getAncestor(node, 266 /* SyntaxKind.ImportDeclaration */); + var importDecl = ts.getAncestor(node, 269 /* SyntaxKind.ImportDeclaration */); deleteNode(changes, sourceFile, importDecl); } } function deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node) { var parent = node.parent; - if (parent.kind === 292 /* SyntaxKind.CatchClause */) { + if (parent.kind === 295 /* SyntaxKind.CatchClause */) { // TODO: There's currently no unused diagnostic for this, could be a suggestion changes.deleteNodeRange(sourceFile, ts.findChildOfKind(parent, 20 /* SyntaxKind.OpenParenToken */, sourceFile), ts.findChildOfKind(parent, 21 /* SyntaxKind.CloseParenToken */, sourceFile)); return; @@ -151882,14 +153120,14 @@ var ts; } var gp = parent.parent; switch (gp.kind) { - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: changes.replaceNode(sourceFile, node, ts.factory.createObjectLiteralExpression()); break; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: deleteNode(changes, sourceFile, parent); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: deleteNode(changes, sourceFile, gp, { leadingTriviaOption: ts.hasJSDocNodes(gp) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine }); break; default: @@ -152076,8 +153314,8 @@ var ts; }); function makeChange(changeTracker, sourceFile, assertion) { var replacement = ts.isAsExpression(assertion) - ? ts.factory.createAsExpression(assertion.expression, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)) - : ts.factory.createTypeAssertion(ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */), assertion.expression); + ? ts.factory.createAsExpression(assertion.expression, ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)) + : ts.factory.createTypeAssertion(ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */), assertion.expression); changeTracker.replaceNode(sourceFile, assertion.expression, replacement); } function getAssertion(sourceFile, pos) { @@ -152161,7 +153399,7 @@ var ts; } } fixedDeclarations === null || fixedDeclarations === void 0 ? void 0 : fixedDeclarations.add(ts.getNodeId(insertionSite)); - var cloneWithModifier = ts.factory.updateModifiers(ts.getSynthesizedDeepClone(insertionSite, /*includeTrivia*/ true), ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(ts.getSyntacticModifierFlags(insertionSite) | 256 /* ModifierFlags.Async */))); + var cloneWithModifier = ts.factory.updateModifiers(ts.getSynthesizedDeepClone(insertionSite, /*includeTrivia*/ true), ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(ts.getSyntacticModifierFlags(insertionSite) | 512 /* ModifierFlags.Async */))); changeTracker.replaceNode(sourceFile, insertionSite, cloneWithModifier); } function getFixableErrorSpanDeclaration(sourceFile, span) { @@ -152207,7 +153445,7 @@ var ts; ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type.code, ts.Diagnostics.Operator_0_cannot_be_applied_to_type_1.code, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2.code, - ts.Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap.code, + ts.Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap.code, ts.Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined.code, ts.Diagnostics.Type_0_is_not_an_array_type.code, ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type.code, @@ -152305,7 +153543,7 @@ var ts; } var declaration = ts.tryCast(symbol.valueDeclaration, ts.isVariableDeclaration); var variableName = declaration && ts.tryCast(declaration.name, ts.isIdentifier); - var variableStatement = ts.getAncestor(declaration, 237 /* SyntaxKind.VariableStatement */); + var variableStatement = ts.getAncestor(declaration, 240 /* SyntaxKind.VariableStatement */); if (!declaration || !variableStatement || declaration.type || !declaration.initializer || @@ -152383,10 +153621,10 @@ var ts; function isInsideAwaitableBody(node) { return node.kind & 32768 /* NodeFlags.AwaitContext */ || !!ts.findAncestor(node, function (ancestor) { return ancestor.parent && ts.isArrowFunction(ancestor.parent) && ancestor.parent.body === ancestor || - ts.isBlock(ancestor) && (ancestor.parent.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - ancestor.parent.kind === 213 /* SyntaxKind.FunctionExpression */ || - ancestor.parent.kind === 214 /* SyntaxKind.ArrowFunction */ || - ancestor.parent.kind === 169 /* SyntaxKind.MethodDeclaration */); + ts.isBlock(ancestor) && (ancestor.parent.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + ancestor.parent.kind === 215 /* SyntaxKind.FunctionExpression */ || + ancestor.parent.kind === 216 /* SyntaxKind.ArrowFunction */ || + ancestor.parent.kind === 171 /* SyntaxKind.MethodDeclaration */); }); } function makeChange(changeTracker, errorCode, sourceFile, checker, insertionSite, fixedDeclarations) { @@ -152505,10 +153743,10 @@ var ts; function isPossiblyPartOfDestructuring(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return true; default: return false; @@ -152523,7 +153761,7 @@ var ts; function isPossiblyPartOfCommaSeperatedInitializer(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: case 27 /* SyntaxKind.CommaToken */: return true; default: @@ -152572,9 +153810,9 @@ var ts; return; } var declaration = token.parent; - if (declaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + if (declaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ && (!fixedNodes || ts.tryAddToSet(fixedNodes, declaration))) { - changeTracker.insertModifierBefore(sourceFile, 135 /* SyntaxKind.DeclareKeyword */, declaration); + changeTracker.insertModifierBefore(sourceFile, 136 /* SyntaxKind.DeclareKeyword */, declaration); } } })(codefix = ts.codefix || (ts.codefix = {})); @@ -152728,7 +153966,7 @@ var ts; var add = toAdd_1[_i]; var d = add.valueDeclaration; if (d && (ts.isPropertySignature(d) || ts.isPropertyDeclaration(d)) && d.type) { - var t = ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], d.type.kind === 187 /* SyntaxKind.UnionType */ ? d.type.types : [d.type], true), [ + var t = ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], d.type.kind === 189 /* SyntaxKind.UnionType */ ? d.type.types : [d.type], true), [ ts.factory.createTypeReferenceNode("undefined") ], false)); changes.replaceNode(d.getSourceFile(), d.type, t); @@ -152808,26 +154046,26 @@ var ts; } function isDeclarationWithType(node) { return ts.isFunctionLikeDeclaration(node) || - node.kind === 254 /* SyntaxKind.VariableDeclaration */ || - node.kind === 166 /* SyntaxKind.PropertySignature */ || - node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + node.kind === 257 /* SyntaxKind.VariableDeclaration */ || + node.kind === 168 /* SyntaxKind.PropertySignature */ || + node.kind === 169 /* SyntaxKind.PropertyDeclaration */; } function transformJSDocType(node) { switch (node.kind) { - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return ts.factory.createTypeReferenceNode("any", ts.emptyArray); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return transformJSDocOptionalType(node); - case 315 /* SyntaxKind.JSDocNonNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: return transformJSDocType(node.type); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return transformJSDocNullableType(node); - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return transformJSDocVariadicType(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return transformJSDocFunctionType(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return transformJSDocTypeReference(node); default: var visited = ts.visitEachChild(node, transformJSDocType, ts.nullTransformationContext); @@ -152848,11 +154086,11 @@ var ts; var _a; // TODO: This does not properly handle `function(new:C, string)` per https://github.com/google/closure-compiler/wiki/Types-in-the-Closure-Type-System#the-javascript-type-language // however we do handle it correctly in `serializeTypeForDeclaration` in checker.ts - return ts.factory.createFunctionTypeNode(ts.emptyArray, node.parameters.map(transformJSDocParameter), (_a = node.type) !== null && _a !== void 0 ? _a : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + return ts.factory.createFunctionTypeNode(ts.emptyArray, node.parameters.map(transformJSDocParameter), (_a = node.type) !== null && _a !== void 0 ? _a : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } function transformJSDocParameter(node) { var index = node.parent.parameters.indexOf(node); - var isRest = node.type.kind === 318 /* SyntaxKind.JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217 + var isRest = node.type.kind === 321 /* SyntaxKind.JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217 var name = node.name || (isRest ? "rest" : "arg" + index); var dotdotdot = isRest ? ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */) : node.dotDotDotToken; return ts.factory.createParameterDeclaration(node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer); @@ -152891,8 +154129,8 @@ var ts; function transformJSDocIndexSignature(node) { var index = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, - /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */ ? "n" : "s", - /*questionToken*/ undefined, ts.factory.createTypeReferenceNode(node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */ ? "number" : "string", []), + /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */ ? "n" : "s", + /*questionToken*/ undefined, ts.factory.createTypeReferenceNode(node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */ ? "number" : "string", []), /*initializer*/ undefined); var indexSignature = ts.factory.createTypeLiteralNode([ts.factory.createIndexSignature(/*modifiers*/ undefined, [index], node.typeArguments[1])]); ts.setEmitFlags(indexSignature, 1 /* EmitFlags.SingleLine */); @@ -152927,8 +154165,8 @@ var ts; return undefined; } var ctorDeclaration = ctorSymbol.valueDeclaration; - if (ts.isFunctionDeclaration(ctorDeclaration)) { - changes.replaceNode(sourceFile, ctorDeclaration, createClassFromFunctionDeclaration(ctorDeclaration)); + if (ts.isFunctionDeclaration(ctorDeclaration) || ts.isFunctionExpression(ctorDeclaration)) { + changes.replaceNode(sourceFile, ctorDeclaration, createClassFromFunction(ctorDeclaration)); } else if (ts.isVariableDeclaration(ctorDeclaration)) { var classDeclaration = createClassFromVariableDeclaration(ctorDeclaration); @@ -153032,7 +154270,7 @@ var ts; return; } // delete the entire statement if this expression is the sole expression to take care of the semicolon at the end - var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ + var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ ? assignmentBinaryExpression.parent : assignmentBinaryExpression; changes.delete(sourceFile, nodeToDelete); if (!assignmentExpr) { @@ -153084,7 +154322,7 @@ var ts; return createArrowFunctionExpressionMember(members, expression, name); } function createFunctionExpressionMember(members, functionExpression, name) { - var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 131 /* SyntaxKind.AsyncKeyword */)); + var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 132 /* SyntaxKind.AsyncKeyword */)); var method = ts.factory.createMethodDeclaration(fullModifiers, /*asteriskToken*/ undefined, name, /*questionToken*/ undefined, /*typeParameters*/ undefined, functionExpression.parameters, /*type*/ undefined, functionExpression.body); ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile); @@ -153095,14 +154333,14 @@ var ts; var arrowFunctionBody = arrowFunction.body; var bodyBlock; // case 1: () => { return [1,2,3] } - if (arrowFunctionBody.kind === 235 /* SyntaxKind.Block */) { + if (arrowFunctionBody.kind === 238 /* SyntaxKind.Block */) { bodyBlock = arrowFunctionBody; } // case 2: () => [1,2,3] else { bodyBlock = ts.factory.createBlock([ts.factory.createReturnStatement(arrowFunctionBody)]); } - var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 131 /* SyntaxKind.AsyncKeyword */)); + var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 132 /* SyntaxKind.AsyncKeyword */)); var method = ts.factory.createMethodDeclaration(fullModifiers, /*asteriskToken*/ undefined, name, /*questionToken*/ undefined, /*typeParameters*/ undefined, arrowFunction.parameters, /*type*/ undefined, bodyBlock); ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile); @@ -153125,7 +154363,7 @@ var ts; // Don't call copyComments here because we'll already leave them in place return cls; } - function createClassFromFunctionDeclaration(node) { + function createClassFromFunction(node) { var memberElements = createClassElementsFromSymbol(ctorSymbol); if (node.body) { memberElements.unshift(ts.factory.createConstructorDeclaration(/*modifiers*/ undefined, node.parameters, node.body)); @@ -153215,7 +154453,7 @@ var ts; return; } var pos = ts.skipTrivia(sourceFile.text, ts.moveRangePastModifiers(functionToConvert).pos); - changes.insertModifierAt(sourceFile, pos, 131 /* SyntaxKind.AsyncKeyword */, { suffix: " " }); + changes.insertModifierAt(sourceFile, pos, 132 /* SyntaxKind.AsyncKeyword */, { suffix: " " }); var _loop_12 = function (returnStatement) { ts.forEachChild(returnStatement, function visit(node) { if (ts.isCallExpression(node)) { @@ -153621,7 +154859,7 @@ var ts; case 104 /* SyntaxKind.NullKeyword */: // do not produce a transformed statement for a null argument break; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: case 79 /* SyntaxKind.Identifier */: // identifier includes undefined if (!inputArgName) { // undefined was argument passed to promise handler @@ -153643,8 +154881,8 @@ var ts; continuationArgName.types.push(transformer.checker.getAwaitedType(returnType) || returnType); } return varDeclOrAssignment; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: { + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: { var funcBody = func.body; var returnType_1 = (_a = getLastCallSignature(transformer.checker.getTypeAtLocation(func), transformer.checker)) === null || _a === void 0 ? void 0 : _a.getReturnType(); // Arrow functions with block bodies { } will enter this control flow @@ -153813,7 +155051,7 @@ var ts; name = getMapEntryOrDefault(funcNode.name); } // return undefined argName when arg is null or undefined - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (!name || "identifier" in name && name.identifier.text === "undefined") { return undefined; } @@ -153922,10 +155160,10 @@ var ts; } var importNode = ts.importFromModuleSpecifier(moduleSpecifier); switch (importNode.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: changes.replaceNode(importingFile, importNode, ts.makeImport(importNode.name, /*namedImports*/ undefined, moduleSpecifier, quotePreference)); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isRequireCall(importNode, /*checkArgumentIsStringLiteralLike*/ false)) { changes.replaceNode(importingFile, importNode, ts.factory.createPropertyAccessExpression(ts.getSynthesizedDeepClone(importNode), "default")); } @@ -153992,20 +155230,20 @@ var ts; } function convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports, useSitesToUnqualify, quotePreference) { switch (statement.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target, quotePreference); return false; - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; switch (expression.kind) { - case 208 /* SyntaxKind.CallExpression */: { + case 210 /* SyntaxKind.CallExpression */: { if (ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true)) { // For side-effecting require() call, just make a side-effecting import. changes.replaceNode(sourceFile, statement, ts.makeImport(/*name*/ undefined, /*namedImports*/ undefined, expression.arguments[0], quotePreference)); } return false; } - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var operatorToken = expression.operatorToken; return operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && convertAssignment(sourceFile, checker, expression, changes, exports, useSitesToUnqualify); } @@ -154054,8 +155292,8 @@ var ts; /** Converts `const name = require("moduleSpecifier").propertyName` */ function convertPropertyAccessImport(name, propertyName, moduleSpecifier, identifiers, quotePreference) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: { // `const [a, b] = require("c").d` --> `import { d } from "c"; const [a, b] = d;` var tmp = makeUniqueName(propertyName, identifiers); return convertedImports([ @@ -154106,16 +155344,16 @@ var ts; function tryChangeModuleExportsObject(object, useSitesToUnqualify) { var statements = ts.mapAllOrFail(object.properties, function (prop) { switch (prop.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // TODO: Maybe we should handle this? See fourslash test `refactorConvertToEs6Module_export_object_shorthand.ts`. // falls through - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return undefined; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return !ts.isIdentifier(prop.name) ? undefined : convertExportsDotXEquals_replaceNode(prop.name.text, prop.initializer, useSitesToUnqualify); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return !ts.isIdentifier(prop.name) ? undefined : functionExpressionToDeclaration(prop.name.text, [ts.factory.createToken(93 /* SyntaxKind.ExportKeyword */)], prop, useSitesToUnqualify); default: ts.Debug.assertNever(prop, "Convert to ES6 got invalid prop kind ".concat(prop.kind)); @@ -154179,7 +155417,7 @@ var ts; function convertExportsDotXEquals_replaceNode(name, exported, useSitesToUnqualify) { var modifiers = [ts.factory.createToken(93 /* SyntaxKind.ExportKeyword */)]; switch (exported.kind) { - case 213 /* SyntaxKind.FunctionExpression */: { + case 215 /* SyntaxKind.FunctionExpression */: { var expressionName = exported.name; if (expressionName && expressionName.text !== name) { // `exports.f = function g() {}` -> `export const f = function g() {}` @@ -154187,10 +155425,10 @@ var ts; } } // falls through - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // `exports.f = function() {}` --> `export function f() {}` return functionExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: // `exports.C = class {}` --> `export class C {}` return classExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify); default: @@ -154210,7 +155448,7 @@ var ts; : ts.getSynthesizedDeepCloneWithReplacements(nodeOrNodes, /*includeTrivia*/ true, replaceNode); function replaceNode(original) { // We are replacing `mod.SomeExport` wih `SomeExport`, so we only need to look at PropertyAccessExpressions - if (original.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (original.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var replacement = useSitesToUnqualify.get(original); // Remove entry from `useSitesToUnqualify` so the refactor knows it's taken care of by the parent statement we're replacing useSitesToUnqualify.delete(original); @@ -154225,7 +155463,7 @@ var ts; */ function convertSingleImport(name, moduleSpecifier, checker, identifiers, target, quotePreference) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: { var importSpecifiers = ts.mapAllOrFail(name.elements, function (e) { return e.dotDotDotToken || e.initializer || e.propertyName && !ts.isIdentifier(e.propertyName) || !ts.isIdentifier(e.name) ? undefined @@ -154236,7 +155474,7 @@ var ts; } } // falls through -- object destructuring has an interesting pattern and must be a variable declaration - case 202 /* SyntaxKind.ArrayBindingPattern */: { + case 204 /* SyntaxKind.ArrayBindingPattern */: { /* import x from "x"; const [a, b, c] = x; @@ -154329,11 +155567,11 @@ var ts; function isFreeIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return parent.name !== node; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return parent.propertyName !== node; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return parent.propertyName !== node; default: return true; @@ -154444,7 +155682,7 @@ var ts; var exportDeclaration = exportClause.parent; var typeExportSpecifiers = getTypeExportSpecifiers(exportSpecifier, context); if (typeExportSpecifiers.length === exportClause.elements.length) { - changes.insertModifierBefore(context.sourceFile, 152 /* SyntaxKind.TypeKeyword */, exportClause); + changes.insertModifierBefore(context.sourceFile, 154 /* SyntaxKind.TypeKeyword */, exportClause); } else { var valueExportDeclaration = ts.factory.updateExportDeclaration(exportDeclaration, exportDeclaration.modifiers, @@ -154680,27 +155918,29 @@ var ts; errorCodes: errorCodes, getCodeActions: function (context) { var errorCode = context.errorCode, preferences = context.preferences, sourceFile = context.sourceFile, span = context.span, program = context.program; - var info = getFixesInfo(context, errorCode, span.start, /*useAutoImportProvider*/ true); + var info = getFixInfos(context, errorCode, span.start, /*useAutoImportProvider*/ true); if (!info) return undefined; - var fixes = info.fixes, symbolName = info.symbolName, errorIdentifierText = info.errorIdentifierText; var quotePreference = ts.getQuotePreference(sourceFile, preferences); - return fixes.map(function (fix) { return codeActionForFix(context, sourceFile, symbolName, fix, - /*includeSymbolNameInDescription*/ symbolName !== errorIdentifierText, quotePreference, program.getCompilerOptions()); }); + return info.map(function (_a) { + var fix = _a.fix, symbolName = _a.symbolName, errorIdentifierText = _a.errorIdentifierText; + return codeActionForFix(context, sourceFile, symbolName, fix, + /*includeSymbolNameInDescription*/ symbolName !== errorIdentifierText, quotePreference, program.getCompilerOptions()); + }); }, fixIds: [importFixId], getAllCodeActions: function (context) { - var sourceFile = context.sourceFile, program = context.program, preferences = context.preferences, host = context.host; - var importAdder = createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ true, preferences, host); + var sourceFile = context.sourceFile, program = context.program, preferences = context.preferences, host = context.host, cancellationToken = context.cancellationToken; + var importAdder = createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ true, preferences, host, cancellationToken); codefix.eachDiagnostic(context, errorCodes, function (diag) { return importAdder.addImportFromDiagnostic(diag, context); }); return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, importAdder.writeFixes)); }, }); - function createImportAdder(sourceFile, program, preferences, host) { - return createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ false, preferences, host); + function createImportAdder(sourceFile, program, preferences, host, cancellationToken) { + return createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ false, preferences, host, cancellationToken); } codefix.createImportAdder = createImportAdder; - function createImportAdderWorker(sourceFile, program, useAutoImportProvider, preferences, host) { + function createImportAdderWorker(sourceFile, program, useAutoImportProvider, preferences, host, cancellationToken) { var compilerOptions = program.getCompilerOptions(); // Namespace fixes don't conflict, so just build a list. var addToNamespace = []; @@ -154711,27 +155951,26 @@ var ts; var newImports = new ts.Map(); return { addImportFromDiagnostic: addImportFromDiagnostic, addImportFromExportedSymbol: addImportFromExportedSymbol, writeFixes: writeFixes, hasFixes: hasFixes }; function addImportFromDiagnostic(diagnostic, context) { - var info = getFixesInfo(context, diagnostic.code, diagnostic.start, useAutoImportProvider); - if (!info || !info.fixes.length) + var info = getFixInfos(context, diagnostic.code, diagnostic.start, useAutoImportProvider); + if (!info || !info.length) return; - addImport(info); + addImport(ts.first(info)); } function addImportFromExportedSymbol(exportedSymbol, isValidTypeOnlyUseSite) { var moduleSymbol = ts.Debug.checkDefined(exportedSymbol.parent); var symbolName = ts.getNameForExportedSymbol(exportedSymbol, ts.getEmitScriptTarget(compilerOptions)); var checker = program.getTypeChecker(); var symbol = checker.getMergedSymbol(ts.skipAlias(exportedSymbol, checker)); - var exportInfo = getAllReExportingModules(sourceFile, symbol, moduleSymbol, symbolName, /*isJsxTagName*/ false, host, program, preferences, useAutoImportProvider); + var exportInfo = getAllExportInfoForSymbol(sourceFile, symbol, symbolName, /*isJsxTagName*/ false, program, host, preferences, cancellationToken); var useRequire = shouldUseRequire(sourceFile, program); - var fix = getImportFixForSymbol(sourceFile, exportInfo, moduleSymbol, program, /*useNamespaceInfo*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences); + var fix = getImportFixForSymbol(sourceFile, ts.Debug.checkDefined(exportInfo), moduleSymbol, program, /*useNamespaceInfo*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences); if (fix) { - addImport({ fixes: [fix], symbolName: symbolName, errorIdentifierText: undefined }); + addImport({ fix: fix, symbolName: symbolName, errorIdentifierText: undefined }); } } function addImport(info) { var _a, _b; - var fixes = info.fixes, symbolName = info.symbolName; - var fix = ts.first(fixes); + var fix = info.fix, symbolName = info.symbolName; switch (fix.kind) { case 0 /* ImportFixKind.UseNamespace */: addToNamespace.push(fix); @@ -154898,11 +156137,12 @@ var ts; AddAsTypeOnly[AddAsTypeOnly["Required"] = 2] = "Required"; AddAsTypeOnly[AddAsTypeOnly["NotAllowed"] = 4] = "NotAllowed"; })(AddAsTypeOnly || (AddAsTypeOnly = {})); - function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, isJsxTagName, host, program, formatContext, position, preferences) { + function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) { var compilerOptions = program.getCompilerOptions(); var exportInfos = ts.pathIsBareSpecifier(ts.stripQuotes(moduleSymbol.name)) - ? [getSymbolExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)] - : getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, isJsxTagName, host, program, preferences, /*useAutoImportProvider*/ true); + ? [getSingleExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)] + : getAllExportInfoForSymbol(sourceFile, targetSymbol, symbolName, isJsxTagName, program, host, preferences, cancellationToken); + ts.Debug.assertIsDefined(exportInfos); var useRequire = shouldUseRequire(sourceFile, program); var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(ts.getTokenAtPosition(sourceFile, position)); var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, { symbolName: symbolName, position: position }, isValidTypeOnlyUseSite, useRequire, host, preferences)); @@ -154915,7 +156155,7 @@ var ts; codefix.getImportCompletionAction = getImportCompletionAction; function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, host, formatContext, preferences) { var compilerOptions = program.getCompilerOptions(); - var symbolName = getSymbolName(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions); + var symbolName = ts.single(getSymbolNamesToImport(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions)); var fix = getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program); var includeSymbolNameInDescription = symbolName !== symbolToken.text; return fix && codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix, includeSymbolNameInDescription, 1 /* QuotePreference.Double */, compilerOptions)); @@ -154930,7 +156170,16 @@ var ts; var description = _a.description, changes = _a.changes, commands = _a.commands; return { description: description, changes: changes, commands: commands }; } - function getSymbolExportInfoForSymbol(symbol, moduleSymbol, program, host) { + function getAllExportInfoForSymbol(importingFile, symbol, symbolName, preferCapitalized, program, host, preferences, cancellationToken) { + var getChecker = createGetChecker(program, host); + return ts.getExportInfoMap(importingFile, host, program, preferences, cancellationToken) + .search(importingFile.path, preferCapitalized, function (name) { return name === symbolName; }, function (info) { + if (ts.skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol) { + return info; + } + }); + } + function getSingleExportInfoForSymbol(symbol, moduleSymbol, program, host) { var _a, _b; var compilerOptions = program.getCompilerOptions(); var mainProgramInfo = getInfoWithChecker(program.getTypeChecker(), /*isFromPackageJson*/ false); @@ -154950,35 +156199,6 @@ var ts; } } } - function getAllReExportingModules(importingFile, targetSymbol, exportingModuleSymbol, symbolName, isJsxTagName, host, program, preferences, useAutoImportProvider) { - var result = []; - var compilerOptions = program.getCompilerOptions(); - var getModuleSpecifierResolutionHost = ts.memoizeOne(function (isFromPackageJson) { - return ts.createModuleSpecifierResolutionHost(isFromPackageJson ? host.getPackageJsonAutoImportProvider() : program, host); - }); - ts.forEachExternalModuleToImportFrom(program, host, preferences, useAutoImportProvider, function (moduleSymbol, moduleFile, program, isFromPackageJson) { - var checker = program.getTypeChecker(); - // Don't import from a re-export when looking "up" like to `./index` or `../index`. - if (moduleFile && moduleSymbol !== exportingModuleSymbol && ts.startsWith(importingFile.fileName, ts.getDirectoryPath(moduleFile.fileName))) { - return; - } - var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions); - if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions), isJsxTagName) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) { - result.push({ symbol: defaultInfo.symbol, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: defaultInfo.exportKind, targetFlags: ts.skipAlias(defaultInfo.symbol, checker).flags, isFromPackageJson: isFromPackageJson }); - } - for (var _i = 0, _a = checker.getExportsAndPropertiesOfModule(moduleSymbol); _i < _a.length; _i++) { - var exported = _a[_i]; - if (exported.name === symbolName && checker.getMergedSymbol(ts.skipAlias(exported, checker)) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) { - result.push({ symbol: exported, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: 0 /* ExportKind.Named */, targetFlags: ts.skipAlias(exported, checker).flags, isFromPackageJson: isFromPackageJson }); - } - } - }); - return result; - function isImportable(program, moduleFile, isFromPackageJson) { - var _a; - return !moduleFile || ts.isImportableFile(program, importingFile, moduleFile, preferences, /*packageJsonFilter*/ undefined, getModuleSpecifierResolutionHost(isFromPackageJson), (_a = host.getModuleSpecifierCache) === null || _a === void 0 ? void 0 : _a.call(host)); - } - } function getImportFixes(exportInfos, useNamespaceInfo, /** undefined only for missing JSX namespace */ isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap, fromCacheOnly) { @@ -155029,11 +156249,11 @@ var ts; function getTargetModuleFromNamespaceLikeImport(declaration, checker) { var _a; switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checker.resolveExternalModuleName(declaration.initializer.arguments[0]); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return checker.getAliasedSymbol(declaration.symbol); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var namespaceImport = ts.tryCast((_a = declaration.importClause) === null || _a === void 0 ? void 0 : _a.namedBindings, ts.isNamespaceImport); return namespaceImport && checker.getAliasedSymbol(namespaceImport.symbol); default: @@ -155043,11 +156263,11 @@ var ts; function getNamespaceLikeImportText(declaration) { var _a, _b, _c; switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return (_a = ts.tryCast(declaration.name, ts.isIdentifier)) === null || _a === void 0 ? void 0 : _a.text; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return declaration.name.text; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return (_c = ts.tryCast((_b = declaration.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings, ts.isNamespaceImport)) === null || _c === void 0 ? void 0 : _c.name.text; default: return ts.Debug.assertNever(declaration); @@ -155074,12 +156294,12 @@ var ts; function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker, compilerOptions) { return ts.firstDefined(existingImports, function (_a) { var declaration = _a.declaration, importKind = _a.importKind, symbol = _a.symbol, targetFlags = _a.targetFlags; - if (importKind === 3 /* ImportKind.CommonJS */ || importKind === 2 /* ImportKind.Namespace */ || declaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (importKind === 3 /* ImportKind.CommonJS */ || importKind === 2 /* ImportKind.Namespace */ || declaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { // These kinds of imports are not combinable with anything return undefined; } - if (declaration.kind === 254 /* SyntaxKind.VariableDeclaration */) { - return (importKind === 0 /* ImportKind.Named */ || importKind === 1 /* ImportKind.Default */) && declaration.name.kind === 201 /* SyntaxKind.ObjectBindingPattern */ + if (declaration.kind === 257 /* SyntaxKind.VariableDeclaration */) { + return (importKind === 0 /* ImportKind.Named */ || importKind === 1 /* ImportKind.Default */) && declaration.name.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? { kind: 2 /* ImportFixKind.AddToExisting */, importClauseOrBindingPattern: declaration.name, importKind: importKind, moduleSpecifier: declaration.initializer.arguments[0].text, addAsTypeOnly: 4 /* AddAsTypeOnly.NotAllowed */ } : undefined; } @@ -155100,7 +156320,7 @@ var ts; )) return undefined; if (importKind === 0 /* ImportKind.Named */ && - (namedBindings === null || namedBindings === void 0 ? void 0 : namedBindings.kind) === 268 /* SyntaxKind.NamespaceImport */ // Cannot add a named import to a declaration that has a namespace import + (namedBindings === null || namedBindings === void 0 ? void 0 : namedBindings.kind) === 271 /* SyntaxKind.NamespaceImport */ // Cannot add a named import to a declaration that has a namespace import ) return undefined; return { @@ -155123,7 +156343,7 @@ var ts; (importMap || (importMap = ts.createMultiMap())).add(ts.getSymbolId(moduleSymbol), i.parent); } } - else if (i.kind === 266 /* SyntaxKind.ImportDeclaration */ || i.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + else if (i.kind === 269 /* SyntaxKind.ImportDeclaration */ || i.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { var moduleSymbol = checker.getSymbolAtLocation(moduleSpecifier); if (moduleSymbol) { (importMap || (importMap = ts.createMultiMap())).add(ts.getSymbolId(moduleSymbol), i); @@ -155172,11 +156392,14 @@ var ts; // 5. Literally nothing to go on return true; } + function createGetChecker(program, host) { + return ts.memoizeOne(function (isFromPackageJson) { return isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker(); }); + } function getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfo, host, preferences, fromCacheOnly) { var isJs = ts.isSourceFileJS(sourceFile); var compilerOptions = program.getCompilerOptions(); var moduleSpecifierResolutionHost = ts.createModuleSpecifierResolutionHost(program, host); - var getChecker = ts.memoizeOne(function (isFromPackageJson) { return isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker(); }); + var getChecker = createGetChecker(program, host); var rejectNodeModulesRelativePaths = ts.moduleResolutionUsesNodeModules(ts.getEmitModuleResolutionKind(compilerOptions)); var getModuleSpecifiers = fromCacheOnly ? function (moduleSymbol) { return ({ moduleSpecifiers: ts.moduleSpecifiers.tryGetModuleSpecifiersFromCache(moduleSymbol, sourceFile, moduleSpecifierResolutionHost, preferences), computedWithoutCache: false }); } @@ -155220,7 +156443,7 @@ var ts; return { kind: 3 /* ImportFixKind.AddNew */, moduleSpecifier: moduleSpecifier, importKind: importKind, addAsTypeOnly: addAsTypeOnly, useRequire: useRequire }; } } - function getFixesInfo(context, errorCode, pos, useAutoImportProvider) { + function getFixInfos(context, errorCode, pos, useAutoImportProvider) { var symbolToken = ts.getTokenAtPosition(context.sourceFile, pos); var info; if (errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) { @@ -155230,19 +156453,23 @@ var ts; return undefined; } else if (errorCode === ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code) { - var symbolName_1 = getSymbolName(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions()); + var symbolName_1 = ts.single(getSymbolNamesToImport(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions())); var fix = getTypeOnlyPromotionFix(context.sourceFile, symbolToken, symbolName_1, context.program); - return fix && { fixes: [fix], symbolName: symbolName_1, errorIdentifierText: symbolToken.text }; + return fix && [{ fix: fix, symbolName: symbolName_1, errorIdentifierText: symbolToken.text }]; } else { info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider); } var packageJsonImportFilter = ts.createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host); - return info && __assign(__assign({}, info), { fixes: sortFixes(info.fixes, context.sourceFile, context.program, packageJsonImportFilter, context.host) }); + return info && sortFixInfo(info, context.sourceFile, context.program, packageJsonImportFilter, context.host); } - function sortFixes(fixes, sourceFile, program, packageJsonImportFilter, host) { + function sortFixInfo(fixes, sourceFile, program, packageJsonImportFilter, host) { var _toPath = function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), ts.hostGetCanonicalFileName(host)); }; - return ts.sort(fixes, function (a, b) { return ts.compareValues(a.kind, b.kind) || compareModuleSpecifiers(a, b, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath); }); + return ts.sort(fixes, function (a, b) { + return ts.compareBooleans(!!a.isJsxNamespaceFix, !!b.isJsxNamespaceFix) || + ts.compareValues(a.fix.kind, b.fix.kind) || + compareModuleSpecifiers(a.fix, b.fix, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath); + }); } function getBestFix(fixes, sourceFile, program, packageJsonImportFilter, host) { if (!ts.some(fixes)) @@ -155293,7 +156520,6 @@ var ts; return 0 /* Comparison.EqualTo */; } function getFixesInfoForUMDImport(_a, token) { - var _b; var sourceFile = _a.sourceFile, program = _a.program, host = _a.host, preferences = _a.preferences; var checker = program.getTypeChecker(); var umdSymbol = getUmdSymbol(token, checker); @@ -155305,7 +156531,7 @@ var ts; var useRequire = shouldUseRequire(sourceFile, program); var position = ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined; var fixes = getImportFixes(exportInfo, position ? { position: position, symbolName: symbolName } : undefined, /*isValidTypeOnlyUseSite*/ false, useRequire, program, sourceFile, host, preferences).fixes; - return { fixes: fixes, symbolName: symbolName, errorIdentifierText: (_b = ts.tryCast(token, ts.isIdentifier)) === null || _b === void 0 ? void 0 : _b.text }; + return fixes.map(function (fix) { var _a; return ({ fix: fix, symbolName: symbolName, errorIdentifierText: (_a = ts.tryCast(token, ts.isIdentifier)) === null || _a === void 0 ? void 0 : _a.text }); }); } function getUmdSymbol(token, checker) { // try the identifier to see if it is the umd symbol @@ -155366,19 +156592,20 @@ var ts; var sourceFile = _a.sourceFile, program = _a.program, cancellationToken = _a.cancellationToken, host = _a.host, preferences = _a.preferences; var checker = program.getTypeChecker(); var compilerOptions = program.getCompilerOptions(); - var symbolName = getSymbolName(sourceFile, checker, symbolToken, compilerOptions); - // "default" is a keyword and not a legal identifier for the import, but appears as an identifier. - if (symbolName === "default" /* InternalSymbolName.Default */) { - return undefined; - } - var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken); - var useRequire = shouldUseRequire(sourceFile, program); - var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences); - var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) { - var _ = _a[0], exportInfos = _a[1]; - return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes; - })); - return { fixes: fixes, symbolName: symbolName, errorIdentifierText: symbolToken.text }; + return ts.flatMap(getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions), function (symbolName) { + // "default" is a keyword and not a legal identifier for the import, but appears as an identifier. + if (symbolName === "default" /* InternalSymbolName.Default */) { + return undefined; + } + var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken); + var useRequire = shouldUseRequire(sourceFile, program); + var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences); + var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) { + var _ = _a[0], exportInfos = _a[1]; + return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes; + })); + return fixes.map(function (fix) { return ({ fix: fix, symbolName: symbolName, errorIdentifierText: symbolToken.text, isJsxNamespaceFix: symbolName !== symbolToken.text }); }); + }); } function getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program) { var checker = program.getTypeChecker(); @@ -155390,15 +156617,16 @@ var ts; return undefined; return { kind: 4 /* ImportFixKind.PromoteTypeOnly */, typeOnlyAliasDeclaration: typeOnlyAliasDeclaration }; } - function getSymbolName(sourceFile, checker, symbolToken, compilerOptions) { + function getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions) { var parent = symbolToken.parent; if ((ts.isJsxOpeningLikeElement(parent) || ts.isJsxClosingElement(parent)) && parent.tagName === symbolToken && ts.jsxModeNeedsExplicitImport(compilerOptions.jsx)) { var jsxNamespace = checker.getJsxNamespace(sourceFile); if (needsJsxNamespaceFix(jsxNamespace, symbolToken, checker)) { - return jsxNamespace; + var needsComponentNameFix = !ts.isIntrinsicJsxName(symbolToken.text) && !checker.resolveName(symbolToken.text, symbolToken, 111551 /* SymbolFlags.Value */, /*excludeGlobals*/ false); + return needsComponentNameFix ? [symbolToken.text, jsxNamespace] : [jsxNamespace]; } } - return symbolToken.text; + return [symbolToken.text]; } function needsJsxNamespaceFix(jsxNamespace, symbolToken, checker) { if (ts.isIntrinsicJsxName(symbolToken.text)) @@ -155507,7 +156735,7 @@ var ts; case 4 /* ImportFixKind.PromoteTypeOnly */: { var typeOnlyAliasDeclaration = fix.typeOnlyAliasDeclaration; var promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration, compilerOptions, sourceFile); - return promotedDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ + return promotedDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ ? [ts.Diagnostics.Remove_type_from_import_of_0_from_1, symbolName, getModuleSpecifierText(promotedDeclaration.parent.parent)] : [ts.Diagnostics.Remove_type_from_import_declaration_from_0, getModuleSpecifierText(promotedDeclaration)]; } @@ -155517,7 +156745,7 @@ var ts; } function getModuleSpecifierText(promotedDeclaration) { var _a, _b; - return promotedDeclaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ + return promotedDeclaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? ((_b = ts.tryCast((_a = ts.tryCast(promotedDeclaration.moduleReference, ts.isExternalModuleReference)) === null || _a === void 0 ? void 0 : _a.expression, ts.isStringLiteralLike)) === null || _b === void 0 ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText() : ts.cast(promotedDeclaration.parent.moduleSpecifier, ts.isStringLiteral).text; } @@ -155525,7 +156753,7 @@ var ts; // See comment in `doAddExistingFix` on constant with the same name. var convertExistingToTypeOnly = compilerOptions.preserveValueImports && compilerOptions.isolatedModules; switch (aliasDeclaration.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: if (aliasDeclaration.isTypeOnly) { if (aliasDeclaration.parent.elements.length > 1 && ts.OrganizeImports.importSpecifiersAreSorted(aliasDeclaration.parent.elements)) { changes.delete(sourceFile, aliasDeclaration); @@ -155543,13 +156771,13 @@ var ts; promoteImportClause(aliasDeclaration.parent.parent); return aliasDeclaration.parent.parent; } - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: promoteImportClause(aliasDeclaration); return aliasDeclaration; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: promoteImportClause(aliasDeclaration.parent); return aliasDeclaration.parent; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: changes.deleteRange(sourceFile, aliasDeclaration.getChildAt(1)); return aliasDeclaration; default: @@ -155561,7 +156789,7 @@ var ts; var namedImports = ts.tryCast(importClause.namedBindings, ts.isNamedImports); if (namedImports && namedImports.elements.length > 1) { if (ts.OrganizeImports.importSpecifiersAreSorted(namedImports.elements) && - aliasDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ && + aliasDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ && namedImports.elements.indexOf(aliasDeclaration) !== 0) { // The import specifier being promoted will be the only non-type-only, // import in the NamedImports, so it should be moved to the front. @@ -155571,7 +156799,7 @@ var ts; for (var _i = 0, _a = namedImports.elements; _i < _a.length; _i++) { var element = _a[_i]; if (element !== aliasDeclaration && !element.isTypeOnly) { - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, element); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, element); } } } @@ -155580,7 +156808,7 @@ var ts; } function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImports, compilerOptions) { var _a; - if (clause.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (clause.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (defaultImport) { addElementToBindingPattern(clause, defaultImport.name, "default"); } @@ -155641,7 +156869,7 @@ var ts; if (convertExistingToTypeOnly && existingSpecifiers) { for (var _d = 0, existingSpecifiers_1 = existingSpecifiers; _d < existingSpecifiers_1.length; _d++) { var specifier = existingSpecifiers_1[_d]; - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, specifier); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, specifier); } } } @@ -155816,7 +157044,7 @@ var ts; var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; }); if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined) return; - var declaration = findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); + var declaration = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); if (declaration === undefined) return; if (ts.isIdentifier(declaration) && ts.isTypeParameterDeclaration(declaration.parent)) { @@ -155850,14 +157078,6 @@ var ts; } } } - function findAncestorMatchingSpan(sourceFile, span) { - var end = ts.textSpanEnd(span); - var token = ts.getTokenAtPosition(sourceFile, span.start); - while (token.end < end) { - token = token.parent; - } - return token; - } function tryGetConstraintFromDiagnosticMessage(messageText) { var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/`extends (.*)`/) || [], _ = _a[0], constraint = _a[1]; return constraint; @@ -156001,7 +157221,7 @@ var ts; accessibilityModifier ? accessibilityModifier.end : lastDecorator ? ts.skipTrivia(sourceFile.text, lastDecorator.end) : classElement.getStart(sourceFile); var options = accessibilityModifier || staticModifier || abstractModifier ? { prefix: " " } : { suffix: " " }; - changeTracker.insertModifierAt(sourceFile, modifierPos, 159 /* SyntaxKind.OverrideKeyword */, options); + changeTracker.insertModifierAt(sourceFile, modifierPos, 161 /* SyntaxKind.OverrideKeyword */, options); } function doRemoveOverrideModifierChange(changeTracker, sourceFile, pos) { var classElement = findContainerClassElementLike(sourceFile, pos); @@ -156015,13 +157235,13 @@ var ts; } function isClassElementLikeHasJSDoc(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return ts.isParameterPropertyDeclaration(node, node.parent); default: return false; @@ -156153,7 +157373,7 @@ var ts; }); function getNamedTupleMember(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); - return ts.findAncestor(token, function (t) { return t.kind === 197 /* SyntaxKind.NamedTupleMember */; }); + return ts.findAncestor(token, function (t) { return t.kind === 199 /* SyntaxKind.NamedTupleMember */; }); } function doChange(changes, sourceFile, namedTupleMember) { if (!namedTupleMember) { @@ -156162,11 +157382,11 @@ var ts; var unwrappedType = namedTupleMember.type; var sawOptional = false; var sawRest = false; - while (unwrappedType.kind === 185 /* SyntaxKind.OptionalType */ || unwrappedType.kind === 186 /* SyntaxKind.RestType */ || unwrappedType.kind === 191 /* SyntaxKind.ParenthesizedType */) { - if (unwrappedType.kind === 185 /* SyntaxKind.OptionalType */) { + while (unwrappedType.kind === 187 /* SyntaxKind.OptionalType */ || unwrappedType.kind === 188 /* SyntaxKind.RestType */ || unwrappedType.kind === 193 /* SyntaxKind.ParenthesizedType */) { + if (unwrappedType.kind === 187 /* SyntaxKind.OptionalType */) { sawOptional = true; } - else if (unwrappedType.kind === 186 /* SyntaxKind.RestType */) { + else if (unwrappedType.kind === 188 /* SyntaxKind.RestType */) { sawRest = true; } unwrappedType = unwrappedType.type; @@ -156437,7 +157657,7 @@ var ts; if (isFunctionType) { var sig = checker.getSignatureFromDeclaration(declaration); if (sig) { - if (ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Async */)) { + if (ts.hasSyntacticModifier(declaration, 512 /* ModifierFlags.Async */)) { exprType = checker.createPromiseType(exprType); } var newSig = checker.createSignature(declaration, sig.typeParameters, sig.thisParameter, sig.parameters, exprType, @@ -156481,19 +157701,19 @@ var ts; } function getVariableLikeInitializer(declaration) { switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: return declaration.initializer; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return declaration.initializer && (ts.isJsxExpression(declaration.initializer) ? declaration.initializer.expression : undefined); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 166 /* SyntaxKind.PropertySignature */: - case 299 /* SyntaxKind.EnumMember */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 168 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return undefined; } } @@ -156547,6 +157767,15 @@ var ts; ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code, ts.Diagnostics.Cannot_find_name_0.code ]; + var InfoKind; + (function (InfoKind) { + InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration"; + InfoKind[InfoKind["Enum"] = 1] = "Enum"; + InfoKind[InfoKind["Function"] = 2] = "Function"; + InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral"; + InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes"; + InfoKind[InfoKind["Signature"] = 5] = "Signature"; + })(InfoKind || (InfoKind = {})); codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { @@ -156555,19 +157784,19 @@ var ts; if (!info) { return undefined; } - if (info.kind === 3 /* InfoKind.ObjectLiteral */) { + if (info.kind === InfoKind.ObjectLiteral) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addObjectLiteralProperties(t, context, info); }); return [codefix.createCodeFixAction(fixMissingProperties, changes, ts.Diagnostics.Add_missing_properties, fixMissingProperties, ts.Diagnostics.Add_all_missing_properties)]; } - if (info.kind === 4 /* InfoKind.JsxAttributes */) { + if (info.kind === InfoKind.JsxAttributes) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addJsxAttributes(t, context, info); }); return [codefix.createCodeFixAction(fixMissingAttributes, changes, ts.Diagnostics.Add_missing_attributes, fixMissingAttributes, ts.Diagnostics.Add_all_missing_attributes)]; } - if (info.kind === 2 /* InfoKind.Function */) { + if (info.kind === InfoKind.Function || info.kind === InfoKind.Signature) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addFunctionDeclaration(t, context, info); }); return [codefix.createCodeFixAction(fixMissingFunctionDeclaration, changes, [ts.Diagnostics.Add_missing_function_declaration_0, info.token.text], fixMissingFunctionDeclaration, ts.Diagnostics.Add_all_missing_function_declarations)]; } - if (info.kind === 1 /* InfoKind.Enum */) { + if (info.kind === InfoKind.Enum) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addEnumMemberDeclaration(t, context.program.getTypeChecker(), info); }); return [codefix.createCodeFixAction(fixMissingMember, changes, [ts.Diagnostics.Add_missing_enum_member_0, info.token.text], fixMissingMember, ts.Diagnostics.Add_all_missing_members)]; } @@ -156585,20 +157814,20 @@ var ts; if (!info || !ts.addToSeen(seen, ts.getNodeId(info.parentDeclaration) + "#" + info.token.text)) { return; } - if (fixId === fixMissingFunctionDeclaration && info.kind === 2 /* InfoKind.Function */) { + if (fixId === fixMissingFunctionDeclaration && (info.kind === InfoKind.Function || info.kind === InfoKind.Signature)) { addFunctionDeclaration(changes, context, info); } - else if (fixId === fixMissingProperties && info.kind === 3 /* InfoKind.ObjectLiteral */) { + else if (fixId === fixMissingProperties && info.kind === InfoKind.ObjectLiteral) { addObjectLiteralProperties(changes, context, info); } - else if (fixId === fixMissingAttributes && info.kind === 4 /* InfoKind.JsxAttributes */) { + else if (fixId === fixMissingAttributes && info.kind === InfoKind.JsxAttributes) { addJsxAttributes(changes, context, info); } else { - if (info.kind === 1 /* InfoKind.Enum */) { + if (info.kind === InfoKind.Enum) { addEnumMemberDeclaration(changes, checker, info); } - if (info.kind === 0 /* InfoKind.TypeLikeDeclaration */) { + if (info.kind === InfoKind.TypeLikeDeclaration) { var parentDeclaration = info.parentDeclaration, token_1 = info.token; var infos = ts.getOrUpdate(typeDeclToMembers, parentDeclaration, function () { return []; }); if (!infos.some(function (i) { return i.token.text === token_1.text; })) { @@ -156642,14 +157871,6 @@ var ts; })); }, }); - var InfoKind; - (function (InfoKind) { - InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration"; - InfoKind[InfoKind["Enum"] = 1] = "Enum"; - InfoKind[InfoKind["Function"] = 2] = "Function"; - InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral"; - InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes"; - })(InfoKind || (InfoKind = {})); function getInfo(sourceFile, tokenPos, errorCode, checker, program) { // The identifier of the missing property. eg: // this.missing = 1; @@ -156671,7 +157892,7 @@ var ts; var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent), checker.getParameterType(signature, argIndex), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false)); if (!ts.length(properties)) return undefined; - return { kind: 3 /* InfoKind.ObjectLiteral */, token: param.name, properties: properties, parentDeclaration: parent }; + return { kind: InfoKind.ObjectLiteral, token: param.name, properties: properties, parentDeclaration: parent }; } if (!ts.isMemberName(token)) return undefined; @@ -156679,17 +157900,26 @@ var ts; var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent.initializer), checker.getTypeAtLocation(token), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false)); if (!ts.length(properties)) return undefined; - return { kind: 3 /* InfoKind.ObjectLiteral */, token: token, properties: properties, parentDeclaration: parent.initializer }; + return { kind: InfoKind.ObjectLiteral, token: token, properties: properties, parentDeclaration: parent.initializer }; } if (ts.isIdentifier(token) && ts.isJsxOpeningLikeElement(token.parent)) { var target = ts.getEmitScriptTarget(program.getCompilerOptions()); var attributes = getUnmatchedAttributes(checker, target, token.parent); if (!ts.length(attributes)) return undefined; - return { kind: 4 /* InfoKind.JsxAttributes */, token: token, attributes: attributes, parentDeclaration: token.parent }; + return { kind: InfoKind.JsxAttributes, token: token, attributes: attributes, parentDeclaration: token.parent }; } - if (ts.isIdentifier(token) && ts.isCallExpression(parent) && parent.expression === token) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* ModifierFlags.None */, parentDeclaration: sourceFile }; + if (ts.isIdentifier(token)) { + var type = checker.getContextualType(token); + if (type && ts.getObjectFlags(type) & 16 /* ObjectFlags.Anonymous */) { + var signature = ts.firstOrUndefined(checker.getSignaturesOfType(type, 0 /* SignatureKind.Call */)); + if (signature === undefined) + return undefined; + return { kind: InfoKind.Signature, token: token, signature: signature, sourceFile: sourceFile, parentDeclaration: findScope(token) }; + } + if (ts.isCallExpression(parent) && parent.expression === token) { + return { kind: InfoKind.Function, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* ModifierFlags.None */, parentDeclaration: findScope(token) }; + } } if (!ts.isPropertyAccessExpression(parent)) return undefined; @@ -156701,13 +157931,13 @@ var ts; var moduleDeclaration = ts.find(symbol.declarations, ts.isModuleDeclaration); var moduleDeclarationSourceFile = moduleDeclaration === null || moduleDeclaration === void 0 ? void 0 : moduleDeclaration.getSourceFile(); if (moduleDeclaration && moduleDeclarationSourceFile && !isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent.parent, sourceFile: sourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleDeclaration }; + return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: sourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleDeclaration }; } var moduleSourceFile = ts.find(symbol.declarations, ts.isSourceFile); if (sourceFile.commonJsModuleIndicator) return undefined; if (moduleSourceFile && !isSourceFileFromLibrary(program, moduleSourceFile)) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleSourceFile }; + return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleSourceFile }; } } var classDeclaration = ts.find(symbol.declarations, ts.isClassLike); @@ -156725,11 +157955,11 @@ var ts; (makeStatic ? 32 /* ModifierFlags.Static */ : 0 /* ModifierFlags.None */) | (ts.startsWithUnderscore(token.text) ? 8 /* ModifierFlags.Private */ : 0 /* ModifierFlags.None */); var isJSFile = ts.isSourceFileJS(declSourceFile); var call = ts.tryCast(parent.parent, ts.isCallExpression); - return { kind: 0 /* InfoKind.TypeLikeDeclaration */, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile }; + 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())) { - return { kind: 1 /* InfoKind.Enum */, token: token, parentDeclaration: enumDeclaration }; + return { kind: InfoKind.Enum, token: token, parentDeclaration: enumDeclaration }; } return undefined; } @@ -156756,7 +157986,7 @@ var ts; function addMissingMemberInJs(changeTracker, sourceFile, classDeclaration, token, makeStatic) { var tokenName = token.text; if (makeStatic) { - if (classDeclaration.kind === 226 /* SyntaxKind.ClassExpression */) { + if (classDeclaration.kind === 228 /* SyntaxKind.ClassExpression */) { return; } var className = classDeclaration.name.getText(); @@ -156807,7 +158037,7 @@ var ts; } function getTypeNode(checker, node, token) { var typeNode; - if (token.parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (token.parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */) { var binaryExpression = token.parent.parent; var otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left; var widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression))); @@ -156817,7 +158047,7 @@ var ts; var contextualType = checker.getContextualType(token.parent); typeNode = contextualType ? checker.typeToTypeNode(contextualType, /*enclosingDeclaration*/ undefined, 1 /* NodeBuilderFlags.NoTruncation */) : undefined; } - return typeNode || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return typeNode || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } function addPropertyDeclaration(changeTracker, sourceFile, node, tokenName, typeNode, modifierFlags) { var modifiers = modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; @@ -156845,7 +158075,7 @@ var ts; } function createAddIndexSignatureAction(context, sourceFile, node, tokenName, typeNode) { // Index signatures cannot have the static modifier. - var stringTypeNode = ts.factory.createKeywordTypeNode(150 /* SyntaxKind.StringKeyword */); + var stringTypeNode = ts.factory.createKeywordTypeNode(152 /* SyntaxKind.StringKeyword */); var indexingParameter = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "x", @@ -156876,7 +158106,7 @@ var ts; } function addMethodDeclaration(context, changes, callExpression, name, modifierFlags, parentDeclaration, sourceFile) { var importAdder = codefix.createImportAdder(sourceFile, context.program, context.preferences, context.host); - var kind = ts.isClassLike(parentDeclaration) ? 169 /* SyntaxKind.MethodDeclaration */ : 168 /* SyntaxKind.MethodSignature */; + var kind = ts.isClassLike(parentDeclaration) ? 171 /* SyntaxKind.MethodDeclaration */ : 170 /* SyntaxKind.MethodSignature */; var signatureDeclaration = codefix.createSignatureDeclarationFromCallExpression(kind, context, importAdder, callExpression, name, modifierFlags, parentDeclaration); var containingMethodDeclaration = tryGetContainingMethodDeclaration(parentDeclaration, callExpression); if (containingMethodDeclaration) { @@ -156905,9 +158135,17 @@ var ts; }); } function addFunctionDeclaration(changes, context, info) { + var quotePreference = ts.getQuotePreference(context.sourceFile, context.preferences); var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host); - var functionDeclaration = codefix.createSignatureDeclarationFromCallExpression(256 /* SyntaxKind.FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration); - changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration); + var functionDeclaration = info.kind === InfoKind.Function + ? codefix.createSignatureDeclarationFromCallExpression(259 /* SyntaxKind.FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration) + : codefix.createSignatureDeclarationFromSignature(259 /* SyntaxKind.FunctionDeclaration */, context, quotePreference, info.signature, codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), info.token, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ undefined, importAdder); + if (functionDeclaration === undefined) { + ts.Debug.fail("fixMissingFunctionDeclaration codefix got unexpected error."); + } + ts.isReturnStatement(info.parentDeclaration) + ? changes.insertNodeBefore(info.sourceFile, info.parentDeclaration, functionDeclaration, /*blankLineBetween*/ true) + : changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration); importAdder.writeFixes(changes); } function addJsxAttributes(changes, context, info) { @@ -157003,7 +158241,7 @@ var ts; var signature = checker.getSignaturesOfType(type, 0 /* SignatureKind.Call */); if (signature === undefined) return createUndefined(); - var func = codefix.createSignatureDeclarationFromSignature(213 /* SyntaxKind.FunctionExpression */, context, quotePreference, signature[0], codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), /*name*/ undefined, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ enclosingDeclaration, importAdder); + var func = codefix.createSignatureDeclarationFromSignature(215 /* SyntaxKind.FunctionExpression */, context, quotePreference, signature[0], codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), /*name*/ undefined, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ enclosingDeclaration, importAdder); return func !== null && func !== void 0 ? func : createUndefined(); } if (ts.getObjectFlags(type) & 1 /* ObjectFlags.Class */) { @@ -157057,14 +158295,21 @@ var ts; return declaration && declaration.parent === node ? declaration : undefined; } function createPropertyNameFromSymbol(symbol, target, quotePreference, checker) { - if (ts.isTransientSymbol(symbol) && symbol.nameType && symbol.nameType.flags & 8192 /* TypeFlags.UniqueESSymbol */) { - var expression = checker.symbolToExpression(symbol.nameType.symbol, 111551 /* SymbolFlags.Value */, symbol.valueDeclaration, 1048576 /* NodeBuilderFlags.AllowUniqueESSymbolType */); - if (expression) { - return ts.factory.createComputedPropertyName(expression); - } + if (ts.isTransientSymbol(symbol)) { + var prop = checker.symbolToNode(symbol, 111551 /* SymbolFlags.Value */, /*enclosingDeclaration*/ undefined, 1073741824 /* NodeBuilderFlags.WriteComputedProps */); + if (prop && ts.isComputedPropertyName(prop)) + return prop; } return ts.createPropertyNameNodeForIdentifierOrLiteral(symbol.name, target, quotePreference === 0 /* QuotePreference.Single */); } + function findScope(node) { + if (ts.findAncestor(node, ts.isJsxExpression)) { + var returnStatement = ts.findAncestor(node.parent, ts.isReturnStatement); + if (returnStatement) + return returnStatement; + } + return ts.getSourceFileOfNode(node); + } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); /* @internal */ @@ -157215,7 +158460,7 @@ var ts; // See `codeFixClassExtendAbstractProtectedProperty.ts` in https://github.com/Microsoft/TypeScript/pull/11547/files // (now named `codeFixClassExtendAbstractPrivateProperty.ts`) var flags = ts.getSyntacticModifierFlags(ts.first(symbol.getDeclarations())); - return !(flags & 8 /* ModifierFlags.Private */) && !!(flags & 128 /* ModifierFlags.Abstract */); + return !(flags & 8 /* ModifierFlags.Private */) && !!(flags & 256 /* ModifierFlags.Abstract */); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -157378,6 +158623,63 @@ var ts; })(ts || (ts = {})); /* @internal */ var ts; +(function (ts) { + var codefix; + (function (codefix) { + var fixId = "fixNaNEquality"; + var errorCodes = [ + ts.Diagnostics.This_condition_will_always_return_0.code, + ]; + codefix.registerCodeFix({ + errorCodes: errorCodes, + getCodeActions: function (context) { + var sourceFile = context.sourceFile, span = context.span, program = context.program; + var info = getInfo(program, sourceFile, span); + if (info === undefined) + return; + var suggestion = info.suggestion, expression = info.expression, arg = info.arg; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, arg, expression); }); + return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Use_0, suggestion], fixId, ts.Diagnostics.Use_Number_isNaN_in_all_conditions)]; + }, + fixIds: [fixId], + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(context.program, diag.file, ts.createTextSpan(diag.start, diag.length)); + if (info) { + doChange(changes, diag.file, info.arg, info.expression); + } + }); + } + }); + function getInfo(program, sourceFile, span) { + var diag = ts.find(program.getSemanticDiagnostics(sourceFile), function (diag) { return diag.start === span.start && diag.length === span.length; }); + if (diag === undefined || diag.relatedInformation === undefined) + return; + var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.Did_you_mean_0.code; }); + if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined) + return; + var token = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); + if (token === undefined) + return; + if (ts.isExpression(token) && ts.isBinaryExpression(token.parent)) { + return { suggestion: getSuggestion(related.messageText), expression: token.parent, arg: token }; + } + return undefined; + } + function doChange(changes, sourceFile, arg, expression) { + var callExpression = ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("Number"), ts.factory.createIdentifier("isNaN")), /*typeArguments*/ undefined, [arg]); + var operator = expression.operatorToken.kind; + changes.replaceNode(sourceFile, expression, operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ + ? ts.factory.createPrefixUnaryExpression(53 /* SyntaxKind.ExclamationToken */, callExpression) : callExpression); + } + function getSuggestion(messageText) { + var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/\'(.*)\'/) || [], _ = _a[0], suggestion = _a[1]; + return suggestion; + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var codefix; (function (codefix) { @@ -157695,7 +158997,7 @@ var ts; var importDeclaration = getImportDeclaration(context.sourceFile, context.program, context.span.start); if (!importDeclaration) return; - var namespaceChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return importDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ && doNamespaceImportChange(t, context.sourceFile, importDeclaration, context.program); }); + var namespaceChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return importDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ && doNamespaceImportChange(t, context.sourceFile, importDeclaration, context.program); }); var typeOnlyChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return doTypeOnlyImportChange(t, context.sourceFile, importDeclaration, context.program); }); var actions; if (namespaceChanges.length) { @@ -157710,7 +159012,7 @@ var ts; }); function getImportDeclaration(sourceFile, program, start) { var identifier = ts.tryCast(ts.getTokenAtPosition(sourceFile, start), ts.isIdentifier); - if (!identifier || identifier.parent.kind !== 178 /* SyntaxKind.TypeReference */) + if (!identifier || identifier.parent.kind !== 180 /* SyntaxKind.TypeReference */) return; var checker = program.getTypeChecker(); var symbol = checker.getSymbolAtLocation(identifier); @@ -157722,11 +159024,11 @@ var ts; // new type-only import declaration, but honestly I doubt anyone will ever use this // codefix at all, so it's probably not worth the lines of code. function doTypeOnlyImportChange(changes, sourceFile, importDeclaration, program) { - if (importDeclaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, importDeclaration.name); + if (importDeclaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, importDeclaration.name); return; } - var importClause = importDeclaration.kind === 267 /* SyntaxKind.ImportClause */ ? importDeclaration : importDeclaration.parent.parent; + var importClause = importDeclaration.kind === 270 /* SyntaxKind.ImportClause */ ? importDeclaration : importDeclaration.parent.parent; if (importClause.name && importClause.namedBindings) { // Cannot convert an import with a default import and named bindings to type-only // (it's a grammar error). @@ -157743,7 +159045,7 @@ var ts; // Don't convert it to type-only. return; } - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, importClause); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, importClause); } function doNamespaceImportChange(changes, sourceFile, importDeclaration, program) { ts.refactor.doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, importDeclaration.parent); @@ -157821,7 +159123,7 @@ var ts; ]; } var result = []; - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return changeInferToUnknown(t, sourceFile, token); }); var name = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name.text; result.push(codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Replace_infer_0_with_unknown, name], fixIdInfer, ts.Diagnostics.Replace_all_unused_infer_with_unknown)); @@ -157863,7 +159165,7 @@ var ts; break; } case fixIdDelete: { - if (token.kind === 137 /* SyntaxKind.InferKeyword */ || isImport(token)) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */ || isImport(token)) { break; // Can't delete } else if (ts.isJSDocTemplateTag(token)) { @@ -157892,7 +159194,7 @@ var ts; break; } case fixIdInfer: - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { changeInferToUnknown(changes, sourceFile, token); } break; @@ -157903,7 +159205,7 @@ var ts; }, }); function changeInferToUnknown(changes, sourceFile, token) { - changes.replaceNode(sourceFile, token.parent, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)); + changes.replaceNode(sourceFile, token.parent, ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)); } function createDeleteFix(changes, diag) { return codefix.createCodeFixAction(fixName, changes, diag, fixIdDelete, ts.Diagnostics.Delete_all_unused_declarations); @@ -157913,7 +159215,7 @@ var ts; } function isImport(token) { return token.kind === 100 /* SyntaxKind.ImportKeyword */ - || token.kind === 79 /* SyntaxKind.Identifier */ && (token.parent.kind === 270 /* SyntaxKind.ImportSpecifier */ || token.parent.kind === 267 /* SyntaxKind.ImportClause */); + || token.kind === 79 /* SyntaxKind.Identifier */ && (token.parent.kind === 273 /* SyntaxKind.ImportSpecifier */ || token.parent.kind === 270 /* SyntaxKind.ImportClause */); } /** Sometimes the diagnostic span is an entire ImportDeclaration, so we should remove the whole thing. */ function tryGetFullImport(token) { @@ -157923,7 +159225,7 @@ var ts; return ts.isVariableDeclarationList(token.parent) && ts.first(token.parent.getChildren(sourceFile)) === token; } function deleteEntireVariableStatement(changes, sourceFile, node) { - changes.delete(sourceFile, node.parent.kind === 237 /* SyntaxKind.VariableStatement */ ? node.parent : node); + changes.delete(sourceFile, node.parent.kind === 240 /* SyntaxKind.VariableStatement */ ? node.parent : node); } function deleteDestructuringElements(changes, sourceFile, node) { ts.forEach(node.elements, function (n) { return changes.delete(sourceFile, n); }); @@ -157932,7 +159234,7 @@ var ts; // Don't offer to prefix a property. if (errorCode === ts.Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code) return; - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { token = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name; } if (ts.isIdentifier(token) && canPrefix(token)) { @@ -157948,14 +159250,14 @@ var ts; } function canPrefix(token) { switch (token.parent.kind) { - case 164 /* SyntaxKind.Parameter */: - case 163 /* SyntaxKind.TypeParameter */: + case 166 /* SyntaxKind.Parameter */: + case 165 /* SyntaxKind.TypeParameter */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var varDecl = token.parent; switch (varDecl.parent.parent.kind) { - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return true; } } @@ -158010,8 +159312,8 @@ var ts; function mayDeleteParameter(checker, sourceFile, parameter, sourceFiles, program, cancellationToken, isFixAll) { var parent = parameter.parent; switch (parent.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: var index = parent.parameters.indexOf(parameter); var referent = ts.isMethodDeclaration(parent) ? parent.name : parent; var entries = ts.FindAllReferences.Core.getReferencedSymbolsForNode(parent.pos, referent, program, sourceFiles, cancellationToken); @@ -158041,20 +159343,20 @@ var ts; } } return true; - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { if (parent.name && isCallbackLike(checker, sourceFile, parent.name)) { return isLastParameter(parent, parameter, isFixAll); } return true; } - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: // Can't remove a non-last parameter in a callback. Can remove a parameter in code-fix-all if future parameters are also unused. return isLastParameter(parent, parameter, isFixAll); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Setter must have a parameter return false; - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Getter cannot have parameters return true; default: @@ -158115,7 +159417,7 @@ var ts; var container = (ts.isBlock(statement.parent) ? statement.parent : statement).parent; if (!ts.isBlock(statement.parent) || statement === ts.first(statement.parent.statements)) { switch (container.kind) { - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: if (container.elseStatement) { if (ts.isBlock(statement.parent)) { break; @@ -158126,8 +159428,8 @@ var ts; return; } // falls through - case 241 /* SyntaxKind.WhileStatement */: - case 242 /* SyntaxKind.ForStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: changes.delete(sourceFile, container); return; } @@ -158200,7 +159502,7 @@ var ts; var typeNode = info.typeNode, type = info.type; var original = typeNode.getText(sourceFile); var actions = [fix(type, fixIdPlain, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript)]; - if (typeNode.kind === 314 /* SyntaxKind.JSDocNullableType */) { + if (typeNode.kind === 317 /* SyntaxKind.JSDocNullableType */) { // for nullable types, suggest the flow-compatible `T | null | undefined` // in addition to the jsdoc/closure-compatible `T | null` actions.push(fix(checker.getNullableType(type, 32768 /* TypeFlags.Undefined */), fixIdNullable, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types)); @@ -158220,7 +159522,7 @@ var ts; if (!info) return; var typeNode = info.typeNode, type = info.type; - var fixedType = typeNode.kind === 314 /* SyntaxKind.JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* TypeFlags.Undefined */) : type; + var fixedType = typeNode.kind === 317 /* SyntaxKind.JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* TypeFlags.Undefined */) : type; doChange(changes, sourceFile, typeNode, fixedType, checker); }); } @@ -158237,22 +159539,22 @@ var ts; // NOTE: Some locations are not handled yet: // MappedTypeNode.typeParameters and SignatureDeclaration.typeParameters, as well as CallExpression.typeArguments switch (node.kind) { - case 229 /* SyntaxKind.AsExpression */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 176 /* SyntaxKind.IndexSignature */: - case 195 /* SyntaxKind.MappedType */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 173 /* SyntaxKind.SetAccessor */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 231 /* SyntaxKind.AsExpression */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 178 /* SyntaxKind.IndexSignature */: + case 197 /* SyntaxKind.MappedType */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 175 /* SyntaxKind.SetAccessor */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; default: return false; @@ -158355,14 +159657,14 @@ var ts; } var insertBefore; switch (containingFunction.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: insertBefore = containingFunction.name; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: insertBefore = ts.findChildOfKind(containingFunction, 98 /* SyntaxKind.FunctionKeyword */, sourceFile); break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: var kind = containingFunction.typeParameters ? 29 /* SyntaxKind.LessThanToken */ : 20 /* SyntaxKind.OpenParenToken */; insertBefore = ts.findChildOfKind(containingFunction, kind, sourceFile) || ts.first(containingFunction.parameters); break; @@ -158382,7 +159684,7 @@ var ts; changes.replaceNode(sourceFile, returnType, ts.factory.createTypeReferenceNode("Promise", ts.factory.createNodeArray([returnType]))); } } - changes.insertModifierBefore(sourceFile, 131 /* SyntaxKind.AsyncKeyword */, insertBefore); + changes.insertModifierBefore(sourceFile, 132 /* SyntaxKind.AsyncKeyword */, insertBefore); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -158698,7 +160000,7 @@ var ts; function annotate(changes, importAdder, sourceFile, declaration, type, program, host) { var typeNode = ts.getTypeNodeIfAccessible(type, declaration, program, host); if (typeNode) { - if (ts.isInJSFile(sourceFile) && declaration.kind !== 166 /* SyntaxKind.PropertySignature */) { + if (ts.isInJSFile(sourceFile) && declaration.kind !== 168 /* SyntaxKind.PropertySignature */) { var parent = ts.isVariableDeclaration(declaration) ? ts.tryCast(declaration.parent.parent, ts.isVariableStatement) : declaration; if (!parent) { return; @@ -158785,19 +160087,19 @@ var ts; function getFunctionReferences(containingFunction, sourceFile, program, cancellationToken) { var searchToken; switch (containingFunction.kind) { - case 171 /* SyntaxKind.Constructor */: - searchToken = ts.findChildOfKind(containingFunction, 134 /* SyntaxKind.ConstructorKeyword */, sourceFile); + case 173 /* SyntaxKind.Constructor */: + searchToken = ts.findChildOfKind(containingFunction, 135 /* SyntaxKind.ConstructorKeyword */, sourceFile); break; - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: var parent = containingFunction.parent; searchToken = (ts.isVariableDeclaration(parent) || ts.isPropertyDeclaration(parent)) && ts.isIdentifier(parent.name) ? parent.name : containingFunction.name; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: searchToken = containingFunction.name; break; } @@ -158939,24 +160241,24 @@ var ts; node = node.parent; } switch (node.parent.kind) { - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: inferTypeFromExpressionStatement(node, usage); break; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: usage.isNumber = true; break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: inferTypeFromPrefixUnaryExpression(node.parent, usage); break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: inferTypeFromBinaryExpression(node, node.parent, usage); break; - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: inferTypeFromSwitchStatementLabel(node.parent, usage); break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: if (node.parent.expression === node) { inferTypeFromCallExpression(node.parent, usage); } @@ -158964,20 +160266,20 @@ var ts; inferTypeFromContextualType(node, usage); } break; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: inferTypeFromPropertyAccessExpression(node.parent, usage); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: inferTypeFromPropertyElementExpression(node.parent, node, usage); break; - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: inferTypeFromPropertyAssignment(node.parent, usage); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: inferTypeFromPropertyDeclaration(node.parent, usage); break; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var _a = node.parent, name = _a.name, initializer = _a.initializer; if (node === name) { if (initializer) { // This can happen for `let x = null;` which still has an implicit-any error. @@ -159099,7 +160401,7 @@ var ts; case 56 /* SyntaxKind.BarBarToken */: case 60 /* SyntaxKind.QuestionQuestionToken */: if (node === parent.left && - (node.parent.parent.kind === 254 /* SyntaxKind.VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) { + (node.parent.parent.kind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) { // var x = x || {}; // TODO: use getFalsyflagsOfType addCandidateType(usage, checker.getTypeAtLocation(parent.right)); @@ -159127,7 +160429,7 @@ var ts; } } calculateUsageOfNode(parent, call.return_); - if (parent.kind === 208 /* SyntaxKind.CallExpression */) { + if (parent.kind === 210 /* SyntaxKind.CallExpression */) { (usage.calls || (usage.calls = [])).push(call); } else { @@ -159581,25 +160883,44 @@ var ts; * @param body If defined, this will be the body of the member node passed to `addClassElement`. Otherwise, the body will default to a stub. */ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional, isAmbient) { + var _a; if (preserveOptional === void 0) { preserveOptional = 3 /* PreserveOptionalFlags.All */; } if (isAmbient === void 0) { isAmbient = false; } var declarations = symbol.getDeclarations(); - if (!(declarations && declarations.length)) { - return undefined; - } + var declaration = declarations === null || declarations === void 0 ? void 0 : declarations[0]; var checker = context.program.getTypeChecker(); var scriptTarget = ts.getEmitScriptTarget(context.program.getCompilerOptions()); - var declaration = declarations[0]; - var name = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false); - var visibilityModifier = createVisibilityModifier(ts.getEffectiveModifierFlags(declaration)); - var modifiers = visibilityModifier ? ts.factory.createNodeArray([visibilityModifier]) : undefined; + /** + * (#49811) + * Note that there are cases in which the symbol declaration is not present. For example, in the code below both + * `MappedIndirect.ax` and `MappedIndirect.ay` have no declaration node attached (due to their mapped-type + * parent): + * + * ```ts + * type Base = { ax: number; ay: string }; + * type BaseKeys = keyof Base; + * type MappedIndirect = { [K in BaseKeys]: boolean }; + * ``` + * + * In such cases, we assume the declaration to be a `PropertySignature`. + */ + var kind = (_a = declaration === null || declaration === void 0 ? void 0 : declaration.kind) !== null && _a !== void 0 ? _a : 168 /* SyntaxKind.PropertySignature */; + var declarationName = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false); + var effectiveModifierFlags = declaration ? ts.getEffectiveModifierFlags(declaration) : 0 /* ModifierFlags.None */; + var modifierFlags = effectiveModifierFlags & 4 /* ModifierFlags.Public */ ? 4 /* ModifierFlags.Public */ : + effectiveModifierFlags & 16 /* ModifierFlags.Protected */ ? 16 /* ModifierFlags.Protected */ : + 0 /* ModifierFlags.None */; + if (declaration && ts.isAutoAccessorPropertyDeclaration(declaration)) { + modifierFlags |= 128 /* ModifierFlags.Accessor */; + } + var modifiers = modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration)); var optional = !!(symbol.flags & 16777216 /* SymbolFlags.Optional */); var ambient = !!(enclosingDeclaration.flags & 16777216 /* NodeFlags.Ambient */) || isAmbient; var quotePreference = ts.getQuotePreference(sourceFile, preferences); - switch (declaration.kind) { - case 166 /* SyntaxKind.PropertySignature */: - case 167 /* SyntaxKind.PropertyDeclaration */: + switch (kind) { + case 168 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: var flags = quotePreference === 0 /* QuotePreference.Single */ ? 268435456 /* NodeBuilderFlags.UseSingleQuotesForStringLiteralType */ : undefined; var typeNode = checker.typeToTypeNode(type, enclosingDeclaration, flags, getNoopSymbolTrackerWithResolver(context)); if (importAdder) { @@ -159609,11 +160930,12 @@ var ts; importSymbols(importAdder, importableReference.symbols); } } - addClassElement(ts.factory.createPropertyDeclaration(modifiers, name, optional && (preserveOptional & 2 /* PreserveOptionalFlags.Property */) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, typeNode, + addClassElement(ts.factory.createPropertyDeclaration(modifiers, declaration ? createName(declarationName) : symbol.getName(), optional && (preserveOptional & 2 /* PreserveOptionalFlags.Property */) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, typeNode, /*initializer*/ undefined)); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: { + ts.Debug.assertIsDefined(declarations); var typeNode_1 = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context)); var allAccessors = ts.getAllAccessorDeclarations(declarations, declaration); var orderedAccessors = allAccessors.secondAccessor @@ -159629,19 +160951,19 @@ var ts; for (var _i = 0, orderedAccessors_1 = orderedAccessors; _i < orderedAccessors_1.length; _i++) { var accessor = orderedAccessors_1[_i]; if (ts.isGetAccessorDeclaration(accessor)) { - addClassElement(ts.factory.createGetAccessorDeclaration(modifiers, name, ts.emptyArray, typeNode_1, ambient ? undefined : body || createStubbedMethodBody(quotePreference))); + addClassElement(ts.factory.createGetAccessorDeclaration(modifiers, createName(declarationName), ts.emptyArray, createTypeNode(typeNode_1), createBody(body, quotePreference, ambient))); } else { ts.Debug.assertNode(accessor, ts.isSetAccessorDeclaration, "The counterpart to a getter should be a setter"); var parameter = ts.getSetAccessorValueParameter(accessor); var parameterName = parameter && ts.isIdentifier(parameter.name) ? ts.idText(parameter.name) : undefined; - addClassElement(ts.factory.createSetAccessorDeclaration(modifiers, name, createDummyParameters(1, [parameterName], [typeNode_1], 1, /*inJs*/ false), ambient ? undefined : body || createStubbedMethodBody(quotePreference))); + addClassElement(ts.factory.createSetAccessorDeclaration(modifiers, createName(declarationName), createDummyParameters(1, [parameterName], [createTypeNode(typeNode_1)], 1, /*inJs*/ false), createBody(body, quotePreference, ambient))); } } break; } - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: // The signature for the implementation appears as an entry in `signatures` iff // there is only one signature. // If there are overloads and an implementation signature, it appears as an @@ -159649,6 +160971,7 @@ var ts; // If there is more than one overload but no implementation signature // (eg: an abstract method or interface declaration), there is a 1-1 // correspondence of declarations and signatures. + ts.Debug.assertIsDefined(declarations); var signatures = type.isUnion() ? ts.flatMap(type.types, function (t) { return t.getCallSignatures(); }) : type.getCallSignatures(); if (!ts.some(signatures)) { break; @@ -159656,31 +160979,41 @@ var ts; if (declarations.length === 1) { ts.Debug.assert(signatures.length === 1, "One declaration implies one signature"); var signature = signatures[0]; - outputMethod(quotePreference, signature, modifiers, name, ambient ? undefined : body || createStubbedMethodBody(quotePreference)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName), createBody(body, quotePreference, ambient)); break; } - for (var _a = 0, signatures_1 = signatures; _a < signatures_1.length; _a++) { - var signature = signatures_1[_a]; + for (var _b = 0, signatures_1 = signatures; _b < signatures_1.length; _b++) { + var signature = signatures_1[_b]; // Ensure nodes are fresh so they can have different positions when going through formatting. - outputMethod(quotePreference, signature, ts.getSynthesizedDeepClones(modifiers, /*includeTrivia*/ false), ts.getSynthesizedDeepClone(name, /*includeTrivia*/ false)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName)); } if (!ambient) { if (declarations.length > signatures.length) { var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]); - outputMethod(quotePreference, signature, modifiers, name, body || createStubbedMethodBody(quotePreference)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName), createBody(body, quotePreference)); } else { ts.Debug.assert(declarations.length === signatures.length, "Declarations and signatures should match count"); - addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), modifiers, quotePreference, body)); + addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, createName(declarationName), optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), modifiers, quotePreference, body)); } } break; } function outputMethod(quotePreference, signature, modifiers, name, body) { - var method = createSignatureDeclarationFromSignature(169 /* SyntaxKind.MethodDeclaration */, context, quotePreference, signature, body, name, modifiers, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), enclosingDeclaration, importAdder); + var method = createSignatureDeclarationFromSignature(171 /* SyntaxKind.MethodDeclaration */, context, quotePreference, signature, body, name, modifiers, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), enclosingDeclaration, importAdder); if (method) addClassElement(method); } + function createName(node) { + return ts.getSynthesizedDeepClone(node, /*includeTrivia*/ false); + } + function createBody(block, quotePreference, ambient) { + return ambient ? undefined : + ts.getSynthesizedDeepClone(block, /*includeTrivia*/ false) || createStubbedMethodBody(quotePreference); + } + function createTypeNode(typeNode) { + return ts.getSynthesizedDeepClone(typeNode, /*includeTrivia*/ false); + } } codefix.addNewNodeForMemberSymbol = addNewNodeForMemberSymbol; function createSignatureDeclarationFromSignature(kind, context, quotePreference, signature, body, name, modifiers, optional, enclosingDeclaration, importAdder) { @@ -159754,6 +161087,9 @@ var ts; if (ts.isMethodDeclaration(signatureDeclaration)) { return ts.factory.updateMethodDeclaration(signatureDeclaration, modifiers, asteriskToken, name !== null && name !== void 0 ? name : ts.factory.createIdentifier(""), questionToken, typeParameters, parameters, type, body); } + if (ts.isFunctionDeclaration(signatureDeclaration)) { + return ts.factory.updateFunctionDeclaration(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, ts.tryCast(name, ts.isIdentifier), typeParameters, parameters, type, body !== null && body !== void 0 ? body : signatureDeclaration.body); + } return undefined; } codefix.createSignatureDeclarationFromSignature = createSignatureDeclarationFromSignature; @@ -159782,13 +161118,13 @@ var ts; ? undefined : checker.typeToTypeNode(contextualType, contextNode, /*flags*/ undefined, tracker); switch (kind) { - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return ts.factory.createMethodDeclaration(modifiers, asteriskToken, name, /*questionToken*/ undefined, typeParameters, parameters, type, createStubbedMethodBody(quotePreference)); - case 168 /* SyntaxKind.MethodSignature */: + case 170 /* SyntaxKind.MethodSignature */: return ts.factory.createMethodSignature(modifiers, name, - /*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */) : type); - case 256 /* SyntaxKind.FunctionDeclaration */: + /*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */) : type); + case 259 /* SyntaxKind.FunctionDeclaration */: return ts.factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference)); default: ts.Debug.fail("Unexpected kind"); @@ -159925,7 +161261,7 @@ var ts; /*dotDotDotToken*/ undefined, /*name*/ parameterName + (parameterNameCount || ""), /*questionToken*/ minArgumentCount !== undefined && i >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, - /*type*/ inJs ? undefined : (types === null || types === void 0 ? void 0 : types[i]) || ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */), + /*type*/ inJs ? undefined : (types === null || types === void 0 ? void 0 : types[i]) || ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */), /*initializer*/ undefined); parameters.push(newParameter); } @@ -159955,7 +161291,7 @@ var ts; if (someSigHasRestParameter) { var restParameter = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */), maxArgsParameterSymbolNames[maxNonRestArgs] || "rest", - /*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)), + /*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)), /*initializer*/ undefined); parameters.push(restParameter); } @@ -159983,15 +161319,6 @@ var ts; /*multiline*/ true); } codefix.createStubbedBody = createStubbedBody; - function createVisibilityModifier(flags) { - if (flags & 4 /* ModifierFlags.Public */) { - return ts.factory.createToken(123 /* SyntaxKind.PublicKeyword */); - } - else if (flags & 16 /* ModifierFlags.Protected */) { - return ts.factory.createToken(122 /* SyntaxKind.ProtectedKeyword */); - } - return undefined; - } function setJsonCompilerOptionValues(changeTracker, configFile, options) { var tsconfigObjectLiteral = ts.getTsConfigObjectLiteralExpression(configFile); if (!tsconfigObjectLiteral) @@ -160070,6 +161397,15 @@ var ts; symbols.forEach(function (s) { return importAdder.addImportFromExportedSymbol(s, /*isValidTypeOnlyUseSite*/ true); }); } codefix.importSymbols = importSymbols; + function findAncestorMatchingSpan(sourceFile, span) { + var end = ts.textSpanEnd(span); + var token = ts.getTokenAtPosition(sourceFile, span.start); + while (token.end < end) { + token = token.parent; + } + return token; + } + codefix.findAncestorMatchingSpan = findAncestorMatchingSpan; })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); /* @internal */ @@ -160092,13 +161428,13 @@ var ts; if (ts.isClassLike(container)) { var modifierFlags = ts.getEffectiveModifierFlags(declaration); if (ts.isSourceFileJS(file)) { - var modifiers = ts.createModifiers(modifierFlags); + var modifiers = ts.factory.createModifiersFromModifierFlags(modifierFlags); accessorModifiers = modifiers; fieldModifiers = modifiers; } else { - accessorModifiers = ts.createModifiers(prepareModifierFlagsForAccessor(modifierFlags)); - fieldModifiers = ts.createModifiers(prepareModifierFlagsForField(modifierFlags)); + accessorModifiers = ts.factory.createModifiersFromModifierFlags(prepareModifierFlagsForAccessor(modifierFlags)); + fieldModifiers = ts.factory.createModifiersFromModifierFlags(prepareModifierFlagsForField(modifierFlags)); } if (ts.canHaveDecorators(declaration)) { fieldModifiers = ts.concatenate(ts.getDecorators(declaration), fieldModifiers); @@ -160167,7 +161503,7 @@ var ts; error: ts.getLocaleSpecificMessage(ts.Diagnostics.Name_is_not_valid) }; } - if (((ts.getEffectiveModifierFlags(declaration) & 125951 /* ModifierFlags.Modifier */) | meaning) !== meaning) { + if (((ts.getEffectiveModifierFlags(declaration) & 126975 /* ModifierFlags.Modifier */) | meaning) !== meaning) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_property_with_modifier) }; @@ -160180,7 +161516,7 @@ var ts; isStatic: ts.hasStaticModifier(declaration), isReadonly: ts.hasEffectiveReadonlyModifier(declaration), type: getDeclarationType(declaration, program), - container: declaration.kind === 164 /* SyntaxKind.Parameter */ ? declaration.parent.parent : declaration.parent, + container: declaration.kind === 166 /* SyntaxKind.Parameter */ ? declaration.parent.parent : declaration.parent, originalName: declaration.name.text, declaration: declaration, fieldName: fieldName, @@ -160254,7 +161590,7 @@ var ts; var type = typeChecker.getTypeFromTypeNode(typeNode); if (!typeChecker.isTypeAssignableTo(typeChecker.getUndefinedType(), type)) { var types = ts.isUnionTypeNode(typeNode) ? typeNode.types : [typeNode]; - return ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], types, true), [ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)], false)); + return ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], types, true), [ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)], false)); } } return typeNode; @@ -160312,7 +161648,7 @@ var ts; }); function getActionsForUsageOfInvalidImport(context) { var sourceFile = context.sourceFile; - var targetKind = ts.Diagnostics.This_expression_is_not_callable.code === context.errorCode ? 208 /* SyntaxKind.CallExpression */ : 209 /* SyntaxKind.NewExpression */; + var targetKind = ts.Diagnostics.This_expression_is_not_callable.code === context.errorCode ? 210 /* SyntaxKind.CallExpression */ : 211 /* SyntaxKind.NewExpression */; var node = ts.findAncestor(ts.getTokenAtPosition(sourceFile, context.span.start), function (a) { return a.kind === targetKind; }); if (!node) { return []; @@ -160438,7 +161774,7 @@ var ts; return codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Add_undefined_type_to_property_0, info.prop.name.getText()], fixIdAddUndefinedType, ts.Diagnostics.Add_undefined_type_to_all_uninitialized_properties); } function addUndefinedType(changeTracker, sourceFile, info) { - var undefinedTypeNode = ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */); + var undefinedTypeNode = ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */); var types = ts.isUnionTypeNode(info.type) ? info.type.types.concat(undefinedTypeNode) : [info.type, undefinedTypeNode]; var unionTypeNode = ts.factory.createUnionTypeNode(types); if (info.isJs) { @@ -160484,7 +161820,7 @@ var ts; } else if (type.isClass()) { var classDeclaration = ts.getClassLikeDeclarationOfSymbol(type.symbol); - if (!classDeclaration || ts.hasSyntacticModifier(classDeclaration, 128 /* ModifierFlags.Abstract */)) + if (!classDeclaration || ts.hasSyntacticModifier(classDeclaration, 256 /* ModifierFlags.Abstract */)) return undefined; var constructorDeclaration = ts.getFirstConstructorWithBody(classDeclaration); if (constructorDeclaration && constructorDeclaration.parameters.length) @@ -160661,7 +161997,7 @@ var ts; function getImportTypeNode(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); ts.Debug.assert(token.kind === 100 /* SyntaxKind.ImportKeyword */, "This token should be an ImportKeyword"); - ts.Debug.assert(token.parent.kind === 200 /* SyntaxKind.ImportType */, "Token parent should be an ImportType"); + ts.Debug.assert(token.parent.kind === 202 /* SyntaxKind.ImportType */, "Token parent should be an ImportType"); return token.parent; } function doChange(changes, sourceFile, importType) { @@ -160790,7 +162126,7 @@ var ts; var otherMembers = members.filter(function (member) { return !ts.isIndexSignatureDeclaration(member); }); var parameter = ts.first(indexSignature.parameters); var mappedTypeParameter = ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.cast(parameter.name, ts.isIdentifier), parameter.type); - var mappedIntersectionType = ts.factory.createMappedTypeNode(ts.hasEffectiveReadonlyModifier(indexSignature) ? ts.factory.createModifier(145 /* SyntaxKind.ReadonlyKeyword */) : undefined, mappedTypeParameter, + var mappedIntersectionType = ts.factory.createMappedTypeNode(ts.hasEffectiveReadonlyModifier(indexSignature) ? ts.factory.createModifier(146 /* SyntaxKind.ReadonlyKeyword */) : undefined, mappedTypeParameter, /*nameType*/ undefined, indexSignature.questionToken, indexSignature.type, /*members*/ undefined); var intersectionType = ts.factory.createIntersectionTypeNode(__spreadArray(__spreadArray(__spreadArray([], ts.getAllSuperTypeNodes(container), true), [ @@ -160848,7 +162184,7 @@ var ts; }, }); function makeChange(changeTracker, sourceFile, span) { - var awaitKeyword = ts.tryCast(ts.getTokenAtPosition(sourceFile, span.start), function (node) { return node.kind === 132 /* SyntaxKind.AwaitKeyword */; }); + var awaitKeyword = ts.tryCast(ts.getTokenAtPosition(sourceFile, span.start), function (node) { return node.kind === 133 /* SyntaxKind.AwaitKeyword */; }); var awaitExpression = awaitKeyword && ts.tryCast(awaitKeyword.parent, ts.isAwaitExpression); if (!awaitExpression) { return; @@ -160915,28 +162251,45 @@ var ts; errorCodes: errorCodes, getCodeActions: function getCodeActionsToConvertConstToLet(context) { var sourceFile = context.sourceFile, span = context.span, program = context.program; - var range = getConstTokenRange(sourceFile, span.start, program); - if (range === undefined) + var info = getInfo(sourceFile, span.start, program); + if (info === undefined) return; - var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, range); }); - return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Convert_const_to_let, fixId, ts.Diagnostics.Convert_const_to_let)]; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, info.token); }); + return [codefix.createCodeFixActionMaybeFixAll(fixId, changes, ts.Diagnostics.Convert_const_to_let, fixId, ts.Diagnostics.Convert_all_const_to_let)]; + }, + getAllCodeActions: function (context) { + var program = context.program; + var seen = new ts.Map(); + return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, function (changes) { + codefix.eachDiagnostic(context, errorCodes, function (diag) { + var info = getInfo(diag.file, diag.start, program); + if (info) { + if (ts.addToSeen(seen, ts.getSymbolId(info.symbol))) { + return doChange(changes, diag.file, info.token); + } + } + return undefined; + }); + })); }, fixIds: [fixId] }); - function getConstTokenRange(sourceFile, pos, program) { + function getInfo(sourceFile, pos, program) { var _a; var checker = program.getTypeChecker(); var symbol = checker.getSymbolAtLocation(ts.getTokenAtPosition(sourceFile, pos)); + if (symbol === undefined) + return; var declaration = ts.tryCast((_a = symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.parent, ts.isVariableDeclarationList); if (declaration === undefined) return; var constToken = ts.findChildOfKind(declaration, 85 /* SyntaxKind.ConstKeyword */, sourceFile); if (constToken === undefined) return; - return ts.createRange(constToken.pos, constToken.end); + return { symbol: symbol, token: constToken }; } - function doChange(changes, sourceFile, range) { - changes.replaceRangeWithText(sourceFile, range, "let"); + function doChange(changes, sourceFile, token) { + changes.replaceNode(sourceFile, token, ts.factory.createToken(119 /* SyntaxKind.LetKeyword */)); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -161111,7 +162464,6 @@ var ts; return { edits: edits, renameFilename: undefined, renameLocation: undefined }; }, }); - ; function getInfo(context, considerPartialSpans) { if (considerPartialSpans === void 0) { considerPartialSpans = true; } var file = context.file, program = context.program; @@ -161123,8 +162475,8 @@ var ts; } var checker = program.getTypeChecker(); var exportingModuleSymbol = getExportingModuleSymbol(exportNode, checker); - var flags = ts.getSyntacticModifierFlags(exportNode) || ((ts.isExportAssignment(exportNode) && !exportNode.isExportEquals) ? 513 /* ModifierFlags.ExportDefault */ : 0 /* ModifierFlags.None */); - var wasDefault = !!(flags & 512 /* ModifierFlags.Default */); + var flags = ts.getSyntacticModifierFlags(exportNode) || ((ts.isExportAssignment(exportNode) && !exportNode.isExportEquals) ? 1025 /* ModifierFlags.ExportDefault */ : 0 /* ModifierFlags.None */); + var wasDefault = !!(flags & 1024 /* ModifierFlags.Default */); // If source file already has a default export, don't offer refactor. if (!(flags & 1 /* ModifierFlags.Export */) || !wasDefault && exportingModuleSymbol.exports.has("default" /* InternalSymbolName.Default */)) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.This_file_already_has_a_default_export) }; @@ -161134,19 +162486,19 @@ var ts; : { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_named_export) }; }; switch (exportNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: { var node = exportNode; if (!node.name) return undefined; return noSymbolError(node.name) || { exportNode: node, exportName: node.name, wasDefault: wasDefault, exportingModuleSymbol: exportingModuleSymbol }; } - case 237 /* SyntaxKind.VariableStatement */: { + case 240 /* SyntaxKind.VariableStatement */: { var vs = exportNode; // Must be `export const x = something;`. if (!(vs.declarationList.flags & 2 /* NodeFlags.Const */) || vs.declarationList.declarations.length !== 1) { @@ -161159,7 +162511,7 @@ var ts; return noSymbolError(decl.name) || { exportNode: vs, exportName: decl.name, wasDefault: wasDefault, exportingModuleSymbol: exportingModuleSymbol }; } - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var node = exportNode; if (node.isExportEquals) return undefined; @@ -161189,12 +162541,12 @@ var ts; else { var exportKeyword = ts.Debug.checkDefined(ts.findModifier(exportNode, 93 /* SyntaxKind.ExportKeyword */), "Should find an export keyword in modifier list"); switch (exportNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: changes.insertNodeAfter(exportingSourceFile, exportKeyword, ts.factory.createToken(88 /* SyntaxKind.DefaultKeyword */)); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // If 'x' isn't used in this file and doesn't have type definition, `export const x = 0;` --> `export default 0;` var decl = ts.first(exportNode.declarationList.declarations); if (!ts.FindAllReferences.Core.isSymbolReferencedInFile(exportName, checker, exportingSourceFile) && !decl.type) { @@ -161203,9 +162555,9 @@ var ts; break; } // falls through - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // `export type T = number;` -> `type T = number; export default T;` changes.deleteModifier(exportingSourceFile, exportKeyword); changes.insertNodeAfter(exportingSourceFile, exportNode, ts.factory.createExportDefault(ts.factory.createIdentifier(exportName.text))); @@ -161234,18 +162586,18 @@ var ts; function changeDefaultToNamedImport(importingSourceFile, ref, changes, exportName) { var parent = ref.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // `a.default` --> `a.foo` changes.replaceNode(importingSourceFile, ref, ts.factory.createIdentifier(exportName)); break; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: { + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: { var spec = parent; // `default as foo` --> `foo`, `default as bar` --> `foo as bar` changes.replaceNode(importingSourceFile, spec, makeImportSpecifier(exportName, spec.name.text)); break; } - case 267 /* SyntaxKind.ImportClause */: { + case 270 /* SyntaxKind.ImportClause */: { var clause = parent; ts.Debug.assert(clause.name === ref, "Import clause name should match provided ref"); var spec = makeImportSpecifier(exportName, ref.text); @@ -161254,7 +162606,7 @@ var ts; // `import foo from "./a";` --> `import { foo } from "./a";` changes.replaceNode(importingSourceFile, ref, ts.factory.createNamedImports([spec])); } - else if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + else if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { // `import foo, * as a from "./a";` --> `import * as a from ".a/"; import { foo } from "./a";` changes.deleteRange(importingSourceFile, { pos: ref.getStart(importingSourceFile), end: namedBindings.getStart(importingSourceFile) }); var quotePreference = ts.isStringLiteral(clause.parent.moduleSpecifier) ? ts.quotePreferenceFromString(clause.parent.moduleSpecifier, importingSourceFile) : 1 /* QuotePreference.Double */; @@ -161268,7 +162620,7 @@ var ts; } break; } - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: var importTypeNode = parent; changes.replaceNode(importingSourceFile, parent, ts.factory.createImportTypeNode(importTypeNode.argument, importTypeNode.assertions, ts.factory.createIdentifier(exportName), importTypeNode.typeArguments, importTypeNode.isTypeOf)); break; @@ -161279,11 +162631,11 @@ var ts; function changeNamedToDefaultImport(importingSourceFile, ref, changes) { var parent = ref.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // `a.foo` --> `a.default` changes.replaceNode(importingSourceFile, ref, ts.factory.createIdentifier("default")); break; - case 270 /* SyntaxKind.ImportSpecifier */: { + case 273 /* SyntaxKind.ImportSpecifier */: { // `import { foo } from "./a";` --> `import foo from "./a";` // `import { foo as bar } from "./a";` --> `import bar from "./a";` var defaultImport = ts.factory.createIdentifier(parent.name.text); @@ -161296,7 +162648,7 @@ var ts; } break; } - case 275 /* SyntaxKind.ExportSpecifier */: { + case 278 /* SyntaxKind.ExportSpecifier */: { // `export { foo } from "./a";` --> `export { default as foo } from "./a";` // `export { foo as bar } from "./a";` --> `export { default as bar } from "./a";` // `export { foo as default } from "./a";` --> `export { default } from "./a";` @@ -161397,7 +162749,7 @@ var ts; if (!importClause.namedBindings) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_namespace_import_or_named_imports) }; } - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { return { convertTo: 0 /* ImportKind.Named */, import: importClause.namedBindings }; } var shouldUseDefault = getShouldUseDefault(context.program, importClause); @@ -161588,7 +162940,6 @@ var ts; }); return { edits: edits, renameFilename: undefined, renameLocation: undefined }; } - ; function isValidExpression(node) { return ts.isBinaryExpression(node) || ts.isConditionalExpression(node); } @@ -161636,7 +162987,6 @@ var ts; if (expression.operatorToken.kind !== 55 /* SyntaxKind.AmpersandAmpersandToken */) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_logical_AND_access_chains) }; } - ; var finalExpression = getFinalExpressionInChain(expression.right); if (!finalExpression) return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_convertible_access_expression) }; @@ -161846,27 +163196,27 @@ var ts; var lastDeclaration = signatureDecls[signatureDecls.length - 1]; var updated = lastDeclaration; switch (lastDeclaration.kind) { - case 168 /* SyntaxKind.MethodSignature */: { + case 170 /* SyntaxKind.MethodSignature */: { updated = ts.factory.updateMethodSignature(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.name, lastDeclaration.questionToken, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 169 /* SyntaxKind.MethodDeclaration */: { + case 171 /* SyntaxKind.MethodDeclaration */: { updated = ts.factory.updateMethodDeclaration(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.asteriskToken, lastDeclaration.name, lastDeclaration.questionToken, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type, lastDeclaration.body); break; } - case 174 /* SyntaxKind.CallSignature */: { + case 176 /* SyntaxKind.CallSignature */: { updated = ts.factory.updateCallSignature(lastDeclaration, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 171 /* SyntaxKind.Constructor */: { + case 173 /* SyntaxKind.Constructor */: { updated = ts.factory.updateConstructorDeclaration(lastDeclaration, lastDeclaration.modifiers, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.body); break; } - case 175 /* SyntaxKind.ConstructSignature */: { + case 177 /* SyntaxKind.ConstructSignature */: { updated = ts.factory.updateConstructSignature(lastDeclaration, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { updated = ts.factory.updateFunctionDeclaration(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.asteriskToken, lastDeclaration.name, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type, lastDeclaration.body); break; } @@ -161897,7 +163247,7 @@ var ts; } function convertParameterToNamedTupleMember(p) { ts.Debug.assert(ts.isIdentifier(p.name)); // This is checked during refactoring applicability checking - var result = ts.setTextRange(ts.factory.createNamedTupleMember(p.dotDotDotToken, p.name, p.questionToken, p.type || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)), p); + var result = ts.setTextRange(ts.factory.createNamedTupleMember(p.dotDotDotToken, p.name, p.questionToken, p.type || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)), p); var parameterDocComment = p.symbol && p.symbol.getDocumentationComment(checker); if (parameterDocComment) { var newComment = ts.displayPartsToString(parameterDocComment); @@ -161917,12 +163267,12 @@ var ts; } function isConvertableSignatureDeclaration(d) { switch (d.kind) { - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 174 /* SyntaxKind.CallSignature */: - case 171 /* SyntaxKind.Constructor */: - case 175 /* SyntaxKind.ConstructSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 176 /* SyntaxKind.CallSignature */: + case 173 /* SyntaxKind.Constructor */: + case 177 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: return true; } return false; @@ -162317,20 +163667,20 @@ var ts; function checkForStaticContext(nodeToCheck, containingClass) { var current = nodeToCheck; while (current !== containingClass) { - if (current.kind === 167 /* SyntaxKind.PropertyDeclaration */) { + if (current.kind === 169 /* SyntaxKind.PropertyDeclaration */) { if (ts.isStatic(current)) { rangeFacts |= RangeFacts.InStaticRegion; } break; } - else if (current.kind === 164 /* SyntaxKind.Parameter */) { + else if (current.kind === 166 /* SyntaxKind.Parameter */) { var ctorOrMethod = ts.getContainingFunction(current); - if (ctorOrMethod.kind === 171 /* SyntaxKind.Constructor */) { + if (ctorOrMethod.kind === 173 /* SyntaxKind.Constructor */) { rangeFacts |= RangeFacts.InStaticRegion; } break; } - else if (current.kind === 169 /* SyntaxKind.MethodDeclaration */) { + else if (current.kind === 171 /* SyntaxKind.MethodDeclaration */) { if (ts.isStatic(current)) { rangeFacts |= RangeFacts.InStaticRegion; } @@ -162368,9 +163718,9 @@ var ts; visit(nodeToCheck); if (rangeFacts & RangeFacts.UsesThis) { var container = ts.getThisContainer(nodeToCheck, /** includeArrowFunctions */ false); - if (container.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) || - container.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (container.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) || + container.kind === 215 /* SyntaxKind.FunctionExpression */) { rangeFacts |= RangeFacts.UsesThisInFunction; } } @@ -162381,7 +163731,7 @@ var ts; return true; } if (ts.isDeclaration(node)) { - var declaringNode = (node.kind === 254 /* SyntaxKind.VariableDeclaration */) ? node.parent.parent : node; + var declaringNode = (node.kind === 257 /* SyntaxKind.VariableDeclaration */) ? node.parent.parent : node; if (ts.hasSyntacticModifier(declaringNode, 1 /* ModifierFlags.Export */)) { // TODO: GH#18217 Silly to use `errors ||` since it's definitely not defined (see top of `visit`) // Also, if we're only pushing one error, just use `let error: Diagnostic | undefined`! @@ -162393,16 +163743,16 @@ var ts; } // Some things can't be extracted in certain situations switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractImport)); return true; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractExportedEntity)); return true; case 106 /* SyntaxKind.SuperKeyword */: // For a super *constructor call*, we have to be extracting the entire class, // but a super *method call* simply implies a 'this' reference - if (node.parent.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.parent.kind === 210 /* SyntaxKind.CallExpression */) { // Super constructor call var containingClass_1 = ts.getContainingClass(node); if (containingClass_1 === undefined || containingClass_1.pos < span.start || containingClass_1.end >= (span.start + span.length)) { @@ -162415,7 +163765,7 @@ var ts; thisNode = node; } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // check if arrow function uses this ts.forEachChild(node, function check(n) { if (ts.isThis(n)) { @@ -162430,39 +163780,39 @@ var ts; } }); // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.isSourceFile(node.parent) && node.parent.externalModuleIndicator === undefined) { // You cannot extract global declarations (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.functionWillNotBeVisibleInTheNewScope)); } // falls through - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // do not dive into functions or classes return false; } var savedPermittedJumps = permittedJumps; switch (node.kind) { - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: permittedJumps &= ~4 /* PermittedJumps.Return */; break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // forbid all jumps inside try blocks permittedJumps = 0 /* PermittedJumps.None */; break; - case 235 /* SyntaxKind.Block */: - if (node.parent && node.parent.kind === 252 /* SyntaxKind.TryStatement */ && node.parent.finallyBlock === node) { + case 238 /* SyntaxKind.Block */: + if (node.parent && node.parent.kind === 255 /* SyntaxKind.TryStatement */ && node.parent.finallyBlock === node) { // allow unconditional returns from finally blocks permittedJumps = 4 /* PermittedJumps.Return */; } break; - case 290 /* SyntaxKind.DefaultClause */: - case 289 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: // allow unlabeled break inside case clauses permittedJumps |= 1 /* PermittedJumps.Break */; break; @@ -162474,20 +163824,20 @@ var ts; break; } switch (node.kind) { - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 108 /* SyntaxKind.ThisKeyword */: rangeFacts |= RangeFacts.UsesThis; thisNode = node; break; - case 250 /* SyntaxKind.LabeledStatement */: { + case 253 /* SyntaxKind.LabeledStatement */: { var label = node.label; (seenLabels || (seenLabels = [])).push(label.escapedText); ts.forEachChild(node, visit); seenLabels.pop(); break; } - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: { + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: { var label = node.label; if (label) { if (!ts.contains(seenLabels, label.escapedText)) { @@ -162496,20 +163846,20 @@ var ts; } } else { - if (!(permittedJumps & (node.kind === 246 /* SyntaxKind.BreakStatement */ ? 1 /* PermittedJumps.Break */ : 2 /* PermittedJumps.Continue */))) { + if (!(permittedJumps & (node.kind === 249 /* SyntaxKind.BreakStatement */ ? 1 /* PermittedJumps.Break */ : 2 /* PermittedJumps.Continue */))) { // attempt to break or continue in a forbidden context (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractRangeContainingConditionalBreakOrContinueStatements)); } } break; } - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: rangeFacts |= RangeFacts.IsAsyncFunction; break; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: rangeFacts |= RangeFacts.IsGenerator; break; - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: if (permittedJumps & 4 /* PermittedJumps.Return */) { rangeFacts |= RangeFacts.HasReturn; } @@ -162579,7 +163929,7 @@ var ts; while (true) { current = current.parent; // A function parameter's initializer is actually in the outer scope, not the function declaration - if (current.kind === 164 /* SyntaxKind.Parameter */) { + if (current.kind === 166 /* SyntaxKind.Parameter */) { // Skip all the way to the outer scope of the function that declared this parameter current = ts.findAncestor(current, function (parent) { return ts.isFunctionLikeDeclaration(parent); }).parent; } @@ -162590,7 +163940,7 @@ var ts; // * Module/namespace or source file if (isScope(current)) { scopes.push(current); - if (current.kind === 305 /* SyntaxKind.SourceFile */) { + if (current.kind === 308 /* SyntaxKind.SourceFile */) { return scopes; } } @@ -162680,32 +164030,32 @@ var ts; } function getDescriptionForFunctionLikeDeclaration(scope) { switch (scope.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "constructor"; - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return scope.name ? "function '".concat(scope.name.text, "'") : ts.ANONYMOUS; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return "arrow function"; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return "method '".concat(scope.name.getText(), "'"); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return "'get ".concat(scope.name.getText(), "'"); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return "'set ".concat(scope.name.getText(), "'"); default: throw ts.Debug.assertNever(scope, "Unexpected scope kind ".concat(scope.kind)); } } function getDescriptionForClassLikeDeclaration(scope) { - return scope.kind === 257 /* SyntaxKind.ClassDeclaration */ + return scope.kind === 260 /* SyntaxKind.ClassDeclaration */ ? scope.name ? "class '".concat(scope.name.text, "'") : "anonymous class declaration" : scope.name ? "class expression '".concat(scope.name.text, "'") : "anonymous class expression"; } function getDescriptionForModuleLikeDeclaration(scope) { - return scope.kind === 262 /* SyntaxKind.ModuleBlock */ + return scope.kind === 265 /* SyntaxKind.ModuleBlock */ ? "namespace '".concat(scope.parent.name.getText(), "'") : scope.externalModuleIndicator ? 0 /* SpecialScope.Module */ : 1 /* SpecialScope.Global */; } @@ -162778,7 +164128,7 @@ var ts; modifiers.push(ts.factory.createModifier(124 /* SyntaxKind.StaticKeyword */)); } if (range.facts & RangeFacts.IsAsyncFunction) { - modifiers.push(ts.factory.createModifier(131 /* SyntaxKind.AsyncKeyword */)); + modifiers.push(ts.factory.createModifier(132 /* SyntaxKind.AsyncKeyword */)); } newFunction = ts.factory.createMethodDeclaration(modifiers.length ? modifiers : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, /*questionToken*/ undefined, typeParameters, parameters, returnType, body); @@ -162792,7 +164142,7 @@ var ts; /*questionToken*/ undefined, checker.typeToTypeNode(checker.getTypeAtLocation(range.thisNode), scope, 1 /* NodeBuilderFlags.NoTruncation */), /*initializer*/ undefined)); } - newFunction = ts.factory.createFunctionDeclaration(range.facts & RangeFacts.IsAsyncFunction ? [ts.factory.createToken(131 /* SyntaxKind.AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body); + newFunction = ts.factory.createFunctionDeclaration(range.facts & RangeFacts.IsAsyncFunction ? [ts.factory.createToken(132 /* SyntaxKind.AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body); } var changeTracker = ts.textChanges.ChangeTracker.fromContext(context); var minInsertionPos = (isReadonlyArray(range.range) ? ts.last(range.range) : range.range).end; @@ -162940,9 +164290,9 @@ var ts; while (ts.isParenthesizedTypeNode(withoutParens)) { withoutParens = withoutParens.type; } - return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 153 /* SyntaxKind.UndefinedKeyword */; }) + return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 155 /* SyntaxKind.UndefinedKeyword */; }) ? clone - : ts.factory.createUnionTypeNode([clone, ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)]); + : ts.factory.createUnionTypeNode([clone, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)]); } } /** @@ -162973,7 +164323,7 @@ var ts; if (rangeFacts & RangeFacts.InStaticRegion) { modifiers.push(ts.factory.createModifier(124 /* SyntaxKind.StaticKeyword */)); } - modifiers.push(ts.factory.createModifier(145 /* SyntaxKind.ReadonlyKeyword */)); + modifiers.push(ts.factory.createModifier(146 /* SyntaxKind.ReadonlyKeyword */)); var newVariable = ts.factory.createPropertyDeclaration(modifiers, localNameText, /*questionToken*/ undefined, variableType, initializer); var localReference = ts.factory.createPropertyAccessExpression(rangeFacts & RangeFacts.InStaticRegion @@ -163004,7 +164354,7 @@ var ts; var localReference = ts.factory.createIdentifier(localNameText); changeTracker.replaceNode(context.file, node, localReference); } - else if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) { + else if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) { // If the parent is an expression statement and the target scope is the immediately enclosing one, // replace the statement with the declaration. var newVariableStatement = ts.factory.createVariableStatement( @@ -163023,7 +164373,7 @@ var ts; changeTracker.insertNodeBefore(context.file, nodeToInsertBefore, newVariableStatement, /*blankLineBetween*/ false); } // Consume - if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */) { + if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */) { // If the parent is an expression statement, delete it. changeTracker.delete(context.file, node.parent); } @@ -163669,30 +165019,30 @@ var ts; function isExtractableExpression(node) { var parent = node.parent; switch (parent.kind) { - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return false; } switch (node.kind) { case 10 /* SyntaxKind.StringLiteral */: - return parent.kind !== 266 /* SyntaxKind.ImportDeclaration */ && - parent.kind !== 270 /* SyntaxKind.ImportSpecifier */; - case 225 /* SyntaxKind.SpreadElement */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 203 /* SyntaxKind.BindingElement */: + return parent.kind !== 269 /* SyntaxKind.ImportDeclaration */ && + parent.kind !== 273 /* SyntaxKind.ImportSpecifier */; + case 227 /* SyntaxKind.SpreadElement */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 205 /* SyntaxKind.BindingElement */: return false; case 79 /* SyntaxKind.Identifier */: - return parent.kind !== 203 /* SyntaxKind.BindingElement */ && - parent.kind !== 270 /* SyntaxKind.ImportSpecifier */ && - parent.kind !== 275 /* SyntaxKind.ExportSpecifier */; + return parent.kind !== 205 /* SyntaxKind.BindingElement */ && + parent.kind !== 273 /* SyntaxKind.ImportSpecifier */ && + parent.kind !== 278 /* SyntaxKind.ExportSpecifier */; } return true; } function isBlockLike(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 305 /* SyntaxKind.SourceFile */: - case 262 /* SyntaxKind.ModuleBlock */: - case 289 /* SyntaxKind.CaseClause */: + case 238 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 265 /* SyntaxKind.ModuleBlock */: + case 292 /* SyntaxKind.CaseClause */: return true; default: return false; @@ -163980,7 +165330,6 @@ var ts; (function (ts) { var refactor; (function (refactor) { - ; /** * Checks if some refactor info has refactor error info. */ @@ -164085,15 +165434,14 @@ var ts; // Imports will be copied to the new file anyway, and may still be needed in the old file. // Prologue directives will be copied to the new file and should be left in the old file. return !isPureImport(statement) && !ts.isPrologueDirective(statement); - ; } function isPureImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return true; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return !ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return node.declarationList.declarations.every(function (d) { return !!d.initializer && ts.isRequireCall(d.initializer, /*checkArgumentIsStringLiteralLike*/ true); }); default: return false; @@ -164189,12 +165537,12 @@ var ts; } function getNamespaceLikeImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? + case 269 /* SyntaxKind.ImportDeclaration */: + return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? node.importClause.namedBindings.name : undefined; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.name; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.tryCast(node.name, ts.isIdentifier); default: return ts.Debug.assertNever(node, "Unexpected node kind ".concat(node.kind)); @@ -164225,21 +165573,21 @@ var ts; var newNamespaceId = ts.factory.createIdentifier(newNamespaceName); var newModuleString = ts.factory.createStringLiteral(newModuleSpecifier); switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, /*name*/ undefined, ts.factory.createNamespaceImport(newNamespaceId)), newModuleString, /*assertClause*/ undefined); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.factory.createImportEqualsDeclaration(/*modifiers*/ undefined, /*isTypeOnly*/ false, newNamespaceId, ts.factory.createExternalModuleReference(newModuleString)); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.factory.createVariableDeclaration(newNamespaceId, /*exclamationToken*/ undefined, /*type*/ undefined, createRequireCall(newModuleString)); default: return ts.Debug.assertNever(node, "Unexpected node kind ".concat(node.kind)); } } function moduleSpecifierFromImport(i) { - return (i.kind === 266 /* SyntaxKind.ImportDeclaration */ ? i.moduleSpecifier - : i.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ ? i.moduleReference.expression + return (i.kind === 269 /* SyntaxKind.ImportDeclaration */ ? i.moduleSpecifier + : i.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? i.moduleReference.expression : i.initializer.arguments[0]); } function forEachImportInStatement(statement, cb) { @@ -164309,15 +165657,15 @@ var ts; } function deleteUnusedImports(sourceFile, importDecl, changes, isUnused) { switch (importDecl.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: deleteUnusedImportsInDeclaration(sourceFile, importDecl, changes, isUnused); break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: if (isUnused(importDecl.name)) { changes.delete(sourceFile, importDecl); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: deleteUnusedImportsInVariableDeclaration(sourceFile, importDecl, changes, isUnused); break; default: @@ -164330,7 +165678,7 @@ var ts; var _a = importDecl.importClause, name = _a.name, namedBindings = _a.namedBindings; var defaultUnused = !name || isUnused(name); var namedBindingsUnused = !namedBindings || - (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); })); + (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); })); if (defaultUnused && namedBindingsUnused) { changes.delete(sourceFile, importDecl); } @@ -164342,7 +165690,7 @@ var ts; if (namedBindingsUnused) { changes.replaceNode(sourceFile, importDecl.importClause, ts.factory.updateImportClause(importDecl.importClause, importDecl.importClause.isTypeOnly, name, /*namedBindings*/ undefined)); } - else if (namedBindings.kind === 269 /* SyntaxKind.NamedImports */) { + else if (namedBindings.kind === 272 /* SyntaxKind.NamedImports */) { for (var _i = 0, _b = namedBindings.elements; _i < _b.length; _i++) { var element = _b[_i]; if (isUnused(element.name)) @@ -164360,9 +165708,9 @@ var ts; changes.delete(sourceFile, name); } break; - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: break; - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: if (name.elements.every(function (e) { return ts.isIdentifier(e.name) && isUnused(e.name); })) { changes.delete(sourceFile, ts.isVariableDeclarationList(varDecl.parent) && varDecl.parent.declarations.length === 1 ? varDecl.parent.parent : varDecl); } @@ -164404,7 +165752,7 @@ var ts; if (markSeenTop(top)) { addExportToChanges(oldFile, top, name, changes, useEsModuleSyntax); } - if (ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */)) { oldFileDefault = name; } else { @@ -164492,14 +165840,14 @@ var ts; // Below should all be utilities function isInImport(decl) { switch (decl.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return isVariableDeclarationInImport(decl); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return ts.isVariableDeclaration(decl.parent.parent) && isVariableDeclarationInImport(decl.parent.parent); default: return false; @@ -164511,7 +165859,7 @@ var ts; } function filterImport(i, moduleSpecifier, keep) { switch (i.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: { + case 269 /* SyntaxKind.ImportDeclaration */: { var clause = i.importClause; if (!clause) return undefined; @@ -164521,9 +165869,9 @@ var ts; ? ts.factory.createImportDeclaration(/*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, defaultImport, namedBindings), moduleSpecifier, /*assertClause*/ undefined) : undefined; } - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return keep(i.name) ? i : undefined; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var name = filterBindingName(i.name, keep); return name ? makeVariableStatement(name, i.type, createRequireCall(moduleSpecifier), i.parent.flags) : undefined; } @@ -164532,7 +165880,7 @@ var ts; } } function filterNamedBindings(namedBindings, keep) { - if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { return keep(namedBindings.name) ? namedBindings : undefined; } else { @@ -164544,9 +165892,9 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return keep(name) ? name : undefined; - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return name; - case 201 /* SyntaxKind.ObjectBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: { // We can't handle nested destructurings or property names well here, so just copy them all. var newElements = name.elements.filter(function (prop) { return prop.propertyName || !ts.isIdentifier(prop.name) || keep(prop.name); }); return newElements.length ? ts.factory.createObjectBindingPattern(newElements) : undefined; @@ -164603,13 +165951,13 @@ var ts; } function isNonVariableTopLevelDeclaration(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return true; default: return false; @@ -164617,17 +165965,17 @@ var ts; } function forEachTopLevelDeclaration(statement, cb) { switch (statement.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return cb(statement); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.firstDefined(statement.declarationList.declarations, function (decl) { return forEachTopLevelDeclarationInBindingName(decl.name, cb); }); - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; return ts.isBinaryExpression(expression) && ts.getAssignmentDeclarationKind(expression) === 1 /* AssignmentDeclarationKind.ExportsProperty */ ? cb(statement) @@ -164639,8 +165987,8 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return cb(ts.cast(name.parent, function (x) { return ts.isVariableDeclaration(x) || ts.isBindingElement(x); })); - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return ts.firstDefined(name.elements, function (em) { return ts.isOmittedExpression(em) ? undefined : forEachTopLevelDeclarationInBindingName(em.name, cb); }); default: return ts.Debug.assertNever(name, "Unexpected name kind ".concat(name.kind)); @@ -164651,9 +165999,9 @@ var ts; } function getTopLevelDeclarationStatement(d) { switch (d.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return d.parent.parent; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getTopLevelDeclarationStatement(ts.cast(d.parent.parent, function (p) { return ts.isVariableDeclaration(p) || ts.isBindingElement(p); })); default: return d; @@ -164685,24 +166033,24 @@ var ts; function addEs6Export(d) { var modifiers = ts.canHaveModifiers(d) ? ts.concatenate([ts.factory.createModifier(93 /* SyntaxKind.ExportKeyword */)], ts.getModifiers(d)) : undefined; switch (d.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return ts.factory.updateFunctionDeclaration(d, modifiers, d.asteriskToken, d.name, d.typeParameters, d.parameters, d.type, d.body); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var decorators = ts.canHaveDecorators(d) ? ts.getDecorators(d) : undefined; return ts.factory.updateClassDeclaration(d, ts.concatenate(decorators, modifiers), d.name, d.typeParameters, d.heritageClauses, d.members); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.factory.updateVariableStatement(d, modifiers, d.declarationList); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.factory.updateModuleDeclaration(d, modifiers, d.name, d.body); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.factory.updateEnumDeclaration(d, modifiers, d.name, d.members); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return ts.factory.updateTypeAliasDeclaration(d, modifiers, d.name, d.typeParameters, d.type); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.factory.updateInterfaceDeclaration(d, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.factory.updateImportEqualsDeclaration(d, modifiers, d.isTypeOnly, d.name, d.moduleReference); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.Debug.fail(); // Shouldn't try to add 'export' keyword to `exports.x = ...` default: return ts.Debug.assertNever(d, "Unexpected declaration kind ".concat(d.kind)); @@ -164713,18 +166061,18 @@ var ts; } function getNamesToExportInCommonJS(decl) { switch (decl.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return [decl.name.text]; // TODO: GH#18217 - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.mapDefined(decl.declarationList.declarations, function (d) { return ts.isIdentifier(d.name) ? d.name.text : undefined; }); - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.emptyArray; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.Debug.fail("Can't export an ExpressionStatement"); // Shouldn't try to add 'export' keyword to `exports.x = ...` default: return ts.Debug.assertNever(decl, "Unexpected decl kind ".concat(decl.kind)); @@ -165065,15 +166413,15 @@ var ts; var parent = functionReference.parent; switch (parent.kind) { // foo(...) or super(...) or new Foo(...) - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: var callOrNewExpression = ts.tryCast(parent, ts.isCallOrNewExpression); if (callOrNewExpression && callOrNewExpression.expression === functionReference) { return callOrNewExpression; } break; // x.foo(...) - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression); if (propertyAccessExpression && propertyAccessExpression.parent && propertyAccessExpression.name === functionReference) { var callOrNewExpression_1 = ts.tryCast(propertyAccessExpression.parent, ts.isCallOrNewExpression); @@ -165083,7 +166431,7 @@ var ts; } break; // x["foo"](...) - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression); if (elementAccessExpression && elementAccessExpression.parent && elementAccessExpression.argumentExpression === functionReference) { var callOrNewExpression_2 = ts.tryCast(elementAccessExpression.parent, ts.isCallOrNewExpression); @@ -165102,14 +166450,14 @@ var ts; var parent = reference.parent; switch (parent.kind) { // `C.foo` - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression); if (propertyAccessExpression && propertyAccessExpression.expression === reference) { return propertyAccessExpression; } break; // `C["foo"]` - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression); if (elementAccessExpression && elementAccessExpression.expression === reference) { return elementAccessExpression; @@ -165155,16 +166503,16 @@ var ts; if (!isValidParameterNodeArray(functionDeclaration.parameters, checker)) return false; switch (functionDeclaration.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return hasNameOrDefault(functionDeclaration) && isSingleImplementation(functionDeclaration, checker); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: if (ts.isObjectLiteralExpression(functionDeclaration.parent)) { var contextualSymbol = getSymbolForContextualType(functionDeclaration.name, checker); // don't offer the refactor when there are multiple signatures since we won't know which ones the user wants to change return ((_a = contextualSymbol === null || contextualSymbol === void 0 ? void 0 : contextualSymbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 && isSingleImplementation(functionDeclaration, checker); } return isSingleImplementation(functionDeclaration, checker); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: if (ts.isClassDeclaration(functionDeclaration.parent)) { return hasNameOrDefault(functionDeclaration.parent) && isSingleImplementation(functionDeclaration, checker); } @@ -165172,8 +166520,8 @@ var ts; return isValidVariableDeclaration(functionDeclaration.parent.parent) && isSingleImplementation(functionDeclaration, checker); } - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return isValidVariableDeclaration(functionDeclaration.parent); } return false; @@ -165321,7 +166669,7 @@ var ts; } function getClassNames(constructorDeclaration) { switch (constructorDeclaration.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var classDeclaration = constructorDeclaration.parent; if (classDeclaration.name) return [classDeclaration.name]; @@ -165329,7 +166677,7 @@ var ts; // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault` var defaultModifier = ts.Debug.checkDefined(ts.findModifier(classDeclaration, 88 /* SyntaxKind.DefaultKeyword */), "Nameless class declaration should be a default export"); return [defaultModifier]; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: var classExpression = constructorDeclaration.parent; var variableDeclaration = constructorDeclaration.parent.parent; var className = classExpression.name; @@ -165340,25 +166688,25 @@ var ts; } function getFunctionNames(functionDeclaration) { switch (functionDeclaration.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (functionDeclaration.name) return [functionDeclaration.name]; // If the function declaration doesn't have a name, it should have a default modifier. // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault` var defaultModifier = ts.Debug.checkDefined(ts.findModifier(functionDeclaration, 88 /* SyntaxKind.DefaultKeyword */), "Nameless function declaration should be a default export"); return [defaultModifier]; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return [functionDeclaration.name]; - case 171 /* SyntaxKind.Constructor */: - var ctrKeyword = ts.Debug.checkDefined(ts.findChildOfKind(functionDeclaration, 134 /* SyntaxKind.ConstructorKeyword */, functionDeclaration.getSourceFile()), "Constructor declaration should have constructor keyword"); - if (functionDeclaration.parent.kind === 226 /* SyntaxKind.ClassExpression */) { + case 173 /* SyntaxKind.Constructor */: + var ctrKeyword = ts.Debug.checkDefined(ts.findChildOfKind(functionDeclaration, 135 /* SyntaxKind.ConstructorKeyword */, functionDeclaration.getSourceFile()), "Constructor declaration should have constructor keyword"); + if (functionDeclaration.parent.kind === 228 /* SyntaxKind.ClassExpression */) { var variableDeclaration = functionDeclaration.parent.parent; return [variableDeclaration.name, ctrKeyword]; } return [ctrKeyword]; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return [functionDeclaration.parent.name]; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (functionDeclaration.name) return [functionDeclaration.name, functionDeclaration.parent.name]; return [functionDeclaration.parent.name]; @@ -165449,11 +166797,11 @@ var ts; function getParentBinaryExpression(expr) { var container = ts.findAncestor(expr.parent, function (n) { switch (n.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return false; - case 223 /* SyntaxKind.TemplateExpression */: - case 221 /* SyntaxKind.BinaryExpression */: + case 225 /* SyntaxKind.TemplateExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return !(ts.isBinaryExpression(n.parent) && isNotEqualsOperator(n.parent)); default: return "quit"; @@ -165901,10 +167249,10 @@ var ts; } function isConvertibleDeclaration(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: return true; default: return false; @@ -165949,7 +167297,7 @@ var ts; this.kind = kind; } NodeObject.prototype.assertHasRealPosition = function (message) { - // eslint-disable-next-line debug-assert + // eslint-disable-next-line local/debug-assert ts.Debug.assert(!ts.positionIsSynthesized(this.pos) && !ts.positionIsSynthesized(this.end), message || "Node must have a real position for this operation"); }; NodeObject.prototype.getSourceFile = function () { @@ -166006,8 +167354,8 @@ var ts; if (!children.length) { return undefined; } - var child = ts.find(children, function (kid) { return kid.kind < 309 /* SyntaxKind.FirstJSDocNode */ || kid.kind > 347 /* SyntaxKind.LastJSDocNode */; }); - return child.kind < 161 /* SyntaxKind.FirstNode */ ? + var child = ts.find(children, function (kid) { return kid.kind < 312 /* SyntaxKind.FirstJSDocNode */ || kid.kind > 350 /* SyntaxKind.LastJSDocNode */; }); + return child.kind < 163 /* SyntaxKind.FirstNode */ ? child : child.getFirstToken(sourceFile); }; @@ -166018,7 +167366,7 @@ var ts; if (!child) { return undefined; } - return child.kind < 161 /* SyntaxKind.FirstNode */ ? child : child.getLastToken(sourceFile); + return child.kind < 163 /* SyntaxKind.FirstNode */ ? child : child.getLastToken(sourceFile); }; NodeObject.prototype.forEachChild = function (cbNode, cbNodeArray) { return ts.forEachChild(this, cbNode, cbNodeArray); @@ -166078,7 +167426,7 @@ var ts; } } function createSyntaxList(nodes, parent) { - var list = createNode(348 /* SyntaxKind.SyntaxList */, nodes.pos, nodes.end, parent); + var list = createNode(351 /* SyntaxKind.SyntaxList */, nodes.pos, nodes.end, parent); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { @@ -166427,7 +167775,7 @@ var ts; var _a; if (!seenSymbols_1.has(symbol)) { seenSymbols_1.add(symbol); - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) { return symbol.getContextualJsDocTags(declaration, checker); } return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 ? symbol.getJsDocTags() : undefined; @@ -166454,7 +167802,7 @@ var ts; var inheritedDocs = findBaseOfDeclaration(checker, declaration, function (symbol) { if (!seenSymbols_2.has(symbol)) { seenSymbols_2.add(symbol); - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) { return symbol.getContextualDocumentationComment(declaration, checker); } return symbol.getDocumentationComment(checker); @@ -166473,7 +167821,7 @@ var ts; } function findBaseOfDeclaration(checker, declaration, cb) { var _a; - var classOrInterfaceDeclaration = ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.kind) === 171 /* SyntaxKind.Constructor */ ? declaration.parent.parent : declaration.parent; + var classOrInterfaceDeclaration = ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.kind) === 173 /* SyntaxKind.Constructor */ ? declaration.parent.parent : declaration.parent; if (!classOrInterfaceDeclaration) return; var isStaticMember = ts.hasStaticModifier(declaration); @@ -166488,7 +167836,7 @@ var ts; __extends(SourceFileObject, _super); function SourceFileObject(kind, pos, end) { var _this = _super.call(this, kind, pos, end) || this; - _this.kind = 305 /* SyntaxKind.SourceFile */; + _this.kind = 308 /* SyntaxKind.SourceFile */; return _this; } SourceFileObject.prototype.update = function (newText, textChangeRange) { @@ -166547,10 +167895,10 @@ var ts; } function visit(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -166570,31 +167918,31 @@ var ts; } ts.forEachChild(node, visit); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 182 /* SyntaxKind.TypeLiteral */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 184 /* SyntaxKind.TypeLiteral */: addDeclaration(node); ts.forEachChild(node, visit); break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Only consider parameter properties if (!ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */)) { break; } // falls through - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: { + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: { var decl = node; if (ts.isBindingPattern(decl.name)) { ts.forEachChild(decl.name, visit); @@ -166605,12 +167953,12 @@ var ts; } } // falls through - case 299 /* SyntaxKind.EnumMember */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: addDeclaration(node); break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; var exportDeclaration = node; @@ -166623,7 +167971,7 @@ var ts; } } break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -166635,7 +167983,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -166644,7 +167992,7 @@ var ts; } } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.getAssignmentDeclarationKind(node) !== 0 /* AssignmentDeclarationKind.None */) { addDeclaration(node); } @@ -167056,6 +168404,10 @@ var ts; getCurrentDirectory: compilerHost.getCurrentDirectory, onUnRecoverableConfigFileDiagnostic: ts.noop, }; + // The call to isProgramUptoDate below may refer back to documentRegistryBucketKey; + // calculate this early so it's not undefined if downleveled to a var (or, if emitted + // 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)) { return; @@ -167065,7 +168417,6 @@ var ts; // instance. If we cancel midway through, we may end up in an inconsistent state where // the program points to old source files that have been invalidated because of // incremental parsing. - var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); var options = { rootNames: rootFileNames, options: newSettings, @@ -167361,16 +168712,16 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return !ts.isLabelName(node) && !ts.isTagName(node) && !ts.isConstTypeReference(node.parent); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: // Don't return quickInfo if inside the comment in `a/**/.b` return !ts.isInComment(sourceFile, position); case 108 /* SyntaxKind.ThisKeyword */: - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 106 /* SyntaxKind.SuperKeyword */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return true; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return ts.isImportMeta(node); default: return false; @@ -167477,15 +168828,15 @@ var ts; return undefined; } switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: case 10 /* SyntaxKind.StringLiteral */: case 95 /* SyntaxKind.FalseKeyword */: case 110 /* SyntaxKind.TrueKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 106 /* SyntaxKind.SuperKeyword */: case 108 /* SyntaxKind.ThisKeyword */: - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 79 /* SyntaxKind.Identifier */: break; // Cant create the text span @@ -167502,7 +168853,7 @@ var ts; // If this is name of a module declarations, check if this is right side of dotted module name // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of // Then this name is name from dotted module - if (nodeForStartPos.parent.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -168251,7 +169602,7 @@ var ts; */ function literalIsName(node) { return ts.isDeclarationName(node) || - node.parent.kind === 277 /* SyntaxKind.ExternalModuleReference */ || + node.parent.kind === 280 /* SyntaxKind.ExternalModuleReference */ || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node); } @@ -168269,13 +169620,13 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 8 /* SyntaxKind.NumericLiteral */: - if (node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { return ts.isObjectLiteralElement(node.parent.parent) ? node.parent.parent : undefined; } // falls through case 79 /* SyntaxKind.Identifier */: return ts.isObjectLiteralElement(node.parent) && - (node.parent.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || node.parent.parent.kind === 286 /* SyntaxKind.JsxAttributes */) && + (node.parent.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || node.parent.parent.kind === 289 /* SyntaxKind.JsxAttributes */) && node.parent.name === node ? node.parent : undefined; } return undefined; @@ -168317,7 +169668,7 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && + node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && node.parent.argumentExpression === node; } /** @@ -168410,114 +169761,114 @@ var ts; if (node) { var parent = node.parent; switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 254 /* SyntaxKind.VariableDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return spanInVariableDeclaration(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return spanInParameterDeclaration(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return spanInFunctionDeclaration(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // falls through - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return spanInBlock(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return spanInBlock(node.block); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: // Span on while(...) return textSpanEndingAtNextToken(node, node.expression); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 253 /* SyntaxKind.DebuggerStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: // set on if(..) span return textSpanEndingAtNextToken(node, node.expression); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: // span in statement return spanInNode(node.statement); - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return spanInForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: // span of for (a in ...) return textSpanEndingAtNextToken(node, node.expression); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: // span in initializer return spanInInitializerOfForLike(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: // span on switch(...) return textSpanEndingAtNextToken(node, node.expression); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 203 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 205 /* SyntaxKind.BindingElement */: // span on complete node return textSpan(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: // span in statement return spanInNode(node.statement); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return spanInNodeArray(parent.modifiers, node, ts.isDecorator); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return spanInBindingPattern(node); // No breakpoint in interface, type alias - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return undefined; // Tokens: case 26 /* SyntaxKind.SemicolonToken */: @@ -168547,7 +169898,7 @@ var ts; case 83 /* SyntaxKind.CatchKeyword */: case 96 /* SyntaxKind.FinallyKeyword */: return spanInNextNode(node); - case 160 /* SyntaxKind.OfKeyword */: + case 162 /* SyntaxKind.OfKeyword */: return spanInOfKeyword(node); default: // Destructuring pattern in destructuring assignment @@ -168560,13 +169911,13 @@ var ts; // `a` or `...c` or `d: x` from // `[a, b, ...c]` or `{ a, b }` or `{ d: x }` from destructuring pattern if ((node.kind === 79 /* SyntaxKind.Identifier */ || - node.kind === 225 /* SyntaxKind.SpreadElement */ || - node.kind === 296 /* SyntaxKind.PropertyAssignment */ || - node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) && + node.kind === 227 /* SyntaxKind.SpreadElement */ || + node.kind === 299 /* SyntaxKind.PropertyAssignment */ || + node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(parent)) { return textSpan(node); } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */) { var _a = node, left = _a.left, operatorToken = _a.operatorToken; // Set breakpoint in destructuring pattern if its destructuring assignment // [a, b, c] or {a, b, c} of @@ -168588,22 +169939,22 @@ var ts; } if (ts.isExpressionNode(node)) { switch (parent.kind) { - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // Set span as if on while keyword return spanInPreviousNode(node); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Set breakpoint on the decorator emit return spanInNode(node.parent); - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return textSpan(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (node.parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { // If this is a comma expression, the breakpoint is possible in this expression return textSpan(node); } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: if (node.parent.body === node) { // If this is body of arrow function, it is allowed to have the breakpoint return textSpan(node); @@ -168612,21 +169963,21 @@ var ts; } } switch (node.parent.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // If this is name of property assignment, set breakpoint in the initializer if (node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); } break; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: // Breakpoint in type assertion goes to its operand if (node.parent.type === node) { return spanInNextNode(node.parent.type); } break; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: { + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: { // initializer of variable/parameter declaration go to previous node var _b = node.parent, initializer = _b.initializer, type = _b.type; if (initializer === node || type === node || ts.isAssignmentOperator(node.kind)) { @@ -168634,7 +169985,7 @@ var ts; } break; } - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var left = node.parent.left; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(left) && node !== left) { // If initializer of destructuring assignment move to previous token @@ -168664,7 +170015,7 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (variableDeclaration.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { return spanInNode(variableDeclaration.parent.parent); } var parent = variableDeclaration.parent; @@ -168676,7 +170027,7 @@ var ts; // or its declaration from 'for of' if ((ts.hasOnlyExpressionInitializer(variableDeclaration) && variableDeclaration.initializer) || ts.hasSyntacticModifier(variableDeclaration, 1 /* ModifierFlags.Export */) || - parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { return textSpanFromVariableDeclaration(variableDeclaration); } if (ts.isVariableDeclarationList(variableDeclaration.parent) && @@ -168717,7 +170068,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasSyntacticModifier(functionDeclaration, 1 /* ModifierFlags.Export */) || - (functionDeclaration.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ && functionDeclaration.kind !== 171 /* SyntaxKind.Constructor */); + (functionDeclaration.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ && functionDeclaration.kind !== 173 /* SyntaxKind.Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -168740,26 +170091,26 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // Set on parent if on same line otherwise on first statement // falls through - case 241 /* SyntaxKind.WhileStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } // Default action is to set on first statement return spanInNode(block.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { - if (forLikeStatement.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (forLikeStatement.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { // Declaration list - set breakpoint in first declaration var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -168784,21 +170135,21 @@ var ts; } function spanInBindingPattern(bindingPattern) { // Set breakpoint in first binding element - var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 227 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 229 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } // Empty binding pattern of binding element, set breakpoint on binding element - if (bindingPattern.parent.kind === 203 /* SyntaxKind.BindingElement */) { + if (bindingPattern.parent.kind === 205 /* SyntaxKind.BindingElement */) { return textSpan(bindingPattern.parent); } // Variable declaration is used as the span return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { - ts.Debug.assert(node.kind !== 202 /* SyntaxKind.ArrayBindingPattern */ && node.kind !== 201 /* SyntaxKind.ObjectBindingPattern */); - var elements = node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ ? node.elements : node.properties; - var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 227 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); + ts.Debug.assert(node.kind !== 204 /* SyntaxKind.ArrayBindingPattern */ && node.kind !== 203 /* SyntaxKind.ObjectBindingPattern */); + var elements = node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ ? node.elements : node.properties; + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 229 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } @@ -168806,18 +170157,18 @@ var ts; // just nested element in another destructuring assignment // set breakpoint on assignment when parent is destructuring assignment // Otherwise set breakpoint for this element - return textSpan(node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ ? node.parent : node); + return textSpan(node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ ? node.parent : node); } // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -168825,25 +170176,25 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: // If this is not an instantiated module block, no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // falls through - case 260 /* SyntaxKind.EnumDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // Span on close brace token return textSpan(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } // falls through - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -168851,7 +170202,7 @@ var ts; return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -168867,7 +170218,7 @@ var ts; } function spanInCloseBracketToken(node) { switch (node.parent.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -168882,12 +170233,12 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 240 /* SyntaxKind.DoStatement */ || // Go to while keyword and do action instead - node.parent.kind === 208 /* SyntaxKind.CallExpression */ || - node.parent.kind === 209 /* SyntaxKind.NewExpression */) { + if (node.parent.kind === 243 /* SyntaxKind.DoStatement */ || // Go to while keyword and do action instead + node.parent.kind === 210 /* SyntaxKind.CallExpression */ || + node.parent.kind === 211 /* SyntaxKind.NewExpression */) { return spanInPreviousNode(node); } - if (node.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (node.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { return spanInNextNode(node); } // Default to parent node @@ -168896,21 +170247,21 @@ var ts; function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return spanInPreviousNode(node); // Default to parent node default: @@ -168920,20 +170271,20 @@ var ts; function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration if (ts.isFunctionLike(node.parent) || - node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ || - node.parent.kind === 164 /* SyntaxKind.Parameter */) { + node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ || + node.parent.kind === 166 /* SyntaxKind.Parameter */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (node.parent.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 240 /* SyntaxKind.DoStatement */) { + if (node.parent.kind === 243 /* SyntaxKind.DoStatement */) { // Set span on while expression return textSpanEndingAtNextToken(node, node.parent.expression); } @@ -168941,7 +170292,7 @@ var ts; return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { // Set using next token return spanInNextNode(node); } @@ -168990,7 +170341,7 @@ var debugObjectHost = (function () { return this; })(); // We need to use 'null' to interface with the managed side. -/* eslint-disable no-in-operator */ +/* eslint-disable local/no-in-operator */ /* @internal */ var ts; (function (ts) { @@ -169790,7 +171141,7 @@ var ts; }()); ts.TypeScriptServicesFactory = TypeScriptServicesFactory; })(ts || (ts = {})); -/* eslint-enable no-in-operator */ +/* eslint-enable local/no-in-operator */ // We polyfill `globalThis` here so re can reliably patch the global scope // in the contexts we want to in the same way across script and module formats /* eslint-enable no-var */ @@ -172850,7 +174201,7 @@ var ts; var newLS = pluginModule.create(info); for (var _i = 0, _a = Object.keys(this.languageService); _i < _a.length; _i++) { var k = _a[_i]; - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (!(k in newLS)) { this.projectService.logger.info("Plugin activation warning: Missing proxied method ".concat(k, " in created LS. Patching.")); newLS[k] = this.languageService[k]; @@ -174137,7 +175488,7 @@ var ts; // raw is now fixed and ready this.safelist = raw.typesMap; for (var key in raw.simpleMap) { - if (raw.simpleMap.hasOwnProperty(key)) { + if (ts.hasProperty(raw.simpleMap, key)) { this.legacySafelist.set(key, raw.simpleMap[key].toLowerCase()); } } @@ -177551,7 +178902,6 @@ var ts; } return ts.deduplicate(outputs, ts.equateValues); } - ; function createDocumentSpanSet() { return ts.createSet(function (_a) { var textSpan = _a.textSpan; @@ -178842,7 +180192,7 @@ var ts; var packageDirectory = fileName.substring(0, nodeModulesPathParts.packageRootIndex); var packageJsonCache = (_a = project.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache(); var compilerOptions = project.getCompilationSettings(); - var packageJson = ts.getPackageScopeForPath(project.toPath(packageDirectory + "/package.json"), ts.getTemporaryModuleResolutionState(packageJsonCache, project, compilerOptions)); + var packageJson = ts.getPackageScopeForPath(ts.getNormalizedAbsolutePath(packageDirectory + "/package.json", project.getCurrentDirectory()), ts.getTemporaryModuleResolutionState(packageJsonCache, project, compilerOptions)); if (!packageJson) return undefined; // Use fake options instead of actual compiler options to avoid following export map if the project uses node16 or nodenext - @@ -178901,7 +180251,7 @@ var ts; } var initialNode = ts.getTouchingPropertyName(program.getSourceFile(file), position); var symbol = program.getTypeChecker().getSymbolAtLocation(initialNode); - var importSpecifier = symbol && ts.getDeclarationOfKind(symbol, 270 /* SyntaxKind.ImportSpecifier */); + var importSpecifier = symbol && ts.getDeclarationOfKind(symbol, 273 /* SyntaxKind.ImportSpecifier */); if (!importSpecifier) return undefined; var nameToSearch = ((_a = importSpecifier.propertyName) === null || _a === void 0 ? void 0 : _a.text) || importSpecifier.name.text; @@ -179254,9 +180604,9 @@ var ts; }; Session.prototype.getFileAndLanguageServiceForSyntacticOperation = function (args) { // Since this is syntactic operation, there should always be project for the file - // we wouldnt have to ensure project but rather throw if we dont get project + // throw if we dont get project var file = server.toNormalizedPath(args.file); - var project = this.getProject(args.projectFileName) || this.projectService.tryGetDefaultProjectForFile(file); + var project = this.getProject(args.projectFileName) || this.projectService.ensureDefaultProjectForFile(file); if (!project) { return server.Errors.ThrowNoProject(); } @@ -182049,7 +183399,7 @@ var ts; if (typeof value === "number") { return ts.factory.createNumericLiteral(value); } - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (typeof value === "object" && "base10Value" in value) { // PseudoBigInt return ts.factory.createBigIntLiteral(value); } @@ -182077,7 +183427,7 @@ var ts; } else { type = operatorOrType; - operator = 140 /* SyntaxKind.KeyOfKeyword */; + operator = 141 /* SyntaxKind.KeyOfKeyword */; } return ts.factory.createTypeOperatorNode(operator, type); }, factoryDeprecation); @@ -182255,7 +183605,7 @@ var ts; ts.createNode = ts.Debug.deprecate(function createNode(kind, pos, end) { if (pos === void 0) { pos = 0; } if (end === void 0) { end = 0; } - return ts.setTextRangePosEnd(kind === 305 /* SyntaxKind.SourceFile */ ? ts.parseBaseNodeFactory.createBaseSourceFileNode(kind) : + return ts.setTextRangePosEnd(kind === 308 /* SyntaxKind.SourceFile */ ? ts.parseBaseNodeFactory.createBaseSourceFileNode(kind) : kind === 79 /* SyntaxKind.Identifier */ ? ts.parseBaseNodeFactory.createBaseIdentifierNode(kind) : kind === 80 /* SyntaxKind.PrivateIdentifier */ ? ts.parseBaseNodeFactory.createBasePrivateIdentifierNode(kind) : !ts.isNodeKind(kind) ? ts.parseBaseNodeFactory.createBaseTokenNode(kind) : @@ -182285,7 +183635,7 @@ var ts; (function (ts) { /** @deprecated Use `isTypeAssertionExpression` instead. */ ts.isTypeAssertion = ts.Debug.deprecate(function isTypeAssertion(node) { - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */; }, { since: "4.0", warnAfter: "4.1", @@ -183892,20 +185242,6 @@ var ts; } // Override sys.write because fs.writeSync is not reliable on Node 4 sys.write = function (s) { return writeMessage(sys.bufferFrom(s, "utf8")); }; - // REVIEW: for now this implementation uses polling. - // The advantage of polling is that it works reliably - // on all os and with network mounted files. - // For 90 referenced files, the average time to detect - // changes is 2*msInterval (by default 5 seconds). - // The overhead of this is .04 percent (1/2500) with - // average pause of < 1 millisecond (and max - // pause less than 1.5 milliseconds); question is - // do we anticipate reference sets in the 100s and - // do we care about waiting 10-20 seconds to detect - // changes for large reference sets? If so, do we want - // to increase the chunk size or decrease the interval - // time dynamically to match the large reference set? - sys.defaultWatchFileKind = function () { return ts.WatchFileKind.FixedChunkSizePolling; }; /* eslint-disable no-restricted-globals */ sys.setTimeout = setTimeout; sys.clearTimeout = clearTimeout; diff --git a/lib/tsserverlibrary.d.ts b/lib/tsserverlibrary.d.ts index 8003ac00a3c..50fbd1d4dea 100644 --- a/lib/tsserverlibrary.d.ts +++ b/lib/tsserverlibrary.d.ts @@ -14,7 +14,7 @@ and limitations under the License. ***************************************************************************** */ declare namespace ts { - const versionMajorMinor = "4.8"; + const versionMajorMinor = "4.9"; /** The version of the TypeScript compiler release */ const version: string; /** @@ -232,237 +232,240 @@ declare namespace ts { StaticKeyword = 124, YieldKeyword = 125, AbstractKeyword = 126, - AsKeyword = 127, - AssertsKeyword = 128, - AssertKeyword = 129, - AnyKeyword = 130, - AsyncKeyword = 131, - AwaitKeyword = 132, - BooleanKeyword = 133, - ConstructorKeyword = 134, - DeclareKeyword = 135, - GetKeyword = 136, - InferKeyword = 137, - IntrinsicKeyword = 138, - IsKeyword = 139, - KeyOfKeyword = 140, - ModuleKeyword = 141, - NamespaceKeyword = 142, - NeverKeyword = 143, - OutKeyword = 144, - ReadonlyKeyword = 145, - RequireKeyword = 146, - NumberKeyword = 147, - ObjectKeyword = 148, - SetKeyword = 149, - StringKeyword = 150, - SymbolKeyword = 151, - TypeKeyword = 152, - UndefinedKeyword = 153, - UniqueKeyword = 154, - UnknownKeyword = 155, - FromKeyword = 156, - GlobalKeyword = 157, - BigIntKeyword = 158, - OverrideKeyword = 159, - OfKeyword = 160, - QualifiedName = 161, - ComputedPropertyName = 162, - TypeParameter = 163, - Parameter = 164, - Decorator = 165, - PropertySignature = 166, - PropertyDeclaration = 167, - MethodSignature = 168, - MethodDeclaration = 169, - ClassStaticBlockDeclaration = 170, - Constructor = 171, - GetAccessor = 172, - SetAccessor = 173, - CallSignature = 174, - ConstructSignature = 175, - IndexSignature = 176, - TypePredicate = 177, - TypeReference = 178, - FunctionType = 179, - ConstructorType = 180, - TypeQuery = 181, - TypeLiteral = 182, - ArrayType = 183, - TupleType = 184, - OptionalType = 185, - RestType = 186, - UnionType = 187, - IntersectionType = 188, - ConditionalType = 189, - InferType = 190, - ParenthesizedType = 191, - ThisType = 192, - TypeOperator = 193, - IndexedAccessType = 194, - MappedType = 195, - LiteralType = 196, - NamedTupleMember = 197, - TemplateLiteralType = 198, - TemplateLiteralTypeSpan = 199, - ImportType = 200, - ObjectBindingPattern = 201, - ArrayBindingPattern = 202, - BindingElement = 203, - ArrayLiteralExpression = 204, - ObjectLiteralExpression = 205, - PropertyAccessExpression = 206, - ElementAccessExpression = 207, - CallExpression = 208, - NewExpression = 209, - TaggedTemplateExpression = 210, - TypeAssertionExpression = 211, - ParenthesizedExpression = 212, - FunctionExpression = 213, - ArrowFunction = 214, - DeleteExpression = 215, - TypeOfExpression = 216, - VoidExpression = 217, - AwaitExpression = 218, - PrefixUnaryExpression = 219, - PostfixUnaryExpression = 220, - BinaryExpression = 221, - ConditionalExpression = 222, - TemplateExpression = 223, - YieldExpression = 224, - SpreadElement = 225, - ClassExpression = 226, - OmittedExpression = 227, - ExpressionWithTypeArguments = 228, - AsExpression = 229, - NonNullExpression = 230, - MetaProperty = 231, - SyntheticExpression = 232, - TemplateSpan = 233, - SemicolonClassElement = 234, - Block = 235, - EmptyStatement = 236, - VariableStatement = 237, - ExpressionStatement = 238, - IfStatement = 239, - DoStatement = 240, - WhileStatement = 241, - ForStatement = 242, - ForInStatement = 243, - ForOfStatement = 244, - ContinueStatement = 245, - BreakStatement = 246, - ReturnStatement = 247, - WithStatement = 248, - SwitchStatement = 249, - LabeledStatement = 250, - ThrowStatement = 251, - TryStatement = 252, - DebuggerStatement = 253, - VariableDeclaration = 254, - VariableDeclarationList = 255, - FunctionDeclaration = 256, - ClassDeclaration = 257, - InterfaceDeclaration = 258, - TypeAliasDeclaration = 259, - EnumDeclaration = 260, - ModuleDeclaration = 261, - ModuleBlock = 262, - CaseBlock = 263, - NamespaceExportDeclaration = 264, - ImportEqualsDeclaration = 265, - ImportDeclaration = 266, - ImportClause = 267, - NamespaceImport = 268, - NamedImports = 269, - ImportSpecifier = 270, - ExportAssignment = 271, - ExportDeclaration = 272, - NamedExports = 273, - NamespaceExport = 274, - ExportSpecifier = 275, - MissingDeclaration = 276, - ExternalModuleReference = 277, - JsxElement = 278, - JsxSelfClosingElement = 279, - JsxOpeningElement = 280, - JsxClosingElement = 281, - JsxFragment = 282, - JsxOpeningFragment = 283, - JsxClosingFragment = 284, - JsxAttribute = 285, - JsxAttributes = 286, - JsxSpreadAttribute = 287, - JsxExpression = 288, - CaseClause = 289, - DefaultClause = 290, - HeritageClause = 291, - CatchClause = 292, - AssertClause = 293, - AssertEntry = 294, - ImportTypeAssertionContainer = 295, - PropertyAssignment = 296, - ShorthandPropertyAssignment = 297, - SpreadAssignment = 298, - EnumMember = 299, - UnparsedPrologue = 300, - UnparsedPrepend = 301, - UnparsedText = 302, - UnparsedInternalText = 303, - UnparsedSyntheticReference = 304, - SourceFile = 305, - Bundle = 306, - UnparsedSource = 307, - InputFiles = 308, - JSDocTypeExpression = 309, - JSDocNameReference = 310, - JSDocMemberName = 311, - JSDocAllType = 312, - JSDocUnknownType = 313, - JSDocNullableType = 314, - JSDocNonNullableType = 315, - JSDocOptionalType = 316, - JSDocFunctionType = 317, - JSDocVariadicType = 318, - JSDocNamepathType = 319, - JSDoc = 320, + AccessorKeyword = 127, + AsKeyword = 128, + AssertsKeyword = 129, + AssertKeyword = 130, + AnyKeyword = 131, + AsyncKeyword = 132, + AwaitKeyword = 133, + BooleanKeyword = 134, + ConstructorKeyword = 135, + DeclareKeyword = 136, + GetKeyword = 137, + InferKeyword = 138, + IntrinsicKeyword = 139, + IsKeyword = 140, + KeyOfKeyword = 141, + ModuleKeyword = 142, + NamespaceKeyword = 143, + NeverKeyword = 144, + OutKeyword = 145, + ReadonlyKeyword = 146, + RequireKeyword = 147, + NumberKeyword = 148, + ObjectKeyword = 149, + SatisfiesKeyword = 150, + SetKeyword = 151, + StringKeyword = 152, + SymbolKeyword = 153, + TypeKeyword = 154, + UndefinedKeyword = 155, + UniqueKeyword = 156, + UnknownKeyword = 157, + FromKeyword = 158, + GlobalKeyword = 159, + BigIntKeyword = 160, + OverrideKeyword = 161, + OfKeyword = 162, + QualifiedName = 163, + ComputedPropertyName = 164, + TypeParameter = 165, + Parameter = 166, + Decorator = 167, + PropertySignature = 168, + PropertyDeclaration = 169, + MethodSignature = 170, + MethodDeclaration = 171, + ClassStaticBlockDeclaration = 172, + Constructor = 173, + GetAccessor = 174, + SetAccessor = 175, + CallSignature = 176, + ConstructSignature = 177, + IndexSignature = 178, + TypePredicate = 179, + TypeReference = 180, + FunctionType = 181, + ConstructorType = 182, + TypeQuery = 183, + TypeLiteral = 184, + ArrayType = 185, + TupleType = 186, + OptionalType = 187, + RestType = 188, + UnionType = 189, + IntersectionType = 190, + ConditionalType = 191, + InferType = 192, + ParenthesizedType = 193, + ThisType = 194, + TypeOperator = 195, + IndexedAccessType = 196, + MappedType = 197, + LiteralType = 198, + NamedTupleMember = 199, + TemplateLiteralType = 200, + TemplateLiteralTypeSpan = 201, + ImportType = 202, + ObjectBindingPattern = 203, + ArrayBindingPattern = 204, + BindingElement = 205, + ArrayLiteralExpression = 206, + ObjectLiteralExpression = 207, + PropertyAccessExpression = 208, + ElementAccessExpression = 209, + CallExpression = 210, + NewExpression = 211, + TaggedTemplateExpression = 212, + TypeAssertionExpression = 213, + ParenthesizedExpression = 214, + FunctionExpression = 215, + ArrowFunction = 216, + DeleteExpression = 217, + TypeOfExpression = 218, + VoidExpression = 219, + AwaitExpression = 220, + PrefixUnaryExpression = 221, + PostfixUnaryExpression = 222, + BinaryExpression = 223, + ConditionalExpression = 224, + TemplateExpression = 225, + YieldExpression = 226, + SpreadElement = 227, + ClassExpression = 228, + OmittedExpression = 229, + ExpressionWithTypeArguments = 230, + AsExpression = 231, + NonNullExpression = 232, + MetaProperty = 233, + SyntheticExpression = 234, + SatisfiesExpression = 235, + TemplateSpan = 236, + SemicolonClassElement = 237, + Block = 238, + EmptyStatement = 239, + VariableStatement = 240, + ExpressionStatement = 241, + IfStatement = 242, + DoStatement = 243, + WhileStatement = 244, + ForStatement = 245, + ForInStatement = 246, + ForOfStatement = 247, + ContinueStatement = 248, + BreakStatement = 249, + ReturnStatement = 250, + WithStatement = 251, + SwitchStatement = 252, + LabeledStatement = 253, + ThrowStatement = 254, + TryStatement = 255, + DebuggerStatement = 256, + VariableDeclaration = 257, + VariableDeclarationList = 258, + FunctionDeclaration = 259, + ClassDeclaration = 260, + InterfaceDeclaration = 261, + TypeAliasDeclaration = 262, + EnumDeclaration = 263, + ModuleDeclaration = 264, + ModuleBlock = 265, + CaseBlock = 266, + NamespaceExportDeclaration = 267, + ImportEqualsDeclaration = 268, + ImportDeclaration = 269, + ImportClause = 270, + NamespaceImport = 271, + NamedImports = 272, + ImportSpecifier = 273, + ExportAssignment = 274, + ExportDeclaration = 275, + NamedExports = 276, + NamespaceExport = 277, + ExportSpecifier = 278, + MissingDeclaration = 279, + ExternalModuleReference = 280, + JsxElement = 281, + JsxSelfClosingElement = 282, + JsxOpeningElement = 283, + JsxClosingElement = 284, + JsxFragment = 285, + JsxOpeningFragment = 286, + JsxClosingFragment = 287, + JsxAttribute = 288, + JsxAttributes = 289, + JsxSpreadAttribute = 290, + JsxExpression = 291, + CaseClause = 292, + DefaultClause = 293, + HeritageClause = 294, + CatchClause = 295, + AssertClause = 296, + AssertEntry = 297, + ImportTypeAssertionContainer = 298, + PropertyAssignment = 299, + ShorthandPropertyAssignment = 300, + SpreadAssignment = 301, + EnumMember = 302, + UnparsedPrologue = 303, + UnparsedPrepend = 304, + UnparsedText = 305, + UnparsedInternalText = 306, + UnparsedSyntheticReference = 307, + SourceFile = 308, + Bundle = 309, + UnparsedSource = 310, + InputFiles = 311, + JSDocTypeExpression = 312, + JSDocNameReference = 313, + JSDocMemberName = 314, + JSDocAllType = 315, + JSDocUnknownType = 316, + JSDocNullableType = 317, + JSDocNonNullableType = 318, + JSDocOptionalType = 319, + JSDocFunctionType = 320, + JSDocVariadicType = 321, + JSDocNamepathType = 322, + JSDoc = 323, /** @deprecated Use SyntaxKind.JSDoc */ - JSDocComment = 320, - JSDocText = 321, - JSDocTypeLiteral = 322, - JSDocSignature = 323, - JSDocLink = 324, - JSDocLinkCode = 325, - JSDocLinkPlain = 326, - JSDocTag = 327, - JSDocAugmentsTag = 328, - JSDocImplementsTag = 329, - JSDocAuthorTag = 330, - JSDocDeprecatedTag = 331, - JSDocClassTag = 332, - JSDocPublicTag = 333, - JSDocPrivateTag = 334, - JSDocProtectedTag = 335, - JSDocReadonlyTag = 336, - JSDocOverrideTag = 337, - JSDocCallbackTag = 338, - JSDocEnumTag = 339, - JSDocParameterTag = 340, - JSDocReturnTag = 341, - JSDocThisTag = 342, - JSDocTypeTag = 343, - JSDocTemplateTag = 344, - JSDocTypedefTag = 345, - JSDocSeeTag = 346, - JSDocPropertyTag = 347, - SyntaxList = 348, - NotEmittedStatement = 349, - PartiallyEmittedExpression = 350, - CommaListExpression = 351, - MergeDeclarationMarker = 352, - EndOfDeclarationMarker = 353, - SyntheticReferenceExpression = 354, - Count = 355, + JSDocComment = 323, + JSDocText = 324, + JSDocTypeLiteral = 325, + JSDocSignature = 326, + JSDocLink = 327, + JSDocLinkCode = 328, + JSDocLinkPlain = 329, + JSDocTag = 330, + JSDocAugmentsTag = 331, + JSDocImplementsTag = 332, + JSDocAuthorTag = 333, + JSDocDeprecatedTag = 334, + JSDocClassTag = 335, + JSDocPublicTag = 336, + JSDocPrivateTag = 337, + JSDocProtectedTag = 338, + JSDocReadonlyTag = 339, + JSDocOverrideTag = 340, + JSDocCallbackTag = 341, + JSDocEnumTag = 342, + JSDocParameterTag = 343, + JSDocReturnTag = 344, + JSDocThisTag = 345, + JSDocTypeTag = 346, + JSDocTemplateTag = 347, + JSDocTypedefTag = 348, + JSDocSeeTag = 349, + JSDocPropertyTag = 350, + SyntaxList = 351, + NotEmittedStatement = 352, + PartiallyEmittedExpression = 353, + CommaListExpression = 354, + MergeDeclarationMarker = 355, + EndOfDeclarationMarker = 356, + SyntheticReferenceExpression = 357, + Count = 358, FirstAssignment = 63, LastAssignment = 78, FirstCompoundAssignment = 64, @@ -470,15 +473,15 @@ declare namespace ts { FirstReservedWord = 81, LastReservedWord = 116, FirstKeyword = 81, - LastKeyword = 160, + LastKeyword = 162, FirstFutureReservedWord = 117, LastFutureReservedWord = 125, - FirstTypeNode = 177, - LastTypeNode = 200, + FirstTypeNode = 179, + LastTypeNode = 202, FirstPunctuation = 18, LastPunctuation = 78, FirstToken = 0, - LastToken = 160, + LastToken = 162, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -487,20 +490,20 @@ declare namespace ts { LastTemplateToken = 17, FirstBinaryOperator = 29, LastBinaryOperator = 78, - FirstStatement = 237, - LastStatement = 253, - FirstNode = 161, - FirstJSDocNode = 309, - LastJSDocNode = 347, - FirstJSDocTagNode = 327, - LastJSDocTagNode = 347, + FirstStatement = 240, + LastStatement = 256, + FirstNode = 163, + FirstJSDocNode = 312, + LastJSDocNode = 350, + FirstJSDocTagNode = 330, + LastJSDocTagNode = 350, } export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; export type PseudoLiteralSyntaxKind = SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail; export type PunctuationSyntaxKind = SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.QuestionDotToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionQuestionToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.BacktickToken | SyntaxKind.HashToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken; - export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; - export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword; + export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SatisfiesKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; + export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword; export type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword; export type TokenSyntaxKind = SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | TriviaSyntaxKind | LiteralSyntaxKind | PseudoLiteralSyntaxKind | PunctuationSyntaxKind | SyntaxKind.Identifier | KeywordSyntaxKind; export type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken; @@ -545,9 +548,10 @@ declare namespace ts { Protected = 16, Static = 32, Readonly = 64, - Abstract = 128, - Async = 256, - Default = 512, + Accessor = 128, + Abstract = 256, + Async = 512, + Default = 1024, Const = 2048, HasComputedJSDocModifiers = 4096, Deprecated = 8192, @@ -559,10 +563,10 @@ declare namespace ts { AccessibilityModifier = 28, ParameterPropertyModifier = 16476, NonPublicAccessibilityModifier = 24, - TypeScriptModifier = 116958, - ExportDefault = 513, - All = 257023, - Modifier = 125951 + TypeScriptModifier = 117086, + ExportDefault = 1025, + All = 258047, + Modifier = 126975 } export enum JsxFlags { None = 0, @@ -618,6 +622,7 @@ declare namespace ts { export interface ModifierToken extends KeywordToken { } export type AbstractKeyword = ModifierToken; + export type AccessorKeyword = ModifierToken; export type AsyncKeyword = ModifierToken; export type ConstKeyword = ModifierToken; export type DeclareKeyword = ModifierToken; @@ -633,11 +638,11 @@ declare namespace ts { export type StaticKeyword = ModifierToken; /** @deprecated Use `ReadonlyKeyword` instead. */ export type ReadonlyToken = ReadonlyKeyword; - export type Modifier = AbstractKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword | DefaultKeyword | ExportKeyword | InKeyword | PrivateKeyword | ProtectedKeyword | PublicKeyword | OutKeyword | OverrideKeyword | ReadonlyKeyword | StaticKeyword; + export type Modifier = AbstractKeyword | AccessorKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword | DefaultKeyword | ExportKeyword | InKeyword | PrivateKeyword | ProtectedKeyword | PublicKeyword | OutKeyword | OverrideKeyword | ReadonlyKeyword | StaticKeyword; export type ModifierLike = Modifier | Decorator; export type AccessibilityModifier = PublicKeyword | PrivateKeyword | ProtectedKeyword; export type ParameterPropertyModifier = AccessibilityModifier | ReadonlyKeyword; - export type ClassMemberModifier = AccessibilityModifier | ReadonlyKeyword | StaticKeyword; + export type ClassMemberModifier = AccessibilityModifier | ReadonlyKeyword | StaticKeyword | AccessorKeyword; export type ModifiersArray = NodeArray; export enum GeneratedIdentifierFlags { None = 0, @@ -764,6 +769,9 @@ declare namespace ts { readonly type?: TypeNode; readonly initializer?: Expression; } + export interface AutoAccessorPropertyDeclaration extends PropertyDeclaration { + _autoAccessorBrand: any; + } export interface ObjectLiteralElement extends NamedDeclaration { _objectLiteralBrand: any; readonly name?: PropertyName; @@ -1340,6 +1348,11 @@ declare namespace ts { readonly type: TypeNode; readonly expression: UnaryExpression; } + export interface SatisfiesExpression extends Expression { + readonly kind: SyntaxKind.SatisfiesExpression; + readonly expression: Expression; + readonly type: TypeNode; + } export type AssertionExpression = TypeAssertion | AsExpression; export interface NonNullExpression extends LeftHandSideExpression { readonly kind: SyntaxKind.NonNullExpression; @@ -2316,6 +2329,7 @@ declare namespace ts { getPrivateIdentifierPropertyOfType(leftType: Type, name: string, location: Node): Symbol | undefined; getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo | undefined; getIndexInfosOfType(type: Type): readonly IndexInfo[]; + getIndexInfosOfIndexSymbol: (indexSymbol: Symbol) => IndexInfo[]; getSignaturesOfType(type: Type, kind: SignatureKind): readonly Signature[]; getIndexTypeOfType(type: Type, kind: IndexKind): Type | undefined; getBaseTypes(type: InterfaceType): BaseType[]; @@ -2562,6 +2576,7 @@ declare namespace ts { MethodExcludes = 103359, GetAccessorExcludes = 46015, SetAccessorExcludes = 78783, + AccessorExcludes = 13247, TypeParameterExcludes = 526824, TypeAliasExcludes = 788968, AliasExcludes = 2097152, @@ -2832,7 +2847,7 @@ declare namespace ts { export interface SubstitutionType extends InstantiableType { objectFlags: ObjectFlags; baseType: Type; - substitute: Type; + constraint: Type; } export enum SignatureKind { Call = 0, @@ -3387,7 +3402,7 @@ declare namespace ts { createNumericLiteral(value: string | number, numericLiteralFlags?: TokenFlags): NumericLiteral; createBigIntLiteral(value: string | PseudoBigInt): BigIntLiteral; createStringLiteral(text: string, isSingleQuote?: boolean): StringLiteral; - createStringLiteralFromNode(sourceNode: PropertyNameLiteral, isSingleQuote?: boolean): StringLiteral; + createStringLiteralFromNode(sourceNode: PropertyNameLiteral | PrivateIdentifier, isSingleQuote?: boolean): StringLiteral; createRegularExpressionLiteral(text: string): RegularExpressionLiteral; createIdentifier(text: string): Identifier; /** @@ -3412,6 +3427,8 @@ declare namespace ts { /** Create a unique name generated for a node. */ getGeneratedNameForNode(node: Node | undefined, flags?: GeneratedIdentifierFlags): Identifier; createPrivateIdentifier(text: string): PrivateIdentifier; + createUniquePrivateName(text?: string): PrivateIdentifier; + getGeneratedPrivateNameForNode(node: Node): PrivateIdentifier; createToken(token: SyntaxKind.SuperKeyword): SuperExpression; createToken(token: SyntaxKind.ThisKeyword): ThisExpression; createToken(token: SyntaxKind.NullKeyword): NullLiteral; @@ -3587,6 +3604,8 @@ declare namespace ts { updateNonNullChain(node: NonNullChain, expression: Expression): NonNullChain; createMetaProperty(keywordToken: MetaProperty["keywordToken"], name: Identifier): MetaProperty; updateMetaProperty(node: MetaProperty, name: Identifier): MetaProperty; + createSatisfiesExpression(expression: Expression, type: TypeNode): SatisfiesExpression; + updateSatisfiesExpression(node: SatisfiesExpression, expression: Expression, type: TypeNode): SatisfiesExpression; createTemplateSpan(expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; updateTemplateSpan(node: TemplateSpan, expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; createSemicolonClassElement(): SemicolonClassElement; @@ -3948,7 +3967,7 @@ declare namespace ts { (nodes: NodeArray, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray; (nodes: NodeArray | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray | undefined; } - export type VisitResult = T | T[] | undefined; + export type VisitResult = T | readonly T[] | undefined; export interface Printer { /** * Print a node and its subtree as-is, without any emit transformations. @@ -4515,6 +4534,7 @@ declare namespace ts { function isClassElement(node: Node): node is ClassElement; function isClassLike(node: Node): node is ClassLikeDeclaration; function isAccessor(node: Node): node is AccessorDeclaration; + function isAutoAccessorPropertyDeclaration(node: Node): node is AutoAccessorPropertyDeclaration; function isModifierLike(node: Node): node is ModifierLike; function isTypeElement(node: Node): node is TypeElement; function isClassOrTypeElement(node: Node): node is ClassElement | TypeElement; @@ -4716,6 +4736,7 @@ declare namespace ts { function isOmittedExpression(node: Node): node is OmittedExpression; function isExpressionWithTypeArguments(node: Node): node is ExpressionWithTypeArguments; function isAsExpression(node: Node): node is AsExpression; + function isSatisfiesExpression(node: Node): node is SatisfiesExpression; function isNonNullExpression(node: Node): node is NonNullExpression; function isMetaProperty(node: Node): node is MetaProperty; function isSyntheticExpression(node: Node): node is SyntheticExpression; @@ -6526,7 +6547,7 @@ declare namespace ts { isGlobalCompletion: boolean; isMemberCompletion: boolean; /** - * In the absence of `CompletionEntry["replacementSpan"], the editor may choose whether to use + * In the absence of `CompletionEntry["replacementSpan"]`, the editor may choose whether to use * this span or its default one. If `CompletionEntry["replacementSpan"]` is defined, that span * must be used to commit that completion entry. */ @@ -6739,6 +6760,8 @@ declare namespace ts { * interface Y { foo:number; } */ memberVariableElement = "property", + /** class X { [public|private]* accessor foo: number; } */ + memberAccessorVariableElement = "accessor", /** * class X { constructor() { } } * class X { static { } } @@ -10885,7 +10908,7 @@ declare namespace ts { (text: string, isSingleQuote?: boolean | undefined, hasExtendedUnicodeEscape?: boolean | undefined): StringLiteral; }; /** @deprecated Use `factory.createStringLiteralFromNode` or the factory supplied by your transformation context instead. */ - const createStringLiteralFromNode: (sourceNode: PropertyNameLiteral, isSingleQuote?: boolean | undefined) => StringLiteral; + const createStringLiteralFromNode: (sourceNode: PrivateIdentifier | PropertyNameLiteral, isSingleQuote?: boolean | undefined) => StringLiteral; /** @deprecated Use `factory.createRegularExpressionLiteral` or the factory supplied by your transformation context instead. */ const createRegularExpressionLiteral: (text: string) => RegularExpressionLiteral; /** @deprecated Use `factory.createLoopVariable` or the factory supplied by your transformation context instead. */ diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index 53b8c929ba8..899775079a6 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -100,210 +100,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -/* @internal */ -var ts; -(function (ts) { - function createMapData() { - var sentinel = {}; - sentinel.prev = sentinel; - return { head: sentinel, tail: sentinel, size: 0 }; - } - function createMapEntry(key, value) { - return { key: key, value: value, next: undefined, prev: undefined }; - } - function sameValueZero(x, y) { - // Treats -0 === 0 and NaN === NaN - return x === y || x !== x && y !== y; - } - function getPrev(entry) { - var prev = entry.prev; - // Entries without a 'prev' have been removed from the map. - // An entry whose 'prev' points to itself is the head of the list and is invalid here. - if (!prev || prev === entry) - throw new Error("Illegal state"); - return prev; - } - function getNext(entry) { - while (entry) { - // Entries without a 'prev' have been removed from the map. Their 'next' - // pointer should point to the previous entry prior to deletion and - // that entry should be skipped to resume iteration. - var skipNext = !entry.prev; - entry = entry.next; - if (skipNext) { - continue; - } - return entry; - } - } - function getEntry(data, key) { - // We walk backwards from 'tail' to prioritize recently added entries. - // We skip 'head' because it is an empty entry used to track iteration start. - for (var entry = data.tail; entry !== data.head; entry = getPrev(entry)) { - if (sameValueZero(entry.key, key)) { - return entry; - } - } - } - function addOrUpdateEntry(data, key, value) { - var existing = getEntry(data, key); - if (existing) { - existing.value = value; - return; - } - var entry = createMapEntry(key, value); - entry.prev = data.tail; - data.tail.next = entry; - data.tail = entry; - data.size++; - return entry; - } - function deleteEntry(data, key) { - // We walk backwards from 'tail' to prioritize recently added entries. - // We skip 'head' because it is an empty entry used to track iteration start. - for (var entry = data.tail; entry !== data.head; entry = getPrev(entry)) { - // all entries in the map should have a 'prev' pointer. - if (entry.prev === undefined) - throw new Error("Illegal state"); - if (sameValueZero(entry.key, key)) { - if (entry.next) { - entry.next.prev = entry.prev; - } - else { - // an entry in the map without a 'next' pointer must be the 'tail'. - if (data.tail !== entry) - throw new Error("Illegal state"); - data.tail = entry.prev; - } - entry.prev.next = entry.next; - entry.next = entry.prev; - entry.prev = undefined; - data.size--; - return entry; - } - } - } - function clearEntries(data) { - var node = data.tail; - while (node !== data.head) { - var prev = getPrev(node); - node.next = data.head; - node.prev = undefined; - node = prev; - } - data.head.next = undefined; - data.tail = data.head; - data.size = 0; - } - function forEachEntry(data, action) { - var entry = data.head; - while (entry) { - entry = getNext(entry); - if (entry) { - action(entry.value, entry.key); - } - } - } - function forEachIteration(iterator, action) { - if (iterator) { - for (var step = iterator.next(); !step.done; step = iterator.next()) { - action(step.value); - } - } - } - function createIteratorData(data, selector) { - return { current: data.head, selector: selector }; - } - function iteratorNext(data) { - // Navigate to the next entry. - data.current = getNext(data.current); - if (data.current) { - return { value: data.selector(data.current.key, data.current.value), done: false }; - } - else { - return { value: undefined, done: true }; - } - } - /* @internal */ - var ShimCollections; - (function (ShimCollections) { - function createMapShim(getIterator) { - var MapIterator = /** @class */ (function () { - function MapIterator(data, selector) { - this._data = createIteratorData(data, selector); - } - MapIterator.prototype.next = function () { return iteratorNext(this._data); }; - return MapIterator; - }()); - return /** @class */ (function () { - function Map(iterable) { - var _this = this; - this._mapData = createMapData(); - forEachIteration(getIterator(iterable), function (_a) { - var key = _a[0], value = _a[1]; - return _this.set(key, value); - }); - } - Object.defineProperty(Map.prototype, "size", { - get: function () { return this._mapData.size; }, - enumerable: false, - configurable: true - }); - Map.prototype.get = function (key) { var _a; return (_a = getEntry(this._mapData, key)) === null || _a === void 0 ? void 0 : _a.value; }; - Map.prototype.set = function (key, value) { return addOrUpdateEntry(this._mapData, key, value), this; }; - Map.prototype.has = function (key) { return !!getEntry(this._mapData, key); }; - Map.prototype.delete = function (key) { return !!deleteEntry(this._mapData, key); }; - Map.prototype.clear = function () { clearEntries(this._mapData); }; - Map.prototype.keys = function () { return new MapIterator(this._mapData, function (key, _value) { return key; }); }; - Map.prototype.values = function () { return new MapIterator(this._mapData, function (_key, value) { return value; }); }; - Map.prototype.entries = function () { return new MapIterator(this._mapData, function (key, value) { return [key, value]; }); }; - Map.prototype.forEach = function (action) { forEachEntry(this._mapData, action); }; - return Map; - }()); - } - ShimCollections.createMapShim = createMapShim; - function createSetShim(getIterator) { - var SetIterator = /** @class */ (function () { - function SetIterator(data, selector) { - this._data = createIteratorData(data, selector); - } - SetIterator.prototype.next = function () { return iteratorNext(this._data); }; - return SetIterator; - }()); - return /** @class */ (function () { - function Set(iterable) { - var _this = this; - this._mapData = createMapData(); - forEachIteration(getIterator(iterable), function (value) { return _this.add(value); }); - } - Object.defineProperty(Set.prototype, "size", { - get: function () { return this._mapData.size; }, - enumerable: false, - configurable: true - }); - Set.prototype.add = function (value) { return addOrUpdateEntry(this._mapData, value, value), this; }; - Set.prototype.has = function (value) { return !!getEntry(this._mapData, value); }; - Set.prototype.delete = function (value) { return !!deleteEntry(this._mapData, value); }; - Set.prototype.clear = function () { clearEntries(this._mapData); }; - Set.prototype.keys = function () { return new SetIterator(this._mapData, function (key, _value) { return key; }); }; - Set.prototype.values = function () { return new SetIterator(this._mapData, function (_key, value) { return value; }); }; - Set.prototype.entries = function () { return new SetIterator(this._mapData, function (key, value) { return [key, value]; }); }; - Set.prototype.forEach = function (action) { forEachEntry(this._mapData, action); }; - return Set; - }()); - } - ShimCollections.createSetShim = createSetShim; - })(ShimCollections = ts.ShimCollections || (ts.ShimCollections = {})); -})(ts || (ts = {})); var ts; (function (ts) { // WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values. // If changing the text in this section, be sure to test `configurePrerelease` too. - ts.versionMajorMinor = "4.8"; + ts.versionMajorMinor = "4.9"; // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types - ts.version = "4.8.3"; + ts.version = "".concat(ts.versionMajorMinor, ".0-beta"); /* @internal */ var Comparison; (function (Comparison) { @@ -324,8 +129,12 @@ var ts; function tryGetNativeMap() { // Internet Explorer's Map doesn't support iteration, so don't use it. var gMap = globals === null || globals === void 0 ? void 0 : globals.Map; - // eslint-disable-next-line no-in-operator - return typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; + // eslint-disable-next-line local/no-in-operator + var constructor = typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; + if (!constructor) { + throw new Error("No compatible Map implementation found."); + } + return constructor; } NativeCollections.tryGetNativeMap = tryGetNativeMap; /** @@ -334,24 +143,19 @@ var ts; function tryGetNativeSet() { // Internet Explorer's Set doesn't support iteration, so don't use it. var gSet = globals === null || globals === void 0 ? void 0 : globals.Set; - // eslint-disable-next-line no-in-operator - return typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; + // eslint-disable-next-line local/no-in-operator + var constructor = typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; + if (!constructor) { + throw new Error("No compatible Set implementation found."); + } + return constructor; } NativeCollections.tryGetNativeSet = tryGetNativeSet; })(NativeCollections || (NativeCollections = {})); /* @internal */ - ts.Map = getCollectionImplementation("Map", "tryGetNativeMap", "createMapShim"); + ts.Map = NativeCollections.tryGetNativeMap(); /* @internal */ - ts.Set = getCollectionImplementation("Set", "tryGetNativeSet", "createSetShim"); - /* @internal */ - function getCollectionImplementation(name, nativeFactory, shimFactory) { - var _a; - // NOTE: ts.ShimCollections will be defined for typescriptServices.js but not for tsc.js, so we must test for it. - var constructor = (_a = NativeCollections[nativeFactory]()) !== null && _a !== void 0 ? _a : ts.ShimCollections === null || ts.ShimCollections === void 0 ? void 0 : ts.ShimCollections[shimFactory](ts.getIterator); - if (constructor) - return constructor; - throw new Error("TypeScript requires an environment that provides a compatible native ".concat(name, " implementation.")); - } + ts.Set = NativeCollections.tryGetNativeSet(); })(ts || (ts = {})); /* @internal */ var ts; @@ -1067,15 +871,18 @@ var ts; function insertSorted(array, insert, compare, allowDuplicates) { if (array.length === 0) { array.push(insert); - return; + return true; } var insertIndex = binarySearch(array, insert, identity, compare); if (insertIndex < 0) { array.splice(~insertIndex, 0, insert); + return true; } - else if (allowDuplicates) { + if (allowDuplicates) { array.splice(insertIndex, 0, insert); + return true; } + return false; } ts.insertSorted = insertSorted; function sortAndDeduplicate(array, comparer, equalityComparer) { @@ -1355,6 +1162,13 @@ var ts; : undefined; } ts.singleOrUndefined = singleOrUndefined; + /** + * Returns the only element of an array if it contains only one element; throws otherwise. + */ + function single(array) { + return ts.Debug.checkDefined(singleOrUndefined(array)); + } + ts.single = single; function singleOrMany(array) { return array && array.length === 1 ? array[0] @@ -2878,7 +2692,7 @@ var ts; if (typeof func !== "function") { return ""; } - else if (func.hasOwnProperty("name")) { + else if (ts.hasProperty(func, "name")) { return func.name; } else { @@ -3028,7 +2842,7 @@ var ts; Debug.formatControlFlowGraph = formatControlFlowGraph; var flowNodeProto; function attachFlowNodeDebugInfoWorker(flowNode) { - if (!("__debugFlowFlags" in flowNode)) { // eslint-disable-line no-in-operator + if (!("__debugFlowFlags" in flowNode)) { // eslint-disable-line local/no-in-operator Object.defineProperties(flowNode, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { @@ -3074,7 +2888,7 @@ var ts; Debug.attachFlowNodeDebugInfo = attachFlowNodeDebugInfo; var nodeArrayProto; function attachNodeArrayDebugInfoWorker(array) { - if (!("__tsDebuggerDisplay" in array)) { // eslint-disable-line no-in-operator + if (!("__tsDebuggerDisplay" in array)) { // eslint-disable-line local/no-in-operator Object.defineProperties(array, { __tsDebuggerDisplay: { value: function (defaultValue) { @@ -3203,7 +3017,7 @@ var ts; ]; for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) { var ctor = nodeConstructors_1[_i]; - if (!ctor.prototype.hasOwnProperty("__debugKind")) { + if (!ts.hasProperty(ctor.prototype, "__debugKind")) { Object.defineProperties(ctor.prototype, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { @@ -3756,6 +3570,8 @@ var ts; typeof performance.mark === "function" && typeof performance.measure === "function" && typeof performance.now === "function" && + typeof performance.clearMarks === "function" && + typeof performance.clearMeasures === "function" && typeof PerformanceObserver === "function"; } function tryGetWebPerformanceHooks() { @@ -3800,7 +3616,9 @@ var ts; if (end === "__performance.measure-fix__") { nodePerformance_1.clearMarks("__performance.measure-fix__"); } - } + }, + clearMarks: function (name) { return nodePerformance_1.clearMarks(name); }, + clearMeasures: function (name) { return nodePerformance_1.clearMeasures(name); }, }; } return { @@ -3933,6 +3751,30 @@ var ts; durations.forEach(function (duration, measureName) { return cb(measureName, duration); }); } performance.forEachMeasure = forEachMeasure; + function forEachMark(cb) { + marks.forEach(function (_time, markName) { return cb(markName); }); + } + performance.forEachMark = forEachMark; + function clearMeasures(name) { + if (name !== undefined) + durations.delete(name); + else + durations.clear(); + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMeasures(name); + } + performance.clearMeasures = clearMeasures; + function clearMarks(name) { + if (name !== undefined) { + counts.delete(name); + marks.delete(name); + } + else { + counts.clear(); + marks.clear(); + } + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMarks(name); + } + performance.clearMarks = clearMarks; /** * Indicates whether the performance API is enabled. */ @@ -4030,7 +3872,6 @@ var ts; var typeCatalog = []; // NB: id is index + 1 var legendPath; var legend = []; - ; /** Starts tracing for the given project. */ function startTracing(tracingMode, traceDir, configFilePath) { ts.Debug.assert(!ts.tracing, "Tracing already started"); @@ -4235,7 +4076,7 @@ var ts; var substitutionType = type; substitutionProperties = { substitutionBaseType: (_o = substitutionType.baseType) === null || _o === void 0 ? void 0 : _o.id, - substituteType: (_p = substitutionType.substitute) === null || _p === void 0 ? void 0 : _p.id, + constraintType: (_p = substitutionType.constraint) === null || _p === void 0 ? void 0 : _p.id, }; } var reverseMappedProperties = {}; @@ -4435,257 +4276,260 @@ var ts; SyntaxKind[SyntaxKind["YieldKeyword"] = 125] = "YieldKeyword"; // Contextual keywords SyntaxKind[SyntaxKind["AbstractKeyword"] = 126] = "AbstractKeyword"; - SyntaxKind[SyntaxKind["AsKeyword"] = 127] = "AsKeyword"; - SyntaxKind[SyntaxKind["AssertsKeyword"] = 128] = "AssertsKeyword"; - SyntaxKind[SyntaxKind["AssertKeyword"] = 129] = "AssertKeyword"; - SyntaxKind[SyntaxKind["AnyKeyword"] = 130] = "AnyKeyword"; - SyntaxKind[SyntaxKind["AsyncKeyword"] = 131] = "AsyncKeyword"; - SyntaxKind[SyntaxKind["AwaitKeyword"] = 132] = "AwaitKeyword"; - SyntaxKind[SyntaxKind["BooleanKeyword"] = 133] = "BooleanKeyword"; - SyntaxKind[SyntaxKind["ConstructorKeyword"] = 134] = "ConstructorKeyword"; - SyntaxKind[SyntaxKind["DeclareKeyword"] = 135] = "DeclareKeyword"; - SyntaxKind[SyntaxKind["GetKeyword"] = 136] = "GetKeyword"; - SyntaxKind[SyntaxKind["InferKeyword"] = 137] = "InferKeyword"; - SyntaxKind[SyntaxKind["IntrinsicKeyword"] = 138] = "IntrinsicKeyword"; - SyntaxKind[SyntaxKind["IsKeyword"] = 139] = "IsKeyword"; - SyntaxKind[SyntaxKind["KeyOfKeyword"] = 140] = "KeyOfKeyword"; - SyntaxKind[SyntaxKind["ModuleKeyword"] = 141] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["NamespaceKeyword"] = 142] = "NamespaceKeyword"; - SyntaxKind[SyntaxKind["NeverKeyword"] = 143] = "NeverKeyword"; - SyntaxKind[SyntaxKind["OutKeyword"] = 144] = "OutKeyword"; - SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 145] = "ReadonlyKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 146] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 147] = "NumberKeyword"; - SyntaxKind[SyntaxKind["ObjectKeyword"] = 148] = "ObjectKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 149] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 150] = "StringKeyword"; - SyntaxKind[SyntaxKind["SymbolKeyword"] = 151] = "SymbolKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 152] = "TypeKeyword"; - SyntaxKind[SyntaxKind["UndefinedKeyword"] = 153] = "UndefinedKeyword"; - SyntaxKind[SyntaxKind["UniqueKeyword"] = 154] = "UniqueKeyword"; - SyntaxKind[SyntaxKind["UnknownKeyword"] = 155] = "UnknownKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 156] = "FromKeyword"; - SyntaxKind[SyntaxKind["GlobalKeyword"] = 157] = "GlobalKeyword"; - SyntaxKind[SyntaxKind["BigIntKeyword"] = 158] = "BigIntKeyword"; - SyntaxKind[SyntaxKind["OverrideKeyword"] = 159] = "OverrideKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 160] = "OfKeyword"; + SyntaxKind[SyntaxKind["AccessorKeyword"] = 127] = "AccessorKeyword"; + SyntaxKind[SyntaxKind["AsKeyword"] = 128] = "AsKeyword"; + SyntaxKind[SyntaxKind["AssertsKeyword"] = 129] = "AssertsKeyword"; + SyntaxKind[SyntaxKind["AssertKeyword"] = 130] = "AssertKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 131] = "AnyKeyword"; + SyntaxKind[SyntaxKind["AsyncKeyword"] = 132] = "AsyncKeyword"; + SyntaxKind[SyntaxKind["AwaitKeyword"] = 133] = "AwaitKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 134] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 135] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 136] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 137] = "GetKeyword"; + SyntaxKind[SyntaxKind["InferKeyword"] = 138] = "InferKeyword"; + SyntaxKind[SyntaxKind["IntrinsicKeyword"] = 139] = "IntrinsicKeyword"; + SyntaxKind[SyntaxKind["IsKeyword"] = 140] = "IsKeyword"; + SyntaxKind[SyntaxKind["KeyOfKeyword"] = 141] = "KeyOfKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 142] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["NamespaceKeyword"] = 143] = "NamespaceKeyword"; + SyntaxKind[SyntaxKind["NeverKeyword"] = 144] = "NeverKeyword"; + SyntaxKind[SyntaxKind["OutKeyword"] = 145] = "OutKeyword"; + SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 146] = "ReadonlyKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 147] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 148] = "NumberKeyword"; + SyntaxKind[SyntaxKind["ObjectKeyword"] = 149] = "ObjectKeyword"; + SyntaxKind[SyntaxKind["SatisfiesKeyword"] = 150] = "SatisfiesKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 151] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 152] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 153] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 154] = "TypeKeyword"; + SyntaxKind[SyntaxKind["UndefinedKeyword"] = 155] = "UndefinedKeyword"; + SyntaxKind[SyntaxKind["UniqueKeyword"] = 156] = "UniqueKeyword"; + SyntaxKind[SyntaxKind["UnknownKeyword"] = 157] = "UnknownKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 158] = "FromKeyword"; + SyntaxKind[SyntaxKind["GlobalKeyword"] = 159] = "GlobalKeyword"; + SyntaxKind[SyntaxKind["BigIntKeyword"] = 160] = "BigIntKeyword"; + SyntaxKind[SyntaxKind["OverrideKeyword"] = 161] = "OverrideKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 162] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 161] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 162] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 163] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 164] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 163] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 164] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 165] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 165] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 166] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 167] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 166] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 167] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 168] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 169] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["ClassStaticBlockDeclaration"] = 170] = "ClassStaticBlockDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 171] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 172] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 173] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 174] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 175] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 176] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 168] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 169] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 170] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 171] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["ClassStaticBlockDeclaration"] = 172] = "ClassStaticBlockDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 173] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 174] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 175] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 176] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 177] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 178] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypePredicate"] = 177] = "TypePredicate"; - SyntaxKind[SyntaxKind["TypeReference"] = 178] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 179] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 180] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 181] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 182] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 183] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 184] = "TupleType"; - SyntaxKind[SyntaxKind["OptionalType"] = 185] = "OptionalType"; - SyntaxKind[SyntaxKind["RestType"] = 186] = "RestType"; - SyntaxKind[SyntaxKind["UnionType"] = 187] = "UnionType"; - SyntaxKind[SyntaxKind["IntersectionType"] = 188] = "IntersectionType"; - SyntaxKind[SyntaxKind["ConditionalType"] = 189] = "ConditionalType"; - SyntaxKind[SyntaxKind["InferType"] = 190] = "InferType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 191] = "ParenthesizedType"; - SyntaxKind[SyntaxKind["ThisType"] = 192] = "ThisType"; - SyntaxKind[SyntaxKind["TypeOperator"] = 193] = "TypeOperator"; - SyntaxKind[SyntaxKind["IndexedAccessType"] = 194] = "IndexedAccessType"; - SyntaxKind[SyntaxKind["MappedType"] = 195] = "MappedType"; - SyntaxKind[SyntaxKind["LiteralType"] = 196] = "LiteralType"; - SyntaxKind[SyntaxKind["NamedTupleMember"] = 197] = "NamedTupleMember"; - SyntaxKind[SyntaxKind["TemplateLiteralType"] = 198] = "TemplateLiteralType"; - SyntaxKind[SyntaxKind["TemplateLiteralTypeSpan"] = 199] = "TemplateLiteralTypeSpan"; - SyntaxKind[SyntaxKind["ImportType"] = 200] = "ImportType"; + SyntaxKind[SyntaxKind["TypePredicate"] = 179] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 180] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 181] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 182] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 183] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 184] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 185] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 186] = "TupleType"; + SyntaxKind[SyntaxKind["OptionalType"] = 187] = "OptionalType"; + SyntaxKind[SyntaxKind["RestType"] = 188] = "RestType"; + SyntaxKind[SyntaxKind["UnionType"] = 189] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 190] = "IntersectionType"; + SyntaxKind[SyntaxKind["ConditionalType"] = 191] = "ConditionalType"; + SyntaxKind[SyntaxKind["InferType"] = 192] = "InferType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 193] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ThisType"] = 194] = "ThisType"; + SyntaxKind[SyntaxKind["TypeOperator"] = 195] = "TypeOperator"; + SyntaxKind[SyntaxKind["IndexedAccessType"] = 196] = "IndexedAccessType"; + SyntaxKind[SyntaxKind["MappedType"] = 197] = "MappedType"; + SyntaxKind[SyntaxKind["LiteralType"] = 198] = "LiteralType"; + SyntaxKind[SyntaxKind["NamedTupleMember"] = 199] = "NamedTupleMember"; + SyntaxKind[SyntaxKind["TemplateLiteralType"] = 200] = "TemplateLiteralType"; + SyntaxKind[SyntaxKind["TemplateLiteralTypeSpan"] = 201] = "TemplateLiteralTypeSpan"; + SyntaxKind[SyntaxKind["ImportType"] = 202] = "ImportType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 201] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 202] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 203] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 203] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 204] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 205] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 204] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 205] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 206] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 207] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 208] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 209] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 210] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 211] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 212] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 213] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 214] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 215] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 216] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 217] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 218] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 219] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 220] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 221] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 222] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 223] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 224] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElement"] = 225] = "SpreadElement"; - SyntaxKind[SyntaxKind["ClassExpression"] = 226] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 227] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 228] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 229] = "AsExpression"; - SyntaxKind[SyntaxKind["NonNullExpression"] = 230] = "NonNullExpression"; - SyntaxKind[SyntaxKind["MetaProperty"] = 231] = "MetaProperty"; - SyntaxKind[SyntaxKind["SyntheticExpression"] = 232] = "SyntheticExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 206] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 207] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 208] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 209] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 210] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 211] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 212] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 213] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 214] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 215] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 216] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 217] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 218] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 219] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 220] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 221] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 222] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 223] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 224] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 225] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 226] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElement"] = 227] = "SpreadElement"; + SyntaxKind[SyntaxKind["ClassExpression"] = 228] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 229] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 230] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 231] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 232] = "NonNullExpression"; + SyntaxKind[SyntaxKind["MetaProperty"] = 233] = "MetaProperty"; + SyntaxKind[SyntaxKind["SyntheticExpression"] = 234] = "SyntheticExpression"; + SyntaxKind[SyntaxKind["SatisfiesExpression"] = 235] = "SatisfiesExpression"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 233] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 234] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 236] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 237] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 235] = "Block"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 236] = "EmptyStatement"; - SyntaxKind[SyntaxKind["VariableStatement"] = 237] = "VariableStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 238] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 239] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 240] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 241] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 242] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 243] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 244] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 245] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 246] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 247] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 248] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 249] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 250] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 251] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 252] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 253] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 254] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 255] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 256] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 257] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 258] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 259] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 260] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 261] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 262] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 263] = "CaseBlock"; - SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 264] = "NamespaceExportDeclaration"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 265] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 266] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 267] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 268] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 269] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 270] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 271] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 272] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 273] = "NamedExports"; - SyntaxKind[SyntaxKind["NamespaceExport"] = 274] = "NamespaceExport"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 275] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 276] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 238] = "Block"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 239] = "EmptyStatement"; + SyntaxKind[SyntaxKind["VariableStatement"] = 240] = "VariableStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 241] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 242] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 243] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 244] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 245] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 246] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 247] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 248] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 249] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 250] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 251] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 252] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 253] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 254] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 255] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 256] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 257] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 258] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 259] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 260] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 261] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 262] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 263] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 264] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 265] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 266] = "CaseBlock"; + SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 267] = "NamespaceExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 268] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 269] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 270] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 271] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 272] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 273] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 274] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 275] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 276] = "NamedExports"; + SyntaxKind[SyntaxKind["NamespaceExport"] = 277] = "NamespaceExport"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 278] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 279] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 277] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 280] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 278] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 279] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 280] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 281] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxFragment"] = 282] = "JsxFragment"; - SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 283] = "JsxOpeningFragment"; - SyntaxKind[SyntaxKind["JsxClosingFragment"] = 284] = "JsxClosingFragment"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 285] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxAttributes"] = 286] = "JsxAttributes"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 287] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 288] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 281] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 282] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 283] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 284] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxFragment"] = 285] = "JsxFragment"; + SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 286] = "JsxOpeningFragment"; + SyntaxKind[SyntaxKind["JsxClosingFragment"] = 287] = "JsxClosingFragment"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 288] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxAttributes"] = 289] = "JsxAttributes"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 290] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 291] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 289] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 290] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 291] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 292] = "CatchClause"; - SyntaxKind[SyntaxKind["AssertClause"] = 293] = "AssertClause"; - SyntaxKind[SyntaxKind["AssertEntry"] = 294] = "AssertEntry"; - SyntaxKind[SyntaxKind["ImportTypeAssertionContainer"] = 295] = "ImportTypeAssertionContainer"; + SyntaxKind[SyntaxKind["CaseClause"] = 292] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 293] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 294] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 295] = "CatchClause"; + SyntaxKind[SyntaxKind["AssertClause"] = 296] = "AssertClause"; + SyntaxKind[SyntaxKind["AssertEntry"] = 297] = "AssertEntry"; + SyntaxKind[SyntaxKind["ImportTypeAssertionContainer"] = 298] = "ImportTypeAssertionContainer"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 296] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 297] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 298] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 299] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 300] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 301] = "SpreadAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 299] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 302] = "EnumMember"; // Unparsed - SyntaxKind[SyntaxKind["UnparsedPrologue"] = 300] = "UnparsedPrologue"; - SyntaxKind[SyntaxKind["UnparsedPrepend"] = 301] = "UnparsedPrepend"; - SyntaxKind[SyntaxKind["UnparsedText"] = 302] = "UnparsedText"; - SyntaxKind[SyntaxKind["UnparsedInternalText"] = 303] = "UnparsedInternalText"; - SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 304] = "UnparsedSyntheticReference"; + SyntaxKind[SyntaxKind["UnparsedPrologue"] = 303] = "UnparsedPrologue"; + SyntaxKind[SyntaxKind["UnparsedPrepend"] = 304] = "UnparsedPrepend"; + SyntaxKind[SyntaxKind["UnparsedText"] = 305] = "UnparsedText"; + SyntaxKind[SyntaxKind["UnparsedInternalText"] = 306] = "UnparsedInternalText"; + SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 307] = "UnparsedSyntheticReference"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 305] = "SourceFile"; - SyntaxKind[SyntaxKind["Bundle"] = 306] = "Bundle"; - SyntaxKind[SyntaxKind["UnparsedSource"] = 307] = "UnparsedSource"; - SyntaxKind[SyntaxKind["InputFiles"] = 308] = "InputFiles"; + SyntaxKind[SyntaxKind["SourceFile"] = 308] = "SourceFile"; + SyntaxKind[SyntaxKind["Bundle"] = 309] = "Bundle"; + SyntaxKind[SyntaxKind["UnparsedSource"] = 310] = "UnparsedSource"; + SyntaxKind[SyntaxKind["InputFiles"] = 311] = "InputFiles"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 309] = "JSDocTypeExpression"; - SyntaxKind[SyntaxKind["JSDocNameReference"] = 310] = "JSDocNameReference"; - SyntaxKind[SyntaxKind["JSDocMemberName"] = 311] = "JSDocMemberName"; - SyntaxKind[SyntaxKind["JSDocAllType"] = 312] = "JSDocAllType"; - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 313] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 314] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 315] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 316] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 317] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 318] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocNamepathType"] = 319] = "JSDocNamepathType"; - SyntaxKind[SyntaxKind["JSDoc"] = 320] = "JSDoc"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 312] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocNameReference"] = 313] = "JSDocNameReference"; + SyntaxKind[SyntaxKind["JSDocMemberName"] = 314] = "JSDocMemberName"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 315] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 316] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 317] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 318] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 319] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 320] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 321] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocNamepathType"] = 322] = "JSDocNamepathType"; + SyntaxKind[SyntaxKind["JSDoc"] = 323] = "JSDoc"; /** @deprecated Use SyntaxKind.JSDoc */ - SyntaxKind[SyntaxKind["JSDocComment"] = 320] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocText"] = 321] = "JSDocText"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 322] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocSignature"] = 323] = "JSDocSignature"; - SyntaxKind[SyntaxKind["JSDocLink"] = 324] = "JSDocLink"; - SyntaxKind[SyntaxKind["JSDocLinkCode"] = 325] = "JSDocLinkCode"; - SyntaxKind[SyntaxKind["JSDocLinkPlain"] = 326] = "JSDocLinkPlain"; - SyntaxKind[SyntaxKind["JSDocTag"] = 327] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 328] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocImplementsTag"] = 329] = "JSDocImplementsTag"; - SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 330] = "JSDocAuthorTag"; - SyntaxKind[SyntaxKind["JSDocDeprecatedTag"] = 331] = "JSDocDeprecatedTag"; - SyntaxKind[SyntaxKind["JSDocClassTag"] = 332] = "JSDocClassTag"; - SyntaxKind[SyntaxKind["JSDocPublicTag"] = 333] = "JSDocPublicTag"; - SyntaxKind[SyntaxKind["JSDocPrivateTag"] = 334] = "JSDocPrivateTag"; - SyntaxKind[SyntaxKind["JSDocProtectedTag"] = 335] = "JSDocProtectedTag"; - SyntaxKind[SyntaxKind["JSDocReadonlyTag"] = 336] = "JSDocReadonlyTag"; - SyntaxKind[SyntaxKind["JSDocOverrideTag"] = 337] = "JSDocOverrideTag"; - SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 338] = "JSDocCallbackTag"; - SyntaxKind[SyntaxKind["JSDocEnumTag"] = 339] = "JSDocEnumTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 340] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 341] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocThisTag"] = 342] = "JSDocThisTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 343] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 344] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 345] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocSeeTag"] = 346] = "JSDocSeeTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 347] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocComment"] = 323] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocText"] = 324] = "JSDocText"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 325] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocSignature"] = 326] = "JSDocSignature"; + SyntaxKind[SyntaxKind["JSDocLink"] = 327] = "JSDocLink"; + SyntaxKind[SyntaxKind["JSDocLinkCode"] = 328] = "JSDocLinkCode"; + SyntaxKind[SyntaxKind["JSDocLinkPlain"] = 329] = "JSDocLinkPlain"; + SyntaxKind[SyntaxKind["JSDocTag"] = 330] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 331] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocImplementsTag"] = 332] = "JSDocImplementsTag"; + SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 333] = "JSDocAuthorTag"; + SyntaxKind[SyntaxKind["JSDocDeprecatedTag"] = 334] = "JSDocDeprecatedTag"; + SyntaxKind[SyntaxKind["JSDocClassTag"] = 335] = "JSDocClassTag"; + SyntaxKind[SyntaxKind["JSDocPublicTag"] = 336] = "JSDocPublicTag"; + SyntaxKind[SyntaxKind["JSDocPrivateTag"] = 337] = "JSDocPrivateTag"; + SyntaxKind[SyntaxKind["JSDocProtectedTag"] = 338] = "JSDocProtectedTag"; + SyntaxKind[SyntaxKind["JSDocReadonlyTag"] = 339] = "JSDocReadonlyTag"; + SyntaxKind[SyntaxKind["JSDocOverrideTag"] = 340] = "JSDocOverrideTag"; + SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 341] = "JSDocCallbackTag"; + SyntaxKind[SyntaxKind["JSDocEnumTag"] = 342] = "JSDocEnumTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 343] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 344] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocThisTag"] = 345] = "JSDocThisTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 346] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 347] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 348] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocSeeTag"] = 349] = "JSDocSeeTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 350] = "JSDocPropertyTag"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 348] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 351] = "SyntaxList"; // Transformation nodes - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 349] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 350] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["CommaListExpression"] = 351] = "CommaListExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 352] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 353] = "EndOfDeclarationMarker"; - SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 354] = "SyntheticReferenceExpression"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 352] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 353] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["CommaListExpression"] = 354] = "CommaListExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 355] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 356] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 357] = "SyntheticReferenceExpression"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 355] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 358] = "Count"; // Markers SyntaxKind[SyntaxKind["FirstAssignment"] = 63] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 78] = "LastAssignment"; @@ -4694,15 +4538,15 @@ var ts; SyntaxKind[SyntaxKind["FirstReservedWord"] = 81] = "FirstReservedWord"; SyntaxKind[SyntaxKind["LastReservedWord"] = 116] = "LastReservedWord"; SyntaxKind[SyntaxKind["FirstKeyword"] = 81] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 160] = "LastKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 162] = "LastKeyword"; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 117] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 125] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 177] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 200] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 179] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 202] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 18] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 78] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 160] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 162] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; @@ -4711,15 +4555,15 @@ var ts; SyntaxKind[SyntaxKind["LastTemplateToken"] = 17] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 29] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 78] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstStatement"] = 237] = "FirstStatement"; - SyntaxKind[SyntaxKind["LastStatement"] = 253] = "LastStatement"; - SyntaxKind[SyntaxKind["FirstNode"] = 161] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 309] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 347] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 327] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 347] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstStatement"] = 240] = "FirstStatement"; + SyntaxKind[SyntaxKind["LastStatement"] = 256] = "LastStatement"; + SyntaxKind[SyntaxKind["FirstNode"] = 163] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 312] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 350] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 330] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 350] = "LastJSDocTagNode"; /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 126] = "FirstContextualKeyword"; - /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 160] = "LastContextualKeyword"; + /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 162] = "LastContextualKeyword"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); var NodeFlags; (function (NodeFlags) { @@ -4784,9 +4628,10 @@ var ts; ModifierFlags[ModifierFlags["Protected"] = 16] = "Protected"; ModifierFlags[ModifierFlags["Static"] = 32] = "Static"; ModifierFlags[ModifierFlags["Readonly"] = 64] = "Readonly"; - ModifierFlags[ModifierFlags["Abstract"] = 128] = "Abstract"; - ModifierFlags[ModifierFlags["Async"] = 256] = "Async"; - ModifierFlags[ModifierFlags["Default"] = 512] = "Default"; + ModifierFlags[ModifierFlags["Accessor"] = 128] = "Accessor"; + ModifierFlags[ModifierFlags["Abstract"] = 256] = "Abstract"; + ModifierFlags[ModifierFlags["Async"] = 512] = "Async"; + ModifierFlags[ModifierFlags["Default"] = 1024] = "Default"; ModifierFlags[ModifierFlags["Const"] = 2048] = "Const"; ModifierFlags[ModifierFlags["HasComputedJSDocModifiers"] = 4096] = "HasComputedJSDocModifiers"; ModifierFlags[ModifierFlags["Deprecated"] = 8192] = "Deprecated"; @@ -4799,10 +4644,10 @@ var ts; // Accessibility modifiers and 'readonly' can be attached to a parameter in a constructor to make it a property. ModifierFlags[ModifierFlags["ParameterPropertyModifier"] = 16476] = "ParameterPropertyModifier"; ModifierFlags[ModifierFlags["NonPublicAccessibilityModifier"] = 24] = "NonPublicAccessibilityModifier"; - ModifierFlags[ModifierFlags["TypeScriptModifier"] = 116958] = "TypeScriptModifier"; - ModifierFlags[ModifierFlags["ExportDefault"] = 513] = "ExportDefault"; - ModifierFlags[ModifierFlags["All"] = 257023] = "All"; - ModifierFlags[ModifierFlags["Modifier"] = 125951] = "Modifier"; + ModifierFlags[ModifierFlags["TypeScriptModifier"] = 117086] = "TypeScriptModifier"; + ModifierFlags[ModifierFlags["ExportDefault"] = 1025] = "ExportDefault"; + ModifierFlags[ModifierFlags["All"] = 258047] = "All"; + ModifierFlags[ModifierFlags["Modifier"] = 126975] = "Modifier"; })(ModifierFlags = ts.ModifierFlags || (ts.ModifierFlags = {})); var JsxFlags; (function (JsxFlags) { @@ -4998,6 +4843,7 @@ var ts; NodeBuilderFlags[NodeBuilderFlags["AllowEmptyTuple"] = 524288] = "AllowEmptyTuple"; NodeBuilderFlags[NodeBuilderFlags["AllowUniqueESSymbolType"] = 1048576] = "AllowUniqueESSymbolType"; NodeBuilderFlags[NodeBuilderFlags["AllowEmptyIndexInfoType"] = 2097152] = "AllowEmptyIndexInfoType"; + /* @internal */ NodeBuilderFlags[NodeBuilderFlags["WriteComputedProps"] = 1073741824] = "WriteComputedProps"; // Errors (cont.) NodeBuilderFlags[NodeBuilderFlags["AllowNodeModulesRelativePaths"] = 67108864] = "AllowNodeModulesRelativePaths"; /* @internal */ NodeBuilderFlags[NodeBuilderFlags["DoNotIncludeSymbolChain"] = 134217728] = "DoNotIncludeSymbolChain"; @@ -5058,8 +4904,10 @@ var ts; SymbolFormatFlags[SymbolFormatFlags["AllowAnyNodeKind"] = 4] = "AllowAnyNodeKind"; // Prefer aliases which are not directly visible SymbolFormatFlags[SymbolFormatFlags["UseAliasDefinedOutsideCurrentScope"] = 8] = "UseAliasDefinedOutsideCurrentScope"; + // { [E.A]: 1 } + /* @internal */ SymbolFormatFlags[SymbolFormatFlags["WriteComputedProps"] = 16] = "WriteComputedProps"; // Skip building an accessible symbol chain - /* @internal */ SymbolFormatFlags[SymbolFormatFlags["DoNotIncludeSymbolChain"] = 16] = "DoNotIncludeSymbolChain"; + /* @internal */ SymbolFormatFlags[SymbolFormatFlags["DoNotIncludeSymbolChain"] = 32] = "DoNotIncludeSymbolChain"; })(SymbolFormatFlags = ts.SymbolFormatFlags || (ts.SymbolFormatFlags = {})); /* @internal */ var SymbolAccessibility; @@ -5173,6 +5021,7 @@ var ts; SymbolFlags[SymbolFlags["MethodExcludes"] = 103359] = "MethodExcludes"; SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 46015] = "GetAccessorExcludes"; SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 78783] = "SetAccessorExcludes"; + SymbolFlags[SymbolFlags["AccessorExcludes"] = 13247] = "AccessorExcludes"; SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 526824] = "TypeParameterExcludes"; SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 788968] = "TypeAliasExcludes"; SymbolFlags[SymbolFlags["AliasExcludes"] = 2097152] = "AliasExcludes"; @@ -6299,7 +6148,6 @@ var ts; var pollingChunkSize = createPollingIntervalBasedLevels(defaultChunkLevels); /* @internal */ ts.unchangedPollThresholds = createPollingIntervalBasedLevels(defaultChunkLevels); - /* @internal */ function setCustomPollingValues(system) { if (!system.getEnvironmentVariable) { return; @@ -6342,7 +6190,6 @@ var ts; createPollingIntervalBasedLevels(customLevels ? __assign(__assign({}, defaultLevels), customLevels) : defaultLevels); } } - ts.setCustomPollingValues = setCustomPollingValues; function pollWatchedFileQueue(host, queue, pollIndex, chunkSize, callbackOnWatchFileStat) { var definedValueCopyToIndex = pollIndex; // Max visit would be all elements of the queue @@ -6388,7 +6235,6 @@ var ts; } } } - /* @internal */ function createDynamicPriorityPollingWatchFile(host) { var watchedFiles = []; var changedFilesInLastPoll = []; @@ -6497,7 +6343,6 @@ var ts; pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === PollingInterval.Low ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval)); } } - ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile; function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) { // One file can have multiple watchers var fileWatcherCallbacks = ts.createMultiMap(); @@ -6576,42 +6421,38 @@ var ts; pollScheduled = host.setTimeout(pollQueue, PollingInterval.High); } } - /* @internal */ - function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) { - var cache = new ts.Map(); - var callbacksCache = ts.createMultiMap(); + function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) { var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); - return function (fileName, callback, pollingInterval, options) { - var path = toCanonicalFileName(fileName); - var existing = cache.get(path); - if (existing) { - existing.refCount++; + var path = toCanonicalFileName(name); + var existing = cache.get(path); + if (existing) { + existing.callbacks.push(callback); + } + else { + cache.set(path, { + watcher: createWatcher(( + // Cant infer types correctly so lets satisfy checker + function (param1, param2, param3) { var _a; return (_a = cache.get(path)) === null || _a === void 0 ? void 0 : _a.callbacks.slice().forEach(function (cb) { return cb(param1, param2, param3); }); })), + callbacks: [callback] + }); + } + return { + close: function () { + var watcher = cache.get(path); + // Watcher is not expected to be undefined, but if it is normally its because + // exception was thrown somewhere else and watch state is not what it should be + if (!watcher) + return; + if (!ts.orderedRemoveItem(watcher.callbacks, callback) || watcher.callbacks.length) + return; + cache.delete(path); + ts.closeFileWatcherOf(watcher); } - else { - cache.set(path, { - watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options), - refCount: 1 - }); - } - callbacksCache.add(path, callback); - return { - close: function () { - var watcher = ts.Debug.checkDefined(cache.get(path)); - callbacksCache.remove(path, callback); - watcher.refCount--; - if (watcher.refCount) - return; - cache.delete(path); - ts.closeFileWatcherOf(watcher); - } - }; }; } - ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName; /** * Returns true if file status changed */ - /*@internal*/ function onWatchedFileStat(watchedFile, modifiedTime) { var oldTime = watchedFile.mtime.getTime(); var newTime = modifiedTime.getTime(); @@ -6623,7 +6464,6 @@ var ts; } return false; } - ts.onWatchedFileStat = onWatchedFileStat; /*@internal*/ function getFileWatcherEventKind(oldTime, newTime) { return oldTime === 0 @@ -6651,7 +6491,6 @@ var ts; * that means if this is recursive watcher, watch the children directories as well * (eg on OS that dont support recursive watch using fs.watch use fs.watchFile) */ - /*@internal*/ function createDirectoryWatcherSupportingRecursive(_a) { var watchDirectory = _a.watchDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, fileSystemEntryExists = _a.fileSystemEntryExists, realpath = _a.realpath, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout; var cache = new ts.Map(); @@ -6860,18 +6699,15 @@ var ts; return ts.stringContains(toCanonicalFilePath(path), searchPath); } } - ts.createDirectoryWatcherSupportingRecursive = createDirectoryWatcherSupportingRecursive; /*@internal*/ var FileSystemEntryKind; (function (FileSystemEntryKind) { FileSystemEntryKind[FileSystemEntryKind["File"] = 0] = "File"; FileSystemEntryKind[FileSystemEntryKind["Directory"] = 1] = "Directory"; })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {})); - /*@internal*/ function createFileWatcherCallback(callback) { return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); }; } - ts.createFileWatcherCallback = createFileWatcherCallback; function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) { return function (eventName, _relativeFileName, modifiedTime) { if (eventName === "rename") { @@ -6905,7 +6741,10 @@ var ts; } /*@internal*/ function createSystemWatchFunctions(_a) { - var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog; + var pollingWatchFileWorker = _a.pollingWatchFileWorker, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog; + var pollingWatches = new ts.Map(); + var fsWatches = new ts.Map(); + var fsWatchesRecursive = new ts.Map(); var dynamicPollingWatchFile; var fixedChunkSizePollingWatchFile; var nonPollingWatchFile; @@ -6969,7 +6808,7 @@ var ts; // Use notifications from FS to watch with falling back to fs.watchFile generateWatchFileOptions(ts.WatchFileKind.UseFsEventsOnParentDirectory, ts.PollingWatchKind.PriorityInterval, options) : // Default to do not use fixed polling interval - { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.FixedPollingInterval }; + { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.UseFsEvents }; } } function generateWatchFileOptions(watchFile, fallbackPolling, options) { @@ -7040,7 +6879,13 @@ var ts; }; } } + function pollingWatchFile(fileName, callback, pollingInterval, options) { + return createSingleWatcherPerName(pollingWatches, useCaseSensitiveFileNames, fileName, callback, function (cb) { return pollingWatchFileWorker(fileName, cb, pollingInterval, options); }); + } function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { + return createSingleWatcherPerName(recursive ? fsWatchesRecursive : fsWatches, useCaseSensitiveFileNames, fileOrDirectory, callback, function (cb) { return fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, cb, recursive, fallbackPollingInterval, fallbackOptions); }); + } + function fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { var lastDirectoryPartWithDirectorySeparator; var lastDirectoryPart; if (inodeWatching) { @@ -7219,7 +7064,7 @@ var ts; var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin"); var getCurrentDirectory = ts.memoize(function () { return process.cwd(); }); var _b = createSystemWatchFunctions({ - pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames), + pollingWatchFileWorker: fsWatchFileWorker, getModifiedTime: getModifiedTime, setTimeout: setTimeout, clearTimeout: clearTimeout, @@ -8039,12 +7884,9 @@ var ts; * Normalize path separators, converting `\` into `/`. */ function normalizeSlashes(path) { - var index = path.indexOf("\\"); - if (index === -1) { - return path; - } - backslashRegExp.lastIndex = index; // prime regex with known position - return path.replace(backslashRegExp, ts.directorySeparator); + return path.indexOf("\\") !== -1 + ? path.replace(backslashRegExp, ts.directorySeparator) + : path; } ts.normalizeSlashes = normalizeSlashes; /** @@ -8627,6 +8469,8 @@ var ts; A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled: diag(1272, ts.DiagnosticCategory.Error, "A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_w_1272", "A type referenced in a decorated signature must be imported with 'import type' or a namespace import when 'isolatedModules' and 'emitDecoratorMetadata' are enabled."), _0_modifier_cannot_appear_on_a_type_parameter: diag(1273, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_type_parameter_1273", "'{0}' modifier cannot appear on a type parameter"), _0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias: diag(1274, ts.DiagnosticCategory.Error, "_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias_1274", "'{0}' modifier can only appear on a type parameter of a class, interface or type alias"), + accessor_modifier_can_only_appear_on_a_property_declaration: diag(1275, ts.DiagnosticCategory.Error, "accessor_modifier_can_only_appear_on_a_property_declaration_1275", "'accessor' modifier can only appear on a property declaration."), + An_accessor_property_cannot_be_declared_optional: diag(1276, ts.DiagnosticCategory.Error, "An_accessor_property_cannot_be_declared_optional_1276", "An 'accessor' property cannot be declared optional."), with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."), await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."), The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, ts.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."), @@ -8677,7 +8521,7 @@ var ts; An_enum_member_name_must_be_followed_by_a_or: diag(1357, ts.DiagnosticCategory.Error, "An_enum_member_name_must_be_followed_by_a_or_1357", "An enum member name must be followed by a ',', '=', or '}'."), Tagged_template_expressions_are_not_permitted_in_an_optional_chain: diag(1358, ts.DiagnosticCategory.Error, "Tagged_template_expressions_are_not_permitted_in_an_optional_chain_1358", "Tagged template expressions are not permitted in an optional chain."), Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here: diag(1359, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here_1359", "Identifier expected. '{0}' is a reserved word that cannot be used here."), - Class_constructor_may_not_be_a_generator: diag(1360, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1360", "Class constructor may not be a generator."), + Type_0_does_not_satisfy_the_expected_type_1: diag(1360, ts.DiagnosticCategory.Error, "Type_0_does_not_satisfy_the_expected_type_1_1360", "Type '{0}' does not satisfy the expected type '{1}'."), _0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type: diag(1361, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type_1361", "'{0}' cannot be used as a value because it was imported using 'import type'."), _0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type: diag(1362, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type_1362", "'{0}' cannot be used as a value because it was exported using 'export type'."), A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both: diag(1363, ts.DiagnosticCategory.Error, "A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both_1363", "A type-only import can specify a default import or named bindings, but not both."), @@ -8685,6 +8529,7 @@ var ts; Convert_all_re_exported_types_to_type_only_exports: diag(1365, ts.DiagnosticCategory.Message, "Convert_all_re_exported_types_to_type_only_exports_1365", "Convert all re-exported types to type-only exports"), Split_into_two_separate_import_declarations: diag(1366, ts.DiagnosticCategory.Message, "Split_into_two_separate_import_declarations_1366", "Split into two separate import declarations"), Split_all_invalid_type_only_imports: diag(1367, ts.DiagnosticCategory.Message, "Split_all_invalid_type_only_imports_1367", "Split all invalid type-only imports"), + Class_constructor_may_not_be_a_generator: diag(1368, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1368", "Class constructor may not be a generator."), Did_you_mean_0: diag(1369, ts.DiagnosticCategory.Message, "Did_you_mean_0_1369", "Did you mean '{0}'?"), This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error: diag(1371, ts.DiagnosticCategory.Error, "This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set__1371", "This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'."), Convert_to_type_only_import: diag(1373, ts.DiagnosticCategory.Message, "Convert_to_type_only_import_1373", "Convert to type-only import"), @@ -8858,14 +8703,12 @@ var ts; The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."), The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."), The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."), - The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360", "The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."), - The_right_hand_side_of_an_in_expression_must_not_be_a_primitive: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361", "The right-hand side of an 'in' expression must not be a primitive."), The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."), Operator_0_cannot_be_applied_to_types_1_and_2: diag(2365, ts.DiagnosticCategory.Error, "Operator_0_cannot_be_applied_to_types_1_and_2_2365", "Operator '{0}' cannot be applied to types '{1}' and '{2}'."), Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: diag(2366, ts.DiagnosticCategory.Error, "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", "Function lacks ending return statement and return type does not include 'undefined'."), - This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367", "This condition will always return '{0}' since the types '{1}' and '{2}' have no overlap."), + This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367", "This comparison appears to be unintentional because the types '{0}' and '{1}' have no overlap."), Type_parameter_name_cannot_be_0: diag(2368, ts.DiagnosticCategory.Error, "Type_parameter_name_cannot_be_0_2368", "Type parameter name cannot be '{0}'."), A_parameter_property_is_only_allowed_in_a_constructor_implementation: diag(2369, ts.DiagnosticCategory.Error, "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", "A parameter property is only allowed in a constructor implementation."), A_rest_parameter_must_be_of_an_array_type: diag(2370, ts.DiagnosticCategory.Error, "A_rest_parameter_must_be_of_an_array_type_2370", "A rest parameter must be of an array type."), @@ -9108,6 +8951,7 @@ var ts; Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."), Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation: diag(2636, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation_2636", "Type '{0}' is not assignable to type '{1}' as implied by variance annotation."), Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types: diag(2637, ts.DiagnosticCategory.Error, "Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_t_2637", "Variance annotations are only supported in type aliases for object, function, constructor, and mapped types."), + Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator: diag(2638, ts.DiagnosticCategory.Error, "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638", "Type '{0}' may represent a primitive value, which is not permitted as the right operand of the 'in' operator."), Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."), A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."), Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."), @@ -9288,6 +9132,7 @@ var ts; _0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation: diag(2842, ts.DiagnosticCategory.Error, "_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842", "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"), We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here: diag(2843, ts.DiagnosticCategory.Error, "We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843", "We can only write a type for '{0}' by adding a type for the entire parameter here."), Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, ts.DiagnosticCategory.Error, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."), + This_condition_will_always_return_0: diag(2845, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."), Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."), Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."), Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."), @@ -9745,6 +9590,7 @@ var ts; Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved: diag(6398, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."), Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes were not emitted"), Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs to update timestamps of output files that are older than input files"), + Project_0_is_out_of_date_because_there_was_error_reading_file_1: diag(6401, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401", "Project '{0}' is out of date because there was error reading file '{1}'"), The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"), The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."), The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."), @@ -9987,6 +9833,7 @@ var ts; The_tag_was_first_specified_here: diag(8034, ts.DiagnosticCategory.Error, "The_tag_was_first_specified_here_8034", "The tag was first specified here."), You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder: diag(8035, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder_8035", "You cannot rename elements that are defined in a 'node_modules' folder."), You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder: diag(8036, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder_8036", "You cannot rename elements that are defined in another 'node_modules' folder."), + Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files: diag(8037, ts.DiagnosticCategory.Error, "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037", "Type satisfaction expressions can only be used in TypeScript files."), Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."), Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."), JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17000, ts.DiagnosticCategory.Error, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."), @@ -10158,6 +10005,7 @@ var ts; Set_the_module_option_in_your_configuration_file_to_0: diag(95099, ts.DiagnosticCategory.Message, "Set_the_module_option_in_your_configuration_file_to_0_95099", "Set the 'module' option in your configuration file to '{0}'"), Convert_invalid_character_to_its_html_entity_code: diag(95100, ts.DiagnosticCategory.Message, "Convert_invalid_character_to_its_html_entity_code_95100", "Convert invalid character to its html entity code"), Convert_all_invalid_characters_to_HTML_entity_code: diag(95101, ts.DiagnosticCategory.Message, "Convert_all_invalid_characters_to_HTML_entity_code_95101", "Convert all invalid characters to HTML entity code"), + Convert_all_const_to_let: diag(95102, ts.DiagnosticCategory.Message, "Convert_all_const_to_let_95102", "Convert all 'const' to 'let'"), Convert_function_expression_0_to_arrow_function: diag(95105, ts.DiagnosticCategory.Message, "Convert_function_expression_0_to_arrow_function_95105", "Convert function expression '{0}' to arrow function"), Convert_function_declaration_0_to_arrow_function: diag(95106, ts.DiagnosticCategory.Message, "Convert_function_declaration_0_to_arrow_function_95106", "Convert function declaration '{0}' to arrow function"), Fix_all_implicit_this_errors: diag(95107, ts.DiagnosticCategory.Message, "Fix_all_implicit_this_errors_95107", "Fix all implicit-'this' errors"), @@ -10227,6 +10075,8 @@ var ts; Delete_unused_param_tag_0: diag(95171, ts.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"), Delete_all_unused_param_tags: diag(95172, ts.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"), Rename_param_tag_name_0_to_1: diag(95173, ts.DiagnosticCategory.Message, "Rename_param_tag_name_0_to_1_95173", "Rename '@param' tag name '{0}' to '{1}'"), + Use_0: diag(95174, ts.DiagnosticCategory.Message, "Use_0_95174", "Use `{0}`."), + Use_Number_isNaN_in_all_conditions: diag(95175, ts.DiagnosticCategory.Message, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."), No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."), Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."), JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, ts.DiagnosticCategory.Error, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"), @@ -10260,6 +10110,12 @@ var ts; _0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation: diag(18042, ts.DiagnosticCategory.Error, "_0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation_18042", "'{0}' is a type and cannot be imported in JavaScript files. Use '{1}' in a JSDoc type annotation."), Types_cannot_appear_in_export_declarations_in_JavaScript_files: diag(18043, ts.DiagnosticCategory.Error, "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043", "Types cannot appear in export declarations in JavaScript files."), _0_is_automatically_exported_here: diag(18044, ts.DiagnosticCategory.Message, "_0_is_automatically_exported_here_18044", "'{0}' is automatically exported here."), + Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher: diag(18045, ts.DiagnosticCategory.Error, "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045", "Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher."), + _0_is_of_type_unknown: diag(18046, ts.DiagnosticCategory.Error, "_0_is_of_type_unknown_18046", "'{0}' is of type 'unknown'."), + _0_is_possibly_null: diag(18047, ts.DiagnosticCategory.Error, "_0_is_possibly_null_18047", "'{0}' is possibly 'null'."), + _0_is_possibly_undefined: diag(18048, ts.DiagnosticCategory.Error, "_0_is_possibly_undefined_18048", "'{0}' is possibly 'undefined'."), + _0_is_possibly_null_or_undefined: diag(18049, ts.DiagnosticCategory.Error, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."), + The_value_0_cannot_be_used_here: diag(18050, ts.DiagnosticCategory.Error, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."), }; })(ts || (ts = {})); var ts; @@ -10278,12 +10134,13 @@ var ts; /** @internal */ ts.textToKeywordObj = (_a = { abstract: 126 /* SyntaxKind.AbstractKeyword */, - any: 130 /* SyntaxKind.AnyKeyword */, - as: 127 /* SyntaxKind.AsKeyword */, - asserts: 128 /* SyntaxKind.AssertsKeyword */, - assert: 129 /* SyntaxKind.AssertKeyword */, - bigint: 158 /* SyntaxKind.BigIntKeyword */, - boolean: 133 /* SyntaxKind.BooleanKeyword */, + accessor: 127 /* SyntaxKind.AccessorKeyword */, + any: 131 /* SyntaxKind.AnyKeyword */, + as: 128 /* SyntaxKind.AsKeyword */, + asserts: 129 /* SyntaxKind.AssertsKeyword */, + assert: 130 /* SyntaxKind.AssertKeyword */, + bigint: 160 /* SyntaxKind.BigIntKeyword */, + boolean: 134 /* SyntaxKind.BooleanKeyword */, break: 81 /* SyntaxKind.BreakKeyword */, case: 82 /* SyntaxKind.CaseKeyword */, catch: 83 /* SyntaxKind.CatchKeyword */, @@ -10291,9 +10148,9 @@ var ts; continue: 86 /* SyntaxKind.ContinueKeyword */, const: 85 /* SyntaxKind.ConstKeyword */ }, - _a["" + "constructor"] = 134 /* SyntaxKind.ConstructorKeyword */, + _a["" + "constructor"] = 135 /* SyntaxKind.ConstructorKeyword */, _a.debugger = 87 /* SyntaxKind.DebuggerKeyword */, - _a.declare = 135 /* SyntaxKind.DeclareKeyword */, + _a.declare = 136 /* SyntaxKind.DeclareKeyword */, _a.default = 88 /* SyntaxKind.DefaultKeyword */, _a.delete = 89 /* SyntaxKind.DeleteKeyword */, _a.do = 90 /* SyntaxKind.DoKeyword */, @@ -10304,60 +10161,61 @@ var ts; _a.false = 95 /* SyntaxKind.FalseKeyword */, _a.finally = 96 /* SyntaxKind.FinallyKeyword */, _a.for = 97 /* SyntaxKind.ForKeyword */, - _a.from = 156 /* SyntaxKind.FromKeyword */, + _a.from = 158 /* SyntaxKind.FromKeyword */, _a.function = 98 /* SyntaxKind.FunctionKeyword */, - _a.get = 136 /* SyntaxKind.GetKeyword */, + _a.get = 137 /* SyntaxKind.GetKeyword */, _a.if = 99 /* SyntaxKind.IfKeyword */, _a.implements = 117 /* SyntaxKind.ImplementsKeyword */, _a.import = 100 /* SyntaxKind.ImportKeyword */, _a.in = 101 /* SyntaxKind.InKeyword */, - _a.infer = 137 /* SyntaxKind.InferKeyword */, + _a.infer = 138 /* SyntaxKind.InferKeyword */, _a.instanceof = 102 /* SyntaxKind.InstanceOfKeyword */, _a.interface = 118 /* SyntaxKind.InterfaceKeyword */, - _a.intrinsic = 138 /* SyntaxKind.IntrinsicKeyword */, - _a.is = 139 /* SyntaxKind.IsKeyword */, - _a.keyof = 140 /* SyntaxKind.KeyOfKeyword */, + _a.intrinsic = 139 /* SyntaxKind.IntrinsicKeyword */, + _a.is = 140 /* SyntaxKind.IsKeyword */, + _a.keyof = 141 /* SyntaxKind.KeyOfKeyword */, _a.let = 119 /* SyntaxKind.LetKeyword */, - _a.module = 141 /* SyntaxKind.ModuleKeyword */, - _a.namespace = 142 /* SyntaxKind.NamespaceKeyword */, - _a.never = 143 /* SyntaxKind.NeverKeyword */, + _a.module = 142 /* SyntaxKind.ModuleKeyword */, + _a.namespace = 143 /* SyntaxKind.NamespaceKeyword */, + _a.never = 144 /* SyntaxKind.NeverKeyword */, _a.new = 103 /* SyntaxKind.NewKeyword */, _a.null = 104 /* SyntaxKind.NullKeyword */, - _a.number = 147 /* SyntaxKind.NumberKeyword */, - _a.object = 148 /* SyntaxKind.ObjectKeyword */, + _a.number = 148 /* SyntaxKind.NumberKeyword */, + _a.object = 149 /* SyntaxKind.ObjectKeyword */, _a.package = 120 /* SyntaxKind.PackageKeyword */, _a.private = 121 /* SyntaxKind.PrivateKeyword */, _a.protected = 122 /* SyntaxKind.ProtectedKeyword */, _a.public = 123 /* SyntaxKind.PublicKeyword */, - _a.override = 159 /* SyntaxKind.OverrideKeyword */, - _a.out = 144 /* SyntaxKind.OutKeyword */, - _a.readonly = 145 /* SyntaxKind.ReadonlyKeyword */, - _a.require = 146 /* SyntaxKind.RequireKeyword */, - _a.global = 157 /* SyntaxKind.GlobalKeyword */, + _a.override = 161 /* SyntaxKind.OverrideKeyword */, + _a.out = 145 /* SyntaxKind.OutKeyword */, + _a.readonly = 146 /* SyntaxKind.ReadonlyKeyword */, + _a.require = 147 /* SyntaxKind.RequireKeyword */, + _a.global = 159 /* SyntaxKind.GlobalKeyword */, _a.return = 105 /* SyntaxKind.ReturnKeyword */, - _a.set = 149 /* SyntaxKind.SetKeyword */, + _a.satisfies = 150 /* SyntaxKind.SatisfiesKeyword */, + _a.set = 151 /* SyntaxKind.SetKeyword */, _a.static = 124 /* SyntaxKind.StaticKeyword */, - _a.string = 150 /* SyntaxKind.StringKeyword */, + _a.string = 152 /* SyntaxKind.StringKeyword */, _a.super = 106 /* SyntaxKind.SuperKeyword */, _a.switch = 107 /* SyntaxKind.SwitchKeyword */, - _a.symbol = 151 /* SyntaxKind.SymbolKeyword */, + _a.symbol = 153 /* SyntaxKind.SymbolKeyword */, _a.this = 108 /* SyntaxKind.ThisKeyword */, _a.throw = 109 /* SyntaxKind.ThrowKeyword */, _a.true = 110 /* SyntaxKind.TrueKeyword */, _a.try = 111 /* SyntaxKind.TryKeyword */, - _a.type = 152 /* SyntaxKind.TypeKeyword */, + _a.type = 154 /* SyntaxKind.TypeKeyword */, _a.typeof = 112 /* SyntaxKind.TypeOfKeyword */, - _a.undefined = 153 /* SyntaxKind.UndefinedKeyword */, - _a.unique = 154 /* SyntaxKind.UniqueKeyword */, - _a.unknown = 155 /* SyntaxKind.UnknownKeyword */, + _a.undefined = 155 /* SyntaxKind.UndefinedKeyword */, + _a.unique = 156 /* SyntaxKind.UniqueKeyword */, + _a.unknown = 157 /* SyntaxKind.UnknownKeyword */, _a.var = 113 /* SyntaxKind.VarKeyword */, _a.void = 114 /* SyntaxKind.VoidKeyword */, _a.while = 115 /* SyntaxKind.WhileKeyword */, _a.with = 116 /* SyntaxKind.WithKeyword */, _a.yield = 125 /* SyntaxKind.YieldKeyword */, - _a.async = 131 /* SyntaxKind.AsyncKeyword */, - _a.await = 132 /* SyntaxKind.AwaitKeyword */, - _a.of = 160 /* SyntaxKind.OfKeyword */, + _a.async = 132 /* SyntaxKind.AsyncKeyword */, + _a.await = 133 /* SyntaxKind.AwaitKeyword */, + _a.of = 162 /* SyntaxKind.OfKeyword */, _a); var textToKeyword = new ts.Map(ts.getEntries(ts.textToKeywordObj)); var textToToken = new ts.Map(ts.getEntries(__assign(__assign({}, ts.textToKeywordObj), { "{": 18 /* SyntaxKind.OpenBraceToken */, "}": 19 /* SyntaxKind.CloseBraceToken */, "(": 20 /* SyntaxKind.OpenParenToken */, ")": 21 /* SyntaxKind.CloseParenToken */, "[": 22 /* SyntaxKind.OpenBracketToken */, "]": 23 /* SyntaxKind.CloseBracketToken */, ".": 24 /* SyntaxKind.DotToken */, "...": 25 /* SyntaxKind.DotDotDotToken */, ";": 26 /* SyntaxKind.SemicolonToken */, ",": 27 /* SyntaxKind.CommaToken */, "<": 29 /* SyntaxKind.LessThanToken */, ">": 31 /* SyntaxKind.GreaterThanToken */, "<=": 32 /* SyntaxKind.LessThanEqualsToken */, ">=": 33 /* SyntaxKind.GreaterThanEqualsToken */, "==": 34 /* SyntaxKind.EqualsEqualsToken */, "!=": 35 /* SyntaxKind.ExclamationEqualsToken */, "===": 36 /* SyntaxKind.EqualsEqualsEqualsToken */, "!==": 37 /* SyntaxKind.ExclamationEqualsEqualsToken */, "=>": 38 /* SyntaxKind.EqualsGreaterThanToken */, "+": 39 /* SyntaxKind.PlusToken */, "-": 40 /* SyntaxKind.MinusToken */, "**": 42 /* SyntaxKind.AsteriskAsteriskToken */, "*": 41 /* SyntaxKind.AsteriskToken */, "/": 43 /* SyntaxKind.SlashToken */, "%": 44 /* SyntaxKind.PercentToken */, "++": 45 /* SyntaxKind.PlusPlusToken */, "--": 46 /* SyntaxKind.MinusMinusToken */, "<<": 47 /* SyntaxKind.LessThanLessThanToken */, ">": 48 /* SyntaxKind.GreaterThanGreaterThanToken */, ">>>": 49 /* SyntaxKind.GreaterThanGreaterThanGreaterThanToken */, "&": 50 /* SyntaxKind.AmpersandToken */, "|": 51 /* SyntaxKind.BarToken */, "^": 52 /* SyntaxKind.CaretToken */, "!": 53 /* SyntaxKind.ExclamationToken */, "~": 54 /* SyntaxKind.TildeToken */, "&&": 55 /* SyntaxKind.AmpersandAmpersandToken */, "||": 56 /* SyntaxKind.BarBarToken */, "?": 57 /* SyntaxKind.QuestionToken */, "??": 60 /* SyntaxKind.QuestionQuestionToken */, "?.": 28 /* SyntaxKind.QuestionDotToken */, ":": 58 /* SyntaxKind.ColonToken */, "=": 63 /* SyntaxKind.EqualsToken */, "+=": 64 /* SyntaxKind.PlusEqualsToken */, "-=": 65 /* SyntaxKind.MinusEqualsToken */, "*=": 66 /* SyntaxKind.AsteriskEqualsToken */, "**=": 67 /* SyntaxKind.AsteriskAsteriskEqualsToken */, "/=": 68 /* SyntaxKind.SlashEqualsToken */, "%=": 69 /* SyntaxKind.PercentEqualsToken */, "<<=": 70 /* SyntaxKind.LessThanLessThanEqualsToken */, ">>=": 71 /* SyntaxKind.GreaterThanGreaterThanEqualsToken */, ">>>=": 72 /* SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 73 /* SyntaxKind.AmpersandEqualsToken */, "|=": 74 /* SyntaxKind.BarEqualsToken */, "^=": 78 /* SyntaxKind.CaretEqualsToken */, "||=": 75 /* SyntaxKind.BarBarEqualsToken */, "&&=": 76 /* SyntaxKind.AmpersandAmpersandEqualsToken */, "??=": 77 /* SyntaxKind.QuestionQuestionEqualsToken */, "@": 59 /* SyntaxKind.AtToken */, "#": 62 /* SyntaxKind.HashToken */, "`": 61 /* SyntaxKind.BacktickToken */ }))); @@ -10480,7 +10338,7 @@ var ts; ts.stringToToken = stringToToken; /* @internal */ function computeLineStarts(text) { - var result = new Array(); + var result = []; var pos = 0; var lineStart = 0; while (pos < text.length) { @@ -12041,12 +11899,36 @@ var ts; pos++; return token = 0 /* SyntaxKind.Unknown */; } - if (isIdentifierStart(codePointAt(text, pos + 1), languageVersion)) { + var charAfterHash = codePointAt(text, pos + 1); + if (charAfterHash === 92 /* CharacterCodes.backslash */) { pos++; - scanIdentifier(codePointAt(text, pos), languageVersion); + var extendedCookedChar_1 = peekExtendedUnicodeEscape(); + if (extendedCookedChar_1 >= 0 && isIdentifierStart(extendedCookedChar_1, languageVersion)) { + pos += 3; + tokenFlags |= 8 /* TokenFlags.ExtendedUnicodeEscape */; + tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts(); + return token = 80 /* SyntaxKind.PrivateIdentifier */; + } + var cookedChar_1 = peekUnicodeEscape(); + if (cookedChar_1 >= 0 && isIdentifierStart(cookedChar_1, languageVersion)) { + pos += 6; + tokenFlags |= 1024 /* TokenFlags.UnicodeEscape */; + tokenValue = "#" + String.fromCharCode(cookedChar_1) + scanIdentifierParts(); + return token = 80 /* SyntaxKind.PrivateIdentifier */; + } + pos--; + } + if (isIdentifierStart(charAfterHash, languageVersion)) { + pos++; + // We're relying on scanIdentifier's behavior and adjusting the token kind after the fact. + // Notably absent from this block is the fact that calling a function named "scanIdentifier", + // but identifiers don't include '#', and that function doesn't deal with it at all. + // This works because 'scanIdentifier' tries to reuse source characters and builds up substrings; + // however, it starts at the 'tokenPos' which includes the '#', and will "accidentally" prepend the '#' for us. + scanIdentifier(charAfterHash, languageVersion); } else { - tokenValue = String.fromCharCode(codePointAt(text, pos)); + tokenValue = "#"; error(ts.Diagnostics.Invalid_character, pos++, charSize(ch)); } return token = 80 /* SyntaxKind.PrivateIdentifier */; @@ -12797,9 +12679,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 163 /* SyntaxKind.TypeParameter */) { + if (d && d.kind === 165 /* SyntaxKind.TypeParameter */) { for (var current = d; current; current = current.parent) { - if (isFunctionLike(current) || isClassLike(current) || current.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (isFunctionLike(current) || isClassLike(current) || current.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return current; } } @@ -12807,7 +12689,7 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node, parent) { - return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) && parent.kind === 171 /* SyntaxKind.Constructor */; + return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) && parent.kind === 173 /* SyntaxKind.Constructor */; } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; function isEmptyBindingPattern(node) { @@ -12837,14 +12719,14 @@ var ts; node = walkUpBindingElementsAndPatterns(node); } var flags = getFlags(node); - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node && node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { flags |= getFlags(node); node = node.parent; } - if (node && node.kind === 237 /* SyntaxKind.VariableStatement */) { + if (node && node.kind === 240 /* SyntaxKind.VariableStatement */) { flags |= getFlags(node); } return flags; @@ -13017,30 +12899,30 @@ var ts; } // Covers remaining cases (returning undefined if none match). switch (hostNode.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: if (hostNode.declarationList && hostNode.declarationList.declarations[0]) { return getDeclarationIdentifier(hostNode.declarationList.declarations[0]); } break; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: var expr = hostNode.expression; - if (expr.kind === 221 /* SyntaxKind.BinaryExpression */ && expr.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (expr.kind === 223 /* SyntaxKind.BinaryExpression */ && expr.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { expr = expr.left; } switch (expr.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return expr.name; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var arg = expr.argumentExpression; if (ts.isIdentifier(arg)) { return arg; } } break; - case 212 /* SyntaxKind.ParenthesizedExpression */: { + case 214 /* SyntaxKind.ParenthesizedExpression */: { return getDeclarationIdentifier(hostNode.expression); } - case 250 /* SyntaxKind.LabeledStatement */: { + case 253 /* SyntaxKind.LabeledStatement */: { if (isDeclaration(hostNode.statement) || isExpression(hostNode.statement)) { return getDeclarationIdentifier(hostNode.statement); } @@ -13077,16 +12959,16 @@ var ts; switch (declaration.kind) { case 79 /* SyntaxKind.Identifier */: return declaration; - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: { + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: { var name = declaration.name; - if (name.kind === 161 /* SyntaxKind.QualifiedName */) { + if (name.kind === 163 /* SyntaxKind.QualifiedName */) { return name.right; } break; } - case 208 /* SyntaxKind.CallExpression */: - case 221 /* SyntaxKind.BinaryExpression */: { + case 210 /* SyntaxKind.CallExpression */: + case 223 /* SyntaxKind.BinaryExpression */: { var expr_1 = declaration; switch (ts.getAssignmentDeclarationKind(expr_1)) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -13102,15 +12984,15 @@ var ts; return undefined; } } - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return getNameOfJSDocTypedef(declaration); - case 339 /* SyntaxKind.JSDocEnumTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return nameForNamelessJSDocTypedef(declaration); - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var expression = declaration.expression; return ts.isIdentifier(expression) ? expression : undefined; } - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = declaration; if (ts.isBindableStaticElementAccessExpression(expr)) { return expr.argumentExpression; @@ -13154,7 +13036,7 @@ var ts; } ts.getDecorators = getDecorators; function getModifiers(node) { - if (ts.hasSyntacticModifier(node, 125951 /* ModifierFlags.Modifier */)) { + if (ts.hasSyntacticModifier(node, 126975 /* ModifierFlags.Modifier */)) { return ts.filter(node.modifiers, isModifier); } } @@ -13415,12 +13297,12 @@ var ts; /** Gets the text of a jsdoc comment, flattening links to their text. */ function getTextOfJSDocComment(comment) { return typeof comment === "string" ? comment - : comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 321 /* SyntaxKind.JSDocText */ ? c.text : formatJSDocLink(c); }).join(""); + : comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 324 /* SyntaxKind.JSDocText */ ? c.text : formatJSDocLink(c); }).join(""); } ts.getTextOfJSDocComment = getTextOfJSDocComment; function formatJSDocLink(link) { - var kind = link.kind === 324 /* SyntaxKind.JSDocLink */ ? "link" - : link.kind === 325 /* SyntaxKind.JSDocLinkCode */ ? "linkcode" + var kind = link.kind === 327 /* SyntaxKind.JSDocLink */ ? "link" + : link.kind === 328 /* SyntaxKind.JSDocLinkCode */ ? "linkcode" : "linkplain"; var name = link.name ? ts.entityNameToString(link.name) : ""; var space = link.name && link.text.startsWith("://") ? "" : " "; @@ -13441,7 +13323,7 @@ var ts; return ts.emptyArray; } if (ts.isJSDocTypeAlias(node)) { - ts.Debug.assert(node.parent.kind === 320 /* SyntaxKind.JSDoc */); + ts.Debug.assert(node.parent.kind === 323 /* SyntaxKind.JSDoc */); return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; }); } if (node.typeParameters) { @@ -13476,7 +13358,7 @@ var ts; ts.isMemberName = isMemberName; /* @internal */ function isGetOrSetAccessorDeclaration(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */ || node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */ || node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetOrSetAccessorDeclaration = isGetOrSetAccessorDeclaration; function isPropertyAccessChain(node) { @@ -13494,10 +13376,10 @@ var ts; function isOptionalChain(node) { var kind = node.kind; return !!(node.flags & 32 /* NodeFlags.OptionalChain */) && - (kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 207 /* SyntaxKind.ElementAccessExpression */ - || kind === 208 /* SyntaxKind.CallExpression */ - || kind === 230 /* SyntaxKind.NonNullExpression */); + (kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 209 /* SyntaxKind.ElementAccessExpression */ + || kind === 210 /* SyntaxKind.CallExpression */ + || kind === 232 /* SyntaxKind.NonNullExpression */); } ts.isOptionalChain = isOptionalChain; /* @internal */ @@ -13532,7 +13414,7 @@ var ts; } ts.isOutermostOptionalChain = isOutermostOptionalChain; function isNullishCoalesce(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */; } ts.isNullishCoalesce = isNullishCoalesce; function isConstTypeReference(node) { @@ -13549,17 +13431,17 @@ var ts; } ts.isNonNullChain = isNonNullChain; function isBreakOrContinueStatement(node) { - return node.kind === 246 /* SyntaxKind.BreakStatement */ || node.kind === 245 /* SyntaxKind.ContinueStatement */; + return node.kind === 249 /* SyntaxKind.BreakStatement */ || node.kind === 248 /* SyntaxKind.ContinueStatement */; } ts.isBreakOrContinueStatement = isBreakOrContinueStatement; function isNamedExportBindings(node) { - return node.kind === 274 /* SyntaxKind.NamespaceExport */ || node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 277 /* SyntaxKind.NamespaceExport */ || node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedExportBindings = isNamedExportBindings; function isUnparsedTextLike(node) { switch (node.kind) { - case 302 /* SyntaxKind.UnparsedText */: - case 303 /* SyntaxKind.UnparsedInternalText */: + case 305 /* SyntaxKind.UnparsedText */: + case 306 /* SyntaxKind.UnparsedInternalText */: return true; default: return false; @@ -13568,12 +13450,12 @@ var ts; ts.isUnparsedTextLike = isUnparsedTextLike; function isUnparsedNode(node) { return isUnparsedTextLike(node) || - node.kind === 300 /* SyntaxKind.UnparsedPrologue */ || - node.kind === 304 /* SyntaxKind.UnparsedSyntheticReference */; + node.kind === 303 /* SyntaxKind.UnparsedPrologue */ || + node.kind === 307 /* SyntaxKind.UnparsedSyntheticReference */; } ts.isUnparsedNode = isUnparsedNode; function isJSDocPropertyLikeTag(node) { - return node.kind === 347 /* SyntaxKind.JSDocPropertyTag */ || node.kind === 340 /* SyntaxKind.JSDocParameterTag */; + return node.kind === 350 /* SyntaxKind.JSDocPropertyTag */ || node.kind === 343 /* SyntaxKind.JSDocParameterTag */; } ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; // #endregion @@ -13589,7 +13471,7 @@ var ts; ts.isNode = isNode; /* @internal */ function isNodeKind(kind) { - return kind >= 161 /* SyntaxKind.FirstNode */; + return kind >= 163 /* SyntaxKind.FirstNode */; } ts.isNodeKind = isNodeKind; /** @@ -13598,7 +13480,7 @@ var ts; * Literals are considered tokens, except TemplateLiteral, but does include TemplateHead/Middle/Tail. */ function isTokenKind(kind) { - return kind >= 0 /* SyntaxKind.FirstToken */ && kind <= 160 /* SyntaxKind.LastToken */; + return kind >= 0 /* SyntaxKind.FirstToken */ && kind <= 162 /* SyntaxKind.LastToken */; } ts.isTokenKind = isTokenKind; /** @@ -13613,7 +13495,7 @@ var ts; // Node Arrays /* @internal */ function isNodeArray(array) { - return array.hasOwnProperty("pos") && array.hasOwnProperty("end"); + return ts.hasProperty(array, "pos") && ts.hasProperty(array, "end"); } ts.isNodeArray = isNodeArray; // Literals @@ -13629,11 +13511,11 @@ var ts; /** @internal */ function isLiteralExpressionOfObject(node) { switch (node.kind) { - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: return true; } return false; @@ -13661,13 +13543,13 @@ var ts; ts.isImportOrExportSpecifier = isImportOrExportSpecifier; function isTypeOnlyImportOrExportDeclaration(node) { switch (node.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return node.isTypeOnly || node.parent.parent.isTypeOnly; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.isTypeOnly; - case 267 /* SyntaxKind.ImportClause */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 270 /* SyntaxKind.ImportClause */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.isTypeOnly; default: return false; @@ -13688,6 +13570,11 @@ var ts; return ts.isIdentifier(node) && (node.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) > 0 /* GeneratedIdentifierFlags.None */; } ts.isGeneratedIdentifier = isGeneratedIdentifier; + /* @internal */ + function isGeneratedPrivateIdentifier(node) { + return ts.isPrivateIdentifier(node) && (node.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) > 0 /* GeneratedIdentifierFlags.None */; + } + ts.isGeneratedPrivateIdentifier = isGeneratedPrivateIdentifier; // Private Identifiers /*@internal*/ function isPrivateIdentifierClassElementDeclaration(node) { @@ -13704,19 +13591,20 @@ var ts; function isModifierKind(token) { switch (token) { case 126 /* SyntaxKind.AbstractKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 88 /* SyntaxKind.DefaultKeyword */: case 93 /* SyntaxKind.ExportKeyword */: case 101 /* SyntaxKind.InKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 144 /* SyntaxKind.OutKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 145 /* SyntaxKind.OutKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: return true; } return false; @@ -13729,7 +13617,10 @@ var ts; ts.isParameterPropertyModifier = isParameterPropertyModifier; /* @internal */ function isClassMemberModifier(idToken) { - return isParameterPropertyModifier(idToken) || idToken === 124 /* SyntaxKind.StaticKeyword */ || idToken === 159 /* SyntaxKind.OverrideKeyword */; + return isParameterPropertyModifier(idToken) || + idToken === 124 /* SyntaxKind.StaticKeyword */ || + idToken === 161 /* SyntaxKind.OverrideKeyword */ || + idToken === 127 /* SyntaxKind.AccessorKeyword */; } ts.isClassMemberModifier = isClassMemberModifier; function isModifier(node) { @@ -13738,7 +13629,7 @@ var ts; ts.isModifier = isModifier; function isEntityName(node) { var kind = node.kind; - return kind === 161 /* SyntaxKind.QualifiedName */ + return kind === 163 /* SyntaxKind.QualifiedName */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isEntityName = isEntityName; @@ -13748,14 +13639,14 @@ var ts; || kind === 80 /* SyntaxKind.PrivateIdentifier */ || kind === 10 /* SyntaxKind.StringLiteral */ || kind === 8 /* SyntaxKind.NumericLiteral */ - || kind === 162 /* SyntaxKind.ComputedPropertyName */; + || kind === 164 /* SyntaxKind.ComputedPropertyName */; } ts.isPropertyName = isPropertyName; function isBindingName(node) { var kind = node.kind; return kind === 79 /* SyntaxKind.Identifier */ - || kind === 201 /* SyntaxKind.ObjectBindingPattern */ - || kind === 202 /* SyntaxKind.ArrayBindingPattern */; + || kind === 203 /* SyntaxKind.ObjectBindingPattern */ + || kind === 204 /* SyntaxKind.ArrayBindingPattern */; } ts.isBindingName = isBindingName; // Functions @@ -13780,13 +13671,13 @@ var ts; ts.isBooleanLiteral = isBooleanLiteral; function isFunctionLikeDeclarationKind(kind) { switch (kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: return false; @@ -13795,14 +13686,14 @@ var ts; /* @internal */ function isFunctionLikeKind(kind) { switch (kind) { - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return true; default: return isFunctionLikeDeclarationKind(kind); @@ -13817,36 +13708,53 @@ var ts; // Classes function isClassElement(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 234 /* SyntaxKind.SemicolonClassElement */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 237 /* SyntaxKind.SemicolonClassElement */; } ts.isClassElement = isClassElement; function isClassLike(node) { - return node && (node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */); + return node && (node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */); } ts.isClassLike = isClassLike; function isAccessor(node) { - return node && (node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */); + return node && (node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */); } ts.isAccessor = isAccessor; + function isAutoAccessorPropertyDeclaration(node) { + return ts.isPropertyDeclaration(node) && ts.hasAccessorModifier(node); + } + ts.isAutoAccessorPropertyDeclaration = isAutoAccessorPropertyDeclaration; /* @internal */ function isMethodOrAccessor(node) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; default: return false; } } ts.isMethodOrAccessor = isMethodOrAccessor; + /* @internal */ + function isNamedClassElement(node) { + switch (node.kind) { + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + return true; + default: + return false; + } + } + ts.isNamedClassElement = isNamedClassElement; // Type members function isModifierLike(node) { return isModifier(node) || ts.isDecorator(node); @@ -13854,13 +13762,13 @@ var ts; ts.isModifierLike = isModifierLike; function isTypeElement(node) { var kind = node.kind; - return kind === 175 /* SyntaxKind.ConstructSignature */ - || kind === 174 /* SyntaxKind.CallSignature */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 177 /* SyntaxKind.ConstructSignature */ + || kind === 176 /* SyntaxKind.CallSignature */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.isTypeElement = isTypeElement; function isClassOrTypeElement(node) { @@ -13869,12 +13777,12 @@ var ts; ts.isClassOrTypeElement = isClassOrTypeElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 298 /* SyntaxKind.SpreadAssignment */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 301 /* SyntaxKind.SpreadAssignment */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; // Type @@ -13889,8 +13797,8 @@ var ts; ts.isTypeNode = isTypeNode; function isFunctionOrConstructorTypeNode(node) { switch (node.kind) { - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return true; } return false; @@ -13901,8 +13809,8 @@ var ts; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 202 /* SyntaxKind.ArrayBindingPattern */ - || kind === 201 /* SyntaxKind.ObjectBindingPattern */; + return kind === 204 /* SyntaxKind.ArrayBindingPattern */ + || kind === 203 /* SyntaxKind.ObjectBindingPattern */; } return false; } @@ -13910,15 +13818,15 @@ var ts; /* @internal */ function isAssignmentPattern(node) { var kind = node.kind; - return kind === 204 /* SyntaxKind.ArrayLiteralExpression */ - || kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return kind === 206 /* SyntaxKind.ArrayLiteralExpression */ + || kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isAssignmentPattern = isAssignmentPattern; /* @internal */ function isArrayBindingElement(node) { var kind = node.kind; - return kind === 203 /* SyntaxKind.BindingElement */ - || kind === 227 /* SyntaxKind.OmittedExpression */; + return kind === 205 /* SyntaxKind.BindingElement */ + || kind === 229 /* SyntaxKind.OmittedExpression */; } ts.isArrayBindingElement = isArrayBindingElement; /** @@ -13927,9 +13835,9 @@ var ts; /* @internal */ function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: return true; } return false; @@ -13950,8 +13858,8 @@ var ts; /* @internal */ function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return true; } return false; @@ -13960,10 +13868,10 @@ var ts; /* @internal */ function isObjectBindingOrAssignmentElement(node) { switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: // AssignmentProperty - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: // AssignmentProperty - case 298 /* SyntaxKind.SpreadAssignment */: // AssignmentRestProperty + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: // AssignmentProperty + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // AssignmentProperty + case 301 /* SyntaxKind.SpreadAssignment */: // AssignmentRestProperty return true; } return false; @@ -13975,8 +13883,8 @@ var ts; /* @internal */ function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return true; } return false; @@ -13985,26 +13893,26 @@ var ts; /* @internal */ function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) { var kind = node.kind; - return kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 161 /* SyntaxKind.QualifiedName */ - || kind === 200 /* SyntaxKind.ImportType */; + return kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 163 /* SyntaxKind.QualifiedName */ + || kind === 202 /* SyntaxKind.ImportType */; } ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode; // Expression function isPropertyAccessOrQualifiedName(node) { var kind = node.kind; - return kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 161 /* SyntaxKind.QualifiedName */; + return kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 163 /* SyntaxKind.QualifiedName */; } ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName; function isCallLikeExpression(node) { switch (node.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 165 /* SyntaxKind.Decorator */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 167 /* SyntaxKind.Decorator */: return true; default: return false; @@ -14012,12 +13920,12 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function isCallOrNewExpression(node) { - return node.kind === 208 /* SyntaxKind.CallExpression */ || node.kind === 209 /* SyntaxKind.NewExpression */; + return node.kind === 210 /* SyntaxKind.CallExpression */ || node.kind === 211 /* SyntaxKind.NewExpression */; } ts.isCallOrNewExpression = isCallOrNewExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 223 /* SyntaxKind.TemplateExpression */ + return kind === 225 /* SyntaxKind.TemplateExpression */ || kind === 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */; } ts.isTemplateLiteral = isTemplateLiteral; @@ -14028,19 +13936,19 @@ var ts; ts.isLeftHandSideExpression = isLeftHandSideExpression; function isLeftHandSideExpressionKind(kind) { switch (kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: // technically this is only an Expression if it's in a `#field in expr` BinaryExpression case 13 /* SyntaxKind.RegularExpressionLiteral */: @@ -14048,15 +13956,15 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 108 /* SyntaxKind.ThisKeyword */: case 110 /* SyntaxKind.TrueKeyword */: case 106 /* SyntaxKind.SuperKeyword */: - case 230 /* SyntaxKind.NonNullExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 231 /* SyntaxKind.MetaProperty */: + case 232 /* SyntaxKind.NonNullExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 233 /* SyntaxKind.MetaProperty */: case 100 /* SyntaxKind.ImportKeyword */: // technically this is only an Expression if it's in a CallExpression return true; default: @@ -14070,13 +13978,13 @@ var ts; ts.isUnaryExpression = isUnaryExpression; function isUnaryExpressionKind(kind) { switch (kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return true; default: return isLeftHandSideExpressionKind(kind); @@ -14085,9 +13993,9 @@ var ts; /* @internal */ function isUnaryExpressionWithWrite(expr) { switch (expr.kind) { - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return true; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 45 /* SyntaxKind.PlusPlusToken */ || expr.operator === 46 /* SyntaxKind.MinusMinusToken */; default: @@ -14106,15 +14014,16 @@ var ts; ts.isExpression = isExpression; function isExpressionKind(kind) { switch (kind) { - case 222 /* SyntaxKind.ConditionalExpression */: - case 224 /* SyntaxKind.YieldExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 221 /* SyntaxKind.BinaryExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 229 /* SyntaxKind.AsExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 351 /* SyntaxKind.CommaListExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 226 /* SyntaxKind.YieldExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 223 /* SyntaxKind.BinaryExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 231 /* SyntaxKind.AsExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 354 /* SyntaxKind.CommaListExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return true; default: return isUnaryExpressionKind(kind); @@ -14122,8 +14031,8 @@ var ts; } function isAssertionExpression(node) { var kind = node.kind; - return kind === 211 /* SyntaxKind.TypeAssertionExpression */ - || kind === 229 /* SyntaxKind.AsExpression */; + return kind === 213 /* SyntaxKind.TypeAssertionExpression */ + || kind === 231 /* SyntaxKind.AsExpression */; } ts.isAssertionExpression = isAssertionExpression; /* @internal */ @@ -14134,13 +14043,13 @@ var ts; ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return true; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -14169,7 +14078,7 @@ var ts; ts.isExternalModuleIndicator = isExternalModuleIndicator; /* @internal */ function isForInOrOfStatement(node) { - return node.kind === 243 /* SyntaxKind.ForInStatement */ || node.kind === 244 /* SyntaxKind.ForOfStatement */; + return node.kind === 246 /* SyntaxKind.ForInStatement */ || node.kind === 247 /* SyntaxKind.ForOfStatement */; } ts.isForInOrOfStatement = isForInOrOfStatement; // Element @@ -14193,115 +14102,115 @@ var ts; /* @internal */ function isModuleBody(node) { var kind = node.kind; - return kind === 262 /* SyntaxKind.ModuleBlock */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ + return kind === 265 /* SyntaxKind.ModuleBlock */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isModuleBody = isModuleBody; /* @internal */ function isNamespaceBody(node) { var kind = node.kind; - return kind === 262 /* SyntaxKind.ModuleBlock */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */; + return kind === 265 /* SyntaxKind.ModuleBlock */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isNamespaceBody = isNamespaceBody; /* @internal */ function isJSDocNamespaceBody(node) { var kind = node.kind; return kind === 79 /* SyntaxKind.Identifier */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */; + || kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isJSDocNamespaceBody = isJSDocNamespaceBody; /* @internal */ function isNamedImportBindings(node) { var kind = node.kind; - return kind === 269 /* SyntaxKind.NamedImports */ - || kind === 268 /* SyntaxKind.NamespaceImport */; + return kind === 272 /* SyntaxKind.NamedImports */ + || kind === 271 /* SyntaxKind.NamespaceImport */; } ts.isNamedImportBindings = isNamedImportBindings; /* @internal */ function isModuleOrEnumDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */ || node.kind === 260 /* SyntaxKind.EnumDeclaration */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */ || node.kind === 263 /* SyntaxKind.EnumDeclaration */; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 203 /* SyntaxKind.BindingElement */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 299 /* SyntaxKind.EnumMember */ - || kind === 275 /* SyntaxKind.ExportSpecifier */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 267 /* SyntaxKind.ImportClause */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 270 /* SyntaxKind.ImportSpecifier */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 285 /* SyntaxKind.JsxAttribute */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 268 /* SyntaxKind.NamespaceImport */ - || kind === 274 /* SyntaxKind.NamespaceExport */ - || kind === 164 /* SyntaxKind.Parameter */ - || kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 163 /* SyntaxKind.TypeParameter */ - || kind === 254 /* SyntaxKind.VariableDeclaration */ - || kind === 345 /* SyntaxKind.JSDocTypedefTag */ - || kind === 338 /* SyntaxKind.JSDocCallbackTag */ - || kind === 347 /* SyntaxKind.JSDocPropertyTag */; + return kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 205 /* SyntaxKind.BindingElement */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 302 /* SyntaxKind.EnumMember */ + || kind === 278 /* SyntaxKind.ExportSpecifier */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 270 /* SyntaxKind.ImportClause */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 273 /* SyntaxKind.ImportSpecifier */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 288 /* SyntaxKind.JsxAttribute */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 271 /* SyntaxKind.NamespaceImport */ + || kind === 277 /* SyntaxKind.NamespaceExport */ + || kind === 166 /* SyntaxKind.Parameter */ + || kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 165 /* SyntaxKind.TypeParameter */ + || kind === 257 /* SyntaxKind.VariableDeclaration */ + || kind === 348 /* SyntaxKind.JSDocTypedefTag */ + || kind === 341 /* SyntaxKind.JSDocCallbackTag */ + || kind === 350 /* SyntaxKind.JSDocPropertyTag */; } function isDeclarationStatementKind(kind) { - return kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 246 /* SyntaxKind.BreakStatement */ - || kind === 245 /* SyntaxKind.ContinueStatement */ - || kind === 253 /* SyntaxKind.DebuggerStatement */ - || kind === 240 /* SyntaxKind.DoStatement */ - || kind === 238 /* SyntaxKind.ExpressionStatement */ - || kind === 236 /* SyntaxKind.EmptyStatement */ - || kind === 243 /* SyntaxKind.ForInStatement */ - || kind === 244 /* SyntaxKind.ForOfStatement */ - || kind === 242 /* SyntaxKind.ForStatement */ - || kind === 239 /* SyntaxKind.IfStatement */ - || kind === 250 /* SyntaxKind.LabeledStatement */ - || kind === 247 /* SyntaxKind.ReturnStatement */ - || kind === 249 /* SyntaxKind.SwitchStatement */ - || kind === 251 /* SyntaxKind.ThrowStatement */ - || kind === 252 /* SyntaxKind.TryStatement */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 241 /* SyntaxKind.WhileStatement */ - || kind === 248 /* SyntaxKind.WithStatement */ - || kind === 349 /* SyntaxKind.NotEmittedStatement */ - || kind === 353 /* SyntaxKind.EndOfDeclarationMarker */ - || kind === 352 /* SyntaxKind.MergeDeclarationMarker */; + return kind === 249 /* SyntaxKind.BreakStatement */ + || kind === 248 /* SyntaxKind.ContinueStatement */ + || kind === 256 /* SyntaxKind.DebuggerStatement */ + || kind === 243 /* SyntaxKind.DoStatement */ + || kind === 241 /* SyntaxKind.ExpressionStatement */ + || kind === 239 /* SyntaxKind.EmptyStatement */ + || kind === 246 /* SyntaxKind.ForInStatement */ + || kind === 247 /* SyntaxKind.ForOfStatement */ + || kind === 245 /* SyntaxKind.ForStatement */ + || kind === 242 /* SyntaxKind.IfStatement */ + || kind === 253 /* SyntaxKind.LabeledStatement */ + || kind === 250 /* SyntaxKind.ReturnStatement */ + || kind === 252 /* SyntaxKind.SwitchStatement */ + || kind === 254 /* SyntaxKind.ThrowStatement */ + || kind === 255 /* SyntaxKind.TryStatement */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 244 /* SyntaxKind.WhileStatement */ + || kind === 251 /* SyntaxKind.WithStatement */ + || kind === 352 /* SyntaxKind.NotEmittedStatement */ + || kind === 356 /* SyntaxKind.EndOfDeclarationMarker */ + || kind === 355 /* SyntaxKind.MergeDeclarationMarker */; } /* @internal */ function isDeclaration(node) { - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { - return (node.parent && node.parent.kind !== 344 /* SyntaxKind.JSDocTemplateTag */) || ts.isInJSFile(node); + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { + return (node.parent && node.parent.kind !== 347 /* SyntaxKind.JSDocTemplateTag */) || ts.isInJSFile(node); } return isDeclarationKind(node.kind); } @@ -14328,10 +14237,10 @@ var ts; } ts.isStatement = isStatement; function isBlockStatement(node) { - if (node.kind !== 235 /* SyntaxKind.Block */) + if (node.kind !== 238 /* SyntaxKind.Block */) return false; if (node.parent !== undefined) { - if (node.parent.kind === 252 /* SyntaxKind.TryStatement */ || node.parent.kind === 292 /* SyntaxKind.CatchClause */) { + if (node.parent.kind === 255 /* SyntaxKind.TryStatement */ || node.parent.kind === 295 /* SyntaxKind.CatchClause */) { return false; } } @@ -14345,15 +14254,15 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 235 /* SyntaxKind.Block */; + || kind === 238 /* SyntaxKind.Block */; } ts.isStatementOrBlock = isStatementOrBlock; // Module references /* @internal */ function isModuleReference(node) { var kind = node.kind; - return kind === 277 /* SyntaxKind.ExternalModuleReference */ - || kind === 161 /* SyntaxKind.QualifiedName */ + return kind === 280 /* SyntaxKind.ExternalModuleReference */ + || kind === 163 /* SyntaxKind.QualifiedName */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isModuleReference = isModuleReference; @@ -14363,58 +14272,58 @@ var ts; var kind = node.kind; return kind === 108 /* SyntaxKind.ThisKeyword */ || kind === 79 /* SyntaxKind.Identifier */ - || kind === 206 /* SyntaxKind.PropertyAccessExpression */; + || kind === 208 /* SyntaxKind.PropertyAccessExpression */; } ts.isJsxTagNameExpression = isJsxTagNameExpression; /* @internal */ function isJsxChild(node) { var kind = node.kind; - return kind === 278 /* SyntaxKind.JsxElement */ - || kind === 288 /* SyntaxKind.JsxExpression */ - || kind === 279 /* SyntaxKind.JsxSelfClosingElement */ + return kind === 281 /* SyntaxKind.JsxElement */ + || kind === 291 /* SyntaxKind.JsxExpression */ + || kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || kind === 11 /* SyntaxKind.JsxText */ - || kind === 282 /* SyntaxKind.JsxFragment */; + || kind === 285 /* SyntaxKind.JsxFragment */; } ts.isJsxChild = isJsxChild; /* @internal */ function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 285 /* SyntaxKind.JsxAttribute */ - || kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return kind === 288 /* SyntaxKind.JsxAttribute */ + || kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } ts.isJsxAttributeLike = isJsxAttributeLike; /* @internal */ function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 10 /* SyntaxKind.StringLiteral */ - || kind === 288 /* SyntaxKind.JsxExpression */; + || kind === 291 /* SyntaxKind.JsxExpression */; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isJsxOpeningLikeElement(node) { var kind = node.kind; - return kind === 280 /* SyntaxKind.JsxOpeningElement */ - || kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return kind === 283 /* SyntaxKind.JsxOpeningElement */ + || kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; // Clauses function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 289 /* SyntaxKind.CaseClause */ - || kind === 290 /* SyntaxKind.DefaultClause */; + return kind === 292 /* SyntaxKind.CaseClause */ + || kind === 293 /* SyntaxKind.DefaultClause */; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; // JSDoc /** True if node is of some JSDoc syntax kind. */ /* @internal */ function isJSDocNode(node) { - return node.kind >= 309 /* SyntaxKind.FirstJSDocNode */ && node.kind <= 347 /* SyntaxKind.LastJSDocNode */; + return node.kind >= 312 /* SyntaxKind.FirstJSDocNode */ && node.kind <= 350 /* SyntaxKind.LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; /** True if node is of a kind that may contain comment text. */ function isJSDocCommentContainingNode(node) { - return node.kind === 320 /* SyntaxKind.JSDoc */ - || node.kind === 319 /* SyntaxKind.JSDocNamepathType */ - || node.kind === 321 /* SyntaxKind.JSDocText */ + return node.kind === 323 /* SyntaxKind.JSDoc */ + || node.kind === 322 /* SyntaxKind.JSDocNamepathType */ + || node.kind === 324 /* SyntaxKind.JSDocText */ || isJSDocLinkLike(node) || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) @@ -14424,15 +14333,15 @@ var ts; // TODO: determine what this does before making it public. /* @internal */ function isJSDocTag(node) { - return node.kind >= 327 /* SyntaxKind.FirstJSDocTagNode */ && node.kind <= 347 /* SyntaxKind.LastJSDocTagNode */; + return node.kind >= 330 /* SyntaxKind.FirstJSDocTagNode */ && node.kind <= 350 /* SyntaxKind.LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function isSetAccessor(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */; } ts.isSetAccessor = isSetAccessor; function isGetAccessor(node) { - return node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetAccessor = isGetAccessor; /** True if has jsdoc nodes attached to it. */ @@ -14458,12 +14367,12 @@ var ts; /** True if has initializer node attached to it. */ function hasOnlyExpressionInitializer(node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 299 /* SyntaxKind.EnumMember */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 302 /* SyntaxKind.EnumMember */: return true; default: return false; @@ -14471,12 +14380,12 @@ var ts; } ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer; function isObjectLiteralElement(node) { - return node.kind === 285 /* SyntaxKind.JsxAttribute */ || node.kind === 287 /* SyntaxKind.JsxSpreadAttribute */ || isObjectLiteralElementLike(node); + return node.kind === 288 /* SyntaxKind.JsxAttribute */ || node.kind === 290 /* SyntaxKind.JsxSpreadAttribute */ || isObjectLiteralElementLike(node); } ts.isObjectLiteralElement = isObjectLiteralElement; /* @internal */ function isTypeReferenceType(node) { - return node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } ts.isTypeReferenceType = isTypeReferenceType; var MAX_SMI_X86 = 1073741823; @@ -14509,7 +14418,7 @@ var ts; } ts.isStringLiteralLike = isStringLiteralLike; function isJSDocLinkLike(node) { - return node.kind === 324 /* SyntaxKind.JSDocLink */ || node.kind === 325 /* SyntaxKind.JSDocLinkCode */ || node.kind === 326 /* SyntaxKind.JSDocLinkPlain */; + return node.kind === 327 /* SyntaxKind.JSDocLink */ || node.kind === 328 /* SyntaxKind.JSDocLinkCode */ || node.kind === 329 /* SyntaxKind.JSDocLinkPlain */; } ts.isJSDocLinkLike = isJSDocLinkLike; function hasRestParameter(s) { @@ -14519,7 +14428,7 @@ var ts; ts.hasRestParameter = hasRestParameter; function isRestParameter(node) { var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type; - return node.dotDotDotToken !== undefined || !!type && type.kind === 318 /* SyntaxKind.JSDocVariadicType */; + return node.dotDotDotToken !== undefined || !!type && type.kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isRestParameter = isRestParameter; // #endregion @@ -14777,7 +14686,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 305 /* SyntaxKind.SourceFile */) { + while (node && node.kind !== 308 /* SyntaxKind.SourceFile */) { node = node.parent; } return node; @@ -14793,11 +14702,11 @@ var ts; ts.isPlainJsFile = isPlainJsFile; function isStatementWithLocals(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return true; } return false; @@ -14993,7 +14902,7 @@ var ts; // the syntax list itself considers them as normal trivia. Therefore if we simply skip // trivia for the list, we may have skipped the JSDocComment as well. So we should process its // first child to determine the actual position of its first token. - if (node.kind === 348 /* SyntaxKind.SyntaxList */ && node._children.length > 0) { + if (node.kind === 351 /* SyntaxKind.SyntaxList */ && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, @@ -15058,7 +14967,6 @@ var ts; return emitNode && emitNode.flags || 0; } ts.getEmitFlags = getEmitFlags; - ; function getScriptTargetFeatures() { return { es2015: { @@ -15231,7 +15139,7 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { @@ -15263,11 +15171,11 @@ var ts; ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { // The only kind of module that can be missing a body is a shorthand ambient module. - return !!node && node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && (!node.body); + return !!node && node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ || - node.kind === 261 /* SyntaxKind.ModuleDeclaration */ || + return node.kind === 308 /* SyntaxKind.SourceFile */ || + node.kind === 264 /* SyntaxKind.ModuleDeclaration */ || ts.isFunctionLikeOrClassStaticBlockDeclaration(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -15284,9 +15192,9 @@ var ts; // - defined in the top level scope and source file is an external module // - defined inside ambient module declaration located in the top level scope and source file not an external module switch (node.parent.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return ts.isExternalModule(node.parent); - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -15341,26 +15249,30 @@ var ts; return false; } ts.isEffectiveStrictModeSourceFile = isEffectiveStrictModeSourceFile; + function isAmbientPropertyDeclaration(node) { + return !!(node.flags & 16777216 /* NodeFlags.Ambient */) || hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */); + } + ts.isAmbientPropertyDeclaration = isAmbientPropertyDeclaration; function isBlockScope(node, parentNode) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 263 /* SyntaxKind.CaseBlock */: - case 292 /* SyntaxKind.CatchClause */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 266 /* SyntaxKind.CaseBlock */: + case 295 /* SyntaxKind.CatchClause */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block return !ts.isFunctionLikeOrClassStaticBlockDeclaration(parentNode); @@ -15370,9 +15282,9 @@ var ts; ts.isBlockScope = isBlockScope; function isDeclarationWithTypeParameters(node) { switch (node.kind) { - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 323 /* SyntaxKind.JSDocSignature */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 326 /* SyntaxKind.JSDocSignature */: return true; default: ts.assertType(node); @@ -15382,25 +15294,25 @@ var ts; ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters; function isDeclarationWithTypeParameterChildren(node) { switch (node.kind) { - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: ts.assertType(node); @@ -15410,8 +15322,8 @@ var ts; ts.isDeclarationWithTypeParameterChildren = isDeclarationWithTypeParameterChildren; function isAnyImportSyntax(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return true; default: return false; @@ -15424,15 +15336,15 @@ var ts; ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire; function isLateVisibilityPaintedStatement(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return true; default: return false; @@ -15473,19 +15385,19 @@ var ts; } ts.getNameFromIndexInfo = getNameFromIndexInfo; function isComputedNonLiteralName(name) { - return name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression); + return name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression); } ts.isComputedNonLiteralName = isComputedNonLiteralName; function tryGetTextOfPropertyName(name) { switch (name.kind) { case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: - return name.escapedText; + return name.autoGenerateFlags ? undefined : name.escapedText; case 10 /* SyntaxKind.StringLiteral */: case 8 /* SyntaxKind.NumericLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return ts.escapeLeadingUnderscores(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: if (isStringOrNumericLiteralLike(name.expression)) return ts.escapeLeadingUnderscores(name.expression.text); return undefined; @@ -15505,16 +15417,16 @@ var ts; case 80 /* SyntaxKind.PrivateIdentifier */: case 79 /* SyntaxKind.Identifier */: return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (ts.isIdentifier(name.name) || ts.isPrivateIdentifier(name.name)) { return entityNameToString(name.expression) + "." + entityNameToString(name.name); } else { return ts.Debug.assertNever(name.name); } - case 311 /* SyntaxKind.JSDocMemberName */: + case 314 /* SyntaxKind.JSDocMemberName */: return entityNameToString(name.left) + entityNameToString(name.right); default: return ts.Debug.assertNever(name); @@ -15604,7 +15516,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 235 /* SyntaxKind.Block */) { + if (node.body && node.body.kind === 238 /* SyntaxKind.Block */) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -15618,7 +15530,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file @@ -15627,29 +15539,29 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 268 /* SyntaxKind.NamespaceImport */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 271 /* SyntaxKind.NamespaceImport */: errorNode = node.name; break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return getErrorSpanForArrowFunction(sourceFile, node); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: var start = ts.skipTrivia(sourceFile.text, node.pos); var end = node.statements.length > 0 ? node.statements[0].pos : node.end; return ts.createTextSpanFromBounds(start, end); @@ -15701,11 +15613,11 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 208 /* SyntaxKind.CallExpression */ && n.expression.kind === 106 /* SyntaxKind.SuperKeyword */; + return n.kind === 210 /* SyntaxKind.CallExpression */ && n.expression.kind === 106 /* SyntaxKind.SuperKeyword */; } ts.isSuperCall = isSuperCall; function isImportCall(n) { - return n.kind === 208 /* SyntaxKind.CallExpression */ && n.expression.kind === 100 /* SyntaxKind.ImportKeyword */; + return n.kind === 210 /* SyntaxKind.CallExpression */ && n.expression.kind === 100 /* SyntaxKind.ImportKeyword */; } ts.isImportCall = isImportCall; function isImportMeta(n) { @@ -15719,7 +15631,7 @@ var ts; } ts.isLiteralImportTypeNode = isLiteralImportTypeNode; function isPrologueDirective(node) { - return node.kind === 238 /* SyntaxKind.ExpressionStatement */ + return node.kind === 241 /* SyntaxKind.ExpressionStatement */ && node.expression.kind === 10 /* SyntaxKind.StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; @@ -15747,13 +15659,13 @@ var ts; } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; function getJSDocCommentRanges(node, text) { - var commentRanges = (node.kind === 164 /* SyntaxKind.Parameter */ || - node.kind === 163 /* SyntaxKind.TypeParameter */ || - node.kind === 213 /* SyntaxKind.FunctionExpression */ || - node.kind === 214 /* SyntaxKind.ArrowFunction */ || - node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ || - node.kind === 254 /* SyntaxKind.VariableDeclaration */ || - node.kind === 275 /* SyntaxKind.ExportSpecifier */) ? + var commentRanges = (node.kind === 166 /* SyntaxKind.Parameter */ || + node.kind === 165 /* SyntaxKind.TypeParameter */ || + node.kind === 215 /* SyntaxKind.FunctionExpression */ || + node.kind === 216 /* SyntaxKind.ArrowFunction */ || + node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || + node.kind === 257 /* SyntaxKind.VariableDeclaration */ || + node.kind === 278 /* SyntaxKind.ExportSpecifier */) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : ts.getLeadingCommentRanges(text, node.pos); // True if the comment starts with '/**' but not if it is '/**/' @@ -15769,48 +15681,48 @@ var ts; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; var defaultLibReferenceRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (177 /* SyntaxKind.FirstTypeNode */ <= node.kind && node.kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (179 /* SyntaxKind.FirstTypeNode */ <= node.kind && node.kind <= 202 /* SyntaxKind.LastTypeNode */) { return true; } switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return true; case 114 /* SyntaxKind.VoidKeyword */: - return node.parent.kind !== 217 /* SyntaxKind.VoidExpression */; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + return node.parent.kind !== 219 /* SyntaxKind.VoidExpression */; + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node); - case 163 /* SyntaxKind.TypeParameter */: - return node.parent.kind === 195 /* SyntaxKind.MappedType */ || node.parent.kind === 190 /* SyntaxKind.InferType */; + case 165 /* SyntaxKind.TypeParameter */: + return node.parent.kind === 197 /* SyntaxKind.MappedType */ || node.parent.kind === 192 /* SyntaxKind.InferType */; // Identifiers and qualified names may be type nodes, depending on their context. Climb // above them to find the lowest container case 79 /* SyntaxKind.Identifier */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 161 /* SyntaxKind.QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 163 /* SyntaxKind.QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } // At this point, node is either a qualified name or an identifier - ts.Debug.assert(node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 161 /* SyntaxKind.QualifiedName */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + ts.Debug.assert(node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 163 /* SyntaxKind.QualifiedName */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); // falls through - case 161 /* SyntaxKind.QualifiedName */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: case 108 /* SyntaxKind.ThisKeyword */: { var parent = node.parent; - if (parent.kind === 181 /* SyntaxKind.TypeQuery */) { + if (parent.kind === 183 /* SyntaxKind.TypeQuery */) { return false; } - if (parent.kind === 200 /* SyntaxKind.ImportType */) { + if (parent.kind === 202 /* SyntaxKind.ImportType */) { return !parent.isTypeOf; } // Do not recursively call isPartOfTypeNode on the parent. In the example: @@ -15819,40 +15731,40 @@ var ts; // // Calling isPartOfTypeNode would consider the qualified name A.B a type node. // Only C and A.B.C are type nodes. - if (177 /* SyntaxKind.FirstTypeNode */ <= parent.kind && parent.kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (179 /* SyntaxKind.FirstTypeNode */ <= parent.kind && parent.kind <= 202 /* SyntaxKind.LastTypeNode */) { return true; } switch (parent.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isHeritageClause(parent.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(parent); - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return node === parent.constraint; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return node === parent.constraint; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 164 /* SyntaxKind.Parameter */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: return node === parent.type; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return node === parent.type; - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return node === parent.type; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return node === parent.type; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return ts.contains(parent.typeArguments, node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -15877,23 +15789,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitor(node); - case 263 /* SyntaxKind.CaseBlock */: - case 235 /* SyntaxKind.Block */: - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 250 /* SyntaxKind.LabeledStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 266 /* SyntaxKind.CaseBlock */: + case 238 /* SyntaxKind.Block */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 253 /* SyntaxKind.LabeledStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 295 /* SyntaxKind.CatchClause */: return ts.forEachChild(node, traverse); } } @@ -15903,23 +15815,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } return; - case 260 /* SyntaxKind.EnumDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // These are not allowed inside a generator now, but eventually they may be allowed // as local types. Regardless, skip them to avoid the work. return; default: if (ts.isFunctionLike(node)) { - if (node.name && node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name && node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // Note that we will not include methods/accessors of a class because they would require // first descending into the class. This is by design. traverse(node.name.expression); @@ -15942,10 +15854,10 @@ var ts; * @param node The type node. */ function getRestParameterElementType(node) { - if (node && node.kind === 183 /* SyntaxKind.ArrayType */) { + if (node && node.kind === 185 /* SyntaxKind.ArrayType */) { return node.elementType; } - else if (node && node.kind === 178 /* SyntaxKind.TypeReference */) { + else if (node && node.kind === 180 /* SyntaxKind.TypeReference */) { return ts.singleOrUndefined(node.typeArguments); } else { @@ -15955,12 +15867,12 @@ var ts; ts.getRestParameterElementType = getRestParameterElementType; function getMembersOfDeclaration(node) { switch (node.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 182 /* SyntaxKind.TypeLiteral */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 184 /* SyntaxKind.TypeLiteral */: return node.members; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return node.properties; } } @@ -15968,14 +15880,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 299 /* SyntaxKind.EnumMember */: - case 164 /* SyntaxKind.Parameter */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 302 /* SyntaxKind.EnumMember */: + case 166 /* SyntaxKind.Parameter */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; } } @@ -15987,8 +15899,8 @@ var ts; } ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor; function isVariableDeclarationInVariableStatement(node) { - return node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */ - && node.parent.parent.kind === 237 /* SyntaxKind.VariableStatement */; + return node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */ + && node.parent.parent.kind === 240 /* SyntaxKind.VariableStatement */; } ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement; function isCommonJsExportedExpression(node) { @@ -16012,13 +15924,13 @@ var ts; ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return true; } return false; @@ -16029,7 +15941,7 @@ var ts; if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 250 /* SyntaxKind.LabeledStatement */) { + if (node.statement.kind !== 253 /* SyntaxKind.LabeledStatement */) { return node.statement; } node = node.statement; @@ -16037,17 +15949,17 @@ var ts; } ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel; function isFunctionBlock(node) { - return node && node.kind === 235 /* SyntaxKind.Block */ && ts.isFunctionLike(node.parent); + return node && node.kind === 238 /* SyntaxKind.Block */ && ts.isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 169 /* SyntaxKind.MethodDeclaration */ && node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return node && node.kind === 171 /* SyntaxKind.MethodDeclaration */ && node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethodOrAccessor(node) { - return (node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */) && - (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || - node.parent.kind === 226 /* SyntaxKind.ClassExpression */); + return (node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */) && + (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || + node.parent.kind === 228 /* SyntaxKind.ClassExpression */); } ts.isObjectLiteralOrClassExpressionMethodOrAccessor = isObjectLiteralOrClassExpressionMethodOrAccessor; function isIdentifierTypePredicate(predicate) { @@ -16060,7 +15972,7 @@ var ts; ts.isThisTypePredicate = isThisTypePredicate; function getPropertyAssignment(objectLiteral, key, key2) { return objectLiteral.properties.filter(function (property) { - if (property.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (property.kind === 299 /* SyntaxKind.PropertyAssignment */) { var propName = tryGetTextOfPropertyName(property.name); return key === propName || (!!key2 && key2 === propName); } @@ -16122,14 +16034,14 @@ var ts; } ts.getContainingFunctionOrClassStaticBlock = getContainingFunctionOrClassStaticBlock; function getThisContainer(node, includeArrowFunctions) { - ts.Debug.assert(node.kind !== 305 /* SyntaxKind.SourceFile */); + ts.Debug.assert(node.kind !== 308 /* SyntaxKind.SourceFile */); while (true) { node = node.parent; if (!node) { return ts.Debug.fail(); // If we never pass in a SourceFile, this should be unreachable, since we'll stop when we reach that. } switch (node.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'this' container. // A computed property name in a class needs to be a this container @@ -16144,9 +16056,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 164 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { + if (node.parent.kind === 166 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -16157,27 +16069,27 @@ var ts; node = node.parent; } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: if (!includeArrowFunctions) { continue; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 305 /* SyntaxKind.SourceFile */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 308 /* SyntaxKind.SourceFile */: return node; } } @@ -16190,17 +16102,17 @@ var ts; switch (node.kind) { // Arrow functions use the same scope, but may do so in a "delayed" manner // For example, `const getThis = () => this` may be before a super() call in a derived constructor - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: switch (node.parent.kind) { - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Object properties can have computed names; only method-like bodies start a new scope return true; default: @@ -16224,9 +16136,9 @@ var ts; var container = getThisContainer(node, /*includeArrowFunctions*/ false); if (container) { switch (container.kind) { - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return container; } } @@ -16248,28 +16160,28 @@ var ts; return node; } switch (node.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: node = node.parent; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (!stopOnFunctions) { continue; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return node; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 164 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { + if (node.parent.kind === 166 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -16285,14 +16197,14 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 213 /* SyntaxKind.FunctionExpression */ || func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 215 /* SyntaxKind.FunctionExpression */ || func.kind === 216 /* SyntaxKind.ArrowFunction */) { var prev = func; var parent = func.parent; - while (parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { prev = parent; parent = parent.parent; } - if (parent.kind === 208 /* SyntaxKind.CallExpression */ && parent.expression === prev) { + if (parent.kind === 210 /* SyntaxKind.CallExpression */ && parent.expression === prev) { return parent; } } @@ -16308,7 +16220,7 @@ var ts; */ function isSuperProperty(node) { var kind = node.kind; - return (kind === 206 /* SyntaxKind.PropertyAccessExpression */ || kind === 207 /* SyntaxKind.ElementAccessExpression */) + return (kind === 208 /* SyntaxKind.PropertyAccessExpression */ || kind === 209 /* SyntaxKind.ElementAccessExpression */) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */; } ts.isSuperProperty = isSuperProperty; @@ -16317,7 +16229,7 @@ var ts; */ function isThisProperty(node) { var kind = node.kind; - return (kind === 206 /* SyntaxKind.PropertyAccessExpression */ || kind === 207 /* SyntaxKind.ElementAccessExpression */) + return (kind === 208 /* SyntaxKind.PropertyAccessExpression */ || kind === 209 /* SyntaxKind.ElementAccessExpression */) && node.expression.kind === 108 /* SyntaxKind.ThisKeyword */; } ts.isThisProperty = isThisProperty; @@ -16336,15 +16248,15 @@ var ts; ts.isThisInitializedObjectBindingExpression = isThisInitializedObjectBindingExpression; function getEntityNameFromTypeNode(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return isEntityNameExpression(node.expression) ? node.expression : undefined; // TODO(rbuckton): These aren't valid TypeNodes, but we treat them as such because of `isPartOfTypeNode`, which returns `true` for things that aren't `TypeNode`s. case 79 /* SyntaxKind.Identifier */: - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return node; } return undefined; @@ -16352,10 +16264,10 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { switch (node.kind) { - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return node.tag; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return node.tagName; default: return node.expression; @@ -16368,25 +16280,25 @@ var ts; return false; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // classes are valid targets return true; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return parent.kind === 257 /* SyntaxKind.ClassDeclaration */; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + return parent.kind === 260 /* SyntaxKind.ClassDeclaration */; + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. return node.body !== undefined - && parent.kind === 257 /* SyntaxKind.ClassDeclaration */; - case 164 /* SyntaxKind.Parameter */: + && parent.kind === 260 /* SyntaxKind.ClassDeclaration */; + case 166 /* SyntaxKind.Parameter */: // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; return parent.body !== undefined - && (parent.kind === 171 /* SyntaxKind.Constructor */ - || parent.kind === 169 /* SyntaxKind.MethodDeclaration */ - || parent.kind === 173 /* SyntaxKind.SetAccessor */) - && grandparent.kind === 257 /* SyntaxKind.ClassDeclaration */; + && (parent.kind === 173 /* SyntaxKind.Constructor */ + || parent.kind === 171 /* SyntaxKind.MethodDeclaration */ + || parent.kind === 175 /* SyntaxKind.SetAccessor */) + && grandparent.kind === 260 /* SyntaxKind.ClassDeclaration */; } return false; } @@ -16402,11 +16314,11 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node, parent) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return ts.some(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); }); // TODO: GH#18217 - case 169 /* SyntaxKind.MethodDeclaration */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: return ts.some(node.parameters, function (p) { return nodeIsDecorated(p, node, parent); }); // TODO: GH#18217 default: return false; @@ -16422,9 +16334,9 @@ var ts; ts.classOrConstructorParameterIsDecorated = classOrConstructorParameterIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 280 /* SyntaxKind.JsxOpeningElement */ || - parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */ || - parent.kind === 281 /* SyntaxKind.JsxClosingElement */) { + if (parent.kind === 283 /* SyntaxKind.JsxOpeningElement */ || + parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || + parent.kind === 284 /* SyntaxKind.JsxClosingElement */) { return parent.tagName === node; } return false; @@ -16437,53 +16349,54 @@ var ts; case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 229 /* SyntaxKind.AsExpression */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 221 /* SyntaxKind.BinaryExpression */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 223 /* SyntaxKind.TemplateExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: - case 224 /* SyntaxKind.YieldExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 231 /* SyntaxKind.MetaProperty */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 225 /* SyntaxKind.TemplateExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: + case 226 /* SyntaxKind.YieldExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 233 /* SyntaxKind.MetaProperty */: return true; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return !ts.isHeritageClause(node.parent); - case 161 /* SyntaxKind.QualifiedName */: - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + case 163 /* SyntaxKind.QualifiedName */: + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); - case 311 /* SyntaxKind.JSDocMemberName */: + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); + case 314 /* SyntaxKind.JSDocMemberName */: while (ts.isJSDocMemberName(node.parent)) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); case 80 /* SyntaxKind.PrivateIdentifier */: return ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 101 /* SyntaxKind.InKeyword */; case 79 /* SyntaxKind.Identifier */: - if (node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) { + if (node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) { return true; } // falls through @@ -16501,60 +16414,62 @@ var ts; function isInExpressionContext(node) { var parent = node.parent; switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 299 /* SyntaxKind.EnumMember */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 205 /* SyntaxKind.BindingElement */: return parent.initializer === node; - case 238 /* SyntaxKind.ExpressionStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 247 /* SyntaxKind.ReturnStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 289 /* SyntaxKind.CaseClause */: - case 251 /* SyntaxKind.ThrowStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 292 /* SyntaxKind.CaseClause */: + case 254 /* SyntaxKind.ThrowStatement */: return parent.expression === node; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) || forInStatement.expression === node; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return node === parent.expression; - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return node === parent.expression; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return node === parent.expression; - case 165 /* SyntaxKind.Decorator */: - case 288 /* SyntaxKind.JsxExpression */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 167 /* SyntaxKind.Decorator */: + case 291 /* SyntaxKind.JsxExpression */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + case 301 /* SyntaxKind.SpreadAssignment */: return true; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return parent.expression === node && !isPartOfTypeNode(parent); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return parent.objectAssignmentInitializer === node; + case 235 /* SyntaxKind.SatisfiesExpression */: + return node === parent.expression; default: return isExpressionNode(parent); } } ts.isInExpressionContext = isInExpressionContext; function isPartOfTypeQuery(node) { - while (node.kind === 161 /* SyntaxKind.QualifiedName */ || node.kind === 79 /* SyntaxKind.Identifier */) { + while (node.kind === 163 /* SyntaxKind.QualifiedName */ || node.kind === 79 /* SyntaxKind.Identifier */) { node = node.parent; } - return node.kind === 181 /* SyntaxKind.TypeQuery */; + return node.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isPartOfTypeQuery = isPartOfTypeQuery; function isNamespaceReexportDeclaration(node) { @@ -16562,7 +16477,7 @@ var ts; } ts.isNamespaceReexportDeclaration = isNamespaceReexportDeclaration; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -16575,7 +16490,7 @@ var ts; } ts.getExternalModuleRequireArgument = getExternalModuleRequireArgument; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind !== 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJS(file) { @@ -16607,11 +16522,11 @@ var ts; ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && node.typeArguments && node.typeArguments.length === 2 && - (node.typeArguments[0].kind === 150 /* SyntaxKind.StringKeyword */ || node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */); + (node.typeArguments[0].kind === 152 /* SyntaxKind.StringKeyword */ || node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */); } ts.isJSDocIndexSignature = isJSDocIndexSignature; function isRequireCall(callExpression, requireStringLiteralLikeArgument) { - if (callExpression.kind !== 208 /* SyntaxKind.CallExpression */) { + if (callExpression.kind !== 210 /* SyntaxKind.CallExpression */) { return false; } var _a = callExpression, expression = _a.expression, args = _a.arguments; @@ -16720,11 +16635,11 @@ var ts; function getExpandoInitializer(initializer, isPrototypeAssignment) { if (ts.isCallExpression(initializer)) { var e = skipParentheses(initializer.expression); - return e.kind === 213 /* SyntaxKind.FunctionExpression */ || e.kind === 214 /* SyntaxKind.ArrowFunction */ ? initializer : undefined; + return e.kind === 215 /* SyntaxKind.FunctionExpression */ || e.kind === 216 /* SyntaxKind.ArrowFunction */ ? initializer : undefined; } - if (initializer.kind === 213 /* SyntaxKind.FunctionExpression */ || - initializer.kind === 226 /* SyntaxKind.ClassExpression */ || - initializer.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (initializer.kind === 215 /* SyntaxKind.FunctionExpression */ || + initializer.kind === 228 /* SyntaxKind.ClassExpression */ || + initializer.kind === 216 /* SyntaxKind.ArrowFunction */) { return initializer; } if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) { @@ -16970,7 +16885,7 @@ var ts; ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment; function isSpecialPropertyDeclaration(expr) { return isInJSFile(expr) && - expr.parent && expr.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && + expr.parent && expr.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && (!ts.isElementAccessExpression(expr) || isLiteralLikeElementAccess(expr)) && !!ts.getJSDocTypeTag(expr.parent); } @@ -16991,17 +16906,17 @@ var ts; return false; } var decl = symbol.valueDeclaration; - return decl.kind === 256 /* SyntaxKind.FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); + return decl.kind === 259 /* SyntaxKind.FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); } ts.isFunctionSymbol = isFunctionSymbol; function tryGetModuleSpecifierFromDeclaration(node) { var _a, _b; switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return (_a = ts.findAncestor(node.initializer, function (node) { return isRequireCall(node, /*requireStringLiteralLikeArgument*/ true); })) === null || _a === void 0 ? void 0 : _a.arguments[0]; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike); default: ts.Debug.assertNever(node); @@ -17014,14 +16929,14 @@ var ts; ts.importFromModuleSpecifier = importFromModuleSpecifier; function tryGetImportFromModuleSpecifier(node) { switch (node.parent.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.parent; - case 277 /* SyntaxKind.ExternalModuleReference */: + case 280 /* SyntaxKind.ExternalModuleReference */: return node.parent.parent; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return isImportCall(node.parent) || isRequireCall(node.parent, /*checkArg*/ false) ? node.parent : undefined; - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: ts.Debug.assert(ts.isStringLiteral(node)); return ts.tryCast(node.parent.parent, ts.isImportTypeNode); default: @@ -17031,16 +16946,16 @@ var ts; ts.tryGetImportFromModuleSpecifier = tryGetImportFromModuleSpecifier; function getExternalModuleName(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.moduleSpecifier; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */ ? node.moduleReference.expression : undefined; - case 200 /* SyntaxKind.ImportType */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + return node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */ ? node.moduleReference.expression : undefined; + case 202 /* SyntaxKind.ImportType */: return isLiteralImportTypeNode(node) ? node.argument.literal : undefined; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return node.arguments[0]; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return node.name.kind === 10 /* SyntaxKind.StringLiteral */ ? node.name : undefined; default: return ts.Debug.assertNever(node); @@ -17049,11 +16964,11 @@ var ts; ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.exportClause && ts.tryCast(node.exportClause, ts.isNamespaceExport); default: return ts.Debug.assertNever(node); @@ -17061,7 +16976,7 @@ var ts; } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 266 /* SyntaxKind.ImportDeclaration */ && !!node.importClause && !!node.importClause.name; + return node.kind === 269 /* SyntaxKind.ImportDeclaration */ && !!node.importClause && !!node.importClause.name; } ts.isDefaultImport = isDefaultImport; function forEachImportClauseDeclaration(node, action) { @@ -17082,13 +16997,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 164 /* SyntaxKind.Parameter */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return node.questionToken !== undefined; } } @@ -17102,7 +17017,7 @@ var ts; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function isJSDocTypeAlias(node) { - return node.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || node.kind === 338 /* SyntaxKind.JSDocCallbackTag */ || node.kind === 339 /* SyntaxKind.JSDocEnumTag */; + return node.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || node.kind === 341 /* SyntaxKind.JSDocCallbackTag */ || node.kind === 342 /* SyntaxKind.JSDocEnumTag */; } ts.isJSDocTypeAlias = isJSDocTypeAlias; function isTypeAlias(node) { @@ -17127,12 +17042,12 @@ var ts; } function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: var v = getSingleVariableOfVariableStatement(node); return v && v.initializer; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return node.initializer; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return node.initializer; } } @@ -17144,7 +17059,7 @@ var ts; function getNestedModuleDeclaration(node) { return ts.isModuleDeclaration(node) && node.body && - node.body.kind === 261 /* SyntaxKind.ModuleDeclaration */ + node.body.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? node.body : undefined; } @@ -17159,11 +17074,11 @@ var ts; if (ts.hasJSDocNodes(node)) { result = ts.addRange(result, filterOwnedJSDocTags(hostNode, ts.last(node.jsDoc))); } - if (node.kind === 164 /* SyntaxKind.Parameter */) { + if (node.kind === 166 /* SyntaxKind.Parameter */) { result = ts.addRange(result, (noCache ? ts.getJSDocParameterTagsNoCache : ts.getJSDocParameterTags)(node)); break; } - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { result = ts.addRange(result, (noCache ? ts.getJSDocTypeParameterTagsNoCache : ts.getJSDocTypeParameterTags)(node)); break; } @@ -17192,11 +17107,11 @@ var ts; } function getNextJSDocCommentLocation(node) { var parent = node.parent; - if (parent.kind === 296 /* SyntaxKind.PropertyAssignment */ || - parent.kind === 271 /* SyntaxKind.ExportAssignment */ || - parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - parent.kind === 247 /* SyntaxKind.ReturnStatement */ || + if (parent.kind === 299 /* SyntaxKind.PropertyAssignment */ || + parent.kind === 274 /* SyntaxKind.ExportAssignment */ || + parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + parent.kind === 250 /* SyntaxKind.ReturnStatement */ || getNestedModuleDeclaration(parent) || ts.isBinaryExpression(node) && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { return parent; @@ -17306,34 +17221,34 @@ var ts; var parent = node.parent; while (true) { switch (parent.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 63 /* SyntaxKind.EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* AssignmentKind.Definite */ : 2 /* AssignmentKind.Compound */ : 0 /* AssignmentKind.None */; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: var unaryOperator = parent.operator; return unaryOperator === 45 /* SyntaxKind.PlusPlusToken */ || unaryOperator === 46 /* SyntaxKind.MinusMinusToken */ ? 2 /* AssignmentKind.Compound */ : 0 /* AssignmentKind.None */; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return parent.initializer === node ? 1 /* AssignmentKind.Definite */ : 0 /* AssignmentKind.None */; - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 232 /* SyntaxKind.NonNullExpression */: node = parent; break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: node = parent.parent; break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: if (parent.name !== node) { return 0 /* AssignmentKind.None */; } node = parent.parent; break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (parent.name === node) { return 0 /* AssignmentKind.None */; } @@ -17360,22 +17275,22 @@ var ts; */ function isNodeWithPossibleHoistedDeclaration(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 237 /* SyntaxKind.VariableStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 263 /* SyntaxKind.CaseBlock */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 250 /* SyntaxKind.LabeledStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 238 /* SyntaxKind.Block */: + case 240 /* SyntaxKind.VariableStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 266 /* SyntaxKind.CaseBlock */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 253 /* SyntaxKind.LabeledStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 295 /* SyntaxKind.CatchClause */: return true; } return false; @@ -17392,11 +17307,11 @@ var ts; return node; } function walkUpParenthesizedTypes(node) { - return walkUp(node, 191 /* SyntaxKind.ParenthesizedType */); + return walkUp(node, 193 /* SyntaxKind.ParenthesizedType */); } ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes; function walkUpParenthesizedExpressions(node) { - return walkUp(node, 212 /* SyntaxKind.ParenthesizedExpression */); + return walkUp(node, 214 /* SyntaxKind.ParenthesizedExpression */); } ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions; /** @@ -17406,7 +17321,7 @@ var ts; */ function walkUpParenthesizedTypesAndGetParentAndChild(node) { var child; - while (node && node.kind === 191 /* SyntaxKind.ParenthesizedType */) { + while (node && node.kind === 193 /* SyntaxKind.ParenthesizedType */) { child = node; node = node.parent; } @@ -17428,11 +17343,11 @@ var ts; ts.skipParentheses = skipParentheses; // a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped function isDeleteTarget(node) { - if (node.kind !== 206 /* SyntaxKind.PropertyAccessExpression */ && node.kind !== 207 /* SyntaxKind.ElementAccessExpression */) { + if (node.kind !== 208 /* SyntaxKind.PropertyAccessExpression */ && node.kind !== 209 /* SyntaxKind.ElementAccessExpression */) { return false; } node = walkUpParenthesizedExpressions(node.parent); - return node && node.kind === 215 /* SyntaxKind.DeleteExpression */; + return node && node.kind === 217 /* SyntaxKind.DeleteExpression */; } ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { @@ -17485,7 +17400,7 @@ var ts; ts.getDeclarationFromName = getDeclarationFromName; function isLiteralComputedPropertyDeclarationName(node) { return isStringOrNumericLiteralLike(node) && - node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */ && + node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */ && ts.isDeclaration(node.parent.parent); } ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; @@ -17493,29 +17408,29 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 299 /* SyntaxKind.EnumMember */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 302 /* SyntaxKind.EnumMember */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: // Name on right hand side of dot in a type query or type reference return parent.right === node; - case 203 /* SyntaxKind.BindingElement */: - case 270 /* SyntaxKind.ImportSpecifier */: + case 205 /* SyntaxKind.BindingElement */: + case 273 /* SyntaxKind.ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 275 /* SyntaxKind.ExportSpecifier */: - case 285 /* SyntaxKind.JsxAttribute */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 288 /* SyntaxKind.JsxAttribute */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: // Any name in an export specifier or JSX Attribute or Jsx Element return true; } @@ -17538,14 +17453,14 @@ var ts; // const x = require("...").y // const { x } = require("...").y function isAliasSymbolDeclaration(node) { - if (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ || - node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ || - node.kind === 267 /* SyntaxKind.ImportClause */ && !!node.name || - node.kind === 268 /* SyntaxKind.NamespaceImport */ || - node.kind === 274 /* SyntaxKind.NamespaceExport */ || - node.kind === 270 /* SyntaxKind.ImportSpecifier */ || - node.kind === 275 /* SyntaxKind.ExportSpecifier */ || - node.kind === 271 /* SyntaxKind.ExportAssignment */ && exportAssignmentIsAlias(node)) { + if (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ || + node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ || + node.kind === 270 /* SyntaxKind.ImportClause */ && !!node.name || + node.kind === 271 /* SyntaxKind.NamespaceImport */ || + node.kind === 277 /* SyntaxKind.NamespaceExport */ || + node.kind === 273 /* SyntaxKind.ImportSpecifier */ || + node.kind === 278 /* SyntaxKind.ExportSpecifier */ || + node.kind === 274 /* SyntaxKind.ExportAssignment */ && exportAssignmentIsAlias(node)) { return true; } return isInJSFile(node) && (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */ && exportAssignmentIsAlias(node) || @@ -17558,18 +17473,18 @@ var ts; ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getAliasDeclarationFromName(node) { switch (node.parent.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 271 /* SyntaxKind.ExportAssignment */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 274 /* SyntaxKind.NamespaceExport */: + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 274 /* SyntaxKind.ExportAssignment */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 277 /* SyntaxKind.NamespaceExport */: return node.parent; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.parent; - } while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */); + } while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */); return getAliasDeclarationFromName(node); } } @@ -17588,7 +17503,7 @@ var ts; } ts.getExportAssignmentExpression = getExportAssignmentExpression; function getPropertyAssignmentAliasLikeExpression(node) { - return node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? node.name : node.kind === 296 /* SyntaxKind.PropertyAssignment */ ? node.initializer : + return node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? node.name : node.kind === 299 /* SyntaxKind.PropertyAssignment */ ? node.initializer : node.parent.right; } ts.getPropertyAssignmentAliasLikeExpression = getPropertyAssignmentAliasLikeExpression; @@ -17654,11 +17569,11 @@ var ts; } ts.getAncestor = getAncestor; function isKeyword(token) { - return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 160 /* SyntaxKind.LastKeyword */; + return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 162 /* SyntaxKind.LastKeyword */; } ts.isKeyword = isKeyword; function isContextualKeyword(token) { - return 126 /* SyntaxKind.FirstContextualKeyword */ <= token && token <= 160 /* SyntaxKind.LastContextualKeyword */; + return 126 /* SyntaxKind.FirstContextualKeyword */ <= token && token <= 162 /* SyntaxKind.LastContextualKeyword */; } ts.isContextualKeyword = isContextualKeyword; function isNonContextualKeyword(token) { @@ -17702,15 +17617,15 @@ var ts; } var flags = 0 /* FunctionFlags.Normal */; switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: if (node.asteriskToken) { flags |= 1 /* FunctionFlags.Generator */; } // falls through - case 214 /* SyntaxKind.ArrowFunction */: - if (hasSyntacticModifier(node, 256 /* ModifierFlags.Async */)) { + case 216 /* SyntaxKind.ArrowFunction */: + if (hasSyntacticModifier(node, 512 /* ModifierFlags.Async */)) { flags |= 2 /* FunctionFlags.Async */; } break; @@ -17723,13 +17638,13 @@ var ts; ts.getFunctionFlags = getFunctionFlags; function isAsyncFunction(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: return node.body !== undefined && node.asteriskToken === undefined - && hasSyntacticModifier(node, 256 /* ModifierFlags.Async */); + && hasSyntacticModifier(node, 512 /* ModifierFlags.Async */); } return false; } @@ -17756,7 +17671,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - if (!(name.kind === 162 /* SyntaxKind.ComputedPropertyName */ || name.kind === 207 /* SyntaxKind.ElementAccessExpression */)) { + if (!(name.kind === 164 /* SyntaxKind.ComputedPropertyName */ || name.kind === 209 /* SyntaxKind.ElementAccessExpression */)) { return false; } var expr = ts.isElementAccessExpression(name) ? skipParentheses(name.argumentExpression) : name.expression; @@ -17772,7 +17687,7 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 8 /* SyntaxKind.NumericLiteral */: return ts.escapeLeadingUnderscores(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: var nameExpression = name.expression; if (isStringOrNumericLiteralLike(nameExpression)) { return ts.escapeLeadingUnderscores(nameExpression.text); @@ -17838,11 +17753,11 @@ var ts; ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 164 /* SyntaxKind.Parameter */; + return root.kind === 166 /* SyntaxKind.Parameter */; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 203 /* SyntaxKind.BindingElement */) { + while (node.kind === 205 /* SyntaxKind.BindingElement */) { node = node.parent.parent; } return node; @@ -17850,15 +17765,15 @@ var ts; ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 305 /* SyntaxKind.SourceFile */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 308 /* SyntaxKind.SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(range) { @@ -17877,23 +17792,23 @@ var ts; })(Associativity = ts.Associativity || (ts.Associativity = {})); function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 209 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 211 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return hasArguments ? 0 /* Associativity.Left */ : 1 /* Associativity.Right */; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 224 /* SyntaxKind.YieldExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 226 /* SyntaxKind.YieldExpression */: return 1 /* Associativity.Right */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (operator) { case 42 /* SyntaxKind.AsteriskAsteriskToken */: case 63 /* SyntaxKind.EqualsToken */: @@ -17920,15 +17835,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 209 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 211 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (expression.kind === 223 /* SyntaxKind.BinaryExpression */) { return expression.operatorToken.kind; } - else if (expression.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || expression.kind === 220 /* SyntaxKind.PostfixUnaryExpression */) { + else if (expression.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || expression.kind === 222 /* SyntaxKind.PostfixUnaryExpression */) { return expression.operator; } else { @@ -18107,15 +18022,15 @@ var ts; })(OperatorPrecedence = ts.OperatorPrecedence || (ts.OperatorPrecedence = {})); function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { switch (nodeKind) { - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return 0 /* OperatorPrecedence.Comma */; - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return 1 /* OperatorPrecedence.Spread */; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return 2 /* OperatorPrecedence.Yield */; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return 4 /* OperatorPrecedence.Conditional */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (operatorKind) { case 27 /* SyntaxKind.CommaToken */: return 0 /* OperatorPrecedence.Comma */; @@ -18140,26 +18055,27 @@ var ts; return getBinaryOperatorPrecedence(operatorKind); } // TODO: Should prefix `++` and `--` be moved to the `Update` precedence? - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 218 /* SyntaxKind.AwaitExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return 16 /* OperatorPrecedence.Unary */; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return 17 /* OperatorPrecedence.Update */; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return 18 /* OperatorPrecedence.LeftHandSide */; - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return hasArguments ? 19 /* OperatorPrecedence.Member */ : 18 /* OperatorPrecedence.LeftHandSide */; - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 231 /* SyntaxKind.MetaProperty */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 233 /* SyntaxKind.MetaProperty */: return 19 /* OperatorPrecedence.Member */; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return 11 /* OperatorPrecedence.Relational */; case 108 /* SyntaxKind.ThisKeyword */: case 106 /* SyntaxKind.SuperKeyword */: @@ -18171,19 +18087,19 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 226 /* SyntaxKind.ClassExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: case 13 /* SyntaxKind.RegularExpressionLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 225 /* SyntaxKind.TemplateExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: return 20 /* OperatorPrecedence.Primary */; default: return -1 /* OperatorPrecedence.Invalid */; @@ -18215,7 +18131,8 @@ var ts; case 33 /* SyntaxKind.GreaterThanEqualsToken */: case 102 /* SyntaxKind.InstanceOfKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: + case 150 /* SyntaxKind.SatisfiesKeyword */: return 11 /* OperatorPrecedence.Relational */; case 47 /* SyntaxKind.LessThanLessThanToken */: case 48 /* SyntaxKind.GreaterThanGreaterThanToken */: @@ -18239,7 +18156,7 @@ var ts; function getSemanticJsxChildren(children) { return ts.filter(children, function (i) { switch (i.kind) { - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return !!i.expression; case 11 /* SyntaxKind.JsxText */: return !i.containsOnlyTriviaWhiteSpaces; @@ -18295,7 +18212,7 @@ var ts; } diagnostics = nonFileDiagnostics; } - ts.insertSorted(diagnostics, diagnostic, compareDiagnostics); + ts.insertSorted(diagnostics, diagnostic, compareDiagnosticsSkipRelatedInformation); } function getGlobalDiagnostics() { hasReadNonFileDiagnostics = true; @@ -18831,7 +18748,7 @@ var ts; while (ts.isQualifiedName(node.parent) && node.parent.left === node) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */; + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isThisInTypeQuery = isThisInTypeQuery; function identifierIsThisKeyword(id) { @@ -18846,10 +18763,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 172 /* SyntaxKind.GetAccessor */) { + if (accessor.kind === 174 /* SyntaxKind.GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (accessor.kind === 175 /* SyntaxKind.SetAccessor */) { setAccessor = accessor; } else { @@ -18869,10 +18786,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 172 /* SyntaxKind.GetAccessor */ && !getAccessor) { + if (member.kind === 174 /* SyntaxKind.GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 173 /* SyntaxKind.SetAccessor */ && !setAccessor) { + if (member.kind === 175 /* SyntaxKind.SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -18921,7 +18838,7 @@ var ts; ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations; /** template tags are only available when a typedef isn't already using them */ function isNonTypeAliasTemplate(tag) { - return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 320 /* SyntaxKind.JSDoc */ && tag.parent.tags.some(isJSDocTypeAlias)); + return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 323 /* SyntaxKind.JSDoc */ && tag.parent.tags.some(isJSDocTypeAlias)); } /** * Gets the effective type annotation of the value parameter of a set accessor. If the node @@ -19154,13 +19071,17 @@ var ts; } ts.hasOverrideModifier = hasOverrideModifier; function hasAbstractModifier(node) { - return hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */); + return hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */); } ts.hasAbstractModifier = hasAbstractModifier; function hasAmbientModifier(node) { return hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */); } ts.hasAmbientModifier = hasAmbientModifier; + function hasAccessorModifier(node) { + return hasSyntacticModifier(node, 128 /* ModifierFlags.Accessor */); + } + ts.hasAccessorModifier = hasAccessorModifier; function hasEffectiveReadonlyModifier(node) { return hasEffectiveModifier(node, 64 /* ModifierFlags.Readonly */); } @@ -19178,7 +19099,7 @@ var ts; } ts.getSelectedSyntacticModifierFlags = getSelectedSyntacticModifierFlags; function getModifierFlagsWorker(node, includeJSDoc, alwaysIncludeJSDoc) { - if (node.kind >= 0 /* SyntaxKind.FirstToken */ && node.kind <= 160 /* SyntaxKind.LastToken */) { + if (node.kind >= 0 /* SyntaxKind.FirstToken */ && node.kind <= 162 /* SyntaxKind.LastToken */) { return 0 /* ModifierFlags.None */; } if (!(node.modifierFlagsCache & 536870912 /* ModifierFlags.HasComputedFlags */)) { @@ -19270,25 +19191,22 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: return 4 /* ModifierFlags.Public */; case 122 /* SyntaxKind.ProtectedKeyword */: return 16 /* ModifierFlags.Protected */; case 121 /* SyntaxKind.PrivateKeyword */: return 8 /* ModifierFlags.Private */; - case 126 /* SyntaxKind.AbstractKeyword */: return 128 /* ModifierFlags.Abstract */; + case 126 /* SyntaxKind.AbstractKeyword */: return 256 /* ModifierFlags.Abstract */; + case 127 /* SyntaxKind.AccessorKeyword */: return 128 /* ModifierFlags.Accessor */; case 93 /* SyntaxKind.ExportKeyword */: return 1 /* ModifierFlags.Export */; - case 135 /* SyntaxKind.DeclareKeyword */: return 2 /* ModifierFlags.Ambient */; + case 136 /* SyntaxKind.DeclareKeyword */: return 2 /* ModifierFlags.Ambient */; case 85 /* SyntaxKind.ConstKeyword */: return 2048 /* ModifierFlags.Const */; - case 88 /* SyntaxKind.DefaultKeyword */: return 512 /* ModifierFlags.Default */; - case 131 /* SyntaxKind.AsyncKeyword */: return 256 /* ModifierFlags.Async */; - case 145 /* SyntaxKind.ReadonlyKeyword */: return 64 /* ModifierFlags.Readonly */; - case 159 /* SyntaxKind.OverrideKeyword */: return 16384 /* ModifierFlags.Override */; + case 88 /* SyntaxKind.DefaultKeyword */: return 1024 /* ModifierFlags.Default */; + case 132 /* SyntaxKind.AsyncKeyword */: return 512 /* ModifierFlags.Async */; + case 146 /* SyntaxKind.ReadonlyKeyword */: return 64 /* ModifierFlags.Readonly */; + case 161 /* SyntaxKind.OverrideKeyword */: return 16384 /* ModifierFlags.Override */; case 101 /* SyntaxKind.InKeyword */: return 32768 /* ModifierFlags.In */; - case 144 /* SyntaxKind.OutKeyword */: return 65536 /* ModifierFlags.Out */; - case 165 /* SyntaxKind.Decorator */: return 131072 /* ModifierFlags.Decorator */; + case 145 /* SyntaxKind.OutKeyword */: return 65536 /* ModifierFlags.Out */; + case 167 /* SyntaxKind.Decorator */: return 131072 /* ModifierFlags.Decorator */; } return 0 /* ModifierFlags.None */; } ts.modifierToFlag = modifierToFlag; - function createModifiers(modifierFlags) { - return modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; - } - ts.createModifiers = createModifiers; function isLogicalOperator(token) { return token === 56 /* SyntaxKind.BarBarToken */ || token === 55 /* SyntaxKind.AmpersandAmpersandToken */ @@ -19338,8 +19256,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { var kind = node.left.kind; - return kind === 205 /* SyntaxKind.ObjectLiteralExpression */ - || kind === 204 /* SyntaxKind.ArrayLiteralExpression */; + return kind === 207 /* SyntaxKind.ObjectLiteralExpression */ + || kind === 206 /* SyntaxKind.ArrayLiteralExpression */; } return false; } @@ -19356,12 +19274,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.left; } while (node.kind !== 79 /* SyntaxKind.Identifier */); return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: do { node = node.expression; } while (node.kind !== 79 /* SyntaxKind.Identifier */); @@ -19373,9 +19291,9 @@ var ts; return node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 108 /* SyntaxKind.ThisKeyword */ || node.kind === 106 /* SyntaxKind.SuperKeyword */ - || node.kind === 231 /* SyntaxKind.MetaProperty */ - || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && isDottedName(node.expression) - || node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ && isDottedName(node.expression); + || node.kind === 233 /* SyntaxKind.MetaProperty */ + || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isDottedName(node.expression) + || node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ && isDottedName(node.expression); } ts.isDottedName = isDottedName; function isPropertyAccessEntityNameExpression(node) { @@ -19406,8 +19324,8 @@ var ts; } ts.isPrototypeAccess = isPrototypeAccess; function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 161 /* SyntaxKind.QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 163 /* SyntaxKind.QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isRightSideOfAccessExpression(node) { @@ -19422,12 +19340,12 @@ var ts; } ts.isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName = isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName; function isEmptyObjectLiteral(expression) { - return expression.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + return expression.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && expression.properties.length === 0; } ts.isEmptyObjectLiteral = isEmptyObjectLiteral; function isEmptyArrayLiteral(expression) { - return expression.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && + return expression.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && expression.elements.length === 0; } ts.isEmptyArrayLiteral = isEmptyArrayLiteral; @@ -19443,7 +19361,7 @@ var ts; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; function isExportDefaultSymbol(symbol) { - return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 512 /* ModifierFlags.Default */); + return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 1024 /* ModifierFlags.Default */); } /** Return ".ts", ".d.ts", or ".tsx", if that is the extension. */ function tryExtractTSExtension(fileName) { @@ -19588,21 +19506,17 @@ var ts; return getStringFromExpandedCharCodes(expandedCharCodes); } ts.base64decode = base64decode; + function readJsonOrUndefined(path, hostOrText) { + var jsonText = ts.isString(hostOrText) ? hostOrText : hostOrText.readFile(path); + if (!jsonText) + return undefined; + // gracefully handle if readFile fails or returns not JSON + var result = ts.parseConfigFileTextToJson(path, jsonText); + return !result.error ? result.config : undefined; + } + ts.readJsonOrUndefined = readJsonOrUndefined; function readJson(path, host) { - try { - var jsonText = host.readFile(path); - if (!jsonText) - return {}; - var result = ts.parseConfigFileTextToJson(path, jsonText); - if (result.error) { - return {}; - } - return result.config; - } - catch (e) { - // gracefully handle if readFile fails or returns not JSON - return {}; - } + return readJsonOrUndefined(path, host) || {}; } ts.readJson = readJson; function directoryProbablyExists(directoryName, host) { @@ -19761,8 +19675,8 @@ var ts; var parseNode = ts.getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return parseNode === parseNode.parent.name; } } @@ -19778,7 +19692,7 @@ var ts; } function isWatchSet(options) { // Firefox has Object.prototype.watch - return options.watch && options.hasOwnProperty("watch"); + return options.watch && ts.hasProperty(options, "watch"); } ts.isWatchSet = isWatchSet; function closeFileWatcher(watcher) { @@ -19842,35 +19756,35 @@ var ts; if (!parent) return 0 /* AccessKind.Read */; switch (parent.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return accessKind(parent); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var operator = parent.operator; return operator === 45 /* SyntaxKind.PlusPlusToken */ || operator === 46 /* SyntaxKind.MinusMinusToken */ ? writeOrReadWrite() : 0 /* AccessKind.Read */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var _a = parent, left = _a.left, operatorToken = _a.operatorToken; return left === node && isAssignmentOperator(operatorToken.kind) ? operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ ? 1 /* AccessKind.Write */ : writeOrReadWrite() : 0 /* AccessKind.Read */; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return parent.name !== node ? 0 /* AccessKind.Read */ : accessKind(parent); - case 296 /* SyntaxKind.PropertyAssignment */: { + case 299 /* SyntaxKind.PropertyAssignment */: { var parentAccess = accessKind(parent.parent); // In `({ x: varname }) = { x: 1 }`, the left `x` is a read, the right `x` is a write. return node === parent.name ? reverseAccessKind(parentAccess) : parentAccess; } - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // Assume it's the local variable being accessed, since we don't check public properties for --noUnusedLocals. return node === parent.objectAssignmentInitializer ? 0 /* AccessKind.Read */ : accessKind(parent.parent); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return accessKind(parent); default: return 0 /* AccessKind.Read */; } function writeOrReadWrite() { // If grandparent is not an ExpressionStatement, this is used as an expression in addition to having a side effect. - return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 238 /* SyntaxKind.ExpressionStatement */ ? 1 /* AccessKind.Write */ : 2 /* AccessKind.ReadWrite */; + return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 241 /* SyntaxKind.ExpressionStatement */ ? 1 /* AccessKind.Write */ : 2 /* AccessKind.ReadWrite */; } } function reverseAccessKind(a) { @@ -19952,7 +19866,7 @@ var ts; function isAbstractConstructorSymbol(symbol) { if (symbol.flags & 32 /* SymbolFlags.Class */) { var declaration = getClassLikeDeclarationOfSymbol(symbol); - return !!declaration && hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */); + return !!declaration && hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */); } return false; } @@ -20014,37 +19928,37 @@ var ts; } ts.isObjectTypeDeclaration = isObjectTypeDeclaration; function isTypeNodeKind(kind) { - return (kind >= 177 /* SyntaxKind.FirstTypeNode */ && kind <= 200 /* SyntaxKind.LastTypeNode */) - || kind === 130 /* SyntaxKind.AnyKeyword */ - || kind === 155 /* SyntaxKind.UnknownKeyword */ - || kind === 147 /* SyntaxKind.NumberKeyword */ - || kind === 158 /* SyntaxKind.BigIntKeyword */ - || kind === 148 /* SyntaxKind.ObjectKeyword */ - || kind === 133 /* SyntaxKind.BooleanKeyword */ - || kind === 150 /* SyntaxKind.StringKeyword */ - || kind === 151 /* SyntaxKind.SymbolKeyword */ + return (kind >= 179 /* SyntaxKind.FirstTypeNode */ && kind <= 202 /* SyntaxKind.LastTypeNode */) + || kind === 131 /* SyntaxKind.AnyKeyword */ + || kind === 157 /* SyntaxKind.UnknownKeyword */ + || kind === 148 /* SyntaxKind.NumberKeyword */ + || kind === 160 /* SyntaxKind.BigIntKeyword */ + || kind === 149 /* SyntaxKind.ObjectKeyword */ + || kind === 134 /* SyntaxKind.BooleanKeyword */ + || kind === 152 /* SyntaxKind.StringKeyword */ + || kind === 153 /* SyntaxKind.SymbolKeyword */ || kind === 114 /* SyntaxKind.VoidKeyword */ - || kind === 153 /* SyntaxKind.UndefinedKeyword */ - || kind === 143 /* SyntaxKind.NeverKeyword */ - || kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ - || kind === 312 /* SyntaxKind.JSDocAllType */ - || kind === 313 /* SyntaxKind.JSDocUnknownType */ - || kind === 314 /* SyntaxKind.JSDocNullableType */ - || kind === 315 /* SyntaxKind.JSDocNonNullableType */ - || kind === 316 /* SyntaxKind.JSDocOptionalType */ - || kind === 317 /* SyntaxKind.JSDocFunctionType */ - || kind === 318 /* SyntaxKind.JSDocVariadicType */; + || kind === 155 /* SyntaxKind.UndefinedKeyword */ + || kind === 144 /* SyntaxKind.NeverKeyword */ + || kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ + || kind === 315 /* SyntaxKind.JSDocAllType */ + || kind === 316 /* SyntaxKind.JSDocUnknownType */ + || kind === 317 /* SyntaxKind.JSDocNullableType */ + || kind === 318 /* SyntaxKind.JSDocNonNullableType */ + || kind === 319 /* SyntaxKind.JSDocOptionalType */ + || kind === 320 /* SyntaxKind.JSDocFunctionType */ + || kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isTypeNodeKind = isTypeNodeKind; function isAccessExpression(node) { - return node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 207 /* SyntaxKind.ElementAccessExpression */; + return node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 209 /* SyntaxKind.ElementAccessExpression */; } ts.isAccessExpression = isAccessExpression; function getNameOfAccessExpression(node) { - if (node.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { return node.name; } - ts.Debug.assert(node.kind === 207 /* SyntaxKind.ElementAccessExpression */); + ts.Debug.assert(node.kind === 209 /* SyntaxKind.ElementAccessExpression */); return node.argumentExpression; } ts.getNameOfAccessExpression = getNameOfAccessExpression; @@ -20059,7 +19973,7 @@ var ts; } ts.isBundleFileTextLike = isBundleFileTextLike; function isNamedImportsOrExports(node) { - return node.kind === 269 /* SyntaxKind.NamedImports */ || node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 272 /* SyntaxKind.NamedImports */ || node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedImportsOrExports = isNamedImportsOrExports; function getLeftmostAccessExpression(expr) { @@ -20074,13 +19988,13 @@ var ts; return walkAccessExpression(name.parent); } function walkAccessExpression(access) { - if (access.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (access.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var res = action(access.name); if (res !== undefined) { return res; } } - else if (access.kind === 207 /* SyntaxKind.ElementAccessExpression */) { + else if (access.kind === 209 /* SyntaxKind.ElementAccessExpression */) { if (ts.isIdentifier(access.argumentExpression) || ts.isStringLiteralLike(access.argumentExpression)) { var res = action(access.argumentExpression); if (res !== undefined) { @@ -20107,28 +20021,29 @@ var ts; function getLeftmostExpression(node, stopAtCallExpressions) { while (true) { switch (node.kind) { - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: node = node.operand; continue; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: node = node.left; continue; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: node = node.condition; continue; - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: node = node.tag; continue; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (stopAtCallExpressions) { return node; } // falls through - case 229 /* SyntaxKind.AsExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: node = node.expression; continue; } @@ -21364,17 +21279,17 @@ var ts; return ts.isIdentifier(useSite) && ts.isShorthandPropertyAssignment(useSite.parent) && useSite.parent.name === useSite; } function isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(node) { - while (node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { node = node.parent; } - if (node.kind !== 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.kind !== 164 /* SyntaxKind.ComputedPropertyName */) { return false; } - if (hasSyntacticModifier(node.parent, 128 /* ModifierFlags.Abstract */)) { + if (hasSyntacticModifier(node.parent, 256 /* ModifierFlags.Abstract */)) { return true; } var containerKind = node.parent.parent.kind; - return containerKind === 258 /* SyntaxKind.InterfaceDeclaration */ || containerKind === 182 /* SyntaxKind.TypeLiteral */; + return containerKind === 261 /* SyntaxKind.InterfaceDeclaration */ || containerKind === 184 /* SyntaxKind.TypeLiteral */; } /** Returns true for an identifier in 1) an `implements` clause, and 2) an `extends` clause of an interface. */ function isIdentifierInNonEmittingHeritageClause(node) { @@ -21382,16 +21297,16 @@ var ts; return false; var heritageClause = ts.findAncestor(node.parent, function (parent) { switch (parent.kind) { - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return true; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return false; default: return "quit"; } }); - return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 /* SyntaxKind.ImplementsKeyword */ || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 258 /* SyntaxKind.InterfaceDeclaration */; + return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 /* SyntaxKind.ImplementsKeyword */ || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 261 /* SyntaxKind.InterfaceDeclaration */; } function isIdentifierTypeReference(node) { return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName); @@ -21552,22 +21467,22 @@ var ts; if (!node.parent) return undefined; switch (node.kind) { - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: var parent_1 = node.parent; - return parent_1.kind === 190 /* SyntaxKind.InferType */ ? undefined : parent_1.typeParameters; - case 164 /* SyntaxKind.Parameter */: + return parent_1.kind === 192 /* SyntaxKind.InferType */ ? undefined : parent_1.typeParameters; + case 166 /* SyntaxKind.Parameter */: return node.parent.parameters; - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: + case 201 /* SyntaxKind.TemplateLiteralTypeSpan */: return node.parent.templateSpans; - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return node.parent.templateSpans; - case 165 /* SyntaxKind.Decorator */: { + case 167 /* SyntaxKind.Decorator */: { var parent_2 = node.parent; return ts.canHaveDecorators(parent_2) ? parent_2.modifiers : ts.canHaveIllegalDecorators(parent_2) ? parent_2.illegalDecorators : undefined; } - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return node.parent.heritageClauses; } var parent = node.parent; @@ -21575,45 +21490,45 @@ var ts; return ts.isJSDocTypeLiteral(node.parent) ? undefined : node.parent.tags; } switch (parent.kind) { - case 182 /* SyntaxKind.TypeLiteral */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.isTypeElement(node) ? parent.members : undefined; - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return parent.types; - case 184 /* SyntaxKind.TupleType */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 351 /* SyntaxKind.CommaListExpression */: - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 186 /* SyntaxKind.TupleType */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 354 /* SyntaxKind.CommaListExpression */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return parent.elements; - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 286 /* SyntaxKind.JsxAttributes */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 289 /* SyntaxKind.JsxAttributes */: return parent.properties; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return ts.isTypeNode(node) ? parent.typeArguments : parent.expression === node ? undefined : parent.arguments; - case 278 /* SyntaxKind.JsxElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 281 /* SyntaxKind.JsxElement */: + case 285 /* SyntaxKind.JsxFragment */: return ts.isJsxChild(node) ? parent.children : undefined; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return ts.isTypeNode(node) ? parent.typeArguments : undefined; - case 235 /* SyntaxKind.Block */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 265 /* SyntaxKind.ModuleBlock */: return parent.statements; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return parent.clauses; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.isClassElement(node) ? parent.members : undefined; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.isEnumMember(node) ? parent.members : undefined; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return parent.statements; } } @@ -21625,7 +21540,7 @@ var ts; if (ts.some(node.parameters, function (p) { return !getEffectiveTypeAnnotationNode(p); })) { return true; } - if (node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind !== 216 /* SyntaxKind.ArrowFunction */) { // If the first parameter is not an explicit 'this' parameter, then the function has // an implicit 'this' parameter which is subject to contextual typing. var parameter = ts.firstOrUndefined(node.parameters); @@ -21643,7 +21558,7 @@ var ts; } ts.isInfinityOrNaNString = isInfinityOrNaNString; function isCatchClauseVariableDeclaration(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function isParameterOrCatchClauseVariable(symbol) { @@ -21652,7 +21567,7 @@ var ts; } ts.isParameterOrCatchClauseVariable = isParameterOrCatchClauseVariable; function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 213 /* SyntaxKind.FunctionExpression */ || node.kind === 214 /* SyntaxKind.ArrowFunction */; + return node.kind === 215 /* SyntaxKind.FunctionExpression */ || node.kind === 216 /* SyntaxKind.ArrowFunction */; } ts.isFunctionExpressionOrArrowFunction = isFunctionExpressionOrArrowFunction; function escapeSnippetText(text) { @@ -21749,7 +21664,7 @@ var ts; ts.getNodeModulePathParts = getNodeModulePathParts; function getParameterTypeNode(parameter) { var _a; - return parameter.kind === 340 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; + return parameter.kind === 343 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; } ts.getParameterTypeNode = getParameterTypeNode; })(ts || (ts = {})); @@ -21874,10 +21789,10 @@ var ts; // // If `a ** d` is on the left of operator `**`, we need to parenthesize to preserve // the intended order of operations: `(a ** b) ** c` - var binaryOperatorPrecedence = ts.getOperatorPrecedence(221 /* SyntaxKind.BinaryExpression */, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(221 /* SyntaxKind.BinaryExpression */, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(223 /* SyntaxKind.BinaryExpression */, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(223 /* SyntaxKind.BinaryExpression */, binaryOperator); var emittedOperand = ts.skipPartiallyEmittedExpressions(operand); - if (!isLeftSideOfBinary && operand.kind === 214 /* SyntaxKind.ArrowFunction */ && binaryOperatorPrecedence > 3 /* OperatorPrecedence.Assignment */) { + if (!isLeftSideOfBinary && operand.kind === 216 /* SyntaxKind.ArrowFunction */ && binaryOperatorPrecedence > 3 /* OperatorPrecedence.Assignment */) { // We need to parenthesize arrow functions on the right side to avoid it being // parsed as parenthesized expression: `a && (() => {})` return true; @@ -21889,7 +21804,7 @@ var ts; // and is a yield expression, then we do not need parentheses. if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 /* Associativity.Right */ - && operand.kind === 224 /* SyntaxKind.YieldExpression */) { + && operand.kind === 226 /* SyntaxKind.YieldExpression */) { return false; } return true; @@ -21958,13 +21873,15 @@ var ts; // (a|b)|c -> a|(b|c) -> a|b|c // (a&b)&c -> a&(b&c) -> a&b&c // (a^b)^c -> a^(b^c) -> a^b^c + // (a,b),c -> a,(b,c) -> a,b,c // // While addition is associative in mathematics, JavaScript's `+` is not // guaranteed to be associative as it is overloaded with string concatenation. return binaryOperator === 41 /* SyntaxKind.AsteriskToken */ || binaryOperator === 51 /* SyntaxKind.BarToken */ || binaryOperator === 50 /* SyntaxKind.AmpersandToken */ - || binaryOperator === 52 /* SyntaxKind.CaretToken */; + || binaryOperator === 52 /* SyntaxKind.CaretToken */ + || binaryOperator === 27 /* SyntaxKind.CommaToken */; } /** * This function determines whether an expression consists of a homogeneous set of @@ -21977,7 +21894,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 39 /* SyntaxKind.PlusToken */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 39 /* SyntaxKind.PlusToken */) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -22003,7 +21920,7 @@ var ts; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = ts.skipPartiallyEmittedExpressions(operand); // If the resulting expression is already parenthesized, we do not need to do any further processing. - if (skipped.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (skipped.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) @@ -22020,7 +21937,7 @@ var ts; return ts.isCommaSequence(expression) ? factory.createParenthesizedExpression(expression) : expression; } function parenthesizeConditionOfConditionalExpression(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(222 /* SyntaxKind.ConditionalExpression */, 57 /* SyntaxKind.QuestionToken */); + var conditionalPrecedence = ts.getOperatorPrecedence(224 /* SyntaxKind.ConditionalExpression */, 57 /* SyntaxKind.QuestionToken */); var emittedCondition = ts.skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) !== 1 /* Comparison.GreaterThan */) { @@ -22053,8 +21970,8 @@ var ts; var needsParens = ts.isCommaSequence(check); if (!needsParens) { switch (ts.getLeftmostExpression(check, /*stopAtCallExpression*/ false).kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: needsParens = true; } } @@ -22067,9 +21984,9 @@ var ts; function parenthesizeExpressionOfNew(expression) { var leftmostExpr = ts.getLeftmostExpression(expression, /*stopAtCallExpressions*/ true); switch (leftmostExpr.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return factory.createParenthesizedExpression(expression); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return !leftmostExpr.arguments ? factory.createParenthesizedExpression(expression) : expression; // TODO(rbuckton): Verify this assertion holds @@ -22089,7 +22006,7 @@ var ts; // var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 209 /* SyntaxKind.NewExpression */ || emittedExpression.arguments) + && (emittedExpression.kind !== 211 /* SyntaxKind.NewExpression */ || emittedExpression.arguments) && (optionalChain || !ts.isOptionalChain(emittedExpression))) { // TODO(rbuckton): Verify whether this assertion holds. return expression; @@ -22112,7 +22029,7 @@ var ts; function parenthesizeExpressionForDisallowedComma(expression) { var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(221 /* SyntaxKind.BinaryExpression */, 27 /* SyntaxKind.CommaToken */); + var commaPrecedence = ts.getOperatorPrecedence(223 /* SyntaxKind.BinaryExpression */, 27 /* SyntaxKind.CommaToken */); // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return expressionPrecedence > commaPrecedence ? expression : ts.setTextRange(factory.createParenthesizedExpression(expression), expression); } @@ -22121,21 +22038,21 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = ts.skipPartiallyEmittedExpressions(callee).kind; - if (kind === 213 /* SyntaxKind.FunctionExpression */ || kind === 214 /* SyntaxKind.ArrowFunction */) { + if (kind === 215 /* SyntaxKind.FunctionExpression */ || kind === 216 /* SyntaxKind.ArrowFunction */) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. var updated = factory.updateCallExpression(emittedExpression, ts.setTextRange(factory.createParenthesizedExpression(callee), callee), emittedExpression.typeArguments, emittedExpression.arguments); return factory.restoreOuterExpressions(expression, updated, 8 /* OuterExpressionKinds.PartiallyEmittedExpressions */); } } var leftmostExpressionKind = ts.getLeftmostExpression(emittedExpression, /*stopAtCallExpressions*/ false).kind; - if (leftmostExpressionKind === 205 /* SyntaxKind.ObjectLiteralExpression */ || leftmostExpressionKind === 213 /* SyntaxKind.FunctionExpression */) { + if (leftmostExpressionKind === 207 /* SyntaxKind.ObjectLiteralExpression */ || leftmostExpressionKind === 215 /* SyntaxKind.FunctionExpression */) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return ts.setTextRange(factory.createParenthesizedExpression(expression), expression); } return expression; } function parenthesizeConciseBodyOfArrowFunction(body) { - if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 205 /* SyntaxKind.ObjectLiteralExpression */)) { + if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 207 /* SyntaxKind.ObjectLiteralExpression */)) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return ts.setTextRange(factory.createParenthesizedExpression(body), body); } @@ -22153,16 +22070,16 @@ var ts; // - The true and false branch types (the second and third `Type` non-terminals, above) allow any type function parenthesizeCheckTypeOfConditionalType(checkType) { switch (checkType.kind) { - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 189 /* SyntaxKind.ConditionalType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 191 /* SyntaxKind.ConditionalType */: return factory.createParenthesizedType(checkType); } return checkType; } function parenthesizeExtendsTypeOfConditionalType(extendsType) { switch (extendsType.kind) { - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return factory.createParenthesizedType(extendsType); } return extendsType; @@ -22174,8 +22091,8 @@ var ts; // - A union type constituent has the same precedence as the check type of a conditional type function parenthesizeConstituentTypeOfUnionType(type) { switch (type.kind) { - case 187 /* SyntaxKind.UnionType */: // Not strictly necessary, but a union containing a union should have been flattened - case 188 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests + case 189 /* SyntaxKind.UnionType */: // Not strictly necessary, but a union containing a union should have been flattened + case 190 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests return factory.createParenthesizedType(type); } return parenthesizeCheckTypeOfConditionalType(type); @@ -22190,8 +22107,8 @@ var ts; // - An intersection type constituent does not allow function, constructor, conditional, or union types (they must be parenthesized) function parenthesizeConstituentTypeOfIntersectionType(type) { switch (type.kind) { - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but an intersection containing an intersection should have been flattened + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but an intersection containing an intersection should have been flattened return factory.createParenthesizedType(type); } return parenthesizeConstituentTypeOfUnionType(type); @@ -22208,14 +22125,14 @@ var ts; // function parenthesizeOperandOfTypeOperator(type) { switch (type.kind) { - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return factory.createParenthesizedType(type); } return parenthesizeConstituentTypeOfIntersectionType(type); } function parenthesizeOperandOfReadonlyTypeOperator(type) { switch (type.kind) { - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return factory.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); @@ -22235,9 +22152,9 @@ var ts; // function parenthesizeNonArrayTypeOfPostfixType(type) { switch (type.kind) { - case 190 /* SyntaxKind.InferType */: - case 193 /* SyntaxKind.TypeOperator */: - case 181 /* SyntaxKind.TypeQuery */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests + case 192 /* SyntaxKind.InferType */: + case 195 /* SyntaxKind.TypeOperator */: + case 183 /* SyntaxKind.TypeQuery */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests return factory.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); @@ -22431,11 +22348,11 @@ var ts; } function convertToAssignmentPattern(node) { switch (node.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return convertToArrayAssignmentPattern(node); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return convertToObjectAssignmentPattern(node); } } @@ -22529,6 +22446,8 @@ var ts; createUniqueName: createUniqueName, getGeneratedNameForNode: getGeneratedNameForNode, createPrivateIdentifier: createPrivateIdentifier, + createUniquePrivateName: createUniquePrivateName, + getGeneratedPrivateNameForNode: getGeneratedPrivateNameForNode, createToken: createToken, createSuper: createSuper, createThis: createThis, @@ -22691,6 +22610,8 @@ var ts; updateAsExpression: updateAsExpression, createNonNullExpression: createNonNullExpression, updateNonNullExpression: updateNonNullExpression, + createSatisfiesExpression: createSatisfiesExpression, + updateSatisfiesExpression: updateSatisfiesExpression, createNonNullChain: createNonNullChain, updateNonNullChain: updateNonNullChain, createMetaProperty: createMetaProperty, @@ -22788,18 +22709,18 @@ var ts; createExternalModuleReference: createExternalModuleReference, updateExternalModuleReference: updateExternalModuleReference, // lazily load factory members for JSDoc types with similar structure - get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(312 /* SyntaxKind.JSDocAllType */); }, - get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(313 /* SyntaxKind.JSDocUnknownType */); }, - get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(315 /* SyntaxKind.JSDocNonNullableType */); }, - get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(315 /* SyntaxKind.JSDocNonNullableType */); }, - get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(314 /* SyntaxKind.JSDocNullableType */); }, - get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(314 /* SyntaxKind.JSDocNullableType */); }, - get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(316 /* SyntaxKind.JSDocOptionalType */); }, - get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(316 /* SyntaxKind.JSDocOptionalType */); }, - get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(318 /* SyntaxKind.JSDocVariadicType */); }, - get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(318 /* SyntaxKind.JSDocVariadicType */); }, - get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(319 /* SyntaxKind.JSDocNamepathType */); }, - get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(319 /* SyntaxKind.JSDocNamepathType */); }, + get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(315 /* SyntaxKind.JSDocAllType */); }, + get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(316 /* SyntaxKind.JSDocUnknownType */); }, + get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(318 /* SyntaxKind.JSDocNonNullableType */); }, + get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(318 /* SyntaxKind.JSDocNonNullableType */); }, + get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(317 /* SyntaxKind.JSDocNullableType */); }, + get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(317 /* SyntaxKind.JSDocNullableType */); }, + get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(319 /* SyntaxKind.JSDocOptionalType */); }, + get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(319 /* SyntaxKind.JSDocOptionalType */); }, + get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(321 /* SyntaxKind.JSDocVariadicType */); }, + get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(321 /* SyntaxKind.JSDocVariadicType */); }, + get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(322 /* SyntaxKind.JSDocNamepathType */); }, + get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(322 /* SyntaxKind.JSDocNamepathType */); }, createJSDocFunctionType: createJSDocFunctionType, updateJSDocFunctionType: updateJSDocFunctionType, createJSDocTypeLiteral: createJSDocTypeLiteral, @@ -22835,30 +22756,30 @@ var ts; createJSDocLinkPlain: createJSDocLinkPlain, updateJSDocLinkPlain: updateJSDocLinkPlain, // lazily load factory members for JSDoc tags with similar structure - get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(343 /* SyntaxKind.JSDocTypeTag */); }, - get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(343 /* SyntaxKind.JSDocTypeTag */); }, - get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(341 /* SyntaxKind.JSDocReturnTag */); }, - get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(341 /* SyntaxKind.JSDocReturnTag */); }, - get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(342 /* SyntaxKind.JSDocThisTag */); }, - get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(342 /* SyntaxKind.JSDocThisTag */); }, - get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(339 /* SyntaxKind.JSDocEnumTag */); }, - get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(339 /* SyntaxKind.JSDocEnumTag */); }, - get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(330 /* SyntaxKind.JSDocAuthorTag */); }, - get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(330 /* SyntaxKind.JSDocAuthorTag */); }, - get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(332 /* SyntaxKind.JSDocClassTag */); }, - get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(332 /* SyntaxKind.JSDocClassTag */); }, - get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(333 /* SyntaxKind.JSDocPublicTag */); }, - get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(333 /* SyntaxKind.JSDocPublicTag */); }, - get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(334 /* SyntaxKind.JSDocPrivateTag */); }, - get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(334 /* SyntaxKind.JSDocPrivateTag */); }, - get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(335 /* SyntaxKind.JSDocProtectedTag */); }, - get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(335 /* SyntaxKind.JSDocProtectedTag */); }, - get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(336 /* SyntaxKind.JSDocReadonlyTag */); }, - get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(336 /* SyntaxKind.JSDocReadonlyTag */); }, - get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(337 /* SyntaxKind.JSDocOverrideTag */); }, - get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(337 /* SyntaxKind.JSDocOverrideTag */); }, - get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(331 /* SyntaxKind.JSDocDeprecatedTag */); }, - get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(331 /* SyntaxKind.JSDocDeprecatedTag */); }, + get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(346 /* SyntaxKind.JSDocTypeTag */); }, + get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(346 /* SyntaxKind.JSDocTypeTag */); }, + get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(344 /* SyntaxKind.JSDocReturnTag */); }, + get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(344 /* SyntaxKind.JSDocReturnTag */); }, + get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(345 /* SyntaxKind.JSDocThisTag */); }, + get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(345 /* SyntaxKind.JSDocThisTag */); }, + get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(342 /* SyntaxKind.JSDocEnumTag */); }, + get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(342 /* SyntaxKind.JSDocEnumTag */); }, + get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(333 /* SyntaxKind.JSDocAuthorTag */); }, + get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(333 /* SyntaxKind.JSDocAuthorTag */); }, + get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(335 /* SyntaxKind.JSDocClassTag */); }, + get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(335 /* SyntaxKind.JSDocClassTag */); }, + get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(336 /* SyntaxKind.JSDocPublicTag */); }, + get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(336 /* SyntaxKind.JSDocPublicTag */); }, + get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(337 /* SyntaxKind.JSDocPrivateTag */); }, + get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(337 /* SyntaxKind.JSDocPrivateTag */); }, + get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(338 /* SyntaxKind.JSDocProtectedTag */); }, + get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(338 /* SyntaxKind.JSDocProtectedTag */); }, + get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(339 /* SyntaxKind.JSDocReadonlyTag */); }, + get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(339 /* SyntaxKind.JSDocReadonlyTag */); }, + get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(340 /* SyntaxKind.JSDocOverrideTag */); }, + get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(340 /* SyntaxKind.JSDocOverrideTag */); }, + get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(334 /* SyntaxKind.JSDocDeprecatedTag */); }, + get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(334 /* SyntaxKind.JSDocDeprecatedTag */); }, createJSDocUnknownTag: createJSDocUnknownTag, updateJSDocUnknownTag: updateJSDocUnknownTag, createJSDocText: createJSDocText, @@ -23061,11 +22982,11 @@ var ts; // don't propagate child flags. if (name) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: if (ts.isIdentifier(name)) { node.transformFlags |= propagateIdentifierNameFlags(name); break; @@ -23214,10 +23135,12 @@ var ts; node.escapedText = ts.escapeLeadingUnderscores(text); return node; } - function createBaseGeneratedIdentifier(text, autoGenerateFlags) { + function createBaseGeneratedIdentifier(text, autoGenerateFlags, prefix, suffix) { var node = createBaseIdentifier(text, /*originalKeywordKind*/ undefined); node.autoGenerateFlags = autoGenerateFlags; node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; nextAutoGenerateId++; return node; } @@ -23228,7 +23151,7 @@ var ts; // NOTE: we do not use `setChildren` here because typeArguments in an identifier do not contribute to transformations node.typeArguments = createNodeArray(typeArguments); } - if (node.originalKeywordKind === 132 /* SyntaxKind.AwaitKeyword */) { + if (node.originalKeywordKind === 133 /* SyntaxKind.AwaitKeyword */) { node.transformFlags |= 67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; } return node; @@ -23240,11 +23163,11 @@ var ts; : node; } // @api - function createTempVariable(recordTempVariable, reservedInNestedScopes) { + function createTempVariable(recordTempVariable, reservedInNestedScopes, prefix, suffix) { var flags = 1 /* GeneratedIdentifierFlags.Auto */; if (reservedInNestedScopes) flags |= 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */; - var name = createBaseGeneratedIdentifier("", flags); + var name = createBaseGeneratedIdentifier("", flags, prefix, suffix); if (recordTempVariable) { recordTempVariable(name); } @@ -23256,34 +23179,69 @@ var ts; var flags = 2 /* GeneratedIdentifierFlags.Loop */; if (reservedInNestedScopes) flags |= 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */; - return createBaseGeneratedIdentifier("", flags); + return createBaseGeneratedIdentifier("", flags, /*prefix*/ undefined, /*suffix*/ undefined); } /** Create a unique name based on the supplied text. */ // @api - function createUniqueName(text, flags) { + function createUniqueName(text, flags, prefix, suffix) { if (flags === void 0) { flags = 0 /* GeneratedIdentifierFlags.None */; } ts.Debug.assert(!(flags & 7 /* GeneratedIdentifierFlags.KindMask */), "Argument out of range: flags"); ts.Debug.assert((flags & (16 /* GeneratedIdentifierFlags.Optimistic */ | 32 /* GeneratedIdentifierFlags.FileLevel */)) !== 32 /* GeneratedIdentifierFlags.FileLevel */, "GeneratedIdentifierFlags.FileLevel cannot be set without also setting GeneratedIdentifierFlags.Optimistic"); - return createBaseGeneratedIdentifier(text, 3 /* GeneratedIdentifierFlags.Unique */ | flags); + return createBaseGeneratedIdentifier(text, 3 /* GeneratedIdentifierFlags.Unique */ | flags, prefix, suffix); } /** Create a unique name generated for a node. */ // @api - function getGeneratedNameForNode(node, flags) { + function getGeneratedNameForNode(node, flags, prefix, suffix) { if (flags === void 0) { flags = 0; } ts.Debug.assert(!(flags & 7 /* GeneratedIdentifierFlags.KindMask */), "Argument out of range: flags"); - var name = createBaseGeneratedIdentifier(node && ts.isIdentifier(node) ? ts.idText(node) : "", 4 /* GeneratedIdentifierFlags.Node */ | flags); + var text = !node ? "" : + ts.isMemberName(node) ? ts.formatGeneratedName(/*privateName*/ false, prefix, node, suffix, ts.idText) : + "generated@".concat(ts.getNodeId(node)); + if (prefix || suffix) + flags |= 16 /* GeneratedIdentifierFlags.Optimistic */; + var name = createBaseGeneratedIdentifier(text, 4 /* GeneratedIdentifierFlags.Node */ | flags, prefix, suffix); name.original = node; return name; } + function createBasePrivateIdentifier(text) { + var node = baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */); + node.escapedText = ts.escapeLeadingUnderscores(text); + node.transformFlags |= 16777216 /* TransformFlags.ContainsClassFields */; + return node; + } // @api function createPrivateIdentifier(text) { if (!ts.startsWith(text, "#")) ts.Debug.fail("First character of private identifier must be #: " + text); - var node = baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */); - node.escapedText = ts.escapeLeadingUnderscores(text); - node.transformFlags |= 16777216 /* TransformFlags.ContainsClassFields */; + return createBasePrivateIdentifier(text); + } + function createBaseGeneratedPrivateIdentifier(text, autoGenerateFlags, prefix, suffix) { + var node = createBasePrivateIdentifier(text); + node.autoGenerateFlags = autoGenerateFlags; + node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; + nextAutoGenerateId++; return node; } + /** Create a unique name based on the supplied text. */ + // @api + function createUniquePrivateName(text, prefix, suffix) { + if (text && !ts.startsWith(text, "#")) + ts.Debug.fail("First character of private identifier must be #: " + text); + var autoGenerateFlags = 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */ | + (text ? 3 /* GeneratedIdentifierFlags.Unique */ : 1 /* GeneratedIdentifierFlags.Auto */); + return createBaseGeneratedPrivateIdentifier(text !== null && text !== void 0 ? text : "", autoGenerateFlags, prefix, suffix); + } + // @api + function getGeneratedPrivateNameForNode(node, prefix, suffix) { + var text = ts.isMemberName(node) ? ts.formatGeneratedName(/*privateName*/ true, prefix, node, suffix, ts.idText) : + "#generated@".concat(ts.getNodeId(node)); + var flags = prefix || suffix ? 16 /* GeneratedIdentifierFlags.Optimistic */ : 0 /* GeneratedIdentifierFlags.None */; + var name = createBaseGeneratedPrivateIdentifier(text, 4 /* GeneratedIdentifierFlags.Node */ | flags, prefix, suffix); + name.original = node; + return name; + } // // Punctuation // @@ -23291,14 +23249,14 @@ var ts; return baseFactory.createBaseTokenNode(kind); } function createToken(token) { - ts.Debug.assert(token >= 0 /* SyntaxKind.FirstToken */ && token <= 160 /* SyntaxKind.LastToken */, "Invalid token"); + ts.Debug.assert(token >= 0 /* SyntaxKind.FirstToken */ && token <= 162 /* SyntaxKind.LastToken */, "Invalid token"); ts.Debug.assert(token <= 14 /* SyntaxKind.FirstTemplateToken */ || token >= 17 /* SyntaxKind.LastTemplateToken */, "Invalid token. Use 'createTemplateLiteralLikeNode' to create template literals."); ts.Debug.assert(token <= 8 /* SyntaxKind.FirstLiteralToken */ || token >= 14 /* SyntaxKind.LastLiteralToken */, "Invalid token. Use 'createLiteralLikeNode' to create literals."); ts.Debug.assert(token !== 79 /* SyntaxKind.Identifier */, "Invalid token. Use 'createIdentifier' to create identifiers"); var node = createBaseToken(token); var transformFlags = 0 /* TransformFlags.None */; switch (token) { - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // 'async' modifier is ES2017 (async functions) or ES2018 (async generators) transformFlags = 256 /* TransformFlags.ContainsES2017 */ | @@ -23307,24 +23265,24 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 130 /* SyntaxKind.AnyKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 145 /* SyntaxKind.OutKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: // `undefined` is an Identifier in the expression case. + case 157 /* SyntaxKind.UnknownKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: // `undefined` is an Identifier in the expression case. transformFlags = 1 /* TransformFlags.ContainsTypeScript */; break; case 106 /* SyntaxKind.SuperKeyword */: @@ -23333,6 +23291,9 @@ var ts; case 124 /* SyntaxKind.StaticKeyword */: transformFlags = 1024 /* TransformFlags.ContainsES2015 */; break; + case 127 /* SyntaxKind.AccessorKeyword */: + transformFlags = 16777216 /* TransformFlags.ContainsClassFields */; + break; case 108 /* SyntaxKind.ThisKeyword */: // 'this' indicates a lexical 'this' transformFlags = 16384 /* TransformFlags.ContainsLexicalThis */; @@ -23379,8 +23340,8 @@ var ts; if (flags & 1 /* ModifierFlags.Export */) result.push(createModifier(93 /* SyntaxKind.ExportKeyword */)); if (flags & 2 /* ModifierFlags.Ambient */) - result.push(createModifier(135 /* SyntaxKind.DeclareKeyword */)); - if (flags & 512 /* ModifierFlags.Default */) + result.push(createModifier(136 /* SyntaxKind.DeclareKeyword */)); + if (flags & 1024 /* ModifierFlags.Default */) result.push(createModifier(88 /* SyntaxKind.DefaultKeyword */)); if (flags & 2048 /* ModifierFlags.Const */) result.push(createModifier(85 /* SyntaxKind.ConstKeyword */)); @@ -23390,20 +23351,22 @@ var ts; result.push(createModifier(121 /* SyntaxKind.PrivateKeyword */)); if (flags & 16 /* ModifierFlags.Protected */) result.push(createModifier(122 /* SyntaxKind.ProtectedKeyword */)); - if (flags & 128 /* ModifierFlags.Abstract */) + if (flags & 256 /* ModifierFlags.Abstract */) result.push(createModifier(126 /* SyntaxKind.AbstractKeyword */)); if (flags & 32 /* ModifierFlags.Static */) result.push(createModifier(124 /* SyntaxKind.StaticKeyword */)); if (flags & 16384 /* ModifierFlags.Override */) - result.push(createModifier(159 /* SyntaxKind.OverrideKeyword */)); + result.push(createModifier(161 /* SyntaxKind.OverrideKeyword */)); if (flags & 64 /* ModifierFlags.Readonly */) - result.push(createModifier(145 /* SyntaxKind.ReadonlyKeyword */)); - if (flags & 256 /* ModifierFlags.Async */) - result.push(createModifier(131 /* SyntaxKind.AsyncKeyword */)); + result.push(createModifier(146 /* SyntaxKind.ReadonlyKeyword */)); + if (flags & 128 /* ModifierFlags.Accessor */) + result.push(createModifier(127 /* SyntaxKind.AccessorKeyword */)); + if (flags & 512 /* ModifierFlags.Async */) + result.push(createModifier(132 /* SyntaxKind.AsyncKeyword */)); if (flags & 32768 /* ModifierFlags.In */) result.push(createModifier(101 /* SyntaxKind.InKeyword */)); if (flags & 65536 /* ModifierFlags.Out */) - result.push(createModifier(144 /* SyntaxKind.OutKeyword */)); + result.push(createModifier(145 /* SyntaxKind.OutKeyword */)); return result.length ? result : undefined; } // @@ -23411,7 +23374,7 @@ var ts; // // @api function createQualifiedName(left, right) { - var node = createBaseNode(161 /* SyntaxKind.QualifiedName */); + var node = createBaseNode(163 /* SyntaxKind.QualifiedName */); node.left = left; node.right = asName(right); node.transformFlags |= @@ -23428,7 +23391,7 @@ var ts; } // @api function createComputedPropertyName(expression) { - var node = createBaseNode(162 /* SyntaxKind.ComputedPropertyName */); + var node = createBaseNode(164 /* SyntaxKind.ComputedPropertyName */); node.expression = parenthesizerRules().parenthesizeExpressionOfComputedPropertyName(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -23447,7 +23410,7 @@ var ts; // // @api function createTypeParameterDeclaration(modifiers, name, constraint, defaultType) { - var node = createBaseNamedDeclaration(163 /* SyntaxKind.TypeParameter */, modifiers, name); + var node = createBaseNamedDeclaration(165 /* SyntaxKind.TypeParameter */, modifiers, name); node.constraint = constraint; node.default = defaultType; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23464,7 +23427,7 @@ var ts; } // @api function createParameterDeclaration(modifiers, dotDotDotToken, name, questionToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(164 /* SyntaxKind.Parameter */, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); + var node = createBaseVariableLikeDeclaration(166 /* SyntaxKind.Parameter */, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.dotDotDotToken = dotDotDotToken; node.questionToken = questionToken; if (ts.isThisIdentifier(node.name)) { @@ -23496,7 +23459,7 @@ var ts; } // @api function createDecorator(expression) { - var node = createBaseNode(165 /* SyntaxKind.Decorator */); + var node = createBaseNode(167 /* SyntaxKind.Decorator */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.transformFlags |= propagateChildFlags(node.expression) | @@ -23516,7 +23479,7 @@ var ts; // // @api function createPropertySignature(modifiers, name, questionToken, type) { - var node = createBaseNamedDeclaration(166 /* SyntaxKind.PropertySignature */, modifiers, name); + var node = createBaseNamedDeclaration(168 /* SyntaxKind.PropertySignature */, modifiers, name); node.type = type; node.questionToken = questionToken; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23542,7 +23505,7 @@ var ts; } // @api function createPropertyDeclaration(modifiers, name, questionOrExclamationToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(167 /* SyntaxKind.PropertyDeclaration */, modifiers, name, type, initializer); + var node = createBaseVariableLikeDeclaration(169 /* SyntaxKind.PropertyDeclaration */, modifiers, name, type, initializer); node.questionToken = questionOrExclamationToken && ts.isQuestionToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.exclamationToken = questionOrExclamationToken && ts.isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.transformFlags |= @@ -23570,7 +23533,7 @@ var ts; } // @api function createMethodSignature(modifiers, name, questionToken, typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(168 /* SyntaxKind.MethodSignature */, modifiers, name, typeParameters, parameters, type); + var node = createBaseSignatureDeclaration(170 /* SyntaxKind.MethodSignature */, modifiers, name, typeParameters, parameters, type); node.questionToken = questionToken; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23588,7 +23551,7 @@ var ts; } // @api function createMethodDeclaration(modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(169 /* SyntaxKind.MethodDeclaration */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(171 /* SyntaxKind.MethodDeclaration */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; node.questionToken = questionToken; node.transformFlags |= @@ -23598,7 +23561,7 @@ var ts; if (questionToken) { node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; } - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -23634,7 +23597,7 @@ var ts; } // @api function createClassStaticBlockDeclaration(body) { - var node = createBaseGenericNamedDeclaration(170 /* SyntaxKind.ClassStaticBlockDeclaration */, + var node = createBaseGenericNamedDeclaration(172 /* SyntaxKind.ClassStaticBlockDeclaration */, /*modifiers*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined); @@ -23660,7 +23623,7 @@ var ts; } // @api function createConstructorDeclaration(modifiers, parameters, body) { - var node = createBaseFunctionLikeDeclaration(171 /* SyntaxKind.Constructor */, modifiers, + var node = createBaseFunctionLikeDeclaration(173 /* SyntaxKind.Constructor */, modifiers, /*name*/ undefined, /*typeParameters*/ undefined, parameters, /*type*/ undefined, body); @@ -23689,7 +23652,7 @@ var ts; } // @api function createGetAccessorDeclaration(modifiers, name, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(172 /* SyntaxKind.GetAccessor */, modifiers, name, + var node = createBaseFunctionLikeDeclaration(174 /* SyntaxKind.GetAccessor */, modifiers, name, /*typeParameters*/ undefined, parameters, type, body); // The following properties are used only to report grammar errors node.typeParameters = undefined; @@ -23713,7 +23676,7 @@ var ts; } // @api function createSetAccessorDeclaration(modifiers, name, parameters, body) { - var node = createBaseFunctionLikeDeclaration(173 /* SyntaxKind.SetAccessor */, modifiers, name, + var node = createBaseFunctionLikeDeclaration(175 /* SyntaxKind.SetAccessor */, modifiers, name, /*typeParameters*/ undefined, parameters, /*type*/ undefined, body); // The following properties are used only to report grammar errors @@ -23739,7 +23702,7 @@ var ts; } // @api function createCallSignature(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(174 /* SyntaxKind.CallSignature */, + var node = createBaseSignatureDeclaration(176 /* SyntaxKind.CallSignature */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23755,7 +23718,7 @@ var ts; } // @api function createConstructSignature(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(175 /* SyntaxKind.ConstructSignature */, + var node = createBaseSignatureDeclaration(177 /* SyntaxKind.ConstructSignature */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23771,7 +23734,7 @@ var ts; } // @api function createIndexSignature(modifiers, parameters, type) { - var node = createBaseSignatureDeclaration(176 /* SyntaxKind.IndexSignature */, modifiers, + var node = createBaseSignatureDeclaration(178 /* SyntaxKind.IndexSignature */, modifiers, /*name*/ undefined, /*typeParameters*/ undefined, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23787,7 +23750,7 @@ var ts; } // @api function createTemplateLiteralTypeSpan(type, literal) { - var node = createBaseNode(199 /* SyntaxKind.TemplateLiteralTypeSpan */); + var node = createBaseNode(201 /* SyntaxKind.TemplateLiteralTypeSpan */); node.type = type; node.literal = literal; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23809,7 +23772,7 @@ var ts; } // @api function createTypePredicateNode(assertsModifier, parameterName, type) { - var node = createBaseNode(177 /* SyntaxKind.TypePredicate */); + var node = createBaseNode(179 /* SyntaxKind.TypePredicate */); node.assertsModifier = assertsModifier; node.parameterName = asName(parameterName); node.type = type; @@ -23826,7 +23789,7 @@ var ts; } // @api function createTypeReferenceNode(typeName, typeArguments) { - var node = createBaseNode(178 /* SyntaxKind.TypeReference */); + var node = createBaseNode(180 /* SyntaxKind.TypeReference */); node.typeName = asName(typeName); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(createNodeArray(typeArguments)); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23841,7 +23804,7 @@ var ts; } // @api function createFunctionTypeNode(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(179 /* SyntaxKind.FunctionType */, + var node = createBaseSignatureDeclaration(181 /* SyntaxKind.FunctionType */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23874,7 +23837,7 @@ var ts; ts.Debug.fail("Incorrect number of arguments specified."); } function createConstructorTypeNode1(modifiers, typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(180 /* SyntaxKind.ConstructorType */, modifiers, + var node = createBaseSignatureDeclaration(182 /* SyntaxKind.ConstructorType */, modifiers, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23907,7 +23870,7 @@ var ts; } // @api function createTypeQueryNode(exprName, typeArguments) { - var node = createBaseNode(181 /* SyntaxKind.TypeQuery */); + var node = createBaseNode(183 /* SyntaxKind.TypeQuery */); node.exprName = exprName; node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23922,7 +23885,7 @@ var ts; } // @api function createTypeLiteralNode(members) { - var node = createBaseNode(182 /* SyntaxKind.TypeLiteral */); + var node = createBaseNode(184 /* SyntaxKind.TypeLiteral */); node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23935,7 +23898,7 @@ var ts; } // @api function createArrayTypeNode(elementType) { - var node = createBaseNode(183 /* SyntaxKind.ArrayType */); + var node = createBaseNode(185 /* SyntaxKind.ArrayType */); node.elementType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(elementType); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23948,7 +23911,7 @@ var ts; } // @api function createTupleTypeNode(elements) { - var node = createBaseNode(184 /* SyntaxKind.TupleType */); + var node = createBaseNode(186 /* SyntaxKind.TupleType */); node.elements = createNodeArray(parenthesizerRules().parenthesizeElementTypesOfTupleType(elements)); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23961,7 +23924,7 @@ var ts; } // @api function createNamedTupleMember(dotDotDotToken, name, questionToken, type) { - var node = createBaseNode(197 /* SyntaxKind.NamedTupleMember */); + var node = createBaseNode(199 /* SyntaxKind.NamedTupleMember */); node.dotDotDotToken = dotDotDotToken; node.name = name; node.questionToken = questionToken; @@ -23980,7 +23943,7 @@ var ts; } // @api function createOptionalTypeNode(type) { - var node = createBaseNode(185 /* SyntaxKind.OptionalType */); + var node = createBaseNode(187 /* SyntaxKind.OptionalType */); node.type = parenthesizerRules().parenthesizeTypeOfOptionalType(type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23993,7 +23956,7 @@ var ts; } // @api function createRestTypeNode(type) { - var node = createBaseNode(186 /* SyntaxKind.RestType */); + var node = createBaseNode(188 /* SyntaxKind.RestType */); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -24017,7 +23980,7 @@ var ts; } // @api function createUnionTypeNode(types) { - return createUnionOrIntersectionTypeNode(187 /* SyntaxKind.UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); + return createUnionOrIntersectionTypeNode(189 /* SyntaxKind.UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); } // @api function updateUnionTypeNode(node, types) { @@ -24025,7 +23988,7 @@ var ts; } // @api function createIntersectionTypeNode(types) { - return createUnionOrIntersectionTypeNode(188 /* SyntaxKind.IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); + return createUnionOrIntersectionTypeNode(190 /* SyntaxKind.IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); } // @api function updateIntersectionTypeNode(node, types) { @@ -24033,7 +23996,7 @@ var ts; } // @api function createConditionalTypeNode(checkType, extendsType, trueType, falseType) { - var node = createBaseNode(189 /* SyntaxKind.ConditionalType */); + var node = createBaseNode(191 /* SyntaxKind.ConditionalType */); node.checkType = parenthesizerRules().parenthesizeCheckTypeOfConditionalType(checkType); node.extendsType = parenthesizerRules().parenthesizeExtendsTypeOfConditionalType(extendsType); node.trueType = trueType; @@ -24052,7 +24015,7 @@ var ts; } // @api function createInferTypeNode(typeParameter) { - var node = createBaseNode(190 /* SyntaxKind.InferType */); + var node = createBaseNode(192 /* SyntaxKind.InferType */); node.typeParameter = typeParameter; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -24065,7 +24028,7 @@ var ts; } // @api function createTemplateLiteralType(head, templateSpans) { - var node = createBaseNode(198 /* SyntaxKind.TemplateLiteralType */); + var node = createBaseNode(200 /* SyntaxKind.TemplateLiteralType */); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -24081,7 +24044,7 @@ var ts; // @api function createImportTypeNode(argument, assertions, qualifier, typeArguments, isTypeOf) { if (isTypeOf === void 0) { isTypeOf = false; } - var node = createBaseNode(200 /* SyntaxKind.ImportType */); + var node = createBaseNode(202 /* SyntaxKind.ImportType */); node.argument = argument; node.assertions = assertions; node.qualifier = qualifier; @@ -24103,7 +24066,7 @@ var ts; } // @api function createParenthesizedType(type) { - var node = createBaseNode(191 /* SyntaxKind.ParenthesizedType */); + var node = createBaseNode(193 /* SyntaxKind.ParenthesizedType */); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -24116,15 +24079,15 @@ var ts; } // @api function createThisTypeNode() { - var node = createBaseNode(192 /* SyntaxKind.ThisType */); + var node = createBaseNode(194 /* SyntaxKind.ThisType */); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; } // @api function createTypeOperatorNode(operator, type) { - var node = createBaseNode(193 /* SyntaxKind.TypeOperator */); + var node = createBaseNode(195 /* SyntaxKind.TypeOperator */); node.operator = operator; - node.type = operator === 145 /* SyntaxKind.ReadonlyKeyword */ ? + node.type = operator === 146 /* SyntaxKind.ReadonlyKeyword */ ? parenthesizerRules().parenthesizeOperandOfReadonlyTypeOperator(type) : parenthesizerRules().parenthesizeOperandOfTypeOperator(type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -24138,7 +24101,7 @@ var ts; } // @api function createIndexedAccessTypeNode(objectType, indexType) { - var node = createBaseNode(194 /* SyntaxKind.IndexedAccessType */); + var node = createBaseNode(196 /* SyntaxKind.IndexedAccessType */); node.objectType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(objectType); node.indexType = indexType; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -24153,7 +24116,7 @@ var ts; } // @api function createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members) { - var node = createBaseNode(195 /* SyntaxKind.MappedType */); + var node = createBaseNode(197 /* SyntaxKind.MappedType */); node.readonlyToken = readonlyToken; node.typeParameter = typeParameter; node.nameType = nameType; @@ -24176,7 +24139,7 @@ var ts; } // @api function createLiteralTypeNode(literal) { - var node = createBaseNode(196 /* SyntaxKind.LiteralType */); + var node = createBaseNode(198 /* SyntaxKind.LiteralType */); node.literal = literal; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -24192,7 +24155,7 @@ var ts; // // @api function createObjectBindingPattern(elements) { - var node = createBaseNode(201 /* SyntaxKind.ObjectBindingPattern */); + var node = createBaseNode(203 /* SyntaxKind.ObjectBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | @@ -24213,7 +24176,7 @@ var ts; } // @api function createArrayBindingPattern(elements) { - var node = createBaseNode(202 /* SyntaxKind.ArrayBindingPattern */); + var node = createBaseNode(204 /* SyntaxKind.ArrayBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | @@ -24229,7 +24192,7 @@ var ts; } // @api function createBindingElement(dotDotDotToken, propertyName, name, initializer) { - var node = createBaseBindingLikeDeclaration(203 /* SyntaxKind.BindingElement */, + var node = createBaseBindingLikeDeclaration(205 /* SyntaxKind.BindingElement */, /*modifiers*/ undefined, name, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.propertyName = asName(propertyName); node.dotDotDotToken = dotDotDotToken; @@ -24264,7 +24227,7 @@ var ts; } // @api function createArrayLiteralExpression(elements, multiLine) { - var node = createBaseExpression(204 /* SyntaxKind.ArrayLiteralExpression */); + var node = createBaseExpression(206 /* SyntaxKind.ArrayLiteralExpression */); // Ensure we add a trailing comma for something like `[NumericLiteral(1), NumericLiteral(2), OmittedExpresion]` so that // we end up with `[1, 2, ,]` instead of `[1, 2, ]` otherwise the `OmittedExpression` will just end up being treated like // a trailing comma. @@ -24283,7 +24246,7 @@ var ts; } // @api function createObjectLiteralExpression(properties, multiLine) { - var node = createBaseExpression(205 /* SyntaxKind.ObjectLiteralExpression */); + var node = createBaseExpression(207 /* SyntaxKind.ObjectLiteralExpression */); node.properties = createNodeArray(properties); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.properties); @@ -24297,7 +24260,7 @@ var ts; } // @api function createPropertyAccessExpression(expression, name) { - var node = createBaseExpression(206 /* SyntaxKind.PropertyAccessExpression */); + var node = createBaseExpression(208 /* SyntaxKind.PropertyAccessExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.name = asName(name); node.transformFlags = @@ -24326,7 +24289,7 @@ var ts; } // @api function createPropertyAccessChain(expression, questionDotToken, name) { - var node = createBaseExpression(206 /* SyntaxKind.PropertyAccessExpression */); + var node = createBaseExpression(208 /* SyntaxKind.PropertyAccessExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24353,7 +24316,7 @@ var ts; } // @api function createElementAccessExpression(expression, index) { - var node = createBaseExpression(207 /* SyntaxKind.ElementAccessExpression */); + var node = createBaseExpression(209 /* SyntaxKind.ElementAccessExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.argumentExpression = asExpression(index); node.transformFlags |= @@ -24380,7 +24343,7 @@ var ts; } // @api function createElementAccessChain(expression, questionDotToken, index) { - var node = createBaseExpression(207 /* SyntaxKind.ElementAccessExpression */); + var node = createBaseExpression(209 /* SyntaxKind.ElementAccessExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24405,7 +24368,7 @@ var ts; } // @api function createCallExpression(expression, typeArguments, argumentsArray) { - var node = createBaseExpression(208 /* SyntaxKind.CallExpression */); + var node = createBaseExpression(210 /* SyntaxKind.CallExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.typeArguments = asNodeArray(typeArguments); node.arguments = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(createNodeArray(argumentsArray)); @@ -24437,7 +24400,7 @@ var ts; } // @api function createCallChain(expression, questionDotToken, typeArguments, argumentsArray) { - var node = createBaseExpression(208 /* SyntaxKind.CallExpression */); + var node = createBaseExpression(210 /* SyntaxKind.CallExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24469,7 +24432,7 @@ var ts; } // @api function createNewExpression(expression, typeArguments, argumentsArray) { - var node = createBaseExpression(209 /* SyntaxKind.NewExpression */); + var node = createBaseExpression(211 /* SyntaxKind.NewExpression */); node.expression = parenthesizerRules().parenthesizeExpressionOfNew(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = argumentsArray ? parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(argumentsArray) : undefined; @@ -24493,7 +24456,7 @@ var ts; } // @api function createTaggedTemplateExpression(tag, typeArguments, template) { - var node = createBaseExpression(210 /* SyntaxKind.TaggedTemplateExpression */); + var node = createBaseExpression(212 /* SyntaxKind.TaggedTemplateExpression */); node.tag = parenthesizerRules().parenthesizeLeftSideOfAccess(tag, /*optionalChain*/ false); node.typeArguments = asNodeArray(typeArguments); node.template = template; @@ -24520,7 +24483,7 @@ var ts; } // @api function createTypeAssertion(type, expression) { - var node = createBaseExpression(211 /* SyntaxKind.TypeAssertionExpression */); + var node = createBaseExpression(213 /* SyntaxKind.TypeAssertionExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.type = type; node.transformFlags |= @@ -24538,7 +24501,7 @@ var ts; } // @api function createParenthesizedExpression(expression) { - var node = createBaseExpression(212 /* SyntaxKind.ParenthesizedExpression */); + var node = createBaseExpression(214 /* SyntaxKind.ParenthesizedExpression */); node.expression = expression; node.transformFlags = propagateChildFlags(node.expression); return node; @@ -24551,13 +24514,13 @@ var ts; } // @api function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(213 /* SyntaxKind.FunctionExpression */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(215 /* SyntaxKind.FunctionExpression */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; node.transformFlags |= propagateChildFlags(node.asteriskToken); if (node.typeParameters) { node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; } - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (node.asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -24584,13 +24547,13 @@ var ts; } // @api function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { - var node = createBaseFunctionLikeDeclaration(214 /* SyntaxKind.ArrowFunction */, modifiers, + var node = createBaseFunctionLikeDeclaration(216 /* SyntaxKind.ArrowFunction */, modifiers, /*name*/ undefined, typeParameters, parameters, type, parenthesizerRules().parenthesizeConciseBodyOfArrowFunction(body)); node.equalsGreaterThanToken = equalsGreaterThanToken !== null && equalsGreaterThanToken !== void 0 ? equalsGreaterThanToken : createToken(38 /* SyntaxKind.EqualsGreaterThanToken */); node.transformFlags |= propagateChildFlags(node.equalsGreaterThanToken) | 1024 /* TransformFlags.ContainsES2015 */; - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { node.transformFlags |= 256 /* TransformFlags.ContainsES2017 */ | 16384 /* TransformFlags.ContainsLexicalThis */; } return node; @@ -24608,7 +24571,7 @@ var ts; } // @api function createDeleteExpression(expression) { - var node = createBaseExpression(215 /* SyntaxKind.DeleteExpression */); + var node = createBaseExpression(217 /* SyntaxKind.DeleteExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24621,7 +24584,7 @@ var ts; } // @api function createTypeOfExpression(expression) { - var node = createBaseExpression(216 /* SyntaxKind.TypeOfExpression */); + var node = createBaseExpression(218 /* SyntaxKind.TypeOfExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24634,7 +24597,7 @@ var ts; } // @api function createVoidExpression(expression) { - var node = createBaseExpression(217 /* SyntaxKind.VoidExpression */); + var node = createBaseExpression(219 /* SyntaxKind.VoidExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24647,7 +24610,7 @@ var ts; } // @api function createAwaitExpression(expression) { - var node = createBaseExpression(218 /* SyntaxKind.AwaitExpression */); + var node = createBaseExpression(220 /* SyntaxKind.AwaitExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24664,7 +24627,7 @@ var ts; } // @api function createPrefixUnaryExpression(operator, operand) { - var node = createBaseExpression(219 /* SyntaxKind.PrefixUnaryExpression */); + var node = createBaseExpression(221 /* SyntaxKind.PrefixUnaryExpression */); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPrefixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -24686,7 +24649,7 @@ var ts; } // @api function createPostfixUnaryExpression(operand, operator) { - var node = createBaseExpression(220 /* SyntaxKind.PostfixUnaryExpression */); + var node = createBaseExpression(222 /* SyntaxKind.PostfixUnaryExpression */); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPostfixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -24707,7 +24670,7 @@ var ts; } // @api function createBinaryExpression(left, operator, right) { - var node = createBaseExpression(221 /* SyntaxKind.BinaryExpression */); + var node = createBaseExpression(223 /* SyntaxKind.BinaryExpression */); var operatorToken = asToken(operator); var operatorKind = operatorToken.kind; node.left = parenthesizerRules().parenthesizeLeftSideOfBinary(operatorKind, left); @@ -24779,7 +24742,7 @@ var ts; } // @api function createConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse) { - var node = createBaseExpression(222 /* SyntaxKind.ConditionalExpression */); + var node = createBaseExpression(224 /* SyntaxKind.ConditionalExpression */); node.condition = parenthesizerRules().parenthesizeConditionOfConditionalExpression(condition); node.questionToken = questionToken !== null && questionToken !== void 0 ? questionToken : createToken(57 /* SyntaxKind.QuestionToken */); node.whenTrue = parenthesizerRules().parenthesizeBranchOfConditionalExpression(whenTrue); @@ -24805,7 +24768,7 @@ var ts; } // @api function createTemplateExpression(head, templateSpans) { - var node = createBaseExpression(223 /* SyntaxKind.TemplateExpression */); + var node = createBaseExpression(225 /* SyntaxKind.TemplateExpression */); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags |= @@ -24875,7 +24838,7 @@ var ts; // @api function createYieldExpression(asteriskToken, expression) { ts.Debug.assert(!asteriskToken || !!expression, "A `YieldExpression` with an asteriskToken must have an expression."); - var node = createBaseExpression(224 /* SyntaxKind.YieldExpression */); + var node = createBaseExpression(226 /* SyntaxKind.YieldExpression */); node.expression = expression && parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.asteriskToken = asteriskToken; node.transformFlags |= @@ -24895,7 +24858,7 @@ var ts; } // @api function createSpreadElement(expression) { - var node = createBaseExpression(225 /* SyntaxKind.SpreadElement */); + var node = createBaseExpression(227 /* SyntaxKind.SpreadElement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24911,7 +24874,7 @@ var ts; } // @api function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseClassLikeDeclaration(226 /* SyntaxKind.ClassExpression */, modifiers, name, typeParameters, heritageClauses, members); + var node = createBaseClassLikeDeclaration(228 /* SyntaxKind.ClassExpression */, modifiers, name, typeParameters, heritageClauses, members); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; return node; } @@ -24927,11 +24890,11 @@ var ts; } // @api function createOmittedExpression() { - return createBaseExpression(227 /* SyntaxKind.OmittedExpression */); + return createBaseExpression(229 /* SyntaxKind.OmittedExpression */); } // @api function createExpressionWithTypeArguments(expression, typeArguments) { - var node = createBaseNode(228 /* SyntaxKind.ExpressionWithTypeArguments */); + var node = createBaseNode(230 /* SyntaxKind.ExpressionWithTypeArguments */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags |= @@ -24949,7 +24912,7 @@ var ts; } // @api function createAsExpression(expression, type) { - var node = createBaseExpression(229 /* SyntaxKind.AsExpression */); + var node = createBaseExpression(231 /* SyntaxKind.AsExpression */); node.expression = expression; node.type = type; node.transformFlags |= @@ -24967,7 +24930,7 @@ var ts; } // @api function createNonNullExpression(expression) { - var node = createBaseExpression(230 /* SyntaxKind.NonNullExpression */); + var node = createBaseExpression(232 /* SyntaxKind.NonNullExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24984,8 +24947,26 @@ var ts; : node; } // @api + function createSatisfiesExpression(expression, type) { + var node = createBaseExpression(235 /* SyntaxKind.SatisfiesExpression */); + node.expression = expression; + node.type = type; + node.transformFlags |= + propagateChildFlags(node.expression) | + propagateChildFlags(node.type) | + 1 /* TransformFlags.ContainsTypeScript */; + return node; + } + // @api + function updateSatisfiesExpression(node, expression, type) { + return node.expression !== expression + || node.type !== type + ? update(createSatisfiesExpression(expression, type), node) + : node; + } + // @api function createNonNullChain(expression) { - var node = createBaseExpression(230 /* SyntaxKind.NonNullExpression */); + var node = createBaseExpression(232 /* SyntaxKind.NonNullExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.transformFlags |= @@ -25002,7 +24983,7 @@ var ts; } // @api function createMetaProperty(keywordToken, name) { - var node = createBaseExpression(231 /* SyntaxKind.MetaProperty */); + var node = createBaseExpression(233 /* SyntaxKind.MetaProperty */); node.keywordToken = keywordToken; node.name = name; node.transformFlags |= propagateChildFlags(node.name); @@ -25029,7 +25010,7 @@ var ts; // // @api function createTemplateSpan(expression, literal) { - var node = createBaseNode(233 /* SyntaxKind.TemplateSpan */); + var node = createBaseNode(236 /* SyntaxKind.TemplateSpan */); node.expression = expression; node.literal = literal; node.transformFlags |= @@ -25047,7 +25028,7 @@ var ts; } // @api function createSemicolonClassElement() { - var node = createBaseNode(234 /* SyntaxKind.SemicolonClassElement */); + var node = createBaseNode(237 /* SyntaxKind.SemicolonClassElement */); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; return node; } @@ -25056,7 +25037,7 @@ var ts; // // @api function createBlock(statements, multiLine) { - var node = createBaseNode(235 /* SyntaxKind.Block */); + var node = createBaseNode(238 /* SyntaxKind.Block */); node.statements = createNodeArray(statements); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.statements); @@ -25070,7 +25051,7 @@ var ts; } // @api function createVariableStatement(modifiers, declarationList) { - var node = createBaseDeclaration(237 /* SyntaxKind.VariableStatement */); + var node = createBaseDeclaration(240 /* SyntaxKind.VariableStatement */); node.modifiers = asNodeArray(modifiers); node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; node.transformFlags |= @@ -25090,11 +25071,11 @@ var ts; } // @api function createEmptyStatement() { - return createBaseNode(236 /* SyntaxKind.EmptyStatement */); + return createBaseNode(239 /* SyntaxKind.EmptyStatement */); } // @api function createExpressionStatement(expression) { - var node = createBaseNode(238 /* SyntaxKind.ExpressionStatement */); + var node = createBaseNode(241 /* SyntaxKind.ExpressionStatement */); node.expression = parenthesizerRules().parenthesizeExpressionOfExpressionStatement(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -25107,7 +25088,7 @@ var ts; } // @api function createIfStatement(expression, thenStatement, elseStatement) { - var node = createBaseNode(239 /* SyntaxKind.IfStatement */); + var node = createBaseNode(242 /* SyntaxKind.IfStatement */); node.expression = expression; node.thenStatement = asEmbeddedStatement(thenStatement); node.elseStatement = asEmbeddedStatement(elseStatement); @@ -25127,7 +25108,7 @@ var ts; } // @api function createDoStatement(statement, expression) { - var node = createBaseNode(240 /* SyntaxKind.DoStatement */); + var node = createBaseNode(243 /* SyntaxKind.DoStatement */); node.statement = asEmbeddedStatement(statement); node.expression = expression; node.transformFlags |= @@ -25144,7 +25125,7 @@ var ts; } // @api function createWhileStatement(expression, statement) { - var node = createBaseNode(241 /* SyntaxKind.WhileStatement */); + var node = createBaseNode(244 /* SyntaxKind.WhileStatement */); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -25161,7 +25142,7 @@ var ts; } // @api function createForStatement(initializer, condition, incrementor, statement) { - var node = createBaseNode(242 /* SyntaxKind.ForStatement */); + var node = createBaseNode(245 /* SyntaxKind.ForStatement */); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -25184,7 +25165,7 @@ var ts; } // @api function createForInStatement(initializer, expression, statement) { - var node = createBaseNode(243 /* SyntaxKind.ForInStatement */); + var node = createBaseNode(246 /* SyntaxKind.ForInStatement */); node.initializer = initializer; node.expression = expression; node.statement = asEmbeddedStatement(statement); @@ -25204,7 +25185,7 @@ var ts; } // @api function createForOfStatement(awaitModifier, initializer, expression, statement) { - var node = createBaseNode(244 /* SyntaxKind.ForOfStatement */); + var node = createBaseNode(247 /* SyntaxKind.ForOfStatement */); node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); @@ -25230,7 +25211,7 @@ var ts; } // @api function createContinueStatement(label) { - var node = createBaseNode(245 /* SyntaxKind.ContinueStatement */); + var node = createBaseNode(248 /* SyntaxKind.ContinueStatement */); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | @@ -25245,7 +25226,7 @@ var ts; } // @api function createBreakStatement(label) { - var node = createBaseNode(246 /* SyntaxKind.BreakStatement */); + var node = createBaseNode(249 /* SyntaxKind.BreakStatement */); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | @@ -25260,7 +25241,7 @@ var ts; } // @api function createReturnStatement(expression) { - var node = createBaseNode(247 /* SyntaxKind.ReturnStatement */); + var node = createBaseNode(250 /* SyntaxKind.ReturnStatement */); node.expression = expression; // return in an ES2018 async generator must be awaited node.transformFlags |= @@ -25277,7 +25258,7 @@ var ts; } // @api function createWithStatement(expression, statement) { - var node = createBaseNode(248 /* SyntaxKind.WithStatement */); + var node = createBaseNode(251 /* SyntaxKind.WithStatement */); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -25294,7 +25275,7 @@ var ts; } // @api function createSwitchStatement(expression, caseBlock) { - var node = createBaseNode(249 /* SyntaxKind.SwitchStatement */); + var node = createBaseNode(252 /* SyntaxKind.SwitchStatement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.caseBlock = caseBlock; node.transformFlags |= @@ -25311,7 +25292,7 @@ var ts; } // @api function createLabeledStatement(label, statement) { - var node = createBaseNode(250 /* SyntaxKind.LabeledStatement */); + var node = createBaseNode(253 /* SyntaxKind.LabeledStatement */); node.label = asName(label); node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -25328,7 +25309,7 @@ var ts; } // @api function createThrowStatement(expression) { - var node = createBaseNode(251 /* SyntaxKind.ThrowStatement */); + var node = createBaseNode(254 /* SyntaxKind.ThrowStatement */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -25341,7 +25322,7 @@ var ts; } // @api function createTryStatement(tryBlock, catchClause, finallyBlock) { - var node = createBaseNode(252 /* SyntaxKind.TryStatement */); + var node = createBaseNode(255 /* SyntaxKind.TryStatement */); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -25361,11 +25342,11 @@ var ts; } // @api function createDebuggerStatement() { - return createBaseNode(253 /* SyntaxKind.DebuggerStatement */); + return createBaseNode(256 /* SyntaxKind.DebuggerStatement */); } // @api function createVariableDeclaration(name, exclamationToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(254 /* SyntaxKind.VariableDeclaration */, + var node = createBaseVariableLikeDeclaration(257 /* SyntaxKind.VariableDeclaration */, /*modifiers*/ undefined, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.exclamationToken = exclamationToken; node.transformFlags |= propagateChildFlags(node.exclamationToken); @@ -25386,7 +25367,7 @@ var ts; // @api function createVariableDeclarationList(declarations, flags) { if (flags === void 0) { flags = 0 /* NodeFlags.None */; } - var node = createBaseNode(255 /* SyntaxKind.VariableDeclarationList */); + var node = createBaseNode(258 /* SyntaxKind.VariableDeclarationList */); node.flags |= flags & 3 /* NodeFlags.BlockScoped */; node.declarations = createNodeArray(declarations); node.transformFlags |= @@ -25407,7 +25388,7 @@ var ts; } // @api function createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(256 /* SyntaxKind.FunctionDeclaration */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(259 /* SyntaxKind.FunctionDeclaration */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; if (!node.body || ts.modifiersToFlags(node.modifiers) & 2 /* ModifierFlags.Ambient */) { node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -25416,7 +25397,7 @@ var ts; node.transformFlags |= propagateChildFlags(node.asteriskToken) | 4194304 /* TransformFlags.ContainsHoistedDeclarationOrCompletion */; - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (node.asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -25453,7 +25434,7 @@ var ts; } // @api function createClassDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseClassLikeDeclaration(257 /* SyntaxKind.ClassDeclaration */, modifiers, name, typeParameters, heritageClauses, members); + var node = createBaseClassLikeDeclaration(260 /* SyntaxKind.ClassDeclaration */, modifiers, name, typeParameters, heritageClauses, members); if (ts.modifiersToFlags(node.modifiers) & 2 /* ModifierFlags.Ambient */) { node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; } @@ -25477,7 +25458,7 @@ var ts; } // @api function createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseInterfaceOrClassLikeDeclaration(258 /* SyntaxKind.InterfaceDeclaration */, modifiers, name, typeParameters, heritageClauses); + var node = createBaseInterfaceOrClassLikeDeclaration(261 /* SyntaxKind.InterfaceDeclaration */, modifiers, name, typeParameters, heritageClauses); node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25502,7 +25483,7 @@ var ts; } // @api function createTypeAliasDeclaration(modifiers, name, typeParameters, type) { - var node = createBaseGenericNamedDeclaration(259 /* SyntaxKind.TypeAliasDeclaration */, modifiers, name, typeParameters); + var node = createBaseGenericNamedDeclaration(262 /* SyntaxKind.TypeAliasDeclaration */, modifiers, name, typeParameters); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25526,7 +25507,7 @@ var ts; } // @api function createEnumDeclaration(modifiers, name, members) { - var node = createBaseNamedDeclaration(260 /* SyntaxKind.EnumDeclaration */, modifiers, name); + var node = createBaseNamedDeclaration(263 /* SyntaxKind.EnumDeclaration */, modifiers, name); node.members = createNodeArray(members); node.transformFlags |= propagateChildrenFlags(node.members) | @@ -25553,7 +25534,7 @@ var ts; // @api function createModuleDeclaration(modifiers, name, body, flags) { if (flags === void 0) { flags = 0 /* NodeFlags.None */; } - var node = createBaseDeclaration(261 /* SyntaxKind.ModuleDeclaration */); + var node = createBaseDeclaration(264 /* SyntaxKind.ModuleDeclaration */); node.modifiers = asNodeArray(modifiers); node.flags |= flags & (16 /* NodeFlags.Namespace */ | 4 /* NodeFlags.NestedNamespace */ | 1024 /* NodeFlags.GlobalAugmentation */); node.name = name; @@ -25589,7 +25570,7 @@ var ts; } // @api function createModuleBlock(statements) { - var node = createBaseNode(262 /* SyntaxKind.ModuleBlock */); + var node = createBaseNode(265 /* SyntaxKind.ModuleBlock */); node.statements = createNodeArray(statements); node.transformFlags |= propagateChildrenFlags(node.statements); return node; @@ -25602,7 +25583,7 @@ var ts; } // @api function createCaseBlock(clauses) { - var node = createBaseNode(263 /* SyntaxKind.CaseBlock */); + var node = createBaseNode(266 /* SyntaxKind.CaseBlock */); node.clauses = createNodeArray(clauses); node.transformFlags |= propagateChildrenFlags(node.clauses); return node; @@ -25615,7 +25596,7 @@ var ts; } // @api function createNamespaceExportDeclaration(name) { - var node = createBaseNamedDeclaration(264 /* SyntaxKind.NamespaceExportDeclaration */, + var node = createBaseNamedDeclaration(267 /* SyntaxKind.NamespaceExportDeclaration */, /*modifiers*/ undefined, name); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25638,7 +25619,7 @@ var ts; } // @api function createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference) { - var node = createBaseNamedDeclaration(265 /* SyntaxKind.ImportEqualsDeclaration */, modifiers, name); + var node = createBaseNamedDeclaration(268 /* SyntaxKind.ImportEqualsDeclaration */, modifiers, name); node.isTypeOnly = isTypeOnly; node.moduleReference = moduleReference; node.transformFlags |= propagateChildFlags(node.moduleReference); @@ -25666,7 +25647,7 @@ var ts; } // @api function createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause) { - var node = createBaseDeclaration(266 /* SyntaxKind.ImportDeclaration */); + var node = createBaseDeclaration(269 /* SyntaxKind.ImportDeclaration */); node.modifiers = asNodeArray(modifiers); node.importClause = importClause; node.moduleSpecifier = moduleSpecifier; @@ -25696,7 +25677,7 @@ var ts; } // @api function createImportClause(isTypeOnly, name, namedBindings) { - var node = createBaseNode(267 /* SyntaxKind.ImportClause */); + var node = createBaseNode(270 /* SyntaxKind.ImportClause */); node.isTypeOnly = isTypeOnly; node.name = name; node.namedBindings = namedBindings; @@ -25719,7 +25700,7 @@ var ts; } // @api function createAssertClause(elements, multiLine) { - var node = createBaseNode(293 /* SyntaxKind.AssertClause */); + var node = createBaseNode(296 /* SyntaxKind.AssertClause */); node.elements = createNodeArray(elements); node.multiLine = multiLine; node.transformFlags |= 4 /* TransformFlags.ContainsESNext */; @@ -25734,7 +25715,7 @@ var ts; } // @api function createAssertEntry(name, value) { - var node = createBaseNode(294 /* SyntaxKind.AssertEntry */); + var node = createBaseNode(297 /* SyntaxKind.AssertEntry */); node.name = name; node.value = value; node.transformFlags |= 4 /* TransformFlags.ContainsESNext */; @@ -25749,7 +25730,7 @@ var ts; } // @api function createImportTypeAssertionContainer(clause, multiLine) { - var node = createBaseNode(295 /* SyntaxKind.ImportTypeAssertionContainer */); + var node = createBaseNode(298 /* SyntaxKind.ImportTypeAssertionContainer */); node.assertClause = clause; node.multiLine = multiLine; return node; @@ -25763,7 +25744,7 @@ var ts; } // @api function createNamespaceImport(name) { - var node = createBaseNode(268 /* SyntaxKind.NamespaceImport */); + var node = createBaseNode(271 /* SyntaxKind.NamespaceImport */); node.name = name; node.transformFlags |= propagateChildFlags(node.name); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25777,7 +25758,7 @@ var ts; } // @api function createNamespaceExport(name) { - var node = createBaseNode(274 /* SyntaxKind.NamespaceExport */); + var node = createBaseNode(277 /* SyntaxKind.NamespaceExport */); node.name = name; node.transformFlags |= propagateChildFlags(node.name) | @@ -25793,7 +25774,7 @@ var ts; } // @api function createNamedImports(elements) { - var node = createBaseNode(269 /* SyntaxKind.NamedImports */); + var node = createBaseNode(272 /* SyntaxKind.NamedImports */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25807,7 +25788,7 @@ var ts; } // @api function createImportSpecifier(isTypeOnly, propertyName, name) { - var node = createBaseNode(270 /* SyntaxKind.ImportSpecifier */); + var node = createBaseNode(273 /* SyntaxKind.ImportSpecifier */); node.isTypeOnly = isTypeOnly; node.propertyName = propertyName; node.name = name; @@ -25827,7 +25808,7 @@ var ts; } // @api function createExportAssignment(modifiers, isExportEquals, expression) { - var node = createBaseDeclaration(271 /* SyntaxKind.ExportAssignment */); + var node = createBaseDeclaration(274 /* SyntaxKind.ExportAssignment */); node.modifiers = asNodeArray(modifiers); node.isExportEquals = isExportEquals; node.expression = isExportEquals @@ -25854,7 +25835,7 @@ var ts; } // @api function createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause) { - var node = createBaseDeclaration(272 /* SyntaxKind.ExportDeclaration */); + var node = createBaseDeclaration(275 /* SyntaxKind.ExportDeclaration */); node.modifiers = asNodeArray(modifiers); node.isTypeOnly = isTypeOnly; node.exportClause = exportClause; @@ -25887,7 +25868,7 @@ var ts; } // @api function createNamedExports(elements) { - var node = createBaseNode(273 /* SyntaxKind.NamedExports */); + var node = createBaseNode(276 /* SyntaxKind.NamedExports */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25901,7 +25882,7 @@ var ts; } // @api function createExportSpecifier(isTypeOnly, propertyName, name) { - var node = createBaseNode(275 /* SyntaxKind.ExportSpecifier */); + var node = createBaseNode(278 /* SyntaxKind.ExportSpecifier */); node.isTypeOnly = isTypeOnly; node.propertyName = asName(propertyName); node.name = asName(name); @@ -25921,7 +25902,7 @@ var ts; } // @api function createMissingDeclaration() { - var node = createBaseDeclaration(276 /* SyntaxKind.MissingDeclaration */); + var node = createBaseDeclaration(279 /* SyntaxKind.MissingDeclaration */); return node; } // @@ -25929,7 +25910,7 @@ var ts; // // @api function createExternalModuleReference(expression) { - var node = createBaseNode(277 /* SyntaxKind.ExternalModuleReference */); + var node = createBaseNode(280 /* SyntaxKind.ExternalModuleReference */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25987,7 +25968,7 @@ var ts; } // @api function createJSDocFunctionType(parameters, type) { - var node = createBaseSignatureDeclaration(317 /* SyntaxKind.JSDocFunctionType */, + var node = createBaseSignatureDeclaration(320 /* SyntaxKind.JSDocFunctionType */, /*modifiers*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined, parameters, type); @@ -26003,7 +25984,7 @@ var ts; // @api function createJSDocTypeLiteral(propertyTags, isArrayType) { if (isArrayType === void 0) { isArrayType = false; } - var node = createBaseNode(322 /* SyntaxKind.JSDocTypeLiteral */); + var node = createBaseNode(325 /* SyntaxKind.JSDocTypeLiteral */); node.jsDocPropertyTags = asNodeArray(propertyTags); node.isArrayType = isArrayType; return node; @@ -26017,7 +25998,7 @@ var ts; } // @api function createJSDocTypeExpression(type) { - var node = createBaseNode(309 /* SyntaxKind.JSDocTypeExpression */); + var node = createBaseNode(312 /* SyntaxKind.JSDocTypeExpression */); node.type = type; return node; } @@ -26029,7 +26010,7 @@ var ts; } // @api function createJSDocSignature(typeParameters, parameters, type) { - var node = createBaseNode(323 /* SyntaxKind.JSDocSignature */); + var node = createBaseNode(326 /* SyntaxKind.JSDocSignature */); node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; @@ -26058,7 +26039,7 @@ var ts; } // @api function createJSDocTemplateTag(tagName, constraint, typeParameters, comment) { - var node = createBaseJSDocTag(344 /* SyntaxKind.JSDocTemplateTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); + var node = createBaseJSDocTag(347 /* SyntaxKind.JSDocTemplateTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); node.constraint = constraint; node.typeParameters = createNodeArray(typeParameters); return node; @@ -26075,7 +26056,7 @@ var ts; } // @api function createJSDocTypedefTag(tagName, typeExpression, fullName, comment) { - var node = createBaseJSDocTag(345 /* SyntaxKind.JSDocTypedefTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); + var node = createBaseJSDocTag(348 /* SyntaxKind.JSDocTypedefTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = ts.getJSDocTypeAliasName(fullName); @@ -26093,7 +26074,7 @@ var ts; } // @api function createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - var node = createBaseJSDocTag(340 /* SyntaxKind.JSDocParameterTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); + var node = createBaseJSDocTag(343 /* SyntaxKind.JSDocParameterTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -26114,7 +26095,7 @@ var ts; } // @api function createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - var node = createBaseJSDocTag(347 /* SyntaxKind.JSDocPropertyTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); + var node = createBaseJSDocTag(350 /* SyntaxKind.JSDocPropertyTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -26135,7 +26116,7 @@ var ts; } // @api function createJSDocCallbackTag(tagName, typeExpression, fullName, comment) { - var node = createBaseJSDocTag(338 /* SyntaxKind.JSDocCallbackTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); + var node = createBaseJSDocTag(341 /* SyntaxKind.JSDocCallbackTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = ts.getJSDocTypeAliasName(fullName); @@ -26153,7 +26134,7 @@ var ts; } // @api function createJSDocAugmentsTag(tagName, className, comment) { - var node = createBaseJSDocTag(328 /* SyntaxKind.JSDocAugmentsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); + var node = createBaseJSDocTag(331 /* SyntaxKind.JSDocAugmentsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); node.class = className; return node; } @@ -26168,13 +26149,13 @@ var ts; } // @api function createJSDocImplementsTag(tagName, className, comment) { - var node = createBaseJSDocTag(329 /* SyntaxKind.JSDocImplementsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); + var node = createBaseJSDocTag(332 /* SyntaxKind.JSDocImplementsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); node.class = className; return node; } // @api function createJSDocSeeTag(tagName, name, comment) { - var node = createBaseJSDocTag(346 /* SyntaxKind.JSDocSeeTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); + var node = createBaseJSDocTag(349 /* SyntaxKind.JSDocSeeTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); node.name = name; return node; } @@ -26188,7 +26169,7 @@ var ts; } // @api function createJSDocNameReference(name) { - var node = createBaseNode(310 /* SyntaxKind.JSDocNameReference */); + var node = createBaseNode(313 /* SyntaxKind.JSDocNameReference */); node.name = name; return node; } @@ -26200,7 +26181,7 @@ var ts; } // @api function createJSDocMemberName(left, right) { - var node = createBaseNode(311 /* SyntaxKind.JSDocMemberName */); + var node = createBaseNode(314 /* SyntaxKind.JSDocMemberName */); node.left = left; node.right = right; node.transformFlags |= @@ -26217,7 +26198,7 @@ var ts; } // @api function createJSDocLink(name, text) { - var node = createBaseNode(324 /* SyntaxKind.JSDocLink */); + var node = createBaseNode(327 /* SyntaxKind.JSDocLink */); node.name = name; node.text = text; return node; @@ -26230,7 +26211,7 @@ var ts; } // @api function createJSDocLinkCode(name, text) { - var node = createBaseNode(325 /* SyntaxKind.JSDocLinkCode */); + var node = createBaseNode(328 /* SyntaxKind.JSDocLinkCode */); node.name = name; node.text = text; return node; @@ -26243,7 +26224,7 @@ var ts; } // @api function createJSDocLinkPlain(name, text) { - var node = createBaseNode(326 /* SyntaxKind.JSDocLinkPlain */); + var node = createBaseNode(329 /* SyntaxKind.JSDocLinkPlain */); node.name = name; node.text = text; return node; @@ -26315,7 +26296,7 @@ var ts; } // @api function createJSDocUnknownTag(tagName, comment) { - var node = createBaseJSDocTag(327 /* SyntaxKind.JSDocTag */, tagName, comment); + var node = createBaseJSDocTag(330 /* SyntaxKind.JSDocTag */, tagName, comment); return node; } // @api @@ -26327,7 +26308,7 @@ var ts; } // @api function createJSDocText(text) { - var node = createBaseNode(321 /* SyntaxKind.JSDocText */); + var node = createBaseNode(324 /* SyntaxKind.JSDocText */); node.text = text; return node; } @@ -26339,7 +26320,7 @@ var ts; } // @api function createJSDocComment(comment, tags) { - var node = createBaseNode(320 /* SyntaxKind.JSDoc */); + var node = createBaseNode(323 /* SyntaxKind.JSDoc */); node.comment = comment; node.tags = asNodeArray(tags); return node; @@ -26356,7 +26337,7 @@ var ts; // // @api function createJsxElement(openingElement, children, closingElement) { - var node = createBaseNode(278 /* SyntaxKind.JsxElement */); + var node = createBaseNode(281 /* SyntaxKind.JsxElement */); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -26377,7 +26358,7 @@ var ts; } // @api function createJsxSelfClosingElement(tagName, typeArguments, attributes) { - var node = createBaseNode(279 /* SyntaxKind.JsxSelfClosingElement */); + var node = createBaseNode(282 /* SyntaxKind.JsxSelfClosingElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -26401,7 +26382,7 @@ var ts; } // @api function createJsxOpeningElement(tagName, typeArguments, attributes) { - var node = createBaseNode(280 /* SyntaxKind.JsxOpeningElement */); + var node = createBaseNode(283 /* SyntaxKind.JsxOpeningElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -26425,7 +26406,7 @@ var ts; } // @api function createJsxClosingElement(tagName) { - var node = createBaseNode(281 /* SyntaxKind.JsxClosingElement */); + var node = createBaseNode(284 /* SyntaxKind.JsxClosingElement */); node.tagName = tagName; node.transformFlags |= propagateChildFlags(node.tagName) | @@ -26440,7 +26421,7 @@ var ts; } // @api function createJsxFragment(openingFragment, children, closingFragment) { - var node = createBaseNode(282 /* SyntaxKind.JsxFragment */); + var node = createBaseNode(285 /* SyntaxKind.JsxFragment */); node.openingFragment = openingFragment; node.children = createNodeArray(children); node.closingFragment = closingFragment; @@ -26476,19 +26457,19 @@ var ts; } // @api function createJsxOpeningFragment() { - var node = createBaseNode(283 /* SyntaxKind.JsxOpeningFragment */); + var node = createBaseNode(286 /* SyntaxKind.JsxOpeningFragment */); node.transformFlags |= 2 /* TransformFlags.ContainsJsx */; return node; } // @api function createJsxJsxClosingFragment() { - var node = createBaseNode(284 /* SyntaxKind.JsxClosingFragment */); + var node = createBaseNode(287 /* SyntaxKind.JsxClosingFragment */); node.transformFlags |= 2 /* TransformFlags.ContainsJsx */; return node; } // @api function createJsxAttribute(name, initializer) { - var node = createBaseNode(285 /* SyntaxKind.JsxAttribute */); + var node = createBaseNode(288 /* SyntaxKind.JsxAttribute */); node.name = name; node.initializer = initializer; node.transformFlags |= @@ -26506,7 +26487,7 @@ var ts; } // @api function createJsxAttributes(properties) { - var node = createBaseNode(286 /* SyntaxKind.JsxAttributes */); + var node = createBaseNode(289 /* SyntaxKind.JsxAttributes */); node.properties = createNodeArray(properties); node.transformFlags |= propagateChildrenFlags(node.properties) | @@ -26521,7 +26502,7 @@ var ts; } // @api function createJsxSpreadAttribute(expression) { - var node = createBaseNode(287 /* SyntaxKind.JsxSpreadAttribute */); + var node = createBaseNode(290 /* SyntaxKind.JsxSpreadAttribute */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression) | @@ -26536,7 +26517,7 @@ var ts; } // @api function createJsxExpression(dotDotDotToken, expression) { - var node = createBaseNode(288 /* SyntaxKind.JsxExpression */); + var node = createBaseNode(291 /* SyntaxKind.JsxExpression */); node.dotDotDotToken = dotDotDotToken; node.expression = expression; node.transformFlags |= @@ -26556,7 +26537,7 @@ var ts; // // @api function createCaseClause(expression, statements) { - var node = createBaseNode(289 /* SyntaxKind.CaseClause */); + var node = createBaseNode(292 /* SyntaxKind.CaseClause */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.statements = createNodeArray(statements); node.transformFlags |= @@ -26573,7 +26554,7 @@ var ts; } // @api function createDefaultClause(statements) { - var node = createBaseNode(290 /* SyntaxKind.DefaultClause */); + var node = createBaseNode(293 /* SyntaxKind.DefaultClause */); node.statements = createNodeArray(statements); node.transformFlags = propagateChildrenFlags(node.statements); return node; @@ -26586,7 +26567,7 @@ var ts; } // @api function createHeritageClause(token, types) { - var node = createBaseNode(291 /* SyntaxKind.HeritageClause */); + var node = createBaseNode(294 /* SyntaxKind.HeritageClause */); node.token = token; node.types = createNodeArray(types); node.transformFlags |= propagateChildrenFlags(node.types); @@ -26610,7 +26591,7 @@ var ts; } // @api function createCatchClause(variableDeclaration, block) { - var node = createBaseNode(292 /* SyntaxKind.CatchClause */); + var node = createBaseNode(295 /* SyntaxKind.CatchClause */); if (typeof variableDeclaration === "string" || variableDeclaration && !ts.isVariableDeclaration(variableDeclaration)) { variableDeclaration = createVariableDeclaration(variableDeclaration, /*exclamationToken*/ undefined, @@ -26638,7 +26619,7 @@ var ts; // // @api function createPropertyAssignment(name, initializer) { - var node = createBaseNamedDeclaration(296 /* SyntaxKind.PropertyAssignment */, + var node = createBaseNamedDeclaration(299 /* SyntaxKind.PropertyAssignment */, /*modifiers*/ undefined, name); node.initializer = parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= @@ -26670,7 +26651,7 @@ var ts; } // @api function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - var node = createBaseNamedDeclaration(297 /* SyntaxKind.ShorthandPropertyAssignment */, + var node = createBaseNamedDeclaration(300 /* SyntaxKind.ShorthandPropertyAssignment */, /*modifiers*/ undefined, name); node.objectAssignmentInitializer = objectAssignmentInitializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(objectAssignmentInitializer); node.transformFlags |= @@ -26704,7 +26685,7 @@ var ts; } // @api function createSpreadAssignment(expression) { - var node = createBaseNode(298 /* SyntaxKind.SpreadAssignment */); + var node = createBaseNode(301 /* SyntaxKind.SpreadAssignment */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -26723,7 +26704,7 @@ var ts; // // @api function createEnumMember(name, initializer) { - var node = createBaseNode(299 /* SyntaxKind.EnumMember */); + var node = createBaseNode(302 /* SyntaxKind.EnumMember */); node.name = asName(name); node.initializer = initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= @@ -26744,7 +26725,7 @@ var ts; // // @api function createSourceFile(statements, endOfFileToken, flags) { - var node = baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */); + var node = baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */); node.statements = createNodeArray(statements); node.endOfFileToken = endOfFileToken; node.flags |= flags; @@ -26761,7 +26742,7 @@ var ts; return node; } function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) { - var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */)); + var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */)); for (var p in source) { if (p === "emitNode" || ts.hasProperty(node, p) || !ts.hasProperty(source, p)) continue; @@ -26800,7 +26781,7 @@ var ts; // @api function createBundle(sourceFiles, prepends) { if (prepends === void 0) { prepends = ts.emptyArray; } - var node = createBaseNode(306 /* SyntaxKind.Bundle */); + var node = createBaseNode(309 /* SyntaxKind.Bundle */); node.prepends = prepends; node.sourceFiles = sourceFiles; return node; @@ -26815,7 +26796,7 @@ var ts; } // @api function createUnparsedSource(prologues, syntheticReferences, texts) { - var node = createBaseNode(307 /* SyntaxKind.UnparsedSource */); + var node = createBaseNode(310 /* SyntaxKind.UnparsedSource */); node.prologues = prologues; node.syntheticReferences = syntheticReferences; node.texts = texts; @@ -26833,28 +26814,28 @@ var ts; } // @api function createUnparsedPrologue(data) { - return createBaseUnparsedNode(300 /* SyntaxKind.UnparsedPrologue */, data); + return createBaseUnparsedNode(303 /* SyntaxKind.UnparsedPrologue */, data); } // @api function createUnparsedPrepend(data, texts) { - var node = createBaseUnparsedNode(301 /* SyntaxKind.UnparsedPrepend */, data); + var node = createBaseUnparsedNode(304 /* SyntaxKind.UnparsedPrepend */, data); node.texts = texts; return node; } // @api function createUnparsedTextLike(data, internal) { - return createBaseUnparsedNode(internal ? 303 /* SyntaxKind.UnparsedInternalText */ : 302 /* SyntaxKind.UnparsedText */, data); + return createBaseUnparsedNode(internal ? 306 /* SyntaxKind.UnparsedInternalText */ : 305 /* SyntaxKind.UnparsedText */, data); } // @api function createUnparsedSyntheticReference(section) { - var node = createBaseNode(304 /* SyntaxKind.UnparsedSyntheticReference */); + var node = createBaseNode(307 /* SyntaxKind.UnparsedSyntheticReference */); node.data = section.data; node.section = section; return node; } // @api function createInputFiles() { - var node = createBaseNode(308 /* SyntaxKind.InputFiles */); + var node = createBaseNode(311 /* SyntaxKind.InputFiles */); node.javascriptText = ""; node.declarationText = ""; return node; @@ -26865,7 +26846,7 @@ var ts; // @api function createSyntheticExpression(type, isSpread, tupleNameSource) { if (isSpread === void 0) { isSpread = false; } - var node = createBaseNode(232 /* SyntaxKind.SyntheticExpression */); + var node = createBaseNode(234 /* SyntaxKind.SyntheticExpression */); node.type = type; node.isSpread = isSpread; node.tupleNameSource = tupleNameSource; @@ -26873,7 +26854,7 @@ var ts; } // @api function createSyntaxList(children) { - var node = createBaseNode(348 /* SyntaxKind.SyntaxList */); + var node = createBaseNode(351 /* SyntaxKind.SyntaxList */); node._children = children; return node; } @@ -26888,7 +26869,7 @@ var ts; */ // @api function createNotEmittedStatement(original) { - var node = createBaseNode(349 /* SyntaxKind.NotEmittedStatement */); + var node = createBaseNode(352 /* SyntaxKind.NotEmittedStatement */); node.original = original; ts.setTextRange(node, original); return node; @@ -26902,7 +26883,7 @@ var ts; */ // @api function createPartiallyEmittedExpression(expression, original) { - var node = createBaseNode(350 /* SyntaxKind.PartiallyEmittedExpression */); + var node = createBaseNode(353 /* SyntaxKind.PartiallyEmittedExpression */); node.expression = expression; node.original = original; node.transformFlags |= @@ -26930,7 +26911,7 @@ var ts; } // @api function createCommaListExpression(elements) { - var node = createBaseNode(351 /* SyntaxKind.CommaListExpression */); + var node = createBaseNode(354 /* SyntaxKind.CommaListExpression */); node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)); node.transformFlags |= propagateChildrenFlags(node.elements); return node; @@ -26947,7 +26928,7 @@ var ts; */ // @api function createEndOfDeclarationMarker(original) { - var node = createBaseNode(353 /* SyntaxKind.EndOfDeclarationMarker */); + var node = createBaseNode(356 /* SyntaxKind.EndOfDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -26958,14 +26939,14 @@ var ts; */ // @api function createMergeDeclarationMarker(original) { - var node = createBaseNode(352 /* SyntaxKind.MergeDeclarationMarker */); + var node = createBaseNode(355 /* SyntaxKind.MergeDeclarationMarker */); node.emitNode = {}; node.original = original; return node; } // @api function createSyntheticReferenceExpression(expression, thisArg) { - var node = createBaseNode(354 /* SyntaxKind.SyntheticReferenceExpression */); + var node = createBaseNode(357 /* SyntaxKind.SyntheticReferenceExpression */); node.expression = expression; node.thisArg = thisArg; node.transformFlags |= @@ -26987,7 +26968,7 @@ var ts; if (node === undefined) { return node; } - var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */) : + var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */) : ts.isIdentifier(node) ? baseFactory.createBaseIdentifierNode(79 /* SyntaxKind.Identifier */) : ts.isPrivateIdentifier(node) ? baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */) : !ts.isNodeKind(node.kind) ? baseFactory.createBaseTokenNode(node.kind) : @@ -26996,7 +26977,7 @@ var ts; clone.transformFlags = node.transformFlags; setOriginalNode(clone, node); for (var key in node) { - if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { + if (ts.hasProperty(clone, key) || !ts.hasProperty(node, key)) { continue; } clone[key] = node[key]; @@ -27104,11 +27085,12 @@ var ts; } function updateOuterExpression(outerExpression, expression) { switch (outerExpression.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: return updateParenthesizedExpression(outerExpression, expression); - case 211 /* SyntaxKind.TypeAssertionExpression */: return updateTypeAssertion(outerExpression, outerExpression.type, expression); - case 229 /* SyntaxKind.AsExpression */: return updateAsExpression(outerExpression, expression, outerExpression.type); - case 230 /* SyntaxKind.NonNullExpression */: return updateNonNullExpression(outerExpression, expression); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: return updatePartiallyEmittedExpression(outerExpression, expression); + case 214 /* SyntaxKind.ParenthesizedExpression */: return updateParenthesizedExpression(outerExpression, expression); + case 213 /* SyntaxKind.TypeAssertionExpression */: return updateTypeAssertion(outerExpression, outerExpression.type, expression); + case 231 /* SyntaxKind.AsExpression */: return updateAsExpression(outerExpression, expression, outerExpression.type); + case 235 /* SyntaxKind.SatisfiesExpression */: return updateSatisfiesExpression(outerExpression, expression, outerExpression.type); + case 232 /* SyntaxKind.NonNullExpression */: return updateNonNullExpression(outerExpression, expression); + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return updatePartiallyEmittedExpression(outerExpression, expression); } } /** @@ -27162,13 +27144,13 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: return false; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return target.properties.length > 0; default: return true; @@ -27594,24 +27576,24 @@ var ts; } function getDefaultTagNameForKind(kind) { switch (kind) { - case 343 /* SyntaxKind.JSDocTypeTag */: return "type"; - case 341 /* SyntaxKind.JSDocReturnTag */: return "returns"; - case 342 /* SyntaxKind.JSDocThisTag */: return "this"; - case 339 /* SyntaxKind.JSDocEnumTag */: return "enum"; - case 330 /* SyntaxKind.JSDocAuthorTag */: return "author"; - case 332 /* SyntaxKind.JSDocClassTag */: return "class"; - case 333 /* SyntaxKind.JSDocPublicTag */: return "public"; - case 334 /* SyntaxKind.JSDocPrivateTag */: return "private"; - case 335 /* SyntaxKind.JSDocProtectedTag */: return "protected"; - case 336 /* SyntaxKind.JSDocReadonlyTag */: return "readonly"; - case 337 /* SyntaxKind.JSDocOverrideTag */: return "override"; - case 344 /* SyntaxKind.JSDocTemplateTag */: return "template"; - case 345 /* SyntaxKind.JSDocTypedefTag */: return "typedef"; - case 340 /* SyntaxKind.JSDocParameterTag */: return "param"; - case 347 /* SyntaxKind.JSDocPropertyTag */: return "prop"; - case 338 /* SyntaxKind.JSDocCallbackTag */: return "callback"; - case 328 /* SyntaxKind.JSDocAugmentsTag */: return "augments"; - case 329 /* SyntaxKind.JSDocImplementsTag */: return "implements"; + case 346 /* SyntaxKind.JSDocTypeTag */: return "type"; + case 344 /* SyntaxKind.JSDocReturnTag */: return "returns"; + case 345 /* SyntaxKind.JSDocThisTag */: return "this"; + case 342 /* SyntaxKind.JSDocEnumTag */: return "enum"; + case 333 /* SyntaxKind.JSDocAuthorTag */: return "author"; + case 335 /* SyntaxKind.JSDocClassTag */: return "class"; + case 336 /* SyntaxKind.JSDocPublicTag */: return "public"; + case 337 /* SyntaxKind.JSDocPrivateTag */: return "private"; + case 338 /* SyntaxKind.JSDocProtectedTag */: return "protected"; + case 339 /* SyntaxKind.JSDocReadonlyTag */: return "readonly"; + case 340 /* SyntaxKind.JSDocOverrideTag */: return "override"; + case 347 /* SyntaxKind.JSDocTemplateTag */: return "template"; + case 348 /* SyntaxKind.JSDocTypedefTag */: return "typedef"; + case 343 /* SyntaxKind.JSDocParameterTag */: return "param"; + case 350 /* SyntaxKind.JSDocPropertyTag */: return "prop"; + case 341 /* SyntaxKind.JSDocCallbackTag */: return "callback"; + case 331 /* SyntaxKind.JSDocAugmentsTag */: return "augments"; + case 332 /* SyntaxKind.JSDocImplementsTag */: return "implements"; default: return ts.Debug.fail("Unsupported kind: ".concat(ts.Debug.formatSyntaxKind(kind))); } @@ -27691,69 +27673,70 @@ var ts; */ /* @internal */ function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 177 /* SyntaxKind.FirstTypeNode */ && kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (kind >= 179 /* SyntaxKind.FirstTypeNode */ && kind <= 202 /* SyntaxKind.LastTypeNode */) { return -2 /* TransformFlags.TypeExcludes */; } switch (kind) { - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return -2147450880 /* TransformFlags.ArrayLiteralOrCallOrNewExcludes */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return -1941676032 /* TransformFlags.ModuleExcludes */; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return -2147483648 /* TransformFlags.ParameterExcludes */; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return -2072174592 /* TransformFlags.ArrowFunctionExcludes */; - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return -1937940480 /* TransformFlags.FunctionExcludes */; - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return -2146893824 /* TransformFlags.VariableDeclarationListExcludes */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return -2147344384 /* TransformFlags.ClassExcludes */; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return -1937948672 /* TransformFlags.ConstructorExcludes */; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return -2013249536 /* TransformFlags.PropertyExcludes */; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return -2005057536 /* TransformFlags.MethodOrAccessorExcludes */; - case 130 /* SyntaxKind.AnyKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 163 /* SyntaxKind.TypeParameter */: - case 166 /* SyntaxKind.PropertySignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: + case 168 /* SyntaxKind.PropertySignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return -2 /* TransformFlags.TypeExcludes */; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return -2147278848 /* TransformFlags.ObjectLiteralExcludes */; - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return -2147418112 /* TransformFlags.CatchClauseExcludes */; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return -2147450880 /* TransformFlags.BindingPatternExcludes */; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: case 106 /* SyntaxKind.SuperKeyword */: return -2147483648 /* TransformFlags.OuterExpressionExcludes */; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return -2147483648 /* TransformFlags.PropertyAccessExcludes */; default: return -2147483648 /* TransformFlags.NodeExcludes */; @@ -27953,9 +27936,10 @@ var ts; }; var buildInfo_1; var getAndCacheBuildInfo_1 = function (getText) { + var _a; if (buildInfo_1 === undefined) { var result = getText(); - buildInfo_1 = result !== undefined ? ts.getBuildInfo(result) : false; + buildInfo_1 = result !== undefined ? (_a = ts.getBuildInfo(node.buildInfoPath, result)) !== null && _a !== void 0 ? _a : false : false; } return buildInfo_1 || undefined; }; @@ -28009,7 +27993,7 @@ var ts; } ts.setOriginalNode = setOriginalNode; function mergeEmitNode(sourceEmitNode, destEmitNode) { - var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine; + var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine, snippetElement = sourceEmitNode.snippetElement; if (!destEmitNode) destEmitNode = {}; // We are using `.slice()` here in case `destEmitNode.leadingComments` is pushed to later. @@ -28035,6 +28019,8 @@ var ts; } if (startsOnNewLine !== undefined) destEmitNode.startsOnNewLine = startsOnNewLine; + if (snippetElement !== undefined) + destEmitNode.snippetElement = snippetElement; return destEmitNode; } function mergeTokenSourceMapRanges(sourceRanges, destRanges) { @@ -28060,7 +28046,7 @@ var ts; // To avoid holding onto transformation artifacts, we keep track of any // parse tree node we are annotating. This allows us to clean them up after // all transformations have completed. - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = (_a = ts.getSourceFileOfNode(ts.getParseTreeNode(ts.getSourceFileOfNode(node)))) !== null && _a !== void 0 ? _a : ts.Debug.fail("Could not determine parsed source file."); @@ -29138,22 +29124,22 @@ var ts; ts.isExportModifier = isExportModifier; /* @internal */ function isAsyncModifier(node) { - return node.kind === 131 /* SyntaxKind.AsyncKeyword */; + return node.kind === 132 /* SyntaxKind.AsyncKeyword */; } ts.isAsyncModifier = isAsyncModifier; /* @internal */ function isAssertsKeyword(node) { - return node.kind === 128 /* SyntaxKind.AssertsKeyword */; + return node.kind === 129 /* SyntaxKind.AssertsKeyword */; } ts.isAssertsKeyword = isAssertsKeyword; /* @internal */ function isAwaitKeyword(node) { - return node.kind === 132 /* SyntaxKind.AwaitKeyword */; + return node.kind === 133 /* SyntaxKind.AwaitKeyword */; } ts.isAwaitKeyword = isAwaitKeyword; /* @internal */ function isReadonlyKeyword(node) { - return node.kind === 145 /* SyntaxKind.ReadonlyKeyword */; + return node.kind === 146 /* SyntaxKind.ReadonlyKeyword */; } ts.isReadonlyKeyword = isReadonlyKeyword; /* @internal */ @@ -29168,9 +29154,14 @@ var ts; ts.isAbstractModifier = isAbstractModifier; /* @internal */ function isOverrideModifier(node) { - return node.kind === 159 /* SyntaxKind.OverrideKeyword */; + return node.kind === 161 /* SyntaxKind.OverrideKeyword */; } ts.isOverrideModifier = isOverrideModifier; + /* @internal */ + function isAccessorModifier(node) { + return node.kind === 127 /* SyntaxKind.AccessorKeyword */; + } + ts.isAccessorModifier = isAccessorModifier; /*@internal*/ function isSuperKeyword(node) { return node.kind === 106 /* SyntaxKind.SuperKeyword */; @@ -29183,605 +29174,609 @@ var ts; ts.isImportKeyword = isImportKeyword; // Names function isQualifiedName(node) { - return node.kind === 161 /* SyntaxKind.QualifiedName */; + return node.kind === 163 /* SyntaxKind.QualifiedName */; } ts.isQualifiedName = isQualifiedName; function isComputedPropertyName(node) { - return node.kind === 162 /* SyntaxKind.ComputedPropertyName */; + return node.kind === 164 /* SyntaxKind.ComputedPropertyName */; } ts.isComputedPropertyName = isComputedPropertyName; // Signature elements function isTypeParameterDeclaration(node) { - return node.kind === 163 /* SyntaxKind.TypeParameter */; + return node.kind === 165 /* SyntaxKind.TypeParameter */; } ts.isTypeParameterDeclaration = isTypeParameterDeclaration; // TODO(rbuckton): Rename to 'isParameterDeclaration' function isParameter(node) { - return node.kind === 164 /* SyntaxKind.Parameter */; + return node.kind === 166 /* SyntaxKind.Parameter */; } ts.isParameter = isParameter; function isDecorator(node) { - return node.kind === 165 /* SyntaxKind.Decorator */; + return node.kind === 167 /* SyntaxKind.Decorator */; } ts.isDecorator = isDecorator; // TypeMember function isPropertySignature(node) { - return node.kind === 166 /* SyntaxKind.PropertySignature */; + return node.kind === 168 /* SyntaxKind.PropertySignature */; } ts.isPropertySignature = isPropertySignature; function isPropertyDeclaration(node) { - return node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + return node.kind === 169 /* SyntaxKind.PropertyDeclaration */; } ts.isPropertyDeclaration = isPropertyDeclaration; function isMethodSignature(node) { - return node.kind === 168 /* SyntaxKind.MethodSignature */; + return node.kind === 170 /* SyntaxKind.MethodSignature */; } ts.isMethodSignature = isMethodSignature; function isMethodDeclaration(node) { - return node.kind === 169 /* SyntaxKind.MethodDeclaration */; + return node.kind === 171 /* SyntaxKind.MethodDeclaration */; } ts.isMethodDeclaration = isMethodDeclaration; function isClassStaticBlockDeclaration(node) { - return node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + return node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; } ts.isClassStaticBlockDeclaration = isClassStaticBlockDeclaration; function isConstructorDeclaration(node) { - return node.kind === 171 /* SyntaxKind.Constructor */; + return node.kind === 173 /* SyntaxKind.Constructor */; } ts.isConstructorDeclaration = isConstructorDeclaration; function isGetAccessorDeclaration(node) { - return node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetAccessorDeclaration = isGetAccessorDeclaration; function isSetAccessorDeclaration(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */; } ts.isSetAccessorDeclaration = isSetAccessorDeclaration; function isCallSignatureDeclaration(node) { - return node.kind === 174 /* SyntaxKind.CallSignature */; + return node.kind === 176 /* SyntaxKind.CallSignature */; } ts.isCallSignatureDeclaration = isCallSignatureDeclaration; function isConstructSignatureDeclaration(node) { - return node.kind === 175 /* SyntaxKind.ConstructSignature */; + return node.kind === 177 /* SyntaxKind.ConstructSignature */; } ts.isConstructSignatureDeclaration = isConstructSignatureDeclaration; function isIndexSignatureDeclaration(node) { - return node.kind === 176 /* SyntaxKind.IndexSignature */; + return node.kind === 178 /* SyntaxKind.IndexSignature */; } ts.isIndexSignatureDeclaration = isIndexSignatureDeclaration; // Type function isTypePredicateNode(node) { - return node.kind === 177 /* SyntaxKind.TypePredicate */; + return node.kind === 179 /* SyntaxKind.TypePredicate */; } ts.isTypePredicateNode = isTypePredicateNode; function isTypeReferenceNode(node) { - return node.kind === 178 /* SyntaxKind.TypeReference */; + return node.kind === 180 /* SyntaxKind.TypeReference */; } ts.isTypeReferenceNode = isTypeReferenceNode; function isFunctionTypeNode(node) { - return node.kind === 179 /* SyntaxKind.FunctionType */; + return node.kind === 181 /* SyntaxKind.FunctionType */; } ts.isFunctionTypeNode = isFunctionTypeNode; function isConstructorTypeNode(node) { - return node.kind === 180 /* SyntaxKind.ConstructorType */; + return node.kind === 182 /* SyntaxKind.ConstructorType */; } ts.isConstructorTypeNode = isConstructorTypeNode; function isTypeQueryNode(node) { - return node.kind === 181 /* SyntaxKind.TypeQuery */; + return node.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isTypeQueryNode = isTypeQueryNode; function isTypeLiteralNode(node) { - return node.kind === 182 /* SyntaxKind.TypeLiteral */; + return node.kind === 184 /* SyntaxKind.TypeLiteral */; } ts.isTypeLiteralNode = isTypeLiteralNode; function isArrayTypeNode(node) { - return node.kind === 183 /* SyntaxKind.ArrayType */; + return node.kind === 185 /* SyntaxKind.ArrayType */; } ts.isArrayTypeNode = isArrayTypeNode; function isTupleTypeNode(node) { - return node.kind === 184 /* SyntaxKind.TupleType */; + return node.kind === 186 /* SyntaxKind.TupleType */; } ts.isTupleTypeNode = isTupleTypeNode; function isNamedTupleMember(node) { - return node.kind === 197 /* SyntaxKind.NamedTupleMember */; + return node.kind === 199 /* SyntaxKind.NamedTupleMember */; } ts.isNamedTupleMember = isNamedTupleMember; function isOptionalTypeNode(node) { - return node.kind === 185 /* SyntaxKind.OptionalType */; + return node.kind === 187 /* SyntaxKind.OptionalType */; } ts.isOptionalTypeNode = isOptionalTypeNode; function isRestTypeNode(node) { - return node.kind === 186 /* SyntaxKind.RestType */; + return node.kind === 188 /* SyntaxKind.RestType */; } ts.isRestTypeNode = isRestTypeNode; function isUnionTypeNode(node) { - return node.kind === 187 /* SyntaxKind.UnionType */; + return node.kind === 189 /* SyntaxKind.UnionType */; } ts.isUnionTypeNode = isUnionTypeNode; function isIntersectionTypeNode(node) { - return node.kind === 188 /* SyntaxKind.IntersectionType */; + return node.kind === 190 /* SyntaxKind.IntersectionType */; } ts.isIntersectionTypeNode = isIntersectionTypeNode; function isConditionalTypeNode(node) { - return node.kind === 189 /* SyntaxKind.ConditionalType */; + return node.kind === 191 /* SyntaxKind.ConditionalType */; } ts.isConditionalTypeNode = isConditionalTypeNode; function isInferTypeNode(node) { - return node.kind === 190 /* SyntaxKind.InferType */; + return node.kind === 192 /* SyntaxKind.InferType */; } ts.isInferTypeNode = isInferTypeNode; function isParenthesizedTypeNode(node) { - return node.kind === 191 /* SyntaxKind.ParenthesizedType */; + return node.kind === 193 /* SyntaxKind.ParenthesizedType */; } ts.isParenthesizedTypeNode = isParenthesizedTypeNode; function isThisTypeNode(node) { - return node.kind === 192 /* SyntaxKind.ThisType */; + return node.kind === 194 /* SyntaxKind.ThisType */; } ts.isThisTypeNode = isThisTypeNode; function isTypeOperatorNode(node) { - return node.kind === 193 /* SyntaxKind.TypeOperator */; + return node.kind === 195 /* SyntaxKind.TypeOperator */; } ts.isTypeOperatorNode = isTypeOperatorNode; function isIndexedAccessTypeNode(node) { - return node.kind === 194 /* SyntaxKind.IndexedAccessType */; + return node.kind === 196 /* SyntaxKind.IndexedAccessType */; } ts.isIndexedAccessTypeNode = isIndexedAccessTypeNode; function isMappedTypeNode(node) { - return node.kind === 195 /* SyntaxKind.MappedType */; + return node.kind === 197 /* SyntaxKind.MappedType */; } ts.isMappedTypeNode = isMappedTypeNode; function isLiteralTypeNode(node) { - return node.kind === 196 /* SyntaxKind.LiteralType */; + return node.kind === 198 /* SyntaxKind.LiteralType */; } ts.isLiteralTypeNode = isLiteralTypeNode; function isImportTypeNode(node) { - return node.kind === 200 /* SyntaxKind.ImportType */; + return node.kind === 202 /* SyntaxKind.ImportType */; } ts.isImportTypeNode = isImportTypeNode; function isTemplateLiteralTypeSpan(node) { - return node.kind === 199 /* SyntaxKind.TemplateLiteralTypeSpan */; + return node.kind === 201 /* SyntaxKind.TemplateLiteralTypeSpan */; } ts.isTemplateLiteralTypeSpan = isTemplateLiteralTypeSpan; function isTemplateLiteralTypeNode(node) { - return node.kind === 198 /* SyntaxKind.TemplateLiteralType */; + return node.kind === 200 /* SyntaxKind.TemplateLiteralType */; } ts.isTemplateLiteralTypeNode = isTemplateLiteralTypeNode; // Binding patterns function isObjectBindingPattern(node) { - return node.kind === 201 /* SyntaxKind.ObjectBindingPattern */; + return node.kind === 203 /* SyntaxKind.ObjectBindingPattern */; } ts.isObjectBindingPattern = isObjectBindingPattern; function isArrayBindingPattern(node) { - return node.kind === 202 /* SyntaxKind.ArrayBindingPattern */; + return node.kind === 204 /* SyntaxKind.ArrayBindingPattern */; } ts.isArrayBindingPattern = isArrayBindingPattern; function isBindingElement(node) { - return node.kind === 203 /* SyntaxKind.BindingElement */; + return node.kind === 205 /* SyntaxKind.BindingElement */; } ts.isBindingElement = isBindingElement; // Expression function isArrayLiteralExpression(node) { - return node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */; + return node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 206 /* SyntaxKind.PropertyAccessExpression */; + return node.kind === 208 /* SyntaxKind.PropertyAccessExpression */; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 207 /* SyntaxKind.ElementAccessExpression */; + return node.kind === 209 /* SyntaxKind.ElementAccessExpression */; } ts.isElementAccessExpression = isElementAccessExpression; function isCallExpression(node) { - return node.kind === 208 /* SyntaxKind.CallExpression */; + return node.kind === 210 /* SyntaxKind.CallExpression */; } ts.isCallExpression = isCallExpression; function isNewExpression(node) { - return node.kind === 209 /* SyntaxKind.NewExpression */; + return node.kind === 211 /* SyntaxKind.NewExpression */; } ts.isNewExpression = isNewExpression; function isTaggedTemplateExpression(node) { - return node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */; + return node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */; } ts.isTaggedTemplateExpression = isTaggedTemplateExpression; function isTypeAssertionExpression(node) { - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */; } ts.isTypeAssertionExpression = isTypeAssertionExpression; function isParenthesizedExpression(node) { - return node.kind === 212 /* SyntaxKind.ParenthesizedExpression */; + return node.kind === 214 /* SyntaxKind.ParenthesizedExpression */; } ts.isParenthesizedExpression = isParenthesizedExpression; function isFunctionExpression(node) { - return node.kind === 213 /* SyntaxKind.FunctionExpression */; + return node.kind === 215 /* SyntaxKind.FunctionExpression */; } ts.isFunctionExpression = isFunctionExpression; function isArrowFunction(node) { - return node.kind === 214 /* SyntaxKind.ArrowFunction */; + return node.kind === 216 /* SyntaxKind.ArrowFunction */; } ts.isArrowFunction = isArrowFunction; function isDeleteExpression(node) { - return node.kind === 215 /* SyntaxKind.DeleteExpression */; + return node.kind === 217 /* SyntaxKind.DeleteExpression */; } ts.isDeleteExpression = isDeleteExpression; function isTypeOfExpression(node) { - return node.kind === 216 /* SyntaxKind.TypeOfExpression */; + return node.kind === 218 /* SyntaxKind.TypeOfExpression */; } ts.isTypeOfExpression = isTypeOfExpression; function isVoidExpression(node) { - return node.kind === 217 /* SyntaxKind.VoidExpression */; + return node.kind === 219 /* SyntaxKind.VoidExpression */; } ts.isVoidExpression = isVoidExpression; function isAwaitExpression(node) { - return node.kind === 218 /* SyntaxKind.AwaitExpression */; + return node.kind === 220 /* SyntaxKind.AwaitExpression */; } ts.isAwaitExpression = isAwaitExpression; function isPrefixUnaryExpression(node) { - return node.kind === 219 /* SyntaxKind.PrefixUnaryExpression */; + return node.kind === 221 /* SyntaxKind.PrefixUnaryExpression */; } ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function isPostfixUnaryExpression(node) { - return node.kind === 220 /* SyntaxKind.PostfixUnaryExpression */; + return node.kind === 222 /* SyntaxKind.PostfixUnaryExpression */; } ts.isPostfixUnaryExpression = isPostfixUnaryExpression; function isBinaryExpression(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 222 /* SyntaxKind.ConditionalExpression */; + return node.kind === 224 /* SyntaxKind.ConditionalExpression */; } ts.isConditionalExpression = isConditionalExpression; function isTemplateExpression(node) { - return node.kind === 223 /* SyntaxKind.TemplateExpression */; + return node.kind === 225 /* SyntaxKind.TemplateExpression */; } ts.isTemplateExpression = isTemplateExpression; function isYieldExpression(node) { - return node.kind === 224 /* SyntaxKind.YieldExpression */; + return node.kind === 226 /* SyntaxKind.YieldExpression */; } ts.isYieldExpression = isYieldExpression; function isSpreadElement(node) { - return node.kind === 225 /* SyntaxKind.SpreadElement */; + return node.kind === 227 /* SyntaxKind.SpreadElement */; } ts.isSpreadElement = isSpreadElement; function isClassExpression(node) { - return node.kind === 226 /* SyntaxKind.ClassExpression */; + return node.kind === 228 /* SyntaxKind.ClassExpression */; } ts.isClassExpression = isClassExpression; function isOmittedExpression(node) { - return node.kind === 227 /* SyntaxKind.OmittedExpression */; + return node.kind === 229 /* SyntaxKind.OmittedExpression */; } ts.isOmittedExpression = isOmittedExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isAsExpression(node) { - return node.kind === 229 /* SyntaxKind.AsExpression */; + return node.kind === 231 /* SyntaxKind.AsExpression */; } ts.isAsExpression = isAsExpression; + function isSatisfiesExpression(node) { + return node.kind === 235 /* SyntaxKind.SatisfiesExpression */; + } + ts.isSatisfiesExpression = isSatisfiesExpression; function isNonNullExpression(node) { - return node.kind === 230 /* SyntaxKind.NonNullExpression */; + return node.kind === 232 /* SyntaxKind.NonNullExpression */; } ts.isNonNullExpression = isNonNullExpression; function isMetaProperty(node) { - return node.kind === 231 /* SyntaxKind.MetaProperty */; + return node.kind === 233 /* SyntaxKind.MetaProperty */; } ts.isMetaProperty = isMetaProperty; function isSyntheticExpression(node) { - return node.kind === 232 /* SyntaxKind.SyntheticExpression */; + return node.kind === 234 /* SyntaxKind.SyntheticExpression */; } ts.isSyntheticExpression = isSyntheticExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 350 /* SyntaxKind.PartiallyEmittedExpression */; + return node.kind === 353 /* SyntaxKind.PartiallyEmittedExpression */; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isCommaListExpression(node) { - return node.kind === 351 /* SyntaxKind.CommaListExpression */; + return node.kind === 354 /* SyntaxKind.CommaListExpression */; } ts.isCommaListExpression = isCommaListExpression; // Misc function isTemplateSpan(node) { - return node.kind === 233 /* SyntaxKind.TemplateSpan */; + return node.kind === 236 /* SyntaxKind.TemplateSpan */; } ts.isTemplateSpan = isTemplateSpan; function isSemicolonClassElement(node) { - return node.kind === 234 /* SyntaxKind.SemicolonClassElement */; + return node.kind === 237 /* SyntaxKind.SemicolonClassElement */; } ts.isSemicolonClassElement = isSemicolonClassElement; // Elements function isBlock(node) { - return node.kind === 235 /* SyntaxKind.Block */; + return node.kind === 238 /* SyntaxKind.Block */; } ts.isBlock = isBlock; function isVariableStatement(node) { - return node.kind === 237 /* SyntaxKind.VariableStatement */; + return node.kind === 240 /* SyntaxKind.VariableStatement */; } ts.isVariableStatement = isVariableStatement; function isEmptyStatement(node) { - return node.kind === 236 /* SyntaxKind.EmptyStatement */; + return node.kind === 239 /* SyntaxKind.EmptyStatement */; } ts.isEmptyStatement = isEmptyStatement; function isExpressionStatement(node) { - return node.kind === 238 /* SyntaxKind.ExpressionStatement */; + return node.kind === 241 /* SyntaxKind.ExpressionStatement */; } ts.isExpressionStatement = isExpressionStatement; function isIfStatement(node) { - return node.kind === 239 /* SyntaxKind.IfStatement */; + return node.kind === 242 /* SyntaxKind.IfStatement */; } ts.isIfStatement = isIfStatement; function isDoStatement(node) { - return node.kind === 240 /* SyntaxKind.DoStatement */; + return node.kind === 243 /* SyntaxKind.DoStatement */; } ts.isDoStatement = isDoStatement; function isWhileStatement(node) { - return node.kind === 241 /* SyntaxKind.WhileStatement */; + return node.kind === 244 /* SyntaxKind.WhileStatement */; } ts.isWhileStatement = isWhileStatement; function isForStatement(node) { - return node.kind === 242 /* SyntaxKind.ForStatement */; + return node.kind === 245 /* SyntaxKind.ForStatement */; } ts.isForStatement = isForStatement; function isForInStatement(node) { - return node.kind === 243 /* SyntaxKind.ForInStatement */; + return node.kind === 246 /* SyntaxKind.ForInStatement */; } ts.isForInStatement = isForInStatement; function isForOfStatement(node) { - return node.kind === 244 /* SyntaxKind.ForOfStatement */; + return node.kind === 247 /* SyntaxKind.ForOfStatement */; } ts.isForOfStatement = isForOfStatement; function isContinueStatement(node) { - return node.kind === 245 /* SyntaxKind.ContinueStatement */; + return node.kind === 248 /* SyntaxKind.ContinueStatement */; } ts.isContinueStatement = isContinueStatement; function isBreakStatement(node) { - return node.kind === 246 /* SyntaxKind.BreakStatement */; + return node.kind === 249 /* SyntaxKind.BreakStatement */; } ts.isBreakStatement = isBreakStatement; function isReturnStatement(node) { - return node.kind === 247 /* SyntaxKind.ReturnStatement */; + return node.kind === 250 /* SyntaxKind.ReturnStatement */; } ts.isReturnStatement = isReturnStatement; function isWithStatement(node) { - return node.kind === 248 /* SyntaxKind.WithStatement */; + return node.kind === 251 /* SyntaxKind.WithStatement */; } ts.isWithStatement = isWithStatement; function isSwitchStatement(node) { - return node.kind === 249 /* SyntaxKind.SwitchStatement */; + return node.kind === 252 /* SyntaxKind.SwitchStatement */; } ts.isSwitchStatement = isSwitchStatement; function isLabeledStatement(node) { - return node.kind === 250 /* SyntaxKind.LabeledStatement */; + return node.kind === 253 /* SyntaxKind.LabeledStatement */; } ts.isLabeledStatement = isLabeledStatement; function isThrowStatement(node) { - return node.kind === 251 /* SyntaxKind.ThrowStatement */; + return node.kind === 254 /* SyntaxKind.ThrowStatement */; } ts.isThrowStatement = isThrowStatement; function isTryStatement(node) { - return node.kind === 252 /* SyntaxKind.TryStatement */; + return node.kind === 255 /* SyntaxKind.TryStatement */; } ts.isTryStatement = isTryStatement; function isDebuggerStatement(node) { - return node.kind === 253 /* SyntaxKind.DebuggerStatement */; + return node.kind === 256 /* SyntaxKind.DebuggerStatement */; } ts.isDebuggerStatement = isDebuggerStatement; function isVariableDeclaration(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 255 /* SyntaxKind.VariableDeclarationList */; + return node.kind === 258 /* SyntaxKind.VariableDeclarationList */; } ts.isVariableDeclarationList = isVariableDeclarationList; function isFunctionDeclaration(node) { - return node.kind === 256 /* SyntaxKind.FunctionDeclaration */; + return node.kind === 259 /* SyntaxKind.FunctionDeclaration */; } ts.isFunctionDeclaration = isFunctionDeclaration; function isClassDeclaration(node) { - return node.kind === 257 /* SyntaxKind.ClassDeclaration */; + return node.kind === 260 /* SyntaxKind.ClassDeclaration */; } ts.isClassDeclaration = isClassDeclaration; function isInterfaceDeclaration(node) { - return node.kind === 258 /* SyntaxKind.InterfaceDeclaration */; + return node.kind === 261 /* SyntaxKind.InterfaceDeclaration */; } ts.isInterfaceDeclaration = isInterfaceDeclaration; function isTypeAliasDeclaration(node) { - return node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */; + return node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */; } ts.isTypeAliasDeclaration = isTypeAliasDeclaration; function isEnumDeclaration(node) { - return node.kind === 260 /* SyntaxKind.EnumDeclaration */; + return node.kind === 263 /* SyntaxKind.EnumDeclaration */; } ts.isEnumDeclaration = isEnumDeclaration; function isModuleDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isModuleDeclaration = isModuleDeclaration; function isModuleBlock(node) { - return node.kind === 262 /* SyntaxKind.ModuleBlock */; + return node.kind === 265 /* SyntaxKind.ModuleBlock */; } ts.isModuleBlock = isModuleBlock; function isCaseBlock(node) { - return node.kind === 263 /* SyntaxKind.CaseBlock */; + return node.kind === 266 /* SyntaxKind.CaseBlock */; } ts.isCaseBlock = isCaseBlock; function isNamespaceExportDeclaration(node) { - return node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration; function isImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportDeclaration(node) { - return node.kind === 266 /* SyntaxKind.ImportDeclaration */; + return node.kind === 269 /* SyntaxKind.ImportDeclaration */; } ts.isImportDeclaration = isImportDeclaration; function isImportClause(node) { - return node.kind === 267 /* SyntaxKind.ImportClause */; + return node.kind === 270 /* SyntaxKind.ImportClause */; } ts.isImportClause = isImportClause; function isImportTypeAssertionContainer(node) { - return node.kind === 295 /* SyntaxKind.ImportTypeAssertionContainer */; + return node.kind === 298 /* SyntaxKind.ImportTypeAssertionContainer */; } ts.isImportTypeAssertionContainer = isImportTypeAssertionContainer; function isAssertClause(node) { - return node.kind === 293 /* SyntaxKind.AssertClause */; + return node.kind === 296 /* SyntaxKind.AssertClause */; } ts.isAssertClause = isAssertClause; function isAssertEntry(node) { - return node.kind === 294 /* SyntaxKind.AssertEntry */; + return node.kind === 297 /* SyntaxKind.AssertEntry */; } ts.isAssertEntry = isAssertEntry; function isNamespaceImport(node) { - return node.kind === 268 /* SyntaxKind.NamespaceImport */; + return node.kind === 271 /* SyntaxKind.NamespaceImport */; } ts.isNamespaceImport = isNamespaceImport; function isNamespaceExport(node) { - return node.kind === 274 /* SyntaxKind.NamespaceExport */; + return node.kind === 277 /* SyntaxKind.NamespaceExport */; } ts.isNamespaceExport = isNamespaceExport; function isNamedImports(node) { - return node.kind === 269 /* SyntaxKind.NamedImports */; + return node.kind === 272 /* SyntaxKind.NamedImports */; } ts.isNamedImports = isNamedImports; function isImportSpecifier(node) { - return node.kind === 270 /* SyntaxKind.ImportSpecifier */; + return node.kind === 273 /* SyntaxKind.ImportSpecifier */; } ts.isImportSpecifier = isImportSpecifier; function isExportAssignment(node) { - return node.kind === 271 /* SyntaxKind.ExportAssignment */; + return node.kind === 274 /* SyntaxKind.ExportAssignment */; } ts.isExportAssignment = isExportAssignment; function isExportDeclaration(node) { - return node.kind === 272 /* SyntaxKind.ExportDeclaration */; + return node.kind === 275 /* SyntaxKind.ExportDeclaration */; } ts.isExportDeclaration = isExportDeclaration; function isNamedExports(node) { - return node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 275 /* SyntaxKind.ExportSpecifier */; + return node.kind === 278 /* SyntaxKind.ExportSpecifier */; } ts.isExportSpecifier = isExportSpecifier; function isMissingDeclaration(node) { - return node.kind === 276 /* SyntaxKind.MissingDeclaration */; + return node.kind === 279 /* SyntaxKind.MissingDeclaration */; } ts.isMissingDeclaration = isMissingDeclaration; function isNotEmittedStatement(node) { - return node.kind === 349 /* SyntaxKind.NotEmittedStatement */; + return node.kind === 352 /* SyntaxKind.NotEmittedStatement */; } ts.isNotEmittedStatement = isNotEmittedStatement; /* @internal */ function isSyntheticReference(node) { - return node.kind === 354 /* SyntaxKind.SyntheticReferenceExpression */; + return node.kind === 357 /* SyntaxKind.SyntheticReferenceExpression */; } ts.isSyntheticReference = isSyntheticReference; /* @internal */ function isMergeDeclarationMarker(node) { - return node.kind === 352 /* SyntaxKind.MergeDeclarationMarker */; + return node.kind === 355 /* SyntaxKind.MergeDeclarationMarker */; } ts.isMergeDeclarationMarker = isMergeDeclarationMarker; /* @internal */ function isEndOfDeclarationMarker(node) { - return node.kind === 353 /* SyntaxKind.EndOfDeclarationMarker */; + return node.kind === 356 /* SyntaxKind.EndOfDeclarationMarker */; } ts.isEndOfDeclarationMarker = isEndOfDeclarationMarker; // Module References function isExternalModuleReference(node) { - return node.kind === 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 280 /* SyntaxKind.ExternalModuleReference */; } ts.isExternalModuleReference = isExternalModuleReference; // JSX function isJsxElement(node) { - return node.kind === 278 /* SyntaxKind.JsxElement */; + return node.kind === 281 /* SyntaxKind.JsxElement */; } ts.isJsxElement = isJsxElement; function isJsxSelfClosingElement(node) { - return node.kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return node.kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } ts.isJsxSelfClosingElement = isJsxSelfClosingElement; function isJsxOpeningElement(node) { - return node.kind === 280 /* SyntaxKind.JsxOpeningElement */; + return node.kind === 283 /* SyntaxKind.JsxOpeningElement */; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 281 /* SyntaxKind.JsxClosingElement */; + return node.kind === 284 /* SyntaxKind.JsxClosingElement */; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxFragment(node) { - return node.kind === 282 /* SyntaxKind.JsxFragment */; + return node.kind === 285 /* SyntaxKind.JsxFragment */; } ts.isJsxFragment = isJsxFragment; function isJsxOpeningFragment(node) { - return node.kind === 283 /* SyntaxKind.JsxOpeningFragment */; + return node.kind === 286 /* SyntaxKind.JsxOpeningFragment */; } ts.isJsxOpeningFragment = isJsxOpeningFragment; function isJsxClosingFragment(node) { - return node.kind === 284 /* SyntaxKind.JsxClosingFragment */; + return node.kind === 287 /* SyntaxKind.JsxClosingFragment */; } ts.isJsxClosingFragment = isJsxClosingFragment; function isJsxAttribute(node) { - return node.kind === 285 /* SyntaxKind.JsxAttribute */; + return node.kind === 288 /* SyntaxKind.JsxAttribute */; } ts.isJsxAttribute = isJsxAttribute; function isJsxAttributes(node) { - return node.kind === 286 /* SyntaxKind.JsxAttributes */; + return node.kind === 289 /* SyntaxKind.JsxAttributes */; } ts.isJsxAttributes = isJsxAttributes; function isJsxSpreadAttribute(node) { - return node.kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return node.kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxExpression(node) { - return node.kind === 288 /* SyntaxKind.JsxExpression */; + return node.kind === 291 /* SyntaxKind.JsxExpression */; } ts.isJsxExpression = isJsxExpression; // Clauses function isCaseClause(node) { - return node.kind === 289 /* SyntaxKind.CaseClause */; + return node.kind === 292 /* SyntaxKind.CaseClause */; } ts.isCaseClause = isCaseClause; function isDefaultClause(node) { - return node.kind === 290 /* SyntaxKind.DefaultClause */; + return node.kind === 293 /* SyntaxKind.DefaultClause */; } ts.isDefaultClause = isDefaultClause; function isHeritageClause(node) { - return node.kind === 291 /* SyntaxKind.HeritageClause */; + return node.kind === 294 /* SyntaxKind.HeritageClause */; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClause = isCatchClause; // Property assignments function isPropertyAssignment(node) { - return node.kind === 296 /* SyntaxKind.PropertyAssignment */; + return node.kind === 299 /* SyntaxKind.PropertyAssignment */; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */; + return node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isSpreadAssignment(node) { - return node.kind === 298 /* SyntaxKind.SpreadAssignment */; + return node.kind === 301 /* SyntaxKind.SpreadAssignment */; } ts.isSpreadAssignment = isSpreadAssignment; // Enum function isEnumMember(node) { - return node.kind === 299 /* SyntaxKind.EnumMember */; + return node.kind === 302 /* SyntaxKind.EnumMember */; } ts.isEnumMember = isEnumMember; // Unparsed // TODO(rbuckton): isUnparsedPrologue function isUnparsedPrepend(node) { - return node.kind === 301 /* SyntaxKind.UnparsedPrepend */; + return node.kind === 304 /* SyntaxKind.UnparsedPrepend */; } ts.isUnparsedPrepend = isUnparsedPrepend; // TODO(rbuckton): isUnparsedText @@ -29789,176 +29784,176 @@ var ts; // TODO(rbuckton): isUnparsedSyntheticReference // Top-level nodes function isSourceFile(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */; + return node.kind === 308 /* SyntaxKind.SourceFile */; } ts.isSourceFile = isSourceFile; function isBundle(node) { - return node.kind === 306 /* SyntaxKind.Bundle */; + return node.kind === 309 /* SyntaxKind.Bundle */; } ts.isBundle = isBundle; function isUnparsedSource(node) { - return node.kind === 307 /* SyntaxKind.UnparsedSource */; + return node.kind === 310 /* SyntaxKind.UnparsedSource */; } ts.isUnparsedSource = isUnparsedSource; // TODO(rbuckton): isInputFiles // JSDoc Elements function isJSDocTypeExpression(node) { - return node.kind === 309 /* SyntaxKind.JSDocTypeExpression */; + return node.kind === 312 /* SyntaxKind.JSDocTypeExpression */; } ts.isJSDocTypeExpression = isJSDocTypeExpression; function isJSDocNameReference(node) { - return node.kind === 310 /* SyntaxKind.JSDocNameReference */; + return node.kind === 313 /* SyntaxKind.JSDocNameReference */; } ts.isJSDocNameReference = isJSDocNameReference; function isJSDocMemberName(node) { - return node.kind === 311 /* SyntaxKind.JSDocMemberName */; + return node.kind === 314 /* SyntaxKind.JSDocMemberName */; } ts.isJSDocMemberName = isJSDocMemberName; function isJSDocLink(node) { - return node.kind === 324 /* SyntaxKind.JSDocLink */; + return node.kind === 327 /* SyntaxKind.JSDocLink */; } ts.isJSDocLink = isJSDocLink; function isJSDocLinkCode(node) { - return node.kind === 325 /* SyntaxKind.JSDocLinkCode */; + return node.kind === 328 /* SyntaxKind.JSDocLinkCode */; } ts.isJSDocLinkCode = isJSDocLinkCode; function isJSDocLinkPlain(node) { - return node.kind === 326 /* SyntaxKind.JSDocLinkPlain */; + return node.kind === 329 /* SyntaxKind.JSDocLinkPlain */; } ts.isJSDocLinkPlain = isJSDocLinkPlain; function isJSDocAllType(node) { - return node.kind === 312 /* SyntaxKind.JSDocAllType */; + return node.kind === 315 /* SyntaxKind.JSDocAllType */; } ts.isJSDocAllType = isJSDocAllType; function isJSDocUnknownType(node) { - return node.kind === 313 /* SyntaxKind.JSDocUnknownType */; + return node.kind === 316 /* SyntaxKind.JSDocUnknownType */; } ts.isJSDocUnknownType = isJSDocUnknownType; function isJSDocNullableType(node) { - return node.kind === 314 /* SyntaxKind.JSDocNullableType */; + return node.kind === 317 /* SyntaxKind.JSDocNullableType */; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 315 /* SyntaxKind.JSDocNonNullableType */; + return node.kind === 318 /* SyntaxKind.JSDocNonNullableType */; } ts.isJSDocNonNullableType = isJSDocNonNullableType; function isJSDocOptionalType(node) { - return node.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return node.kind === 319 /* SyntaxKind.JSDocOptionalType */; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 317 /* SyntaxKind.JSDocFunctionType */; + return node.kind === 320 /* SyntaxKind.JSDocFunctionType */; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 318 /* SyntaxKind.JSDocVariadicType */; + return node.kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isJSDocVariadicType = isJSDocVariadicType; function isJSDocNamepathType(node) { - return node.kind === 319 /* SyntaxKind.JSDocNamepathType */; + return node.kind === 322 /* SyntaxKind.JSDocNamepathType */; } ts.isJSDocNamepathType = isJSDocNamepathType; function isJSDoc(node) { - return node.kind === 320 /* SyntaxKind.JSDoc */; + return node.kind === 323 /* SyntaxKind.JSDoc */; } ts.isJSDoc = isJSDoc; function isJSDocTypeLiteral(node) { - return node.kind === 322 /* SyntaxKind.JSDocTypeLiteral */; + return node.kind === 325 /* SyntaxKind.JSDocTypeLiteral */; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; function isJSDocSignature(node) { - return node.kind === 323 /* SyntaxKind.JSDocSignature */; + return node.kind === 326 /* SyntaxKind.JSDocSignature */; } ts.isJSDocSignature = isJSDocSignature; // JSDoc Tags function isJSDocAugmentsTag(node) { - return node.kind === 328 /* SyntaxKind.JSDocAugmentsTag */; + return node.kind === 331 /* SyntaxKind.JSDocAugmentsTag */; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocAuthorTag(node) { - return node.kind === 330 /* SyntaxKind.JSDocAuthorTag */; + return node.kind === 333 /* SyntaxKind.JSDocAuthorTag */; } ts.isJSDocAuthorTag = isJSDocAuthorTag; function isJSDocClassTag(node) { - return node.kind === 332 /* SyntaxKind.JSDocClassTag */; + return node.kind === 335 /* SyntaxKind.JSDocClassTag */; } ts.isJSDocClassTag = isJSDocClassTag; function isJSDocCallbackTag(node) { - return node.kind === 338 /* SyntaxKind.JSDocCallbackTag */; + return node.kind === 341 /* SyntaxKind.JSDocCallbackTag */; } ts.isJSDocCallbackTag = isJSDocCallbackTag; function isJSDocPublicTag(node) { - return node.kind === 333 /* SyntaxKind.JSDocPublicTag */; + return node.kind === 336 /* SyntaxKind.JSDocPublicTag */; } ts.isJSDocPublicTag = isJSDocPublicTag; function isJSDocPrivateTag(node) { - return node.kind === 334 /* SyntaxKind.JSDocPrivateTag */; + return node.kind === 337 /* SyntaxKind.JSDocPrivateTag */; } ts.isJSDocPrivateTag = isJSDocPrivateTag; function isJSDocProtectedTag(node) { - return node.kind === 335 /* SyntaxKind.JSDocProtectedTag */; + return node.kind === 338 /* SyntaxKind.JSDocProtectedTag */; } ts.isJSDocProtectedTag = isJSDocProtectedTag; function isJSDocReadonlyTag(node) { - return node.kind === 336 /* SyntaxKind.JSDocReadonlyTag */; + return node.kind === 339 /* SyntaxKind.JSDocReadonlyTag */; } ts.isJSDocReadonlyTag = isJSDocReadonlyTag; function isJSDocOverrideTag(node) { - return node.kind === 337 /* SyntaxKind.JSDocOverrideTag */; + return node.kind === 340 /* SyntaxKind.JSDocOverrideTag */; } ts.isJSDocOverrideTag = isJSDocOverrideTag; function isJSDocDeprecatedTag(node) { - return node.kind === 331 /* SyntaxKind.JSDocDeprecatedTag */; + return node.kind === 334 /* SyntaxKind.JSDocDeprecatedTag */; } ts.isJSDocDeprecatedTag = isJSDocDeprecatedTag; function isJSDocSeeTag(node) { - return node.kind === 346 /* SyntaxKind.JSDocSeeTag */; + return node.kind === 349 /* SyntaxKind.JSDocSeeTag */; } ts.isJSDocSeeTag = isJSDocSeeTag; function isJSDocEnumTag(node) { - return node.kind === 339 /* SyntaxKind.JSDocEnumTag */; + return node.kind === 342 /* SyntaxKind.JSDocEnumTag */; } ts.isJSDocEnumTag = isJSDocEnumTag; function isJSDocParameterTag(node) { - return node.kind === 340 /* SyntaxKind.JSDocParameterTag */; + return node.kind === 343 /* SyntaxKind.JSDocParameterTag */; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 341 /* SyntaxKind.JSDocReturnTag */; + return node.kind === 344 /* SyntaxKind.JSDocReturnTag */; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocThisTag(node) { - return node.kind === 342 /* SyntaxKind.JSDocThisTag */; + return node.kind === 345 /* SyntaxKind.JSDocThisTag */; } ts.isJSDocThisTag = isJSDocThisTag; function isJSDocTypeTag(node) { - return node.kind === 343 /* SyntaxKind.JSDocTypeTag */; + return node.kind === 346 /* SyntaxKind.JSDocTypeTag */; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 344 /* SyntaxKind.JSDocTemplateTag */; + return node.kind === 347 /* SyntaxKind.JSDocTemplateTag */; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 345 /* SyntaxKind.JSDocTypedefTag */; + return node.kind === 348 /* SyntaxKind.JSDocTypedefTag */; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocUnknownTag(node) { - return node.kind === 327 /* SyntaxKind.JSDocTag */; + return node.kind === 330 /* SyntaxKind.JSDocTag */; } ts.isJSDocUnknownTag = isJSDocUnknownTag; function isJSDocPropertyTag(node) { - return node.kind === 347 /* SyntaxKind.JSDocPropertyTag */; + return node.kind === 350 /* SyntaxKind.JSDocPropertyTag */; } ts.isJSDocPropertyTag = isJSDocPropertyTag; function isJSDocImplementsTag(node) { - return node.kind === 329 /* SyntaxKind.JSDocImplementsTag */; + return node.kind === 332 /* SyntaxKind.JSDocImplementsTag */; } ts.isJSDocImplementsTag = isJSDocImplementsTag; // Synthesized list /* @internal */ function isSyntaxList(n) { - return n.kind === 348 /* SyntaxKind.SyntaxList */; + return n.kind === 351 /* SyntaxKind.SyntaxList */; } ts.isSyntaxList = isSyntaxList; })(ts || (ts = {})); @@ -30157,14 +30152,14 @@ var ts; ts.Debug.failBadSyntaxKind(property.name, "Private identifiers are not allowed in object literals."); } switch (property.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return createExpressionForAccessorDeclaration(factory, node.properties, property, receiver, !!node.multiLine); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return createExpressionForPropertyAssignment(factory, property, receiver); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return createExpressionForShorthandPropertyAssignment(factory, property, receiver); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return createExpressionForMethodDeclaration(factory, property, receiver); } } @@ -30272,8 +30267,8 @@ var ts; } ts.startsWithUseStrict = startsWithUseStrict; function isCommaSequence(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ || - node.kind === 351 /* SyntaxKind.CommaListExpression */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ || + node.kind === 354 /* SyntaxKind.CommaListExpression */; } ts.isCommaSequence = isCommaSequence; function isJSDocTypeAssertion(node) { @@ -30291,17 +30286,18 @@ var ts; function isOuterExpression(node, kinds) { if (kinds === void 0) { kinds = 15 /* OuterExpressionKinds.All */; } switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: if (kinds & 16 /* OuterExpressionKinds.ExcludeJSDocTypeAssertion */ && isJSDocTypeAssertion(node)) { return false; } return (kinds & 1 /* OuterExpressionKinds.Parentheses */) !== 0; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return (kinds & 2 /* OuterExpressionKinds.TypeAssertions */) !== 0; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return (kinds & 4 /* OuterExpressionKinds.NonNullAssertions */) !== 0; - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return (kinds & 8 /* OuterExpressionKinds.PartiallyEmittedExpressions */) !== 0; } return false; @@ -30422,10 +30418,10 @@ var ts; var name = namespaceDeclaration.name; return ts.isGeneratedIdentifier(name) ? name : factory.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name)); } - if (node.kind === 266 /* SyntaxKind.ImportDeclaration */ && node.importClause) { + if (node.kind === 269 /* SyntaxKind.ImportDeclaration */ && node.importClause) { return factory.getGeneratedNameForNode(node); } - if (node.kind === 272 /* SyntaxKind.ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 275 /* SyntaxKind.ExportDeclaration */ && node.moduleSpecifier) { return factory.getGeneratedNameForNode(node); } return undefined; @@ -30544,7 +30540,7 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // `b` in `({ a: b } = ...)` // `b` in `({ a: b = 1 } = ...)` // `{b}` in `({ a: {b} } = ...)` @@ -30556,11 +30552,11 @@ var ts; // `b[0]` in `({ a: b[0] } = ...)` // `b[0]` in `({ a: b[0] = 1 } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // `a` in `({ a } = ...)` // `a` in `({ a = 1 } = ...)` return bindingElement.name; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: // `a` in `({ ...a } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } @@ -30592,12 +30588,12 @@ var ts; */ function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: // `...` in `let [...a] = ...` return bindingElement.dotDotDotToken; - case 225 /* SyntaxKind.SpreadElement */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 227 /* SyntaxKind.SpreadElement */: + case 301 /* SyntaxKind.SpreadAssignment */: // `...` in `[...a] = ...` return bindingElement; } @@ -30615,7 +30611,7 @@ var ts; ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; function tryGetPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: // `a` in `let { a: b } = ...` // `[a]` in `let { [a]: b } = ...` // `"a"` in `let { "a": b } = ...` @@ -30630,7 +30626,7 @@ var ts; : propertyName; } break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // `a` in `({ a: b } = ...)` // `[a]` in `({ [a]: b } = ...)` // `"a"` in `({ "a": b } = ...)` @@ -30645,7 +30641,7 @@ var ts; : propertyName; } break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: // `a` in `({ ...a } = ...)` if (bindingElement.name && ts.isPrivateIdentifier(bindingElement.name)) { return ts.Debug.failBadSyntaxKind(bindingElement.name); @@ -30668,13 +30664,13 @@ var ts; */ function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: // `a` in `{a}` // `a` in `[a]` return name.elements; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: // `a` in `{a}` return name.properties; } @@ -30695,46 +30691,46 @@ var ts; ts.getJSDocTypeAliasName = getJSDocTypeAliasName; function canHaveIllegalType(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.canHaveIllegalType = canHaveIllegalType; function canHaveIllegalTypeParameters(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.canHaveIllegalTypeParameters = canHaveIllegalTypeParameters; function canHaveIllegalDecorators(node) { var kind = node.kind; - return kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */; + return kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */; } ts.canHaveIllegalDecorators = canHaveIllegalDecorators; function canHaveIllegalModifiers(node) { var kind = node.kind; - return kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 179 /* SyntaxKind.FunctionType */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 181 /* SyntaxKind.FunctionType */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } ts.canHaveIllegalModifiers = canHaveIllegalModifiers; ts.isTypeNodeOrTypeParameterDeclaration = ts.or(ts.isTypeNode, ts.isTypeParameterDeclaration); @@ -31008,6 +31004,83 @@ var ts; return ts.setTextRange(factory.createNodeArray([], nodes.hasTrailingComma), nodes); } ts.elideNodes = elideNodes; + /** + * Gets the node from which a name should be generated. + */ + function getNodeForGeneratedName(name) { + if (name.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) { + var autoGenerateId = name.autoGenerateId; + var node = name; + var original = node.original; + while (original) { + node = original; + // if "node" is a different generated name (having a different "autoGenerateId"), use it and stop traversing. + if (ts.isMemberName(node) + && !!(node.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) + && node.autoGenerateId !== autoGenerateId) { + break; + } + original = node.original; + } + // otherwise, return the original node for the source + return node; + } + return name; + } + ts.getNodeForGeneratedName = getNodeForGeneratedName; + function formatGeneratedNamePart(part, generateName) { + return typeof part === "object" ? formatGeneratedName(/*privateName*/ false, part.prefix, part.node, part.suffix, generateName) : + typeof part === "string" ? part.length > 0 && part.charCodeAt(0) === 35 /* CharacterCodes.hash */ ? part.slice(1) : part : + ""; + } + ts.formatGeneratedNamePart = formatGeneratedNamePart; + function formatIdentifier(name, generateName) { + return typeof name === "string" ? name : + formatIdentifierWorker(name, ts.Debug.checkDefined(generateName)); + } + function formatIdentifierWorker(node, generateName) { + return ts.isGeneratedPrivateIdentifier(node) ? generateName(node).slice(1) : + ts.isGeneratedIdentifier(node) ? generateName(node) : + ts.isPrivateIdentifier(node) ? node.escapedText.slice(1) : + ts.idText(node); + } + function formatGeneratedName(privateName, prefix, baseName, suffix, generateName) { + prefix = formatGeneratedNamePart(prefix, generateName); + suffix = formatGeneratedNamePart(suffix, generateName); + baseName = formatIdentifier(baseName, generateName); + return "".concat(privateName ? "#" : "").concat(prefix).concat(baseName).concat(suffix); + } + ts.formatGeneratedName = formatGeneratedName; + /** + * Creates a private backing field for an `accessor` {@link PropertyDeclaration}. + */ + function createAccessorPropertyBackingField(factory, node, modifiers, initializer) { + return factory.updatePropertyDeclaration(node, modifiers, factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage"), + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, initializer); + } + ts.createAccessorPropertyBackingField = createAccessorPropertyBackingField; + /** + * Creates a {@link GetAccessorDeclaration} that reads from a private backing field. + */ + function createAccessorPropertyGetRedirector(factory, node, modifiers, name) { + return factory.createGetAccessorDeclaration(modifiers, name, [], + /*type*/ undefined, factory.createBlock([ + factory.createReturnStatement(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage"))) + ])); + } + ts.createAccessorPropertyGetRedirector = createAccessorPropertyGetRedirector; + /** + * Creates a {@link SetAccessorDeclaration} that writes to a private backing field. + */ + function createAccessorPropertySetRedirector(factory, node, modifiers, name) { + return factory.createSetAccessorDeclaration(modifiers, name, [factory.createParameterDeclaration( + /*modifiers*/ undefined, + /*dotdotDotToken*/ undefined, "value")], factory.createBlock([ + factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage")), factory.createIdentifier("value"))) + ])); + } + ts.createAccessorPropertySetRedirector = createAccessorPropertySetRedirector; })(ts || (ts = {})); var ts; (function (ts) { @@ -31017,47 +31090,48 @@ var ts; ts.setTextRange = setTextRange; function canHaveModifiers(node) { var kind = node.kind; - return kind === 163 /* SyntaxKind.TypeParameter */ - || kind === 164 /* SyntaxKind.Parameter */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 180 /* SyntaxKind.ConstructorType */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */ - || kind === 272 /* SyntaxKind.ExportDeclaration */; + return kind === 165 /* SyntaxKind.TypeParameter */ + || kind === 166 /* SyntaxKind.Parameter */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 182 /* SyntaxKind.ConstructorType */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */ + || kind === 275 /* SyntaxKind.ExportDeclaration */; } ts.canHaveModifiers = canHaveModifiers; function canHaveDecorators(node) { var kind = node.kind; - return kind === 164 /* SyntaxKind.Parameter */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 257 /* SyntaxKind.ClassDeclaration */; + return kind === 166 /* SyntaxKind.Parameter */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 260 /* SyntaxKind.ClassDeclaration */; } ts.canHaveDecorators = canHaveDecorators; })(ts || (ts = {})); var ts; (function (ts) { + var _a; var SignatureFlags; (function (SignatureFlags) { SignatureFlags[SignatureFlags["None"] = 0] = "None"; @@ -31145,6 +31219,718 @@ var ts; function isImportMeta(node) { return ts.isMetaProperty(node) && node.keywordToken === 100 /* SyntaxKind.ImportKeyword */ && node.name.escapedText === "meta"; } + var forEachChildTable = (_a = {}, + _a[163 /* SyntaxKind.QualifiedName */] = function forEachChildInQualifiedName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + }, + _a[165 /* SyntaxKind.TypeParameter */] = function forEachChildInTypeParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.default) || + visitNode(cbNode, node.expression); + }, + _a[300 /* SyntaxKind.ShorthandPropertyAssignment */] = function forEachChildInShorthandPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.equalsToken) || + visitNode(cbNode, node.objectAssignmentInitializer); + }, + _a[301 /* SyntaxKind.SpreadAssignment */] = function forEachChildInSpreadAssignment(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[166 /* SyntaxKind.Parameter */] = function forEachChildInParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[169 /* SyntaxKind.PropertyDeclaration */] = function forEachChildInPropertyDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[168 /* SyntaxKind.PropertySignature */] = function forEachChildInPropertySignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[299 /* SyntaxKind.PropertyAssignment */] = function forEachChildInPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.initializer); + }, + _a[257 /* SyntaxKind.VariableDeclaration */] = function forEachChildInVariableDeclaration(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[205 /* SyntaxKind.BindingElement */] = function forEachChildInBindingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[178 /* SyntaxKind.IndexSignature */] = function forEachChildInIndexSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[182 /* SyntaxKind.ConstructorType */] = function forEachChildInConstructorType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[181 /* SyntaxKind.FunctionType */] = function forEachChildInFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[176 /* SyntaxKind.CallSignature */] = forEachChildInCallOrConstructSignature, + _a[177 /* SyntaxKind.ConstructSignature */] = forEachChildInCallOrConstructSignature, + _a[171 /* SyntaxKind.MethodDeclaration */] = function forEachChildInMethodDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[170 /* SyntaxKind.MethodSignature */] = function forEachChildInMethodSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[173 /* SyntaxKind.Constructor */] = function forEachChildInConstructor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[174 /* SyntaxKind.GetAccessor */] = function forEachChildInGetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[175 /* SyntaxKind.SetAccessor */] = function forEachChildInSetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[259 /* SyntaxKind.FunctionDeclaration */] = function forEachChildInFunctionDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[215 /* SyntaxKind.FunctionExpression */] = function forEachChildInFunctionExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[216 /* SyntaxKind.ArrowFunction */] = function forEachChildInArrowFunction(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.equalsGreaterThanToken) || + visitNode(cbNode, node.body); + }, + _a[172 /* SyntaxKind.ClassStaticBlockDeclaration */] = function forEachChildInClassStaticBlockDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.body); + }, + _a[180 /* SyntaxKind.TypeReference */] = function forEachChildInTypeReference(node, cbNode, cbNodes) { + return visitNode(cbNode, node.typeName) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[179 /* SyntaxKind.TypePredicate */] = function forEachChildInTypePredicate(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertsModifier) || + visitNode(cbNode, node.parameterName) || + visitNode(cbNode, node.type); + }, + _a[183 /* SyntaxKind.TypeQuery */] = function forEachChildInTypeQuery(node, cbNode, cbNodes) { + return visitNode(cbNode, node.exprName) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[184 /* SyntaxKind.TypeLiteral */] = function forEachChildInTypeLiteral(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.members); + }, + _a[185 /* SyntaxKind.ArrayType */] = function forEachChildInArrayType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.elementType); + }, + _a[186 /* SyntaxKind.TupleType */] = function forEachChildInTupleType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[189 /* SyntaxKind.UnionType */] = forEachChildInUnionOrIntersectionType, + _a[190 /* SyntaxKind.IntersectionType */] = forEachChildInUnionOrIntersectionType, + _a[191 /* SyntaxKind.ConditionalType */] = function forEachChildInConditionalType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.checkType) || + visitNode(cbNode, node.extendsType) || + visitNode(cbNode, node.trueType) || + visitNode(cbNode, node.falseType); + }, + _a[192 /* SyntaxKind.InferType */] = function forEachChildInInferType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.typeParameter); + }, + _a[202 /* SyntaxKind.ImportType */] = function forEachChildInImportType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.argument) || + visitNode(cbNode, node.assertions) || + visitNode(cbNode, node.qualifier) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[298 /* SyntaxKind.ImportTypeAssertionContainer */] = function forEachChildInImportTypeAssertionContainer(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertClause); + }, + _a[193 /* SyntaxKind.ParenthesizedType */] = forEachChildInParenthesizedTypeOrTypeOperator, + _a[195 /* SyntaxKind.TypeOperator */] = forEachChildInParenthesizedTypeOrTypeOperator, + _a[196 /* SyntaxKind.IndexedAccessType */] = function forEachChildInIndexedAccessType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.objectType) || + visitNode(cbNode, node.indexType); + }, + _a[197 /* SyntaxKind.MappedType */] = function forEachChildInMappedType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.readonlyToken) || + visitNode(cbNode, node.typeParameter) || + visitNode(cbNode, node.nameType) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[198 /* SyntaxKind.LiteralType */] = function forEachChildInLiteralType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.literal); + }, + _a[199 /* SyntaxKind.NamedTupleMember */] = function forEachChildInNamedTupleMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type); + }, + _a[203 /* SyntaxKind.ObjectBindingPattern */] = forEachChildInObjectOrArrayBindingPattern, + _a[204 /* SyntaxKind.ArrayBindingPattern */] = forEachChildInObjectOrArrayBindingPattern, + _a[206 /* SyntaxKind.ArrayLiteralExpression */] = function forEachChildInArrayLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[207 /* SyntaxKind.ObjectLiteralExpression */] = function forEachChildInObjectLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, + _a[208 /* SyntaxKind.PropertyAccessExpression */] = function forEachChildInPropertyAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNode(cbNode, node.name); + }, + _a[209 /* SyntaxKind.ElementAccessExpression */] = function forEachChildInElementAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNode(cbNode, node.argumentExpression); + }, + _a[210 /* SyntaxKind.CallExpression */] = forEachChildInCallOrNewExpression, + _a[211 /* SyntaxKind.NewExpression */] = forEachChildInCallOrNewExpression, + _a[212 /* SyntaxKind.TaggedTemplateExpression */] = function forEachChildInTaggedTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tag) || + visitNode(cbNode, node.questionDotToken) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNode(cbNode, node.template); + }, + _a[213 /* SyntaxKind.TypeAssertionExpression */] = function forEachChildInTypeAssertionExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.expression); + }, + _a[214 /* SyntaxKind.ParenthesizedExpression */] = function forEachChildInParenthesizedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[217 /* SyntaxKind.DeleteExpression */] = function forEachChildInDeleteExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[218 /* SyntaxKind.TypeOfExpression */] = function forEachChildInTypeOfExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[219 /* SyntaxKind.VoidExpression */] = function forEachChildInVoidExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[221 /* SyntaxKind.PrefixUnaryExpression */] = function forEachChildInPrefixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, + _a[226 /* SyntaxKind.YieldExpression */] = function forEachChildInYieldExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + }, + _a[220 /* SyntaxKind.AwaitExpression */] = function forEachChildInAwaitExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[222 /* SyntaxKind.PostfixUnaryExpression */] = function forEachChildInPostfixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, + _a[223 /* SyntaxKind.BinaryExpression */] = function forEachChildInBinaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.operatorToken) || + visitNode(cbNode, node.right); + }, + _a[231 /* SyntaxKind.AsExpression */] = function forEachChildInAsExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.type); + }, + _a[232 /* SyntaxKind.NonNullExpression */] = function forEachChildInNonNullExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[235 /* SyntaxKind.SatisfiesExpression */] = function forEachChildInSatisfiesExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); + }, + _a[233 /* SyntaxKind.MetaProperty */] = function forEachChildInMetaProperty(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[224 /* SyntaxKind.ConditionalExpression */] = function forEachChildInConditionalExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.condition) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.whenTrue) || + visitNode(cbNode, node.colonToken) || + visitNode(cbNode, node.whenFalse); + }, + _a[227 /* SyntaxKind.SpreadElement */] = function forEachChildInSpreadElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[238 /* SyntaxKind.Block */] = forEachChildInBlock, + _a[265 /* SyntaxKind.ModuleBlock */] = forEachChildInBlock, + _a[308 /* SyntaxKind.SourceFile */] = function forEachChildInSourceFile(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements) || + visitNode(cbNode, node.endOfFileToken); + }, + _a[240 /* SyntaxKind.VariableStatement */] = function forEachChildInVariableStatement(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.declarationList); + }, + _a[258 /* SyntaxKind.VariableDeclarationList */] = function forEachChildInVariableDeclarationList(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.declarations); + }, + _a[241 /* SyntaxKind.ExpressionStatement */] = function forEachChildInExpressionStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[242 /* SyntaxKind.IfStatement */] = function forEachChildInIfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.thenStatement) || + visitNode(cbNode, node.elseStatement); + }, + _a[243 /* SyntaxKind.DoStatement */] = function forEachChildInDoStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.statement) || + visitNode(cbNode, node.expression); + }, + _a[244 /* SyntaxKind.WhileStatement */] = function forEachChildInWhileStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[245 /* SyntaxKind.ForStatement */] = function forEachChildInForStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.incrementor) || + visitNode(cbNode, node.statement); + }, + _a[246 /* SyntaxKind.ForInStatement */] = function forEachChildInForInStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[247 /* SyntaxKind.ForOfStatement */] = function forEachChildInForOfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.awaitModifier) || + visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[248 /* SyntaxKind.ContinueStatement */] = forEachChildInContinueOrBreakStatement, + _a[249 /* SyntaxKind.BreakStatement */] = forEachChildInContinueOrBreakStatement, + _a[250 /* SyntaxKind.ReturnStatement */] = function forEachChildInReturnStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[251 /* SyntaxKind.WithStatement */] = function forEachChildInWithStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[252 /* SyntaxKind.SwitchStatement */] = function forEachChildInSwitchStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.caseBlock); + }, + _a[266 /* SyntaxKind.CaseBlock */] = function forEachChildInCaseBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.clauses); + }, + _a[292 /* SyntaxKind.CaseClause */] = function forEachChildInCaseClause(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNodes(cbNode, cbNodes, node.statements); + }, + _a[293 /* SyntaxKind.DefaultClause */] = function forEachChildInDefaultClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + }, + _a[253 /* SyntaxKind.LabeledStatement */] = function forEachChildInLabeledStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + }, + _a[254 /* SyntaxKind.ThrowStatement */] = function forEachChildInThrowStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[255 /* SyntaxKind.TryStatement */] = function forEachChildInTryStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tryBlock) || + visitNode(cbNode, node.catchClause) || + visitNode(cbNode, node.finallyBlock); + }, + _a[295 /* SyntaxKind.CatchClause */] = function forEachChildInCatchClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.variableDeclaration) || + visitNode(cbNode, node.block); + }, + _a[167 /* SyntaxKind.Decorator */] = function forEachChildInDecorator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[260 /* SyntaxKind.ClassDeclaration */] = forEachChildInClassDeclarationOrExpression, + _a[228 /* SyntaxKind.ClassExpression */] = forEachChildInClassDeclarationOrExpression, + _a[261 /* SyntaxKind.InterfaceDeclaration */] = function forEachChildInInterfaceDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[262 /* SyntaxKind.TypeAliasDeclaration */] = function forEachChildInTypeAliasDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNode(cbNode, node.type); + }, + _a[263 /* SyntaxKind.EnumDeclaration */] = function forEachChildInEnumDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[302 /* SyntaxKind.EnumMember */] = function forEachChildInEnumMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[264 /* SyntaxKind.ModuleDeclaration */] = function forEachChildInModuleDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); + }, + _a[268 /* SyntaxKind.ImportEqualsDeclaration */] = function forEachChildInImportEqualsDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.moduleReference); + }, + _a[269 /* SyntaxKind.ImportDeclaration */] = function forEachChildInImportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.importClause) || + visitNode(cbNode, node.moduleSpecifier) || + visitNode(cbNode, node.assertClause); + }, + _a[270 /* SyntaxKind.ImportClause */] = function forEachChildInImportClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.namedBindings); + }, + _a[296 /* SyntaxKind.AssertClause */] = function forEachChildInAssertClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[297 /* SyntaxKind.AssertEntry */] = function forEachChildInAssertEntry(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.value); + }, + _a[267 /* SyntaxKind.NamespaceExportDeclaration */] = function forEachChildInNamespaceExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNode(cbNode, node.name); + }, + _a[271 /* SyntaxKind.NamespaceImport */] = function forEachChildInNamespaceImport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[277 /* SyntaxKind.NamespaceExport */] = function forEachChildInNamespaceExport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[272 /* SyntaxKind.NamedImports */] = forEachChildInNamedImportsOrExports, + _a[276 /* SyntaxKind.NamedExports */] = forEachChildInNamedImportsOrExports, + _a[275 /* SyntaxKind.ExportDeclaration */] = function forEachChildInExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.exportClause) || + visitNode(cbNode, node.moduleSpecifier) || + visitNode(cbNode, node.assertClause); + }, + _a[273 /* SyntaxKind.ImportSpecifier */] = forEachChildInImportOrExportSpecifier, + _a[278 /* SyntaxKind.ExportSpecifier */] = forEachChildInImportOrExportSpecifier, + _a[274 /* SyntaxKind.ExportAssignment */] = function forEachChildInExportAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.expression); + }, + _a[225 /* SyntaxKind.TemplateExpression */] = function forEachChildInTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || + visitNodes(cbNode, cbNodes, node.templateSpans); + }, + _a[236 /* SyntaxKind.TemplateSpan */] = function forEachChildInTemplateSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.literal); + }, + _a[200 /* SyntaxKind.TemplateLiteralType */] = function forEachChildInTemplateLiteralType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || + visitNodes(cbNode, cbNodes, node.templateSpans); + }, + _a[201 /* SyntaxKind.TemplateLiteralTypeSpan */] = function forEachChildInTemplateLiteralTypeSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.literal); + }, + _a[164 /* SyntaxKind.ComputedPropertyName */] = function forEachChildInComputedPropertyName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[294 /* SyntaxKind.HeritageClause */] = function forEachChildInHeritageClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + }, + _a[230 /* SyntaxKind.ExpressionWithTypeArguments */] = function forEachChildInExpressionWithTypeArguments(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[280 /* SyntaxKind.ExternalModuleReference */] = function forEachChildInExternalModuleReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[279 /* SyntaxKind.MissingDeclaration */] = function forEachChildInMissingDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers); + }, + _a[354 /* SyntaxKind.CommaListExpression */] = function forEachChildInCommaListExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[281 /* SyntaxKind.JsxElement */] = function forEachChildInJsxElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingElement) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingElement); + }, + _a[285 /* SyntaxKind.JsxFragment */] = function forEachChildInJsxFragment(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingFragment) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingFragment); + }, + _a[282 /* SyntaxKind.JsxSelfClosingElement */] = forEachChildInJsxOpeningOrSelfClosingElement, + _a[283 /* SyntaxKind.JsxOpeningElement */] = forEachChildInJsxOpeningOrSelfClosingElement, + _a[289 /* SyntaxKind.JsxAttributes */] = function forEachChildInJsxAttributes(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, + _a[288 /* SyntaxKind.JsxAttribute */] = function forEachChildInJsxAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[290 /* SyntaxKind.JsxSpreadAttribute */] = function forEachChildInJsxSpreadAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[291 /* SyntaxKind.JsxExpression */] = function forEachChildInJsxExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.expression); + }, + _a[284 /* SyntaxKind.JsxClosingElement */] = function forEachChildInJsxClosingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tagName); + }, + _a[187 /* SyntaxKind.OptionalType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[188 /* SyntaxKind.RestType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[312 /* SyntaxKind.JSDocTypeExpression */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[318 /* SyntaxKind.JSDocNonNullableType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[317 /* SyntaxKind.JSDocNullableType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[319 /* SyntaxKind.JSDocOptionalType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[321 /* SyntaxKind.JSDocVariadicType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[320 /* SyntaxKind.JSDocFunctionType */] = function forEachChildInJSDocFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[323 /* SyntaxKind.JSDoc */] = function forEachChildInJSDoc(node, cbNode, cbNodes) { + return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) + || visitNodes(cbNode, cbNodes, node.tags); + }, + _a[349 /* SyntaxKind.JSDocSeeTag */] = function forEachChildInJSDocSeeTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.name) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[313 /* SyntaxKind.JSDocNameReference */] = function forEachChildInJSDocNameReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[314 /* SyntaxKind.JSDocMemberName */] = function forEachChildInJSDocMemberName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + }, + _a[343 /* SyntaxKind.JSDocParameterTag */] = forEachChildInJSDocParameterOrPropertyTag, + _a[350 /* SyntaxKind.JSDocPropertyTag */] = forEachChildInJSDocParameterOrPropertyTag, + _a[333 /* SyntaxKind.JSDocAuthorTag */] = function forEachChildInJSDocAuthorTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[332 /* SyntaxKind.JSDocImplementsTag */] = function forEachChildInJSDocImplementsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.class) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[331 /* SyntaxKind.JSDocAugmentsTag */] = function forEachChildInJSDocAugmentsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.class) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[347 /* SyntaxKind.JSDocTemplateTag */] = function forEachChildInJSDocTemplateTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.constraint) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[348 /* SyntaxKind.JSDocTypedefTag */] = function forEachChildInJSDocTypedefTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (node.typeExpression && + node.typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */ + ? visitNode(cbNode, node.typeExpression) || + visitNode(cbNode, node.fullName) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) + : visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); + }, + _a[341 /* SyntaxKind.JSDocCallbackTag */] = function forEachChildInJSDocCallbackTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[344 /* SyntaxKind.JSDocReturnTag */] = forEachChildInJSDocReturnTag, + _a[346 /* SyntaxKind.JSDocTypeTag */] = forEachChildInJSDocReturnTag, + _a[345 /* SyntaxKind.JSDocThisTag */] = forEachChildInJSDocReturnTag, + _a[342 /* SyntaxKind.JSDocEnumTag */] = forEachChildInJSDocReturnTag, + _a[326 /* SyntaxKind.JSDocSignature */] = function forEachChildInJSDocSignature(node, cbNode, _cbNodes) { + return ts.forEach(node.typeParameters, cbNode) || + ts.forEach(node.parameters, cbNode) || + visitNode(cbNode, node.type); + }, + _a[327 /* SyntaxKind.JSDocLink */] = forEachChildInJSDocLinkCodeOrPlain, + _a[328 /* SyntaxKind.JSDocLinkCode */] = forEachChildInJSDocLinkCodeOrPlain, + _a[329 /* SyntaxKind.JSDocLinkPlain */] = forEachChildInJSDocLinkCodeOrPlain, + _a[325 /* SyntaxKind.JSDocTypeLiteral */] = function forEachChildInJSDocTypeLiteral(node, cbNode, _cbNodes) { + return ts.forEach(node.jsDocPropertyTags, cbNode); + }, + _a[330 /* SyntaxKind.JSDocTag */] = forEachChildInJSDocTag, + _a[335 /* SyntaxKind.JSDocClassTag */] = forEachChildInJSDocTag, + _a[336 /* SyntaxKind.JSDocPublicTag */] = forEachChildInJSDocTag, + _a[337 /* SyntaxKind.JSDocPrivateTag */] = forEachChildInJSDocTag, + _a[338 /* SyntaxKind.JSDocProtectedTag */] = forEachChildInJSDocTag, + _a[339 /* SyntaxKind.JSDocReadonlyTag */] = forEachChildInJSDocTag, + _a[334 /* SyntaxKind.JSDocDeprecatedTag */] = forEachChildInJSDocTag, + _a[340 /* SyntaxKind.JSDocOverrideTag */] = forEachChildInJSDocTag, + _a[353 /* SyntaxKind.PartiallyEmittedExpression */] = forEachChildInPartiallyEmittedExpression, + _a); + // shared + function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + } + function forEachChildInUnionOrIntersectionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + } + function forEachChildInParenthesizedTypeOrTypeOperator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInObjectOrArrayBindingPattern(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInCallOrNewExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + // TODO: should we separate these branches out? + visitNode(cbNode, node.questionDotToken) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNodes(cbNode, cbNodes, node.arguments); + } + function forEachChildInBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + } + function forEachChildInContinueOrBreakStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label); + } + function forEachChildInClassDeclarationOrExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); + } + function forEachChildInNamedImportsOrExports(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInImportOrExportSpecifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name); + } + function forEachChildInJsxOpeningOrSelfClosingElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNode(cbNode, node.attributes); + } + function forEachChildInOptionalRestOrJSDocParameterModifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInJSDocParameterOrPropertyTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (node.isNameFirst + ? visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression) + : visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name)) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocReturnTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocLinkCodeOrPlain(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + } + function forEachChildInJSDocTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) + || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInPartiallyEmittedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + } /** * Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes * stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise, @@ -31159,562 +31945,11 @@ var ts; * that they appear in the source code. The language service depends on this property to locate nodes by position. */ function forEachChild(node, cbNode, cbNodes) { - if (!node || node.kind <= 160 /* SyntaxKind.LastToken */) { + if (node === undefined || node.kind <= 162 /* SyntaxKind.LastToken */) { return; } - switch (node.kind) { - case 161 /* SyntaxKind.QualifiedName */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); - case 163 /* SyntaxKind.TypeParameter */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.constraint) || - visitNode(cbNode, node.default) || - visitNode(cbNode, node.expression); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.equalsToken) || - visitNode(cbNode, node.objectAssignmentInitializer); - case 298 /* SyntaxKind.SpreadAssignment */: - return visitNode(cbNode, node.expression); - case 164 /* SyntaxKind.Parameter */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 166 /* SyntaxKind.PropertySignature */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 296 /* SyntaxKind.PropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.initializer); - case 254 /* SyntaxKind.VariableDeclaration */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 203 /* SyntaxKind.BindingElement */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 176 /* SyntaxKind.IndexSignature */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 180 /* SyntaxKind.ConstructorType */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 179 /* SyntaxKind.FunctionType */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - return visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 169 /* SyntaxKind.MethodDeclaration */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 168 /* SyntaxKind.MethodSignature */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 171 /* SyntaxKind.Constructor */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 172 /* SyntaxKind.GetAccessor */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 173 /* SyntaxKind.SetAccessor */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 256 /* SyntaxKind.FunctionDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 213 /* SyntaxKind.FunctionExpression */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 214 /* SyntaxKind.ArrowFunction */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.equalsGreaterThanToken) || - visitNode(cbNode, node.body); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.body); - case 178 /* SyntaxKind.TypeReference */: - return visitNode(cbNode, node.typeName) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 177 /* SyntaxKind.TypePredicate */: - return visitNode(cbNode, node.assertsModifier) || - visitNode(cbNode, node.parameterName) || - visitNode(cbNode, node.type); - case 181 /* SyntaxKind.TypeQuery */: - return visitNode(cbNode, node.exprName) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 182 /* SyntaxKind.TypeLiteral */: - return visitNodes(cbNode, cbNodes, node.members); - case 183 /* SyntaxKind.ArrayType */: - return visitNode(cbNode, node.elementType); - case 184 /* SyntaxKind.TupleType */: - return visitNodes(cbNode, cbNodes, node.elements); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - return visitNodes(cbNode, cbNodes, node.types); - case 189 /* SyntaxKind.ConditionalType */: - return visitNode(cbNode, node.checkType) || - visitNode(cbNode, node.extendsType) || - visitNode(cbNode, node.trueType) || - visitNode(cbNode, node.falseType); - case 190 /* SyntaxKind.InferType */: - return visitNode(cbNode, node.typeParameter); - case 200 /* SyntaxKind.ImportType */: - return visitNode(cbNode, node.argument) || - visitNode(cbNode, node.assertions) || - visitNode(cbNode, node.qualifier) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 295 /* SyntaxKind.ImportTypeAssertionContainer */: - return visitNode(cbNode, node.assertClause); - case 191 /* SyntaxKind.ParenthesizedType */: - case 193 /* SyntaxKind.TypeOperator */: - return visitNode(cbNode, node.type); - case 194 /* SyntaxKind.IndexedAccessType */: - return visitNode(cbNode, node.objectType) || - visitNode(cbNode, node.indexType); - case 195 /* SyntaxKind.MappedType */: - return visitNode(cbNode, node.readonlyToken) || - visitNode(cbNode, node.typeParameter) || - visitNode(cbNode, node.nameType) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNodes(cbNode, cbNodes, node.members); - case 196 /* SyntaxKind.LiteralType */: - return visitNode(cbNode, node.literal); - case 197 /* SyntaxKind.NamedTupleMember */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - return visitNodes(cbNode, cbNodes, node.elements); - case 204 /* SyntaxKind.ArrayLiteralExpression */: - return visitNodes(cbNode, cbNodes, node.elements); - case 205 /* SyntaxKind.ObjectLiteralExpression */: - return visitNodes(cbNode, cbNodes, node.properties); - case 206 /* SyntaxKind.PropertyAccessExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNode(cbNode, node.name); - case 207 /* SyntaxKind.ElementAccessExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNode(cbNode, node.argumentExpression); - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNodes(cbNode, cbNodes, node.arguments); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - return visitNode(cbNode, node.tag) || - visitNode(cbNode, node.questionDotToken) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNode(cbNode, node.template); - case 211 /* SyntaxKind.TypeAssertionExpression */: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.expression); - case 212 /* SyntaxKind.ParenthesizedExpression */: - return visitNode(cbNode, node.expression); - case 215 /* SyntaxKind.DeleteExpression */: - return visitNode(cbNode, node.expression); - case 216 /* SyntaxKind.TypeOfExpression */: - return visitNode(cbNode, node.expression); - case 217 /* SyntaxKind.VoidExpression */: - return visitNode(cbNode, node.expression); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - return visitNode(cbNode, node.operand); - case 224 /* SyntaxKind.YieldExpression */: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); - case 218 /* SyntaxKind.AwaitExpression */: - return visitNode(cbNode, node.expression); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - return visitNode(cbNode, node.operand); - case 221 /* SyntaxKind.BinaryExpression */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.operatorToken) || - visitNode(cbNode, node.right); - case 229 /* SyntaxKind.AsExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.type); - case 230 /* SyntaxKind.NonNullExpression */: - return visitNode(cbNode, node.expression); - case 231 /* SyntaxKind.MetaProperty */: - return visitNode(cbNode, node.name); - case 222 /* SyntaxKind.ConditionalExpression */: - return visitNode(cbNode, node.condition) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.whenTrue) || - visitNode(cbNode, node.colonToken) || - visitNode(cbNode, node.whenFalse); - case 225 /* SyntaxKind.SpreadElement */: - return visitNode(cbNode, node.expression); - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - return visitNodes(cbNode, cbNodes, node.statements); - case 305 /* SyntaxKind.SourceFile */: - return visitNodes(cbNode, cbNodes, node.statements) || - visitNode(cbNode, node.endOfFileToken); - case 237 /* SyntaxKind.VariableStatement */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.declarationList); - case 255 /* SyntaxKind.VariableDeclarationList */: - return visitNodes(cbNode, cbNodes, node.declarations); - case 238 /* SyntaxKind.ExpressionStatement */: - return visitNode(cbNode, node.expression); - case 239 /* SyntaxKind.IfStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.thenStatement) || - visitNode(cbNode, node.elseStatement); - case 240 /* SyntaxKind.DoStatement */: - return visitNode(cbNode, node.statement) || - visitNode(cbNode, node.expression); - case 241 /* SyntaxKind.WhileStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 242 /* SyntaxKind.ForStatement */: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.condition) || - visitNode(cbNode, node.incrementor) || - visitNode(cbNode, node.statement); - case 243 /* SyntaxKind.ForInStatement */: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 244 /* SyntaxKind.ForOfStatement */: - return visitNode(cbNode, node.awaitModifier) || - visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: - return visitNode(cbNode, node.label); - case 247 /* SyntaxKind.ReturnStatement */: - return visitNode(cbNode, node.expression); - case 248 /* SyntaxKind.WithStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 249 /* SyntaxKind.SwitchStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.caseBlock); - case 263 /* SyntaxKind.CaseBlock */: - return visitNodes(cbNode, cbNodes, node.clauses); - case 289 /* SyntaxKind.CaseClause */: - return visitNode(cbNode, node.expression) || - visitNodes(cbNode, cbNodes, node.statements); - case 290 /* SyntaxKind.DefaultClause */: - return visitNodes(cbNode, cbNodes, node.statements); - case 250 /* SyntaxKind.LabeledStatement */: - return visitNode(cbNode, node.label) || - visitNode(cbNode, node.statement); - case 251 /* SyntaxKind.ThrowStatement */: - return visitNode(cbNode, node.expression); - case 252 /* SyntaxKind.TryStatement */: - return visitNode(cbNode, node.tryBlock) || - visitNode(cbNode, node.catchClause) || - visitNode(cbNode, node.finallyBlock); - case 292 /* SyntaxKind.CatchClause */: - return visitNode(cbNode, node.variableDeclaration) || - visitNode(cbNode, node.block); - case 165 /* SyntaxKind.Decorator */: - return visitNode(cbNode, node.expression); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.heritageClauses) || - visitNodes(cbNode, cbNodes, node.members); - case 258 /* SyntaxKind.InterfaceDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.heritageClauses) || - visitNodes(cbNode, cbNodes, node.members); - case 259 /* SyntaxKind.TypeAliasDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNode(cbNode, node.type); - case 260 /* SyntaxKind.EnumDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.members); - case 299 /* SyntaxKind.EnumMember */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 261 /* SyntaxKind.ModuleDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.body); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.moduleReference); - case 266 /* SyntaxKind.ImportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.importClause) || - visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); - case 267 /* SyntaxKind.ImportClause */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.namedBindings); - case 293 /* SyntaxKind.AssertClause */: - return visitNodes(cbNode, cbNodes, node.elements); - case 294 /* SyntaxKind.AssertEntry */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.value); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNode(cbNode, node.name); - case 268 /* SyntaxKind.NamespaceImport */: - return visitNode(cbNode, node.name); - case 274 /* SyntaxKind.NamespaceExport */: - return visitNode(cbNode, node.name); - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: - return visitNodes(cbNode, cbNodes, node.elements); - case 272 /* SyntaxKind.ExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.exportClause) || - visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: - return visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name); - case 271 /* SyntaxKind.ExportAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.expression); - case 223 /* SyntaxKind.TemplateExpression */: - return visitNode(cbNode, node.head) || - visitNodes(cbNode, cbNodes, node.templateSpans); - case 233 /* SyntaxKind.TemplateSpan */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.literal); - case 198 /* SyntaxKind.TemplateLiteralType */: - return visitNode(cbNode, node.head) || - visitNodes(cbNode, cbNodes, node.templateSpans); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.literal); - case 162 /* SyntaxKind.ComputedPropertyName */: - return visitNode(cbNode, node.expression); - case 291 /* SyntaxKind.HeritageClause */: - return visitNodes(cbNode, cbNodes, node.types); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - return visitNode(cbNode, node.expression) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 277 /* SyntaxKind.ExternalModuleReference */: - return visitNode(cbNode, node.expression); - case 276 /* SyntaxKind.MissingDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers); - case 351 /* SyntaxKind.CommaListExpression */: - return visitNodes(cbNode, cbNodes, node.elements); - case 278 /* SyntaxKind.JsxElement */: - return visitNode(cbNode, node.openingElement) || - visitNodes(cbNode, cbNodes, node.children) || - visitNode(cbNode, node.closingElement); - case 282 /* SyntaxKind.JsxFragment */: - return visitNode(cbNode, node.openingFragment) || - visitNodes(cbNode, cbNodes, node.children) || - visitNode(cbNode, node.closingFragment); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - return visitNode(cbNode, node.tagName) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNode(cbNode, node.attributes); - case 286 /* SyntaxKind.JsxAttributes */: - return visitNodes(cbNode, cbNodes, node.properties); - case 285 /* SyntaxKind.JsxAttribute */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 287 /* SyntaxKind.JsxSpreadAttribute */: - return visitNode(cbNode, node.expression); - case 288 /* SyntaxKind.JsxExpression */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.expression); - case 281 /* SyntaxKind.JsxClosingElement */: - return visitNode(cbNode, node.tagName); - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 316 /* SyntaxKind.JSDocOptionalType */: - case 318 /* SyntaxKind.JSDocVariadicType */: - return visitNode(cbNode, node.type); - case 317 /* SyntaxKind.JSDocFunctionType */: - return visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 320 /* SyntaxKind.JSDoc */: - return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - || visitNodes(cbNode, cbNodes, node.tags); - case 346 /* SyntaxKind.JSDocSeeTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.name) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 310 /* SyntaxKind.JSDocNameReference */: - return visitNode(cbNode, node.name); - case 311 /* SyntaxKind.JSDocMemberName */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - return visitNode(cbNode, node.tagName) || - (node.isNameFirst - ? visitNode(cbNode, node.name) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - : visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.name) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); - case 330 /* SyntaxKind.JSDocAuthorTag */: - return visitNode(cbNode, node.tagName) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 329 /* SyntaxKind.JSDocImplementsTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.class) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 328 /* SyntaxKind.JSDocAugmentsTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.class) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 344 /* SyntaxKind.JSDocTemplateTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.constraint) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 345 /* SyntaxKind.JSDocTypedefTag */: - return visitNode(cbNode, node.tagName) || - (node.typeExpression && - node.typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */ - ? visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.fullName) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - : visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); - case 338 /* SyntaxKind.JSDocCallbackTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 341 /* SyntaxKind.JSDocReturnTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: - case 342 /* SyntaxKind.JSDocThisTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 323 /* SyntaxKind.JSDocSignature */: - return ts.forEach(node.typeParameters, cbNode) || - ts.forEach(node.parameters, cbNode) || - visitNode(cbNode, node.type); - case 324 /* SyntaxKind.JSDocLink */: - case 325 /* SyntaxKind.JSDocLinkCode */: - case 326 /* SyntaxKind.JSDocLinkPlain */: - return visitNode(cbNode, node.name); - case 322 /* SyntaxKind.JSDocTypeLiteral */: - return ts.forEach(node.jsDocPropertyTags, cbNode); - case 327 /* SyntaxKind.JSDocTag */: - case 332 /* SyntaxKind.JSDocClassTag */: - case 333 /* SyntaxKind.JSDocPublicTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 336 /* SyntaxKind.JSDocReadonlyTag */: - case 331 /* SyntaxKind.JSDocDeprecatedTag */: - return visitNode(cbNode, node.tagName) - || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - return visitNode(cbNode, node.expression); - } + var fn = forEachChildTable[node.kind]; + return fn === undefined ? undefined : fn(node, cbNode, cbNodes); } ts.forEachChild = forEachChild; /** @internal */ @@ -31761,7 +31996,7 @@ var ts; continue; return res; } - if (current.kind >= 161 /* SyntaxKind.FirstNode */) { + if (current.kind >= 163 /* SyntaxKind.FirstNode */) { // add children in reverse order to the queue, so popping gives the first child for (var _i = 0, _a = gatherPossibleChildren(current); _i < _a.length; _i++) { var child = _a[_i]; @@ -32586,7 +32821,7 @@ var ts; } // If we have a 'await' keyword, and we're in the [Await] context, then 'await' is // considered a keyword and is not an identifier. - if (token() === 132 /* SyntaxKind.AwaitKeyword */ && inAwaitContext()) { + if (token() === 133 /* SyntaxKind.AwaitKeyword */ && inAwaitContext()) { return false; } return token() > 116 /* SyntaxKind.LastReservedWord */; @@ -32832,7 +33067,7 @@ var ts; ts.isTemplateLiteralKind(kind) ? factory.createTemplateLiteralLikeNode(kind, "", "", /*templateFlags*/ undefined) : kind === 8 /* SyntaxKind.NumericLiteral */ ? factory.createNumericLiteral("", /*numericLiteralFlags*/ undefined) : kind === 10 /* SyntaxKind.StringLiteral */ ? factory.createStringLiteral("", /*isSingleQuote*/ undefined) : - kind === 276 /* SyntaxKind.MissingDeclaration */ ? factory.createMissingDeclaration() : + kind === 279 /* SyntaxKind.MissingDeclaration */ ? factory.createMissingDeclaration() : factory.createToken(kind); return finishNode(result, pos); } @@ -32931,7 +33166,7 @@ var ts; } function parsePrivateIdentifier() { var pos = getNodePos(); - var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenText())); + var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenValue())); nextToken(); return finishNode(node, pos); } @@ -32955,15 +33190,16 @@ var ts; if (token() === 88 /* SyntaxKind.DefaultKeyword */) { return lookAhead(nextTokenCanFollowDefaultKeyword); } - if (token() === 152 /* SyntaxKind.TypeKeyword */) { + if (token() === 154 /* SyntaxKind.TypeKeyword */) { return lookAhead(nextTokenCanFollowExportModifier); } return canFollowExportModifier(); case 88 /* SyntaxKind.DefaultKeyword */: return nextTokenCanFollowDefaultKeyword(); + case 127 /* SyntaxKind.AccessorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: nextToken(); return canFollowModifier(); default: @@ -32972,7 +33208,7 @@ var ts; } function canFollowExportModifier() { return token() !== 41 /* SyntaxKind.AsteriskToken */ - && token() !== 127 /* SyntaxKind.AsKeyword */ + && token() !== 128 /* SyntaxKind.AsKeyword */ && token() !== 18 /* SyntaxKind.OpenBraceToken */ && canFollowModifier(); } @@ -32995,7 +33231,7 @@ var ts; return token() === 84 /* SyntaxKind.ClassKeyword */ || token() === 98 /* SyntaxKind.FunctionKeyword */ || token() === 118 /* SyntaxKind.InterfaceKeyword */ || (token() === 126 /* SyntaxKind.AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine)) || - (token() === 131 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); + (token() === 132 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); } // True if positioned at the start of a list element function isListElement(parsingContext, inErrorRecovery) { @@ -33375,20 +33611,20 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 176 /* SyntaxKind.IndexSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 234 /* SyntaxKind.SemicolonClassElement */: + case 173 /* SyntaxKind.Constructor */: + case 178 /* SyntaxKind.IndexSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 237 /* SyntaxKind.SemicolonClassElement */: return true; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // Method declarations are not necessarily reusable. An object-literal // may have a method calls "constructor(...)" and we must reparse that // into an actual .ConstructorDeclaration. var methodDeclaration = node; var nameIsConstructor = methodDeclaration.name.kind === 79 /* SyntaxKind.Identifier */ && - methodDeclaration.name.originalKeywordKind === 134 /* SyntaxKind.ConstructorKeyword */; + methodDeclaration.name.originalKeywordKind === 135 /* SyntaxKind.ConstructorKeyword */; return !nameIsConstructor; } } @@ -33397,8 +33633,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: return true; } } @@ -33407,58 +33643,58 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 235 /* SyntaxKind.Block */: - case 239 /* SyntaxKind.IfStatement */: - case 238 /* SyntaxKind.ExpressionStatement */: - case 251 /* SyntaxKind.ThrowStatement */: - case 247 /* SyntaxKind.ReturnStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 236 /* SyntaxKind.EmptyStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 250 /* SyntaxKind.LabeledStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 253 /* SyntaxKind.DebuggerStatement */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 238 /* SyntaxKind.Block */: + case 242 /* SyntaxKind.IfStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 254 /* SyntaxKind.ThrowStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 239 /* SyntaxKind.EmptyStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 253 /* SyntaxKind.LabeledStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 299 /* SyntaxKind.EnumMember */; + return node.kind === 302 /* SyntaxKind.EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 166 /* SyntaxKind.PropertySignature */: - case 174 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 168 /* SyntaxKind.PropertySignature */: + case 176 /* SyntaxKind.CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 254 /* SyntaxKind.VariableDeclaration */) { + if (node.kind !== 257 /* SyntaxKind.VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -33479,7 +33715,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 164 /* SyntaxKind.Parameter */) { + if (node.kind !== 166 /* SyntaxKind.Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -33772,14 +34008,14 @@ var ts; // If true, we should abort parsing an error function. function typeHasArrowFunctionBlockingParseError(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return ts.nodeIsMissing(node.typeName); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: { + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: { var _a = node, parameters = _a.parameters, type = _a.type; return isMissingList(parameters) || typeHasArrowFunctionBlockingParseError(type); } - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return typeHasArrowFunctionBlockingParseError(node.type); default: return false; @@ -33858,7 +34094,7 @@ var ts; function parseJSDocType() { scanner.setInJSDocType(true); var pos = getNodePos(); - if (parseOptional(141 /* SyntaxKind.ModuleKeyword */)) { + if (parseOptional(142 /* SyntaxKind.ModuleKeyword */)) { // TODO(rbuckton): We never set the type for a JSDocNamepathType. What should we put here? var moduleTag = factory.createJSDocNamepathType(/*type*/ undefined); terminate: while (true) { @@ -34074,14 +34310,14 @@ var ts; function parseSignatureMember(kind) { var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); - if (kind === 175 /* SyntaxKind.ConstructSignature */) { + if (kind === 177 /* SyntaxKind.ConstructSignature */) { parseExpected(103 /* SyntaxKind.NewKeyword */); } var typeParameters = parseTypeParameters(); var parameters = parseParameters(4 /* SignatureFlags.Type */); var type = parseReturnType(58 /* SyntaxKind.ColonToken */, /*isType*/ true); parseTypeMemberSemicolon(); - var node = kind === 174 /* SyntaxKind.CallSignature */ + var node = kind === 176 /* SyntaxKind.CallSignature */ ? factory.createCallSignature(typeParameters, parameters, type) : factory.createConstructSignature(typeParameters, parameters, type); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -34175,8 +34411,8 @@ var ts; // Return true if we have the start of a signature member if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || - token() === 136 /* SyntaxKind.GetKeyword */ || - token() === 149 /* SyntaxKind.SetKeyword */) { + token() === 137 /* SyntaxKind.GetKeyword */ || + token() === 151 /* SyntaxKind.SetKeyword */) { return true; } var idToken = false; @@ -34208,19 +34444,19 @@ var ts; } function parseTypeMember() { if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */) { - return parseSignatureMember(174 /* SyntaxKind.CallSignature */); + return parseSignatureMember(176 /* SyntaxKind.CallSignature */); } if (token() === 103 /* SyntaxKind.NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) { - return parseSignatureMember(175 /* SyntaxKind.ConstructSignature */); + return parseSignatureMember(177 /* SyntaxKind.ConstructSignature */); } var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); var modifiers = parseModifiers(); - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 172 /* SyntaxKind.GetAccessor */, 4 /* SignatureFlags.Type */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 174 /* SyntaxKind.GetAccessor */, 4 /* SignatureFlags.Type */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 173 /* SyntaxKind.SetAccessor */, 4 /* SignatureFlags.Type */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 175 /* SyntaxKind.SetAccessor */, 4 /* SignatureFlags.Type */); } if (isIndexSignature()) { return parseIndexSignatureDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers); @@ -34261,9 +34497,9 @@ var ts; function isStartOfMappedType() { nextToken(); if (token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { - return nextToken() === 145 /* SyntaxKind.ReadonlyKeyword */; + return nextToken() === 146 /* SyntaxKind.ReadonlyKeyword */; } - if (token() === 145 /* SyntaxKind.ReadonlyKeyword */) { + if (token() === 146 /* SyntaxKind.ReadonlyKeyword */) { nextToken(); } return token() === 22 /* SyntaxKind.OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 101 /* SyntaxKind.InKeyword */; @@ -34279,15 +34515,15 @@ var ts; var pos = getNodePos(); parseExpected(18 /* SyntaxKind.OpenBraceToken */); var readonlyToken; - if (token() === 145 /* SyntaxKind.ReadonlyKeyword */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { + if (token() === 146 /* SyntaxKind.ReadonlyKeyword */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { readonlyToken = parseTokenNode(); - if (readonlyToken.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { - parseExpected(145 /* SyntaxKind.ReadonlyKeyword */); + if (readonlyToken.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { + parseExpected(146 /* SyntaxKind.ReadonlyKeyword */); } } parseExpected(22 /* SyntaxKind.OpenBracketToken */); var typeParameter = parseMappedTypeParameter(); - var nameType = parseOptional(127 /* SyntaxKind.AsKeyword */) ? parseType() : undefined; + var nameType = parseOptional(128 /* SyntaxKind.AsKeyword */) ? parseType() : undefined; parseExpected(23 /* SyntaxKind.CloseBracketToken */); var questionToken; if (token() === 57 /* SyntaxKind.QuestionToken */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { @@ -34401,7 +34637,7 @@ var ts; var openBracePosition = scanner.getTokenPos(); parseExpected(18 /* SyntaxKind.OpenBraceToken */); var multiLine = scanner.hasPrecedingLineBreak(); - parseExpected(129 /* SyntaxKind.AssertKeyword */); + parseExpected(130 /* SyntaxKind.AssertKeyword */); parseExpected(58 /* SyntaxKind.ColonToken */); var clause = parseAssertClause(/*skipAssertKeyword*/ true); if (!parseExpected(19 /* SyntaxKind.CloseBraceToken */)) { @@ -34434,16 +34670,16 @@ var ts; } function parseNonArrayType() { switch (token()) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: // If these are followed by a dot, then parse these out as a dotted type reference instead. return tryParse(parseKeywordAndNoDot) || parseTypeReference(); case 66 /* SyntaxKind.AsteriskEqualsToken */: @@ -34476,7 +34712,7 @@ var ts; return parseTokenNode(); case 108 /* SyntaxKind.ThisKeyword */: { var thisKeyword = parseThisTypeNode(); - if (token() === 139 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 140 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { return parseThisTypePredicate(thisKeyword); } else { @@ -34493,7 +34729,7 @@ var ts; return parseParenthesizedType(); case 100 /* SyntaxKind.ImportKeyword */: return parseImportType(); - case 128 /* SyntaxKind.AssertsKeyword */: + case 129 /* SyntaxKind.AssertsKeyword */: return lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine) ? parseAssertsTypePredicate() : parseTypeReference(); case 15 /* SyntaxKind.TemplateHead */: return parseTemplateType(); @@ -34503,21 +34739,21 @@ var ts; } function isStartOfType(inStartOfParameter) { switch (token()) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 108 /* SyntaxKind.ThisKeyword */: case 112 /* SyntaxKind.TypeOfKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: case 18 /* SyntaxKind.OpenBraceToken */: case 22 /* SyntaxKind.OpenBracketToken */: case 29 /* SyntaxKind.LessThanToken */: @@ -34529,14 +34765,14 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 41 /* SyntaxKind.AsteriskToken */: case 57 /* SyntaxKind.QuestionToken */: case 53 /* SyntaxKind.ExclamationToken */: case 25 /* SyntaxKind.DotDotDotToken */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: case 100 /* SyntaxKind.ImportKeyword */: - case 128 /* SyntaxKind.AssertsKeyword */: + case 129 /* SyntaxKind.AssertsKeyword */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 15 /* SyntaxKind.TemplateHead */: return true; @@ -34613,17 +34849,17 @@ var ts; } function parseInferType() { var pos = getNodePos(); - parseExpected(137 /* SyntaxKind.InferKeyword */); + parseExpected(138 /* SyntaxKind.InferKeyword */); return finishNode(factory.createInferTypeNode(parseTypeParameterOfInferType()), pos); } function parseTypeOperatorOrHigher() { var operator = token(); switch (operator) { - case 140 /* SyntaxKind.KeyOfKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: return parseTypeOperator(operator); - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: return parseInferType(); } return allowConditionalTypesAnd(parsePostfixTypeOrHigher); @@ -34743,16 +34979,16 @@ var ts; } function parseTypePredicatePrefix() { var id = parseIdentifier(); - if (token() === 139 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 140 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { nextToken(); return id; } } function parseAssertsTypePredicate() { var pos = getNodePos(); - var assertsModifier = parseExpectedToken(128 /* SyntaxKind.AssertsKeyword */); + var assertsModifier = parseExpectedToken(129 /* SyntaxKind.AssertsKeyword */); var parameterName = token() === 108 /* SyntaxKind.ThisKeyword */ ? parseThisTypeNode() : parseIdentifier(); - var type = parseOptional(139 /* SyntaxKind.IsKeyword */) ? parseType() : undefined; + var type = parseOptional(140 /* SyntaxKind.IsKeyword */) ? parseType() : undefined; return finishNode(factory.createTypePredicateNode(assertsModifier, parameterName, type), pos); } function parseType() { @@ -34822,7 +35058,7 @@ var ts; case 45 /* SyntaxKind.PlusPlusToken */: case 46 /* SyntaxKind.MinusMinusToken */: case 29 /* SyntaxKind.LessThanToken */: - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: case 125 /* SyntaxKind.YieldKeyword */: case 80 /* SyntaxKind.PrivateIdentifier */: // Yield/await always starts an expression. Either it is an identifier (in which case @@ -35010,7 +35246,7 @@ var ts; // Unknown -> There *might* be a parenthesized arrow function here. // Speculatively look ahead to be sure, and rollback if not. function isParenthesizedArrowFunctionExpression() { - if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || token() === 132 /* SyntaxKind.AsyncKeyword */) { return lookAhead(isParenthesizedArrowFunctionExpressionWorker); } if (token() === 38 /* SyntaxKind.EqualsGreaterThanToken */) { @@ -35023,7 +35259,7 @@ var ts; return 0 /* Tristate.False */; } function isParenthesizedArrowFunctionExpressionWorker() { - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { nextToken(); if (scanner.hasPrecedingLineBreak()) { return 0 /* Tristate.False */; @@ -35067,8 +35303,8 @@ var ts; // Check for "(xxx yyy", where xxx is a modifier and yyy is an identifier. This // isn't actually allowed, but we want to treat it as a lambda so we can provide // a good error message. - if (ts.isModifierKind(second) && second !== 131 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) { - if (nextToken() === 127 /* SyntaxKind.AsKeyword */) { + if (ts.isModifierKind(second) && second !== 132 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) { + if (nextToken() === 128 /* SyntaxKind.AsKeyword */) { // https://github.com/microsoft/TypeScript/issues/44466 return 0 /* Tristate.False */; } @@ -35150,7 +35386,7 @@ var ts; } function tryParseAsyncSimpleArrowFunctionExpression(allowReturnTypeInArrowFunction) { // We do a check here so that we won't be doing unnecessarily call to "lookAhead" - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* Tristate.True */) { var pos = getNodePos(); var asyncModifier = parseModifiersForArrowFunction(); @@ -35164,7 +35400,7 @@ var ts; // AsyncArrowFunctionExpression: // 1) async[no LineTerminator here]AsyncArrowBindingIdentifier[?Yield][no LineTerminator here]=>AsyncConciseBody[?In] // 2) CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In] - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { nextToken(); // If the "async" is followed by "=>" token then it is not a beginning of an async arrow-function // but instead a simple arrow-function which will be parsed inside "parseAssignmentExpressionOrHigher" @@ -35230,7 +35466,7 @@ var ts; // // So we need just a bit of lookahead to ensure that it can only be a signature. var unwrappedType = type; - while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 191 /* SyntaxKind.ParenthesizedType */) { + while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 193 /* SyntaxKind.ParenthesizedType */) { unwrappedType = unwrappedType.type; // Skip parens if need be } var hasJSDocFunctionType = unwrappedType && ts.isJSDocFunctionType(unwrappedType); @@ -35325,7 +35561,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand, pos); } function isInOrOfKeyword(t) { - return t === 101 /* SyntaxKind.InKeyword */ || t === 160 /* SyntaxKind.OfKeyword */; + return t === 101 /* SyntaxKind.InKeyword */ || t === 162 /* SyntaxKind.OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand, pos) { while (true) { @@ -35363,7 +35599,7 @@ var ts; if (token() === 101 /* SyntaxKind.InKeyword */ && inDisallowInContext()) { break; } - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */ || token() === 150 /* SyntaxKind.SatisfiesKeyword */) { // Make sure we *do* perform ASI for constructs like this: // var x = foo // as (Bar) @@ -35373,8 +35609,10 @@ var ts; break; } else { + var keywordKind = token(); nextToken(); - leftOperand = makeAsExpression(leftOperand, parseType()); + leftOperand = keywordKind === 150 /* SyntaxKind.SatisfiesKeyword */ ? makeSatisfiesExpression(leftOperand, parseType()) : + makeAsExpression(leftOperand, parseType()); } } else { @@ -35389,6 +35627,9 @@ var ts; } return ts.getBinaryOperatorPrecedence(token()) > 0; } + function makeSatisfiesExpression(left, right) { + return finishNode(factory.createSatisfiesExpression(left, right), left.pos); + } function makeBinaryExpression(left, operatorToken, right, pos) { return finishNode(factory.createBinaryExpression(left, operatorToken, right), pos); } @@ -35412,7 +35653,7 @@ var ts; return finishNode(factory.createVoidExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos); } function isAwaitExpression() { - if (token() === 132 /* SyntaxKind.AwaitKeyword */) { + if (token() === 133 /* SyntaxKind.AwaitKeyword */) { if (inAwaitContext()) { return true; } @@ -35465,7 +35706,7 @@ var ts; if (token() === 42 /* SyntaxKind.AsteriskAsteriskToken */) { var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); var end = simpleUnaryExpression.end; - if (simpleUnaryExpression.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (simpleUnaryExpression.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { parseErrorAt(pos, end, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { @@ -35506,7 +35747,7 @@ var ts; // UnaryExpression (modified): // < type > UnaryExpression return parseTypeAssertion(); - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: if (isAwaitExpression()) { return parseAwaitExpression(); } @@ -35536,7 +35777,7 @@ var ts; case 89 /* SyntaxKind.DeleteKeyword */: case 112 /* SyntaxKind.TypeOfKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: return false; case 29 /* SyntaxKind.LessThanToken */: // If we are not in JSX context, we are parsing TypeAssertion which is an UnaryExpression @@ -35719,11 +35960,11 @@ var ts; var pos = getNodePos(); var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); var result; - if (opening.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (opening.kind === 283 /* SyntaxKind.JsxOpeningElement */) { var children = parseJsxChildren(opening); var closingElement = void 0; var lastChild = children[children.length - 1]; - if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 278 /* SyntaxKind.JsxElement */ + if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 281 /* SyntaxKind.JsxElement */ && !tagNamesAreEquivalent(lastChild.openingElement.tagName, lastChild.closingElement.tagName) && tagNamesAreEquivalent(opening.tagName, lastChild.closingElement.tagName)) { // when an unclosed JsxOpeningElement incorrectly parses its parent's JsxClosingElement, @@ -35749,11 +35990,11 @@ var ts; } result = finishNode(factory.createJsxElement(opening, children, closingElement), pos); } - else if (opening.kind === 283 /* SyntaxKind.JsxOpeningFragment */) { + else if (opening.kind === 286 /* SyntaxKind.JsxOpeningFragment */) { result = finishNode(factory.createJsxFragment(opening, parseJsxChildren(opening), parseJsxClosingFragment(inExpressionContext)), pos); } else { - ts.Debug.assert(opening.kind === 279 /* SyntaxKind.JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 282 /* SyntaxKind.JsxSelfClosingElement */); // Nothing else to do for self-closing elements result = opening; } @@ -35823,7 +36064,7 @@ var ts; break; list.push(child); if (ts.isJsxOpeningElement(openingTag) - && (child === null || child === void 0 ? void 0 : child.kind) === 278 /* SyntaxKind.JsxElement */ + && (child === null || child === void 0 ? void 0 : child.kind) === 281 /* SyntaxKind.JsxElement */ && !tagNamesAreEquivalent(child.openingElement.tagName, child.closingElement.tagName) && tagNamesAreEquivalent(openingTag.tagName, child.closingElement.tagName)) { // stop after parsing a mismatched child like
...(
) in order to reattach the
higher @@ -36068,7 +36309,7 @@ var ts; } if (isTemplateStartOfTaggedTemplate()) { // Absorb type arguments into TemplateExpression when preceding expression is ExpressionWithTypeArguments - expression = !questionDotToken && expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ ? + expression = !questionDotToken && expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ ? parseTaggedTemplateRest(pos, expression.expression, questionDotToken, expression.typeArguments) : parseTaggedTemplateRest(pos, expression, questionDotToken, /*typeArguments*/ undefined); continue; @@ -36115,7 +36356,7 @@ var ts; } if (typeArguments || token() === 20 /* SyntaxKind.OpenParenToken */) { // Absorb type arguments into CallExpression when preceding expression is ExpressionWithTypeArguments - if (!questionDotToken && expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (!questionDotToken && expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -36201,7 +36442,7 @@ var ts; return parseArrayLiteralExpression(); case 18 /* SyntaxKind.OpenBraceToken */: return parseObjectLiteralExpression(); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // Async arrow functions are parsed earlier in parseAssignmentExpressionOrHigher. // If we encounter `async [no LineTerminator here] function` then this is an async // function; otherwise, its an identifier. @@ -36268,11 +36509,11 @@ var ts; } var decorators = parseDecorators(); var modifiers = parseModifiers(); - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 174 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 175 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); } var asteriskToken = parseOptionalToken(41 /* SyntaxKind.AsteriskToken */); var tokenIsIdentifier = isIdentifier(); @@ -36360,7 +36601,7 @@ var ts; var expression = parseMemberExpressionRest(expressionPos, parsePrimaryExpression(), /*allowOptionalChain*/ false); var typeArguments; // Absorb type arguments into NewExpression when preceding expression is ExpressionWithTypeArguments - if (expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -36464,7 +36705,7 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(97 /* SyntaxKind.ForKeyword */); - var awaitToken = parseOptionalToken(132 /* SyntaxKind.AwaitKeyword */); + var awaitToken = parseOptionalToken(133 /* SyntaxKind.AwaitKeyword */); parseExpected(20 /* SyntaxKind.OpenParenToken */); var initializer; if (token() !== 26 /* SyntaxKind.SemicolonToken */) { @@ -36476,7 +36717,7 @@ var ts; } } var node; - if (awaitToken ? parseExpected(160 /* SyntaxKind.OfKeyword */) : parseOptional(160 /* SyntaxKind.OfKeyword */)) { + if (awaitToken ? parseExpected(162 /* SyntaxKind.OfKeyword */) : parseOptional(162 /* SyntaxKind.OfKeyword */)) { var expression = allowInAnd(function () { return parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true); }); parseExpected(21 /* SyntaxKind.CloseParenToken */); node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement()); @@ -36503,10 +36744,10 @@ var ts; function parseBreakOrContinueStatement(kind) { var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(kind === 246 /* SyntaxKind.BreakStatement */ ? 81 /* SyntaxKind.BreakKeyword */ : 86 /* SyntaxKind.ContinueKeyword */); + parseExpected(kind === 249 /* SyntaxKind.BreakStatement */ ? 81 /* SyntaxKind.BreakKeyword */ : 86 /* SyntaxKind.ContinueKeyword */); var label = canParseSemicolon() ? undefined : parseIdentifier(); parseSemicolon(); - var node = kind === 246 /* SyntaxKind.BreakStatement */ + var node = kind === 249 /* SyntaxKind.BreakStatement */ ? factory.createBreakStatement(label) : factory.createContinueStatement(label); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -36697,25 +36938,26 @@ var ts; // // could be legal, it would add complexity for very little gain. case 118 /* SyntaxKind.InterfaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: return nextTokenIsIdentifierOnSameLine(); - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); case 126 /* SyntaxKind.AbstractKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: nextToken(); // ASI takes effect for this modifier. if (scanner.hasPrecedingLineBreak()) { return false; } continue; - case 157 /* SyntaxKind.GlobalKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: nextToken(); return token() === 18 /* SyntaxKind.OpenBraceToken */ || token() === 79 /* SyntaxKind.Identifier */ || token() === 93 /* SyntaxKind.ExportKeyword */; case 100 /* SyntaxKind.ImportKeyword */: @@ -36724,12 +36966,12 @@ var ts; token() === 18 /* SyntaxKind.OpenBraceToken */ || ts.tokenIsIdentifierOrKeyword(token()); case 93 /* SyntaxKind.ExportKeyword */: var currentToken_1 = nextToken(); - if (currentToken_1 === 152 /* SyntaxKind.TypeKeyword */) { + if (currentToken_1 === 154 /* SyntaxKind.TypeKeyword */) { currentToken_1 = lookAhead(nextToken); } if (currentToken_1 === 63 /* SyntaxKind.EqualsToken */ || currentToken_1 === 41 /* SyntaxKind.AsteriskToken */ || currentToken_1 === 18 /* SyntaxKind.OpenBraceToken */ || currentToken_1 === 88 /* SyntaxKind.DefaultKeyword */ || - currentToken_1 === 127 /* SyntaxKind.AsKeyword */) { + currentToken_1 === 128 /* SyntaxKind.AsKeyword */) { return true; } continue; @@ -36777,20 +37019,21 @@ var ts; case 85 /* SyntaxKind.ConstKeyword */: case 93 /* SyntaxKind.ExportKeyword */: return isStartOfDeclaration(); - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: // When these don't start a declaration, they're an identifier in an expression statement return true; + case 127 /* SyntaxKind.AccessorKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: // When these don't start a declaration, they may be the start of a class member if an identifier // immediately follows. Otherwise they're an identifier in an expression statement. return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); @@ -36833,9 +37076,9 @@ var ts; case 97 /* SyntaxKind.ForKeyword */: return parseForOrForInOrForOfStatement(); case 86 /* SyntaxKind.ContinueKeyword */: - return parseBreakOrContinueStatement(245 /* SyntaxKind.ContinueStatement */); + return parseBreakOrContinueStatement(248 /* SyntaxKind.ContinueStatement */); case 81 /* SyntaxKind.BreakKeyword */: - return parseBreakOrContinueStatement(246 /* SyntaxKind.BreakStatement */); + return parseBreakOrContinueStatement(249 /* SyntaxKind.BreakStatement */); case 105 /* SyntaxKind.ReturnKeyword */: return parseReturnStatement(); case 116 /* SyntaxKind.WithKeyword */: @@ -36854,12 +37097,12 @@ var ts; return parseDebuggerStatement(); case 59 /* SyntaxKind.AtToken */: return parseDeclaration(); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 85 /* SyntaxKind.ConstKeyword */: case 92 /* SyntaxKind.EnumKeyword */: case 93 /* SyntaxKind.ExportKeyword */: @@ -36868,9 +37111,10 @@ var ts; case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -36879,7 +37123,7 @@ var ts; return parseExpressionOrLabeledStatement(); } function isDeclareModifier(modifier) { - return modifier.kind === 135 /* SyntaxKind.DeclareKeyword */; + return modifier.kind === 136 /* SyntaxKind.DeclareKeyword */; } function parseDeclaration() { // `parseListElement` attempted to get the reused node at this position, @@ -36925,13 +37169,13 @@ var ts; return parseClassDeclaration(pos, hasJSDoc, decorators, modifiers); case 118 /* SyntaxKind.InterfaceKeyword */: return parseInterfaceDeclaration(pos, hasJSDoc, decorators, modifiers); - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: return parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers); case 92 /* SyntaxKind.EnumKeyword */: return parseEnumDeclaration(pos, hasJSDoc, decorators, modifiers); - case 157 /* SyntaxKind.GlobalKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: return parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers); case 100 /* SyntaxKind.ImportKeyword */: return parseImportDeclarationOrImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers); @@ -36941,7 +37185,7 @@ var ts; case 88 /* SyntaxKind.DefaultKeyword */: case 63 /* SyntaxKind.EqualsToken */: return parseExportAssignment(pos, hasJSDoc, decorators, modifiers); - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: return parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers); default: return parseExportDeclaration(pos, hasJSDoc, decorators, modifiers); @@ -36950,7 +37194,7 @@ var ts; if (decorators || modifiers) { // We reached this point because we encountered decorators and/or modifiers and assumed a declaration // would follow. For recovery and error reporting purposes, return an incomplete declaration. - var missing = createMissingNode(276 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var missing = createMissingNode(279 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); ts.setTextRangePos(missing, pos); missing.illegalDecorators = decorators; missing.modifiers = modifiers; @@ -37076,7 +37320,7 @@ var ts; // this context. // The checker will then give an error that there is an empty declaration list. var declarations; - if (token() === 160 /* SyntaxKind.OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 162 /* SyntaxKind.OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { declarations = createMissingList(); } else { @@ -37104,9 +37348,9 @@ var ts; parseExpected(98 /* SyntaxKind.FunctionKeyword */); var asteriskToken = parseOptionalToken(41 /* SyntaxKind.AsteriskToken */); // We don't parse the name here in await context, instead we will report a grammar error in the checker. - var name = modifierFlags & 512 /* ModifierFlags.Default */ ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); + var name = modifierFlags & 1024 /* ModifierFlags.Default */ ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); var isGenerator = asteriskToken ? 1 /* SignatureFlags.Yield */ : 0 /* SignatureFlags.None */; - var isAsync = modifierFlags & 256 /* ModifierFlags.Async */ ? 2 /* SignatureFlags.Await */ : 0 /* SignatureFlags.None */; + var isAsync = modifierFlags & 512 /* ModifierFlags.Async */ ? 2 /* SignatureFlags.Await */ : 0 /* SignatureFlags.None */; var typeParameters = parseTypeParameters(); if (modifierFlags & 1 /* ModifierFlags.Export */) setAwaitContext(/*value*/ true); @@ -37119,8 +37363,8 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseConstructorName() { - if (token() === 134 /* SyntaxKind.ConstructorKeyword */) { - return parseExpected(134 /* SyntaxKind.ConstructorKeyword */); + if (token() === 135 /* SyntaxKind.ConstructorKeyword */) { + return parseExpected(135 /* SyntaxKind.ConstructorKeyword */); } if (token() === 10 /* SyntaxKind.StringLiteral */ && lookAhead(nextToken) === 20 /* SyntaxKind.OpenParenToken */) { return tryParse(function () { @@ -37182,7 +37426,7 @@ var ts; var parameters = parseParameters(0 /* SignatureFlags.None */); var type = parseReturnType(58 /* SyntaxKind.ColonToken */, /*isType*/ false); var body = parseFunctionBlockOrSemicolon(flags); - var node = kind === 172 /* SyntaxKind.GetAccessor */ + var node = kind === 174 /* SyntaxKind.GetAccessor */ ? factory.createGetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, type, body) : factory.createSetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, body); // Keep track of `typeParameters` (for both) and `type` (for setters) if they were parsed those indicate grammar errors @@ -37226,7 +37470,7 @@ var ts; // If we were able to get any potential identifier... if (idToken !== undefined) { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. - if (!ts.isKeyword(idToken) || idToken === 149 /* SyntaxKind.SetKeyword */ || idToken === 136 /* SyntaxKind.GetKeyword */) { + if (!ts.isKeyword(idToken) || idToken === 151 /* SyntaxKind.SetKeyword */ || idToken === 137 /* SyntaxKind.GetKeyword */) { return true; } // If it *is* a keyword, but not an accessor, check a little farther along @@ -37269,7 +37513,7 @@ var ts; return body; } function parseDecoratorExpression() { - if (inAwaitContext() && token() === 132 /* SyntaxKind.AwaitKeyword */) { + if (inAwaitContext() && token() === 133 /* SyntaxKind.AwaitKeyword */) { // `@await` is is disallowed in an [Await] context, but can cause parsing to go off the rails // This simply parses the missing identifier and moves on. var pos = getNodePos(); @@ -37347,10 +37591,10 @@ var ts; } function parseModifiersForArrowFunction() { var modifiers; - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { var pos = getNodePos(); nextToken(); - var modifier = finishNode(factory.createToken(131 /* SyntaxKind.AsyncKeyword */), pos); + var modifier = finishNode(factory.createToken(132 /* SyntaxKind.AsyncKeyword */), pos); modifiers = createNodeArray([modifier], pos); } return modifiers; @@ -37367,13 +37611,13 @@ var ts; if (token() === 124 /* SyntaxKind.StaticKeyword */ && lookAhead(nextTokenIsOpenBrace)) { return parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers); } - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 174 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 175 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); } - if (token() === 134 /* SyntaxKind.ConstructorKeyword */ || token() === 10 /* SyntaxKind.StringLiteral */) { + if (token() === 135 /* SyntaxKind.ConstructorKeyword */ || token() === 10 /* SyntaxKind.StringLiteral */) { var constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers); if (constructorDeclaration) { return constructorDeclaration; @@ -37410,10 +37654,10 @@ var ts; return ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined, 226 /* SyntaxKind.ClassExpression */); + return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined, 228 /* SyntaxKind.ClassExpression */); } function parseClassDeclaration(pos, hasJSDoc, decorators, modifiers) { - return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 257 /* SyntaxKind.ClassDeclaration */); + return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 260 /* SyntaxKind.ClassDeclaration */); } function parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, kind) { var savedAwaitContext = inAwaitContext(); @@ -37435,7 +37679,7 @@ var ts; members = createMissingList(); } setAwaitContext(savedAwaitContext); - var node = kind === 257 /* SyntaxKind.ClassDeclaration */ + var node = kind === 260 /* SyntaxKind.ClassDeclaration */ ? factory.createClassDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members) : factory.createClassExpression(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -37472,7 +37716,7 @@ var ts; function parseExpressionWithTypeArguments() { var pos = getNodePos(); var expression = parseLeftHandSideExpressionOrHigher(); - if (expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { return expression; } var typeArguments = tryParseTypeArguments(); @@ -37499,11 +37743,11 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers) { - parseExpected(152 /* SyntaxKind.TypeKeyword */); + parseExpected(154 /* SyntaxKind.TypeKeyword */); var name = parseIdentifier(); var typeParameters = parseTypeParameters(); parseExpected(63 /* SyntaxKind.EqualsToken */); - var type = token() === 138 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); + var type = token() === 139 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); parseSemicolon(); var node = factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type); node.illegalDecorators = decorators; @@ -37562,7 +37806,7 @@ var ts; function parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { var flags = 0; var name; - if (token() === 157 /* SyntaxKind.GlobalKeyword */) { + if (token() === 159 /* SyntaxKind.GlobalKeyword */) { // parse 'global' as name of global scope augmentation name = parseIdentifier(); flags |= 1024 /* NodeFlags.GlobalAugmentation */; @@ -37584,15 +37828,15 @@ var ts; } function parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { var flags = 0; - if (token() === 157 /* SyntaxKind.GlobalKeyword */) { + if (token() === 159 /* SyntaxKind.GlobalKeyword */) { // global augmentation return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); } - else if (parseOptional(142 /* SyntaxKind.NamespaceKeyword */)) { + else if (parseOptional(143 /* SyntaxKind.NamespaceKeyword */)) { flags |= 16 /* NodeFlags.Namespace */; } else { - parseExpected(141 /* SyntaxKind.ModuleKeyword */); + parseExpected(142 /* SyntaxKind.ModuleKeyword */); if (token() === 10 /* SyntaxKind.StringLiteral */) { return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); } @@ -37600,7 +37844,7 @@ var ts; return parseModuleOrNamespaceDeclaration(pos, hasJSDoc, decorators, modifiers, flags); } function isExternalModuleReference() { - return token() === 146 /* SyntaxKind.RequireKeyword */ && + return token() === 147 /* SyntaxKind.RequireKeyword */ && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { @@ -37613,8 +37857,8 @@ var ts; return nextToken() === 43 /* SyntaxKind.SlashToken */; } function parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers) { - parseExpected(127 /* SyntaxKind.AsKeyword */); - parseExpected(142 /* SyntaxKind.NamespaceKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); + parseExpected(143 /* SyntaxKind.NamespaceKeyword */); var name = parseIdentifier(); parseSemicolon(); var node = factory.createNamespaceExportDeclaration(name); @@ -37632,7 +37876,7 @@ var ts; identifier = parseIdentifier(); } var isTypeOnly = false; - if (token() !== 156 /* SyntaxKind.FromKeyword */ && + if (token() !== 158 /* SyntaxKind.FromKeyword */ && (identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) === "type" && (isIdentifier() || tokenAfterImportDefinitelyProducesImportDeclaration())) { isTypeOnly = true; @@ -37650,11 +37894,11 @@ var ts; token() === 18 /* SyntaxKind.OpenBraceToken */ // import { ) { importClause = parseImportClause(identifier, afterImportPos, isTypeOnly); - parseExpected(156 /* SyntaxKind.FromKeyword */); + parseExpected(158 /* SyntaxKind.FromKeyword */); } var moduleSpecifier = parseModuleSpecifier(); var assertClause; - if (token() === 129 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 130 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -37672,7 +37916,7 @@ var ts; function parseAssertClause(skipAssertKeyword) { var pos = getNodePos(); if (!skipAssertKeyword) { - parseExpected(129 /* SyntaxKind.AssertKeyword */); + parseExpected(130 /* SyntaxKind.AssertKeyword */); } var openBracePosition = scanner.getTokenPos(); if (parseExpected(18 /* SyntaxKind.OpenBraceToken */)) { @@ -37697,7 +37941,7 @@ var ts; function tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration() { // In `import id ___`, the current token decides whether to produce // an ImportDeclaration or ImportEqualsDeclaration. - return token() === 27 /* SyntaxKind.CommaToken */ || token() === 156 /* SyntaxKind.FromKeyword */; + return token() === 27 /* SyntaxKind.CommaToken */ || token() === 158 /* SyntaxKind.FromKeyword */; } function parseImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers, identifier, isTypeOnly) { parseExpected(63 /* SyntaxKind.EqualsToken */); @@ -37720,7 +37964,7 @@ var ts; var namedBindings; if (!identifier || parseOptional(27 /* SyntaxKind.CommaToken */)) { - namedBindings = token() === 41 /* SyntaxKind.AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(269 /* SyntaxKind.NamedImports */); + namedBindings = token() === 41 /* SyntaxKind.AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(272 /* SyntaxKind.NamedImports */); } return finishNode(factory.createImportClause(isTypeOnly, identifier, namedBindings), pos); } @@ -37731,7 +37975,7 @@ var ts; } function parseExternalModuleReference() { var pos = getNodePos(); - parseExpected(146 /* SyntaxKind.RequireKeyword */); + parseExpected(147 /* SyntaxKind.RequireKeyword */); parseExpected(20 /* SyntaxKind.OpenParenToken */); var expression = parseModuleSpecifier(); parseExpected(21 /* SyntaxKind.CloseParenToken */); @@ -37755,7 +37999,7 @@ var ts; // * as ImportedBinding var pos = getNodePos(); parseExpected(41 /* SyntaxKind.AsteriskToken */); - parseExpected(127 /* SyntaxKind.AsKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); var name = parseIdentifier(); return finishNode(factory.createNamespaceImport(name), pos); } @@ -37768,17 +38012,17 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - var node = kind === 269 /* SyntaxKind.NamedImports */ + var node = kind === 272 /* SyntaxKind.NamedImports */ ? factory.createNamedImports(parseBracketedList(23 /* ParsingContext.ImportOrExportSpecifiers */, parseImportSpecifier, 18 /* SyntaxKind.OpenBraceToken */, 19 /* SyntaxKind.CloseBraceToken */)) : factory.createNamedExports(parseBracketedList(23 /* ParsingContext.ImportOrExportSpecifiers */, parseExportSpecifier, 18 /* SyntaxKind.OpenBraceToken */, 19 /* SyntaxKind.CloseBraceToken */)); return finishNode(node, pos); } function parseExportSpecifier() { var hasJSDoc = hasPrecedingJSDocComment(); - return withJSDoc(parseImportOrExportSpecifier(275 /* SyntaxKind.ExportSpecifier */), hasJSDoc); + return withJSDoc(parseImportOrExportSpecifier(278 /* SyntaxKind.ExportSpecifier */), hasJSDoc); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(270 /* SyntaxKind.ImportSpecifier */); + return parseImportOrExportSpecifier(273 /* SyntaxKind.ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var pos = getNodePos(); @@ -37803,10 +38047,10 @@ var ts; // import { type as } from "mod"; - isTypeOnly: true, name: as // import { type as as } from "mod"; - isTypeOnly: false, name: as, propertyName: type // import { type as as as } from "mod"; - isTypeOnly: true, name: as, propertyName: as - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */) { // { type as ...? } var firstAs = parseIdentifierName(); - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */) { // { type as as ...? } var secondAs = parseIdentifierName(); if (ts.tokenIsIdentifierOrKeyword(token())) { @@ -37841,15 +38085,15 @@ var ts; name = parseNameWithKeywordCheck(); } } - if (canParseAsKeyword && token() === 127 /* SyntaxKind.AsKeyword */) { + if (canParseAsKeyword && token() === 128 /* SyntaxKind.AsKeyword */) { propertyName = name; - parseExpected(127 /* SyntaxKind.AsKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); name = parseNameWithKeywordCheck(); } - if (kind === 270 /* SyntaxKind.ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 273 /* SyntaxKind.ImportSpecifier */ && checkIdentifierIsKeyword) { parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected); } - var node = kind === 270 /* SyntaxKind.ImportSpecifier */ + var node = kind === 273 /* SyntaxKind.ImportSpecifier */ ? factory.createImportSpecifier(isTypeOnly, propertyName, name) : factory.createExportSpecifier(isTypeOnly, propertyName, name); return finishNode(node, pos); @@ -37869,26 +38113,26 @@ var ts; var exportClause; var moduleSpecifier; var assertClause; - var isTypeOnly = parseOptional(152 /* SyntaxKind.TypeKeyword */); + var isTypeOnly = parseOptional(154 /* SyntaxKind.TypeKeyword */); var namespaceExportPos = getNodePos(); if (parseOptional(41 /* SyntaxKind.AsteriskToken */)) { - if (parseOptional(127 /* SyntaxKind.AsKeyword */)) { + if (parseOptional(128 /* SyntaxKind.AsKeyword */)) { exportClause = parseNamespaceExport(namespaceExportPos); } - parseExpected(156 /* SyntaxKind.FromKeyword */); + parseExpected(158 /* SyntaxKind.FromKeyword */); moduleSpecifier = parseModuleSpecifier(); } else { - exportClause = parseNamedImportsOrExports(273 /* SyntaxKind.NamedExports */); + exportClause = parseNamedImportsOrExports(276 /* SyntaxKind.NamedExports */); // It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios, // the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`) // If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect. - if (token() === 156 /* SyntaxKind.FromKeyword */ || (token() === 10 /* SyntaxKind.StringLiteral */ && !scanner.hasPrecedingLineBreak())) { - parseExpected(156 /* SyntaxKind.FromKeyword */); + if (token() === 158 /* SyntaxKind.FromKeyword */ || (token() === 10 /* SyntaxKind.StringLiteral */ && !scanner.hasPrecedingLineBreak())) { + parseExpected(158 /* SyntaxKind.FromKeyword */); moduleSpecifier = parseModuleSpecifier(); } } - if (moduleSpecifier && token() === 129 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (moduleSpecifier && token() === 130 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -38501,9 +38745,9 @@ var ts; } function isObjectOrObjectArrayTypeReference(node) { switch (node.kind) { - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return true; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return isObjectOrObjectArrayTypeReference(node.elementType); default: return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && !node.typeArguments; @@ -38535,12 +38779,12 @@ var ts; var child = void 0; var children = void 0; while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) { - if (child.kind === 340 /* SyntaxKind.JSDocParameterTag */ || child.kind === 347 /* SyntaxKind.JSDocPropertyTag */) { + if (child.kind === 343 /* SyntaxKind.JSDocParameterTag */ || child.kind === 350 /* SyntaxKind.JSDocPropertyTag */) { children = ts.append(children, child); } } if (children) { - var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 183 /* SyntaxKind.ArrayType */), pos); + var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 185 /* SyntaxKind.ArrayType */), pos); return finishNode(factory.createJSDocTypeExpression(literal), pos); } } @@ -38658,7 +38902,7 @@ var ts; var hasChildren = false; while (child = tryParse(function () { return parseChildPropertyTag(indent); })) { hasChildren = true; - if (child.kind === 343 /* SyntaxKind.JSDocTypeTag */) { + if (child.kind === 346 /* SyntaxKind.JSDocTypeTag */) { if (childTypeTag) { var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); if (lastError) { @@ -38675,7 +38919,7 @@ var ts; } } if (hasChildren) { - var isArrayType = typeExpression && typeExpression.type.kind === 183 /* SyntaxKind.ArrayType */; + var isArrayType = typeExpression && typeExpression.type.kind === 185 /* SyntaxKind.ArrayType */; var jsdocTypeLiteral = factory.createJSDocTypeLiteral(jsDocPropertyTags, isArrayType); typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ? childTypeTag.typeExpression : @@ -38727,7 +38971,7 @@ var ts; var returnTag = tryParse(function () { if (parseOptionalJsdoc(59 /* SyntaxKind.AtToken */)) { var tag = parseTag(indent); - if (tag && tag.kind === 341 /* SyntaxKind.JSDocReturnTag */) { + if (tag && tag.kind === 344 /* SyntaxKind.JSDocReturnTag */) { return tag; } } @@ -38762,7 +39006,7 @@ var ts; case 59 /* SyntaxKind.AtToken */: if (canParseTag) { var child = tryParseChildTag(target, indent); - if (child && (child.kind === 340 /* SyntaxKind.JSDocParameterTag */ || child.kind === 347 /* SyntaxKind.JSDocPropertyTag */) && + if (child && (child.kind === 343 /* SyntaxKind.JSDocParameterTag */ || child.kind === 350 /* SyntaxKind.JSDocPropertyTag */) && target !== 4 /* PropertyLikeParse.CallbackParameter */ && name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; @@ -39732,6 +39976,7 @@ var ts; ["es2019.object", "lib.es2019.object.d.ts"], ["es2019.string", "lib.es2019.string.d.ts"], ["es2019.symbol", "lib.es2019.symbol.d.ts"], + ["es2019.intl", "lib.es2019.intl.d.ts"], ["es2020.bigint", "lib.es2020.bigint.d.ts"], ["es2020.date", "lib.es2020.date.d.ts"], ["es2020.promise", "lib.es2020.promise.d.ts"], @@ -39852,6 +40097,7 @@ var ts; shortName: "h", type: "boolean", showInSimplifiedHelpView: true, + isCommandLineOnly: true, category: ts.Diagnostics.Command_line_Options, description: ts.Diagnostics.Print_this_message, defaultValueDescription: false, @@ -39860,6 +40106,8 @@ var ts; name: "help", shortName: "?", type: "boolean", + isCommandLineOnly: true, + category: ts.Diagnostics.Command_line_Options, defaultValueDescription: false, }, { @@ -41591,7 +41839,7 @@ var ts; var _a; var rootExpression = (_a = sourceFile.statements[0]) === null || _a === void 0 ? void 0 : _a.expression; var knownRootOptions = reportOptionsErrors ? getTsconfigRootOptionsMap() : undefined; - if (rootExpression && rootExpression.kind !== 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (rootExpression && rootExpression.kind !== 207 /* SyntaxKind.ObjectLiteralExpression */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, rootExpression, ts.Diagnostics.The_root_value_of_a_0_file_must_be_an_object, ts.getBaseFileName(sourceFile.fileName) === "jsconfig.json" ? "jsconfig.json" : "tsconfig.json")); // Last-ditch error recovery. Somewhat useful because the JSON parser will recover from some parse errors by // synthesizing a top-level array literal expression. There's a reasonable chance the first element of that @@ -41631,7 +41879,7 @@ var ts; function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) { var result = returnValue ? {} : undefined; var _loop_4 = function (element) { - if (element.kind !== 296 /* SyntaxKind.PropertyAssignment */) { + if (element.kind !== 299 /* SyntaxKind.PropertyAssignment */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); return "continue"; } @@ -41725,13 +41973,13 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: reportInvalidOptionValue(option && option.type !== "number"); return validateValue(Number(valueExpression.text)); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: if (valueExpression.operator !== 40 /* SyntaxKind.MinusToken */ || valueExpression.operand.kind !== 8 /* SyntaxKind.NumericLiteral */) { break; // not valid JSON syntax } reportInvalidOptionValue(option && option.type !== "number"); return validateValue(-Number(valueExpression.operand.text)); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: reportInvalidOptionValue(option && option.type !== "object"); var objectLiteralExpression = valueExpression; // Currently having element option declaration in the tsconfig with type "object" @@ -41748,7 +41996,7 @@ var ts; return validateValue(convertObjectLiteralExpressionToJson(objectLiteralExpression, /* knownOptions*/ undefined, /*extraKeyDiagnosticMessage */ undefined, /*parentOption*/ undefined)); } - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: reportInvalidOptionValue(option && option.type !== "list"); return validateValue(convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element)); } @@ -42932,7 +43180,7 @@ var ts; function convertCompilerOptionsForTelemetry(opts) { var out = {}; for (var key in opts) { - if (opts.hasOwnProperty(key)) { + if (ts.hasProperty(opts, key)) { var type = getOptionFromName(key); if (type !== undefined) { // Ignore unknown options out[key] = getOptionValueWithEmptyStrings(opts[key], type); @@ -42998,7 +43246,7 @@ var ts; function withPackageId(packageInfo, r) { var packageId; if (r && packageInfo) { - var packageJsonContent = packageInfo.packageJsonContent; + var packageJsonContent = packageInfo.contents.packageJsonContent; if (typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string") { packageId = { name: packageJsonContent.name, @@ -44317,16 +44565,16 @@ var ts; function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson) { if (considerPackageJson === void 0) { considerPackageJson = true; } var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : undefined; - var packageJsonContent = packageInfo && packageInfo.packageJsonContent; - var versionPaths = packageInfo && packageInfo.versionPaths; + var packageJsonContent = packageInfo && packageInfo.contents.packageJsonContent; + var versionPaths = packageInfo && packageInfo.contents.versionPaths; return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths)); } /* @internal */ function getEntrypointsFromPackageJsonInfo(packageJsonInfo, options, host, cache, resolveJs) { - if (!resolveJs && packageJsonInfo.resolvedEntrypoints !== undefined) { + if (!resolveJs && packageJsonInfo.contents.resolvedEntrypoints !== undefined) { // Cached value excludes resolutions to JS files - those could be // cached separately, but they're used rarely. - return packageJsonInfo.resolvedEntrypoints; + return packageJsonInfo.contents.resolvedEntrypoints; } var entrypoints; var extensions = resolveJs ? Extensions.JavaScript : Extensions.TypeScript; @@ -44335,13 +44583,13 @@ var ts; requireState.conditions = ["node", "require", "types"]; requireState.requestContainingDirectory = packageJsonInfo.packageDirectory; var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory, - /*onlyRecordFailures*/ false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths); + /*onlyRecordFailures*/ false, requireState, packageJsonInfo.contents.packageJsonContent, packageJsonInfo.contents.versionPaths); entrypoints = ts.append(entrypoints, requireResolution === null || requireResolution === void 0 ? void 0 : requireResolution.path); - if (features & NodeResolutionFeatures.Exports && packageJsonInfo.packageJsonContent.exports) { + if (features & NodeResolutionFeatures.Exports && packageJsonInfo.contents.packageJsonContent.exports) { for (var _i = 0, _a = [["node", "import", "types"], ["node", "require", "types"]]; _i < _a.length; _i++) { var conditions = _a[_i]; var exportState = __assign(__assign({}, requireState), { failedLookupLocations: [], conditions: conditions }); - var exportResolutions = loadEntrypointsFromExportMap(packageJsonInfo, packageJsonInfo.packageJsonContent.exports, exportState, extensions); + var exportResolutions = loadEntrypointsFromExportMap(packageJsonInfo, packageJsonInfo.contents.packageJsonContent.exports, exportState, extensions); if (exportResolutions) { for (var _b = 0, exportResolutions_1 = exportResolutions; _b < exportResolutions_1.length; _b++) { var resolution = exportResolutions_1[_b]; @@ -44350,7 +44598,7 @@ var ts; } } } - return packageJsonInfo.resolvedEntrypoints = entrypoints || false; + return packageJsonInfo.contents.resolvedEntrypoints = entrypoints || false; } ts.getEntrypointsFromPackageJsonInfo = getEntrypointsFromPackageJsonInfo; function loadEntrypointsFromExportMap(scope, exports, state, extensions) { @@ -44454,7 +44702,9 @@ var ts; if (traceEnabled) trace(host, ts.Diagnostics.File_0_exists_according_to_earlier_cached_lookups, packageJsonPath); state.affectingLocations.push(packageJsonPath); - return existing; + return existing.packageDirectory === packageDirectory ? + existing : + { packageDirectory: packageDirectory, contents: existing.contents }; } else { if (existing && traceEnabled) @@ -44470,7 +44720,7 @@ var ts; trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); } var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state); - var result = { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined }; + var result = { packageDirectory: packageDirectory, contents: { packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined } }; (_b = state.packageJsonInfoCache) === null || _b === void 0 ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result); state.affectingLocations.push(packageJsonPath); return result; @@ -44595,17 +44845,16 @@ var ts; } function loadModuleFromSelfNameReference(extensions, moduleName, directory, state, cache, redirectedReference) { var _a, _b; - var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames; - var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames)); + var directoryPath = ts.getNormalizedAbsolutePath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)); var scope = getPackageScopeForPath(directoryPath, state); - if (!scope || !scope.packageJsonContent.exports) { + if (!scope || !scope.contents.packageJsonContent.exports) { return undefined; } - if (typeof scope.packageJsonContent.name !== "string") { + if (typeof scope.contents.packageJsonContent.name !== "string") { return undefined; } var parts = ts.getPathComponents(moduleName); // unrooted paths should have `""` as their 0th entry - var nameParts = ts.getPathComponents(scope.packageJsonContent.name); + var nameParts = ts.getPathComponents(scope.contents.packageJsonContent.name); if (!ts.every(nameParts, function (p, i) { return parts[i] === p; })) { return undefined; } @@ -44613,30 +44862,30 @@ var ts; return loadModuleFromExports(scope, extensions, !ts.length(trailingParts) ? "." : ".".concat(ts.directorySeparator).concat(trailingParts.join(ts.directorySeparator)), state, cache, redirectedReference); } function loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference) { - if (!scope.packageJsonContent.exports) { + if (!scope.contents.packageJsonContent.exports) { return undefined; } if (subpath === ".") { var mainExport = void 0; - if (typeof scope.packageJsonContent.exports === "string" || Array.isArray(scope.packageJsonContent.exports) || (typeof scope.packageJsonContent.exports === "object" && noKeyStartsWithDot(scope.packageJsonContent.exports))) { - mainExport = scope.packageJsonContent.exports; + if (typeof scope.contents.packageJsonContent.exports === "string" || Array.isArray(scope.contents.packageJsonContent.exports) || (typeof scope.contents.packageJsonContent.exports === "object" && noKeyStartsWithDot(scope.contents.packageJsonContent.exports))) { + mainExport = scope.contents.packageJsonContent.exports; } - else if (ts.hasProperty(scope.packageJsonContent.exports, ".")) { - mainExport = scope.packageJsonContent.exports["."]; + else if (ts.hasProperty(scope.contents.packageJsonContent.exports, ".")) { + mainExport = scope.contents.packageJsonContent.exports["."]; } if (mainExport) { var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, subpath, scope, /*isImports*/ false); return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false); } } - else if (allKeysStartWithDot(scope.packageJsonContent.exports)) { - if (typeof scope.packageJsonContent.exports !== "object") { + else if (allKeysStartWithDot(scope.contents.packageJsonContent.exports)) { + if (typeof scope.contents.packageJsonContent.exports !== "object") { if (state.traceEnabled) { trace(state.host, ts.Diagnostics.Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1, subpath, scope.packageDirectory); } return toSearchResult(/*value*/ undefined); } - var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, subpath, scope.packageJsonContent.exports, scope, /*isImports*/ false); + var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, subpath, scope.contents.packageJsonContent.exports, scope, /*isImports*/ false); if (result) { return result; } @@ -44654,8 +44903,7 @@ var ts; } return toSearchResult(/*value*/ undefined); } - var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames; - var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames)); + var directoryPath = ts.getNormalizedAbsolutePath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)); var scope = getPackageScopeForPath(directoryPath, state); if (!scope) { if (state.traceEnabled) { @@ -44663,13 +44911,13 @@ var ts; } return toSearchResult(/*value*/ undefined); } - if (!scope.packageJsonContent.imports) { + if (!scope.contents.packageJsonContent.imports) { if (state.traceEnabled) { trace(state.host, ts.Diagnostics.package_json_scope_0_has_no_imports_defined, scope.packageDirectory); } return toSearchResult(/*value*/ undefined); } - var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, scope.packageJsonContent.imports, scope, /*isImports*/ true); + var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, scope.contents.packageJsonContent.imports, scope, /*isImports*/ true); if (result) { return result; } @@ -45014,7 +45262,7 @@ var ts; if (fromFile) { return noPackageId(fromFile); } - var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.packageJsonContent, packageInfo.versionPaths); + var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.contents.packageJsonContent, packageInfo.contents.versionPaths); return withPackageId(packageInfo, fromDirectory); } } @@ -45022,14 +45270,14 @@ var ts; 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.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { + 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.packageJsonContent, packageInfo && packageInfo.versionPaths); + loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths); if (!pathAndExtension && packageInfo // eslint-disable-next-line no-null/no-null - && (packageInfo.packageJsonContent.exports === undefined || packageInfo.packageJsonContent.exports === null) + && (packageInfo.contents.packageJsonContent.exports === undefined || packageInfo.contents.packageJsonContent.exports === null) && state.features & NodeResolutionFeatures.EsmMode) { // EsmMode disables index lookup in `loadNodeModuleFromDirectoryWorker` generally, however non-relative package resolutions still assume // a default `index.js` entrypoint if no `main` or `exports` are present @@ -45041,12 +45289,12 @@ var ts; 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. packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state); - if (packageInfo && packageInfo.versionPaths) { + 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.versionPaths.version, ts.version, rest); + 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.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); + var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); if (fromPaths) { return fromPaths.value; } @@ -45259,26 +45507,26 @@ var ts; // A module is uninstantiated if it contains only switch (node.kind) { // 1. interface declarations, type alias declarations - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return 0 /* ModuleInstanceState.NonInstantiated */; // 2. const enum declarations - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (ts.isEnumConst(node)) { return 2 /* ModuleInstanceState.ConstEnumOnly */; } break; // 3. non-exported import declarations - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: if (!(ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */))) { return 0 /* ModuleInstanceState.NonInstantiated */; } break; // 4. Export alias declarations pointing at only uninstantiated modules or things uninstantiated modules contain - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportDeclaration = node; - if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 273 /* SyntaxKind.NamedExports */) { + if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 276 /* SyntaxKind.NamedExports */) { var state = 0 /* ModuleInstanceState.NonInstantiated */; for (var _i = 0, _a = exportDeclaration.exportClause.elements; _i < _a.length; _i++) { var specifier = _a[_i]; @@ -45294,7 +45542,7 @@ var ts; } break; // 5. other uninstantiated module declarations. - case 262 /* SyntaxKind.ModuleBlock */: { + case 265 /* SyntaxKind.ModuleBlock */: { var state_1 = 0 /* ModuleInstanceState.NonInstantiated */; ts.forEachChild(node, function (n) { var childState = getModuleInstanceStateCached(n, visited); @@ -45316,7 +45564,7 @@ var ts; }); return state_1; } - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return getModuleInstanceState(node, visited); case 79 /* SyntaxKind.Identifier */: // Only jsdoc typedef definition can exist in jsdoc namespace, and it should @@ -45517,7 +45765,7 @@ var ts; // Should not be called on a declaration with a computed property name, // unless it is a well known Symbol. function getDeclarationName(node) { - if (node.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (node.kind === 274 /* SyntaxKind.ExportAssignment */) { return node.isExportEquals ? "export=" /* InternalSymbolName.ExportEquals */ : "default" /* InternalSymbolName.Default */; } var name = ts.getNameOfDeclaration(node); @@ -45526,7 +45774,7 @@ var ts; var moduleName = ts.getTextOfIdentifierOrLiteral(name); return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"".concat(moduleName, "\"")); } - if (name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { var nameExpression = name.expression; // treat computed property names where expression is string/numeric literal as just string/numeric literal if (ts.isStringOrNumericLiteralLike(nameExpression)) { @@ -45552,36 +45800,36 @@ var ts; return ts.isPropertyNameLiteral(name) ? ts.getEscapedTextOfIdentifierOrLiteral(name) : undefined; } switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "__constructor" /* InternalSymbolName.Constructor */; - case 179 /* SyntaxKind.FunctionType */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: return "__call" /* InternalSymbolName.Call */; - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return "__new" /* InternalSymbolName.New */; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return "__index" /* InternalSymbolName.Index */; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return "__export" /* InternalSymbolName.ExportStar */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // json file should behave as // module.exports = ... return "export=" /* InternalSymbolName.ExportEquals */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */) { // module.exports = ... return "export=" /* InternalSymbolName.ExportEquals */; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return (ts.isJSDocConstructSignature(node) ? "__new" /* InternalSymbolName.New */ : "__call" /* InternalSymbolName.Call */); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Parameters with names are handled at the top of this function. Parameters // without names can only come from JSDocFunctionTypes. - ts.Debug.assert(node.parent.kind === 317 /* SyntaxKind.JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); }); + ts.Debug.assert(node.parent.kind === 320 /* SyntaxKind.JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); }); var functionType = node.parent; var index = functionType.parameters.indexOf(node); return "arg" + index; @@ -45600,7 +45848,7 @@ var ts; */ function declareSymbol(symbolTable, parent, node, includes, excludes, isReplaceableByMethod, isComputedName) { ts.Debug.assert(isComputedName || !ts.hasDynamicName(node)); - var isDefaultExport = ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) || ts.isExportSpecifier(node) && node.name.escapedText === "default"; + var isDefaultExport = ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) || ts.isExportSpecifier(node) && node.name.escapedText === "default"; // The exported symbol for an export default function/class node is always named "default" var name = isComputedName ? "__computed" /* InternalSymbolName.Computed */ : isDefaultExport && parent ? "default" /* InternalSymbolName.Default */ @@ -45683,7 +45931,7 @@ var ts; // 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default // 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers) if (symbol.declarations && symbol.declarations.length && - (node.kind === 271 /* SyntaxKind.ExportAssignment */ && !node.isExportEquals)) { + (node.kind === 274 /* SyntaxKind.ExportAssignment */ && !node.isExportEquals)) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; messageNeedsName_1 = false; multipleDefaultExports_1 = true; @@ -45722,7 +45970,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = !!(ts.getCombinedModifierFlags(node) & 1 /* ModifierFlags.Export */) || jsdocTreatAsExported(node); if (symbolFlags & 2097152 /* SymbolFlags.Alias */) { - if (node.kind === 275 /* SyntaxKind.ExportSpecifier */ || (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 278 /* SyntaxKind.ExportSpecifier */ || (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -45747,7 +45995,7 @@ var ts; if (ts.isJSDocTypeAlias(node)) ts.Debug.assert(ts.isInJSFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file. if (!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 64 /* NodeFlags.ExportContext */)) { - if (!container.locals || (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) && !getDeclarationName(node))) { + if (!container.locals || (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) && !getDeclarationName(node))) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); // No local symbol for an unnamed default! } var exportKind = symbolFlags & 111551 /* SymbolFlags.Value */ ? 1048576 /* SymbolFlags.ExportValue */ : 0; @@ -45811,7 +46059,7 @@ var ts; // for it. We must clear this so we don't accidentally move any stale data forward from // a previous compilation. if (containerFlags & 1 /* ContainerFlags.IsContainer */) { - if (node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind !== 216 /* SyntaxKind.ArrowFunction */) { thisParentContainer = container; } container = blockScopeContainer = node; @@ -45833,10 +46081,10 @@ var ts; var saveActiveLabelList = activeLabelList; var saveHasExplicitReturn = hasExplicitReturn; var isImmediatelyInvoked = (containerFlags & 16 /* ContainerFlags.IsFunctionExpression */ && - !ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Async */) && + !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Async */) && !node.asteriskToken && !!ts.getImmediatelyInvokedFunctionExpression(node)) || - node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; // A non-async, non-generator IIFE is considered part of the containing control flow. Return statements behave // similarly to break statements that exit to a label just past the statement body. if (!isImmediatelyInvoked) { @@ -45847,7 +46095,7 @@ var ts; } // We create a return control flow graph for IIFEs and constructors. For constructors // we use the return control flow graph in strict property initialization checks. - currentReturnTarget = isImmediatelyInvoked || node.kind === 171 /* SyntaxKind.Constructor */ || (ts.isInJSFile(node) && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */)) ? createBranchLabel() : undefined; + currentReturnTarget = isImmediatelyInvoked || node.kind === 173 /* SyntaxKind.Constructor */ || (ts.isInJSFile(node) && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */)) ? createBranchLabel() : undefined; currentExceptionTarget = undefined; currentBreakTarget = undefined; currentContinueTarget = undefined; @@ -45862,14 +46110,14 @@ var ts; node.flags |= 512 /* NodeFlags.HasExplicitReturn */; node.endFlowNode = currentFlow; } - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { node.flags |= emitFlags; node.endFlowNode = currentFlow; } if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); currentFlow = finishFlowLabel(currentReturnTarget); - if (node.kind === 171 /* SyntaxKind.Constructor */ || node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ || (ts.isInJSFile(node) && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */))) { + if (node.kind === 173 /* SyntaxKind.Constructor */ || node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ || (ts.isInJSFile(node) && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */))) { node.returnFlowNode = currentFlow; } } @@ -45896,8 +46144,8 @@ var ts; blockScopeContainer = savedBlockScopeContainer; } function bindEachFunctionsFirst(nodes) { - bindEach(nodes, function (n) { return n.kind === 256 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); - bindEach(nodes, function (n) { return n.kind !== 256 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind === 259 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind !== 259 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); } function bindEach(nodes, bindFunction) { if (bindFunction === void 0) { bindFunction = bind; } @@ -45920,59 +46168,59 @@ var ts; inAssignmentPattern = saveInAssignmentPattern; return; } - if (node.kind >= 237 /* SyntaxKind.FirstStatement */ && node.kind <= 253 /* SyntaxKind.LastStatement */ && !options.allowUnreachableCode) { + if (node.kind >= 240 /* SyntaxKind.FirstStatement */ && node.kind <= 256 /* SyntaxKind.LastStatement */ && !options.allowUnreachableCode) { node.flowNode = currentFlow; } switch (node.kind) { - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: bindWhileStatement(node); break; - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: bindDoStatement(node); break; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: bindForStatement(node); break; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: bindForInOrForOfStatement(node); break; - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: bindIfStatement(node); break; - case 247 /* SyntaxKind.ReturnStatement */: - case 251 /* SyntaxKind.ThrowStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 254 /* SyntaxKind.ThrowStatement */: bindReturnOrThrow(node); break; - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: bindTryStatement(node); break; - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: bindSwitchStatement(node); break; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: bindCaseBlock(node); break; - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: bindCaseClause(node); break; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: bindExpressionStatement(node); break; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: bindLabeledStatement(node); break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: bindPrefixUnaryExpressionFlow(node); break; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: bindPostfixUnaryExpressionFlow(node); break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { // Carry over whether we are in an assignment pattern to // binary expressions that could actually be an initializer @@ -45982,47 +46230,50 @@ var ts; } bindBinaryExpressionFlow(node); break; - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: bindDeleteExpressionFlow(node); break; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: bindConditionalExpressionFlow(node); break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: bindVariableDeclarationFlow(node); break; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: bindAccessExpressionFlow(node); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: bindCallExpressionFlow(node); break; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: bindNonNullExpressionFlow(node); break; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: bindJSDocTypeAlias(node); break; // In source files and blocks, bind functions first to match hoisting that occurs at runtime - case 305 /* SyntaxKind.SourceFile */: { + case 308 /* SyntaxKind.SourceFile */: { bindEachFunctionsFirst(node.statements); bind(node.endOfFileToken); break; } - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: bindEachFunctionsFirst(node.statements); break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: bindBindingElementFlow(node); break; - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 225 /* SyntaxKind.SpreadElement */: + case 166 /* SyntaxKind.Parameter */: + bindParameterFlow(node); + break; + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 227 /* SyntaxKind.SpreadElement */: // Carry over whether we are in an assignment pattern of Object and Array literals // as well as their children that are valid assignment targets. inAssignmentPattern = saveInAssignmentPattern; @@ -46039,19 +46290,19 @@ var ts; case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: case 108 /* SyntaxKind.ThisKeyword */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return containsNarrowableReference(expr); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return hasNarrowableArgument(expr); - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return isNarrowingExpression(expr.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isNarrowingBinaryExpression(expr); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 53 /* SyntaxKind.ExclamationToken */ && isNarrowingExpression(expr.operand); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return isNarrowingExpression(expr.expression); } return false; @@ -46075,7 +46326,7 @@ var ts; } } } - if (expr.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + if (expr.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && containsNarrowableReference(expr.expression.expression)) { return true; } @@ -46108,9 +46359,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isNarrowableOperand(expr.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (expr.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: return isNarrowableOperand(expr.left); @@ -46186,26 +46437,26 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: return parent.expression === node; - case 242 /* SyntaxKind.ForStatement */: - case 222 /* SyntaxKind.ConditionalExpression */: + case 245 /* SyntaxKind.ForStatement */: + case 224 /* SyntaxKind.ConditionalExpression */: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (node.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { node = node.expression; } - else if (node.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && node.operator === 53 /* SyntaxKind.ExclamationToken */) { + else if (node.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && node.operator === 53 /* SyntaxKind.ExclamationToken */) { node = node.operand; } else { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ || node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */); } @@ -46251,7 +46502,7 @@ var ts; } function setContinueTarget(node, target) { var label = activeLabelList; - while (label && node.parent.kind === 250 /* SyntaxKind.LabeledStatement */) { + while (label && node.parent.kind === 253 /* SyntaxKind.LabeledStatement */) { label.continueTarget = target; label = label.next; node = node.parent; @@ -46302,12 +46553,12 @@ var ts; bind(node.expression); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; - if (node.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.kind === 247 /* SyntaxKind.ForOfStatement */) { bind(node.awaitModifier); } addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -46329,7 +46580,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 247 /* SyntaxKind.ReturnStatement */) { + if (node.kind === 250 /* SyntaxKind.ReturnStatement */) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -46346,7 +46597,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 246 /* SyntaxKind.BreakStatement */ ? breakTarget : continueTarget; + var flowLabel = node.kind === 249 /* SyntaxKind.BreakStatement */ ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -46451,7 +46702,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 290 /* SyntaxKind.DefaultClause */; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 293 /* SyntaxKind.DefaultClause */; }); // We mark a switch statement as possibly exhaustive if it has no default clause and if all // case clauses have unreachable end points (e.g. they all return). Note, we no longer need // this property in control flow analysis, it's there only for backwards compatibility. @@ -46499,7 +46750,7 @@ var ts; function maybeBindExpressionFlowIfCall(node) { // A top level or comma expression call expression with a dotted function name and at least one argument // is potentially an assertion and is therefore included in the control flow. - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { var call = node; if (call.expression.kind !== 106 /* SyntaxKind.SuperKeyword */ && ts.isDottedName(call.expression)) { currentFlow = createFlowCall(currentFlow, call); @@ -46525,7 +46776,7 @@ var ts; currentFlow = finishFlowLabel(postStatementLabel); } function bindDestructuringTargetFlow(node) { - if (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { bindAssignmentTargetFlow(node.left); } else { @@ -46536,10 +46787,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowMutation(16 /* FlowFlags.Assignment */, currentFlow, node); } - else if (node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */) { + else if (node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 225 /* SyntaxKind.SpreadElement */) { + if (e.kind === 227 /* SyntaxKind.SpreadElement */) { bindAssignmentTargetFlow(e.expression); } else { @@ -46547,16 +46798,16 @@ var ts; } } } - else if (node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + else if (node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (p.kind === 299 /* SyntaxKind.PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + else if (p.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (p.kind === 301 /* SyntaxKind.SpreadAssignment */) { bindAssignmentTargetFlow(p.expression); } } @@ -46693,7 +46944,7 @@ var ts; var operator = node.operatorToken.kind; if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 63 /* SyntaxKind.EqualsToken */ && node.left.kind === 207 /* SyntaxKind.ElementAccessExpression */) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && node.left.kind === 209 /* SyntaxKind.ElementAccessExpression */) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowMutation(256 /* FlowFlags.ArrayMutation */, currentFlow, node); @@ -46721,7 +46972,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { bindAssignmentTargetFlow(node.expression); } } @@ -46759,24 +47010,42 @@ var ts; } } function bindBindingElementFlow(node) { - if (ts.isBindingPattern(node.name)) { - // When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per: - // - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization - // - `BindingElement: BindingPattern Initializer?` - // - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization - // - `BindingElement: BindingPattern Initializer?` - bind(node.dotDotDotToken); - bind(node.propertyName); - bind(node.initializer); - bind(node.name); + // When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per: + // - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization + // - `BindingElement: BindingPattern Initializer?` + // - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization + // - `BindingElement: BindingPattern Initializer?` + bind(node.dotDotDotToken); + bind(node.propertyName); + bindInitializer(node.initializer); + bind(node.name); + } + function bindParameterFlow(node) { + bindEach(node.modifiers); + bind(node.dotDotDotToken); + bind(node.questionToken); + bind(node.type); + bindInitializer(node.initializer); + bind(node.name); + } + // a BindingElement/Parameter does not have side effects if initializers are not evaluated and used. (see GH#49759) + function bindInitializer(node) { + if (!node) { + return; } - else { - bindEachChild(node); + var entryFlow = currentFlow; + bind(node); + if (entryFlow === unreachableFlow || entryFlow === currentFlow) { + return; } + var exitFlow = createBranchLabel(); + addAntecedent(exitFlow, entryFlow); + addAntecedent(exitFlow, currentFlow); + currentFlow = finishFlowLabel(exitFlow); } function bindJSDocTypeAlias(node) { bind(node.tagName); - if (node.kind !== 339 /* SyntaxKind.JSDocEnumTag */ && node.fullName) { + if (node.kind !== 342 /* SyntaxKind.JSDocEnumTag */ && node.fullName) { // don't bind the type name yet; that's delayed until delayedBindJSDocTypedefTag ts.setParent(node.fullName, node); ts.setParentRecursive(node.fullName, /*incremental*/ false); @@ -46788,7 +47057,7 @@ var ts; function bindJSDocClassTag(node) { bindEachChild(node); var host = ts.getHostSignatureFromJSDoc(node); - if (host && host.kind !== 169 /* SyntaxKind.MethodDeclaration */) { + if (host && host.kind !== 171 /* SyntaxKind.MethodDeclaration */) { addDeclarationToSymbol(host.symbol, host, 32 /* SymbolFlags.Class */); } } @@ -46801,15 +47070,15 @@ var ts; } function bindOptionalChainRest(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: bind(node.questionDotToken); bind(node.name); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: bind(node.questionDotToken); bind(node.argumentExpression); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: bind(node.questionDotToken); bindEach(node.typeArguments); bindEach(node.arguments); @@ -46874,7 +47143,7 @@ var ts; // an immediately invoked function expression (IIFE). Initialize the flowNode property to // the current control flow (which includes evaluation of the IIFE arguments). var expr = ts.skipParentheses(node.expression); - if (expr.kind === 213 /* SyntaxKind.FunctionExpression */ || expr.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (expr.kind === 215 /* SyntaxKind.FunctionExpression */ || expr.kind === 216 /* SyntaxKind.ArrowFunction */) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -46886,7 +47155,7 @@ var ts; } } } - if (node.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var propertyAccess = node.expression; if (ts.isIdentifier(propertyAccess.name) && isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowMutation(256 /* FlowFlags.ArrayMutation */, currentFlow, node); @@ -46895,55 +47164,55 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 286 /* SyntaxKind.JsxAttributes */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 289 /* SyntaxKind.JsxAttributes */: return 1 /* ContainerFlags.IsContainer */; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return 1 /* ContainerFlags.IsContainer */ | 64 /* ContainerFlags.IsInterface */; - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 195 /* SyntaxKind.MappedType */: - case 176 /* SyntaxKind.IndexSignature */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 197 /* SyntaxKind.MappedType */: + case 178 /* SyntaxKind.IndexSignature */: return 1 /* ContainerFlags.IsContainer */ | 32 /* ContainerFlags.HasLocals */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: if (ts.isObjectLiteralOrClassExpressionMethodOrAccessor(node)) { return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */ | 128 /* ContainerFlags.IsObjectLiteralOrClassExpressionMethodOrAccessor */; } // falls through - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 179 /* SyntaxKind.FunctionType */: - case 175 /* SyntaxKind.ConstructSignature */: - case 180 /* SyntaxKind.ConstructorType */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 181 /* SyntaxKind.FunctionType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */ | 16 /* ContainerFlags.IsFunctionExpression */; - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return 4 /* ContainerFlags.IsControlFlowContainer */; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return node.initializer ? 4 /* ContainerFlags.IsControlFlowContainer */ : 0; - case 292 /* SyntaxKind.CatchClause */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 263 /* SyntaxKind.CaseBlock */: + case 295 /* SyntaxKind.CatchClause */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 266 /* SyntaxKind.CaseBlock */: return 2 /* ContainerFlags.IsBlockScopedContainer */; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: // do not treat blocks directly inside a function as a block-scoped-container. // Locals that reside in this block should go to the function locals. Otherwise 'x' // would not appear to be a redeclaration of a block scoped local in the following @@ -46976,46 +47245,46 @@ var ts; // members are declared (for example, a member of a class will go into a specific // symbol table depending on if it is static or not). We defer to specialized // handlers to take care of declaring these child members. - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 286 /* SyntaxKind.JsxAttributes */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 289 /* SyntaxKind.JsxAttributes */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the // object / type / interface declaring them). An exception is type parameters, // which are in scope without qualification (similar to 'locals'). return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 195 /* SyntaxKind.MappedType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 197 /* SyntaxKind.MappedType */: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, // they're only accessed 'lexically' (i.e. from code that exists underneath @@ -47123,10 +47392,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (ts.isExternalOrCommonJsModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -47223,7 +47492,7 @@ var ts; node.originalKeywordKind <= 125 /* SyntaxKind.LastFutureReservedWord */) { file.bindDiagnostics.push(createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); } - else if (node.originalKeywordKind === 132 /* SyntaxKind.AwaitKeyword */) { + else if (node.originalKeywordKind === 133 /* SyntaxKind.AwaitKeyword */) { if (ts.isExternalModule(file) && ts.isInTopLevelContext(node)) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module, ts.declarationNameToString(node))); } @@ -47325,8 +47594,8 @@ var ts; function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { // Report error if function is not top level function declaration - if (blockScopeContainer.kind !== 305 /* SyntaxKind.SourceFile */ && - blockScopeContainer.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && + if (blockScopeContainer.kind !== 308 /* SyntaxKind.SourceFile */ && + blockScopeContainer.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isFunctionLikeOrClassStaticBlockDeclaration(blockScopeContainer)) { // We check first if the name is inside class declaration or class expression; if so give explicit message // otherwise report generic error message. @@ -47423,7 +47692,7 @@ var ts; // the current 'container' node when it changes. This helps us know which symbol table // a local should go into for example. Since terminal nodes are known not to have // children, as an optimization we don't process those. - if (node.kind > 160 /* SyntaxKind.LastToken */) { + if (node.kind > 162 /* SyntaxKind.LastToken */) { var saveParent = parent; parent = node; var containerFlags = getContainerFlags(node); @@ -47499,23 +47768,23 @@ var ts; } // falls through case 108 /* SyntaxKind.ThisKeyword */: - if (currentFlow && (ts.isExpression(node) || parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkContextualIdentifier(node); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: if (currentFlow && ts.isPartOfTypeQuery(node)) { node.flowNode = currentFlow; } break; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: case 106 /* SyntaxKind.SuperKeyword */: node.flowNode = currentFlow; break; case 80 /* SyntaxKind.PrivateIdentifier */: return checkPrivateIdentifier(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = node; if (currentFlow && isNarrowableReference(expr)) { expr.flowNode = currentFlow; @@ -47530,7 +47799,7 @@ var ts; declareSymbol(file.locals, /*parent*/ undefined, expr.expression, 1 /* SymbolFlags.FunctionScopedVariable */ | 134217728 /* SymbolFlags.ModuleExports */, 111550 /* SymbolFlags.FunctionScopedVariableExcludes */); } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var specialKind = ts.getAssignmentDeclarationKind(node); switch (specialKind) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -47566,78 +47835,78 @@ var ts; ts.Debug.fail("Unknown binary expression special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return checkStrictModeCatchClause(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return checkStrictModeDeleteExpression(node); case 8 /* SyntaxKind.NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return checkStrictModeWithStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return checkStrictModeLabeledStatement(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: seenThisKeyword = true; return; - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: break; // Binding the children will handle everything - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return bindTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return bindParameter(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return bindVariableDeclarationOrBindingElement(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: node.flowNode = currentFlow; return bindVariableDeclarationOrBindingElement(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return bindPropertyWorker(node); - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* SymbolFlags.Property */, 0 /* SymbolFlags.PropertyExcludes */); - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* SymbolFlags.EnumMember */, 900095 /* SymbolFlags.EnumMemberExcludes */); - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* SymbolFlags.Signature */, 0 /* SymbolFlags.None */); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: // If this is an ObjectLiteralExpression method, then it sits in the same space // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes // so that it will conflict with any other object literal members with the same // name. return bindPropertyOrMethodOrAccessor(node, 8192 /* SymbolFlags.Method */ | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), ts.isObjectLiteralMethod(node) ? 0 /* SymbolFlags.PropertyExcludes */ : 103359 /* SymbolFlags.MethodExcludes */); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return bindFunctionDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* SymbolFlags.Constructor */, /*symbolExcludes:*/ 0 /* SymbolFlags.None */); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* SymbolFlags.GetAccessor */, 46015 /* SymbolFlags.GetAccessorExcludes */); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SymbolFlags.SetAccessor */, 78783 /* SymbolFlags.SetAccessorExcludes */); - case 179 /* SyntaxKind.FunctionType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 323 /* SyntaxKind.JSDocSignature */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 326 /* SyntaxKind.JSDocSignature */: + case 182 /* SyntaxKind.ConstructorType */: return bindFunctionOrConstructorType(node); - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 195 /* SyntaxKind.MappedType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 197 /* SyntaxKind.MappedType */: return bindAnonymousTypeWorker(node); - case 332 /* SyntaxKind.JSDocClassTag */: + case 335 /* SyntaxKind.JSDocClassTag */: return bindJSDocClassTag(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return bindFunctionExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: var assignmentKind = ts.getAssignmentDeclarationKind(node); switch (assignmentKind) { case 7 /* AssignmentDeclarationKind.ObjectDefinePropertyValue */: @@ -47656,70 +47925,73 @@ var ts; } break; // Members of classes, interfaces, and modules - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return bindClassLikeDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* SymbolFlags.Interface */, 788872 /* SymbolFlags.InterfaceExcludes */); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* SymbolFlags.TypeAlias */, 788968 /* SymbolFlags.TypeAliasExcludes */); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return bindEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return bindModuleDeclaration(node); // Jsx-attributes - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return bindJsxAttributes(node); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return bindJsxAttribute(node, 4 /* SymbolFlags.Property */, 0 /* SymbolFlags.PropertyExcludes */); // Imports and exports - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 2097152 /* SymbolFlags.Alias */, 2097152 /* SymbolFlags.AliasExcludes */); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return bindNamespaceExportDeclaration(node); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return bindImportClause(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return bindExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return bindExportAssignment(node); - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (!ts.isFunctionLikeOrClassStaticBlockDeclaration(node.parent)) { return; } // falls through - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return updateStrictModeStatementList(node.statements); - case 340 /* SyntaxKind.JSDocParameterTag */: - if (node.parent.kind === 323 /* SyntaxKind.JSDocSignature */) { + case 343 /* SyntaxKind.JSDocParameterTag */: + if (node.parent.kind === 326 /* SyntaxKind.JSDocSignature */) { return bindParameter(node); } - if (node.parent.kind !== 322 /* SyntaxKind.JSDocTypeLiteral */) { + if (node.parent.kind !== 325 /* SyntaxKind.JSDocTypeLiteral */) { break; } // falls through - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: var propTag = node; - var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */ ? + var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */ ? 4 /* SymbolFlags.Property */ | 16777216 /* SymbolFlags.Optional */ : 4 /* SymbolFlags.Property */; return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* SymbolFlags.PropertyExcludes */); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return (delayedTypeAliases || (delayedTypeAliases = [])).push(node); } } function bindPropertyWorker(node) { - return bindPropertyOrMethodOrAccessor(node, 4 /* SymbolFlags.Property */ | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), 0 /* SymbolFlags.PropertyExcludes */); + var isAutoAccessor = ts.isAutoAccessorPropertyDeclaration(node); + var includes = isAutoAccessor ? 98304 /* SymbolFlags.Accessor */ : 4 /* SymbolFlags.Property */; + var excludes = isAutoAccessor ? 13247 /* SymbolFlags.AccessorExcludes */ : 0 /* SymbolFlags.PropertyExcludes */; + return bindPropertyOrMethodOrAccessor(node, includes | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), excludes); } function bindAnonymousTypeWorker(node) { return bindAnonymousDeclaration(node, 2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */); @@ -47879,8 +48151,8 @@ var ts; } var thisContainer = ts.getThisContainer(node, /*includeArrowFunctions*/ false); switch (thisContainer.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: var constructorSymbol = thisContainer.symbol; // For `f.prototype.m = function() { this.x = 0; }`, `this.x = 0` should modify `f`'s members, not the function expression. if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { @@ -47902,12 +48174,12 @@ var ts; addDeclarationToSymbol(constructorSymbol, constructorSymbol.valueDeclaration, 32 /* SymbolFlags.Class */); } break; - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // this.foo assignment in a JavaScript class // Bind this property to the containing class var containingClass = thisContainer.parent; @@ -47919,7 +48191,7 @@ var ts; declareSymbol(symbolTable, containingClass.symbol, node, 4 /* SymbolFlags.Property */ | 67108864 /* SymbolFlags.Assignment */, 0 /* SymbolFlags.None */, /*isReplaceableByMethod*/ true); } break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // this.property = assignment in a source file -- declare symbol in exports for a module, in locals for a script if (ts.hasDynamicName(node)) { break; @@ -47948,7 +48220,7 @@ var ts; if (node.expression.kind === 108 /* SyntaxKind.ThisKeyword */) { bindThisPropertyAssignment(node); } - else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 308 /* SyntaxKind.SourceFile */) { if (ts.isPrototypeAccess(node.expression)) { bindPrototypePropertyAssignment(node, node.parent); } @@ -47988,7 +48260,7 @@ var ts; } function bindObjectDefinePropertyAssignment(node) { var namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0]); - var isToplevel = node.parent.parent.kind === 305 /* SyntaxKind.SourceFile */; + var isToplevel = node.parent.parent.kind === 308 /* SyntaxKind.SourceFile */; namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, node.arguments[0], isToplevel, /*isPrototypeProperty*/ false, /*containerIsClass*/ false); bindPotentiallyNewExpandoMemberToNamespace(node, namespaceSymbol, /*isPrototypeProperty*/ false); } @@ -48097,8 +48369,8 @@ var ts; } function isTopLevelNamespaceAssignment(propertyAccess) { return ts.isBinaryExpression(propertyAccess.parent) - ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 305 /* SyntaxKind.SourceFile */ - : propertyAccess.parent.parent.kind === 305 /* SyntaxKind.SourceFile */; + ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 308 /* SyntaxKind.SourceFile */ + : propertyAccess.parent.parent.kind === 308 /* SyntaxKind.SourceFile */; } function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty, containerIsClass) { var namespaceSymbol = lookupSymbolForPropertyAccess(name, container) || lookupSymbolForPropertyAccess(name, blockScopeContainer); @@ -48177,7 +48449,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 257 /* SyntaxKind.ClassDeclaration */) { + if (node.kind === 260 /* SyntaxKind.ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* SymbolFlags.Class */, 899503 /* SymbolFlags.ClassExcludes */); } else { @@ -48219,7 +48491,7 @@ var ts; checkStrictModeEvalOrArguments(node, node.name); } if (!ts.isBindingPattern(node.name)) { - var possibleVariableDecl = node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? node : node.parent.parent; + var possibleVariableDecl = node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? node : node.parent.parent; if (ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !ts.getJSDocTypeTag(node) && @@ -48247,7 +48519,7 @@ var ts; } } function bindParameter(node) { - if (node.kind === 340 /* SyntaxKind.JSDocParameterTag */ && container.kind !== 323 /* SyntaxKind.JSDocSignature */) { + if (node.kind === 343 /* SyntaxKind.JSDocParameterTag */ && container.kind !== 326 /* SyntaxKind.JSDocSignature */) { return; } if (inStrictMode && !(node.flags & 16777216 /* NodeFlags.Ambient */)) { @@ -48324,7 +48596,7 @@ var ts; declareSymbolAndAddToSymbolTable(node, 262144 /* SymbolFlags.TypeParameter */, 526824 /* SymbolFlags.TypeParameterExcludes */); } } - else if (node.parent.kind === 190 /* SyntaxKind.InferType */) { + else if (node.parent.kind === 192 /* SyntaxKind.InferType */) { var container_2 = getInferTypeContainer(node.parent); if (container_2) { if (!container_2.locals) { @@ -48352,11 +48624,11 @@ var ts; if (currentFlow === unreachableFlow) { var reportError = // report error on all statements except empty ones - (ts.isStatementButNotDeclaration(node) && node.kind !== 236 /* SyntaxKind.EmptyStatement */) || + (ts.isStatementButNotDeclaration(node) && node.kind !== 239 /* SyntaxKind.EmptyStatement */) || // report error on class declarations - node.kind === 257 /* SyntaxKind.ClassDeclaration */ || + node.kind === 260 /* SyntaxKind.ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)); + (node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)); if (reportError) { currentFlow = reportedUnreachableFlow; if (!options.allowUnreachableCode) { @@ -48400,12 +48672,12 @@ var ts; } function isPurelyTypeDeclaration(s) { switch (s.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return getModuleInstanceState(s) !== 1 /* ModuleInstanceState.Instantiated */; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.hasSyntacticModifier(s, 2048 /* ModifierFlags.Const */); default: return false; @@ -48606,7 +48878,7 @@ var ts; // (their type resolved directly to the member deeply referenced) // So to get the intervening symbols, we need to check if there's a type // query node on any of the symbol's declarations and get symbols there - if (d.type && d.type.kind === 181 /* SyntaxKind.TypeQuery */) { + if (d.type && d.type.kind === 183 /* SyntaxKind.TypeQuery */) { var query = d.type; var entity = getResolvedSymbol(getFirstIdentifier(query.exprName)); visitSymbol(entity); @@ -49017,6 +49289,7 @@ var ts; getTypeOfPropertyOfType: function (type, name) { return getTypeOfPropertyOfType(type, ts.escapeLeadingUnderscores(name)); }, getIndexInfoOfType: function (type, kind) { return getIndexInfoOfType(type, kind === 0 /* IndexKind.String */ ? stringType : numberType); }, getIndexInfosOfType: getIndexInfosOfType, + getIndexInfosOfIndexSymbol: getIndexInfosOfIndexSymbol, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: function (type, kind) { return getIndexTypeOfType(type, kind === 0 /* IndexKind.String */ ? stringType : numberType); }, getIndexType: function (type) { return getIndexType(type); }, @@ -49042,6 +49315,7 @@ var ts; signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration, symbolToEntityName: nodeBuilder.symbolToEntityName, symbolToExpression: nodeBuilder.symbolToExpression, + symbolToNode: nodeBuilder.symbolToNode, symbolToTypeParameterDeclarations: nodeBuilder.symbolToTypeParameterDeclarations, symbolToParameterDeclaration: nodeBuilder.symbolToParameterDeclaration, typeParameterToDeclaration: nodeBuilder.typeParameterToDeclaration, @@ -49290,6 +49564,7 @@ var ts; isPropertyAccessible: isPropertyAccessible, getTypeOnlyAliasDeclaration: getTypeOnlyAliasDeclaration, getMemberOverrideModifierStatus: getMemberOverrideModifierStatus, + isTypeParameterPossiblyReferenced: isTypeParameterPossiblyReferenced, }; function runWithInferenceBlockedFromSourceNode(node, fn) { var containingCall = ts.findAncestor(node, ts.isCallLikeExpression); @@ -49347,6 +49622,7 @@ var ts; var wildcardType = createIntrinsicType(1 /* TypeFlags.Any */, "any"); var errorType = createIntrinsicType(1 /* TypeFlags.Any */, "error"); var unresolvedType = createIntrinsicType(1 /* TypeFlags.Any */, "unresolved"); + var nonInferrableAnyType = createIntrinsicType(1 /* TypeFlags.Any */, "any", 65536 /* ObjectFlags.ContainsWideningType */); var intrinsicMarkerType = createIntrinsicType(1 /* TypeFlags.Any */, "intrinsic"); var unknownType = createIntrinsicType(2 /* TypeFlags.Unknown */, "unknown"); var nonNullUnknownType = createIntrinsicType(2 /* TypeFlags.Unknown */, "unknown"); @@ -49408,7 +49684,8 @@ var ts; var emptyTypeLiteralSymbol = createSymbol(2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */); emptyTypeLiteralSymbol.members = ts.createSymbolTable(); var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); - var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType; + var unknownEmptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); + var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType; var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); emptyGenericType.instantiations = new ts.Map(); var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); @@ -49522,6 +49799,8 @@ var ts; var deferredGlobalOmitSymbol; var deferredGlobalAwaitedSymbol; var deferredGlobalBigIntType; + var deferredGlobalNaNSymbol; + var deferredGlobalRecordSymbol; var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name var flowLoopStart = 0; var flowLoopCount = 0; @@ -49711,10 +49990,10 @@ var ts; } // Issue errors globally var file = ts.getSourceFileOfNode(location); - addErrorOrSuggestion(isError, "message" in message ? ts.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForFileFromMessageChain(file, message)); // eslint-disable-line no-in-operator + addErrorOrSuggestion(isError, "message" in message ? ts.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForFileFromMessageChain(file, message)); // eslint-disable-line local/no-in-operator return; } - addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line no-in-operator + addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line local/no-in-operator } function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, arg0, arg1, arg2, arg3) { var diagnostic = error(location, message, arg0, arg1, arg2, arg3); @@ -49943,7 +50222,7 @@ var ts; if (unidirectional === void 0) { unidirectional = false; } source.forEach(function (sourceSymbol, id) { var targetSymbol = target.get(id); - target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol); + target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol)); }); } function mergeModuleAugmentation(moduleName) { @@ -50031,7 +50310,7 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = new NodeLinks()); } function isGlobalSourceFile(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -50090,17 +50369,17 @@ var ts; } if (declaration.pos <= usage.pos && !(ts.isPropertyDeclaration(declaration) && ts.isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) { // declaration is before usage - if (declaration.kind === 203 /* SyntaxKind.BindingElement */) { + if (declaration.kind === 205 /* SyntaxKind.BindingElement */) { // still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2]) - var errorBindingElement = ts.getAncestor(usage, 203 /* SyntaxKind.BindingElement */); + var errorBindingElement = ts.getAncestor(usage, 205 /* SyntaxKind.BindingElement */); if (errorBindingElement) { return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) || declaration.pos < errorBindingElement.pos; } // or it might be illegal if usage happens before parent variable is declared (eg var [a] = a) - return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 254 /* SyntaxKind.VariableDeclaration */), usage); + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 257 /* SyntaxKind.VariableDeclaration */), usage); } - else if (declaration.kind === 254 /* SyntaxKind.VariableDeclaration */) { + else if (declaration.kind === 257 /* SyntaxKind.VariableDeclaration */) { // still might be illegal if usage is in the initializer of the variable declaration (eg var a = a) return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } @@ -50130,12 +50409,12 @@ var ts; // or if usage is in a type context: // 1. inside a type query (typeof in type position) // 2. inside a jsdoc comment - if (usage.parent.kind === 275 /* SyntaxKind.ExportSpecifier */ || (usage.parent.kind === 271 /* SyntaxKind.ExportAssignment */ && usage.parent.isExportEquals)) { + if (usage.parent.kind === 278 /* SyntaxKind.ExportSpecifier */ || (usage.parent.kind === 274 /* SyntaxKind.ExportAssignment */ && usage.parent.isExportEquals)) { // export specifiers do not use the variable, they only make it available for use return true; } // When resolving symbols for exports, the `usage` location passed in can be the export site directly - if (usage.kind === 271 /* SyntaxKind.ExportAssignment */ && usage.isExportEquals) { + if (usage.kind === 274 /* SyntaxKind.ExportAssignment */ && usage.isExportEquals) { return true; } if (!!(usage.flags & 8388608 /* NodeFlags.JSDoc */) || isInTypeQuery(usage) || usageInTypeDeclaration()) { @@ -50157,9 +50436,9 @@ var ts; } function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { switch (declaration.parent.parent.kind) { - case 237 /* SyntaxKind.VariableStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 240 /* SyntaxKind.VariableStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: // variable statement/for/for-of statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) if (isSameScopeDescendentOf(usage, declaration, declContainer)) { @@ -50187,7 +50466,7 @@ var ts; var initializerOfProperty = propertyDeclaration.initializer === current; if (initializerOfProperty) { if (ts.isStatic(current.parent)) { - if (declaration.kind === 169 /* SyntaxKind.MethodDeclaration */) { + if (declaration.kind === 171 /* SyntaxKind.MethodDeclaration */) { return true; } if (ts.isPropertyDeclaration(declaration) && ts.getContainingClass(usage) === ts.getContainingClass(declaration)) { @@ -50202,7 +50481,7 @@ var ts; } } else { - var isDeclarationInstanceProperty = declaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(declaration); + var isDeclarationInstanceProperty = declaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(declaration); if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) { return true; } @@ -50225,19 +50504,19 @@ var ts; return "quit"; } switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return true; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // even when stopping at any property declaration, they need to come from the same class return stopAtAnyPropertyDeclaration && (ts.isPropertyDeclaration(declaration) && node.parent === declaration.parent || ts.isParameterPropertyDeclaration(declaration, declaration.parent) && node.parent === declaration.parent.parent) ? "quit" : true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: switch (node.parent.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 175 /* SyntaxKind.SetAccessor */: return true; default: return false; @@ -50277,18 +50556,18 @@ var ts; } function requiresScopeChangeWorker(node) { switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: // do not descend into these return false; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 299 /* SyntaxKind.PropertyAssignment */: return requiresScopeChangeWorker(node.name); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // static properties in classes introduce temporary variables if (ts.hasStaticModifier(node)) { return target < 99 /* ScriptTarget.ESNext */ || !useDefineForClassFields; @@ -50317,12 +50596,13 @@ var ts; * the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with * the given name can be found. * + * @param nameNotFoundMessage If defined, we will report errors found during resolve. * @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters. */ - function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions) { + function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions) { if (excludeGlobals === void 0) { excludeGlobals = false; } - if (getSpellingSuggstions === void 0) { getSpellingSuggstions = true; } - return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions, getSymbol); + if (getSpellingSuggestions === void 0) { getSpellingSuggestions = true; } + return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol); } function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) { var _a, _b, _c; @@ -50353,14 +50633,14 @@ var ts; // - parameters are only in the scope of function body // This restriction does not apply to JSDoc comment types because they are parented // at a higher level than type parameters would normally be - if (meaning & result.flags & 788968 /* SymbolFlags.Type */ && lastLocation.kind !== 320 /* SyntaxKind.JSDoc */) { + if (meaning & result.flags & 788968 /* SymbolFlags.Type */ && lastLocation.kind !== 323 /* SyntaxKind.JSDoc */) { useResult = result.flags & 262144 /* SymbolFlags.TypeParameter */ // type parameters are visible in parameter list, return type and type parameter list ? lastLocation === location.type || - lastLocation.kind === 164 /* SyntaxKind.Parameter */ || - lastLocation.kind === 340 /* SyntaxKind.JSDocParameterTag */ || - lastLocation.kind === 341 /* SyntaxKind.JSDocReturnTag */ || - lastLocation.kind === 163 /* SyntaxKind.TypeParameter */ + lastLocation.kind === 166 /* SyntaxKind.Parameter */ || + lastLocation.kind === 343 /* SyntaxKind.JSDocParameterTag */ || + lastLocation.kind === 344 /* SyntaxKind.JSDocReturnTag */ || + lastLocation.kind === 165 /* SyntaxKind.TypeParameter */ // local types not visible outside the function body : false; } @@ -50375,13 +50655,13 @@ var ts; // however it is detected separately when checking initializers of parameters // to make sure that they reference no variables declared after them. useResult = - lastLocation.kind === 164 /* SyntaxKind.Parameter */ || + lastLocation.kind === 166 /* SyntaxKind.Parameter */ || (lastLocation === location.type && !!ts.findAncestor(result.valueDeclaration, ts.isParameter)); } } } - else if (location.kind === 189 /* SyntaxKind.ConditionalType */) { + else if (location.kind === 191 /* SyntaxKind.ConditionalType */) { // A type parameter declared using 'infer T' in a conditional type is visible only in // the true branch of the conditional type. useResult = lastLocation === location.trueType; @@ -50396,14 +50676,14 @@ var ts; } withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation); switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var moduleExports = ((_a = getSymbolOfNode(location)) === null || _a === void 0 ? void 0 : _a.exports) || emptySymbols; - if (location.kind === 305 /* SyntaxKind.SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 16777216 /* NodeFlags.Ambient */ && !ts.isGlobalScopeAugmentation(location))) { + if (location.kind === 308 /* SyntaxKind.SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 16777216 /* NodeFlags.Ambient */ && !ts.isGlobalScopeAugmentation(location))) { // It's an external module. First see if the module has an export default and if the local // name of that export default matches. if (result = moduleExports.get("default" /* InternalSymbolName.Default */)) { @@ -50427,7 +50707,7 @@ var ts; var moduleExport = moduleExports.get(name); if (moduleExport && moduleExport.flags === 2097152 /* SymbolFlags.Alias */ && - (ts.getDeclarationOfKind(moduleExport, 275 /* SyntaxKind.ExportSpecifier */) || ts.getDeclarationOfKind(moduleExport, 274 /* SyntaxKind.NamespaceExport */))) { + (ts.getDeclarationOfKind(moduleExport, 278 /* SyntaxKind.ExportSpecifier */) || ts.getDeclarationOfKind(moduleExport, 277 /* SyntaxKind.NamespaceExport */))) { break; } } @@ -50441,12 +50721,12 @@ var ts; } } break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (result = lookup(((_c = getSymbolOfNode(location)) === null || _c === void 0 ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* SymbolFlags.EnumMember */)) { break loop; } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // TypeScript 1.0 spec (April 2014): 8.4.1 // Initializer expressions for instance member variables are evaluated in the scope // of the class constructor body but are not permitted to reference parameters or @@ -50464,9 +50744,9 @@ var ts; } } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // The below is used to lookup type parameters within a class or interface, as they are added to the class/interface locals // These can never be latebound, so the symbol's raw members are sufficient. `getMembersOfNode` cannot be used, as it would // trigger resolving late-bound names, which we may already be in the process of doing while we're here! @@ -50480,12 +50760,14 @@ var ts; // TypeScript 1.0 spec (April 2014): 3.4.1 // The scope of a type parameter extends over the entire declaration with which the type // parameter list is associated, with the exception of static member declarations in classes. - error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + if (nameNotFoundMessage) { + error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + } return undefined; } break loop; } - if (location.kind === 226 /* SyntaxKind.ClassExpression */ && meaning & 32 /* SymbolFlags.Class */) { + if (location.kind === 228 /* SyntaxKind.ClassExpression */ && meaning & 32 /* SymbolFlags.Class */) { var className = location.name; if (className && name === className.escapedText) { result = location.symbol; @@ -50493,7 +50775,7 @@ var ts; } } break; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // The type parameters of a class are not in scope in the base class expression. if (lastLocation === location.expression && location.parent.token === 94 /* SyntaxKind.ExtendsKeyword */) { var container = location.parent.parent; @@ -50513,34 +50795,36 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968 /* SymbolFlags.Type */)) { - error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + if (nameNotFoundMessage) { + error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + } return undefined; } } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // when targeting ES6 or higher there is no 'arguments' in an arrow function // for lower compile targets the resolved symbol is used to emit an error if (ts.getEmitScriptTarget(compilerOptions) >= 2 /* ScriptTarget.ES2015 */) { break; } // falls through - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (meaning & 3 /* SymbolFlags.Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (meaning & 3 /* SymbolFlags.Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -50553,7 +50837,7 @@ var ts; } } break; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -50562,7 +50846,7 @@ var ts; // method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter. // } // - if (location.parent && location.parent.kind === 164 /* SyntaxKind.Parameter */) { + if (location.parent && location.parent.kind === 166 /* SyntaxKind.Parameter */) { location = location.parent; } // @@ -50577,20 +50861,20 @@ var ts; // declare function y(x: T): any; // @param(1 as T) // <-- T should resolve to the type alias outside of class C // class C {} - if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 257 /* SyntaxKind.ClassDeclaration */)) { + if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 260 /* SyntaxKind.ClassDeclaration */)) { location = location.parent; } break; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: // js type aliases do not resolve names from their host, so skip past it var root = ts.getJSDocRoot(location); if (root) { location = root.parent; } break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts.isBindingPattern(lastLocation))) { if (!associatedDeclarationForContainingInitializerOrBindingName) { @@ -50598,7 +50882,7 @@ var ts; } } break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts.isBindingPattern(lastLocation))) { if (ts.isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) { @@ -50606,7 +50890,7 @@ var ts; } } break; - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: if (meaning & 262144 /* SymbolFlags.TypeParameter */) { var parameterName = location.typeParameter.name; if (parameterName && name === parameterName.escapedText) { @@ -50632,7 +50916,7 @@ var ts; } if (!result) { if (lastLocation) { - ts.Debug.assert(lastLocation.kind === 305 /* SyntaxKind.SourceFile */); + ts.Debug.assert(lastLocation.kind === 308 /* SyntaxKind.SourceFile */); if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) { return lastLocation.symbol; } @@ -50714,7 +50998,7 @@ var ts; } return undefined; } - else if (checkAndReportErrorForInvalidInitializer()) { + else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) { return undefined; } // Perform extra checks only if error reporting was requested @@ -50762,7 +51046,7 @@ var ts; if (result && errorLocation && meaning & 111551 /* SymbolFlags.Value */ && result.flags & 2097152 /* SymbolFlags.Alias */ && !(result.flags & 111551 /* SymbolFlags.Value */) && !ts.isValidTypeOnlyAliasUseSite(errorLocation)) { var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result); if (typeOnlyDeclaration) { - var message = typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */ + var message = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type; var unescapedName = ts.unescapeLeadingUnderscores(name); @@ -50776,31 +51060,31 @@ var ts; function addTypeOnlyDeclarationRelatedInfo(diagnostic, typeOnlyDeclaration, unescapedName) { if (!typeOnlyDeclaration) return diagnostic; - return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName)); + return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName)); } function getIsDeferredContext(location, lastLocation) { - if (location.kind !== 214 /* SyntaxKind.ArrowFunction */ && location.kind !== 213 /* SyntaxKind.FunctionExpression */) { + if (location.kind !== 216 /* SyntaxKind.ArrowFunction */ && location.kind !== 215 /* SyntaxKind.FunctionExpression */) { // initializers in instance property declaration of class like entities are executed in constructor and thus deferred return ts.isTypeQueryNode(location) || ((ts.isFunctionLikeDeclaration(location) || - (location.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred + (location.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred } if (lastLocation && lastLocation === location.name) { return false; } // generator functions and async functions are not inlined in control flow when immediately invoked - if (location.asteriskToken || ts.hasSyntacticModifier(location, 256 /* ModifierFlags.Async */)) { + if (location.asteriskToken || ts.hasSyntacticModifier(location, 512 /* ModifierFlags.Async */)) { return true; } return !ts.getImmediatelyInvokedFunctionExpression(location); } function isSelfReferenceLocation(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: // For `namespace N { N; }` + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // For `namespace N { N; }` return true; default: return false; @@ -50813,7 +51097,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - if (decl.kind === 163 /* SyntaxKind.TypeParameter */) { + if (decl.kind === 165 /* SyntaxKind.TypeParameter */) { var parent = ts.isJSDocTemplateTag(decl.parent) ? ts.getJSDocHost(decl.parent) : decl.parent; if (parent === container) { return !(ts.isJSDocTemplateTag(decl.parent) && ts.find(decl.parent.parent.tags, ts.isJSDocTypeAlias)); @@ -50870,9 +51154,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: if (ts.isEntityNameExpression(node.expression)) { return node.expression; } @@ -50916,7 +51200,7 @@ var ts; return name === "any" || name === "string" || name === "number" || name === "boolean" || name === "never" || name === "unknown"; } function checkAndReportErrorForExportingPrimitiveType(errorLocation, name) { - if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) { + if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) { error(errorLocation, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, name); return true; } @@ -51007,7 +51291,7 @@ var ts; return; } // Block-scoped variables cannot be used before their definition - var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 260 /* SyntaxKind.EnumDeclaration */); }); + var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 263 /* SyntaxKind.EnumDeclaration */); }); if (declaration === undefined) return ts.Debug.fail("checkResolvedBlockScopedVariable could not find block-scoped declaration"); if (!(declaration.flags & 16777216 /* NodeFlags.Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { @@ -51044,13 +51328,13 @@ var ts; } function getAnyImportSyntax(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return node.parent; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent; default: return undefined; @@ -51075,24 +51359,24 @@ var ts; * const { x } = require ... */ function isAliasSymbolDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || node.kind === 267 /* SyntaxKind.ImportClause */ && !!node.name - || node.kind === 268 /* SyntaxKind.NamespaceImport */ - || node.kind === 274 /* SyntaxKind.NamespaceExport */ - || node.kind === 270 /* SyntaxKind.ImportSpecifier */ - || node.kind === 275 /* SyntaxKind.ExportSpecifier */ - || node.kind === 271 /* SyntaxKind.ExportAssignment */ && ts.exportAssignmentIsAlias(node) + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || node.kind === 270 /* SyntaxKind.ImportClause */ && !!node.name + || node.kind === 271 /* SyntaxKind.NamespaceImport */ + || node.kind === 277 /* SyntaxKind.NamespaceExport */ + || node.kind === 273 /* SyntaxKind.ImportSpecifier */ + || node.kind === 278 /* SyntaxKind.ExportSpecifier */ + || node.kind === 274 /* SyntaxKind.ExportAssignment */ && ts.exportAssignmentIsAlias(node) || ts.isBinaryExpression(node) && ts.getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */ && ts.exportAssignmentIsAlias(node) || ts.isAccessExpression(node) && ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && isAliasableOrJsExpression(node.parent.right) - || node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || node.kind === 296 /* SyntaxKind.PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) - || node.kind === 254 /* SyntaxKind.VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) - || node.kind === 203 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); + || node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || node.kind === 299 /* SyntaxKind.PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) + || node.kind === 257 /* SyntaxKind.VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) + || node.kind === 205 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); } function isAliasableOrJsExpression(e) { return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e); @@ -51105,7 +51389,7 @@ var ts; ? resolveSymbol(getPropertyOfType(resolveExternalModuleTypeByLiteral(name), commonJSPropertyAccess.name.escapedText)) : undefined; } - if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { var immediate = resolveExternalModuleName(node, ts.getExternalModuleRequireArgument(node) || ts.getExternalModuleImportEqualsDeclarationExpression(node)); var resolved_4 = resolveExternalModuleSymbol(immediate); markSymbolOfAliasDeclarationIfTypeOnly(node, immediate, resolved_4, /*overwriteEmpty*/ false); @@ -51118,7 +51402,7 @@ var ts; function checkAndReportErrorForResolvingImportAliasToTypeOnlySymbol(node, resolved) { if (markSymbolOfAliasDeclarationIfTypeOnly(node, /*immediateTarget*/ undefined, resolved, /*overwriteEmpty*/ false) && !node.isTypeOnly) { var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(getSymbolOfNode(node)); - var isExport = typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */; + var isExport = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */; var message = isExport ? ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type : ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type; @@ -51137,7 +51421,7 @@ var ts; return resolved; } function isSyntacticDefault(node) { - return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) || ts.isExportSpecifier(node)); + return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) || ts.isExportSpecifier(node)); } function getUsageModeForExpression(usage) { return ts.isStringLiteralLike(usage) ? ts.getModeForUsageLocation(ts.getSourceFileOfNode(usage), usage) : undefined; @@ -51237,11 +51521,11 @@ var ts; } function getModuleSpecifierForImportOrExport(node) { switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; - case 268 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier; - case 270 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier; - case 275 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier; + case 270 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier; + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier; + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier; + case 278 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier; default: return ts.Debug.assertNever(node); } } @@ -51510,31 +51794,31 @@ var ts; function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { if (dontRecursivelyResolve === void 0) { dontRecursivelyResolve = false; } switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return getTargetOfImportClause(node, dontRecursivelyResolve); - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return getTargetOfNamespaceImport(node, dontRecursivelyResolve); - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: return getTargetOfNamespaceExport(node, dontRecursivelyResolve); - case 270 /* SyntaxKind.ImportSpecifier */: - case 203 /* SyntaxKind.BindingElement */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 205 /* SyntaxKind.BindingElement */: return getTargetOfImportSpecifier(node, dontRecursivelyResolve); - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return getTargetOfExportSpecifier(node, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, dontRecursivelyResolve); - case 271 /* SyntaxKind.ExportAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: + case 274 /* SyntaxKind.ExportAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: return getTargetOfExportAssignment(node, dontRecursivelyResolve); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return resolveEntityName(node.name, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ true, dontRecursivelyResolve); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getTargetOfAliasLikeExpression(node.initializer, dontRecursivelyResolve); - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return getTargetOfAccessExpression(node, dontRecursivelyResolve); default: return ts.Debug.fail(); @@ -51686,18 +51970,18 @@ var ts; entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 79 /* SyntaxKind.Identifier */ || entityName.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + if (entityName.kind === 79 /* SyntaxKind.Identifier */ || entityName.parent.kind === 163 /* SyntaxKind.QualifiedName */) { return resolveEntityName(entityName, 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */); return resolveEntityName(entityName, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } } function getFullyQualifiedName(symbol, containingLocation) { - return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, /*meaning*/ undefined, 16 /* SymbolFormatFlags.DoNotIncludeSymbolChain */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, /*meaning*/ undefined, 32 /* SymbolFormatFlags.DoNotIncludeSymbolChain */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); } function getContainingQualifiedNameNode(node) { while (ts.isQualifiedName(node.parent)) { @@ -51738,9 +52022,9 @@ var ts; return getMergedSymbol(symbolFromJSPrototype); } } - else if (name.kind === 161 /* SyntaxKind.QualifiedName */ || name.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { - var left = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.left : name.expression; - var right = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.right : name.name; + else if (name.kind === 163 /* SyntaxKind.QualifiedName */ || name.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { + var left = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.left : name.expression; + var right = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, namespaceMeaning, ignoreErrors, /*dontResolveAlias*/ false, location); if (!namespace || ts.nodeIsMissing(right)) { return undefined; @@ -51798,7 +52082,7 @@ var ts; throw ts.Debug.assertNever(name, "Unknown entity name kind."); } ts.Debug.assert((ts.getCheckFlags(symbol) & 1 /* CheckFlags.Instantiated */) === 0, "Should never get an instantiated symbol here."); - if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 /* SymbolFlags.Alias */ || name.parent.kind === 271 /* SyntaxKind.ExportAssignment */)) { + if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 /* SymbolFlags.Alias */ || name.parent.kind === 274 /* SyntaxKind.ExportAssignment */)) { markSymbolOfAliasDeclarationIfTypeOnly(ts.getAliasDeclarationFromName(name), symbol, /*finalTarget*/ undefined, /*overwriteEmpty*/ true); } return (symbol.flags & meaning) || dontResolveAlias ? symbol : resolveAlias(symbol); @@ -51948,7 +52232,7 @@ var ts; if (ext === ".ts" /* Extension.Ts */ || ext === ".js" /* Extension.Js */ || ext === ".tsx" /* Extension.Tsx */ || ext === ".jsx" /* Extension.Jsx */) { var scope = currentSourceFile.packageJsonScope; var targetExt = ext === ".ts" /* Extension.Ts */ ? ".mts" /* Extension.Mts */ : ext === ".js" /* Extension.Js */ ? ".mjs" /* Extension.Mjs */ : undefined; - if (scope && !scope.packageJsonContent.type) { + if (scope && !scope.contents.packageJsonContent.type) { if (targetExt) { diagnosticDetails = ts.chainDiagnosticMessages( /*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1, targetExt, ts.combinePaths(scope.packageDirectory, "package.json")); @@ -52121,7 +52405,7 @@ var ts; var _a; var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); if (!dontResolveAlias && symbol) { - if (!suppressInteropError && !(symbol.flags & (1536 /* SymbolFlags.Module */ | 3 /* SymbolFlags.Variable */)) && !ts.getDeclarationOfKind(symbol, 305 /* SyntaxKind.SourceFile */)) { + if (!suppressInteropError && !(symbol.flags & (1536 /* SymbolFlags.Module */ | 3 /* SymbolFlags.Variable */)) && !ts.getDeclarationOfKind(symbol, 308 /* SyntaxKind.SourceFile */)) { var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop"; @@ -52487,7 +52771,7 @@ var ts; var members = node.members; for (var _i = 0, members_3 = members; _i < members_3.length; _i++) { var member = members_3[_i]; - if (member.kind === 171 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 173 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } @@ -52595,12 +52879,12 @@ var ts; } } switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var sym = getSymbolOfNode(location); // `sym` may not have exports if this module declaration is backed by the symbol for a `const` that's being rewritten // into a namespace - in such cases, it's best to just let the namespace appear empty (the const members couldn't have referred @@ -52609,9 +52893,9 @@ var ts; return { value: result }; } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // Type parameters are bound into `members` lists so they can merge across declarations // This is troublesome, since in all other respects, they behave like locals :cries: // TODO: the below is shared with similar code in `resolveName` - in fact, rephrasing all this symbol @@ -52706,7 +52990,7 @@ var ts; && (isLocalNameLookup ? !ts.some(symbolFromSymbolTable.declarations, ts.isNamespaceReexportDeclaration) : true) // While exports are generally considered to be in scope, export-specifier declared symbols are _not_ // See similar comment in `resolveName` for details - && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 275 /* SyntaxKind.ExportSpecifier */))) { + && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */))) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); var candidate = getCandidateListForSymbol(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification); if (candidate) { @@ -52750,7 +53034,7 @@ var ts; return true; } // Qualify if the symbol from symbol table has same meaning as expected - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 275 /* SyntaxKind.ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -52765,10 +53049,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: continue; default: return false; @@ -52898,10 +53182,10 @@ var ts; return node && getSymbolOfNode(node); } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasNonGlobalAugmentationExternalModuleSymbol(declaration) { - return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -52969,14 +53253,14 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 181 /* SyntaxKind.TypeQuery */ || - entityName.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) || - entityName.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (entityName.parent.kind === 183 /* SyntaxKind.TypeQuery */ || + entityName.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) || + entityName.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // Typeof value meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } - else if (entityName.kind === 161 /* SyntaxKind.QualifiedName */ || entityName.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - entityName.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + else if (entityName.kind === 163 /* SyntaxKind.QualifiedName */ || entityName.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + entityName.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1920 /* SymbolFlags.Namespace */; @@ -53012,15 +53296,18 @@ var ts; if (flags & 8 /* SymbolFormatFlags.UseAliasDefinedOutsideCurrentScope */) { nodeFlags |= 16384 /* NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope */; } - if (flags & 16 /* SymbolFormatFlags.DoNotIncludeSymbolChain */) { + if (flags & 32 /* SymbolFormatFlags.DoNotIncludeSymbolChain */) { nodeFlags |= 134217728 /* NodeBuilderFlags.DoNotIncludeSymbolChain */; } - var builder = flags & 4 /* SymbolFormatFlags.AllowAnyNodeKind */ ? nodeBuilder.symbolToExpression : nodeBuilder.symbolToEntityName; + if (flags & 16 /* SymbolFormatFlags.WriteComputedProps */) { + nodeFlags |= 1073741824 /* NodeBuilderFlags.WriteComputedProps */; + } + var builder = flags & 4 /* SymbolFormatFlags.AllowAnyNodeKind */ ? nodeBuilder.symbolToNode : nodeBuilder.symbolToEntityName; return writer ? symbolToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(symbolToStringWorker); function symbolToStringWorker(writer) { var entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags); // TODO: GH#18217 // add neverAsciiEscape for GH#39027 - var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 305 /* SyntaxKind.SourceFile */ ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true }); + var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 308 /* SyntaxKind.SourceFile */ ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true }); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); printer.writeNode(4 /* EmitHint.Unspecified */, entity, /*sourceFile*/ sourceFile, writer); return writer; @@ -53032,10 +53319,10 @@ var ts; function signatureToStringWorker(writer) { var sigOutput; if (flags & 262144 /* TypeFormatFlags.WriteArrowStyleSignature */) { - sigOutput = kind === 1 /* SignatureKind.Construct */ ? 180 /* SyntaxKind.ConstructorType */ : 179 /* SyntaxKind.FunctionType */; + sigOutput = kind === 1 /* SignatureKind.Construct */ ? 182 /* SyntaxKind.ConstructorType */ : 181 /* SyntaxKind.FunctionType */; } else { - sigOutput = kind === 1 /* SignatureKind.Construct */ ? 175 /* SyntaxKind.ConstructSignature */ : 174 /* SyntaxKind.CallSignature */; + sigOutput = kind === 1 /* SignatureKind.Construct */ ? 177 /* SyntaxKind.ConstructSignature */ : 176 /* SyntaxKind.CallSignature */; } var sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */); var printer = ts.createPrinter({ removeComments: true, omitTrailingSemicolon: true }); @@ -53115,7 +53402,25 @@ var ts; symbolTableToDeclarationStatements: function (symbolTable, enclosingDeclaration, flags, tracker, bundled) { return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolTableToDeclarationStatements(symbolTable, context, bundled); }); }, + symbolToNode: function (symbol, meaning, enclosingDeclaration, flags, tracker) { + return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolToNode(symbol, context, meaning); }); + }, }; + function symbolToNode(symbol, context, meaning) { + if (context.flags & 1073741824 /* NodeBuilderFlags.WriteComputedProps */) { + if (symbol.valueDeclaration) { + var name = ts.getNameOfDeclaration(symbol.valueDeclaration); + if (name && ts.isComputedPropertyName(name)) + return name; + } + var nameType = getSymbolLinks(symbol).nameType; + if (nameType && nameType.flags & (1024 /* TypeFlags.EnumLiteral */ | 8192 /* TypeFlags.UniqueESSymbol */)) { + context.enclosingDeclaration = nameType.symbol.valueDeclaration; + return ts.factory.createComputedPropertyName(symbolToExpression(nameType.symbol, context, meaning)); + } + } + return symbolToExpression(symbol, context, meaning); + } function withContext(enclosingDeclaration, flags, tracker, cb) { var _a, _b; ts.Debug.assert(enclosingDeclaration === undefined || (enclosingDeclaration.flags & 8 /* NodeFlags.Synthesized */) === 0); @@ -53200,7 +53505,7 @@ var ts; return undefined; // TODO: GH#18217 } context.approximateLength += 3; - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } if (!(context.flags & 536870912 /* NodeBuilderFlags.NoTypeReduction */)) { type = getReducedType(type); @@ -53210,29 +53515,29 @@ var ts; return ts.factory.createTypeReferenceNode(symbolToEntityNameNode(type.aliasSymbol), mapToTypeNodes(type.aliasTypeArguments, context)); } if (type === unresolvedType) { - return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */), 3 /* SyntaxKind.MultiLineCommentTrivia */, "unresolved"); + return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */), 3 /* SyntaxKind.MultiLineCommentTrivia */, "unresolved"); } context.approximateLength += 3; - return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 138 /* SyntaxKind.IntrinsicKeyword */ : 130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 139 /* SyntaxKind.IntrinsicKeyword */ : 131 /* SyntaxKind.AnyKeyword */); } if (type.flags & 2 /* TypeFlags.Unknown */) { - return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */); + return ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */); } if (type.flags & 4 /* TypeFlags.String */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(150 /* SyntaxKind.StringKeyword */); + return ts.factory.createKeywordTypeNode(152 /* SyntaxKind.StringKeyword */); } if (type.flags & 8 /* TypeFlags.Number */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(147 /* SyntaxKind.NumberKeyword */); + return ts.factory.createKeywordTypeNode(148 /* SyntaxKind.NumberKeyword */); } if (type.flags & 64 /* TypeFlags.BigInt */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(158 /* SyntaxKind.BigIntKeyword */); + return ts.factory.createKeywordTypeNode(160 /* SyntaxKind.BigIntKeyword */); } if (type.flags & 16 /* TypeFlags.Boolean */ && !type.aliasSymbol) { context.approximateLength += 7; - return ts.factory.createKeywordTypeNode(133 /* SyntaxKind.BooleanKeyword */); + return ts.factory.createKeywordTypeNode(134 /* SyntaxKind.BooleanKeyword */); } if (type.flags & 1024 /* TypeFlags.EnumLiteral */ && !(type.flags & 1048576 /* TypeFlags.Union */)) { var parentSymbol = getParentOfSymbol(type.symbol); @@ -53286,7 +53591,7 @@ var ts; } } context.approximateLength += 13; - return ts.factory.createTypeOperatorNode(154 /* SyntaxKind.UniqueKeyword */, ts.factory.createKeywordTypeNode(151 /* SyntaxKind.SymbolKeyword */)); + return ts.factory.createTypeOperatorNode(156 /* SyntaxKind.UniqueKeyword */, ts.factory.createKeywordTypeNode(153 /* SyntaxKind.SymbolKeyword */)); } if (type.flags & 16384 /* TypeFlags.Void */) { context.approximateLength += 4; @@ -53294,7 +53599,7 @@ var ts; } if (type.flags & 32768 /* TypeFlags.Undefined */) { context.approximateLength += 9; - return ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */); + return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */); } if (type.flags & 65536 /* TypeFlags.Null */) { context.approximateLength += 4; @@ -53302,15 +53607,15 @@ var ts; } if (type.flags & 131072 /* TypeFlags.Never */) { context.approximateLength += 5; - return ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */); + return ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */); } if (type.flags & 4096 /* TypeFlags.ESSymbol */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(151 /* SyntaxKind.SymbolKeyword */); + return ts.factory.createKeywordTypeNode(153 /* SyntaxKind.SymbolKeyword */); } if (type.flags & 67108864 /* TypeFlags.NonPrimitive */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(148 /* SyntaxKind.ObjectKeyword */); + return ts.factory.createKeywordTypeNode(149 /* SyntaxKind.ObjectKeyword */); } if (ts.isThisTypeParameter(type)) { if (context.flags & 4194304 /* NodeBuilderFlags.InObjectTypeLiteral */) { @@ -53399,7 +53704,7 @@ var ts; var indexedType = type.type; context.approximateLength += 6; var indexTypeNode = typeToTypeNodeHelper(indexedType, context); - return ts.factory.createTypeOperatorNode(140 /* SyntaxKind.KeyOfKeyword */, indexTypeNode); + return ts.factory.createTypeOperatorNode(141 /* SyntaxKind.KeyOfKeyword */, indexTypeNode); } if (type.flags & 134217728 /* TypeFlags.TemplateLiteral */) { var texts_1 = type.texts; @@ -53451,7 +53756,7 @@ var ts; // On the other hand, // checkType extends infer T extends checkType ? T extends extendsType ? trueType : falseType : never; // may also work with `infer ... extends ...` in, but would produce declarations only compatible with the latest TS. - return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)), ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)); + return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)), ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)); } var saveInferTypeParameters = context.inferTypeParameters; context.inferTypeParameters = type.root.inferTypeParameters; @@ -53493,7 +53798,7 @@ var ts; var name = typeParameterToName(newParam, context); newTypeVariable = ts.factory.createTypeReferenceNode(name); } - appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(140 /* SyntaxKind.KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)); + appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(141 /* SyntaxKind.KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)); } else { appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type), context); @@ -53509,7 +53814,7 @@ var ts; // wrap it with a conditional like `SomeModifiersType extends infer U ? {..the mapped type...} : never` to ensure the resulting // type stays homomorphic var originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode(type.declaration.typeParameter.constraint.type)) || unknownType, type.mapper); - return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 /* TypeFlags.Unknown */ ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)); + return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 /* TypeFlags.Unknown */ ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)); } return result; } @@ -53557,7 +53862,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* SymbolFlags.Function */) && (symbol.parent || // is exported function symbol ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 305 /* SyntaxKind.SourceFile */ || declaration.parent.kind === 262 /* SyntaxKind.ModuleBlock */; + return declaration.parent.kind === 308 /* SyntaxKind.SourceFile */ || declaration.parent.kind === 265 /* SyntaxKind.ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -53646,12 +53951,12 @@ var ts; } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { var signature = resolved.callSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 179 /* SyntaxKind.FunctionType */, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 181 /* SyntaxKind.FunctionType */, context); return signatureNode; } if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { var signature = resolved.constructSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 180 /* SyntaxKind.ConstructorType */, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 182 /* SyntaxKind.ConstructorType */, context); return signatureNode; } } @@ -53694,7 +53999,7 @@ var ts; } var elementType = typeToTypeNodeHelper(typeArguments[0], context); var arrayType = ts.factory.createArrayTypeNode(elementType); - return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, arrayType); + return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, arrayType); } else if (type.target.objectFlags & 8 /* ObjectFlags.Tuple */) { typeArguments = ts.sameMap(typeArguments, function (t, i) { return removeMissingType(t, !!(type.target.elementFlags[i] & 2 /* ElementFlags.Optional */)); }); @@ -53719,12 +54024,12 @@ var ts; } } var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode(tupleConstituentNodes), 1 /* EmitFlags.SingleLine */); - return type.target.readonly ? ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; } } if (context.encounteredError || (context.flags & 524288 /* NodeBuilderFlags.AllowEmptyTuple */)) { var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode([]), 1 /* EmitFlags.SingleLine */); - return type.target.readonly ? ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; } context.encounteredError = true; return undefined; // TODO: GH#18217 @@ -53831,13 +54136,13 @@ var ts; var typeElements = []; for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 174 /* SyntaxKind.CallSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 176 /* SyntaxKind.CallSignature */, context)); } for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; if (signature.flags & 4 /* SignatureFlags.Abstract */) continue; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 175 /* SyntaxKind.ConstructSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 177 /* SyntaxKind.ConstructSignature */, context)); } for (var _d = 0, _e = resolvedType.indexInfos; _d < _e.length; _d++) { var info = _e[_d]; @@ -53874,7 +54179,7 @@ var ts; if (!(context.flags & 1 /* NodeBuilderFlags.NoTruncation */)) { return ts.factory.createTypeReferenceNode(ts.factory.createIdentifier("..."), /*typeArguments*/ undefined); } - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } function shouldUsePlaceholderForProperty(propertySymbol, context) { var _a; @@ -53924,7 +54229,7 @@ var ts; var signatures = getSignaturesOfType(filterType(propertyType, function (t) { return !(t.flags & 32768 /* TypeFlags.Undefined */); }), 0 /* SignatureKind.Call */); for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) { var signature = signatures_1[_i]; - var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 168 /* SyntaxKind.MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); + var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 170 /* SyntaxKind.MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); typeElements.push(preserveCommentsOn(methodDeclaration)); } } @@ -53938,12 +54243,12 @@ var ts; context.reverseMappedStack || (context.reverseMappedStack = []); context.reverseMappedStack.push(propertySymbol); } - propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); if (propertyIsReverseMapped) { context.reverseMappedStack.pop(); } } - var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(145 /* SyntaxKind.ReadonlyKeyword */)] : undefined; + var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(146 /* SyntaxKind.ReadonlyKeyword */)] : undefined; if (modifiers) { context.approximateLength += 9; } @@ -53952,8 +54257,8 @@ var ts; } function preserveCommentsOn(node) { var _a; - if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 347 /* SyntaxKind.JSDocPropertyTag */; })) { - var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 347 /* SyntaxKind.JSDocPropertyTag */; }); + if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 350 /* SyntaxKind.JSDocPropertyTag */; })) { + var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 350 /* SyntaxKind.JSDocPropertyTag */; }); var commentText = ts.getTextOfJSDocComment(d.comment); if (commentText) { ts.setSyntheticLeadingComments(node, [{ kind: 3 /* SyntaxKind.MultiLineCommentTrivia */, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]); @@ -54052,7 +54357,7 @@ var ts; context.encounteredError = true; } context.approximateLength += (name.length + 4); - return ts.factory.createIndexSignature(indexInfo.isReadonly ? [ts.factory.createToken(145 /* SyntaxKind.ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); + return ts.factory.createIndexSignature(indexInfo.isReadonly ? [ts.factory.createToken(146 /* SyntaxKind.ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); } function signatureToSignatureDeclarationHelper(signature, kind, context, options) { var _a, _b, _c, _d; @@ -54070,7 +54375,7 @@ var ts; } var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0]; // If the expanded parameter list had a variadic in a non-trailing position, don't expand it - var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* CheckFlags.RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 171 /* SyntaxKind.Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); + var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* CheckFlags.RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 173 /* SyntaxKind.Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); var thisParameter = context.flags & 33554432 /* NodeBuilderFlags.OmitThisParameter */ ? undefined : tryGetThisParameterDeclaration(signature, context); if (thisParameter) { parameters.unshift(thisParameter); @@ -54079,7 +54384,7 @@ var ts; var typePredicate = getTypePredicateOfSignature(signature); if (typePredicate) { var assertsModifier = typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? - ts.factory.createToken(128 /* SyntaxKind.AssertsKeyword */) : + ts.factory.createToken(129 /* SyntaxKind.AssertsKeyword */) : undefined; var parameterName = typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.setEmitFlags(ts.factory.createIdentifier(typePredicate.parameterName), 16777216 /* EmitFlags.NoAsciiEscaping */) : @@ -54093,28 +54398,28 @@ var ts; returnTypeNode = serializeReturnTypeForSignature(context, returnType, signature, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); } else if (!suppressAny) { - returnTypeNode = ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + returnTypeNode = ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } } var modifiers = options === null || options === void 0 ? void 0 : options.modifiers; - if ((kind === 180 /* SyntaxKind.ConstructorType */) && signature.flags & 4 /* SignatureFlags.Abstract */) { + if ((kind === 182 /* SyntaxKind.ConstructorType */) && signature.flags & 4 /* SignatureFlags.Abstract */) { var flags = ts.modifiersToFlags(modifiers); - modifiers = ts.factory.createModifiersFromModifierFlags(flags | 128 /* ModifierFlags.Abstract */); + modifiers = ts.factory.createModifiersFromModifierFlags(flags | 256 /* ModifierFlags.Abstract */); } - var node = kind === 174 /* SyntaxKind.CallSignature */ ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : - kind === 175 /* SyntaxKind.ConstructSignature */ ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : - kind === 168 /* SyntaxKind.MethodSignature */ ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : - kind === 169 /* SyntaxKind.MethodDeclaration */ ? ts.factory.createMethodDeclaration(modifiers, /*asteriskToken*/ undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), /*questionToken*/ undefined, typeParameters, parameters, returnTypeNode, /*body*/ undefined) : - kind === 171 /* SyntaxKind.Constructor */ ? ts.factory.createConstructorDeclaration(modifiers, parameters, /*body*/ undefined) : - kind === 172 /* SyntaxKind.GetAccessor */ ? ts.factory.createGetAccessorDeclaration(modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, /*body*/ undefined) : - kind === 173 /* SyntaxKind.SetAccessor */ ? ts.factory.createSetAccessorDeclaration(modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, /*body*/ undefined) : - kind === 176 /* SyntaxKind.IndexSignature */ ? ts.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : - kind === 317 /* SyntaxKind.JSDocFunctionType */ ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : - kind === 179 /* SyntaxKind.FunctionType */ ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : - kind === 180 /* SyntaxKind.ConstructorType */ ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : - kind === 256 /* SyntaxKind.FunctionDeclaration */ ? ts.factory.createFunctionDeclaration(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, /*body*/ undefined) : - kind === 213 /* SyntaxKind.FunctionExpression */ ? ts.factory.createFunctionExpression(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) : - kind === 214 /* SyntaxKind.ArrowFunction */ ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, /*equalsGreaterThanToken*/ undefined, ts.factory.createBlock([])) : + var node = kind === 176 /* SyntaxKind.CallSignature */ ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : + kind === 177 /* SyntaxKind.ConstructSignature */ ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : + kind === 170 /* SyntaxKind.MethodSignature */ ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : + kind === 171 /* SyntaxKind.MethodDeclaration */ ? ts.factory.createMethodDeclaration(modifiers, /*asteriskToken*/ undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), /*questionToken*/ undefined, typeParameters, parameters, returnTypeNode, /*body*/ undefined) : + kind === 173 /* SyntaxKind.Constructor */ ? ts.factory.createConstructorDeclaration(modifiers, parameters, /*body*/ undefined) : + kind === 174 /* SyntaxKind.GetAccessor */ ? ts.factory.createGetAccessorDeclaration(modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, /*body*/ undefined) : + kind === 175 /* SyntaxKind.SetAccessor */ ? ts.factory.createSetAccessorDeclaration(modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, /*body*/ undefined) : + kind === 178 /* SyntaxKind.IndexSignature */ ? ts.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : + kind === 320 /* SyntaxKind.JSDocFunctionType */ ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : + kind === 181 /* SyntaxKind.FunctionType */ ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : + kind === 182 /* SyntaxKind.ConstructorType */ ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : + kind === 259 /* SyntaxKind.FunctionDeclaration */ ? ts.factory.createFunctionDeclaration(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, /*body*/ undefined) : + kind === 215 /* SyntaxKind.FunctionExpression */ ? ts.factory.createFunctionExpression(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) : + kind === 216 /* SyntaxKind.ArrowFunction */ ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, /*equalsGreaterThanToken*/ undefined, ts.factory.createBlock([])) : ts.Debug.assertNever(kind); if (typeArguments) { node.typeArguments = ts.factory.createNodeArray(typeArguments); @@ -54151,9 +54456,9 @@ var ts; return typeParameterToDeclarationWithConstraint(type, context, constraintNode); } function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) { - var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 164 /* SyntaxKind.Parameter */); + var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 166 /* SyntaxKind.Parameter */); if (!parameterDeclaration && !ts.isTransientSymbol(parameterSymbol)) { - parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 340 /* SyntaxKind.JSDocParameterTag */); + parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 343 /* SyntaxKind.JSDocParameterTag */); } var parameterType = getTypeOfSymbol(parameterSymbol); if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) { @@ -54165,7 +54470,7 @@ var ts; var dotDotDotToken = isRest ? ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */) : undefined; var name = parameterDeclaration ? parameterDeclaration.name ? parameterDeclaration.name.kind === 79 /* SyntaxKind.Identifier */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name), 16777216 /* EmitFlags.NoAsciiEscaping */) : - parameterDeclaration.name.kind === 161 /* SyntaxKind.QualifiedName */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216 /* EmitFlags.NoAsciiEscaping */) : + parameterDeclaration.name.kind === 163 /* SyntaxKind.QualifiedName */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216 /* EmitFlags.NoAsciiEscaping */) : cloneBindingName(parameterDeclaration.name) : ts.symbolName(parameterSymbol) : ts.symbolName(parameterSymbol); @@ -54176,22 +54481,15 @@ var ts; context.approximateLength += ts.symbolName(parameterSymbol).length + 3; return parameterNode; function cloneBindingName(node) { - return elideInitializerAndPropertyRenamingAndSetEmitFlags(node); - function elideInitializerAndPropertyRenamingAndSetEmitFlags(node) { + return elideInitializerAndSetEmitFlags(node); + function elideInitializerAndSetEmitFlags(node) { if (context.tracker.trackSymbol && ts.isComputedPropertyName(node) && isLateBindableName(node)) { trackComputedName(node.expression, context.enclosingDeclaration, context); } - var visited = ts.visitEachChild(node, elideInitializerAndPropertyRenamingAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndPropertyRenamingAndSetEmitFlags); + var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndSetEmitFlags); if (ts.isBindingElement(visited)) { - if (visited.propertyName && ts.isIdentifier(visited.propertyName) && ts.isIdentifier(visited.name)) { - visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, - /* propertyName*/ undefined, visited.propertyName, - /*initializer*/ undefined); - } - else { - visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name, - /*initializer*/ undefined); - } + visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name, + /*initializer*/ undefined); } if (!ts.nodeIsSynthesized(visited)) { visited = ts.factory.cloneNode(visited); @@ -54336,11 +54634,11 @@ var ts; } function getSpecifierForModuleSymbol(symbol, context, overrideImportMode) { var _a; - var file = ts.getDeclarationOfKind(symbol, 305 /* SyntaxKind.SourceFile */); + var file = ts.getDeclarationOfKind(symbol, 308 /* SyntaxKind.SourceFile */); if (!file) { var equivalentFileSymbol = ts.firstDefined(symbol.declarations, function (d) { return getFileSymbolIfFileSymbolExportEqualsContainer(d, symbol); }); if (equivalentFileSymbol) { - file = ts.getDeclarationOfKind(equivalentFileSymbol, 305 /* SyntaxKind.SourceFile */); + file = ts.getDeclarationOfKind(equivalentFileSymbol, 308 /* SyntaxKind.SourceFile */); } } if (file && file.moduleName !== undefined) { @@ -54808,17 +55106,17 @@ var ts; return transformed === existing ? ts.setTextRange(ts.factory.cloneNode(existing), existing) : transformed; function visitExistingNodeTreeSymbols(node) { // We don't _actually_ support jsdoc namepath types, emit `any` instead - if (ts.isJSDocAllType(node) || node.kind === 319 /* SyntaxKind.JSDocNamepathType */) { - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + if (ts.isJSDocAllType(node) || node.kind === 322 /* SyntaxKind.JSDocNamepathType */) { + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } if (ts.isJSDocUnknownType(node)) { - return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */); + return ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */); } if (ts.isJSDocNullableType(node)) { return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createLiteralTypeNode(ts.factory.createNull())]); } if (ts.isJSDocOptionalType(node)) { - return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)]); + return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)]); } if (ts.isJSDocNonNullableType(node)) { return ts.visitNode(node.type, visitExistingNodeTreeSymbols); @@ -54832,11 +55130,11 @@ var ts; var typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode(node), name.escapedText); var overrideTypeNode = typeViaParent && t.typeExpression && getTypeFromTypeNode(t.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : undefined; return ts.factory.createPropertySignature( - /*modifiers*/ undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*modifiers*/ undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); })); } if (ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "") { - return ts.setOriginalNode(ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */), node); + return ts.setOriginalNode(ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */), node); } if ((ts.isExpressionWithTypeArguments(node) || ts.isTypeReferenceNode(node)) && ts.isJSDocIndexSignature(node)) { return ts.factory.createTypeLiteralNode([ts.factory.createIndexSignature( @@ -54851,12 +55149,12 @@ var ts; return ts.factory.createConstructorTypeNode( /*modifiers*/ undefined, ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.mapDefined(node.parameters, function (p, i) { return p.name && ts.isIdentifier(p.name) && p.name.escapedText === "new" ? (newTypeNode_1 = p.type, undefined) : ts.factory.createParameterDeclaration( /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), - /*initializer*/ undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*initializer*/ undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } else { return ts.factory.createFunctionTypeNode(ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.map(node.parameters, function (p, i) { return ts.factory.createParameterDeclaration( /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), - /*initializer*/ undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*initializer*/ undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } } if (ts.isTypeReferenceNode(node) && ts.isInJSDoc(node) && (!existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(node, getTypeFromTypeNode(node)) || getIntendedTypeFromJSDocTypeReference(node) || unknownSymbol === resolveTypeReferenceName(node, 788968 /* SymbolFlags.Type */, /*ignoreErrors*/ true))) { @@ -54924,8 +55222,8 @@ var ts; } } function symbolTableToDeclarationStatements(symbolTable, context, bundled) { - var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 169 /* SyntaxKind.MethodDeclaration */, /*useAcessors*/ true); - var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 168 /* SyntaxKind.MethodSignature */, /*useAcessors*/ false); + var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 171 /* SyntaxKind.MethodDeclaration */, /*useAcessors*/ true); + var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 170 /* SyntaxKind.MethodSignature */, /*useAcessors*/ false); // TODO: Use `setOriginalNode` on original declaration names where possible so these declarations see some kind of // declaration mapping // We save the enclosing declaration off here so it's not adjusted by well-meaning declaration @@ -55163,7 +55461,7 @@ var ts; if (needsPostExportDefault || needsExportDeclaration) { isPrivate = true; } - var modifierFlags = (!isPrivate ? 1 /* ModifierFlags.Export */ : 0) | (isDefault && !needsPostExportDefault ? 512 /* ModifierFlags.Default */ : 0); + var modifierFlags = (!isPrivate ? 1 /* ModifierFlags.Export */ : 0) | (isDefault && !needsPostExportDefault ? 1024 /* ModifierFlags.Default */ : 0); var isConstMergedWithNS = symbol.flags & 1536 /* SymbolFlags.Module */ && symbol.flags & (2 /* SymbolFlags.BlockScopedVariable */ | 1 /* SymbolFlags.FunctionScopedVariable */ | 4 /* SymbolFlags.Property */) && symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */; @@ -55347,8 +55645,8 @@ var ts; // Classes, namespaces, variables, enums, and functions all need `declare` modifiers to be valid in a declaration file top-level scope newModifierFlags |= 2 /* ModifierFlags.Ambient */; } - if ((additionalModifierFlags & 512 /* ModifierFlags.Default */) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) { - newModifierFlags |= 512 /* ModifierFlags.Default */; + if ((additionalModifierFlags & 1024 /* ModifierFlags.Default */) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) { + newModifierFlags |= 1024 /* ModifierFlags.Default */; } if (newModifierFlags) { node = ts.factory.updateModifiers(node, newModifierFlags | ts.getEffectiveModifierFlags(node)); @@ -55382,8 +55680,8 @@ var ts; var baseTypes = getBaseTypes(interfaceType); var baseType = ts.length(baseTypes) ? getIntersectionType(baseTypes) : undefined; var members = ts.flatMap(getPropertiesOfType(interfaceType), function (p) { return serializePropertySymbolForInterface(p, baseType); }); - var callSignatures = serializeSignatures(0 /* SignatureKind.Call */, interfaceType, baseType, 174 /* SyntaxKind.CallSignature */); - var constructSignatures = serializeSignatures(1 /* SignatureKind.Construct */, interfaceType, baseType, 175 /* SyntaxKind.ConstructSignature */); + var callSignatures = serializeSignatures(0 /* SignatureKind.Call */, interfaceType, baseType, 176 /* SyntaxKind.CallSignature */); + var constructSignatures = serializeSignatures(1 /* SignatureKind.Construct */, interfaceType, baseType, 177 /* SyntaxKind.ConstructSignature */); var indexSignatures = serializeIndexSignatures(interfaceType, baseType); var heritageClauses = !ts.length(baseTypes) ? undefined : [ts.factory.createHeritageClause(94 /* SyntaxKind.ExtendsKeyword */, ts.mapDefined(baseTypes, function (b) { return trySerializeAsTypeReference(b, 111551 /* SymbolFlags.Value */); }))]; addResult(ts.factory.createInterfaceDeclaration( @@ -55448,7 +55746,7 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var sig = signatures_2[_i]; // Each overload becomes a separate function declaration, in order - var decl = signatureToSignatureDeclarationHelper(sig, 256 /* SyntaxKind.FunctionDeclaration */, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); + var decl = signatureToSignatureDeclarationHelper(sig, 259 /* SyntaxKind.FunctionDeclaration */, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); addResult(ts.setTextRange(decl, getSignatureTextRangeLocation(sig)), modifierFlags); } // Module symbol emit will take care of module-y members, provided it has exports @@ -55606,7 +55904,7 @@ var ts; !ts.some(getSignaturesOfType(staticType, 1 /* SignatureKind.Construct */)); var constructors = isNonConstructableClassLikeInJsFile ? [ts.factory.createConstructorDeclaration(ts.factory.createModifiersFromModifierFlags(8 /* ModifierFlags.Private */), [], /*body*/ undefined)] : - serializeSignatures(1 /* SignatureKind.Construct */, staticType, staticBaseType, 171 /* SyntaxKind.Constructor */); + serializeSignatures(1 /* SignatureKind.Construct */, staticType, staticBaseType, 173 /* SyntaxKind.Constructor */); var indexSignatures = serializeIndexSignatures(classType, baseTypes[0]); context.enclosingDeclaration = oldEnclosing; addResult(ts.setTextRange(ts.factory.createClassDeclaration( @@ -55655,8 +55953,8 @@ var ts; var targetName = getInternalSymbolName(target, verbatimTargetName); includePrivateSymbol(target); // the target may be within the same scope - attempt to serialize it first switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 254 /* SyntaxKind.VariableDeclaration */) { + case 205 /* SyntaxKind.BindingElement */: + if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 257 /* SyntaxKind.VariableDeclaration */) { // const { SomeClass } = require('./lib'); var specifier_1 = getSpecifierForModuleSymbol(target.parent || target, context); // './lib' var propertyName = node.propertyName; @@ -55669,13 +55967,13 @@ var ts; // We don't know how to serialize this (nested?) binding element ts.Debug.failBadSyntaxKind(((_c = node.parent) === null || _c === void 0 ? void 0 : _c.parent) || node, "Unhandled binding element grandparent kind in declaration serialization"); break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 221 /* SyntaxKind.BinaryExpression */) { + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 223 /* SyntaxKind.BinaryExpression */) { // module.exports = { SomeClass } serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), targetName); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: // commonjs require: const x = require('y') if (ts.isPropertyAccessExpression(node.initializer)) { // const x = require('y').z @@ -55693,7 +55991,7 @@ var ts; break; } // else fall through and treat commonjs require just like import= - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // This _specifically_ only exists to handle json declarations - where we make aliases, but since // we emit no declarations for the json document, must not refer to it in the declarations if (target.escapedName === "export=" /* InternalSymbolName.ExportEquals */ && ts.some(target.declarations, ts.isJsonSourceFile)) { @@ -55709,13 +56007,13 @@ var ts; ? symbolToName(target, context, 67108863 /* SymbolFlags.All */, /*expectsIdentifier*/ false) : ts.factory.createExternalModuleReference(ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)))), isLocalImport ? modifierFlags : 0 /* ModifierFlags.None */); break; - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: // export as namespace foo // TODO: Not part of a file's local or export symbol tables // Is bound into file.symbol.globalExports instead, which we don't currently traverse addResult(ts.factory.createNamespaceExportDeclaration(ts.idText(node.name)), 0 /* ModifierFlags.None */); break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, ts.factory.createIdentifier(localName), /*namedBindings*/ undefined), // We use `target.parent || target` below as `target.parent` is unset when the target is a module which has been export assigned @@ -55724,17 +56022,17 @@ var ts; ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, /*importClause*/ undefined, ts.factory.createNamespaceImport(ts.factory.createIdentifier(localName))), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: addResult(ts.factory.createExportDeclaration( /*modifiers*/ undefined, /*isTypeOnly*/ false, ts.factory.createNamespaceExport(ts.factory.createIdentifier(localName)), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context))), 0 /* ModifierFlags.None */); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause( /*isTypeOnly*/ false, @@ -55744,7 +56042,7 @@ var ts; ])), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: // does not use localName because the symbol name in this case refers to the name in the exports table, // which we must exactly preserve var specifier = node.parent.parent.moduleSpecifier; @@ -55752,12 +56050,12 @@ var ts; // another file serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), specifier ? verbatimTargetName : targetName, specifier && ts.isStringLiteralLike(specifier) ? ts.factory.createStringLiteral(specifier.text) : undefined); break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: serializeMaybeAliasAssignment(symbol); break; - case 221 /* SyntaxKind.BinaryExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // Could be best encoded as though an export specifier or as though an export assignment // If name is default or export=, do an export assignment // Otherwise do an export specifier @@ -55901,7 +56199,7 @@ var ts; && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName)))) { return []; } - var flag = (modifierFlags & ~256 /* ModifierFlags.Async */) | (isStatic ? 32 /* ModifierFlags.Static */ : 0); + var flag = (modifierFlags & ~512 /* ModifierFlags.Async */) | (isStatic ? 32 /* ModifierFlags.Static */ : 0); var name = getPropertyNameNodeForSymbol(p, context); var firstPropertyLikeDecl = (_a = p.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.or(ts.isPropertyDeclaration, ts.isAccessor, ts.isVariableDeclaration, ts.isPropertySignature, ts.isBinaryExpression, ts.isPropertyAccessExpression)); if (p.flags & 98304 /* SymbolFlags.Accessor */ && useAccessors) { @@ -55923,7 +56221,7 @@ var ts; // This is an else/if as accessors and properties can't merge in TS, but might in JS // If this happens, we assume the accessor takes priority, as it imposes more constraints else if (p.flags & (4 /* SymbolFlags.Property */ | 3 /* SymbolFlags.Variable */ | 98304 /* SymbolFlags.Accessor */)) { - return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* ModifierFlags.Readonly */ : 0) | flag), name, p.flags & 16777216 /* SymbolFlags.Optional */ ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), + return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* ModifierFlags.Readonly */ : 0) | flag), name, p.flags & 16777216 /* SymbolFlags.Optional */ ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), // TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357 // interface members can't have initializers, however class members _can_ /*initializer*/ undefined), ((_d = p.declarations) === null || _d === void 0 ? void 0 : _d.find(ts.or(ts.isPropertyDeclaration, ts.isVariableDeclaration))) || firstPropertyLikeDecl); @@ -56113,7 +56411,7 @@ var ts; if (flags === void 0) { flags = 16384 /* TypeFormatFlags.UseAliasDefinedOutsideCurrentScope */; } return writer ? typePredicateToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(typePredicateToStringWorker); function typePredicateToStringWorker(writer) { - var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createToken(128 /* SyntaxKind.AssertsKeyword */) : undefined, typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */) // TODO: GH#18217 + var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createToken(129 /* SyntaxKind.AssertsKeyword */) : undefined, typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */) // TODO: GH#18217 ); var printer = ts.createPrinter({ removeComments: true }); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); @@ -56160,7 +56458,7 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* SymbolFlags.TypeLiteral */ && type.symbol.declarations) { var node = ts.walkUpParenthesizedTypes(type.symbol.declarations[0].parent); - if (node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + if (node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -56168,11 +56466,11 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && + node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isExternalModuleAugmentation(node.parent.parent); } function isDefaultBindingContext(location) { - return location.kind === 305 /* SyntaxKind.SourceFile */ || ts.isAmbientModule(location); + return location.kind === 308 /* SyntaxKind.SourceFile */ || ts.isAmbientModule(location); } function getNameOfSymbolFromNameType(symbol, context) { var nameType = getSymbolLinks(symbol).nameType; @@ -56231,17 +56529,17 @@ var ts; if (!declaration) { declaration = symbol.declarations[0]; // Declaration may be nameless, but we'll try anyway } - if (declaration.parent && declaration.parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (declaration.parent && declaration.parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { return ts.declarationNameToString(declaration.parent.name); } switch (declaration.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (context && !context.encounteredError && !(context.flags & 131072 /* NodeBuilderFlags.AllowAnonymousIdentifier */)) { context.encounteredError = true; } - return declaration.kind === 226 /* SyntaxKind.ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; + return declaration.kind === 228 /* SyntaxKind.ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; } } var name = getNameOfSymbolFromNameType(symbol, context); @@ -56258,28 +56556,28 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: // Top-level jsdoc type aliases are considered exported // First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent)); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return isDeclarationVisible(node.parent.parent); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { // If the binding pattern is empty, this variable declaration is not visible return false; } // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // external module augmentation is always visible if (ts.isExternalModuleAugmentation(node)) { return true; @@ -56287,55 +56585,55 @@ var ts; var parent = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedModifierFlags(node) & 1 /* ModifierFlags.Export */) && - !(node.kind !== 265 /* SyntaxKind.ImportEqualsDeclaration */ && parent.kind !== 305 /* SyntaxKind.SourceFile */ && parent.flags & 16777216 /* NodeFlags.Ambient */)) { + !(node.kind !== 268 /* SyntaxKind.ImportEqualsDeclaration */ && parent.kind !== 308 /* SyntaxKind.SourceFile */ && parent.flags & 16777216 /* NodeFlags.Ambient */)) { return isGlobalSourceFile(parent); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible return isDeclarationVisible(parent); - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.hasEffectiveModifier(node, 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */)) { // Private/protected properties/methods are not visible return false; } // Public properties/methods are visible if its parents are visible, so: // falls through - case 171 /* SyntaxKind.Constructor */: - case 175 /* SyntaxKind.ConstructSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 164 /* SyntaxKind.Parameter */: - case 262 /* SyntaxKind.ModuleBlock */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 178 /* SyntaxKind.TypeReference */: - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 173 /* SyntaxKind.Constructor */: + case 177 /* SyntaxKind.ConstructSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 166 /* SyntaxKind.Parameter */: + case 265 /* SyntaxKind.ModuleBlock */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 180 /* SyntaxKind.TypeReference */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: return false; // Type parameters are always visible - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: // Source file and namespace export are always visible // falls through - case 305 /* SyntaxKind.SourceFile */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return true; // Export assignments do not create name bindings outside the module - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return false; default: return false; @@ -56344,10 +56642,10 @@ var ts; } function collectLinkedAliases(node, setVisibility) { var exportSymbol; - if (node.parent && node.parent.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (node.parent && node.parent.kind === 274 /* SyntaxKind.ExportAssignment */) { exportSymbol = resolveName(node, node.escapedText, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false); } - else if (node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) { + else if (node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) { exportSymbol = getTargetOfExportSpecifier(node.parent, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */); } var result; @@ -56454,12 +56752,12 @@ var ts; function getDeclarationContainer(node) { return ts.findAncestor(ts.getRootDeclaration(node), function (node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 255 /* SyntaxKind.VariableDeclarationList */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 269 /* SyntaxKind.NamedImports */: - case 268 /* SyntaxKind.NamespaceImport */: - case 267 /* SyntaxKind.ImportClause */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 258 /* SyntaxKind.VariableDeclarationList */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 272 /* SyntaxKind.NamedImports */: + case 271 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: return false; default: return true; @@ -56589,23 +56887,23 @@ var ts; function getParentElementAccess(node) { var ancestor = node.parent.parent; switch (ancestor.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: return getSyntheticElementAccess(ancestor); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getSyntheticElementAccess(node.parent); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ancestor.initializer; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return ancestor.right; } } function getDestructuringPropertyName(node) { var parent = node.parent; - if (node.kind === 203 /* SyntaxKind.BindingElement */ && parent.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (node.kind === 205 /* SyntaxKind.BindingElement */ && parent.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { return getLiteralPropertyNameText(node.propertyName || node.name); } - if (node.kind === 296 /* SyntaxKind.PropertyAssignment */ || node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.kind === 299 /* SyntaxKind.PropertyAssignment */ || node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return getLiteralPropertyNameText(node.name); } return "" + parent.elements.indexOf(node); @@ -56635,7 +56933,7 @@ var ts; parentType = getTypeWithFacts(parentType, 524288 /* TypeFacts.NEUndefined */); } var type; - if (pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (declaration.dotDotDotToken) { parentType = getReducedType(parentType); if (parentType.flags & 2 /* TypeFlags.Unknown */ || !isValidSpreadType(parentType)) { @@ -56706,7 +57004,7 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node, /*excludeJSDocTypeAssertions*/ true); - return expr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && expr.elements.length === 0; + return expr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && expr.elements.length === 0; } function addOptionality(type, isProperty, isOptional) { if (isProperty === void 0) { isProperty = false; } @@ -56717,11 +57015,11 @@ var ts; function getTypeForVariableLikeDeclaration(declaration, includeOptionality, checkMode) { // A variable declared in a for..in statement is of type string, or of type keyof T when the // right hand expression is of a type parameter type. - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression, /*checkMode*/ checkMode))); return indexType.flags & (262144 /* TypeFlags.TypeParameter */ | 4194304 /* TypeFlags.Index */) ? getExtractStringType(indexType) : stringType; } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { // checkRightHandSideOfForOf will return undefined if the for-of expression type was // missing properties/signatures required to get its iteratedType (like // [Symbol.iterator] or next). This may be because we accessed properties from anyType, @@ -56732,7 +57030,7 @@ var ts; if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } - var isProperty = ts.isPropertyDeclaration(declaration) || ts.isPropertySignature(declaration); + var isProperty = ts.isPropertyDeclaration(declaration) && !ts.hasAccessorModifier(declaration) || ts.isPropertySignature(declaration); var isOptional = includeOptionality && (isProperty && !!declaration.questionToken || ts.isParameter(declaration) && (!!declaration.questionToken || isJSDocOptionalParameter(declaration)) || isOptionalJSDocPropertyLikeTag(declaration)); @@ -56759,8 +57057,8 @@ var ts; if (ts.isParameter(declaration)) { var func = declaration.parent; // For a parameter of a set accessor, use the type of the get accessor if one is present - if (func.kind === 173 /* SyntaxKind.SetAccessor */ && hasBindableName(func)) { - var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 172 /* SyntaxKind.GetAccessor */); + if (func.kind === 175 /* SyntaxKind.SetAccessor */ && hasBindableName(func)) { + var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 174 /* SyntaxKind.GetAccessor */); if (getter) { var getterSignature = getSignatureFromDeclaration(getter); var thisParameter = getAccessorThisParameter(func); @@ -56772,11 +57070,9 @@ var ts; return getReturnTypeOfSignature(getterSignature); } } - if (ts.isInJSFile(declaration)) { - var type_1 = getParameterTypeOfTypeTag(func, declaration); - if (type_1) - return type_1; - } + var parameterTypeOfTypeTag = getParameterTypeOfTypeTag(func, declaration); + if (parameterTypeOfTypeTag) + return parameterTypeOfTypeTag; // Use contextual parameter type if one is available var type = declaration.symbol.escapedName === "this" /* InternalSymbolName.This */ ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration); if (type) { @@ -56837,7 +57133,7 @@ var ts; links.isConstructorDeclaredProperty = !!getDeclaringConstructor(symbol) && ts.every(symbol.declarations, function (declaration) { return ts.isBinaryExpression(declaration) && isPossiblyAliasedThisProperty(declaration) && - (declaration.left.kind !== 207 /* SyntaxKind.ElementAccessExpression */ || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && + (declaration.left.kind !== 209 /* SyntaxKind.ElementAccessExpression */ || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && !getAnnotatedTypeForAssignmentDeclaration(/*declaredType*/ undefined, declaration, symbol, declaration); }); } @@ -56859,11 +57155,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; var container = ts.getThisContainer(declaration, /*includeArrowFunctions*/ false); - if (container && (container.kind === 171 /* SyntaxKind.Constructor */ || isJSConstructor(container))) { + if (container && (container.kind === 173 /* SyntaxKind.Constructor */ || isJSConstructor(container))) { return container; } } - ; } /** Create a synthetic property access flow node after the last statement of the file */ function getFlowTypeFromCommonJSExport(symbol) { @@ -57156,9 +57451,9 @@ var ts; var thisContainer = ts.getThisContainer(expression, /*includeArrowFunctions*/ false); // Properties defined in a constructor (or base constructor, or javascript constructor function) don't get undefined added. // Function expressions that are assigned to the prototype count as methods. - return thisContainer.kind === 171 /* SyntaxKind.Constructor */ || - thisContainer.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - (thisContainer.kind === 213 /* SyntaxKind.FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); + return thisContainer.kind === 173 /* SyntaxKind.Constructor */ || + thisContainer.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + (thisContainer.kind === 215 /* SyntaxKind.FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); } function getConstructorDefinedThisAssignmentTypes(types, declarations) { ts.Debug.assert(types.length === declarations.length); @@ -57186,7 +57481,11 @@ var ts; if (reportErrors && !declarationBelongsToPrivateAmbientMember(element)) { reportImplicitAny(element, anyType); } - return anyType; + // When we're including the pattern in the type (an indication we're obtaining a contextual type), we + // use a non-inferrable any type. Inference will never directly infer this type, but it is possible + // to infer a type that contains it, e.g. for a binding pattern like [foo] or { foo }. In such cases, + // widening of the binding pattern type substitutes a regular any for the non-inferrable any. + return includePatternInType ? nonInferrableAnyType : anyType; } // Return the type implied by an object binding pattern function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) { @@ -57224,7 +57523,7 @@ var ts; function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) { var elements = pattern.elements; var lastElement = ts.lastOrUndefined(elements); - var restElement = lastElement && lastElement.kind === 203 /* SyntaxKind.BindingElement */ && lastElement.dotDotDotToken ? lastElement : undefined; + var restElement = lastElement && lastElement.kind === 205 /* SyntaxKind.BindingElement */ && lastElement.dotDotDotToken ? lastElement : undefined; if (elements.length === 0 || elements.length === 1 && restElement) { return languageVersion >= 2 /* ScriptTarget.ES2015 */ ? createIterableType(anyType) : anyArrayType; } @@ -57249,7 +57548,7 @@ var ts; function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { if (includePatternInType === void 0) { includePatternInType = false; } if (reportErrors === void 0) { reportErrors = false; } - return pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ + return pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -57297,7 +57596,7 @@ var ts; } function declarationBelongsToPrivateAmbientMember(declaration) { var root = ts.getRootDeclaration(declaration); - var memberDeclaration = root.kind === 164 /* SyntaxKind.Parameter */ ? root.parent : root; + var memberDeclaration = root.kind === 166 /* SyntaxKind.Parameter */ ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function tryGetTypeFromEffectiveTypeNode(node) { @@ -57352,9 +57651,9 @@ var ts; if (typeNode === undefined) { return useUnknownInCatchVariables ? unknownType : anyType; } - var type_2 = getTypeOfNode(typeNode); + var type_1 = getTypeOfNode(typeNode); // an errorType will make `checkTryStatement` issue an error - return isTypeAny(type_2) || type_2 === unknownType ? type_2 : errorType; + return isTypeAny(type_1) || type_1 === unknownType ? type_1 : errorType; } // Handle export default expressions if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) { @@ -57377,7 +57676,7 @@ var ts; return reportCircularityError(symbol); } var type; - if (declaration.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (declaration.kind === 274 /* SyntaxKind.ExportAssignment */) { type = widenTypeForVariableLikeDeclaration(tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionCached(declaration.expression), declaration); } else if (ts.isBinaryExpression(declaration) || @@ -57445,13 +57744,17 @@ var ts; } function getAnnotatedAccessorTypeNode(accessor) { if (accessor) { - if (accessor.kind === 172 /* SyntaxKind.GetAccessor */) { - var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); - return getterTypeAnnotation; - } - else { - var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation; + switch (accessor.kind) { + case 174 /* SyntaxKind.GetAccessor */: + var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); + return getterTypeAnnotation; + case 175 /* SyntaxKind.SetAccessor */: + var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); + return setterTypeAnnotation; + case 169 /* SyntaxKind.PropertyDeclaration */: + ts.Debug.assert(ts.hasAccessorModifier(accessor)); + var accessorTypeAnnotation = ts.getEffectiveTypeAnnotationNode(accessor); + return accessorTypeAnnotation; } } return undefined; @@ -57473,14 +57776,17 @@ var ts; if (!pushTypeResolution(symbol, 0 /* TypeSystemPropertyName.Type */)) { return errorType; } - var getter = ts.getDeclarationOfKind(symbol, 172 /* SyntaxKind.GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 174 /* SyntaxKind.GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */); + var accessor = ts.tryCast(ts.getDeclarationOfKind(symbol, 169 /* SyntaxKind.PropertyDeclaration */), ts.isAutoAccessorPropertyDeclaration); // We try to resolve a getter type annotation, a setter type annotation, or a getter function // body return type inference, in that order. var type = getter && ts.isInJSFile(getter) && getTypeForDeclarationFromJSDocComment(getter) || getAnnotatedAccessorType(getter) || getAnnotatedAccessorType(setter) || - getter && getter.body && getReturnTypeFromBody(getter); + getAnnotatedAccessorType(accessor) || + getter && getter.body && getReturnTypeFromBody(getter) || + accessor && accessor.initializer && getWidenedTypeForVariableLikeDeclaration(accessor, /*includeOptionality*/ true); if (!type) { if (setter && !isPrivateWithinAmbient(setter)) { errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol)); @@ -57488,6 +57794,9 @@ var ts; else if (getter && !isPrivateWithinAmbient(getter)) { errorOrSuggestion(noImplicitAny, getter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol)); } + else if (accessor && !isPrivateWithinAmbient(accessor)) { + errorOrSuggestion(noImplicitAny, accessor, ts.Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), "any"); + } type = anyType; } if (!popTypeResolution()) { @@ -57497,6 +57806,9 @@ var ts; else if (getAnnotatedAccessorTypeNode(setter)) { error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); } + else if (getAnnotatedAccessorTypeNode(accessor)) { + error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } else if (getter && noImplicitAny) { error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } @@ -57507,12 +57819,13 @@ var ts; return links.type; } function getWriteTypeOfAccessors(symbol) { + var _a; var links = getSymbolLinks(symbol); if (!links.writeType) { if (!pushTypeResolution(symbol, 8 /* TypeSystemPropertyName.WriteType */)) { return errorType; } - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var setter = (_a = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */)) !== null && _a !== void 0 ? _a : ts.tryCast(ts.getDeclarationOfKind(symbol, 169 /* SyntaxKind.PropertyDeclaration */), ts.isAutoAccessorPropertyDeclaration); var writeType = getAnnotatedAccessorType(setter); if (!popTypeResolution()) { if (getAnnotatedAccessorTypeNode(setter)) { @@ -57552,9 +57865,9 @@ var ts; if (symbol.flags & 1536 /* SymbolFlags.Module */ && ts.isShorthandAmbientModuleSymbol(symbol)) { return anyType; } - else if (declaration && (declaration.kind === 221 /* SyntaxKind.BinaryExpression */ || + else if (declaration && (declaration.kind === 223 /* SyntaxKind.BinaryExpression */ || ts.isAccessExpression(declaration) && - declaration.parent.kind === 221 /* SyntaxKind.BinaryExpression */)) { + declaration.parent.kind === 223 /* SyntaxKind.BinaryExpression */)) { return getWidenedTypeForAssignmentDeclaration(symbol); } else if (symbol.flags & 512 /* SymbolFlags.ValueModule */ && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) { @@ -57564,11 +57877,11 @@ var ts; return errorType; } var exportEquals = getMergedSymbol(symbol.exports.get("export=" /* InternalSymbolName.ExportEquals */)); - var type_3 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule); + var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule); if (!popTypeResolution()) { return reportCircularityError(symbol); } - return type_3; + return type_2; } } var type = createObjectType(16 /* ObjectFlags.Anonymous */, symbol); @@ -57619,7 +57932,7 @@ var ts; return errorType; } // Check if variable has initializer that circularly references the variable itself - if (noImplicitAny && (declaration.kind !== 164 /* SyntaxKind.Parameter */ || declaration.initializer)) { + if (noImplicitAny && (declaration.kind !== 166 /* SyntaxKind.Parameter */ || declaration.initializer)) { error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); } // Circularities could also result from parameters in function expressions that end up @@ -57751,46 +58064,46 @@ var ts; return undefined; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 195 /* SyntaxKind.MappedType */: - case 189 /* SyntaxKind.ConditionalType */: { + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 197 /* SyntaxKind.MappedType */: + case 191 /* SyntaxKind.ConditionalType */: { var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); - if (node.kind === 195 /* SyntaxKind.MappedType */) { + if (node.kind === 197 /* SyntaxKind.MappedType */) { return ts.append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter))); } - else if (node.kind === 189 /* SyntaxKind.ConditionalType */) { + else if (node.kind === 191 /* SyntaxKind.ConditionalType */) { return ts.concatenate(outerTypeParameters, getInferTypeParameters(node)); } var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node)); var thisType = includeThisTypes && - (node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */ || node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || isJSConstructor(node)) && + (node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */ || node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || isJSConstructor(node)) && getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters; } - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: var paramSymbol = ts.getParameterSymbolFromJSDoc(node); if (paramSymbol) { node = paramSymbol.valueDeclaration; } break; - case 320 /* SyntaxKind.JSDoc */: { + case 323 /* SyntaxKind.JSDoc */: { var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); return node.tags ? appendTypeParameters(outerTypeParameters, ts.flatMap(node.tags, function (t) { return ts.isJSDocTemplateTag(t) ? t.typeParameters : undefined; })) @@ -57801,7 +58114,7 @@ var ts; } // The outer type parameters are those defined by enclosing generic classes, methods, or functions. function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 /* SymbolFlags.Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 258 /* SyntaxKind.InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* SymbolFlags.Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.InterfaceDeclaration */); ts.Debug.assert(!!declaration, "Class was missing valueDeclaration -OR- non-class had no interface declarations"); return getOuterTypeParameters(declaration); } @@ -57814,9 +58127,9 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - node.kind === 257 /* SyntaxKind.ClassDeclaration */ || - node.kind === 226 /* SyntaxKind.ClassExpression */ || + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + node.kind === 260 /* SyntaxKind.ClassDeclaration */ || + node.kind === 228 /* SyntaxKind.ClassExpression */ || isJSConstructor(node) || ts.isTypeAlias(node)) { var declaration = node; @@ -57968,7 +58281,7 @@ var ts; if (!popTypeResolution() && type.symbol.declarations) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ || declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ || declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { reportCircularBaseType(declaration, type); } } @@ -58064,7 +58377,7 @@ var ts; if (type.symbol.declarations) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getReducedType(getTypeFromTypeNode(node)); @@ -58104,7 +58417,7 @@ var ts; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { if (declaration.flags & 128 /* NodeFlags.ContainsThis */) { return false; } @@ -58183,7 +58496,7 @@ var ts; } else { type = errorType; - if (declaration.kind === 339 /* SyntaxKind.JSDocEnumTag */) { + if (declaration.kind === 342 /* SyntaxKind.JSDocEnumTag */) { error(declaration.typeExpression.type, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } else { @@ -58198,7 +58511,7 @@ var ts; if (ts.isStringLiteralLike(expr)) { return true; } - else if (expr.kind === 221 /* SyntaxKind.BinaryExpression */) { + else if (expr.kind === 223 /* SyntaxKind.BinaryExpression */) { return isStringConcatExpression(expr.left) && isStringConcatExpression(expr.right); } return false; @@ -58213,12 +58526,12 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return true; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 8 /* SyntaxKind.NumericLiteral */; case 79 /* SyntaxKind.Identifier */: return ts.nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isStringConcatExpression(expr); default: return false; @@ -58233,7 +58546,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind === 263 /* SyntaxKind.EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (member.initializer && ts.isStringLiteralLike(member.initializer)) { @@ -58262,7 +58575,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind === 263 /* SyntaxKind.EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; var value = getEnumMemberValue(member); @@ -58335,22 +58648,22 @@ var ts; */ function isThislessType(node) { switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 196 /* SyntaxKind.LiteralType */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 198 /* SyntaxKind.LiteralType */: return true; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return isThislessType(node.elementType); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return !node.typeArguments || node.typeArguments.every(isThislessType); } return false; @@ -58376,7 +58689,7 @@ var ts; function isThislessFunctionLikeDeclaration(node) { var returnType = ts.getEffectiveReturnTypeNode(node); var typeParameters = ts.getEffectiveTypeParameterDeclarations(node); - return (node.kind === 171 /* SyntaxKind.Constructor */ || (!!returnType && isThislessType(returnType))) && + return (node.kind === 173 /* SyntaxKind.Constructor */ || (!!returnType && isThislessType(returnType))) && node.parameters.every(isThislessVariableLikeDeclaration) && typeParameters.every(isThislessTypeParameter); } @@ -58392,14 +58705,14 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return isThislessVariableLikeDeclaration(declaration); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return isThislessFunctionLikeDeclaration(declaration); } } @@ -58610,8 +58923,10 @@ var ts; if (members) { for (var _b = 0, members_5 = members; _b < members_5.length; _b++) { var member = members_5[_b]; - if (isStatic_1 === ts.hasStaticModifier(member) && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic_1 === ts.hasStaticModifier(member)) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -58626,8 +58941,10 @@ var ts; || ts.isBinaryExpression(member) && isPossiblyAliasedThisProperty(member, assignmentKind) || assignmentKind === 9 /* AssignmentDeclarationKind.ObjectDefinePrototypeProperty */ || assignmentKind === 6 /* AssignmentDeclarationKind.Prototype */; // A straight `Prototype` assignment probably can never have a computed name - if (isStatic_1 === !isInstanceMember && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic_1 === !isInstanceMember) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -58814,7 +59131,7 @@ var ts; var baseConstructorType = getBaseConstructorTypeOfClass(classType); var baseSignatures = getSignaturesOfType(baseConstructorType, 1 /* SignatureKind.Construct */); var declaration = ts.getClassLikeDeclarationOfSymbol(classType.symbol); - var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */); + var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */); if (baseSignatures.length === 0) { return [createSignature(undefined, classType.localTypeParameters, undefined, ts.emptyArray, classType, /*resolvedTypePredicate*/ undefined, 0, isAbstract ? 4 /* SignatureFlags.Abstract */ : 0 /* SignatureFlags.None */)]; } @@ -59287,6 +59604,12 @@ var ts; return mapType(type, getLowerBoundOfKeyType); } if (type.flags & 2097152 /* TypeFlags.Intersection */) { + // Similarly to getTypeFromIntersectionTypeNode, we preserve the special string & {}, number & {}, + // and bigint & {} intersections that are used to prevent subtype reduction in union types. + var types = type.types; + if (types.length === 2 && !!(types[0].flags & (4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) && types[1] === emptyTypeLiteralType) { + return type; + } return getIntersectionType(ts.sameMap(type.types, getLowerBoundOfKeyType)); } return type; @@ -59430,8 +59753,8 @@ var ts; } function isMappedTypeWithKeyofConstraintDeclaration(type) { var constraintDeclaration = getConstraintDeclarationForMappedType(type); // TODO: GH#18217 - return constraintDeclaration.kind === 193 /* SyntaxKind.TypeOperator */ && - constraintDeclaration.operator === 140 /* SyntaxKind.KeyOfKeyword */; + return constraintDeclaration.kind === 195 /* SyntaxKind.TypeOperator */ && + constraintDeclaration.operator === 141 /* SyntaxKind.KeyOfKeyword */; } function getModifiersTypeFromMappedType(type) { if (!type.modifiersType) { @@ -59791,10 +60114,10 @@ var ts; var baseTypes = []; var different = false; for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var type_4 = types_7[_i]; - var baseType = getBaseConstraint(type_4); + var type_3 = types_7[_i]; + var baseType = getBaseConstraint(type_3); if (baseType) { - if (baseType !== type_4) { + if (baseType !== type_3) { different = true; } baseTypes.push(baseType); @@ -59838,7 +60161,7 @@ var ts; return constraint && getBaseConstraint(constraint); } if (t.flags & 33554432 /* TypeFlags.Substitution */) { - return getBaseConstraint(t.substitute); + return getBaseConstraint(getSubstitutionIntersection(t)); } return t; } @@ -59965,7 +60288,7 @@ var ts; var isInstantiation = (getTargetSymbol(prop) || prop) === (getTargetSymbol(singleProp) || singleProp); // If the symbols are instances of one another with identical types - consider the symbols // equivalent and just use the first one, which thus allows us to avoid eliding private - // members when intersecting a (this-)instantiations of a class with it's raw base or another instance + // members when intersecting a (this-)instantiations of a class with its raw base or another instance if (isInstantiation && compareProperties(singleProp, prop, function (a, b) { return a === b ? -1 /* Ternary.True */ : 0 /* Ternary.False */; }) === -1 /* Ternary.True */) { // If we merged instantiations of a generic type, we replicate the symbol parent resetting behavior we used // to do when we recorded multiple distinct symbols so that we still get, eg, `Array.length` printed @@ -60013,7 +60336,11 @@ var ts; } } } - if (!singleProp || isUnion && (propSet || checkFlags & 48 /* CheckFlags.Partial */) && checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */)) { + if (!singleProp || + isUnion && + (propSet || checkFlags & 48 /* CheckFlags.Partial */) && + checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */) && + !(propSet && getCommonDeclarationsOfSymbols(ts.arrayFrom(propSet.values())))) { // No property was found, or, in a union, a property has a private or protected declaration in one // constituent, but is missing or has a different declaration in another constituent. return undefined; @@ -60115,6 +60442,33 @@ var ts; } return property; } + function getCommonDeclarationsOfSymbols(symbols) { + var commonDeclarations; + var _loop_14 = function (symbol) { + if (!symbol.declarations) { + return { value: undefined }; + } + if (!commonDeclarations) { + commonDeclarations = new ts.Set(symbol.declarations); + return "continue"; + } + commonDeclarations.forEach(function (declaration) { + if (!ts.contains(symbol.declarations, declaration)) { + commonDeclarations.delete(declaration); + } + }); + if (commonDeclarations.size === 0) { + return { value: undefined }; + } + }; + for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) { + var symbol = symbols_3[_i]; + var state_4 = _loop_14(symbol); + if (typeof state_4 === "object") + return state_4.value; + } + return commonDeclarations; + } function getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment) { var property = getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment); // We need to filter out partial properties in union types @@ -60318,10 +60672,10 @@ var ts; function isJSDocOptionalParameter(node) { return ts.isInJSFile(node) && ( // node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType - node.type && node.type.kind === 316 /* SyntaxKind.JSDocOptionalType */ + node.type && node.type.kind === 319 /* SyntaxKind.JSDocOptionalType */ || ts.getJSDocParameterTags(node).some(function (_a) { var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */; })); } function tryFindAmbientModule(moduleName, withAugmentations) { @@ -60354,14 +60708,14 @@ var ts; return false; } function isOptionalPropertyDeclaration(node) { - return ts.isPropertyDeclaration(node) && node.questionToken; + return ts.isPropertyDeclaration(node) && !ts.hasAccessorModifier(node) && node.questionToken; } function isOptionalJSDocPropertyLikeTag(node) { if (!ts.isJSDocPropertyLikeTag(node)) { return false; } var isBracketed = node.isBracketed, typeExpression = node.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */; } function createTypePredicate(kind, parameterName, parameterIndex, type) { return { kind: kind, parameterName: parameterName, parameterIndex: parameterIndex, type: type }; @@ -60443,7 +60797,7 @@ var ts; else { parameters.push(paramSymbol); } - if (type && type.kind === 196 /* SyntaxKind.LiteralType */) { + if (type && type.kind === 198 /* SyntaxKind.LiteralType */) { flags |= 2 /* SignatureFlags.HasLiteralTypes */; } // Record a new minimum argument count if this is not an optional parameter @@ -60456,24 +60810,24 @@ var ts; } } // If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation - if ((declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) && + if ((declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) && hasBindableName(declaration) && (!hasThisParameter || !thisParameter)) { - var otherKind = declaration.kind === 172 /* SyntaxKind.GetAccessor */ ? 173 /* SyntaxKind.SetAccessor */ : 172 /* SyntaxKind.GetAccessor */; + var otherKind = declaration.kind === 174 /* SyntaxKind.GetAccessor */ ? 175 /* SyntaxKind.SetAccessor */ : 174 /* SyntaxKind.GetAccessor */; var other = ts.getDeclarationOfKind(getSymbolOfNode(declaration), otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); } } - var classType = declaration.kind === 171 /* SyntaxKind.Constructor */ ? + var classType = declaration.kind === 173 /* SyntaxKind.Constructor */ ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration); if (ts.hasRestParameter(declaration) || ts.isInJSFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters)) { flags |= 1 /* SignatureFlags.HasRestParameter */; } - if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */) || - ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 128 /* ModifierFlags.Abstract */)) { + if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */) || + ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 256 /* ModifierFlags.Abstract */)) { flags |= 4 /* SignatureFlags.Abstract */; } links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, @@ -60552,16 +60906,16 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node.escapedText === argumentsSymbol.escapedName && getReferencedValueSymbol(node) === argumentsSymbol; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && traverse(node.name); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return traverse(node.expression); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return traverse(node.initializer); default: return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && !!ts.forEachChild(node, traverse); @@ -60585,7 +60939,12 @@ var ts; continue; } } - result.push(getSignatureFromDeclaration(decl)); + // If this is a function or method declaration, get the signature from the @type tag for the sake of optional parameters. + // Exclude contextually-typed kinds because we already apply the @type tag to the context, plus applying it here to the initializer would supress checks that the two are compatible. + result.push((!ts.isFunctionExpressionOrArrowFunction(decl) && + !ts.isObjectLiteralMethod(decl) && + getSignatureOfTypeTag(decl)) || + getSignatureFromDeclaration(decl)); } return result; } @@ -60616,7 +60975,7 @@ var ts; else { var type = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration); var jsdocPredicate = void 0; - if (!type && ts.isInJSFile(signature.declaration)) { + if (!type) { var jsdocSignature = getSignatureOfTypeTag(signature.declaration); if (jsdocSignature && signature !== jsdocSignature) { jsdocPredicate = getTypePredicateOfSignature(jsdocSignature); @@ -60633,7 +60992,7 @@ var ts; function createTypePredicateFromTypePredicateNode(node, signature) { var parameterName = node.parameterName; var type = node.type && getTypeFromTypeNode(node.type); - return parameterName.kind === 192 /* SyntaxKind.ThisType */ ? + return parameterName.kind === 194 /* SyntaxKind.ThisType */ ? createTypePredicate(node.assertsModifier ? 2 /* TypePredicateKind.AssertsThis */ : 0 /* TypePredicateKind.This */, /*parameterName*/ undefined, /*parameterIndex*/ undefined, type) : createTypePredicate(node.assertsModifier ? 3 /* TypePredicateKind.AssertsIdentifier */ : 1 /* TypePredicateKind.Identifier */, parameterName.escapedText, ts.findIndex(signature.parameters, function (p) { return p.escapedName === parameterName.escapedText; }), type); } @@ -60679,7 +61038,7 @@ var ts; return signature.resolvedReturnType; } function getReturnTypeFromAnnotation(declaration) { - if (declaration.kind === 171 /* SyntaxKind.Constructor */) { + if (declaration.kind === 173 /* SyntaxKind.Constructor */) { return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)); } if (ts.isJSDocConstructSignature(declaration)) { @@ -60689,12 +61048,12 @@ var ts; if (typeNode) { return getTypeFromTypeNode(typeNode); } - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ && hasBindableName(declaration)) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ && hasBindableName(declaration)) { var jsDocType = ts.isInJSFile(declaration) && getTypeForDeclarationFromJSDocComment(declaration); if (jsDocType) { return jsDocType; } - var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 173 /* SyntaxKind.SetAccessor */); + var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 175 /* SyntaxKind.SetAccessor */); var setterType = getAnnotatedAccessorType(setter); if (setterType) { return setterType; @@ -60797,7 +61156,7 @@ var ts; if (!signature.isolatedSignatureType) { var kind = (_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind; // If declaration is undefined, it is likely to be the signature of the default constructor. - var isConstructor = kind === undefined || kind === 171 /* SyntaxKind.Constructor */ || kind === 175 /* SyntaxKind.ConstructSignature */ || kind === 180 /* SyntaxKind.ConstructorType */; + var isConstructor = kind === undefined || kind === 173 /* SyntaxKind.Constructor */ || kind === 177 /* SyntaxKind.ConstructSignature */ || kind === 182 /* SyntaxKind.ConstructorType */; var type = createObjectType(16 /* ObjectFlags.Anonymous */); type.members = emptySymbols; type.properties = ts.emptyArray; @@ -60824,7 +61183,7 @@ var ts; function getIndexInfosOfIndexSymbol(indexSymbol) { if (indexSymbol.declarations) { var indexInfos_4 = []; - var _loop_14 = function (declaration) { + var _loop_15 = function (declaration) { if (declaration.parameters.length === 1) { var parameter = declaration.parameters[0]; if (parameter.type) { @@ -60838,7 +61197,7 @@ var ts; }; for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - _loop_14(declaration); + _loop_15(declaration); } return indexInfos_4; } @@ -60855,14 +61214,14 @@ var ts; var _a; var inferences; if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) { - var _loop_15 = function (declaration) { - if (declaration.parent.kind === 190 /* SyntaxKind.InferType */) { + var _loop_16 = function (declaration) { + if (declaration.parent.kind === 192 /* SyntaxKind.InferType */) { // When an 'infer T' declaration is immediately contained in a type reference node // (such as 'Foo'), T's constraint is inferred from the constraint of the // corresponding type parameter in 'Foo'. When multiple 'infer T' declarations are // present, we form an intersection of the inferred constraint types. var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1]; - if (grandParent.kind === 178 /* SyntaxKind.TypeReference */ && !omitTypeReferences) { + if (grandParent.kind === 180 /* SyntaxKind.TypeReference */ && !omitTypeReferences) { var typeReference_1 = grandParent; var typeParameters_1 = getTypeParametersForTypeReference(typeReference_1); if (typeParameters_1) { @@ -60889,27 +61248,27 @@ var ts; } // When an 'infer T' declaration is immediately contained in a rest parameter declaration, a rest type // or a named rest tuple element, we infer an 'unknown[]' constraint. - else if (grandParent.kind === 164 /* SyntaxKind.Parameter */ && grandParent.dotDotDotToken || - grandParent.kind === 186 /* SyntaxKind.RestType */ || - grandParent.kind === 197 /* SyntaxKind.NamedTupleMember */ && grandParent.dotDotDotToken) { + else if (grandParent.kind === 166 /* SyntaxKind.Parameter */ && grandParent.dotDotDotToken || + grandParent.kind === 188 /* SyntaxKind.RestType */ || + grandParent.kind === 199 /* SyntaxKind.NamedTupleMember */ && grandParent.dotDotDotToken) { inferences = ts.append(inferences, createArrayType(unknownType)); } // When an 'infer T' declaration is immediately contained in a string template type, we infer a 'string' // constraint. - else if (grandParent.kind === 199 /* SyntaxKind.TemplateLiteralTypeSpan */) { + else if (grandParent.kind === 201 /* SyntaxKind.TemplateLiteralTypeSpan */) { inferences = ts.append(inferences, stringType); } // When an 'infer T' declaration is in the constraint position of a mapped type, we infer a 'keyof any' // constraint. - else if (grandParent.kind === 163 /* SyntaxKind.TypeParameter */ && grandParent.parent.kind === 195 /* SyntaxKind.MappedType */) { + else if (grandParent.kind === 165 /* SyntaxKind.TypeParameter */ && grandParent.parent.kind === 197 /* SyntaxKind.MappedType */) { inferences = ts.append(inferences, keyofConstraintType); } // When an 'infer T' declaration is the template of a mapped type, and that mapped type is the extends // clause of a conditional whose check type is also a mapped type, give it a constraint equal to the template // of the check type's mapped type - else if (grandParent.kind === 195 /* SyntaxKind.MappedType */ && grandParent.type && - ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 189 /* SyntaxKind.ConditionalType */ && - grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 195 /* SyntaxKind.MappedType */ && + else if (grandParent.kind === 197 /* SyntaxKind.MappedType */ && grandParent.type && + ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 191 /* SyntaxKind.ConditionalType */ && + grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 197 /* SyntaxKind.MappedType */ && grandParent.parent.checkType.type) { var checkMappedType_1 = grandParent.parent.checkType; var nodeType = getTypeFromTypeNode(checkMappedType_1.type); @@ -60919,7 +61278,7 @@ var ts; }; for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) { var declaration = _b[_i]; - _loop_15(declaration); + _loop_16(declaration); } } return inferences && getIntersectionType(inferences); @@ -60941,7 +61300,7 @@ var ts; if (type.flags & 1 /* TypeFlags.Any */ && !isErrorType(type)) { // Allow errorType to propegate to keep downstream errors suppressed // use keyofConstraintType as the base constraint for mapped type key constraints (unknown isn;t assignable to that, but `any` was), // use unknown otherwise - type = constraintDeclaration.parent.parent.kind === 195 /* SyntaxKind.MappedType */ ? keyofConstraintType : unknownType; + type = constraintDeclaration.parent.parent.kind === 197 /* SyntaxKind.MappedType */ ? keyofConstraintType : unknownType; } typeParameter.constraint = type; } @@ -60950,7 +61309,7 @@ var ts; return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - var tp = ts.getDeclarationOfKind(typeParameter.symbol, 163 /* SyntaxKind.TypeParameter */); + var tp = ts.getDeclarationOfKind(typeParameter.symbol, 165 /* SyntaxKind.TypeParameter */); var host = ts.isJSDocTemplateTag(tp.parent) ? ts.getEffectiveContainerForJSDocTemplateTag(tp.parent) : tp.parent; return host && getSymbolOfNode(host); } @@ -61036,8 +61395,8 @@ var ts; } var node = type.node; var typeArguments = !node ? ts.emptyArray : - node.kind === 178 /* SyntaxKind.TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : - node.kind === 183 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : + node.kind === 180 /* SyntaxKind.TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : + node.kind === 185 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); if (popTypeResolution()) { type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments; @@ -61079,7 +61438,7 @@ var ts; return errorType; } } - if (node.kind === 178 /* SyntaxKind.TypeReference */ && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) { return createDeferredTypeReference(type, node, /*mapper*/ undefined); } // In a type reference, the outer type parameters of the referenced class or interface are automatically @@ -61150,9 +61509,9 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // We only support expressions that are simple qualified names. For other // expressions this produces undefined. var expr = node.expression; @@ -61167,13 +61526,13 @@ var ts; return symbol.parent ? "".concat(getSymbolPath(symbol.parent), ".").concat(symbol.escapedName) : symbol.escapedName; } function getUnresolvedSymbolForEntityName(name) { - var identifier = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.right : - name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ ? name.name : + var identifier = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.right : + name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? name.name : name; var text = identifier.escapedText; if (text) { - var parentSymbol = name.kind === 161 /* SyntaxKind.QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) : - name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) : + var parentSymbol = name.kind === 163 /* SyntaxKind.QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) : + name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) : undefined; var path = parentSymbol ? "".concat(getSymbolPath(parentSymbol), ".").concat(text) : text; var result = unresolvedSymbols.get(path); @@ -61234,7 +61593,7 @@ var ts; var valueType = getTypeOfSymbol(symbol); var typeType = valueType; if (symbol.valueDeclaration) { - var isImportTypeWithQualifier = node.kind === 200 /* SyntaxKind.ImportType */ && node.qualifier; + var isImportTypeWithQualifier = node.kind === 202 /* SyntaxKind.ImportType */ && node.qualifier; // valueType might not have a symbol, eg, {import('./b').STRING_LITERAL} if (valueType.symbol && valueType.symbol !== symbol && isImportTypeWithQualifier) { typeType = getTypeReferenceType(node, valueType.symbol); @@ -61244,23 +61603,27 @@ var ts; } return links.resolvedJSDocType; } - function getSubstitutionType(baseType, substitute) { - if (substitute.flags & 3 /* TypeFlags.AnyOrUnknown */ || substitute === baseType) { + function getSubstitutionType(baseType, constraint) { + if (constraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || constraint === baseType || + !isGenericType(baseType) && !isGenericType(constraint)) { return baseType; } - var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(substitute)); + var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(constraint)); var cached = substitutionTypes.get(id); if (cached) { return cached; } var result = createType(33554432 /* TypeFlags.Substitution */); result.baseType = baseType; - result.substitute = substitute; + result.constraint = constraint; substitutionTypes.set(id, result); return result; } + function getSubstitutionIntersection(substitutionType) { + return getIntersectionType([substitutionType.constraint, substitutionType.baseType]); + } function isUnaryTupleTypeNode(node) { - return node.kind === 184 /* SyntaxKind.TupleType */ && node.elements.length === 1; + return node.kind === 186 /* SyntaxKind.TupleType */ && node.elements.length === 1; } function getImpliedConstraint(type, checkNode, extendsNode) { return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(type, checkNode.elements[0], extendsNode.elements[0]) : @@ -61270,16 +61633,16 @@ var ts; function getConditionalFlowTypeOfType(type, node) { var constraints; var covariant = true; - while (node && !ts.isStatement(node) && node.kind !== 320 /* SyntaxKind.JSDoc */) { + while (node && !ts.isStatement(node) && node.kind !== 323 /* SyntaxKind.JSDoc */) { var parent = node.parent; // only consider variance flipped by parameter locations - `keyof` types would usually be considered variance inverting, but // often get used in indexed accesses where they behave sortof invariantly, but our checking is lax - if (parent.kind === 164 /* SyntaxKind.Parameter */) { + if (parent.kind === 166 /* SyntaxKind.Parameter */) { covariant = !covariant; } // Always substitute on type parameters, regardless of variance, since even // in contravariant positions, they may rely on substituted constraints to be valid - if ((covariant || type.flags & 8650752 /* TypeFlags.TypeVariable */) && parent.kind === 189 /* SyntaxKind.ConditionalType */ && node === parent.trueType) { + if ((covariant || type.flags & 8650752 /* TypeFlags.TypeVariable */) && parent.kind === 191 /* SyntaxKind.ConditionalType */ && node === parent.trueType) { var constraint = getImpliedConstraint(type, parent.checkType, parent.extendsType); if (constraint) { constraints = ts.append(constraints, constraint); @@ -61287,7 +61650,7 @@ var ts; } // Given a homomorphic mapped type { [K in keyof T]: XXX }, where T is constrained to an array or tuple type, in the // template type XXX, K has an added constraint of number | `${number}`. - else if (type.flags & 262144 /* TypeFlags.TypeParameter */ && parent.kind === 195 /* SyntaxKind.MappedType */ && node === parent.type) { + else if (type.flags & 262144 /* TypeFlags.TypeParameter */ && parent.kind === 197 /* SyntaxKind.MappedType */ && node === parent.type) { var mappedType = getTypeFromTypeNode(parent); if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) { var typeParameter = getHomomorphicTypeVariable(mappedType); @@ -61301,10 +61664,10 @@ var ts; } node = parent; } - return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type; + return constraints ? getSubstitutionType(type, getIntersectionType(constraints)) : type; } function isJSDocTypeReference(node) { - return !!(node.flags & 8388608 /* NodeFlags.JSDoc */) && (node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 200 /* SyntaxKind.ImportType */); + return !!(node.flags & 8388608 /* NodeFlags.JSDoc */) && (node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 202 /* SyntaxKind.ImportType */); } function checkNoTypeArguments(node, symbol) { if (node.typeArguments) { @@ -61419,9 +61782,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return declaration; } } @@ -61572,6 +61935,13 @@ var ts; function getGlobalBigIntType() { return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType; } + function getGlobalNaNSymbol() { + return (deferredGlobalNaNSymbol || (deferredGlobalNaNSymbol = getGlobalValueSymbol("NaN", /*reportErrors*/ false))); + } + function getGlobalRecordSymbol() { + deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol); + return deferredGlobalRecordSymbol === unknownSymbol ? undefined : deferredGlobalRecordSymbol; + } /** * Instantiates a global type that is generic with some element type, and returns that instantiation. */ @@ -61589,11 +61959,11 @@ var ts; } function getTupleElementFlags(node) { switch (node.kind) { - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return 2 /* ElementFlags.Optional */; - case 186 /* SyntaxKind.RestType */: + case 188 /* SyntaxKind.RestType */: return getRestTypeElementFlags(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return node.questionToken ? 2 /* ElementFlags.Optional */ : node.dotDotDotToken ? getRestTypeElementFlags(node) : 1 /* ElementFlags.Required */; @@ -61611,14 +61981,14 @@ var ts; return readonly ? globalReadonlyArrayType : globalArrayType; } var elementFlags = ts.map(node.elements, getTupleElementFlags); - var missingName = ts.some(node.elements, function (e) { return e.kind !== 197 /* SyntaxKind.NamedTupleMember */; }); + var missingName = ts.some(node.elements, function (e) { return e.kind !== 199 /* SyntaxKind.NamedTupleMember */; }); return getTupleTargetType(elementFlags, readonly, /*associatedNames*/ missingName ? undefined : node.elements); } // Return true if the given type reference node is directly aliased or if it needs to be deferred // because it is possibly contained in a circular chain of eagerly resolved types. function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) { - return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 183 /* SyntaxKind.ArrayType */ ? mayResolveTypeAlias(node.elementType) : - node.kind === 184 /* SyntaxKind.TupleType */ ? ts.some(node.elements, mayResolveTypeAlias) : + return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 185 /* SyntaxKind.ArrayType */ ? mayResolveTypeAlias(node.elementType) : + node.kind === 186 /* SyntaxKind.TupleType */ ? ts.some(node.elements, mayResolveTypeAlias) : hasDefaultTypeArguments || ts.some(node.typeArguments, mayResolveTypeAlias)); } // Return true when the given node is transitively contained in type constructs that eagerly @@ -61627,18 +61997,18 @@ var ts; function isResolvedByTypeAlias(node) { var parent = node.parent; switch (parent.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: - case 178 /* SyntaxKind.TypeReference */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 189 /* SyntaxKind.ConditionalType */: - case 193 /* SyntaxKind.TypeOperator */: - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: + case 180 /* SyntaxKind.TypeReference */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 191 /* SyntaxKind.ConditionalType */: + case 195 /* SyntaxKind.TypeOperator */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return isResolvedByTypeAlias(parent); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; } return false; @@ -61647,28 +62017,28 @@ var ts; // of a type alias. function mayResolveTypeAlias(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return isJSDocTypeReference(node) || !!(resolveTypeReferenceName(node, 788968 /* SymbolFlags.Type */).flags & 524288 /* SymbolFlags.TypeAlias */); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return true; - case 193 /* SyntaxKind.TypeOperator */: - return node.operator !== 154 /* SyntaxKind.UniqueKeyword */ && mayResolveTypeAlias(node.type); - case 191 /* SyntaxKind.ParenthesizedType */: - case 185 /* SyntaxKind.OptionalType */: - case 197 /* SyntaxKind.NamedTupleMember */: - case 316 /* SyntaxKind.JSDocOptionalType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 195 /* SyntaxKind.TypeOperator */: + return node.operator !== 156 /* SyntaxKind.UniqueKeyword */ && mayResolveTypeAlias(node.type); + case 193 /* SyntaxKind.ParenthesizedType */: + case 187 /* SyntaxKind.OptionalType */: + case 199 /* SyntaxKind.NamedTupleMember */: + case 319 /* SyntaxKind.JSDocOptionalType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return mayResolveTypeAlias(node.type); - case 186 /* SyntaxKind.RestType */: - return node.type.kind !== 183 /* SyntaxKind.ArrayType */ || mayResolveTypeAlias(node.type.elementType); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 188 /* SyntaxKind.RestType */: + return node.type.kind !== 185 /* SyntaxKind.ArrayType */ || mayResolveTypeAlias(node.type.elementType); + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return ts.some(node.types, mayResolveTypeAlias); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return mayResolveTypeAlias(node.objectType) || mayResolveTypeAlias(node.indexType); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return mayResolveTypeAlias(node.checkType) || mayResolveTypeAlias(node.extendsType) || mayResolveTypeAlias(node.trueType) || mayResolveTypeAlias(node.falseType); } @@ -61681,19 +62051,19 @@ var ts; if (target === emptyGenericType) { links.resolvedType = emptyObjectType; } - else if (!(node.kind === 184 /* SyntaxKind.TupleType */ && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8 /* ElementFlags.Variadic */); })) && isDeferredTypeReferenceNode(node)) { - links.resolvedType = node.kind === 184 /* SyntaxKind.TupleType */ && node.elements.length === 0 ? target : + else if (!(node.kind === 186 /* SyntaxKind.TupleType */ && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8 /* ElementFlags.Variadic */); })) && isDeferredTypeReferenceNode(node)) { + links.resolvedType = node.kind === 186 /* SyntaxKind.TupleType */ && node.elements.length === 0 ? target : createDeferredTypeReference(target, node, /*mapper*/ undefined); } else { - var elementTypes = node.kind === 183 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); + var elementTypes = node.kind === 185 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); links.resolvedType = createNormalizedTypeReference(target, elementTypes); } } return links.resolvedType; } function isReadonlyTypeOperator(node) { - return ts.isTypeOperatorNode(node) && node.operator === 145 /* SyntaxKind.ReadonlyKeyword */; + return ts.isTypeOperatorNode(node) && node.operator === 146 /* SyntaxKind.ReadonlyKeyword */; } function createTupleType(elementTypes, elementFlags, readonly, namedMemberDeclarations) { if (readonly === void 0) { readonly = false; } @@ -61808,7 +62178,7 @@ var ts; var lastRequiredIndex = -1; var firstRestIndex = -1; var lastOptionalOrRestIndex = -1; - var _loop_16 = function (i) { + var _loop_17 = function (i) { var type = elementTypes[i]; var flags = target.elementFlags[i]; if (flags & 8 /* ElementFlags.Variadic */) { @@ -61838,9 +62208,9 @@ var ts; } }; for (var i = 0; i < elementTypes.length; i++) { - var state_4 = _loop_16(i); - if (typeof state_4 === "object") - return state_4.value; + var state_5 = _loop_17(i); + if (typeof state_5 === "object") + return state_5.value; } // Turn optional elements preceding the last required element into required elements for (var i = 0; i < lastRequiredIndex; i++) { @@ -61868,7 +62238,7 @@ var ts; if (flags & (2 /* ElementFlags.Optional */ | 4 /* ElementFlags.Rest */)) { lastOptionalOrRestIndex = expandedFlags.length; } - expandedTypes.push(type); + expandedTypes.push(flags & 2 /* ElementFlags.Optional */ ? addOptionality(type, /*isProperty*/ true) : type); expandedFlags.push(flags); if (expandedDeclarations && declaration) { expandedDeclarations.push(declaration); @@ -62034,7 +62404,7 @@ var ts; var templates = ts.filter(types, isPatternLiteralType); if (templates.length) { var i = types.length; - var _loop_17 = function () { + var _loop_18 = function () { i--; var t = types[i]; if (t.flags & 128 /* TypeFlags.StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) { @@ -62042,7 +62412,7 @@ var ts; } }; while (i > 0) { - _loop_17(); + _loop_18(); } } } @@ -62119,14 +62489,14 @@ var ts; var namedUnions = []; addNamedUnions(namedUnions, types); var reducedTypes = []; - var _loop_18 = function (t) { + var _loop_19 = function (t) { if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) { reducedTypes.push(t); } }; for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) { var t = typeSet_1[_i]; - _loop_18(t); + _loop_19(t); } if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) { return namedUnions[0]; @@ -62616,7 +62986,7 @@ var ts; type.flags & 16777216 /* TypeFlags.Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* TypeFlags.UnionOrIntersection */ | 134217728 /* TypeFlags.TemplateLiteral */) ? ts.every(type.types, isDistributive) : type.flags & 8388608 /* TypeFlags.IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : - type.flags & 33554432 /* TypeFlags.Substitution */ ? isDistributive(type.substitute) : + type.flags & 33554432 /* TypeFlags.Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* TypeFlags.StringMapping */ ? isDistributive(type.type) : false; } @@ -62697,15 +63067,15 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { switch (node.operator) { - case 140 /* SyntaxKind.KeyOfKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: links.resolvedType = getIndexType(getTypeFromTypeNode(node.type)); break; - case 154 /* SyntaxKind.UniqueKeyword */: - links.resolvedType = node.type.kind === 151 /* SyntaxKind.SymbolKeyword */ + case 156 /* SyntaxKind.UniqueKeyword */: + links.resolvedType = node.type.kind === 153 /* SyntaxKind.SymbolKeyword */ ? getESSymbolLikeTypeForNode(ts.walkUpParenthesizedTypes(node.parent)) : errorType; break; - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: links.resolvedType = getTypeFromTypeNode(node.type); break; default: @@ -62897,7 +63267,7 @@ var ts; } function getPropertyTypeForIndexType(originalObjectType, objectType, indexType, fullIndexType, accessNode, accessFlags) { var _a; - var accessExpression = accessNode && accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ ? accessNode : undefined; var propName = accessNode && ts.isPrivateIdentifier(accessNode) ? undefined : getPropertyNameFromIndex(indexType, accessNode); if (propName !== undefined) { if (accessFlags & 256 /* AccessFlags.Contextual */) { @@ -63068,9 +63438,9 @@ var ts; } } function getIndexNodeForAccessExpression(accessNode) { - return accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ ? accessNode.argumentExpression : - accessNode.kind === 194 /* SyntaxKind.IndexedAccessType */ ? accessNode.indexType : - accessNode.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? accessNode.expression : + return accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ ? accessNode.argumentExpression : + accessNode.kind === 196 /* SyntaxKind.IndexedAccessType */ ? accessNode.indexType : + accessNode.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? accessNode.expression : accessNode; } function isPatternLiteralPlaceholderType(type) { @@ -63099,7 +63469,7 @@ var ts; if (type.flags & 33554432 /* TypeFlags.Substitution */) { if (!(type.objectFlags & 2097152 /* ObjectFlags.IsGenericTypeComputed */)) { type.objectFlags |= 2097152 /* ObjectFlags.IsGenericTypeComputed */ | - getGenericObjectFlags(type.substitute) | getGenericObjectFlags(type.baseType); + getGenericObjectFlags(type.baseType) | getGenericObjectFlags(type.constraint); } return type.objectFlags & 12582912 /* ObjectFlags.IsGenericType */; } @@ -63250,7 +63620,7 @@ var ts; // for a generic T and a non-generic K, we eagerly resolve T[K] if it originates in an expression. This is to // preserve backwards compatibility. For example, an element access 'this["foo"]' has always been resolved // eagerly using the constraint type of 'this' at the given location. - if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 194 /* SyntaxKind.IndexedAccessType */ ? + if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 196 /* SyntaxKind.IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) { if (objectType.flags & 3 /* TypeFlags.AnyOrUnknown */) { @@ -63302,11 +63672,7 @@ var ts; var objectType = getTypeFromTypeNode(node.objectType); var indexType = getTypeFromTypeNode(node.indexType); var potentialAlias = getAliasSymbolForTypeNode(node); - var resolved = getIndexedAccessType(objectType, indexType, 0 /* AccessFlags.None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); - links.resolvedType = resolved.flags & 8388608 /* TypeFlags.IndexedAccess */ && - resolved.objectType === objectType && - resolved.indexType === indexType ? - getConditionalFlowTypeOfType(resolved, node) : resolved; + links.resolvedType = getIndexedAccessType(objectType, indexType, 0 /* AccessFlags.None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); } return links.resolvedType; } @@ -63360,7 +63726,7 @@ var ts; var result; var extraTypes; var tailCount = 0; - var _loop_19 = function () { + var _loop_20 = function () { if (tailCount === 1000) { error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite); result = errorType; @@ -63481,10 +63847,10 @@ var ts; // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive // cases we increment the tail recursion counter and stop after 1000 iterations. while (true) { - var state_5 = _loop_19(); - if (typeof state_5 === "object") - return state_5.value; - if (state_5 === "break") + var state_6 = _loop_20(); + if (typeof state_6 === "object") + return state_6.value; + if (state_6 === "break") break; } return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result; @@ -63677,7 +64043,7 @@ var ts; } function getAliasSymbolForTypeNode(node) { var host = node.parent; - while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { + while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { host = host.parent; } return ts.isTypeAlias(host) ? getSymbolOfNode(host) : undefined; @@ -63922,7 +64288,7 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */)) { if (!ts.isStatic(container) && (!ts.isConstructorDeclaration(container) || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; @@ -63957,17 +64323,17 @@ var ts; } function getArrayElementTypeNode(node) { switch (node.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return getArrayElementTypeNode(node.type); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: if (node.elements.length === 1) { node = node.elements[0]; - if (node.kind === 186 /* SyntaxKind.RestType */ || node.kind === 197 /* SyntaxKind.NamedTupleMember */ && node.dotDotDotToken) { + if (node.kind === 188 /* SyntaxKind.RestType */ || node.kind === 199 /* SyntaxKind.NamedTupleMember */ && node.dotDotDotToken) { return getArrayElementTypeNode(node.type); } } break; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return node.elementType; } return undefined; @@ -63983,99 +64349,99 @@ var ts; } function getTypeFromTypeNodeWorker(node) { switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: + case 131 /* SyntaxKind.AnyKeyword */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return anyType; - case 155 /* SyntaxKind.UnknownKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: return unknownType; - case 150 /* SyntaxKind.StringKeyword */: + case 152 /* SyntaxKind.StringKeyword */: return stringType; - case 147 /* SyntaxKind.NumberKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: return numberType; - case 158 /* SyntaxKind.BigIntKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: return bigintType; - case 133 /* SyntaxKind.BooleanKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: return booleanType; - case 151 /* SyntaxKind.SymbolKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: return esSymbolType; case 114 /* SyntaxKind.VoidKeyword */: return voidType; - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: return undefinedType; case 104 /* SyntaxKind.NullKeyword */: // TODO(rbuckton): `NullKeyword` is no longer a `TypeNode`, but we defensively allow it here because of incorrect casts in the Language Service. return nullType; - case 143 /* SyntaxKind.NeverKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return neverType; - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return node.flags & 262144 /* NodeFlags.JavaScriptFile */ && !noImplicitAny ? anyType : nonPrimitiveType; - case 138 /* SyntaxKind.IntrinsicKeyword */: + case 139 /* SyntaxKind.IntrinsicKeyword */: return intrinsicMarkerType; - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 108 /* SyntaxKind.ThisKeyword */: // TODO(rbuckton): `ThisKeyword` is no longer a `TypeNode`, but we defensively allow it here because of incorrect casts in the Language Service and because of `isPartOfTypeNode`. return getTypeFromThisTypeNode(node); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return getTypeFromLiteralTypeNode(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return getTypeFromTypeReference(node); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return node.assertsModifier ? voidType : booleanType; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return getTypeFromTypeQueryNode(node); - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return getTypeFromArrayOrTupleTypeNode(node); - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return getTypeFromOptionalTypeNode(node); - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return getTypeFromUnionTypeNode(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return getTypeFromJSDocNullableTypeNode(node); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return addOptionality(getTypeFromTypeNode(node.type)); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return getTypeFromNamedTupleTypeNode(node); - case 191 /* SyntaxKind.ParenthesizedType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return getTypeFromTypeNode(node.type); - case 186 /* SyntaxKind.RestType */: + case 188 /* SyntaxKind.RestType */: return getTypeFromRestTypeNode(node); - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 323 /* SyntaxKind.JSDocSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 326 /* SyntaxKind.JSDocSignature */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return getTypeFromTypeOperatorNode(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return getTypeFromIndexedAccessTypeNode(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return getTypeFromMappedTypeNode(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return getTypeFromConditionalTypeNode(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return getTypeFromInferTypeNode(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return getTypeFromTemplateTypeNode(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return getTypeFromImportTypeNode(node); // This function assumes that an identifier, qualified name, or property access expression is a type expression // Callers should first ensure this by calling `isPartOfTypeNode` // TODO(rbuckton): These aren't valid TypeNodes, but we treat them as such because of `isPartOfTypeNode`, which returns `true` for things that aren't `TypeNode`s. case 79 /* SyntaxKind.Identifier */: - case 161 /* SyntaxKind.QualifiedName */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var symbol = getSymbolAtLocation(node); return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType; default: @@ -64182,8 +64548,8 @@ var ts; return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* TypeMapKind.Merged */, mapper, makeUnaryTypeMapper(source, target)); } function getRestrictiveTypeParameter(tp) { - return tp.constraint === unknownType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), - tp.restrictiveInstantiation.constraint = unknownType, + return !tp.constraint && !getConstraintDeclaration(tp) || tp.constraint === noConstraintType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), + tp.restrictiveInstantiation.constraint = noConstraintType, tp.restrictiveInstantiation); } function cloneTypeParameter(typeParameter) { @@ -64297,17 +64663,18 @@ var ts; return type; } function maybeTypeParameterReference(node) { - return !(node.parent.kind === 178 /* SyntaxKind.TypeReference */ && node.parent.typeArguments && node === node.parent.typeName || - node.parent.kind === 200 /* SyntaxKind.ImportType */ && node.parent.typeArguments && node === node.parent.qualifier); + return !(node.parent.kind === 180 /* SyntaxKind.TypeReference */ && node.parent.typeArguments && node === node.parent.typeName || + node.parent.kind === 202 /* SyntaxKind.ImportType */ && node.parent.typeArguments && node === node.parent.qualifier); } function isTypeParameterPossiblyReferenced(tp, node) { - // If the type parameter doesn't have exactly one declaration, if there are invening statement blocks + // If the type parameter doesn't have exactly one declaration, if there are intervening statement blocks // between the node and the type parameter declaration, if the node contains actual references to the - // type parameter, or if the node contains type queries, we consider the type parameter possibly referenced. + // type parameter, or if the node contains type queries that we can't prove couldn't contain references to the type parameter, + // we consider the type parameter possibly referenced. if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) { var container = tp.symbol.declarations[0].parent; for (var n = node; n !== container; n = n.parent) { - if (!n || n.kind === 235 /* SyntaxKind.Block */ || n.kind === 189 /* SyntaxKind.ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) { + if (!n || n.kind === 238 /* SyntaxKind.Block */ || n.kind === 191 /* SyntaxKind.ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) { return true; } } @@ -64316,15 +64683,36 @@ var ts; return true; function containsReference(node) { switch (node.kind) { - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return !!tp.isThisType; case 79 /* SyntaxKind.Identifier */: return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) && getTypeFromTypeNodeWorker(node) === tp; // use worker because we're looking for === equality - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: + var entityName = node.exprName; + var firstIdentifier = ts.getFirstIdentifier(entityName); + var firstIdentifierSymbol = getResolvedSymbol(firstIdentifier); + var tpDeclaration = tp.symbol.declarations[0]; // There is exactly one declaration, otherwise `containsReference` is not called + var tpScope_1; + if (tpDeclaration.kind === 165 /* SyntaxKind.TypeParameter */) { // Type parameter is a regular type parameter, e.g. foo + tpScope_1 = tpDeclaration.parent; + } + else if (tp.isThisType) { + // Type parameter is the this type, and its declaration is the class declaration. + tpScope_1 = tpDeclaration; + } + else { + // Type parameter's declaration was unrecognized. + // This could happen if the type parameter comes from e.g. a JSDoc annotation, so we default to returning true. + return true; + } + if (firstIdentifierSymbol.declarations) { + return ts.some(firstIdentifierSymbol.declarations, function (idDecl) { return ts.isNodeDescendantOf(idDecl, tpScope_1); }) || + ts.some(node.typeArguments, containsReference); + } return true; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return !node.type && !!node.body || ts.some(node.typeParameters, containsReference) || ts.some(node.parameters, containsReference) || @@ -64546,17 +64934,18 @@ var ts; return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments); } if (flags & 33554432 /* TypeFlags.Substitution */) { - var maybeVariable = instantiateType(type.baseType, mapper); - if (maybeVariable.flags & 8650752 /* TypeFlags.TypeVariable */) { - return getSubstitutionType(maybeVariable, instantiateType(type.substitute, mapper)); + var newBaseType = instantiateType(type.baseType, mapper); + var newConstraint = instantiateType(type.constraint, mapper); + // A substitution type originates in the true branch of a conditional type and can be resolved + // to just the base type in the same cases as the conditional type resolves to its true branch + // (because the base type is then known to satisfy the constraint). + if (newBaseType.flags & 8650752 /* TypeFlags.TypeVariable */ && isGenericType(newConstraint)) { + return getSubstitutionType(newBaseType, newConstraint); } - else { - var sub = instantiateType(type.substitute, mapper); - if (sub.flags & 3 /* TypeFlags.AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) { - return maybeVariable; - } - return sub; + if (newConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(newBaseType), getRestrictiveInstantiation(newConstraint))) { + return newBaseType; } + return newBaseType.flags & 8650752 /* TypeFlags.TypeVariable */ ? getSubstitutionType(newBaseType, newConstraint) : getIntersectionType([newConstraint, newBaseType]); } return type; } @@ -64605,35 +64994,35 @@ var ts; // Returns true if the given expression contains (at any level of nesting) a function or arrow expression // that is subject to contextual typing. function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type return isContextSensitiveFunctionLikeDeclaration(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return ts.some(node.properties, isContextSensitive); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return ts.some(node.elements, isContextSensitive); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ || node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */) && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return isContextSensitive(node.initializer); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isContextSensitive(node.expression); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return ts.some(node.properties, isContextSensitive) || ts.isJsxOpeningElement(node.parent) && ts.some(node.parent.parent.children, isContextSensitive); - case 285 /* SyntaxKind.JsxAttribute */: { + case 288 /* SyntaxKind.JsxAttribute */: { // If there is no initializer, JSX attribute has a boolean value of true which is not context sensitive. var initializer = node.initializer; return !!initializer && isContextSensitive(initializer); } - case 288 /* SyntaxKind.JsxExpression */: { + case 291 /* SyntaxKind.JsxExpression */: { // It is possible to that node.expression is undefined (e.g
) var expression = node.expression; return !!expression && isContextSensitive(expression); @@ -64642,15 +65031,14 @@ var ts; return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return (!ts.isFunctionDeclaration(node) || ts.isInJSFile(node) && !!getTypeForDeclarationFromJSDocComment(node)) && - (ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node)); + return ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node); } function hasContextSensitiveReturnExpression(node) { // TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value. - return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 235 /* SyntaxKind.Block */ && isContextSensitive(node.body); + return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 238 /* SyntaxKind.Block */ && isContextSensitive(node.body); } function isContextSensitiveFunctionOrObjectLiteralMethod(func) { - return (ts.isInJSFile(func) && ts.isFunctionDeclaration(func) || ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && + return (ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func); } function getTypeWithoutSignatures(type) { @@ -64751,23 +65139,23 @@ var ts; return true; } switch (node.kind) { - case 288 /* SyntaxKind.JsxExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 291 /* SyntaxKind.JsxExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (node.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: case 27 /* SyntaxKind.CommaToken */: return elaborateError(node.right, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); } break; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return elaborateJsxComponents(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return elaborateArrowFunction(node, source, target, relation, containingMessageChain, errorOutputContainer); } return false; @@ -64976,7 +65364,7 @@ var ts; } function getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic) { switch (child.kind) { - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: // child is of the type of the expression return { errorNode: child, innerExpression: child.expression, nameType: nameType }; case 11 /* SyntaxKind.JsxText */: @@ -64985,9 +65373,9 @@ var ts; } // child is a string return { errorNode: child, innerExpression: undefined, nameType: nameType, errorMessage: getInvalidTextDiagnostic() }; - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: // child is of type JSX.Element return { errorNode: child, innerExpression: child, nameType: nameType }; default: @@ -65135,11 +65523,11 @@ var ts; } _b = prop.kind; switch (_b) { - case 173 /* SyntaxKind.SetAccessor */: return [3 /*break*/, 2]; - case 172 /* SyntaxKind.GetAccessor */: return [3 /*break*/, 2]; - case 169 /* SyntaxKind.MethodDeclaration */: return [3 /*break*/, 2]; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: return [3 /*break*/, 2]; - case 296 /* SyntaxKind.PropertyAssignment */: return [3 /*break*/, 4]; + case 175 /* SyntaxKind.SetAccessor */: return [3 /*break*/, 2]; + case 174 /* SyntaxKind.GetAccessor */: return [3 /*break*/, 2]; + case 171 /* SyntaxKind.MethodDeclaration */: return [3 /*break*/, 2]; + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return [3 /*break*/, 2]; + case 299 /* SyntaxKind.PropertyAssignment */: return [3 /*break*/, 4]; } return [3 /*break*/, 6]; case 2: return [4 /*yield*/, { errorNode: prop.name, innerExpression: undefined, nameType: type }]; @@ -65212,8 +65600,8 @@ var ts; void instantiateType(sourceRestType || targetRestType, reportUnreliableMarkers); } var kind = target.declaration ? target.declaration.kind : 0 /* SyntaxKind.Unknown */; - var strictVariance = !(checkMode & 3 /* SignatureCheckMode.Callback */) && strictFunctionTypes && kind !== 169 /* SyntaxKind.MethodDeclaration */ && - kind !== 168 /* SyntaxKind.MethodSignature */ && kind !== 171 /* SyntaxKind.Constructor */; + var strictVariance = !(checkMode & 3 /* SignatureCheckMode.Callback */) && strictFunctionTypes && kind !== 171 /* SyntaxKind.MethodDeclaration */ && + kind !== 170 /* SyntaxKind.MethodSignature */ && kind !== 173 /* SyntaxKind.Constructor */; var result = -1 /* Ternary.True */; var sourceThisType = getThisTypeOfSignature(source); if (sourceThisType && sourceThisType !== voidType) { @@ -65510,7 +65898,7 @@ var ts; var t = isFreshLiteralType(type) ? type.regularType : ts.getObjectFlags(type) & 4 /* ObjectFlags.Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 /* TypeFlags.UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : - type.flags & 33554432 /* TypeFlags.Substitution */ ? writing ? type.baseType : type.substitute : + type.flags & 33554432 /* TypeFlags.Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 /* TypeFlags.Simplifiable */ ? getSimplifiedType(type, writing) : type; if (t === type) @@ -65917,7 +66305,8 @@ var ts; return 0 /* Ternary.False */; } } - var isPerformingCommonPropertyChecks = relation !== comparableRelation && !(intersectionState & 2 /* IntersectionState.Target */) && + var isPerformingCommonPropertyChecks = (relation !== comparableRelation || !(source.flags & 1048576 /* TypeFlags.Union */) && isLiteralType(source)) && + !(intersectionState & 2 /* IntersectionState.Target */) && source.flags & (131068 /* TypeFlags.Primitive */ | 524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && source !== globalObjectType && target.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && isWeakType(target) && (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source)); @@ -66076,7 +66465,7 @@ var ts; reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target); checkTypes = reducedTarget.flags & 1048576 /* TypeFlags.Union */ ? reducedTarget.types : [reducedTarget]; } - var _loop_20 = function (prop) { + var _loop_21 = function (prop) { if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) { if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) { if (reportErrors) { @@ -66139,9 +66528,9 @@ var ts; }; for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) { var prop = _b[_i]; - var state_6 = _loop_20(prop); - if (typeof state_6 === "object") - return state_6.value; + var state_7 = _loop_21(prop); + if (typeof state_7 === "object") + return state_7.value; } return false; } @@ -66169,11 +66558,15 @@ var ts; // parameter 'T extends 1 | 2', the intersection 'T & 1' should be reduced to '1' such that it doesn't // appear to be comparable to '2'. if (relation === comparableRelation && target.flags & 131068 /* TypeFlags.Primitive */) { - var constraints = ts.sameMap(source.types, getBaseConstraintOrType); + var constraints = ts.sameMap(source.types, function (t) { return t.flags & 465829888 /* TypeFlags.Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t; }); if (constraints !== source.types) { source = getIntersectionType(constraints); + if (source.flags & 131072 /* TypeFlags.Never */) { + return 0 /* Ternary.False */; + } if (!(source.flags & 2097152 /* TypeFlags.Intersection */)) { - return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false); + return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false) || + isRelatedTo(target, source, 1 /* RecursionFlags.Source */, /*reportErrors*/ false); } } } @@ -66491,7 +66884,7 @@ var ts; // the type param can be compared with itself in the target (with the influence of its constraint to match other parts) // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)` var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */)); - if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself + if (constraint && !(constraint.flags & 131072 /* TypeFlags.Never */) && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState); } @@ -66543,7 +66936,11 @@ var ts; } } if (sourceFlags & 33554432 /* TypeFlags.Substitution */) { - return isRelatedTo(source.substitute, target.substitute, 3 /* RecursionFlags.Both */, /*reportErrors*/ false); + if (result = isRelatedTo(source.baseType, target.baseType, 3 /* RecursionFlags.Both */, /*reportErrors*/ false)) { + if (result &= isRelatedTo(source.constraint, target.constraint, 3 /* RecursionFlags.Both */, /*reportErrors*/ false)) { + return result; + } + } } if (!(sourceFlags & 524288 /* TypeFlags.Object */)) { return 0 /* Ternary.False */; @@ -67124,11 +67521,11 @@ var ts; // constituents of 'target'. If any combination does not have a match then 'source' is not relatable. var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes); var matchingTypes = []; - var _loop_21 = function (combination) { + var _loop_22 = function (combination) { var hasMatch = false; outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) { var type = _d[_c]; - var _loop_22 = function (i) { + var _loop_23 = function (i) { var sourceProperty = sourcePropertiesFiltered[i]; var targetProperty = getPropertyOfType(type, sourceProperty.escapedName); if (!targetProperty) @@ -67144,8 +67541,8 @@ var ts; } }; for (var i = 0; i < sourcePropertiesFiltered.length; i++) { - var state_8 = _loop_22(i); - switch (state_8) { + var state_9 = _loop_23(i); + switch (state_9) { case "continue-outer": continue outer; } } @@ -67158,9 +67555,9 @@ var ts; }; for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) { var combination = discriminantCombinations_1[_a]; - var state_7 = _loop_21(combination); - if (typeof state_7 === "object") - return state_7.value; + var state_8 = _loop_22(combination); + if (typeof state_8 === "object") + return state_8.value; } // Compare the remaining non-discriminant properties of each match. var result = -1 /* Ternary.True */; @@ -67295,7 +67692,7 @@ var ts; shouldSkipElaboration = true; // Retain top-level error for interface implementing issues, otherwise omit it } if (props.length === 1) { - var propName = symbolToString(unmatchedProperty); + var propName = symbolToString(unmatchedProperty, /*enclosingDeclaration*/ undefined, 0 /* SymbolFlags.None */, 4 /* SymbolFormatFlags.AllowAnyNodeKind */ | 16 /* SymbolFormatFlags.WriteComputedProps */); reportError.apply(void 0, __spreadArray([ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName], getTypeNamesForErrorDisplay(source, target), false)); if (ts.length(unmatchedProperty.declarations)) { associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName)); @@ -67544,7 +67941,7 @@ var ts; var targetSignature = ts.first(targetSignatures); result = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors, incompatibleReporter(sourceSignature, targetSignature)); if (!result && reportErrors && kind === 1 /* SignatureKind.Construct */ && (sourceObjectFlags & targetObjectFlags) && - (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 171 /* SyntaxKind.Constructor */ || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 171 /* SyntaxKind.Constructor */)) { + (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 173 /* SyntaxKind.Constructor */ || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 173 /* SyntaxKind.Constructor */)) { var constructSignatureToString = function (signature) { return signatureToString(signature, /*enclosingDeclaration*/ undefined, 262144 /* TypeFormatFlags.WriteArrowStyleSignature */, kind); }; @@ -67865,7 +68262,7 @@ var ts; ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* tracing.Phase.CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) }); links.variances = ts.emptyArray; var variances = []; - var _loop_23 = function (tp) { + var _loop_24 = function (tp) { var modifiers = getVarianceModifiers(tp); var variance = modifiers & 65536 /* ModifierFlags.Out */ ? modifiers & 32768 /* ModifierFlags.In */ ? 0 /* VarianceFlags.Invariant */ : 1 /* VarianceFlags.Covariant */ : @@ -67903,7 +68300,7 @@ var ts; }; for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) { var tp = typeParameters_2[_i]; - _loop_23(tp); + _loop_24(tp); } links.variances = variances; ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) }); @@ -68309,7 +68706,7 @@ var ts; var baseTypeNode = getBaseTypeNodeOfClass(target); // A base type expression may circularly reference the class itself (e.g. as an argument to function call), so we only // check for base types specified as simple qualified names. - if (baseTypeNode && baseTypeNode.expression.kind !== 79 /* SyntaxKind.Identifier */ && baseTypeNode.expression.kind !== 206 /* SyntaxKind.PropertyAccessExpression */) { + if (baseTypeNode && baseTypeNode.expression.kind !== 79 /* SyntaxKind.Identifier */ && baseTypeNode.expression.kind !== 208 /* SyntaxKind.PropertyAccessExpression */) { return undefined; } } @@ -68400,7 +68797,7 @@ var ts; if (!isLiteralOfContextualType(type, contextualType)) { type = getWidenedUniqueESSymbolType(getWidenedLiteralType(type)); } - return type; + return getRegularTypeOfLiteralType(type); } function getWidenedLiteralLikeTypeForContextualReturnTypeIfNeeded(type, contextualSignatureReturnType, isAsync) { if (type && isUnitType(type)) { @@ -68495,7 +68892,8 @@ var ts; function getOptionalType(type, isProperty) { if (isProperty === void 0) { isProperty = false; } ts.Debug.assert(strictNullChecks); - return type.flags & 32768 /* TypeFlags.Undefined */ ? type : getUnionType([type, isProperty ? missingType : undefinedType]); + var missingOrUndefined = isProperty ? missingType : undefinedType; + return type.flags & 32768 /* TypeFlags.Undefined */ || type.flags & 1048576 /* TypeFlags.Union */ && type.types[0] === missingOrUndefined ? type : getUnionType([type, missingOrUndefined]); } function getGlobalNonNullableTypeInstantiation(type) { if (!deferredGlobalNonNullableTypeAlias) { @@ -68784,12 +69182,12 @@ var ts; } var diagnostic; switch (declaration.kind) { - case 221 /* SyntaxKind.BinaryExpression */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 223 /* SyntaxKind.BinaryExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: diagnostic = noImplicitAny ? ts.Diagnostics.Member_0_implicitly_has_an_1_type : ts.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: var param = declaration; if (ts.isIdentifier(param.name) && (ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) && @@ -68805,23 +69203,23 @@ var ts; noImplicitAny ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage : noImplicitAny ? ts.Diagnostics.Parameter_0_implicitly_has_an_1_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; if (!noImplicitAny) { // Don't issue a suggestion for binding elements since the codefix doesn't yet support them. return; } break; - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: error(declaration, ts.Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (noImplicitAny && !declaration.name) { if (wideningKind === 3 /* WideningKind.GeneratorYield */) { error(declaration, ts.Diagnostics.Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation, typeAsString); @@ -68835,7 +69233,7 @@ var ts; wideningKind === 3 /* WideningKind.GeneratorYield */ ? ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type : ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; break; - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: if (noImplicitAny) { error(declaration, ts.Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type); } @@ -68952,7 +69350,7 @@ var ts; if (context.intraExpressionInferenceSites) { for (var _i = 0, _a = context.intraExpressionInferenceSites; _i < _a.length; _i++) { var _b = _a[_i], node = _b.node, type = _b.type; - var contextualType = node.kind === 169 /* SyntaxKind.MethodDeclaration */ ? + var contextualType = node.kind === 171 /* SyntaxKind.MethodDeclaration */ ? getContextualTypeForObjectLiteralMethod(node, 2 /* ContextFlags.NoConstraints */) : getContextualType(node, 2 /* ContextFlags.NoConstraints */); if (contextualType) { @@ -69015,8 +69413,8 @@ var ts; } function isNonGenericTopLevelType(type) { if (type.aliasSymbol && !type.aliasTypeArguments) { - var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 259 /* SyntaxKind.TypeAliasDeclaration */); - return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 305 /* SyntaxKind.SourceFile */ ? true : n.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? false : "quit"; })); + var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 262 /* SyntaxKind.TypeAliasDeclaration */); + return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 308 /* SyntaxKind.SourceFile */ ? true : n.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? false : "quit"; })); } return false; } @@ -69474,7 +69872,10 @@ var ts; // // This flag is infectious; if we produce Box (where never is silentNeverType), Box is // also non-inferrable. - if (ts.getObjectFlags(source) & 262144 /* ObjectFlags.NonInferrableType */) { + // + // As a special case, also ignore nonInferrableAnyType, which is a special form of the any type + // used as a stand-in for binding elements when they are being inferred. + if (ts.getObjectFlags(source) & 262144 /* ObjectFlags.NonInferrableType */ || source === nonInferrableAnyType) { return; } if (!inference.isFixed) { @@ -69547,7 +69948,7 @@ var ts; } else if (source.flags & 33554432 /* TypeFlags.Substitution */) { inferFromTypes(source.baseType, target); - inferWithPriority(source.substitute, target, 4 /* InferencePriority.SubstituteSource */); // Make substitute inference at a lower priority + inferWithPriority(getSubstitutionIntersection(source), target, 4 /* InferencePriority.SubstituteSource */); // Make substitute inference at a lower priority } else if (target.flags & 16777216 /* TypeFlags.Conditional */) { invokeOnce(source, target, inferToConditionalType); @@ -69857,7 +70258,7 @@ var ts; // upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might // succeed. That would be a pointless and confusing outcome. if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) { - var _loop_24 = function (i) { + var _loop_25 = function (i) { var source_1 = matches ? matches[i] : neverType; var target_3 = types[i]; // If we are inferring from a string literal type to a type variable whose constraint includes one of the @@ -69907,7 +70308,7 @@ var ts; inferFromTypes(source_1, target_3); }; for (var i = 0; i < types.length; i++) { - _loop_24(i); + _loop_25(i); } } } @@ -70029,7 +70430,7 @@ var ts; var saveBivariant = bivariant; var kind = target.declaration ? target.declaration.kind : 0 /* SyntaxKind.Unknown */; // Once we descend into a bivariant signature we remain bivariant for all nested inferences - bivariant = bivariant || kind === 169 /* SyntaxKind.MethodDeclaration */ || kind === 168 /* SyntaxKind.MethodSignature */ || kind === 171 /* SyntaxKind.Constructor */; + bivariant = bivariant || kind === 171 /* SyntaxKind.MethodDeclaration */ || kind === 170 /* SyntaxKind.MethodSignature */ || kind === 173 /* SyntaxKind.Constructor */; applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes); bivariant = saveBivariant; applyToReturnTypes(source, target, inferFromTypes); @@ -70228,7 +70629,7 @@ var ts; } // falls through default: - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer; } else { @@ -70249,7 +70650,7 @@ var ts; // TypeScript 1.0 spec (April 2014): 3.6.3 // A type query consists of the keyword typeof followed by an expression. // The expression is restricted to a single identifier or a sequence of identifiers separated by periods - return !!ts.findAncestor(node, function (n) { return n.kind === 181 /* SyntaxKind.TypeQuery */ ? true : n.kind === 79 /* SyntaxKind.Identifier */ || n.kind === 161 /* SyntaxKind.QualifiedName */ ? false : "quit"; }); + return !!ts.findAncestor(node, function (n) { return n.kind === 183 /* SyntaxKind.TypeQuery */ ? true : n.kind === 79 /* SyntaxKind.Identifier */ || n.kind === 163 /* SyntaxKind.QualifiedName */ ? false : "quit"; }); } // Return the flow cache key for a "dotted name" (i.e. a sequence of identifiers // separated by dots). The key consists of the id of the symbol referenced by the @@ -70265,26 +70666,26 @@ var ts; // falls through case 108 /* SyntaxKind.ThisKeyword */: return "0|".concat(flowContainer ? getNodeId(flowContainer) : "-1", "|").concat(getTypeId(declaredType), "|").concat(getTypeId(initialType)); - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: var left = getFlowCacheKey(node.left, declaredType, initialType, flowContainer); return left && left + "." + node.right.escapedText; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var propName = getAccessedPropertyName(node); if (propName !== undefined) { var key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); return key && key + "." + propName; } break; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: // Handle pseudo-references originating in getNarrowedTypeOfSymbol. return "".concat(getNodeId(node), "#").concat(getTypeId(declaredType)); } @@ -70292,16 +70693,16 @@ var ts; } function isMatchingReference(source, target) { switch (target.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return isMatchingReference(source, target.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (ts.isAssignmentExpression(target) && isMatchingReference(source, target.left)) || (ts.isBinaryExpression(target) && target.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && isMatchingReference(source, target.right)); } switch (source.kind) { - case 231 /* SyntaxKind.MetaProperty */: - return target.kind === 231 /* SyntaxKind.MetaProperty */ + case 233 /* SyntaxKind.MetaProperty */: + return target.kind === 233 /* SyntaxKind.MetaProperty */ && source.keywordToken === target.keywordToken && source.name.escapedText === target.name.escapedText; case 79 /* SyntaxKind.Identifier */: @@ -70309,26 +70710,26 @@ var ts; return ts.isThisInTypeQuery(source) ? target.kind === 108 /* SyntaxKind.ThisKeyword */ : target.kind === 79 /* SyntaxKind.Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 254 /* SyntaxKind.VariableDeclaration */ || target.kind === 203 /* SyntaxKind.BindingElement */) && + (target.kind === 257 /* SyntaxKind.VariableDeclaration */ || target.kind === 205 /* SyntaxKind.BindingElement */) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 108 /* SyntaxKind.ThisKeyword */: return target.kind === 108 /* SyntaxKind.ThisKeyword */; case 106 /* SyntaxKind.SuperKeyword */: return target.kind === 106 /* SyntaxKind.SuperKeyword */; - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isMatchingReference(source.expression, target); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var sourcePropertyName = getAccessedPropertyName(source); var targetPropertyName = ts.isAccessExpression(target) ? getAccessedPropertyName(target) : undefined; return sourcePropertyName !== undefined && targetPropertyName !== undefined && targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return ts.isAccessExpression(target) && source.right.escapedText === getAccessedPropertyName(target) && isMatchingReference(source.left, target.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (ts.isBinaryExpression(source) && source.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && isMatchingReference(source.right, target)); } return false; @@ -70371,7 +70772,7 @@ var ts; return name; } } - if (ts.hasOnlyExpressionInitializer(declaration)) { + if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) { var initializer = ts.getEffectiveInitializer(declaration); return initializer && tryGetNameFromType(getTypeOfExpression(initializer)); } @@ -70431,7 +70832,7 @@ var ts; function mapTypesByKeyProperty(types, name) { var map = new ts.Map(); var count = 0; - var _loop_25 = function (type) { + var _loop_26 = function (type) { if (type.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */)) { var discriminant = getTypeOfPropertyOfType(type, name); if (discriminant) { @@ -70457,9 +70858,9 @@ var ts; }; for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { var type = types_15[_i]; - var state_9 = _loop_25(type); - if (typeof state_9 === "object") - return state_9.value; + var state_10 = _loop_26(type); + if (typeof state_10 === "object") + return state_10.value; } return count >= 10 && count * 2 >= types.length ? map : undefined; } @@ -70500,7 +70901,7 @@ var ts; } function getMatchingUnionConstituentForObjectLiteral(unionType, node) { var keyPropertyName = getKeyPropertyName(unionType); - var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 296 /* SyntaxKind.PropertyAssignment */ && + var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 299 /* SyntaxKind.PropertyAssignment */ && p.symbol.escapedName === keyPropertyName && isPossiblyDiscriminantValue(p.initializer); }); var propType = propNode && getContextFreeTypeOfExpression(propNode.initializer); return propType && getConstituentTypeForKeyType(unionType, propType); @@ -70517,7 +70918,7 @@ var ts; } } } - if (expression.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + if (expression.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isOrContainsMatchingReference(reference, expression.expression.expression)) { return true; } @@ -70717,15 +71118,15 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(65 /* IterationUse.Destructuring */, type, undefinedType, /*errorNode*/ undefined) || errorType); } function getAssignedTypeOfBinaryExpression(node) { - var isDestructuringDefaultAssignment = node.parent.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || - node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); + var isDestructuringDefaultAssignment = node.parent.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || + node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } function isDestructuringAssignmentTarget(parent) { - return parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.parent.left === parent || - parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */ && parent.parent.initializer === parent; + return parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.parent.left === parent || + parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */ && parent.parent.initializer === parent; } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element)); @@ -70742,21 +71143,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return stringType; - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return checkRightHandSideOfForOf(parent) || errorType; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return getAssignedTypeOfBinaryExpression(parent); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return undefinedType; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return getAssignedTypeOfSpreadExpression(parent); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return errorType; @@ -70764,7 +71165,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ ? + var type = pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) : @@ -70782,30 +71183,30 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (node.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { return stringType; } - if (node.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { return checkRightHandSideOfForOf(node.parent.parent) || errorType; } return errorType; } function getInitialType(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function isEmptyArrayAssignment(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.initializer && + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 203 /* SyntaxKind.BindingElement */ && node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + node.kind !== 205 /* SyntaxKind.BindingElement */ && node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getReferenceCandidate(node.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (node.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: case 75 /* SyntaxKind.BarBarEqualsToken */: @@ -70820,13 +71221,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */ || - parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.left === node || - parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && parent.right === node ? + return parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || + parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.left === node || + parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { return getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); } return neverType; @@ -70845,13 +71246,13 @@ var ts; // Get the type names from all cases in a switch on `typeof`. The default clause and/or duplicate type names are // represented as undefined. Return undefined if one or more case clause expressions are not string literals. function getSwitchClauseTypeOfWitnesses(switchStatement) { - if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 289 /* SyntaxKind.CaseClause */ && !ts.isStringLiteralLike(clause.expression); })) { + if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 292 /* SyntaxKind.CaseClause */ && !ts.isStringLiteralLike(clause.expression); })) { return undefined; } var witnesses = []; for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) { var clause = _a[_i]; - var text = clause.kind === 289 /* SyntaxKind.CaseClause */ ? clause.expression.text : undefined; + var text = clause.kind === 292 /* SyntaxKind.CaseClause */ ? clause.expression.text : undefined; witnesses.push(text && !ts.contains(witnesses, text) ? text : undefined); } return witnesses; @@ -71038,12 +71439,12 @@ var ts; var root = getReferenceRoot(node); var parent = root.parent; var isLengthPushOrUnshift = ts.isPropertyAccessExpression(parent) && (parent.name.escapedText === "length" || - parent.parent.kind === 208 /* SyntaxKind.CallExpression */ + parent.parent.kind === 210 /* SyntaxKind.CallExpression */ && ts.isIdentifier(parent.name) && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && + var isElementAssignment = parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && parent.expression === root && - parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -71071,7 +71472,7 @@ var ts; if (isDeclarationWithExplicitTypeAnnotation(declaration)) { return getTypeOfSymbol(symbol); } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { var statement = declaration.parent.parent; var expressionType = getTypeOfDottedName(statement.expression, /*diagnostic*/ undefined); if (expressionType) { @@ -71099,7 +71500,7 @@ var ts; return getExplicitThisType(node); case 106 /* SyntaxKind.SuperKeyword */: return checkSuperExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: { + case 208 /* SyntaxKind.PropertyAccessExpression */: { var type = getTypeOfDottedName(node.expression, diagnostic); if (type) { var name = node.name; @@ -71117,7 +71518,7 @@ var ts; } return undefined; } - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getTypeOfDottedName(node.expression, diagnostic); } } @@ -71131,7 +71532,7 @@ var ts; // circularities in control flow analysis, we use getTypeOfDottedName when resolving the call // target expression of an assertion. var funcType = void 0; - if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */) { + if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */) { funcType = getTypeOfDottedName(node.expression, /*diagnostic*/ undefined); } else if (node.expression.kind !== 106 /* SyntaxKind.SuperKeyword */) { @@ -71175,7 +71576,7 @@ var ts; } function isFalseExpression(expr) { var node = ts.skipParentheses(expr, /*excludeJSDocTypeAssertions*/ true); - return node.kind === 95 /* SyntaxKind.FalseKeyword */ || node.kind === 221 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ && (isFalseExpression(node.left) || isFalseExpression(node.right)) || + return node.kind === 95 /* SyntaxKind.FalseKeyword */ || node.kind === 223 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ && (isFalseExpression(node.left) || isFalseExpression(node.right)) || node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ && isFalseExpression(node.left) && isFalseExpression(node.right)); } function isReachableFlowNodeWorker(flow, noCacheCheck) { @@ -71296,8 +71697,8 @@ var ts; var symbol = getResolvedSymbol(node); return isConstVariable(symbol) || ts.isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol); } - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // The resolvedSymbol property is initialized by checkPropertyAccess or checkElementAccess before we get here. return isConstantReference(node.expression) && isReadonlySymbol(getNodeLinks(node).resolvedSymbol || unknownSymbol); } @@ -71324,7 +71725,7 @@ var ts; // on empty arrays are possible without implicit any errors and new element types can be inferred without // type mismatch errors. var resultType = ts.getObjectFlags(evolvedType) & 256 /* ObjectFlags.EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType); - if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 230 /* SyntaxKind.NonNullExpression */ && !(resultType.flags & 131072 /* TypeFlags.Never */) && getTypeWithFacts(resultType, 2097152 /* TypeFacts.NEUndefinedOrNull */).flags & 131072 /* TypeFlags.Never */) { + if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 232 /* SyntaxKind.NonNullExpression */ && !(resultType.flags & 131072 /* TypeFlags.Never */) && getTypeWithFacts(resultType, 2097152 /* TypeFacts.NEUndefinedOrNull */).flags & 131072 /* TypeFlags.Never */) { return declaredType; } // The non-null unknown type should never escape control flow analysis. @@ -71409,8 +71810,8 @@ var ts; // Check if we should continue with the control flow of the containing function. var container = flow.node; if (container && container !== flowContainer && - reference.kind !== 206 /* SyntaxKind.PropertyAccessExpression */ && - reference.kind !== 207 /* SyntaxKind.ElementAccessExpression */ && + reference.kind !== 208 /* SyntaxKind.PropertyAccessExpression */ && + reference.kind !== 209 /* SyntaxKind.ElementAccessExpression */ && reference.kind !== 108 /* SyntaxKind.ThisKeyword */) { flow = container.flowNode; continue; @@ -71435,7 +71836,7 @@ var ts; } function getInitialOrAssignedType(flow) { var node = flow.node; - return getNarrowableTypeForReference(node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */ ? + return getNarrowableTypeForReference(node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */ ? getInitialType(node) : getAssignedType(node), reference); } @@ -71475,14 +71876,14 @@ var ts; // in which case we continue control flow analysis back to the function's declaration if (ts.isVariableDeclaration(node) && (ts.isInJSFile(node) || ts.isVarConst(node))) { var init = ts.getDeclaredExpandoInitializer(node); - if (init && (init.kind === 213 /* SyntaxKind.FunctionExpression */ || init.kind === 214 /* SyntaxKind.ArrowFunction */)) { + if (init && (init.kind === 215 /* SyntaxKind.FunctionExpression */ || init.kind === 216 /* SyntaxKind.ArrowFunction */)) { return getTypeAtFlowNode(flow.antecedent); } } return declaredType; } // for (const _ in ref) acts as a nonnull on ref - if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) { + if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) { return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)))); } // Assignment doesn't affect reference @@ -71493,7 +71894,7 @@ var ts; if (node.kind === 95 /* SyntaxKind.FalseKeyword */) { return unreachableNeverType; } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */) { if (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */) { return narrowTypeByAssertion(narrowTypeByAssertion(type, node.left), node.right); } @@ -71524,7 +71925,7 @@ var ts; function getTypeAtFlowArrayMutation(flow) { if (declaredType === autoType || declaredType === autoArrayType) { var node = flow.node; - var expr = node.kind === 208 /* SyntaxKind.CallExpression */ ? + var expr = node.kind === 210 /* SyntaxKind.CallExpression */ ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -71532,7 +71933,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (ts.getObjectFlags(type) & 256 /* ObjectFlags.EvolvingArray */) { var evolvedType_1 = type; - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -71580,7 +71981,7 @@ var ts; if (isMatchingReference(reference, expr)) { type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } - else if (expr.kind === 216 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { + else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } else { @@ -71588,7 +71989,7 @@ var ts; if (optionalChainContainsReference(expr, reference)) { type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & (32768 /* TypeFlags.Undefined */ | 131072 /* TypeFlags.Never */)); }); } - else if (expr.kind === 216 /* SyntaxKind.TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { + else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & 131072 /* TypeFlags.Never */ || t.flags & 128 /* TypeFlags.StringLiteral */ && t.value === "undefined"); }); } } @@ -71816,7 +72217,7 @@ var ts; var narrowedPropType = narrowType(propType); return filterType(type, function (t) { var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName); - return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType); + return !(discriminantType.flags & 131072 /* TypeFlags.Never */) && !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType); }); } function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) { @@ -71858,18 +72259,26 @@ var ts; } function isTypePresencePossible(type, propName, assumeTrue) { var prop = getPropertyOfType(type, propName); - if (prop) { - return prop.flags & 16777216 /* SymbolFlags.Optional */ ? true : assumeTrue; - } - return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue; + return prop ? + !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue : + !!getApplicableIndexInfoForName(type, propName) || !assumeTrue; } - function narrowByInKeyword(type, name, assumeTrue) { - if (type.flags & 1048576 /* TypeFlags.Union */ - || type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type)) - || ts.isThisTypeParameter(type) - || type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) { + function narrowByInKeyword(type, nameType, assumeTrue) { + var name = getPropertyNameFromType(nameType); + var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); }); + if (isKnownProperty) { + // If the check is for a known property (i.e. a property declared in some constituent of + // the target type), we filter the target type by presence of absence of the property. return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); }); } + if (assumeTrue) { + // If the check is for an unknown property, we intersect the target type with `Record`, + // where X is the name of the property. + var recordSymbol = getGlobalRecordSymbol(); + if (recordSymbol) { + return getIntersectionType([type, getTypeAliasInstantiation(recordSymbol, [nameType, unknownType])]); + } + } return type; } function narrowTypeByBinaryExpression(type, expr, assumeTrue) { @@ -71886,10 +72295,10 @@ var ts; var operator = expr.operatorToken.kind; var left = getReferenceCandidate(expr.left); var right = getReferenceCandidate(expr.right); - if (left.kind === 216 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(right)) { + if (left.kind === 218 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(right)) { return narrowTypeByTypeof(type, left, operator, right, assumeTrue); } - if (right.kind === 216 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(left)) { + if (right.kind === 218 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(left)) { return narrowTypeByTypeof(type, right, operator, left, assumeTrue); } if (isMatchingReference(reference, left)) { @@ -71928,15 +72337,14 @@ var ts; return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue); } var target = getReferenceCandidate(expr.right); - var leftType = getTypeOfNode(expr.left); - if (leftType.flags & 128 /* TypeFlags.StringLiteral */) { - var name = ts.escapeLeadingUnderscores(leftType.value); + var leftType = getTypeOfExpression(expr.left); + if (leftType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */) { if (containsMissingType(type) && ts.isAccessExpression(reference) && isMatchingReference(reference.expression, target) && - getAccessedPropertyName(reference) === name) { + getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) { return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */); } if (isMatchingReference(reference, target)) { - return narrowByInKeyword(type, name, assumeTrue); + return narrowByInKeyword(type, leftType, assumeTrue); } } break; @@ -71998,24 +72406,11 @@ var ts; assumeTrue = !assumeTrue; } var valueType = getTypeOfExpression(value); - if (((type.flags & 2 /* TypeFlags.Unknown */) || isEmptyAnonymousObjectType(type) && !(valueType.flags & 98304 /* TypeFlags.Nullable */)) && - assumeTrue && - (operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */)) { - if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */)) { - return valueType; - } - if (valueType.flags & 524288 /* TypeFlags.Object */) { - return nonPrimitiveType; - } - if (type.flags & 2 /* TypeFlags.Unknown */) { - return type; - } - } + var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */; if (valueType.flags & 98304 /* TypeFlags.Nullable */) { if (!strictNullChecks) { return type; } - var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */; var facts = doubleEquals ? assumeTrue ? 262144 /* TypeFacts.EQUndefinedOrNull */ : 2097152 /* TypeFacts.NEUndefinedOrNull */ : valueType.flags & 65536 /* TypeFlags.Null */ ? @@ -72024,10 +72419,16 @@ var ts; return getAdjustedTypeWithFacts(type, facts); } if (assumeTrue) { - var filterFn = operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? - function (t) { return areTypesComparable(t, valueType) || isCoercibleUnderDoubleEquals(t, valueType); } : - function (t) { return areTypesComparable(t, valueType); }; - return replacePrimitivesWithLiterals(filterType(type, filterFn), valueType); + if (!doubleEquals && (type.flags & 2 /* TypeFlags.Unknown */ || someType(type, isEmptyAnonymousObjectType))) { + if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) { + return valueType; + } + if (valueType.flags & 524288 /* TypeFlags.Object */) { + return nonPrimitiveType; + } + } + var filteredType = filterType(type, function (t) { return areTypesComparable(t, valueType) || doubleEquals && isCoercibleUnderDoubleEquals(t, valueType); }); + return replacePrimitivesWithLiterals(filteredType, valueType); } if (isUnitType(valueType)) { return filterType(type, function (t) { return !(isUnitLikeType(t) && areTypesComparable(t, valueType)); }); @@ -72041,11 +72442,18 @@ var ts; } var target = getReferenceCandidate(typeOfExpr.expression); if (!isMatchingReference(reference, target)) { + var propertyAccess = getDiscriminantPropertyAccess(typeOfExpr.expression, type); + if (propertyAccess) { + return narrowTypeByDiscriminant(type, propertyAccess, function (t) { return narrowTypeByLiteralExpression(t, literal, assumeTrue); }); + } if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) { return getAdjustedTypeWithFacts(type, 2097152 /* TypeFacts.NEUndefinedOrNull */); } return type; } + return narrowTypeByLiteralExpression(type, literal, assumeTrue); + } + function narrowTypeByLiteralExpression(type, literal, assumeTrue) { return assumeTrue ? narrowTypeByTypeName(type, literal.text) : getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768 /* TypeFacts.TypeofNEHostObject */); @@ -72131,7 +72539,7 @@ var ts; return type; } // Equal start and end denotes implicit fallthrough; undefined marks explicit default clause. - var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 290 /* SyntaxKind.DefaultClause */; }); + var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 293 /* SyntaxKind.DefaultClause */; }); var hasDefaultClause = clauseStart === clauseEnd || (defaultIndex >= clauseStart && defaultIndex < clauseEnd); if (hasDefaultClause) { // In the default clause we filter constituents down to those that are not-equal to all handled cases. @@ -72335,17 +72743,17 @@ var ts; // falls through case 108 /* SyntaxKind.ThisKeyword */: case 106 /* SyntaxKind.SuperKeyword */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return narrowTypeByCallExpression(type, expr, assumeTrue); - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return narrowType(type, expr.expression, assumeTrue); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: if (expr.operator === 53 /* SyntaxKind.ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -72394,9 +72802,9 @@ var ts; function getControlFlowContainer(node) { return ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 262 /* SyntaxKind.ModuleBlock */ || - node.kind === 305 /* SyntaxKind.SourceFile */ || - node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + node.kind === 265 /* SyntaxKind.ModuleBlock */ || + node.kind === 308 /* SyntaxKind.SourceFile */ || + node.kind === 169 /* SyntaxKind.PropertyDeclaration */; }); } // Check if a parameter or catch variable is assigned anywhere @@ -72439,7 +72847,7 @@ var ts; function removeOptionalityFromDeclaredType(declaredType, declaration) { if (pushTypeResolution(declaration.symbol, 2 /* TypeSystemPropertyName.DeclaredType */)) { var annotationIncludesUndefined = strictNullChecks && - declaration.kind === 164 /* SyntaxKind.Parameter */ && + declaration.kind === 166 /* SyntaxKind.Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* TypeFacts.IsUndefined */ && !(getTypeFacts(checkExpression(declaration.initializer)) & 16777216 /* TypeFacts.IsUndefined */); @@ -72456,10 +72864,10 @@ var ts; // In an element access obj[x], we consider obj to be in a constraint position, except when obj is of // a generic type without a nullable constraint and x is a generic type. This is because when both obj // and x are of generic types T and K, we want the resulting type to be T[K]. - return parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - parent.kind === 161 /* SyntaxKind.QualifiedName */ || - parent.kind === 208 /* SyntaxKind.CallExpression */ && parent.expression === node || - parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && parent.expression === node && + return parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + parent.kind === 163 /* SyntaxKind.QualifiedName */ || + parent.kind === 210 /* SyntaxKind.CallExpression */ && parent.expression === node || + parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && parent.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression))); } function isGenericTypeWithUnionConstraint(type) { @@ -72558,15 +72966,16 @@ var ts; // destructuring from the narrowed parent type. if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) { var parent = declaration.parent.parent; - if (parent.kind === 254 /* SyntaxKind.VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* NodeFlags.Const */ || parent.kind === 164 /* SyntaxKind.Parameter */) { + if (parent.kind === 257 /* SyntaxKind.VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* NodeFlags.Const */ || parent.kind === 166 /* SyntaxKind.Parameter */) { var links = getNodeLinks(parent); if (!(links.flags & 268435456 /* NodeCheckFlags.InCheckIdentifier */)) { links.flags |= 268435456 /* NodeCheckFlags.InCheckIdentifier */; var parentType = getTypeForBindingElementParent(parent, 0 /* CheckMode.Normal */); + var parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType); links.flags &= ~268435456 /* NodeCheckFlags.InCheckIdentifier */; - if (parentType && parentType.flags & 1048576 /* TypeFlags.Union */ && !(parent.kind === 164 /* SyntaxKind.Parameter */ && isSymbolAssigned(symbol))) { + if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* TypeFlags.Union */ && !(parent.kind === 166 /* SyntaxKind.Parameter */ && isSymbolAssigned(symbol))) { var pattern = declaration.parent; - var narrowedType = getFlowTypeOfReference(pattern, parentType, parentType, /*flowContainer*/ undefined, location.flowNode); + var narrowedType = getFlowTypeOfReference(pattern, parentTypeConstraint, parentTypeConstraint, /*flowContainer*/ undefined, location.flowNode); if (narrowedType.flags & 131072 /* TypeFlags.Never */) { return neverType; } @@ -72633,10 +73042,10 @@ var ts; } var container = ts.getContainingFunction(node); if (languageVersion < 2 /* ScriptTarget.ES2015 */) { - if (container.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (container.kind === 216 /* SyntaxKind.ArrowFunction */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } - else if (ts.hasSyntacticModifier(container, 256 /* ModifierFlags.Async */)) { + else if (ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); } } @@ -72656,7 +73065,7 @@ var ts; // Due to the emit for class decorators, any reference to the class from inside of the class body // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind // behavior of class names in ES6. - if (declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ + if (declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ && ts.nodeIsDecorated(declaration)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -72668,12 +73077,12 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration.kind === 226 /* SyntaxKind.ClassExpression */) { + else if (declaration.kind === 228 /* SyntaxKind.ClassExpression */) { // When we emit a class expression with static members that contain a reference // to the constructor in the initializer, we will need to substitute that // binding with an alias as the class name is not in scope. var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); - while (container.kind !== 305 /* SyntaxKind.SourceFile */) { + while (container.kind !== 308 /* SyntaxKind.SourceFile */) { if (container.parent === declaration) { if (ts.isPropertyDeclaration(container) && ts.isStatic(container) || ts.isClassStaticBlockDeclaration(container)) { getNodeLinks(declaration).flags |= 16777216 /* NodeCheckFlags.ClassWithConstructorReference */; @@ -72731,7 +73140,7 @@ var ts; // The declaration container is the innermost function that encloses the declaration of the variable // or parameter. The flow container is the innermost function starting with which we analyze the control // flow graph to determine the control flow based type. - var isParameter = ts.getRootDeclaration(declaration).kind === 164 /* SyntaxKind.Parameter */; + var isParameter = ts.getRootDeclaration(declaration).kind === 166 /* SyntaxKind.Parameter */; var declarationContainer = getControlFlowContainer(declaration); var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; @@ -72740,8 +73149,8 @@ var ts; // When the control flow originates in a function expression or arrow function and we are referencing // a const variable or parameter from an outer function, we extend the origin of the control flow // analysis to include the immediately enclosing function. - while (flowContainer !== declarationContainer && (flowContainer.kind === 213 /* SyntaxKind.FunctionExpression */ || - flowContainer.kind === 214 /* SyntaxKind.ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 215 /* SyntaxKind.FunctionExpression */ || + flowContainer.kind === 216 /* SyntaxKind.ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter && !isSymbolAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } @@ -72750,9 +73159,9 @@ var ts; // declaration container are the same). var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || ts.isBindingElement(declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* TypeFlags.AnyOrUnknown */ | 16384 /* TypeFlags.Void */)) !== 0 || - isInTypeQuery(node) || node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) || - node.parent.kind === 230 /* SyntaxKind.NonNullExpression */ || - declaration.kind === 254 /* SyntaxKind.VariableDeclaration */ && declaration.exclamationToken || + isInTypeQuery(node) || node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) || + node.parent.kind === 232 /* SyntaxKind.NonNullExpression */ || + declaration.kind === 257 /* SyntaxKind.VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* NodeFlags.Ambient */; var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) : type === autoType || type === autoArrayType ? undefinedType : @@ -72810,7 +73219,7 @@ var ts; (symbol.flags & (2 /* SymbolFlags.BlockScopedVariable */ | 32 /* SymbolFlags.Class */)) === 0 || !symbol.valueDeclaration || ts.isSourceFile(symbol.valueDeclaration) || - symbol.valueDeclaration.parent.kind === 292 /* SyntaxKind.CatchClause */) { + symbol.valueDeclaration.parent.kind === 295 /* SyntaxKind.CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -72825,7 +73234,7 @@ var ts; // mark iteration statement as containing block-scoped binding captured in some function var capturesBlockScopeBindingInLoopBody = true; if (ts.isForStatement(container)) { - var varDeclList = ts.getAncestor(symbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); + var varDeclList = ts.getAncestor(symbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); if (varDeclList && varDeclList.parent === container) { var part = getPartOfForStatementContainingNode(node.parent, container); if (part) { @@ -72846,7 +73255,7 @@ var ts; // mark variables that are declared in loop initializer and reassigned inside the body of ForStatement. // if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back. if (ts.isForStatement(container)) { - var varDeclList = ts.getAncestor(symbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); + var varDeclList = ts.getAncestor(symbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); if (varDeclList && varDeclList.parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 4194304 /* NodeCheckFlags.NeedsLoopOutParameter */; } @@ -72865,7 +73274,7 @@ var ts; function isAssignedInBodyOfForStatement(node, container) { // skip parenthesized nodes var current = node; - while (current.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (current.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { current = current.parent; } // check if node is used as LHS in some assignment expression @@ -72873,7 +73282,7 @@ var ts; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || current.parent.kind === 220 /* SyntaxKind.PostfixUnaryExpression */)) { + else if ((current.parent.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || current.parent.kind === 222 /* SyntaxKind.PostfixUnaryExpression */)) { var expr = current.parent; isAssigned = expr.operator === 45 /* SyntaxKind.PlusPlusToken */ || expr.operator === 46 /* SyntaxKind.MinusMinusToken */; } @@ -72886,7 +73295,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* NodeCheckFlags.LexicalThis */; - if (container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || container.kind === 171 /* SyntaxKind.Constructor */) { + if (container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || container.kind === 173 /* SyntaxKind.Constructor */) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* NodeCheckFlags.CaptureThis */; } @@ -72933,31 +73342,31 @@ var ts; // tell whether 'this' needs to be captured. var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var capturedByArrowFunction = false; - if (container.kind === 171 /* SyntaxKind.Constructor */) { + if (container.kind === 173 /* SyntaxKind.Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (container.kind === 216 /* SyntaxKind.ArrowFunction */) { container = ts.getThisContainer(container, /* includeArrowFunctions */ false); capturedByArrowFunction = true; } checkThisInStaticClassFieldInitializerInDecoratedClass(node, container); switch (container.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks } break; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -73045,7 +73454,7 @@ var ts; } function getClassNameFromPrototypeMethod(container) { // Check if it's the RHS of a x.prototype.y = function [name]() { .... } - if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && + if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && ts.isBinaryExpression(container.parent) && ts.getAssignmentDeclarationKind(container.parent) === 3 /* AssignmentDeclarationKind.PrototypeProperty */) { // Get the 'x' of 'x.prototype.y = container' @@ -73055,16 +73464,16 @@ var ts; .expression; // x } // x.prototype = { method() { } } - else if (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && - container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + else if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && + container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && ts.isBinaryExpression(container.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent) === 6 /* AssignmentDeclarationKind.Prototype */) { return container.parent.parent.left.expression; } // x.prototype = { method: function() { } } - else if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && - container.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ && - container.parent.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + else if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && + container.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ && + container.parent.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && ts.isBinaryExpression(container.parent.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent.parent) === 6 /* AssignmentDeclarationKind.Prototype */) { return container.parent.parent.parent.left.expression; @@ -73072,7 +73481,7 @@ var ts; // Object.defineProperty(x, "method", { value: function() { } }); // Object.defineProperty(x, "method", { set: (x: () => void) => void }); // Object.defineProperty(x, "method", { get: () => function() { }) }); - else if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && + else if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && ts.isPropertyAssignment(container.parent) && ts.isIdentifier(container.parent.name) && (container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") && @@ -73097,7 +73506,7 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 317 /* SyntaxKind.JSDocFunctionType */) { + if (jsdocType && jsdocType.kind === 320 /* SyntaxKind.JSDocFunctionType */) { var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && @@ -73111,16 +73520,16 @@ var ts; } } function isInConstructorArgumentInitializer(node, constructorDecl) { - return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 164 /* SyntaxKind.Parameter */ && n.parent === constructorDecl; }); + return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 166 /* SyntaxKind.Parameter */ && n.parent === constructorDecl; }); } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 208 /* SyntaxKind.CallExpression */ && node.parent.expression === node; + var isCallExpression = node.parent.kind === 210 /* SyntaxKind.CallExpression */ && node.parent.expression === node; var immediateContainer = ts.getSuperContainer(node, /*stopOnFunctions*/ true); var container = immediateContainer; var needToCaptureLexicalThis = false; // adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting if (!isCallExpression) { - while (container && container.kind === 214 /* SyntaxKind.ArrowFunction */) { + while (container && container.kind === 216 /* SyntaxKind.ArrowFunction */) { container = ts.getSuperContainer(container, /*stopOnFunctions*/ true); needToCaptureLexicalThis = languageVersion < 2 /* ScriptTarget.ES2015 */; } @@ -73133,14 +73542,14 @@ var ts; // class B { // [super.foo()]() {} // } - var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 162 /* SyntaxKind.ComputedPropertyName */; }); - if (current && current.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 164 /* SyntaxKind.ComputedPropertyName */; }); + if (current && current.kind === 164 /* SyntaxKind.ComputedPropertyName */) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } - else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -73148,7 +73557,7 @@ var ts; } return errorType; } - if (!isCallExpression && immediateContainer.kind === 171 /* SyntaxKind.Constructor */) { + if (!isCallExpression && immediateContainer.kind === 173 /* SyntaxKind.Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); } if (ts.isStatic(container) || isCallExpression) { @@ -73229,7 +73638,7 @@ var ts; // as a call expression cannot be used as the target of a destructuring assignment while a property access can. // // For element access expressions (`super[x]`), we emit a generic helper that forwards the element access in both situations. - if (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && ts.hasSyntacticModifier(container, 256 /* ModifierFlags.Async */)) { + if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) { if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */; } @@ -73243,7 +73652,7 @@ var ts; // in this case they should also use correct lexical this captureLexicalThis(node.parent, container); } - if (container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return errorType; @@ -73264,7 +73673,7 @@ var ts; if (!baseClassType) { return errorType; } - if (container.kind === 171 /* SyntaxKind.Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 173 /* SyntaxKind.Constructor */ && isInConstructorArgumentInitializer(node, container)) { // issue custom error message for super property access in constructor arguments (to be aligned with old compiler) error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return errorType; @@ -73279,7 +73688,7 @@ var ts; if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes - return container.kind === 171 /* SyntaxKind.Constructor */; + return container.kind === 173 /* SyntaxKind.Constructor */; } else { // TS 1.0 SPEC (April 2014) @@ -73287,23 +73696,23 @@ var ts; // - In a constructor, instance member function, instance member accessor, or instance member variable initializer where this references a derived class instance // - In a static member function or static member accessor // topmost container must be something that is directly nested in the class declaration\object literal expression - if (ts.isClassLike(container.parent) || container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (ts.isClassLike(container.parent) || container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { if (ts.isStatic(container)) { - return container.kind === 169 /* SyntaxKind.MethodDeclaration */ || - container.kind === 168 /* SyntaxKind.MethodSignature */ || - container.kind === 172 /* SyntaxKind.GetAccessor */ || - container.kind === 173 /* SyntaxKind.SetAccessor */ || - container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - container.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + return container.kind === 171 /* SyntaxKind.MethodDeclaration */ || + container.kind === 170 /* SyntaxKind.MethodSignature */ || + container.kind === 174 /* SyntaxKind.GetAccessor */ || + container.kind === 175 /* SyntaxKind.SetAccessor */ || + container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + container.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; } else { - return container.kind === 169 /* SyntaxKind.MethodDeclaration */ || - container.kind === 168 /* SyntaxKind.MethodSignature */ || - container.kind === 172 /* SyntaxKind.GetAccessor */ || - container.kind === 173 /* SyntaxKind.SetAccessor */ || - container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - container.kind === 166 /* SyntaxKind.PropertySignature */ || - container.kind === 171 /* SyntaxKind.Constructor */; + return container.kind === 171 /* SyntaxKind.MethodDeclaration */ || + container.kind === 170 /* SyntaxKind.MethodSignature */ || + container.kind === 174 /* SyntaxKind.GetAccessor */ || + container.kind === 175 /* SyntaxKind.SetAccessor */ || + container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + container.kind === 168 /* SyntaxKind.PropertySignature */ || + container.kind === 173 /* SyntaxKind.Constructor */; } } } @@ -73311,10 +73720,10 @@ var ts; } } function getContainingObjectLiteral(func) { - return (func.kind === 169 /* SyntaxKind.MethodDeclaration */ || - func.kind === 172 /* SyntaxKind.GetAccessor */ || - func.kind === 173 /* SyntaxKind.SetAccessor */) && func.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ ? func.parent : - func.kind === 213 /* SyntaxKind.FunctionExpression */ && func.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ ? func.parent.parent : + return (func.kind === 171 /* SyntaxKind.MethodDeclaration */ || + func.kind === 174 /* SyntaxKind.GetAccessor */ || + func.kind === 175 /* SyntaxKind.SetAccessor */) && func.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ ? func.parent : + func.kind === 215 /* SyntaxKind.FunctionExpression */ && func.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ ? func.parent.parent : undefined; } function getThisTypeArgument(type) { @@ -73326,7 +73735,7 @@ var ts; }); } function getContextualThisParameterType(func) { - if (func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 216 /* SyntaxKind.ArrowFunction */) { return undefined; } if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { @@ -73353,7 +73762,7 @@ var ts; if (thisType) { return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral))); } - if (literal.parent.kind !== 296 /* SyntaxKind.PropertyAssignment */) { + if (literal.parent.kind !== 299 /* SyntaxKind.PropertyAssignment */) { break; } literal = literal.parent.parent; @@ -73367,7 +73776,7 @@ var ts; // In an assignment of the form 'obj.xxx = function(...)' or 'obj[xxx] = function(...)', the // contextual type for 'this' is 'obj'. var parent = ts.walkUpParenthesizedExpressions(func.parent); - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { var target = parent.left; if (ts.isAccessExpression(target)) { var expression = target.expression; @@ -73420,11 +73829,11 @@ var ts; return getTypeFromTypeNode(typeNode); } switch (declaration.kind) { - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return getContextuallyTypedParameterType(declaration); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getContextualTypeForBindingElement(declaration, contextFlags); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (ts.isStatic(declaration)) { return getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags); } @@ -73435,10 +73844,10 @@ var ts; var parent = declaration.parent.parent; var name = declaration.propertyName || declaration.name; var parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || - parent.kind !== 203 /* SyntaxKind.BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* CheckMode.RestBindingElement */ : 0 /* CheckMode.Normal */); + parent.kind !== 205 /* SyntaxKind.BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* CheckMode.RestBindingElement */ : 0 /* CheckMode.Normal */); if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name)) return undefined; - if (parent.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */) { + if (parent.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */) { var index = ts.indexOfNode(declaration.parent.elements, declaration); if (index < 0) return undefined; @@ -73595,7 +74004,7 @@ var ts; getTypeAtPosition(signature, argIndex); } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (template.parent.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -73714,9 +74123,11 @@ var ts; case 1 /* AssignmentDeclarationKind.ExportsProperty */: case 6 /* AssignmentDeclarationKind.Prototype */: case 3 /* AssignmentDeclarationKind.PrototypeProperty */: - var valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; - // falls through case 2 /* AssignmentDeclarationKind.ModuleExports */: + var valueDeclaration = void 0; + if (kind !== 2 /* AssignmentDeclarationKind.ModuleExports */) { + valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; + } valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration); var annotated = valueDeclaration && ts.getEffectiveTypeAnnotationNode(valueDeclaration); return annotated ? getTypeFromTypeNode(annotated) : undefined; @@ -73893,21 +74304,21 @@ var ts; case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 79 /* SyntaxKind.Identifier */: - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: return true; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isPossiblyDiscriminantValue(node.expression); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return !node.expression || isPossiblyDiscriminantValue(node.expression); } return false; } function discriminateContextualTypeByObjectMembers(node, contextualType) { - return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 296 /* SyntaxKind.PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); + return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 299 /* SyntaxKind.PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); } function discriminateContextualTypeByJSXAttributes(node, contextualType) { - return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 285 /* SyntaxKind.JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); + return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 288 /* SyntaxKind.JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); } // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily // be "pushed" onto a node using the contextualType property. @@ -73990,60 +74401,62 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 205 /* SyntaxKind.BindingElement */: return getContextualTypeForInitializerExpression(node, contextFlags); - case 214 /* SyntaxKind.ArrowFunction */: - case 247 /* SyntaxKind.ReturnStatement */: + case 216 /* SyntaxKind.ArrowFunction */: + case 250 /* SyntaxKind.ReturnStatement */: return getContextualTypeForReturnExpression(node, contextFlags); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return getContextualTypeForYieldOperand(parent, contextFlags); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return getContextualTypeForAwaitOperand(parent, contextFlags); - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return getContextualTypeForArgument(parent, node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return ts.isConstTypeReference(parent.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(parent.type); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return getContextualTypeForBinaryOperand(node, contextFlags); - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent, contextFlags); - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return getContextualType(parent.parent, contextFlags); - case 204 /* SyntaxKind.ArrayLiteralExpression */: { + case 206 /* SyntaxKind.ArrayLiteralExpression */: { var arrayLiteral = parent; var type = getApparentTypeOfContextualType(arrayLiteral, contextFlags); return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node)); } - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return getContextualTypeForConditionalOperand(node, contextFlags); - case 233 /* SyntaxKind.TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 223 /* SyntaxKind.TemplateExpression */); + case 236 /* SyntaxKind.TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 225 /* SyntaxKind.TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 212 /* SyntaxKind.ParenthesizedExpression */: { + case 214 /* SyntaxKind.ParenthesizedExpression */: { // Like in `checkParenthesizedExpression`, an `/** @type {xyz} */` comment before a parenthesized expression acts as a type cast. var tag = ts.isInJSFile(parent) ? ts.getJSDocTypeTag(parent) : undefined; return !tag ? getContextualType(parent, contextFlags) : ts.isJSDocTypeTag(tag) && ts.isConstTypeReference(tag.typeExpression.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(tag.typeExpression.type); } - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return getContextualType(parent, contextFlags); - case 271 /* SyntaxKind.ExportAssignment */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return getTypeFromTypeNode(parent.type); + case 274 /* SyntaxKind.ExportAssignment */: return tryGetTypeFromEffectiveTypeNode(parent); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return getContextualTypeForJsxExpression(parent, contextFlags); - case 285 /* SyntaxKind.JsxAttribute */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent, contextFlags); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return getContextualJsxElementAttributesType(parent, contextFlags); } return undefined; @@ -74169,9 +74582,16 @@ var ts; if (!isErrorType(intrinsicClassAttribs)) { var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); var hostClassType = getReturnTypeOfSignature(sig); - apparentAttributesType = intersectTypes(typeParams - ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context))) - : intrinsicClassAttribs, apparentAttributesType); + var libraryManagedAttributeType = void 0; + if (typeParams) { + // apply JSX.IntrinsicClassElements + var inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context)); + libraryManagedAttributeType = instantiateType(intrinsicClassAttribs, createTypeMapper(typeParams, inferredArgs)); + } + // or JSX.IntrinsicClassElements has no generics. + else + libraryManagedAttributeType = intrinsicClassAttribs; + apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType); } var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); if (!isErrorType(intrinsicAttribs)) { @@ -74294,7 +74714,7 @@ var ts; // all identical ignoring their return type, the result is same signature but with return type as // union type of return types from these signatures function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var typeTagSignature = getSignatureOfTypeTag(node); if (typeTagSignature) { return typeTagSignature; @@ -74342,8 +74762,8 @@ var ts; return node.isSpread ? getIndexedAccessType(node.type, numberType) : node.type; } function hasDefaultValue(node) { - return (node.kind === 203 /* SyntaxKind.BindingElement */ && !!node.initializer) || - (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */); + return (node.kind === 205 /* SyntaxKind.BindingElement */ && !!node.initializer) || + (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */); } function checkArrayLiteral(node, checkMode, forceTuple) { var elements = node.elements; @@ -74356,7 +74776,7 @@ var ts; var hasOmittedExpression = false; for (var i = 0; i < elementCount; i++) { var e = elements[i]; - if (e.kind === 225 /* SyntaxKind.SpreadElement */) { + if (e.kind === 227 /* SyntaxKind.SpreadElement */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { checkExternalEmitHelpers(e, compilerOptions.downlevelIteration ? 1536 /* ExternalEmitHelpers.SpreadIncludes */ : 1024 /* ExternalEmitHelpers.SpreadArray */); } @@ -74389,7 +74809,7 @@ var ts; elementFlags.push(4 /* ElementFlags.Rest */); } } - else if (exactOptionalPropertyTypes && e.kind === 227 /* SyntaxKind.OmittedExpression */) { + else if (exactOptionalPropertyTypes && e.kind === 229 /* SyntaxKind.OmittedExpression */) { hasOmittedExpression = true; elementTypes.push(missingType); elementFlags.push(2 /* ElementFlags.Optional */); @@ -74429,7 +74849,7 @@ var ts; } function isNumericName(name) { switch (name.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return isNumericComputedName(name); case 79 /* SyntaxKind.Identifier */: return ts.isNumericLiteralName(name.escapedText); @@ -74450,7 +74870,7 @@ var ts; if (!links.resolvedType) { if ((ts.isTypeLiteralNode(node.parent.parent) || ts.isClassLike(node.parent.parent) || ts.isInterfaceDeclaration(node.parent.parent)) && ts.isBinaryExpression(node.expression) && node.expression.operatorToken.kind === 101 /* SyntaxKind.InKeyword */ - && node.parent.kind !== 172 /* SyntaxKind.GetAccessor */ && node.parent.kind !== 173 /* SyntaxKind.SetAccessor */) { + && node.parent.kind !== 174 /* SyntaxKind.GetAccessor */ && node.parent.kind !== 175 /* SyntaxKind.SetAccessor */) { return links.resolvedType = errorType; } links.resolvedType = checkExpression(node.expression); @@ -74523,7 +74943,7 @@ var ts; var spread = emptyObjectType; var contextualType = getApparentTypeOfContextualType(node, /*contextFlags*/ undefined); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ || contextualType.pattern.kind === 205 /* SyntaxKind.ObjectLiteralExpression */); + (contextualType.pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ || contextualType.pattern.kind === 207 /* SyntaxKind.ObjectLiteralExpression */); var inConstContext = isConstContext(node); var checkFlags = inConstContext ? 8 /* CheckFlags.Readonly */ : 0; var isInJavascript = ts.isInJSFile(node) && !ts.isInJsonFile(node); @@ -74547,16 +74967,16 @@ var ts; for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var memberDecl = _c[_b]; var member = getSymbolOfNode(memberDecl); - var computedNameType = memberDecl.name && memberDecl.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? + var computedNameType = memberDecl.name && memberDecl.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : undefined; - if (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ || - memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ || + if (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ || + memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { - var type = memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : + var type = memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : // avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring // for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`. // we don't want to say "could not find 'a'". - memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : + memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode); if (isInJavascript) { var jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl); @@ -74579,8 +74999,8 @@ var ts; if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. - var isOptional = (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 16777216 /* SymbolFlags.Optional */; } @@ -74606,14 +75026,14 @@ var ts; member = prop; allPropertiesTable === null || allPropertiesTable === void 0 ? void 0 : allPropertiesTable.set(prop.escapedName, prop); if (contextualType && checkMode && checkMode & 2 /* CheckMode.Inferential */ && !(checkMode & 4 /* CheckMode.SkipContextSensitive */) && - (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ || memberDecl.kind === 169 /* SyntaxKind.MethodDeclaration */) && isContextSensitive(memberDecl)) { + (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ || memberDecl.kind === 171 /* SyntaxKind.MethodDeclaration */) && isContextSensitive(memberDecl)) { var inferenceContext = getInferenceContext(node); ts.Debug.assert(inferenceContext); // In CheckMode.Inferential we should always have an inference context - var inferenceNode = memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ ? memberDecl.initializer : memberDecl; + var inferenceNode = memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ ? memberDecl.initializer : memberDecl; addIntraExpressionInferenceSite(inferenceContext, inferenceNode, type); } } - else if (memberDecl.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (memberDecl.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { checkExternalEmitHelpers(memberDecl, 2 /* ExternalEmitHelpers.Assign */); } @@ -74649,7 +75069,7 @@ var ts; // an ordinary function declaration(section 6.1) with no parameters. // A set accessor declaration is processed in the same manner // as an ordinary function declaration with a single parameter and a Void return type. - ts.Debug.assert(memberDecl.kind === 172 /* SyntaxKind.GetAccessor */ || memberDecl.kind === 173 /* SyntaxKind.SetAccessor */); + ts.Debug.assert(memberDecl.kind === 174 /* SyntaxKind.GetAccessor */ || memberDecl.kind === 175 /* SyntaxKind.SetAccessor */); checkNodeDeferred(memberDecl); } if (computedNameType && !(computedNameType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */)) { @@ -74676,16 +75096,30 @@ var ts; // If object literal is contextually typed by the implied type of a binding pattern, augment the result // type with those properties for which the binding pattern specifies a default value. // If the object literal is spread into another object literal, skip this step and let the top-level object - // literal handle it instead. - if (contextualTypeHasPattern && node.parent.kind !== 298 /* SyntaxKind.SpreadAssignment */) { - for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { - var prop = _e[_d]; - if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { - if (!(prop.flags & 16777216 /* SymbolFlags.Optional */)) { - error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + // literal handle it instead. Note that this might require full traversal to the root pattern's parent + // as it's the guaranteed to be the common ancestor of the pattern node and the current object node. + // It's not possible to check if the immediate parent node is a spread assignment + // since the type flows in non-obvious ways through conditional expressions, IIFEs and more. + if (contextualTypeHasPattern) { + var rootPatternParent_1 = ts.findAncestor(contextualType.pattern.parent, function (n) { + return n.kind === 257 /* SyntaxKind.VariableDeclaration */ || + n.kind === 223 /* SyntaxKind.BinaryExpression */ || + n.kind === 166 /* SyntaxKind.Parameter */; + }); + var spreadOrOutsideRootObject = ts.findAncestor(node, function (n) { + return n === rootPatternParent_1 || + n.kind === 301 /* SyntaxKind.SpreadAssignment */; + }); + if (spreadOrOutsideRootObject.kind !== 301 /* SyntaxKind.SpreadAssignment */) { + for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { + var prop = _e[_d]; + if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { + if (!(prop.flags & 16777216 /* SymbolFlags.Optional */)) { + error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + propertiesTable.set(prop.escapedName, prop); + propertiesArray.push(prop); } - propertiesTable.set(prop.escapedName, prop); - propertiesArray.push(prop); } } } @@ -74793,6 +75227,7 @@ var ts; */ function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) { var attributes = openingLikeElement.attributes; + var attributesType = getContextualType(attributes, 0 /* ContextFlags.None */); var allAttributesTable = strictNullChecks ? ts.createSymbolTable() : undefined; var attributesTable = ts.createSymbolTable(); var spread = emptyJsxObjectType; @@ -74820,9 +75255,15 @@ var ts; if (attributeDecl.name.escapedText === jsxChildrenPropertyName) { explicitlySpecifyChildrenAttribute = true; } + if (attributesType) { + var prop = getPropertyOfType(attributesType, member.escapedName); + if (prop && prop.declarations && isDeprecatedSymbol(prop)) { + addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText); + } + } } else { - ts.Debug.assert(attributeDecl.kind === 287 /* SyntaxKind.JsxSpreadAttribute */); + ts.Debug.assert(attributeDecl.kind === 290 /* SyntaxKind.JsxSpreadAttribute */); if (attributesTable.size > 0) { spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, /*readonly*/ false); attributesTable = ts.createSymbolTable(); @@ -74849,7 +75290,7 @@ var ts; } } // Handle children attribute - var parent = openingLikeElement.parent.kind === 278 /* SyntaxKind.JsxElement */ ? openingLikeElement.parent : undefined; + var parent = openingLikeElement.parent.kind === 281 /* SyntaxKind.JsxElement */ ? openingLikeElement.parent : undefined; // We have to check that openingElement of the parent is the one we are visiting as this may not be true for selfClosingElement if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) { var childrenTypes = checkJsxChildren(parent, checkMode); @@ -74906,7 +75347,7 @@ var ts; childrenTypes.push(stringType); } } - else if (child.kind === 288 /* SyntaxKind.JsxExpression */ && !child.expression) { + else if (child.kind === 291 /* SyntaxKind.JsxExpression */ && !child.expression) { continue; // empty jsx expressions don't *really* count as present children } else { @@ -75338,9 +75779,9 @@ var ts; function checkPropertyAccessibility(node, isSuper, writing, type, prop, reportError) { if (reportError === void 0) { reportError = true; } var errorNode = !reportError ? undefined : - node.kind === 161 /* SyntaxKind.QualifiedName */ ? node.right : - node.kind === 200 /* SyntaxKind.ImportType */ ? node : - node.kind === 203 /* SyntaxKind.BindingElement */ && node.propertyName ? node.propertyName : node.name; + node.kind === 163 /* SyntaxKind.QualifiedName */ ? node.right : + node.kind === 202 /* SyntaxKind.ImportType */ ? node : + node.kind === 205 /* SyntaxKind.BindingElement */ && node.propertyName ? node.propertyName : node.name; return checkPropertyAccessibilityAtLocation(node, isSuper, writing, type, prop, errorNode); } /** @@ -75371,7 +75812,7 @@ var ts; return false; } } - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { // A method cannot be accessed in a super property access if the method is abstract. // This error could mask a private property access error. But, a member // cannot simultaneously be private and abstract, so this will trigger an @@ -75383,7 +75824,7 @@ var ts; } } // Referencing abstract properties within their own constructors is not allowed - if ((flags & 128 /* ModifierFlags.Abstract */) && symbolHasNonMethodDeclaration(prop) && + if ((flags & 256 /* ModifierFlags.Abstract */) && symbolHasNonMethodDeclaration(prop) && (ts.isThisProperty(location) || ts.isThisInitializedObjectBindingExpression(location) || ts.isObjectBindingPattern(location.parent) && ts.isThisInitializedDeclaration(location.parent.parent))) { var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) { @@ -75477,10 +75918,27 @@ var ts; return isNullableType(type) ? getNonNullableType(type) : type; } function reportObjectPossiblyNullOrUndefinedError(node, facts) { - error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? - ts.Diagnostics.Object_is_possibly_null_or_undefined : - ts.Diagnostics.Object_is_possibly_undefined : - ts.Diagnostics.Object_is_possibly_null); + var nodeText = ts.isEntityNameExpression(node) ? ts.entityNameToString(node) : undefined; + if (node.kind === 104 /* SyntaxKind.NullKeyword */) { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "null"); + return; + } + if (nodeText !== undefined && nodeText.length < 100) { + if (ts.isIdentifier(node) && nodeText === "undefined") { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "undefined"); + return; + } + error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? + ts.Diagnostics._0_is_possibly_null_or_undefined : + ts.Diagnostics._0_is_possibly_undefined : + ts.Diagnostics._0_is_possibly_null, nodeText); + } + else { + error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + } } function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) { error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? @@ -75490,6 +75948,13 @@ var ts; } function checkNonNullTypeWithReporter(type, node, reportError) { if (strictNullChecks && type.flags & 2 /* TypeFlags.Unknown */) { + if (ts.isEntityNameExpression(node)) { + var nodeText = ts.entityNameToString(node); + if (nodeText.length < 100) { + error(node, ts.Diagnostics._0_is_of_type_unknown, nodeText); + return errorType; + } + } error(node, ts.Diagnostics.Object_is_of_type_unknown); return errorType; } @@ -75507,6 +75972,17 @@ var ts; function checkNonNullNonVoidType(type, node) { var nonNullType = checkNonNullType(type, node); if (nonNullType.flags & 16384 /* TypeFlags.Void */) { + if (ts.isEntityNameExpression(node)) { + var nodeText = ts.entityNameToString(node); + if (ts.isIdentifier(node) && nodeText === "undefined") { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, nodeText); + return nonNullType; + } + if (nodeText.length < 100) { + error(node, ts.Diagnostics._0_is_possibly_undefined, nodeText); + return nonNullType; + } + } error(node, ts.Diagnostics.Object_is_possibly_undefined); } return nonNullType; @@ -75525,7 +76001,7 @@ var ts; return checkPropertyAccessExpressionOrQualifiedName(node, node.left, leftType, node.right, checkMode); } function isMethodAccessForCall(node) { - while (node.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (node.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { node = node.parent; } return ts.isCallOrNewExpression(node.parent) && node.parent.expression === node; @@ -75665,7 +76141,7 @@ var ts; } return isErrorType(apparentType) ? errorType : apparentType; } - prop = getPropertyOfType(apparentType, right.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ node.kind === 161 /* SyntaxKind.QualifiedName */); + prop = getPropertyOfType(apparentType, right.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ node.kind === 163 /* SyntaxKind.QualifiedName */); } // In `Foo.Bar.Baz`, 'Foo' is not referenced if 'Bar' is a const enum or a module containing only const enums. // `Foo` is also not referenced in `enum FooCopy { Bar = Foo.Bar }`, because the enum member value gets inlined @@ -75675,7 +76151,7 @@ var ts; // 1. if 'isolatedModules' is enabled, because the const enum value will not be inlined, and // 2. if 'preserveConstEnums' is enabled and the expression is itself an export, e.g. `export = Foo.Bar.Baz`. if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules || - !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* SymbolFlags.EnumMember */ && node.parent.kind === 299 /* SyntaxKind.EnumMember */)) || + !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* SymbolFlags.EnumMember */ && node.parent.kind === 302 /* SyntaxKind.EnumMember */)) || ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) { markAliasReferenced(parentSymbol, node); } @@ -75777,7 +76253,7 @@ var ts; if (declaration && isPropertyWithoutInitializer(declaration)) { if (!ts.isStatic(declaration)) { var flowContainer = getControlFlowContainer(node); - if (flowContainer.kind === 171 /* SyntaxKind.Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { + if (flowContainer.kind === 173 /* SyntaxKind.Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { assumeUninitialized = true; } } @@ -75812,8 +76288,8 @@ var ts; && (compilerOptions.useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) { diagnosticMessage = error(right, ts.Diagnostics.Property_0_is_used_before_its_initialization, declarationName); } - else if (valueDeclaration.kind === 257 /* SyntaxKind.ClassDeclaration */ && - node.parent.kind !== 178 /* SyntaxKind.TypeReference */ && + else if (valueDeclaration.kind === 260 /* SyntaxKind.ClassDeclaration */ && + node.parent.kind !== 180 /* SyntaxKind.TypeReference */ && !(valueDeclaration.flags & 16777216 /* NodeFlags.Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) { diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName); @@ -75825,25 +76301,25 @@ var ts; function isInPropertyInitializerOrClassStaticBlock(node) { return !!ts.findAncestor(node, function (node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 296 /* SyntaxKind.PropertyAssignment */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 298 /* SyntaxKind.SpreadAssignment */: - case 162 /* SyntaxKind.ComputedPropertyName */: - case 233 /* SyntaxKind.TemplateSpan */: - case 288 /* SyntaxKind.JsxExpression */: - case 285 /* SyntaxKind.JsxAttribute */: - case 286 /* SyntaxKind.JsxAttributes */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 291 /* SyntaxKind.HeritageClause */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 301 /* SyntaxKind.SpreadAssignment */: + case 164 /* SyntaxKind.ComputedPropertyName */: + case 236 /* SyntaxKind.TemplateSpan */: + case 291 /* SyntaxKind.JsxExpression */: + case 288 /* SyntaxKind.JsxAttribute */: + case 289 /* SyntaxKind.JsxAttributes */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 294 /* SyntaxKind.HeritageClause */: return false; - case 214 /* SyntaxKind.ArrowFunction */: - case 238 /* SyntaxKind.ExpressionStatement */: + case 216 /* SyntaxKind.ArrowFunction */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.isBlock(node.parent) && ts.isClassStaticBlockDeclaration(node.parent.parent) ? true : "quit"; default: return ts.isExpressionNode(node) ? false : "quit"; @@ -76038,7 +76514,6 @@ var ts; } return false; } - ; var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get"; if (!hasProp(suggestedMethod)) { return undefined; @@ -76118,11 +76593,11 @@ var ts; } function isValidPropertyAccess(node, propertyName) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return isValidPropertyAccessWithType(node, node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, propertyName, getWidenedType(checkExpression(node.expression))); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getWidenedType(checkExpression(node.left))); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getTypeFromTypeNode(node)); } } @@ -76137,7 +76612,7 @@ var ts; * @param property the accessed property's symbol. */ function isValidPropertyAccessForCompletions(node, type, property) { - return isPropertyAccessible(node, node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, + return isPropertyAccessible(node, node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, /* isWrite */ false, type, property); // Previously we validated the 'this' type of methods but this adversely affected performance. See #31377 for more context. } @@ -76177,7 +76652,7 @@ var ts; */ function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -76206,7 +76681,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 243 /* SyntaxKind.ForInStatement */ && + if (node.kind === 246 /* SyntaxKind.ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -76255,13 +76730,13 @@ var ts; // This gets us diagnostics for the type arguments and marks them as referenced. ts.forEach(node.typeArguments, checkSourceElement); } - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { checkExpression(node.template); } else if (ts.isJsxOpeningLikeElement(node)) { checkExpression(node.attributes); } - else if (node.kind !== 165 /* SyntaxKind.Decorator */) { + else if (node.kind !== 167 /* SyntaxKind.Decorator */) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -76325,7 +76800,7 @@ var ts; } } function isSpreadArgument(arg) { - return !!arg && (arg.kind === 225 /* SyntaxKind.SpreadElement */ || arg.kind === 232 /* SyntaxKind.SyntheticExpression */ && arg.isSpread); + return !!arg && (arg.kind === 227 /* SyntaxKind.SpreadElement */ || arg.kind === 234 /* SyntaxKind.SyntheticExpression */ && arg.isSpread); } function getSpreadArgumentIndex(args) { return ts.findIndex(args, isSpreadArgument); @@ -76342,9 +76817,9 @@ var ts; var callIsIncomplete = false; // In incomplete call we want to be lenient when we have too few arguments var effectiveParameterCount = getParameterCount(signature); var effectiveMinimumArguments = getMinArgumentCount(signature); - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { argCount = args.length; - if (node.template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (node.template.kind === 225 /* SyntaxKind.TemplateExpression */) { // If a tagged template expression lacks a tail literal, the call is incomplete. // Specifically, a template only can end in a TemplateTail or a Missing literal. var lastSpan = ts.last(node.template.templateSpans); // we should always have at least one span. @@ -76359,7 +76834,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 165 /* SyntaxKind.Decorator */) { + else if (node.kind === 167 /* SyntaxKind.Decorator */) { argCount = getDecoratorArgumentCount(node, signature); } else if (ts.isJsxOpeningLikeElement(node)) { @@ -76373,7 +76848,7 @@ var ts; } else if (!node.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(node.kind === 209 /* SyntaxKind.NewExpression */); + ts.Debug.assert(node.kind === 211 /* SyntaxKind.NewExpression */); return getMinArgumentCount(signature) === 0; } else { @@ -76476,7 +76951,7 @@ var ts; // example, given a 'function wrap(cb: (x: T) => U): (x: T) => U' and a call expression // 'let f: (x: string) => number = wrap(s => s.length)', we infer from the declared type of 'f' to the // return type of 'wrap'. - if (node.kind !== 165 /* SyntaxKind.Decorator */) { + if (node.kind !== 167 /* SyntaxKind.Decorator */) { var skipBindingPatterns = ts.every(signature.typeParameters, function (p) { return !!getDefaultFromTypeParameter(p); }); var contextualType = getContextualType(node, skipBindingPatterns ? 8 /* ContextFlags.SkipBindingPatterns */ : 0 /* ContextFlags.None */); if (contextualType) { @@ -76540,7 +77015,7 @@ var ts; } for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 227 /* SyntaxKind.OmittedExpression */ && !(checkMode & 32 /* CheckMode.IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) { + if (arg.kind !== 229 /* SyntaxKind.OmittedExpression */ && !(checkMode & 32 /* CheckMode.IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) { var paramType = getTypeAtPosition(signature, i); if (couldContainTypeVariables(paramType)) { var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode); @@ -76566,7 +77041,7 @@ var ts; if (isSpreadArgument(arg)) { // We are inferring from a spread expression in the last argument position, i.e. both the parameter // and the argument are ...x forms. - return getMutableArrayOrTupleType(arg.kind === 232 /* SyntaxKind.SyntheticExpression */ ? arg.type : + return getMutableArrayOrTupleType(arg.kind === 234 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode)); } } @@ -76576,13 +77051,13 @@ var ts; for (var i = index; i < argCount; i++) { var arg = args[i]; if (isSpreadArgument(arg)) { - var spreadType = arg.kind === 232 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpression(arg.expression); + var spreadType = arg.kind === 234 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpression(arg.expression); if (isArrayLikeType(spreadType)) { types.push(spreadType); flags.push(8 /* ElementFlags.Variadic */); } else { - types.push(checkIteratedTypeOrElementType(33 /* IterationUse.Spread */, spreadType, undefinedType, arg.kind === 225 /* SyntaxKind.SpreadElement */ ? arg.expression : arg)); + types.push(checkIteratedTypeOrElementType(33 /* IterationUse.Spread */, spreadType, undefinedType, arg.kind === 227 /* SyntaxKind.SpreadElement */ ? arg.expression : arg)); flags.push(4 /* ElementFlags.Rest */); } } @@ -76593,7 +77068,7 @@ var ts; types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType)); flags.push(1 /* ElementFlags.Required */); } - if (arg.kind === 232 /* SyntaxKind.SyntheticExpression */ && arg.tupleNameSource) { + if (arg.kind === 234 /* SyntaxKind.SyntheticExpression */ && arg.tupleNameSource) { names.push(arg.tupleNameSource); } } @@ -76737,7 +77212,7 @@ var ts; return undefined; } var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 209 /* SyntaxKind.NewExpression */) { + if (thisType && thisType !== voidType && node.kind !== 211 /* SyntaxKind.NewExpression */) { // If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType // If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible. // If the expression is a new expression, then the check is skipped. @@ -76755,7 +77230,7 @@ var ts; var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length; for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 227 /* SyntaxKind.OmittedExpression */) { + if (arg.kind !== 229 /* SyntaxKind.OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = checkExpressionWithContextualType(arg, paramType, /*inferenceContext*/ undefined, checkMode); // If one or more arguments are still excluded (as indicated by CheckMode.SkipContextSensitive), @@ -76800,8 +77275,8 @@ var ts; * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise. */ function getThisArgumentOfCall(node) { - var expression = node.kind === 208 /* SyntaxKind.CallExpression */ ? node.expression : - node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */ ? node.tag : undefined; + var expression = node.kind === 210 /* SyntaxKind.CallExpression */ ? node.expression : + node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */ ? node.tag : undefined; if (expression) { var callee = ts.skipOuterExpressions(expression); if (ts.isAccessExpression(callee)) { @@ -76819,17 +77294,17 @@ var ts; * Returns the effective arguments for an expression that works like a function invocation. */ function getEffectiveCallArguments(node) { - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { var template = node.template; var args_3 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())]; - if (template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (template.kind === 225 /* SyntaxKind.TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args_3.push(span.expression); }); } return args_3; } - if (node.kind === 165 /* SyntaxKind.Decorator */) { + if (node.kind === 167 /* SyntaxKind.Decorator */) { return getEffectiveDecoratorArguments(node); } if (ts.isJsxOpeningLikeElement(node)) { @@ -76840,10 +77315,10 @@ var ts; if (spreadIndex >= 0) { // Create synthetic arguments from spreads of tuple types. var effectiveArgs_1 = args.slice(0, spreadIndex); - var _loop_26 = function (i) { + var _loop_27 = function (i) { var arg = args[i]; // We can call checkExpressionCached because spread expressions never have a contextual type. - var spreadType = arg.kind === 225 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); + var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); if (spreadType && isTupleType(spreadType)) { ts.forEach(getTypeArguments(spreadType), function (t, i) { var _a; @@ -76857,7 +77332,7 @@ var ts; } }; for (var i = spreadIndex; i < args.length; i++) { - _loop_26(i); + _loop_27(i); } return effectiveArgs_1; } @@ -76870,30 +77345,30 @@ var ts; var parent = node.parent; var expr = node.expression; switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: // For a class decorator, the `target` is the type of the class (e.g. the // "static" or "constructor" side of the class). return [ createSyntheticExpression(expr, getTypeOfSymbol(getSymbolOfNode(parent))) ]; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // A parameter declaration decorator will have three arguments (see // `ParameterDecorator` in core.d.ts). var func = parent.parent; return [ - createSyntheticExpression(expr, parent.parent.kind === 171 /* SyntaxKind.Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), + createSyntheticExpression(expr, parent.parent.kind === 173 /* SyntaxKind.Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), createSyntheticExpression(expr, anyType), createSyntheticExpression(expr, numberType) ]; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // A method or accessor declaration decorator will have two or three arguments (see // `PropertyDecorator` and `MethodDecorator` in core.d.ts). If we are emitting decorators // for ES3, we will only pass two arguments. - var hasPropDesc = parent.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && languageVersion !== 0 /* ScriptTarget.ES3 */; + var hasPropDesc = languageVersion !== 0 /* ScriptTarget.ES3 */ && (!ts.isPropertyDeclaration(parent) || ts.hasAccessorModifier(parent)); return [ createSyntheticExpression(expr, getParentTypeOfClassElement(parent)), createSyntheticExpression(expr, getClassElementPropertyKeyType(parent)), @@ -76907,17 +77382,17 @@ var ts; */ function getDecoratorArgumentCount(node, signature) { switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return 1; - case 167 /* SyntaxKind.PropertyDeclaration */: - return 2; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + return ts.hasAccessorModifier(node.parent) ? 3 : 2; + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // For ES3 or decorators with only two parameters we supply only two arguments return languageVersion === 0 /* ScriptTarget.ES3 */ || signature.parameters.length <= 2 ? 2 : 3; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return 3; default: return ts.Debug.fail(); @@ -77059,8 +77534,8 @@ var ts; return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount); } function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags, fallbackError) { - var isTaggedTemplate = node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */; - var isDecorator = node.kind === 165 /* SyntaxKind.Decorator */; + var isTaggedTemplate = node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */; + var isDecorator = node.kind === 167 /* SyntaxKind.Decorator */; var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node); var reportErrors = !candidatesOutArray; var typeArguments; @@ -77123,7 +77598,7 @@ var ts; var result; // If we are in signature help, a trailing comma indicates that we intend to provide another argument, // so we will only accept overloads with arity at least 1 higher than the current number of provided arguments. - var signatureHelpTrailingComma = !!(checkMode & 16 /* CheckMode.IsForSignatureHelp */) && node.kind === 208 /* SyntaxKind.CallExpression */ && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = !!(checkMode & 16 /* CheckMode.IsForSignatureHelp */) && node.kind === 210 /* SyntaxKind.CallExpression */ && node.arguments.hasTrailingComma; // Section 4.12.1: // if the candidate list contains one or more signatures for which the type of each argument // expression is a subtype of each corresponding parameter type, the return type of the first @@ -77186,7 +77661,7 @@ var ts; var min_3 = Number.MAX_VALUE; var minIndex = 0; var i_1 = 0; - var _loop_27 = function (c) { + var _loop_28 = function (c) { var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); }; var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* CheckMode.Normal */, /*reportErrors*/ true, chain_2); if (diags_2) { @@ -77204,7 +77679,7 @@ var ts; }; for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) { var c = candidatesForArgumentError_1[_a]; - _loop_27(c); + _loop_28(c); } var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics); ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures"); @@ -77362,7 +77837,7 @@ var ts; } var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max; var parameters = []; - var _loop_28 = function (i) { + var _loop_29 = function (i) { var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ? i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) : i < s.parameters.length ? s.parameters[i] : undefined; }); @@ -77370,7 +77845,7 @@ var ts; parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); }))); }; for (var i = 0; i < maxNonRestParam; i++) { - _loop_28(i); + _loop_29(i); } var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; }); var flags = 0 /* SignatureFlags.None */; @@ -77612,7 +78087,7 @@ var ts; return resolveErrorCall(node); } var valueDecl = expressionType.symbol && ts.getClassLikeDeclarationOfSymbol(expressionType.symbol); - if (valueDecl && ts.hasSyntacticModifier(valueDecl, 128 /* ModifierFlags.Abstract */)) { + if (valueDecl && ts.hasSyntacticModifier(valueDecl, 256 /* ModifierFlags.Abstract */)) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_an_abstract_class); return resolveErrorCall(node); } @@ -77683,7 +78158,7 @@ var ts; var declaration = signature.declaration; var modifiers = ts.getSelectedEffectiveModifierFlags(declaration, 24 /* ModifierFlags.NonPublicAccessibilityModifier */); // (1) Public constructors and (2) constructor functions are always accessible. - if (!modifiers || declaration.kind !== 171 /* SyntaxKind.Constructor */) { + if (!modifiers || declaration.kind !== 173 /* SyntaxKind.Constructor */) { return true; } var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(declaration.parent.symbol); @@ -77827,16 +78302,16 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; default: return ts.Debug.fail(); @@ -77882,7 +78357,7 @@ var ts; // file would probably be preferable. var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 788968 /* SymbolFlags.Type */); var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 788968 /* SymbolFlags.Type */, node); - var declaration = ts.factory.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + var declaration = ts.factory.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); var parameterSymbol = createSymbol(1 /* SymbolFlags.FunctionScopedVariable */, "props"); parameterSymbol.type = result; return createSignature(declaration, @@ -77931,16 +78406,16 @@ var ts; } function resolveSignature(node, candidatesOutArray, checkMode) { switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return resolveCallExpression(node, candidatesOutArray, checkMode); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return resolveNewExpression(node, candidatesOutArray, checkMode); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return resolveDecorator(node, candidatesOutArray, checkMode); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode); } throw ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable."); @@ -77984,12 +78459,15 @@ var ts; return false; } var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node : - ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer : + (ts.isVariableDeclaration(node) || ts.isPropertyAssignment(node)) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer : undefined; if (func) { - // If the node has a @class tag, treat it like a constructor. + // If the node has a @class or @constructor tag, treat it like a constructor. if (ts.getJSDocClassTag(node)) return true; + // If the node is a property of an object literal. + if (ts.isPropertyAssignment(ts.walkUpParenthesizedExpressions(func.parent))) + return false; // If the symbol of the node has members, treat it like a constructor. var symbol = getSymbolOfNode(func); return !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.members) === null || _a === void 0 ? void 0 : _a.size); @@ -78072,7 +78550,7 @@ var ts; return false; } var parent = node.parent; - while (parent && parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (parent && parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { parent = parent.parent; } if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { @@ -78098,12 +78576,12 @@ var ts; if (node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { return voidType; } - if (node.kind === 209 /* SyntaxKind.NewExpression */) { + if (node.kind === 211 /* SyntaxKind.NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 171 /* SyntaxKind.Constructor */ && - declaration.kind !== 175 /* SyntaxKind.ConstructSignature */ && - declaration.kind !== 180 /* SyntaxKind.ConstructorType */ && + declaration.kind !== 173 /* SyntaxKind.Constructor */ && + declaration.kind !== 177 /* SyntaxKind.ConstructSignature */ && + declaration.kind !== 182 /* SyntaxKind.ConstructorType */ && !ts.isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) { // When resolved signature is a call signature (and not a construct signature) the result type is any @@ -78123,7 +78601,7 @@ var ts; if (returnType.flags & 12288 /* TypeFlags.ESSymbolLike */ && isSymbolOrSymbolForCall(node)) { return getESSymbolLikeTypeForNode(ts.walkUpParenthesizedExpressions(node.parent)); } - if (node.kind === 208 /* SyntaxKind.CallExpression */ && !node.questionDotToken && node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && + if (node.kind === 210 /* SyntaxKind.CallExpression */ && !node.questionDotToken && node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && returnType.flags & 16384 /* TypeFlags.Void */ && getTypePredicateOfSignature(signature)) { if (!ts.isDottedName(node.expression)) { error(node.expression, ts.Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name); @@ -78153,20 +78631,20 @@ var ts; function getDeprecatedSuggestionNode(node) { node = ts.skipParentheses(node); switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: - case 165 /* SyntaxKind.Decorator */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 167 /* SyntaxKind.Decorator */: + case 211 /* SyntaxKind.NewExpression */: return getDeprecatedSuggestionNode(node.expression); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return getDeprecatedSuggestionNode(node.tag); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return getDeprecatedSuggestionNode(node.tagName); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return node.argumentExpression; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.name; - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: var typeReference = node; return ts.isQualifiedName(typeReference.typeName) ? typeReference.typeName.right : typeReference; default: @@ -78237,8 +78715,8 @@ var ts; if (hasDefaultOnly && type && !isErrorType(type)) { var synthType = type; if (!synthType.defaultOnlyType) { - var type_5 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); - synthType.defaultOnlyType = type_5; + var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); + synthType.defaultOnlyType = type_4; } return synthType.defaultOnlyType; } @@ -78281,9 +78759,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 /* SymbolFlags.Function */ - ? 256 /* SyntaxKind.FunctionDeclaration */ + ? 259 /* SyntaxKind.FunctionDeclaration */ : resolvedRequire.flags & 3 /* SymbolFlags.Variable */ - ? 254 /* SyntaxKind.VariableDeclaration */ + ? 257 /* SyntaxKind.VariableDeclaration */ : 0 /* SyntaxKind.Unknown */; if (targetDeclarationKind !== 0 /* SyntaxKind.Unknown */) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -78303,7 +78781,7 @@ var ts; return getReturnTypeOfSignature(signature); } function checkAssertion(node) { - if (node.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (node.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { var file = ts.getSourceFileOfNode(node); if (file && ts.fileExtensionIsOneOf(file.fileName, [".cts" /* Extension.Cts */, ".mts" /* Extension.Mts */])) { grammarErrorOnNode(node, ts.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead); @@ -78319,19 +78797,19 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 223 /* SyntaxKind.TemplateExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return true; - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isValidConstAssertionArgument(node.expression); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var op = node.operator; var arg = node.operand; return op === 40 /* SyntaxKind.MinusToken */ && (arg.kind === 8 /* SyntaxKind.NumericLiteral */ || arg.kind === 9 /* SyntaxKind.BigIntLiteral */) || op === 39 /* SyntaxKind.PlusToken */ && arg.kind === 8 /* SyntaxKind.NumericLiteral */; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = node.expression; var symbol = getTypeOfNode(expr).symbol; if (symbol && symbol.flags & 2097152 /* SymbolFlags.Alias */) { @@ -78373,7 +78851,7 @@ var ts; } function checkExpressionWithTypeArguments(node) { checkGrammarExpressionWithTypeArguments(node); - var exprType = node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ ? checkExpression(node.expression) : + var exprType = node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ ? checkExpression(node.expression) : ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName); var typeArguments = node.typeArguments; @@ -78437,6 +78915,16 @@ var ts; }); } } + function checkSatisfiesExpression(node) { + checkSourceElement(node.type); + var targetType = getTypeFromTypeNode(node.type); + if (isErrorType(targetType)) { + return targetType; + } + var exprType = checkExpression(node.expression); + checkTypeAssignableToAndOptionallyElaborate(exprType, targetType, node.type, node.expression, ts.Diagnostics.Type_0_does_not_satisfy_the_expected_type_1); + return exprType; + } function checkMetaProperty(node) { checkGrammarMetaProperty(node); if (node.keywordToken === 103 /* SyntaxKind.NewKeyword */) { @@ -78464,7 +78952,7 @@ var ts; error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); return errorType; } - else if (container.kind === 171 /* SyntaxKind.Constructor */) { + else if (container.kind === 173 /* SyntaxKind.Constructor */) { var symbol = getSymbolOfNode(container.parent); return getTypeOfSymbol(symbol); } @@ -78516,7 +79004,7 @@ var ts; } function getParameterIdentifierNameAtPosition(signature, pos) { var _a; - if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 317 /* SyntaxKind.JSDocFunctionType */) { + if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 320 /* SyntaxKind.JSDocFunctionType */) { return undefined; } var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -78548,7 +79036,7 @@ var ts; return symbol.valueDeclaration && ts.isParameter(symbol.valueDeclaration) && ts.isIdentifier(symbol.valueDeclaration.name); } function isValidDeclarationForTupleLabel(d) { - return d.kind === 197 /* SyntaxKind.NamedTupleMember */ || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name)); + return d.kind === 199 /* SyntaxKind.NamedTupleMember */ || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name)); } function getNameableDeclarationAtPosition(signature, pos) { var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -78840,7 +79328,7 @@ var ts; var yieldType; var nextType; var fallbackReturnType = voidType; - if (func.body.kind !== 235 /* SyntaxKind.Block */) { // Async or normal arrow function + if (func.body.kind !== 238 /* SyntaxKind.Block */) { // Async or normal arrow function returnType = checkExpressionCached(func.body, checkMode && checkMode & ~8 /* CheckMode.SkipGenericFunctions */); if (isAsync) { // From within an async function you can return either a non-promise value or a promise. Any @@ -78992,7 +79480,7 @@ var ts; return links.isExhaustive !== undefined ? links.isExhaustive : (links.isExhaustive = computeExhaustiveSwitchStatement(node)); } function computeExhaustiveSwitchStatement(node) { - if (node.expression.kind === 216 /* SyntaxKind.TypeOfExpression */) { + if (node.expression.kind === 218 /* SyntaxKind.TypeOfExpression */) { var witnesses = getSwitchClauseTypeOfWitnesses(node); if (!witnesses) { return false; @@ -79058,11 +79546,11 @@ var ts; } function mayReturnNever(func) { switch (func.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; - case 169 /* SyntaxKind.MethodDeclaration */: - return func.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + case 171 /* SyntaxKind.MethodDeclaration */: + return func.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; default: return false; } @@ -79088,7 +79576,7 @@ var ts; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. // also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw - if (func.kind === 168 /* SyntaxKind.MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 235 /* SyntaxKind.Block */ || !functionHasImplicitReturn(func)) { + if (func.kind === 170 /* SyntaxKind.MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 238 /* SyntaxKind.Block */ || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 512 /* NodeFlags.HasExplicitReturn */; @@ -79122,7 +79610,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); checkNodeDeferred(node); if (ts.isFunctionExpression(node)) { checkCollisionsForDeclarationName(node, node.name); @@ -79149,7 +79637,7 @@ var ts; } // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (!hasGrammarError && node.kind === 215 /* SyntaxKind.FunctionExpression */) { checkGrammarForGenerator(node); } contextuallyCheckFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -79200,7 +79688,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var functionFlags = ts.getFunctionFlags(node); var returnType = getReturnTypeFromAnnotation(node); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); @@ -79213,7 +79701,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 235 /* SyntaxKind.Block */) { + if (node.body.kind === 238 /* SyntaxKind.Block */) { checkSourceElement(node.body); } else { @@ -79303,7 +79791,7 @@ var ts; expr.expression.kind === 108 /* SyntaxKind.ThisKeyword */) { // Look for if this is the constructor for the class that `symbol` is a property of. var ctor = ts.getContainingFunction(expr); - if (!(ctor && (ctor.kind === 171 /* SyntaxKind.Constructor */ || isJSConstructor(ctor)))) { + if (!(ctor && (ctor.kind === 173 /* SyntaxKind.Constructor */ || isJSConstructor(ctor)))) { return true; } if (symbol.valueDeclaration) { @@ -79328,7 +79816,7 @@ var ts; var symbol_2 = getNodeLinks(node).resolvedSymbol; if (symbol_2.flags & 2097152 /* SymbolFlags.Alias */) { var declaration = getDeclarationOfAliasSymbol(symbol_2); - return !!declaration && declaration.kind === 268 /* SyntaxKind.NamespaceImport */; + return !!declaration && declaration.kind === 271 /* SyntaxKind.NamespaceImport */; } } } @@ -79428,7 +79916,7 @@ var ts; if (!hasParseDiagnostics(sourceFile)) { var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos); var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); - if (container && container.kind !== 171 /* SyntaxKind.Constructor */ && (ts.getFunctionFlags(container) & 2 /* FunctionFlags.Async */) === 0) { + if (container && container.kind !== 173 /* SyntaxKind.Constructor */ && (ts.getFunctionFlags(container) & 2 /* FunctionFlags.Async */) === 0) { var relatedInfo = ts.createDiagnosticForNode(container, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); ts.addRelatedInfo(diagnostic, relatedInfo); } @@ -79596,6 +80084,9 @@ var ts; } return booleanType; } + function hasEmptyObjectIntersection(type) { + return someType(type, function (t) { return t === unknownEmptyObjectType || !!(t.flags & 2097152 /* TypeFlags.Intersection */) && ts.some(t.types, isEmptyAnonymousObjectType); }); + } function checkInExpression(left, right, leftType, rightType) { if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; @@ -79612,40 +80103,20 @@ var ts; } } else { - leftType = checkNonNullType(leftType, left); - // TypeScript 1.0 spec (April 2014): 4.15.5 - // Require the left operand to be of type Any, the String primitive type, or the Number primitive type. - if (!(allTypesAssignableToKind(leftType, 402653316 /* TypeFlags.StringLike */ | 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */) || - isTypeAssignableToKind(leftType, 4194304 /* TypeFlags.Index */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */ | 262144 /* TypeFlags.TypeParameter */))) { - error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol); + // The type of the lef operand must be assignable to string, number, or symbol. + checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left); + } + // The type of the right operand must be assignable to 'object'. + if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) { + // The {} type is assignable to the object type, yet {} might represent a primitive type. Here we + // detect and error on {} that results from narrowing the unknown type, as well as intersections + // that include {} (we know that the other types in such intersections are assignable to object + // since we already checked for that). + if (hasEmptyObjectIntersection(rightType)) { + error(right, ts.Diagnostics.Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator, typeToString(rightType)); } } - rightType = checkNonNullType(rightType, right); - // TypeScript 1.0 spec (April 2014): 4.15.5 - // The in operator requires the right operand to be - // - // 1. assignable to the non-primitive type, - // 2. an unconstrained type parameter, - // 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the - // the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the - // non-primitive type, or - // 4. a type parameter whose constraint is - // i. an object type, - // ii. the non-primitive type, or - // iii. a union or intersection with at least one constituent assignable to an object or non-primitive type. - // - // The divergent behavior for type parameters and unions containing type parameters is a workaround for type - // parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance - // it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error - // unless *all* instantiations would result in an error. - // // The result is always of the Boolean primitive type. - var rightTypeConstraint = getConstraintOfType(rightType); - if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) || - rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) || - !maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) { - error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive); - } return booleanType; } function checkObjectLiteralAssignment(node, sourceType, rightIsThis) { @@ -79663,7 +80134,7 @@ var ts; if (rightIsThis === void 0) { rightIsThis = false; } var properties = node.properties; var property = properties[propertyIndex]; - if (property.kind === 296 /* SyntaxKind.PropertyAssignment */ || property.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (property.kind === 299 /* SyntaxKind.PropertyAssignment */ || property.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var name = property.name; var exprType = getLiteralTypeFromPropertyName(name); if (isTypeUsableAsPropertyName(exprType)) { @@ -79676,9 +80147,9 @@ var ts; } var elementType = getIndexedAccessType(objectLiteralType, exprType, 32 /* AccessFlags.ExpressionPosition */, name); var type = getFlowTypeOfDestructuring(property, elementType); - return checkDestructuringAssignment(property.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? property : property.initializer, type); + return checkDestructuringAssignment(property.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? property : property.initializer, type); } - else if (property.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (property.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (propertyIndex < properties.length - 1) { error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } @@ -79716,7 +80187,7 @@ var ts; var inBoundsType = compilerOptions.noUncheckedIndexedAccess ? undefined : possiblyOutOfBoundsType; for (var i = 0; i < elements.length; i++) { var type = possiblyOutOfBoundsType; - if (node.elements[i].kind === 225 /* SyntaxKind.SpreadElement */) { + if (node.elements[i].kind === 227 /* SyntaxKind.SpreadElement */) { type = inBoundsType = inBoundsType !== null && inBoundsType !== void 0 ? inBoundsType : (checkIteratedTypeOrElementType(65 /* IterationUse.Destructuring */, sourceType, undefinedType, node) || errorType); } checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, type, checkMode); @@ -79726,8 +80197,8 @@ var ts; function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 227 /* SyntaxKind.OmittedExpression */) { - if (element.kind !== 225 /* SyntaxKind.SpreadElement */) { + if (element.kind !== 229 /* SyntaxKind.OmittedExpression */) { + if (element.kind !== 227 /* SyntaxKind.SpreadElement */) { var indexType = getNumberLiteralType(elementIndex); if (isArrayLikeType(sourceType)) { // We create a synthetic expression so that getIndexedAccessType doesn't get confused @@ -79745,7 +80216,7 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 221 /* SyntaxKind.BinaryExpression */ && restExpression.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (restExpression.kind === 223 /* SyntaxKind.BinaryExpression */ && restExpression.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -79761,7 +80232,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode, rightIsThis) { var target; - if (exprOrAssignment.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { // In strict null checking mode, if a default value of a non-undefined type is specified, remove @@ -79777,7 +80248,7 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 221 /* SyntaxKind.BinaryExpression */ && target.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (target.kind === 223 /* SyntaxKind.BinaryExpression */ && target.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { checkBinaryExpression(target, checkMode); target = target.left; // A default value is specified, so remove undefined from the final type. @@ -79785,20 +80256,20 @@ var ts; sourceType = getTypeWithFacts(sourceType, 524288 /* TypeFacts.NEUndefined */); } } - if (target.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (target.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType, rightIsThis); } - if (target.kind === 204 /* SyntaxKind.ArrayLiteralExpression */) { + if (target.kind === 206 /* SyntaxKind.ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, checkMode); } return checkReferenceAssignment(target, sourceType, checkMode); } function checkReferenceAssignment(target, sourceType, checkMode) { var targetType = checkExpression(target, checkMode); - var error = target.parent.kind === 298 /* SyntaxKind.SpreadAssignment */ ? + var error = target.parent.kind === 301 /* SyntaxKind.SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; - var optionalError = target.parent.kind === 298 /* SyntaxKind.SpreadAssignment */ ? + var optionalError = target.parent.kind === 301 /* SyntaxKind.SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access; if (checkReferenceExpression(target, error, optionalError)) { @@ -79823,36 +80294,36 @@ var ts; case 79 /* SyntaxKind.Identifier */: case 10 /* SyntaxKind.StringLiteral */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 223 /* SyntaxKind.TemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 8 /* SyntaxKind.NumericLiteral */: case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 278 /* SyntaxKind.JsxElement */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 281 /* SyntaxKind.JsxElement */: return true; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: // Unary operators ~, !, +, and - have no side effects. // The rest do. switch (node.operator) { @@ -79864,9 +80335,9 @@ var ts; } return false; // Some forms listed here for clarity - case 217 /* SyntaxKind.VoidExpression */: // Explicit opt-out - case 211 /* SyntaxKind.TypeAssertionExpression */: // Not SEF, but can produce useful type warnings - case 229 /* SyntaxKind.AsExpression */: // Not SEF, but can produce useful type warnings + case 219 /* SyntaxKind.VoidExpression */: // Explicit opt-out + case 213 /* SyntaxKind.TypeAssertionExpression */: // Not SEF, but can produce useful type warnings + case 231 /* SyntaxKind.AsExpression */: // Not SEF, but can produce useful type warnings default: return false; } @@ -79903,7 +80374,7 @@ var ts; } checkGrammarNullishCoalesceWithLogicalExpression(node); var operator = node.operatorToken.kind; - if (operator === 63 /* SyntaxKind.EqualsToken */ && (node.left.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || node.left.kind === 204 /* SyntaxKind.ArrayLiteralExpression */)) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && (node.left.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || node.left.kind === 206 /* SyntaxKind.ArrayLiteralExpression */)) { state.skip = true; setLastResult(state, checkDestructuringAssignment(node.left, checkExpression(node.right, checkMode), checkMode, node.right.kind === 108 /* SyntaxKind.ThisKeyword */)); return state; @@ -79925,11 +80396,11 @@ var ts; if (operator === 55 /* SyntaxKind.AmpersandAmpersandToken */ || operator === 56 /* SyntaxKind.BarBarToken */ || operator === 60 /* SyntaxKind.QuestionQuestionToken */) { if (operator === 55 /* SyntaxKind.AmpersandAmpersandToken */) { var parent = node.parent; - while (parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */ + while (parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || ts.isBinaryExpression(parent) && (parent.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || parent.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */)) { parent = parent.parent; } - checkTestingKnownTruthyCallableOrAwaitableType(node.left, ts.isIfStatement(parent) ? parent.thenStatement : undefined); + checkTestingKnownTruthyCallableOrAwaitableType(node.left, leftType, ts.isIfStatement(parent) ? parent.thenStatement : undefined); } checkTruthinessOfType(leftType, node.left); } @@ -80000,7 +80471,7 @@ var ts; // expression-wide checks and does not use a work stack to fold nested binary expressions into the same callstack frame function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { var operator = operatorToken.kind; - if (operator === 63 /* SyntaxKind.EqualsToken */ && (left.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || left.kind === 204 /* SyntaxKind.ArrayLiteralExpression */)) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && (left.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || left.kind === 206 /* SyntaxKind.ArrayLiteralExpression */)) { return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 108 /* SyntaxKind.ThisKeyword */); } var leftType; @@ -80156,6 +80627,7 @@ var ts; var eqType = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */; error(errorNode, ts.Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true"); } + checkNaNEquality(errorNode, operator, left, right); reportOperatorErrorUnless(function (left, right) { return isTypeEqualityComparableTo(left, right) || isTypeEqualityComparableTo(right, left); }); return booleanType; case 102 /* SyntaxKind.InstanceOfKeyword */: @@ -80351,20 +80823,35 @@ var ts; } } function tryGiveBetterPrimaryError(errNode, maybeMissingAwait, leftStr, rightStr) { - var typeName; switch (operatorToken.kind) { case 36 /* SyntaxKind.EqualsEqualsEqualsToken */: case 34 /* SyntaxKind.EqualsEqualsToken */: - typeName = "false"; - break; case 37 /* SyntaxKind.ExclamationEqualsEqualsToken */: case 35 /* SyntaxKind.ExclamationEqualsToken */: - typeName = "true"; + return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap, leftStr, rightStr); + default: + return undefined; } - if (typeName) { - return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap, typeName, leftStr, rightStr); + } + function checkNaNEquality(errorNode, operator, left, right) { + var isLeftNaN = isGlobalNaN(ts.skipParentheses(left)); + var isRightNaN = isGlobalNaN(ts.skipParentheses(right)); + if (isLeftNaN || isRightNaN) { + var err = error(errorNode, ts.Diagnostics.This_condition_will_always_return_0, ts.tokenToString(operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? 95 /* SyntaxKind.FalseKeyword */ : 110 /* SyntaxKind.TrueKeyword */)); + if (isLeftNaN && isRightNaN) + return; + var operatorString = operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ ? ts.tokenToString(53 /* SyntaxKind.ExclamationToken */) : ""; + var location = isLeftNaN ? right : left; + var expression = ts.skipParentheses(location); + ts.addRelatedInfo(err, ts.createDiagnosticForNode(location, ts.Diagnostics.Did_you_mean_0, "".concat(operatorString, "Number.isNaN(").concat(ts.isEntityNameExpression(expression) ? ts.entityNameToString(expression) : "...", ")"))); } - return undefined; + } + function isGlobalNaN(expr) { + if (ts.isIdentifier(expr) && expr.escapedText === "NaN") { + var globalNaNSymbol = getGlobalNaNSymbol(); + return !!globalNaNSymbol && globalNaNSymbol === getResolvedSymbol(expr); + } + return false; } } function getBaseTypesIfUnrelated(leftType, rightType, isRelated) { @@ -80445,8 +80932,8 @@ var ts; } } function checkConditionalExpression(node, checkMode) { - checkTruthinessExpression(node.condition); - checkTestingKnownTruthyCallableOrAwaitableType(node.condition, node.whenTrue); + var type = checkTruthinessExpression(node.condition); + checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue); var type1 = checkExpression(node.whenTrue, checkMode); var type2 = checkExpression(node.whenFalse, checkMode); return getUnionType([type1, type2], 2 /* UnionReduction.Subtype */); @@ -80475,7 +80962,7 @@ var ts; type.flags & 58982400 /* TypeFlags.InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* TypeFlags.StringLike */)); } function getContextNode(node) { - if (node.kind === 286 /* SyntaxKind.JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) { + if (node.kind === 289 /* SyntaxKind.JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) { return node.parent.parent; // Needs to be the root JsxElement, so it encompasses the attributes _and_ the children (which are essentially part of the attributes) } return node; @@ -80529,8 +81016,8 @@ var ts; } function isTypeAssertion(node) { node = ts.skipParentheses(node, /*excludeJSDocTypeAssertions*/ true); - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */ || - node.kind === 229 /* SyntaxKind.AsExpression */ || + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */ || + node.kind === 231 /* SyntaxKind.AsExpression */ || ts.isJSDocTypeAssertion(node); } function checkDeclarationInitializer(declaration, checkMode, contextualType) { @@ -80539,7 +81026,7 @@ var ts; (contextualType ? checkExpressionWithContextualType(initializer, contextualType, /*inferenceContext*/ undefined, checkMode || 0 /* CheckMode.Normal */) : checkExpressionCached(initializer, checkMode)); - return ts.isParameter(declaration) && declaration.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && + return ts.isParameter(declaration) && declaration.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ? padTupleType(type, declaration.name) : type; } @@ -80549,7 +81036,7 @@ var ts; var elementFlags = type.target.elementFlags.slice(); for (var i = getTypeReferenceArity(type); i < patternElements.length; i++) { var e = patternElements[i]; - if (i < patternElements.length - 1 || !(e.kind === 203 /* SyntaxKind.BindingElement */ && e.dotDotDotToken)) { + if (i < patternElements.length - 1 || !(e.kind === 205 /* SyntaxKind.BindingElement */ && e.dotDotDotToken)) { elementTypes.push(!ts.isOmittedExpression(e) && hasDefaultValue(e) ? getTypeFromBindingElement(e, /*includePatternInType*/ false, /*reportErrors*/ false) : anyType); elementFlags.push(2 /* ElementFlags.Optional */); if (!ts.isOmittedExpression(e) && !hasDefaultValue(e)) { @@ -80617,7 +81104,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } return checkExpressionForMutableLocation(node.initializer, checkMode); @@ -80628,7 +81115,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -80871,11 +81358,11 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 161 /* SyntaxKind.QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || - (node.parent.kind === 181 /* SyntaxKind.TypeQuery */ && node.parent.exprName === node)) || - (node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */); // We allow reexporting const enums + var ok = (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 163 /* SyntaxKind.QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || + (node.parent.kind === 183 /* SyntaxKind.TypeQuery */ && node.parent.exprName === node)) || + (node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */); // We allow reexporting const enums if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query); } @@ -80900,9 +81387,9 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } } @@ -80933,80 +81420,82 @@ var ts; return trueType; case 95 /* SyntaxKind.FalseKeyword */: return falseType; - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return checkTemplateExpression(node); case 13 /* SyntaxKind.RegularExpressionLiteral */: return globalRegExpType; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return checkArrayLiteral(node, checkMode, forceTuple); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return checkObjectLiteral(node, checkMode); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return checkPropertyAccessExpression(node, checkMode); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return checkQualifiedName(node, checkMode); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return checkIndexedAccess(node, checkMode); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (node.expression.kind === 100 /* SyntaxKind.ImportKeyword */) { return checkImportCallExpression(node); } // falls through - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return checkCallExpression(node, checkMode); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return checkParenthesizedExpression(node, checkMode); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return checkClassExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return checkTypeOfExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return checkAssertion(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return checkNonNullAssertion(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return checkExpressionWithTypeArguments(node); - case 231 /* SyntaxKind.MetaProperty */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return checkSatisfiesExpression(node); + case 233 /* SyntaxKind.MetaProperty */: return checkMetaProperty(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return checkDeleteExpression(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return checkVoidExpression(node); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return checkAwaitExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return checkBinaryExpression(node, checkMode); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return checkConditionalExpression(node, checkMode); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return checkSpreadExpression(node, checkMode); - case 227 /* SyntaxKind.OmittedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: return undefinedWideningType; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return checkYieldExpression(node); - case 232 /* SyntaxKind.SyntheticExpression */: + case 234 /* SyntaxKind.SyntheticExpression */: return checkSyntheticExpression(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return checkJsxExpression(node, checkMode); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return checkJsxElement(node, checkMode); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return checkJsxSelfClosingElement(node, checkMode); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return checkJsxFragment(node); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return checkJsxAttributes(node, checkMode); - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return errorType; @@ -81065,10 +81554,10 @@ var ts; checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); if (ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */)) { - if (!(func.kind === 171 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 173 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } - if (func.kind === 171 /* SyntaxKind.Constructor */ && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { + if (func.kind === 173 /* SyntaxKind.Constructor */ && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { error(node.name, ts.Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name); } } @@ -81079,13 +81568,13 @@ var ts; if (func.parameters.indexOf(node) !== 0) { error(node, ts.Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText); } - if (func.kind === 171 /* SyntaxKind.Constructor */ || func.kind === 175 /* SyntaxKind.ConstructSignature */ || func.kind === 180 /* SyntaxKind.ConstructorType */) { + if (func.kind === 173 /* SyntaxKind.Constructor */ || func.kind === 177 /* SyntaxKind.ConstructSignature */ || func.kind === 182 /* SyntaxKind.ConstructorType */) { error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); } - if (func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 216 /* SyntaxKind.ArrowFunction */) { error(node, ts.Diagnostics.An_arrow_function_cannot_have_a_this_parameter); } - if (func.kind === 172 /* SyntaxKind.GetAccessor */ || func.kind === 173 /* SyntaxKind.SetAccessor */) { + if (func.kind === 174 /* SyntaxKind.GetAccessor */ || func.kind === 175 /* SyntaxKind.SetAccessor */) { error(node, ts.Diagnostics.get_and_set_accessors_cannot_declare_this_parameters); } } @@ -81143,13 +81632,13 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 174 /* SyntaxKind.CallSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 179 /* SyntaxKind.FunctionType */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 181 /* SyntaxKind.FunctionType */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: var parent = node.parent; if (node === parent.type) { return parent; @@ -81167,7 +81656,7 @@ var ts; error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ || name.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + else if (name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ || name.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } @@ -81176,13 +81665,13 @@ var ts; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 176 /* SyntaxKind.IndexSignature */) { + if (node.kind === 178 /* SyntaxKind.IndexSignature */) { checkGrammarIndexSignature(node); } // TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled - else if (node.kind === 179 /* SyntaxKind.FunctionType */ || node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 180 /* SyntaxKind.ConstructorType */ || - node.kind === 174 /* SyntaxKind.CallSignature */ || node.kind === 171 /* SyntaxKind.Constructor */ || - node.kind === 175 /* SyntaxKind.ConstructSignature */) { + else if (node.kind === 181 /* SyntaxKind.FunctionType */ || node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 182 /* SyntaxKind.ConstructorType */ || + node.kind === 176 /* SyntaxKind.CallSignature */ || node.kind === 173 /* SyntaxKind.Constructor */ || + node.kind === 177 /* SyntaxKind.ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } var functionFlags = ts.getFunctionFlags(node); @@ -81214,10 +81703,10 @@ var ts; var returnTypeNode = ts.getEffectiveReturnTypeNode(node); if (noImplicitAny && !returnTypeNode) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -81247,7 +81736,7 @@ var ts; checkAsyncFunctionReturnType(node, returnTypeNode); } } - if (node.kind !== 176 /* SyntaxKind.IndexSignature */ && node.kind !== 317 /* SyntaxKind.JSDocFunctionType */) { + if (node.kind !== 178 /* SyntaxKind.IndexSignature */ && node.kind !== 320 /* SyntaxKind.JSDocFunctionType */) { registerForUnusedIdentifiersCheck(node); } } @@ -81259,7 +81748,7 @@ var ts; var privateIdentifiers = new ts.Map(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 171 /* SyntaxKind.Constructor */) { + if (member.kind === 173 /* SyntaxKind.Constructor */) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; if (ts.isParameterPropertyDeclaration(param, member) && !ts.isBindingPattern(param.name)) { @@ -81281,16 +81770,16 @@ var ts; var memberName = name && ts.getPropertyNameForPropertyNameNode(name); if (memberName) { switch (member.kind) { - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: addName(names, name, memberName, 1 /* DeclarationMeaning.GetAccessor */ | privateStaticFlags); break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: addName(names, name, memberName, 2 /* DeclarationMeaning.SetAccessor */ | privateStaticFlags); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: addName(names, name, memberName, 3 /* DeclarationMeaning.GetOrSetAccessor */ | privateStaticFlags); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: addName(names, name, memberName, 8 /* DeclarationMeaning.Method */ | privateStaticFlags); break; } @@ -81362,7 +81851,7 @@ var ts; var names = new ts.Map(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 166 /* SyntaxKind.PropertySignature */) { + if (member.kind === 168 /* SyntaxKind.PropertySignature */) { var memberName = void 0; var name = member.name; switch (name.kind) { @@ -81387,7 +81876,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); // in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration // to prevent this run check only for the first declaration of a given kind @@ -81401,7 +81890,7 @@ var ts; var indexSymbol = getIndexSymbol(getSymbolOfNode(node)); if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) { var indexSignatureMap_1 = new ts.Map(); - var _loop_29 = function (declaration) { + var _loop_30 = function (declaration) { if (declaration.parameters.length === 1 && declaration.parameters[0].type) { forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) { var entry = indexSignatureMap_1.get(getTypeId(type)); @@ -81416,7 +81905,7 @@ var ts; }; for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - _loop_29(declaration); + _loop_30(declaration); } indexSignatureMap_1.forEach(function (entry) { if (entry.declarations.length > 1) { @@ -81435,7 +81924,7 @@ var ts; checkVariableLikeDeclaration(node); setNodeLinksForPrivateIdentifierScope(node); // property signatures already report "initializer not allowed in ambient context" elsewhere - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */) && node.kind === 167 /* SyntaxKind.PropertyDeclaration */ && node.initializer) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */) && node.kind === 169 /* SyntaxKind.PropertyDeclaration */ && node.initializer) { error(node, ts.Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } } @@ -81455,7 +81944,7 @@ var ts; // Grammar checking for modifiers is done inside the function checkGrammarFunctionLikeDeclaration checkFunctionOrMethodDeclaration(node); // method signatures already report "implementation not allowed in ambient context" elsewhere - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */) && node.kind === 169 /* SyntaxKind.MethodDeclaration */ && node.body) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */) && node.kind === 171 /* SyntaxKind.MethodDeclaration */ && node.body) { error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } // Private named methods are only allowed in class declarations @@ -81508,7 +81997,7 @@ var ts; if (ts.isPrivateIdentifierClassElementDeclaration(n)) { return true; } - return n.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + return n.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(n) && !!n.initializer; } @@ -81591,7 +82080,7 @@ var ts; checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { if (!(node.flags & 16777216 /* NodeFlags.Ambient */) && ts.nodeIsPresent(node.body) && (node.flags & 256 /* NodeFlags.HasImplicitReturn */)) { if (!(node.flags & 512 /* NodeFlags.HasExplicitReturn */)) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); @@ -81601,20 +82090,20 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } if (hasBindableName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. var symbol = getSymbolOfNode(node); - var getter = ts.getDeclarationOfKind(symbol, 172 /* SyntaxKind.GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 174 /* SyntaxKind.GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */); if (getter && setter && !(getNodeCheckFlags(getter) & 1 /* NodeCheckFlags.TypeChecked */)) { getNodeLinks(getter).flags |= 1 /* NodeCheckFlags.TypeChecked */; var getterFlags = ts.getEffectiveModifierFlags(getter); var setterFlags = ts.getEffectiveModifierFlags(setter); - if ((getterFlags & 128 /* ModifierFlags.Abstract */) !== (setterFlags & 128 /* ModifierFlags.Abstract */)) { + if ((getterFlags & 256 /* ModifierFlags.Abstract */) !== (setterFlags & 256 /* ModifierFlags.Abstract */)) { error(getter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); error(setter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); } @@ -81631,7 +82120,7 @@ var ts; } } var returnType = getTypeOfAccessors(getSymbolOfNode(node)); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } @@ -81640,7 +82129,7 @@ var ts; checkDecorators(node); } function getEffectiveTypeArgumentAtIndex(node, typeParameters, index) { - if (index < typeParameters.length) { + if (node.typeArguments && index < node.typeArguments.length) { return getTypeFromTypeNode(node.typeArguments[index]); } return getEffectiveTypeArguments(node, typeParameters)[index]; @@ -81677,7 +82166,7 @@ var ts; } function checkTypeReferenceNode(node) { checkGrammarTypeArguments(node, node.typeArguments); - if (node.kind === 178 /* SyntaxKind.TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { grammarErrorAtPos(node, node.typeName.jsdocDotPos, 1, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); } ts.forEach(node.typeArguments, checkSourceElement); @@ -81735,7 +82224,7 @@ var ts; var hasNamedElement = ts.some(elementTypes, ts.isNamedTupleMember); for (var _i = 0, elementTypes_1 = elementTypes; _i < elementTypes_1.length; _i++) { var e = elementTypes_1[_i]; - if (e.kind !== 197 /* SyntaxKind.NamedTupleMember */ && hasNamedElement) { + if (e.kind !== 199 /* SyntaxKind.NamedTupleMember */ && hasNamedElement) { grammarErrorOnNode(e, ts.Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names); break; } @@ -81784,7 +82273,7 @@ var ts; var objectType = type.objectType; var indexType = type.indexType; if (isTypeAssignableTo(indexType, getIndexType(objectType, /*stringsOnly*/ false))) { - if (accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && + if (accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && ts.getObjectFlags(objectType) & 32 /* ObjectFlags.Mapped */ && getMappedTypeModifiers(objectType) & 1 /* MappedTypeModifiers.IncludeReadonly */) { error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); } @@ -81849,7 +82338,7 @@ var ts; ts.forEachChild(node, checkSourceElement); } function checkInferType(node) { - if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 189 /* SyntaxKind.ConditionalType */ && n.parent.extendsType === n; })) { + if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 191 /* SyntaxKind.ConditionalType */ && n.parent.extendsType === n; })) { grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type); } checkSourceElement(node.typeParameter); @@ -81859,7 +82348,7 @@ var ts; if (!links.typeParametersChecked) { links.typeParametersChecked = true; var typeParameter = getDeclaredTypeOfTypeParameter(symbol); - var declarations = ts.getDeclarationsOfKind(symbol, 163 /* SyntaxKind.TypeParameter */); + var declarations = ts.getDeclarationsOfKind(symbol, 165 /* SyntaxKind.TypeParameter */); if (!areTypeParametersIdentical(declarations, [typeParameter], function (decl) { return [decl]; })) { // Report an error on every conflicting declaration. var name = symbolToString(symbol); @@ -81900,10 +82389,10 @@ var ts; if (node.dotDotDotToken && node.questionToken) { grammarErrorOnNode(node, ts.Diagnostics.A_tuple_member_cannot_be_both_optional_and_rest); } - if (node.type.kind === 185 /* SyntaxKind.OptionalType */) { + if (node.type.kind === 187 /* SyntaxKind.OptionalType */) { grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type); } - if (node.type.kind === 186 /* SyntaxKind.RestType */) { + if (node.type.kind === 188 /* SyntaxKind.RestType */) { grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type); } checkSourceElement(node.type); @@ -81916,9 +82405,9 @@ var ts; var flags = ts.getCombinedModifierFlags(n); // children of classes (even ambient classes) should not be marked as ambient or export // because those flags have no useful semantics there. - if (n.parent.kind !== 258 /* SyntaxKind.InterfaceDeclaration */ && - n.parent.kind !== 257 /* SyntaxKind.ClassDeclaration */ && - n.parent.kind !== 226 /* SyntaxKind.ClassExpression */ && + if (n.parent.kind !== 261 /* SyntaxKind.InterfaceDeclaration */ && + n.parent.kind !== 260 /* SyntaxKind.ClassDeclaration */ && + n.parent.kind !== 228 /* SyntaxKind.ClassExpression */ && n.flags & 16777216 /* NodeFlags.Ambient */) { if (!(flags & 2 /* ModifierFlags.Ambient */) && !(ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent))) { // It is nested in an ambient context, which means it is automatically exported @@ -81958,7 +82447,7 @@ var ts; else if (deviation & (8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */)) { error(ts.getNameOfDeclaration(o) || o, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } - else if (deviation & 128 /* ModifierFlags.Abstract */) { + else if (deviation & 256 /* ModifierFlags.Abstract */) { error(ts.getNameOfDeclaration(o), ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract); } }); @@ -81975,7 +82464,7 @@ var ts; }); } } - var flagsToCheck = 1 /* ModifierFlags.Export */ | 2 /* ModifierFlags.Ambient */ | 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | 128 /* ModifierFlags.Abstract */; + var flagsToCheck = 1 /* ModifierFlags.Export */ | 2 /* ModifierFlags.Ambient */ | 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | 256 /* ModifierFlags.Abstract */; var someNodeFlags = 0 /* ModifierFlags.None */; var allNodeFlags = flagsToCheck; var someHaveQuestionToken = false; @@ -82014,7 +82503,7 @@ var ts; // Both are literal property names that are the same. ts.isPropertyNameLiteral(node.name) && ts.isPropertyNameLiteral(subsequentName) && ts.getEscapedTextOfIdentifierOrLiteral(node.name) === ts.getEscapedTextOfIdentifierOrLiteral(subsequentName))) { - var reportError = (node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 168 /* SyntaxKind.MethodSignature */) && + var reportError = (node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 170 /* SyntaxKind.MethodSignature */) && ts.isStatic(node) !== ts.isStatic(subsequentNode); // we can get here in two cases // 1. mixed static and instance class members @@ -82039,7 +82528,7 @@ var ts; else { // Report different errors regarding non-consecutive blocks of declarations depending on whether // the node in question is abstract. - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)) { error(errorNode, ts.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive); } else { @@ -82056,7 +82545,7 @@ var ts; var current = declarations_5[_i]; var node = current; var inAmbientContext = node.flags & 16777216 /* NodeFlags.Ambient */; - var inAmbientContextOrInterface = node.parent && (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || node.parent.kind === 182 /* SyntaxKind.TypeLiteral */) || inAmbientContext; + var inAmbientContextOrInterface = node.parent && (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || node.parent.kind === 184 /* SyntaxKind.TypeLiteral */) || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -82067,10 +82556,10 @@ var ts; // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one previousDeclaration = undefined; } - if ((node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */) && !inAmbientContext) { + if ((node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */) && !inAmbientContext) { hasNonAmbientClass = true; } - if (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 168 /* SyntaxKind.MethodSignature */ || node.kind === 171 /* SyntaxKind.Constructor */) { + if (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 170 /* SyntaxKind.MethodSignature */ || node.kind === 173 /* SyntaxKind.Constructor */) { functionDeclarations.push(node); var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; @@ -82115,12 +82604,12 @@ var ts; }); } if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 /* SymbolFlags.Function */ && declarations) { - var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 257 /* SyntaxKind.ClassDeclaration */; }) + var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 260 /* SyntaxKind.ClassDeclaration */; }) .map(function (d) { return ts.createDiagnosticForNode(d, ts.Diagnostics.Consider_adding_a_declare_modifier_to_this_class); }); ts.forEach(declarations, function (declaration) { - var diagnostic = declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ + var diagnostic = declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ ? ts.Diagnostics.Class_declaration_cannot_implement_overload_list_for_0 - : declaration.kind === 256 /* SyntaxKind.FunctionDeclaration */ + : declaration.kind === 259 /* SyntaxKind.FunctionDeclaration */ ? ts.Diagnostics.Function_with_bodies_can_only_merge_with_classes_that_are_ambient : undefined; if (diagnostic) { @@ -82130,7 +82619,7 @@ var ts; } // Abstract methods can't have an implementation -- in particular, they don't need one. if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && - !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 128 /* ModifierFlags.Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) { + !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 256 /* ModifierFlags.Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } if (hasOverloads) { @@ -82176,9 +82665,9 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var d = _a[_i]; var declarationSpaces = getDeclarationSpaces(d); - var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* ModifierFlags.Export */ | 512 /* ModifierFlags.Default */); + var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* ModifierFlags.Export */ | 1024 /* ModifierFlags.Default */); if (effectiveDeclarationFlags & 1 /* ModifierFlags.Export */) { - if (effectiveDeclarationFlags & 512 /* ModifierFlags.Default */) { + if (effectiveDeclarationFlags & 1024 /* ModifierFlags.Default */) { defaultExportedDeclarationSpaces |= declarationSpaces; } else { @@ -82211,26 +82700,26 @@ var ts; function getDeclarationSpaces(decl) { var d = decl; switch (d.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // A jsdoc typedef and callback are, by definition, type aliases. // falls through - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return 2 /* DeclarationSpaces.ExportType */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* ModuleInstanceState.NonInstantiated */ ? 4 /* DeclarationSpaces.ExportNamespace */ | 1 /* DeclarationSpaces.ExportValue */ : 4 /* DeclarationSpaces.ExportNamespace */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: return 2 /* DeclarationSpaces.ExportType */ | 1 /* DeclarationSpaces.ExportValue */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 2 /* DeclarationSpaces.ExportType */ | 1 /* DeclarationSpaces.ExportValue */ | 4 /* DeclarationSpaces.ExportNamespace */; - case 271 /* SyntaxKind.ExportAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: + case 274 /* SyntaxKind.ExportAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: var node_2 = d; var expression = ts.isExportAssignment(node_2) ? node_2.expression : node_2.right; // Export assigned entity name expressions act as aliases and should fall through, otherwise they export values @@ -82240,19 +82729,19 @@ var ts; d = expression; // The below options all declare an Alias, which is allowed to merge with other values within the importing module. // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 267 /* SyntaxKind.ImportClause */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: var result_12 = 0 /* DeclarationSpaces.None */; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_12 |= getDeclarationSpaces(d); }); return result_12; - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 case 79 /* SyntaxKind.Identifier */: // https://github.com/microsoft/TypeScript/issues/36098 // Identifiers are used as declarations of assignment declarations whose parents may be // SyntaxKind.CallExpression - `Object.defineProperty(thing, "aField", {value: 42});` @@ -82665,20 +83154,20 @@ var ts; var headMessage; var expectedReturnType; switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: headMessage = ts.Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any; expectedReturnType = voidType; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); @@ -82737,15 +83226,15 @@ var ts; function getEntityNameForDecoratorMetadata(node) { if (node) { switch (node.kind) { - case 188 /* SyntaxKind.IntersectionType */: - case 187 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: return getEntityNameForDecoratorMetadataFromTypeList(node.types); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]); - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: return getEntityNameForDecoratorMetadata(node.type); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; } } @@ -82754,13 +83243,13 @@ var ts; var commonEntityName; for (var _i = 0, types_21 = types; _i < types_21.length; _i++) { var typeNode = types_21[_i]; - while (typeNode.kind === 191 /* SyntaxKind.ParenthesizedType */ || typeNode.kind === 197 /* SyntaxKind.NamedTupleMember */) { + while (typeNode.kind === 193 /* SyntaxKind.ParenthesizedType */ || typeNode.kind === 199 /* SyntaxKind.NamedTupleMember */) { typeNode = typeNode.type; // Skip parens if need be } - if (typeNode.kind === 143 /* SyntaxKind.NeverKeyword */) { + if (typeNode.kind === 144 /* SyntaxKind.NeverKeyword */) { continue; // Always elide `never` from the union/intersection if possible } - if (!strictNullChecks && (typeNode.kind === 196 /* SyntaxKind.LiteralType */ && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */ || typeNode.kind === 153 /* SyntaxKind.UndefinedKeyword */)) { + if (!strictNullChecks && (typeNode.kind === 198 /* SyntaxKind.LiteralType */ && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */ || typeNode.kind === 155 /* SyntaxKind.UndefinedKeyword */)) { continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks } var individualEntityName = getEntityNameForDecoratorMetadata(typeNode); @@ -82806,14 +83295,14 @@ var ts; return; } checkExternalEmitHelpers(firstDecorator, 8 /* ExternalEmitHelpers.Decorate */); - if (node.kind === 164 /* SyntaxKind.Parameter */) { + if (node.kind === 166 /* SyntaxKind.Parameter */) { checkExternalEmitHelpers(firstDecorator, 32 /* ExternalEmitHelpers.Param */); } if (compilerOptions.emitDecoratorMetadata) { checkExternalEmitHelpers(firstDecorator, 16 /* ExternalEmitHelpers.Metadata */); // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -82822,23 +83311,23 @@ var ts; } } break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - var otherKind = node.kind === 172 /* SyntaxKind.GetAccessor */ ? 173 /* SyntaxKind.SetAccessor */ : 172 /* SyntaxKind.GetAccessor */; + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + var otherKind = node.kind === 174 /* SyntaxKind.GetAccessor */ ? 175 /* SyntaxKind.SetAccessor */ : 174 /* SyntaxKind.GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind); markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor)); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveReturnTypeNode(node)); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveTypeAnnotationNode(node)); break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); var containingSignature = node.parent; for (var _d = 0, _e = containingSignature.parameters; _d < _e.length; _d++) { @@ -82940,7 +83429,7 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.name; default: return undefined; @@ -82954,7 +83443,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name && node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name && node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -82980,7 +83469,7 @@ var ts; checkFunctionOrConstructorSymbol(symbol); } } - var body = node.kind === 168 /* SyntaxKind.MethodSignature */ ? undefined : node.body; + var body = node.kind === 170 /* SyntaxKind.MethodSignature */ ? undefined : node.body; checkSourceElement(body); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, getReturnTypeFromAnnotation(node)); addLazyDiagnostic(checkFunctionOrMethodDeclarationDiagnostics); @@ -83026,42 +83515,42 @@ var ts; for (var _i = 0, potentiallyUnusedIdentifiers_1 = potentiallyUnusedIdentifiers; _i < potentiallyUnusedIdentifiers_1.length; _i++) { var node = potentiallyUnusedIdentifiers_1[_i]; switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: checkUnusedClassMembers(node, addDiagnostic); checkUnusedTypeParameters(node, addDiagnostic); break; - case 305 /* SyntaxKind.SourceFile */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 308 /* SyntaxKind.SourceFile */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: checkUnusedLocalsAndParameters(node, addDiagnostic); break; - case 171 /* SyntaxKind.Constructor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: if (node.body) { // Don't report unused parameters in overloads checkUnusedLocalsAndParameters(node, addDiagnostic); } checkUnusedTypeParameters(node, addDiagnostic); break; - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: checkUnusedTypeParameters(node, addDiagnostic); break; - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: checkUnusedInferTypeParameter(node, addDiagnostic); break; default: @@ -83081,11 +83570,11 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - if (member.kind === 173 /* SyntaxKind.SetAccessor */ && member.symbol.flags & 32768 /* SymbolFlags.GetAccessor */) { + case 171 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + if (member.kind === 175 /* SyntaxKind.SetAccessor */ && member.symbol.flags & 32768 /* SymbolFlags.GetAccessor */) { // Already would have reported an error on the getter. break; } @@ -83096,7 +83585,7 @@ var ts; addDiagnostic(member, 0 /* UnusedKind.Local */, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol))); } break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; if (!parameter.symbol.isReferenced && ts.hasSyntacticModifier(parameter, 8 /* ModifierFlags.Private */)) { @@ -83104,9 +83593,9 @@ var ts; } } break; - case 176 /* SyntaxKind.IndexSignature */: - case 234 /* SyntaxKind.SemicolonClassElement */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: + case 237 /* SyntaxKind.SemicolonClassElement */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // Can't be private break; default: @@ -83134,7 +83623,7 @@ var ts; continue; var name = ts.idText(typeParameter.name); var parent = typeParameter.parent; - if (parent.kind !== 190 /* SyntaxKind.InferType */ && parent.typeParameters.every(isTypeParameterUnused)) { + if (parent.kind !== 192 /* SyntaxKind.InferType */ && parent.typeParameters.every(isTypeParameterUnused)) { if (ts.tryAddToSet(seenParentsWithEveryUnused, parent)) { var sourceFile = ts.getSourceFileOfNode(parent); var range = ts.isJSDocTemplateTag(parent) @@ -83240,7 +83729,7 @@ var ts; var importDecl = importClause.parent; var nDeclarations = (importClause.name ? 1 : 0) + (importClause.namedBindings ? - (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? 1 : importClause.namedBindings.elements.length) + (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? 1 : importClause.namedBindings.elements.length) : 0); if (nDeclarations === unuseds.length) { addDiagnostic(importDecl, 0 /* UnusedKind.Local */, unuseds.length === 1 @@ -83258,7 +83747,7 @@ var ts; var bindingPattern = _a[0], bindingElements = _a[1]; var kind = tryGetRootParameterDeclaration(bindingPattern.parent) ? 1 /* UnusedKind.Parameter */ : 0 /* UnusedKind.Local */; if (bindingPattern.elements.length === bindingElements.length) { - if (bindingElements.length === 1 && bindingPattern.parent.kind === 254 /* SyntaxKind.VariableDeclaration */ && bindingPattern.parent.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (bindingElements.length === 1 && bindingPattern.parent.kind === 257 /* SyntaxKind.VariableDeclaration */ && bindingPattern.parent.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */) { addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId); } else { @@ -83279,7 +83768,7 @@ var ts; if (declarationList.declarations.length === declarations.length) { addDiagnostic(declarationList, 0 /* UnusedKind.Local */, declarations.length === 1 ? ts.createDiagnosticForNode(ts.first(declarations).name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(ts.first(declarations).name)) - : ts.createDiagnosticForNode(declarationList.parent.kind === 237 /* SyntaxKind.VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); + : ts.createDiagnosticForNode(declarationList.parent.kind === 240 /* SyntaxKind.VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); } else { for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { @@ -83309,22 +83798,22 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return ts.idText(name); - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return bindingNameText(ts.cast(ts.first(name.elements), ts.isBindingElement).name); default: return ts.Debug.assertNever(name); } } function isImportedDeclaration(node) { - return node.kind === 267 /* SyntaxKind.ImportClause */ || node.kind === 270 /* SyntaxKind.ImportSpecifier */ || node.kind === 268 /* SyntaxKind.NamespaceImport */; + return node.kind === 270 /* SyntaxKind.ImportClause */ || node.kind === 273 /* SyntaxKind.ImportSpecifier */ || node.kind === 271 /* SyntaxKind.NamespaceImport */; } function importClauseFromImported(decl) { - return decl.kind === 267 /* SyntaxKind.ImportClause */ ? decl : decl.kind === 268 /* SyntaxKind.NamespaceImport */ ? decl.parent : decl.parent.parent; + return decl.kind === 270 /* SyntaxKind.ImportClause */ ? decl : decl.kind === 271 /* SyntaxKind.NamespaceImport */ ? decl.parent : decl.parent.parent; } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 235 /* SyntaxKind.Block */) { + if (node.kind === 238 /* SyntaxKind.Block */) { checkGrammarStatementInAmbientContext(node); } if (ts.isFunctionOrModuleBlock(node)) { @@ -83359,13 +83848,13 @@ var ts; if ((identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) !== name) { return false; } - if (node.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - node.kind === 166 /* SyntaxKind.PropertySignature */ || - node.kind === 169 /* SyntaxKind.MethodDeclaration */ || - node.kind === 168 /* SyntaxKind.MethodSignature */ || - node.kind === 172 /* SyntaxKind.GetAccessor */ || - node.kind === 173 /* SyntaxKind.SetAccessor */ || - node.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (node.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + node.kind === 168 /* SyntaxKind.PropertySignature */ || + node.kind === 171 /* SyntaxKind.MethodDeclaration */ || + node.kind === 170 /* SyntaxKind.MethodSignature */ || + node.kind === 174 /* SyntaxKind.GetAccessor */ || + node.kind === 175 /* SyntaxKind.SetAccessor */ || + node.kind === 299 /* SyntaxKind.PropertyAssignment */) { // it is ok to have member named '_super', '_this', `Promise`, etc. - member access is always qualified return false; } @@ -83431,7 +83920,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -83446,7 +83935,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048 /* NodeFlags.HasAsyncFunctions */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048 /* NodeFlags.HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -83546,7 +84035,7 @@ var ts; // skip variable declarations that don't have initializers // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern // so we'll always treat binding elements as initialized - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ && !node.initializer) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -83558,17 +84047,17 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* SymbolFlags.BlockScopedVariable */) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* NodeFlags.BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); - var container = varDeclList.parent.kind === 237 /* SyntaxKind.VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); + var container = varDeclList.parent.kind === 240 /* SyntaxKind.VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; // names of block-scoped and function scoped variables can collide only // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) var namesShareScope = container && - (container.kind === 235 /* SyntaxKind.Block */ && ts.isFunctionLike(container.parent) || - container.kind === 262 /* SyntaxKind.ModuleBlock */ || - container.kind === 261 /* SyntaxKind.ModuleDeclaration */ || - container.kind === 305 /* SyntaxKind.SourceFile */); + (container.kind === 238 /* SyntaxKind.Block */ && ts.isFunctionLike(container.parent) || + container.kind === 265 /* SyntaxKind.ModuleBlock */ || + container.kind === 264 /* SyntaxKind.ModuleDeclaration */ || + container.kind === 308 /* SyntaxKind.SourceFile */); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error // otherwise if variable has an initializer - show error that initialization will fail @@ -83599,7 +84088,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); if (ts.hasOnlyExpressionInitializer(node) && node.initializer) { checkExpressionCached(node.initializer); @@ -83621,7 +84110,7 @@ var ts; checkExternalEmitHelpers(node, 4 /* ExternalEmitHelpers.Rest */); } // check computed properties inside property names of binding elements - if (node.propertyName && node.propertyName.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.propertyName && node.propertyName.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.propertyName); } // check private/protected variable access @@ -83643,7 +84132,7 @@ var ts; } // For a binding pattern, check contained binding elements if (ts.isBindingPattern(node.name)) { - if (node.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && languageVersion < 2 /* ScriptTarget.ES2015 */ && compilerOptions.downlevelIteration) { + if (node.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && languageVersion < 2 /* ScriptTarget.ES2015 */ && compilerOptions.downlevelIteration) { checkExternalEmitHelpers(node, 512 /* ExternalEmitHelpers.Read */); } ts.forEach(node.name.elements, checkSourceElement); @@ -83655,7 +84144,7 @@ var ts; } // For a binding pattern, validate the initializer and exit if (ts.isBindingPattern(node.name)) { - var needCheckInitializer = ts.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */; + var needCheckInitializer = ts.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */; var needCheckWidenedType = !ts.some(node.name.elements, ts.not(ts.isOmittedExpression)); if (needCheckInitializer || needCheckWidenedType) { // Don't validate for-in initializer as it is already an error @@ -83683,7 +84172,7 @@ var ts; } // For a commonjs `const x = require`, validate the alias and exit var symbol = getSymbolOfNode(node); - if (symbol.flags & 2097152 /* SymbolFlags.Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 203 /* SyntaxKind.BindingElement */ ? node.parent.parent : node)) { + if (symbol.flags & 2097152 /* SymbolFlags.Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 205 /* SyntaxKind.BindingElement */ ? node.parent.parent : node)) { checkAliasSymbol(node); return; } @@ -83697,7 +84186,7 @@ var ts; ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || ts.isPrototypeAccess(node.name)) && !!((_a = symbol.exports) === null || _a === void 0 ? void 0 : _a.size); - if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */) { + if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */) { checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(initializer), type, node, initializer, /*headMessage*/ undefined); } } @@ -83723,10 +84212,10 @@ var ts; error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name)); } } - if (node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 166 /* SyntaxKind.PropertySignature */) { + if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 168 /* SyntaxKind.PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionsForDeclarationName(node, node.name); @@ -83734,7 +84223,7 @@ var ts; } function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) { var nextDeclarationName = ts.getNameOfDeclaration(nextDeclaration); - var message = nextDeclaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ || nextDeclaration.kind === 166 /* SyntaxKind.PropertySignature */ + var message = nextDeclaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ || nextDeclaration.kind === 168 /* SyntaxKind.PropertySignature */ ? ts.Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2 : ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2; var declName = ts.declarationNameToString(nextDeclarationName); @@ -83744,8 +84233,8 @@ var ts; } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 164 /* SyntaxKind.Parameter */ && right.kind === 254 /* SyntaxKind.VariableDeclaration */) || - (left.kind === 254 /* SyntaxKind.VariableDeclaration */ && right.kind === 164 /* SyntaxKind.Parameter */)) { + if ((left.kind === 166 /* SyntaxKind.Parameter */ && right.kind === 257 /* SyntaxKind.VariableDeclaration */) || + (left.kind === 257 /* SyntaxKind.VariableDeclaration */ && right.kind === 166 /* SyntaxKind.Parameter */)) { // Differences in optionality between parameters and variables are allowed. return true; } @@ -83754,8 +84243,8 @@ var ts; } var interestingFlags = 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | - 256 /* ModifierFlags.Async */ | - 128 /* ModifierFlags.Abstract */ | + 512 /* ModifierFlags.Async */ | + 256 /* ModifierFlags.Abstract */ | 64 /* ModifierFlags.Readonly */ | 32 /* ModifierFlags.Static */; return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags); @@ -83784,15 +84273,15 @@ var ts; function checkIfStatement(node) { // Grammar checking checkGrammarStatementInAmbientContext(node); - checkTruthinessExpression(node.expression); - checkTestingKnownTruthyCallableOrAwaitableType(node.expression, node.thenStatement); + var type = checkTruthinessExpression(node.expression); + checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 236 /* SyntaxKind.EmptyStatement */) { + if (node.thenStatement.kind === 239 /* SyntaxKind.EmptyStatement */) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); } - function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, body) { + function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, condType, body) { if (!strictNullChecks) return; helper(condExpr, body); @@ -83807,7 +84296,7 @@ var ts; : condExpr; if (ts.isModuleExportsAccessExpression(location)) return; - var type = checkTruthinessExpression(location); + var type = location === condExpr ? condType : checkTruthinessExpression(location); var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression); if (!(getTypeFacts(type) & 4194304 /* TypeFacts.Truthy */) || isPropertyExpressionCast) return; @@ -83921,12 +84410,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -83966,14 +84455,14 @@ var ts; // via checkRightHandSideOfForOf. // If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference. // Then check that the RHS is assignable to it. - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node); // There may be a destructuring assignment on the left side - if (varExpr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (varExpr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // iteratedType may be undefined. In this case, we still want to check the structure of // varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like // to short circuit the type relation checking as much as possible, so we pass the unknownType. @@ -84005,7 +84494,7 @@ var ts; // for (let VarDecl in Expr) Statement // VarDecl must be a variable declaration without a type annotation that declares a variable of type Any, // and Expr must be an expression of type Any, an object type, or a type parameter type. - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -84019,7 +84508,7 @@ var ts; // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (varExpr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { @@ -84819,12 +85308,12 @@ var ts; var functionFlags = ts.getFunctionFlags(container); if (strictNullChecks || node.expression || returnType.flags & 131072 /* TypeFlags.Never */) { var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; - if (container.kind === 173 /* SyntaxKind.SetAccessor */) { + if (container.kind === 175 /* SyntaxKind.SetAccessor */) { if (node.expression) { error(node, ts.Diagnostics.Setters_cannot_return_a_value); } } - else if (container.kind === 171 /* SyntaxKind.Constructor */) { + else if (container.kind === 173 /* SyntaxKind.Constructor */) { if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) { error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -84842,7 +85331,7 @@ var ts; } } } - else if (container.kind !== 171 /* SyntaxKind.Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { + else if (container.kind !== 173 /* SyntaxKind.Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { // The function has a return type, but the return statement doesn't have an expression. error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); } @@ -84871,7 +85360,7 @@ var ts; var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 290 /* SyntaxKind.DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 293 /* SyntaxKind.DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -84880,7 +85369,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { addLazyDiagnostic(createLazyCaseClauseDiagnostics(clause)); } ts.forEach(clause.statements, checkSourceElement); @@ -84917,7 +85406,7 @@ var ts; if (ts.isFunctionLike(current)) { return "quit"; } - if (current.kind === 250 /* SyntaxKind.LabeledStatement */ && current.label.escapedText === node.label.escapedText) { + if (current.kind === 253 /* SyntaxKind.LabeledStatement */ && current.label.escapedText === node.label.escapedText) { grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label)); return true; } @@ -85012,11 +85501,11 @@ var ts; return; } var indexInfos = getApplicableIndexInfos(type, propNameType); - var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* SyntaxKind.InterfaceDeclaration */) : undefined; - var propDeclaration = declaration && declaration.kind === 221 /* SyntaxKind.BinaryExpression */ || - name && name.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined; + var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined; + var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ || + name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined; var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined; - var _loop_30 = function (info) { + var _loop_31 = function (info) { var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined; // We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared // in the containing type, or (c) the containing type is an interface and no base interface contains both the property and @@ -85033,15 +85522,15 @@ var ts; }; for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) { var info = indexInfos_9[_i]; - _loop_30(info); + _loop_31(info); } } function checkIndexConstraintForIndexSignature(type, checkInfo) { var declaration = checkInfo.declaration; var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType); - var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* SyntaxKind.InterfaceDeclaration */) : undefined; + var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined; var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined; - var _loop_31 = function (info) { + var _loop_32 = function (info) { if (info === checkInfo) return "continue"; var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined; @@ -85056,7 +85545,7 @@ var ts; }; for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) { var info = indexInfos_10[_i]; - _loop_31(info); + _loop_32(info); } } function checkTypeNameIsReserved(name, message) { @@ -85159,7 +85648,7 @@ var ts; function checkTypeParametersNotReferenced(root, typeParameters, index) { visit(root); function visit(node) { - if (node.kind === 178 /* SyntaxKind.TypeReference */) { + if (node.kind === 180 /* SyntaxKind.TypeReference */) { var type = getTypeFromTypeReference(node); if (type.flags & 262144 /* TypeFlags.TypeParameter */) { for (var i = index; i < typeParameters.length; i++) { @@ -85249,7 +85738,7 @@ var ts; if (firstDecorator && ts.some(node.members, function (p) { return ts.hasStaticModifier(p) && ts.isPrivateIdentifierClassElementDeclaration(p); })) { grammarErrorOnNode(firstDecorator, ts.Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator); } - if (!node.name && !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (!node.name && !ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); } checkClassLikeDeclaration(node); @@ -85316,7 +85805,7 @@ var ts; } else { var constructSignatures = getSignaturesOfType(baseConstructorType, 1 /* SignatureKind.Construct */); - if (constructSignatures.some(function (signature) { return signature.flags & 4 /* SignatureFlags.Abstract */; }) && !ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)) { + if (constructSignatures.some(function (signature) { return signature.flags & 4 /* SignatureFlags.Abstract */; }) && !ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)) { error(node.name || node, ts.Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract); } } @@ -85376,7 +85865,7 @@ var ts; var baseTypes = baseTypeNode && getBaseTypes(type); var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined; var baseStaticType = getBaseConstructorTypeOfClass(type); - var _loop_32 = function (member) { + var _loop_33 = function (member) { if (ts.hasAmbientModifier(member)) { return "continue"; } @@ -85393,7 +85882,7 @@ var ts; }; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - _loop_32(member); + _loop_33(member); } } /** @@ -85481,7 +85970,7 @@ var ts; function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) { // iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible var issuedMemberError = false; - var _loop_33 = function (member) { + var _loop_34 = function (member) { if (ts.isStatic(member)) { return "continue"; } @@ -85500,7 +85989,7 @@ var ts; }; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - _loop_33(member); + _loop_34(member); } if (!issuedMemberError) { // check again with diagnostics to generate a less-specific error @@ -85551,7 +86040,7 @@ var ts; } function getClassOrInterfaceDeclarationsOfSymbol(symbol) { return ts.filter(symbol.declarations, function (d) { - return d.kind === 257 /* SyntaxKind.ClassDeclaration */ || d.kind === 258 /* SyntaxKind.InterfaceDeclaration */; + return d.kind === 260 /* SyntaxKind.ClassDeclaration */ || d.kind === 261 /* SyntaxKind.InterfaceDeclaration */; }); } function checkKindsOfPropertyMemberOverrides(type, baseType) { @@ -85571,7 +86060,7 @@ var ts; var _a, _b, _c, _d; // NOTE: assignability is checked in checkClassDeclaration var baseProperties = getPropertiesOfType(baseType); - var _loop_34 = function (baseProperty) { + var _loop_35 = function (baseProperty) { var base = getTargetSymbol(baseProperty); if (base.flags & 4194304 /* SymbolFlags.Prototype */) { return "continue"; @@ -85592,7 +86081,7 @@ var ts; // It is an error to inherit an abstract member without implementing it or being declared abstract. // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. - if (baseDeclarationFlags & 128 /* ModifierFlags.Abstract */ && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 128 /* ModifierFlags.Abstract */))) { + if (baseDeclarationFlags & 256 /* ModifierFlags.Abstract */ && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 256 /* ModifierFlags.Abstract */))) { // Searches other base types for a declaration that would satisfy the inherited abstract member. // (The class may have more than one base type via declaration merging with an interface with the // same name.) @@ -85606,7 +86095,7 @@ var ts; return "continue-basePropertyCheck"; } } - if (derivedClassDecl.kind === 226 /* SyntaxKind.ClassExpression */) { + if (derivedClassDecl.kind === 228 /* SyntaxKind.ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -85641,11 +86130,11 @@ var ts; error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_1, symbolToString(base), typeToString(baseType), typeToString(type)); } else if (useDefineForClassFields) { - var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !d.initializer; }); + var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !d.initializer; }); if (uninitialized && !(derived.flags & 33554432 /* SymbolFlags.Transient */) - && !(baseDeclarationFlags & 128 /* ModifierFlags.Abstract */) - && !(derivedDeclarationFlags & 128 /* ModifierFlags.Abstract */) + && !(baseDeclarationFlags & 256 /* ModifierFlags.Abstract */) + && !(derivedDeclarationFlags & 256 /* ModifierFlags.Abstract */) && !((_d = derived.declarations) === null || _d === void 0 ? void 0 : _d.some(function (d) { return !!(d.flags & 16777216 /* NodeFlags.Ambient */); }))) { var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol)); var propName = uninitialized.name; @@ -85681,14 +86170,14 @@ var ts; }; basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) { var baseProperty = baseProperties_1[_i]; - var state_10 = _loop_34(baseProperty); - switch (state_10) { + var state_11 = _loop_35(baseProperty); + switch (state_11) { case "continue-basePropertyCheck": continue basePropertyCheck; } } } function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) { - return baseDeclarationFlags & 128 /* ModifierFlags.Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer) + return baseDeclarationFlags & 256 /* ModifierFlags.Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer) || ts.isInterfaceDeclaration(declaration.parent); } function getNonInheritedProperties(type, baseTypes, properties) { @@ -85770,7 +86259,7 @@ var ts; } } function isPropertyWithoutInitializer(node) { - return node.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + return node.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.hasAbstractModifier(node) && !node.exclamationToken && !node.initializer; @@ -85813,7 +86302,7 @@ var ts; var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(symbol); // Only check this symbol once - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 258 /* SyntaxKind.InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.InterfaceDeclaration */); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -85846,7 +86335,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0); checkExportsOnMergedDeclarations(node); checkTypeParameters(node.typeParameters); - if (node.type.kind === 138 /* SyntaxKind.IntrinsicKeyword */) { + if (node.type.kind === 139 /* SyntaxKind.IntrinsicKeyword */) { if (!intrinsicTypeKinds.has(node.name.escapedText) || ts.length(node.typeParameters) !== 1) { error(node.type, ts.Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types); } @@ -85932,7 +86421,7 @@ var ts; return value; function evaluate(expr) { switch (expr.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var value_2 = evaluate(expr.operand); if (typeof value_2 === "number") { switch (expr.operator) { @@ -85942,7 +86431,7 @@ var ts; } } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var left = evaluate(expr.left); var right = evaluate(expr.right); if (typeof left === "number" && typeof right === "number") { @@ -85971,7 +86460,7 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: checkGrammarNumericLiteral(expr); return +expr.text; - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return evaluate(expr.expression); case 79 /* SyntaxKind.Identifier */: var identifier = expr; @@ -85979,13 +86468,13 @@ var ts; return +(identifier.escapedText); } return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText); - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (isConstantMemberAccess(expr)) { var type = getTypeOfExpression(expr.expression); if (type.symbol && type.symbol.flags & 384 /* SymbolFlags.Enum */) { var name = void 0; - if (expr.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (expr.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { name = expr.name.escapedText; } else { @@ -86022,8 +86511,8 @@ var ts; return false; } return node.kind === 79 /* SyntaxKind.Identifier */ || - node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || - node.kind === 207 /* SyntaxKind.ElementAccessExpression */ && isConstantMemberAccess(node.expression) && + node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || + node.kind === 209 /* SyntaxKind.ElementAccessExpression */ && isConstantMemberAccess(node.expression) && ts.isStringLiteralLike(node.argumentExpression); } function checkEnumDeclaration(node) { @@ -86057,7 +86546,7 @@ var ts; var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind !== 263 /* SyntaxKind.EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -86086,8 +86575,8 @@ var ts; if (declarations) { for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { var declaration = declarations_9[_i]; - if ((declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ || - (declaration.kind === 256 /* SyntaxKind.FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ || + (declaration.kind === 259 /* SyntaxKind.FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { return declaration; } @@ -86158,7 +86647,7 @@ var ts; } // if the module merges with a class declaration in the same lexical scope, // we need to track this to ensure the correct emit. - var mergedClass = ts.getDeclarationOfKind(symbol, 257 /* SyntaxKind.ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 260 /* SyntaxKind.ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* NodeCheckFlags.LexicalModuleMergesWithClass */; @@ -86203,23 +86692,23 @@ var ts; function checkModuleAugmentationElement(node, isGlobalAugmentation) { var _a; switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // error each individual name in variable statement instead of marking the entire variable statement for (var _i = 0, _b = node.declarationList.declarations; _i < _b.length; _i++) { var decl = _b[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 203 /* SyntaxKind.BindingElement */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: var name = node.name; if (ts.isBindingPattern(name)) { for (var _c = 0, _d = name.elements; _c < _d.length; _c++) { @@ -86230,12 +86719,12 @@ var ts; break; } // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: if (isGlobalAugmentation) { return; } @@ -86258,12 +86747,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.left; } while (node.kind !== 79 /* SyntaxKind.Identifier */); return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: do { if (ts.isModuleExportsAccessExpression(node.expression) && !ts.isPrivateIdentifier(node.name)) { return node.name; @@ -86283,9 +86772,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 305 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 272 /* SyntaxKind.ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 308 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 275 /* SyntaxKind.ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -86332,8 +86821,8 @@ var ts; var errorNode = ts.isImportOrExportSpecifier(node) ? node.propertyName || node.name : ts.isNamedDeclaration(node) ? node.name : node; - ts.Debug.assert(node.kind !== 274 /* SyntaxKind.NamespaceExport */); - if (node.kind === 275 /* SyntaxKind.ExportSpecifier */) { + ts.Debug.assert(node.kind !== 277 /* SyntaxKind.NamespaceExport */); + if (node.kind === 278 /* SyntaxKind.ExportSpecifier */) { var diag = error(errorNode, ts.Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files); var alreadyExportedSymbol = (_b = (_a = ts.getSourceFileOfNode(node).symbol) === null || _a === void 0 ? void 0 : _a.exports) === null || _b === void 0 ? void 0 : _b.get((node.propertyName || node.name).escapedText); if (alreadyExportedSymbol === target) { @@ -86344,7 +86833,7 @@ var ts; } } else { - ts.Debug.assert(node.kind !== 254 /* SyntaxKind.VariableDeclaration */); + ts.Debug.assert(node.kind !== 257 /* SyntaxKind.VariableDeclaration */); var importDeclaration = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)); var moduleSpecifier = (_e = (importDeclaration && ((_d = ts.tryGetModuleSpecifierFromDeclaration(importDeclaration)) === null || _d === void 0 ? void 0 : _d.text))) !== null && _e !== void 0 ? _e : "..."; var importedIdentifier = ts.unescapeLeadingUnderscores(ts.isIdentifier(errorNode) ? errorNode.escapedText : symbol.escapedName); @@ -86356,7 +86845,7 @@ var ts; (symbol.flags & 788968 /* SymbolFlags.Type */ ? 788968 /* SymbolFlags.Type */ : 0) | (symbol.flags & 1920 /* SymbolFlags.Namespace */ ? 1920 /* SymbolFlags.Namespace */ : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 275 /* SyntaxKind.ExportSpecifier */ ? + var message = node.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -86368,23 +86857,23 @@ var ts; var isType = !(target.flags & 111551 /* SymbolFlags.Value */); if (isType || typeOnlyAlias) { switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { if (compilerOptions.preserveValueImports) { ts.Debug.assertIsDefined(node.name, "An ImportClause with a symbol should have a name"); var message = isType ? ts.Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled : ts.Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled; - var name = ts.idText(node.kind === 270 /* SyntaxKind.ImportSpecifier */ ? node.propertyName || node.name : node.name); + var name = ts.idText(node.kind === 273 /* SyntaxKind.ImportSpecifier */ ? node.propertyName || node.name : node.name); addTypeOnlyDeclarationRelatedInfo(error(node, message, name), isType ? undefined : typeOnlyAlias, name); } - if (isType && node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && ts.hasEffectiveModifier(node, 1 /* ModifierFlags.Export */)) { + if (isType && node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && ts.hasEffectiveModifier(node, 1 /* ModifierFlags.Export */)) { error(node, ts.Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided); } break; } - case 275 /* SyntaxKind.ExportSpecifier */: { + case 278 /* SyntaxKind.ExportSpecifier */: { // Don't allow re-exporting an export that will be elided when `--isolatedModules` is set. // The exception is that `import type { A } from './a'; export { A }` is allowed // because single-file analysis can determine that the export should be dropped. @@ -86443,7 +86932,7 @@ var ts; function checkImportBinding(node) { checkCollisionsForDeclarationName(node, node.name); checkAliasSymbol(node); - if (node.kind === 270 /* SyntaxKind.ImportSpecifier */ && + if (node.kind === 273 /* SyntaxKind.ImportSpecifier */ && ts.idText(node.propertyName || node.name) === "default" && ts.getESModuleInterop(compilerOptions) && moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) { @@ -86493,7 +86982,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { checkImportBinding(importClause.namedBindings); if (moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) && ts.getESModuleInterop(compilerOptions)) { // import * as ns from "foo"; @@ -86522,7 +87011,7 @@ var ts; if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { markExportAsReferenced(node); } - if (node.moduleReference.kind !== 277 /* SyntaxKind.ExternalModuleReference */) { + if (node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */) { var target = resolveAlias(getSymbolOfNode(node)); if (target !== unknownSymbol) { if (target.flags & 111551 /* SymbolFlags.Value */) { @@ -86565,10 +87054,10 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && + var inAmbientExternalModule = node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && !node.moduleSpecifier && node.flags & 16777216 /* NodeFlags.Ambient */; - if (node.parent.kind !== 305 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + if (node.parent.kind !== 308 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -86603,7 +87092,7 @@ var ts; function checkGrammarExportDeclaration(node) { var _a; if (node.isTypeOnly) { - if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 273 /* SyntaxKind.NamedExports */) { + if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 276 /* SyntaxKind.NamedExports */) { return checkGrammarNamedImportsOrExports(node.exportClause); } else { @@ -86613,7 +87102,7 @@ var ts; return false; } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 305 /* SyntaxKind.SourceFile */ || node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */; + var isInAppropriateContext = node.parent.kind === 308 /* SyntaxKind.SourceFile */ || node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -86693,8 +87182,8 @@ var ts; // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors. return; } - var container = node.parent.kind === 305 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 261 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 308 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); } @@ -86826,181 +87315,181 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } - if (kind >= 237 /* SyntaxKind.FirstStatement */ && kind <= 253 /* SyntaxKind.LastStatement */ && node.flowNode && !isReachableFlowNode(node.flowNode)) { + if (kind >= 240 /* SyntaxKind.FirstStatement */ && kind <= 256 /* SyntaxKind.LastStatement */ && node.flowNode && !isReachableFlowNode(node.flowNode)) { errorOrSuggestion(compilerOptions.allowUnreachableCode === false, node, ts.Diagnostics.Unreachable_code_detected); } switch (kind) { - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return checkTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return checkParameter(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return checkPropertyDeclaration(node); - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return checkPropertySignature(node); - case 180 /* SyntaxKind.ConstructorType */: - case 179 /* SyntaxKind.FunctionType */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return checkSignatureDeclaration(node); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return checkMethodDeclaration(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return checkClassStaticBlockDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return checkConstructorDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return checkAccessorDeclaration(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return checkTypeReferenceNode(node); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return checkTypePredicate(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return checkTypeQuery(node); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return checkTypeLiteral(node); - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return checkArrayType(node); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return checkTupleType(node); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return checkUnionOrIntersectionType(node); - case 191 /* SyntaxKind.ParenthesizedType */: - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 187 /* SyntaxKind.OptionalType */: + case 188 /* SyntaxKind.RestType */: return checkSourceElement(node.type); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return checkThisType(node); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return checkTypeOperator(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return checkConditionalType(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return checkInferType(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return checkTemplateLiteralType(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return checkImportType(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return checkNamedTupleMember(node); - case 328 /* SyntaxKind.JSDocAugmentsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: return checkJSDocAugmentsTag(node); - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return checkJSDocImplementsTag(node); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return checkJSDocTypeAliasTag(node); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return checkJSDocTemplateTag(node); - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return checkJSDocTypeTag(node); - case 324 /* SyntaxKind.JSDocLink */: - case 325 /* SyntaxKind.JSDocLinkCode */: - case 326 /* SyntaxKind.JSDocLinkPlain */: + case 327 /* SyntaxKind.JSDocLink */: + case 328 /* SyntaxKind.JSDocLinkCode */: + case 329 /* SyntaxKind.JSDocLinkPlain */: return checkJSDocLinkLikeTag(node); - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return checkJSDocParameterTag(node); - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return checkJSDocPropertyTag(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: checkJSDocFunctionType(node); // falls through - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: checkJSDocTypeIsInJsFile(node); ts.forEachChild(node, checkSourceElement); return; - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: checkJSDocVariadicType(node); return; - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return checkSourceElement(node.type); - case 333 /* SyntaxKind.JSDocPublicTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: + case 336 /* SyntaxKind.JSDocPublicTag */: + case 338 /* SyntaxKind.JSDocProtectedTag */: + case 337 /* SyntaxKind.JSDocPrivateTag */: return checkJSDocAccessibilityModifiers(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return checkIndexedAccessType(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return checkMappedType(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return checkFunctionDeclaration(node); - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: return checkBlock(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return checkVariableStatement(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return checkExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return checkIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return checkDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return checkWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return checkForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return checkForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return checkForOfStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: return checkBreakOrContinueStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return checkReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return checkWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return checkSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return checkLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return checkThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return checkTryStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checkVariableDeclaration(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return checkBindingElement(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return checkClassDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return checkEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return checkModuleDeclaration(node); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return checkImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return checkExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return checkExportAssignment(node); - case 236 /* SyntaxKind.EmptyStatement */: - case 253 /* SyntaxKind.DebuggerStatement */: + case 239 /* SyntaxKind.EmptyStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 276 /* SyntaxKind.MissingDeclaration */: + case 279 /* SyntaxKind.MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -87107,36 +87596,36 @@ var ts; currentNode = node; instantiationCount = 0; switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 165 /* SyntaxKind.Decorator */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 167 /* SyntaxKind.Decorator */: + case 283 /* SyntaxKind.JsxOpeningElement */: // These node kinds are deferred checked when overload resolution fails // To save on work, we ensure the arguments are checked just once, in // a deferred way resolveUntypedCall(node); break; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: checkAccessorDeclaration(node); break; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: checkClassExpressionDeferred(node); break; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: checkTypeParameterDeferred(node); break; - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: checkJsxSelfClosingElementDeferred(node); break; - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: checkJsxElementDeferred(node); break; } @@ -87309,17 +87798,17 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalModule(location)) break; // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: copyLocallyVisibleExportSymbols(getSymbolOfNode(location).exports, meaning & 2623475 /* SymbolFlags.ModuleMember */); break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* SymbolFlags.EnumMember */); break; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: var className = location.name; if (className) { copySymbol(location.symbol, meaning); @@ -87327,8 +87816,8 @@ var ts; // this fall-through is necessary because we would like to handle // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration. // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // If we didn't come from static member of class or interface, // add the type parameters into the symbol table // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol. @@ -87337,7 +87826,7 @@ var ts; copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 788968 /* SymbolFlags.Type */); } break; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -87381,7 +87870,7 @@ var ts; if (meaning) { source.forEach(function (symbol) { // Similar condition as in `resolveNameHelper` - if (!ts.getDeclarationOfKind(symbol, 275 /* SyntaxKind.ExportSpecifier */) && !ts.getDeclarationOfKind(symbol, 274 /* SyntaxKind.NamespaceExport */)) { + if (!ts.getDeclarationOfKind(symbol, 278 /* SyntaxKind.ExportSpecifier */) && !ts.getDeclarationOfKind(symbol, 277 /* SyntaxKind.NamespaceExport */)) { copySymbol(symbol, meaning); } }); @@ -87395,19 +87884,19 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 163 /* SyntaxKind.TypeParameter */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 165 /* SyntaxKind.TypeParameter */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return true; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return node.isTypeOnly; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.isTypeOnly; default: return false; @@ -87415,16 +87904,16 @@ var ts; } // True if the given identifier is part of a type reference function isTypeReferenceIdentifier(node) { - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } - return node.parent.kind === 178 /* SyntaxKind.TypeReference */; + return node.parent.kind === 180 /* SyntaxKind.TypeReference */; } function isHeritageClauseElementIdentifier(node) { - while (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { node = node.parent; } - return node.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } function forEachEnclosingClass(node, callback) { var result; @@ -87452,13 +87941,13 @@ var ts; return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (nodeOnRightSide.parent.kind === 163 /* SyntaxKind.QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } - if (nodeOnRightSide.parent.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 274 /* SyntaxKind.ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } return undefined; @@ -87484,7 +87973,7 @@ var ts; node = parent; parent = parent.parent; } - if (parent && parent.kind === 200 /* SyntaxKind.ImportType */ && parent.qualifier === node) { + if (parent && parent.kind === 202 /* SyntaxKind.ImportType */ && parent.qualifier === node) { return parent; } return undefined; @@ -87494,7 +87983,7 @@ var ts; return getSymbolOfNode(name.parent); } if (ts.isInJSFile(name) && - name.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + name.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && name.parent === name.parent.parent.left) { // Check if this is a special property assignment if (!ts.isPrivateIdentifier(name) && !ts.isJSDocMemberName(name)) { @@ -87504,7 +87993,7 @@ var ts; } } } - if (name.parent.kind === 271 /* SyntaxKind.ExportAssignment */ && ts.isEntityNameExpression(name)) { + if (name.parent.kind === 274 /* SyntaxKind.ExportAssignment */ && ts.isEntityNameExpression(name)) { // Even an entity name expression that doesn't resolve as an entityname may still typecheck as a property access expression var success = resolveEntityName(name, /*all meanings*/ 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */, /*ignoreErrors*/ true); @@ -87514,7 +88003,7 @@ var ts; } else if (ts.isEntityName(name) && isInRightSideOfImportOrExportAssignment(name)) { // Since we already checked for ExportAssignment, this really could only be an Import - var importEqualsDeclaration = ts.getAncestor(name, 265 /* SyntaxKind.ImportEqualsDeclaration */); + var importEqualsDeclaration = ts.getAncestor(name, 268 /* SyntaxKind.ImportEqualsDeclaration */); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(name, /*dontResolveAlias*/ true); } @@ -87532,7 +88021,7 @@ var ts; if (isHeritageClauseElementIdentifier(name)) { var meaning = 0 /* SymbolFlags.None */; // In an interface or class, we're definitely interested in a type. - if (name.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (name.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { meaning = 788968 /* SymbolFlags.Type */; // In a class 'extends' clause we are also looking for a value. if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(name.parent)) { @@ -87548,10 +88037,10 @@ var ts; return entityNameSymbol; } } - if (name.parent.kind === 340 /* SyntaxKind.JSDocParameterTag */) { + if (name.parent.kind === 343 /* SyntaxKind.JSDocParameterTag */) { return ts.getParameterSymbolFromJSDoc(name.parent); } - if (name.parent.kind === 163 /* SyntaxKind.TypeParameter */ && name.parent.parent.kind === 344 /* SyntaxKind.JSDocTemplateTag */) { + if (name.parent.kind === 165 /* SyntaxKind.TypeParameter */ && name.parent.parent.kind === 347 /* SyntaxKind.JSDocTemplateTag */) { ts.Debug.assert(!ts.isInJSFile(name)); // Otherwise `isDeclarationName` would have been true. var typeParameter = ts.getTypeParameterFromJsDoc(name.parent); return typeParameter && typeParameter.symbol; @@ -87575,18 +88064,53 @@ var ts; return resolveJSDocMemberName(name, /*ignoreErrors*/ false, getSymbolOfNode(container)); } } + if (result && isJSDoc_1) { + var container = ts.getJSDocHost(name); + if (container && ts.isEnumMember(container) && container === result.valueDeclaration) { + return resolveEntityName(name, meaning, /*ignoreErrors*/ true, /* dontResolveAlias */ true, ts.getSourceFileOfNode(container)) || result; + } + } return result; } else if (ts.isPrivateIdentifier(name)) { return getSymbolForPrivateIdentifierExpression(name); } - else if (name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || name.kind === 161 /* SyntaxKind.QualifiedName */) { + else if (name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || name.kind === 163 /* SyntaxKind.QualifiedName */) { var links = getNodeLinks(name); if (links.resolvedSymbol) { return links.resolvedSymbol; } - if (name.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (name.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { checkPropertyAccessExpression(name, 0 /* CheckMode.Normal */); + if (!links.resolvedSymbol) { + var expressionType = checkExpressionCached(name.expression); + var infos = getApplicableIndexInfos(expressionType, getLiteralTypeFromPropertyName(name.name)); + if (infos.length && expressionType.members) { + var resolved = resolveStructuredTypeMembers(expressionType); + var symbol = resolved.members.get("__index" /* InternalSymbolName.Index */); + if (infos === getIndexInfosOfType(expressionType)) { + links.resolvedSymbol = symbol; + } + else if (symbol) { + var symbolLinks_1 = getSymbolLinks(symbol); + var declarationList = ts.mapDefined(infos, function (i) { return i.declaration; }); + var nodeListId = ts.map(declarationList, getNodeId).join(","); + if (!symbolLinks_1.filteredIndexSymbolCache) { + symbolLinks_1.filteredIndexSymbolCache = new ts.Map(); + } + if (symbolLinks_1.filteredIndexSymbolCache.has(nodeListId)) { + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + else { + var copy = createSymbol(131072 /* SymbolFlags.Signature */, "__index" /* InternalSymbolName.Index */); + copy.declarations = ts.mapDefined(infos, function (i) { return i.declaration; }); + copy.parent = expressionType.aliasSymbol ? expressionType.aliasSymbol : expressionType.symbol ? expressionType.symbol : getSymbolAtLocation(copy.declarations[0].parent); + symbolLinks_1.filteredIndexSymbolCache.set(nodeListId, copy); + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + } + } + } } else { checkQualifiedName(name, 0 /* CheckMode.Normal */); @@ -87601,11 +88125,11 @@ var ts; } } else if (isTypeReferenceIdentifier(name)) { - var meaning = name.parent.kind === 178 /* SyntaxKind.TypeReference */ ? 788968 /* SymbolFlags.Type */ : 1920 /* SymbolFlags.Namespace */; + var meaning = name.parent.kind === 180 /* SyntaxKind.TypeReference */ ? 788968 /* SymbolFlags.Type */ : 1920 /* SymbolFlags.Namespace */; var symbol = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); return symbol && symbol !== unknownSymbol ? symbol : getUnresolvedSymbolForEntityName(name); } - if (name.parent.kind === 177 /* SyntaxKind.TypePredicate */) { + if (name.parent.kind === 179 /* SyntaxKind.TypePredicate */) { return resolveEntityName(name, /*meaning*/ 1 /* SymbolFlags.FunctionScopedVariable */); } return undefined; @@ -87639,7 +88163,7 @@ var ts; } } function getSymbolAtLocation(node, ignoreErrors) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } var parent = node.parent; @@ -87662,8 +88186,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } - else if (parent.kind === 203 /* SyntaxKind.BindingElement */ && - grandParent.kind === 201 /* SyntaxKind.ObjectBindingPattern */ && + else if (parent.kind === 205 /* SyntaxKind.BindingElement */ && + grandParent.kind === 203 /* SyntaxKind.ObjectBindingPattern */ && node === parent.propertyName) { var typeOfPattern = getTypeOfNode(grandParent); var propertyDeclaration = getPropertyOfType(typeOfPattern, node.escapedText); @@ -87690,8 +88214,8 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: if (!ts.isThisInTypeQuery(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } @@ -87708,14 +88232,14 @@ var ts; return checkExpression(node).symbol; } // falls through - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return getTypeFromThisTypeNode(node).symbol; case 106 /* SyntaxKind.SuperKeyword */: return checkExpression(node).symbol; - case 134 /* SyntaxKind.ConstructorKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 171 /* SyntaxKind.Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 173 /* SyntaxKind.Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; @@ -87726,7 +88250,7 @@ var ts; // 3). Dynamic import call or require in javascript // 4). type A = import("./f/*gotToDefinitionHere*/oo") if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 266 /* SyntaxKind.ImportDeclaration */ || node.parent.kind === 272 /* SyntaxKind.ExportDeclaration */) && node.parent.moduleSpecifier === node) || + ((node.parent.kind === 269 /* SyntaxKind.ImportDeclaration */ || node.parent.kind === 275 /* SyntaxKind.ExportDeclaration */) && node.parent.moduleSpecifier === node) || ((ts.isInJSFile(node) && ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false)) || ts.isImportCall(node.parent)) || (ts.isLiteralTypeNode(node.parent) && ts.isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent)) { return resolveExternalModuleName(node, node, ignoreErrors); @@ -87748,14 +88272,14 @@ var ts; case 38 /* SyntaxKind.EqualsGreaterThanToken */: case 84 /* SyntaxKind.ClassKeyword */: return getSymbolOfNode(node.parent); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal, ignoreErrors) : undefined; case 93 /* SyntaxKind.ExportKeyword */: return ts.isExportAssignment(node.parent) ? ts.Debug.checkDefined(node.parent.symbol) : undefined; case 100 /* SyntaxKind.ImportKeyword */: case 103 /* SyntaxKind.NewKeyword */: return ts.isMetaProperty(node.parent) ? checkMetaPropertyKeyword(node.parent).symbol : undefined; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return checkExpression(node).symbol; default: return undefined; @@ -87771,7 +88295,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (location && location.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 111551 /* SymbolFlags.Value */ | 2097152 /* SymbolFlags.Alias */); } return undefined; @@ -87853,23 +88377,23 @@ var ts; // [ a ] from // [a] = [ some array ...] function getTypeOfAssignmentPattern(expr) { - ts.Debug.assert(expr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || expr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */); + ts.Debug.assert(expr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || expr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */); // If this is from "for of" // for ( { a } of elems) { // } - if (expr.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (expr.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { var iteratedType = checkRightHandSideOfForOf(expr.parent); return checkDestructuringAssignment(expr, iteratedType || errorType); } // If this is from "for" initializer // for ({a } = elems[0];.....) { } - if (expr.parent.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (expr.parent.kind === 223 /* SyntaxKind.BinaryExpression */) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || errorType); } // If this is from nested object binding pattern // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { - if (expr.parent.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (expr.parent.kind === 299 /* SyntaxKind.PropertyAssignment */) { var node_3 = ts.cast(expr.parent.parent, ts.isObjectLiteralExpression); var typeOfParentObjectLiteral = getTypeOfAssignmentPattern(node_3) || errorType; var propertyIndex = ts.indexOfNode(node_3.properties, expr.parent); @@ -87917,7 +88441,7 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 10 /* SyntaxKind.StringLiteral */: return getStringLiteralType(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: var nameType = checkComputedPropertyName(name); return isTypeAssignableToKind(nameType, 12288 /* TypeFlags.ESSymbolLike */) ? nameType : stringType; default: @@ -88035,7 +88559,7 @@ var ts; } var parentSymbol_1 = getParentOfSymbol(symbol); if (parentSymbol_1) { - if (parentSymbol_1.flags & 512 /* SymbolFlags.ValueModule */ && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 305 /* SyntaxKind.SourceFile */) { + if (parentSymbol_1.flags & 512 /* SymbolFlags.ValueModule */ && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 308 /* SyntaxKind.SourceFile */) { var symbolFile = parentSymbol_1.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); // If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined. @@ -88055,7 +88579,7 @@ var ts; } var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier); if (node) { - var symbol = getReferencedValueSymbol(node); + var symbol = getReferencedValueOrAliasSymbol(node); // We should only get the declaration of an alias if there isn't a local value // declaration for the symbol if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol)) { @@ -88067,7 +88591,7 @@ var ts; function isSymbolOfDestructuredElementOfCatchBinding(symbol) { return symbol.valueDeclaration && ts.isBindingElement(symbol.valueDeclaration) - && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 292 /* SyntaxKind.CatchClause */; + && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 295 /* SyntaxKind.CatchClause */; } function isSymbolOfDeclarationWithCollidingName(symbol) { if (symbol.flags & 418 /* SymbolFlags.BlockScoped */ && symbol.valueDeclaration && !ts.isSourceFile(symbol.valueDeclaration)) { @@ -88098,7 +88622,7 @@ var ts; // they will not collide with anything var isDeclaredInLoop = nodeLinks_1.flags & 524288 /* NodeCheckFlags.BlockScopedBindingInLoop */; var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false); - var inLoopBodyBlock = container.kind === 235 /* SyntaxKind.Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + var inLoopBodyBlock = container.kind === 238 /* SyntaxKind.Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -88139,19 +88663,19 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: var symbol = getSymbolOfNode(node); return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportClause = node.exportClause; return !!exportClause && (ts.isNamespaceExport(exportClause) || ts.some(exportClause.elements, isValueAliasDeclaration)); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return node.expression && node.expression.kind === 79 /* SyntaxKind.Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; @@ -88160,7 +88684,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(nodeIn) { var node = ts.getParseTreeNode(nodeIn, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 305 /* SyntaxKind.SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 308 /* SyntaxKind.SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -88270,15 +88794,15 @@ var ts; } function canHaveConstantValue(node) { switch (node.kind) { - case 299 /* SyntaxKind.EnumMember */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 302 /* SyntaxKind.EnumMember */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return true; } return false; } function getConstantValue(node) { - if (node.kind === 299 /* SyntaxKind.EnumMember */) { + if (node.kind === 302 /* SyntaxKind.EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -88371,7 +88895,7 @@ var ts; function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker, addUndefined) { var declaration = ts.getParseTreeNode(declarationIn, ts.isVariableLikeOrAccessor); if (!declaration) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } // Get type of the symbol if this is the valid symbol otherwise get type at location var symbol = getSymbolOfNode(declaration); @@ -88390,7 +88914,7 @@ var ts; function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) { var signatureDeclaration = ts.getParseTreeNode(signatureDeclarationIn, ts.isFunctionLike); if (!signatureDeclaration) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } var signature = getSignatureFromDeclaration(signatureDeclaration); return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, flags | 1024 /* NodeBuilderFlags.MultilineObjectLiterals */, tracker); @@ -88398,7 +88922,7 @@ var ts; function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) { var expr = ts.getParseTreeNode(exprIn, ts.isExpression); if (!expr) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } var type = getWidenedType(getRegularTypeOfExpression(expr)); return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024 /* NodeBuilderFlags.MultilineObjectLiterals */, tracker); @@ -88422,6 +88946,25 @@ var ts; } return resolveName(location, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true); } + /** + * Get either a value-meaning symbol or an alias symbol. + * Unlike `getReferencedValueSymbol`, if the cached resolved symbol is the unknown symbol, + * we call `resolveName` to find a symbol. + * This is because when caching the resolved symbol, we only consider value symbols, but here + * we want to also get an alias symbol if one exists. + */ + function getReferencedValueOrAliasSymbol(reference) { + var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; + if (resolvedSymbol && resolvedSymbol !== unknownSymbol) { + return resolvedSymbol; + } + return resolveName(reference, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, + /*nodeNotFoundMessage*/ undefined, + /*nameArg*/ undefined, + /*isUse*/ true, + /*excludeGlobals*/ undefined, + /*getSpellingSuggestions*/ undefined); + } function getReferencedValueDeclaration(referenceIn) { if (!ts.isGeneratedIdentifier(referenceIn)) { var reference = ts.getParseTreeNode(referenceIn, ts.isIdentifier); @@ -88555,12 +89098,12 @@ var ts; getJsxFragmentFactoryEntity: getJsxFragmentFactoryEntity, getAllAccessorDeclarations: function (accessor) { accessor = ts.getParseTreeNode(accessor, ts.isGetOrSetAccessorDeclaration); // TODO: GH#18217 - var otherKind = accessor.kind === 173 /* SyntaxKind.SetAccessor */ ? 172 /* SyntaxKind.GetAccessor */ : 173 /* SyntaxKind.SetAccessor */; + var otherKind = accessor.kind === 175 /* SyntaxKind.SetAccessor */ ? 174 /* SyntaxKind.GetAccessor */ : 175 /* SyntaxKind.SetAccessor */; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(accessor), otherKind); var firstAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? otherAccessor : accessor; var secondAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? accessor : otherAccessor; - var setAccessor = accessor.kind === 173 /* SyntaxKind.SetAccessor */ ? accessor : otherAccessor; - var getAccessor = accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? accessor : otherAccessor; + var setAccessor = accessor.kind === 175 /* SyntaxKind.SetAccessor */ ? accessor : otherAccessor; + var getAccessor = accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? accessor : otherAccessor; return { firstAccessor: firstAccessor, secondAccessor: secondAccessor, @@ -88576,7 +89119,7 @@ var ts; }, getDeclarationStatementsForSourceFile: function (node, flags, tracker, bundled) { var n = ts.getParseTreeNode(node); - ts.Debug.assert(n && n.kind === 305 /* SyntaxKind.SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile"); + ts.Debug.assert(n && n.kind === 308 /* SyntaxKind.SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile"); var sym = getSymbolOfNode(node); if (!sym) { return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker, bundled); @@ -88613,7 +89156,7 @@ var ts; return false; } function isInHeritageClause(node) { - return node.parent && node.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 291 /* SyntaxKind.HeritageClause */; + return node.parent && node.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 294 /* SyntaxKind.HeritageClause */; } // defined here to avoid outer scope pollution function getTypeReferenceDirectivesForEntityName(node) { @@ -88626,12 +89169,12 @@ var ts; // qualified names can only be used as types\namespaces // identifiers are treated as values only if they appear in type queries var meaning; - if (node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } else { meaning = 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */; - if ((node.kind === 79 /* SyntaxKind.Identifier */ && isInTypeQuery(node)) || (node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && !isInHeritageClause(node))) { + if ((node.kind === 79 /* SyntaxKind.Identifier */ && isInTypeQuery(node)) || (node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && !isInHeritageClause(node))) { meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } } @@ -88680,7 +89223,7 @@ var ts; break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 305 /* SyntaxKind.SourceFile */ && current.flags & 512 /* SymbolFlags.ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 308 /* SyntaxKind.SourceFile */ && current.flags & 512 /* SymbolFlags.ValueModule */) { return false; } // check that at least one declaration of top level symbol originates from type declaration file @@ -88708,12 +89251,12 @@ var ts; } } function getExternalModuleFileFromDeclaration(declaration) { - var specifier = declaration.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); + var specifier = declaration.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, /*moduleNotFoundError*/ undefined); // TODO: GH#18217 if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 305 /* SyntaxKind.SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 308 /* SyntaxKind.SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors @@ -88925,14 +89468,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node, node.parent, node.parent.parent)) { - if (node.kind === 169 /* SyntaxKind.MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { + if (node.kind === 171 /* SyntaxKind.MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } } - else if (node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (ts.hasDecorators(accessors.firstAccessor) && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -88951,26 +89494,26 @@ var ts; var modifier = _a[_i]; if (ts.isDecorator(modifier)) continue; - if (modifier.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { - if (node.kind === 166 /* SyntaxKind.PropertySignature */ || node.kind === 168 /* SyntaxKind.MethodSignature */) { + if (modifier.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { + if (node.kind === 168 /* SyntaxKind.PropertySignature */ || node.kind === 170 /* SyntaxKind.MethodSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 176 /* SyntaxKind.IndexSignature */ && (modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ || !ts.isClassLike(node.parent))) { + if (node.kind === 178 /* SyntaxKind.IndexSignature */ && (modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ || !ts.isClassLike(node.parent))) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } - if (modifier.kind !== 101 /* SyntaxKind.InKeyword */ && modifier.kind !== 144 /* SyntaxKind.OutKeyword */) { - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { + if (modifier.kind !== 101 /* SyntaxKind.InKeyword */ && modifier.kind !== 145 /* SyntaxKind.OutKeyword */) { + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_parameter, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { case 85 /* SyntaxKind.ConstKeyword */: - if (node.kind !== 260 /* SyntaxKind.EnumDeclaration */) { + if (node.kind !== 263 /* SyntaxKind.EnumDeclaration */) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(85 /* SyntaxKind.ConstKeyword */)); } break; - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "override"); @@ -88981,7 +89524,10 @@ var ts; else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "accessor"); + } + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "async"); } flags |= 16384 /* ModifierFlags.Override */; @@ -89000,16 +89546,19 @@ var ts; else if (flags & 32 /* ModifierFlags.Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "accessor"); + } else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { if (modifier.kind === 121 /* SyntaxKind.PrivateKeyword */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } @@ -89029,16 +89578,19 @@ var ts; else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "accessor"); + } + else if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } else if (flags & 16384 /* ModifierFlags.Override */) { @@ -89047,11 +89599,26 @@ var ts; flags |= 32 /* ModifierFlags.Static */; lastStatic = modifier; break; - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "accessor"); + } + else if (flags & 64 /* ModifierFlags.Readonly */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "readonly"); + } + else if (flags & 2 /* ModifierFlags.Ambient */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "declare"); + } + else if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */) { + return grammarErrorOnNode(modifier, ts.Diagnostics.accessor_modifier_can_only_appear_on_a_property_declaration); + } + flags |= 128 /* ModifierFlags.Accessor */; + break; + case 146 /* SyntaxKind.ReadonlyKeyword */: if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 166 /* SyntaxKind.PropertySignature */ && node.kind !== 176 /* SyntaxKind.IndexSignature */ && node.kind !== 164 /* SyntaxKind.Parameter */) { + else if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 168 /* SyntaxKind.PropertySignature */ && node.kind !== 178 /* SyntaxKind.IndexSignature */ && node.kind !== 166 /* SyntaxKind.Parameter */) { // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } @@ -89064,35 +89631,35 @@ var ts; else if (flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "abstract"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } else if (ts.isClassLike(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "export"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1 /* ModifierFlags.Export */; break; case 88 /* SyntaxKind.DefaultKeyword */: - var container = node.parent.kind === 305 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 261 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 308 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } else if (!(flags & 1 /* ModifierFlags.Export */)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "default"); } - flags |= 512 /* ModifierFlags.Default */; + flags |= 1024 /* ModifierFlags.Default */; break; - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: if (flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } else if (flags & 16384 /* ModifierFlags.Override */) { @@ -89101,10 +89668,10 @@ var ts; else if (ts.isClassLike(node.parent) && !ts.isPropertyDeclaration(node)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "declare"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if ((node.parent.flags & 16777216 /* NodeFlags.Ambient */) && node.parent.kind === 262 /* SyntaxKind.ModuleBlock */) { + else if ((node.parent.flags & 16777216 /* NodeFlags.Ambient */) && node.parent.kind === 265 /* SyntaxKind.ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } else if (ts.isPrivateIdentifierClassElementDeclaration(node)) { @@ -89114,18 +89681,18 @@ var ts; lastDeclare = modifier; break; case 126 /* SyntaxKind.AbstractKeyword */: - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 257 /* SyntaxKind.ClassDeclaration */ && - node.kind !== 180 /* SyntaxKind.ConstructorType */) { - if (node.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && - node.kind !== 172 /* SyntaxKind.GetAccessor */ && - node.kind !== 173 /* SyntaxKind.SetAccessor */) { + if (node.kind !== 260 /* SyntaxKind.ClassDeclaration */ && + node.kind !== 182 /* SyntaxKind.ConstructorType */) { + if (node.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && + node.kind !== 174 /* SyntaxKind.GetAccessor */ && + node.kind !== 175 /* SyntaxKind.SetAccessor */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ && ts.hasSyntacticModifier(node.parent, 128 /* ModifierFlags.Abstract */))) { + if (!(node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ && ts.hasSyntacticModifier(node.parent, 256 /* ModifierFlags.Abstract */))) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32 /* ModifierFlags.Static */) { @@ -89134,39 +89701,42 @@ var ts; if (flags & 8 /* ModifierFlags.Private */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract"); } - if (flags & 256 /* ModifierFlags.Async */ && lastAsync) { + if (flags & 512 /* ModifierFlags.Async */ && lastAsync) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); } if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "override"); } + if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "accessor"); + } } if (ts.isNamedDeclaration(node) && node.name.kind === 80 /* SyntaxKind.PrivateIdentifier */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "abstract"); } - flags |= 128 /* ModifierFlags.Abstract */; + flags |= 256 /* ModifierFlags.Abstract */; break; - case 131 /* SyntaxKind.AsyncKeyword */: - if (flags & 256 /* ModifierFlags.Async */) { + case 132 /* SyntaxKind.AsyncKeyword */: + if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } else if (flags & 2 /* ModifierFlags.Ambient */ || node.parent.flags & 16777216 /* NodeFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); } - flags |= 256 /* ModifierFlags.Async */; + flags |= 512 /* ModifierFlags.Async */; lastAsync = modifier; break; case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: var inOutFlag = modifier.kind === 101 /* SyntaxKind.InKeyword */ ? 32768 /* ModifierFlags.In */ : 65536 /* ModifierFlags.Out */; var inOutText = modifier.kind === 101 /* SyntaxKind.InKeyword */ ? "in" : "out"; - if (node.kind !== 163 /* SyntaxKind.TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) { + if (node.kind !== 165 /* SyntaxKind.TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText); } if (flags & inOutFlag) { @@ -89179,28 +89749,28 @@ var ts; break; } } - if (node.kind === 171 /* SyntaxKind.Constructor */) { + if (node.kind === 173 /* SyntaxKind.Constructor */) { if (flags & 32 /* ModifierFlags.Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(lastOverride, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "override"); // TODO: GH#18217 } - if (flags & 256 /* ModifierFlags.Async */) { + if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); } return false; } - else if ((node.kind === 266 /* SyntaxKind.ImportDeclaration */ || node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) && flags & 2 /* ModifierFlags.Ambient */) { + else if ((node.kind === 269 /* SyntaxKind.ImportDeclaration */ || node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) && flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 166 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); } - else if (node.kind === 164 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && node.dotDotDotToken) { + else if (node.kind === 166 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && node.dotDotDotToken) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } - if (flags & 256 /* ModifierFlags.Async */) { + if (flags & 512 /* ModifierFlags.Async */) { return checkGrammarAsyncModifier(node, lastAsync); } return false; @@ -89218,47 +89788,47 @@ var ts; } function shouldReportBadModifier(node) { switch (node.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 164 /* SyntaxKind.Parameter */: - case 163 /* SyntaxKind.TypeParameter */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 166 /* SyntaxKind.Parameter */: + case 165 /* SyntaxKind.TypeParameter */: return false; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - case 179 /* SyntaxKind.FunctionType */: - case 276 /* SyntaxKind.MissingDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: + case 181 /* SyntaxKind.FunctionType */: + case 279 /* SyntaxKind.MissingDeclaration */: return true; default: - if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return false; } switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - return nodeHasAnyModifiersExcept(node, 131 /* SyntaxKind.AsyncKeyword */); - case 257 /* SyntaxKind.ClassDeclaration */: - case 180 /* SyntaxKind.ConstructorType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + return nodeHasAnyModifiersExcept(node, 132 /* SyntaxKind.AsyncKeyword */); + case 260 /* SyntaxKind.ClassDeclaration */: + case 182 /* SyntaxKind.ConstructorType */: return nodeHasAnyModifiersExcept(node, 126 /* SyntaxKind.AbstractKeyword */); - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return nodeHasAnyModifiersExcept(node, 85 /* SyntaxKind.ConstKeyword */); default: ts.Debug.assertNever(node); @@ -89276,10 +89846,10 @@ var ts; } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return false; } return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); @@ -89508,20 +90078,20 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.kind !== 164 /* SyntaxKind.ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 221 /* SyntaxKind.BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { + if (computedPropertyName.expression.kind === 223 /* SyntaxKind.BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } return false; } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - node.kind === 213 /* SyntaxKind.FunctionExpression */ || - node.kind === 169 /* SyntaxKind.MethodDeclaration */); + ts.Debug.assert(node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + node.kind === 215 /* SyntaxKind.FunctionExpression */ || + node.kind === 171 /* SyntaxKind.MethodDeclaration */); if (node.flags & 16777216 /* NodeFlags.Ambient */) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -89540,7 +90110,7 @@ var ts; var seen = new ts.Map(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 298 /* SyntaxKind.SpreadAssignment */) { + if (prop.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (inDestructuring) { // a rest property cannot be destructured any further var expression = ts.skipParentheses(prop.expression); @@ -89551,11 +90121,11 @@ var ts; continue; } var name = prop.name; - if (name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name); } - if (prop.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern); @@ -89567,7 +90137,7 @@ var ts; if (ts.canHaveModifiers(prop) && prop.modifiers) { for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { var mod = _c[_b]; - if (ts.isModifier(mod) && (mod.kind !== 131 /* SyntaxKind.AsyncKeyword */ || prop.kind !== 169 /* SyntaxKind.MethodDeclaration */)) { + if (ts.isModifier(mod) && (mod.kind !== 132 /* SyntaxKind.AsyncKeyword */ || prop.kind !== 171 /* SyntaxKind.MethodDeclaration */)) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } } @@ -89588,8 +90158,8 @@ var ts; // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = void 0; switch (prop.kind) { - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidExclamationToken(prop.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); @@ -89598,13 +90168,13 @@ var ts; } currentKind = 4 /* DeclarationMeaning.PropertyAssignment */; break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: currentKind = 8 /* DeclarationMeaning.Method */; break; - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: currentKind = 1 /* DeclarationMeaning.GetAccessor */; break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: currentKind = 2 /* DeclarationMeaning.SetAccessor */; break; default: @@ -89647,7 +90217,7 @@ var ts; var seen = new ts.Map(); for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 287 /* SyntaxKind.JsxSpreadAttribute */) { + if (attr.kind === 290 /* SyntaxKind.JsxSpreadAttribute */) { continue; } var name = attr.name, initializer = attr.initializer; @@ -89657,7 +90227,7 @@ var ts; else { return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } - if (initializer && initializer.kind === 288 /* SyntaxKind.JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 291 /* SyntaxKind.JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -89692,7 +90262,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.kind === 244 /* SyntaxKind.ForOfStatement */ && forInOrOfStatement.awaitModifier) { + if (forInOrOfStatement.kind === 247 /* SyntaxKind.ForOfStatement */ && forInOrOfStatement.awaitModifier) { if (!(forInOrOfStatement.flags & 32768 /* NodeFlags.AwaitContext */)) { var sourceFile = ts.getSourceFileOfNode(forInOrOfStatement); if (ts.isInTopLevelContext(forInOrOfStatement)) { @@ -89726,7 +90296,7 @@ var ts; if (!hasParseDiagnostics(sourceFile)) { var diagnostic = ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); var func = ts.getContainingFunction(forInOrOfStatement); - if (func && func.kind !== 171 /* SyntaxKind.Constructor */) { + if (func && func.kind !== 173 /* SyntaxKind.Constructor */) { ts.Debug.assert((ts.getFunctionFlags(func) & 2 /* FunctionFlags.Async */) === 0, "Enclosing function should never be an async function."); var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); ts.addRelatedInfo(diagnostic, relatedInfo); @@ -89743,7 +90313,7 @@ var ts; grammarErrorOnNode(forInOrOfStatement.initializer, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async); return false; } - if (forInOrOfStatement.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -89758,20 +90328,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -89781,22 +90351,22 @@ var ts; return false; } function checkGrammarAccessor(accessor) { - if (!(accessor.flags & 16777216 /* NodeFlags.Ambient */) && (accessor.parent.kind !== 182 /* SyntaxKind.TypeLiteral */) && (accessor.parent.kind !== 258 /* SyntaxKind.InterfaceDeclaration */)) { + if (!(accessor.flags & 16777216 /* NodeFlags.Ambient */) && (accessor.parent.kind !== 184 /* SyntaxKind.TypeLiteral */) && (accessor.parent.kind !== 261 /* SyntaxKind.InterfaceDeclaration */)) { if (languageVersion < 1 /* ScriptTarget.ES5 */) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); } if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isPrivateIdentifier(accessor.name)) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } - if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 128 /* ModifierFlags.Abstract */)) { + if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 256 /* ModifierFlags.Abstract */)) { return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } if (accessor.body) { - if (ts.hasSyntacticModifier(accessor, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(accessor, 256 /* ModifierFlags.Abstract */)) { return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); } - if (accessor.parent.kind === 182 /* SyntaxKind.TypeLiteral */ || accessor.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (accessor.parent.kind === 184 /* SyntaxKind.TypeLiteral */ || accessor.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return grammarErrorOnNode(accessor.body, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } } @@ -89804,11 +90374,11 @@ var ts; return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } if (!doesAccessorHaveCorrectParameterCount(accessor)) { - return grammarErrorOnNode(accessor.name, accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? + return grammarErrorOnNode(accessor.name, accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? ts.Diagnostics.A_get_accessor_cannot_have_parameters : ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - if (accessor.kind === 173 /* SyntaxKind.SetAccessor */) { + if (accessor.kind === 175 /* SyntaxKind.SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -89830,17 +90400,17 @@ var ts; * A set accessor has one parameter or a `this` parameter and one more parameter. */ function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? 1 : 2)) { + if (accessor.parameters.length === (accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? 1 : 2)) { return ts.getThisParameter(accessor); } } function checkGrammarTypeOperatorNode(node) { - if (node.operator === 154 /* SyntaxKind.UniqueKeyword */) { - if (node.type.kind !== 151 /* SyntaxKind.SymbolKeyword */) { - return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(151 /* SyntaxKind.SymbolKeyword */)); + if (node.operator === 156 /* SyntaxKind.UniqueKeyword */) { + if (node.type.kind !== 153 /* SyntaxKind.SymbolKeyword */) { + return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(153 /* SyntaxKind.SymbolKeyword */)); } var parent = ts.walkUpParenthesizedTypes(node.parent); if (ts.isInJSFile(parent) && ts.isJSDocTypeExpression(parent)) { @@ -89850,7 +90420,7 @@ var ts; } } switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: var decl = parent; if (decl.name.kind !== 79 /* SyntaxKind.Identifier */) { return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name); @@ -89862,13 +90432,13 @@ var ts; return grammarErrorOnNode(parent.name, ts.Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const); } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (!ts.isStatic(parent) || !ts.hasEffectiveReadonlyModifier(parent)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly); } break; - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (!ts.hasSyntacticModifier(parent, 64 /* ModifierFlags.Readonly */)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly); } @@ -89877,9 +90447,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_are_not_allowed_here); } } - else if (node.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { - if (node.type.kind !== 183 /* SyntaxKind.ArrayType */ && node.type.kind !== 184 /* SyntaxKind.TupleType */) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(151 /* SyntaxKind.SymbolKeyword */)); + else if (node.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { + if (node.type.kind !== 185 /* SyntaxKind.ArrayType */ && node.type.kind !== 186 /* SyntaxKind.TupleType */) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(153 /* SyntaxKind.SymbolKeyword */)); } } } @@ -89892,10 +90462,10 @@ var ts; if (checkGrammarFunctionLikeDeclaration(node)) { return true; } - if (node.kind === 169 /* SyntaxKind.MethodDeclaration */) { - if (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (node.kind === 171 /* SyntaxKind.MethodDeclaration */) { + if (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // We only disallow modifier on a method declaration if it is a property of object-literal-expression - if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 131 /* SyntaxKind.AsyncKeyword */)) { + if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 132 /* SyntaxKind.AsyncKeyword */)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } else if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { @@ -89924,14 +90494,14 @@ var ts; if (node.flags & 16777216 /* NodeFlags.Ambient */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.kind === 169 /* SyntaxKind.MethodDeclaration */ && !node.body) { + else if (node.kind === 171 /* SyntaxKind.MethodDeclaration */ && !node.body) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } - else if (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + else if (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.parent.kind === 182 /* SyntaxKind.TypeLiteral */) { + else if (node.parent.kind === 184 /* SyntaxKind.TypeLiteral */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } @@ -89942,11 +90512,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: if (node.label && current.label.escapedText === node.label.escapedText) { // found matching label - verify that label usage is correct // continue can only target labels that are on iteration statements - var isMisplacedContinueLabel = node.kind === 245 /* SyntaxKind.ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 248 /* SyntaxKind.ContinueStatement */ && !ts.isIterationStatement(current.statement, /*lookInLabeledStatement*/ true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -89954,8 +90524,8 @@ var ts; return false; } break; - case 249 /* SyntaxKind.SwitchStatement */: - if (node.kind === 246 /* SyntaxKind.BreakStatement */ && !node.label) { + case 252 /* SyntaxKind.SwitchStatement */: + if (node.kind === 249 /* SyntaxKind.BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -89970,13 +90540,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 246 /* SyntaxKind.BreakStatement */ + var message = node.kind === 249 /* SyntaxKind.BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 246 /* SyntaxKind.BreakStatement */ + var message = node.kind === 249 /* SyntaxKind.BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -90000,12 +90570,12 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return ts.isStringOrNumericLiteralLike(expr) || - expr.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && + expr.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 8 /* SyntaxKind.NumericLiteral */; } function isBigIntLiteralExpression(expr) { return expr.kind === 9 /* SyntaxKind.BigIntLiteral */ || - expr.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && + expr.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 9 /* SyntaxKind.BigIntLiteral */; } function isSimpleLiteralEnumReference(expr) { @@ -90033,7 +90603,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */ && node.parent.parent.kind !== 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */ && node.parent.parent.kind !== 247 /* SyntaxKind.ForOfStatement */) { if (node.flags & 16777216 /* NodeFlags.Ambient */) { checkAmbientInitializer(node); } @@ -90046,7 +90616,7 @@ var ts; } } } - if (node.exclamationToken && (node.parent.parent.kind !== 237 /* SyntaxKind.VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* NodeFlags.Ambient */)) { + if (node.exclamationToken && (node.parent.parent.kind !== 240 /* SyntaxKind.VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* NodeFlags.Ambient */)) { var message = node.initializer ? ts.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type @@ -90113,15 +90683,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return false; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -90215,8 +90785,14 @@ var ts; if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isPrivateIdentifier(node.name)) { return grammarErrorOnNode(node.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } + if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isAutoAccessorPropertyDeclaration(node)) { + return grammarErrorOnNode(node.name, ts.Diagnostics.Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher); + } + if (ts.isAutoAccessorPropertyDeclaration(node) && checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_accessor_property_cannot_be_declared_optional)) { + return true; + } } - else if (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + else if (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) { return true; } @@ -90262,14 +90838,14 @@ var ts; // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */ || - node.kind === 266 /* SyntaxKind.ImportDeclaration */ || - node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ || - node.kind === 272 /* SyntaxKind.ExportDeclaration */ || - node.kind === 271 /* SyntaxKind.ExportAssignment */ || - node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ || - ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */ | 1 /* ModifierFlags.Export */ | 512 /* ModifierFlags.Default */)) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */ || + node.kind === 269 /* SyntaxKind.ImportDeclaration */ || + node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ || + node.kind === 275 /* SyntaxKind.ExportDeclaration */ || + node.kind === 274 /* SyntaxKind.ExportAssignment */ || + node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ || + ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */ | 1 /* ModifierFlags.Export */ | 1024 /* ModifierFlags.Default */)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier); @@ -90277,7 +90853,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 237 /* SyntaxKind.VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 240 /* SyntaxKind.VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -90300,7 +90876,7 @@ var ts; // to prevent noisiness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 235 /* SyntaxKind.Block */ || node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.parent.kind === 238 /* SyntaxKind.Block */ || node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { var links_2 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_2.hasReportedStatementInAmbientContext) { @@ -90322,10 +90898,10 @@ var ts; if (languageVersion >= 1 /* ScriptTarget.ES5 */) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 196 /* SyntaxKind.LiteralType */)) { + else if (ts.isChildOfNodeWithKind(node, 198 /* SyntaxKind.LiteralType */)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 299 /* SyntaxKind.EnumMember */)) { + else if (ts.isChildOfNodeWithKind(node, 302 /* SyntaxKind.EnumMember */)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -90397,7 +90973,7 @@ var ts; if (node.isTypeOnly && node.name && node.namedBindings) { return grammarErrorOnNode(node, ts.Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both); } - if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 269 /* SyntaxKind.NamedImports */) { + if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 272 /* SyntaxKind.NamedImports */) { return checkGrammarNamedImportsOrExports(node.namedBindings); } return false; @@ -90405,7 +90981,7 @@ var ts; function checkGrammarNamedImportsOrExports(namedBindings) { return !!ts.forEach(namedBindings.elements, function (specifier) { if (specifier.isTypeOnly) { - return grammarErrorOnFirstToken(specifier, specifier.kind === 270 /* SyntaxKind.ImportSpecifier */ + return grammarErrorOnFirstToken(specifier, specifier.kind === 273 /* SyntaxKind.ImportSpecifier */ ? ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement : ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement); } @@ -90419,7 +90995,7 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments); } var nodeArguments = node.arguments; - if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext) { + if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext && moduleKind !== ts.ModuleKind.Node16) { // We are allowed trailing comma after proposal-import-assertions. checkGrammarForDisallowedTrailingComma(nodeArguments); if (nodeArguments.length > 1) { @@ -90528,14 +91104,14 @@ var ts; return !ts.isAccessor(declaration); } function isNotOverload(declaration) { - return (declaration.kind !== 256 /* SyntaxKind.FunctionDeclaration */ && declaration.kind !== 169 /* SyntaxKind.MethodDeclaration */) || + return (declaration.kind !== 259 /* SyntaxKind.FunctionDeclaration */ && declaration.kind !== 171 /* SyntaxKind.MethodDeclaration */) || !!declaration.body; } /** Like 'isDeclarationName', but returns true for LHS of `import { x as y }` or `export { x as y }`. */ function isDeclarationNameOrImportPropertyName(name) { switch (name.parent.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return ts.isIdentifier(name); default: return ts.isDeclarationName(name); @@ -90571,6 +91147,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { + var _a; function visitNode(node, visitor, test, lift) { if (node === undefined || visitor === undefined) { return node; @@ -90637,7 +91214,6 @@ var ts; return nodes; } ts.visitNodes = visitNodes; - /* @internal */ function visitArray(nodes, visitor, test, start, count) { if (nodes === undefined) { return nodes; @@ -90785,12 +91361,10 @@ var ts; return updated; } ts.visitFunctionBody = visitFunctionBody; - /** - * Visits an iteration body, adding any block-scoped variables required by the transformation. - */ - function visitIterationBody(body, visitor, context) { + function visitIterationBody(body, visitor, context, nodeVisitor) { + if (nodeVisitor === void 0) { nodeVisitor = visitNode; } context.startBlockScope(); - var updated = visitNode(body, visitor, ts.isStatement, context.factory.liftToBlock); + var updated = nodeVisitor(body, visitor, ts.isStatement, context.factory.liftToBlock); var declarations = context.endBlockScope(); if (ts.some(declarations)) { if (ts.isBlock(updated)) { @@ -90809,456 +91383,446 @@ var ts; if (node === undefined) { return undefined; } - var kind = node.kind; - // No need to visit nodes with no children. - if ((kind > 0 /* SyntaxKind.FirstToken */ && kind <= 160 /* SyntaxKind.LastToken */) || kind === 192 /* SyntaxKind.ThisType */) { - return node; - } - var factory = context.factory; - switch (kind) { - // Names - case 79 /* SyntaxKind.Identifier */: - ts.Debug.type(node); - return factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration)); - case 161 /* SyntaxKind.QualifiedName */: - ts.Debug.type(node); - return factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier)); - case 162 /* SyntaxKind.ComputedPropertyName */: - ts.Debug.type(node); - return factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Signature elements - case 163 /* SyntaxKind.TypeParameter */: - ts.Debug.type(node); - return factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode)); - case 164 /* SyntaxKind.Parameter */: - ts.Debug.type(node); - return factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 165 /* SyntaxKind.Decorator */: - ts.Debug.type(node); - return factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Type elements - case 166 /* SyntaxKind.PropertySignature */: - ts.Debug.type(node); - return factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 167 /* SyntaxKind.PropertyDeclaration */: - ts.Debug.type(node); - return factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), - // QuestionToken and ExclamationToken is uniqued in Property Declaration and the signature of 'updateProperty' is that too - nodeVisitor(node.questionToken || node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 168 /* SyntaxKind.MethodSignature */: - ts.Debug.type(node); - return factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 169 /* SyntaxKind.MethodDeclaration */: - ts.Debug.type(node); - return factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 171 /* SyntaxKind.Constructor */: - ts.Debug.type(node); - return factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 172 /* SyntaxKind.GetAccessor */: - ts.Debug.type(node); - return factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 173 /* SyntaxKind.SetAccessor */: - ts.Debug.type(node); - return factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - ts.Debug.type(node); - context.startLexicalEnvironment(); - context.suspendLexicalEnvironment(); - return factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 174 /* SyntaxKind.CallSignature */: - ts.Debug.type(node); - return factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 175 /* SyntaxKind.ConstructSignature */: - ts.Debug.type(node); - return factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 176 /* SyntaxKind.IndexSignature */: - ts.Debug.type(node); - return factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - // Types - case 177 /* SyntaxKind.TypePredicate */: - ts.Debug.type(node); - return factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 178 /* SyntaxKind.TypeReference */: - ts.Debug.type(node); - return factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 179 /* SyntaxKind.FunctionType */: - ts.Debug.type(node); - return factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 180 /* SyntaxKind.ConstructorType */: - ts.Debug.type(node); - return factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 181 /* SyntaxKind.TypeQuery */: - ts.Debug.type(node); - return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 182 /* SyntaxKind.TypeLiteral */: - ts.Debug.type(node); - return factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 183 /* SyntaxKind.ArrayType */: - ts.Debug.type(node); - return factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode)); - case 184 /* SyntaxKind.TupleType */: - ts.Debug.type(node); - return factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode)); - case 185 /* SyntaxKind.OptionalType */: - ts.Debug.type(node); - return factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 186 /* SyntaxKind.RestType */: - ts.Debug.type(node); - return factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 187 /* SyntaxKind.UnionType */: - ts.Debug.type(node); - return factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 188 /* SyntaxKind.IntersectionType */: - ts.Debug.type(node); - return factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 189 /* SyntaxKind.ConditionalType */: - ts.Debug.type(node); - return factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode)); - case 190 /* SyntaxKind.InferType */: - ts.Debug.type(node); - return factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); - case 200 /* SyntaxKind.ImportType */: - ts.Debug.type(node); - return factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isNode), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); - case 295 /* SyntaxKind.ImportTypeAssertionContainer */: - ts.Debug.type(node); - return factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isNode), node.multiLine); - case 197 /* SyntaxKind.NamedTupleMember */: - ts.Debug.type(node); - return factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 191 /* SyntaxKind.ParenthesizedType */: - ts.Debug.type(node); - return factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 193 /* SyntaxKind.TypeOperator */: - ts.Debug.type(node); - return factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 194 /* SyntaxKind.IndexedAccessType */: - ts.Debug.type(node); - return factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode)); - case 195 /* SyntaxKind.MappedType */: - ts.Debug.type(node); - return factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 196 /* SyntaxKind.LiteralType */: - ts.Debug.type(node); - return factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression)); - case 198 /* SyntaxKind.TemplateLiteralType */: - ts.Debug.type(node); - return factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan)); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: - ts.Debug.type(node); - return factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - // Binding patterns - case 201 /* SyntaxKind.ObjectBindingPattern */: - ts.Debug.type(node); - return factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); - case 202 /* SyntaxKind.ArrayBindingPattern */: - ts.Debug.type(node); - return factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); - case 203 /* SyntaxKind.BindingElement */: - ts.Debug.type(node); - return factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - // Expression - case 204 /* SyntaxKind.ArrayLiteralExpression */: - ts.Debug.type(node); - return factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - case 205 /* SyntaxKind.ObjectLiteralExpression */: - ts.Debug.type(node); - return factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); - case 206 /* SyntaxKind.PropertyAccessExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName)); - } - ts.Debug.type(node); - return factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName)); - case 207 /* SyntaxKind.ElementAccessExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); - case 208 /* SyntaxKind.CallExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 209 /* SyntaxKind.NewExpression */: - ts.Debug.type(node); - return factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - ts.Debug.type(node); - return factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral)); - case 211 /* SyntaxKind.TypeAssertionExpression */: - ts.Debug.type(node); - return factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 212 /* SyntaxKind.ParenthesizedExpression */: - ts.Debug.type(node); - return factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 213 /* SyntaxKind.FunctionExpression */: - ts.Debug.type(node); - return factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 214 /* SyntaxKind.ArrowFunction */: - ts.Debug.type(node); - return factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 215 /* SyntaxKind.DeleteExpression */: - ts.Debug.type(node); - return factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 216 /* SyntaxKind.TypeOfExpression */: - ts.Debug.type(node); - return factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 217 /* SyntaxKind.VoidExpression */: - ts.Debug.type(node); - return factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 218 /* SyntaxKind.AwaitExpression */: - ts.Debug.type(node); - return factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - ts.Debug.type(node); - return factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - ts.Debug.type(node); - return factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); - case 221 /* SyntaxKind.BinaryExpression */: - ts.Debug.type(node); - return factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression)); - case 222 /* SyntaxKind.ConditionalExpression */: - ts.Debug.type(node); - return factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression)); - case 223 /* SyntaxKind.TemplateExpression */: - ts.Debug.type(node); - return factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); - case 224 /* SyntaxKind.YieldExpression */: - ts.Debug.type(node); - return factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 225 /* SyntaxKind.SpreadElement */: - ts.Debug.type(node); - return factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 226 /* SyntaxKind.ClassExpression */: - ts.Debug.type(node); - return factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - ts.Debug.type(node); - return factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 229 /* SyntaxKind.AsExpression */: - ts.Debug.type(node); - return factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 230 /* SyntaxKind.NonNullExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 231 /* SyntaxKind.MetaProperty */: - ts.Debug.type(node); - return factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - // Misc - case 233 /* SyntaxKind.TemplateSpan */: - ts.Debug.type(node); - return factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - // Element - case 235 /* SyntaxKind.Block */: - ts.Debug.type(node); - return factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 237 /* SyntaxKind.VariableStatement */: - ts.Debug.type(node); - return factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 238 /* SyntaxKind.ExpressionStatement */: - ts.Debug.type(node); - return factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 239 /* SyntaxKind.IfStatement */: - ts.Debug.type(node); - return factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, factory.liftToBlock)); - case 240 /* SyntaxKind.DoStatement */: - ts.Debug.type(node); - return factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 241 /* SyntaxKind.WhileStatement */: - ts.Debug.type(node); - return factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 242 /* SyntaxKind.ForStatement */: - ts.Debug.type(node); - return factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 243 /* SyntaxKind.ForInStatement */: - ts.Debug.type(node); - return factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 244 /* SyntaxKind.ForOfStatement */: - ts.Debug.type(node); - return factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 245 /* SyntaxKind.ContinueStatement */: - ts.Debug.type(node); - return factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); - case 246 /* SyntaxKind.BreakStatement */: - ts.Debug.type(node); - return factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); - case 247 /* SyntaxKind.ReturnStatement */: - ts.Debug.type(node); - return factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 248 /* SyntaxKind.WithStatement */: - ts.Debug.type(node); - return factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock)); - case 249 /* SyntaxKind.SwitchStatement */: - ts.Debug.type(node); - return factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock)); - case 250 /* SyntaxKind.LabeledStatement */: - ts.Debug.type(node); - return factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock)); - case 251 /* SyntaxKind.ThrowStatement */: - ts.Debug.type(node); - return factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 252 /* SyntaxKind.TryStatement */: - ts.Debug.type(node); - return factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock)); - case 254 /* SyntaxKind.VariableDeclaration */: - ts.Debug.type(node); - return factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 255 /* SyntaxKind.VariableDeclarationList */: - ts.Debug.type(node); - return factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); - case 256 /* SyntaxKind.FunctionDeclaration */: - ts.Debug.type(node); - return factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 257 /* SyntaxKind.ClassDeclaration */: - ts.Debug.type(node); - return factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 258 /* SyntaxKind.InterfaceDeclaration */: - ts.Debug.type(node); - return factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 259 /* SyntaxKind.TypeAliasDeclaration */: - ts.Debug.type(node); - return factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 260 /* SyntaxKind.EnumDeclaration */: - ts.Debug.type(node); - return factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); - case 261 /* SyntaxKind.ModuleDeclaration */: - ts.Debug.type(node); - return factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody)); - case 262 /* SyntaxKind.ModuleBlock */: - ts.Debug.type(node); - return factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 263 /* SyntaxKind.CaseBlock */: - ts.Debug.type(node); - return factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - ts.Debug.type(node); - return factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - ts.Debug.type(node); - return factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference)); - case 266 /* SyntaxKind.ImportDeclaration */: - ts.Debug.type(node); - return factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); - case 293 /* SyntaxKind.AssertClause */: - ts.Debug.type(node); - return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine); - case 294 /* SyntaxKind.AssertEntry */: - ts.Debug.type(node); - return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode)); - case 267 /* SyntaxKind.ImportClause */: - ts.Debug.type(node); - return factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings)); - case 268 /* SyntaxKind.NamespaceImport */: - ts.Debug.type(node); - return factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 274 /* SyntaxKind.NamespaceExport */: - ts.Debug.type(node); - return factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 269 /* SyntaxKind.NamedImports */: - ts.Debug.type(node); - return factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); - case 270 /* SyntaxKind.ImportSpecifier */: - ts.Debug.type(node); - return factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 271 /* SyntaxKind.ExportAssignment */: - ts.Debug.type(node); - return factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 272 /* SyntaxKind.ExportDeclaration */: - ts.Debug.type(node); - return factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); - case 273 /* SyntaxKind.NamedExports */: - ts.Debug.type(node); - return factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); - case 275 /* SyntaxKind.ExportSpecifier */: - ts.Debug.type(node); - return factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); - // Module references - case 277 /* SyntaxKind.ExternalModuleReference */: - ts.Debug.type(node); - return factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // JSX - case 278 /* SyntaxKind.JsxElement */: - ts.Debug.type(node); - return factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement)); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - ts.Debug.type(node); - return factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); - case 280 /* SyntaxKind.JsxOpeningElement */: - ts.Debug.type(node); - return factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); - case 281 /* SyntaxKind.JsxClosingElement */: - ts.Debug.type(node); - return factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 282 /* SyntaxKind.JsxFragment */: - ts.Debug.type(node); - return factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment)); - case 285 /* SyntaxKind.JsxAttribute */: - ts.Debug.type(node); - return factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 286 /* SyntaxKind.JsxAttributes */: - ts.Debug.type(node); - return factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); - case 287 /* SyntaxKind.JsxSpreadAttribute */: - ts.Debug.type(node); - return factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 288 /* SyntaxKind.JsxExpression */: - ts.Debug.type(node); - return factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Clauses - case 289 /* SyntaxKind.CaseClause */: - ts.Debug.type(node); - return factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); - case 290 /* SyntaxKind.DefaultClause */: - ts.Debug.type(node); - return factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 291 /* SyntaxKind.HeritageClause */: - ts.Debug.type(node); - return factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 292 /* SyntaxKind.CatchClause */: - ts.Debug.type(node); - return factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock)); - // Property assignments - case 296 /* SyntaxKind.PropertyAssignment */: - ts.Debug.type(node); - return factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - ts.Debug.type(node); - return factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 298 /* SyntaxKind.SpreadAssignment */: - ts.Debug.type(node); - return factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Enum - case 299 /* SyntaxKind.EnumMember */: - ts.Debug.type(node); - return factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - // Top-level nodes - case 305 /* SyntaxKind.SourceFile */: - ts.Debug.type(node); - return factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context)); - // Transformation nodes - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - ts.Debug.type(node); - return factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 351 /* SyntaxKind.CommaListExpression */: - ts.Debug.type(node); - return factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - default: - // No need to visit nodes with no children. - return node; - } + var fn = visitEachChildTable[node.kind]; + return fn === undefined ? node : fn(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor); } ts.visitEachChild = visitEachChild; + // NOTE: Before you can add a new method to `visitEachChildTable`, you must first ensure the `Node` subtype you + // wish to add is defined in the `HasChildren` union in types.ts. + var visitEachChildTable = (_a = {}, + _a[79 /* SyntaxKind.Identifier */] = function visitEachChildOfIdentifier(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration)); + }, + _a[163 /* SyntaxKind.QualifiedName */] = function visitEachChildOfQualifiedName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier)); + }, + _a[164 /* SyntaxKind.ComputedPropertyName */] = function visitEachChildOfComputedPropertyName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Signature elements + _a[165 /* SyntaxKind.TypeParameter */] = function visitEachChildOfTypeParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode)); + }, + _a[166 /* SyntaxKind.Parameter */] = function visitEachChildOfParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[167 /* SyntaxKind.Decorator */] = function visitEachChildOfDecorator(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Type elements + _a[168 /* SyntaxKind.PropertySignature */] = function visitEachChildOfPropertySignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[169 /* SyntaxKind.PropertyDeclaration */] = function visitEachChildOfPropertyDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + var _a; + return context.factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), + // QuestionToken and ExclamationToken are mutually exclusive in PropertyDeclaration + nodeVisitor((_a = node.questionToken) !== null && _a !== void 0 ? _a : node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[170 /* SyntaxKind.MethodSignature */] = function visitEachChildOfMethodSignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[171 /* SyntaxKind.MethodDeclaration */] = function visitEachChildOfMethodDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[173 /* SyntaxKind.Constructor */] = function visitEachChildOfConstructorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[174 /* SyntaxKind.GetAccessor */] = function visitEachChildOfGetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[175 /* SyntaxKind.SetAccessor */] = function visitEachChildOfSetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[172 /* SyntaxKind.ClassStaticBlockDeclaration */] = function visitEachChildOfClassStaticBlockDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + context.startLexicalEnvironment(); + context.suspendLexicalEnvironment(); + return context.factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[176 /* SyntaxKind.CallSignature */] = function visitEachChildOfCallSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[177 /* SyntaxKind.ConstructSignature */] = function visitEachChildOfConstructSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[178 /* SyntaxKind.IndexSignature */] = function visitEachChildOfIndexSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + // Types + _a[179 /* SyntaxKind.TypePredicate */] = function visitEachChildOfTypePredicateNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[180 /* SyntaxKind.TypeReference */] = function visitEachChildOfTypeReferenceNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[181 /* SyntaxKind.FunctionType */] = function visitEachChildOfFunctionTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[182 /* SyntaxKind.ConstructorType */] = function visitEachChildOfConstructorTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[183 /* SyntaxKind.TypeQuery */] = function visitEachChildOfTypeQueryNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[184 /* SyntaxKind.TypeLiteral */] = function visitEachChildOfTypeLiteralNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[185 /* SyntaxKind.ArrayType */] = function visitEachChildOfArrayTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode)); + }, + _a[186 /* SyntaxKind.TupleType */] = function visitEachChildOfTupleTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode)); + }, + _a[187 /* SyntaxKind.OptionalType */] = function visitEachChildOfOptionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[188 /* SyntaxKind.RestType */] = function visitEachChildOfRestTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[189 /* SyntaxKind.UnionType */] = function visitEachChildOfUnionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + }, + _a[190 /* SyntaxKind.IntersectionType */] = function visitEachChildOfIntersectionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + }, + _a[191 /* SyntaxKind.ConditionalType */] = function visitEachChildOfConditionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode)); + }, + _a[192 /* SyntaxKind.InferType */] = function visitEachChildOfInferTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); + }, + _a[202 /* SyntaxKind.ImportType */] = function visitEachChildOfImportTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isImportTypeAssertionContainer), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); + }, + _a[298 /* SyntaxKind.ImportTypeAssertionContainer */] = function visitEachChildOfImportTypeAssertionContainer(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isAssertClause), node.multiLine); + }, + _a[199 /* SyntaxKind.NamedTupleMember */] = function visitEachChildOfNamedTupleMember(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[193 /* SyntaxKind.ParenthesizedType */] = function visitEachChildOfParenthesizedType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[195 /* SyntaxKind.TypeOperator */] = function visitEachChildOfTypeOperatorNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[196 /* SyntaxKind.IndexedAccessType */] = function visitEachChildOfIndexedAccessType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode)); + }, + _a[197 /* SyntaxKind.MappedType */] = function visitEachChildOfMappedType(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[198 /* SyntaxKind.LiteralType */] = function visitEachChildOfLiteralTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression)); + }, + _a[200 /* SyntaxKind.TemplateLiteralType */] = function visitEachChildOfTemplateLiteralType(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan)); + }, + _a[201 /* SyntaxKind.TemplateLiteralTypeSpan */] = function visitEachChildOfTemplateLiteralTypeSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + }, + // Binding patterns + _a[203 /* SyntaxKind.ObjectBindingPattern */] = function visitEachChildOfObjectBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); + }, + _a[204 /* SyntaxKind.ArrayBindingPattern */] = function visitEachChildOfArrayBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); + }, + _a[205 /* SyntaxKind.BindingElement */] = function visitEachChildOfBindingElement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + // Expression + _a[206 /* SyntaxKind.ArrayLiteralExpression */] = function visitEachChildOfArrayLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + }, + _a[207 /* SyntaxKind.ObjectLiteralExpression */] = function visitEachChildOfObjectLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); + }, + _a[208 /* SyntaxKind.PropertyAccessExpression */] = function visitEachChildOfPropertyAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isPropertyAccessChain(node) ? + context.factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName)) : + context.factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName)); + }, + _a[209 /* SyntaxKind.ElementAccessExpression */] = function visitEachChildOfElementAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isElementAccessChain(node) ? + context.factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)) : + context.factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); + }, + _a[210 /* SyntaxKind.CallExpression */] = function visitEachChildOfCallExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isCallChain(node) ? + context.factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)) : + context.factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + }, + _a[211 /* SyntaxKind.NewExpression */] = function visitEachChildOfNewExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + }, + _a[212 /* SyntaxKind.TaggedTemplateExpression */] = function visitEachChildOfTaggedTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral)); + }, + _a[213 /* SyntaxKind.TypeAssertionExpression */] = function visitEachChildOfTypeAssertionExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[214 /* SyntaxKind.ParenthesizedExpression */] = function visitEachChildOfParenthesizedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[215 /* SyntaxKind.FunctionExpression */] = function visitEachChildOfFunctionExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[216 /* SyntaxKind.ArrowFunction */] = function visitEachChildOfArrowFunction(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[217 /* SyntaxKind.DeleteExpression */] = function visitEachChildOfDeleteExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[218 /* SyntaxKind.TypeOfExpression */] = function visitEachChildOfTypeOfExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[219 /* SyntaxKind.VoidExpression */] = function visitEachChildOfVoidExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[220 /* SyntaxKind.AwaitExpression */] = function visitEachChildOfAwaitExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[221 /* SyntaxKind.PrefixUnaryExpression */] = function visitEachChildOfPrefixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); + }, + _a[222 /* SyntaxKind.PostfixUnaryExpression */] = function visitEachChildOfPostfixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); + }, + _a[223 /* SyntaxKind.BinaryExpression */] = function visitEachChildOfBinaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression)); + }, + _a[224 /* SyntaxKind.ConditionalExpression */] = function visitEachChildOfConditionalExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression)); + }, + _a[225 /* SyntaxKind.TemplateExpression */] = function visitEachChildOfTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); + }, + _a[226 /* SyntaxKind.YieldExpression */] = function visitEachChildOfYieldExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[227 /* SyntaxKind.SpreadElement */] = function visitEachChildOfSpreadElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[228 /* SyntaxKind.ClassExpression */] = function visitEachChildOfClassExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + }, + _a[230 /* SyntaxKind.ExpressionWithTypeArguments */] = function visitEachChildOfExpressionWithTypeArguments(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[231 /* SyntaxKind.AsExpression */] = function visitEachChildOfAsExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[235 /* SyntaxKind.SatisfiesExpression */] = function visitEachChildOfSatisfiesExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSatisfiesExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[232 /* SyntaxKind.NonNullExpression */] = function visitEachChildOfNonNullExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return ts.isOptionalChain(node) ? + context.factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression)) : + context.factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[233 /* SyntaxKind.MetaProperty */] = function visitEachChildOfMetaProperty(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + // Misc + _a[236 /* SyntaxKind.TemplateSpan */] = function visitEachChildOfTemplateSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + }, + // Element + _a[238 /* SyntaxKind.Block */] = function visitEachChildOfBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[240 /* SyntaxKind.VariableStatement */] = function visitEachChildOfVariableStatement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList)); + }, + _a[241 /* SyntaxKind.ExpressionStatement */] = function visitEachChildOfExpressionStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[242 /* SyntaxKind.IfStatement */] = function visitEachChildOfIfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, context.factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[243 /* SyntaxKind.DoStatement */] = function visitEachChildOfDoStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context, nodeVisitor), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[244 /* SyntaxKind.WhileStatement */] = function visitEachChildOfWhileStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[245 /* SyntaxKind.ForStatement */] = function visitEachChildOfForStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[246 /* SyntaxKind.ForInStatement */] = function visitEachChildOfForInStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[247 /* SyntaxKind.ForOfStatement */] = function visitEachChildOfForOfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[248 /* SyntaxKind.ContinueStatement */] = function visitEachChildOfContinueStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); + }, + _a[249 /* SyntaxKind.BreakStatement */] = function visitEachChildOfBreakStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); + }, + _a[250 /* SyntaxKind.ReturnStatement */] = function visitEachChildOfReturnStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[251 /* SyntaxKind.WithStatement */] = function visitEachChildOfWithStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[252 /* SyntaxKind.SwitchStatement */] = function visitEachChildOfSwitchStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock)); + }, + _a[253 /* SyntaxKind.LabeledStatement */] = function visitEachChildOfLabeledStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[254 /* SyntaxKind.ThrowStatement */] = function visitEachChildOfThrowStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[255 /* SyntaxKind.TryStatement */] = function visitEachChildOfTryStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock)); + }, + _a[257 /* SyntaxKind.VariableDeclaration */] = function visitEachChildOfVariableDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[258 /* SyntaxKind.VariableDeclarationList */] = function visitEachChildOfVariableDeclarationList(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); + }, + _a[259 /* SyntaxKind.FunctionDeclaration */] = function visitEachChildOfFunctionDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[260 /* SyntaxKind.ClassDeclaration */] = function visitEachChildOfClassDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + }, + _a[261 /* SyntaxKind.InterfaceDeclaration */] = function visitEachChildOfInterfaceDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[262 /* SyntaxKind.TypeAliasDeclaration */] = function visitEachChildOfTypeAliasDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[263 /* SyntaxKind.EnumDeclaration */] = function visitEachChildOfEnumDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); + }, + _a[264 /* SyntaxKind.ModuleDeclaration */] = function visitEachChildOfModuleDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody)); + }, + _a[265 /* SyntaxKind.ModuleBlock */] = function visitEachChildOfModuleBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[266 /* SyntaxKind.CaseBlock */] = function visitEachChildOfCaseBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); + }, + _a[267 /* SyntaxKind.NamespaceExportDeclaration */] = function visitEachChildOfNamespaceExportDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[268 /* SyntaxKind.ImportEqualsDeclaration */] = function visitEachChildOfImportEqualsDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference)); + }, + _a[269 /* SyntaxKind.ImportDeclaration */] = function visitEachChildOfImportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); + }, + _a[296 /* SyntaxKind.AssertClause */] = function visitEachChildOfAssertClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine); + }, + _a[297 /* SyntaxKind.AssertEntry */] = function visitEachChildOfAssertEntry(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpression)); + }, + _a[270 /* SyntaxKind.ImportClause */] = function visitEachChildOfImportClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings)); + }, + _a[271 /* SyntaxKind.NamespaceImport */] = function visitEachChildOfNamespaceImport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[277 /* SyntaxKind.NamespaceExport */] = function visitEachChildOfNamespaceExport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[272 /* SyntaxKind.NamedImports */] = function visitEachChildOfNamedImports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); + }, + _a[273 /* SyntaxKind.ImportSpecifier */] = function visitEachChildOfImportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[274 /* SyntaxKind.ExportAssignment */] = function visitEachChildOfExportAssignment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[275 /* SyntaxKind.ExportDeclaration */] = function visitEachChildOfExportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); + }, + _a[276 /* SyntaxKind.NamedExports */] = function visitEachChildOfNamedExports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); + }, + _a[278 /* SyntaxKind.ExportSpecifier */] = function visitEachChildOfExportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + // Module references + _a[280 /* SyntaxKind.ExternalModuleReference */] = function visitEachChildOfExternalModuleReference(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // JSX + _a[281 /* SyntaxKind.JsxElement */] = function visitEachChildOfJsxElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement)); + }, + _a[282 /* SyntaxKind.JsxSelfClosingElement */] = function visitEachChildOfJsxSelfClosingElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); + }, + _a[283 /* SyntaxKind.JsxOpeningElement */] = function visitEachChildOfJsxOpeningElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); + }, + _a[284 /* SyntaxKind.JsxClosingElement */] = function visitEachChildOfJsxClosingElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression)); + }, + _a[285 /* SyntaxKind.JsxFragment */] = function visitEachChildOfJsxFragment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment)); + }, + _a[288 /* SyntaxKind.JsxAttribute */] = function visitEachChildOfJsxAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); + }, + _a[289 /* SyntaxKind.JsxAttributes */] = function visitEachChildOfJsxAttributes(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); + }, + _a[290 /* SyntaxKind.JsxSpreadAttribute */] = function visitEachChildOfJsxSpreadAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[291 /* SyntaxKind.JsxExpression */] = function visitEachChildOfJsxExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Clauses + _a[292 /* SyntaxKind.CaseClause */] = function visitEachChildOfCaseClause(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[293 /* SyntaxKind.DefaultClause */] = function visitEachChildOfDefaultClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[294 /* SyntaxKind.HeritageClause */] = function visitEachChildOfHeritageClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); + }, + _a[295 /* SyntaxKind.CatchClause */] = function visitEachChildOfCatchClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock)); + }, + // Property assignments + _a[299 /* SyntaxKind.PropertyAssignment */] = function visitEachChildOfPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[300 /* SyntaxKind.ShorthandPropertyAssignment */] = function visitEachChildOfShorthandPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression)); + }, + _a[301 /* SyntaxKind.SpreadAssignment */] = function visitEachChildOfSpreadAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Enum + _a[302 /* SyntaxKind.EnumMember */] = function visitEachChildOfEnumMember(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + // Top-level nodes + _a[308 /* SyntaxKind.SourceFile */] = function visitEachChildOfSourceFile(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context, /*start*/ undefined, /*ensureUseStrict*/ undefined, nodesVisitor)); + }, + // Transformation nodes + _a[353 /* SyntaxKind.PartiallyEmittedExpression */] = function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[354 /* SyntaxKind.CommaListExpression */] = function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + }, + _a); /** * Extracts the single node from a NodeArray. * @@ -91326,7 +91890,7 @@ var ts; exit(); return sourceIndex; } - /* eslint-disable boolean-trivia, no-null/no-null */ + /* eslint-disable local/boolean-trivia, no-null/no-null */ function setSourceContent(sourceIndex, content) { enter(); if (content !== null) { @@ -91339,7 +91903,7 @@ var ts; } exit(); } - /* eslint-enable boolean-trivia, no-null/no-null */ + /* eslint-enable local/boolean-trivia, no-null/no-null */ function addName(name) { enter(); if (!nameToNameIndexMap) @@ -91941,7 +92505,7 @@ var ts; function chainBundle(context, transformSourceFile) { return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -91992,7 +92556,7 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: // import "mod" // import x from "mod" // import * as x from "mod" @@ -92005,13 +92569,13 @@ var ts; hasImportDefault = true; } break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - if (node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + if (node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { // import x = require("mod") externalImports.push(node); } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -92042,13 +92606,13 @@ var ts; addExportedNamesForExportDeclaration(node); } break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; } break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { for (var _b = 0, _c = node.declarationList.declarations; _b < _c.length; _b++) { var decl = _c[_b]; @@ -92056,9 +92620,9 @@ var ts; } } break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - if (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { // export default function() { } if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); @@ -92076,9 +92640,9 @@ var ts; } } break; - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - if (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { // export default class { } if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); @@ -92256,7 +92820,7 @@ var ts; * @param isStatic A value indicating whether the member should be a static or instance member. */ function isInitializedProperty(member) { - return member.kind === 167 /* SyntaxKind.PropertyDeclaration */ + return member.kind === 169 /* SyntaxKind.PropertyDeclaration */ && member.initializer !== undefined; } ts.isInitializedProperty = isInitializedProperty; @@ -92266,7 +92830,7 @@ var ts; * @param member The class element node. */ function isNonStaticMethodOrAccessorWithPrivateName(member) { - return !ts.isStatic(member) && ts.isMethodOrAccessor(member) && ts.isPrivateIdentifier(member.name); + return !ts.isStatic(member) && (ts.isMethodOrAccessor(member) || ts.isAutoAccessorPropertyDeclaration(member)) && ts.isPrivateIdentifier(member.name); } ts.isNonStaticMethodOrAccessorWithPrivateName = isNonStaticMethodOrAccessorWithPrivateName; /** @@ -92320,12 +92884,12 @@ var ts; */ function getAllDecoratorsOfClassElement(member, parent) { switch (member.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return getAllDecoratorsOfAccessors(member, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return getAllDecoratorsOfMethod(member); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return getAllDecoratorsOfProperty(member); default: return undefined; @@ -92986,8 +93550,8 @@ var ts; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; // Enable substitution for property/element access to emit const enum values. - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // These variables contain state that changes as we descend into the tree. var currentSourceFile; var currentNamespace; @@ -93007,14 +93571,14 @@ var ts; var applicableSubstitutions; return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - if (node.kind === 306 /* SyntaxKind.Bundle */) { + if (node.kind === 309 /* SyntaxKind.Bundle */) { return transformBundle(node); } return transformSourceFile(node); } function transformBundle(node) { return factory.createBundle(node.sourceFiles.map(transformSourceFile), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 308 /* SyntaxKind.InputFiles */) { + if (prepend.kind === 311 /* SyntaxKind.InputFiles */) { return ts.createUnparsedSourceFile(prepend, "js"); } return prepend; @@ -93063,15 +93627,15 @@ var ts; */ function onBeforeVisitNode(node) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 263 /* SyntaxKind.CaseBlock */: - case 262 /* SyntaxKind.ModuleBlock */: - case 235 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 266 /* SyntaxKind.CaseBlock */: + case 265 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: currentLexicalScope = node; currentScopeFirstDeclarationsOfName = undefined; break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */)) { break; } @@ -93083,7 +93647,7 @@ var ts; // These nodes should always have names unless they are default-exports; // however, class declaration parsing allows for undefined names, so syntactically invalid // programs may also have an undefined name. - ts.Debug.assert(node.kind === 257 /* SyntaxKind.ClassDeclaration */ || ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)); + ts.Debug.assert(node.kind === 260 /* SyntaxKind.ClassDeclaration */ || ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)); } break; } @@ -93122,10 +93686,10 @@ var ts; */ function sourceElementVisitorWorker(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitElidableStatement(node); default: return visitorWorker(node); @@ -93146,13 +93710,13 @@ var ts; return node; } switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); default: ts.Debug.fail("Unhandled ellided statement"); @@ -93172,11 +93736,11 @@ var ts; * @param node The node to visit. */ function namespaceElementVisitorWorker(node) { - if (node.kind === 272 /* SyntaxKind.ExportDeclaration */ || - node.kind === 266 /* SyntaxKind.ImportDeclaration */ || - node.kind === 267 /* SyntaxKind.ImportClause */ || - (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && - node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */)) { + if (node.kind === 275 /* SyntaxKind.ExportDeclaration */ || + node.kind === 269 /* SyntaxKind.ImportDeclaration */ || + node.kind === 270 /* SyntaxKind.ImportClause */ || + (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && + node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */)) { // do not emit ES6 imports and exports since they are illegal inside a namespace return undefined; } @@ -93200,27 +93764,27 @@ var ts; */ function classElementVisitorWorker(node, parent) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return visitConstructor(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // Property declarations are not TypeScript syntax, but they must be visited // for the decorator transformation. return visitPropertyDeclaration(node, parent); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node, parent); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node, parent); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return ts.visitEachChild(node, visitor, context); - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: return node; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Index signatures are elided return; default: @@ -93232,17 +93796,17 @@ var ts; } function objectLiteralElementVisitorWorker(node, parent) { switch (node.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return visitor(node); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node, parent); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node, parent); @@ -93253,7 +93817,7 @@ var ts; function modifierVisitor(node) { if (ts.isDecorator(node)) return undefined; - if (ts.modifierToFlag(node.kind) & 116958 /* ModifierFlags.TypeScriptModifier */) { + if (ts.modifierToFlag(node.kind) & 117086 /* ModifierFlags.TypeScriptModifier */) { return undefined; } else if (currentNamespace && node.kind === 93 /* SyntaxKind.ExportKeyword */) { @@ -93281,58 +93845,58 @@ var ts; case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: // TypeScript accessibility and readonly modifiers are elided // falls through - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 177 /* SyntaxKind.TypePredicate */: - case 163 /* SyntaxKind.TypeParameter */: - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: + case 187 /* SyntaxKind.OptionalType */: + case 188 /* SyntaxKind.RestType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 179 /* SyntaxKind.TypePredicate */: + case 165 /* SyntaxKind.TypeParameter */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 180 /* SyntaxKind.ConstructorType */: - case 179 /* SyntaxKind.FunctionType */: - case 181 /* SyntaxKind.TypeQuery */: - case 178 /* SyntaxKind.TypeReference */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 189 /* SyntaxKind.ConditionalType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 192 /* SyntaxKind.ThisType */: - case 193 /* SyntaxKind.TypeOperator */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 195 /* SyntaxKind.MappedType */: - case 196 /* SyntaxKind.LiteralType */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 182 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 183 /* SyntaxKind.TypeQuery */: + case 180 /* SyntaxKind.TypeReference */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 191 /* SyntaxKind.ConditionalType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 194 /* SyntaxKind.ThisType */: + case 195 /* SyntaxKind.TypeOperator */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 197 /* SyntaxKind.MappedType */: + case 198 /* SyntaxKind.LiteralType */: // TypeScript type nodes are elided. // falls through - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // TypeScript index signatures are elided. return undefined; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // TypeScript type-only declarations are elided. return factory.createNotEmittedStatement(node); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: // TypeScript namespace export declarations are elided. return undefined; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // TypeScript interfaces are elided, but some comments may be preserved. // See the implementation of `getLeadingComments` in comments.ts for more details. return factory.createNotEmittedStatement(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // This may be a class declaration with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -93342,7 +93906,7 @@ var ts; // - index signatures // - method overload signatures return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: // This may be a class expression with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -93352,34 +93916,34 @@ var ts; // - index signatures // - method overload signatures return visitClassExpression(node); - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: // This may be a heritage clause with TypeScript syntax extensions. // // TypeScript heritage clause extensions include: // - `implements` clause return visitHeritageClause(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // TypeScript supports type arguments on an expression in an `extends` heritage clause. return visitExpressionWithTypeArguments(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return ts.Debug.fail("Class and object literal elements must be visited with their respective visitors"); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: // Typescript function declarations can have modifiers, decorators, and type annotations. return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: // TypeScript function expressions can have modifiers and type annotations. return visitFunctionExpression(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // TypeScript arrow functions can have modifiers and type annotations. return visitArrowFunction(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // This may be a parameter declaration with TypeScript syntax extensions. // // TypeScript parameter declaration syntax extensions include: @@ -93389,40 +93953,42 @@ var ts; // - type annotations // - this parameters return visitParameter(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: // ParenthesizedExpressions are TypeScript if their expression is a // TypeAssertion or AsExpression return visitParenthesizedExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: // TypeScript type assertions are removed, but their subtrees are preserved. return visitAssertionExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return visitSatisfiesExpression(node); + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: // TypeScript non-null expressions are removed, but their subtrees are preserved. return visitNonNullExpression(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: // TypeScript enum declarations do not exist in ES6 and must be rewritten. return visitEnumDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // TypeScript namespace exports for variable statements must be transformed. return visitVariableStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // TypeScript namespace declarations must be transformed. return visitModuleDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // TypeScript namespace or external module import. return visitImportEqualsDeclaration(node); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node); - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: return visitJsxJsxOpeningElement(node); default: // node contains some other TypeScript syntax @@ -93692,10 +94258,10 @@ var ts; */ function shouldAddTypeMetadata(node) { var kind = node.kind; - return kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */; + return kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */; } /** * Determines whether to emit the "design:returntype" metadata based on the node's kind. @@ -93705,7 +94271,7 @@ var ts; * @param node The node to test. */ function shouldAddReturnTypeMetadata(node) { - return node.kind === 169 /* SyntaxKind.MethodDeclaration */; + return node.kind === 171 /* SyntaxKind.MethodDeclaration */; } /** * Determines whether to emit the "design:paramtypes" metadata based on the node's kind. @@ -93716,12 +94282,12 @@ var ts; */ function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.getFirstConstructorWithBody(node) !== undefined; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; } return false; @@ -93811,7 +94377,7 @@ var ts; return !ts.nodeIsMissing(node.body); } function visitPropertyDeclaration(node, parent) { - var isAmbient = node.flags & 16777216 /* NodeFlags.Ambient */ || ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */); + var isAmbient = node.flags & 16777216 /* NodeFlags.Ambient */ || ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */); if (isAmbient && !ts.hasDecorators(node)) { return undefined; } @@ -93919,7 +94485,7 @@ var ts; * @param node The declaration node. */ function shouldEmitAccessorDeclaration(node) { - return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)); + return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)); } function visitGetAccessor(node, parent) { if (!(node.transformFlags & 1 /* TransformFlags.ContainsTypeScript */)) { @@ -94061,6 +94627,10 @@ var ts; var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression); return factory.createPartiallyEmittedExpression(expression, node); } + function visitSatisfiesExpression(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + return factory.createPartiallyEmittedExpression(expression, node); + } function visitCallExpression(node) { return factory.updateCallExpression(node, ts.visitNode(node.expression, visitor, ts.isExpression), /*typeArguments*/ undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression)); @@ -94274,12 +94844,12 @@ var ts; // enums in any other scope are emitted as a `let` declaration. var statement = factory.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), factory.createVariableDeclarationList([ factory.createVariableDeclaration(factory.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)) - ], currentLexicalScope.kind === 305 /* SyntaxKind.SourceFile */ ? 0 /* NodeFlags.None */ : 1 /* NodeFlags.Let */)); + ], currentLexicalScope.kind === 308 /* SyntaxKind.SourceFile */ ? 0 /* NodeFlags.None */ : 1 /* NodeFlags.Let */)); ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { // Adjust the source map emit to match the old emitter. - if (node.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (node.kind === 263 /* SyntaxKind.EnumDeclaration */) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -94404,7 +94974,7 @@ var ts; var statementsLocation; var blockLocation; if (node.body) { - if (node.body.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (node.body.kind === 265 /* SyntaxKind.ModuleBlock */) { saveStateAndInvoke(node.body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = node.body.statements; blockLocation = node.body; @@ -94451,13 +95021,13 @@ var ts; // })(hi = hello.hi || (hello.hi = {})); // })(hello || (hello = {})); // We only want to emit comment on the namespace which contains block body itself, not the containing namespaces. - if (!node.body || node.body.kind !== 262 /* SyntaxKind.ModuleBlock */) { + if (!node.body || node.body.kind !== 265 /* SyntaxKind.ModuleBlock */) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* EmitFlags.NoComments */); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 264 /* SyntaxKind.ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -94504,7 +95074,7 @@ var ts; * @param node The named import bindings node. */ function visitNamedImportBindings(node) { - if (node.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (node.kind === 271 /* SyntaxKind.NamespaceImport */) { // Elide a namespace import if it is not referenced. return shouldEmitAliasDeclaration(node) ? node : undefined; } @@ -94662,7 +95232,7 @@ var ts; */ function isNamedExternalModuleExport(node) { return isExternalModuleExport(node) - && !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */); + && !ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */); } /** * Gets a value indicating whether the node is the default export of an external module. @@ -94671,7 +95241,7 @@ var ts; */ function isDefaultExternalModuleExport(node) { return isExternalModuleExport(node) - && ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */); + && ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */); } function addExportMemberAssignment(statements, node) { var expression = factory.createAssignment(factory.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true), factory.getLocalName(node)); @@ -94716,16 +95286,16 @@ var ts; // We need to enable substitutions for identifiers and shorthand property assignments. This allows us to // substitute the names of exported members of a namespace. context.enableSubstitution(79 /* SyntaxKind.Identifier */); - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // We need to be notified when entering and exiting namespaces. - context.enableEmitNotification(261 /* SyntaxKind.ModuleDeclaration */); + context.enableEmitNotification(264 /* SyntaxKind.ModuleDeclaration */); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 261 /* SyntaxKind.ModuleDeclaration */; + return ts.getOriginalNode(node).kind === 264 /* SyntaxKind.ModuleDeclaration */; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 260 /* SyntaxKind.EnumDeclaration */; + return ts.getOriginalNode(node).kind === 263 /* SyntaxKind.EnumDeclaration */; } /** * Hook for node emit. @@ -94786,9 +95356,9 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); } return node; @@ -94803,9 +95373,9 @@ var ts; // If we are nested within a namespace declaration, we may need to qualifiy // an identifier that is exported from a merged namespace. var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false); - if (container && container.kind !== 305 /* SyntaxKind.SourceFile */) { - var substitute = (applicableSubstitutions & 2 /* TypeScriptSubstitutionFlags.NamespaceExports */ && container.kind === 261 /* SyntaxKind.ModuleDeclaration */) || - (applicableSubstitutions & 8 /* TypeScriptSubstitutionFlags.NonQualifiedEnumMembers */ && container.kind === 260 /* SyntaxKind.EnumDeclaration */); + if (container && container.kind !== 308 /* SyntaxKind.SourceFile */) { + var substitute = (applicableSubstitutions & 2 /* TypeScriptSubstitutionFlags.NamespaceExports */ && container.kind === 264 /* SyntaxKind.ModuleDeclaration */) || + (applicableSubstitutions & 8 /* TypeScriptSubstitutionFlags.NonQualifiedEnumMembers */ && container.kind === 263 /* SyntaxKind.EnumDeclaration */); if (substitute) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(container), node), /*location*/ node); @@ -94844,9 +95414,10 @@ var ts; return ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node) ? resolver.getConstantValue(node) : undefined; } function shouldEmitAliasDeclaration(node) { - return compilerOptions.preserveValueImports - ? resolver.isValueAliasDeclaration(node) - : resolver.isReferencedAliasDeclaration(node); + return ts.isInJSFile(node) || + (compilerOptions.preserveValueImports + ? resolver.isValueAliasDeclaration(node) + : resolver.isReferencedAliasDeclaration(node)); } } ts.transformTypeScript = transformTypeScript; @@ -94894,13 +95465,24 @@ var ts; var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); var useDefineForClassFields = ts.getUseDefineForClassFields(compilerOptions); + // Always transform field initializers using Set semantics when `useDefineForClassFields: false`. + var shouldTransformInitializersUsingSet = !useDefineForClassFields; + // Transform field initializers using Define semantics when `useDefineForClassFields: true` and target < ES2022. + var shouldTransformInitializersUsingDefine = useDefineForClassFields && languageVersion < 9 /* ScriptTarget.ES2022 */; + var shouldTransformInitializers = shouldTransformInitializersUsingSet || shouldTransformInitializersUsingDefine; + // We need to transform private members and class static blocks when target < ES2022. var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < 9 /* ScriptTarget.ES2022 */; + // We need to transform `accessor` fields when target < ESNext + var shouldTransformAutoAccessors = languageVersion < 99 /* ScriptTarget.ESNext */; // We need to transform `this` in a static initializer into a reference to the class - // when targeting < ES2022 since the assignment will be moved outside of the class body. + // when target < ES2022 since the assignment will be moved outside of the class body. var shouldTransformThisInStaticInitializers = languageVersion < 9 /* ScriptTarget.ES2022 */; - // We don't need to transform `super` property access when targeting ES5, ES3 because + // We don't need to transform `super` property access when target <= ES5 because // the es2015 transformation handles those. var shouldTransformSuperInStaticInitializers = shouldTransformThisInStaticInitializers && languageVersion >= 2 /* ScriptTarget.ES2015 */; + var shouldTransformAnything = shouldTransformInitializers || + shouldTransformPrivateElementsOrClassStaticBlocks || + shouldTransformAutoAccessors; var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; var previousOnEmitNode = context.onEmitNode; @@ -94920,98 +95502,149 @@ var ts; var classLexicalEnvironmentStack = []; var classLexicalEnvironmentMap = new ts.Map(); var currentClassLexicalEnvironment; + var currentClassContainer; var currentComputedPropertyNameClassLexicalEnvironment; var currentStaticPropertyDeclarationOrStaticBlock; return ts.chainBundle(context, transformSourceFile); function transformSourceFile(node) { - var options = context.getCompilerOptions(); - if (node.isDeclarationFile - || useDefineForClassFields && ts.getEmitScriptTarget(options) >= 9 /* ScriptTarget.ES2022 */) { + if (node.isDeclarationFile || !shouldTransformAnything) { return node; } var visited = ts.visitEachChild(node, visitor, context); ts.addEmitHelpers(visited, context.readEmitHelpers()); return visited; } - function visitorWorker(node, valueIsDiscarded) { - if (node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */) { - switch (node.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - return visitClassLike(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitPropertyDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: - return visitVariableStatement(node); - case 80 /* SyntaxKind.PrivateIdentifier */: - return visitPrivateIdentifier(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitClassStaticBlockDeclaration(node); - } + function visitor(node) { + if (!(node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */) && + !(node.transformFlags & 134234112 /* TransformFlags.ContainsLexicalThisOrSuper */)) { + return node; } - if (node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */ || - node.transformFlags & 134217728 /* TransformFlags.ContainsLexicalSuper */ && - shouldTransformSuperInStaticInitializers && - currentStaticPropertyDeclarationOrStaticBlock && - currentClassLexicalEnvironment) { - switch (node.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); - case 221 /* SyntaxKind.BinaryExpression */: - return visitBinaryExpression(node, valueIsDiscarded); - case 208 /* SyntaxKind.CallExpression */: - return visitCallExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - return visitTaggedTemplateExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: - return visitPropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: - return visitElementAccessExpression(node); - case 238 /* SyntaxKind.ExpressionStatement */: - return visitExpressionStatement(node); - case 242 /* SyntaxKind.ForStatement */: - return visitForStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: { - var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = undefined; - var result = ts.visitEachChild(node, visitor, context); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; - return result; - } + switch (node.kind) { + case 127 /* SyntaxKind.AccessorKeyword */: + return shouldTransformAutoAccessors ? undefined : node; + case 260 /* SyntaxKind.ClassDeclaration */: + return visitClassDeclaration(node); + case 228 /* SyntaxKind.ClassExpression */: + return visitClassExpression(node); + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + return visitClassStaticBlockDeclaration(node); + case 169 /* SyntaxKind.PropertyDeclaration */: + return visitPropertyDeclaration(node); + case 240 /* SyntaxKind.VariableStatement */: + return visitVariableStatement(node); + case 80 /* SyntaxKind.PrivateIdentifier */: + return visitPrivateIdentifier(node); + case 208 /* SyntaxKind.PropertyAccessExpression */: + return visitPropertyAccessExpression(node); + case 209 /* SyntaxKind.ElementAccessExpression */: + return visitElementAccessExpression(node); + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + return visitPreOrPostfixUnaryExpression(node, /*valueIsDiscarded*/ false); + case 223 /* SyntaxKind.BinaryExpression */: + return visitBinaryExpression(node, /*valueIsDiscarded*/ false); + case 210 /* SyntaxKind.CallExpression */: + return visitCallExpression(node); + case 241 /* SyntaxKind.ExpressionStatement */: + return visitExpressionStatement(node); + case 212 /* SyntaxKind.TaggedTemplateExpression */: + return visitTaggedTemplateExpression(node); + case 245 /* SyntaxKind.ForStatement */: + return visitForStatement(node); + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: { + // If we are descending into a new scope, clear the current static property or block + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, fallbackVisitor, node); } + default: + return fallbackVisitor(node); } + } + function fallbackVisitor(node) { return ts.visitEachChild(node, visitor, context); } + /** + * Visits a node in an expression whose result is discarded. + */ function discardedValueVisitor(node) { - return visitorWorker(node, /*valueIsDiscarded*/ true); - } - function visitor(node) { - return visitorWorker(node, /*valueIsDiscarded*/ false); + switch (node.kind) { + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + return visitPreOrPostfixUnaryExpression(node, /*valueIsDiscarded*/ true); + case 223 /* SyntaxKind.BinaryExpression */: + return visitBinaryExpression(node, /*valueIsDiscarded*/ true); + default: + return visitor(node); + } } + /** + * Visits a node in a {@link HeritageClause}. + */ function heritageClauseVisitor(node) { switch (node.kind) { - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return ts.visitEachChild(node, heritageClauseVisitor, context); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - return visitExpressionWithTypeArguments(node); + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + return visitExpressionWithTypeArgumentsInHeritageClause(node); + default: + return visitor(node); } - return visitor(node); } - function visitorDestructuringTarget(node) { + /** + * Visits the assignment target of a destructuring assignment. + */ + function assignmentTargetVisitor(node) { switch (node.kind) { - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitAssignmentPattern(node); default: return visitor(node); } } + /** + * Visits a member of a class. + */ + function classElementVisitor(node) { + switch (node.kind) { + case 173 /* SyntaxKind.Constructor */: + return visitConstructorDeclaration(node); + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, visitMethodOrAccessorDeclaration, node); + case 169 /* SyntaxKind.PropertyDeclaration */: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, visitPropertyDeclaration, node); + case 164 /* SyntaxKind.ComputedPropertyName */: + return visitComputedPropertyName(node); + case 237 /* SyntaxKind.SemicolonClassElement */: + return node; + default: + return visitor(node); + } + } + /** + * Visits the results of an auto-accessor field transformation in a second pass. + */ + function accessorFieldResultVisitor(node) { + switch (node.kind) { + case 169 /* SyntaxKind.PropertyDeclaration */: + return transformFieldInitializer(node); + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return classElementVisitor(node); + default: + ts.Debug.assertMissingNode(node, "Expected node to either be a PropertyDeclaration, GetAccessorDeclaration, or SetAccessorDeclaration"); + break; + } + } /** * If we visit a private name, this means it is an undeclared private name. * Replace it with an empty identifier to indicate a problem with the code, @@ -95027,17 +95660,15 @@ var ts; } return ts.setOriginalNode(factory.createIdentifier(""), node); } + function isPrivateIdentifierInExpression(node) { + return ts.isPrivateIdentifier(node.left) + && node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */; + } /** * Visits `#id in expr` */ - function visitPrivateIdentifierInInExpression(node) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return node; - } - var privId = node.left; - ts.Debug.assertNode(privId, ts.isPrivateIdentifier); - ts.Debug.assert(node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */); - var info = accessPrivateIdentifier(privId); + function transformPrivateIdentifierInInExpression(node) { + var info = accessPrivateIdentifier(node.left); if (info) { var receiver = ts.visitNode(node.right, visitor, ts.isExpression); return ts.setOriginalNode(context.getEmitHelperFactory().createClassPrivateFieldInHelper(info.brandCheckIdentifier, receiver), node); @@ -95045,31 +95676,6 @@ var ts; // Private name has not been declared. Subsequent transformers will handle this error return ts.visitEachChild(node, visitor, context); } - /** - * Visits the members of a class that has fields. - * - * @param node The node to visit. - */ - function classElementVisitor(node) { - switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - // Constructors for classes using class fields are transformed in - // `visitClassDeclaration` or `visitClassExpression`. - return undefined; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - return visitMethodOrAccessorDeclaration(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitPropertyDeclaration(node); - case 162 /* SyntaxKind.ComputedPropertyName */: - return visitComputedPropertyName(node); - case 234 /* SyntaxKind.SemicolonClassElement */: - return node; - default: - return visitor(node); - } - } function visitVariableStatement(node) { var savedPendingStatements = pendingStatements; pendingStatements = []; @@ -95079,15 +95685,24 @@ var ts; pendingStatements = savedPendingStatements; return statement; } - function visitComputedPropertyName(name) { - var node = ts.visitEachChild(name, visitor, context); + function visitComputedPropertyName(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); if (ts.some(pendingExpressions)) { - var expressions = pendingExpressions; - expressions.push(node.expression); - pendingExpressions = []; - node = factory.updateComputedPropertyName(node, factory.inlineExpressions(expressions)); + if (ts.isParenthesizedExpression(expression)) { + expression = factory.updateParenthesizedExpression(expression, factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression.expression], false))); + } + else { + expression = factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression], false)); + } + pendingExpressions = undefined; } - return node; + return factory.updateComputedPropertyName(node, expression); + } + function visitConstructorDeclaration(node) { + if (currentClassContainer) { + return transformConstructor(node, currentClassContainer); + } + return fallbackVisitor(node); } function visitMethodOrAccessorDeclaration(node) { ts.Debug.assert(!ts.hasDecorators(node)); @@ -95102,13 +95717,20 @@ var ts; } var functionName = getHoistedFunctionName(node); if (functionName) { - getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return ts.isModifier(m) && !ts.isStaticModifier(m); }), node.asteriskToken, functionName, - /* typeParameters */ undefined, ts.visitParameterList(node.parameters, classElementVisitor, context), - /* type */ undefined, ts.visitFunctionBody(node.body, classElementVisitor, context)))); + getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return ts.isModifier(m) && !ts.isStaticModifier(m) && !ts.isAccessorModifier(m); }), node.asteriskToken, functionName, + /* typeParameters */ undefined, ts.visitParameterList(node.parameters, visitor, context), + /* type */ undefined, ts.visitFunctionBody(node.body, visitor, context)))); } // remove method declaration from class return undefined; } + function setCurrentStaticPropertyDeclarationOrStaticBlockAnd(current, visitor, arg) { + var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; + currentStaticPropertyDeclarationOrStaticBlock = current; + var result = visitor(arg); + currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; + return result; + } function getHoistedFunctionName(node) { ts.Debug.assert(ts.isPrivateIdentifier(node.name)); var info = accessPrivateIdentifier(node.name); @@ -95125,49 +95747,104 @@ var ts; } } } - function visitPropertyDeclaration(node) { - ts.Debug.assert(!ts.hasDecorators(node)); - if (ts.isPrivateIdentifier(node.name)) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - if (ts.isStatic(node)) { - // static fields are left as is - return ts.visitEachChild(node, visitor, context); - } - // Initializer is elided as the field is initialized in transformConstructor. - return factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, - /*questionOrExclamationToken*/ undefined, - /*type*/ undefined, - /*initializer*/ undefined); - } - // leave invalid code untransformed + function transformAutoAccessor(node) { + // transforms: + // accessor x = 1; + // into: + // #x = 1; + // get x() { return this.#x; } + // set x(value) { this.#x = value; } + ts.Debug.assertEachNode(node.modifiers, ts.isModifier); + var commentRange = ts.getCommentRange(node); + var sourceMapRange = ts.getSourceMapRange(node); + // Since we're creating two declarations where there was previously one, cache + // the expression for any computed property names. + var name = node.name; + var getterName = name; + var setterName = name; + if (ts.isComputedPropertyName(name) && !ts.isSimpleInlineableExpression(name.expression)) { + var temp = factory.createTempVariable(hoistVariableDeclaration); + ts.setSourceMapRange(temp, name.expression); + var expression = ts.visitNode(name.expression, visitor, ts.isExpression); + var assignment = factory.createAssignment(temp, expression); + ts.setSourceMapRange(assignment, name.expression); + getterName = factory.updateComputedPropertyName(name, factory.inlineExpressions([assignment, temp])); + setterName = factory.updateComputedPropertyName(name, temp); + } + var backingField = ts.createAccessorPropertyBackingField(factory, node, node.modifiers, node.initializer); + ts.setOriginalNode(backingField, node); + ts.setEmitFlags(backingField, 1536 /* EmitFlags.NoComments */); + ts.setSourceMapRange(backingField, sourceMapRange); + var getter = ts.createAccessorPropertyGetRedirector(factory, node, node.modifiers, getterName); + ts.setOriginalNode(getter, node); + ts.setCommentRange(getter, commentRange); + ts.setSourceMapRange(getter, sourceMapRange); + var setter = ts.createAccessorPropertySetRedirector(factory, node, node.modifiers, setterName); + ts.setOriginalNode(setter, node); + ts.setEmitFlags(setter, 1536 /* EmitFlags.NoComments */); + ts.setSourceMapRange(setter, sourceMapRange); + return ts.visitArray([backingField, getter, setter], accessorFieldResultVisitor, ts.isClassElement); + } + function transformPrivateFieldInitializer(node) { + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + // If we are transforming private elements into WeakMap/WeakSet, we should elide the node. var info = accessPrivateIdentifier(node.name); ts.Debug.assert(info, "Undeclared private name for property declaration."); - if (!info.isValid) { - return node; + // Leave invalid code untransformed; otherwise, elide the node as it is transformed elsewhere. + return info.isValid ? undefined : node; + } + if (shouldTransformInitializersUsingSet && !ts.isStatic(node)) { + // If we are transforming initializers using Set semantics we will elide the initializer as it will + // be moved to the constructor to preserve evaluation order next to public instance fields. We don't + // need to do this transformation for private static fields since public static fields can be + // transformed into `static {}` blocks. + return factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, + /*initializer*/ undefined); + } + return ts.visitEachChild(node, visitor, context); + } + function transformPublicFieldInitializer(node) { + if (shouldTransformInitializers) { + // Create a temporary variable to store a computed property name (if necessary). + // If it's not inlineable, then we emit an expression after the class which assigns + // the property name to the temporary variable. + var expr = getPropertyNameExpressionIfNeeded(node.name, /*shouldHoist*/ !!node.initializer || useDefineForClassFields); + if (expr) { + getPendingExpressions().push(expr); } - } - // Create a temporary variable to store a computed property name (if necessary). - // If it's not inlineable, then we emit an expression after the class which assigns - // the property name to the temporary variable. - var expr = getPropertyNameExpressionIfNeeded(node.name, !!node.initializer || useDefineForClassFields); - if (expr && !ts.isSimpleInlineableExpression(expr)) { - getPendingExpressions().push(expr); - } - if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks && !useDefineForClassFields) { - var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); - if (initializerStatement) { - var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); - ts.setOriginalNode(staticBlock, node); - ts.setCommentRange(staticBlock, node); - // Set the comment range for the statement to an empty synthetic range - // and drop synthetic comments from the statement to avoid printing them twice. - ts.setCommentRange(initializerStatement, { pos: -1, end: -1 }); - ts.setSyntheticLeadingComments(initializerStatement, undefined); - ts.setSyntheticTrailingComments(initializerStatement, undefined); - return staticBlock; + if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks) { + var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); + if (initializerStatement) { + var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); + ts.setOriginalNode(staticBlock, node); + ts.setCommentRange(staticBlock, node); + // Set the comment range for the statement to an empty synthetic range + // and drop synthetic comments from the statement to avoid printing them twice. + ts.setCommentRange(initializerStatement, { pos: -1, end: -1 }); + ts.setSyntheticLeadingComments(initializerStatement, undefined); + ts.setSyntheticTrailingComments(initializerStatement, undefined); + return staticBlock; + } } + return undefined; } - return undefined; + return ts.visitEachChild(node, classElementVisitor, context); + } + function transformFieldInitializer(node) { + ts.Debug.assert(!ts.hasDecorators(node), "Decorators should already have been transformed and elided."); + return ts.isPrivateIdentifierClassElementDeclaration(node) ? + transformPrivateFieldInitializer(node) : + transformPublicFieldInitializer(node); + } + function visitPropertyDeclaration(node) { + // If this is an auto-accessor, we defer to `transformAutoAccessor`. That function + // will in turn call `transformFieldInitializer` as needed. + if (shouldTransformAutoAccessors && ts.isAutoAccessorPropertyDeclaration(node)) { + return transformAutoAccessor(node); + } + return transformFieldInitializer(node); } function createPrivateIdentifierAccess(info, receiver) { return createPrivateIdentifierAccessHelper(info, ts.visitNode(receiver, visitor, ts.isExpression)); @@ -95231,9 +95908,11 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitPreOrPostfixUnaryExpression(node, valueIsDiscarded) { - if (node.operator === 45 /* SyntaxKind.PlusPlusToken */ || node.operator === 46 /* SyntaxKind.MinusMinusToken */) { + if (node.operator === 45 /* SyntaxKind.PlusPlusToken */ || + node.operator === 46 /* SyntaxKind.MinusMinusToken */) { var operand = ts.skipParentheses(node.operand); - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(operand)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(operand)) { var info = void 0; if (info = accessPrivateIdentifier(operand.name)) { var receiver = ts.visitNode(operand.expression, visitor, ts.isExpression); @@ -95322,7 +96001,9 @@ var ts; return { readExpression: readExpression, initializeExpression: initializeExpression }; } function visitCallExpression(node) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) { + // obj.#x() // Transform call expressions of private names to properly bind the `this` parameter. var _a = factory.createCallBinding(node.expression, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; if (ts.isCallChain(node)) { @@ -95337,6 +96018,8 @@ var ts; ts.isSuperProperty(node.expression) && currentStaticPropertyDeclarationOrStaticBlock && (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.classConstructor)) { + // super.x() + // super[x]() // converts `super.f(...)` into `Reflect.get(_baseTemp, "f", _classTemp).call(_classTemp, ...)` var invocation = factory.createFunctionCallCall(ts.visitNode(node.expression, visitor, ts.isExpression), currentClassLexicalEnvironment.classConstructor, ts.visitNodes(node.arguments, visitor, ts.isExpression)); ts.setOriginalNode(invocation, node); @@ -95346,7 +96029,8 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitTaggedTemplateExpression(node) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) { // Bind the `this` correctly for tagged template literals when the tag is a private identifier property access. var _a = factory.createCallBinding(node.tag, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; return factory.updateTaggedTemplateExpression(node, factory.createCallExpression(factory.createPropertyAccessExpression(ts.visitNode(target, visitor), "bind"), @@ -95372,11 +96056,8 @@ var ts; classLexicalEnvironmentMap.set(ts.getOriginalNodeId(node), currentClassLexicalEnvironment); } startLexicalEnvironment(); - var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = node; - var statements = ts.visitNodes(node.body.statements, visitor, ts.isStatement); + var statements = setCurrentStaticPropertyDeclarationOrStaticBlockAnd(node, function (statements) { return ts.visitNodes(statements, visitor, ts.isStatement); }, node.body.statements); statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; var iife = factory.createImmediatelyInvokedArrowFunction(statements); ts.setOriginalNode(iife, node); ts.setTextRange(iife, node); @@ -95386,9 +96067,12 @@ var ts; } function visitBinaryExpression(node, valueIsDiscarded) { if (ts.isDestructuringAssignment(node)) { + // ({ x: obj.#x } = ...) + // ({ x: super.x } = ...) + // ({ x: super[x] } = ...) var savedPendingExpressions = pendingExpressions; pendingExpressions = undefined; - node = factory.updateBinaryExpression(node, ts.visitNode(node.left, visitorDestructuringTarget), node.operatorToken, ts.visitNode(node.right, visitor)); + node = factory.updateBinaryExpression(node, ts.visitNode(node.left, assignmentTargetVisitor), node.operatorToken, ts.visitNode(node.right, visitor)); var expr = ts.some(pendingExpressions) ? factory.inlineExpressions(ts.compact(__spreadArray(__spreadArray([], pendingExpressions, true), [node], false))) : node; @@ -95396,7 +96080,9 @@ var ts; return expr; } if (ts.isAssignmentExpression(node)) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.left)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.left)) { + // obj.#x = ... var info = accessPrivateIdentifier(node.left.name); if (info) { return ts.setTextRange(ts.setOriginalNode(createPrivateIdentifierAssignment(info, node.left.expression, node.right, node.operatorToken.kind), node), node); @@ -95406,6 +96092,10 @@ var ts; ts.isSuperProperty(node.left) && currentStaticPropertyDeclarationOrStaticBlock && currentClassLexicalEnvironment) { + // super.x = ... + // super[x] = ... + // super.x += ... + // super.x -= ... var classConstructor = currentClassLexicalEnvironment.classConstructor, superClassReference = currentClassLexicalEnvironment.superClassReference, facts = currentClassLexicalEnvironment.facts; if (facts & 1 /* ClassFacts.ClassWasDecorated */) { return factory.updateBinaryExpression(node, visitInvalidSuperProperty(node.left), node.operatorToken, ts.visitNode(node.right, visitor, ts.isExpression)); @@ -95449,8 +96139,10 @@ var ts; } } } - if (node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */ && ts.isPrivateIdentifier(node.left)) { - return visitPrivateIdentifierInInExpression(node); + if (shouldTransformPrivateElementsOrClassStaticBlocks && + isPrivateIdentifierInExpression(node)) { + // #x in obj + return transformPrivateIdentifierInInExpression(node); } return ts.visitEachChild(node, visitor, context); } @@ -95475,36 +96167,6 @@ var ts; ts.Debug.assertNever(info, "Unknown private element type"); } } - /** - * Set up the environment for a class. - */ - function visitClassLike(node) { - if (!ts.forEach(node.members, doesClassElementNeedTransform)) { - return ts.visitEachChild(node, visitor, context); - } - var savedPendingExpressions = pendingExpressions; - pendingExpressions = undefined; - startClassLexicalEnvironment(); - if (shouldTransformPrivateElementsOrClassStaticBlocks) { - var name = ts.getNameOfDeclaration(node); - if (name && ts.isIdentifier(name)) { - getPrivateIdentifierEnvironment().className = ts.idText(name); - } - var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); - if (ts.some(privateInstanceMethodsAndAccessors)) { - getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); - } - } - var result = ts.isClassDeclaration(node) ? - visitClassDeclaration(node) : - visitClassExpression(node); - endClassLexicalEnvironment(); - pendingExpressions = savedPendingExpressions; - return result; - } - function doesClassElementNeedTransform(node) { - return ts.isPropertyDeclaration(node) || ts.isClassStaticBlockDeclaration(node) || (shouldTransformPrivateElementsOrClassStaticBlocks && node.name && ts.isPrivateIdentifier(node.name)); - } function getPrivateInstanceMethodsAndAccessors(node) { return ts.filter(node.members, ts.isNonStaticMethodOrAccessorWithPrivateName); } @@ -95518,7 +96180,7 @@ var ts; var member = _a[_i]; if (!ts.isStatic(member)) continue; - if (member.name && ts.isPrivateIdentifier(member.name) && shouldTransformPrivateElementsOrClassStaticBlocks) { + if (member.name && (ts.isPrivateIdentifier(member.name) || ts.isAutoAccessorPropertyDeclaration(member)) && shouldTransformPrivateElementsOrClassStaticBlocks) { facts |= 2 /* ClassFacts.NeedsClassConstructorReference */; } if (ts.isPropertyDeclaration(member) || ts.isClassStaticBlockDeclaration(member)) { @@ -95537,7 +96199,7 @@ var ts; } return facts; } - function visitExpressionWithTypeArguments(node) { + function visitExpressionWithTypeArgumentsInHeritageClause(node) { var facts = (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.facts) || 0 /* ClassFacts.None */; if (facts & 4 /* ClassFacts.NeedsClassSuperReference */) { var temp = factory.createTempVariable(hoistVariableDeclaration, /*reserveInNestedScopes*/ true); @@ -95547,7 +96209,22 @@ var ts; } return ts.visitEachChild(node, visitor, context); } - function visitClassDeclaration(node) { + function visitInNewClassLexicalEnvironment(node, visitor) { + var savedCurrentClassContainer = currentClassContainer; + var savedPendingExpressions = pendingExpressions; + currentClassContainer = node; + pendingExpressions = undefined; + startClassLexicalEnvironment(); + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + var name = ts.getNameOfDeclaration(node); + if (name && ts.isIdentifier(name)) { + getPrivateIdentifierEnvironment().className = name; + } + var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); + if (ts.some(privateInstanceMethodsAndAccessors)) { + getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); + } + } var facts = getClassFacts(node); if (facts) { getClassLexicalEnvironment().facts = facts; @@ -95555,6 +96232,16 @@ var ts; if (facts & 8 /* ClassFacts.NeedsSubstitutionForThisInClassStaticField */) { enableSubstitutionForClassStaticThisOrSuperReference(); } + var result = visitor(node, facts); + endClassLexicalEnvironment(); + currentClassContainer = savedCurrentClassContainer; + pendingExpressions = savedPendingExpressions; + return result; + } + function visitClassDeclaration(node) { + return visitInNewClassLexicalEnvironment(node, visitClassDeclarationInNewClassLexicalEnvironment); + } + function visitClassDeclarationInNewClassLexicalEnvironment(node, facts) { // If a class has private static fields, or a static field has a `this` or `super` reference, // then we need to allocate a temp variable to hold on to that reference. var pendingClassReferenceAssignment; @@ -95563,12 +96250,16 @@ var ts; getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); pendingClassReferenceAssignment = factory.createAssignment(temp, factory.getInternalName(node)); } - var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); - var statements = [ - factory.updateClassDeclaration(node, node.modifiers, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)) - ]; + var modifiers = ts.visitNodes(node.modifiers, visitor, ts.isModifierLike); + var heritageClauses = ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classDecl = factory.updateClassDeclaration(node, modifiers, node.name, + /*typeParameters*/ undefined, heritageClauses, members); + var statements = []; + if (prologue) { + statements.push(factory.createExpressionStatement(prologue)); + } + statements.push(classDecl); if (pendingClassReferenceAssignment) { getPendingExpressions().unshift(pendingClassReferenceAssignment); } @@ -95576,25 +96267,23 @@ var ts; if (ts.some(pendingExpressions)) { statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))); } - // Emit static property assignment. Because classDeclaration is lexically evaluated, - // it is safe to emit static property assignment after classDeclaration - // From ES6 specification: - // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using - // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. - var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node); - if (ts.some(staticProperties)) { - addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + if (shouldTransformInitializersUsingSet || shouldTransformPrivateElementsOrClassStaticBlocks) { + // Emit static property assignment. Because classDeclaration is lexically evaluated, + // it is safe to emit static property assignment after classDeclaration + // From ES6 specification: + // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using + // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. + var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node); + if (ts.some(staticProperties)) { + addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + } } return statements; } function visitClassExpression(node) { - var facts = getClassFacts(node); - if (facts) { - getClassLexicalEnvironment().facts = facts; - } - if (facts & 8 /* ClassFacts.NeedsSubstitutionForThisInClassStaticField */) { - enableSubstitutionForClassStaticThisOrSuperReference(); - } + return visitInNewClassLexicalEnvironment(node, visitClassExpressionInNewClassLexicalEnvironment); + } + function visitClassExpressionInNewClassLexicalEnvironment(node, facts) { // If this class expression is a transformation of a decorated class declaration, // then we want to output the pendingExpressions as statements, not as inlined // expressions with the class statement. @@ -95604,8 +96293,6 @@ var ts; // these statements after the class expression variable statement. var isDecoratedClassDeclaration = !!(facts & 1 /* ClassFacts.ClassWasDecorated */); var staticPropertiesOrClassStaticBlocks = ts.getStaticPropertiesAndClassStaticBlock(node); - var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); var isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 16777216 /* NodeCheckFlags.ClassWithConstructorReference */; var temp; function createClassTempVar() { @@ -95618,9 +96305,23 @@ var ts; temp = createClassTempVar(); getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); } - var classExpression = factory.updateClassExpression(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)); - var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(staticPropertiesOrClassStaticBlocks, function (p) { return ts.isClassStaticBlockDeclaration(p) || !!p.initializer || ts.isPrivateIdentifier(p.name); }); + var modifiers = ts.visitNodes(node.modifiers, visitor, ts.isModifierLike); + var heritageClauses = ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classExpression = factory.updateClassExpression(node, modifiers, node.name, + /*typeParameters*/ undefined, heritageClauses, members); + var expressions = []; + if (prologue) { + expressions.push(prologue); + } + // Static initializers are transformed to `static {}` blocks when `useDefineForClassFields: false` + // and not also transforming static blocks. + var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && + ts.some(staticPropertiesOrClassStaticBlocks, function (node) { + return ts.isClassStaticBlockDeclaration(node) || + ts.isPrivateIdentifierClassElementDeclaration(node) || + shouldTransformInitializers && ts.isInitializedProperty(node); + }); if (hasTransformableStatics || ts.some(pendingExpressions)) { if (isDecoratedClassDeclaration) { ts.Debug.assertIsDefined(pendingStatements, "Decorated classes transformed by TypeScript are expected to be within a variable declaration."); @@ -95632,12 +96333,16 @@ var ts; addPropertyOrClassStaticBlockStatements(pendingStatements, staticPropertiesOrClassStaticBlocks, factory.getInternalName(node)); } if (temp) { - return factory.inlineExpressions([factory.createAssignment(temp, classExpression), temp]); + expressions.push(ts.startOnNewLine(factory.createAssignment(temp, classExpression)), ts.startOnNewLine(temp)); + } + else { + expressions.push(classExpression); + if (prologue) { + ts.startOnNewLine(classExpression); + } } - return classExpression; } else { - var expressions = []; temp || (temp = createClassTempVar()); if (isClassWithConstructorReference) { // record an alias as the class name is not in scope for statics. @@ -95654,45 +96359,87 @@ var ts; ts.addRange(expressions, ts.map(pendingExpressions, ts.startOnNewLine)); ts.addRange(expressions, generateInitializedPropertyExpressionsOrClassStaticBlock(staticPropertiesOrClassStaticBlocks, temp)); expressions.push(ts.startOnNewLine(temp)); - return factory.inlineExpressions(expressions); } } - return classExpression; + else { + expressions.push(classExpression); + if (prologue) { + ts.startOnNewLine(classExpression); + } + } + return factory.inlineExpressions(expressions); } function visitClassStaticBlockDeclaration(node) { if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return ts.visitEachChild(node, classElementVisitor, context); + return ts.visitEachChild(node, visitor, context); } // ClassStaticBlockDeclaration for classes are transformed in `visitClassDeclaration` or `visitClassExpression`. return undefined; } - function transformClassMembers(node, isDerivedClass) { - var members = []; + function transformClassMembers(node) { + // Declare private names if (shouldTransformPrivateElementsOrClassStaticBlocks) { - // Declare private names. for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; if (ts.isPrivateIdentifierClassElementDeclaration(member)) { - addPrivateIdentifierToEnvironment(member); + addPrivateIdentifierToEnvironment(member, member.name, addPrivateIdentifierClassElementToEnvironment); } } if (ts.some(getPrivateInstanceMethodsAndAccessors(node))) { createBrandCheckWeakSetForPrivateMethods(); } + if (shouldTransformAutoAccessors) { + for (var _b = 0, _c = node.members; _b < _c.length; _b++) { + var member = _c[_b]; + if (ts.isAutoAccessorPropertyDeclaration(member)) { + var storageName = factory.getGeneratedPrivateNameForNode(member.name, /*prefix*/ undefined, "_accessor_storage"); + addPrivateIdentifierToEnvironment(member, storageName, addPrivateIdentifierPropertyDeclarationToEnvironment); + } + } + } } - var constructor = transformConstructor(node, isDerivedClass); - var visitedMembers = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement); - if (constructor) { - members.push(constructor); + var members = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement); + // Create a synthetic constructor if necessary + var syntheticConstructor; + if (!ts.some(members, ts.isConstructorDeclaration)) { + syntheticConstructor = transformConstructor(/*constructor*/ undefined, node); } + var prologue; + // If there are pending expressions create a class static block in which to evaluate them, but only if + // class static blocks are not also being transformed. This block will be injected at the top of the class + // to ensure that expressions from computed property names are evaluated before any other static + // initializers. + var syntheticStaticBlock; if (!shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(pendingExpressions)) { - members.push(factory.createClassStaticBlockDeclaration(factory.createBlock([ - factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)) - ]))); + var statement = factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)); + if (statement.transformFlags & 134234112 /* TransformFlags.ContainsLexicalThisOrSuper */) { + // If there are `this` or `super` references from computed property names, shift the expression + // into an arrow function to be evaluated in the outer scope so that `this` and `super` are + // properly captured. + var temp = factory.createTempVariable(hoistVariableDeclaration); + var arrow = factory.createArrowFunction( + /*modifiers*/ undefined, + /*typeParameters*/ undefined, + /*parameters*/ [], + /*type*/ undefined, + /*equalsGreaterThanToken*/ undefined, factory.createBlock([statement])); + prologue = factory.createAssignment(temp, arrow); + statement = factory.createExpressionStatement(factory.createCallExpression(temp, /*typeArguments*/ undefined, [])); + } + var block = factory.createBlock([statement]); + syntheticStaticBlock = factory.createClassStaticBlockDeclaration(block); pendingExpressions = undefined; } - ts.addRange(members, visitedMembers); - return ts.setTextRange(factory.createNodeArray(members), /*location*/ node.members); + // If we created a synthetic constructor or class static block, add them to the visited members + // and return a new array. + if (syntheticConstructor || syntheticStaticBlock) { + var membersArray = void 0; + membersArray = ts.append(membersArray, syntheticConstructor); + membersArray = ts.append(membersArray, syntheticStaticBlock); + membersArray = ts.addRange(membersArray, members); + members = ts.setTextRange(factory.createNodeArray(membersArray), /*location*/ node.members); + } + return { members: members, prologue: prologue }; } function createBrandCheckWeakSetForPrivateMethods() { var weakSetName = getPrivateIdentifierEnvironment().weakSetName; @@ -95701,35 +96448,38 @@ var ts; /*typeArguments*/ undefined, []))); } function isClassElementThatRequiresConstructorStatement(member) { - if (ts.isStatic(member) || ts.hasSyntacticModifier(ts.getOriginalNode(member), 128 /* ModifierFlags.Abstract */)) { + if (ts.isStatic(member) || ts.hasAbstractModifier(ts.getOriginalNode(member))) { return false; } - if (useDefineForClassFields) { - // If we are using define semantics and targeting ESNext or higher, - // then we don't need to transform any class properties. - return languageVersion < 9 /* ScriptTarget.ES2022 */; - } - return ts.isInitializedProperty(member) || shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member); + return shouldTransformInitializersUsingDefine && ts.isPropertyDeclaration(member) || + shouldTransformInitializersUsingSet && ts.isInitializedProperty(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && shouldTransformAutoAccessors && ts.isAutoAccessorPropertyDeclaration(member); } - function transformConstructor(node, isDerivedClass) { - var constructor = ts.visitNode(ts.getFirstConstructorWithBody(node), visitor, ts.isConstructorDeclaration); - var elements = node.members.filter(isClassElementThatRequiresConstructorStatement); - if (!ts.some(elements)) { + function transformConstructor(constructor, container) { + constructor = ts.visitNode(constructor, visitor, ts.isConstructorDeclaration); + if (!ts.some(container.members, isClassElementThatRequiresConstructorStatement)) { return constructor; } + var extendsClauseElement = ts.getEffectiveBaseTypeNode(container); + var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); var parameters = ts.visitParameterList(constructor ? constructor.parameters : undefined, visitor, context); - var body = transformConstructorBody(node, constructor, isDerivedClass); + var body = transformConstructorBody(container, constructor, isDerivedClass); if (!body) { - return undefined; + return constructor; + } + if (constructor) { + ts.Debug.assert(parameters); + return factory.updateConstructorDeclaration(constructor, /*modifiers*/ undefined, parameters, body); } return ts.startOnNewLine(ts.setOriginalNode(ts.setTextRange(factory.createConstructorDeclaration( - /*modifiers*/ undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || node), constructor)); + /*modifiers*/ undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || container), constructor)); } function transformConstructorBody(node, constructor, isDerivedClass) { - var _a; + var _a, _b; var properties = ts.getProperties(node, /*requireInitializer*/ false, /*isStatic*/ false); if (!useDefineForClassFields) { - properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name); }); + properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name) || ts.hasAccessorModifier(property); }); } var privateMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); var needsConstructorBody = ts.some(properties) || ts.some(privateMethodsAndAccessors); @@ -95781,8 +96531,8 @@ var ts; statements = statements.filter(function (statement) { return !ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor); }); } else { - for (var _i = 0, _b = constructor.body.statements; _i < _b.length; _i++) { - var statement = _b[_i]; + for (var _i = 0, _c = constructor.body.statements; _i < _c.length; _i++) { + var statement = _c[_i]; if (ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) { parameterPropertyDeclarationCount++; } @@ -95814,9 +96564,14 @@ var ts; ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue)); } statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); + if (statements.length === 0 && !constructor) { + return undefined; + } + var multiLine = (constructor === null || constructor === void 0 ? void 0 : constructor.body) && constructor.body.statements.length >= statements.length ? + (_b = constructor.body.multiLine) !== null && _b !== void 0 ? _b : statements.length > 0 : + statements.length > 0; return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), - /*location*/ constructor ? constructor.body.statements : node.members), - /*multiLine*/ true), + /*location*/ constructor ? constructor.body.statements : node.members), multiLine), /*location*/ constructor ? constructor.body : undefined); function visitBodyStatement(statement) { if (useDefineForClassFields && ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) { @@ -95852,9 +96607,10 @@ var ts; return undefined; } var statement = factory.createExpressionStatement(expression); + ts.setOriginalNode(statement, property); + ts.addEmitFlags(statement, ts.getEmitFlags(property) & 1536 /* EmitFlags.NoComments */); ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)); ts.setCommentRange(statement, property); - ts.setOriginalNode(statement, property); // `setOriginalNode` *copies* the `emitNode` from `property`, so now both // `statement` and `expression` have a copy of the synthesized comments. // Drop the comments from expression to avoid printing them twice. @@ -95877,9 +96633,10 @@ var ts; continue; } ts.startOnNewLine(expression); + ts.setOriginalNode(expression, property); + ts.addEmitFlags(expression, ts.getEmitFlags(property) & 1536 /* EmitFlags.NoComments */); ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)); ts.setCommentRange(expression, property); - ts.setOriginalNode(expression, property); expressions.push(expression); } return expressions; @@ -95906,9 +96663,11 @@ var ts; var _a; // We generate a name here in order to reuse the value cached by the relocated computed name expression (which uses the same generated name) var emitAssignment = !useDefineForClassFields; - var propertyName = ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression) - ? factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) - : property.name; + var propertyName = ts.hasAccessorModifier(property) ? + factory.getGeneratedPrivateNameForNode(property.name) : + ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression) ? + factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) : + property.name; if (ts.hasStaticModifier(property)) { currentStaticPropertyDeclarationOrStaticBlock = property; } @@ -95935,7 +96694,7 @@ var ts; return undefined; } var propertyOriginalNode = ts.getOriginalNode(property); - if (ts.hasSyntacticModifier(propertyOriginalNode, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(propertyOriginalNode, 256 /* ModifierFlags.Abstract */)) { return undefined; } var initializer = property.initializer || emitAssignment ? (_a = ts.visitNode(property.initializer, visitor, ts.isExpression)) !== null && _a !== void 0 ? _a : factory.createVoidZero() @@ -95969,17 +96728,17 @@ var ts; // substitute `this` in a static field initializer context.enableSubstitution(108 /* SyntaxKind.ThisKeyword */); // these push a new lexical environment that is not the class lexical environment - context.enableEmitNotification(256 /* SyntaxKind.FunctionDeclaration */); - context.enableEmitNotification(213 /* SyntaxKind.FunctionExpression */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(259 /* SyntaxKind.FunctionDeclaration */); + context.enableEmitNotification(215 /* SyntaxKind.FunctionExpression */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // these push a new lexical environment that is not the class lexical environment, except // when they have a computed property name - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(167 /* SyntaxKind.PropertyDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(169 /* SyntaxKind.PropertyDeclaration */); // class lexical environments are restored when entering a computed property name - context.enableEmitNotification(162 /* SyntaxKind.ComputedPropertyName */); + context.enableEmitNotification(164 /* SyntaxKind.ComputedPropertyName */); } } /** @@ -96018,13 +96777,13 @@ var ts; } } switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (ts.isArrowFunction(original) || ts.getEmitFlags(node) & 262144 /* EmitFlags.AsyncFunctionBody */) { break; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 171 /* SyntaxKind.Constructor */: { + case 259 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentClassLexicalEnvironment = undefined; @@ -96034,10 +96793,10 @@ var ts; currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; return; } - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentComputedPropertyNameClassLexicalEnvironment = currentClassLexicalEnvironment; @@ -96047,7 +96806,7 @@ var ts; currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; return; } - case 162 /* SyntaxKind.ComputedPropertyName */: { + case 164 /* SyntaxKind.ComputedPropertyName */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; @@ -96161,149 +96920,138 @@ var ts; function getPrivateIdentifierEnvironment() { var lex = getClassLexicalEnvironment(); lex.privateIdentifierEnvironment || (lex.privateIdentifierEnvironment = { - className: "", - identifiers: new ts.Map() + className: undefined, + weakSetName: undefined, + identifiers: undefined, + generatedIdentifiers: undefined, }); return lex.privateIdentifierEnvironment; } function getPendingExpressions() { - return pendingExpressions || (pendingExpressions = []); + return pendingExpressions !== null && pendingExpressions !== void 0 ? pendingExpressions : (pendingExpressions = []); } - function addPrivateIdentifierToEnvironment(node) { - var _a; - var text = ts.getTextOfPropertyName(node.name); - var lex = getClassLexicalEnvironment(); - var classConstructor = lex.classConstructor; - var privateEnv = getPrivateIdentifierEnvironment(); - var weakSetName = privateEnv.weakSetName; - var assignmentExpressions = []; - var privateName = node.name.escapedText; - var previousInfo = privateEnv.identifiers.get(privateName); - var isValid = !isReservedPrivateName(node.name) && previousInfo === undefined; - if (ts.hasStaticModifier(node)) { - ts.Debug.assert(classConstructor, "weakSetName should be set in private identifier environment"); - if (ts.isPropertyDeclaration(node)) { - var variableName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "f" /* PrivateIdentifierKind.Field */, - variableName: variableName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - else if (ts.isMethodDeclaration(node)) { - var functionName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "m" /* PrivateIdentifierKind.Method */, - methodName: functionName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - else if (ts.isGetAccessorDeclaration(node)) { - var getterName = createHoistedVariableForPrivateName(text + "_get", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: getterName, - setterName: undefined, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - } - else if (ts.isSetAccessorDeclaration(node)) { - var setterName = createHoistedVariableForPrivateName(text + "_set", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: undefined, - setterName: setterName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - } - else { - ts.Debug.assertNever(node, "Unknown class element type."); - } + function addPrivateIdentifierClassElementToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + if (ts.isAutoAccessorPropertyDeclaration(node)) { + addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); } else if (ts.isPropertyDeclaration(node)) { - var weakMapName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "f" /* PrivateIdentifierKind.Field */, - brandCheckIdentifier: weakMapName, - isStatic: false, - variableName: undefined, - isValid: isValid, - }); - assignmentExpressions.push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), - /*typeArguments*/ undefined, []))); + addPrivateIdentifierPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); } else if (ts.isMethodDeclaration(node)) { - ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); - privateEnv.identifiers.set(privateName, { - kind: "m" /* PrivateIdentifierKind.Method */, - methodName: createHoistedVariableForPrivateName(text, node), - brandCheckIdentifier: weakSetName, - isStatic: false, + addPrivateIdentifierMethodDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isGetAccessorDeclaration(node)) { + addPrivateIdentifierGetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isSetAccessorDeclaration(node)) { + addPrivateIdentifierSetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + } + function addPrivateIdentifierPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + if (isStatic) { + ts.Debug.assert(lex.classConstructor, "classConstructor should be set in private identifier environment"); + var variableName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { + kind: "f" /* PrivateIdentifierKind.Field */, + brandCheckIdentifier: lex.classConstructor, + variableName: variableName, + isStatic: true, isValid: isValid, }); } - else if (ts.isAccessor(node)) { - ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); - if (ts.isGetAccessor(node)) { - var getterName = createHoistedVariableForPrivateName(text + "_get", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && !previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: getterName, - setterName: undefined, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid: isValid, - }); - } - } - else { - var setterName = createHoistedVariableForPrivateName(text + "_set", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && !previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: undefined, - setterName: setterName, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid: isValid, - }); - } - } + else { + var weakMapName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { + kind: "f" /* PrivateIdentifierKind.Field */, + brandCheckIdentifier: weakMapName, + variableName: undefined, + isStatic: false, + isValid: isValid, + }); + getPendingExpressions().push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), + /*typeArguments*/ undefined, []))); + } + } + function addPrivateIdentifierMethodDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var methodName = createHoistedVariableForPrivateName(name); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "m" /* PrivateIdentifierKind.Method */, + methodName: methodName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + function addPrivateIdentifierGetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic === isStatic && !previousInfo.getterName) { + previousInfo.getterName = getterName; } else { - ts.Debug.assertNever(node, "Unknown class element type."); + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: getterName, + setterName: undefined, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); } - (_a = getPendingExpressions()).push.apply(_a, assignmentExpressions); } - function createHoistedVariableForClass(name, node) { + function addPrivateIdentifierSetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic === isStatic && !previousInfo.setterName) { + previousInfo.setterName = setterName; + } + else { + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: undefined, + setterName: setterName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + } + function addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: getterName, + setterName: setterName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + function addPrivateIdentifierToEnvironment(node, name, addDeclaration) { + var lex = getClassLexicalEnvironment(); + var privateEnv = getPrivateIdentifierEnvironment(); + var previousInfo = getPrivateIdentifier(privateEnv, name); + var isStatic = ts.hasStaticModifier(node); + var isValid = !isReservedPrivateName(name) && previousInfo === undefined; + addDeclaration(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + function createHoistedVariableForClass(name, node, suffix) { var className = getPrivateIdentifierEnvironment().className; - var prefix = className ? "_".concat(className) : ""; - var identifier = factory.createUniqueName("".concat(prefix, "_").concat(name), 16 /* GeneratedIdentifierFlags.Optimistic */); + var prefix = className ? { prefix: "_", node: className, suffix: "_" } : "_"; + var identifier = typeof name === "object" ? factory.getGeneratedNameForNode(name, 16 /* GeneratedIdentifierFlags.Optimistic */ | 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */, prefix, suffix) : + typeof name === "string" ? factory.createUniqueName(name, 16 /* GeneratedIdentifierFlags.Optimistic */, prefix, suffix) : + factory.createTempVariable(/*recordTempVariable*/ undefined, /*reserveInNestedScopes*/ true, prefix, suffix); if (resolver.getNodeCheckFlags(node) & 524288 /* NodeCheckFlags.BlockScopedBindingInLoop */) { addBlockScopedVariable(identifier); } @@ -96312,13 +97060,33 @@ var ts; } return identifier; } - function createHoistedVariableForPrivateName(privateName, node) { - return createHoistedVariableForClass(privateName.substring(1), node.name); - } - function accessPrivateIdentifier(name) { + function createHoistedVariableForPrivateName(name, suffix) { var _a; + var text = ts.tryGetTextOfPropertyName(name); + return createHoistedVariableForClass((_a = text === null || text === void 0 ? void 0 : text.substring(1)) !== null && _a !== void 0 ? _a : name, name, suffix); + } + /** + * Access an already defined {@link PrivateIdentifier} in the current {@link PrivateIdentifierEnvironment}. + * + * @seealso {@link addPrivateIdentifierToEnvironment} + */ + function accessPrivateIdentifier(name) { + if (ts.isGeneratedPrivateIdentifier(name)) { + return accessGeneratedPrivateIdentifier(name); + } + else { + return accessPrivateIdentifierByText(name.escapedText); + } + } + function accessPrivateIdentifierByText(text) { + return accessPrivateIdentifierWorker(getPrivateIdentifierInfo, text); + } + function accessGeneratedPrivateIdentifier(name) { + return accessPrivateIdentifierWorker(getGeneratedPrivateIdentifierInfo, ts.getNodeForGeneratedName(name)); + } + function accessPrivateIdentifierWorker(getPrivateIdentifierInfo, privateIdentifierKey) { if (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.privateIdentifierEnvironment) { - var info = currentClassLexicalEnvironment.privateIdentifierEnvironment.identifiers.get(name.escapedText); + var info = getPrivateIdentifierInfo(currentClassLexicalEnvironment.privateIdentifierEnvironment, privateIdentifierKey); if (info) { return info; } @@ -96328,9 +97096,11 @@ var ts; if (!env) { continue; } - var info = (_a = env.privateIdentifierEnvironment) === null || _a === void 0 ? void 0 : _a.identifiers.get(name.escapedText); - if (info) { - return info; + if (env.privateIdentifierEnvironment) { + var info = getPrivateIdentifierInfo(env.privateIdentifierEnvironment, privateIdentifierKey); + if (info) { + return info; + } } } return undefined; @@ -96387,7 +97157,7 @@ var ts; } } } - return ts.visitNode(node, visitorDestructuringTarget); + return ts.visitNode(node, assignmentTargetVisitor); } function visitObjectAssignmentTarget(node) { if (ts.isObjectBindingOrAssignmentElement(node) && !ts.isShorthandPropertyAssignment(node)) { @@ -96420,10 +97190,10 @@ var ts; var initializer = ts.getInitializerOfBindingOrAssignmentElement(node); return factory.updatePropertyAssignment(node, ts.visitNode(node.name, visitor, ts.isPropertyName), wrapped ? initializer ? factory.createAssignment(wrapped, ts.visitNode(initializer, visitor)) : wrapped : - ts.visitNode(node.initializer, visitorDestructuringTarget, ts.isExpression)); + ts.visitNode(node.initializer, assignmentTargetVisitor, ts.isExpression)); } if (ts.isSpreadAssignment(node)) { - return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, visitorDestructuringTarget, ts.isExpression)); + return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, assignmentTargetVisitor, ts.isExpression)); } ts.Debug.assert(wrapped === undefined, "Should not have generated a wrapped target"); } @@ -96469,7 +97239,31 @@ var ts; /*typeArguments*/ undefined, [receiver]); } function isReservedPrivateName(node) { - return node.escapedText === "#constructor"; + return !ts.isGeneratedPrivateIdentifier(node) && node.escapedText === "#constructor"; + } + function getPrivateIdentifier(privateEnv, name) { + return ts.isGeneratedPrivateIdentifier(name) ? + getGeneratedPrivateIdentifierInfo(privateEnv, ts.getNodeForGeneratedName(name)) : + getPrivateIdentifierInfo(privateEnv, name.escapedText); + } + function setPrivateIdentifier(privateEnv, name, info) { + var _a, _b; + if (ts.isGeneratedPrivateIdentifier(name)) { + (_a = privateEnv.generatedIdentifiers) !== null && _a !== void 0 ? _a : (privateEnv.generatedIdentifiers = new ts.Map()); + privateEnv.generatedIdentifiers.set(ts.getNodeForGeneratedName(name), info); + } + else { + (_b = privateEnv.identifiers) !== null && _b !== void 0 ? _b : (privateEnv.identifiers = new ts.Map()); + privateEnv.identifiers.set(name.escapedText, info); + } + } + function getPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.identifiers) === null || _a === void 0 ? void 0 : _a.get(key); + } + function getGeneratedPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.generatedIdentifiers) === null || _a === void 0 ? void 0 : _a.get(key); } })(ts || (ts = {})); /*@internal*/ @@ -96510,15 +97304,15 @@ var ts; */ function serializeTypeOfNode(node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: return serializeTypeNode(node.type); - case 173 /* SyntaxKind.SetAccessor */: - case 172 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return serializeTypeNode(getAccessorTypeNode(node)); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: return ts.factory.createIdentifier("Function"); default: return ts.factory.createVoidZero(); @@ -96554,7 +97348,7 @@ var ts; return ts.factory.createArrayLiteralExpression(expressions); } function getParametersOfDecoratedDeclaration(node, container) { - if (container && node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (container && node.kind === 174 /* SyntaxKind.GetAccessor */) { var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; if (setAccessor) { return setAccessor.parameters; @@ -96600,66 +97394,66 @@ var ts; node = ts.skipTypeParentheses(node); switch (node.kind) { case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return ts.factory.createVoidZero(); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return ts.factory.createIdentifier("Function"); - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return ts.factory.createIdentifier("Array"); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return node.assertsModifier ? ts.factory.createVoidZero() : ts.factory.createIdentifier("Boolean"); - case 133 /* SyntaxKind.BooleanKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: return ts.factory.createIdentifier("Boolean"); - case 198 /* SyntaxKind.TemplateLiteralType */: - case 150 /* SyntaxKind.StringKeyword */: + case 200 /* SyntaxKind.TemplateLiteralType */: + case 152 /* SyntaxKind.StringKeyword */: return ts.factory.createIdentifier("String"); - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return ts.factory.createIdentifier("Object"); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return serializeLiteralOfLiteralTypeNode(node.literal); - case 147 /* SyntaxKind.NumberKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: return ts.factory.createIdentifier("Number"); - case 158 /* SyntaxKind.BigIntKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: return getGlobalConstructor("BigInt", 7 /* ScriptTarget.ES2020 */); - case 151 /* SyntaxKind.SymbolKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: return getGlobalConstructor("Symbol", 2 /* ScriptTarget.ES2015 */); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return serializeTypeReferenceNode(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return serializeUnionOrIntersectionConstituents(node.types, /*isIntersection*/ true); - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return serializeUnionOrIntersectionConstituents(node.types, /*isIntersection*/ false); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return serializeUnionOrIntersectionConstituents([node.trueType, node.falseType], /*isIntersection*/ false); - case 193 /* SyntaxKind.TypeOperator */: - if (node.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { + case 195 /* SyntaxKind.TypeOperator */: + if (node.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { return serializeTypeNode(node.type); } break; - case 181 /* SyntaxKind.TypeQuery */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 195 /* SyntaxKind.MappedType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 192 /* SyntaxKind.ThisType */: - case 200 /* SyntaxKind.ImportType */: + case 183 /* SyntaxKind.TypeQuery */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 197 /* SyntaxKind.MappedType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 194 /* SyntaxKind.ThisType */: + case 202 /* SyntaxKind.ImportType */: break; // handle JSDoc types from an invalid parse - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 318 /* SyntaxKind.JSDocVariadicType */: - case 319 /* SyntaxKind.JSDocNamepathType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 321 /* SyntaxKind.JSDocVariadicType */: + case 322 /* SyntaxKind.JSDocNamepathType */: break; - case 314 /* SyntaxKind.JSDocNullableType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 316 /* SyntaxKind.JSDocOptionalType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return serializeTypeNode(node.type); default: return ts.Debug.failBadSyntaxKind(node); @@ -96671,7 +97465,7 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return ts.factory.createIdentifier("String"); - case 219 /* SyntaxKind.PrefixUnaryExpression */: { + case 221 /* SyntaxKind.PrefixUnaryExpression */: { var operand = node.operand; switch (operand.kind) { case 8 /* SyntaxKind.NumericLiteral */: @@ -96700,20 +97494,20 @@ var ts; for (var _i = 0, types_22 = types; _i < types_22.length; _i++) { var typeNode = types_22[_i]; typeNode = ts.skipTypeParentheses(typeNode); - if (typeNode.kind === 143 /* SyntaxKind.NeverKeyword */) { + if (typeNode.kind === 144 /* SyntaxKind.NeverKeyword */) { if (isIntersection) return ts.factory.createVoidZero(); // Reduce to `never` in an intersection continue; // Elide `never` in a union } - if (typeNode.kind === 155 /* SyntaxKind.UnknownKeyword */) { + if (typeNode.kind === 157 /* SyntaxKind.UnknownKeyword */) { if (!isIntersection) return ts.factory.createIdentifier("Object"); // Reduce to `unknown` in a union continue; // Elide `unknown` in an intersection } - if (typeNode.kind === 130 /* SyntaxKind.AnyKeyword */) { + if (typeNode.kind === 131 /* SyntaxKind.AnyKeyword */) { return ts.factory.createIdentifier("Object"); // Reduce to `any` in a union or intersection } - if (!strictNullChecks && ((ts.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */) || typeNode.kind === 153 /* SyntaxKind.UndefinedKeyword */)) { + if (!strictNullChecks && ((ts.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */) || typeNode.kind === 155 /* SyntaxKind.UndefinedKeyword */)) { continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks } var serializedConstituent = serializeTypeNode(typeNode); @@ -96861,7 +97655,7 @@ var ts; name.original = undefined; ts.setParent(name, ts.getParseTreeNode(currentLexicalScope)); // ensure the parent is set to a parse tree node. return name; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return serializeQualifiedNameAsExpression(node); } } @@ -96916,24 +97710,24 @@ var ts; return node; } switch (node.kind) { - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are elided. They will be emitted as part of `visitClassDeclaration`. return undefined; - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return visitClassExpression(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return visitConstructorDeclaration(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return visitMethodDeclaration(node); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitSetAccessorDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return visitGetAccessorDeclaration(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return visitPropertyDeclaration(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameterDeclaration(node); default: return ts.visitEachChild(node, visitor, context); @@ -97289,7 +98083,7 @@ var ts; var prefix = getClassMemberPrefix(node, member); var memberName = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ !ts.hasSyntacticModifier(member, 2 /* ModifierFlags.Ambient */)); var descriptor = languageVersion > 0 /* ScriptTarget.ES3 */ - ? member.kind === 167 /* SyntaxKind.PropertyDeclaration */ + ? ts.isPropertyDeclaration(member) && !ts.hasAccessorModifier(member) // We emit `void 0` here to indicate to `__decorate` that it can invoke `Object.defineProperty` directly, but that it // should not invoke `Object.getOwnPropertyDescriptor`. ? factory.createVoidZero() @@ -97552,34 +98346,34 @@ var ts; return node; } switch (node.kind) { - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // ES2017 async modifier should be elided for targets < ES2017 return undefined; - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return visitAwaitExpression(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitMethodDeclaration, node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitFunctionDeclaration, node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitFunctionExpression, node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return doWithContext(1 /* ContextFlags.NonTopLevel */, visitArrowFunction, node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { capturedSuperProperties.add(node.name.escapedText); } return ts.visitEachChild(node, visitor, context); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (capturedSuperProperties && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitDefault, node); default: return ts.visitEachChild(node, visitor, context); @@ -97588,27 +98382,27 @@ var ts; function asyncBodyVisitor(node) { if (ts.isNodeWithPossibleHoistedDeclaration(node)) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatementInAsyncBody(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatementInAsyncBody(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatementInAsyncBody(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatementInAsyncBody(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClauseInAsyncBody(node); - case 235 /* SyntaxKind.Block */: - case 249 /* SyntaxKind.SwitchStatement */: - case 263 /* SyntaxKind.CaseBlock */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 252 /* SyntaxKind.TryStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 250 /* SyntaxKind.LabeledStatement */: + case 238 /* SyntaxKind.Block */: + case 252 /* SyntaxKind.SwitchStatement */: + case 266 /* SyntaxKind.CaseBlock */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 255 /* SyntaxKind.TryStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return ts.visitEachChild(node, asyncBodyVisitor, context); default: return ts.Debug.assertNever(node, "Unhandled node."); @@ -97811,7 +98605,7 @@ var ts; var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 /* ScriptTarget.ES2015 */ ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 214 /* SyntaxKind.ArrowFunction */; + var isArrowFunction = node.kind === 216 /* SyntaxKind.ArrowFunction */; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* NodeCheckFlags.CaptureArguments */) !== 0; // An async function is emit as an outer function that calls an inner // generator function. To preserve lexical bindings, we pass the current @@ -97902,17 +98696,17 @@ var ts; enabledSubstitutions |= 1 /* ES2017SubstitutionFlags.AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(257 /* SyntaxKind.ClassDeclaration */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(260 /* SyntaxKind.ClassDeclaration */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // We need to be notified when entering the generated accessor arrow functions. - context.enableEmitNotification(237 /* SyntaxKind.VariableStatement */); + context.enableEmitNotification(240 /* SyntaxKind.VariableStatement */); } } /** @@ -97960,11 +98754,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); } return node; @@ -97996,11 +98790,11 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { @@ -98157,7 +98951,7 @@ var ts; return visitorWorker(node, /*expressionResultIsUnused*/ true); } function visitorNoAsyncModifier(node) { - if (node.kind === 131 /* SyntaxKind.AsyncKeyword */) { + if (node.kind === 132 /* SyntaxKind.AsyncKeyword */) { return undefined; } return node; @@ -98183,70 +98977,70 @@ var ts; return node; } switch (node.kind) { - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return visitAwaitExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node, expressionResultIsUnused); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node, expressionResultIsUnused); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 246 /* SyntaxKind.ForInStatement */: return doWithHierarchyFacts(visitDefault, node, 0 /* HierarchyFacts.IterationStatementExcludes */, 2 /* HierarchyFacts.IterationStatementIncludes */); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return doWithHierarchyFacts(visitForStatement, node, 0 /* HierarchyFacts.IterationStatementExcludes */, 2 /* HierarchyFacts.IterationStatementIncludes */); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return visitVoidExpression(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return doWithHierarchyFacts(visitConstructorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return doWithHierarchyFacts(visitMethodDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return doWithHierarchyFacts(visitGetAccessorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return doWithHierarchyFacts(visitSetAccessorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return doWithHierarchyFacts(visitFunctionDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return doWithHierarchyFacts(visitFunctionExpression, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return doWithHierarchyFacts(visitArrowFunction, node, 2 /* HierarchyFacts.ArrowFunctionExcludes */, 0 /* HierarchyFacts.ArrowFunctionIncludes */); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameter(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, expressionResultIsUnused); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { capturedSuperProperties.add(node.name.escapedText); } return ts.visitEachChild(node, visitor, context); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (capturedSuperProperties && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return doWithHierarchyFacts(visitDefault, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); default: return ts.visitEachChild(node, visitor, context); @@ -98282,7 +99076,7 @@ var ts; function visitLabeledStatement(node) { if (enclosingFunctionFlags & 2 /* FunctionFlags.Async */) { var statement = ts.unwrapInnermostStatementOfLabel(node); - if (statement.kind === 244 /* SyntaxKind.ForOfStatement */ && statement.awaitModifier) { + if (statement.kind === 247 /* SyntaxKind.ForOfStatement */ && statement.awaitModifier) { return visitForOfStatement(statement, node); } return factory.restoreEnclosingLabel(ts.visitNode(statement, visitor, ts.isStatement, factory.liftToBlock), node); @@ -98294,7 +99088,7 @@ var ts; var objects = []; for (var _i = 0, elements_5 = elements; _i < elements_5.length; _i++) { var e = elements_5[_i]; - if (e.kind === 298 /* SyntaxKind.SpreadAssignment */) { + if (e.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (chunkObject) { objects.push(factory.createObjectLiteralExpression(chunkObject)); chunkObject = undefined; @@ -98303,7 +99097,7 @@ var ts; objects.push(ts.visitNode(target, visitor, ts.isExpression)); } else { - chunkObject = ts.append(chunkObject, e.kind === 296 /* SyntaxKind.PropertyAssignment */ + chunkObject = ts.append(chunkObject, e.kind === 299 /* SyntaxKind.PropertyAssignment */ ? factory.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression)) : ts.visitNode(e, visitor, ts.isObjectLiteralElementLike)); } @@ -98337,7 +99131,7 @@ var ts; // If we translate the above to `__assign({}, k, l)`, the `l` will evaluate before `k` is spread and we // end up with `{ a: 1, b: 2, c: 3 }` var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (objects.length && objects[0].kind !== 207 /* SyntaxKind.ObjectLiteralExpression */) { objects.unshift(factory.createObjectLiteralExpression()); } var expression = objects[0]; @@ -98845,17 +99639,17 @@ var ts; enabledSubstitutions |= 1 /* ESNextSubstitutionFlags.AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(257 /* SyntaxKind.ClassDeclaration */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(260 /* SyntaxKind.ClassDeclaration */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // We need to be notified when entering the generated accessor arrow functions. - context.enableEmitNotification(237 /* SyntaxKind.VariableStatement */); + context.enableEmitNotification(240 /* SyntaxKind.VariableStatement */); } } /** @@ -98903,11 +99697,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); } return node; @@ -98939,11 +99733,11 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { @@ -98975,7 +99769,7 @@ var ts; return node; } switch (node.kind) { - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); default: return ts.visitEachChild(node, visitor, context); @@ -99007,25 +99801,25 @@ var ts; return node; } switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: { + case 210 /* SyntaxKind.CallExpression */: { var updated = visitNonOptionalCallExpression(node, /*captureThisArg*/ false); ts.Debug.assertNotNode(updated, ts.isSyntheticReference); return updated; } - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (ts.isOptionalChain(node)) { var updated = visitOptionalExpression(node, /*captureThisArg*/ false, /*isDelete*/ false); ts.Debug.assertNotNode(updated, ts.isSyntheticReference); return updated; } return ts.visitEachChild(node, visitor, context); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */) { return transformNullishCoalescingExpression(node); } return ts.visitEachChild(node, visitor, context); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return visitDeleteExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -99067,7 +99861,7 @@ var ts; thisArg = expression; } } - expression = node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ + expression = node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? factory.updatePropertyAccessExpression(node, expression, ts.visitNode(node.name, visitor, ts.isIdentifier)) : factory.updateElementAccessExpression(node, expression, ts.visitNode(node.argumentExpression, visitor, ts.isExpression)); return thisArg ? factory.createSyntheticReferenceExpression(expression, thisArg) : expression; @@ -99090,10 +99884,10 @@ var ts; } function visitNonOptionalExpression(node, captureThisArg, isDelete) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); - case 208 /* SyntaxKind.CallExpression */: return visitNonOptionalCallExpression(node, captureThisArg); + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); + case 210 /* SyntaxKind.CallExpression */: return visitNonOptionalCallExpression(node, captureThisArg); default: return ts.visitNode(node, visitor, ts.isExpression); } } @@ -99112,8 +99906,8 @@ var ts; for (var i = 0; i < chain.length; i++) { var segment = chain[i]; switch (segment.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (i === chain.length - 1 && captureThisArg) { if (!ts.isSimpleCopiableExpression(rightExpression)) { thisArg = factory.createTempVariable(hoistVariableDeclaration); @@ -99123,11 +99917,11 @@ var ts; thisArg = rightExpression; } } - rightExpression = segment.kind === 206 /* SyntaxKind.PropertyAccessExpression */ + rightExpression = segment.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? factory.createPropertyAccessExpression(rightExpression, ts.visitNode(segment.name, visitor, ts.isIdentifier)) : factory.createElementAccessExpression(rightExpression, ts.visitNode(segment.argumentExpression, visitor, ts.isExpression)); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (i === 0 && leftThisArg) { if (!ts.isGeneratedIdentifier(leftThisArg)) { leftThisArg = factory.cloneNode(leftThisArg); @@ -99188,7 +99982,7 @@ var ts; return node; } switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var binaryExpression = node; if (ts.isLogicalOrCoalescingAssignmentExpression(binaryExpression)) { return transformLogicalAssignment(binaryExpression); @@ -99357,13 +100151,13 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return visitJsxElement(node, /*isChild*/ false); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ false); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return visitJsxFragment(node, /*isChild*/ false); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -99373,13 +100167,13 @@ var ts; switch (node.kind) { case 11 /* SyntaxKind.JsxText */: return visitJsxText(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return visitJsxExpression(node); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return visitJsxElement(node, /*isChild*/ true); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ true); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return visitJsxFragment(node, /*isChild*/ true); default: return ts.Debug.failBadSyntaxKind(node); @@ -99560,7 +100354,7 @@ var ts; var literal = factory.createStringLiteral(tryDecodeEntities(node.text) || node.text, singleQuote); return ts.setTextRange(literal, node); } - if (node.kind === 288 /* SyntaxKind.JsxExpression */) { + if (node.kind === 291 /* SyntaxKind.JsxExpression */) { if (node.expression === undefined) { return factory.createTrue(); } @@ -99661,7 +100455,7 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 278 /* SyntaxKind.JsxElement */) { + if (node.kind === 281 /* SyntaxKind.JsxElement */) { return getTagName(node.openingElement); } else { @@ -99968,7 +100762,7 @@ var ts; return node; } switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -100193,7 +100987,7 @@ var ts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { return (hierarchyFacts & 8192 /* HierarchyFacts.ConstructorWithCapturedSuper */) !== 0 - && node.kind === 247 /* SyntaxKind.ReturnStatement */ + && node.kind === 250 /* SyntaxKind.ReturnStatement */ && !node.expression; } function isOrMayContainReturnCompletion(node) { @@ -100247,65 +101041,65 @@ var ts; switch (node.kind) { case 124 /* SyntaxKind.StaticKeyword */: return undefined; // elide static keyword - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return visitClassExpression(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameter(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return visitArrowFunction(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); case 79 /* SyntaxKind.Identifier */: return visitIdentifier(node); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return visitVariableDeclarationList(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return visitCaseBlock(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return visitBlock(node, /*isFunctionBody*/ false); - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return visitBreakOrContinueStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*outermostLabeledStatement*/ undefined); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node, /*outermostLabeledStatement*/ undefined); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return visitShorthandPropertyAssignment(node); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return visitComputedPropertyName(node); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, expressionResultIsUnused); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node, expressionResultIsUnused); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node, expressionResultIsUnused); case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 15 /* SyntaxKind.TemplateHead */: @@ -100316,30 +101110,30 @@ var ts; return visitStringLiteral(node); case 8 /* SyntaxKind.NumericLiteral */: return visitNumericLiteral(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return visitTemplateExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return visitSpreadElement(node); case 106 /* SyntaxKind.SuperKeyword */: return visitSuperKeyword(/*isExpressionOfCall*/ false); case 108 /* SyntaxKind.ThisKeyword */: return visitThisKeyword(node); - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return visitMetaProperty(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return visitMethodDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitAccessorDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return visitVoidExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -100429,14 +101223,14 @@ var ts; // it is possible if either // - break/continue is labeled and label is located inside the converted loop // - break/continue is non-labeled and located in non-converted loop/switch statement - var jump = node.kind === 246 /* SyntaxKind.BreakStatement */ ? 2 /* Jump.Break */ : 4 /* Jump.Continue */; + var jump = node.kind === 249 /* SyntaxKind.BreakStatement */ ? 2 /* Jump.Break */ : 4 /* Jump.Continue */; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(ts.idText(node.label))) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; var label = node.label; if (!label) { - if (node.kind === 246 /* SyntaxKind.BreakStatement */) { + if (node.kind === 249 /* SyntaxKind.BreakStatement */) { convertedLoopState.nonLocalJumps |= 2 /* Jump.Break */; labelMarker = "break"; } @@ -100447,7 +101241,7 @@ var ts; } } else { - if (node.kind === 246 /* SyntaxKind.BreakStatement */) { + if (node.kind === 249 /* SyntaxKind.BreakStatement */) { labelMarker = "break-".concat(label.escapedText); setLabeledJump(convertedLoopState, /*isBreak*/ true, ts.idText(label), labelMarker); } @@ -100503,7 +101297,7 @@ var ts; statements.push(statement); // Add an `export default` statement for default exports (for `--target es5 --module es6`) if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - var exportStatement = ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) + var exportStatement = ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) ? factory.createExportDefault(factory.getLocalName(node)) : factory.createExternalModuleExport(factory.getLocalName(node)); ts.setOriginalNode(exportStatement, statement); @@ -100872,11 +101666,11 @@ var ts; */ function isSufficientlyCoveredByReturnStatements(statement) { // A return statement is considered covered. - if (statement.kind === 247 /* SyntaxKind.ReturnStatement */) { + if (statement.kind === 250 /* SyntaxKind.ReturnStatement */) { return true; } // An if-statement with two covered branches is covered. - else if (statement.kind === 239 /* SyntaxKind.IfStatement */) { + else if (statement.kind === 242 /* SyntaxKind.IfStatement */) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && @@ -100884,7 +101678,7 @@ var ts; } } // A block is covered if it has a last statement which is covered. - else if (statement.kind === 235 /* SyntaxKind.Block */) { + else if (statement.kind === 238 /* SyntaxKind.Block */) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -101084,7 +101878,7 @@ var ts; * @param node A node. */ function insertCaptureThisForNodeIfNeeded(statements, node) { - if (hierarchyFacts & 65536 /* HierarchyFacts.CapturedLexicalThis */ && node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (hierarchyFacts & 65536 /* HierarchyFacts.CapturedLexicalThis */ && node.kind !== 216 /* SyntaxKind.ArrowFunction */) { insertCaptureThisForNode(statements, node, factory.createThis()); return true; } @@ -101118,22 +101912,22 @@ var ts; if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */) { var newTarget = void 0; switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return statements; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Methods and accessors cannot be constructors, so 'new.target' will // always return 'undefined'. newTarget = factory.createVoidZero(); break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: // Class constructors can only be called with `new`, so `this.constructor` // should be relatively safe to use. newTarget = factory.createPropertyAccessExpression(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), "constructor"); break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: // Functions can be called or constructed, and may have a `this` due to // being a member or when calling an imported function via `other_1.f()`. newTarget = factory.createConditionalExpression(factory.createLogicalAnd(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), factory.createBinaryExpression(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), 102 /* SyntaxKind.InstanceOfKeyword */, factory.getLocalName(node))), @@ -101168,21 +101962,21 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: statements.push(transformSemicolonClassElementToStatement(member)); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; - case 171 /* SyntaxKind.Constructor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // Constructors are handled in visitClassExpression/visitClassDeclaration break; default: @@ -101381,7 +102175,7 @@ var ts; : enterSubtree(32670 /* HierarchyFacts.FunctionExcludes */, 65 /* HierarchyFacts.FunctionIncludes */); var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */ && !name && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */)) { + if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */ && !name && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */)) { name = factory.getGeneratedNameForNode(node); } exitSubtree(ancestorFacts, 98304 /* HierarchyFacts.FunctionSubtreeExcludes */, 0 /* HierarchyFacts.None */); @@ -101427,7 +102221,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 214 /* SyntaxKind.ArrowFunction */); + ts.Debug.assert(node.kind === 216 /* SyntaxKind.ArrowFunction */); // To align with the old emitter, we use a synthetic end position on the location // for the statement list we synthesize when we down-level an arrow function with // an expression function body. This prevents both comments and source maps from @@ -101734,14 +102528,14 @@ var ts; } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitDoOrWhileStatement(node, outermostLabeledStatement); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, outermostLabeledStatement); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node, outermostLabeledStatement); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, outermostLabeledStatement); } } @@ -101927,7 +102721,7 @@ var ts; var property = properties[i]; if ((property.transformFlags & 1048576 /* TransformFlags.ContainsYield */ && hierarchyFacts & 4 /* HierarchyFacts.AsyncFunctionBody */) - || (hasComputed = ts.Debug.checkDefined(property.name).kind === 162 /* SyntaxKind.ComputedPropertyName */)) { + || (hasComputed = ts.Debug.checkDefined(property.name).kind === 164 /* SyntaxKind.ComputedPropertyName */)) { numInitialProperties = i; break; } @@ -102043,11 +102837,11 @@ var ts; } function convertIterationStatementCore(node, initializerFunction, convertedLoopBody) { switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody); - case 243 /* SyntaxKind.ForInStatement */: return convertForInStatement(node, convertedLoopBody); - case 244 /* SyntaxKind.ForOfStatement */: return convertForOfStatement(node, convertedLoopBody); - case 240 /* SyntaxKind.DoStatement */: return convertDoStatement(node, convertedLoopBody); - case 241 /* SyntaxKind.WhileStatement */: return convertWhileStatement(node, convertedLoopBody); + case 245 /* SyntaxKind.ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody); + case 246 /* SyntaxKind.ForInStatement */: return convertForInStatement(node, convertedLoopBody); + case 247 /* SyntaxKind.ForOfStatement */: return convertForOfStatement(node, convertedLoopBody); + case 243 /* SyntaxKind.DoStatement */: return convertDoStatement(node, convertedLoopBody); + case 244 /* SyntaxKind.WhileStatement */: return convertWhileStatement(node, convertedLoopBody); default: return ts.Debug.failBadSyntaxKind(node, "IterationStatement expected"); } } @@ -102072,11 +102866,11 @@ var ts; function createConvertedLoopState(node) { var loopInitializer; switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: var initializer = node.initializer; - if (initializer && initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (initializer && initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { loopInitializer = initializer; } break; @@ -102492,20 +103286,20 @@ var ts; for (var i = start; i < numProperties; i++) { var property = properties[i]; switch (property.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { expressions.push(transformAccessorsToExpression(receiver, accessors, node, !!node.multiLine)); } break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -102612,7 +103406,7 @@ var ts; var updated; var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { updated = factory.updateGetAccessorDeclaration(node, node.modifiers, node.name, parameters, node.type, body); } else { @@ -103072,13 +103866,13 @@ var ts; if ((enabledSubstitutions & 1 /* ES2015SubstitutionFlags.CapturedThis */) === 0) { enabledSubstitutions |= 1 /* ES2015SubstitutionFlags.CapturedThis */; context.enableSubstitution(108 /* SyntaxKind.ThisKeyword */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(214 /* SyntaxKind.ArrowFunction */); - context.enableEmitNotification(213 /* SyntaxKind.FunctionExpression */); - context.enableEmitNotification(256 /* SyntaxKind.FunctionDeclaration */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(216 /* SyntaxKind.ArrowFunction */); + context.enableEmitNotification(215 /* SyntaxKind.FunctionExpression */); + context.enableEmitNotification(259 /* SyntaxKind.FunctionDeclaration */); } } /** @@ -103119,10 +103913,10 @@ var ts; */ function isNameOfDeclarationWithCollidingName(node) { switch (node.parent.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return node.parent.name === node && resolver.isDeclarationWithCollidingName(node.parent); } @@ -103204,11 +103998,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 238 /* SyntaxKind.ExpressionStatement */) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 241 /* SyntaxKind.ExpressionStatement */) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 208 /* SyntaxKind.CallExpression */) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 210 /* SyntaxKind.CallExpression */) { return false; } var callTarget = statementExpression.expression; @@ -103216,7 +104010,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 225 /* SyntaxKind.SpreadElement */) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 227 /* SyntaxKind.SpreadElement */) { return false; } var expression = callArgument.expression; @@ -103242,15 +104036,15 @@ var ts; if (compilerOptions.jsx === 1 /* JsxEmit.Preserve */ || compilerOptions.jsx === 3 /* JsxEmit.ReactNative */) { previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; - context.enableEmitNotification(280 /* SyntaxKind.JsxOpeningElement */); - context.enableEmitNotification(281 /* SyntaxKind.JsxClosingElement */); - context.enableEmitNotification(279 /* SyntaxKind.JsxSelfClosingElement */); + context.enableEmitNotification(283 /* SyntaxKind.JsxOpeningElement */); + context.enableEmitNotification(284 /* SyntaxKind.JsxClosingElement */); + context.enableEmitNotification(282 /* SyntaxKind.JsxSelfClosingElement */); noSubstitution = []; } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(296 /* SyntaxKind.PropertyAssignment */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(299 /* SyntaxKind.PropertyAssignment */); return ts.chainBundle(context, transformSourceFile); /** * Transforms an ES5 source file to ES3. @@ -103269,9 +104063,9 @@ var ts; */ function onEmitNode(hint, node, emitCallback) { switch (node.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: var tagName = node.tagName; noSubstitution[ts.getOriginalNodeId(tagName)] = true; break; @@ -103606,13 +104400,13 @@ var ts; */ function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return visitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitWhileStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -103625,24 +104419,24 @@ var ts; */ function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitAccessorDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return visitBreakStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return visitContinueStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); default: if (node.transformFlags & 1048576 /* TransformFlags.ContainsYield */) { @@ -103663,23 +104457,23 @@ var ts; */ function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return visitConditionalExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return visitElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -103692,9 +104486,9 @@ var ts; */ function visitGenerator(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); default: return ts.Debug.failBadSyntaxKind(node); @@ -103901,7 +104695,7 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // [source] // a.b = yield; // @@ -103913,7 +104707,7 @@ var ts; // _a.b = %sent%; target = factory.updatePropertyAccessExpression(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // [source] // a[b] = yield; // @@ -104307,35 +105101,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return transformAndEmitBlock(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return transformAndEmitExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return transformAndEmitIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return transformAndEmitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return transformAndEmitWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return transformAndEmitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return transformAndEmitForInStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return transformAndEmitContinueStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return transformAndEmitBreakStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return transformAndEmitReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return transformAndEmitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return transformAndEmitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return transformAndEmitLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return transformAndEmitThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement)); @@ -104765,7 +105559,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 290 /* SyntaxKind.DefaultClause */ && defaultClauseIndex === -1) { + if (clause.kind === 293 /* SyntaxKind.DefaultClause */ && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -104778,7 +105572,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { if (containsYield(clause.expression) && pendingClauses.length > 0) { break; } @@ -105938,12 +106732,12 @@ var ts; var previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. - context.enableSubstitution(210 /* SyntaxKind.TaggedTemplateExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. + context.enableSubstitution(212 /* SyntaxKind.TaggedTemplateExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. context.enableSubstitution(79 /* SyntaxKind.Identifier */); // Substitutes expression identifiers with imported/exported symbols. - context.enableSubstitution(221 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(223 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var currentSourceFile; // The current file. @@ -106271,23 +107065,23 @@ var ts; */ function topLevelVisitor(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return visitor(node); @@ -106300,26 +107094,26 @@ var ts; return node; } switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, valueIsDiscarded); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(node) && currentSourceFile.impliedNodeFormat === undefined) { return visitImportCallExpression(node); } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); } return ts.visitEachChild(node, visitor, context); @@ -106335,24 +107129,24 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var elem = _a[_i]; switch (elem.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (destructuringNeedsFlattening(elem.initializer)) { return true; } break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: if (destructuringNeedsFlattening(elem.name)) { return true; } break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: if (destructuringNeedsFlattening(elem.expression)) { return true; } break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return false; default: ts.Debug.assertNever(elem, "Unhandled object member kind"); } @@ -106938,7 +107732,7 @@ var ts; // // To balance the declaration, add the exports of the elided variable // statement. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 237 /* SyntaxKind.VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240 /* SyntaxKind.VariableStatement */) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -106993,10 +107787,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding, /* liveBinding */ true); @@ -107080,7 +107874,7 @@ var ts; return statements; } if (ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */)) { - var exportName = ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); + var exportName = ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); statements = appendExportStatement(statements, exportName, factory.getLocalName(decl), /*location*/ decl); } if (decl.name) { @@ -107209,7 +108003,7 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; previousOnEmitNode(hint, node, emitCallback); @@ -107271,11 +108065,11 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return substituteTaggedTemplateExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return substituteBinaryExpression(node); } return node; @@ -107319,7 +108113,7 @@ var ts; } else if (!(ts.isGeneratedIdentifier(node) && !(node.autoGenerateFlags & 64 /* GeneratedIdentifierFlags.AllowNameSubstitution */)) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 305 /* SyntaxKind.SourceFile */) { + if (exportContainer && exportContainer.kind === 308 /* SyntaxKind.SourceFile */) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.cloneNode(node)), /*location*/ node); } @@ -107409,10 +108203,10 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(79 /* SyntaxKind.Identifier */); // Substitutes expression identifiers for imported symbols. - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols - context.enableSubstitution(221 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(231 /* SyntaxKind.MetaProperty */); // Substitutes 'import.meta' - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols + context.enableSubstitution(223 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(233 /* SyntaxKind.MetaProperty */); // Substitutes 'import.meta' + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var exportFunctionsMap = []; // The export function associated with a source file. @@ -107602,7 +108396,7 @@ var ts; ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); var exportStarFunction = addExportStarIfNeeded(statements); // TODO: GH#18217 var modifiers = node.transformFlags & 2097152 /* TransformFlags.ContainsAwait */ ? - factory.createModifiersFromModifierFlags(256 /* ModifierFlags.Async */) : + factory.createModifiersFromModifierFlags(512 /* ModifierFlags.Async */) : undefined; var moduleObject = factory.createObjectLiteralExpression([ factory.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), @@ -107636,7 +108430,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 272 /* SyntaxKind.ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 275 /* SyntaxKind.ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -107725,19 +108519,26 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(factory, entry, currentSourceFile); // TODO: GH#18217 switch (entry.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: if (!entry.importClause) { // 'import "..."' case // module is imported only for side-effects, no emit required break; } // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: ts.Debug.assert(importVariableName !== undefined); // save import into the local statements.push(factory.createExpressionStatement(factory.createAssignment(importVariableName, parameterName))); + if (ts.hasSyntacticModifier(entry, 1 /* ModifierFlags.Export */)) { + statements.push(factory.createExpressionStatement(factory.createCallExpression(exportFunction, + /*typeArguments*/ undefined, [ + factory.createStringLiteral(ts.idText(importVariableName)), + parameterName, + ]))); + } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { if (ts.isNamedExports(entry.exportClause)) { @@ -107796,13 +108597,13 @@ var ts; */ function topLevelVisitor(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); default: return topLevelNestedVisitor(node); @@ -107981,7 +108782,7 @@ var ts; function shouldHoistVariableDeclarationList(node) { // hoist only non-block scoped declarations or block scoped declarations parented by source file return (ts.getEmitFlags(node) & 2097152 /* EmitFlags.NoHoisting */) === 0 - && (enclosingBlockScopedContainer.kind === 305 /* SyntaxKind.SourceFile */ + && (enclosingBlockScopedContainer.kind === 308 /* SyntaxKind.SourceFile */ || (ts.getOriginalNode(node).flags & 3 /* NodeFlags.BlockScoped */) === 0); } /** @@ -108045,7 +108846,7 @@ var ts; // // To balance the declaration, we defer the exports of the elided variable // statement until we visit this declaration's `EndOfDeclarationMarker`. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 237 /* SyntaxKind.VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240 /* SyntaxKind.VariableStatement */) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasSyntacticModifier(node.original, 1 /* ModifierFlags.Export */); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -108107,10 +108908,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -108205,7 +109006,7 @@ var ts; } var excludeName; if (ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */)) { - var exportName = ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */) ? factory.createStringLiteral("default") : decl.name; + var exportName = ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */) ? factory.createStringLiteral("default") : decl.name; statements = appendExportStatement(statements, exportName, factory.getLocalName(decl)); excludeName = ts.getTextOfIdentifierOrLiteral(exportName); } @@ -108290,43 +109091,43 @@ var ts; */ function topLevelNestedVisitor(node) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*isTopLevel*/ true); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return visitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitWhileStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return visitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return visitCaseBlock(node); - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return visitCaseClause(node); - case 290 /* SyntaxKind.DefaultClause */: + case 293 /* SyntaxKind.DefaultClause */: return visitDefaultClause(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return visitTryStatement(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return visitBlock(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return visitor(node); @@ -108512,26 +109313,26 @@ var ts; return node; } switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*isTopLevel*/ false); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, valueIsDiscarded); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(node)) { return visitImportCallExpression(node); } break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return visitPrefixOrPostfixUnaryExpression(node, valueIsDiscarded); } return ts.visitEachChild(node, visitor, context); @@ -108611,7 +109412,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 305 /* SyntaxKind.SourceFile */; + return container !== undefined && container.kind === 308 /* SyntaxKind.SourceFile */; } else { return false; @@ -108689,7 +109490,7 @@ var ts; * @param emitCallback A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -108739,7 +109540,7 @@ var ts; */ function substituteUnspecified(node) { switch (node.kind) { - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return substituteShorthandPropertyAssignment(node); } return node; @@ -108776,9 +109577,9 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return substituteBinaryExpression(node); - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return substituteMetaProperty(node); } return node; @@ -108868,7 +109669,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); - if (exportContainer && exportContainer.kind === 305 /* SyntaxKind.SourceFile */) { + if (exportContainer && exportContainer.kind === 308 /* SyntaxKind.SourceFile */) { exportedNames = ts.append(exportedNames, factory.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -108911,7 +109712,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); context.enableSubstitution(79 /* SyntaxKind.Identifier */); var helperNameSubstitutions; var currentSourceFile; @@ -108951,14 +109752,14 @@ var ts; } function visitor(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // Though an error in es2020 modules, in node-flavor es2020 modules, we can helpfully transform this to a synthetic `require` call // To give easy access to a synchronous `require` in node-flavor esm. We do the transform even in scenarios where we error, but `import.meta.url` // is available, just because the output is reasonable for a node-like runtime. return ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.Node16 ? visitImportEqualsDeclaration(node) : undefined; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportDecl = node; return visitExportDeclaration(exportDecl); } @@ -109115,8 +109916,8 @@ var ts; var cjsOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(305 /* SyntaxKind.SourceFile */); - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); + context.enableSubstitution(308 /* SyntaxKind.SourceFile */); + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); var currentSourceFile; return transformSourceFileOrBundle; function onSubstituteNode(hint, node) { @@ -109163,7 +109964,7 @@ var ts; return result; } function transformSourceFileOrBundle(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -109223,7 +110024,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109252,7 +110053,7 @@ var ts; ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109299,7 +110100,7 @@ var ts; return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: ".concat(ts.Debug.formatSyntaxKind(node.kind))); } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109308,8 +110109,8 @@ var ts; } // This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit // The only exception here is if the constructor was marked as private. we are not emitting the constructor parameters at all. - else if (node.kind === 167 /* SyntaxKind.PropertyDeclaration */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 166 /* SyntaxKind.PropertySignature */ || - (node.kind === 164 /* SyntaxKind.Parameter */ && ts.hasSyntacticModifier(node.parent, 8 /* ModifierFlags.Private */))) { + else if (node.kind === 169 /* SyntaxKind.PropertyDeclaration */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 168 /* SyntaxKind.PropertySignature */ || + (node.kind === 166 /* SyntaxKind.Parameter */ && ts.hasSyntacticModifier(node.parent, 8 /* ModifierFlags.Private */))) { // TODO(jfreeman): Deal with computed properties in error reporting. if (ts.isStatic(node)) { return symbolAccessibilityResult.errorModuleName ? @@ -109318,7 +110119,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 166 /* SyntaxKind.Parameter */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109343,7 +110144,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (node.kind === 173 /* SyntaxKind.SetAccessor */) { + if (node.kind === 175 /* SyntaxKind.SetAccessor */) { // Getters can infer the return type from the returned expression, but setters cannot, so the // "_from_external_module_1_but_cannot_be_named" case cannot occur. if (ts.isStatic(node)) { @@ -109382,26 +110183,26 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? @@ -109409,7 +110210,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -109423,7 +110224,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -109448,30 +110249,30 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 175 /* SyntaxKind.ConstructSignature */: - case 180 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node.parent)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? @@ -109479,7 +110280,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109492,15 +110293,15 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 256 /* SyntaxKind.FunctionDeclaration */: - case 179 /* SyntaxKind.FunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 181 /* SyntaxKind.FunctionType */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; - case 173 /* SyntaxKind.SetAccessor */: - case 172 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109514,39 +110315,39 @@ var ts; // Type parameter constraints are named by user so we should always be able to name it var diagnosticMessage; switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1; break; - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node.parent)) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 179 /* SyntaxKind.FunctionType */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 181 /* SyntaxKind.FunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -109612,7 +110413,7 @@ var ts; } function isInternalDeclaration(node, currentSourceFile) { var parseTreeNode = ts.getParseTreeNode(node); - if (parseTreeNode && parseTreeNode.kind === 164 /* SyntaxKind.Parameter */) { + if (parseTreeNode && parseTreeNode.kind === 166 /* SyntaxKind.Parameter */) { var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode); var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined; var text = currentSourceFile.text; @@ -109788,7 +110589,7 @@ var ts; var _a; var primaryDeclaration = (_a = parentSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.getSourceFileOfNode(d) === containingFile; }); var augmentingDeclarations = ts.filter(symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== containingFile; }); - if (augmentingDeclarations) { + if (primaryDeclaration && augmentingDeclarations) { for (var _i = 0, augmentingDeclarations_1 = augmentingDeclarations; _i < augmentingDeclarations_1.length; _i++) { var augmentations = augmentingDeclarations_1[_i]; context.addDiagnostic(ts.addRelatedInfo(ts.createDiagnosticForNode(augmentations, ts.Diagnostics.Declaration_augments_declaration_in_another_file_This_cannot_be_serialized), ts.createDiagnosticForNode(primaryDeclaration, ts.Diagnostics.This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_file))); @@ -109818,10 +110619,10 @@ var ts; return result; } function transformRoot(node) { - if (node.kind === 305 /* SyntaxKind.SourceFile */ && node.isDeclarationFile) { + if (node.kind === 308 /* SyntaxKind.SourceFile */ && node.isDeclarationFile) { return node; } - if (node.kind === 306 /* SyntaxKind.Bundle */) { + if (node.kind === 309 /* SyntaxKind.Bundle */) { isBundledEmit = true; refs = new ts.Map(); libs = new ts.Map(); @@ -109844,14 +110645,14 @@ var ts; resultHasExternalModuleIndicator = false; // unused in external module bundle emit (all external modules are within module blocks, therefore are known to be modules) needsDeclare = false; var statements = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile, /*bundled*/ true)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements); - var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); + var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); return newFile; } needsDeclare = true; var updated = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements); return factory.updateSourceFile(sourceFile, transformAndReplaceLatePaintedStatements(updated), /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); }), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 308 /* SyntaxKind.InputFiles */) { + if (prepend.kind === 311 /* SyntaxKind.InputFiles */) { var sourceFile = ts.createUnparsedSourceFile(prepend, "dts", stripInternal); hasNoDefaultLib_1 = hasNoDefaultLib_1 || !!sourceFile.hasNoDefaultLib; collectReferences(sourceFile, refs); @@ -109992,7 +110793,7 @@ var ts; return name; } else { - if (name.kind === 202 /* SyntaxKind.ArrayBindingPattern */) { + if (name.kind === 204 /* SyntaxKind.ArrayBindingPattern */) { return factory.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement)); } else { @@ -110000,7 +110801,7 @@ var ts; } } function visitBindingElement(elem) { - if (elem.kind === 227 /* SyntaxKind.OmittedExpression */) { + if (elem.kind === 229 /* SyntaxKind.OmittedExpression */) { return elem; } if (elem.propertyName && ts.isIdentifier(elem.propertyName) && ts.isIdentifier(elem.name) && !elem.symbol.isReferenced) { @@ -110042,19 +110843,19 @@ var ts; // Literal const declarations will have an initializer ensured rather than a type return; } - var shouldUseResolverType = node.kind === 164 /* SyntaxKind.Parameter */ && + var shouldUseResolverType = node.kind === 166 /* SyntaxKind.Parameter */ && (resolver.isRequiredInitializedParameter(node) || resolver.isOptionalUninitializedParameterProperty(node)); if (type && !shouldUseResolverType) { return ts.visitNode(type, visitDeclarationSubtree); } if (!ts.getParseTreeNode(node)) { - return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } - if (node.kind === 173 /* SyntaxKind.SetAccessor */) { + if (node.kind === 175 /* SyntaxKind.SetAccessor */) { // Set accessors with no associated type node (from it's param or get accessor return) are `any` since they are never contextually typed right now // (The inferred type here will be void, but the old declaration emitter printed `any`, so this replicates that) - return factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } errorNameNode = node.name; var oldDiag; @@ -110062,12 +110863,12 @@ var ts; oldDiag = getSymbolAccessibilityDiagnostic; getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node); } - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); } - if (node.kind === 164 /* SyntaxKind.Parameter */ - || node.kind === 167 /* SyntaxKind.PropertyDeclaration */ - || node.kind === 166 /* SyntaxKind.PropertySignature */) { + if (node.kind === 166 /* SyntaxKind.Parameter */ + || node.kind === 169 /* SyntaxKind.PropertyDeclaration */ + || node.kind === 168 /* SyntaxKind.PropertySignature */) { if (ts.isPropertySignature(node) || !node.initializer) return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType)); return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType) || resolver.createTypeOfExpression(node.initializer, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); @@ -110078,28 +110879,28 @@ var ts; if (!suppressNewDiagnosticContexts) { getSymbolAccessibilityDiagnostic = oldDiag; } - return returnValue || factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return returnValue || factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } } function isDeclarationAndNotVisible(node) { node = ts.getParseTreeNode(node); switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return !resolver.isDeclarationVisible(node); // The following should be doing their own visibility checks based on filtering their members - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return !getBindingNameVisible(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: return false; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return true; } return false; @@ -110188,7 +110989,7 @@ var ts; function rewriteModuleSpecifier(parent, input) { if (!input) return undefined; // TODO: GH#18217 - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && parent.kind !== 200 /* SyntaxKind.ImportType */); + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && parent.kind !== 202 /* SyntaxKind.ImportType */); if (ts.isStringLiteralLike(input)) { if (isBundledEmit) { var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent); @@ -110208,7 +111009,7 @@ var ts; function transformImportEqualsDeclaration(decl) { if (!resolver.isDeclarationVisible(decl)) return; - if (decl.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + if (decl.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { // Rewrite external module names if necessary var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl); return factory.updateImportEqualsDeclaration(decl, decl.modifiers, decl.isTypeOnly, decl.name, factory.updateExternalModuleReference(decl.moduleReference, rewriteModuleSpecifier(decl, specifier))); @@ -110233,7 +111034,7 @@ var ts; return visibleDefaultBinding && factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, /*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)); } - if (decl.importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (decl.importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { // Namespace import (optionally with visible default) var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined; return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)) : undefined; @@ -110336,7 +111137,7 @@ var ts; // We'd see a TDZ violation at runtime var canProduceDiagnostic = ts.canProduceDiagnostics(input); var oldWithinObjectLiteralType = suppressNewDiagnosticContexts; - var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 182 /* SyntaxKind.TypeLiteral */ || input.kind === 195 /* SyntaxKind.MappedType */) && input.parent.kind !== 259 /* SyntaxKind.TypeAliasDeclaration */); + var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 184 /* SyntaxKind.TypeLiteral */ || input.kind === 197 /* SyntaxKind.MappedType */) && input.parent.kind !== 262 /* SyntaxKind.TypeAliasDeclaration */); // Emit methods which are private as properties with no type information if (ts.isMethodDeclaration(input) || ts.isMethodSignature(input)) { if (ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)) { @@ -110357,28 +111158,28 @@ var ts; } if (isProcessedComponent(input)) { switch (input.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: { + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: { if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) { checkEntityNameVisibility(input.expression, enclosingDeclaration); } var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory.updateExpressionWithTypeArguments(node, node.expression, node.typeArguments)); } - case 178 /* SyntaxKind.TypeReference */: { + case 180 /* SyntaxKind.TypeReference */: { checkEntityNameVisibility(input.typeName, enclosingDeclaration); var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory.updateTypeReferenceNode(node, node.typeName, node.typeArguments)); } - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return cleanup(factory.updateConstructSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); - case 171 /* SyntaxKind.Constructor */: { + case 173 /* SyntaxKind.Constructor */: { // A constructor declaration may not have a type annotation var ctor = factory.createConstructorDeclaration( /*modifiers*/ ensureModifiers(input), updateParamsList(input, input.parameters, 0 /* ModifierFlags.None */), /*body*/ undefined); return cleanup(ctor); } - case 169 /* SyntaxKind.MethodDeclaration */: { + case 171 /* SyntaxKind.MethodDeclaration */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } @@ -110387,7 +111188,7 @@ var ts; /*body*/ undefined); return cleanup(sig); } - case 172 /* SyntaxKind.GetAccessor */: { + case 174 /* SyntaxKind.GetAccessor */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } @@ -110395,36 +111196,36 @@ var ts; return cleanup(factory.updateGetAccessorDeclaration(input, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)), ensureType(input, accessorType), /*body*/ undefined)); } - case 173 /* SyntaxKind.SetAccessor */: { + case 175 /* SyntaxKind.SetAccessor */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updateSetAccessorDeclaration(input, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)), /*body*/ undefined)); } - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updatePropertyDeclaration(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type), ensureNoInitializer(input))); - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updatePropertySignature(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type))); - case 168 /* SyntaxKind.MethodSignature */: { + case 170 /* SyntaxKind.MethodSignature */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updateMethodSignature(input, ensureModifiers(input), input.name, input.questionToken, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 174 /* SyntaxKind.CallSignature */: { + case 176 /* SyntaxKind.CallSignature */: { return cleanup(factory.updateCallSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 176 /* SyntaxKind.IndexSignature */: { - return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */))); + case 178 /* SyntaxKind.IndexSignature */: { + return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */))); } - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { if (ts.isBindingPattern(input.name)) { return recreateBindingPattern(input.name); } @@ -110432,13 +111233,13 @@ var ts; suppressNewDiagnosticContexts = true; // Variable declaration types also suppress new diagnostic contexts, provided the contexts wouldn't be made for binding pattern types return cleanup(factory.updateVariableDeclaration(input, input.name, /*exclamationToken*/ undefined, ensureType(input, input.type), ensureNoInitializer(input))); } - case 163 /* SyntaxKind.TypeParameter */: { + case 165 /* SyntaxKind.TypeParameter */: { if (isPrivateMethodTypeParameter(input) && (input.default || input.constraint)) { return cleanup(factory.updateTypeParameterDeclaration(input, input.modifiers, input.name, /*constraint*/ undefined, /*defaultType*/ undefined)); } return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context)); } - case 189 /* SyntaxKind.ConditionalType */: { + case 191 /* SyntaxKind.ConditionalType */: { // We have to process conditional types in a special way because for visibility purposes we need to push a new enclosingDeclaration // just for the `infer` types in the true branch. It's an implicit declaration scope that only applies to _part_ of the type. var checkType = ts.visitNode(input.checkType, visitDeclarationSubtree); @@ -110450,13 +111251,13 @@ var ts; var falseType = ts.visitNode(input.falseType, visitDeclarationSubtree); return cleanup(factory.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType)); } - case 179 /* SyntaxKind.FunctionType */: { + case 181 /* SyntaxKind.FunctionType */: { return cleanup(factory.updateFunctionTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 180 /* SyntaxKind.ConstructorType */: { + case 182 /* SyntaxKind.ConstructorType */: { return cleanup(factory.updateConstructorTypeNode(input, ensureModifiers(input), ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 200 /* SyntaxKind.ImportType */: { + case 202 /* SyntaxKind.ImportType */: { if (!ts.isLiteralImportTypeNode(input)) return cleanup(input); return cleanup(factory.updateImportTypeNode(input, factory.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.assertions, input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf)); @@ -110488,7 +111289,7 @@ var ts; } } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 169 /* SyntaxKind.MethodDeclaration */ && ts.hasEffectiveModifier(node.parent, 8 /* ModifierFlags.Private */); + return node.parent.kind === 171 /* SyntaxKind.MethodDeclaration */ && ts.hasEffectiveModifier(node.parent, 8 /* ModifierFlags.Private */); } function visitDeclarationStatements(input) { if (!isPreservedDeclarationStatement(input)) { @@ -110498,7 +111299,7 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 272 /* SyntaxKind.ExportDeclaration */: { + case 275 /* SyntaxKind.ExportDeclaration */: { if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; } @@ -110507,7 +111308,7 @@ var ts; // Rewrite external module names if necessary return factory.updateExportDeclaration(input, input.modifiers, input.isTypeOnly, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier), ts.getResolutionModeOverrideForClause(input.assertClause) ? input.assertClause : undefined); } - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { // Always visible if the parent node isn't dropped for being not visible if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; @@ -110525,7 +111326,7 @@ var ts; errorFallbackNode = input; var varDecl = factory.createVariableDeclaration(newId, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); errorFallbackNode = undefined; - var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); preserveJsDoc(statement, input); ts.removeAllComments(input); return [statement, factory.updateExportAssignment(input, input.modifiers, newId)]; @@ -110538,12 +111339,12 @@ var ts; return input; } function stripExportModifiers(statement) { - if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 512 /* ModifierFlags.Default */) || !ts.canHaveModifiers(statement)) { + if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 1024 /* ModifierFlags.Default */) || !ts.canHaveModifiers(statement)) { // `export import` statements should remain as-is, as imports are _not_ implicitly exported in an ambient namespace // Likewise, `export default` classes and the like and just be `default`, so we preserve their `export` modifiers, too return statement; } - var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (257023 /* ModifierFlags.All */ ^ 1 /* ModifierFlags.Export */)); + var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (258047 /* ModifierFlags.All */ ^ 1 /* ModifierFlags.Export */)); return factory.updateModifiers(statement, modifiers); } function transformTopLevelDeclaration(input) { @@ -110554,10 +111355,10 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { return transformImportEqualsDeclaration(input); } - case 266 /* SyntaxKind.ImportDeclaration */: { + case 269 /* SyntaxKind.ImportDeclaration */: { return transformImportDeclaration(input); } } @@ -110578,12 +111379,16 @@ var ts; } var previousNeedsDeclare = needsDeclare; switch (input.kind) { - case 259 /* SyntaxKind.TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all - return cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); - case 258 /* SyntaxKind.InterfaceDeclaration */: { + case 262 /* SyntaxKind.TypeAliasDeclaration */: { + needsDeclare = false; + var clean = cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); + needsDeclare = previousNeedsDeclare; + return clean; + } + case 261 /* SyntaxKind.InterfaceDeclaration */: { return cleanup(factory.updateInterfaceDeclaration(input, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree))); } - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { // Generators lose their generator-ness, excepting their return type var clean = cleanup(factory.updateFunctionDeclaration(input, ensureModifiers(input), /*asteriskToken*/ undefined, input.name, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), @@ -110624,10 +111429,10 @@ var ts; })))); } var namespaceDecl = factory.createModuleDeclaration(ensureModifiers(input), input.name, factory.createModuleBlock(declarations), 16 /* NodeFlags.Namespace */); - if (!ts.hasEffectiveModifier(clean, 512 /* ModifierFlags.Default */)) { + if (!ts.hasEffectiveModifier(clean, 1024 /* ModifierFlags.Default */)) { return [clean, namespaceDecl]; } - var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~513 /* ModifierFlags.ExportDefault */) | 2 /* ModifierFlags.Ambient */); + var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~1025 /* ModifierFlags.ExportDefault */) | 2 /* ModifierFlags.Ambient */); var cleanDeclaration = factory.updateFunctionDeclaration(clean, modifiers, /*asteriskToken*/ undefined, clean.name, clean.typeParameters, clean.parameters, clean.type, /*body*/ undefined); @@ -110645,10 +111450,10 @@ var ts; return clean; } } - case 261 /* SyntaxKind.ModuleDeclaration */: { + case 264 /* SyntaxKind.ModuleDeclaration */: { needsDeclare = false; var inner = input.body; - if (inner && inner.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (inner && inner.kind === 265 /* SyntaxKind.ModuleBlock */) { var oldNeedsScopeFix = needsScopeFixMarker; var oldHasScopeFix = resultHasScopeMarker; resultHasScopeMarker = false; @@ -110689,7 +111494,7 @@ var ts; return cleanup(factory.updateModuleDeclaration(input, mods, input.name, body)); } } - case 257 /* SyntaxKind.ClassDeclaration */: { + case 260 /* SyntaxKind.ClassDeclaration */: { errorNameNode = input.name; errorFallbackNode = input; var modifiers = factory.createNodeArray(ensureModifiers(input)); @@ -110751,7 +111556,7 @@ var ts; typeName: input.name }); }; var varDecl = factory.createVariableDeclaration(newId_1, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(extendsClause_1.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); - var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); var heritageClauses = factory.createNodeArray(ts.map(input.heritageClauses, function (clause) { if (clause.token === 94 /* SyntaxKind.ExtendsKeyword */) { var oldDiag_2 = getSymbolAccessibilityDiagnostic; @@ -110769,10 +111574,10 @@ var ts; return cleanup(factory.updateClassDeclaration(input, modifiers, input.name, typeParameters, heritageClauses, members)); } } - case 237 /* SyntaxKind.VariableStatement */: { + case 240 /* SyntaxKind.VariableStatement */: { return cleanup(transformVariableStatement(input)); } - case 260 /* SyntaxKind.EnumDeclaration */: { + case 263 /* SyntaxKind.EnumDeclaration */: { return cleanup(factory.updateEnumDeclaration(input, factory.createNodeArray(ensureModifiers(input)), input.name, factory.createNodeArray(ts.mapDefined(input.members, function (m) { if (shouldStripInternal(m)) return; @@ -110791,7 +111596,7 @@ var ts; if (canProdiceDiagnostic) { getSymbolAccessibilityDiagnostic = oldDiag; } - if (input.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (input.kind === 264 /* SyntaxKind.ModuleDeclaration */) { needsDeclare = previousNeedsDeclare; } if (node === input) { @@ -110814,7 +111619,7 @@ var ts; return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e); })); } function recreateBindingElement(e) { - if (e.kind === 227 /* SyntaxKind.OmittedExpression */) { + if (e.kind === 229 /* SyntaxKind.OmittedExpression */) { return; } if (e.name) { @@ -110862,9 +111667,9 @@ var ts; return factory.createModifiersFromModifierFlags(newFlags); } function ensureModifierFlags(node) { - var mask = 257023 /* ModifierFlags.All */ ^ (4 /* ModifierFlags.Public */ | 256 /* ModifierFlags.Async */ | 16384 /* ModifierFlags.Override */); // No async and override modifiers in declaration files + var mask = 258047 /* ModifierFlags.All */ ^ (4 /* ModifierFlags.Public */ | 512 /* ModifierFlags.Async */ | 16384 /* ModifierFlags.Override */); // No async and override modifiers in declaration files var additions = (needsDeclare && !isAlwaysType(node)) ? 2 /* ModifierFlags.Ambient */ : 0 /* ModifierFlags.None */; - var parentIsFile = node.parent.kind === 305 /* SyntaxKind.SourceFile */; + var parentIsFile = node.parent.kind === 308 /* SyntaxKind.SourceFile */; if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) { mask ^= 2 /* ModifierFlags.Ambient */; additions = 0 /* ModifierFlags.None */; @@ -110893,7 +111698,7 @@ var ts; } ts.transformDeclarations = transformDeclarations; function isAlwaysType(node) { - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return true; } return false; @@ -110903,22 +111708,22 @@ var ts; return ts.factory.createModifiersFromModifierFlags(maskModifierFlags(node, modifierMask, modifierAdditions)); } function maskModifierFlags(node, modifierMask, modifierAdditions) { - if (modifierMask === void 0) { modifierMask = 257023 /* ModifierFlags.All */ ^ 4 /* ModifierFlags.Public */; } + if (modifierMask === void 0) { modifierMask = 258047 /* ModifierFlags.All */ ^ 4 /* ModifierFlags.Public */; } if (modifierAdditions === void 0) { modifierAdditions = 0 /* ModifierFlags.None */; } var flags = (ts.getEffectiveModifierFlags(node) & modifierMask) | modifierAdditions; - if (flags & 512 /* ModifierFlags.Default */ && !(flags & 1 /* ModifierFlags.Export */)) { + if (flags & 1024 /* ModifierFlags.Default */ && !(flags & 1 /* ModifierFlags.Export */)) { // A non-exported default is a nonsequitor - we usually try to remove all export modifiers // from statements in ambient declarations; but a default export must retain its export modifier to be syntactically valid flags ^= 1 /* ModifierFlags.Export */; } - if (flags & 512 /* ModifierFlags.Default */ && flags & 2 /* ModifierFlags.Ambient */) { + if (flags & 1024 /* ModifierFlags.Default */ && flags & 2 /* ModifierFlags.Ambient */) { flags ^= 2 /* ModifierFlags.Ambient */; // `declare` is never required alongside `default` (and would be an error if printed) } return flags; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 172 /* SyntaxKind.GetAccessor */ + return accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? accessor.type // Getter - return type : accessor.parameters.length > 0 ? accessor.parameters[0].type // Setter parameter type @@ -110927,52 +111732,52 @@ var ts; } function canHaveLiteralInitializer(node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return !ts.hasEffectiveModifier(node, 8 /* ModifierFlags.Private */); - case 164 /* SyntaxKind.Parameter */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; } return false; } function isPreservedDeclarationStatement(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: return true; } return false; } function isProcessedComponent(node) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 254 /* SyntaxKind.VariableDeclaration */: - case 163 /* SyntaxKind.TypeParameter */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 178 /* SyntaxKind.TypeReference */: - case 189 /* SyntaxKind.ConditionalType */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 200 /* SyntaxKind.ImportType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: + case 191 /* SyntaxKind.ConditionalType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 202 /* SyntaxKind.ImportType */: return true; } return false; @@ -111112,7 +111917,7 @@ var ts; * @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files. */ function transformNodes(resolver, host, factory, options, nodes, transformers, allowDtsFiles) { - var enabledSyntaxKindFeatures = new Array(355 /* SyntaxKind.Count */); + var enabledSyntaxKindFeatures = new Array(358 /* SyntaxKind.Count */); var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentStatements; @@ -111194,7 +111999,7 @@ var ts; var transformed = []; for (var _a = 0, nodes_3 = nodes; _a < nodes_3.length; _a++) { var node = nodes_3[_a]; - ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* tracing.Phase.Emit */, "transformNodes", node.kind === 305 /* SyntaxKind.SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); + ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* tracing.Phase.Emit */, "transformNodes", node.kind === 308 /* SyntaxKind.SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); transformed.push((allowDtsFiles ? transformation : transformRoot)(node)); ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop(); } @@ -111600,7 +112405,7 @@ var ts; /*@internal*/ function getOutputPathsFor(sourceFile, host, forceDtsPaths) { var options = host.getCompilerOptions(); - if (sourceFile.kind === 306 /* SyntaxKind.Bundle */) { + if (sourceFile.kind === 309 /* SyntaxKind.Bundle */) { return getOutputPathsForBundle(options, forceDtsPaths); } else { @@ -111969,8 +112774,8 @@ var ts; } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) { var sourceFileOrBundle = transform.transformed[0]; - var bundle = sourceFileOrBundle.kind === 306 /* SyntaxKind.Bundle */ ? sourceFileOrBundle : undefined; - var sourceFile = sourceFileOrBundle.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFileOrBundle : undefined; + var bundle = sourceFileOrBundle.kind === 309 /* SyntaxKind.Bundle */ ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFileOrBundle : undefined; var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; var sourceMapGenerator; if (shouldEmitSourceMaps(mapOptions, sourceFileOrBundle)) { @@ -112020,7 +112825,7 @@ var ts; } function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) { return (mapOptions.sourceMap || mapOptions.inlineSourceMap) - && (sourceFileOrBundle.kind !== 305 /* SyntaxKind.SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Extension.Json */)); + && (sourceFileOrBundle.kind !== 308 /* SyntaxKind.SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Extension.Json */)); } function getSourceRoot(mapOptions) { // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the @@ -112083,8 +112888,8 @@ var ts; } ts.getBuildInfoText = getBuildInfoText; /*@internal*/ - function getBuildInfo(buildInfoText) { - return JSON.parse(buildInfoText); + function getBuildInfo(buildInfoFile, buildInfoText) { + return ts.readJsonOrUndefined(buildInfoFile, buildInfoText); } ts.getBuildInfo = getBuildInfo; /*@internal*/ @@ -112162,17 +112967,16 @@ var ts; var buildInfo; if (host.getBuildInfo) { // If host directly provides buildinfo we can get it directly. This allows host to cache the buildinfo - var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); - if (!hostBuildInfo) - return buildInfoPath; - buildInfo = hostBuildInfo; + buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); } else { var buildInfoText = host.readFile(buildInfoPath); if (!buildInfoText) return buildInfoPath; - buildInfo = getBuildInfo(buildInfoText); + buildInfo = getBuildInfo(buildInfoPath, buildInfoText); } + if (!buildInfo) + return buildInfoPath; if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts)) return buildInfoPath; var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath)); @@ -112298,6 +113102,10 @@ var ts; var nodeIdToGeneratedName; // Map of generated names for specific nodes. var autoGeneratedIdToGeneratedName; // Map of generated names for temp and loop variables. var generatedNames; // Set of names generated by the NameGenerator. + var formattedNameTempFlagsStack; + var formattedNameTempFlags; + var privateNameTempFlagsStack; // Stack of enclosing name generation scopes. + var privateNameTempFlags; // TempFlags for the current name generation scope. var tempFlagsStack; // Stack of enclosing name generation scopes. var tempFlags; // TempFlags for the current name generation scope. var reservedNamesStack; // Stack of TempFlags reserved in enclosing name generation scopes. @@ -112363,9 +113171,9 @@ var ts; break; } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: return printFile(node); - case 306 /* SyntaxKind.Bundle */: return printBundle(node); - case 307 /* SyntaxKind.UnparsedSource */: return printUnparsedSource(node); + case 308 /* SyntaxKind.SourceFile */: return printFile(node); + case 309 /* SyntaxKind.Bundle */: return printBundle(node); + case 310 /* SyntaxKind.UnparsedSource */: return printUnparsedSource(node); } writeNode(hint, node, sourceFile, beginPrint()); return endPrint(); @@ -112556,6 +113364,10 @@ var ts; nodeIdToGeneratedName = []; autoGeneratedIdToGeneratedName = []; generatedNames = new ts.Set(); + formattedNameTempFlagsStack = []; + formattedNameTempFlags = new ts.Map(); + privateNameTempFlagsStack = []; + privateNameTempFlags = 0 /* TempFlags.Auto */; tempFlagsStack = []; tempFlags = 0 /* TempFlags.Auto */; reservedNamesStack = []; @@ -112699,315 +113511,315 @@ var ts; return emitPrivateIdentifier(node); // Parse tree nodes // Names - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return emitQualifiedName(node); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return emitComputedPropertyName(node); // Signature elements - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return emitTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return emitParameter(node); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return emitDecorator(node); // Type members - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return emitPropertySignature(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return emitPropertyDeclaration(node); - case 168 /* SyntaxKind.MethodSignature */: + case 170 /* SyntaxKind.MethodSignature */: return emitMethodSignature(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return emitMethodDeclaration(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return emitClassStaticBlockDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return emitConstructor(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return emitAccessorDeclaration(node); - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: return emitCallSignature(node); - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return emitConstructSignature(node); - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return emitIndexSignature(node); // Types - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return emitTypePredicate(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return emitTypeReference(node); - case 179 /* SyntaxKind.FunctionType */: + case 181 /* SyntaxKind.FunctionType */: return emitFunctionType(node); - case 180 /* SyntaxKind.ConstructorType */: + case 182 /* SyntaxKind.ConstructorType */: return emitConstructorType(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return emitTypeQuery(node); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return emitTypeLiteral(node); - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return emitArrayType(node); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return emitTupleType(node); - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return emitOptionalType(node); // SyntaxKind.RestType is handled below - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return emitUnionType(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return emitIntersectionType(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return emitConditionalType(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return emitInferType(node); - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return emitParenthesizedType(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return emitThisType(); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return emitTypeOperator(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return emitIndexedAccessType(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return emitMappedType(node); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return emitLiteralType(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return emitNamedTupleMember(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return emitTemplateType(node); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: + case 201 /* SyntaxKind.TemplateLiteralTypeSpan */: return emitTemplateTypeSpan(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return emitImportTypeNode(node); // Binding patterns - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return emitBindingElement(node); // Misc - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return emitTemplateSpan(node); - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: return emitSemicolonClassElement(); // Statements - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return emitBlock(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return emitVariableStatement(node); - case 236 /* SyntaxKind.EmptyStatement */: + case 239 /* SyntaxKind.EmptyStatement */: return emitEmptyStatement(/*isEmbeddedStatement*/ false); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return emitExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return emitIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return emitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return emitWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return emitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return emitForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return emitForOfStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return emitContinueStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return emitBreakStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return emitReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return emitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return emitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return emitLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return emitThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return emitTryStatement(node); - case 253 /* SyntaxKind.DebuggerStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: return emitDebuggerStatement(node); // Declarations - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return emitVariableDeclaration(node); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return emitVariableDeclarationList(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return emitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return emitClassDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return emitEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return emitModuleDeclaration(node); - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return emitModuleBlock(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return emitCaseBlock(node); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return emitNamespaceExportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return emitImportDeclaration(node); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return emitImportClause(node); - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return emitNamespaceImport(node); - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: return emitNamespaceExport(node); - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: return emitNamedImports(node); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return emitImportSpecifier(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return emitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return emitExportDeclaration(node); - case 273 /* SyntaxKind.NamedExports */: + case 276 /* SyntaxKind.NamedExports */: return emitNamedExports(node); - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return emitExportSpecifier(node); - case 293 /* SyntaxKind.AssertClause */: + case 296 /* SyntaxKind.AssertClause */: return emitAssertClause(node); - case 294 /* SyntaxKind.AssertEntry */: + case 297 /* SyntaxKind.AssertEntry */: return emitAssertEntry(node); - case 276 /* SyntaxKind.MissingDeclaration */: + case 279 /* SyntaxKind.MissingDeclaration */: return; // Module references - case 277 /* SyntaxKind.ExternalModuleReference */: + case 280 /* SyntaxKind.ExternalModuleReference */: return emitExternalModuleReference(node); // JSX (non-expression) case 11 /* SyntaxKind.JsxText */: return emitJsxText(node); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 283 /* SyntaxKind.JsxOpeningFragment */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 286 /* SyntaxKind.JsxOpeningFragment */: return emitJsxOpeningElementOrFragment(node); - case 281 /* SyntaxKind.JsxClosingElement */: - case 284 /* SyntaxKind.JsxClosingFragment */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 287 /* SyntaxKind.JsxClosingFragment */: return emitJsxClosingElementOrFragment(node); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return emitJsxAttribute(node); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return emitJsxAttributes(node); - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: return emitJsxSpreadAttribute(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return emitJsxExpression(node); // Clauses - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return emitCaseClause(node); - case 290 /* SyntaxKind.DefaultClause */: + case 293 /* SyntaxKind.DefaultClause */: return emitDefaultClause(node); - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return emitHeritageClause(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return emitCatchClause(node); // Property assignments - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return emitPropertyAssignment(node); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return emitSpreadAssignment(node); // Enum - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return emitEnumMember(node); // Unparsed - case 300 /* SyntaxKind.UnparsedPrologue */: + case 303 /* SyntaxKind.UnparsedPrologue */: return writeUnparsedNode(node); - case 307 /* SyntaxKind.UnparsedSource */: - case 301 /* SyntaxKind.UnparsedPrepend */: + case 310 /* SyntaxKind.UnparsedSource */: + case 304 /* SyntaxKind.UnparsedPrepend */: return emitUnparsedSourceOrPrepend(node); - case 302 /* SyntaxKind.UnparsedText */: - case 303 /* SyntaxKind.UnparsedInternalText */: + case 305 /* SyntaxKind.UnparsedText */: + case 306 /* SyntaxKind.UnparsedInternalText */: return emitUnparsedTextLike(node); - case 304 /* SyntaxKind.UnparsedSyntheticReference */: + case 307 /* SyntaxKind.UnparsedSyntheticReference */: return emitUnparsedSyntheticReference(node); // Top-level nodes - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return emitSourceFile(node); - case 306 /* SyntaxKind.Bundle */: + case 309 /* SyntaxKind.Bundle */: return ts.Debug.fail("Bundles should be printed using printBundle"); // SyntaxKind.UnparsedSource (handled above) - case 308 /* SyntaxKind.InputFiles */: + case 311 /* SyntaxKind.InputFiles */: return ts.Debug.fail("InputFiles should not be printed"); // JSDoc nodes (only used in codefixes currently) - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return emitJSDocTypeExpression(node); - case 310 /* SyntaxKind.JSDocNameReference */: + case 313 /* SyntaxKind.JSDocNameReference */: return emitJSDocNameReference(node); - case 312 /* SyntaxKind.JSDocAllType */: + case 315 /* SyntaxKind.JSDocAllType */: return writePunctuation("*"); - case 313 /* SyntaxKind.JSDocUnknownType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return writePunctuation("?"); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return emitJSDocNullableType(node); - case 315 /* SyntaxKind.JSDocNonNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: return emitJSDocNonNullableType(node); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return emitJSDocOptionalType(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return emitJSDocFunctionType(node); - case 186 /* SyntaxKind.RestType */: - case 318 /* SyntaxKind.JSDocVariadicType */: + case 188 /* SyntaxKind.RestType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return emitRestOrJSDocVariadicType(node); - case 319 /* SyntaxKind.JSDocNamepathType */: + case 322 /* SyntaxKind.JSDocNamepathType */: return; - case 320 /* SyntaxKind.JSDoc */: + case 323 /* SyntaxKind.JSDoc */: return emitJSDoc(node); - case 322 /* SyntaxKind.JSDocTypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: return emitJSDocTypeLiteral(node); - case 323 /* SyntaxKind.JSDocSignature */: + case 326 /* SyntaxKind.JSDocSignature */: return emitJSDocSignature(node); - case 327 /* SyntaxKind.JSDocTag */: - case 332 /* SyntaxKind.JSDocClassTag */: - case 337 /* SyntaxKind.JSDocOverrideTag */: + case 330 /* SyntaxKind.JSDocTag */: + case 335 /* SyntaxKind.JSDocClassTag */: + case 340 /* SyntaxKind.JSDocOverrideTag */: return emitJSDocSimpleTag(node); - case 328 /* SyntaxKind.JSDocAugmentsTag */: - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return emitJSDocHeritageTag(node); - case 330 /* SyntaxKind.JSDocAuthorTag */: - case 331 /* SyntaxKind.JSDocDeprecatedTag */: + case 333 /* SyntaxKind.JSDocAuthorTag */: + case 334 /* SyntaxKind.JSDocDeprecatedTag */: return; // SyntaxKind.JSDocClassTag (see JSDocTag, above) - case 333 /* SyntaxKind.JSDocPublicTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 336 /* SyntaxKind.JSDocReadonlyTag */: + case 336 /* SyntaxKind.JSDocPublicTag */: + case 337 /* SyntaxKind.JSDocPrivateTag */: + case 338 /* SyntaxKind.JSDocProtectedTag */: + case 339 /* SyntaxKind.JSDocReadonlyTag */: return; - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return emitJSDocCallbackTag(node); // SyntaxKind.JSDocEnumTag (see below) - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return emitJSDocPropertyLikeTag(node); - case 339 /* SyntaxKind.JSDocEnumTag */: - case 341 /* SyntaxKind.JSDocReturnTag */: - case 342 /* SyntaxKind.JSDocThisTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: + case 345 /* SyntaxKind.JSDocThisTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return emitJSDocSimpleTypedTag(node); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return emitJSDocTemplateTag(node); - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return emitJSDocTypedefTag(node); - case 346 /* SyntaxKind.JSDocSeeTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: return emitJSDocSeeTag(node); // SyntaxKind.JSDocPropertyTag (see JSDocParameterTag, above) // Transformation nodes - case 349 /* SyntaxKind.NotEmittedStatement */: - case 353 /* SyntaxKind.EndOfDeclarationMarker */: - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 352 /* SyntaxKind.NotEmittedStatement */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return; } if (ts.isExpression(node)) { @@ -113039,85 +113851,87 @@ var ts; case 80 /* SyntaxKind.PrivateIdentifier */: return emitPrivateIdentifier(node); // Expressions - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return emitArrayLiteralExpression(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return emitObjectLiteralExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return emitPropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return emitElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return emitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return emitNewExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return emitTypeAssertionExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return emitParenthesizedExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return emitFunctionExpression(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return emitArrowFunction(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return emitDeleteExpression(node); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return emitTypeOfExpression(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return emitVoidExpression(node); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return emitAwaitExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return emitBinaryExpression(node); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return emitConditionalExpression(node); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return emitTemplateExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return emitYieldExpression(node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return emitSpreadElement(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return emitClassExpression(node); - case 227 /* SyntaxKind.OmittedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: return; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: return emitAsExpression(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return emitNonNullExpression(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 231 /* SyntaxKind.MetaProperty */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return emitSatisfiesExpression(node); + case 233 /* SyntaxKind.MetaProperty */: return emitMetaProperty(node); - case 232 /* SyntaxKind.SyntheticExpression */: + case 234 /* SyntaxKind.SyntheticExpression */: return ts.Debug.fail("SyntheticExpression should never be printed."); // JSX - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return emitJsxElement(node); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return emitJsxFragment(node); // Synthesized list - case 348 /* SyntaxKind.SyntaxList */: + case 351 /* SyntaxKind.SyntaxList */: return ts.Debug.fail("SyntaxList should not be printed"); // Transformation nodes - case 349 /* SyntaxKind.NotEmittedStatement */: + case 352 /* SyntaxKind.NotEmittedStatement */: return; - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return emitCommaList(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return; - case 354 /* SyntaxKind.SyntheticReferenceExpression */: + case 357 /* SyntaxKind.SyntheticReferenceExpression */: return ts.Debug.fail("SyntheticReferenceExpression should not be printed"); } } @@ -113165,7 +113979,7 @@ var ts; } function emitHelpers(node) { var helpersEmitted = false; - var bundle = node.kind === 306 /* SyntaxKind.Bundle */ ? node : undefined; + var bundle = node.kind === 309 /* SyntaxKind.Bundle */ ? node : undefined; if (bundle && moduleKind === ts.ModuleKind.None) { return; } @@ -113265,7 +114079,7 @@ var ts; var pos = getTextPosWithWriteLine(); writeUnparsedNode(unparsed); if (bundleFileInfo) { - updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 302 /* SyntaxKind.UnparsedText */ ? + updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 305 /* SyntaxKind.UnparsedText */ ? "text" /* BundleFileSectionKind.Text */ : "internal" /* BundleFileSectionKind.Internal */); } @@ -113302,7 +114116,7 @@ var ts; } function emitTabStop(hint, node, snippet) { // A tab stop should only be attached to an empty node, i.e. a node that doesn't emit any text. - ts.Debug.assert(node.kind === 236 /* SyntaxKind.EmptyStatement */, "A tab stop cannot be attached to a node of kind ".concat(ts.Debug.formatSyntaxKind(node.kind), ".")); + ts.Debug.assert(node.kind === 239 /* SyntaxKind.EmptyStatement */, "A tab stop cannot be attached to a node of kind ".concat(ts.Debug.formatSyntaxKind(node.kind), ".")); ts.Debug.assert(hint !== 5 /* EmitHint.EmbeddedStatement */, "A tab stop cannot be attached to an embedded statement."); nonEscapingWrite("$".concat(snippet.order)); } @@ -113363,7 +114177,7 @@ var ts; emit(node.dotDotDotToken); emitNodeWithWriter(node.name, writeParameter); emit(node.questionToken); - if (node.parent && node.parent.kind === 317 /* SyntaxKind.JSDocFunctionType */ && !node.name) { + if (node.parent && node.parent.kind === 320 /* SyntaxKind.JSDocFunctionType */ && !node.name) { emit(node.type); } else { @@ -113424,7 +114238,7 @@ var ts; } function emitAccessorDeclaration(node) { emitDecoratorsAndModifiers(node, node.modifiers); - writeKeyword(node.kind === 172 /* SyntaxKind.GetAccessor */ ? "get" : "set"); + writeKeyword(node.kind === 174 /* SyntaxKind.GetAccessor */ ? "get" : "set"); writeSpace(); emit(node.name); emitSignatureAndBody(node, emitSignatureHead); @@ -113597,7 +114411,7 @@ var ts; function emitTypeOperator(node) { writeTokenText(node.operator, writeKeyword); writeSpace(); - var parenthesizerRule = node.operator === 145 /* SyntaxKind.ReadonlyKeyword */ ? + var parenthesizerRule = node.operator === 146 /* SyntaxKind.ReadonlyKeyword */ ? parenthesizer.parenthesizeOperandOfReadonlyTypeOperator : parenthesizer.parenthesizeOperandOfTypeOperator; emit(node.type, parenthesizerRule); @@ -113620,7 +114434,7 @@ var ts; } if (node.readonlyToken) { emit(node.readonlyToken); - if (node.readonlyToken.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { + if (node.readonlyToken.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { writeKeyword("readonly"); } writeSpace(); @@ -113866,7 +114680,7 @@ var ts; emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } function emitAwaitExpression(node) { - emitTokenWithComment(132 /* SyntaxKind.AwaitKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(133 /* SyntaxKind.AwaitKeyword */, node.pos, writeKeyword, node); writeSpace(); emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } @@ -113891,7 +114705,7 @@ var ts; // expression a prefix increment whose operand is a plus expression - (++(+x)) // The same is true of minus of course. var operand = node.operand; - return operand.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ + return operand.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && ((node.operator === 39 /* SyntaxKind.PlusToken */ && (operand.operator === 39 /* SyntaxKind.PlusToken */ || operand.operator === 45 /* SyntaxKind.PlusPlusToken */)) || (node.operator === 40 /* SyntaxKind.MinusToken */ && (operand.operator === 40 /* SyntaxKind.MinusToken */ || operand.operator === 46 /* SyntaxKind.MinusMinusToken */))); } @@ -114039,6 +114853,15 @@ var ts; emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess); writeOperator("!"); } + function emitSatisfiesExpression(node) { + emitExpression(node.expression, /*parenthesizerRules*/ undefined); + if (node.type) { + writeSpace(); + writeKeyword("satisfies"); + writeSpace(); + emit(node.type); + } + } function emitMetaProperty(node) { writeToken(node.keywordToken, node.pos, writePunctuation); writePunctuation("."); @@ -114096,7 +114919,7 @@ var ts; if (node.elseStatement) { writeLineOrSpace(node, node.thenStatement, node.elseStatement); emitTokenWithComment(91 /* SyntaxKind.ElseKeyword */, node.thenStatement.end, writeKeyword, node); - if (node.elseStatement.kind === 239 /* SyntaxKind.IfStatement */) { + if (node.elseStatement.kind === 242 /* SyntaxKind.IfStatement */) { writeSpace(); emit(node.elseStatement); } @@ -114159,7 +114982,7 @@ var ts; emitTokenWithComment(20 /* SyntaxKind.OpenParenToken */, openParenPos, writePunctuation, node); emitForBinding(node.initializer); writeSpace(); - emitTokenWithComment(160 /* SyntaxKind.OfKeyword */, node.initializer.end, writeKeyword, node); + emitTokenWithComment(162 /* SyntaxKind.OfKeyword */, node.initializer.end, writeKeyword, node); writeSpace(); emitExpression(node.expression); emitTokenWithComment(21 /* SyntaxKind.CloseParenToken */, node.expression.end, writePunctuation, node); @@ -114167,7 +114990,7 @@ var ts; } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { emit(node); } else { @@ -114204,7 +115027,7 @@ var ts; } pos = writeTokenText(token, writer, pos); if (isSimilarNode && contextNode.end !== pos) { - var isJsxExprContext = contextNode.kind === 288 /* SyntaxKind.JsxExpression */; + var isJsxExprContext = contextNode.kind === 291 /* SyntaxKind.JsxExpression */; emitTrailingCommentsOfPosition(pos, /*prefixSpace*/ !isJsxExprContext, /*forceNoNewline*/ isJsxExprContext); } return pos; @@ -114514,7 +115337,7 @@ var ts; emitTokenWithComment(100 /* SyntaxKind.ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114539,7 +115362,7 @@ var ts; if (node.importClause) { emit(node.importClause); writeSpace(); - emitTokenWithComment(156 /* SyntaxKind.FromKeyword */, node.importClause.end, writeKeyword, node); + emitTokenWithComment(158 /* SyntaxKind.FromKeyword */, node.importClause.end, writeKeyword, node); writeSpace(); } emitExpression(node.moduleSpecifier); @@ -114550,7 +115373,7 @@ var ts; } function emitImportClause(node) { if (node.isTypeOnly) { - emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114563,7 +115386,7 @@ var ts; function emitNamespaceImport(node) { var asPos = emitTokenWithComment(41 /* SyntaxKind.AsteriskToken */, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -114589,10 +115412,11 @@ var ts; writeTrailingSemicolon(); } function emitExportDeclaration(node) { + emitModifiers(node, node.modifiers); var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - nextPos = emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, nextPos, writeKeyword, node); writeSpace(); } if (node.exportClause) { @@ -114604,7 +115428,7 @@ var ts; if (node.moduleSpecifier) { writeSpace(); var fromPos = node.exportClause ? node.exportClause.end : nextPos; - emitTokenWithComment(156 /* SyntaxKind.FromKeyword */, fromPos, writeKeyword, node); + emitTokenWithComment(158 /* SyntaxKind.FromKeyword */, fromPos, writeKeyword, node); writeSpace(); emitExpression(node.moduleSpecifier); } @@ -114614,7 +115438,7 @@ var ts; writeTrailingSemicolon(); } function emitAssertClause(node) { - emitTokenWithComment(129 /* SyntaxKind.AssertKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(130 /* SyntaxKind.AssertKeyword */, node.pos, writeKeyword, node); writeSpace(); var elements = node.elements; emitList(node, elements, 526226 /* ListFormat.ImportClauseEntries */); @@ -114634,9 +115458,9 @@ var ts; function emitNamespaceExportDeclaration(node) { var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, nextPos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(142 /* SyntaxKind.NamespaceKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(143 /* SyntaxKind.NamespaceKeyword */, nextPos, writeKeyword, node); writeSpace(); emit(node.name); writeTrailingSemicolon(); @@ -114644,7 +115468,7 @@ var ts; function emitNamespaceExport(node) { var asPos = emitTokenWithComment(41 /* SyntaxKind.AsteriskToken */, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -114667,7 +115491,7 @@ var ts; if (node.propertyName) { emit(node.propertyName); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, node.propertyName.end, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, node.propertyName.end, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114888,7 +115712,7 @@ var ts; } } if (node.tags) { - if (node.tags.length === 1 && node.tags[0].kind === 343 /* SyntaxKind.JSDocTypeTag */ && !node.comment) { + if (node.tags.length === 1 && node.tags[0].kind === 346 /* SyntaxKind.JSDocTypeTag */ && !node.comment) { writeSpace(); emit(node.tags[0]); } @@ -114933,7 +115757,7 @@ var ts; function emitJSDocTypedefTag(tag) { emitJSDocTagName(tag.tagName); if (tag.typeExpression) { - if (tag.typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */) { + if (tag.typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */) { emitJSDocTypeExpression(tag.typeExpression); } else { @@ -114952,7 +115776,7 @@ var ts; emit(tag.fullName); } emitJSDocComment(tag.comment); - if (tag.typeExpression && tag.typeExpression.kind === 322 /* SyntaxKind.JSDocTypeLiteral */) { + if (tag.typeExpression && tag.typeExpression.kind === 325 /* SyntaxKind.JSDocTypeLiteral */) { emitJSDocTypeLiteral(tag.typeExpression); } } @@ -115885,13 +116709,13 @@ var ts; && (!currentSourceFile || ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile)); } function skipSynthesizedParentheses(node) { - while (node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { + while (node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; } function getTextOfNode(node, includeTrivia) { - if (ts.isGeneratedIdentifier(node)) { + if (ts.isGeneratedIdentifier(node) || ts.isGeneratedPrivateIdentifier(node)) { return generateName(node); } if (ts.isStringLiteral(node) && node.textSourceNode) { @@ -115915,7 +116739,7 @@ var ts; function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) { if (node.kind === 10 /* SyntaxKind.StringLiteral */ && node.textSourceNode) { var textSourceNode = node.textSourceNode; - if (ts.isIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) { + if (ts.isIdentifier(textSourceNode) || ts.isPrivateIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) { var text = ts.isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode(textSourceNode); return jsxAttributeEscape ? "\"".concat(ts.escapeJsxAttributeString(text), "\"") : neverAsciiEscape || (ts.getEmitFlags(node) & 16777216 /* EmitFlags.NoAsciiEscaping */) ? "\"".concat(ts.escapeString(text), "\"") : @@ -115939,7 +116763,11 @@ var ts; return; } tempFlagsStack.push(tempFlags); - tempFlags = 0; + tempFlags = 0 /* TempFlags.Auto */; + privateNameTempFlagsStack.push(privateNameTempFlags); + privateNameTempFlags = 0 /* TempFlags.Auto */; + formattedNameTempFlagsStack.push(formattedNameTempFlags); + formattedNameTempFlags = undefined; reservedNamesStack.push(reservedNames); } /** @@ -115950,6 +116778,8 @@ var ts; return; } tempFlags = tempFlagsStack.pop(); + privateNameTempFlags = privateNameTempFlagsStack.pop(); + formattedNameTempFlags = formattedNameTempFlagsStack.pop(); reservedNames = reservedNamesStack.pop(); } function reserveNameInNestedScopes(name) { @@ -115962,84 +116792,84 @@ var ts; if (!node) return; switch (node.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: ts.forEach(node.statements, generateNames); break; - case 250 /* SyntaxKind.LabeledStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 253 /* SyntaxKind.LabeledStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: generateNames(node.statement); break; - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: generateNames(node.thenStatement); generateNames(node.elseStatement); break; - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: generateNames(node.initializer); generateNames(node.statement); break; - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: generateNames(node.caseBlock); break; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: ts.forEach(node.clauses, generateNames); break; - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: ts.forEach(node.statements, generateNames); break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: generateNames(node.tryBlock); generateNames(node.catchClause); generateNames(node.finallyBlock); break; - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: generateNames(node.variableDeclaration); generateNames(node.block); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: generateNames(node.declarationList); break; - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: ts.forEach(node.declarations, generateNames); break; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: generateNameIfNeeded(node.name); break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: generateNameIfNeeded(node.name); if (ts.getEmitFlags(node) & 524288 /* EmitFlags.ReuseTempVariableScope */) { ts.forEach(node.parameters, generateNames); generateNames(node.body); } break; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: ts.forEach(node.elements, generateNames); break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: generateNames(node.importClause); break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: generateNameIfNeeded(node.name); generateNames(node.namedBindings); break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: generateNameIfNeeded(node.name); break; - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: generateNameIfNeeded(node.name); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: ts.forEach(node.elements, generateNames); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: generateNameIfNeeded(node.propertyName || node.name); break; } @@ -116048,19 +116878,19 @@ var ts; if (!node) return; switch (node.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: generateNameIfNeeded(node.name); break; } } function generateNameIfNeeded(name) { if (name) { - if (ts.isGeneratedIdentifier(name)) { + if (ts.isGeneratedIdentifier(name) || ts.isGeneratedPrivateIdentifier(name)) { generateName(name); } else if (ts.isBindingPattern(name)) { @@ -116075,7 +116905,7 @@ var ts; if ((name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) === 4 /* GeneratedIdentifierFlags.Node */) { // Node names generate unique names based on their original node // and are cached based on that node's id. - return generateNameCached(getNodeForGeneratedName(name), name.autoGenerateFlags); + return generateNameCached(ts.getNodeForGeneratedName(name), ts.isPrivateIdentifier(name), name.autoGenerateFlags, name.autoGeneratePrefix, name.autoGenerateSuffix); } else { // Auto, Loop, and Unique names are cached based on their unique @@ -116084,9 +116914,9 @@ var ts; return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = makeName(name)); } } - function generateNameCached(node, flags) { + function generateNameCached(node, privateName, flags, prefix, suffix) { var nodeId = ts.getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, flags)); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, privateName, flags !== null && flags !== void 0 ? flags : 0 /* GeneratedIdentifierFlags.None */, ts.formatGeneratedNamePart(prefix, generateName), ts.formatGeneratedNamePart(suffix))); } /** * Returns a value indicating whether a name is unique globally, within the current file, @@ -116118,20 +116948,53 @@ var ts; } return true; } + function getTempFlags(formattedNameKey) { + var _a; + switch (formattedNameKey) { + case "": + return tempFlags; + case "#": + return privateNameTempFlags; + default: + return (_a = formattedNameTempFlags === null || formattedNameTempFlags === void 0 ? void 0 : formattedNameTempFlags.get(formattedNameKey)) !== null && _a !== void 0 ? _a : 0 /* TempFlags.Auto */; + } + } + function setTempFlags(formattedNameKey, flags) { + switch (formattedNameKey) { + case "": + tempFlags = flags; + break; + case "#": + privateNameTempFlags = flags; + break; + default: + formattedNameTempFlags !== null && formattedNameTempFlags !== void 0 ? formattedNameTempFlags : (formattedNameTempFlags = new ts.Map()); + formattedNameTempFlags.set(formattedNameKey, flags); + break; + } + } /** * Return the next available name in the pattern _a ... _z, _0, _1, ... * TempFlags._i or TempFlags._n may be used to express a preference for that dedicated name. * Note that names generated by makeTempVariableName and makeUniqueName will never conflict. */ - function makeTempVariableName(flags, reservedInNestedScopes) { + function makeTempVariableName(flags, reservedInNestedScopes, privateName, prefix, suffix) { + if (prefix.length > 0 && prefix.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + prefix = prefix.slice(1); + } + // Generate a key to use to acquire a TempFlags counter based on the fixed portions of the generated name. + var key = ts.formatGeneratedName(privateName, prefix, "", suffix); + var tempFlags = getTempFlags(key); if (flags && !(tempFlags & flags)) { var name = flags === 268435456 /* TempFlags._i */ ? "_i" : "_n"; - if (isUniqueName(name)) { + var fullName = ts.formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { tempFlags |= flags; if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } while (true) { @@ -116142,11 +117005,13 @@ var ts; var name = count < 26 ? "_" + String.fromCharCode(97 /* CharacterCodes.a */ + count) : "_" + (count - 26); - if (isUniqueName(name)) { + var fullName = ts.formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } } @@ -116158,17 +117023,24 @@ var ts; * makeUniqueName are guaranteed to never conflict. * If `optimistic` is set, the first instance will use 'baseName' verbatim instead of 'baseName_1' */ - function makeUniqueName(baseName, checkFn, optimistic, scoped) { + function makeUniqueName(baseName, checkFn, optimistic, scoped, privateName, prefix, suffix) { if (checkFn === void 0) { checkFn = isUniqueName; } + if (baseName.length > 0 && baseName.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + baseName = baseName.slice(1); + } + if (prefix.length > 0 && prefix.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + prefix = prefix.slice(1); + } if (optimistic) { - if (checkFn(baseName)) { + var fullName = ts.formatGeneratedName(privateName, prefix, baseName, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(baseName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(baseName); + generatedNames.add(fullName); } - return baseName; + return fullName; } } // Find the first unique 'name_n', where n is a positive number @@ -116177,21 +117049,21 @@ var ts; } var i = 1; while (true) { - var generatedName = baseName + i; - if (checkFn(generatedName)) { + var fullName = ts.formatGeneratedName(privateName, prefix, baseName + i, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(generatedName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(generatedName); + generatedNames.add(fullName); } - return generatedName; + return fullName; } i++; } } function makeFileLevelOptimisticUniqueName(name) { - return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true); + return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a ModuleDeclaration or EnumDeclaration. @@ -116199,7 +117071,7 @@ var ts; function generateNameForModuleOrEnum(node) { var name = getTextOfNode(node.name); // Use module/enum name itself if it is unique, otherwise make a unique variation - return isUniqueLocalName(name, node) ? name : makeUniqueName(name); + return isUniqueLocalName(name, node) ? name : makeUniqueName(name, isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for an ImportDeclaration or ExportDeclaration. @@ -116208,89 +117080,76 @@ var ts; var expr = ts.getExternalModuleName(node); // TODO: GH#18217 var baseName = ts.isStringLiteral(expr) ? ts.makeIdentifierFromModuleName(expr.text) : "module"; - return makeUniqueName(baseName); + return makeUniqueName(baseName, isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a default export. */ function generateNameForExportDefault() { - return makeUniqueName("default"); + return makeUniqueName("default", isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a class expression. */ function generateNameForClassExpression() { - return makeUniqueName("class"); + return makeUniqueName("class", isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } - function generateNameForMethodOrAccessor(node) { + function generateNameForMethodOrAccessor(node, privateName, prefix, suffix) { if (ts.isIdentifier(node.name)) { - return generateNameCached(node.name); + return generateNameCached(node.name, privateName); } - return makeTempVariableName(0 /* TempFlags.Auto */); + return makeTempVariableName(0 /* TempFlags.Auto */, /*reservedInNestedScopes*/ false, privateName, prefix, suffix); } /** * Generates a unique name from a node. */ - function generateNameForNode(node, flags) { + function generateNameForNode(node, privateName, flags, prefix, suffix) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(flags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 80 /* SyntaxKind.PrivateIdentifier */: + return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(flags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), privateName, prefix, suffix); + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForModuleOrEnum(node); - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForImportOrExportDeclaration(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForExportDefault(); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForClassExpression(); - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return generateNameForMethodOrAccessor(node); - case 162 /* SyntaxKind.ComputedPropertyName */: - return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ true); + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return generateNameForMethodOrAccessor(node, privateName, prefix, suffix); + case 164 /* SyntaxKind.ComputedPropertyName */: + return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ true, privateName, prefix, suffix); default: - return makeTempVariableName(0 /* TempFlags.Auto */); + return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ false, privateName, prefix, suffix); } } /** * Generates a unique identifier for a node. */ function makeName(name) { + var prefix = ts.formatGeneratedNamePart(name.autoGeneratePrefix, generateName); + var suffix = ts.formatGeneratedNamePart(name.autoGenerateSuffix); switch (name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) { case 1 /* GeneratedIdentifierFlags.Auto */: - return makeTempVariableName(0 /* TempFlags.Auto */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + return makeTempVariableName(0 /* TempFlags.Auto */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), ts.isPrivateIdentifier(name), prefix, suffix); case 2 /* GeneratedIdentifierFlags.Loop */: - return makeTempVariableName(268435456 /* TempFlags._i */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + ts.Debug.assertNode(name, ts.isIdentifier); + return makeTempVariableName(268435456 /* TempFlags._i */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), /*privateName*/ false, prefix, suffix); case 3 /* GeneratedIdentifierFlags.Unique */: - return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32 /* GeneratedIdentifierFlags.FileLevel */) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32 /* GeneratedIdentifierFlags.FileLevel */) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), ts.isPrivateIdentifier(name), prefix, suffix); } - return ts.Debug.fail("Unsupported GeneratedIdentifierKind."); - } - /** - * Gets the node from which a name should be generated. - */ - function getNodeForGeneratedName(name) { - var autoGenerateId = name.autoGenerateId; - var node = name; - var original = node.original; - while (original) { - node = original; - // if "node" is a different generated name (having a different - // "autoGenerateId"), use it and stop traversing. - if (ts.isIdentifier(node) - && !!(node.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) - && node.autoGenerateId !== autoGenerateId) { - break; - } - original = node.original; - } - // otherwise, return the original node for the source; - return node; + return ts.Debug.fail("Unsupported GeneratedIdentifierKind: ".concat(ts.Debug.formatEnum(name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */, ts.GeneratedIdentifierFlags, /*isFlags*/ true), ".")); } // Comments function pipelineEmitWithComments(hint, node) { @@ -116336,7 +117195,7 @@ var ts; // Emit leading comments if the position is not synthesized and the node // has not opted out from emitting leading comments. if (!skipLeadingComments) { - emitLeadingComments(pos, /*isEmittedNode*/ node.kind !== 349 /* SyntaxKind.NotEmittedStatement */); + emitLeadingComments(pos, /*isEmittedNode*/ node.kind !== 352 /* SyntaxKind.NotEmittedStatement */); } if (!skipLeadingComments || (pos >= 0 && (emitFlags & 512 /* EmitFlags.NoLeadingComments */) !== 0)) { // Advance the container position if comments get emitted or if they've been disabled explicitly using NoLeadingComments. @@ -116347,7 +117206,7 @@ var ts; containerEnd = end; // To avoid invalid comment emit in a down-level binding pattern, we // keep track of the last declaration list container's end - if (node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { declarationListContainerEnd = end; } } @@ -116366,7 +117225,7 @@ var ts; declarationListContainerEnd = savedDeclarationListContainerEnd; // Emit trailing comments if the position is not synthesized and the node // has not opted out from emitting leading comments and is an emitted node. - if (!skipTrailingComments && node.kind !== 349 /* SyntaxKind.NotEmittedStatement */) { + if (!skipTrailingComments && node.kind !== 352 /* SyntaxKind.NotEmittedStatement */) { emitTrailingComments(end); } } @@ -116647,7 +117506,7 @@ var ts; } else { var source = sourceMapRange.source || sourceMapSource; - if (node.kind !== 349 /* SyntaxKind.NotEmittedStatement */ + if (node.kind !== 352 /* SyntaxKind.NotEmittedStatement */ && (emitFlags & 16 /* EmitFlags.NoLeadingSourceMap */) === 0 && sourceMapRange.pos >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, skipSourceTrivia(source, sourceMapRange.pos)); @@ -116665,7 +117524,7 @@ var ts; if (emitFlags & 64 /* EmitFlags.NoNestedSourceMaps */) { sourceMapsDisabled = false; } - if (node.kind !== 349 /* SyntaxKind.NotEmittedStatement */ + if (node.kind !== 352 /* SyntaxKind.NotEmittedStatement */ && (emitFlags & 32 /* EmitFlags.NoTrailingSourceMap */) === 0 && sourceMapRange.end >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, sourceMapRange.end); @@ -116830,7 +117689,16 @@ var ts; return cachedReadDirectoryResult.get(ts.ensureTrailingDirectorySeparator(rootDirPath)); } function getCachedFileSystemEntriesForBaseDir(path) { - return getCachedFileSystemEntries(ts.getDirectoryPath(path)); + var entries = getCachedFileSystemEntries(ts.getDirectoryPath(path)); + if (!entries) { + return entries; + } + // If we're looking for the base directory, we're definitely going to search the entries + if (!entries.sortedAndCanonicalizedFiles) { + entries.sortedAndCanonicalizedFiles = entries.files.map(getCanonicalFileName).sort(); + entries.sortedAndCanonicalizedDirectories = entries.directories.map(getCanonicalFileName).sort(); + } + return entries; } function getBaseNameOfFileName(fileName) { return ts.getBaseFileName(ts.normalizePath(fileName)); @@ -116873,21 +117741,10 @@ var ts; return undefined; } } - function fileNameEqual(name1, name2) { - return getCanonicalFileName(name1) === getCanonicalFileName(name2); - } function hasEntry(entries, name) { - return ts.some(entries, function (file) { return fileNameEqual(file, name); }); - } - function updateFileSystemEntry(entries, baseName, isValid) { - if (hasEntry(entries, baseName)) { - if (!isValid) { - return ts.filterMutate(entries, function (entry) { return !fileNameEqual(entry, baseName); }); - } - } - else if (isValid) { - return entries.push(baseName); - } + // Case-sensitive comparison since already canonicalized + var index = ts.binarySearch(entries, name, ts.identity, ts.compareStringsCaseSensitive); + return index >= 0; } function writeFile(fileName, data, writeByteOrderMark) { var path = toPath(fileName); @@ -116900,7 +117757,7 @@ var ts; function fileExists(fileName) { var path = toPath(fileName); var result = getCachedFileSystemEntriesForBaseDir(path); - return result && hasEntry(result.files, getBaseNameOfFileName(fileName)) || + return result && hasEntry(result.sortedAndCanonicalizedFiles, getCanonicalFileName(getBaseNameOfFileName(fileName))) || host.fileExists(fileName); } function directoryExists(dirPath) { @@ -116910,9 +117767,14 @@ var ts; function createDirectory(dirPath) { var path = toPath(dirPath); var result = getCachedFileSystemEntriesForBaseDir(path); - var baseFileName = getBaseNameOfFileName(dirPath); if (result) { - updateFileSystemEntry(result.directories, baseFileName, /*isValid*/ true); + var baseName = getBaseNameOfFileName(dirPath); + var canonicalizedBaseName = getCanonicalFileName(baseName); + var canonicalizedDirectories = result.sortedAndCanonicalizedDirectories; + // Case-sensitive comparison since already canonicalized + if (ts.insertSorted(canonicalizedDirectories, canonicalizedBaseName, ts.compareStringsCaseSensitive)) { + result.directories.push(baseName); + } } host.createDirectory(dirPath); } @@ -116981,7 +117843,7 @@ var ts; fileExists: host.fileExists(fileOrDirectoryPath), directoryExists: host.directoryExists(fileOrDirectoryPath) }; - if (fsQueryResult.directoryExists || hasEntry(parentResult.directories, baseName)) { + if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) { // Folder added or removed, clear the cache instead of updating the folder and its structure clearCache(); } @@ -117001,7 +117863,23 @@ var ts; } } function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists) { - updateFileSystemEntry(parentResult.files, baseName, fileExists); + var canonicalizedFiles = parentResult.sortedAndCanonicalizedFiles; + var canonicalizedBaseName = getCanonicalFileName(baseName); + if (fileExists) { + // Case-sensitive comparison since already canonicalized + if (ts.insertSorted(canonicalizedFiles, canonicalizedBaseName, ts.compareStringsCaseSensitive)) { + parentResult.files.push(baseName); + } + } + else { + // Case-sensitive comparison since already canonicalized + var sortedIndex = ts.binarySearch(canonicalizedFiles, canonicalizedBaseName, ts.identity, ts.compareStringsCaseSensitive); + if (sortedIndex >= 0) { + canonicalizedFiles.splice(sortedIndex, 1); + var unsortedIndex = parentResult.files.findIndex(function (entry) { return getCanonicalFileName(entry) === canonicalizedBaseName; }); + parentResult.files.splice(unsortedIndex, 1); + } + } } function clearCache() { cachedReadDirectoryResult.clear(); @@ -117761,7 +118639,6 @@ var ts; return resolutions; } ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache; - ; /** * Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly * provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file. @@ -118066,7 +118943,7 @@ var ts; state.failedLookupLocations = packageJsonLocations; state.affectingLocations = packageJsonLocations; var packageJsonScope = ts.getPackageScopeForPath(fileName, state); - var impliedNodeFormat = (packageJsonScope === null || packageJsonScope === void 0 ? void 0 : packageJsonScope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS; + var impliedNodeFormat = (packageJsonScope === null || packageJsonScope === void 0 ? void 0 : packageJsonScope.contents.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS; return { impliedNodeFormat: impliedNodeFormat, packageJsonLocations: packageJsonLocations, packageJsonScope: packageJsonScope }; } } @@ -119306,22 +120183,22 @@ var ts; // Return directly from the case if the given node doesnt want to visit each child // Otherwise break to visit each child switch (parent.kind) { - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: if (parent.questionToken === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?")); return "skip"; } // falls through - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 257 /* SyntaxKind.VariableDeclaration */: // type annotation if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_annotations_can_only_be_used_in_TypeScript_files)); @@ -119329,65 +120206,68 @@ var ts; } } switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "import type")); return "skip"; } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "export type")); return "skip"; } break; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, ts.isImportSpecifier(node) ? "import...type" : "export...type")); return "skip"; } break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_TypeScript_files)); return "skip"; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: var heritageClause = node; if (heritageClause.token === 117 /* SyntaxKind.ImplementsKeyword */) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: var interfaceKeyword = ts.tokenToString(118 /* SyntaxKind.InterfaceKeyword */); ts.Debug.assertIsDefined(interfaceKeyword); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, interfaceKeyword)); return "skip"; - case 261 /* SyntaxKind.ModuleDeclaration */: - var moduleKeyword = node.flags & 16 /* NodeFlags.Namespace */ ? ts.tokenToString(142 /* SyntaxKind.NamespaceKeyword */) : ts.tokenToString(141 /* SyntaxKind.ModuleKeyword */); + case 264 /* SyntaxKind.ModuleDeclaration */: + var moduleKeyword = node.flags & 16 /* NodeFlags.Namespace */ ? ts.tokenToString(143 /* SyntaxKind.NamespaceKeyword */) : ts.tokenToString(142 /* SyntaxKind.ModuleKeyword */); ts.Debug.assertIsDefined(moduleKeyword); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, moduleKeyword)); return "skip"; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files)); return "skip"; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: var enumKeyword = ts.Debug.checkDefined(ts.tokenToString(92 /* SyntaxKind.EnumKeyword */)); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, enumKeyword)); return "skip"; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Non_null_assertions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_assertion_expressions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files)); + return "skip"; + case 213 /* SyntaxKind.TypeAssertionExpression */: ts.Debug.fail(); // Won't parse these in a JS file anyway, as they are interpreted as JSX. } } @@ -119396,53 +120276,55 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning)); } switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: // Check type parameters if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files)); return "skip"; } // falls through - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // Check modifiers if (nodes === parent.modifiers) { - checkModifiers(parent.modifiers, parent.kind === 237 /* SyntaxKind.VariableStatement */); + checkModifiers(parent.modifiers, parent.kind === 240 /* SyntaxKind.VariableStatement */); return "skip"; } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // Check modifiers of property declaration if (nodes === parent.modifiers) { for (var _i = 0, _a = nodes; _i < _a.length; _i++) { var modifier = _a[_i]; - if (ts.isModifier(modifier) && modifier.kind !== 124 /* SyntaxKind.StaticKeyword */) { + if (ts.isModifier(modifier) + && modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ + && modifier.kind !== 127 /* SyntaxKind.AccessorKeyword */) { diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind))); } } return "skip"; } break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Check modifiers of parameter declaration if (nodes === parent.modifiers && ts.some(nodes, ts.isModifier)) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Parameter_modifiers_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // Check type arguments if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_arguments_can_only_be_used_in_TypeScript_files)); @@ -119464,18 +120346,19 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind))); break; // These are all legal modifiers. case 124 /* SyntaxKind.StaticKeyword */: case 93 /* SyntaxKind.ExportKeyword */: case 88 /* SyntaxKind.DefaultKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: } } } @@ -119797,7 +120680,7 @@ var ts; // It's a _little odd_ that we can't set `impliedNodeFormat` until the program step - but it's the first and only time we have a resolution cache // and a freshly made source file node on hand at the same time, and we need both to set the field. Persisting the resolution cache all the way // to the check and emit steps would be bad - so we much prefer detecting and storing the format information on the source file node upfront. - var result = getImpliedNodeFormatForFileWorker(toPath(fileName), moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options); + var result = getImpliedNodeFormatForFileWorker(ts.getNormalizedAbsolutePath(fileName, currentDirectory), moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options); var languageVersion = ts.getEmitScriptTarget(options); var setExternalModuleIndicator = ts.getSetExternalModuleIndicator(options); return typeof result === "object" ? __assign(__assign({}, result), { languageVersion: languageVersion, setExternalModuleIndicator: setExternalModuleIndicator }) : @@ -120400,10 +121283,12 @@ var ts; if (options.preserveConstEnums === false) { createDiagnosticForOptionName(ts.Diagnostics.Option_preserveConstEnums_cannot_be_disabled_when_isolatedModules_is_enabled, "preserveConstEnums", "isolatedModules"); } - var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !ts.isSourceFileJS(f) && !f.isDeclarationFile && f.scriptKind !== 6 /* ScriptKind.JSON */; }); - if (firstNonExternalModuleSourceFile) { - var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(firstNonExternalModuleSourceFile.fileName))); + for (var _a = 0, files_5 = files; _a < files_5.length; _a++) { + var file = files_5[_a]; + if (!ts.isExternalModule(file) && !ts.isSourceFileJS(file) && !file.isDeclarationFile && file.scriptKind !== 6 /* ScriptKind.JSON */) { + var span = ts.getErrorSpanForNode(file, file); + programDiagnostics.add(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(file.fileName))); + } } } else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 /* ScriptTarget.ES2015 */ && options.module === ts.ModuleKind.None) { @@ -124130,7 +125015,7 @@ var ts; }); // Sort by paths closest to importing file Name directory var sortedPaths = []; - var _loop_35 = function (directory) { + var _loop_36 = function (directory) { var directoryStart = ts.ensureTrailingDirectorySeparator(directory); var pathsInDirectory; allFileNames.forEach(function (_a, fileName) { @@ -124154,9 +125039,9 @@ var ts; }; var out_directory_1; for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) { - var state_11 = _loop_35(directory); + var state_12 = _loop_36(directory); directory = out_directory_1; - if (state_11 === "break") + if (state_12 === "break") break; } if (allFileNames.size) { @@ -124225,7 +125110,7 @@ var ts; } function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) { for (var key in paths) { - var _loop_36 = function (patternText_1) { + var _loop_37 = function (patternText_1) { var pattern = ts.normalizePath(patternText_1); var indexOfStar = pattern.indexOf("*"); // In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly, @@ -124292,9 +125177,9 @@ var ts; }; for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) { var patternText_1 = _a[_i]; - var state_12 = _loop_36(patternText_1); - if (typeof state_12 === "object") - return state_12.value; + var state_13 = _loop_37(patternText_1); + if (typeof state_13 === "object") + return state_13.value; } } function validateEnding(_a) { @@ -124458,7 +125343,7 @@ var ts; var maybeBlockedByTypesVersions = false; var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath); if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) { - var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath)); + var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath)); var importMode = overrideMode || importingSourceFile.impliedNodeFormat; if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) { var conditions = ["node", importMode === ts.ModuleKind.ESNext ? "import" : "require", "types"]; @@ -124820,7 +125705,7 @@ var ts; case ts.ModuleKind.CommonJS: if (file.packageJsonScope) { (result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages( - /*details*/ undefined, file.packageJsonScope.packageJsonContent.type ? + /*details*/ undefined, file.packageJsonScope.contents.packageJsonContent.type ? ts.Diagnostics.File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module : ts.Diagnostics.File_is_CommonJS_module_because_0_does_not_have_field_type, toFileName(ts.last(file.packageJsonLocations), fileNameConvertor))); } @@ -125239,18 +126124,14 @@ var ts; if (host.getBuildInfo) { // host provides buildinfo, get it from there. This allows host to cache it buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath); - if (!buildInfo) - return undefined; } else { var content = host.readFile(buildInfoPath); if (!content) return undefined; - buildInfo = ts.getBuildInfo(content); + buildInfo = ts.getBuildInfo(buildInfoPath, content); } - if (buildInfo.version !== ts.version) - return undefined; - if (!buildInfo.program) + if (!buildInfo || buildInfo.version !== ts.version || !buildInfo.program) return undefined; return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host); } @@ -125472,7 +126353,8 @@ var ts; } // All resolutions are invalid if user provided resolutions var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution); - if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + 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 (hasChangedConfigFileParsingErrors) { if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); @@ -125491,6 +126373,11 @@ var ts; if (host.afterProgramCreate && program !== builderProgram) { host.afterProgramCreate(builderProgram); } + compilerHost.readFile = originalReadFile; + compilerHost.fileExists = originalFileExists; + compilerHost.directoryExists = originalDirectoryExists; + compilerHost.createDirectory = originalCreateDirectory; + compilerHost.writeFile = originalWriteFile; return builderProgram; } function createNewProgram(hasInvalidatedResolution) { @@ -125968,19 +126855,20 @@ var ts; */ UpToDateStatusType[UpToDateStatusType["OutOfDateWithPrepend"] = 3] = "OutOfDateWithPrepend"; UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing"; - UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf"; - UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream"; - UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo"; - UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate"; - UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked"; - UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream"; - UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate"; - UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText"; + UpToDateStatusType[UpToDateStatusType["ErrorReadingFile"] = 5] = "ErrorReadingFile"; + UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 6] = "OutOfDateWithSelf"; + UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 7] = "OutOfDateWithUpstream"; + UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 8] = "OutOfDateBuildInfo"; + UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 9] = "UpstreamOutOfDate"; + UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 10] = "UpstreamBlocked"; + UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 11] = "ComputingUpstream"; + UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 12] = "TsVersionOutputOfDate"; + UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 13] = "UpToDateWithInputFileText"; /** * Projects with no outputs (i.e. "solution" files) */ - UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly"; - UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild"; + UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 14] = "ContainerOnly"; + UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 15] = "ForceBuild"; })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {})); function resolveConfigFileProjectName(project) { if (ts.fileExtensionIs(project, ".json" /* Extension.Json */)) { @@ -126198,6 +127086,7 @@ var ts; if (value) { return isParsedCommandLine(value) ? value : undefined; } + ts.performance.mark("SolutionBuilder::beforeConfigFileParsing"); var diagnostic; var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host; var parsed; @@ -126212,6 +127101,8 @@ var ts; parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop; } configFileCache.set(configFilePath, parsed || diagnostic); + ts.performance.mark("SolutionBuilder::afterConfigFileParsing"); + ts.performance.measure("SolutionBuilder::Config file parsing", "SolutionBuilder::beforeConfigFileParsing", "SolutionBuilder::afterConfigFileParsing"); return parsed; } function resolveProjectName(state, name) { @@ -126411,6 +127302,7 @@ var ts; if (updateOutputFileStampsPending) { updateOutputTimestamps(state, config, projectPath); } + ts.performance.mark("SolutionBuilder::Timestamps only updates"); return doneInvalidatedProject(state, projectPath); } }; @@ -126504,6 +127396,10 @@ var ts; }; function done(cancellationToken, writeFile, customTransformers) { executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers); + if (kind === InvalidatedProjectKind.Build) + ts.performance.mark("SolutionBuilder::Projects built"); + else + ts.performance.mark("SolutionBuilder::Bundles updated"); return doneInvalidatedProject(state, projectPath); } function withProgramOrUndefined(action) { @@ -126682,13 +127578,13 @@ var ts; var emitterDiagnostics = ts.createDiagnosticCollection(); var emittedOutputs = new ts.Map(); var resultFlags = BuildResultFlags.DeclarationOutputUnchanged; - var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo; + var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo || undefined; outputFiles.forEach(function (_a) { var _b, _c; var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo; emittedOutputs.set(toPath(state, name), name); if (buildInfo) { - if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { + if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo === null || existingBuildInfo === void 0 ? void 0 : existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged; } setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags); @@ -126981,8 +127877,7 @@ var ts; return existing.buildInfo || undefined; } var value = state.readFileWithCache(buildInfoPath); - var buildInfo = value ? ts.getBuildInfo(value) : undefined; - ts.Debug.assert(modifiedTime || !buildInfo); + var buildInfo = value ? ts.getBuildInfo(buildInfoPath, value) : undefined; state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime }); return buildInfo; } @@ -127067,7 +127962,14 @@ var ts; missingOutputFileName: buildInfoPath }; } - var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime)); + var buildInfo = getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime); + if (!buildInfo) { + // Error reading buildInfo + return { + type: ts.UpToDateStatusType.ErrorReadingFile, + fileName: buildInfoPath + }; + } if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) { return { type: ts.UpToDateStatusType.TsVersionOutputOfDate, @@ -127252,7 +128154,10 @@ var ts; if (prior !== undefined) { return prior; } + ts.performance.mark("SolutionBuilder::beforeUpToDateCheck"); var actual = getUpToDateStatusWorker(state, project, resolvedPath); + ts.performance.mark("SolutionBuilder::afterUpToDateCheck"); + ts.performance.measure("SolutionBuilder::Up-to-date check", "SolutionBuilder::beforeUpToDateCheck", "SolutionBuilder::afterUpToDateCheck"); state.projectStatus.set(resolvedPath, actual); return actual; } @@ -127390,6 +128295,13 @@ var ts; } } function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { + ts.performance.mark("SolutionBuilder::beforeBuild"); + var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences); + ts.performance.mark("SolutionBuilder::afterBuild"); + ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + return result; + } + function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { var buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ts.ExitStatus.InvalidProject_OutputsSkipped; @@ -127417,6 +128329,13 @@ var ts; : ts.ExitStatus.DiagnosticsPresent_OutputsSkipped; } function clean(state, project, onlyReferences) { + ts.performance.mark("SolutionBuilder::beforeClean"); + var result = cleanWorker(state, project, onlyReferences); + ts.performance.mark("SolutionBuilder::afterClean"); + ts.performance.measure("SolutionBuilder::Clean", "SolutionBuilder::beforeClean", "SolutionBuilder::afterClean"); + return result; + } + function cleanWorker(state, project, onlyReferences) { var buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ts.ExitStatus.InvalidProject_OutputsSkipped; @@ -127490,6 +128409,14 @@ var ts; state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected); } function buildNextInvalidatedProject(state, changeDetected) { + ts.performance.mark("SolutionBuilder::beforeBuild"); + var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected); + ts.performance.mark("SolutionBuilder::afterBuild"); + ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + if (buildOrder) + reportErrorSummary(state, buildOrder); + } + function buildNextInvalidatedProjectWorker(state, changeDetected) { state.timerToBuildInvalidatedProject = undefined; if (state.reportFileChangeDetected) { state.reportFileChangeDetected = false; @@ -127522,7 +128449,7 @@ var ts; } } disableCache(state); - reportErrorSummary(state, buildOrder); + return buildOrder; } function watchConfigFile(state, resolved, resolvedPath, parsed) { if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath)) @@ -127577,6 +128504,7 @@ var ts; function startWatching(state, buildOrder) { if (!state.watchAllProjectsPending) return; + ts.performance.mark("SolutionBuilder::beforeWatcherCreation"); state.watchAllProjectsPending = false; for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) { var resolved = _a[_i]; @@ -127594,6 +128522,8 @@ var ts; watchPackageJsonFiles(state, resolved, resolvedPath, cfg); } } + ts.performance.mark("SolutionBuilder::afterWatcherCreation"); + ts.performance.measure("SolutionBuilder::Watcher creation", "SolutionBuilder::beforeWatcherCreation", "SolutionBuilder::afterWatcherCreation"); } function stopWatching(state) { ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher); @@ -127707,6 +128637,8 @@ var ts; return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_1_is_older_than_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerProjectName)); case ts.UpToDateStatusType.OutputMissing: return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relName(state, configFileName), relName(state, status.missingOutputFileName)); + case ts.UpToDateStatusType.ErrorReadingFile: + return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_there_was_error_reading_file_1, relName(state, configFileName), relName(state, status.fileName)); case ts.UpToDateStatusType.OutOfDateBuildInfo: return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted, relName(state, configFileName), relName(state, status.buildInfoFile)); case ts.UpToDateStatusType.UpToDate: @@ -128414,6 +129346,8 @@ var ts; * interface Y { foo:number; } */ ScriptElementKind["memberVariableElement"] = "property"; + /** class X { [public|private]* accessor foo: number; } */ + ScriptElementKind["memberAccessorVariableElement"] = "accessor"; /** * class X { constructor() { } } * class X { static { } } @@ -128546,37 +129480,37 @@ var ts; })(SemanticMeaning = ts.SemanticMeaning || (ts.SemanticMeaning = {})); function getMeaningFromDeclaration(node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.isInJSFile(node) && ts.getJSDocEnumTag(node) ? 7 /* SemanticMeaning.All */ : 1 /* SemanticMeaning.Value */; - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 292 /* SyntaxKind.CatchClause */: - case 285 /* SyntaxKind.JsxAttribute */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 295 /* SyntaxKind.CatchClause */: + case 288 /* SyntaxKind.JsxAttribute */: return 1 /* SemanticMeaning.Value */; - case 163 /* SyntaxKind.TypeParameter */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: + case 165 /* SyntaxKind.TypeParameter */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: return 2 /* SemanticMeaning.Type */; - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: // If it has no name node, it shares the name with the value declaration below it. return node.name === undefined ? 1 /* SemanticMeaning.Value */ | 2 /* SemanticMeaning.Type */ : 2 /* SemanticMeaning.Type */; - case 299 /* SyntaxKind.EnumMember */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 260 /* SyntaxKind.ClassDeclaration */: return 1 /* SemanticMeaning.Value */ | 2 /* SemanticMeaning.Type */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.isAmbientModule(node)) { return 4 /* SemanticMeaning.Namespace */ | 1 /* SemanticMeaning.Value */; } @@ -128586,16 +129520,16 @@ var ts; else { return 4 /* SemanticMeaning.Namespace */; } - case 260 /* SyntaxKind.EnumDeclaration */: - case 269 /* SyntaxKind.NamedImports */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 272 /* SyntaxKind.NamedImports */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: return 7 /* SemanticMeaning.All */; // An external module can be a Value - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 4 /* SemanticMeaning.Namespace */ | 1 /* SemanticMeaning.Value */; } return 7 /* SemanticMeaning.All */; @@ -128604,7 +129538,7 @@ var ts; function getMeaningFromLocation(node) { node = getAdjustedReferenceLocation(node); var parent = node.parent; - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return 1 /* SemanticMeaning.Value */; } else if (ts.isExportAssignment(parent) @@ -128647,11 +129581,11 @@ var ts; // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - var name = node.kind === 161 /* SyntaxKind.QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined; - return name && name.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ ? 7 /* SemanticMeaning.All */ : 4 /* SemanticMeaning.Namespace */; + var name = node.kind === 163 /* SyntaxKind.QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined; + return name && name.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? 7 /* SemanticMeaning.All */ : 4 /* SemanticMeaning.Namespace */; } function isInRightSideOfInternalImportEqualsDeclaration(node) { - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; @@ -128663,27 +129597,27 @@ var ts; function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 161 /* SyntaxKind.QualifiedName */) { - while (root.parent && root.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + if (root.parent.kind === 163 /* SyntaxKind.QualifiedName */) { + while (root.parent && root.parent.kind === 163 /* SyntaxKind.QualifiedName */) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 178 /* SyntaxKind.TypeReference */ && !isLastClause; + return root.parent.kind === 180 /* SyntaxKind.TypeReference */ && !isLastClause; } function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (root.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && root.parent.parent.kind === 291 /* SyntaxKind.HeritageClause */) { + if (!isLastClause && root.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && root.parent.parent.kind === 294 /* SyntaxKind.HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 257 /* SyntaxKind.ClassDeclaration */ && root.parent.parent.token === 117 /* SyntaxKind.ImplementsKeyword */) || - (decl.kind === 258 /* SyntaxKind.InterfaceDeclaration */ && root.parent.parent.token === 94 /* SyntaxKind.ExtendsKeyword */); + return (decl.kind === 260 /* SyntaxKind.ClassDeclaration */ && root.parent.parent.token === 117 /* SyntaxKind.ImplementsKeyword */) || + (decl.kind === 261 /* SyntaxKind.InterfaceDeclaration */ && root.parent.parent.token === 94 /* SyntaxKind.ExtendsKeyword */); } return false; } @@ -128694,15 +129628,15 @@ var ts; switch (node.kind) { case 108 /* SyntaxKind.ThisKeyword */: return !ts.isExpressionNode(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return true; } switch (node.parent.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return true; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return !node.parent.isTypeOf; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isPartOfTypeNode(node.parent); } return false; @@ -128769,7 +129703,7 @@ var ts; ts.climbPastPropertyOrElementAccess = climbPastPropertyOrElementAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 250 /* SyntaxKind.LabeledStatement */ && referenceNode.label.escapedText === labelName) { + if (referenceNode.kind === 253 /* SyntaxKind.LabeledStatement */ && referenceNode.label.escapedText === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -128830,22 +129764,22 @@ var ts; ts.isNameOfFunctionDeclaration = isNameOfFunctionDeclaration; function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { switch (node.parent.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 299 /* SyntaxKind.EnumMember */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 302 /* SyntaxKind.EnumMember */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.getNameOfDeclaration(node.parent) === node; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return node.parent.argumentExpression === node; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return true; - case 196 /* SyntaxKind.LiteralType */: - return node.parent.parent.kind === 194 /* SyntaxKind.IndexedAccessType */; + case 198 /* SyntaxKind.LiteralType */: + return node.parent.parent.kind === 196 /* SyntaxKind.IndexedAccessType */; default: return false; } @@ -128869,17 +129803,17 @@ var ts; return undefined; } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return node; } } @@ -128887,56 +129821,56 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return ts.isExternalModule(node) ? "module" /* ScriptElementKind.moduleElement */ : "script" /* ScriptElementKind.scriptElement */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return "module" /* ScriptElementKind.moduleElement */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return "class" /* ScriptElementKind.classElement */; - case 258 /* SyntaxKind.InterfaceDeclaration */: return "interface" /* ScriptElementKind.interfaceElement */; - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return "interface" /* ScriptElementKind.interfaceElement */; + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return "type" /* ScriptElementKind.typeElement */; - case 260 /* SyntaxKind.EnumDeclaration */: return "enum" /* ScriptElementKind.enumElement */; - case 254 /* SyntaxKind.VariableDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return "enum" /* ScriptElementKind.enumElement */; + case 257 /* SyntaxKind.VariableDeclaration */: return getKindOfVariableDeclaration(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return "function" /* ScriptElementKind.functionElement */; - case 172 /* SyntaxKind.GetAccessor */: return "getter" /* ScriptElementKind.memberGetAccessorElement */; - case 173 /* SyntaxKind.SetAccessor */: return "setter" /* ScriptElementKind.memberSetAccessorElement */; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: return "getter" /* ScriptElementKind.memberGetAccessorElement */; + case 175 /* SyntaxKind.SetAccessor */: return "setter" /* ScriptElementKind.memberSetAccessorElement */; + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return "method" /* ScriptElementKind.memberFunctionElement */; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: var initializer = node.initializer; return ts.isFunctionLike(initializer) ? "method" /* ScriptElementKind.memberFunctionElement */ : "property" /* ScriptElementKind.memberVariableElement */; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return "property" /* ScriptElementKind.memberVariableElement */; - case 176 /* SyntaxKind.IndexSignature */: return "index" /* ScriptElementKind.indexSignatureElement */; - case 175 /* SyntaxKind.ConstructSignature */: return "construct" /* ScriptElementKind.constructSignatureElement */; - case 174 /* SyntaxKind.CallSignature */: return "call" /* ScriptElementKind.callSignatureElement */; - case 171 /* SyntaxKind.Constructor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: return "index" /* ScriptElementKind.indexSignatureElement */; + case 177 /* SyntaxKind.ConstructSignature */: return "construct" /* ScriptElementKind.constructSignatureElement */; + case 176 /* SyntaxKind.CallSignature */: return "call" /* ScriptElementKind.callSignatureElement */; + case 173 /* SyntaxKind.Constructor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return "constructor" /* ScriptElementKind.constructorImplementationElement */; - case 163 /* SyntaxKind.TypeParameter */: return "type parameter" /* ScriptElementKind.typeParameterElement */; - case 299 /* SyntaxKind.EnumMember */: return "enum member" /* ScriptElementKind.enumMemberElement */; - case 164 /* SyntaxKind.Parameter */: return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) ? "property" /* ScriptElementKind.memberVariableElement */ : "parameter" /* ScriptElementKind.parameterElement */; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: - case 274 /* SyntaxKind.NamespaceExport */: + case 165 /* SyntaxKind.TypeParameter */: return "type parameter" /* ScriptElementKind.typeParameterElement */; + case 302 /* SyntaxKind.EnumMember */: return "enum member" /* ScriptElementKind.enumMemberElement */; + case 166 /* SyntaxKind.Parameter */: return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) ? "property" /* ScriptElementKind.memberVariableElement */ : "parameter" /* ScriptElementKind.parameterElement */; + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: + case 277 /* SyntaxKind.NamespaceExport */: return "alias" /* ScriptElementKind.alias */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var kind = ts.getAssignmentDeclarationKind(node); var right = node.right; switch (kind) { @@ -128965,7 +129899,7 @@ var ts; } case 79 /* SyntaxKind.Identifier */: return ts.isImportClause(node.parent) ? "alias" /* ScriptElementKind.alias */ : "" /* ScriptElementKind.unknown */; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: var scriptKind = getNodeKind(node.expression); // If the expression didn't come back with something (like it does for an identifiers) return scriptKind === "" /* ScriptElementKind.unknown */ ? "const" /* ScriptElementKind.constElement */ : scriptKind; @@ -128988,7 +129922,7 @@ var ts; return true; case 79 /* SyntaxKind.Identifier */: // 'this' as a parameter - return ts.identifierIsThisKeyword(node) && node.parent.kind === 164 /* SyntaxKind.Parameter */; + return ts.identifierIsThisKeyword(node) && node.parent.kind === 166 /* SyntaxKind.Parameter */; default: return false; } @@ -129053,42 +129987,42 @@ var ts; return false; } switch (n.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 182 /* SyntaxKind.TypeLiteral */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - case 263 /* SyntaxKind.CaseBlock */: - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 184 /* SyntaxKind.TypeLiteral */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: + case 266 /* SyntaxKind.CaseBlock */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return nodeEndsWith(n, 19 /* SyntaxKind.CloseBraceToken */, sourceFile); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return isCompletedNode(n.block, sourceFile); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: if (!n.arguments) { return true; } // falls through - case 208 /* SyntaxKind.CallExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 191 /* SyntaxKind.ParenthesizedType */: + case 210 /* SyntaxKind.CallExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 193 /* SyntaxKind.ParenthesizedType */: return nodeEndsWith(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return isCompletedNode(n.type, sourceFile); - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 214 /* SyntaxKind.ArrowFunction */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 216 /* SyntaxKind.ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -129098,65 +130032,65 @@ var ts; // Even though type parameters can be unclosed, we can get away with // having at least a closing paren. return hasChildOfKind(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return !!n.body && isCompletedNode(n.body, sourceFile); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 26 /* SyntaxKind.SemicolonToken */, sourceFile); - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 162 /* SyntaxKind.ComputedPropertyName */: - case 184 /* SyntaxKind.TupleType */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 164 /* SyntaxKind.ComputedPropertyName */: + case 186 /* SyntaxKind.TupleType */: return nodeEndsWith(n, 23 /* SyntaxKind.CloseBracketToken */, sourceFile); - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 23 /* SyntaxKind.CloseBracketToken */, sourceFile); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed return false; - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; return hasChildOfKind(n, 115 /* SyntaxKind.WhileKeyword */, sourceFile) ? nodeEndsWith(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile) : isCompletedNode(n.statement, sourceFile); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 216 /* SyntaxKind.TypeOfExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 224 /* SyntaxKind.YieldExpression */: - case 225 /* SyntaxKind.SpreadElement */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 226 /* SyntaxKind.YieldExpression */: + case 227 /* SyntaxKind.SpreadElement */: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 272 /* SyntaxKind.ExportDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.nodeIsPresent(n.moduleSpecifier); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -129281,13 +130215,13 @@ var ts; function getAdjustedLocationForDeclaration(node, forRename) { if (!forRename) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return getAdjustedLocationForClass(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return getAdjustedLocationForFunction(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return node; } } @@ -129382,11 +130316,11 @@ var ts; node.kind === 98 /* SyntaxKind.FunctionKeyword */ ? ts.isFunctionDeclaration(parent) || ts.isFunctionExpression(node) : node.kind === 118 /* SyntaxKind.InterfaceKeyword */ ? ts.isInterfaceDeclaration(parent) : node.kind === 92 /* SyntaxKind.EnumKeyword */ ? ts.isEnumDeclaration(parent) : - node.kind === 152 /* SyntaxKind.TypeKeyword */ ? ts.isTypeAliasDeclaration(parent) : - node.kind === 142 /* SyntaxKind.NamespaceKeyword */ || node.kind === 141 /* SyntaxKind.ModuleKeyword */ ? ts.isModuleDeclaration(parent) : + node.kind === 154 /* SyntaxKind.TypeKeyword */ ? ts.isTypeAliasDeclaration(parent) : + node.kind === 143 /* SyntaxKind.NamespaceKeyword */ || node.kind === 142 /* SyntaxKind.ModuleKeyword */ ? ts.isModuleDeclaration(parent) : node.kind === 100 /* SyntaxKind.ImportKeyword */ ? ts.isImportEqualsDeclaration(parent) : - node.kind === 136 /* SyntaxKind.GetKeyword */ ? ts.isGetAccessorDeclaration(parent) : - node.kind === 149 /* SyntaxKind.SetKeyword */ && ts.isSetAccessorDeclaration(parent)) { + node.kind === 137 /* SyntaxKind.GetKeyword */ ? ts.isGetAccessorDeclaration(parent) : + node.kind === 151 /* SyntaxKind.SetKeyword */ && ts.isSetAccessorDeclaration(parent)) { var location = getAdjustedLocationForDeclaration(parent, forRename); if (location) { return location; @@ -129400,7 +130334,7 @@ var ts; return decl.name; } } - if (node.kind === 152 /* SyntaxKind.TypeKeyword */) { + if (node.kind === 154 /* SyntaxKind.TypeKeyword */) { // import /**/type [|name|] from ...; // import /**/type { [|name|] } from ...; // import /**/type { propertyName as [|name|] } from ...; @@ -129426,7 +130360,7 @@ var ts; // import * /**/as [|name|] ... // export { propertyName /**/as [|name|] } ... // export * /**/as [|name|] ... - if (node.kind === 127 /* SyntaxKind.AsKeyword */) { + if (node.kind === 128 /* SyntaxKind.AsKeyword */) { if (ts.isImportSpecifier(parent) && parent.propertyName || ts.isExportSpecifier(parent) && parent.propertyName || ts.isNamespaceImport(parent) || @@ -129467,12 +130401,12 @@ var ts; } } // import name = /**/require("[|module|]"); - if (node.kind === 146 /* SyntaxKind.RequireKeyword */ && ts.isExternalModuleReference(parent)) { + if (node.kind === 147 /* SyntaxKind.RequireKeyword */ && ts.isExternalModuleReference(parent)) { return parent.expression; } // import ... /**/from "[|module|]"; // export ... /**/from "[|module|]"; - if (node.kind === 156 /* SyntaxKind.FromKeyword */ && (ts.isImportDeclaration(parent) || ts.isExportDeclaration(parent)) && parent.moduleSpecifier) { + if (node.kind === 158 /* SyntaxKind.FromKeyword */ && (ts.isImportDeclaration(parent) || ts.isExportDeclaration(parent)) && parent.moduleSpecifier) { return parent.moduleSpecifier; } // class ... /**/extends [|name|] ... @@ -129497,7 +130431,7 @@ var ts; } } // ... T extends /**/infer [|U|] ? ... - if (node.kind === 137 /* SyntaxKind.InferKeyword */ && ts.isInferTypeNode(parent)) { + if (node.kind === 138 /* SyntaxKind.InferKeyword */ && ts.isInferTypeNode(parent)) { return parent.typeParameter.name; } // { [ [|K|] /**/in keyof T]: ... } @@ -129505,12 +130439,12 @@ var ts; return parent.name; } // /**/keyof [|T|] - if (node.kind === 140 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 140 /* SyntaxKind.KeyOfKeyword */ && + if (node.kind === 141 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 141 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeReferenceNode(parent.type)) { return parent.type.typeName; } // /**/readonly [|name|][] - if (node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 145 /* SyntaxKind.ReadonlyKeyword */ && + if (node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isArrayTypeNode(parent.type) && ts.isTypeReferenceNode(parent.type.elementType)) { return parent.type.elementType.typeName; } @@ -129528,7 +130462,7 @@ var ts; if (node.kind === 103 /* SyntaxKind.NewKeyword */ && ts.isNewExpression(parent) || node.kind === 114 /* SyntaxKind.VoidKeyword */ && ts.isVoidExpression(parent) || node.kind === 112 /* SyntaxKind.TypeOfKeyword */ && ts.isTypeOfExpression(parent) || - node.kind === 132 /* SyntaxKind.AwaitKeyword */ && ts.isAwaitExpression(parent) || + node.kind === 133 /* SyntaxKind.AwaitKeyword */ && ts.isAwaitExpression(parent) || node.kind === 125 /* SyntaxKind.YieldKeyword */ && ts.isYieldExpression(parent) || node.kind === 89 /* SyntaxKind.DeleteKeyword */ && ts.isDeleteExpression(parent)) { if (parent.expression) { @@ -129541,13 +130475,13 @@ var ts; return ts.skipOuterExpressions(parent.right); } // left /**/as [|name|] - if (node.kind === 127 /* SyntaxKind.AsKeyword */ && ts.isAsExpression(parent) && ts.isTypeReferenceNode(parent.type)) { + if (node.kind === 128 /* SyntaxKind.AsKeyword */ && ts.isAsExpression(parent) && ts.isTypeReferenceNode(parent.type)) { return parent.type.typeName; } // for (... /**/in [|name|]) // for (... /**/of [|name|]) if (node.kind === 101 /* SyntaxKind.InKeyword */ && ts.isForInStatement(parent) || - node.kind === 160 /* SyntaxKind.OfKeyword */ && ts.isForOfStatement(parent)) { + node.kind === 162 /* SyntaxKind.OfKeyword */ && ts.isForOfStatement(parent)) { return ts.skipOuterExpressions(parent.expression); } } @@ -129779,7 +130713,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 305 /* SyntaxKind.SourceFile */ || n.kind === 1 /* SyntaxKind.EndOfFileToken */ || ts.isJSDocCommentContainingNode(n)); + ts.Debug.assert(startNode !== undefined || n.kind === 308 /* SyntaxKind.SourceFile */ || n.kind === 1 /* SyntaxKind.EndOfFileToken */ || ts.isJSDocCommentContainingNode(n)); // Here we know that none of child token nodes embrace the position, // the only known case is when position is at the end of the file. // Try to find the rightmost token in the file without filtering. @@ -129810,7 +130744,7 @@ var ts; for (var i = exclusiveStartPosition - 1; i >= 0; i--) { var child = children[i]; if (isWhiteSpaceOnlyJsxText(child)) { - if (i === 0 && (parentKind === 11 /* SyntaxKind.JsxText */ || parentKind === 279 /* SyntaxKind.JsxSelfClosingElement */)) { + if (i === 0 && (parentKind === 11 /* SyntaxKind.JsxText */ || parentKind === 282 /* SyntaxKind.JsxSelfClosingElement */)) { ts.Debug.fail("`JsxText` tokens should not be the first child of `JsxElement | JsxSelfClosingElement`"); } } @@ -129854,17 +130788,17 @@ var ts; return true; } //
{ |
or
- if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 288 /* SyntaxKind.JsxExpression */) { + if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 291 /* SyntaxKind.JsxExpression */) { return true; } //
{ // | // } < /div> - if (token && token.kind === 19 /* SyntaxKind.CloseBraceToken */ && token.parent.kind === 288 /* SyntaxKind.JsxExpression */) { + if (token && token.kind === 19 /* SyntaxKind.CloseBraceToken */ && token.parent.kind === 291 /* SyntaxKind.JsxExpression */) { return true; } //
|
- if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 281 /* SyntaxKind.JsxClosingElement */) { + if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 284 /* SyntaxKind.JsxClosingElement */) { return true; } return false; @@ -129895,7 +130829,7 @@ var ts; function isInsideJsxElement(sourceFile, position) { function isInsideJsxElementTraversal(node) { while (node) { - if (node.kind >= 279 /* SyntaxKind.JsxSelfClosingElement */ && node.kind <= 288 /* SyntaxKind.JsxExpression */ + if (node.kind >= 282 /* SyntaxKind.JsxSelfClosingElement */ && node.kind <= 291 /* SyntaxKind.JsxExpression */ || node.kind === 11 /* SyntaxKind.JsxText */ || node.kind === 29 /* SyntaxKind.LessThanToken */ || node.kind === 31 /* SyntaxKind.GreaterThanToken */ @@ -129905,7 +130839,7 @@ var ts; || node.kind === 43 /* SyntaxKind.SlashToken */) { node = node.parent; } - else if (node.kind === 278 /* SyntaxKind.JsxElement */) { + else if (node.kind === 281 /* SyntaxKind.JsxElement */) { if (position > node.getStart(sourceFile)) return true; node = node.parent; @@ -130053,7 +130987,7 @@ var ts; // falls through case 112 /* SyntaxKind.TypeOfKeyword */: case 94 /* SyntaxKind.ExtendsKeyword */: - case 140 /* SyntaxKind.KeyOfKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: case 24 /* SyntaxKind.DotToken */: case 51 /* SyntaxKind.BarToken */: case 57 /* SyntaxKind.QuestionToken */: @@ -130074,7 +131008,7 @@ var ts; /** * Returns true if the cursor at position in sourceFile is within a comment. * - * @param tokenAtPosition Must equal `getTokenAtPosition(sourceFile, position) + * @param tokenAtPosition Must equal `getTokenAtPosition(sourceFile, position)` * @param predicate Additional predicate to test on the comment range. */ function isInComment(sourceFile, position, tokenAtPosition) { @@ -130105,7 +131039,7 @@ var ts; result.push("public" /* ScriptElementKindModifier.publicMemberModifier */); if (flags & 32 /* ModifierFlags.Static */ || ts.isClassStaticBlockDeclaration(node)) result.push("static" /* ScriptElementKindModifier.staticModifier */); - if (flags & 128 /* ModifierFlags.Abstract */) + if (flags & 256 /* ModifierFlags.Abstract */) result.push("abstract" /* ScriptElementKindModifier.abstractModifier */); if (flags & 1 /* ModifierFlags.Export */) result.push("export" /* ScriptElementKindModifier.exportedModifier */); @@ -130113,16 +131047,16 @@ var ts; result.push("deprecated" /* ScriptElementKindModifier.deprecatedModifier */); if (node.flags & 16777216 /* NodeFlags.Ambient */) result.push("declare" /* ScriptElementKindModifier.ambientModifier */); - if (node.kind === 271 /* SyntaxKind.ExportAssignment */) + if (node.kind === 274 /* SyntaxKind.ExportAssignment */) result.push("export" /* ScriptElementKindModifier.exportedModifier */); return result.length > 0 ? result.join(",") : "" /* ScriptElementKindModifier.none */; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 210 /* SyntaxKind.CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return node.typeParameters; } return undefined; @@ -130167,18 +131101,18 @@ var ts; } ts.cloneCompilerOptions = cloneCompilerOptions; function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || - node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || + node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // [a,b,c] from: // [a, b, c] = someExpression; - if (node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + if (node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && node.parent.left === node && node.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { return true; } // [a, b, c] from: // for([a, b, c] of expression) - if (node.parent.kind === 244 /* SyntaxKind.ForOfStatement */ && + if (node.parent.kind === 247 /* SyntaxKind.ForOfStatement */ && node.parent.initializer === node) { return true; } @@ -130186,7 +131120,7 @@ var ts; // [x, [a, b, c] ] = someExpression // or // {x, a: {a, b, c} } = someExpression - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ ? node.parent.parent : node.parent)) { return true; } } @@ -130248,32 +131182,32 @@ var ts; } ts.createTextChange = createTextChange; ts.typeKeywords = [ - 130 /* SyntaxKind.AnyKeyword */, - 128 /* SyntaxKind.AssertsKeyword */, - 158 /* SyntaxKind.BigIntKeyword */, - 133 /* SyntaxKind.BooleanKeyword */, + 131 /* SyntaxKind.AnyKeyword */, + 129 /* SyntaxKind.AssertsKeyword */, + 160 /* SyntaxKind.BigIntKeyword */, + 134 /* SyntaxKind.BooleanKeyword */, 95 /* SyntaxKind.FalseKeyword */, - 137 /* SyntaxKind.InferKeyword */, - 140 /* SyntaxKind.KeyOfKeyword */, - 143 /* SyntaxKind.NeverKeyword */, + 138 /* SyntaxKind.InferKeyword */, + 141 /* SyntaxKind.KeyOfKeyword */, + 144 /* SyntaxKind.NeverKeyword */, 104 /* SyntaxKind.NullKeyword */, - 147 /* SyntaxKind.NumberKeyword */, - 148 /* SyntaxKind.ObjectKeyword */, - 145 /* SyntaxKind.ReadonlyKeyword */, - 150 /* SyntaxKind.StringKeyword */, - 151 /* SyntaxKind.SymbolKeyword */, + 148 /* SyntaxKind.NumberKeyword */, + 149 /* SyntaxKind.ObjectKeyword */, + 146 /* SyntaxKind.ReadonlyKeyword */, + 152 /* SyntaxKind.StringKeyword */, + 153 /* SyntaxKind.SymbolKeyword */, 110 /* SyntaxKind.TrueKeyword */, 114 /* SyntaxKind.VoidKeyword */, - 153 /* SyntaxKind.UndefinedKeyword */, - 154 /* SyntaxKind.UniqueKeyword */, - 155 /* SyntaxKind.UnknownKeyword */, + 155 /* SyntaxKind.UndefinedKeyword */, + 156 /* SyntaxKind.UniqueKeyword */, + 157 /* SyntaxKind.UnknownKeyword */, ]; function isTypeKeyword(kind) { return ts.contains(ts.typeKeywords, kind); } ts.isTypeKeyword = isTypeKeyword; function isTypeKeywordToken(node) { - return node.kind === 152 /* SyntaxKind.TypeKeyword */; + return node.kind === 154 /* SyntaxKind.TypeKeyword */; } ts.isTypeKeywordToken = isTypeKeywordToken; function isTypeKeywordTokenOrIdentifier(node) { @@ -130310,7 +131244,7 @@ var ts; } ts.skipConstraint = skipConstraint; function getNameFromPropertyName(name) { - return name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + return name.kind === 164 /* SyntaxKind.ComputedPropertyName */ // treat computed property names where expression is string/numeric literal as just string/numeric literal ? ts.isStringOrNumericLiteralLike(name.expression) ? name.expression.text : undefined : ts.isPrivateIdentifier(name) ? ts.idText(name) : ts.getTextOfIdentifierOrLiteral(name); @@ -130460,7 +131394,7 @@ var ts; ts.findModifier = findModifier; function insertImports(changes, sourceFile, imports, blankLineBetween) { var decl = ts.isArray(imports) ? imports[0] : imports; - var importKindPredicate = decl.kind === 237 /* SyntaxKind.VariableStatement */ ? ts.isRequireVariableStatement : ts.isAnyImportSyntax; + var importKindPredicate = decl.kind === 240 /* SyntaxKind.VariableStatement */ ? ts.isRequireVariableStatement : ts.isAnyImportSyntax; var existingImportStatements = ts.filter(sourceFile.statements, importKindPredicate); var sortedNewImports = ts.isArray(imports) ? ts.stableSort(imports, ts.OrganizeImports.compareImportsOrRequireStatements) : [imports]; if (!existingImportStatements.length) { @@ -131134,15 +132068,15 @@ var ts; function getContextualTypeFromParent(node, checker) { var parent = node.parent; switch (parent.kind) { - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return checker.getContextualType(parent); - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var _a = parent, left = _a.left, operatorToken = _a.operatorToken, right = _a.right; return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node); } - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return parent.expression === node ? getSwitchedType(parent, checker) : undefined; default: return checker.getContextualType(node); @@ -131172,8 +132106,8 @@ var ts; switch (node.kind) { case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return true; default: return false; @@ -131207,38 +132141,38 @@ var ts; } ts.getTypeNodeIfAccessible = getTypeNodeIfAccessible; function syntaxRequiresTrailingCommaOrSemicolonOrASI(kind) { - return kind === 174 /* SyntaxKind.CallSignature */ - || kind === 175 /* SyntaxKind.ConstructSignature */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 168 /* SyntaxKind.MethodSignature */; + return kind === 176 /* SyntaxKind.CallSignature */ + || kind === 177 /* SyntaxKind.ConstructSignature */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 170 /* SyntaxKind.MethodSignature */; } function syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI(kind) { - return kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function syntaxRequiresTrailingModuleBlockOrSemicolonOrASI(kind) { - return kind === 261 /* SyntaxKind.ModuleDeclaration */; + return kind === 264 /* SyntaxKind.ModuleDeclaration */; } function syntaxRequiresTrailingSemicolonOrASI(kind) { - return kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 238 /* SyntaxKind.ExpressionStatement */ - || kind === 240 /* SyntaxKind.DoStatement */ - || kind === 245 /* SyntaxKind.ContinueStatement */ - || kind === 246 /* SyntaxKind.BreakStatement */ - || kind === 247 /* SyntaxKind.ReturnStatement */ - || kind === 251 /* SyntaxKind.ThrowStatement */ - || kind === 253 /* SyntaxKind.DebuggerStatement */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */; + return kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 241 /* SyntaxKind.ExpressionStatement */ + || kind === 243 /* SyntaxKind.DoStatement */ + || kind === 248 /* SyntaxKind.ContinueStatement */ + || kind === 249 /* SyntaxKind.BreakStatement */ + || kind === 250 /* SyntaxKind.ReturnStatement */ + || kind === 254 /* SyntaxKind.ThrowStatement */ + || kind === 256 /* SyntaxKind.DebuggerStatement */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */; } ts.syntaxRequiresTrailingSemicolonOrASI = syntaxRequiresTrailingSemicolonOrASI; ts.syntaxMayBeASICandidate = ts.or(syntaxRequiresTrailingCommaOrSemicolonOrASI, syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI, syntaxRequiresTrailingModuleBlockOrSemicolonOrASI, syntaxRequiresTrailingSemicolonOrASI); @@ -131268,7 +132202,7 @@ var ts; return false; } // See comment in parser’s `parseDoStatement` - if (node.kind === 240 /* SyntaxKind.DoStatement */) { + if (node.kind === 243 /* SyntaxKind.DoStatement */) { return true; } var topNode = ts.findAncestor(node, function (ancestor) { return !ancestor.parent; }); @@ -131872,14 +132806,16 @@ var ts; search: function (importingFile, preferCapitalized, matches, action) { if (importingFile !== usableByFileName) return; - exportInfo.forEach(function (info, key) { + return ts.forEachEntry(exportInfo, function (info, key) { var _a = parseKey(key), symbolName = _a.symbolName, ambientModuleName = _a.ambientModuleName; var name = preferCapitalized && info[0].capitalizedSymbolName || symbolName; if (matches(name, info[0].targetFlags)) { var rehydrated = info.map(rehydrateCachedInfo); var filtered = rehydrated.filter(function (r, i) { return isNotShadowedByDeeperNodeModulesPackage(r, info[i].packageName); }); if (filtered.length) { - action(filtered, name, !!ambientModuleName, key); + var res = action(filtered, name, !!ambientModuleName, key); + if (res !== undefined) + return res; } } }); @@ -132267,11 +133203,11 @@ var ts; angleBracketStack--; } break; - case 130 /* SyntaxKind.AnyKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: if (angleBracketStack > 0 && !syntacticClassifierAbsent) { // If it looks like we're could be in something generic, don't classify this // as a keyword. We may just get overwritten by the syntactic classifier, @@ -132460,10 +133396,11 @@ var ts; return true; } switch (keyword2) { - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - case 134 /* SyntaxKind.ConstructorKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: return true; // Allow things like "public get", "public constructor" and "public static". default: return false; // Any other keyword following "public" is actually an identifier, not a real keyword. @@ -132510,7 +133447,8 @@ var ts; case 33 /* SyntaxKind.GreaterThanEqualsToken */: case 102 /* SyntaxKind.InstanceOfKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: + case 150 /* SyntaxKind.SatisfiesKeyword */: case 34 /* SyntaxKind.EqualsEqualsToken */: case 35 /* SyntaxKind.ExclamationEqualsToken */: case 36 /* SyntaxKind.EqualsEqualsEqualsToken */: @@ -132606,13 +133544,13 @@ var ts; // That means we're calling back into the host around every 1.2k of the file we process. // Lib.d.ts has similar numbers. switch (kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } } @@ -132834,46 +133772,46 @@ var ts; pos = tag.tagName.end; var commentStart = tag.tagName.end; switch (tag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: var param = tag; processJSDocParameterTag(param); commentStart = param.isNameFirst && ((_a = param.typeExpression) === null || _a === void 0 ? void 0 : _a.end) || param.name.end; break; - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: var prop = tag; commentStart = prop.isNameFirst && ((_b = prop.typeExpression) === null || _b === void 0 ? void 0 : _b.end) || prop.name.end; break; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: processJSDocTemplateTag(tag); pos = tag.end; commentStart = tag.typeParameters.end; break; - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: var type = tag; - commentStart = ((_c = type.typeExpression) === null || _c === void 0 ? void 0 : _c.kind) === 309 /* SyntaxKind.JSDocTypeExpression */ && ((_d = type.fullName) === null || _d === void 0 ? void 0 : _d.end) || ((_e = type.typeExpression) === null || _e === void 0 ? void 0 : _e.end) || commentStart; + commentStart = ((_c = type.typeExpression) === null || _c === void 0 ? void 0 : _c.kind) === 312 /* SyntaxKind.JSDocTypeExpression */ && ((_d = type.fullName) === null || _d === void 0 ? void 0 : _d.end) || ((_e = type.typeExpression) === null || _e === void 0 ? void 0 : _e.end) || commentStart; break; - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: commentStart = tag.typeExpression.end; break; - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: processElement(tag.typeExpression); pos = tag.end; commentStart = tag.typeExpression.end; break; - case 342 /* SyntaxKind.JSDocThisTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 345 /* SyntaxKind.JSDocThisTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: commentStart = tag.typeExpression.end; break; - case 341 /* SyntaxKind.JSDocReturnTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: processElement(tag.typeExpression); pos = tag.end; commentStart = ((_f = tag.typeExpression) === null || _f === void 0 ? void 0 : _f.end) || commentStart; break; - case 346 /* SyntaxKind.JSDocSeeTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: commentStart = ((_g = tag.name) === null || _g === void 0 ? void 0 : _g.end) || commentStart; break; - case 328 /* SyntaxKind.JSDocAugmentsTag */: - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: commentStart = tag.class.end; break; } @@ -132920,7 +133858,7 @@ var ts; // defined in `ts.commentPragmas` would be excessive, but we can avoid // some obvious false positives (e.g. in XML-like doc comments) by // checking the element name. - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (!match[3] || !(match[3] in ts.commentPragmas)) { return false; } @@ -133030,22 +133968,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: if (token.parent.tagName === token) { return 19 /* ClassificationType.jsxOpenTagName */; } break; - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: if (token.parent.tagName === token) { return 20 /* ClassificationType.jsxCloseTagName */; } break; - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: if (token.parent.tagName === token) { return 21 /* ClassificationType.jsxSelfClosingTagName */; } break; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: if (token.parent.name === token) { return 22 /* ClassificationType.jsxAttribute */; } @@ -133074,17 +134012,17 @@ var ts; var parent = token.parent; if (tokenKind === 63 /* SyntaxKind.EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (parent.kind === 254 /* SyntaxKind.VariableDeclaration */ || - parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - parent.kind === 164 /* SyntaxKind.Parameter */ || - parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + if (parent.kind === 257 /* SyntaxKind.VariableDeclaration */ || + parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + parent.kind === 166 /* SyntaxKind.Parameter */ || + parent.kind === 288 /* SyntaxKind.JsxAttribute */) { return 5 /* ClassificationType.operator */; } } - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ || - parent.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || - parent.kind === 220 /* SyntaxKind.PostfixUnaryExpression */ || - parent.kind === 222 /* SyntaxKind.ConditionalExpression */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ || + parent.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || + parent.kind === 222 /* SyntaxKind.PostfixUnaryExpression */ || + parent.kind === 224 /* SyntaxKind.ConditionalExpression */) { return 5 /* ClassificationType.operator */; } } @@ -133097,7 +134035,7 @@ var ts; return 25 /* ClassificationType.bigintLiteral */; } else if (tokenKind === 10 /* SyntaxKind.StringLiteral */) { - return token && token.parent.kind === 285 /* SyntaxKind.JsxAttribute */ ? 24 /* ClassificationType.jsxAttributeStringLiteralValue */ : 6 /* ClassificationType.stringLiteral */; + return token && token.parent.kind === 288 /* SyntaxKind.JsxAttribute */ ? 24 /* ClassificationType.jsxAttributeStringLiteralValue */ : 6 /* ClassificationType.stringLiteral */; } else if (tokenKind === 13 /* SyntaxKind.RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. @@ -133113,32 +134051,32 @@ var ts; else if (tokenKind === 79 /* SyntaxKind.Identifier */) { if (token) { switch (token.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: if (token.parent.name === token) { return 11 /* ClassificationType.className */; } return; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: if (token.parent.name === token) { return 15 /* ClassificationType.typeParameterName */; } return; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* ClassificationType.interfaceName */; } return; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (token.parent.name === token) { return 12 /* ClassificationType.enumName */; } return; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (token.parent.name === token) { return 14 /* ClassificationType.moduleName */; } return; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: if (token.parent.name === token) { return ts.isThisIdentifier(token) ? 3 /* ClassificationType.keyword */ : 17 /* ClassificationType.parameterName */; } @@ -133243,13 +134181,13 @@ var ts; var inJSXElement = false; function visit(node) { switch (node.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } if (!node || !ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth()) || node.getFullWidth() === 0) { @@ -133289,7 +134227,7 @@ var ts; if (modifiers & 32 /* ModifierFlags.Static */) { modifierSet |= 1 << 1 /* TokenModifier.static */; } - if (modifiers & 256 /* ModifierFlags.Async */) { + if (modifiers & 512 /* ModifierFlags.Async */) { modifierSet |= 1 << 2 /* TokenModifier.async */; } if (typeIdx !== 0 /* TokenType.class */ && typeIdx !== 2 /* TokenType.interface */) { @@ -133395,25 +134333,25 @@ var ts; return (ts.isQualifiedName(node.parent) && node.parent.right === node) || (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node); } var tokenFromDeclarationMapping = new ts.Map([ - [254 /* SyntaxKind.VariableDeclaration */, 7 /* TokenType.variable */], - [164 /* SyntaxKind.Parameter */, 6 /* TokenType.parameter */], - [167 /* SyntaxKind.PropertyDeclaration */, 9 /* TokenType.property */], - [261 /* SyntaxKind.ModuleDeclaration */, 3 /* TokenType.namespace */], - [260 /* SyntaxKind.EnumDeclaration */, 1 /* TokenType.enum */], - [299 /* SyntaxKind.EnumMember */, 8 /* TokenType.enumMember */], - [257 /* SyntaxKind.ClassDeclaration */, 0 /* TokenType.class */], - [169 /* SyntaxKind.MethodDeclaration */, 11 /* TokenType.member */], - [256 /* SyntaxKind.FunctionDeclaration */, 10 /* TokenType.function */], - [213 /* SyntaxKind.FunctionExpression */, 10 /* TokenType.function */], - [168 /* SyntaxKind.MethodSignature */, 11 /* TokenType.member */], - [172 /* SyntaxKind.GetAccessor */, 9 /* TokenType.property */], - [173 /* SyntaxKind.SetAccessor */, 9 /* TokenType.property */], - [166 /* SyntaxKind.PropertySignature */, 9 /* TokenType.property */], - [258 /* SyntaxKind.InterfaceDeclaration */, 2 /* TokenType.interface */], - [259 /* SyntaxKind.TypeAliasDeclaration */, 5 /* TokenType.type */], - [163 /* SyntaxKind.TypeParameter */, 4 /* TokenType.typeParameter */], - [296 /* SyntaxKind.PropertyAssignment */, 9 /* TokenType.property */], - [297 /* SyntaxKind.ShorthandPropertyAssignment */, 9 /* TokenType.property */] + [257 /* SyntaxKind.VariableDeclaration */, 7 /* TokenType.variable */], + [166 /* SyntaxKind.Parameter */, 6 /* TokenType.parameter */], + [169 /* SyntaxKind.PropertyDeclaration */, 9 /* TokenType.property */], + [264 /* SyntaxKind.ModuleDeclaration */, 3 /* TokenType.namespace */], + [263 /* SyntaxKind.EnumDeclaration */, 1 /* TokenType.enum */], + [302 /* SyntaxKind.EnumMember */, 8 /* TokenType.enumMember */], + [260 /* SyntaxKind.ClassDeclaration */, 0 /* TokenType.class */], + [171 /* SyntaxKind.MethodDeclaration */, 11 /* TokenType.member */], + [259 /* SyntaxKind.FunctionDeclaration */, 10 /* TokenType.function */], + [215 /* SyntaxKind.FunctionExpression */, 10 /* TokenType.function */], + [170 /* SyntaxKind.MethodSignature */, 11 /* TokenType.member */], + [174 /* SyntaxKind.GetAccessor */, 9 /* TokenType.property */], + [175 /* SyntaxKind.SetAccessor */, 9 /* TokenType.property */], + [168 /* SyntaxKind.PropertySignature */, 9 /* TokenType.property */], + [261 /* SyntaxKind.InterfaceDeclaration */, 2 /* TokenType.interface */], + [262 /* SyntaxKind.TypeAliasDeclaration */, 5 /* TokenType.type */], + [165 /* SyntaxKind.TypeParameter */, 4 /* TokenType.typeParameter */], + [299 /* SyntaxKind.PropertyAssignment */, 9 /* TokenType.property */], + [300 /* SyntaxKind.ShorthandPropertyAssignment */, 9 /* TokenType.property */] ]); })(v2020 = classifier.v2020 || (classifier.v2020 = {})); })(classifier = ts.classifier || (ts.classifier = {})); @@ -133547,18 +134485,18 @@ var ts; function getStringLiteralCompletionEntries(sourceFile, node, position, typeChecker, compilerOptions, host, preferences) { var parent = walkUpParentheses(node.parent); switch (parent.kind) { - case 196 /* SyntaxKind.LiteralType */: { + case 198 /* SyntaxKind.LiteralType */: { var grandParent_1 = walkUpParentheses(parent.parent); switch (grandParent_1.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 178 /* SyntaxKind.TypeReference */: { + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: { var typeArgument = ts.findAncestor(parent, function (n) { return n.parent === grandParent_1; }); if (typeArgument) { return { kind: 2 /* StringLiteralCompletionKind.Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(typeArgument)), isNewIdentifier: false }; } return undefined; } - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: // Get all apparent property names // i.e. interface Foo { // foo: string; @@ -133570,9 +134508,9 @@ var ts; return undefined; } return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(objectType)); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return { kind: 0 /* StringLiteralCompletionKind.Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) }; - case 187 /* SyntaxKind.UnionType */: { + case 189 /* SyntaxKind.UnionType */: { if (!ts.isTypeReferenceNode(grandParent_1.parent)) { return undefined; } @@ -133584,7 +134522,7 @@ var ts; return undefined; } } - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (ts.isObjectLiteralExpression(parent.parent) && parent.name === node) { // Get quoted name of properties of the object literal expression // i.e. interface ConfigFiles { @@ -133601,7 +134539,7 @@ var ts; return stringLiteralCompletionsForObjectLiteral(typeChecker, parent.parent); } return fromContextualType(); - case 207 /* SyntaxKind.ElementAccessExpression */: { + case 209 /* SyntaxKind.ElementAccessExpression */: { var _b = parent, expression = _b.expression, argumentExpression = _b.argumentExpression; if (node === ts.skipParentheses(argumentExpression)) { // Get all names of properties on the expression @@ -133614,20 +134552,20 @@ var ts; } return undefined; } - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 285 /* SyntaxKind.JsxAttribute */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 288 /* SyntaxKind.JsxAttribute */: if (!isRequireCallArgument(node) && !ts.isImportCall(parent)) { - var argumentInfo = ts.SignatureHelp.getArgumentInfoForCompletions(parent.kind === 285 /* SyntaxKind.JsxAttribute */ ? parent.parent : node, position, sourceFile); + var argumentInfo = ts.SignatureHelp.getArgumentInfoForCompletions(parent.kind === 288 /* SyntaxKind.JsxAttribute */ ? parent.parent : node, position, sourceFile); // Get string literal completions from specialized signatures of the target // i.e. declare function f(a: 'A'); // f("/*completion position*/") - return argumentInfo ? getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) : fromContextualType(); + return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(); } // falls through (is `require("")` or `require(""` or `import("")`) - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 277 /* SyntaxKind.ExternalModuleReference */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 280 /* SyntaxKind.ExternalModuleReference */: // Get all known external module names or complete a path to a module // i.e. import * as ns from "/*completion position*/"; // var y = import("/*completion position*/"); @@ -133646,9 +134584,9 @@ var ts; } function walkUpParentheses(node) { switch (node.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return ts.walkUpParenthesizedTypes(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return ts.walkUpParenthesizedExpressions(node); default: return node; @@ -133678,7 +134616,7 @@ var ts; isNewIdentifier = isNewIdentifier || !!(type.flags & 4 /* TypeFlags.String */); return getStringLiteralTypes(type, uniques); }); - return { kind: 2 /* StringLiteralCompletionKind.Types */, types: types, isNewIdentifier: isNewIdentifier }; + return ts.length(types) ? { kind: 2 /* StringLiteralCompletionKind.Types */, types: types, isNewIdentifier: isNewIdentifier } : undefined; } function stringLiteralCompletionsFromProperties(type) { return type && { @@ -134196,7 +135134,7 @@ var ts; if (!dependencies) continue; for (var dep in dependencies) { - if (dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, "@types/")) { + if (ts.hasProperty(dependencies, dep) && !ts.startsWith(dep, "@types/")) { result.push(dep); } } @@ -134571,7 +135509,7 @@ var ts; } function keywordFiltersFromSyntaxKind(keywordCompletion) { switch (keywordCompletion) { - case 152 /* SyntaxKind.TypeKeyword */: return 8 /* KeywordCompletionFilters.TypeKeyword */; + case 154 /* SyntaxKind.TypeKeyword */: return 8 /* KeywordCompletionFilters.TypeKeyword */; default: ts.Debug.fail("Unknown mapping from SyntaxKind to KeywordCompletionFilters"); } } @@ -134580,7 +135518,7 @@ var ts; return (location === null || location === void 0 ? void 0 : location.kind) === 79 /* SyntaxKind.Identifier */ ? ts.createTextSpanFromNode(location) : undefined; } function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) { - var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag, importCompletionNode = completionData.importCompletionNode, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports; + var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag, importStatementCompletion = completionData.importStatementCompletion, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports; // Verify if the file is JSX language variant if (ts.getLanguageVariant(sourceFile.scriptKind) === 1 /* LanguageVariant.JSX */) { var completionInfo = getJsxClosingTagCompletion(location, sourceFile); @@ -134594,7 +135532,7 @@ var ts; return undefined; } var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, - /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag); + /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag); if (keywordFilters !== 0 /* KeywordCompletionFilters.None */) { for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) { var keywordEntry = _a[_i]; @@ -134647,12 +135585,12 @@ var ts; // We wanna walk up the tree till we find a JSX closing element var jsxClosingElement = ts.findAncestor(location, function (node) { switch (node.kind) { - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: return true; case 43 /* SyntaxKind.SlashToken */: case 31 /* SyntaxKind.GreaterThanToken */: case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return false; default: return "quit"; @@ -134712,7 +135650,7 @@ var ts; function createCompletionEntryForLiteral(sourceFile, preferences, literal) { return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* ScriptElementKind.string */, kindModifiers: "" /* ScriptElementKindModifier.none */, sortText: Completions.SortText.LocationPriority }; } - function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) { + function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) { var _a, _b; var insertText; var replacementSpan = ts.getReplacementSpanForContextToken(replacementToken); @@ -134768,8 +135706,8 @@ var ts; } if (originIsResolvedExport(origin)) { sourceDisplay = [ts.textPart(origin.moduleSpecifier)]; - if (importCompletionNode) { - (_a = getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, contextToken, origin, useSemicolons, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan); + if (importStatementCompletion) { + (_a = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan); isSnippet = preferences.includeCompletionsWithSnippetText ? true : undefined; } } @@ -134824,7 +135762,7 @@ var ts; } if (originIsExport(origin) || originIsResolvedExport(origin)) { data = originToCompletionEntryData(origin); - hasAction = !importCompletionNode; + hasAction = !importStatementCompletion; } // TODO(drosen): Right now we just permit *all* semantic meanings when calling // 'getSymbolKind' which is permissible given that it is backwards compatible; but @@ -134847,7 +135785,7 @@ var ts; labelDetails: labelDetails, isSnippet: isSnippet, isPackageJsonImport: originIsPackageJsonImport(origin) || undefined, - isImportStatementCompletion: !!importCompletionNode || undefined, + isImportStatementCompletion: !!importStatementCompletion || undefined, data: data, }; } @@ -134926,7 +135864,7 @@ var ts; // Whether the suggested member should be abstract. // e.g. in `abstract class C { abstract | }`, we should offer abstract method signatures at position `|`. var _a = getPresentModifiers(contextToken), presentModifiers = _a.modifiers, modifiersSpan = _a.span; - var isAbstract = !!(presentModifiers & 128 /* ModifierFlags.Abstract */); + var isAbstract = !!(presentModifiers & 256 /* ModifierFlags.Abstract */); var completionNodes = []; ts.codefix.addNewNodeForMemberSymbol(symbol, classLikeDeclaration, sourceFile, { program: program, host: host }, preferences, importAdder, // `addNewNodeForMemberSymbol` calls this callback function for each new member node @@ -134939,7 +135877,7 @@ var ts; function (node) { var requiredModifiers = 0 /* ModifierFlags.None */; if (isAbstract) { - requiredModifiers |= 128 /* ModifierFlags.Abstract */; + requiredModifiers |= 256 /* ModifierFlags.Abstract */; } if (ts.isClassElement(node) && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node) === 1 /* MemberOverrideStatus.NeedsOverride */) { @@ -135000,7 +135938,7 @@ var ts; span = ts.createTextSpanFromNode(contextToken); } if (ts.isPropertyDeclaration(contextToken.parent)) { - modifiers |= ts.modifiersToFlags(contextToken.parent.modifiers) & 125951 /* ModifierFlags.Modifier */; + modifiers |= ts.modifiersToFlags(contextToken.parent.modifiers) & 126975 /* ModifierFlags.Modifier */; span = ts.createTextSpanFromNode(contextToken.parent); } return { modifiers: modifiers, span: span }; @@ -135049,7 +135987,6 @@ var ts; var labelDetails = { detail: signaturePrinter.printNode(4 /* EmitHint.Unspecified */, methodSignature, sourceFile) }; return { isSnippet: isSnippet, insertText: insertText, labelDetails: labelDetails }; } - ; function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences) { var declarations = symbol.getDeclarations(); if (!(declarations && declarations.length)) { @@ -135062,10 +135999,10 @@ var ts; var quotePreference = ts.getQuotePreference(sourceFile, preferences); var builderFlags = 33554432 /* NodeBuilderFlags.OmitThisParameter */ | (quotePreference === 0 /* QuotePreference.Single */ ? 268435456 /* NodeBuilderFlags.UseSingleQuotesForStringLiteralType */ : 0 /* NodeBuilderFlags.None */); switch (declaration.kind) { - case 166 /* SyntaxKind.PropertySignature */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: { + case 168 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: { var effectiveType = type.flags & 1048576 /* TypeFlags.Union */ && type.types.length < 10 ? checker.getUnionType(type.types, 2 /* UnionReduction.Subtype */) : type; @@ -135099,7 +136036,8 @@ var ts; } var parameters = typeNode.parameters.map(function (typedParam) { return ts.factory.createParameterDeclaration( - /*modifiers*/ undefined, typedParam.dotDotDotToken, typedParam.name, typedParam.questionToken, + /*modifiers*/ undefined, typedParam.dotDotDotToken, typedParam.name, + /*questionToken*/ undefined, /*type*/ undefined, typedParam.initializer); }); return ts.factory.createMethodDeclaration( @@ -135219,20 +136157,17 @@ var ts; }; return unresolvedOrigin; } - function getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, contextToken, origin, useSemicolons, options, preferences) { - var _a, _b, _c; - var sourceFile = importCompletionNode.getSourceFile(); - var replacementSpan = ts.createTextSpanFromNode(ts.findAncestor(importCompletionNode, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)) || importCompletionNode, sourceFile); + function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) { + var replacementSpan = importStatementCompletion.replacementSpan; var quotedModuleSpecifier = ts.quote(sourceFile, preferences, origin.moduleSpecifier); var exportKind = origin.isDefaultExport ? 1 /* ExportKind.Default */ : origin.exportName === "export=" /* InternalSymbolName.ExportEquals */ ? 2 /* ExportKind.ExportEquals */ : 0 /* ExportKind.Named */; var tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : ""; var importKind = ts.codefix.getImportKind(sourceFile, exportKind, options, /*forceImportKeyword*/ true); - var isTopLevelTypeOnly = ((_b = (_a = ts.tryCast(importCompletionNode, ts.isImportDeclaration)) === null || _a === void 0 ? void 0 : _a.importClause) === null || _b === void 0 ? void 0 : _b.isTypeOnly) || ((_c = ts.tryCast(importCompletionNode, ts.isImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.isTypeOnly); - var isImportSpecifierTypeOnly = couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken); - var topLevelTypeOnlyText = isTopLevelTypeOnly ? " ".concat(ts.tokenToString(152 /* SyntaxKind.TypeKeyword */), " ") : " "; - var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? "".concat(ts.tokenToString(152 /* SyntaxKind.TypeKeyword */), " ") : ""; + var isImportSpecifierTypeOnly = importStatementCompletion.couldBeTypeOnlyImportSpecifier; + var topLevelTypeOnlyText = importStatementCompletion.isTopLevelTypeOnly ? " ".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : " "; + var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? "".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : ""; var suffix = useSemicolons ? ";" : ""; switch (importKind) { case 3 /* ImportKind.CommonJS */: return { replacementSpan: replacementSpan, insertText: "import".concat(topLevelTypeOnlyText).concat(ts.escapeSnippetText(name)).concat(tabStop, " = require(").concat(quotedModuleSpecifier, ")").concat(suffix) }; @@ -135265,7 +136200,7 @@ var ts; return CompletionSource.TypeOnlyAlias; } } - function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) { + function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) { var _a; var start = ts.timestamp(); var variableDeclaration = getVariableDeclaration(location); @@ -135286,7 +136221,7 @@ var ts; var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess; var originalSortText = (_a = symbolToSortTextMap === null || symbolToSortTextMap === void 0 ? void 0 : symbolToSortTextMap[ts.getSymbolId(symbol)]) !== null && _a !== void 0 ? _a : Completions.SortText.LocationPriority; var sortText = (isDeprecated(symbol, typeChecker) ? Completions.SortText.Deprecated(originalSortText) : originalSortText); - var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, compilerOptions, preferences, kind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag); + var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, compilerOptions, preferences, kind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag); if (!entry) { continue; } @@ -135446,7 +136381,7 @@ var ts; } case "symbol": { var symbol = symbolCompletion.symbol, location = symbolCompletion.location, contextToken_2 = symbolCompletion.contextToken, origin = symbolCompletion.origin, previousToken = symbolCompletion.previousToken; - var _a = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken_2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; + var _a = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken_2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay); // TODO: GH#18217 } case "literal": { @@ -135475,9 +136410,9 @@ var ts; return { name: name, kindModifiers: kindModifiers, kind: kind, displayParts: displayParts, documentation: documentation, tags: tags, codeActions: codeActions, source: source, sourceDisplay: source }; } Completions.createCompletionDetails = createCompletionDetails; - function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source) { + function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken) { if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) { - if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementNode) { + if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementSpan) { // Import statement completion: 'import c|' return { codeActions: undefined, sourceDisplay: [ts.textPart(data.moduleSpecifier)] }; } @@ -135507,7 +136442,7 @@ var ts; var moduleSymbol = origin.moduleSymbol; var targetSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker)); var isJsxOpeningTagName = (contextToken === null || contextToken === void 0 ? void 0 : contextToken.kind) === 29 /* SyntaxKind.LessThanToken */ && ts.isJsxOpeningLikeElement(contextToken.parent); - var _a = ts.codefix.getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), isJsxOpeningTagName), isJsxOpeningTagName, host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences), moduleSpecifier = _a.moduleSpecifier, codeAction = _a.codeAction; + var _a = ts.codefix.getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), isJsxOpeningTagName), isJsxOpeningTagName, host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences, cancellationToken), moduleSpecifier = _a.moduleSpecifier, codeAction = _a.codeAction; ts.Debug.assert(!(data === null || data === void 0 ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier); return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] }; } @@ -135550,11 +136485,11 @@ var ts; return ts.getContextualTypeFromParent(previousToken, checker); case 63 /* SyntaxKind.EqualsToken */: switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checker.getContextualType(parent.initializer); // TODO: GH#18217 - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return checker.getTypeAtLocation(parent.left); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return checker.getContextualTypeForJsxAttribute(parent); default: return undefined; @@ -135585,7 +136520,7 @@ var ts; } function isModuleSymbol(symbol) { var _a; - return !!((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.kind === 305 /* SyntaxKind.SourceFile */; })); + return !!((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.kind === 308 /* SyntaxKind.SourceFile */; })); } function getCompletionData(program, log, sourceFile, compilerOptions, position, preferences, detailsEntryId, host, formatContext, cancellationToken) { var typeChecker = program.getTypeChecker(); @@ -135642,7 +136577,7 @@ var ts; currentToken = ts.getTokenAtPosition(sourceFile, position); if (!currentToken || (!ts.isDeclarationName(currentToken) && - (currentToken.parent.kind !== 347 /* SyntaxKind.JSDocPropertyTag */ || + (currentToken.parent.kind !== 350 /* SyntaxKind.JSDocPropertyTag */ || currentToken.parent.name !== currentToken))) { // Use as type location if inside tag's type expression insideJsDocTagTypeExpression = isCurrentlyEditingNode(typeExpression); @@ -135678,34 +136613,34 @@ var ts; var isStartingCloseTag = false; var isJsxInitializer = false; var isJsxIdentifierExpected = false; - var importCompletionNode; + var importStatementCompletion; var location = ts.getTouchingPropertyName(sourceFile, position); var keywordFilters = 0 /* KeywordCompletionFilters.None */; var isNewIdentifierLocation = false; var flags = 0 /* CompletionInfoFlags.None */; if (contextToken) { - var importStatementCompletion = getImportStatementCompletionInfo(contextToken); - isNewIdentifierLocation = importStatementCompletion.isNewIdentifierLocation; - if (importStatementCompletion.keywordCompletion) { - if (importStatementCompletion.isKeywordOnlyCompletion) { + var importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken); + if (importStatementCompletionInfo.keywordCompletion) { + if (importStatementCompletionInfo.isKeywordOnlyCompletion) { return { kind: 4 /* CompletionDataKind.Keywords */, - keywordCompletions: [keywordToCompletionEntry(importStatementCompletion.keywordCompletion)], - isNewIdentifierLocation: isNewIdentifierLocation, + keywordCompletions: [keywordToCompletionEntry(importStatementCompletionInfo.keywordCompletion)], + isNewIdentifierLocation: importStatementCompletionInfo.isNewIdentifierLocation, }; } - keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletion.keywordCompletion); + keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletionInfo.keywordCompletion); } - if (importStatementCompletion.replacementNode && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) { + if (importStatementCompletionInfo.replacementSpan && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) { // Import statement completions use `insertText`, and also require the `data` property of `CompletionEntryIdentifier` // added in TypeScript 4.3 to be sent back from the client during `getCompletionEntryDetails`. Since this feature // is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients // to opt in with the `includeCompletionsForImportStatements` user preference. - importCompletionNode = importStatementCompletion.replacementNode; flags |= 2 /* CompletionInfoFlags.IsImportStatementCompletion */; + importStatementCompletion = importStatementCompletionInfo; + isNewIdentifierLocation = importStatementCompletionInfo.isNewIdentifierLocation; } // Bail out if this is a known invalid completion location - if (!importCompletionNode && isCompletionListBlocker(contextToken)) { + if (!importStatementCompletionInfo.replacementSpan && isCompletionListBlocker(contextToken)) { log("Returning an empty list because completion was requested in an invalid position."); return keywordFilters ? keywordCompletionData(keywordFilters, isJsOnlyLocation, isNewIdentifierDefinitionLocation()) @@ -135716,7 +136651,7 @@ var ts; isRightOfDot = contextToken.kind === 24 /* SyntaxKind.DotToken */; isRightOfQuestionDot = contextToken.kind === 28 /* SyntaxKind.QuestionDotToken */; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: propertyAccessToConvert = parent; node = propertyAccessToConvert.expression; var leftmostAccessExpression = ts.getLeftmostAccessExpression(propertyAccessToConvert); @@ -135732,16 +136667,16 @@ var ts; return undefined; } break; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: node = parent.left; break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: node = parent.name; break; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: node = parent; break; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: node = parent.getFirstToken(sourceFile); ts.Debug.assert(node.kind === 100 /* SyntaxKind.ImportKeyword */ || node.kind === 103 /* SyntaxKind.NewKeyword */); break; @@ -135751,11 +136686,11 @@ var ts; return undefined; } } - else if (!importCompletionNode && sourceFile.languageVariant === 1 /* LanguageVariant.JSX */) { + else if (!importStatementCompletion) { // // If the tagname is a property access expression, we will then walk up to the top most of property access expression. // Then, try to get a JSX container and its associated attributes type. - if (parent && parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (parent && parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { contextToken = parent; parent = parent.parent; } @@ -135763,46 +136698,46 @@ var ts; if (currentToken.parent === location) { switch (currentToken.kind) { case 31 /* SyntaxKind.GreaterThanToken */: - if (currentToken.parent.kind === 278 /* SyntaxKind.JsxElement */ || currentToken.parent.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (currentToken.parent.kind === 281 /* SyntaxKind.JsxElement */ || currentToken.parent.kind === 283 /* SyntaxKind.JsxOpeningElement */) { location = currentToken; } break; case 43 /* SyntaxKind.SlashToken */: - if (currentToken.parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */) { + if (currentToken.parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */) { location = currentToken; } break; } } switch (parent.kind) { - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: if (contextToken.kind === 43 /* SyntaxKind.SlashToken */) { isStartingCloseTag = true; location = contextToken; } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (!binaryExpressionMayBeOpenTag(parent)) { break; } // falls through - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 278 /* SyntaxKind.JsxElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 281 /* SyntaxKind.JsxElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: isJsxIdentifierExpected = true; if (contextToken.kind === 29 /* SyntaxKind.LessThanToken */) { isRightOfOpenTag = true; location = contextToken; } break; - case 288 /* SyntaxKind.JsxExpression */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 291 /* SyntaxKind.JsxExpression */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: // For `
`, `parent` will be `{true}` and `previousToken` will be `}` if (previousToken.kind === 19 /* SyntaxKind.CloseBraceToken */ && currentToken.kind === 31 /* SyntaxKind.GreaterThanToken */) { isJsxIdentifierExpected = true; } break; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: // For `
`, `parent` will be JsxAttribute and `previousToken` will be its initializer if (parent.initializer === previousToken && previousToken.end < position) { @@ -135894,19 +136829,19 @@ var ts; isTypeOnlyLocation: isTypeOnlyLocation, isJsxIdentifierExpected: isJsxIdentifierExpected, isRightOfOpenTag: isRightOfOpenTag, - importCompletionNode: importCompletionNode, + importStatementCompletion: importStatementCompletion, hasUnresolvedAutoImports: hasUnresolvedAutoImports, flags: flags, }; function isTagWithTypeExpression(tag) { switch (tag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 341 /* SyntaxKind.JSDocReturnTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return true; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return !!tag.constraint; default: return false; @@ -135915,7 +136850,7 @@ var ts; function tryGetTypeExpressionFromTag(tag) { if (isTagWithTypeExpression(tag)) { var typeExpression = ts.isJSDocTemplateTag(tag) ? tag.constraint : tag.typeExpression; - return typeExpression && typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */ ? typeExpression : undefined; + return typeExpression && typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */ ? typeExpression : undefined; } return undefined; } @@ -135958,7 +136893,7 @@ var ts; // If the module is merged with a value, we must get the type of the class and add its propertes (for inherited static methods). if (!isTypeLocation && symbol.declarations && - symbol.declarations.some(function (d) { return d.kind !== 305 /* SyntaxKind.SourceFile */ && d.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && d.kind !== 260 /* SyntaxKind.EnumDeclaration */; })) { + symbol.declarations.some(function (d) { return d.kind !== 308 /* SyntaxKind.SourceFile */ && d.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && d.kind !== 263 /* SyntaxKind.EnumDeclaration */; })) { var type = typeChecker.getTypeOfSymbolAtLocation(symbol, node).getNonOptionalType(); var insertQuestionDot = false; if (type.isNullableType()) { @@ -136004,7 +136939,7 @@ var ts; if (isRightOfQuestionDot && ts.some(type.getCallSignatures())) { isNewIdentifierLocation = true; } - var propertyAccess = node.kind === 200 /* SyntaxKind.ImportType */ ? node : node.parent; + var propertyAccess = node.kind === 202 /* SyntaxKind.ImportType */ ? node : node.parent; if (inCheckedFile) { for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) { var symbol = _a[_i]; @@ -136148,7 +137083,7 @@ var ts; return 1 /* GlobalsSearch.Success */; } function tryGetImportCompletionSymbols() { - if (!importCompletionNode) + if (!importStatementCompletion) return 0 /* GlobalsSearch.Continue */; isNewIdentifierLocation = true; collectAutoImports(); @@ -136211,7 +137146,7 @@ var ts; } } // Need to insert 'this.' before properties of `this` type, so only do that if `includeInsertTextCompletions` - if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 305 /* SyntaxKind.SourceFile */) { + if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 308 /* SyntaxKind.SourceFile */) { var thisType = typeChecker.tryGetThisTypeAt(scopeNode, /*includeGlobalThis*/ false, ts.isClassLike(scopeNode.parent) ? scopeNode : undefined); if (thisType && !isProbablyGlobalType(thisType, sourceFile, typeChecker)) { for (var _i = 0, _a = getPropertiesForCompletion(thisType, typeChecker); _i < _a.length; _i++) { @@ -136231,7 +137166,7 @@ var ts; } function shouldOfferImportCompletions() { // If already typing an import statement, provide completions for it. - if (importCompletionNode) + if (importStatementCompletion) return true; // If current completion is for non-contextual Object literal shortahands, ignore auto-import symbols if (isNonContextualObjectLiteral) @@ -136250,10 +137185,10 @@ var ts; } function isSnippetScope(scopeNode) { switch (scopeNode.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 223 /* SyntaxKind.TemplateExpression */: - case 288 /* SyntaxKind.JsxExpression */: - case 235 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 225 /* SyntaxKind.TemplateExpression */: + case 291 /* SyntaxKind.JsxExpression */: + case 238 /* SyntaxKind.Block */: return true; default: return ts.isStatement(scopeNode); @@ -136261,7 +137196,7 @@ var ts; } function isTypeOnlyCompletion() { return insideJsDocTagTypeExpression - || !!importCompletionNode && ts.isTypeOnlyImportOrExportDeclaration(location.parent) + || !!importStatementCompletion && ts.isTypeOnlyImportOrExportDeclaration(location.parent) || !isContextTokenValueLocation(contextToken) && (ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker) || ts.isPartOfTypeNode(location) @@ -136270,28 +137205,30 @@ var ts; function isContextTokenValueLocation(contextToken) { return contextToken && ((contextToken.kind === 112 /* SyntaxKind.TypeOfKeyword */ && - (contextToken.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isTypeOfExpression(contextToken.parent))) || - (contextToken.kind === 128 /* SyntaxKind.AssertsKeyword */ && contextToken.parent.kind === 177 /* SyntaxKind.TypePredicate */)); + (contextToken.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isTypeOfExpression(contextToken.parent))) || + (contextToken.kind === 129 /* SyntaxKind.AssertsKeyword */ && contextToken.parent.kind === 179 /* SyntaxKind.TypePredicate */)); } function isContextTokenTypeLocation(contextToken) { if (contextToken) { var parentKind = contextToken.parent.kind; switch (contextToken.kind) { case 58 /* SyntaxKind.ColonToken */: - return parentKind === 167 /* SyntaxKind.PropertyDeclaration */ || - parentKind === 166 /* SyntaxKind.PropertySignature */ || - parentKind === 164 /* SyntaxKind.Parameter */ || - parentKind === 254 /* SyntaxKind.VariableDeclaration */ || + return parentKind === 169 /* SyntaxKind.PropertyDeclaration */ || + parentKind === 168 /* SyntaxKind.PropertySignature */ || + parentKind === 166 /* SyntaxKind.Parameter */ || + parentKind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isFunctionLikeKind(parentKind); case 63 /* SyntaxKind.EqualsToken */: - return parentKind === 259 /* SyntaxKind.TypeAliasDeclaration */; - case 127 /* SyntaxKind.AsKeyword */: - return parentKind === 229 /* SyntaxKind.AsExpression */; + return parentKind === 262 /* SyntaxKind.TypeAliasDeclaration */; + case 128 /* SyntaxKind.AsKeyword */: + return parentKind === 231 /* SyntaxKind.AsExpression */; case 29 /* SyntaxKind.LessThanToken */: - return parentKind === 178 /* SyntaxKind.TypeReference */ || - parentKind === 211 /* SyntaxKind.TypeAssertionExpression */; + return parentKind === 180 /* SyntaxKind.TypeReference */ || + parentKind === 213 /* SyntaxKind.TypeAssertionExpression */; case 94 /* SyntaxKind.ExtendsKeyword */: - return parentKind === 163 /* SyntaxKind.TypeParameter */; + return parentKind === 165 /* SyntaxKind.TypeParameter */; + case 150 /* SyntaxKind.SatisfiesKeyword */: + return parentKind === 235 /* SyntaxKind.SatisfiesExpression */; } } return false; @@ -136309,8 +137246,7 @@ var ts; flags |= 1 /* CompletionInfoFlags.MayIncludeAutoImports */; // import { type | -> token text should be blank var isAfterTypeOnlyImportSpecifierModifier = previousToken === contextToken - && importCompletionNode - && couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken); + && importStatementCompletion; var lowerCaseTokenText = isAfterTypeOnlyImportSpecifierModifier ? "" : previousToken && ts.isIdentifier(previousToken) ? previousToken.text.toLowerCase() : ""; @@ -136318,14 +137254,14 @@ var ts; var exportInfo = ts.getExportInfoMap(sourceFile, host, program, preferences, cancellationToken); var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host); var packageJsonFilter = detailsEntryId ? undefined : ts.createPackageJsonImportFilter(sourceFile, preferences, host); - resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importCompletionNode, ts.isValidTypeOnlyAliasUseSite(location), function (context) { + resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importStatementCompletion, ts.isValidTypeOnlyAliasUseSite(location), function (context) { exportInfo.search(sourceFile.path, /*preferCapitalized*/ isRightOfOpenTag, function (symbolName, targetFlags) { if (!ts.isIdentifierText(symbolName, ts.getEmitScriptTarget(host.getCompilationSettings()))) return false; if (!detailsEntryId && ts.isStringANonContextualKeyword(symbolName)) return false; - if (!isTypeOnlyLocation && !importCompletionNode && !(targetFlags & 111551 /* SymbolFlags.Value */)) + if (!isTypeOnlyLocation && !importStatementCompletion && !(targetFlags & 111551 /* SymbolFlags.Value */)) return false; if (isTypeOnlyLocation && !(targetFlags & (1536 /* SymbolFlags.Module */ | 788968 /* SymbolFlags.Type */))) return false; @@ -136406,7 +137342,7 @@ var ts; return; } symbolToOriginInfoMap[symbols.length] = origin; - symbolToSortTextMap[symbolId] = importCompletionNode ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions; + symbolToSortTextMap[symbolId] = importStatementCompletion ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions; symbols.push(symbol); } /* Mutates `symbols` and `symbolToOriginInfoMap`. */ @@ -136482,18 +137418,18 @@ var ts; // - contextToken: GreaterThanToken (before cursor) // - location: JsxSelfClosingElement or JsxOpeningElement // - contextToken.parent === location - if (location === contextToken.parent && (location.kind === 280 /* SyntaxKind.JsxOpeningElement */ || location.kind === 279 /* SyntaxKind.JsxSelfClosingElement */)) { + if (location === contextToken.parent && (location.kind === 283 /* SyntaxKind.JsxOpeningElement */ || location.kind === 282 /* SyntaxKind.JsxSelfClosingElement */)) { return false; } - if (contextToken.parent.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (contextToken.parent.kind === 283 /* SyntaxKind.JsxOpeningElement */) { //
/**/ // - contextToken: GreaterThanToken (before cursor) // - location: JSXElement // - different parents (JSXOpeningElement, JSXElement) - return location.parent.kind !== 280 /* SyntaxKind.JsxOpeningElement */; + return location.parent.kind !== 283 /* SyntaxKind.JsxOpeningElement */; } - if (contextToken.parent.kind === 281 /* SyntaxKind.JsxClosingElement */ || contextToken.parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */) { - return !!contextToken.parent.parent && contextToken.parent.parent.kind === 278 /* SyntaxKind.JsxElement */; + if (contextToken.parent.kind === 284 /* SyntaxKind.JsxClosingElement */ || contextToken.parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */) { + return !!contextToken.parent.parent && contextToken.parent.parent.kind === 281 /* SyntaxKind.JsxElement */; } } return false; @@ -136505,44 +137441,44 @@ var ts; // Previous token may have been a keyword that was converted to an identifier. switch (tokenKind) { case 27 /* SyntaxKind.CommaToken */: - return containingNodeKind === 208 /* SyntaxKind.CallExpression */ // func( a, | - || containingNodeKind === 171 /* SyntaxKind.Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ - || containingNodeKind === 209 /* SyntaxKind.NewExpression */ // new C(a, | - || containingNodeKind === 204 /* SyntaxKind.ArrayLiteralExpression */ // [a, | - || containingNodeKind === 221 /* SyntaxKind.BinaryExpression */ // const x = (a, | - || containingNodeKind === 179 /* SyntaxKind.FunctionType */ // var x: (s: string, list| - || containingNodeKind === 205 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { x, | + return containingNodeKind === 210 /* SyntaxKind.CallExpression */ // func( a, | + || containingNodeKind === 173 /* SyntaxKind.Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ + || containingNodeKind === 211 /* SyntaxKind.NewExpression */ // new C(a, | + || containingNodeKind === 206 /* SyntaxKind.ArrayLiteralExpression */ // [a, | + || containingNodeKind === 223 /* SyntaxKind.BinaryExpression */ // const x = (a, | + || containingNodeKind === 181 /* SyntaxKind.FunctionType */ // var x: (s: string, list| + || containingNodeKind === 207 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { x, | case 20 /* SyntaxKind.OpenParenToken */: - return containingNodeKind === 208 /* SyntaxKind.CallExpression */ // func( | - || containingNodeKind === 171 /* SyntaxKind.Constructor */ // constructor( | - || containingNodeKind === 209 /* SyntaxKind.NewExpression */ // new C(a| - || containingNodeKind === 212 /* SyntaxKind.ParenthesizedExpression */ // const x = (a| - || containingNodeKind === 191 /* SyntaxKind.ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ + return containingNodeKind === 210 /* SyntaxKind.CallExpression */ // func( | + || containingNodeKind === 173 /* SyntaxKind.Constructor */ // constructor( | + || containingNodeKind === 211 /* SyntaxKind.NewExpression */ // new C(a| + || containingNodeKind === 214 /* SyntaxKind.ParenthesizedExpression */ // const x = (a| + || containingNodeKind === 193 /* SyntaxKind.ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ case 22 /* SyntaxKind.OpenBracketToken */: - return containingNodeKind === 204 /* SyntaxKind.ArrayLiteralExpression */ // [ | - || containingNodeKind === 176 /* SyntaxKind.IndexSignature */ // [ | : string ] - || containingNodeKind === 162 /* SyntaxKind.ComputedPropertyName */; // [ | /* this can become an index signature */ - case 141 /* SyntaxKind.ModuleKeyword */: // module | - case 142 /* SyntaxKind.NamespaceKeyword */: // namespace | + return containingNodeKind === 206 /* SyntaxKind.ArrayLiteralExpression */ // [ | + || containingNodeKind === 178 /* SyntaxKind.IndexSignature */ // [ | : string ] + || containingNodeKind === 164 /* SyntaxKind.ComputedPropertyName */; // [ | /* this can become an index signature */ + case 142 /* SyntaxKind.ModuleKeyword */: // module | + case 143 /* SyntaxKind.NamespaceKeyword */: // namespace | case 100 /* SyntaxKind.ImportKeyword */: // import | return true; case 24 /* SyntaxKind.DotToken */: - return containingNodeKind === 261 /* SyntaxKind.ModuleDeclaration */; // module A.| + return containingNodeKind === 264 /* SyntaxKind.ModuleDeclaration */; // module A.| case 18 /* SyntaxKind.OpenBraceToken */: - return containingNodeKind === 257 /* SyntaxKind.ClassDeclaration */ // class A { | - || containingNodeKind === 205 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { | + return containingNodeKind === 260 /* SyntaxKind.ClassDeclaration */ // class A { | + || containingNodeKind === 207 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { | case 63 /* SyntaxKind.EqualsToken */: - return containingNodeKind === 254 /* SyntaxKind.VariableDeclaration */ // const x = a| - || containingNodeKind === 221 /* SyntaxKind.BinaryExpression */; // x = a| + return containingNodeKind === 257 /* SyntaxKind.VariableDeclaration */ // const x = a| + || containingNodeKind === 223 /* SyntaxKind.BinaryExpression */; // x = a| case 15 /* SyntaxKind.TemplateHead */: - return containingNodeKind === 223 /* SyntaxKind.TemplateExpression */; // `aa ${| + return containingNodeKind === 225 /* SyntaxKind.TemplateExpression */; // `aa ${| case 16 /* SyntaxKind.TemplateMiddle */: - return containingNodeKind === 233 /* SyntaxKind.TemplateSpan */; // `aa ${10} dd ${| - case 131 /* SyntaxKind.AsyncKeyword */: - return containingNodeKind === 169 /* SyntaxKind.MethodDeclaration */ // const obj = { async c|() - || containingNodeKind === 297 /* SyntaxKind.ShorthandPropertyAssignment */; // const obj = { async c| + return containingNodeKind === 236 /* SyntaxKind.TemplateSpan */; // `aa ${10} dd ${| + case 132 /* SyntaxKind.AsyncKeyword */: + return containingNodeKind === 171 /* SyntaxKind.MethodDeclaration */ // const obj = { async c|() + || containingNodeKind === 300 /* SyntaxKind.ShorthandPropertyAssignment */; // const obj = { async c| case 41 /* SyntaxKind.AsteriskToken */: - return containingNodeKind === 169 /* SyntaxKind.MethodDeclaration */; // const obj = { * c| + return containingNodeKind === 171 /* SyntaxKind.MethodDeclaration */; // const obj = { * c| } if (isClassMemberCompletionKeyword(tokenKind)) { return true; @@ -136592,7 +137528,7 @@ var ts; completionKind = 0 /* CompletionKind.ObjectPropertyDeclaration */; var typeMembers; var existingMembers; - if (objectLikeContainer.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { var instantiatedType = tryGetObjectLiteralContextualType(objectLikeContainer, typeChecker); // Check completions for Object property value shorthand if (instantiatedType === undefined) { @@ -136617,7 +137553,7 @@ var ts; } } else { - ts.Debug.assert(objectLikeContainer.kind === 201 /* SyntaxKind.ObjectBindingPattern */); + ts.Debug.assert(objectLikeContainer.kind === 203 /* SyntaxKind.ObjectBindingPattern */); // We are *only* completing on properties from the type being destructured. isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); @@ -136628,12 +137564,12 @@ var ts; // through type declaration or inference. // Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed - // type of parameter will flow in from the contextual type of the function - var canGetType = ts.hasInitializer(rootDeclaration) || !!ts.getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */; - if (!canGetType && rootDeclaration.kind === 164 /* SyntaxKind.Parameter */) { + var canGetType = ts.hasInitializer(rootDeclaration) || !!ts.getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */; + if (!canGetType && rootDeclaration.kind === 166 /* SyntaxKind.Parameter */) { if (ts.isExpression(rootDeclaration.parent)) { canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); } - else if (rootDeclaration.parent.kind === 169 /* SyntaxKind.MethodDeclaration */ || rootDeclaration.parent.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (rootDeclaration.parent.kind === 171 /* SyntaxKind.MethodDeclaration */ || rootDeclaration.parent.kind === 175 /* SyntaxKind.SetAccessor */) { canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); } } @@ -136652,7 +137588,7 @@ var ts; var filteredMembers = filterObjectMembersList(typeMembers, ts.Debug.checkDefined(existingMembers)); symbols = ts.concatenate(symbols, filteredMembers); setSortTextToOptionalMember(); - if (objectLikeContainer.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ + if (objectLikeContainer.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && preferences.includeCompletionsWithObjectLiteralMethodSnippets && preferences.includeCompletionsWithInsertText) { transformObjectLiteralMembersSortText(symbolsStartIndex); @@ -136687,10 +137623,10 @@ var ts; keywordFilters = 8 /* KeywordCompletionFilters.TypeKeyword */; } // try to show exported member for imported/re-exported module - var moduleSpecifier = (namedImportsOrExports.kind === 269 /* SyntaxKind.NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier; + var moduleSpecifier = (namedImportsOrExports.kind === 272 /* SyntaxKind.NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier; if (!moduleSpecifier) { isNewIdentifierLocation = true; - return namedImportsOrExports.kind === 269 /* SyntaxKind.NamedImports */ ? 2 /* GlobalsSearch.Fail */ : 0 /* GlobalsSearch.Continue */; + return namedImportsOrExports.kind === 272 /* SyntaxKind.NamedImports */ ? 2 /* GlobalsSearch.Fail */ : 0 /* GlobalsSearch.Continue */; } var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); // TODO: GH#18217 if (!moduleSpecifierSymbol) { @@ -136835,11 +137771,11 @@ var ts; case 30 /* SyntaxKind.LessThanSlashToken */: case 43 /* SyntaxKind.SlashToken */: case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 286 /* SyntaxKind.JsxAttributes */: - case 285 /* SyntaxKind.JsxAttribute */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - if (parent && (parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */ || parent.kind === 280 /* SyntaxKind.JsxOpeningElement */)) { + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 289 /* SyntaxKind.JsxAttributes */: + case 288 /* SyntaxKind.JsxAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + if (parent && (parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || parent.kind === 283 /* SyntaxKind.JsxOpeningElement */)) { if (contextToken.kind === 31 /* SyntaxKind.GreaterThanToken */) { var precedingToken = ts.findPrecedingToken(contextToken.pos, sourceFile, /*startNode*/ undefined); if (!parent.typeArguments || (precedingToken && precedingToken.kind === 43 /* SyntaxKind.SlashToken */)) @@ -136847,7 +137783,7 @@ var ts; } return parent; } - else if (parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + else if (parent.kind === 288 /* SyntaxKind.JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136859,7 +137795,7 @@ var ts; // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 10 /* SyntaxKind.StringLiteral */: - if (parent && ((parent.kind === 285 /* SyntaxKind.JsxAttribute */) || (parent.kind === 287 /* SyntaxKind.JsxSpreadAttribute */))) { + if (parent && ((parent.kind === 288 /* SyntaxKind.JsxAttribute */) || (parent.kind === 290 /* SyntaxKind.JsxSpreadAttribute */))) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136869,8 +137805,8 @@ var ts; break; case 19 /* SyntaxKind.CloseBraceToken */: if (parent && - parent.kind === 288 /* SyntaxKind.JsxExpression */ && - parent.parent && parent.parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + parent.kind === 291 /* SyntaxKind.JsxExpression */ && + parent.parent && parent.parent.kind === 288 /* SyntaxKind.JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136878,7 +137814,7 @@ var ts; // each JsxAttribute can have initializer as JsxExpression return parent.parent.parent.parent; } - if (parent && parent.kind === 287 /* SyntaxKind.JsxSpreadAttribute */) { + if (parent && parent.kind === 290 /* SyntaxKind.JsxSpreadAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136898,54 +137834,54 @@ var ts; var containingNodeKind = parent.kind; switch (contextToken.kind) { case 27 /* SyntaxKind.CommaToken */: - return containingNodeKind === 254 /* SyntaxKind.VariableDeclaration */ || + return containingNodeKind === 257 /* SyntaxKind.VariableDeclaration */ || isVariableDeclarationListButNotTypeArgument(contextToken) || - containingNodeKind === 237 /* SyntaxKind.VariableStatement */ || - containingNodeKind === 260 /* SyntaxKind.EnumDeclaration */ || // enum a { foo, | + containingNodeKind === 240 /* SyntaxKind.VariableStatement */ || + containingNodeKind === 263 /* SyntaxKind.EnumDeclaration */ || // enum a { foo, | isFunctionLikeButNotConstructor(containingNodeKind) || - containingNodeKind === 258 /* SyntaxKind.InterfaceDeclaration */ || // interface A= contextToken.pos); case 24 /* SyntaxKind.DotToken */: - return containingNodeKind === 202 /* SyntaxKind.ArrayBindingPattern */; // var [.| + return containingNodeKind === 204 /* SyntaxKind.ArrayBindingPattern */; // var [.| case 58 /* SyntaxKind.ColonToken */: - return containingNodeKind === 203 /* SyntaxKind.BindingElement */; // var {x :html| + return containingNodeKind === 205 /* SyntaxKind.BindingElement */; // var {x :html| case 22 /* SyntaxKind.OpenBracketToken */: - return containingNodeKind === 202 /* SyntaxKind.ArrayBindingPattern */; // var [x| + return containingNodeKind === 204 /* SyntaxKind.ArrayBindingPattern */; // var [x| case 20 /* SyntaxKind.OpenParenToken */: - return containingNodeKind === 292 /* SyntaxKind.CatchClause */ || + return containingNodeKind === 295 /* SyntaxKind.CatchClause */ || isFunctionLikeButNotConstructor(containingNodeKind); case 18 /* SyntaxKind.OpenBraceToken */: - return containingNodeKind === 260 /* SyntaxKind.EnumDeclaration */; // enum a { | + return containingNodeKind === 263 /* SyntaxKind.EnumDeclaration */; // enum a { | case 29 /* SyntaxKind.LessThanToken */: - return containingNodeKind === 257 /* SyntaxKind.ClassDeclaration */ || // class A< | - containingNodeKind === 226 /* SyntaxKind.ClassExpression */ || // var C = class D< | - containingNodeKind === 258 /* SyntaxKind.InterfaceDeclaration */ || // interface A< | - containingNodeKind === 259 /* SyntaxKind.TypeAliasDeclaration */ || // type List< | + return containingNodeKind === 260 /* SyntaxKind.ClassDeclaration */ || // class A< | + containingNodeKind === 228 /* SyntaxKind.ClassExpression */ || // var C = class D< | + containingNodeKind === 261 /* SyntaxKind.InterfaceDeclaration */ || // interface A< | + containingNodeKind === 262 /* SyntaxKind.TypeAliasDeclaration */ || // type List< | ts.isFunctionLikeKind(containingNodeKind); case 124 /* SyntaxKind.StaticKeyword */: - return containingNodeKind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isClassLike(parent.parent); + return containingNodeKind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isClassLike(parent.parent); case 25 /* SyntaxKind.DotDotDotToken */: - return containingNodeKind === 164 /* SyntaxKind.Parameter */ || - (!!parent.parent && parent.parent.kind === 202 /* SyntaxKind.ArrayBindingPattern */); // var [...z| + return containingNodeKind === 166 /* SyntaxKind.Parameter */ || + (!!parent.parent && parent.parent.kind === 204 /* SyntaxKind.ArrayBindingPattern */); // var [...z| case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - return containingNodeKind === 164 /* SyntaxKind.Parameter */ && !ts.isConstructorDeclaration(parent.parent); - case 127 /* SyntaxKind.AsKeyword */: - return containingNodeKind === 270 /* SyntaxKind.ImportSpecifier */ || - containingNodeKind === 275 /* SyntaxKind.ExportSpecifier */ || - containingNodeKind === 268 /* SyntaxKind.NamespaceImport */; - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: + return containingNodeKind === 166 /* SyntaxKind.Parameter */ && !ts.isConstructorDeclaration(parent.parent); + case 128 /* SyntaxKind.AsKeyword */: + return containingNodeKind === 273 /* SyntaxKind.ImportSpecifier */ || + containingNodeKind === 278 /* SyntaxKind.ExportSpecifier */ || + containingNodeKind === 271 /* SyntaxKind.NamespaceImport */; + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: return !isFromObjectTypeDeclaration(contextToken); case 79 /* SyntaxKind.Identifier */: - if (containingNodeKind === 270 /* SyntaxKind.ImportSpecifier */ && + if (containingNodeKind === 273 /* SyntaxKind.ImportSpecifier */ && contextToken === parent.name && contextToken.text === "type") { // import { type | } @@ -136960,11 +137896,11 @@ var ts; case 100 /* SyntaxKind.ImportKeyword */: case 119 /* SyntaxKind.LetKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: return true; - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: // import { type foo| } - return containingNodeKind !== 270 /* SyntaxKind.ImportSpecifier */; + return containingNodeKind !== 273 /* SyntaxKind.ImportSpecifier */; case 41 /* SyntaxKind.AsteriskToken */: return ts.isFunctionLike(contextToken.parent) && !ts.isMethodDeclaration(contextToken.parent); } @@ -136989,7 +137925,7 @@ var ts; case 126 /* SyntaxKind.AbstractKeyword */: case 84 /* SyntaxKind.ClassKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 92 /* SyntaxKind.EnumKeyword */: case 98 /* SyntaxKind.FunctionKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: @@ -137000,7 +137936,7 @@ var ts; case 124 /* SyntaxKind.StaticKeyword */: case 113 /* SyntaxKind.VarKeyword */: return true; - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: return ts.isPropertyDeclaration(contextToken.parent); } // If we are inside a class declaration, and `constructor` is totally not present, @@ -137009,7 +137945,7 @@ var ts; if (ancestorClassLike && contextToken === previousToken && isPreviousPropertyDeclarationTerminated(contextToken, position)) { return false; // Don't block completions. } - var ancestorPropertyDeclaraion = ts.getAncestor(contextToken.parent, 167 /* SyntaxKind.PropertyDeclaration */); + var ancestorPropertyDeclaraion = ts.getAncestor(contextToken.parent, 169 /* SyntaxKind.PropertyDeclaration */); // If we are inside a class declaration and typing `constructor` after property declaration... if (ancestorPropertyDeclaraion && contextToken !== previousToken @@ -137041,7 +137977,7 @@ var ts; || !ts.positionsAreOnSameLine(contextToken.end, position, sourceFile)); } function isFunctionLikeButNotConstructor(kind) { - return ts.isFunctionLikeKind(kind) && kind !== 171 /* SyntaxKind.Constructor */; + return ts.isFunctionLikeKind(kind) && kind !== 173 /* SyntaxKind.Constructor */; } function isDotOfNumericLiteral(contextToken) { if (contextToken.kind === 8 /* SyntaxKind.NumericLiteral */) { @@ -137051,7 +137987,7 @@ var ts; return false; } function isVariableDeclarationListButNotTypeArgument(node) { - return node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */ + return node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */ && !ts.isPossiblyTypeArgumentPosition(node, sourceFile, typeChecker); } /** @@ -137069,13 +138005,13 @@ var ts; for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 296 /* SyntaxKind.PropertyAssignment */ && - m.kind !== 297 /* SyntaxKind.ShorthandPropertyAssignment */ && - m.kind !== 203 /* SyntaxKind.BindingElement */ && - m.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - m.kind !== 172 /* SyntaxKind.GetAccessor */ && - m.kind !== 173 /* SyntaxKind.SetAccessor */ && - m.kind !== 298 /* SyntaxKind.SpreadAssignment */) { + if (m.kind !== 299 /* SyntaxKind.PropertyAssignment */ && + m.kind !== 300 /* SyntaxKind.ShorthandPropertyAssignment */ && + m.kind !== 205 /* SyntaxKind.BindingElement */ && + m.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + m.kind !== 174 /* SyntaxKind.GetAccessor */ && + m.kind !== 175 /* SyntaxKind.SetAccessor */ && + m.kind !== 301 /* SyntaxKind.SpreadAssignment */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -137166,10 +138102,10 @@ var ts; for (var _i = 0, existingMembers_2 = existingMembers; _i < existingMembers_2.length; _i++) { var m = existingMembers_2[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && - m.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - m.kind !== 172 /* SyntaxKind.GetAccessor */ && - m.kind !== 173 /* SyntaxKind.SetAccessor */) { + if (m.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && + m.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + m.kind !== 174 /* SyntaxKind.GetAccessor */ && + m.kind !== 175 /* SyntaxKind.SetAccessor */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -137211,7 +138147,7 @@ var ts; if (isCurrentlyEditingNode(attr)) { continue; } - if (attr.kind === 285 /* SyntaxKind.JsxAttribute */) { + if (attr.kind === 288 /* SyntaxKind.JsxAttribute */) { seenNames.add(attr.name.escapedText); } else if (ts.isJsxSpreadAttribute(attr)) { @@ -137309,7 +138245,7 @@ var ts; var _keywordCompletions = []; var allKeywordsCompletions = ts.memoize(function () { var res = []; - for (var i = 81 /* SyntaxKind.FirstKeyword */; i <= 160 /* SyntaxKind.LastKeyword */; i++) { + for (var i = 81 /* SyntaxKind.FirstKeyword */; i <= 162 /* SyntaxKind.LastKeyword */; i++) { res.push({ name: ts.tokenToString(i), kind: "keyword" /* ScriptElementKind.keyword */, @@ -137335,12 +138271,12 @@ var ts; return false; case 1 /* KeywordCompletionFilters.All */: return isFunctionLikeBodyKeyword(kind) - || kind === 135 /* SyntaxKind.DeclareKeyword */ - || kind === 141 /* SyntaxKind.ModuleKeyword */ - || kind === 152 /* SyntaxKind.TypeKeyword */ - || kind === 142 /* SyntaxKind.NamespaceKeyword */ + || kind === 136 /* SyntaxKind.DeclareKeyword */ + || kind === 142 /* SyntaxKind.ModuleKeyword */ + || kind === 154 /* SyntaxKind.TypeKeyword */ + || kind === 143 /* SyntaxKind.NamespaceKeyword */ || kind === 126 /* SyntaxKind.AbstractKeyword */ - || ts.isTypeKeyword(kind) && kind !== 153 /* SyntaxKind.UndefinedKeyword */; + || ts.isTypeKeyword(kind) && kind !== 155 /* SyntaxKind.UndefinedKeyword */; case 5 /* KeywordCompletionFilters.FunctionLikeBodyKeywords */: return isFunctionLikeBodyKeyword(kind); case 2 /* KeywordCompletionFilters.ClassElementKeywords */: @@ -137354,7 +138290,7 @@ var ts; case 7 /* KeywordCompletionFilters.TypeKeywords */: return ts.isTypeKeyword(kind); case 8 /* KeywordCompletionFilters.TypeKeyword */: - return kind === 152 /* SyntaxKind.TypeKeyword */; + return kind === 154 /* SyntaxKind.TypeKeyword */; default: return ts.Debug.assertNever(keywordFilter); } @@ -137363,59 +138299,61 @@ var ts; function isTypeScriptOnlyKeyword(kind) { switch (kind) { case 126 /* SyntaxKind.AbstractKeyword */: - case 130 /* SyntaxKind.AnyKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 92 /* SyntaxKind.EnumKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: case 117 /* SyntaxKind.ImplementsKeyword */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 139 /* SyntaxKind.IsKeyword */: - case 140 /* SyntaxKind.KeyOfKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 140 /* SyntaxKind.IsKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: return true; default: return false; } } function isInterfaceOrTypeLiteralCompletionKeyword(kind) { - return kind === 145 /* SyntaxKind.ReadonlyKeyword */; + return kind === 146 /* SyntaxKind.ReadonlyKeyword */; } function isClassMemberCompletionKeyword(kind) { switch (kind) { case 126 /* SyntaxKind.AbstractKeyword */: - case 134 /* SyntaxKind.ConstructorKeyword */: - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: return true; default: return ts.isClassMemberModifier(kind); } } function isFunctionLikeBodyKeyword(kind) { - return kind === 131 /* SyntaxKind.AsyncKeyword */ - || kind === 132 /* SyntaxKind.AwaitKeyword */ - || kind === 127 /* SyntaxKind.AsKeyword */ - || kind === 152 /* SyntaxKind.TypeKeyword */ + return kind === 132 /* SyntaxKind.AsyncKeyword */ + || kind === 133 /* SyntaxKind.AwaitKeyword */ + || kind === 128 /* SyntaxKind.AsKeyword */ + || kind === 150 /* SyntaxKind.SatisfiesKeyword */ + || kind === 154 /* SyntaxKind.TypeKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind); } function keywordForNode(node) { @@ -137440,7 +138378,7 @@ var ts; && contextToken === parent.moduleSpecifier && tokenLine === currentLine) { entries.push({ - name: ts.tokenToString(129 /* SyntaxKind.AssertKeyword */), + name: ts.tokenToString(130 /* SyntaxKind.AssertKeyword */), kind: "keyword" /* ScriptElementKind.keyword */, kindModifiers: "" /* ScriptElementKindModifier.none */, sortText: Completions.SortText.GlobalsOrKeywords, @@ -137506,7 +138444,7 @@ var ts; function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location, position) { // class c { method() { } | method2() { } } switch (location.kind) { - case 348 /* SyntaxKind.SyntaxList */: + case 351 /* SyntaxKind.SyntaxList */: return ts.tryCast(location.parent, ts.isObjectTypeDeclaration); case 1 /* SyntaxKind.EndOfFileToken */: var cls = ts.tryCast(ts.lastOrUndefined(ts.cast(location.parent, ts.isSourceFile).statements), ts.isObjectTypeDeclaration); @@ -137532,7 +138470,7 @@ var ts; if (!contextToken) return undefined; // class C { blah; constructor/**/ } and so on - if (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ + if (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ // class C { blah \n constructor/**/ } || (ts.isIdentifier(contextToken) && ts.isPropertyDeclaration(contextToken.parent) && ts.isClassLike(location))) { return ts.findAncestor(contextToken, ts.isClassLike); @@ -137575,7 +138513,7 @@ var ts; case 26 /* SyntaxKind.SemicolonToken */: case 27 /* SyntaxKind.CommaToken */: case 79 /* SyntaxKind.Identifier */: - if (parent.kind === 166 /* SyntaxKind.PropertySignature */ && ts.isTypeLiteralNode(parent.parent)) { + if (parent.kind === 168 /* SyntaxKind.PropertySignature */ && ts.isTypeLiteralNode(parent.parent)) { return parent.parent; } break; @@ -137592,11 +138530,11 @@ var ts; if (!t) return undefined; switch (node.kind) { - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return checker.getTypeOfPropertyOfContextualType(t, node.symbol.escapedName); - case 188 /* SyntaxKind.IntersectionType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 187 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 189 /* SyntaxKind.UnionType */: return t; } } @@ -137624,7 +138562,7 @@ var ts; ? !!ts.tryGetImportFromModuleSpecifier(contextToken) : contextToken.kind === 43 /* SyntaxKind.SlashToken */ && ts.isJsxClosingElement(contextToken.parent)); case " ": - return !!contextToken && ts.isImportKeyword(contextToken) && contextToken.parent.kind === 305 /* SyntaxKind.SourceFile */; + return !!contextToken && ts.isImportKeyword(contextToken) && contextToken.parent.kind === 308 /* SyntaxKind.SourceFile */; default: return ts.Debug.assertNever(triggerCharacter); } @@ -137671,21 +138609,22 @@ var ts; return undefined; } function getImportStatementCompletionInfo(contextToken) { + var _a, _b, _c; var keywordCompletion; var isKeywordOnlyCompletion = false; var candidate = getCandidate(); return { isKeywordOnlyCompletion: isKeywordOnlyCompletion, keywordCompletion: keywordCompletion, - isNewIdentifierLocation: !!(candidate || keywordCompletion === 152 /* SyntaxKind.TypeKeyword */), - replacementNode: candidate && ts.rangeIsOnSingleLine(candidate, candidate.getSourceFile()) - ? candidate - : undefined + isNewIdentifierLocation: !!(candidate || keywordCompletion === 154 /* SyntaxKind.TypeKeyword */), + isTopLevelTypeOnly: !!((_b = (_a = ts.tryCast(candidate, ts.isImportDeclaration)) === null || _a === void 0 ? void 0 : _a.importClause) === null || _b === void 0 ? void 0 : _b.isTypeOnly) || !!((_c = ts.tryCast(candidate, ts.isImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.isTypeOnly), + couldBeTypeOnlyImportSpecifier: !!candidate && couldBeTypeOnlyImportSpecifier(candidate, contextToken), + replacementSpan: getSingleLineReplacementSpanForImportCompletionNode(candidate), }; function getCandidate() { var parent = contextToken.parent; if (ts.isImportEqualsDeclaration(parent)) { - keywordCompletion = contextToken.kind === 152 /* SyntaxKind.TypeKeyword */ ? undefined : 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = contextToken.kind === 154 /* SyntaxKind.TypeKeyword */ ? undefined : 154 /* SyntaxKind.TypeKeyword */; return isModuleSpecifierMissingOrEmpty(parent.moduleReference) ? parent : undefined; } if (couldBeTypeOnlyImportSpecifier(parent, contextToken) && canCompleteFromNamedBindings(parent.parent)) { @@ -137695,13 +138634,13 @@ var ts; if (!parent.parent.isTypeOnly && (contextToken.kind === 18 /* SyntaxKind.OpenBraceToken */ || contextToken.kind === 100 /* SyntaxKind.ImportKeyword */ || contextToken.kind === 27 /* SyntaxKind.CommaToken */)) { - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; } if (canCompleteFromNamedBindings(parent)) { // At `import { ... } |` or `import * as Foo |`, the only possible completion is `from` if (contextToken.kind === 19 /* SyntaxKind.CloseBraceToken */ || contextToken.kind === 79 /* SyntaxKind.Identifier */) { isKeywordOnlyCompletion = true; - keywordCompletion = 156 /* SyntaxKind.FromKeyword */; + keywordCompletion = 158 /* SyntaxKind.FromKeyword */; } else { return parent.parent.parent; @@ -137711,25 +138650,82 @@ var ts; } if (ts.isImportKeyword(contextToken) && ts.isSourceFile(parent)) { // A lone import keyword with nothing following it does not parse as a statement at all - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; return contextToken; } if (ts.isImportKeyword(contextToken) && ts.isImportDeclaration(parent)) { // `import s| from` - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; return isModuleSpecifierMissingOrEmpty(parent.moduleSpecifier) ? parent : undefined; } return undefined; } } + function getSingleLineReplacementSpanForImportCompletionNode(node) { + var _a, _b, _c; + if (!node) + return undefined; + var top = (_a = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration))) !== null && _a !== void 0 ? _a : node; + var sourceFile = top.getSourceFile(); + if (ts.rangeIsOnSingleLine(top, sourceFile)) { + return ts.createTextSpanFromNode(top, sourceFile); + } + // ImportKeyword was necessarily on one line; ImportSpecifier was necessarily parented in an ImportDeclaration + ts.Debug.assert(top.kind !== 100 /* SyntaxKind.ImportKeyword */ && top.kind !== 273 /* SyntaxKind.ImportSpecifier */); + // Guess which point in the import might actually be a later statement parsed as part of the import + // during parser recovery - either in the middle of named imports, or the module specifier. + var potentialSplitPoint = top.kind === 269 /* SyntaxKind.ImportDeclaration */ + ? (_c = getPotentiallyInvalidImportSpecifier((_b = top.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings)) !== null && _c !== void 0 ? _c : top.moduleSpecifier + : top.moduleReference; + var withoutModuleSpecifier = { + pos: top.getFirstToken().getStart(), + end: potentialSplitPoint.pos, + }; + // The module specifier/reference was previously found to be missing, empty, or + // not a string literal - in this last case, it's likely that statement on a following + // line was parsed as the module specifier of a partially-typed import, e.g. + // import Foo| + // interface Blah {} + // This appears to be a multiline-import, and editors can't replace multiple lines. + // But if everything but the "module specifier" is on one line, by this point we can + // assume that the "module specifier" is actually just another statement, and return + // the single-line range of the import excluding that probable statement. + if (ts.rangeIsOnSingleLine(withoutModuleSpecifier, sourceFile)) { + return ts.createTextSpanFromRange(withoutModuleSpecifier); + } + } + // Tries to identify the first named import that is not really a named import, but rather + // just parser recovery for a situation like: + // import { Foo| + // interface Bar {} + // in which `Foo`, `interface`, and `Bar` are all parsed as import specifiers. The caller + // will also check if this token is on a separate line from the rest of the import. + function getPotentiallyInvalidImportSpecifier(namedBindings) { + var _a; + return ts.find((_a = ts.tryCast(namedBindings, ts.isNamedImports)) === null || _a === void 0 ? void 0 : _a.elements, function (e) { + var _a; + return !e.propertyName && + ts.isStringANonContextualKeyword(e.name.text) && + ((_a = ts.findPrecedingToken(e.name.pos, namedBindings.getSourceFile(), namedBindings)) === null || _a === void 0 ? void 0 : _a.kind) !== 27 /* SyntaxKind.CommaToken */; + }); + } function couldBeTypeOnlyImportSpecifier(importSpecifier, contextToken) { return ts.isImportSpecifier(importSpecifier) && (importSpecifier.isTypeOnly || contextToken === importSpecifier.name && ts.isTypeKeywordTokenOrIdentifier(contextToken)); } function canCompleteFromNamedBindings(namedBindings) { - return isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) - && (ts.isNamespaceImport(namedBindings) || namedBindings.elements.length < 2) - && !namedBindings.parent.name; + if (!isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) || namedBindings.parent.name) { + return false; + } + if (ts.isNamedImports(namedBindings)) { + // We can only complete on named imports if there are no other named imports already, + // but parser recovery sometimes puts later statements in the named imports list, so + // we try to only consider the probably-valid ones. + var invalidNamedImport = getPotentiallyInvalidImportSpecifier(namedBindings); + var validImports = invalidNamedImport ? namedBindings.elements.indexOf(invalidNamedImport) : namedBindings.elements.length; + return validImports < 2; + } + return true; } function isModuleSpecifierMissingOrEmpty(specifier) { var _a; @@ -137748,7 +138744,6 @@ var ts; function isArrowFunctionBody(node) { return node.parent && ts.isArrowFunction(node.parent) && node.parent.body === node; } - ; /** True if symbol is a type or a module containing at least one type. */ function symbolCanBeReferencedAtTypeLocation(symbol, checker, seenModules) { if (seenModules === void 0) { seenModules = new ts.Map(); } @@ -137897,14 +138892,14 @@ var ts; case 115 /* SyntaxKind.WhileKeyword */: case 90 /* SyntaxKind.DoKeyword */: return useParent(node.parent, function (n) { return ts.isIterationStatement(n, /*lookInLabeledStatements*/ true); }, getLoopBreakContinueOccurrences); - case 134 /* SyntaxKind.ConstructorKeyword */: - return getFromAllDeclarations(ts.isConstructorDeclaration, [134 /* SyntaxKind.ConstructorKeyword */]); - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - return getFromAllDeclarations(ts.isAccessor, [136 /* SyntaxKind.GetKeyword */, 149 /* SyntaxKind.SetKeyword */]); - case 132 /* SyntaxKind.AwaitKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: + return getFromAllDeclarations(ts.isConstructorDeclaration, [135 /* SyntaxKind.ConstructorKeyword */]); + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + return getFromAllDeclarations(ts.isAccessor, [137 /* SyntaxKind.GetKeyword */, 151 /* SyntaxKind.SetKeyword */]); + case 133 /* SyntaxKind.AwaitKeyword */: return useParent(node.parent, ts.isAwaitExpression, getAsyncAndAwaitOccurrences); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: return highlightSpans(getAsyncAndAwaitOccurrences(node)); case 125 /* SyntaxKind.YieldKeyword */: return highlightSpans(getYieldOccurrences(node)); @@ -137951,7 +138946,7 @@ var ts; var child = throwStatement; while (child.parent) { var parent = child.parent; - if (ts.isFunctionBlock(parent) || parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (ts.isFunctionBlock(parent) || parent.kind === 308 /* SyntaxKind.SourceFile */) { return parent; } // A throw-statement is only owned by a try-statement if the try-statement has @@ -137983,16 +138978,16 @@ var ts; function getBreakOrContinueOwner(statement) { return ts.findAncestor(statement, function (node) { switch (node.kind) { - case 249 /* SyntaxKind.SwitchStatement */: - if (statement.kind === 245 /* SyntaxKind.ContinueStatement */) { + case 252 /* SyntaxKind.SwitchStatement */: + if (statement.kind === 248 /* SyntaxKind.ContinueStatement */) { return false; } // falls through - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: return !statement.label || isLabeledBy(node, statement.label.escapedText); default: // Don't cross function boundaries. @@ -138008,26 +139003,26 @@ var ts; // Types of node whose children might have modifiers. var container = declaration.parent; switch (container.kind) { - case 262 /* SyntaxKind.ModuleBlock */: - case 305 /* SyntaxKind.SourceFile */: - case 235 /* SyntaxKind.Block */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 265 /* SyntaxKind.ModuleBlock */: + case 308 /* SyntaxKind.SourceFile */: + case 238 /* SyntaxKind.Block */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // Container is either a class declaration or the declaration is a classDeclaration - if (modifierFlag & 128 /* ModifierFlags.Abstract */ && ts.isClassDeclaration(declaration)) { + if (modifierFlag & 256 /* ModifierFlags.Abstract */ && ts.isClassDeclaration(declaration)) { return __spreadArray(__spreadArray([], declaration.members, true), [declaration], false); } else { return container.statements; } - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return __spreadArray(__spreadArray([], container.parameters, true), (ts.isClassLike(container.parent) ? container.parent.members : []), true); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: var nodes = container.members; // If we're an accessibility modifier, we're in an instance member and should search // the constructor's parameter list for instance members as well. @@ -138037,12 +139032,12 @@ var ts; return __spreadArray(__spreadArray([], nodes, true), constructor.parameters, true); } } - else if (modifierFlag & 128 /* ModifierFlags.Abstract */) { + else if (modifierFlag & 256 /* ModifierFlags.Abstract */) { return __spreadArray(__spreadArray([], nodes, true), [container], false); } return nodes; // Syntactically invalid positions that the parser might produce anyway - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return undefined; default: ts.Debug.assertNever(container, "Invalid container kind."); @@ -138063,7 +139058,7 @@ var ts; var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 97 /* SyntaxKind.ForKeyword */, 115 /* SyntaxKind.WhileKeyword */, 90 /* SyntaxKind.DoKeyword */)) { // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 240 /* SyntaxKind.DoStatement */) { + if (loopNode.kind === 243 /* SyntaxKind.DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 115 /* SyntaxKind.WhileKeyword */)) { @@ -138083,13 +139078,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -138162,13 +139157,13 @@ var ts; var keywords = []; if (func.modifiers) { func.modifiers.forEach(function (modifier) { - pushKeywordIf(keywords, modifier, 131 /* SyntaxKind.AsyncKeyword */); + pushKeywordIf(keywords, modifier, 132 /* SyntaxKind.AsyncKeyword */); }); } ts.forEachChild(func, function (child) { traverseWithoutCrossingFunction(child, function (node) { if (ts.isAwaitExpression(node)) { - pushKeywordIf(keywords, node.getFirstToken(), 132 /* SyntaxKind.AwaitKeyword */); + pushKeywordIf(keywords, node.getFirstToken(), 133 /* SyntaxKind.AwaitKeyword */); } }); }); @@ -138552,14 +139547,14 @@ var ts; if (cancellationToken) cancellationToken.throwIfCancellationRequested(); switch (direct.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(direct)) { handleImportCall(direct); break; } if (!isAvailableThroughGlobal) { var parent = direct.parent; - if (exportKind === 2 /* ExportKind.ExportEquals */ && parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (exportKind === 2 /* ExportKind.ExportEquals */ && parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { var name = parent.name; if (name.kind === 79 /* SyntaxKind.Identifier */) { directImports.push(name); @@ -138570,25 +139565,25 @@ var ts; break; case 79 /* SyntaxKind.Identifier */: // for 'const x = require("y"); break; // TODO: GH#23879 - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: handleNamespaceImport(direct, direct.name, ts.hasSyntacticModifier(direct, 1 /* ModifierFlags.Export */), /*alreadyAddedDirect*/ false); break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: directImports.push(direct); var namedBindings = direct.importClause && direct.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings && namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { handleNamespaceImport(direct, namedBindings.name, /*isReExport*/ false, /*alreadyAddedDirect*/ true); } else if (!isAvailableThroughGlobal && ts.isDefaultImport(direct)) { addIndirectUser(getSourceFileLikeForImportDeclaration(direct)); // Add a check for indirect uses to handle synthetic default imports } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (!direct.exportClause) { // This is `export * from "foo"`, so imports of this module may import the export too. handleDirectImports(getContainingModuleSymbol(direct, checker)); } - else if (direct.exportClause.kind === 274 /* SyntaxKind.NamespaceExport */) { + else if (direct.exportClause.kind === 277 /* SyntaxKind.NamespaceExport */) { // `export * as foo from "foo"` add to indirect uses addIndirectUser(getSourceFileLikeForImportDeclaration(direct), /** addTransitiveDependencies */ true); } @@ -138597,7 +139592,7 @@ var ts; directImports.push(direct); } break; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: // Only check for typeof import('xyz') if (direct.isTypeOf && !direct.qualifier && isExported(direct)) { addIndirectUser(direct.getSourceFile(), /** addTransitiveDependencies */ true); @@ -138630,7 +139625,7 @@ var ts; } else if (!isAvailableThroughGlobal) { var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration); - ts.Debug.assert(sourceFileLike.kind === 305 /* SyntaxKind.SourceFile */ || sourceFileLike.kind === 261 /* SyntaxKind.ModuleDeclaration */); + ts.Debug.assert(sourceFileLike.kind === 308 /* SyntaxKind.SourceFile */ || sourceFileLike.kind === 264 /* SyntaxKind.ModuleDeclaration */); if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) { addIndirectUser(sourceFileLike, /** addTransitiveDependencies */ true); } @@ -138686,7 +139681,7 @@ var ts; } return { importSearches: importSearches, singleReferences: singleReferences }; function handleImport(decl) { - if (decl.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (decl.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { if (isExternalModuleImportEquals(decl)) { handleNamespaceImportLike(decl.name); } @@ -138696,7 +139691,7 @@ var ts; handleNamespaceImportLike(decl); return; } - if (decl.kind === 200 /* SyntaxKind.ImportType */) { + if (decl.kind === 202 /* SyntaxKind.ImportType */) { if (decl.qualifier) { var firstIdentifier = ts.getFirstIdentifier(decl.qualifier); if (firstIdentifier.escapedText === ts.symbolName(exportSymbol)) { @@ -138712,7 +139707,7 @@ var ts; if (decl.moduleSpecifier.kind !== 10 /* SyntaxKind.StringLiteral */) { return; } - if (decl.kind === 272 /* SyntaxKind.ExportDeclaration */) { + if (decl.kind === 275 /* SyntaxKind.ExportDeclaration */) { if (decl.exportClause && ts.isNamedExports(decl.exportClause)) { searchForNamedImport(decl.exportClause); } @@ -138721,10 +139716,10 @@ var ts; var _a = decl.importClause || { name: undefined, namedBindings: undefined }, name = _a.name, namedBindings = _a.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: handleNamespaceImportLike(namedBindings.name); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: // 'default' might be accessed as a named import `{ default as foo }`. if (exportKind === 0 /* ExportKind.Named */ || exportKind === 1 /* ExportKind.Default */) { searchForNamedImport(namedBindings); @@ -138774,7 +139769,7 @@ var ts; } } else { - var localSymbol = element.kind === 275 /* SyntaxKind.ExportSpecifier */ && element.propertyName + var localSymbol = element.kind === 278 /* SyntaxKind.ExportSpecifier */ && element.propertyName ? checker.getExportSpecifierLocalTargetSymbol(element) // For re-exporting under a different name, we want to get the re-exported symbol. : checker.getSymbolAtLocation(name); addSearch(name, localSymbol); @@ -138803,7 +139798,7 @@ var ts; for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { var referencingFile = sourceFiles_1[_i]; var searchSourceFile = searchModuleSymbol.valueDeclaration; - if ((searchSourceFile === null || searchSourceFile === void 0 ? void 0 : searchSourceFile.kind) === 305 /* SyntaxKind.SourceFile */) { + if ((searchSourceFile === null || searchSourceFile === void 0 ? void 0 : searchSourceFile.kind) === 308 /* SyntaxKind.SourceFile */) { for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) { var ref = _b[_a]; if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) { @@ -138851,7 +139846,7 @@ var ts; } /** Iterates over all statements at the top level or in module declarations. Returns the first truthy result. */ function forEachPossibleImportOrExportStatement(sourceFileLike, action) { - return ts.forEach(sourceFileLike.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { + return ts.forEach(sourceFileLike.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { return action(statement) || (isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action)); }); } @@ -138866,15 +139861,15 @@ var ts; else { forEachPossibleImportOrExportStatement(sourceFile, function (statement) { switch (statement.kind) { - case 272 /* SyntaxKind.ExportDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: { + case 275 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: { var decl = statement; if (decl.moduleSpecifier && ts.isStringLiteral(decl.moduleSpecifier)) { action(decl, decl.moduleSpecifier); } break; } - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { var decl = statement; if (isExternalModuleImportEquals(decl)) { action(decl, decl.moduleReference.expression); @@ -138899,7 +139894,7 @@ var ts; var parent = node.parent; var grandparent = parent.parent; if (symbol.exportSymbol) { - if (parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { // When accessing an export of a JS module, there's no alias. The symbol will still be flagged as an export even though we're at the use. // So check that we are at the declaration. return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d === parent; })) && ts.isBinaryExpression(grandparent) @@ -138983,6 +139978,8 @@ var ts; // Similarly, skip past the symbol for 'export =' if (importedSymbol.escapedName === "export=") { importedSymbol = getExportEqualsLocalSymbol(importedSymbol, checker); + if (importedSymbol === undefined) + return undefined; } // If the import has a different name than the export, do not continue searching. // If `importedName` is undefined, do continue searching as the export is anonymous. @@ -138998,25 +139995,25 @@ var ts; } // Not meant for use with export specifiers or export assignment. function getExportKindForDeclaration(node) { - return ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) ? 1 /* ExportKind.Default */ : 0 /* ExportKind.Named */; + return ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) ? 1 /* ExportKind.Default */ : 0 /* ExportKind.Named */; } } FindAllReferences.getImportOrExportSymbol = getImportOrExportSymbol; function getExportEqualsLocalSymbol(importedSymbol, checker) { if (importedSymbol.flags & 2097152 /* SymbolFlags.Alias */) { - return ts.Debug.checkDefined(checker.getImmediateAliasedSymbol(importedSymbol)); + return checker.getImmediateAliasedSymbol(importedSymbol); } var decl = ts.Debug.checkDefined(importedSymbol.valueDeclaration); if (ts.isExportAssignment(decl)) { // `export = class {}` - return ts.Debug.checkDefined(decl.expression.symbol); + return decl.expression.symbol; } else if (ts.isBinaryExpression(decl)) { // `module.exports = class {}` - return ts.Debug.checkDefined(decl.right.symbol); + return decl.right.symbol; } else if (ts.isSourceFile(decl)) { // json module - return ts.Debug.checkDefined(decl.symbol); + return decl.symbol; } - return ts.Debug.fail(); + return undefined; } // If a reference is a class expression, the exported node would be its parent. // If a reference is a variable declaration, the exported node would be the variable statement. @@ -139033,16 +140030,16 @@ var ts; function isNodeImport(node) { var parent = node.parent; switch (parent.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return parent.name === node && isExternalModuleImportEquals(parent); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: // For a rename import `{ foo as bar }`, don't search for the imported symbol. Just find local uses of `bar`. return !parent.propertyName; - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: ts.Debug.assert(parent.name === node); return true; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(parent.parent.parent); default: return false; @@ -139083,21 +140080,21 @@ var ts; return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol); } function getSourceFileLikeForImportDeclaration(node) { - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { return node.getSourceFile(); } var parent = node.parent; - if (parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */) { return parent; } - ts.Debug.assert(parent.kind === 262 /* SyntaxKind.ModuleBlock */); + ts.Debug.assert(parent.kind === 265 /* SyntaxKind.ModuleBlock */); return ts.cast(parent.parent, isAmbientModuleDeclaration); } function isAmbientModuleDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && node.name.kind === 10 /* SyntaxKind.StringLiteral */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && node.name.kind === 10 /* SyntaxKind.StringLiteral */; } function isExternalModuleImportEquals(eq) { - return eq.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* SyntaxKind.StringLiteral */; + return eq.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* SyntaxKind.StringLiteral */; } })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); @@ -139191,7 +140188,7 @@ var ts; ((ts.isImportOrExportSpecifier(node.parent) || ts.isBindingElement(node.parent)) && node.parent.propertyName === node) || // Is default export - (node.kind === 88 /* SyntaxKind.DefaultKeyword */ && ts.hasSyntacticModifier(node.parent, 513 /* ModifierFlags.ExportDefault */))) { + (node.kind === 88 /* SyntaxKind.DefaultKeyword */ && ts.hasSyntacticModifier(node.parent, 1025 /* ModifierFlags.ExportDefault */))) { return getContextNode(node.parent); } return undefined; @@ -139200,7 +140197,7 @@ var ts; if (!node) return undefined; switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return !ts.isVariableDeclarationList(node.parent) || node.parent.declarations.length !== 1 ? node : ts.isVariableStatement(node.parent.parent) ? @@ -139208,28 +140205,28 @@ var ts; ts.isForInOrOfStatement(node.parent.parent) ? getContextNode(node.parent.parent) : node.parent; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getContextNode(node.parent.parent); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent; - case 275 /* SyntaxKind.ExportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent; - case 267 /* SyntaxKind.ImportClause */: - case 274 /* SyntaxKind.NamespaceExport */: + case 270 /* SyntaxKind.ImportClause */: + case 277 /* SyntaxKind.NamespaceExport */: return node.parent; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return ts.isExpressionStatement(node.parent) ? node.parent : node; - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return { start: node.initializer, end: node.expression }; - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent) ? getContextNode(ts.findAncestor(node.parent, function (node) { return ts.isBinaryExpression(node) || ts.isForInOrOfStatement(node); @@ -139290,15 +140287,15 @@ var ts; return node.kind === 88 /* SyntaxKind.DefaultKeyword */ || !!ts.getDeclarationFromName(node) || ts.isLiteralComputedPropertyDeclarationName(node) - || (node.kind === 134 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent)); + || (node.kind === 135 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent)); } function getImplementationsAtPosition(program, cancellationToken, sourceFiles, sourceFile, position) { var node = ts.getTouchingPropertyName(sourceFile, position); var referenceEntries; var entries = getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position); - if (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || node.parent.kind === 203 /* SyntaxKind.BindingElement */ - || node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ + if (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || node.parent.kind === 205 /* SyntaxKind.BindingElement */ + || node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ || node.kind === 106 /* SyntaxKind.SuperKeyword */) { referenceEntries = entries && __spreadArray([], entries, true); } @@ -139322,13 +140319,13 @@ var ts; } FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition; function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return undefined; } var checker = program.getTypeChecker(); // If invoked directly on a shorthand property assignment, then return // the declaration of the symbol being assigned (not the symbol being assigned to). - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var result_2 = []; Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_2.push(nodeEntry(node)); }); return result_2; @@ -139504,13 +140501,13 @@ var ts; if (symbol) { return getDefinitionKindAndDisplayParts(symbol, checker, node); } - else if (node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + else if (node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return { kind: "interface" /* ScriptElementKind.interfaceElement */, displayParts: [ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */), ts.textPart("object literal"), ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)] }; } - else if (node.kind === 226 /* SyntaxKind.ClassExpression */) { + else if (node.kind === 228 /* SyntaxKind.ClassExpression */) { return { kind: "local class" /* ScriptElementKind.localClassElement */, displayParts: [ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */), ts.textPart("anonymous local class"), ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)] @@ -139564,7 +140561,7 @@ var ts; var source = ts.getDeclarationFromName(node) || (node.kind === 88 /* SyntaxKind.DefaultKeyword */ ? node.parent : ts.isLiteralComputedPropertyDeclarationName(node) ? node.parent.parent - : node.kind === 134 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent) ? node.parent.parent + : node.kind === 135 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent) ? node.parent.parent : undefined); var commonjsSource = source && ts.isBinaryExpression(source) ? source.left : undefined; return !!(source && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d === source || d === commonjsSource; }))); @@ -139579,47 +140576,47 @@ var ts; if (!!(decl.flags & 16777216 /* NodeFlags.Ambient */)) return true; switch (decl.kind) { - case 221 /* SyntaxKind.BinaryExpression */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: case 88 /* SyntaxKind.DefaultKeyword */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: // default import - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 285 /* SyntaxKind.JsxAttribute */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 274 /* SyntaxKind.NamespaceExport */: - case 164 /* SyntaxKind.Parameter */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 163 /* SyntaxKind.TypeParameter */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: // default import + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 288 /* SyntaxKind.JsxAttribute */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 277 /* SyntaxKind.NamespaceExport */: + case 166 /* SyntaxKind.Parameter */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: return true; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // In `({ x: y } = 0);`, `x` is not a write access. (Won't call this function for `y`.) return !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(decl.parent); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return !!decl.body; - case 254 /* SyntaxKind.VariableDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return !!decl.initializer || ts.isCatchClause(decl.parent); - case 168 /* SyntaxKind.MethodSignature */: - case 166 /* SyntaxKind.PropertySignature */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: + case 170 /* SyntaxKind.MethodSignature */: + case 168 /* SyntaxKind.PropertySignature */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return false; default: return ts.Debug.failBadSyntaxKind(decl); @@ -139845,10 +140842,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; switch (decl.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // Don't include the source file itself. (This may not be ideal behavior, but awkward to include an entire file as a reference.) break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (sourceFilesSet.has(decl.getSourceFile().fileName)) { references.push(nodeEntry(decl.name)); } @@ -139877,9 +140874,9 @@ var ts; } /** As in a `readonly prop: any` or `constructor(readonly prop: any)`, not a `readonly any[]`. */ function isReadonlyTypeOperator(node) { - return node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ + return node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(node.parent) - && node.parent.operator === 145 /* SyntaxKind.ReadonlyKeyword */; + && node.parent.operator === 146 /* SyntaxKind.ReadonlyKeyword */; } /** getReferencedSymbols for special node kinds. */ function getReferencedSymbolsSpecial(node, sourceFiles, cancellationToken) { @@ -139890,12 +140887,12 @@ var ts; } // A modifier readonly (like on a property declaration) is not special; // a readonly type keyword (like `readonly string[]`) is. - if (node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ && !isReadonlyTypeOperator(node)) { + if (node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && !isReadonlyTypeOperator(node)) { return undefined; } // Likewise, when we *are* looking for a special keyword, make sure we // *don’t* include readonly member modifiers. - return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken, node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ ? isReadonlyTypeOperator : undefined); + return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken, node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ ? isReadonlyTypeOperator : undefined); } if (ts.isImportMeta(node.parent) && node.parent.name === node) { return getAllReferencesForImportMeta(sourceFiles, cancellationToken); @@ -139962,8 +140959,8 @@ var ts; } function getSpecialSearchKind(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 134 /* SyntaxKind.ConstructorKeyword */: + case 173 /* SyntaxKind.Constructor */: + case 135 /* SyntaxKind.ConstructorKeyword */: return 1 /* SpecialSearchKind.Constructor */; case 79 /* SyntaxKind.Identifier */: if (ts.isClassLike(node.parent)) { @@ -140211,7 +141208,7 @@ var ts; // If this is the symbol of a named function expression or named class expression, // then named references are limited to its own scope. var declarations = symbol.declarations, flags = symbol.flags, parent = symbol.parent, valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 213 /* SyntaxKind.FunctionExpression */ || valueDeclaration.kind === 226 /* SyntaxKind.ClassExpression */)) { + if (valueDeclaration && (valueDeclaration.kind === 215 /* SyntaxKind.FunctionExpression */ || valueDeclaration.kind === 228 /* SyntaxKind.ClassExpression */)) { return valueDeclaration; } if (!declarations) { @@ -140221,7 +141218,7 @@ var ts; if (flags & (4 /* SymbolFlags.Property */ | 8192 /* SymbolFlags.Method */)) { var privateDeclaration = ts.find(declarations, function (d) { return ts.hasEffectiveModifier(d, 8 /* ModifierFlags.Private */) || ts.isPrivateIdentifierClassElementDeclaration(d); }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 257 /* SyntaxKind.ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 260 /* SyntaxKind.ClassDeclaration */); } // Else this is a public property and could be accessed from anywhere. return undefined; @@ -140250,7 +141247,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (!container || container.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { + if (!container || container.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { // This is a global variable and not an external module, any declaration defined // within this scope is visible outside the file return undefined; @@ -140508,7 +141505,7 @@ var ts; } // Use the parent symbol if the location is commonjs require syntax on javascript files only. if (ts.isInJSFile(referenceLocation) - && referenceLocation.parent.kind === 203 /* SyntaxKind.BindingElement */ + && referenceLocation.parent.kind === 205 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(referenceLocation.parent.parent.parent)) { referenceSymbol = referenceLocation.parent.symbol; // The parent will not have a symbol if it's an ObjectBindingPattern (when destructuring is used). In @@ -140615,7 +141612,7 @@ var ts; } } function addReference(referenceLocation, relatedSymbol, state) { - var _a = "kind" in relatedSymbol ? relatedSymbol : { kind: undefined, symbol: relatedSymbol }, kind = _a.kind, symbol = _a.symbol; // eslint-disable-line no-in-operator + var _a = "kind" in relatedSymbol ? relatedSymbol : { kind: undefined, symbol: relatedSymbol }, kind = _a.kind, symbol = _a.symbol; // eslint-disable-line local/no-in-operator // if rename symbol from default export anonymous function, for example `export default function() {}`, we do not need to add reference if (state.options.use === 2 /* FindReferencesUse.Rename */ && referenceLocation.kind === 88 /* SyntaxKind.DefaultKeyword */) { return; @@ -140681,15 +141678,15 @@ var ts; if (constructorSymbol && constructorSymbol.declarations) { for (var _i = 0, _a = constructorSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - var ctrKeyword = ts.findChildOfKind(decl, 134 /* SyntaxKind.ConstructorKeyword */, sourceFile); - ts.Debug.assert(decl.kind === 171 /* SyntaxKind.Constructor */ && !!ctrKeyword); + var ctrKeyword = ts.findChildOfKind(decl, 135 /* SyntaxKind.ConstructorKeyword */, sourceFile); + ts.Debug.assert(decl.kind === 173 /* SyntaxKind.Constructor */ && !!ctrKeyword); addNode(ctrKeyword); } } if (classSymbol.exports) { classSymbol.exports.forEach(function (member) { var decl = member.valueDeclaration; - if (decl && decl.kind === 169 /* SyntaxKind.MethodDeclaration */) { + if (decl && decl.kind === 171 /* SyntaxKind.MethodDeclaration */) { var body = decl.body; if (body) { forEachDescendantOfKind(body, 108 /* SyntaxKind.ThisKeyword */, function (thisKeyword) { @@ -140713,7 +141710,7 @@ var ts; } for (var _i = 0, _a = constructor.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - ts.Debug.assert(decl.kind === 171 /* SyntaxKind.Constructor */); + ts.Debug.assert(decl.kind === 173 /* SyntaxKind.Constructor */); var body = decl.body; if (body) { forEachDescendantOfKind(body, 106 /* SyntaxKind.SuperKeyword */, function (node) { @@ -140743,7 +141740,7 @@ var ts; if (refNode.kind !== 79 /* SyntaxKind.Identifier */) { return; } - if (refNode.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (refNode.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { // Go ahead and dereference the shorthand assignment by going to its definition getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference); } @@ -140763,7 +141760,7 @@ var ts; } else if (ts.isFunctionLike(typeHavingNode) && typeHavingNode.body) { var body = typeHavingNode.body; - if (body.kind === 235 /* SyntaxKind.Block */) { + if (body.kind === 238 /* SyntaxKind.Block */) { ts.forEachReturnStatement(body, function (returnStatement) { if (returnStatement.expression) addIfImplementation(returnStatement.expression); @@ -140791,13 +141788,13 @@ var ts; */ function isImplementationExpression(node) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isImplementationExpression(node.expression); - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return true; default: return false; @@ -140850,13 +141847,13 @@ var ts; // Whether 'super' occurs in a static context within a class. var staticFlag = 32 /* ModifierFlags.Static */; switch (searchSpaceNode.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; @@ -140877,43 +141874,43 @@ var ts; return [{ definition: { type: 0 /* DefinitionKind.Symbol */, symbol: searchSpaceNode.symbol }, references: references }]; } function isParameterName(node) { - return node.kind === 79 /* SyntaxKind.Identifier */ && node.parent.kind === 164 /* SyntaxKind.Parameter */ && node.parent.name === node; + return node.kind === 79 /* SyntaxKind.Identifier */ && node.parent.kind === 166 /* SyntaxKind.Parameter */ && node.parent.name === node; } function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles, cancellationToken) { var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); // Whether 'this' occurs in a static context within a class. var staticFlag = 32 /* ModifierFlags.Static */; switch (searchSpaceNode.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode)) { staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning object literals break; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (ts.isExternalModule(searchSpaceNode) || isParameterName(thisOrSuperKeyword)) { return undefined; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: break; // Computed properties in classes are not handled here because references to this are illegal, // so there is no point finding references to them. default: return undefined; } - var references = ts.flatMap(searchSpaceNode.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) { + var references = ts.flatMap(searchSpaceNode.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) { cancellationToken.throwIfCancellationRequested(); return getPossibleSymbolReferenceNodes(sourceFile, "this", ts.isSourceFile(searchSpaceNode) ? sourceFile : searchSpaceNode).filter(function (node) { if (!ts.isThis(node)) { @@ -140921,20 +141918,20 @@ var ts; } var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); switch (searchSpaceNode.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return searchSpaceNode.symbol === container.symbol; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol; - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: // Make sure the container belongs to the same class/object literals // and has the appropriate static modifier from the original container. return container.parent && searchSpaceNode.symbol === container.parent.symbol && ts.isStatic(container) === !!staticFlag; - case 305 /* SyntaxKind.SourceFile */: - return container.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node); + case 308 /* SyntaxKind.SourceFile */: + return container.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node); } }); }).map(function (n) { return nodeEntry(n); }); @@ -141045,7 +142042,7 @@ var ts; ts.Debug.assert(paramProps.length === 2 && !!(paramProps[0].flags & 1 /* SymbolFlags.FunctionScopedVariable */) && !!(paramProps[1].flags & 4 /* SymbolFlags.Property */)); // is [parameter, property] return fromRoot(symbol.flags & 1 /* SymbolFlags.FunctionScopedVariable */ ? paramProps[1] : paramProps[0]); } - var exportSpecifier = ts.getDeclarationOfKind(symbol, 275 /* SyntaxKind.ExportSpecifier */); + var exportSpecifier = ts.getDeclarationOfKind(symbol, 278 /* SyntaxKind.ExportSpecifier */); if (!isForRenamePopulateSearchSymbolSet || exportSpecifier && !exportSpecifier.propertyName) { var localSymbol = exportSpecifier && checker.getExportSpecifierLocalTargetSymbol(exportSpecifier); if (localSymbol) { @@ -141090,7 +142087,7 @@ var ts; }); } function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker) { - var bindingElement = ts.getDeclarationOfKind(symbol, 203 /* SyntaxKind.BindingElement */); + var bindingElement = ts.getDeclarationOfKind(symbol, 205 /* SyntaxKind.BindingElement */); if (bindingElement && ts.isObjectBindingElementWithoutPropertyName(bindingElement)) { return ts.getPropertySymbolFromBindingElement(checker, bindingElement); } @@ -141353,16 +142350,16 @@ var ts; return; } switch (node.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - if (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + if (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return (_a = ts.getAssignedName(node.parent)) === null || _a === void 0 ? void 0 : _a.getText(); } return (_b = ts.getNameOfDeclaration(node.parent)) === null || _b === void 0 ? void 0 : _b.getText(); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.isModuleBlock(node.parent) && ts.isIdentifier(node.parent.parent.name)) { return node.parent.parent.name.getText(); } @@ -141577,61 +142574,65 @@ var ts; } switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // do not descend into nodes that cannot contain callable nodes return; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: recordCallSite(node); return; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: // do not descend into the type side of an assertion collect(node.expression); return; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: // do not descend into the type of a variable or parameter declaration collect(node.name); collect(node.initializer); return; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: // do not descend into the type arguments of a call expression recordCallSite(node); collect(node.expression); ts.forEach(node.arguments, collect); return; - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: // do not descend into the type arguments of a new expression recordCallSite(node); collect(node.expression); ts.forEach(node.arguments, collect); return; - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // do not descend into the type arguments of a tagged template expression recordCallSite(node); collect(node.tag); collect(node.template); return; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: // do not descend into the type arguments of a JsxOpeningLikeElement recordCallSite(node); collect(node.tagName); collect(node.attributes); return; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: recordCallSite(node); collect(node.expression); return; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: recordCallSite(node); ts.forEachChild(node, collect); break; + case 235 /* SyntaxKind.SatisfiesExpression */: + // do not descend into the type side of an assertion + collect(node.expression); + return; } if (ts.isPartOfTypeNode(node)) { // do not descend into types @@ -141686,25 +142687,25 @@ var ts; var callSites = []; var collect = createCallSiteCollector(program, callSites); switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: collectCallSitesOfSourceFile(node, collect); break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: collectCallSitesOfModuleDeclaration(node, collect); break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: collectCallSitesOfFunctionLikeDeclaration(program.getTypeChecker(), node, collect); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: collectCallSitesOfClassLikeDeclaration(node, collect); break; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: collectCallSitesOfClassStaticBlockDeclaration(node, collect); break; default: @@ -141975,7 +142976,7 @@ var ts; } var parent = node.parent; var typeChecker = program.getTypeChecker(); - if (node.kind === 159 /* SyntaxKind.OverrideKeyword */ || (ts.isJSDocOverrideTag(node) && ts.rangeContainsPosition(node.tagName, position))) { + if (node.kind === 161 /* SyntaxKind.OverrideKeyword */ || (ts.isIdentifier(node) && ts.isJSDocOverrideTag(parent) && parent.tagName === node)) { return getDefinitionFromOverriddenMember(typeChecker, node) || ts.emptyArray; } // Labels @@ -142051,7 +143052,7 @@ var ts; // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var shorthandSymbol_1 = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); var definitions = (shorthandSymbol_1 === null || shorthandSymbol_1 === void 0 ? void 0 : shorthandSymbol_1.declarations) ? shorthandSymbol_1.declarations.map(function (decl) { return createDefinitionInfo(decl, typeChecker, shorthandSymbol_1, node, /*unverified*/ false, failedAliasResolution); }) : ts.emptyArray; return ts.concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node) || ts.emptyArray); @@ -142257,7 +143258,7 @@ var ts; if (node.parent === declaration) { return true; } - if (declaration.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (declaration.kind === 271 /* SyntaxKind.NamespaceImport */) { return false; } return true; @@ -142299,7 +143300,7 @@ var ts; function getConstructSignatureDefinition() { // Applicable only if we are in a new expression, or we are on a constructor declaration // and in either case the symbol has a construct signature definition, i.e. class - if (symbol.flags & 32 /* SymbolFlags.Class */ && !(symbol.flags & (16 /* SymbolFlags.Function */ | 3 /* SymbolFlags.Variable */)) && (ts.isNewExpressionTarget(node) || node.kind === 134 /* SyntaxKind.ConstructorKeyword */)) { + if (symbol.flags & 32 /* SymbolFlags.Class */ && !(symbol.flags & (16 /* SymbolFlags.Function */ | 3 /* SymbolFlags.Variable */)) && (ts.isNewExpressionTarget(node) || node.kind === 135 /* SyntaxKind.ConstructorKeyword */)) { var cls = ts.find(filteredDeclarations, ts.isClassLike) || ts.Debug.fail("Expected declaration to have at least one class-like declaration"); return getSignatureDefinition(cls.members, /*selectConstructors*/ true); } @@ -142351,22 +143352,22 @@ var ts; return isDefinitionVisible(checker, declaration.parent); // Handle some exceptions here like arrow function, members of class and object literal expression which are technically not visible but we want the definition to be determined by its parent switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: // Private/protected properties/methods are not visible if (ts.hasEffectiveModifier(declaration, 8 /* ModifierFlags.Private */)) return false; // Public properties/methods are visible if its parents are visible, so: // falls through - case 171 /* SyntaxKind.Constructor */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: return isDefinitionVisible(checker, declaration.parent); default: return false; @@ -142404,9 +143405,9 @@ var ts; } function isConstructorLike(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 173 /* SyntaxKind.Constructor */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return true; default: return false; @@ -142512,17 +143513,17 @@ var ts; ts.forEachUnique(declarations, function (declaration) { for (var _i = 0, _a = getCommentHavingNodes(declaration); _i < _a.length; _i++) { var jsdoc = _a[_i]; - var inheritDoc = ts.isJSDoc(jsdoc) && jsdoc.tags && ts.find(jsdoc.tags, function (t) { return t.kind === 327 /* SyntaxKind.JSDocTag */ && (t.tagName.escapedText === "inheritDoc" || t.tagName.escapedText === "inheritdoc"); }); + var inheritDoc = ts.isJSDoc(jsdoc) && jsdoc.tags && ts.find(jsdoc.tags, function (t) { return t.kind === 330 /* SyntaxKind.JSDocTag */ && (t.tagName.escapedText === "inheritDoc" || t.tagName.escapedText === "inheritdoc"); }); // skip comments containing @typedefs since they're not associated with particular declarations // Exceptions: // - @typedefs are themselves declarations with associated comments // - @param or @return indicate that the author thinks of it as a 'local' @typedef that's part of the function documentation if (jsdoc.comment === undefined && !inheritDoc || ts.isJSDoc(jsdoc) - && declaration.kind !== 345 /* SyntaxKind.JSDocTypedefTag */ && declaration.kind !== 338 /* SyntaxKind.JSDocCallbackTag */ + && declaration.kind !== 348 /* SyntaxKind.JSDocTypedefTag */ && declaration.kind !== 341 /* SyntaxKind.JSDocCallbackTag */ && jsdoc.tags - && jsdoc.tags.some(function (t) { return t.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 338 /* SyntaxKind.JSDocCallbackTag */; }) - && !jsdoc.tags.some(function (t) { return t.kind === 340 /* SyntaxKind.JSDocParameterTag */ || t.kind === 341 /* SyntaxKind.JSDocReturnTag */; })) { + && jsdoc.tags.some(function (t) { return t.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 341 /* SyntaxKind.JSDocCallbackTag */; }) + && !jsdoc.tags.some(function (t) { return t.kind === 343 /* SyntaxKind.JSDocParameterTag */ || t.kind === 344 /* SyntaxKind.JSDocReturnTag */; })) { continue; } var newparts = jsdoc.comment ? getDisplayPartsFromComment(jsdoc.comment, checker) : []; @@ -142542,11 +143543,11 @@ var ts; } function getCommentHavingNodes(declaration) { switch (declaration.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return [declaration]; - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return [declaration, declaration.parent]; default: return ts.getJSDocCommentsAndTags(declaration); @@ -142560,8 +143561,8 @@ var ts; // skip comments containing @typedefs since they're not associated with particular declarations // Exceptions: // - @param or @return indicate that the author thinks of it as a 'local' @typedef that's part of the function documentation - if (tags.some(function (t) { return t.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 338 /* SyntaxKind.JSDocCallbackTag */; }) - && !tags.some(function (t) { return t.kind === 340 /* SyntaxKind.JSDocParameterTag */ || t.kind === 341 /* SyntaxKind.JSDocReturnTag */; })) { + if (tags.some(function (t) { return t.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 341 /* SyntaxKind.JSDocCallbackTag */; }) + && !tags.some(function (t) { return t.kind === 343 /* SyntaxKind.JSDocParameterTag */ || t.kind === 344 /* SyntaxKind.JSDocReturnTag */; })) { return; } for (var _i = 0, tags_1 = tags; _i < tags_1.length; _i++) { @@ -142576,17 +143577,17 @@ var ts; if (typeof comment === "string") { return [ts.textPart(comment)]; } - return ts.flatMap(comment, function (node) { return node.kind === 321 /* SyntaxKind.JSDocText */ ? [ts.textPart(node.text)] : ts.buildLinkParts(node, checker); }); + return ts.flatMap(comment, function (node) { return node.kind === 324 /* SyntaxKind.JSDocText */ ? [ts.textPart(node.text)] : ts.buildLinkParts(node, checker); }); } function getCommentDisplayParts(tag, checker) { var comment = tag.comment, kind = tag.kind; var namePart = getTagNameDisplayPart(kind); switch (kind) { - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return withNode(tag.class); - case 328 /* SyntaxKind.JSDocAugmentsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: return withNode(tag.class); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: var templateTag = tag; var displayParts_3 = []; if (templateTag.constraint) { @@ -142608,13 +143609,13 @@ var ts; displayParts_3.push.apply(displayParts_3, __spreadArray([ts.spacePart()], getDisplayPartsFromComment(comment, checker), true)); } return displayParts_3; - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return withNode(tag.typeExpression); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: - case 346 /* SyntaxKind.JSDocSeeTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: var name = tag.name; return name ? withNode(name) : comment === undefined ? undefined @@ -142641,14 +143642,14 @@ var ts; } function getTagNameDisplayPart(kind) { switch (kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return ts.parameterNamePart; - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return ts.propertyNamePart; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return ts.typeParameterNamePart; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return ts.typeAliasNamePart; default: return ts.textPart; @@ -142819,24 +143820,24 @@ var ts; } function getCommentOwnerInfoWorker(commentOwner, options) { switch (commentOwner.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 168 /* SyntaxKind.MethodSignature */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 170 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: var host = commentOwner; return { commentOwner: commentOwner, parameters: host.parameters, hasReturn: hasReturn(host, options) }; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getCommentOwnerInfoWorker(commentOwner.initializer, options); - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return { commentOwner: commentOwner }; - case 237 /* SyntaxKind.VariableStatement */: { + case 240 /* SyntaxKind.VariableStatement */: { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; var host_1 = varDeclarations.length === 1 && varDeclarations[0].initializer @@ -142846,16 +143847,16 @@ var ts; ? { commentOwner: commentOwner, parameters: host_1.parameters, hasReturn: hasReturn(host_1, options) } : { commentOwner: commentOwner }; } - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return "quit"; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // If in walking up the tree, we hit a a nested namespace declaration, // then we must be somewhere within a dotted namespace name; however we don't // want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'. - return commentOwner.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? undefined : { commentOwner: commentOwner }; - case 238 /* SyntaxKind.ExpressionStatement */: + return commentOwner.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? undefined : { commentOwner: commentOwner }; + case 241 /* SyntaxKind.ExpressionStatement */: return getCommentOwnerInfoWorker(commentOwner.expression, options); - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var be = commentOwner; if (ts.getAssignmentDeclarationKind(be) === 0 /* AssignmentDeclarationKind.None */) { return "quit"; @@ -142864,7 +143865,7 @@ var ts; ? { commentOwner: commentOwner, parameters: be.right.parameters, hasReturn: hasReturn(be.right, options) } : { commentOwner: commentOwner }; } - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: var init = commentOwner.initializer; if (init && (ts.isFunctionExpression(init) || ts.isArrowFunction(init))) { return { commentOwner: commentOwner, parameters: init.parameters, hasReturn: hasReturn(init, options) }; @@ -142877,14 +143878,14 @@ var ts; || ts.isFunctionLikeDeclaration(node) && node.body && ts.isBlock(node.body) && !!ts.forEachReturnStatement(node.body, function (n) { return n; })); } function getRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (rightHandSide.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return rightHandSide; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return ts.find(rightHandSide.members, ts.isConstructorDeclaration); } } @@ -142943,9 +143944,9 @@ var ts; } function shouldKeepItem(declaration, checker) { switch (declaration.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: var importer = checker.getSymbolAtLocation(declaration.name); // TODO: GH#18217 var imported = checker.getAliasedSymbol(importer); return importer.escapedName !== imported.escapedName; @@ -142955,7 +143956,7 @@ var ts; } function tryAddSingleDeclarationName(declaration, containers) { var name = ts.getNameOfDeclaration(declaration); - return !!name && (pushLiteral(name, containers) || name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers)); + return !!name && (pushLiteral(name, containers) || name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers)); } // Only added the names of computed properties if they're simple dotted expressions, like: // @@ -142972,7 +143973,7 @@ var ts; // First, if we started with a computed property name, then add all but the last // portion into the container array. var name = ts.getNameOfDeclaration(declaration); - if (name && name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) { + if (name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) { return ts.emptyArray; } // Don't include the last portion. @@ -143189,7 +144190,7 @@ var ts; */ function hasNavigationBarName(node) { return !ts.hasDynamicName(node) || - (node.kind !== 221 /* SyntaxKind.BinaryExpression */ && + (node.kind !== 223 /* SyntaxKind.BinaryExpression */ && ts.isPropertyAccessExpression(node.name.expression) && ts.isIdentifier(node.name.expression.expression) && ts.idText(node.name.expression.expression) === "Symbol"); @@ -143202,7 +144203,7 @@ var ts; return; } switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: // Get parameter properties, and treat them as being on the *same* level as the constructor, not under it. var ctr = node; addNodeWithRecursiveChild(ctr, ctr.body); @@ -143214,25 +144215,25 @@ var ts; } } break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 170 /* SyntaxKind.MethodSignature */: if (hasNavigationBarName(node)) { addNodeWithRecursiveChild(node, node.body); } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (hasNavigationBarName(node)) { addNodeWithRecursiveInitializer(node); } break; - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (hasNavigationBarName(node)) { addLeafNode(node); } break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: var importClause = node; // Handle default import case e.g.: // import d from "mod"; @@ -143244,7 +144245,7 @@ var ts; // import {a, b as B} from "mod"; var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { addLeafNode(namedBindings); } else { @@ -143255,17 +144256,17 @@ var ts; } } break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: addNodeWithRecursiveChild(node, node.name); break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: var expression = node.expression; // Use the expression as the name of the SpreadAssignment, otherwise show as . ts.isIdentifier(expression) ? addLeafNode(node, expression) : addLeafNode(node); break; - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 254 /* SyntaxKind.VariableDeclaration */: { + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: { var child = node; if (ts.isBindingPattern(child.name)) { addChildrenRecursively(child.name); @@ -143275,7 +144276,7 @@ var ts; } break; } - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: var nameNode = node.name; // If we see a function declaration track as a possible ES5 class if (nameNode && ts.isIdentifier(nameNode)) { @@ -143283,11 +144284,11 @@ var ts; } addNodeWithRecursiveChild(node, node.body); break; - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: addNodeWithRecursiveChild(node, node.body); break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: startNode(node); for (var _e = 0, _f = node.members; _e < _f.length; _e++) { var member = _f[_e]; @@ -143297,9 +144298,9 @@ var ts; } endNode(); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: startNode(node); for (var _g = 0, _h = node.members; _g < _h.length; _g++) { var member = _h[_g]; @@ -143307,10 +144308,10 @@ var ts; } endNode(); break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var expression_1 = node.expression; var child = ts.isObjectLiteralExpression(expression_1) || ts.isCallExpression(expression_1) ? expression_1 : ts.isArrowFunction(expression_1) || ts.isFunctionExpression(expression_1) ? expression_1.body : undefined; @@ -143324,16 +144325,16 @@ var ts; } break; } - case 275 /* SyntaxKind.ExportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 176 /* SyntaxKind.IndexSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: addLeafNode(node); break; - case 208 /* SyntaxKind.CallExpression */: - case 221 /* SyntaxKind.BinaryExpression */: { + case 210 /* SyntaxKind.CallExpression */: + case 223 /* SyntaxKind.BinaryExpression */: { var special = ts.getAssignmentDeclarationKind(node); switch (special) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -143573,12 +144574,12 @@ var ts; return false; } switch (a.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return ts.isStatic(a) === ts.isStatic(b); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return areSameModule(a, b) && getFullyQualifiedModuleName(a) === getFullyQualifiedModuleName(b); default: @@ -143600,7 +144601,7 @@ var ts; if (!a.body || !b.body) { return a.body === b.body; } - return a.body.kind === b.body.kind && (a.body.kind !== 261 /* SyntaxKind.ModuleDeclaration */ || areSameModule(a.body, b.body)); + return a.body.kind === b.body.kind && (a.body.kind !== 264 /* SyntaxKind.ModuleDeclaration */ || areSameModule(a.body, b.body)); } /** Merge source into target. Source should be thrown away after this is called. */ function merge(target, source) { @@ -143630,7 +144631,7 @@ var ts; * So `new()` can still come before an `aardvark` method. */ function tryGetName(node) { - if (node.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (node.kind === 264 /* SyntaxKind.ModuleDeclaration */) { return getModuleName(node); } var declName = ts.getNameOfDeclaration(node); @@ -143639,16 +144640,16 @@ var ts; return propertyName && ts.unescapeLeadingUnderscores(propertyName); } switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 226 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: return getFunctionOrClassName(node); default: return undefined; } } function getItemName(node, name) { - if (node.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (node.kind === 264 /* SyntaxKind.ModuleDeclaration */) { return cleanText(getModuleName(node)); } if (name) { @@ -143660,32 +144661,32 @@ var ts; } } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"".concat(ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))), "\"") : ""; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return ts.isExportAssignment(node) && node.isExportEquals ? "export=" /* InternalSymbolName.ExportEquals */ : "default" /* InternalSymbolName.Default */; - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - if (ts.getSyntacticModifierFlags(node) & 512 /* ModifierFlags.Default */) { + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + if (ts.getSyntacticModifierFlags(node) & 1024 /* ModifierFlags.Default */) { return "default"; } // We may get a string with newlines or other whitespace in the case of an object dereference // (eg: "app\n.onactivated"), so we should remove the whitespace for readability in the // navigation bar. return getFunctionOrClassName(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "constructor"; - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return "new()"; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: return "()"; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return "[]"; default: return ""; @@ -143718,19 +144719,19 @@ var ts; } // Some nodes are otherwise important enough to always include in the primary navigation menu. switch (navigationBarNodeKind(item)) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 305 /* SyntaxKind.SourceFile */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return true; - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return isTopLevelFunctionDeclaration(item); default: return false; @@ -143740,10 +144741,10 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 262 /* SyntaxKind.ModuleBlock */: - case 305 /* SyntaxKind.SourceFile */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 265 /* SyntaxKind.ModuleBlock */: + case 308 /* SyntaxKind.SourceFile */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: return true; default: return false; @@ -143805,7 +144806,7 @@ var ts; function getFullyQualifiedModuleName(moduleDeclaration) { // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = [ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)]; - while (moduleDeclaration.body && moduleDeclaration.body.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 264 /* SyntaxKind.ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)); } @@ -143819,13 +144820,13 @@ var ts; return decl.body && ts.isModuleDeclaration(decl.body) ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { - return !member.name || member.name.kind === 162 /* SyntaxKind.ComputedPropertyName */; + return !member.name || member.name.kind === 164 /* SyntaxKind.ComputedPropertyName */; } function getNodeSpan(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); } function getModifiers(node) { - if (node.parent && node.parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (node.parent && node.parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { node = node.parent; } return ts.getNodeModifiers(node); @@ -143848,7 +144849,7 @@ var ts; return nodeText(parent.name); } // Default exports are named "default" - else if (ts.getSyntacticModifierFlags(node) & 512 /* ModifierFlags.Default */) { + else if (ts.getSyntacticModifierFlags(node) & 1024 /* ModifierFlags.Default */) { return "default"; } else if (ts.isClassLike(node)) { @@ -143883,9 +144884,9 @@ var ts; } function isFunctionOrClassExpression(node) { switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: return true; default: return false; @@ -144286,11 +145287,11 @@ var ts; function getModuleSpecifierExpression(declaration) { var _a; switch (declaration.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return (_a = ts.tryCast(declaration.moduleReference, ts.isExternalModuleReference)) === null || _a === void 0 ? void 0 : _a.expression; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return declaration.moduleSpecifier; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return declaration.declarationList.declarations[0].initializer.arguments[0]; } } @@ -144329,19 +145330,19 @@ var ts; function getImportKindOrder(s1) { var _a; switch (s1.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: if (!s1.importClause) return 0; if (s1.importClause.isTypeOnly) return 1; - if (((_a = s1.importClause.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 268 /* SyntaxKind.NamespaceImport */) + if (((_a = s1.importClause.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 271 /* SyntaxKind.NamespaceImport */) return 2; if (s1.importClause.name) return 3; return 4; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return 5; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return 6; } } @@ -144530,7 +145531,7 @@ var ts; } function getOutliningSpanForNode(n, sourceFile) { switch (n.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionLike(n.parent)) { return functionSpan(n.parent, n, sourceFile); } @@ -144538,16 +145539,16 @@ var ts; // If the latter, we want to collapse the block, but consider its hint span // to be the entire span of the parent. switch (n.parent.kind) { - case 240 /* SyntaxKind.DoStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 243 /* SyntaxKind.DoStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 295 /* SyntaxKind.CatchClause */: return spanForNode(n.parent); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // Could be the try-block, or the finally-block. var tryStatement = n.parent; if (tryStatement.tryBlock === n) { @@ -144564,42 +145565,42 @@ var ts; // the span of the block, independent of any parent span. return createOutliningSpan(ts.createTextSpanFromNode(n, sourceFile), "code" /* OutliningSpanKind.Code */); } - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return spanForNode(n.parent); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 263 /* SyntaxKind.CaseBlock */: - case 182 /* SyntaxKind.TypeLiteral */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 266 /* SyntaxKind.CaseBlock */: + case 184 /* SyntaxKind.TypeLiteral */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return spanForNode(n); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return spanForNode(n, /*autoCollapse*/ false, /*useFullStart*/ !ts.isTupleTypeNode(n.parent), 22 /* SyntaxKind.OpenBracketToken */); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: return spanForNodeArray(n.statements); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return spanForObjectOrArrayLiteral(n); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return spanForObjectOrArrayLiteral(n, 22 /* SyntaxKind.OpenBracketToken */); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return spanForJSXElement(n); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return spanForJSXFragment(n); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: return spanForJSXAttributes(n.attributes); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return spanForTemplateLiteral(n); - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return spanForNode(n, /*autoCollapse*/ false, /*useFullStart*/ !ts.isBindingElement(n.parent), 22 /* SyntaxKind.OpenBracketToken */); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return spanForArrowFunction(n); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return spanForCallExpression(n); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return spanForParenthesizedExpression(n); } function spanForCallExpression(node) { @@ -144672,7 +145673,7 @@ var ts; function functionSpan(node, body, sourceFile) { var openToken = tryGetFunctionOpenToken(node, body, sourceFile); var closeToken = ts.findChildOfKind(body, 19 /* SyntaxKind.CloseBraceToken */, sourceFile); - return openToken && closeToken && spanBetweenTokens(openToken, closeToken, node, sourceFile, /*autoCollapse*/ node.kind !== 214 /* SyntaxKind.ArrowFunction */); + return openToken && closeToken && spanBetweenTokens(openToken, closeToken, node, sourceFile, /*autoCollapse*/ node.kind !== 216 /* SyntaxKind.ArrowFunction */); } function spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart) { if (autoCollapse === void 0) { autoCollapse = false; } @@ -145216,10 +146217,10 @@ var ts; */ function tryConsumeDeclare() { var token = ts.scanner.getToken(); - if (token === 135 /* SyntaxKind.DeclareKeyword */) { + if (token === 136 /* SyntaxKind.DeclareKeyword */) { // declare module "mod" token = nextToken(); - if (token === 141 /* SyntaxKind.ModuleKeyword */) { + if (token === 142 /* SyntaxKind.ModuleKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { recordAmbientExternalModule(); @@ -145253,10 +146254,10 @@ var ts; return true; } else { - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); - return token !== 156 /* SyntaxKind.FromKeyword */ && (token === 41 /* SyntaxKind.AsteriskToken */ || + return token !== 158 /* SyntaxKind.FromKeyword */ && (token === 41 /* SyntaxKind.AsteriskToken */ || token === 18 /* SyntaxKind.OpenBraceToken */ || token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)); @@ -145267,7 +146268,7 @@ var ts; } if (token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import d from "mod"; @@ -145298,7 +146299,7 @@ var ts; } if (token === 19 /* SyntaxKind.CloseBraceToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import {a as A} from "mod"; @@ -145310,11 +146311,11 @@ var ts; } else if (token === 41 /* SyntaxKind.AsteriskToken */) { token = nextToken(); - if (token === 127 /* SyntaxKind.AsKeyword */) { + if (token === 128 /* SyntaxKind.AsKeyword */) { token = nextToken(); if (token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import * as NS from "mod" @@ -145335,7 +146336,7 @@ var ts; if (token === 93 /* SyntaxKind.ExportKeyword */) { markAsExternalModuleIfTopLevel(); token = nextToken(); - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); return token === 41 /* SyntaxKind.AsteriskToken */ || @@ -145354,7 +146355,7 @@ var ts; } if (token === 19 /* SyntaxKind.CloseBraceToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // export {a as A} from "mod"; @@ -145366,7 +146367,7 @@ var ts; } else if (token === 41 /* SyntaxKind.AsteriskToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // export * from "mod" @@ -145376,7 +146377,7 @@ var ts; } else if (token === 100 /* SyntaxKind.ImportKeyword */) { token = nextToken(); - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); return token === 79 /* SyntaxKind.Identifier */ || @@ -145402,7 +146403,7 @@ var ts; function tryConsumeRequireCall(skipCurrentToken, allowTemplateLiterals) { if (allowTemplateLiterals === void 0) { allowTemplateLiterals = false; } var token = skipCurrentToken ? nextToken() : ts.scanner.getToken(); - if (token === 146 /* SyntaxKind.RequireKeyword */) { + if (token === 147 /* SyntaxKind.RequireKeyword */) { token = nextToken(); if (token === 20 /* SyntaxKind.OpenParenToken */) { token = nextToken(); @@ -145614,7 +146615,7 @@ var ts; return getRenameInfoError(wouldRenameNodeModules); } var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); - var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) + var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) ? ts.stripQuotes(ts.getTextOfIdentifierOrLiteral(node)) : undefined; var displayName = specifierName || typeChecker.symbolToString(symbol); @@ -145759,6 +146760,10 @@ var ts; pushSelectionCommentRange(comment.pos, comment.end); } if (positionShouldSnapToNode(sourceFile, pos, node)) { + if (ts.isFunctionBody(node) + && ts.isFunctionLikeDeclaration(parentNode) && !ts.positionsAreOnSameLine(node.getStart(sourceFile), node.getEnd(), sourceFile)) { + pushSelectionRange(node.getStart(sourceFile), node.getEnd()); + } // 1. Blocks are effectively redundant with SyntaxLists. // 2. TemplateSpans, along with the SyntaxLists containing them, are a somewhat unintuitive grouping // of things that should be considered independently. @@ -145896,14 +146901,14 @@ var ts; ts.Debug.assertEqual(closeBraceToken.kind, 19 /* SyntaxKind.CloseBraceToken */); // Group `-/+readonly` and `-/+?` var groupedWithPlusMinusTokens = groupChildren(children, function (child) { - return child === node.readonlyToken || child.kind === 145 /* SyntaxKind.ReadonlyKeyword */ || + return child === node.readonlyToken || child.kind === 146 /* SyntaxKind.ReadonlyKeyword */ || child === node.questionToken || child.kind === 57 /* SyntaxKind.QuestionToken */; }); // Group type parameter with surrounding brackets var groupedWithBrackets = groupChildren(groupedWithPlusMinusTokens, function (_a) { var kind = _a.kind; return kind === 22 /* SyntaxKind.OpenBracketToken */ || - kind === 163 /* SyntaxKind.TypeParameter */ || + kind === 165 /* SyntaxKind.TypeParameter */ || kind === 23 /* SyntaxKind.CloseBracketToken */; }); return [ @@ -145921,7 +146926,7 @@ var ts; var children = groupChildren(node.getChildren(), function (child) { return child === node.name || ts.contains(node.modifiers, child); }); - var firstJSDocChild = ((_a = children[0]) === null || _a === void 0 ? void 0 : _a.kind) === 320 /* SyntaxKind.JSDoc */ ? children[0] : undefined; + var firstJSDocChild = ((_a = children[0]) === null || _a === void 0 ? void 0 : _a.kind) === 323 /* SyntaxKind.JSDoc */ ? children[0] : undefined; var withJSDocSeparated = firstJSDocChild ? children.slice(1) : children; var splittedChildren = splitChildren(withJSDocSeparated, function (_a) { var kind = _a.kind; @@ -146020,22 +147025,22 @@ var ts; return kind === 18 /* SyntaxKind.OpenBraceToken */ || kind === 22 /* SyntaxKind.OpenBracketToken */ || kind === 20 /* SyntaxKind.OpenParenToken */ - || kind === 280 /* SyntaxKind.JsxOpeningElement */; + || kind === 283 /* SyntaxKind.JsxOpeningElement */; } function isListCloser(token) { var kind = token && token.kind; return kind === 19 /* SyntaxKind.CloseBraceToken */ || kind === 23 /* SyntaxKind.CloseBracketToken */ || kind === 21 /* SyntaxKind.CloseParenToken */ - || kind === 281 /* SyntaxKind.JsxClosingElement */; + || kind === 284 /* SyntaxKind.JsxClosingElement */; } function getEndPos(sourceFile, node) { switch (node.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 342 /* SyntaxKind.JSDocThisTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 345 /* SyntaxKind.JSDocThisTag */: return sourceFile.getLineEndOfPosition(node.getStart()); default: return node.getEnd(); @@ -146245,10 +147250,10 @@ var ts; } return undefined; } - else if (ts.isTemplateHead(node) && parent.parent.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + else if (ts.isTemplateHead(node) && parent.parent.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { var templateExpression = parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 223 /* SyntaxKind.TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 225 /* SyntaxKind.TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position, sourceFile) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } @@ -146320,17 +147325,17 @@ var ts; return undefined; var parent = startingToken.parent; switch (parent.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: var info = getArgumentOrParameterListInfo(startingToken, position, sourceFile); if (!info) return undefined; var argumentIndex = info.argumentIndex, argumentCount = info.argumentCount, argumentsSpan = info.argumentsSpan; var contextualType = ts.isMethodDeclaration(parent) ? checker.getContextualTypeForObjectLiteralElement(parent) : checker.getContextualType(parent); return contextualType && { contextualType: contextualType, argumentIndex: argumentIndex, argumentCount: argumentCount, argumentsSpan: argumentsSpan }; - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var highestBinary = getHighestBinary(parent); var contextualType_1 = checker.getContextualType(highestBinary); var argumentIndex_1 = startingToken.kind === 20 /* SyntaxKind.OpenParenToken */ ? 0 : countBinaryExpressionParameters(parent) - 1; @@ -146401,11 +147406,11 @@ var ts; // not enough to put us in the substitution expression; we should consider ourselves part of // the *next* span's expression by offsetting the index (argIndex = (spanIndex + 1) + 1). // - /* eslint-disable no-double-space */ + /* eslint-disable local/no-double-space */ // Example: f `# abcd $#{# 1 + 1# }# efghi ${ #"#hello"# } # ` // ^ ^ ^ ^ ^ ^ ^ ^ ^ // Case: 1 1 3 2 1 3 2 2 1 - /* eslint-enable no-double-space */ + /* eslint-enable local/no-double-space */ ts.Debug.assert(position >= node.getStart(), "Assumed 'position' could not occur before node."); if (ts.isTemplateLiteralToken(node)) { if (ts.isInsideTemplateLiteral(node, position, sourceFile)) { @@ -146454,7 +147459,7 @@ var ts; // | | // This is because a Missing node has no width. However, what we actually want is to include trivia // leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail. - if (template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (template.kind === 225 /* SyntaxKind.TemplateExpression */) { var lastSpan = ts.last(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); @@ -146659,14 +147664,14 @@ var ts; return; } switch (node.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } if (!ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth())) { @@ -146810,7 +147815,7 @@ var ts; } function isHintableLiteral(node) { switch (node.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: { + case 221 /* SyntaxKind.PrefixUnaryExpression */: { var operand = node.operand; return ts.isLiteralExpression(operand) || ts.isIdentifier(operand) && ts.isInfinityOrNaNString(operand.escapedText); } @@ -146818,7 +147823,7 @@ var ts; case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return true; case 79 /* SyntaxKind.Identifier */: { var name = node.escapedText; @@ -147139,11 +148144,11 @@ var ts; function containsTopLevelCommonjs(sourceFile) { return sourceFile.statements.some(function (statement) { switch (statement.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return statement.declarationList.declarations.some(function (decl) { return !!decl.initializer && ts.isRequireCall(propertyAccessLeftHandSide(decl.initializer), /*checkArgumentIsStringLiteralLike*/ true); }); - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; if (!ts.isBinaryExpression(expression)) return ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true); @@ -147160,12 +148165,12 @@ var ts; } function importNameForConvertToDefaultImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var importClause = node.importClause, moduleSpecifier = node.moduleSpecifier; - return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ && ts.isStringLiteral(moduleSpecifier) + return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ && ts.isStringLiteral(moduleSpecifier) ? importClause.namedBindings.name : undefined; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.name; default: return undefined; @@ -147241,20 +148246,20 @@ var ts; // should be kept up to date with getTransformationBody in convertToAsyncFunction.ts function isFixablePromiseArgument(arg, checker) { switch (arg.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: var functionFlags = ts.getFunctionFlags(arg); if (functionFlags & 1 /* FunctionFlags.Generator */) { return false; } // falls through - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: visitedNestedConvertibleFunctions.set(getKeyFromNode(arg), true); // falls through case 104 /* SyntaxKind.NullKeyword */: return true; case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: { + case 208 /* SyntaxKind.PropertyAccessExpression */: { var symbol = checker.getSymbolAtLocation(arg); if (!symbol) { return false; @@ -147271,24 +148276,24 @@ var ts; } function canBeConvertedToClass(node, checker) { var _a, _b, _c, _d; - if (node.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (node.kind === 215 /* SyntaxKind.FunctionExpression */) { if (ts.isVariableDeclaration(node.parent) && ((_a = node.symbol.members) === null || _a === void 0 ? void 0 : _a.size)) { return true; } var symbol = checker.getSymbolOfExpando(node, /*allowDeclaration*/ false); return !!(symbol && (((_b = symbol.exports) === null || _b === void 0 ? void 0 : _b.size) || ((_c = symbol.members) === null || _c === void 0 ? void 0 : _c.size))); } - if (node.kind === 256 /* SyntaxKind.FunctionDeclaration */) { + if (node.kind === 259 /* SyntaxKind.FunctionDeclaration */) { return !!((_d = node.symbol.members) === null || _d === void 0 ? void 0 : _d.size); } return false; } function canBeConvertedToAsync(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: return false; @@ -147310,7 +148315,7 @@ var ts; } var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol); if (flags & 32 /* SymbolFlags.Class */) { - return ts.getDeclarationOfKind(symbol, 226 /* SyntaxKind.ClassExpression */) ? + return ts.getDeclarationOfKind(symbol, 228 /* SyntaxKind.ClassExpression */) ? "local class" /* ScriptElementKind.localClassElement */ : "class" /* ScriptElementKind.classElement */; } if (flags & 384 /* SymbolFlags.Enum */) @@ -147373,6 +148378,8 @@ var ts; return "method" /* ScriptElementKind.memberFunctionElement */; if (flags & 16384 /* SymbolFlags.Constructor */) return "constructor" /* ScriptElementKind.constructorImplementationElement */; + if (flags & 131072 /* SymbolFlags.Signature */) + return "index" /* ScriptElementKind.indexSignatureElement */; if (flags & 4 /* SymbolFlags.Property */) { if (flags & 33554432 /* SymbolFlags.Transient */ && symbol.checkFlags & 6 /* CheckFlags.Synthetic */) { // If union property is result of union of non method (property/accessors/variables), it is labeled as property @@ -147456,12 +148463,15 @@ var ts; var declaration = ts.find(symbol.declarations, function (declaration) { return declaration.name === location; }); if (declaration) { switch (declaration.kind) { - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: symbolKind = "getter" /* ScriptElementKind.memberGetAccessorElement */; break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: symbolKind = "setter" /* ScriptElementKind.memberSetAccessorElement */; break; + case 169 /* SyntaxKind.PropertyDeclaration */: + symbolKind = "accessor" /* ScriptElementKind.memberAccessorVariableElement */; + break; default: ts.Debug.assertNever(declaration); } @@ -147472,7 +148482,7 @@ var ts; } var signature = void 0; type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); - if (location.parent && location.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var right = location.parent.name; // Either the location is on the right of a property access, or on the left and the right is missing if (right === location || (right && right.getFullWidth() === 0)) { @@ -147492,7 +148502,7 @@ var ts; } if (callExpressionLike) { signature = typeChecker.getResolvedSignature(callExpressionLike); // TODO: GH#18217 - var useConstructSignatures = callExpressionLike.kind === 209 /* SyntaxKind.NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 106 /* SyntaxKind.SuperKeyword */); + var useConstructSignatures = callExpressionLike.kind === 211 /* SyntaxKind.NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 106 /* SyntaxKind.SuperKeyword */); var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (signature && !ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { // Get the first signature if there is one -- allSignatures may contain @@ -147556,29 +148566,29 @@ var ts; } } else if ((ts.isNameOfFunctionDeclaration(location) && !(symbolFlags & 98304 /* SymbolFlags.Accessor */)) || // name of function declaration - (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ && location.parent.kind === 171 /* SyntaxKind.Constructor */)) { // At constructor keyword of constructor declaration + (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ && location.parent.kind === 173 /* SyntaxKind.Constructor */)) { // At constructor keyword of constructor declaration // get the signature from the declaration and write it var functionDeclaration_1 = location.parent; // Use function declaration to write the signatures only if the symbol corresponding to this declaration var locationIsSymbolDeclaration = symbol.declarations && ts.find(symbol.declarations, function (declaration) { - return declaration === (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1); + return declaration === (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1); }); if (locationIsSymbolDeclaration) { - var allSignatures = functionDeclaration_1.kind === 171 /* SyntaxKind.Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); + var allSignatures = functionDeclaration_1.kind === 173 /* SyntaxKind.Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration_1)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration_1); // TODO: GH#18217 } else { signature = allSignatures[0]; } - if (functionDeclaration_1.kind === 171 /* SyntaxKind.Constructor */) { + if (functionDeclaration_1.kind === 173 /* SyntaxKind.Constructor */) { // show (constructor) Type(...) signature symbolKind = "constructor" /* ScriptElementKind.constructorImplementationElement */; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { // (function/method) symbol(..signature) - addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 174 /* SyntaxKind.CallSignature */ && + addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 176 /* SyntaxKind.CallSignature */ && !(type.symbol.flags & 2048 /* SymbolFlags.TypeLiteral */ || type.symbol.flags & 4096 /* SymbolFlags.ObjectLiteral */) ? type.symbol : symbol, symbolKind); } if (signature) { @@ -147591,7 +148601,7 @@ var ts; } if (symbolFlags & 32 /* SymbolFlags.Class */ && !hasAddedSymbolInfo && !isThisExpression) { addAliasPrefixIfNecessary(); - if (ts.getDeclarationOfKind(symbol, 226 /* SyntaxKind.ClassExpression */)) { + if (ts.getDeclarationOfKind(symbol, 228 /* SyntaxKind.ClassExpression */)) { // Special case for class expressions because we would like to indicate that // the class name is local to the class body (similar to function expression) // (local class) class @@ -147614,7 +148624,7 @@ var ts; } if ((symbolFlags & 524288 /* SymbolFlags.TypeAlias */) && (semanticMeaning & 2 /* SemanticMeaning.Type */)) { prefixNextMeaning(); - displayParts.push(ts.keywordPart(152 /* SyntaxKind.TypeKeyword */)); + displayParts.push(ts.keywordPart(154 /* SyntaxKind.TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); @@ -147635,9 +148645,9 @@ var ts; } if (symbolFlags & 1536 /* SymbolFlags.Module */ && !isThisExpression) { prefixNextMeaning(); - var declaration = ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.ModuleDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 264 /* SyntaxKind.ModuleDeclaration */); var isNamespace = declaration && declaration.name && declaration.name.kind === 79 /* SyntaxKind.Identifier */; - displayParts.push(ts.keywordPart(isNamespace ? 142 /* SyntaxKind.NamespaceKeyword */ : 141 /* SyntaxKind.ModuleKeyword */)); + displayParts.push(ts.keywordPart(isNamespace ? 143 /* SyntaxKind.NamespaceKeyword */ : 142 /* SyntaxKind.ModuleKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } @@ -147656,7 +148666,7 @@ var ts; } else { // Method/function type parameter - var decl = ts.getDeclarationOfKind(symbol, 163 /* SyntaxKind.TypeParameter */); + var decl = ts.getDeclarationOfKind(symbol, 165 /* SyntaxKind.TypeParameter */); if (decl === undefined) return ts.Debug.fail(); var declaration = decl.parent; @@ -147664,21 +148674,21 @@ var ts; if (ts.isFunctionLikeKind(declaration.kind)) { addInPrefix(); var signature = typeChecker.getSignatureFromDeclaration(declaration); // TODO: GH#18217 - if (declaration.kind === 175 /* SyntaxKind.ConstructSignature */) { + if (declaration.kind === 177 /* SyntaxKind.ConstructSignature */) { displayParts.push(ts.keywordPart(103 /* SyntaxKind.NewKeyword */)); displayParts.push(ts.spacePart()); } - else if (declaration.kind !== 174 /* SyntaxKind.CallSignature */ && declaration.name) { + else if (declaration.kind !== 176 /* SyntaxKind.CallSignature */ && declaration.name) { addFullSymbolName(declaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* TypeFormatFlags.WriteTypeArgumentsOfSignature */)); } - else if (declaration.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + else if (declaration.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { // Type alias type parameter // For example // type list = T[]; // Both T will go through same code path addInPrefix(); - displayParts.push(ts.keywordPart(152 /* SyntaxKind.TypeKeyword */)); + displayParts.push(ts.keywordPart(154 /* SyntaxKind.TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(declaration.symbol); writeTypeParametersOfSymbol(declaration.symbol, sourceFile); @@ -147690,7 +148700,7 @@ var ts; symbolKind = "enum member" /* ScriptElementKind.enumMemberElement */; addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]; - if ((declaration === null || declaration === void 0 ? void 0 : declaration.kind) === 299 /* SyntaxKind.EnumMember */) { + if ((declaration === null || declaration === void 0 ? void 0 : declaration.kind) === 302 /* SyntaxKind.EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -147726,17 +148736,17 @@ var ts; } if (symbol.declarations) { switch (symbol.declarations[0].kind) { - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(142 /* SyntaxKind.NamespaceKeyword */)); + displayParts.push(ts.keywordPart(143 /* SyntaxKind.NamespaceKeyword */)); break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(symbol.declarations[0].isExportEquals ? 63 /* SyntaxKind.EqualsToken */ : 88 /* SyntaxKind.DefaultKeyword */)); break; - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); break; default: @@ -147746,13 +148756,13 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (declaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); displayParts.push(ts.operatorPart(63 /* SyntaxKind.EqualsToken */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(146 /* SyntaxKind.RequireKeyword */)); + displayParts.push(ts.keywordPart(147 /* SyntaxKind.RequireKeyword */)); displayParts.push(ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */)); displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), ts.SymbolDisplayPartKind.stringLiteral)); displayParts.push(ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)); @@ -147782,16 +148792,18 @@ var ts; } // For properties, variables and local vars: show the type if (symbolKind === "property" /* ScriptElementKind.memberVariableElement */ || + symbolKind === "accessor" /* ScriptElementKind.memberAccessorVariableElement */ || symbolKind === "getter" /* ScriptElementKind.memberGetAccessorElement */ || symbolKind === "setter" /* ScriptElementKind.memberSetAccessorElement */ || symbolKind === "JSX attribute" /* ScriptElementKind.jsxAttribute */ || symbolFlags & 3 /* SymbolFlags.Variable */ || symbolKind === "local var" /* ScriptElementKind.localVariableElement */ || + symbolKind === "index" /* ScriptElementKind.indexSignatureElement */ || isThisExpression) { displayParts.push(ts.punctuationPart(58 /* SyntaxKind.ColonToken */)); displayParts.push(ts.spacePart()); // If the type is type parameter, format it specially - if (type.symbol && type.symbol.flags & 262144 /* SymbolFlags.TypeParameter */) { + if (type.symbol && type.symbol.flags & 262144 /* SymbolFlags.TypeParameter */ && symbolKind !== "index" /* ScriptElementKind.indexSignatureElement */) { var typeParameterParts = ts.mapToDisplayParts(function (writer) { var param = typeChecker.typeParameterToDeclaration(type, enclosingDeclaration, symbolDisplayNodeBuilderFlags); getPrinter().writeNode(4 /* EmitHint.Unspecified */, param, ts.getSourceFileOfNode(ts.getParseTreeNode(enclosingDeclaration)), writer); @@ -147835,10 +148847,10 @@ var ts; // For some special property access expressions like `exports.foo = foo` or `module.exports.foo = foo` // there documentation comments might be attached to the right hand side symbol of their declarations. // The pattern of such special property access is that the parent symbol is the symbol of the file. - if (symbol.parent && symbol.declarations && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 305 /* SyntaxKind.SourceFile */; })) { + if (symbol.parent && symbol.declarations && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 308 /* SyntaxKind.SourceFile */; })) { for (var _i = 0, _b = symbol.declarations; _i < _b.length; _i++) { var declaration = _b[_i]; - if (!declaration.parent || declaration.parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (!declaration.parent || declaration.parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { continue; } var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); @@ -147899,10 +148911,34 @@ var ts; displayParts.push(ts.spacePart()); } function addFullSymbolName(symbolToDisplay, enclosingDeclaration) { + var indexInfos; if (alias && symbolToDisplay === symbol) { symbolToDisplay = alias; } - var fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay, enclosingDeclaration || sourceFile, /*meaning*/ undefined, 1 /* SymbolFormatFlags.WriteTypeParametersOrArguments */ | 2 /* SymbolFormatFlags.UseOnlyExternalAliasing */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + if (symbolKind === "index" /* ScriptElementKind.indexSignatureElement */) { + indexInfos = typeChecker.getIndexInfosOfIndexSymbol(symbolToDisplay); + } + var fullSymbolDisplayParts = []; + if (symbolToDisplay.flags & 131072 /* SymbolFlags.Signature */ && indexInfos) { + if (symbolToDisplay.parent) { + fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay.parent); + } + fullSymbolDisplayParts.push(ts.punctuationPart(22 /* SyntaxKind.OpenBracketToken */)); + //Needed to handle more than one type of index + indexInfos.forEach(function (info, i) { + //Needed to handle template literals + fullSymbolDisplayParts.push.apply(fullSymbolDisplayParts, ts.typeToDisplayParts(typeChecker, info.keyType)); + if (i !== indexInfos.length - 1) { + fullSymbolDisplayParts.push(ts.spacePart()); + fullSymbolDisplayParts.push(ts.punctuationPart(51 /* SyntaxKind.BarToken */)); + fullSymbolDisplayParts.push(ts.spacePart()); + } + }); + fullSymbolDisplayParts.push(ts.punctuationPart(23 /* SyntaxKind.CloseBracketToken */)); + } + else { + fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay, enclosingDeclaration || sourceFile, /*meaning*/ undefined, 1 /* SymbolFormatFlags.WriteTypeParametersOrArguments */ | 2 /* SymbolFormatFlags.UseOnlyExternalAliasing */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + } ts.addRange(displayParts, fullSymbolDisplayParts); if (symbol.flags & 16777216 /* SymbolFlags.Optional */) { displayParts.push(ts.punctuationPart(57 /* SyntaxKind.QuestionToken */)); @@ -147968,16 +149004,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (declaration.kind === 215 /* SyntaxKind.FunctionExpression */) { return true; } - if (declaration.kind !== 254 /* SyntaxKind.VariableDeclaration */ && declaration.kind !== 256 /* SyntaxKind.FunctionDeclaration */) { + if (declaration.kind !== 257 /* SyntaxKind.VariableDeclaration */ && declaration.kind !== 259 /* SyntaxKind.FunctionDeclaration */) { return false; } // If the parent is not sourceFile or module block it is local variable for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { // Reached source file or module block - if (parent.kind === 305 /* SyntaxKind.SourceFile */ || parent.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ || parent.kind === 265 /* SyntaxKind.ModuleBlock */) { return false; } } @@ -148282,10 +149318,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 285 /* SyntaxKind.JsxAttribute */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 288 /* SyntaxKind.JsxAttribute */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: // May parse an identifier like `module-layout`; that will be scanned as a keyword at first, but we should parse the whole thing to get an identifier. return ts.isKeyword(node.kind) || node.kind === 79 /* SyntaxKind.Identifier */; } @@ -148478,7 +149514,7 @@ var ts; (function (formatting) { function getAllRules() { var allTokens = []; - for (var token = 0 /* SyntaxKind.FirstToken */; token <= 160 /* SyntaxKind.LastToken */; token++) { + for (var token = 0 /* SyntaxKind.FirstToken */; token <= 162 /* SyntaxKind.LastToken */; token++) { if (token !== 1 /* SyntaxKind.EndOfFileToken */) { allTokens.push(token); } @@ -148493,9 +149529,9 @@ var ts; var anyToken = { tokens: allTokens, isSpecific: false }; var anyTokenIncludingMultilineComments = tokenRangeFrom(__spreadArray(__spreadArray([], allTokens, true), [3 /* SyntaxKind.MultiLineCommentTrivia */], false)); var anyTokenIncludingEOF = tokenRangeFrom(__spreadArray(__spreadArray([], allTokens, true), [1 /* SyntaxKind.EndOfFileToken */], false)); - var keywords = tokenRangeFromRange(81 /* SyntaxKind.FirstKeyword */, 160 /* SyntaxKind.LastKeyword */); + var keywords = tokenRangeFromRange(81 /* SyntaxKind.FirstKeyword */, 162 /* SyntaxKind.LastKeyword */); var binaryOperators = tokenRangeFromRange(29 /* SyntaxKind.FirstBinaryOperator */, 78 /* SyntaxKind.LastBinaryOperator */); - var binaryKeywordOperators = [101 /* SyntaxKind.InKeyword */, 102 /* SyntaxKind.InstanceOfKeyword */, 160 /* SyntaxKind.OfKeyword */, 127 /* SyntaxKind.AsKeyword */, 139 /* SyntaxKind.IsKeyword */]; + var binaryKeywordOperators = [101 /* SyntaxKind.InKeyword */, 102 /* SyntaxKind.InstanceOfKeyword */, 162 /* SyntaxKind.OfKeyword */, 128 /* SyntaxKind.AsKeyword */, 140 /* SyntaxKind.IsKeyword */]; var unaryPrefixOperators = [45 /* SyntaxKind.PlusPlusToken */, 46 /* SyntaxKind.MinusMinusToken */, 54 /* SyntaxKind.TildeToken */, 53 /* SyntaxKind.ExclamationToken */]; var unaryPrefixExpressions = [ 8 /* SyntaxKind.NumericLiteral */, 9 /* SyntaxKind.BigIntLiteral */, 79 /* SyntaxKind.Identifier */, 20 /* SyntaxKind.OpenParenToken */, @@ -148526,7 +149562,7 @@ var ts; rule("SpaceAfterQuestionMarkInConditionalOperator", 57 /* SyntaxKind.QuestionToken */, anyToken, [isNonJsxSameLineTokenContext, isConditionalOperatorContext], 4 /* RuleAction.InsertSpace */), // in other cases there should be no space between '?' and next token rule("NoSpaceAfterQuestionMark", 57 /* SyntaxKind.QuestionToken */, anyToken, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), - rule("NoSpaceBeforeDot", anyToken, [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceBeforeDot", anyToken, [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], [isNonJsxSameLineTokenContext, isNotPropertyAccessOnIntegerLiteral], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceAfterDot", [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], anyToken, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceBetweenImportParenInImportType", 100 /* SyntaxKind.ImportKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext, isImportTypeContext], 16 /* RuleAction.DeleteSpace */), // Special handling of unary operators. @@ -148569,11 +149605,11 @@ var ts; // Though, we do extra check on the context to make sure we are dealing with get/set node. Example: // get x() {} // set x(val) {} - rule("SpaceAfterGetSetInMember", [136 /* SyntaxKind.GetKeyword */, 149 /* SyntaxKind.SetKeyword */], 79 /* SyntaxKind.Identifier */, [isFunctionDeclContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceAfterGetSetInMember", [137 /* SyntaxKind.GetKeyword */, 151 /* SyntaxKind.SetKeyword */], 79 /* SyntaxKind.Identifier */, [isFunctionDeclContext], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBetweenYieldKeywordAndStar", 125 /* SyntaxKind.YieldKeyword */, 41 /* SyntaxKind.AsteriskToken */, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 16 /* RuleAction.DeleteSpace */), rule("SpaceBetweenYieldOrYieldStarAndOperand", [125 /* SyntaxKind.YieldKeyword */, 41 /* SyntaxKind.AsteriskToken */], anyToken, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBetweenReturnAndSemicolon", 105 /* SyntaxKind.ReturnKeyword */, 26 /* SyntaxKind.SemicolonToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), - rule("SpaceAfterCertainKeywords", [113 /* SyntaxKind.VarKeyword */, 109 /* SyntaxKind.ThrowKeyword */, 103 /* SyntaxKind.NewKeyword */, 89 /* SyntaxKind.DeleteKeyword */, 105 /* SyntaxKind.ReturnKeyword */, 112 /* SyntaxKind.TypeOfKeyword */, 132 /* SyntaxKind.AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceAfterCertainKeywords", [113 /* SyntaxKind.VarKeyword */, 109 /* SyntaxKind.ThrowKeyword */, 103 /* SyntaxKind.NewKeyword */, 89 /* SyntaxKind.DeleteKeyword */, 105 /* SyntaxKind.ReturnKeyword */, 112 /* SyntaxKind.TypeOfKeyword */, 133 /* SyntaxKind.AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), rule("SpaceAfterLetConstInVariableDeclaration", [119 /* SyntaxKind.LetKeyword */, 85 /* SyntaxKind.ConstKeyword */], anyToken, [isNonJsxSameLineTokenContext, isStartOfVariableDeclarationList], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBeforeOpenParenInFuncCall", anyToken, 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext, isFunctionCallOrNewContext, isPreviousTokenNotComma], 16 /* RuleAction.DeleteSpace */), // Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options. @@ -148581,8 +149617,8 @@ var ts; rule("SpaceAfterBinaryKeywordOperator", binaryKeywordOperators, anyToken, [isNonJsxSameLineTokenContext, isBinaryOpContext], 4 /* RuleAction.InsertSpace */), rule("SpaceAfterVoidOperator", 114 /* SyntaxKind.VoidKeyword */, anyToken, [isNonJsxSameLineTokenContext, isVoidOpContext], 4 /* RuleAction.InsertSpace */), // Async-await - rule("SpaceBetweenAsyncAndOpenParen", 131 /* SyntaxKind.AsyncKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("SpaceBetweenAsyncAndFunctionKeyword", 131 /* SyntaxKind.AsyncKeyword */, [98 /* SyntaxKind.FunctionKeyword */, 79 /* SyntaxKind.Identifier */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenAsyncAndOpenParen", 132 /* SyntaxKind.AsyncKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenAsyncAndFunctionKeyword", 132 /* SyntaxKind.AsyncKeyword */, [98 /* SyntaxKind.FunctionKeyword */, 79 /* SyntaxKind.Identifier */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Template string rule("NoSpaceBetweenTagAndTemplateString", [79 /* SyntaxKind.Identifier */, 21 /* SyntaxKind.CloseParenToken */], [14 /* SyntaxKind.NoSubstitutionTemplateLiteral */, 15 /* SyntaxKind.TemplateHead */], [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // JSX opening elements @@ -148593,34 +149629,35 @@ var ts; rule("NoSpaceAfterEqualInJsxAttribute", 63 /* SyntaxKind.EqualsToken */, anyToken, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // TypeScript-specific rules // Use of module as a function call. e.g.: import m2 = module("m2"); - rule("NoSpaceAfterModuleImport", [141 /* SyntaxKind.ModuleKeyword */, 146 /* SyntaxKind.RequireKeyword */], 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceAfterModuleImport", [142 /* SyntaxKind.ModuleKeyword */, 147 /* SyntaxKind.RequireKeyword */], 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // Add a space around certain TypeScript keywords rule("SpaceAfterCertainTypeScriptKeywords", [ 126 /* SyntaxKind.AbstractKeyword */, + 127 /* SyntaxKind.AccessorKeyword */, 84 /* SyntaxKind.ClassKeyword */, - 135 /* SyntaxKind.DeclareKeyword */, + 136 /* SyntaxKind.DeclareKeyword */, 88 /* SyntaxKind.DefaultKeyword */, 92 /* SyntaxKind.EnumKeyword */, 93 /* SyntaxKind.ExportKeyword */, 94 /* SyntaxKind.ExtendsKeyword */, - 136 /* SyntaxKind.GetKeyword */, + 137 /* SyntaxKind.GetKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 100 /* SyntaxKind.ImportKeyword */, 118 /* SyntaxKind.InterfaceKeyword */, - 141 /* SyntaxKind.ModuleKeyword */, - 142 /* SyntaxKind.NamespaceKeyword */, + 142 /* SyntaxKind.ModuleKeyword */, + 143 /* SyntaxKind.NamespaceKeyword */, 121 /* SyntaxKind.PrivateKeyword */, 123 /* SyntaxKind.PublicKeyword */, 122 /* SyntaxKind.ProtectedKeyword */, - 145 /* SyntaxKind.ReadonlyKeyword */, - 149 /* SyntaxKind.SetKeyword */, + 146 /* SyntaxKind.ReadonlyKeyword */, + 151 /* SyntaxKind.SetKeyword */, 124 /* SyntaxKind.StaticKeyword */, - 152 /* SyntaxKind.TypeKeyword */, - 156 /* SyntaxKind.FromKeyword */, - 140 /* SyntaxKind.KeyOfKeyword */, - 137 /* SyntaxKind.InferKeyword */, + 154 /* SyntaxKind.TypeKeyword */, + 158 /* SyntaxKind.FromKeyword */, + 141 /* SyntaxKind.KeyOfKeyword */, + 138 /* SyntaxKind.InferKeyword */, ], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [94 /* SyntaxKind.ExtendsKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 156 /* SyntaxKind.FromKeyword */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [94 /* SyntaxKind.ExtendsKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 158 /* SyntaxKind.FromKeyword */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { rule("SpaceAfterModuleName", 10 /* SyntaxKind.StringLiteral */, 18 /* SyntaxKind.OpenBraceToken */, [isModuleDeclContext], 4 /* RuleAction.InsertSpace */), // Lambda expressions @@ -148651,8 +149688,8 @@ var ts; 123 /* SyntaxKind.PublicKeyword */, 121 /* SyntaxKind.PrivateKeyword */, 122 /* SyntaxKind.ProtectedKeyword */, - 136 /* SyntaxKind.GetKeyword */, - 149 /* SyntaxKind.SetKeyword */, + 137 /* SyntaxKind.GetKeyword */, + 151 /* SyntaxKind.SetKeyword */, 22 /* SyntaxKind.OpenBracketToken */, 41 /* SyntaxKind.AsteriskToken */, ], [isEndOfDecoratorContextOnSameLine], 4 /* RuleAction.InsertSpace */), @@ -148663,8 +149700,8 @@ var ts; // These rules are applied after high priority var userConfigurableRules = [ // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses - rule("SpaceAfterConstructor", 134 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("NoSpaceAfterConstructor", 134 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("SpaceAfterConstructor", 135 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("NoSpaceAfterConstructor", 135 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("SpaceAfterComma", 27 /* SyntaxKind.CommaToken */, anyToken, [isOptionEnabled("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNextTokenNotCloseBracket, isNextTokenNotCloseParen], 4 /* RuleAction.InsertSpace */), rule("NoSpaceAfterComma", 27 /* SyntaxKind.CommaToken */, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext], 16 /* RuleAction.DeleteSpace */), // Insert space after function keyword for anonymous functions @@ -148738,11 +149775,11 @@ var ts; rule("SpaceBeforeOpenBraceInTypeScriptDeclWithBlock", typeScriptOpenBraceLeftTokenRange, 18 /* SyntaxKind.OpenBraceToken */, [isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForFunctions"), isTypeScriptDeclWithBlockContext, isNotFormatOnEnter, isSameLineTokenOrBeforeBlockContext], 4 /* RuleAction.InsertSpace */, 1 /* RuleFlags.CanDeleteNewLines */), rule("NoSpaceBeforeComma", anyToken, 27 /* SyntaxKind.CommaToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // No space before and after indexer `x[]` - rule("NoSpaceBeforeOpenBracket", anyTokenExcept(131 /* SyntaxKind.AsyncKeyword */, 82 /* SyntaxKind.CaseKeyword */), 22 /* SyntaxKind.OpenBracketToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceBeforeOpenBracket", anyTokenExcept(132 /* SyntaxKind.AsyncKeyword */, 82 /* SyntaxKind.CaseKeyword */), 22 /* SyntaxKind.OpenBracketToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceAfterCloseBracket", 23 /* SyntaxKind.CloseBracketToken */, anyToken, [isNonJsxSameLineTokenContext, isNotBeforeBlockInFunctionDeclarationContext], 16 /* RuleAction.DeleteSpace */), rule("SpaceAfterSemicolon", 26 /* SyntaxKind.SemicolonToken */, anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Remove extra space between for and await - rule("SpaceBetweenForAndAwaitKeyword", 97 /* SyntaxKind.ForKeyword */, 132 /* SyntaxKind.AwaitKeyword */, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenForAndAwaitKeyword", 97 /* SyntaxKind.ForKeyword */, 133 /* SyntaxKind.AwaitKeyword */, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Add a space between statements. All keywords except (do,else,case) has open/close parens after them. // So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any] rule("SpaceBetweenStatements", [21 /* SyntaxKind.CloseParenToken */, 90 /* SyntaxKind.DoKeyword */, 91 /* SyntaxKind.ElseKeyword */, 82 /* SyntaxKind.CaseKeyword */], anyToken, [isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNotForContext], 4 /* RuleAction.InsertSpace */), @@ -148791,69 +149828,70 @@ var ts; return function (context) { return context.options && context.options[optionName] === optionValue; }; } function isOptionEnabled(optionName) { - return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !!context.options[optionName]; }; + return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !!context.options[optionName]; }; } function isOptionDisabled(optionName) { - return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !context.options[optionName]; }; + return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !context.options[optionName]; }; } function isOptionDisabledOrUndefined(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName]; }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName]; }; } function isOptionDisabledOrUndefinedOrTokensOnSameLine(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); }; } function isOptionEnabledOrUndefined(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName]; }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !!context.options[optionName]; }; } function isForContext(context) { - return context.contextNode.kind === 242 /* SyntaxKind.ForStatement */; + return context.contextNode.kind === 245 /* SyntaxKind.ForStatement */; } function isNotForContext(context) { return !isForContext(context); } function isBinaryOpContext(context) { switch (context.contextNode.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return context.contextNode.operatorToken.kind !== 27 /* SyntaxKind.CommaToken */; - case 222 /* SyntaxKind.ConditionalExpression */: - case 189 /* SyntaxKind.ConditionalType */: - case 229 /* SyntaxKind.AsExpression */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 177 /* SyntaxKind.TypePredicate */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 191 /* SyntaxKind.ConditionalType */: + case 231 /* SyntaxKind.AsExpression */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 179 /* SyntaxKind.TypePredicate */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 235 /* SyntaxKind.SatisfiesExpression */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: // equals in type X = ... // falls through - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // equal in import a = module('a'); // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // equal in export = 1 // falls through - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: // equal in let a = 0 // falls through - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: // equal in p = 0 // falls through - case 164 /* SyntaxKind.Parameter */: - case 299 /* SyntaxKind.EnumMember */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 302 /* SyntaxKind.EnumMember */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return context.currentTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */ || context.nextTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */; // "in" keyword in for (let x in []) { } - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: // "in" keyword in [P in keyof T]: T[P] // falls through - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return context.currentTokenSpan.kind === 101 /* SyntaxKind.InKeyword */ || context.nextTokenSpan.kind === 101 /* SyntaxKind.InKeyword */ || context.currentTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */ || context.nextTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 244 /* SyntaxKind.ForOfStatement */: - return context.currentTokenSpan.kind === 160 /* SyntaxKind.OfKeyword */ || context.nextTokenSpan.kind === 160 /* SyntaxKind.OfKeyword */; + case 247 /* SyntaxKind.ForOfStatement */: + return context.currentTokenSpan.kind === 162 /* SyntaxKind.OfKeyword */ || context.nextTokenSpan.kind === 162 /* SyntaxKind.OfKeyword */; } return false; } @@ -148865,22 +149903,22 @@ var ts; } function isTypeAnnotationContext(context) { var contextKind = context.contextNode.kind; - return contextKind === 167 /* SyntaxKind.PropertyDeclaration */ || - contextKind === 166 /* SyntaxKind.PropertySignature */ || - contextKind === 164 /* SyntaxKind.Parameter */ || - contextKind === 254 /* SyntaxKind.VariableDeclaration */ || + return contextKind === 169 /* SyntaxKind.PropertyDeclaration */ || + contextKind === 168 /* SyntaxKind.PropertySignature */ || + contextKind === 166 /* SyntaxKind.Parameter */ || + contextKind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isFunctionLikeKind(contextKind); } function isConditionalOperatorContext(context) { - return context.contextNode.kind === 222 /* SyntaxKind.ConditionalExpression */ || - context.contextNode.kind === 189 /* SyntaxKind.ConditionalType */; + return context.contextNode.kind === 224 /* SyntaxKind.ConditionalExpression */ || + context.contextNode.kind === 191 /* SyntaxKind.ConditionalType */; } function isSameLineTokenOrBeforeBlockContext(context) { return context.TokensAreOnSameLine() || isBeforeBlockContext(context); } function isBraceWrappedContext(context) { - return context.contextNode.kind === 201 /* SyntaxKind.ObjectBindingPattern */ || - context.contextNode.kind === 195 /* SyntaxKind.MappedType */ || + return context.contextNode.kind === 203 /* SyntaxKind.ObjectBindingPattern */ || + context.contextNode.kind === 197 /* SyntaxKind.MappedType */ || isSingleLineBlockContext(context); } // This check is done before an open brace in a control construct, a function, or a typescript block declaration @@ -148906,34 +149944,34 @@ var ts; return true; } switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 265 /* SyntaxKind.ModuleBlock */: return true; } return false; } function isFunctionDeclContext(context) { switch (context.contextNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: // case SyntaxKind.MemberFunctionDeclaration: // falls through - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // case SyntaxKind.MethodSignature: // falls through - case 174 /* SyntaxKind.CallSignature */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 214 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 216 /* SyntaxKind.ArrowFunction */: // case SyntaxKind.ConstructorDeclaration: // case SyntaxKind.SimpleArrowFunctionExpression: // case SyntaxKind.ParenthesizedArrowFunctionExpression: // falls through - case 258 /* SyntaxKind.InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one + case 261 /* SyntaxKind.InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one return true; } return false; @@ -148942,40 +149980,40 @@ var ts; return !isFunctionDeclContext(context); } function isFunctionDeclarationOrFunctionExpressionContext(context) { - return context.contextNode.kind === 256 /* SyntaxKind.FunctionDeclaration */ || context.contextNode.kind === 213 /* SyntaxKind.FunctionExpression */; + return context.contextNode.kind === 259 /* SyntaxKind.FunctionDeclaration */ || context.contextNode.kind === 215 /* SyntaxKind.FunctionExpression */; } function isTypeScriptDeclWithBlockContext(context) { return nodeIsTypeScriptDeclWithBlockContext(context.contextNode); } function nodeIsTypeScriptDeclWithBlockContext(node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 273 /* SyntaxKind.NamedExports */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 269 /* SyntaxKind.NamedImports */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 276 /* SyntaxKind.NamedExports */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 272 /* SyntaxKind.NamedImports */: return true; } return false; } function isAfterCodeBlockContext(context) { switch (context.currentTokenParent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 292 /* SyntaxKind.CatchClause */: - case 262 /* SyntaxKind.ModuleBlock */: - case 249 /* SyntaxKind.SwitchStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 295 /* SyntaxKind.CatchClause */: + case 265 /* SyntaxKind.ModuleBlock */: + case 252 /* SyntaxKind.SwitchStatement */: return true; - case 235 /* SyntaxKind.Block */: { + case 238 /* SyntaxKind.Block */: { var blockParent = context.currentTokenParent.parent; // In a codefix scenario, we can't rely on parents being set. So just always return true. - if (!blockParent || blockParent.kind !== 214 /* SyntaxKind.ArrowFunction */ && blockParent.kind !== 213 /* SyntaxKind.FunctionExpression */) { + if (!blockParent || blockParent.kind !== 216 /* SyntaxKind.ArrowFunction */ && blockParent.kind !== 215 /* SyntaxKind.FunctionExpression */) { return true; } } @@ -148984,32 +150022,32 @@ var ts; } function isControlDeclContext(context) { switch (context.contextNode.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 248 /* SyntaxKind.WithStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 251 /* SyntaxKind.WithStatement */: // TODO // case SyntaxKind.ElseClause: // falls through - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return true; default: return false; } } function isObjectContext(context) { - return context.contextNode.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return context.contextNode.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } function isFunctionCallContext(context) { - return context.contextNode.kind === 208 /* SyntaxKind.CallExpression */; + return context.contextNode.kind === 210 /* SyntaxKind.CallExpression */; } function isNewContext(context) { - return context.contextNode.kind === 209 /* SyntaxKind.NewExpression */; + return context.contextNode.kind === 211 /* SyntaxKind.NewExpression */; } function isFunctionCallOrNewContext(context) { return isFunctionCallContext(context) || isNewContext(context); @@ -149024,10 +150062,10 @@ var ts; return context.nextTokenSpan.kind !== 21 /* SyntaxKind.CloseParenToken */; } function isArrowFunctionContext(context) { - return context.contextNode.kind === 214 /* SyntaxKind.ArrowFunction */; + return context.contextNode.kind === 216 /* SyntaxKind.ArrowFunction */; } function isImportTypeContext(context) { - return context.contextNode.kind === 200 /* SyntaxKind.ImportType */; + return context.contextNode.kind === 202 /* SyntaxKind.ImportType */; } function isNonJsxSameLineTokenContext(context) { return context.TokensAreOnSameLine() && context.contextNode.kind !== 11 /* SyntaxKind.JsxText */; @@ -149036,19 +150074,19 @@ var ts; return context.contextNode.kind !== 11 /* SyntaxKind.JsxText */; } function isNonJsxElementOrFragmentContext(context) { - return context.contextNode.kind !== 278 /* SyntaxKind.JsxElement */ && context.contextNode.kind !== 282 /* SyntaxKind.JsxFragment */; + return context.contextNode.kind !== 281 /* SyntaxKind.JsxElement */ && context.contextNode.kind !== 285 /* SyntaxKind.JsxFragment */; } function isJsxExpressionContext(context) { - return context.contextNode.kind === 288 /* SyntaxKind.JsxExpression */ || context.contextNode.kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return context.contextNode.kind === 291 /* SyntaxKind.JsxExpression */ || context.contextNode.kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } function isNextTokenParentJsxAttribute(context) { - return context.nextTokenParent.kind === 285 /* SyntaxKind.JsxAttribute */; + return context.nextTokenParent.kind === 288 /* SyntaxKind.JsxAttribute */; } function isJsxAttributeContext(context) { - return context.contextNode.kind === 285 /* SyntaxKind.JsxAttribute */; + return context.contextNode.kind === 288 /* SyntaxKind.JsxAttribute */; } function isJsxSelfClosingElementContext(context) { - return context.contextNode.kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return context.contextNode.kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } function isNotBeforeBlockInFunctionDeclarationContext(context) { return !isFunctionDeclContext(context) && !isBeforeBlockContext(context); @@ -149063,45 +150101,45 @@ var ts; while (ts.isExpressionNode(node)) { node = node.parent; } - return node.kind === 165 /* SyntaxKind.Decorator */; + return node.kind === 167 /* SyntaxKind.Decorator */; } function isStartOfVariableDeclarationList(context) { - return context.currentTokenParent.kind === 255 /* SyntaxKind.VariableDeclarationList */ && + return context.currentTokenParent.kind === 258 /* SyntaxKind.VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; } function isNotFormatOnEnter(context) { return context.formattingRequestKind !== 2 /* FormattingRequestKind.FormatOnEnter */; } function isModuleDeclContext(context) { - return context.contextNode.kind === 261 /* SyntaxKind.ModuleDeclaration */; + return context.contextNode.kind === 264 /* SyntaxKind.ModuleDeclaration */; } function isObjectTypeContext(context) { - return context.contextNode.kind === 182 /* SyntaxKind.TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; + return context.contextNode.kind === 184 /* SyntaxKind.TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; } function isConstructorSignatureContext(context) { - return context.contextNode.kind === 175 /* SyntaxKind.ConstructSignature */; + return context.contextNode.kind === 177 /* SyntaxKind.ConstructSignature */; } function isTypeArgumentOrParameterOrAssertion(token, parent) { if (token.kind !== 29 /* SyntaxKind.LessThanToken */ && token.kind !== 31 /* SyntaxKind.GreaterThanToken */) { return false; } switch (parent.kind) { - case 178 /* SyntaxKind.TypeReference */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return true; default: return false; @@ -149112,28 +150150,28 @@ var ts; isTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); } function isTypeAssertionContext(context) { - return context.contextNode.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return context.contextNode.kind === 213 /* SyntaxKind.TypeAssertionExpression */; } function isVoidOpContext(context) { - return context.currentTokenSpan.kind === 114 /* SyntaxKind.VoidKeyword */ && context.currentTokenParent.kind === 217 /* SyntaxKind.VoidExpression */; + return context.currentTokenSpan.kind === 114 /* SyntaxKind.VoidKeyword */ && context.currentTokenParent.kind === 219 /* SyntaxKind.VoidExpression */; } function isYieldOrYieldStarWithOperand(context) { - return context.contextNode.kind === 224 /* SyntaxKind.YieldExpression */ && context.contextNode.expression !== undefined; + return context.contextNode.kind === 226 /* SyntaxKind.YieldExpression */ && context.contextNode.expression !== undefined; } function isNonNullAssertionContext(context) { - return context.contextNode.kind === 230 /* SyntaxKind.NonNullExpression */; + return context.contextNode.kind === 232 /* SyntaxKind.NonNullExpression */; } function isNotStatementConditionContext(context) { return !isStatementConditionContext(context); } function isStatementConditionContext(context) { switch (context.contextNode.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return true; default: return false; @@ -149158,12 +150196,12 @@ var ts; return nextTokenKind === 19 /* SyntaxKind.CloseBraceToken */ || nextTokenKind === 1 /* SyntaxKind.EndOfFileToken */; } - if (nextTokenKind === 234 /* SyntaxKind.SemicolonClassElement */ || + if (nextTokenKind === 237 /* SyntaxKind.SemicolonClassElement */ || nextTokenKind === 26 /* SyntaxKind.SemicolonToken */) { return false; } - if (context.contextNode.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - context.contextNode.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + if (context.contextNode.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + context.contextNode.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { // Can’t remove semicolon after `foo`; it would parse as a method declaration: // // interface I { @@ -149177,9 +150215,9 @@ var ts; if (ts.isPropertyDeclaration(context.currentTokenParent)) { return !context.currentTokenParent.initializer; } - return context.currentTokenParent.kind !== 242 /* SyntaxKind.ForStatement */ - && context.currentTokenParent.kind !== 236 /* SyntaxKind.EmptyStatement */ - && context.currentTokenParent.kind !== 234 /* SyntaxKind.SemicolonClassElement */ + return context.currentTokenParent.kind !== 245 /* SyntaxKind.ForStatement */ + && context.currentTokenParent.kind !== 239 /* SyntaxKind.EmptyStatement */ + && context.currentTokenParent.kind !== 237 /* SyntaxKind.SemicolonClassElement */ && nextTokenKind !== 22 /* SyntaxKind.OpenBracketToken */ && nextTokenKind !== 20 /* SyntaxKind.OpenParenToken */ && nextTokenKind !== 39 /* SyntaxKind.PlusToken */ @@ -149187,7 +150225,7 @@ var ts; && nextTokenKind !== 43 /* SyntaxKind.SlashToken */ && nextTokenKind !== 13 /* SyntaxKind.RegularExpressionLiteral */ && nextTokenKind !== 27 /* SyntaxKind.CommaToken */ - && nextTokenKind !== 223 /* SyntaxKind.TemplateExpression */ + && nextTokenKind !== 225 /* SyntaxKind.TemplateExpression */ && nextTokenKind !== 15 /* SyntaxKind.TemplateHead */ && nextTokenKind !== 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */ && nextTokenKind !== 24 /* SyntaxKind.DotToken */; @@ -149195,6 +150233,11 @@ var ts; function isSemicolonInsertionContext(context) { return ts.positionIsASICandidate(context.currentTokenSpan.end, context.currentTokenParent, context.sourceFile); } + function isNotPropertyAccessOnIntegerLiteral(context) { + return !ts.isPropertyAccessExpression(context.contextNode) + || !ts.isNumericLiteral(context.contextNode.expression) + || context.contextNode.expression.getText().indexOf(".") !== -1; + } })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); /* @internal */ @@ -149278,12 +150321,12 @@ var ts; return map; } function getRuleBucketIndex(row, column) { - ts.Debug.assert(row <= 160 /* SyntaxKind.LastKeyword */ && column <= 160 /* SyntaxKind.LastKeyword */, "Must compute formatting context from tokens"); + ts.Debug.assert(row <= 162 /* SyntaxKind.LastKeyword */ && column <= 162 /* SyntaxKind.LastKeyword */, "Must compute formatting context from tokens"); return (row * mapRowLength) + column; } var maskBitSize = 5; var mask = 31; // MaskBitSize bits - var mapRowLength = 160 /* SyntaxKind.LastToken */ + 1; + var mapRowLength = 162 /* SyntaxKind.LastToken */ + 1; var RulesPosition; (function (RulesPosition) { RulesPosition[RulesPosition["StopRulesSpecific"] = 0] = "StopRulesSpecific"; @@ -149471,17 +150514,17 @@ var ts; // i.e. parent is class declaration with the list of members and node is one of members. function isListElement(parent, node) { switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var body = parent.body; - return !!body && body.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.rangeContainsRange(body.statements, node); - case 305 /* SyntaxKind.SourceFile */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + return !!body && body.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.rangeContainsRange(body.statements, node); + case 308 /* SyntaxKind.SourceFile */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -149744,19 +150787,19 @@ var ts; return modifier.kind; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: return 84 /* SyntaxKind.ClassKeyword */; - case 258 /* SyntaxKind.InterfaceDeclaration */: return 118 /* SyntaxKind.InterfaceKeyword */; - case 256 /* SyntaxKind.FunctionDeclaration */: return 98 /* SyntaxKind.FunctionKeyword */; - case 260 /* SyntaxKind.EnumDeclaration */: return 260 /* SyntaxKind.EnumDeclaration */; - case 172 /* SyntaxKind.GetAccessor */: return 136 /* SyntaxKind.GetKeyword */; - case 173 /* SyntaxKind.SetAccessor */: return 149 /* SyntaxKind.SetKeyword */; - case 169 /* SyntaxKind.MethodDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return 84 /* SyntaxKind.ClassKeyword */; + case 261 /* SyntaxKind.InterfaceDeclaration */: return 118 /* SyntaxKind.InterfaceKeyword */; + case 259 /* SyntaxKind.FunctionDeclaration */: return 98 /* SyntaxKind.FunctionKeyword */; + case 263 /* SyntaxKind.EnumDeclaration */: return 263 /* SyntaxKind.EnumDeclaration */; + case 174 /* SyntaxKind.GetAccessor */: return 137 /* SyntaxKind.GetKeyword */; + case 175 /* SyntaxKind.SetAccessor */: return 151 /* SyntaxKind.SetKeyword */; + case 171 /* SyntaxKind.MethodDeclaration */: if (node.asteriskToken) { return 41 /* SyntaxKind.AsteriskToken */; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: var name = ts.getNameOfDeclaration(node); if (name) { return name.kind; @@ -149813,15 +150856,15 @@ var ts; case 43 /* SyntaxKind.SlashToken */: case 31 /* SyntaxKind.GreaterThanToken */: switch (container.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return false; } break; case 22 /* SyntaxKind.OpenBracketToken */: case 23 /* SyntaxKind.CloseBracketToken */: - if (container.kind !== 195 /* SyntaxKind.MappedType */) { + if (container.kind !== 197 /* SyntaxKind.MappedType */) { return false; } break; @@ -149925,11 +150968,11 @@ var ts; return inheritedIndentation; } } - var effectiveParentStartLine = child.kind === 165 /* SyntaxKind.Decorator */ ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 167 /* SyntaxKind.Decorator */ ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; - if (isFirstListItem && parent.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && inheritedIndentation === -1 /* Constants.Unknown */) { + if (isFirstListItem && parent.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && inheritedIndentation === -1 /* Constants.Unknown */) { inheritedIndentation = childIndentation.indentation; } return inheritedIndentation; @@ -150387,18 +151430,18 @@ var ts; formatting.getRangeOfEnclosingComment = getRangeOfEnclosingComment; function getOpenTokenForList(node, list) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 214 /* SyntaxKind.ArrowFunction */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: if (node.typeParameters === list) { return 29 /* SyntaxKind.LessThanToken */; } @@ -150406,8 +151449,8 @@ var ts; return 20 /* SyntaxKind.OpenParenToken */; } break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: if (node.typeArguments === list) { return 29 /* SyntaxKind.LessThanToken */; } @@ -150415,24 +151458,24 @@ var ts; return 20 /* SyntaxKind.OpenParenToken */; } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: if (node.typeParameters === list) { return 29 /* SyntaxKind.LessThanToken */; } break; - case 178 /* SyntaxKind.TypeReference */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 181 /* SyntaxKind.TypeQuery */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 200 /* SyntaxKind.ImportType */: + case 180 /* SyntaxKind.TypeReference */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 183 /* SyntaxKind.TypeQuery */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 202 /* SyntaxKind.ImportType */: if (node.typeArguments === list) { return 29 /* SyntaxKind.LessThanToken */; } break; - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return 18 /* SyntaxKind.OpenBraceToken */; } return 0 /* SyntaxKind.Unknown */; @@ -150568,11 +151611,11 @@ var ts; // y: undefined, // } // ``` - var isObjectLiteral = currentToken.kind === 18 /* SyntaxKind.OpenBraceToken */ && currentToken.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + var isObjectLiteral = currentToken.kind === 18 /* SyntaxKind.OpenBraceToken */ && currentToken.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; if (options.indentStyle === ts.IndentStyle.Block || isObjectLiteral) { return getBlockIndent(sourceFile, position, options); } - if (precedingToken.kind === 27 /* SyntaxKind.CommaToken */ && precedingToken.parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (precedingToken.kind === 27 /* SyntaxKind.CommaToken */ && precedingToken.parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1 /* Value.Unknown */) { @@ -150582,7 +151625,7 @@ var ts; var containerList = getListByPosition(position, precedingToken.parent, sourceFile); // use list position if the preceding token is before any list items if (containerList && !ts.rangeContainsRange(containerList, precedingToken)) { - var useTheSameBaseIndentation = [213 /* SyntaxKind.FunctionExpression */, 214 /* SyntaxKind.ArrowFunction */].indexOf(currentToken.parent.kind) !== -1; + var useTheSameBaseIndentation = [215 /* SyntaxKind.FunctionExpression */, 216 /* SyntaxKind.ArrowFunction */].indexOf(currentToken.parent.kind) !== -1; var indentSize = useTheSameBaseIndentation ? 0 : options.indentSize; return getActualIndentationForListStartLine(containerList, sourceFile, options) + indentSize; // TODO: GH#18217 } @@ -150747,7 +151790,7 @@ var ts; // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually // - parent and child are not on the same line var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && - (parent.kind === 305 /* SyntaxKind.SourceFile */ || !parentAndChildShareLine); + (parent.kind === 308 /* SyntaxKind.SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Value.Unknown */; } @@ -150795,7 +151838,7 @@ var ts; } SmartIndenter.isArgumentAndStartLineOverlapsExpressionBeingCalled = isArgumentAndStartLineOverlapsExpressionBeingCalled; function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 239 /* SyntaxKind.IfStatement */ && parent.elseStatement === child) { + if (parent.kind === 242 /* SyntaxKind.IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 91 /* SyntaxKind.ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -150876,42 +151919,42 @@ var ts; } function getListByRange(start, end, node, sourceFile) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return getList(node.typeArguments); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return getList(node.properties); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getList(node.elements); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return getList(node.members); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 171 /* SyntaxKind.Constructor */: - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 173 /* SyntaxKind.Constructor */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return getList(node.typeParameters) || getList(node.parameters); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return getList(node.parameters); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return getList(node.typeParameters); - case 209 /* SyntaxKind.NewExpression */: - case 208 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: return getList(node.typeArguments) || getList(node.arguments); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return getList(node.declarations); - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return getList(node.elements); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return getList(node.elements); } function getList(list) { @@ -150934,7 +151977,7 @@ var ts; return findColumnForFirstNonWhitespaceCharacterInLine(sourceFile.getLineAndCharacterOfPosition(list.pos), sourceFile, options); } function getActualIndentationForListItem(node, sourceFile, options, listIndentsChild) { - if (node.parent && node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.parent && node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */) { // VariableDeclarationList has no wrapping tokens return -1 /* Value.Unknown */; } @@ -151007,96 +152050,96 @@ var ts; function nodeWillIndentChild(settings, parent, child, sourceFile, indentByDefault) { var childKind = child ? child.kind : 0 /* SyntaxKind.Unknown */; switch (parent.kind) { - case 238 /* SyntaxKind.ExpressionStatement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 182 /* SyntaxKind.TypeLiteral */: - case 195 /* SyntaxKind.MappedType */: - case 184 /* SyntaxKind.TupleType */: - case 263 /* SyntaxKind.CaseBlock */: - case 290 /* SyntaxKind.DefaultClause */: - case 289 /* SyntaxKind.CaseClause */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 237 /* SyntaxKind.VariableStatement */: - case 271 /* SyntaxKind.ExportAssignment */: - case 247 /* SyntaxKind.ReturnStatement */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 283 /* SyntaxKind.JsxOpeningFragment */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 288 /* SyntaxKind.JsxExpression */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 164 /* SyntaxKind.Parameter */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 273 /* SyntaxKind.NamedExports */: - case 269 /* SyntaxKind.NamedImports */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 184 /* SyntaxKind.TypeLiteral */: + case 197 /* SyntaxKind.MappedType */: + case 186 /* SyntaxKind.TupleType */: + case 266 /* SyntaxKind.CaseBlock */: + case 293 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 240 /* SyntaxKind.VariableStatement */: + case 274 /* SyntaxKind.ExportAssignment */: + case 250 /* SyntaxKind.ReturnStatement */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 286 /* SyntaxKind.JsxOpeningFragment */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 291 /* SyntaxKind.JsxExpression */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 166 /* SyntaxKind.Parameter */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 276 /* SyntaxKind.NamedExports */: + case 272 /* SyntaxKind.NamedImports */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: - if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 205 /* SyntaxKind.ObjectLiteralExpression */) { // TODO: GH#18217 + case 257 /* SyntaxKind.VariableDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: + if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // TODO: GH#18217 return rangeIsOnOneLine(sourceFile, child); } - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ && sourceFile && child && childKind === 278 /* SyntaxKind.JsxElement */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ && sourceFile && child && childKind === 281 /* SyntaxKind.JsxElement */) { var parentStartLine = sourceFile.getLineAndCharacterOfPosition(ts.skipTrivia(sourceFile.text, parent.pos)).line; var childStartLine = sourceFile.getLineAndCharacterOfPosition(ts.skipTrivia(sourceFile.text, child.pos)).line; return parentStartLine !== childStartLine; } - if (parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { return true; } break; - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return childKind !== 235 /* SyntaxKind.Block */; - case 214 /* SyntaxKind.ArrowFunction */: - if (sourceFile && childKind === 212 /* SyntaxKind.ParenthesizedExpression */) { + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return childKind !== 238 /* SyntaxKind.Block */; + case 216 /* SyntaxKind.ArrowFunction */: + if (sourceFile && childKind === 214 /* SyntaxKind.ParenthesizedExpression */) { return rangeIsOnOneLine(sourceFile, child); } - return childKind !== 235 /* SyntaxKind.Block */; - case 272 /* SyntaxKind.ExportDeclaration */: - return childKind !== 273 /* SyntaxKind.NamedExports */; - case 266 /* SyntaxKind.ImportDeclaration */: - return childKind !== 267 /* SyntaxKind.ImportClause */ || - (!!child.namedBindings && child.namedBindings.kind !== 269 /* SyntaxKind.NamedImports */); - case 278 /* SyntaxKind.JsxElement */: - return childKind !== 281 /* SyntaxKind.JsxClosingElement */; - case 282 /* SyntaxKind.JsxFragment */: - return childKind !== 284 /* SyntaxKind.JsxClosingFragment */; - case 188 /* SyntaxKind.IntersectionType */: - case 187 /* SyntaxKind.UnionType */: - if (childKind === 182 /* SyntaxKind.TypeLiteral */ || childKind === 184 /* SyntaxKind.TupleType */) { + return childKind !== 238 /* SyntaxKind.Block */; + case 275 /* SyntaxKind.ExportDeclaration */: + return childKind !== 276 /* SyntaxKind.NamedExports */; + case 269 /* SyntaxKind.ImportDeclaration */: + return childKind !== 270 /* SyntaxKind.ImportClause */ || + (!!child.namedBindings && child.namedBindings.kind !== 272 /* SyntaxKind.NamedImports */); + case 281 /* SyntaxKind.JsxElement */: + return childKind !== 284 /* SyntaxKind.JsxClosingElement */; + case 285 /* SyntaxKind.JsxFragment */: + return childKind !== 287 /* SyntaxKind.JsxClosingFragment */; + case 190 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + if (childKind === 184 /* SyntaxKind.TypeLiteral */ || childKind === 186 /* SyntaxKind.TupleType */) { return false; } break; @@ -151107,11 +152150,11 @@ var ts; SmartIndenter.nodeWillIndentChild = nodeWillIndentChild; function isControlFlowEndingStatement(kind, parent) { switch (kind) { - case 247 /* SyntaxKind.ReturnStatement */: - case 251 /* SyntaxKind.ThrowStatement */: - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: - return parent.kind !== 235 /* SyntaxKind.Block */; + case 250 /* SyntaxKind.ReturnStatement */: + case 254 /* SyntaxKind.ThrowStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + return parent.kind !== 238 /* SyntaxKind.Block */; default: return false; } @@ -151328,7 +152371,7 @@ var ts; * Checks if 'candidate' argument is a legal separator in the list that contains 'node' as an element */ function isSeparator(node, candidate) { - return !!candidate && !!node.parent && (candidate.kind === 27 /* SyntaxKind.CommaToken */ || (candidate.kind === 26 /* SyntaxKind.SemicolonToken */ && node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */)); + return !!candidate && !!node.parent && (candidate.kind === 27 /* SyntaxKind.CommaToken */ || (candidate.kind === 26 /* SyntaxKind.SemicolonToken */ && node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */)); } function isThisTypeAnnotatable(containingFunction) { return ts.isFunctionExpression(containingFunction) || ts.isFunctionDeclaration(containingFunction); @@ -151560,7 +152603,7 @@ var ts; } } else { - endNode = (_a = (node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? node.exclamationToken : node.questionToken)) !== null && _a !== void 0 ? _a : node.name; + endNode = (_a = (node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? node.exclamationToken : node.questionToken)) !== null && _a !== void 0 ? _a : node.name; } this.insertNodeAt(sourceFile, endNode.end, type, { prefix: ": " }); return true; @@ -151726,18 +152769,18 @@ var ts; }; ChangeTracker.prototype.getInsertNodeAfterOptionsWorker = function (node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return { prefix: this.newLineCharacter, suffix: this.newLineCharacter }; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: case 10 /* SyntaxKind.StringLiteral */: case 79 /* SyntaxKind.Identifier */: return { prefix: ", " }; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return { suffix: "," + this.newLineCharacter }; case 93 /* SyntaxKind.ExportKeyword */: return { prefix: " " }; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return {}; default: ts.Debug.assert(ts.isStatement(node) || ts.isClassOrTypeElement(node)); // Else we haven't handled this kind of node yet -- add it @@ -151746,7 +152789,7 @@ var ts; }; ChangeTracker.prototype.insertName = function (sourceFile, node, name) { ts.Debug.assert(!node.name); - if (node.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind === 216 /* SyntaxKind.ArrowFunction */) { var arrow = ts.findChildOfKind(node, 38 /* SyntaxKind.EqualsGreaterThanToken */, sourceFile); var lparen = ts.findChildOfKind(node, 20 /* SyntaxKind.OpenParenToken */, sourceFile); if (lparen) { @@ -151760,14 +152803,14 @@ var ts; // Replacing full range of arrow to get rid of the leading space -- replace ` =>` with `)` this.replaceRange(sourceFile, arrow, ts.factory.createToken(21 /* SyntaxKind.CloseParenToken */)); } - if (node.body.kind !== 235 /* SyntaxKind.Block */) { + if (node.body.kind !== 238 /* SyntaxKind.Block */) { // `() => 0` => `function f() { return 0; }` this.insertNodesAt(sourceFile, node.body.getStart(sourceFile), [ts.factory.createToken(18 /* SyntaxKind.OpenBraceToken */), ts.factory.createToken(105 /* SyntaxKind.ReturnKeyword */)], { joiner: " ", suffix: " " }); this.insertNodesAt(sourceFile, node.body.end, [ts.factory.createToken(26 /* SyntaxKind.SemicolonToken */), ts.factory.createToken(19 /* SyntaxKind.CloseBraceToken */)], { joiner: " " }); } } else { - var pos = ts.findChildOfKind(node, node.kind === 213 /* SyntaxKind.FunctionExpression */ ? 98 /* SyntaxKind.FunctionKeyword */ : 84 /* SyntaxKind.ClassKeyword */, sourceFile).end; + var pos = ts.findChildOfKind(node, node.kind === 215 /* SyntaxKind.FunctionExpression */ ? 98 /* SyntaxKind.FunctionKeyword */ : 84 /* SyntaxKind.ClassKeyword */, sourceFile).end; this.insertNodeAt(sourceFile, pos, ts.factory.createIdentifier(name), { prefix: " " }); } }; @@ -151944,10 +152987,10 @@ var ts; }()); textChanges_3.ChangeTracker = ChangeTracker; function updateJSDocHost(parent) { - if (parent.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (parent.kind !== 216 /* SyntaxKind.ArrowFunction */) { return parent; } - var jsDocNode = parent.parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ ? + var jsDocNode = parent.parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ ? parent.parent : parent.parent.parent; jsDocNode.jsDoc = parent.jsDoc; @@ -151959,16 +153002,16 @@ var ts; return undefined; } switch (oldTag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: { + case 343 /* SyntaxKind.JSDocParameterTag */: { var oldParam = oldTag; var newParam = newTag; return ts.isIdentifier(oldParam.name) && ts.isIdentifier(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText ? ts.factory.createJSDocParameterTag(/*tagName*/ undefined, newParam.name, /*isBracketed*/ false, newParam.typeExpression, newParam.isNameFirst, oldParam.comment) : undefined; } - case 341 /* SyntaxKind.JSDocReturnTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: return ts.factory.createJSDocReturnTag(/*tagName*/ undefined, newTag.typeExpression, oldTag.comment); - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return ts.factory.createJSDocTypeTag(/*tagName*/ undefined, newTag.typeExpression, oldTag.comment); } } @@ -152362,14 +153405,14 @@ var ts; } textChanges_3.isValidLocationToAddComment = isValidLocationToAddComment; function needSemicolonBetween(a, b) { - return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ || ts.isStatementButNotDeclaration(a) && ts.isStatementButNotDeclaration(b); // TODO: only if b would start with a `(` or `[` } var deleteDeclaration; (function (deleteDeclaration_1) { function deleteDeclaration(changes, deletedNodesInLists, sourceFile, node) { switch (node.kind) { - case 164 /* SyntaxKind.Parameter */: { + case 166 /* SyntaxKind.Parameter */: { var oldFunction = node.parent; if (ts.isArrowFunction(oldFunction) && oldFunction.parameters.length === 1 && @@ -152384,17 +153427,17 @@ var ts; } break; } - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: var isFirstImport = sourceFile.imports.length && node === ts.first(sourceFile.imports).parent || node === ts.find(sourceFile.statements, ts.isAnyImportSyntax); // For first import, leave header comment in place, otherwise only delete JSDoc comments deleteNode(changes, sourceFile, node, { leadingTriviaOption: isFirstImport ? LeadingTriviaOption.Exclude : ts.hasJSDocNodes(node) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine, }); break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: var pattern = node.parent; - var preserveComma = pattern.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && node !== ts.last(pattern.elements); + var preserveComma = pattern.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && node !== ts.last(pattern.elements); if (preserveComma) { deleteNode(changes, sourceFile, node); } @@ -152402,13 +153445,13 @@ var ts; deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node); break; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: var namedImports = node.parent; if (namedImports.elements.length === 1) { deleteImportBinding(changes, sourceFile, namedImports); @@ -152417,7 +153460,7 @@ var ts; deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: deleteImportBinding(changes, sourceFile, node); break; case 26 /* SyntaxKind.SemicolonToken */: @@ -152426,8 +153469,8 @@ var ts; case 98 /* SyntaxKind.FunctionKeyword */: deleteNode(changes, sourceFile, node, { leadingTriviaOption: LeadingTriviaOption.Exclude }); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: deleteNode(changes, sourceFile, node, { leadingTriviaOption: ts.hasJSDocNodes(node) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine }); break; default: @@ -152478,13 +153521,13 @@ var ts; // Delete the entire import declaration // |import * as ns from './file'| // |import { a } from './file'| - var importDecl = ts.getAncestor(node, 266 /* SyntaxKind.ImportDeclaration */); + var importDecl = ts.getAncestor(node, 269 /* SyntaxKind.ImportDeclaration */); deleteNode(changes, sourceFile, importDecl); } } function deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node) { var parent = node.parent; - if (parent.kind === 292 /* SyntaxKind.CatchClause */) { + if (parent.kind === 295 /* SyntaxKind.CatchClause */) { // TODO: There's currently no unused diagnostic for this, could be a suggestion changes.deleteNodeRange(sourceFile, ts.findChildOfKind(parent, 20 /* SyntaxKind.OpenParenToken */, sourceFile), ts.findChildOfKind(parent, 21 /* SyntaxKind.CloseParenToken */, sourceFile)); return; @@ -152495,14 +153538,14 @@ var ts; } var gp = parent.parent; switch (gp.kind) { - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: changes.replaceNode(sourceFile, node, ts.factory.createObjectLiteralExpression()); break; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: deleteNode(changes, sourceFile, parent); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: deleteNode(changes, sourceFile, gp, { leadingTriviaOption: ts.hasJSDocNodes(gp) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine }); break; default: @@ -152689,8 +153732,8 @@ var ts; }); function makeChange(changeTracker, sourceFile, assertion) { var replacement = ts.isAsExpression(assertion) - ? ts.factory.createAsExpression(assertion.expression, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)) - : ts.factory.createTypeAssertion(ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */), assertion.expression); + ? ts.factory.createAsExpression(assertion.expression, ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)) + : ts.factory.createTypeAssertion(ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */), assertion.expression); changeTracker.replaceNode(sourceFile, assertion.expression, replacement); } function getAssertion(sourceFile, pos) { @@ -152774,7 +153817,7 @@ var ts; } } fixedDeclarations === null || fixedDeclarations === void 0 ? void 0 : fixedDeclarations.add(ts.getNodeId(insertionSite)); - var cloneWithModifier = ts.factory.updateModifiers(ts.getSynthesizedDeepClone(insertionSite, /*includeTrivia*/ true), ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(ts.getSyntacticModifierFlags(insertionSite) | 256 /* ModifierFlags.Async */))); + var cloneWithModifier = ts.factory.updateModifiers(ts.getSynthesizedDeepClone(insertionSite, /*includeTrivia*/ true), ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(ts.getSyntacticModifierFlags(insertionSite) | 512 /* ModifierFlags.Async */))); changeTracker.replaceNode(sourceFile, insertionSite, cloneWithModifier); } function getFixableErrorSpanDeclaration(sourceFile, span) { @@ -152820,7 +153863,7 @@ var ts; ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type.code, ts.Diagnostics.Operator_0_cannot_be_applied_to_type_1.code, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2.code, - ts.Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap.code, + ts.Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap.code, ts.Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined.code, ts.Diagnostics.Type_0_is_not_an_array_type.code, ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type.code, @@ -152918,7 +153961,7 @@ var ts; } var declaration = ts.tryCast(symbol.valueDeclaration, ts.isVariableDeclaration); var variableName = declaration && ts.tryCast(declaration.name, ts.isIdentifier); - var variableStatement = ts.getAncestor(declaration, 237 /* SyntaxKind.VariableStatement */); + var variableStatement = ts.getAncestor(declaration, 240 /* SyntaxKind.VariableStatement */); if (!declaration || !variableStatement || declaration.type || !declaration.initializer || @@ -152996,10 +154039,10 @@ var ts; function isInsideAwaitableBody(node) { return node.kind & 32768 /* NodeFlags.AwaitContext */ || !!ts.findAncestor(node, function (ancestor) { return ancestor.parent && ts.isArrowFunction(ancestor.parent) && ancestor.parent.body === ancestor || - ts.isBlock(ancestor) && (ancestor.parent.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - ancestor.parent.kind === 213 /* SyntaxKind.FunctionExpression */ || - ancestor.parent.kind === 214 /* SyntaxKind.ArrowFunction */ || - ancestor.parent.kind === 169 /* SyntaxKind.MethodDeclaration */); + ts.isBlock(ancestor) && (ancestor.parent.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + ancestor.parent.kind === 215 /* SyntaxKind.FunctionExpression */ || + ancestor.parent.kind === 216 /* SyntaxKind.ArrowFunction */ || + ancestor.parent.kind === 171 /* SyntaxKind.MethodDeclaration */); }); } function makeChange(changeTracker, errorCode, sourceFile, checker, insertionSite, fixedDeclarations) { @@ -153118,10 +154161,10 @@ var ts; function isPossiblyPartOfDestructuring(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return true; default: return false; @@ -153136,7 +154179,7 @@ var ts; function isPossiblyPartOfCommaSeperatedInitializer(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: case 27 /* SyntaxKind.CommaToken */: return true; default: @@ -153185,9 +154228,9 @@ var ts; return; } var declaration = token.parent; - if (declaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + if (declaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ && (!fixedNodes || ts.tryAddToSet(fixedNodes, declaration))) { - changeTracker.insertModifierBefore(sourceFile, 135 /* SyntaxKind.DeclareKeyword */, declaration); + changeTracker.insertModifierBefore(sourceFile, 136 /* SyntaxKind.DeclareKeyword */, declaration); } } })(codefix = ts.codefix || (ts.codefix = {})); @@ -153341,7 +154384,7 @@ var ts; var add = toAdd_1[_i]; var d = add.valueDeclaration; if (d && (ts.isPropertySignature(d) || ts.isPropertyDeclaration(d)) && d.type) { - var t = ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], d.type.kind === 187 /* SyntaxKind.UnionType */ ? d.type.types : [d.type], true), [ + var t = ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], d.type.kind === 189 /* SyntaxKind.UnionType */ ? d.type.types : [d.type], true), [ ts.factory.createTypeReferenceNode("undefined") ], false)); changes.replaceNode(d.getSourceFile(), d.type, t); @@ -153421,26 +154464,26 @@ var ts; } function isDeclarationWithType(node) { return ts.isFunctionLikeDeclaration(node) || - node.kind === 254 /* SyntaxKind.VariableDeclaration */ || - node.kind === 166 /* SyntaxKind.PropertySignature */ || - node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + node.kind === 257 /* SyntaxKind.VariableDeclaration */ || + node.kind === 168 /* SyntaxKind.PropertySignature */ || + node.kind === 169 /* SyntaxKind.PropertyDeclaration */; } function transformJSDocType(node) { switch (node.kind) { - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return ts.factory.createTypeReferenceNode("any", ts.emptyArray); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return transformJSDocOptionalType(node); - case 315 /* SyntaxKind.JSDocNonNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: return transformJSDocType(node.type); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return transformJSDocNullableType(node); - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return transformJSDocVariadicType(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return transformJSDocFunctionType(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return transformJSDocTypeReference(node); default: var visited = ts.visitEachChild(node, transformJSDocType, ts.nullTransformationContext); @@ -153461,11 +154504,11 @@ var ts; var _a; // TODO: This does not properly handle `function(new:C, string)` per https://github.com/google/closure-compiler/wiki/Types-in-the-Closure-Type-System#the-javascript-type-language // however we do handle it correctly in `serializeTypeForDeclaration` in checker.ts - return ts.factory.createFunctionTypeNode(ts.emptyArray, node.parameters.map(transformJSDocParameter), (_a = node.type) !== null && _a !== void 0 ? _a : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + return ts.factory.createFunctionTypeNode(ts.emptyArray, node.parameters.map(transformJSDocParameter), (_a = node.type) !== null && _a !== void 0 ? _a : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } function transformJSDocParameter(node) { var index = node.parent.parameters.indexOf(node); - var isRest = node.type.kind === 318 /* SyntaxKind.JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217 + var isRest = node.type.kind === 321 /* SyntaxKind.JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217 var name = node.name || (isRest ? "rest" : "arg" + index); var dotdotdot = isRest ? ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */) : node.dotDotDotToken; return ts.factory.createParameterDeclaration(node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer); @@ -153504,8 +154547,8 @@ var ts; function transformJSDocIndexSignature(node) { var index = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, - /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */ ? "n" : "s", - /*questionToken*/ undefined, ts.factory.createTypeReferenceNode(node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */ ? "number" : "string", []), + /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */ ? "n" : "s", + /*questionToken*/ undefined, ts.factory.createTypeReferenceNode(node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */ ? "number" : "string", []), /*initializer*/ undefined); var indexSignature = ts.factory.createTypeLiteralNode([ts.factory.createIndexSignature(/*modifiers*/ undefined, [index], node.typeArguments[1])]); ts.setEmitFlags(indexSignature, 1 /* EmitFlags.SingleLine */); @@ -153540,8 +154583,8 @@ var ts; return undefined; } var ctorDeclaration = ctorSymbol.valueDeclaration; - if (ts.isFunctionDeclaration(ctorDeclaration)) { - changes.replaceNode(sourceFile, ctorDeclaration, createClassFromFunctionDeclaration(ctorDeclaration)); + if (ts.isFunctionDeclaration(ctorDeclaration) || ts.isFunctionExpression(ctorDeclaration)) { + changes.replaceNode(sourceFile, ctorDeclaration, createClassFromFunction(ctorDeclaration)); } else if (ts.isVariableDeclaration(ctorDeclaration)) { var classDeclaration = createClassFromVariableDeclaration(ctorDeclaration); @@ -153645,7 +154688,7 @@ var ts; return; } // delete the entire statement if this expression is the sole expression to take care of the semicolon at the end - var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ + var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ ? assignmentBinaryExpression.parent : assignmentBinaryExpression; changes.delete(sourceFile, nodeToDelete); if (!assignmentExpr) { @@ -153697,7 +154740,7 @@ var ts; return createArrowFunctionExpressionMember(members, expression, name); } function createFunctionExpressionMember(members, functionExpression, name) { - var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 131 /* SyntaxKind.AsyncKeyword */)); + var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 132 /* SyntaxKind.AsyncKeyword */)); var method = ts.factory.createMethodDeclaration(fullModifiers, /*asteriskToken*/ undefined, name, /*questionToken*/ undefined, /*typeParameters*/ undefined, functionExpression.parameters, /*type*/ undefined, functionExpression.body); ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile); @@ -153708,14 +154751,14 @@ var ts; var arrowFunctionBody = arrowFunction.body; var bodyBlock; // case 1: () => { return [1,2,3] } - if (arrowFunctionBody.kind === 235 /* SyntaxKind.Block */) { + if (arrowFunctionBody.kind === 238 /* SyntaxKind.Block */) { bodyBlock = arrowFunctionBody; } // case 2: () => [1,2,3] else { bodyBlock = ts.factory.createBlock([ts.factory.createReturnStatement(arrowFunctionBody)]); } - var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 131 /* SyntaxKind.AsyncKeyword */)); + var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 132 /* SyntaxKind.AsyncKeyword */)); var method = ts.factory.createMethodDeclaration(fullModifiers, /*asteriskToken*/ undefined, name, /*questionToken*/ undefined, /*typeParameters*/ undefined, arrowFunction.parameters, /*type*/ undefined, bodyBlock); ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile); @@ -153738,7 +154781,7 @@ var ts; // Don't call copyComments here because we'll already leave them in place return cls; } - function createClassFromFunctionDeclaration(node) { + function createClassFromFunction(node) { var memberElements = createClassElementsFromSymbol(ctorSymbol); if (node.body) { memberElements.unshift(ts.factory.createConstructorDeclaration(/*modifiers*/ undefined, node.parameters, node.body)); @@ -153828,7 +154871,7 @@ var ts; return; } var pos = ts.skipTrivia(sourceFile.text, ts.moveRangePastModifiers(functionToConvert).pos); - changes.insertModifierAt(sourceFile, pos, 131 /* SyntaxKind.AsyncKeyword */, { suffix: " " }); + changes.insertModifierAt(sourceFile, pos, 132 /* SyntaxKind.AsyncKeyword */, { suffix: " " }); var _loop_12 = function (returnStatement) { ts.forEachChild(returnStatement, function visit(node) { if (ts.isCallExpression(node)) { @@ -154234,7 +155277,7 @@ var ts; case 104 /* SyntaxKind.NullKeyword */: // do not produce a transformed statement for a null argument break; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: case 79 /* SyntaxKind.Identifier */: // identifier includes undefined if (!inputArgName) { // undefined was argument passed to promise handler @@ -154256,8 +155299,8 @@ var ts; continuationArgName.types.push(transformer.checker.getAwaitedType(returnType) || returnType); } return varDeclOrAssignment; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: { + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: { var funcBody = func.body; var returnType_1 = (_a = getLastCallSignature(transformer.checker.getTypeAtLocation(func), transformer.checker)) === null || _a === void 0 ? void 0 : _a.getReturnType(); // Arrow functions with block bodies { } will enter this control flow @@ -154426,7 +155469,7 @@ var ts; name = getMapEntryOrDefault(funcNode.name); } // return undefined argName when arg is null or undefined - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (!name || "identifier" in name && name.identifier.text === "undefined") { return undefined; } @@ -154535,10 +155578,10 @@ var ts; } var importNode = ts.importFromModuleSpecifier(moduleSpecifier); switch (importNode.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: changes.replaceNode(importingFile, importNode, ts.makeImport(importNode.name, /*namedImports*/ undefined, moduleSpecifier, quotePreference)); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isRequireCall(importNode, /*checkArgumentIsStringLiteralLike*/ false)) { changes.replaceNode(importingFile, importNode, ts.factory.createPropertyAccessExpression(ts.getSynthesizedDeepClone(importNode), "default")); } @@ -154605,20 +155648,20 @@ var ts; } function convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports, useSitesToUnqualify, quotePreference) { switch (statement.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target, quotePreference); return false; - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; switch (expression.kind) { - case 208 /* SyntaxKind.CallExpression */: { + case 210 /* SyntaxKind.CallExpression */: { if (ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true)) { // For side-effecting require() call, just make a side-effecting import. changes.replaceNode(sourceFile, statement, ts.makeImport(/*name*/ undefined, /*namedImports*/ undefined, expression.arguments[0], quotePreference)); } return false; } - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var operatorToken = expression.operatorToken; return operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && convertAssignment(sourceFile, checker, expression, changes, exports, useSitesToUnqualify); } @@ -154667,8 +155710,8 @@ var ts; /** Converts `const name = require("moduleSpecifier").propertyName` */ function convertPropertyAccessImport(name, propertyName, moduleSpecifier, identifiers, quotePreference) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: { // `const [a, b] = require("c").d` --> `import { d } from "c"; const [a, b] = d;` var tmp = makeUniqueName(propertyName, identifiers); return convertedImports([ @@ -154719,16 +155762,16 @@ var ts; function tryChangeModuleExportsObject(object, useSitesToUnqualify) { var statements = ts.mapAllOrFail(object.properties, function (prop) { switch (prop.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // TODO: Maybe we should handle this? See fourslash test `refactorConvertToEs6Module_export_object_shorthand.ts`. // falls through - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return undefined; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return !ts.isIdentifier(prop.name) ? undefined : convertExportsDotXEquals_replaceNode(prop.name.text, prop.initializer, useSitesToUnqualify); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return !ts.isIdentifier(prop.name) ? undefined : functionExpressionToDeclaration(prop.name.text, [ts.factory.createToken(93 /* SyntaxKind.ExportKeyword */)], prop, useSitesToUnqualify); default: ts.Debug.assertNever(prop, "Convert to ES6 got invalid prop kind ".concat(prop.kind)); @@ -154792,7 +155835,7 @@ var ts; function convertExportsDotXEquals_replaceNode(name, exported, useSitesToUnqualify) { var modifiers = [ts.factory.createToken(93 /* SyntaxKind.ExportKeyword */)]; switch (exported.kind) { - case 213 /* SyntaxKind.FunctionExpression */: { + case 215 /* SyntaxKind.FunctionExpression */: { var expressionName = exported.name; if (expressionName && expressionName.text !== name) { // `exports.f = function g() {}` -> `export const f = function g() {}` @@ -154800,10 +155843,10 @@ var ts; } } // falls through - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // `exports.f = function() {}` --> `export function f() {}` return functionExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: // `exports.C = class {}` --> `export class C {}` return classExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify); default: @@ -154823,7 +155866,7 @@ var ts; : ts.getSynthesizedDeepCloneWithReplacements(nodeOrNodes, /*includeTrivia*/ true, replaceNode); function replaceNode(original) { // We are replacing `mod.SomeExport` wih `SomeExport`, so we only need to look at PropertyAccessExpressions - if (original.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (original.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var replacement = useSitesToUnqualify.get(original); // Remove entry from `useSitesToUnqualify` so the refactor knows it's taken care of by the parent statement we're replacing useSitesToUnqualify.delete(original); @@ -154838,7 +155881,7 @@ var ts; */ function convertSingleImport(name, moduleSpecifier, checker, identifiers, target, quotePreference) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: { var importSpecifiers = ts.mapAllOrFail(name.elements, function (e) { return e.dotDotDotToken || e.initializer || e.propertyName && !ts.isIdentifier(e.propertyName) || !ts.isIdentifier(e.name) ? undefined @@ -154849,7 +155892,7 @@ var ts; } } // falls through -- object destructuring has an interesting pattern and must be a variable declaration - case 202 /* SyntaxKind.ArrayBindingPattern */: { + case 204 /* SyntaxKind.ArrayBindingPattern */: { /* import x from "x"; const [a, b, c] = x; @@ -154942,11 +155985,11 @@ var ts; function isFreeIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return parent.name !== node; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return parent.propertyName !== node; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return parent.propertyName !== node; default: return true; @@ -155057,7 +156100,7 @@ var ts; var exportDeclaration = exportClause.parent; var typeExportSpecifiers = getTypeExportSpecifiers(exportSpecifier, context); if (typeExportSpecifiers.length === exportClause.elements.length) { - changes.insertModifierBefore(context.sourceFile, 152 /* SyntaxKind.TypeKeyword */, exportClause); + changes.insertModifierBefore(context.sourceFile, 154 /* SyntaxKind.TypeKeyword */, exportClause); } else { var valueExportDeclaration = ts.factory.updateExportDeclaration(exportDeclaration, exportDeclaration.modifiers, @@ -155293,27 +156336,29 @@ var ts; errorCodes: errorCodes, getCodeActions: function (context) { var errorCode = context.errorCode, preferences = context.preferences, sourceFile = context.sourceFile, span = context.span, program = context.program; - var info = getFixesInfo(context, errorCode, span.start, /*useAutoImportProvider*/ true); + var info = getFixInfos(context, errorCode, span.start, /*useAutoImportProvider*/ true); if (!info) return undefined; - var fixes = info.fixes, symbolName = info.symbolName, errorIdentifierText = info.errorIdentifierText; var quotePreference = ts.getQuotePreference(sourceFile, preferences); - return fixes.map(function (fix) { return codeActionForFix(context, sourceFile, symbolName, fix, - /*includeSymbolNameInDescription*/ symbolName !== errorIdentifierText, quotePreference, program.getCompilerOptions()); }); + return info.map(function (_a) { + var fix = _a.fix, symbolName = _a.symbolName, errorIdentifierText = _a.errorIdentifierText; + return codeActionForFix(context, sourceFile, symbolName, fix, + /*includeSymbolNameInDescription*/ symbolName !== errorIdentifierText, quotePreference, program.getCompilerOptions()); + }); }, fixIds: [importFixId], getAllCodeActions: function (context) { - var sourceFile = context.sourceFile, program = context.program, preferences = context.preferences, host = context.host; - var importAdder = createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ true, preferences, host); + var sourceFile = context.sourceFile, program = context.program, preferences = context.preferences, host = context.host, cancellationToken = context.cancellationToken; + var importAdder = createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ true, preferences, host, cancellationToken); codefix.eachDiagnostic(context, errorCodes, function (diag) { return importAdder.addImportFromDiagnostic(diag, context); }); return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, importAdder.writeFixes)); }, }); - function createImportAdder(sourceFile, program, preferences, host) { - return createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ false, preferences, host); + function createImportAdder(sourceFile, program, preferences, host, cancellationToken) { + return createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ false, preferences, host, cancellationToken); } codefix.createImportAdder = createImportAdder; - function createImportAdderWorker(sourceFile, program, useAutoImportProvider, preferences, host) { + function createImportAdderWorker(sourceFile, program, useAutoImportProvider, preferences, host, cancellationToken) { var compilerOptions = program.getCompilerOptions(); // Namespace fixes don't conflict, so just build a list. var addToNamespace = []; @@ -155324,27 +156369,26 @@ var ts; var newImports = new ts.Map(); return { addImportFromDiagnostic: addImportFromDiagnostic, addImportFromExportedSymbol: addImportFromExportedSymbol, writeFixes: writeFixes, hasFixes: hasFixes }; function addImportFromDiagnostic(diagnostic, context) { - var info = getFixesInfo(context, diagnostic.code, diagnostic.start, useAutoImportProvider); - if (!info || !info.fixes.length) + var info = getFixInfos(context, diagnostic.code, diagnostic.start, useAutoImportProvider); + if (!info || !info.length) return; - addImport(info); + addImport(ts.first(info)); } function addImportFromExportedSymbol(exportedSymbol, isValidTypeOnlyUseSite) { var moduleSymbol = ts.Debug.checkDefined(exportedSymbol.parent); var symbolName = ts.getNameForExportedSymbol(exportedSymbol, ts.getEmitScriptTarget(compilerOptions)); var checker = program.getTypeChecker(); var symbol = checker.getMergedSymbol(ts.skipAlias(exportedSymbol, checker)); - var exportInfo = getAllReExportingModules(sourceFile, symbol, moduleSymbol, symbolName, /*isJsxTagName*/ false, host, program, preferences, useAutoImportProvider); + var exportInfo = getAllExportInfoForSymbol(sourceFile, symbol, symbolName, /*isJsxTagName*/ false, program, host, preferences, cancellationToken); var useRequire = shouldUseRequire(sourceFile, program); - var fix = getImportFixForSymbol(sourceFile, exportInfo, moduleSymbol, program, /*useNamespaceInfo*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences); + var fix = getImportFixForSymbol(sourceFile, ts.Debug.checkDefined(exportInfo), moduleSymbol, program, /*useNamespaceInfo*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences); if (fix) { - addImport({ fixes: [fix], symbolName: symbolName, errorIdentifierText: undefined }); + addImport({ fix: fix, symbolName: symbolName, errorIdentifierText: undefined }); } } function addImport(info) { var _a, _b; - var fixes = info.fixes, symbolName = info.symbolName; - var fix = ts.first(fixes); + var fix = info.fix, symbolName = info.symbolName; switch (fix.kind) { case 0 /* ImportFixKind.UseNamespace */: addToNamespace.push(fix); @@ -155511,11 +156555,12 @@ var ts; AddAsTypeOnly[AddAsTypeOnly["Required"] = 2] = "Required"; AddAsTypeOnly[AddAsTypeOnly["NotAllowed"] = 4] = "NotAllowed"; })(AddAsTypeOnly || (AddAsTypeOnly = {})); - function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, isJsxTagName, host, program, formatContext, position, preferences) { + function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) { var compilerOptions = program.getCompilerOptions(); var exportInfos = ts.pathIsBareSpecifier(ts.stripQuotes(moduleSymbol.name)) - ? [getSymbolExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)] - : getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, isJsxTagName, host, program, preferences, /*useAutoImportProvider*/ true); + ? [getSingleExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)] + : getAllExportInfoForSymbol(sourceFile, targetSymbol, symbolName, isJsxTagName, program, host, preferences, cancellationToken); + ts.Debug.assertIsDefined(exportInfos); var useRequire = shouldUseRequire(sourceFile, program); var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(ts.getTokenAtPosition(sourceFile, position)); var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, { symbolName: symbolName, position: position }, isValidTypeOnlyUseSite, useRequire, host, preferences)); @@ -155528,7 +156573,7 @@ var ts; codefix.getImportCompletionAction = getImportCompletionAction; function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, host, formatContext, preferences) { var compilerOptions = program.getCompilerOptions(); - var symbolName = getSymbolName(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions); + var symbolName = ts.single(getSymbolNamesToImport(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions)); var fix = getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program); var includeSymbolNameInDescription = symbolName !== symbolToken.text; return fix && codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix, includeSymbolNameInDescription, 1 /* QuotePreference.Double */, compilerOptions)); @@ -155543,7 +156588,16 @@ var ts; var description = _a.description, changes = _a.changes, commands = _a.commands; return { description: description, changes: changes, commands: commands }; } - function getSymbolExportInfoForSymbol(symbol, moduleSymbol, program, host) { + function getAllExportInfoForSymbol(importingFile, symbol, symbolName, preferCapitalized, program, host, preferences, cancellationToken) { + var getChecker = createGetChecker(program, host); + return ts.getExportInfoMap(importingFile, host, program, preferences, cancellationToken) + .search(importingFile.path, preferCapitalized, function (name) { return name === symbolName; }, function (info) { + if (ts.skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol) { + return info; + } + }); + } + function getSingleExportInfoForSymbol(symbol, moduleSymbol, program, host) { var _a, _b; var compilerOptions = program.getCompilerOptions(); var mainProgramInfo = getInfoWithChecker(program.getTypeChecker(), /*isFromPackageJson*/ false); @@ -155563,35 +156617,6 @@ var ts; } } } - function getAllReExportingModules(importingFile, targetSymbol, exportingModuleSymbol, symbolName, isJsxTagName, host, program, preferences, useAutoImportProvider) { - var result = []; - var compilerOptions = program.getCompilerOptions(); - var getModuleSpecifierResolutionHost = ts.memoizeOne(function (isFromPackageJson) { - return ts.createModuleSpecifierResolutionHost(isFromPackageJson ? host.getPackageJsonAutoImportProvider() : program, host); - }); - ts.forEachExternalModuleToImportFrom(program, host, preferences, useAutoImportProvider, function (moduleSymbol, moduleFile, program, isFromPackageJson) { - var checker = program.getTypeChecker(); - // Don't import from a re-export when looking "up" like to `./index` or `../index`. - if (moduleFile && moduleSymbol !== exportingModuleSymbol && ts.startsWith(importingFile.fileName, ts.getDirectoryPath(moduleFile.fileName))) { - return; - } - var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions); - if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions), isJsxTagName) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) { - result.push({ symbol: defaultInfo.symbol, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: defaultInfo.exportKind, targetFlags: ts.skipAlias(defaultInfo.symbol, checker).flags, isFromPackageJson: isFromPackageJson }); - } - for (var _i = 0, _a = checker.getExportsAndPropertiesOfModule(moduleSymbol); _i < _a.length; _i++) { - var exported = _a[_i]; - if (exported.name === symbolName && checker.getMergedSymbol(ts.skipAlias(exported, checker)) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) { - result.push({ symbol: exported, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: 0 /* ExportKind.Named */, targetFlags: ts.skipAlias(exported, checker).flags, isFromPackageJson: isFromPackageJson }); - } - } - }); - return result; - function isImportable(program, moduleFile, isFromPackageJson) { - var _a; - return !moduleFile || ts.isImportableFile(program, importingFile, moduleFile, preferences, /*packageJsonFilter*/ undefined, getModuleSpecifierResolutionHost(isFromPackageJson), (_a = host.getModuleSpecifierCache) === null || _a === void 0 ? void 0 : _a.call(host)); - } - } function getImportFixes(exportInfos, useNamespaceInfo, /** undefined only for missing JSX namespace */ isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap, fromCacheOnly) { @@ -155642,11 +156667,11 @@ var ts; function getTargetModuleFromNamespaceLikeImport(declaration, checker) { var _a; switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checker.resolveExternalModuleName(declaration.initializer.arguments[0]); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return checker.getAliasedSymbol(declaration.symbol); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var namespaceImport = ts.tryCast((_a = declaration.importClause) === null || _a === void 0 ? void 0 : _a.namedBindings, ts.isNamespaceImport); return namespaceImport && checker.getAliasedSymbol(namespaceImport.symbol); default: @@ -155656,11 +156681,11 @@ var ts; function getNamespaceLikeImportText(declaration) { var _a, _b, _c; switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return (_a = ts.tryCast(declaration.name, ts.isIdentifier)) === null || _a === void 0 ? void 0 : _a.text; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return declaration.name.text; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return (_c = ts.tryCast((_b = declaration.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings, ts.isNamespaceImport)) === null || _c === void 0 ? void 0 : _c.name.text; default: return ts.Debug.assertNever(declaration); @@ -155687,12 +156712,12 @@ var ts; function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker, compilerOptions) { return ts.firstDefined(existingImports, function (_a) { var declaration = _a.declaration, importKind = _a.importKind, symbol = _a.symbol, targetFlags = _a.targetFlags; - if (importKind === 3 /* ImportKind.CommonJS */ || importKind === 2 /* ImportKind.Namespace */ || declaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (importKind === 3 /* ImportKind.CommonJS */ || importKind === 2 /* ImportKind.Namespace */ || declaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { // These kinds of imports are not combinable with anything return undefined; } - if (declaration.kind === 254 /* SyntaxKind.VariableDeclaration */) { - return (importKind === 0 /* ImportKind.Named */ || importKind === 1 /* ImportKind.Default */) && declaration.name.kind === 201 /* SyntaxKind.ObjectBindingPattern */ + if (declaration.kind === 257 /* SyntaxKind.VariableDeclaration */) { + return (importKind === 0 /* ImportKind.Named */ || importKind === 1 /* ImportKind.Default */) && declaration.name.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? { kind: 2 /* ImportFixKind.AddToExisting */, importClauseOrBindingPattern: declaration.name, importKind: importKind, moduleSpecifier: declaration.initializer.arguments[0].text, addAsTypeOnly: 4 /* AddAsTypeOnly.NotAllowed */ } : undefined; } @@ -155713,7 +156738,7 @@ var ts; )) return undefined; if (importKind === 0 /* ImportKind.Named */ && - (namedBindings === null || namedBindings === void 0 ? void 0 : namedBindings.kind) === 268 /* SyntaxKind.NamespaceImport */ // Cannot add a named import to a declaration that has a namespace import + (namedBindings === null || namedBindings === void 0 ? void 0 : namedBindings.kind) === 271 /* SyntaxKind.NamespaceImport */ // Cannot add a named import to a declaration that has a namespace import ) return undefined; return { @@ -155736,7 +156761,7 @@ var ts; (importMap || (importMap = ts.createMultiMap())).add(ts.getSymbolId(moduleSymbol), i.parent); } } - else if (i.kind === 266 /* SyntaxKind.ImportDeclaration */ || i.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + else if (i.kind === 269 /* SyntaxKind.ImportDeclaration */ || i.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { var moduleSymbol = checker.getSymbolAtLocation(moduleSpecifier); if (moduleSymbol) { (importMap || (importMap = ts.createMultiMap())).add(ts.getSymbolId(moduleSymbol), i); @@ -155785,11 +156810,14 @@ var ts; // 5. Literally nothing to go on return true; } + function createGetChecker(program, host) { + return ts.memoizeOne(function (isFromPackageJson) { return isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker(); }); + } function getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfo, host, preferences, fromCacheOnly) { var isJs = ts.isSourceFileJS(sourceFile); var compilerOptions = program.getCompilerOptions(); var moduleSpecifierResolutionHost = ts.createModuleSpecifierResolutionHost(program, host); - var getChecker = ts.memoizeOne(function (isFromPackageJson) { return isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker(); }); + var getChecker = createGetChecker(program, host); var rejectNodeModulesRelativePaths = ts.moduleResolutionUsesNodeModules(ts.getEmitModuleResolutionKind(compilerOptions)); var getModuleSpecifiers = fromCacheOnly ? function (moduleSymbol) { return ({ moduleSpecifiers: ts.moduleSpecifiers.tryGetModuleSpecifiersFromCache(moduleSymbol, sourceFile, moduleSpecifierResolutionHost, preferences), computedWithoutCache: false }); } @@ -155833,7 +156861,7 @@ var ts; return { kind: 3 /* ImportFixKind.AddNew */, moduleSpecifier: moduleSpecifier, importKind: importKind, addAsTypeOnly: addAsTypeOnly, useRequire: useRequire }; } } - function getFixesInfo(context, errorCode, pos, useAutoImportProvider) { + function getFixInfos(context, errorCode, pos, useAutoImportProvider) { var symbolToken = ts.getTokenAtPosition(context.sourceFile, pos); var info; if (errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) { @@ -155843,19 +156871,23 @@ var ts; return undefined; } else if (errorCode === ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code) { - var symbolName_1 = getSymbolName(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions()); + var symbolName_1 = ts.single(getSymbolNamesToImport(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions())); var fix = getTypeOnlyPromotionFix(context.sourceFile, symbolToken, symbolName_1, context.program); - return fix && { fixes: [fix], symbolName: symbolName_1, errorIdentifierText: symbolToken.text }; + return fix && [{ fix: fix, symbolName: symbolName_1, errorIdentifierText: symbolToken.text }]; } else { info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider); } var packageJsonImportFilter = ts.createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host); - return info && __assign(__assign({}, info), { fixes: sortFixes(info.fixes, context.sourceFile, context.program, packageJsonImportFilter, context.host) }); + return info && sortFixInfo(info, context.sourceFile, context.program, packageJsonImportFilter, context.host); } - function sortFixes(fixes, sourceFile, program, packageJsonImportFilter, host) { + function sortFixInfo(fixes, sourceFile, program, packageJsonImportFilter, host) { var _toPath = function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), ts.hostGetCanonicalFileName(host)); }; - return ts.sort(fixes, function (a, b) { return ts.compareValues(a.kind, b.kind) || compareModuleSpecifiers(a, b, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath); }); + return ts.sort(fixes, function (a, b) { + return ts.compareBooleans(!!a.isJsxNamespaceFix, !!b.isJsxNamespaceFix) || + ts.compareValues(a.fix.kind, b.fix.kind) || + compareModuleSpecifiers(a.fix, b.fix, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath); + }); } function getBestFix(fixes, sourceFile, program, packageJsonImportFilter, host) { if (!ts.some(fixes)) @@ -155906,7 +156938,6 @@ var ts; return 0 /* Comparison.EqualTo */; } function getFixesInfoForUMDImport(_a, token) { - var _b; var sourceFile = _a.sourceFile, program = _a.program, host = _a.host, preferences = _a.preferences; var checker = program.getTypeChecker(); var umdSymbol = getUmdSymbol(token, checker); @@ -155918,7 +156949,7 @@ var ts; var useRequire = shouldUseRequire(sourceFile, program); var position = ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined; var fixes = getImportFixes(exportInfo, position ? { position: position, symbolName: symbolName } : undefined, /*isValidTypeOnlyUseSite*/ false, useRequire, program, sourceFile, host, preferences).fixes; - return { fixes: fixes, symbolName: symbolName, errorIdentifierText: (_b = ts.tryCast(token, ts.isIdentifier)) === null || _b === void 0 ? void 0 : _b.text }; + return fixes.map(function (fix) { var _a; return ({ fix: fix, symbolName: symbolName, errorIdentifierText: (_a = ts.tryCast(token, ts.isIdentifier)) === null || _a === void 0 ? void 0 : _a.text }); }); } function getUmdSymbol(token, checker) { // try the identifier to see if it is the umd symbol @@ -155979,19 +157010,20 @@ var ts; var sourceFile = _a.sourceFile, program = _a.program, cancellationToken = _a.cancellationToken, host = _a.host, preferences = _a.preferences; var checker = program.getTypeChecker(); var compilerOptions = program.getCompilerOptions(); - var symbolName = getSymbolName(sourceFile, checker, symbolToken, compilerOptions); - // "default" is a keyword and not a legal identifier for the import, but appears as an identifier. - if (symbolName === "default" /* InternalSymbolName.Default */) { - return undefined; - } - var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken); - var useRequire = shouldUseRequire(sourceFile, program); - var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences); - var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) { - var _ = _a[0], exportInfos = _a[1]; - return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes; - })); - return { fixes: fixes, symbolName: symbolName, errorIdentifierText: symbolToken.text }; + return ts.flatMap(getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions), function (symbolName) { + // "default" is a keyword and not a legal identifier for the import, but appears as an identifier. + if (symbolName === "default" /* InternalSymbolName.Default */) { + return undefined; + } + var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken); + var useRequire = shouldUseRequire(sourceFile, program); + var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences); + var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) { + var _ = _a[0], exportInfos = _a[1]; + return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes; + })); + return fixes.map(function (fix) { return ({ fix: fix, symbolName: symbolName, errorIdentifierText: symbolToken.text, isJsxNamespaceFix: symbolName !== symbolToken.text }); }); + }); } function getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program) { var checker = program.getTypeChecker(); @@ -156003,15 +157035,16 @@ var ts; return undefined; return { kind: 4 /* ImportFixKind.PromoteTypeOnly */, typeOnlyAliasDeclaration: typeOnlyAliasDeclaration }; } - function getSymbolName(sourceFile, checker, symbolToken, compilerOptions) { + function getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions) { var parent = symbolToken.parent; if ((ts.isJsxOpeningLikeElement(parent) || ts.isJsxClosingElement(parent)) && parent.tagName === symbolToken && ts.jsxModeNeedsExplicitImport(compilerOptions.jsx)) { var jsxNamespace = checker.getJsxNamespace(sourceFile); if (needsJsxNamespaceFix(jsxNamespace, symbolToken, checker)) { - return jsxNamespace; + var needsComponentNameFix = !ts.isIntrinsicJsxName(symbolToken.text) && !checker.resolveName(symbolToken.text, symbolToken, 111551 /* SymbolFlags.Value */, /*excludeGlobals*/ false); + return needsComponentNameFix ? [symbolToken.text, jsxNamespace] : [jsxNamespace]; } } - return symbolToken.text; + return [symbolToken.text]; } function needsJsxNamespaceFix(jsxNamespace, symbolToken, checker) { if (ts.isIntrinsicJsxName(symbolToken.text)) @@ -156120,7 +157153,7 @@ var ts; case 4 /* ImportFixKind.PromoteTypeOnly */: { var typeOnlyAliasDeclaration = fix.typeOnlyAliasDeclaration; var promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration, compilerOptions, sourceFile); - return promotedDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ + return promotedDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ ? [ts.Diagnostics.Remove_type_from_import_of_0_from_1, symbolName, getModuleSpecifierText(promotedDeclaration.parent.parent)] : [ts.Diagnostics.Remove_type_from_import_declaration_from_0, getModuleSpecifierText(promotedDeclaration)]; } @@ -156130,7 +157163,7 @@ var ts; } function getModuleSpecifierText(promotedDeclaration) { var _a, _b; - return promotedDeclaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ + return promotedDeclaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? ((_b = ts.tryCast((_a = ts.tryCast(promotedDeclaration.moduleReference, ts.isExternalModuleReference)) === null || _a === void 0 ? void 0 : _a.expression, ts.isStringLiteralLike)) === null || _b === void 0 ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText() : ts.cast(promotedDeclaration.parent.moduleSpecifier, ts.isStringLiteral).text; } @@ -156138,7 +157171,7 @@ var ts; // See comment in `doAddExistingFix` on constant with the same name. var convertExistingToTypeOnly = compilerOptions.preserveValueImports && compilerOptions.isolatedModules; switch (aliasDeclaration.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: if (aliasDeclaration.isTypeOnly) { if (aliasDeclaration.parent.elements.length > 1 && ts.OrganizeImports.importSpecifiersAreSorted(aliasDeclaration.parent.elements)) { changes.delete(sourceFile, aliasDeclaration); @@ -156156,13 +157189,13 @@ var ts; promoteImportClause(aliasDeclaration.parent.parent); return aliasDeclaration.parent.parent; } - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: promoteImportClause(aliasDeclaration); return aliasDeclaration; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: promoteImportClause(aliasDeclaration.parent); return aliasDeclaration.parent; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: changes.deleteRange(sourceFile, aliasDeclaration.getChildAt(1)); return aliasDeclaration; default: @@ -156174,7 +157207,7 @@ var ts; var namedImports = ts.tryCast(importClause.namedBindings, ts.isNamedImports); if (namedImports && namedImports.elements.length > 1) { if (ts.OrganizeImports.importSpecifiersAreSorted(namedImports.elements) && - aliasDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ && + aliasDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ && namedImports.elements.indexOf(aliasDeclaration) !== 0) { // The import specifier being promoted will be the only non-type-only, // import in the NamedImports, so it should be moved to the front. @@ -156184,7 +157217,7 @@ var ts; for (var _i = 0, _a = namedImports.elements; _i < _a.length; _i++) { var element = _a[_i]; if (element !== aliasDeclaration && !element.isTypeOnly) { - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, element); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, element); } } } @@ -156193,7 +157226,7 @@ var ts; } function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImports, compilerOptions) { var _a; - if (clause.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (clause.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (defaultImport) { addElementToBindingPattern(clause, defaultImport.name, "default"); } @@ -156254,7 +157287,7 @@ var ts; if (convertExistingToTypeOnly && existingSpecifiers) { for (var _d = 0, existingSpecifiers_1 = existingSpecifiers; _d < existingSpecifiers_1.length; _d++) { var specifier = existingSpecifiers_1[_d]; - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, specifier); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, specifier); } } } @@ -156429,7 +157462,7 @@ var ts; var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; }); if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined) return; - var declaration = findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); + var declaration = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); if (declaration === undefined) return; if (ts.isIdentifier(declaration) && ts.isTypeParameterDeclaration(declaration.parent)) { @@ -156463,14 +157496,6 @@ var ts; } } } - function findAncestorMatchingSpan(sourceFile, span) { - var end = ts.textSpanEnd(span); - var token = ts.getTokenAtPosition(sourceFile, span.start); - while (token.end < end) { - token = token.parent; - } - return token; - } function tryGetConstraintFromDiagnosticMessage(messageText) { var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/`extends (.*)`/) || [], _ = _a[0], constraint = _a[1]; return constraint; @@ -156614,7 +157639,7 @@ var ts; accessibilityModifier ? accessibilityModifier.end : lastDecorator ? ts.skipTrivia(sourceFile.text, lastDecorator.end) : classElement.getStart(sourceFile); var options = accessibilityModifier || staticModifier || abstractModifier ? { prefix: " " } : { suffix: " " }; - changeTracker.insertModifierAt(sourceFile, modifierPos, 159 /* SyntaxKind.OverrideKeyword */, options); + changeTracker.insertModifierAt(sourceFile, modifierPos, 161 /* SyntaxKind.OverrideKeyword */, options); } function doRemoveOverrideModifierChange(changeTracker, sourceFile, pos) { var classElement = findContainerClassElementLike(sourceFile, pos); @@ -156628,13 +157653,13 @@ var ts; } function isClassElementLikeHasJSDoc(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return ts.isParameterPropertyDeclaration(node, node.parent); default: return false; @@ -156766,7 +157791,7 @@ var ts; }); function getNamedTupleMember(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); - return ts.findAncestor(token, function (t) { return t.kind === 197 /* SyntaxKind.NamedTupleMember */; }); + return ts.findAncestor(token, function (t) { return t.kind === 199 /* SyntaxKind.NamedTupleMember */; }); } function doChange(changes, sourceFile, namedTupleMember) { if (!namedTupleMember) { @@ -156775,11 +157800,11 @@ var ts; var unwrappedType = namedTupleMember.type; var sawOptional = false; var sawRest = false; - while (unwrappedType.kind === 185 /* SyntaxKind.OptionalType */ || unwrappedType.kind === 186 /* SyntaxKind.RestType */ || unwrappedType.kind === 191 /* SyntaxKind.ParenthesizedType */) { - if (unwrappedType.kind === 185 /* SyntaxKind.OptionalType */) { + while (unwrappedType.kind === 187 /* SyntaxKind.OptionalType */ || unwrappedType.kind === 188 /* SyntaxKind.RestType */ || unwrappedType.kind === 193 /* SyntaxKind.ParenthesizedType */) { + if (unwrappedType.kind === 187 /* SyntaxKind.OptionalType */) { sawOptional = true; } - else if (unwrappedType.kind === 186 /* SyntaxKind.RestType */) { + else if (unwrappedType.kind === 188 /* SyntaxKind.RestType */) { sawRest = true; } unwrappedType = unwrappedType.type; @@ -157050,7 +158075,7 @@ var ts; if (isFunctionType) { var sig = checker.getSignatureFromDeclaration(declaration); if (sig) { - if (ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Async */)) { + if (ts.hasSyntacticModifier(declaration, 512 /* ModifierFlags.Async */)) { exprType = checker.createPromiseType(exprType); } var newSig = checker.createSignature(declaration, sig.typeParameters, sig.thisParameter, sig.parameters, exprType, @@ -157094,19 +158119,19 @@ var ts; } function getVariableLikeInitializer(declaration) { switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: return declaration.initializer; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return declaration.initializer && (ts.isJsxExpression(declaration.initializer) ? declaration.initializer.expression : undefined); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 166 /* SyntaxKind.PropertySignature */: - case 299 /* SyntaxKind.EnumMember */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 168 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return undefined; } } @@ -157160,6 +158185,15 @@ var ts; ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code, ts.Diagnostics.Cannot_find_name_0.code ]; + var InfoKind; + (function (InfoKind) { + InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration"; + InfoKind[InfoKind["Enum"] = 1] = "Enum"; + InfoKind[InfoKind["Function"] = 2] = "Function"; + InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral"; + InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes"; + InfoKind[InfoKind["Signature"] = 5] = "Signature"; + })(InfoKind || (InfoKind = {})); codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { @@ -157168,19 +158202,19 @@ var ts; if (!info) { return undefined; } - if (info.kind === 3 /* InfoKind.ObjectLiteral */) { + if (info.kind === InfoKind.ObjectLiteral) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addObjectLiteralProperties(t, context, info); }); return [codefix.createCodeFixAction(fixMissingProperties, changes, ts.Diagnostics.Add_missing_properties, fixMissingProperties, ts.Diagnostics.Add_all_missing_properties)]; } - if (info.kind === 4 /* InfoKind.JsxAttributes */) { + if (info.kind === InfoKind.JsxAttributes) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addJsxAttributes(t, context, info); }); return [codefix.createCodeFixAction(fixMissingAttributes, changes, ts.Diagnostics.Add_missing_attributes, fixMissingAttributes, ts.Diagnostics.Add_all_missing_attributes)]; } - if (info.kind === 2 /* InfoKind.Function */) { + if (info.kind === InfoKind.Function || info.kind === InfoKind.Signature) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addFunctionDeclaration(t, context, info); }); return [codefix.createCodeFixAction(fixMissingFunctionDeclaration, changes, [ts.Diagnostics.Add_missing_function_declaration_0, info.token.text], fixMissingFunctionDeclaration, ts.Diagnostics.Add_all_missing_function_declarations)]; } - if (info.kind === 1 /* InfoKind.Enum */) { + if (info.kind === InfoKind.Enum) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addEnumMemberDeclaration(t, context.program.getTypeChecker(), info); }); return [codefix.createCodeFixAction(fixMissingMember, changes, [ts.Diagnostics.Add_missing_enum_member_0, info.token.text], fixMissingMember, ts.Diagnostics.Add_all_missing_members)]; } @@ -157198,20 +158232,20 @@ var ts; if (!info || !ts.addToSeen(seen, ts.getNodeId(info.parentDeclaration) + "#" + info.token.text)) { return; } - if (fixId === fixMissingFunctionDeclaration && info.kind === 2 /* InfoKind.Function */) { + if (fixId === fixMissingFunctionDeclaration && (info.kind === InfoKind.Function || info.kind === InfoKind.Signature)) { addFunctionDeclaration(changes, context, info); } - else if (fixId === fixMissingProperties && info.kind === 3 /* InfoKind.ObjectLiteral */) { + else if (fixId === fixMissingProperties && info.kind === InfoKind.ObjectLiteral) { addObjectLiteralProperties(changes, context, info); } - else if (fixId === fixMissingAttributes && info.kind === 4 /* InfoKind.JsxAttributes */) { + else if (fixId === fixMissingAttributes && info.kind === InfoKind.JsxAttributes) { addJsxAttributes(changes, context, info); } else { - if (info.kind === 1 /* InfoKind.Enum */) { + if (info.kind === InfoKind.Enum) { addEnumMemberDeclaration(changes, checker, info); } - if (info.kind === 0 /* InfoKind.TypeLikeDeclaration */) { + if (info.kind === InfoKind.TypeLikeDeclaration) { var parentDeclaration = info.parentDeclaration, token_1 = info.token; var infos = ts.getOrUpdate(typeDeclToMembers, parentDeclaration, function () { return []; }); if (!infos.some(function (i) { return i.token.text === token_1.text; })) { @@ -157255,14 +158289,6 @@ var ts; })); }, }); - var InfoKind; - (function (InfoKind) { - InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration"; - InfoKind[InfoKind["Enum"] = 1] = "Enum"; - InfoKind[InfoKind["Function"] = 2] = "Function"; - InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral"; - InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes"; - })(InfoKind || (InfoKind = {})); function getInfo(sourceFile, tokenPos, errorCode, checker, program) { // The identifier of the missing property. eg: // this.missing = 1; @@ -157284,7 +158310,7 @@ var ts; var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent), checker.getParameterType(signature, argIndex), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false)); if (!ts.length(properties)) return undefined; - return { kind: 3 /* InfoKind.ObjectLiteral */, token: param.name, properties: properties, parentDeclaration: parent }; + return { kind: InfoKind.ObjectLiteral, token: param.name, properties: properties, parentDeclaration: parent }; } if (!ts.isMemberName(token)) return undefined; @@ -157292,17 +158318,26 @@ var ts; var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent.initializer), checker.getTypeAtLocation(token), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false)); if (!ts.length(properties)) return undefined; - return { kind: 3 /* InfoKind.ObjectLiteral */, token: token, properties: properties, parentDeclaration: parent.initializer }; + return { kind: InfoKind.ObjectLiteral, token: token, properties: properties, parentDeclaration: parent.initializer }; } if (ts.isIdentifier(token) && ts.isJsxOpeningLikeElement(token.parent)) { var target = ts.getEmitScriptTarget(program.getCompilerOptions()); var attributes = getUnmatchedAttributes(checker, target, token.parent); if (!ts.length(attributes)) return undefined; - return { kind: 4 /* InfoKind.JsxAttributes */, token: token, attributes: attributes, parentDeclaration: token.parent }; + return { kind: InfoKind.JsxAttributes, token: token, attributes: attributes, parentDeclaration: token.parent }; } - if (ts.isIdentifier(token) && ts.isCallExpression(parent) && parent.expression === token) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* ModifierFlags.None */, parentDeclaration: sourceFile }; + if (ts.isIdentifier(token)) { + var type = checker.getContextualType(token); + if (type && ts.getObjectFlags(type) & 16 /* ObjectFlags.Anonymous */) { + var signature = ts.firstOrUndefined(checker.getSignaturesOfType(type, 0 /* SignatureKind.Call */)); + if (signature === undefined) + return undefined; + return { kind: InfoKind.Signature, token: token, signature: signature, sourceFile: sourceFile, parentDeclaration: findScope(token) }; + } + if (ts.isCallExpression(parent) && parent.expression === token) { + return { kind: InfoKind.Function, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* ModifierFlags.None */, parentDeclaration: findScope(token) }; + } } if (!ts.isPropertyAccessExpression(parent)) return undefined; @@ -157314,13 +158349,13 @@ var ts; var moduleDeclaration = ts.find(symbol.declarations, ts.isModuleDeclaration); var moduleDeclarationSourceFile = moduleDeclaration === null || moduleDeclaration === void 0 ? void 0 : moduleDeclaration.getSourceFile(); if (moduleDeclaration && moduleDeclarationSourceFile && !isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent.parent, sourceFile: sourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleDeclaration }; + return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: sourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleDeclaration }; } var moduleSourceFile = ts.find(symbol.declarations, ts.isSourceFile); if (sourceFile.commonJsModuleIndicator) return undefined; if (moduleSourceFile && !isSourceFileFromLibrary(program, moduleSourceFile)) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleSourceFile }; + return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleSourceFile }; } } var classDeclaration = ts.find(symbol.declarations, ts.isClassLike); @@ -157338,11 +158373,11 @@ var ts; (makeStatic ? 32 /* ModifierFlags.Static */ : 0 /* ModifierFlags.None */) | (ts.startsWithUnderscore(token.text) ? 8 /* ModifierFlags.Private */ : 0 /* ModifierFlags.None */); var isJSFile = ts.isSourceFileJS(declSourceFile); var call = ts.tryCast(parent.parent, ts.isCallExpression); - return { kind: 0 /* InfoKind.TypeLikeDeclaration */, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile }; + 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())) { - return { kind: 1 /* InfoKind.Enum */, token: token, parentDeclaration: enumDeclaration }; + return { kind: InfoKind.Enum, token: token, parentDeclaration: enumDeclaration }; } return undefined; } @@ -157369,7 +158404,7 @@ var ts; function addMissingMemberInJs(changeTracker, sourceFile, classDeclaration, token, makeStatic) { var tokenName = token.text; if (makeStatic) { - if (classDeclaration.kind === 226 /* SyntaxKind.ClassExpression */) { + if (classDeclaration.kind === 228 /* SyntaxKind.ClassExpression */) { return; } var className = classDeclaration.name.getText(); @@ -157420,7 +158455,7 @@ var ts; } function getTypeNode(checker, node, token) { var typeNode; - if (token.parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (token.parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */) { var binaryExpression = token.parent.parent; var otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left; var widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression))); @@ -157430,7 +158465,7 @@ var ts; var contextualType = checker.getContextualType(token.parent); typeNode = contextualType ? checker.typeToTypeNode(contextualType, /*enclosingDeclaration*/ undefined, 1 /* NodeBuilderFlags.NoTruncation */) : undefined; } - return typeNode || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return typeNode || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } function addPropertyDeclaration(changeTracker, sourceFile, node, tokenName, typeNode, modifierFlags) { var modifiers = modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; @@ -157458,7 +158493,7 @@ var ts; } function createAddIndexSignatureAction(context, sourceFile, node, tokenName, typeNode) { // Index signatures cannot have the static modifier. - var stringTypeNode = ts.factory.createKeywordTypeNode(150 /* SyntaxKind.StringKeyword */); + var stringTypeNode = ts.factory.createKeywordTypeNode(152 /* SyntaxKind.StringKeyword */); var indexingParameter = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "x", @@ -157489,7 +158524,7 @@ var ts; } function addMethodDeclaration(context, changes, callExpression, name, modifierFlags, parentDeclaration, sourceFile) { var importAdder = codefix.createImportAdder(sourceFile, context.program, context.preferences, context.host); - var kind = ts.isClassLike(parentDeclaration) ? 169 /* SyntaxKind.MethodDeclaration */ : 168 /* SyntaxKind.MethodSignature */; + var kind = ts.isClassLike(parentDeclaration) ? 171 /* SyntaxKind.MethodDeclaration */ : 170 /* SyntaxKind.MethodSignature */; var signatureDeclaration = codefix.createSignatureDeclarationFromCallExpression(kind, context, importAdder, callExpression, name, modifierFlags, parentDeclaration); var containingMethodDeclaration = tryGetContainingMethodDeclaration(parentDeclaration, callExpression); if (containingMethodDeclaration) { @@ -157518,9 +158553,17 @@ var ts; }); } function addFunctionDeclaration(changes, context, info) { + var quotePreference = ts.getQuotePreference(context.sourceFile, context.preferences); var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host); - var functionDeclaration = codefix.createSignatureDeclarationFromCallExpression(256 /* SyntaxKind.FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration); - changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration); + var functionDeclaration = info.kind === InfoKind.Function + ? codefix.createSignatureDeclarationFromCallExpression(259 /* SyntaxKind.FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration) + : codefix.createSignatureDeclarationFromSignature(259 /* SyntaxKind.FunctionDeclaration */, context, quotePreference, info.signature, codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), info.token, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ undefined, importAdder); + if (functionDeclaration === undefined) { + ts.Debug.fail("fixMissingFunctionDeclaration codefix got unexpected error."); + } + ts.isReturnStatement(info.parentDeclaration) + ? changes.insertNodeBefore(info.sourceFile, info.parentDeclaration, functionDeclaration, /*blankLineBetween*/ true) + : changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration); importAdder.writeFixes(changes); } function addJsxAttributes(changes, context, info) { @@ -157616,7 +158659,7 @@ var ts; var signature = checker.getSignaturesOfType(type, 0 /* SignatureKind.Call */); if (signature === undefined) return createUndefined(); - var func = codefix.createSignatureDeclarationFromSignature(213 /* SyntaxKind.FunctionExpression */, context, quotePreference, signature[0], codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), /*name*/ undefined, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ enclosingDeclaration, importAdder); + var func = codefix.createSignatureDeclarationFromSignature(215 /* SyntaxKind.FunctionExpression */, context, quotePreference, signature[0], codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), /*name*/ undefined, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ enclosingDeclaration, importAdder); return func !== null && func !== void 0 ? func : createUndefined(); } if (ts.getObjectFlags(type) & 1 /* ObjectFlags.Class */) { @@ -157670,14 +158713,21 @@ var ts; return declaration && declaration.parent === node ? declaration : undefined; } function createPropertyNameFromSymbol(symbol, target, quotePreference, checker) { - if (ts.isTransientSymbol(symbol) && symbol.nameType && symbol.nameType.flags & 8192 /* TypeFlags.UniqueESSymbol */) { - var expression = checker.symbolToExpression(symbol.nameType.symbol, 111551 /* SymbolFlags.Value */, symbol.valueDeclaration, 1048576 /* NodeBuilderFlags.AllowUniqueESSymbolType */); - if (expression) { - return ts.factory.createComputedPropertyName(expression); - } + if (ts.isTransientSymbol(symbol)) { + var prop = checker.symbolToNode(symbol, 111551 /* SymbolFlags.Value */, /*enclosingDeclaration*/ undefined, 1073741824 /* NodeBuilderFlags.WriteComputedProps */); + if (prop && ts.isComputedPropertyName(prop)) + return prop; } return ts.createPropertyNameNodeForIdentifierOrLiteral(symbol.name, target, quotePreference === 0 /* QuotePreference.Single */); } + function findScope(node) { + if (ts.findAncestor(node, ts.isJsxExpression)) { + var returnStatement = ts.findAncestor(node.parent, ts.isReturnStatement); + if (returnStatement) + return returnStatement; + } + return ts.getSourceFileOfNode(node); + } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); /* @internal */ @@ -157828,7 +158878,7 @@ var ts; // See `codeFixClassExtendAbstractProtectedProperty.ts` in https://github.com/Microsoft/TypeScript/pull/11547/files // (now named `codeFixClassExtendAbstractPrivateProperty.ts`) var flags = ts.getSyntacticModifierFlags(ts.first(symbol.getDeclarations())); - return !(flags & 8 /* ModifierFlags.Private */) && !!(flags & 128 /* ModifierFlags.Abstract */); + return !(flags & 8 /* ModifierFlags.Private */) && !!(flags & 256 /* ModifierFlags.Abstract */); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -157991,6 +159041,63 @@ var ts; })(ts || (ts = {})); /* @internal */ var ts; +(function (ts) { + var codefix; + (function (codefix) { + var fixId = "fixNaNEquality"; + var errorCodes = [ + ts.Diagnostics.This_condition_will_always_return_0.code, + ]; + codefix.registerCodeFix({ + errorCodes: errorCodes, + getCodeActions: function (context) { + var sourceFile = context.sourceFile, span = context.span, program = context.program; + var info = getInfo(program, sourceFile, span); + if (info === undefined) + return; + var suggestion = info.suggestion, expression = info.expression, arg = info.arg; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, arg, expression); }); + return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Use_0, suggestion], fixId, ts.Diagnostics.Use_Number_isNaN_in_all_conditions)]; + }, + fixIds: [fixId], + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(context.program, diag.file, ts.createTextSpan(diag.start, diag.length)); + if (info) { + doChange(changes, diag.file, info.arg, info.expression); + } + }); + } + }); + function getInfo(program, sourceFile, span) { + var diag = ts.find(program.getSemanticDiagnostics(sourceFile), function (diag) { return diag.start === span.start && diag.length === span.length; }); + if (diag === undefined || diag.relatedInformation === undefined) + return; + var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.Did_you_mean_0.code; }); + if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined) + return; + var token = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); + if (token === undefined) + return; + if (ts.isExpression(token) && ts.isBinaryExpression(token.parent)) { + return { suggestion: getSuggestion(related.messageText), expression: token.parent, arg: token }; + } + return undefined; + } + function doChange(changes, sourceFile, arg, expression) { + var callExpression = ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("Number"), ts.factory.createIdentifier("isNaN")), /*typeArguments*/ undefined, [arg]); + var operator = expression.operatorToken.kind; + changes.replaceNode(sourceFile, expression, operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ + ? ts.factory.createPrefixUnaryExpression(53 /* SyntaxKind.ExclamationToken */, callExpression) : callExpression); + } + function getSuggestion(messageText) { + var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/\'(.*)\'/) || [], _ = _a[0], suggestion = _a[1]; + return suggestion; + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var codefix; (function (codefix) { @@ -158308,7 +159415,7 @@ var ts; var importDeclaration = getImportDeclaration(context.sourceFile, context.program, context.span.start); if (!importDeclaration) return; - var namespaceChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return importDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ && doNamespaceImportChange(t, context.sourceFile, importDeclaration, context.program); }); + var namespaceChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return importDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ && doNamespaceImportChange(t, context.sourceFile, importDeclaration, context.program); }); var typeOnlyChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return doTypeOnlyImportChange(t, context.sourceFile, importDeclaration, context.program); }); var actions; if (namespaceChanges.length) { @@ -158323,7 +159430,7 @@ var ts; }); function getImportDeclaration(sourceFile, program, start) { var identifier = ts.tryCast(ts.getTokenAtPosition(sourceFile, start), ts.isIdentifier); - if (!identifier || identifier.parent.kind !== 178 /* SyntaxKind.TypeReference */) + if (!identifier || identifier.parent.kind !== 180 /* SyntaxKind.TypeReference */) return; var checker = program.getTypeChecker(); var symbol = checker.getSymbolAtLocation(identifier); @@ -158335,11 +159442,11 @@ var ts; // new type-only import declaration, but honestly I doubt anyone will ever use this // codefix at all, so it's probably not worth the lines of code. function doTypeOnlyImportChange(changes, sourceFile, importDeclaration, program) { - if (importDeclaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, importDeclaration.name); + if (importDeclaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, importDeclaration.name); return; } - var importClause = importDeclaration.kind === 267 /* SyntaxKind.ImportClause */ ? importDeclaration : importDeclaration.parent.parent; + var importClause = importDeclaration.kind === 270 /* SyntaxKind.ImportClause */ ? importDeclaration : importDeclaration.parent.parent; if (importClause.name && importClause.namedBindings) { // Cannot convert an import with a default import and named bindings to type-only // (it's a grammar error). @@ -158356,7 +159463,7 @@ var ts; // Don't convert it to type-only. return; } - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, importClause); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, importClause); } function doNamespaceImportChange(changes, sourceFile, importDeclaration, program) { ts.refactor.doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, importDeclaration.parent); @@ -158434,7 +159541,7 @@ var ts; ]; } var result = []; - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return changeInferToUnknown(t, sourceFile, token); }); var name = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name.text; result.push(codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Replace_infer_0_with_unknown, name], fixIdInfer, ts.Diagnostics.Replace_all_unused_infer_with_unknown)); @@ -158476,7 +159583,7 @@ var ts; break; } case fixIdDelete: { - if (token.kind === 137 /* SyntaxKind.InferKeyword */ || isImport(token)) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */ || isImport(token)) { break; // Can't delete } else if (ts.isJSDocTemplateTag(token)) { @@ -158505,7 +159612,7 @@ var ts; break; } case fixIdInfer: - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { changeInferToUnknown(changes, sourceFile, token); } break; @@ -158516,7 +159623,7 @@ var ts; }, }); function changeInferToUnknown(changes, sourceFile, token) { - changes.replaceNode(sourceFile, token.parent, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)); + changes.replaceNode(sourceFile, token.parent, ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)); } function createDeleteFix(changes, diag) { return codefix.createCodeFixAction(fixName, changes, diag, fixIdDelete, ts.Diagnostics.Delete_all_unused_declarations); @@ -158526,7 +159633,7 @@ var ts; } function isImport(token) { return token.kind === 100 /* SyntaxKind.ImportKeyword */ - || token.kind === 79 /* SyntaxKind.Identifier */ && (token.parent.kind === 270 /* SyntaxKind.ImportSpecifier */ || token.parent.kind === 267 /* SyntaxKind.ImportClause */); + || token.kind === 79 /* SyntaxKind.Identifier */ && (token.parent.kind === 273 /* SyntaxKind.ImportSpecifier */ || token.parent.kind === 270 /* SyntaxKind.ImportClause */); } /** Sometimes the diagnostic span is an entire ImportDeclaration, so we should remove the whole thing. */ function tryGetFullImport(token) { @@ -158536,7 +159643,7 @@ var ts; return ts.isVariableDeclarationList(token.parent) && ts.first(token.parent.getChildren(sourceFile)) === token; } function deleteEntireVariableStatement(changes, sourceFile, node) { - changes.delete(sourceFile, node.parent.kind === 237 /* SyntaxKind.VariableStatement */ ? node.parent : node); + changes.delete(sourceFile, node.parent.kind === 240 /* SyntaxKind.VariableStatement */ ? node.parent : node); } function deleteDestructuringElements(changes, sourceFile, node) { ts.forEach(node.elements, function (n) { return changes.delete(sourceFile, n); }); @@ -158545,7 +159652,7 @@ var ts; // Don't offer to prefix a property. if (errorCode === ts.Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code) return; - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { token = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name; } if (ts.isIdentifier(token) && canPrefix(token)) { @@ -158561,14 +159668,14 @@ var ts; } function canPrefix(token) { switch (token.parent.kind) { - case 164 /* SyntaxKind.Parameter */: - case 163 /* SyntaxKind.TypeParameter */: + case 166 /* SyntaxKind.Parameter */: + case 165 /* SyntaxKind.TypeParameter */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var varDecl = token.parent; switch (varDecl.parent.parent.kind) { - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return true; } } @@ -158623,8 +159730,8 @@ var ts; function mayDeleteParameter(checker, sourceFile, parameter, sourceFiles, program, cancellationToken, isFixAll) { var parent = parameter.parent; switch (parent.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: var index = parent.parameters.indexOf(parameter); var referent = ts.isMethodDeclaration(parent) ? parent.name : parent; var entries = ts.FindAllReferences.Core.getReferencedSymbolsForNode(parent.pos, referent, program, sourceFiles, cancellationToken); @@ -158654,20 +159761,20 @@ var ts; } } return true; - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { if (parent.name && isCallbackLike(checker, sourceFile, parent.name)) { return isLastParameter(parent, parameter, isFixAll); } return true; } - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: // Can't remove a non-last parameter in a callback. Can remove a parameter in code-fix-all if future parameters are also unused. return isLastParameter(parent, parameter, isFixAll); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Setter must have a parameter return false; - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Getter cannot have parameters return true; default: @@ -158728,7 +159835,7 @@ var ts; var container = (ts.isBlock(statement.parent) ? statement.parent : statement).parent; if (!ts.isBlock(statement.parent) || statement === ts.first(statement.parent.statements)) { switch (container.kind) { - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: if (container.elseStatement) { if (ts.isBlock(statement.parent)) { break; @@ -158739,8 +159846,8 @@ var ts; return; } // falls through - case 241 /* SyntaxKind.WhileStatement */: - case 242 /* SyntaxKind.ForStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: changes.delete(sourceFile, container); return; } @@ -158813,7 +159920,7 @@ var ts; var typeNode = info.typeNode, type = info.type; var original = typeNode.getText(sourceFile); var actions = [fix(type, fixIdPlain, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript)]; - if (typeNode.kind === 314 /* SyntaxKind.JSDocNullableType */) { + if (typeNode.kind === 317 /* SyntaxKind.JSDocNullableType */) { // for nullable types, suggest the flow-compatible `T | null | undefined` // in addition to the jsdoc/closure-compatible `T | null` actions.push(fix(checker.getNullableType(type, 32768 /* TypeFlags.Undefined */), fixIdNullable, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types)); @@ -158833,7 +159940,7 @@ var ts; if (!info) return; var typeNode = info.typeNode, type = info.type; - var fixedType = typeNode.kind === 314 /* SyntaxKind.JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* TypeFlags.Undefined */) : type; + var fixedType = typeNode.kind === 317 /* SyntaxKind.JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* TypeFlags.Undefined */) : type; doChange(changes, sourceFile, typeNode, fixedType, checker); }); } @@ -158850,22 +159957,22 @@ var ts; // NOTE: Some locations are not handled yet: // MappedTypeNode.typeParameters and SignatureDeclaration.typeParameters, as well as CallExpression.typeArguments switch (node.kind) { - case 229 /* SyntaxKind.AsExpression */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 176 /* SyntaxKind.IndexSignature */: - case 195 /* SyntaxKind.MappedType */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 173 /* SyntaxKind.SetAccessor */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 231 /* SyntaxKind.AsExpression */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 178 /* SyntaxKind.IndexSignature */: + case 197 /* SyntaxKind.MappedType */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 175 /* SyntaxKind.SetAccessor */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; default: return false; @@ -158968,14 +160075,14 @@ var ts; } var insertBefore; switch (containingFunction.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: insertBefore = containingFunction.name; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: insertBefore = ts.findChildOfKind(containingFunction, 98 /* SyntaxKind.FunctionKeyword */, sourceFile); break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: var kind = containingFunction.typeParameters ? 29 /* SyntaxKind.LessThanToken */ : 20 /* SyntaxKind.OpenParenToken */; insertBefore = ts.findChildOfKind(containingFunction, kind, sourceFile) || ts.first(containingFunction.parameters); break; @@ -158995,7 +160102,7 @@ var ts; changes.replaceNode(sourceFile, returnType, ts.factory.createTypeReferenceNode("Promise", ts.factory.createNodeArray([returnType]))); } } - changes.insertModifierBefore(sourceFile, 131 /* SyntaxKind.AsyncKeyword */, insertBefore); + changes.insertModifierBefore(sourceFile, 132 /* SyntaxKind.AsyncKeyword */, insertBefore); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -159311,7 +160418,7 @@ var ts; function annotate(changes, importAdder, sourceFile, declaration, type, program, host) { var typeNode = ts.getTypeNodeIfAccessible(type, declaration, program, host); if (typeNode) { - if (ts.isInJSFile(sourceFile) && declaration.kind !== 166 /* SyntaxKind.PropertySignature */) { + if (ts.isInJSFile(sourceFile) && declaration.kind !== 168 /* SyntaxKind.PropertySignature */) { var parent = ts.isVariableDeclaration(declaration) ? ts.tryCast(declaration.parent.parent, ts.isVariableStatement) : declaration; if (!parent) { return; @@ -159398,19 +160505,19 @@ var ts; function getFunctionReferences(containingFunction, sourceFile, program, cancellationToken) { var searchToken; switch (containingFunction.kind) { - case 171 /* SyntaxKind.Constructor */: - searchToken = ts.findChildOfKind(containingFunction, 134 /* SyntaxKind.ConstructorKeyword */, sourceFile); + case 173 /* SyntaxKind.Constructor */: + searchToken = ts.findChildOfKind(containingFunction, 135 /* SyntaxKind.ConstructorKeyword */, sourceFile); break; - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: var parent = containingFunction.parent; searchToken = (ts.isVariableDeclaration(parent) || ts.isPropertyDeclaration(parent)) && ts.isIdentifier(parent.name) ? parent.name : containingFunction.name; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: searchToken = containingFunction.name; break; } @@ -159552,24 +160659,24 @@ var ts; node = node.parent; } switch (node.parent.kind) { - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: inferTypeFromExpressionStatement(node, usage); break; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: usage.isNumber = true; break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: inferTypeFromPrefixUnaryExpression(node.parent, usage); break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: inferTypeFromBinaryExpression(node, node.parent, usage); break; - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: inferTypeFromSwitchStatementLabel(node.parent, usage); break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: if (node.parent.expression === node) { inferTypeFromCallExpression(node.parent, usage); } @@ -159577,20 +160684,20 @@ var ts; inferTypeFromContextualType(node, usage); } break; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: inferTypeFromPropertyAccessExpression(node.parent, usage); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: inferTypeFromPropertyElementExpression(node.parent, node, usage); break; - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: inferTypeFromPropertyAssignment(node.parent, usage); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: inferTypeFromPropertyDeclaration(node.parent, usage); break; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var _a = node.parent, name = _a.name, initializer = _a.initializer; if (node === name) { if (initializer) { // This can happen for `let x = null;` which still has an implicit-any error. @@ -159712,7 +160819,7 @@ var ts; case 56 /* SyntaxKind.BarBarToken */: case 60 /* SyntaxKind.QuestionQuestionToken */: if (node === parent.left && - (node.parent.parent.kind === 254 /* SyntaxKind.VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) { + (node.parent.parent.kind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) { // var x = x || {}; // TODO: use getFalsyflagsOfType addCandidateType(usage, checker.getTypeAtLocation(parent.right)); @@ -159740,7 +160847,7 @@ var ts; } } calculateUsageOfNode(parent, call.return_); - if (parent.kind === 208 /* SyntaxKind.CallExpression */) { + if (parent.kind === 210 /* SyntaxKind.CallExpression */) { (usage.calls || (usage.calls = [])).push(call); } else { @@ -160194,25 +161301,44 @@ var ts; * @param body If defined, this will be the body of the member node passed to `addClassElement`. Otherwise, the body will default to a stub. */ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional, isAmbient) { + var _a; if (preserveOptional === void 0) { preserveOptional = 3 /* PreserveOptionalFlags.All */; } if (isAmbient === void 0) { isAmbient = false; } var declarations = symbol.getDeclarations(); - if (!(declarations && declarations.length)) { - return undefined; - } + var declaration = declarations === null || declarations === void 0 ? void 0 : declarations[0]; var checker = context.program.getTypeChecker(); var scriptTarget = ts.getEmitScriptTarget(context.program.getCompilerOptions()); - var declaration = declarations[0]; - var name = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false); - var visibilityModifier = createVisibilityModifier(ts.getEffectiveModifierFlags(declaration)); - var modifiers = visibilityModifier ? ts.factory.createNodeArray([visibilityModifier]) : undefined; + /** + * (#49811) + * Note that there are cases in which the symbol declaration is not present. For example, in the code below both + * `MappedIndirect.ax` and `MappedIndirect.ay` have no declaration node attached (due to their mapped-type + * parent): + * + * ```ts + * type Base = { ax: number; ay: string }; + * type BaseKeys = keyof Base; + * type MappedIndirect = { [K in BaseKeys]: boolean }; + * ``` + * + * In such cases, we assume the declaration to be a `PropertySignature`. + */ + var kind = (_a = declaration === null || declaration === void 0 ? void 0 : declaration.kind) !== null && _a !== void 0 ? _a : 168 /* SyntaxKind.PropertySignature */; + var declarationName = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false); + var effectiveModifierFlags = declaration ? ts.getEffectiveModifierFlags(declaration) : 0 /* ModifierFlags.None */; + var modifierFlags = effectiveModifierFlags & 4 /* ModifierFlags.Public */ ? 4 /* ModifierFlags.Public */ : + effectiveModifierFlags & 16 /* ModifierFlags.Protected */ ? 16 /* ModifierFlags.Protected */ : + 0 /* ModifierFlags.None */; + if (declaration && ts.isAutoAccessorPropertyDeclaration(declaration)) { + modifierFlags |= 128 /* ModifierFlags.Accessor */; + } + var modifiers = modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration)); var optional = !!(symbol.flags & 16777216 /* SymbolFlags.Optional */); var ambient = !!(enclosingDeclaration.flags & 16777216 /* NodeFlags.Ambient */) || isAmbient; var quotePreference = ts.getQuotePreference(sourceFile, preferences); - switch (declaration.kind) { - case 166 /* SyntaxKind.PropertySignature */: - case 167 /* SyntaxKind.PropertyDeclaration */: + switch (kind) { + case 168 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: var flags = quotePreference === 0 /* QuotePreference.Single */ ? 268435456 /* NodeBuilderFlags.UseSingleQuotesForStringLiteralType */ : undefined; var typeNode = checker.typeToTypeNode(type, enclosingDeclaration, flags, getNoopSymbolTrackerWithResolver(context)); if (importAdder) { @@ -160222,11 +161348,12 @@ var ts; importSymbols(importAdder, importableReference.symbols); } } - addClassElement(ts.factory.createPropertyDeclaration(modifiers, name, optional && (preserveOptional & 2 /* PreserveOptionalFlags.Property */) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, typeNode, + addClassElement(ts.factory.createPropertyDeclaration(modifiers, declaration ? createName(declarationName) : symbol.getName(), optional && (preserveOptional & 2 /* PreserveOptionalFlags.Property */) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, typeNode, /*initializer*/ undefined)); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: { + ts.Debug.assertIsDefined(declarations); var typeNode_1 = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context)); var allAccessors = ts.getAllAccessorDeclarations(declarations, declaration); var orderedAccessors = allAccessors.secondAccessor @@ -160242,19 +161369,19 @@ var ts; for (var _i = 0, orderedAccessors_1 = orderedAccessors; _i < orderedAccessors_1.length; _i++) { var accessor = orderedAccessors_1[_i]; if (ts.isGetAccessorDeclaration(accessor)) { - addClassElement(ts.factory.createGetAccessorDeclaration(modifiers, name, ts.emptyArray, typeNode_1, ambient ? undefined : body || createStubbedMethodBody(quotePreference))); + addClassElement(ts.factory.createGetAccessorDeclaration(modifiers, createName(declarationName), ts.emptyArray, createTypeNode(typeNode_1), createBody(body, quotePreference, ambient))); } else { ts.Debug.assertNode(accessor, ts.isSetAccessorDeclaration, "The counterpart to a getter should be a setter"); var parameter = ts.getSetAccessorValueParameter(accessor); var parameterName = parameter && ts.isIdentifier(parameter.name) ? ts.idText(parameter.name) : undefined; - addClassElement(ts.factory.createSetAccessorDeclaration(modifiers, name, createDummyParameters(1, [parameterName], [typeNode_1], 1, /*inJs*/ false), ambient ? undefined : body || createStubbedMethodBody(quotePreference))); + addClassElement(ts.factory.createSetAccessorDeclaration(modifiers, createName(declarationName), createDummyParameters(1, [parameterName], [createTypeNode(typeNode_1)], 1, /*inJs*/ false), createBody(body, quotePreference, ambient))); } } break; } - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: // The signature for the implementation appears as an entry in `signatures` iff // there is only one signature. // If there are overloads and an implementation signature, it appears as an @@ -160262,6 +161389,7 @@ var ts; // If there is more than one overload but no implementation signature // (eg: an abstract method or interface declaration), there is a 1-1 // correspondence of declarations and signatures. + ts.Debug.assertIsDefined(declarations); var signatures = type.isUnion() ? ts.flatMap(type.types, function (t) { return t.getCallSignatures(); }) : type.getCallSignatures(); if (!ts.some(signatures)) { break; @@ -160269,31 +161397,41 @@ var ts; if (declarations.length === 1) { ts.Debug.assert(signatures.length === 1, "One declaration implies one signature"); var signature = signatures[0]; - outputMethod(quotePreference, signature, modifiers, name, ambient ? undefined : body || createStubbedMethodBody(quotePreference)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName), createBody(body, quotePreference, ambient)); break; } - for (var _a = 0, signatures_1 = signatures; _a < signatures_1.length; _a++) { - var signature = signatures_1[_a]; + for (var _b = 0, signatures_1 = signatures; _b < signatures_1.length; _b++) { + var signature = signatures_1[_b]; // Ensure nodes are fresh so they can have different positions when going through formatting. - outputMethod(quotePreference, signature, ts.getSynthesizedDeepClones(modifiers, /*includeTrivia*/ false), ts.getSynthesizedDeepClone(name, /*includeTrivia*/ false)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName)); } if (!ambient) { if (declarations.length > signatures.length) { var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]); - outputMethod(quotePreference, signature, modifiers, name, body || createStubbedMethodBody(quotePreference)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName), createBody(body, quotePreference)); } else { ts.Debug.assert(declarations.length === signatures.length, "Declarations and signatures should match count"); - addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), modifiers, quotePreference, body)); + addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, createName(declarationName), optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), modifiers, quotePreference, body)); } } break; } function outputMethod(quotePreference, signature, modifiers, name, body) { - var method = createSignatureDeclarationFromSignature(169 /* SyntaxKind.MethodDeclaration */, context, quotePreference, signature, body, name, modifiers, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), enclosingDeclaration, importAdder); + var method = createSignatureDeclarationFromSignature(171 /* SyntaxKind.MethodDeclaration */, context, quotePreference, signature, body, name, modifiers, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), enclosingDeclaration, importAdder); if (method) addClassElement(method); } + function createName(node) { + return ts.getSynthesizedDeepClone(node, /*includeTrivia*/ false); + } + function createBody(block, quotePreference, ambient) { + return ambient ? undefined : + ts.getSynthesizedDeepClone(block, /*includeTrivia*/ false) || createStubbedMethodBody(quotePreference); + } + function createTypeNode(typeNode) { + return ts.getSynthesizedDeepClone(typeNode, /*includeTrivia*/ false); + } } codefix.addNewNodeForMemberSymbol = addNewNodeForMemberSymbol; function createSignatureDeclarationFromSignature(kind, context, quotePreference, signature, body, name, modifiers, optional, enclosingDeclaration, importAdder) { @@ -160367,6 +161505,9 @@ var ts; if (ts.isMethodDeclaration(signatureDeclaration)) { return ts.factory.updateMethodDeclaration(signatureDeclaration, modifiers, asteriskToken, name !== null && name !== void 0 ? name : ts.factory.createIdentifier(""), questionToken, typeParameters, parameters, type, body); } + if (ts.isFunctionDeclaration(signatureDeclaration)) { + return ts.factory.updateFunctionDeclaration(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, ts.tryCast(name, ts.isIdentifier), typeParameters, parameters, type, body !== null && body !== void 0 ? body : signatureDeclaration.body); + } return undefined; } codefix.createSignatureDeclarationFromSignature = createSignatureDeclarationFromSignature; @@ -160395,13 +161536,13 @@ var ts; ? undefined : checker.typeToTypeNode(contextualType, contextNode, /*flags*/ undefined, tracker); switch (kind) { - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return ts.factory.createMethodDeclaration(modifiers, asteriskToken, name, /*questionToken*/ undefined, typeParameters, parameters, type, createStubbedMethodBody(quotePreference)); - case 168 /* SyntaxKind.MethodSignature */: + case 170 /* SyntaxKind.MethodSignature */: return ts.factory.createMethodSignature(modifiers, name, - /*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */) : type); - case 256 /* SyntaxKind.FunctionDeclaration */: + /*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */) : type); + case 259 /* SyntaxKind.FunctionDeclaration */: return ts.factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference)); default: ts.Debug.fail("Unexpected kind"); @@ -160538,7 +161679,7 @@ var ts; /*dotDotDotToken*/ undefined, /*name*/ parameterName + (parameterNameCount || ""), /*questionToken*/ minArgumentCount !== undefined && i >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, - /*type*/ inJs ? undefined : (types === null || types === void 0 ? void 0 : types[i]) || ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */), + /*type*/ inJs ? undefined : (types === null || types === void 0 ? void 0 : types[i]) || ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */), /*initializer*/ undefined); parameters.push(newParameter); } @@ -160568,7 +161709,7 @@ var ts; if (someSigHasRestParameter) { var restParameter = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */), maxArgsParameterSymbolNames[maxNonRestArgs] || "rest", - /*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)), + /*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)), /*initializer*/ undefined); parameters.push(restParameter); } @@ -160596,15 +161737,6 @@ var ts; /*multiline*/ true); } codefix.createStubbedBody = createStubbedBody; - function createVisibilityModifier(flags) { - if (flags & 4 /* ModifierFlags.Public */) { - return ts.factory.createToken(123 /* SyntaxKind.PublicKeyword */); - } - else if (flags & 16 /* ModifierFlags.Protected */) { - return ts.factory.createToken(122 /* SyntaxKind.ProtectedKeyword */); - } - return undefined; - } function setJsonCompilerOptionValues(changeTracker, configFile, options) { var tsconfigObjectLiteral = ts.getTsConfigObjectLiteralExpression(configFile); if (!tsconfigObjectLiteral) @@ -160683,6 +161815,15 @@ var ts; symbols.forEach(function (s) { return importAdder.addImportFromExportedSymbol(s, /*isValidTypeOnlyUseSite*/ true); }); } codefix.importSymbols = importSymbols; + function findAncestorMatchingSpan(sourceFile, span) { + var end = ts.textSpanEnd(span); + var token = ts.getTokenAtPosition(sourceFile, span.start); + while (token.end < end) { + token = token.parent; + } + return token; + } + codefix.findAncestorMatchingSpan = findAncestorMatchingSpan; })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); /* @internal */ @@ -160705,13 +161846,13 @@ var ts; if (ts.isClassLike(container)) { var modifierFlags = ts.getEffectiveModifierFlags(declaration); if (ts.isSourceFileJS(file)) { - var modifiers = ts.createModifiers(modifierFlags); + var modifiers = ts.factory.createModifiersFromModifierFlags(modifierFlags); accessorModifiers = modifiers; fieldModifiers = modifiers; } else { - accessorModifiers = ts.createModifiers(prepareModifierFlagsForAccessor(modifierFlags)); - fieldModifiers = ts.createModifiers(prepareModifierFlagsForField(modifierFlags)); + accessorModifiers = ts.factory.createModifiersFromModifierFlags(prepareModifierFlagsForAccessor(modifierFlags)); + fieldModifiers = ts.factory.createModifiersFromModifierFlags(prepareModifierFlagsForField(modifierFlags)); } if (ts.canHaveDecorators(declaration)) { fieldModifiers = ts.concatenate(ts.getDecorators(declaration), fieldModifiers); @@ -160780,7 +161921,7 @@ var ts; error: ts.getLocaleSpecificMessage(ts.Diagnostics.Name_is_not_valid) }; } - if (((ts.getEffectiveModifierFlags(declaration) & 125951 /* ModifierFlags.Modifier */) | meaning) !== meaning) { + if (((ts.getEffectiveModifierFlags(declaration) & 126975 /* ModifierFlags.Modifier */) | meaning) !== meaning) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_property_with_modifier) }; @@ -160793,7 +161934,7 @@ var ts; isStatic: ts.hasStaticModifier(declaration), isReadonly: ts.hasEffectiveReadonlyModifier(declaration), type: getDeclarationType(declaration, program), - container: declaration.kind === 164 /* SyntaxKind.Parameter */ ? declaration.parent.parent : declaration.parent, + container: declaration.kind === 166 /* SyntaxKind.Parameter */ ? declaration.parent.parent : declaration.parent, originalName: declaration.name.text, declaration: declaration, fieldName: fieldName, @@ -160867,7 +162008,7 @@ var ts; var type = typeChecker.getTypeFromTypeNode(typeNode); if (!typeChecker.isTypeAssignableTo(typeChecker.getUndefinedType(), type)) { var types = ts.isUnionTypeNode(typeNode) ? typeNode.types : [typeNode]; - return ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], types, true), [ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)], false)); + return ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], types, true), [ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)], false)); } } return typeNode; @@ -160925,7 +162066,7 @@ var ts; }); function getActionsForUsageOfInvalidImport(context) { var sourceFile = context.sourceFile; - var targetKind = ts.Diagnostics.This_expression_is_not_callable.code === context.errorCode ? 208 /* SyntaxKind.CallExpression */ : 209 /* SyntaxKind.NewExpression */; + var targetKind = ts.Diagnostics.This_expression_is_not_callable.code === context.errorCode ? 210 /* SyntaxKind.CallExpression */ : 211 /* SyntaxKind.NewExpression */; var node = ts.findAncestor(ts.getTokenAtPosition(sourceFile, context.span.start), function (a) { return a.kind === targetKind; }); if (!node) { return []; @@ -161051,7 +162192,7 @@ var ts; return codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Add_undefined_type_to_property_0, info.prop.name.getText()], fixIdAddUndefinedType, ts.Diagnostics.Add_undefined_type_to_all_uninitialized_properties); } function addUndefinedType(changeTracker, sourceFile, info) { - var undefinedTypeNode = ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */); + var undefinedTypeNode = ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */); var types = ts.isUnionTypeNode(info.type) ? info.type.types.concat(undefinedTypeNode) : [info.type, undefinedTypeNode]; var unionTypeNode = ts.factory.createUnionTypeNode(types); if (info.isJs) { @@ -161097,7 +162238,7 @@ var ts; } else if (type.isClass()) { var classDeclaration = ts.getClassLikeDeclarationOfSymbol(type.symbol); - if (!classDeclaration || ts.hasSyntacticModifier(classDeclaration, 128 /* ModifierFlags.Abstract */)) + if (!classDeclaration || ts.hasSyntacticModifier(classDeclaration, 256 /* ModifierFlags.Abstract */)) return undefined; var constructorDeclaration = ts.getFirstConstructorWithBody(classDeclaration); if (constructorDeclaration && constructorDeclaration.parameters.length) @@ -161274,7 +162415,7 @@ var ts; function getImportTypeNode(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); ts.Debug.assert(token.kind === 100 /* SyntaxKind.ImportKeyword */, "This token should be an ImportKeyword"); - ts.Debug.assert(token.parent.kind === 200 /* SyntaxKind.ImportType */, "Token parent should be an ImportType"); + ts.Debug.assert(token.parent.kind === 202 /* SyntaxKind.ImportType */, "Token parent should be an ImportType"); return token.parent; } function doChange(changes, sourceFile, importType) { @@ -161403,7 +162544,7 @@ var ts; var otherMembers = members.filter(function (member) { return !ts.isIndexSignatureDeclaration(member); }); var parameter = ts.first(indexSignature.parameters); var mappedTypeParameter = ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.cast(parameter.name, ts.isIdentifier), parameter.type); - var mappedIntersectionType = ts.factory.createMappedTypeNode(ts.hasEffectiveReadonlyModifier(indexSignature) ? ts.factory.createModifier(145 /* SyntaxKind.ReadonlyKeyword */) : undefined, mappedTypeParameter, + var mappedIntersectionType = ts.factory.createMappedTypeNode(ts.hasEffectiveReadonlyModifier(indexSignature) ? ts.factory.createModifier(146 /* SyntaxKind.ReadonlyKeyword */) : undefined, mappedTypeParameter, /*nameType*/ undefined, indexSignature.questionToken, indexSignature.type, /*members*/ undefined); var intersectionType = ts.factory.createIntersectionTypeNode(__spreadArray(__spreadArray(__spreadArray([], ts.getAllSuperTypeNodes(container), true), [ @@ -161461,7 +162602,7 @@ var ts; }, }); function makeChange(changeTracker, sourceFile, span) { - var awaitKeyword = ts.tryCast(ts.getTokenAtPosition(sourceFile, span.start), function (node) { return node.kind === 132 /* SyntaxKind.AwaitKeyword */; }); + var awaitKeyword = ts.tryCast(ts.getTokenAtPosition(sourceFile, span.start), function (node) { return node.kind === 133 /* SyntaxKind.AwaitKeyword */; }); var awaitExpression = awaitKeyword && ts.tryCast(awaitKeyword.parent, ts.isAwaitExpression); if (!awaitExpression) { return; @@ -161528,28 +162669,45 @@ var ts; errorCodes: errorCodes, getCodeActions: function getCodeActionsToConvertConstToLet(context) { var sourceFile = context.sourceFile, span = context.span, program = context.program; - var range = getConstTokenRange(sourceFile, span.start, program); - if (range === undefined) + var info = getInfo(sourceFile, span.start, program); + if (info === undefined) return; - var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, range); }); - return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Convert_const_to_let, fixId, ts.Diagnostics.Convert_const_to_let)]; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, info.token); }); + return [codefix.createCodeFixActionMaybeFixAll(fixId, changes, ts.Diagnostics.Convert_const_to_let, fixId, ts.Diagnostics.Convert_all_const_to_let)]; + }, + getAllCodeActions: function (context) { + var program = context.program; + var seen = new ts.Map(); + return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, function (changes) { + codefix.eachDiagnostic(context, errorCodes, function (diag) { + var info = getInfo(diag.file, diag.start, program); + if (info) { + if (ts.addToSeen(seen, ts.getSymbolId(info.symbol))) { + return doChange(changes, diag.file, info.token); + } + } + return undefined; + }); + })); }, fixIds: [fixId] }); - function getConstTokenRange(sourceFile, pos, program) { + function getInfo(sourceFile, pos, program) { var _a; var checker = program.getTypeChecker(); var symbol = checker.getSymbolAtLocation(ts.getTokenAtPosition(sourceFile, pos)); + if (symbol === undefined) + return; var declaration = ts.tryCast((_a = symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.parent, ts.isVariableDeclarationList); if (declaration === undefined) return; var constToken = ts.findChildOfKind(declaration, 85 /* SyntaxKind.ConstKeyword */, sourceFile); if (constToken === undefined) return; - return ts.createRange(constToken.pos, constToken.end); + return { symbol: symbol, token: constToken }; } - function doChange(changes, sourceFile, range) { - changes.replaceRangeWithText(sourceFile, range, "let"); + function doChange(changes, sourceFile, token) { + changes.replaceNode(sourceFile, token, ts.factory.createToken(119 /* SyntaxKind.LetKeyword */)); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -161724,7 +162882,6 @@ var ts; return { edits: edits, renameFilename: undefined, renameLocation: undefined }; }, }); - ; function getInfo(context, considerPartialSpans) { if (considerPartialSpans === void 0) { considerPartialSpans = true; } var file = context.file, program = context.program; @@ -161736,8 +162893,8 @@ var ts; } var checker = program.getTypeChecker(); var exportingModuleSymbol = getExportingModuleSymbol(exportNode, checker); - var flags = ts.getSyntacticModifierFlags(exportNode) || ((ts.isExportAssignment(exportNode) && !exportNode.isExportEquals) ? 513 /* ModifierFlags.ExportDefault */ : 0 /* ModifierFlags.None */); - var wasDefault = !!(flags & 512 /* ModifierFlags.Default */); + var flags = ts.getSyntacticModifierFlags(exportNode) || ((ts.isExportAssignment(exportNode) && !exportNode.isExportEquals) ? 1025 /* ModifierFlags.ExportDefault */ : 0 /* ModifierFlags.None */); + var wasDefault = !!(flags & 1024 /* ModifierFlags.Default */); // If source file already has a default export, don't offer refactor. if (!(flags & 1 /* ModifierFlags.Export */) || !wasDefault && exportingModuleSymbol.exports.has("default" /* InternalSymbolName.Default */)) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.This_file_already_has_a_default_export) }; @@ -161747,19 +162904,19 @@ var ts; : { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_named_export) }; }; switch (exportNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: { var node = exportNode; if (!node.name) return undefined; return noSymbolError(node.name) || { exportNode: node, exportName: node.name, wasDefault: wasDefault, exportingModuleSymbol: exportingModuleSymbol }; } - case 237 /* SyntaxKind.VariableStatement */: { + case 240 /* SyntaxKind.VariableStatement */: { var vs = exportNode; // Must be `export const x = something;`. if (!(vs.declarationList.flags & 2 /* NodeFlags.Const */) || vs.declarationList.declarations.length !== 1) { @@ -161772,7 +162929,7 @@ var ts; return noSymbolError(decl.name) || { exportNode: vs, exportName: decl.name, wasDefault: wasDefault, exportingModuleSymbol: exportingModuleSymbol }; } - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var node = exportNode; if (node.isExportEquals) return undefined; @@ -161802,12 +162959,12 @@ var ts; else { var exportKeyword = ts.Debug.checkDefined(ts.findModifier(exportNode, 93 /* SyntaxKind.ExportKeyword */), "Should find an export keyword in modifier list"); switch (exportNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: changes.insertNodeAfter(exportingSourceFile, exportKeyword, ts.factory.createToken(88 /* SyntaxKind.DefaultKeyword */)); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // If 'x' isn't used in this file and doesn't have type definition, `export const x = 0;` --> `export default 0;` var decl = ts.first(exportNode.declarationList.declarations); if (!ts.FindAllReferences.Core.isSymbolReferencedInFile(exportName, checker, exportingSourceFile) && !decl.type) { @@ -161816,9 +162973,9 @@ var ts; break; } // falls through - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // `export type T = number;` -> `type T = number; export default T;` changes.deleteModifier(exportingSourceFile, exportKeyword); changes.insertNodeAfter(exportingSourceFile, exportNode, ts.factory.createExportDefault(ts.factory.createIdentifier(exportName.text))); @@ -161847,18 +163004,18 @@ var ts; function changeDefaultToNamedImport(importingSourceFile, ref, changes, exportName) { var parent = ref.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // `a.default` --> `a.foo` changes.replaceNode(importingSourceFile, ref, ts.factory.createIdentifier(exportName)); break; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: { + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: { var spec = parent; // `default as foo` --> `foo`, `default as bar` --> `foo as bar` changes.replaceNode(importingSourceFile, spec, makeImportSpecifier(exportName, spec.name.text)); break; } - case 267 /* SyntaxKind.ImportClause */: { + case 270 /* SyntaxKind.ImportClause */: { var clause = parent; ts.Debug.assert(clause.name === ref, "Import clause name should match provided ref"); var spec = makeImportSpecifier(exportName, ref.text); @@ -161867,7 +163024,7 @@ var ts; // `import foo from "./a";` --> `import { foo } from "./a";` changes.replaceNode(importingSourceFile, ref, ts.factory.createNamedImports([spec])); } - else if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + else if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { // `import foo, * as a from "./a";` --> `import * as a from ".a/"; import { foo } from "./a";` changes.deleteRange(importingSourceFile, { pos: ref.getStart(importingSourceFile), end: namedBindings.getStart(importingSourceFile) }); var quotePreference = ts.isStringLiteral(clause.parent.moduleSpecifier) ? ts.quotePreferenceFromString(clause.parent.moduleSpecifier, importingSourceFile) : 1 /* QuotePreference.Double */; @@ -161881,7 +163038,7 @@ var ts; } break; } - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: var importTypeNode = parent; changes.replaceNode(importingSourceFile, parent, ts.factory.createImportTypeNode(importTypeNode.argument, importTypeNode.assertions, ts.factory.createIdentifier(exportName), importTypeNode.typeArguments, importTypeNode.isTypeOf)); break; @@ -161892,11 +163049,11 @@ var ts; function changeNamedToDefaultImport(importingSourceFile, ref, changes) { var parent = ref.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // `a.foo` --> `a.default` changes.replaceNode(importingSourceFile, ref, ts.factory.createIdentifier("default")); break; - case 270 /* SyntaxKind.ImportSpecifier */: { + case 273 /* SyntaxKind.ImportSpecifier */: { // `import { foo } from "./a";` --> `import foo from "./a";` // `import { foo as bar } from "./a";` --> `import bar from "./a";` var defaultImport = ts.factory.createIdentifier(parent.name.text); @@ -161909,7 +163066,7 @@ var ts; } break; } - case 275 /* SyntaxKind.ExportSpecifier */: { + case 278 /* SyntaxKind.ExportSpecifier */: { // `export { foo } from "./a";` --> `export { default as foo } from "./a";` // `export { foo as bar } from "./a";` --> `export { default as bar } from "./a";` // `export { foo as default } from "./a";` --> `export { default } from "./a";` @@ -162010,7 +163167,7 @@ var ts; if (!importClause.namedBindings) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_namespace_import_or_named_imports) }; } - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { return { convertTo: 0 /* ImportKind.Named */, import: importClause.namedBindings }; } var shouldUseDefault = getShouldUseDefault(context.program, importClause); @@ -162201,7 +163358,6 @@ var ts; }); return { edits: edits, renameFilename: undefined, renameLocation: undefined }; } - ; function isValidExpression(node) { return ts.isBinaryExpression(node) || ts.isConditionalExpression(node); } @@ -162249,7 +163405,6 @@ var ts; if (expression.operatorToken.kind !== 55 /* SyntaxKind.AmpersandAmpersandToken */) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_logical_AND_access_chains) }; } - ; var finalExpression = getFinalExpressionInChain(expression.right); if (!finalExpression) return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_convertible_access_expression) }; @@ -162459,27 +163614,27 @@ var ts; var lastDeclaration = signatureDecls[signatureDecls.length - 1]; var updated = lastDeclaration; switch (lastDeclaration.kind) { - case 168 /* SyntaxKind.MethodSignature */: { + case 170 /* SyntaxKind.MethodSignature */: { updated = ts.factory.updateMethodSignature(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.name, lastDeclaration.questionToken, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 169 /* SyntaxKind.MethodDeclaration */: { + case 171 /* SyntaxKind.MethodDeclaration */: { updated = ts.factory.updateMethodDeclaration(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.asteriskToken, lastDeclaration.name, lastDeclaration.questionToken, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type, lastDeclaration.body); break; } - case 174 /* SyntaxKind.CallSignature */: { + case 176 /* SyntaxKind.CallSignature */: { updated = ts.factory.updateCallSignature(lastDeclaration, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 171 /* SyntaxKind.Constructor */: { + case 173 /* SyntaxKind.Constructor */: { updated = ts.factory.updateConstructorDeclaration(lastDeclaration, lastDeclaration.modifiers, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.body); break; } - case 175 /* SyntaxKind.ConstructSignature */: { + case 177 /* SyntaxKind.ConstructSignature */: { updated = ts.factory.updateConstructSignature(lastDeclaration, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { updated = ts.factory.updateFunctionDeclaration(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.asteriskToken, lastDeclaration.name, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type, lastDeclaration.body); break; } @@ -162510,7 +163665,7 @@ var ts; } function convertParameterToNamedTupleMember(p) { ts.Debug.assert(ts.isIdentifier(p.name)); // This is checked during refactoring applicability checking - var result = ts.setTextRange(ts.factory.createNamedTupleMember(p.dotDotDotToken, p.name, p.questionToken, p.type || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)), p); + var result = ts.setTextRange(ts.factory.createNamedTupleMember(p.dotDotDotToken, p.name, p.questionToken, p.type || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)), p); var parameterDocComment = p.symbol && p.symbol.getDocumentationComment(checker); if (parameterDocComment) { var newComment = ts.displayPartsToString(parameterDocComment); @@ -162530,12 +163685,12 @@ var ts; } function isConvertableSignatureDeclaration(d) { switch (d.kind) { - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 174 /* SyntaxKind.CallSignature */: - case 171 /* SyntaxKind.Constructor */: - case 175 /* SyntaxKind.ConstructSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 176 /* SyntaxKind.CallSignature */: + case 173 /* SyntaxKind.Constructor */: + case 177 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: return true; } return false; @@ -162930,20 +164085,20 @@ var ts; function checkForStaticContext(nodeToCheck, containingClass) { var current = nodeToCheck; while (current !== containingClass) { - if (current.kind === 167 /* SyntaxKind.PropertyDeclaration */) { + if (current.kind === 169 /* SyntaxKind.PropertyDeclaration */) { if (ts.isStatic(current)) { rangeFacts |= RangeFacts.InStaticRegion; } break; } - else if (current.kind === 164 /* SyntaxKind.Parameter */) { + else if (current.kind === 166 /* SyntaxKind.Parameter */) { var ctorOrMethod = ts.getContainingFunction(current); - if (ctorOrMethod.kind === 171 /* SyntaxKind.Constructor */) { + if (ctorOrMethod.kind === 173 /* SyntaxKind.Constructor */) { rangeFacts |= RangeFacts.InStaticRegion; } break; } - else if (current.kind === 169 /* SyntaxKind.MethodDeclaration */) { + else if (current.kind === 171 /* SyntaxKind.MethodDeclaration */) { if (ts.isStatic(current)) { rangeFacts |= RangeFacts.InStaticRegion; } @@ -162981,9 +164136,9 @@ var ts; visit(nodeToCheck); if (rangeFacts & RangeFacts.UsesThis) { var container = ts.getThisContainer(nodeToCheck, /** includeArrowFunctions */ false); - if (container.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) || - container.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (container.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) || + container.kind === 215 /* SyntaxKind.FunctionExpression */) { rangeFacts |= RangeFacts.UsesThisInFunction; } } @@ -162994,7 +164149,7 @@ var ts; return true; } if (ts.isDeclaration(node)) { - var declaringNode = (node.kind === 254 /* SyntaxKind.VariableDeclaration */) ? node.parent.parent : node; + var declaringNode = (node.kind === 257 /* SyntaxKind.VariableDeclaration */) ? node.parent.parent : node; if (ts.hasSyntacticModifier(declaringNode, 1 /* ModifierFlags.Export */)) { // TODO: GH#18217 Silly to use `errors ||` since it's definitely not defined (see top of `visit`) // Also, if we're only pushing one error, just use `let error: Diagnostic | undefined`! @@ -163006,16 +164161,16 @@ var ts; } // Some things can't be extracted in certain situations switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractImport)); return true; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractExportedEntity)); return true; case 106 /* SyntaxKind.SuperKeyword */: // For a super *constructor call*, we have to be extracting the entire class, // but a super *method call* simply implies a 'this' reference - if (node.parent.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.parent.kind === 210 /* SyntaxKind.CallExpression */) { // Super constructor call var containingClass_1 = ts.getContainingClass(node); if (containingClass_1 === undefined || containingClass_1.pos < span.start || containingClass_1.end >= (span.start + span.length)) { @@ -163028,7 +164183,7 @@ var ts; thisNode = node; } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // check if arrow function uses this ts.forEachChild(node, function check(n) { if (ts.isThis(n)) { @@ -163043,39 +164198,39 @@ var ts; } }); // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.isSourceFile(node.parent) && node.parent.externalModuleIndicator === undefined) { // You cannot extract global declarations (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.functionWillNotBeVisibleInTheNewScope)); } // falls through - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // do not dive into functions or classes return false; } var savedPermittedJumps = permittedJumps; switch (node.kind) { - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: permittedJumps &= ~4 /* PermittedJumps.Return */; break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // forbid all jumps inside try blocks permittedJumps = 0 /* PermittedJumps.None */; break; - case 235 /* SyntaxKind.Block */: - if (node.parent && node.parent.kind === 252 /* SyntaxKind.TryStatement */ && node.parent.finallyBlock === node) { + case 238 /* SyntaxKind.Block */: + if (node.parent && node.parent.kind === 255 /* SyntaxKind.TryStatement */ && node.parent.finallyBlock === node) { // allow unconditional returns from finally blocks permittedJumps = 4 /* PermittedJumps.Return */; } break; - case 290 /* SyntaxKind.DefaultClause */: - case 289 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: // allow unlabeled break inside case clauses permittedJumps |= 1 /* PermittedJumps.Break */; break; @@ -163087,20 +164242,20 @@ var ts; break; } switch (node.kind) { - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 108 /* SyntaxKind.ThisKeyword */: rangeFacts |= RangeFacts.UsesThis; thisNode = node; break; - case 250 /* SyntaxKind.LabeledStatement */: { + case 253 /* SyntaxKind.LabeledStatement */: { var label = node.label; (seenLabels || (seenLabels = [])).push(label.escapedText); ts.forEachChild(node, visit); seenLabels.pop(); break; } - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: { + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: { var label = node.label; if (label) { if (!ts.contains(seenLabels, label.escapedText)) { @@ -163109,20 +164264,20 @@ var ts; } } else { - if (!(permittedJumps & (node.kind === 246 /* SyntaxKind.BreakStatement */ ? 1 /* PermittedJumps.Break */ : 2 /* PermittedJumps.Continue */))) { + if (!(permittedJumps & (node.kind === 249 /* SyntaxKind.BreakStatement */ ? 1 /* PermittedJumps.Break */ : 2 /* PermittedJumps.Continue */))) { // attempt to break or continue in a forbidden context (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractRangeContainingConditionalBreakOrContinueStatements)); } } break; } - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: rangeFacts |= RangeFacts.IsAsyncFunction; break; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: rangeFacts |= RangeFacts.IsGenerator; break; - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: if (permittedJumps & 4 /* PermittedJumps.Return */) { rangeFacts |= RangeFacts.HasReturn; } @@ -163192,7 +164347,7 @@ var ts; while (true) { current = current.parent; // A function parameter's initializer is actually in the outer scope, not the function declaration - if (current.kind === 164 /* SyntaxKind.Parameter */) { + if (current.kind === 166 /* SyntaxKind.Parameter */) { // Skip all the way to the outer scope of the function that declared this parameter current = ts.findAncestor(current, function (parent) { return ts.isFunctionLikeDeclaration(parent); }).parent; } @@ -163203,7 +164358,7 @@ var ts; // * Module/namespace or source file if (isScope(current)) { scopes.push(current); - if (current.kind === 305 /* SyntaxKind.SourceFile */) { + if (current.kind === 308 /* SyntaxKind.SourceFile */) { return scopes; } } @@ -163293,32 +164448,32 @@ var ts; } function getDescriptionForFunctionLikeDeclaration(scope) { switch (scope.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "constructor"; - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return scope.name ? "function '".concat(scope.name.text, "'") : ts.ANONYMOUS; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return "arrow function"; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return "method '".concat(scope.name.getText(), "'"); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return "'get ".concat(scope.name.getText(), "'"); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return "'set ".concat(scope.name.getText(), "'"); default: throw ts.Debug.assertNever(scope, "Unexpected scope kind ".concat(scope.kind)); } } function getDescriptionForClassLikeDeclaration(scope) { - return scope.kind === 257 /* SyntaxKind.ClassDeclaration */ + return scope.kind === 260 /* SyntaxKind.ClassDeclaration */ ? scope.name ? "class '".concat(scope.name.text, "'") : "anonymous class declaration" : scope.name ? "class expression '".concat(scope.name.text, "'") : "anonymous class expression"; } function getDescriptionForModuleLikeDeclaration(scope) { - return scope.kind === 262 /* SyntaxKind.ModuleBlock */ + return scope.kind === 265 /* SyntaxKind.ModuleBlock */ ? "namespace '".concat(scope.parent.name.getText(), "'") : scope.externalModuleIndicator ? 0 /* SpecialScope.Module */ : 1 /* SpecialScope.Global */; } @@ -163391,7 +164546,7 @@ var ts; modifiers.push(ts.factory.createModifier(124 /* SyntaxKind.StaticKeyword */)); } if (range.facts & RangeFacts.IsAsyncFunction) { - modifiers.push(ts.factory.createModifier(131 /* SyntaxKind.AsyncKeyword */)); + modifiers.push(ts.factory.createModifier(132 /* SyntaxKind.AsyncKeyword */)); } newFunction = ts.factory.createMethodDeclaration(modifiers.length ? modifiers : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, /*questionToken*/ undefined, typeParameters, parameters, returnType, body); @@ -163405,7 +164560,7 @@ var ts; /*questionToken*/ undefined, checker.typeToTypeNode(checker.getTypeAtLocation(range.thisNode), scope, 1 /* NodeBuilderFlags.NoTruncation */), /*initializer*/ undefined)); } - newFunction = ts.factory.createFunctionDeclaration(range.facts & RangeFacts.IsAsyncFunction ? [ts.factory.createToken(131 /* SyntaxKind.AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body); + newFunction = ts.factory.createFunctionDeclaration(range.facts & RangeFacts.IsAsyncFunction ? [ts.factory.createToken(132 /* SyntaxKind.AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body); } var changeTracker = ts.textChanges.ChangeTracker.fromContext(context); var minInsertionPos = (isReadonlyArray(range.range) ? ts.last(range.range) : range.range).end; @@ -163553,9 +164708,9 @@ var ts; while (ts.isParenthesizedTypeNode(withoutParens)) { withoutParens = withoutParens.type; } - return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 153 /* SyntaxKind.UndefinedKeyword */; }) + return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 155 /* SyntaxKind.UndefinedKeyword */; }) ? clone - : ts.factory.createUnionTypeNode([clone, ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)]); + : ts.factory.createUnionTypeNode([clone, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)]); } } /** @@ -163586,7 +164741,7 @@ var ts; if (rangeFacts & RangeFacts.InStaticRegion) { modifiers.push(ts.factory.createModifier(124 /* SyntaxKind.StaticKeyword */)); } - modifiers.push(ts.factory.createModifier(145 /* SyntaxKind.ReadonlyKeyword */)); + modifiers.push(ts.factory.createModifier(146 /* SyntaxKind.ReadonlyKeyword */)); var newVariable = ts.factory.createPropertyDeclaration(modifiers, localNameText, /*questionToken*/ undefined, variableType, initializer); var localReference = ts.factory.createPropertyAccessExpression(rangeFacts & RangeFacts.InStaticRegion @@ -163617,7 +164772,7 @@ var ts; var localReference = ts.factory.createIdentifier(localNameText); changeTracker.replaceNode(context.file, node, localReference); } - else if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) { + else if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) { // If the parent is an expression statement and the target scope is the immediately enclosing one, // replace the statement with the declaration. var newVariableStatement = ts.factory.createVariableStatement( @@ -163636,7 +164791,7 @@ var ts; changeTracker.insertNodeBefore(context.file, nodeToInsertBefore, newVariableStatement, /*blankLineBetween*/ false); } // Consume - if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */) { + if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */) { // If the parent is an expression statement, delete it. changeTracker.delete(context.file, node.parent); } @@ -164282,30 +165437,30 @@ var ts; function isExtractableExpression(node) { var parent = node.parent; switch (parent.kind) { - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return false; } switch (node.kind) { case 10 /* SyntaxKind.StringLiteral */: - return parent.kind !== 266 /* SyntaxKind.ImportDeclaration */ && - parent.kind !== 270 /* SyntaxKind.ImportSpecifier */; - case 225 /* SyntaxKind.SpreadElement */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 203 /* SyntaxKind.BindingElement */: + return parent.kind !== 269 /* SyntaxKind.ImportDeclaration */ && + parent.kind !== 273 /* SyntaxKind.ImportSpecifier */; + case 227 /* SyntaxKind.SpreadElement */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 205 /* SyntaxKind.BindingElement */: return false; case 79 /* SyntaxKind.Identifier */: - return parent.kind !== 203 /* SyntaxKind.BindingElement */ && - parent.kind !== 270 /* SyntaxKind.ImportSpecifier */ && - parent.kind !== 275 /* SyntaxKind.ExportSpecifier */; + return parent.kind !== 205 /* SyntaxKind.BindingElement */ && + parent.kind !== 273 /* SyntaxKind.ImportSpecifier */ && + parent.kind !== 278 /* SyntaxKind.ExportSpecifier */; } return true; } function isBlockLike(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 305 /* SyntaxKind.SourceFile */: - case 262 /* SyntaxKind.ModuleBlock */: - case 289 /* SyntaxKind.CaseClause */: + case 238 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 265 /* SyntaxKind.ModuleBlock */: + case 292 /* SyntaxKind.CaseClause */: return true; default: return false; @@ -164593,7 +165748,6 @@ var ts; (function (ts) { var refactor; (function (refactor) { - ; /** * Checks if some refactor info has refactor error info. */ @@ -164698,15 +165852,14 @@ var ts; // Imports will be copied to the new file anyway, and may still be needed in the old file. // Prologue directives will be copied to the new file and should be left in the old file. return !isPureImport(statement) && !ts.isPrologueDirective(statement); - ; } function isPureImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return true; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return !ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return node.declarationList.declarations.every(function (d) { return !!d.initializer && ts.isRequireCall(d.initializer, /*checkArgumentIsStringLiteralLike*/ true); }); default: return false; @@ -164802,12 +165955,12 @@ var ts; } function getNamespaceLikeImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? + case 269 /* SyntaxKind.ImportDeclaration */: + return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? node.importClause.namedBindings.name : undefined; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.name; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.tryCast(node.name, ts.isIdentifier); default: return ts.Debug.assertNever(node, "Unexpected node kind ".concat(node.kind)); @@ -164838,21 +165991,21 @@ var ts; var newNamespaceId = ts.factory.createIdentifier(newNamespaceName); var newModuleString = ts.factory.createStringLiteral(newModuleSpecifier); switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, /*name*/ undefined, ts.factory.createNamespaceImport(newNamespaceId)), newModuleString, /*assertClause*/ undefined); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.factory.createImportEqualsDeclaration(/*modifiers*/ undefined, /*isTypeOnly*/ false, newNamespaceId, ts.factory.createExternalModuleReference(newModuleString)); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.factory.createVariableDeclaration(newNamespaceId, /*exclamationToken*/ undefined, /*type*/ undefined, createRequireCall(newModuleString)); default: return ts.Debug.assertNever(node, "Unexpected node kind ".concat(node.kind)); } } function moduleSpecifierFromImport(i) { - return (i.kind === 266 /* SyntaxKind.ImportDeclaration */ ? i.moduleSpecifier - : i.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ ? i.moduleReference.expression + return (i.kind === 269 /* SyntaxKind.ImportDeclaration */ ? i.moduleSpecifier + : i.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? i.moduleReference.expression : i.initializer.arguments[0]); } function forEachImportInStatement(statement, cb) { @@ -164922,15 +166075,15 @@ var ts; } function deleteUnusedImports(sourceFile, importDecl, changes, isUnused) { switch (importDecl.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: deleteUnusedImportsInDeclaration(sourceFile, importDecl, changes, isUnused); break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: if (isUnused(importDecl.name)) { changes.delete(sourceFile, importDecl); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: deleteUnusedImportsInVariableDeclaration(sourceFile, importDecl, changes, isUnused); break; default: @@ -164943,7 +166096,7 @@ var ts; var _a = importDecl.importClause, name = _a.name, namedBindings = _a.namedBindings; var defaultUnused = !name || isUnused(name); var namedBindingsUnused = !namedBindings || - (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); })); + (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); })); if (defaultUnused && namedBindingsUnused) { changes.delete(sourceFile, importDecl); } @@ -164955,7 +166108,7 @@ var ts; if (namedBindingsUnused) { changes.replaceNode(sourceFile, importDecl.importClause, ts.factory.updateImportClause(importDecl.importClause, importDecl.importClause.isTypeOnly, name, /*namedBindings*/ undefined)); } - else if (namedBindings.kind === 269 /* SyntaxKind.NamedImports */) { + else if (namedBindings.kind === 272 /* SyntaxKind.NamedImports */) { for (var _i = 0, _b = namedBindings.elements; _i < _b.length; _i++) { var element = _b[_i]; if (isUnused(element.name)) @@ -164973,9 +166126,9 @@ var ts; changes.delete(sourceFile, name); } break; - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: break; - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: if (name.elements.every(function (e) { return ts.isIdentifier(e.name) && isUnused(e.name); })) { changes.delete(sourceFile, ts.isVariableDeclarationList(varDecl.parent) && varDecl.parent.declarations.length === 1 ? varDecl.parent.parent : varDecl); } @@ -165017,7 +166170,7 @@ var ts; if (markSeenTop(top)) { addExportToChanges(oldFile, top, name, changes, useEsModuleSyntax); } - if (ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */)) { oldFileDefault = name; } else { @@ -165105,14 +166258,14 @@ var ts; // Below should all be utilities function isInImport(decl) { switch (decl.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return isVariableDeclarationInImport(decl); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return ts.isVariableDeclaration(decl.parent.parent) && isVariableDeclarationInImport(decl.parent.parent); default: return false; @@ -165124,7 +166277,7 @@ var ts; } function filterImport(i, moduleSpecifier, keep) { switch (i.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: { + case 269 /* SyntaxKind.ImportDeclaration */: { var clause = i.importClause; if (!clause) return undefined; @@ -165134,9 +166287,9 @@ var ts; ? ts.factory.createImportDeclaration(/*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, defaultImport, namedBindings), moduleSpecifier, /*assertClause*/ undefined) : undefined; } - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return keep(i.name) ? i : undefined; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var name = filterBindingName(i.name, keep); return name ? makeVariableStatement(name, i.type, createRequireCall(moduleSpecifier), i.parent.flags) : undefined; } @@ -165145,7 +166298,7 @@ var ts; } } function filterNamedBindings(namedBindings, keep) { - if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { return keep(namedBindings.name) ? namedBindings : undefined; } else { @@ -165157,9 +166310,9 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return keep(name) ? name : undefined; - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return name; - case 201 /* SyntaxKind.ObjectBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: { // We can't handle nested destructurings or property names well here, so just copy them all. var newElements = name.elements.filter(function (prop) { return prop.propertyName || !ts.isIdentifier(prop.name) || keep(prop.name); }); return newElements.length ? ts.factory.createObjectBindingPattern(newElements) : undefined; @@ -165216,13 +166369,13 @@ var ts; } function isNonVariableTopLevelDeclaration(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return true; default: return false; @@ -165230,17 +166383,17 @@ var ts; } function forEachTopLevelDeclaration(statement, cb) { switch (statement.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return cb(statement); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.firstDefined(statement.declarationList.declarations, function (decl) { return forEachTopLevelDeclarationInBindingName(decl.name, cb); }); - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; return ts.isBinaryExpression(expression) && ts.getAssignmentDeclarationKind(expression) === 1 /* AssignmentDeclarationKind.ExportsProperty */ ? cb(statement) @@ -165252,8 +166405,8 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return cb(ts.cast(name.parent, function (x) { return ts.isVariableDeclaration(x) || ts.isBindingElement(x); })); - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return ts.firstDefined(name.elements, function (em) { return ts.isOmittedExpression(em) ? undefined : forEachTopLevelDeclarationInBindingName(em.name, cb); }); default: return ts.Debug.assertNever(name, "Unexpected name kind ".concat(name.kind)); @@ -165264,9 +166417,9 @@ var ts; } function getTopLevelDeclarationStatement(d) { switch (d.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return d.parent.parent; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getTopLevelDeclarationStatement(ts.cast(d.parent.parent, function (p) { return ts.isVariableDeclaration(p) || ts.isBindingElement(p); })); default: return d; @@ -165298,24 +166451,24 @@ var ts; function addEs6Export(d) { var modifiers = ts.canHaveModifiers(d) ? ts.concatenate([ts.factory.createModifier(93 /* SyntaxKind.ExportKeyword */)], ts.getModifiers(d)) : undefined; switch (d.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return ts.factory.updateFunctionDeclaration(d, modifiers, d.asteriskToken, d.name, d.typeParameters, d.parameters, d.type, d.body); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var decorators = ts.canHaveDecorators(d) ? ts.getDecorators(d) : undefined; return ts.factory.updateClassDeclaration(d, ts.concatenate(decorators, modifiers), d.name, d.typeParameters, d.heritageClauses, d.members); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.factory.updateVariableStatement(d, modifiers, d.declarationList); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.factory.updateModuleDeclaration(d, modifiers, d.name, d.body); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.factory.updateEnumDeclaration(d, modifiers, d.name, d.members); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return ts.factory.updateTypeAliasDeclaration(d, modifiers, d.name, d.typeParameters, d.type); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.factory.updateInterfaceDeclaration(d, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.factory.updateImportEqualsDeclaration(d, modifiers, d.isTypeOnly, d.name, d.moduleReference); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.Debug.fail(); // Shouldn't try to add 'export' keyword to `exports.x = ...` default: return ts.Debug.assertNever(d, "Unexpected declaration kind ".concat(d.kind)); @@ -165326,18 +166479,18 @@ var ts; } function getNamesToExportInCommonJS(decl) { switch (decl.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return [decl.name.text]; // TODO: GH#18217 - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.mapDefined(decl.declarationList.declarations, function (d) { return ts.isIdentifier(d.name) ? d.name.text : undefined; }); - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.emptyArray; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.Debug.fail("Can't export an ExpressionStatement"); // Shouldn't try to add 'export' keyword to `exports.x = ...` default: return ts.Debug.assertNever(decl, "Unexpected decl kind ".concat(decl.kind)); @@ -165678,15 +166831,15 @@ var ts; var parent = functionReference.parent; switch (parent.kind) { // foo(...) or super(...) or new Foo(...) - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: var callOrNewExpression = ts.tryCast(parent, ts.isCallOrNewExpression); if (callOrNewExpression && callOrNewExpression.expression === functionReference) { return callOrNewExpression; } break; // x.foo(...) - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression); if (propertyAccessExpression && propertyAccessExpression.parent && propertyAccessExpression.name === functionReference) { var callOrNewExpression_1 = ts.tryCast(propertyAccessExpression.parent, ts.isCallOrNewExpression); @@ -165696,7 +166849,7 @@ var ts; } break; // x["foo"](...) - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression); if (elementAccessExpression && elementAccessExpression.parent && elementAccessExpression.argumentExpression === functionReference) { var callOrNewExpression_2 = ts.tryCast(elementAccessExpression.parent, ts.isCallOrNewExpression); @@ -165715,14 +166868,14 @@ var ts; var parent = reference.parent; switch (parent.kind) { // `C.foo` - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression); if (propertyAccessExpression && propertyAccessExpression.expression === reference) { return propertyAccessExpression; } break; // `C["foo"]` - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression); if (elementAccessExpression && elementAccessExpression.expression === reference) { return elementAccessExpression; @@ -165768,16 +166921,16 @@ var ts; if (!isValidParameterNodeArray(functionDeclaration.parameters, checker)) return false; switch (functionDeclaration.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return hasNameOrDefault(functionDeclaration) && isSingleImplementation(functionDeclaration, checker); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: if (ts.isObjectLiteralExpression(functionDeclaration.parent)) { var contextualSymbol = getSymbolForContextualType(functionDeclaration.name, checker); // don't offer the refactor when there are multiple signatures since we won't know which ones the user wants to change return ((_a = contextualSymbol === null || contextualSymbol === void 0 ? void 0 : contextualSymbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 && isSingleImplementation(functionDeclaration, checker); } return isSingleImplementation(functionDeclaration, checker); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: if (ts.isClassDeclaration(functionDeclaration.parent)) { return hasNameOrDefault(functionDeclaration.parent) && isSingleImplementation(functionDeclaration, checker); } @@ -165785,8 +166938,8 @@ var ts; return isValidVariableDeclaration(functionDeclaration.parent.parent) && isSingleImplementation(functionDeclaration, checker); } - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return isValidVariableDeclaration(functionDeclaration.parent); } return false; @@ -165934,7 +167087,7 @@ var ts; } function getClassNames(constructorDeclaration) { switch (constructorDeclaration.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var classDeclaration = constructorDeclaration.parent; if (classDeclaration.name) return [classDeclaration.name]; @@ -165942,7 +167095,7 @@ var ts; // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault` var defaultModifier = ts.Debug.checkDefined(ts.findModifier(classDeclaration, 88 /* SyntaxKind.DefaultKeyword */), "Nameless class declaration should be a default export"); return [defaultModifier]; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: var classExpression = constructorDeclaration.parent; var variableDeclaration = constructorDeclaration.parent.parent; var className = classExpression.name; @@ -165953,25 +167106,25 @@ var ts; } function getFunctionNames(functionDeclaration) { switch (functionDeclaration.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (functionDeclaration.name) return [functionDeclaration.name]; // If the function declaration doesn't have a name, it should have a default modifier. // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault` var defaultModifier = ts.Debug.checkDefined(ts.findModifier(functionDeclaration, 88 /* SyntaxKind.DefaultKeyword */), "Nameless function declaration should be a default export"); return [defaultModifier]; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return [functionDeclaration.name]; - case 171 /* SyntaxKind.Constructor */: - var ctrKeyword = ts.Debug.checkDefined(ts.findChildOfKind(functionDeclaration, 134 /* SyntaxKind.ConstructorKeyword */, functionDeclaration.getSourceFile()), "Constructor declaration should have constructor keyword"); - if (functionDeclaration.parent.kind === 226 /* SyntaxKind.ClassExpression */) { + case 173 /* SyntaxKind.Constructor */: + var ctrKeyword = ts.Debug.checkDefined(ts.findChildOfKind(functionDeclaration, 135 /* SyntaxKind.ConstructorKeyword */, functionDeclaration.getSourceFile()), "Constructor declaration should have constructor keyword"); + if (functionDeclaration.parent.kind === 228 /* SyntaxKind.ClassExpression */) { var variableDeclaration = functionDeclaration.parent.parent; return [variableDeclaration.name, ctrKeyword]; } return [ctrKeyword]; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return [functionDeclaration.parent.name]; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (functionDeclaration.name) return [functionDeclaration.name, functionDeclaration.parent.name]; return [functionDeclaration.parent.name]; @@ -166062,11 +167215,11 @@ var ts; function getParentBinaryExpression(expr) { var container = ts.findAncestor(expr.parent, function (n) { switch (n.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return false; - case 223 /* SyntaxKind.TemplateExpression */: - case 221 /* SyntaxKind.BinaryExpression */: + case 225 /* SyntaxKind.TemplateExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return !(ts.isBinaryExpression(n.parent) && isNotEqualsOperator(n.parent)); default: return "quit"; @@ -166514,10 +167667,10 @@ var ts; } function isConvertibleDeclaration(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: return true; default: return false; @@ -166562,7 +167715,7 @@ var ts; this.kind = kind; } NodeObject.prototype.assertHasRealPosition = function (message) { - // eslint-disable-next-line debug-assert + // eslint-disable-next-line local/debug-assert ts.Debug.assert(!ts.positionIsSynthesized(this.pos) && !ts.positionIsSynthesized(this.end), message || "Node must have a real position for this operation"); }; NodeObject.prototype.getSourceFile = function () { @@ -166619,8 +167772,8 @@ var ts; if (!children.length) { return undefined; } - var child = ts.find(children, function (kid) { return kid.kind < 309 /* SyntaxKind.FirstJSDocNode */ || kid.kind > 347 /* SyntaxKind.LastJSDocNode */; }); - return child.kind < 161 /* SyntaxKind.FirstNode */ ? + var child = ts.find(children, function (kid) { return kid.kind < 312 /* SyntaxKind.FirstJSDocNode */ || kid.kind > 350 /* SyntaxKind.LastJSDocNode */; }); + return child.kind < 163 /* SyntaxKind.FirstNode */ ? child : child.getFirstToken(sourceFile); }; @@ -166631,7 +167784,7 @@ var ts; if (!child) { return undefined; } - return child.kind < 161 /* SyntaxKind.FirstNode */ ? child : child.getLastToken(sourceFile); + return child.kind < 163 /* SyntaxKind.FirstNode */ ? child : child.getLastToken(sourceFile); }; NodeObject.prototype.forEachChild = function (cbNode, cbNodeArray) { return ts.forEachChild(this, cbNode, cbNodeArray); @@ -166691,7 +167844,7 @@ var ts; } } function createSyntaxList(nodes, parent) { - var list = createNode(348 /* SyntaxKind.SyntaxList */, nodes.pos, nodes.end, parent); + var list = createNode(351 /* SyntaxKind.SyntaxList */, nodes.pos, nodes.end, parent); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { @@ -167040,7 +168193,7 @@ var ts; var _a; if (!seenSymbols_1.has(symbol)) { seenSymbols_1.add(symbol); - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) { return symbol.getContextualJsDocTags(declaration, checker); } return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 ? symbol.getJsDocTags() : undefined; @@ -167067,7 +168220,7 @@ var ts; var inheritedDocs = findBaseOfDeclaration(checker, declaration, function (symbol) { if (!seenSymbols_2.has(symbol)) { seenSymbols_2.add(symbol); - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) { return symbol.getContextualDocumentationComment(declaration, checker); } return symbol.getDocumentationComment(checker); @@ -167086,7 +168239,7 @@ var ts; } function findBaseOfDeclaration(checker, declaration, cb) { var _a; - var classOrInterfaceDeclaration = ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.kind) === 171 /* SyntaxKind.Constructor */ ? declaration.parent.parent : declaration.parent; + var classOrInterfaceDeclaration = ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.kind) === 173 /* SyntaxKind.Constructor */ ? declaration.parent.parent : declaration.parent; if (!classOrInterfaceDeclaration) return; var isStaticMember = ts.hasStaticModifier(declaration); @@ -167101,7 +168254,7 @@ var ts; __extends(SourceFileObject, _super); function SourceFileObject(kind, pos, end) { var _this = _super.call(this, kind, pos, end) || this; - _this.kind = 305 /* SyntaxKind.SourceFile */; + _this.kind = 308 /* SyntaxKind.SourceFile */; return _this; } SourceFileObject.prototype.update = function (newText, textChangeRange) { @@ -167160,10 +168313,10 @@ var ts; } function visit(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -167183,31 +168336,31 @@ var ts; } ts.forEachChild(node, visit); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 182 /* SyntaxKind.TypeLiteral */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 184 /* SyntaxKind.TypeLiteral */: addDeclaration(node); ts.forEachChild(node, visit); break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Only consider parameter properties if (!ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */)) { break; } // falls through - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: { + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: { var decl = node; if (ts.isBindingPattern(decl.name)) { ts.forEachChild(decl.name, visit); @@ -167218,12 +168371,12 @@ var ts; } } // falls through - case 299 /* SyntaxKind.EnumMember */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: addDeclaration(node); break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; var exportDeclaration = node; @@ -167236,7 +168389,7 @@ var ts; } } break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -167248,7 +168401,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -167257,7 +168410,7 @@ var ts; } } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.getAssignmentDeclarationKind(node) !== 0 /* AssignmentDeclarationKind.None */) { addDeclaration(node); } @@ -167669,6 +168822,10 @@ var ts; getCurrentDirectory: compilerHost.getCurrentDirectory, onUnRecoverableConfigFileDiagnostic: ts.noop, }; + // The call to isProgramUptoDate below may refer back to documentRegistryBucketKey; + // calculate this early so it's not undefined if downleveled to a var (or, if emitted + // 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)) { return; @@ -167678,7 +168835,6 @@ var ts; // instance. If we cancel midway through, we may end up in an inconsistent state where // the program points to old source files that have been invalidated because of // incremental parsing. - var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); var options = { rootNames: rootFileNames, options: newSettings, @@ -167974,16 +169130,16 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return !ts.isLabelName(node) && !ts.isTagName(node) && !ts.isConstTypeReference(node.parent); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: // Don't return quickInfo if inside the comment in `a/**/.b` return !ts.isInComment(sourceFile, position); case 108 /* SyntaxKind.ThisKeyword */: - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 106 /* SyntaxKind.SuperKeyword */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return true; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return ts.isImportMeta(node); default: return false; @@ -168090,15 +169246,15 @@ var ts; return undefined; } switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: case 10 /* SyntaxKind.StringLiteral */: case 95 /* SyntaxKind.FalseKeyword */: case 110 /* SyntaxKind.TrueKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 106 /* SyntaxKind.SuperKeyword */: case 108 /* SyntaxKind.ThisKeyword */: - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 79 /* SyntaxKind.Identifier */: break; // Cant create the text span @@ -168115,7 +169271,7 @@ var ts; // If this is name of a module declarations, check if this is right side of dotted module name // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of // Then this name is name from dotted module - if (nodeForStartPos.parent.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -168864,7 +170020,7 @@ var ts; */ function literalIsName(node) { return ts.isDeclarationName(node) || - node.parent.kind === 277 /* SyntaxKind.ExternalModuleReference */ || + node.parent.kind === 280 /* SyntaxKind.ExternalModuleReference */ || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node); } @@ -168882,13 +170038,13 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 8 /* SyntaxKind.NumericLiteral */: - if (node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { return ts.isObjectLiteralElement(node.parent.parent) ? node.parent.parent : undefined; } // falls through case 79 /* SyntaxKind.Identifier */: return ts.isObjectLiteralElement(node.parent) && - (node.parent.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || node.parent.parent.kind === 286 /* SyntaxKind.JsxAttributes */) && + (node.parent.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || node.parent.parent.kind === 289 /* SyntaxKind.JsxAttributes */) && node.parent.name === node ? node.parent : undefined; } return undefined; @@ -168930,7 +170086,7 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && + node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && node.parent.argumentExpression === node; } /** @@ -169023,114 +170179,114 @@ var ts; if (node) { var parent = node.parent; switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 254 /* SyntaxKind.VariableDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return spanInVariableDeclaration(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return spanInParameterDeclaration(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return spanInFunctionDeclaration(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // falls through - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return spanInBlock(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return spanInBlock(node.block); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: // Span on while(...) return textSpanEndingAtNextToken(node, node.expression); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 253 /* SyntaxKind.DebuggerStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: // set on if(..) span return textSpanEndingAtNextToken(node, node.expression); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: // span in statement return spanInNode(node.statement); - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return spanInForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: // span of for (a in ...) return textSpanEndingAtNextToken(node, node.expression); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: // span in initializer return spanInInitializerOfForLike(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: // span on switch(...) return textSpanEndingAtNextToken(node, node.expression); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 203 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 205 /* SyntaxKind.BindingElement */: // span on complete node return textSpan(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: // span in statement return spanInNode(node.statement); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return spanInNodeArray(parent.modifiers, node, ts.isDecorator); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return spanInBindingPattern(node); // No breakpoint in interface, type alias - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return undefined; // Tokens: case 26 /* SyntaxKind.SemicolonToken */: @@ -169160,7 +170316,7 @@ var ts; case 83 /* SyntaxKind.CatchKeyword */: case 96 /* SyntaxKind.FinallyKeyword */: return spanInNextNode(node); - case 160 /* SyntaxKind.OfKeyword */: + case 162 /* SyntaxKind.OfKeyword */: return spanInOfKeyword(node); default: // Destructuring pattern in destructuring assignment @@ -169173,13 +170329,13 @@ var ts; // `a` or `...c` or `d: x` from // `[a, b, ...c]` or `{ a, b }` or `{ d: x }` from destructuring pattern if ((node.kind === 79 /* SyntaxKind.Identifier */ || - node.kind === 225 /* SyntaxKind.SpreadElement */ || - node.kind === 296 /* SyntaxKind.PropertyAssignment */ || - node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) && + node.kind === 227 /* SyntaxKind.SpreadElement */ || + node.kind === 299 /* SyntaxKind.PropertyAssignment */ || + node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(parent)) { return textSpan(node); } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */) { var _a = node, left = _a.left, operatorToken = _a.operatorToken; // Set breakpoint in destructuring pattern if its destructuring assignment // [a, b, c] or {a, b, c} of @@ -169201,22 +170357,22 @@ var ts; } if (ts.isExpressionNode(node)) { switch (parent.kind) { - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // Set span as if on while keyword return spanInPreviousNode(node); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Set breakpoint on the decorator emit return spanInNode(node.parent); - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return textSpan(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (node.parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { // If this is a comma expression, the breakpoint is possible in this expression return textSpan(node); } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: if (node.parent.body === node) { // If this is body of arrow function, it is allowed to have the breakpoint return textSpan(node); @@ -169225,21 +170381,21 @@ var ts; } } switch (node.parent.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // If this is name of property assignment, set breakpoint in the initializer if (node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); } break; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: // Breakpoint in type assertion goes to its operand if (node.parent.type === node) { return spanInNextNode(node.parent.type); } break; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: { + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: { // initializer of variable/parameter declaration go to previous node var _b = node.parent, initializer = _b.initializer, type = _b.type; if (initializer === node || type === node || ts.isAssignmentOperator(node.kind)) { @@ -169247,7 +170403,7 @@ var ts; } break; } - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var left = node.parent.left; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(left) && node !== left) { // If initializer of destructuring assignment move to previous token @@ -169277,7 +170433,7 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (variableDeclaration.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { return spanInNode(variableDeclaration.parent.parent); } var parent = variableDeclaration.parent; @@ -169289,7 +170445,7 @@ var ts; // or its declaration from 'for of' if ((ts.hasOnlyExpressionInitializer(variableDeclaration) && variableDeclaration.initializer) || ts.hasSyntacticModifier(variableDeclaration, 1 /* ModifierFlags.Export */) || - parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { return textSpanFromVariableDeclaration(variableDeclaration); } if (ts.isVariableDeclarationList(variableDeclaration.parent) && @@ -169330,7 +170486,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasSyntacticModifier(functionDeclaration, 1 /* ModifierFlags.Export */) || - (functionDeclaration.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ && functionDeclaration.kind !== 171 /* SyntaxKind.Constructor */); + (functionDeclaration.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ && functionDeclaration.kind !== 173 /* SyntaxKind.Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -169353,26 +170509,26 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // Set on parent if on same line otherwise on first statement // falls through - case 241 /* SyntaxKind.WhileStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } // Default action is to set on first statement return spanInNode(block.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { - if (forLikeStatement.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (forLikeStatement.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { // Declaration list - set breakpoint in first declaration var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -169397,21 +170553,21 @@ var ts; } function spanInBindingPattern(bindingPattern) { // Set breakpoint in first binding element - var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 227 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 229 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } // Empty binding pattern of binding element, set breakpoint on binding element - if (bindingPattern.parent.kind === 203 /* SyntaxKind.BindingElement */) { + if (bindingPattern.parent.kind === 205 /* SyntaxKind.BindingElement */) { return textSpan(bindingPattern.parent); } // Variable declaration is used as the span return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { - ts.Debug.assert(node.kind !== 202 /* SyntaxKind.ArrayBindingPattern */ && node.kind !== 201 /* SyntaxKind.ObjectBindingPattern */); - var elements = node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ ? node.elements : node.properties; - var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 227 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); + ts.Debug.assert(node.kind !== 204 /* SyntaxKind.ArrayBindingPattern */ && node.kind !== 203 /* SyntaxKind.ObjectBindingPattern */); + var elements = node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ ? node.elements : node.properties; + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 229 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } @@ -169419,18 +170575,18 @@ var ts; // just nested element in another destructuring assignment // set breakpoint on assignment when parent is destructuring assignment // Otherwise set breakpoint for this element - return textSpan(node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ ? node.parent : node); + return textSpan(node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ ? node.parent : node); } // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -169438,25 +170594,25 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: // If this is not an instantiated module block, no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // falls through - case 260 /* SyntaxKind.EnumDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // Span on close brace token return textSpan(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } // falls through - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -169464,7 +170620,7 @@ var ts; return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -169480,7 +170636,7 @@ var ts; } function spanInCloseBracketToken(node) { switch (node.parent.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -169495,12 +170651,12 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 240 /* SyntaxKind.DoStatement */ || // Go to while keyword and do action instead - node.parent.kind === 208 /* SyntaxKind.CallExpression */ || - node.parent.kind === 209 /* SyntaxKind.NewExpression */) { + if (node.parent.kind === 243 /* SyntaxKind.DoStatement */ || // Go to while keyword and do action instead + node.parent.kind === 210 /* SyntaxKind.CallExpression */ || + node.parent.kind === 211 /* SyntaxKind.NewExpression */) { return spanInPreviousNode(node); } - if (node.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (node.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { return spanInNextNode(node); } // Default to parent node @@ -169509,21 +170665,21 @@ var ts; function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return spanInPreviousNode(node); // Default to parent node default: @@ -169533,20 +170689,20 @@ var ts; function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration if (ts.isFunctionLike(node.parent) || - node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ || - node.parent.kind === 164 /* SyntaxKind.Parameter */) { + node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ || + node.parent.kind === 166 /* SyntaxKind.Parameter */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (node.parent.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 240 /* SyntaxKind.DoStatement */) { + if (node.parent.kind === 243 /* SyntaxKind.DoStatement */) { // Set span on while expression return textSpanEndingAtNextToken(node, node.parent.expression); } @@ -169554,7 +170710,7 @@ var ts; return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { // Set using next token return spanInNextNode(node); } @@ -169603,7 +170759,7 @@ var debugObjectHost = (function () { return this; })(); // We need to use 'null' to interface with the managed side. -/* eslint-disable no-in-operator */ +/* eslint-disable local/no-in-operator */ /* @internal */ var ts; (function (ts) { @@ -170403,7 +171559,7 @@ var ts; }()); ts.TypeScriptServicesFactory = TypeScriptServicesFactory; })(ts || (ts = {})); -/* eslint-enable no-in-operator */ +/* eslint-enable local/no-in-operator */ // We polyfill `globalThis` here so re can reliably patch the global scope // in the contexts we want to in the same way across script and module formats /* eslint-enable no-var */ @@ -173044,7 +174200,7 @@ var ts; var newLS = pluginModule.create(info); for (var _i = 0, _a = Object.keys(this.languageService); _i < _a.length; _i++) { var k = _a[_i]; - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (!(k in newLS)) { this.projectService.logger.info("Plugin activation warning: Missing proxied method ".concat(k, " in created LS. Patching.")); newLS[k] = this.languageService[k]; @@ -174331,7 +175487,7 @@ var ts; // raw is now fixed and ready this.safelist = raw.typesMap; for (var key in raw.simpleMap) { - if (raw.simpleMap.hasOwnProperty(key)) { + if (ts.hasProperty(raw.simpleMap, key)) { this.legacySafelist.set(key, raw.simpleMap[key].toLowerCase()); } } @@ -177745,7 +178901,6 @@ var ts; } return ts.deduplicate(outputs, ts.equateValues); } - ; function createDocumentSpanSet() { return ts.createSet(function (_a) { var textSpan = _a.textSpan; @@ -179036,7 +180191,7 @@ var ts; var packageDirectory = fileName.substring(0, nodeModulesPathParts.packageRootIndex); var packageJsonCache = (_a = project.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache(); var compilerOptions = project.getCompilationSettings(); - var packageJson = ts.getPackageScopeForPath(project.toPath(packageDirectory + "/package.json"), ts.getTemporaryModuleResolutionState(packageJsonCache, project, compilerOptions)); + var packageJson = ts.getPackageScopeForPath(ts.getNormalizedAbsolutePath(packageDirectory + "/package.json", project.getCurrentDirectory()), ts.getTemporaryModuleResolutionState(packageJsonCache, project, compilerOptions)); if (!packageJson) return undefined; // Use fake options instead of actual compiler options to avoid following export map if the project uses node16 or nodenext - @@ -179095,7 +180250,7 @@ var ts; } var initialNode = ts.getTouchingPropertyName(program.getSourceFile(file), position); var symbol = program.getTypeChecker().getSymbolAtLocation(initialNode); - var importSpecifier = symbol && ts.getDeclarationOfKind(symbol, 270 /* SyntaxKind.ImportSpecifier */); + var importSpecifier = symbol && ts.getDeclarationOfKind(symbol, 273 /* SyntaxKind.ImportSpecifier */); if (!importSpecifier) return undefined; var nameToSearch = ((_a = importSpecifier.propertyName) === null || _a === void 0 ? void 0 : _a.text) || importSpecifier.name.text; @@ -179448,9 +180603,9 @@ var ts; }; Session.prototype.getFileAndLanguageServiceForSyntacticOperation = function (args) { // Since this is syntactic operation, there should always be project for the file - // we wouldnt have to ensure project but rather throw if we dont get project + // throw if we dont get project var file = server.toNormalizedPath(args.file); - var project = this.getProject(args.projectFileName) || this.projectService.tryGetDefaultProjectForFile(file); + var project = this.getProject(args.projectFileName) || this.projectService.ensureDefaultProjectForFile(file); if (!project) { return server.Errors.ThrowNoProject(); } @@ -181989,7 +183144,7 @@ var ts; if (typeof value === "number") { return ts.factory.createNumericLiteral(value); } - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (typeof value === "object" && "base10Value" in value) { // PseudoBigInt return ts.factory.createBigIntLiteral(value); } @@ -182017,7 +183172,7 @@ var ts; } else { type = operatorOrType; - operator = 140 /* SyntaxKind.KeyOfKeyword */; + operator = 141 /* SyntaxKind.KeyOfKeyword */; } return ts.factory.createTypeOperatorNode(operator, type); }, factoryDeprecation); @@ -182195,7 +183350,7 @@ var ts; ts.createNode = ts.Debug.deprecate(function createNode(kind, pos, end) { if (pos === void 0) { pos = 0; } if (end === void 0) { end = 0; } - return ts.setTextRangePosEnd(kind === 305 /* SyntaxKind.SourceFile */ ? ts.parseBaseNodeFactory.createBaseSourceFileNode(kind) : + return ts.setTextRangePosEnd(kind === 308 /* SyntaxKind.SourceFile */ ? ts.parseBaseNodeFactory.createBaseSourceFileNode(kind) : kind === 79 /* SyntaxKind.Identifier */ ? ts.parseBaseNodeFactory.createBaseIdentifierNode(kind) : kind === 80 /* SyntaxKind.PrivateIdentifier */ ? ts.parseBaseNodeFactory.createBasePrivateIdentifierNode(kind) : !ts.isNodeKind(kind) ? ts.parseBaseNodeFactory.createBaseTokenNode(kind) : @@ -182225,7 +183380,7 @@ var ts; (function (ts) { /** @deprecated Use `isTypeAssertionExpression` instead. */ ts.isTypeAssertion = ts.Debug.deprecate(function isTypeAssertion(node) { - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */; }, { since: "4.0", warnAfter: "4.1", diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index 0fd60ae8826..d323d77c229 100644 --- a/lib/typescript.d.ts +++ b/lib/typescript.d.ts @@ -14,7 +14,7 @@ and limitations under the License. ***************************************************************************** */ declare namespace ts { - const versionMajorMinor = "4.8"; + const versionMajorMinor = "4.9"; /** The version of the TypeScript compiler release */ const version: string; /** @@ -232,237 +232,240 @@ declare namespace ts { StaticKeyword = 124, YieldKeyword = 125, AbstractKeyword = 126, - AsKeyword = 127, - AssertsKeyword = 128, - AssertKeyword = 129, - AnyKeyword = 130, - AsyncKeyword = 131, - AwaitKeyword = 132, - BooleanKeyword = 133, - ConstructorKeyword = 134, - DeclareKeyword = 135, - GetKeyword = 136, - InferKeyword = 137, - IntrinsicKeyword = 138, - IsKeyword = 139, - KeyOfKeyword = 140, - ModuleKeyword = 141, - NamespaceKeyword = 142, - NeverKeyword = 143, - OutKeyword = 144, - ReadonlyKeyword = 145, - RequireKeyword = 146, - NumberKeyword = 147, - ObjectKeyword = 148, - SetKeyword = 149, - StringKeyword = 150, - SymbolKeyword = 151, - TypeKeyword = 152, - UndefinedKeyword = 153, - UniqueKeyword = 154, - UnknownKeyword = 155, - FromKeyword = 156, - GlobalKeyword = 157, - BigIntKeyword = 158, - OverrideKeyword = 159, - OfKeyword = 160, - QualifiedName = 161, - ComputedPropertyName = 162, - TypeParameter = 163, - Parameter = 164, - Decorator = 165, - PropertySignature = 166, - PropertyDeclaration = 167, - MethodSignature = 168, - MethodDeclaration = 169, - ClassStaticBlockDeclaration = 170, - Constructor = 171, - GetAccessor = 172, - SetAccessor = 173, - CallSignature = 174, - ConstructSignature = 175, - IndexSignature = 176, - TypePredicate = 177, - TypeReference = 178, - FunctionType = 179, - ConstructorType = 180, - TypeQuery = 181, - TypeLiteral = 182, - ArrayType = 183, - TupleType = 184, - OptionalType = 185, - RestType = 186, - UnionType = 187, - IntersectionType = 188, - ConditionalType = 189, - InferType = 190, - ParenthesizedType = 191, - ThisType = 192, - TypeOperator = 193, - IndexedAccessType = 194, - MappedType = 195, - LiteralType = 196, - NamedTupleMember = 197, - TemplateLiteralType = 198, - TemplateLiteralTypeSpan = 199, - ImportType = 200, - ObjectBindingPattern = 201, - ArrayBindingPattern = 202, - BindingElement = 203, - ArrayLiteralExpression = 204, - ObjectLiteralExpression = 205, - PropertyAccessExpression = 206, - ElementAccessExpression = 207, - CallExpression = 208, - NewExpression = 209, - TaggedTemplateExpression = 210, - TypeAssertionExpression = 211, - ParenthesizedExpression = 212, - FunctionExpression = 213, - ArrowFunction = 214, - DeleteExpression = 215, - TypeOfExpression = 216, - VoidExpression = 217, - AwaitExpression = 218, - PrefixUnaryExpression = 219, - PostfixUnaryExpression = 220, - BinaryExpression = 221, - ConditionalExpression = 222, - TemplateExpression = 223, - YieldExpression = 224, - SpreadElement = 225, - ClassExpression = 226, - OmittedExpression = 227, - ExpressionWithTypeArguments = 228, - AsExpression = 229, - NonNullExpression = 230, - MetaProperty = 231, - SyntheticExpression = 232, - TemplateSpan = 233, - SemicolonClassElement = 234, - Block = 235, - EmptyStatement = 236, - VariableStatement = 237, - ExpressionStatement = 238, - IfStatement = 239, - DoStatement = 240, - WhileStatement = 241, - ForStatement = 242, - ForInStatement = 243, - ForOfStatement = 244, - ContinueStatement = 245, - BreakStatement = 246, - ReturnStatement = 247, - WithStatement = 248, - SwitchStatement = 249, - LabeledStatement = 250, - ThrowStatement = 251, - TryStatement = 252, - DebuggerStatement = 253, - VariableDeclaration = 254, - VariableDeclarationList = 255, - FunctionDeclaration = 256, - ClassDeclaration = 257, - InterfaceDeclaration = 258, - TypeAliasDeclaration = 259, - EnumDeclaration = 260, - ModuleDeclaration = 261, - ModuleBlock = 262, - CaseBlock = 263, - NamespaceExportDeclaration = 264, - ImportEqualsDeclaration = 265, - ImportDeclaration = 266, - ImportClause = 267, - NamespaceImport = 268, - NamedImports = 269, - ImportSpecifier = 270, - ExportAssignment = 271, - ExportDeclaration = 272, - NamedExports = 273, - NamespaceExport = 274, - ExportSpecifier = 275, - MissingDeclaration = 276, - ExternalModuleReference = 277, - JsxElement = 278, - JsxSelfClosingElement = 279, - JsxOpeningElement = 280, - JsxClosingElement = 281, - JsxFragment = 282, - JsxOpeningFragment = 283, - JsxClosingFragment = 284, - JsxAttribute = 285, - JsxAttributes = 286, - JsxSpreadAttribute = 287, - JsxExpression = 288, - CaseClause = 289, - DefaultClause = 290, - HeritageClause = 291, - CatchClause = 292, - AssertClause = 293, - AssertEntry = 294, - ImportTypeAssertionContainer = 295, - PropertyAssignment = 296, - ShorthandPropertyAssignment = 297, - SpreadAssignment = 298, - EnumMember = 299, - UnparsedPrologue = 300, - UnparsedPrepend = 301, - UnparsedText = 302, - UnparsedInternalText = 303, - UnparsedSyntheticReference = 304, - SourceFile = 305, - Bundle = 306, - UnparsedSource = 307, - InputFiles = 308, - JSDocTypeExpression = 309, - JSDocNameReference = 310, - JSDocMemberName = 311, - JSDocAllType = 312, - JSDocUnknownType = 313, - JSDocNullableType = 314, - JSDocNonNullableType = 315, - JSDocOptionalType = 316, - JSDocFunctionType = 317, - JSDocVariadicType = 318, - JSDocNamepathType = 319, - JSDoc = 320, + AccessorKeyword = 127, + AsKeyword = 128, + AssertsKeyword = 129, + AssertKeyword = 130, + AnyKeyword = 131, + AsyncKeyword = 132, + AwaitKeyword = 133, + BooleanKeyword = 134, + ConstructorKeyword = 135, + DeclareKeyword = 136, + GetKeyword = 137, + InferKeyword = 138, + IntrinsicKeyword = 139, + IsKeyword = 140, + KeyOfKeyword = 141, + ModuleKeyword = 142, + NamespaceKeyword = 143, + NeverKeyword = 144, + OutKeyword = 145, + ReadonlyKeyword = 146, + RequireKeyword = 147, + NumberKeyword = 148, + ObjectKeyword = 149, + SatisfiesKeyword = 150, + SetKeyword = 151, + StringKeyword = 152, + SymbolKeyword = 153, + TypeKeyword = 154, + UndefinedKeyword = 155, + UniqueKeyword = 156, + UnknownKeyword = 157, + FromKeyword = 158, + GlobalKeyword = 159, + BigIntKeyword = 160, + OverrideKeyword = 161, + OfKeyword = 162, + QualifiedName = 163, + ComputedPropertyName = 164, + TypeParameter = 165, + Parameter = 166, + Decorator = 167, + PropertySignature = 168, + PropertyDeclaration = 169, + MethodSignature = 170, + MethodDeclaration = 171, + ClassStaticBlockDeclaration = 172, + Constructor = 173, + GetAccessor = 174, + SetAccessor = 175, + CallSignature = 176, + ConstructSignature = 177, + IndexSignature = 178, + TypePredicate = 179, + TypeReference = 180, + FunctionType = 181, + ConstructorType = 182, + TypeQuery = 183, + TypeLiteral = 184, + ArrayType = 185, + TupleType = 186, + OptionalType = 187, + RestType = 188, + UnionType = 189, + IntersectionType = 190, + ConditionalType = 191, + InferType = 192, + ParenthesizedType = 193, + ThisType = 194, + TypeOperator = 195, + IndexedAccessType = 196, + MappedType = 197, + LiteralType = 198, + NamedTupleMember = 199, + TemplateLiteralType = 200, + TemplateLiteralTypeSpan = 201, + ImportType = 202, + ObjectBindingPattern = 203, + ArrayBindingPattern = 204, + BindingElement = 205, + ArrayLiteralExpression = 206, + ObjectLiteralExpression = 207, + PropertyAccessExpression = 208, + ElementAccessExpression = 209, + CallExpression = 210, + NewExpression = 211, + TaggedTemplateExpression = 212, + TypeAssertionExpression = 213, + ParenthesizedExpression = 214, + FunctionExpression = 215, + ArrowFunction = 216, + DeleteExpression = 217, + TypeOfExpression = 218, + VoidExpression = 219, + AwaitExpression = 220, + PrefixUnaryExpression = 221, + PostfixUnaryExpression = 222, + BinaryExpression = 223, + ConditionalExpression = 224, + TemplateExpression = 225, + YieldExpression = 226, + SpreadElement = 227, + ClassExpression = 228, + OmittedExpression = 229, + ExpressionWithTypeArguments = 230, + AsExpression = 231, + NonNullExpression = 232, + MetaProperty = 233, + SyntheticExpression = 234, + SatisfiesExpression = 235, + TemplateSpan = 236, + SemicolonClassElement = 237, + Block = 238, + EmptyStatement = 239, + VariableStatement = 240, + ExpressionStatement = 241, + IfStatement = 242, + DoStatement = 243, + WhileStatement = 244, + ForStatement = 245, + ForInStatement = 246, + ForOfStatement = 247, + ContinueStatement = 248, + BreakStatement = 249, + ReturnStatement = 250, + WithStatement = 251, + SwitchStatement = 252, + LabeledStatement = 253, + ThrowStatement = 254, + TryStatement = 255, + DebuggerStatement = 256, + VariableDeclaration = 257, + VariableDeclarationList = 258, + FunctionDeclaration = 259, + ClassDeclaration = 260, + InterfaceDeclaration = 261, + TypeAliasDeclaration = 262, + EnumDeclaration = 263, + ModuleDeclaration = 264, + ModuleBlock = 265, + CaseBlock = 266, + NamespaceExportDeclaration = 267, + ImportEqualsDeclaration = 268, + ImportDeclaration = 269, + ImportClause = 270, + NamespaceImport = 271, + NamedImports = 272, + ImportSpecifier = 273, + ExportAssignment = 274, + ExportDeclaration = 275, + NamedExports = 276, + NamespaceExport = 277, + ExportSpecifier = 278, + MissingDeclaration = 279, + ExternalModuleReference = 280, + JsxElement = 281, + JsxSelfClosingElement = 282, + JsxOpeningElement = 283, + JsxClosingElement = 284, + JsxFragment = 285, + JsxOpeningFragment = 286, + JsxClosingFragment = 287, + JsxAttribute = 288, + JsxAttributes = 289, + JsxSpreadAttribute = 290, + JsxExpression = 291, + CaseClause = 292, + DefaultClause = 293, + HeritageClause = 294, + CatchClause = 295, + AssertClause = 296, + AssertEntry = 297, + ImportTypeAssertionContainer = 298, + PropertyAssignment = 299, + ShorthandPropertyAssignment = 300, + SpreadAssignment = 301, + EnumMember = 302, + UnparsedPrologue = 303, + UnparsedPrepend = 304, + UnparsedText = 305, + UnparsedInternalText = 306, + UnparsedSyntheticReference = 307, + SourceFile = 308, + Bundle = 309, + UnparsedSource = 310, + InputFiles = 311, + JSDocTypeExpression = 312, + JSDocNameReference = 313, + JSDocMemberName = 314, + JSDocAllType = 315, + JSDocUnknownType = 316, + JSDocNullableType = 317, + JSDocNonNullableType = 318, + JSDocOptionalType = 319, + JSDocFunctionType = 320, + JSDocVariadicType = 321, + JSDocNamepathType = 322, + JSDoc = 323, /** @deprecated Use SyntaxKind.JSDoc */ - JSDocComment = 320, - JSDocText = 321, - JSDocTypeLiteral = 322, - JSDocSignature = 323, - JSDocLink = 324, - JSDocLinkCode = 325, - JSDocLinkPlain = 326, - JSDocTag = 327, - JSDocAugmentsTag = 328, - JSDocImplementsTag = 329, - JSDocAuthorTag = 330, - JSDocDeprecatedTag = 331, - JSDocClassTag = 332, - JSDocPublicTag = 333, - JSDocPrivateTag = 334, - JSDocProtectedTag = 335, - JSDocReadonlyTag = 336, - JSDocOverrideTag = 337, - JSDocCallbackTag = 338, - JSDocEnumTag = 339, - JSDocParameterTag = 340, - JSDocReturnTag = 341, - JSDocThisTag = 342, - JSDocTypeTag = 343, - JSDocTemplateTag = 344, - JSDocTypedefTag = 345, - JSDocSeeTag = 346, - JSDocPropertyTag = 347, - SyntaxList = 348, - NotEmittedStatement = 349, - PartiallyEmittedExpression = 350, - CommaListExpression = 351, - MergeDeclarationMarker = 352, - EndOfDeclarationMarker = 353, - SyntheticReferenceExpression = 354, - Count = 355, + JSDocComment = 323, + JSDocText = 324, + JSDocTypeLiteral = 325, + JSDocSignature = 326, + JSDocLink = 327, + JSDocLinkCode = 328, + JSDocLinkPlain = 329, + JSDocTag = 330, + JSDocAugmentsTag = 331, + JSDocImplementsTag = 332, + JSDocAuthorTag = 333, + JSDocDeprecatedTag = 334, + JSDocClassTag = 335, + JSDocPublicTag = 336, + JSDocPrivateTag = 337, + JSDocProtectedTag = 338, + JSDocReadonlyTag = 339, + JSDocOverrideTag = 340, + JSDocCallbackTag = 341, + JSDocEnumTag = 342, + JSDocParameterTag = 343, + JSDocReturnTag = 344, + JSDocThisTag = 345, + JSDocTypeTag = 346, + JSDocTemplateTag = 347, + JSDocTypedefTag = 348, + JSDocSeeTag = 349, + JSDocPropertyTag = 350, + SyntaxList = 351, + NotEmittedStatement = 352, + PartiallyEmittedExpression = 353, + CommaListExpression = 354, + MergeDeclarationMarker = 355, + EndOfDeclarationMarker = 356, + SyntheticReferenceExpression = 357, + Count = 358, FirstAssignment = 63, LastAssignment = 78, FirstCompoundAssignment = 64, @@ -470,15 +473,15 @@ declare namespace ts { FirstReservedWord = 81, LastReservedWord = 116, FirstKeyword = 81, - LastKeyword = 160, + LastKeyword = 162, FirstFutureReservedWord = 117, LastFutureReservedWord = 125, - FirstTypeNode = 177, - LastTypeNode = 200, + FirstTypeNode = 179, + LastTypeNode = 202, FirstPunctuation = 18, LastPunctuation = 78, FirstToken = 0, - LastToken = 160, + LastToken = 162, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -487,20 +490,20 @@ declare namespace ts { LastTemplateToken = 17, FirstBinaryOperator = 29, LastBinaryOperator = 78, - FirstStatement = 237, - LastStatement = 253, - FirstNode = 161, - FirstJSDocNode = 309, - LastJSDocNode = 347, - FirstJSDocTagNode = 327, - LastJSDocTagNode = 347, + FirstStatement = 240, + LastStatement = 256, + FirstNode = 163, + FirstJSDocNode = 312, + LastJSDocNode = 350, + FirstJSDocTagNode = 330, + LastJSDocTagNode = 350, } export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; export type PseudoLiteralSyntaxKind = SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail; export type PunctuationSyntaxKind = SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.QuestionDotToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionQuestionToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.BacktickToken | SyntaxKind.HashToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken; - export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; - export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword; + export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SatisfiesKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; + export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword; export type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword; export type TokenSyntaxKind = SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | TriviaSyntaxKind | LiteralSyntaxKind | PseudoLiteralSyntaxKind | PunctuationSyntaxKind | SyntaxKind.Identifier | KeywordSyntaxKind; export type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken; @@ -545,9 +548,10 @@ declare namespace ts { Protected = 16, Static = 32, Readonly = 64, - Abstract = 128, - Async = 256, - Default = 512, + Accessor = 128, + Abstract = 256, + Async = 512, + Default = 1024, Const = 2048, HasComputedJSDocModifiers = 4096, Deprecated = 8192, @@ -559,10 +563,10 @@ declare namespace ts { AccessibilityModifier = 28, ParameterPropertyModifier = 16476, NonPublicAccessibilityModifier = 24, - TypeScriptModifier = 116958, - ExportDefault = 513, - All = 257023, - Modifier = 125951 + TypeScriptModifier = 117086, + ExportDefault = 1025, + All = 258047, + Modifier = 126975 } export enum JsxFlags { None = 0, @@ -618,6 +622,7 @@ declare namespace ts { export interface ModifierToken extends KeywordToken { } export type AbstractKeyword = ModifierToken; + export type AccessorKeyword = ModifierToken; export type AsyncKeyword = ModifierToken; export type ConstKeyword = ModifierToken; export type DeclareKeyword = ModifierToken; @@ -633,11 +638,11 @@ declare namespace ts { export type StaticKeyword = ModifierToken; /** @deprecated Use `ReadonlyKeyword` instead. */ export type ReadonlyToken = ReadonlyKeyword; - export type Modifier = AbstractKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword | DefaultKeyword | ExportKeyword | InKeyword | PrivateKeyword | ProtectedKeyword | PublicKeyword | OutKeyword | OverrideKeyword | ReadonlyKeyword | StaticKeyword; + export type Modifier = AbstractKeyword | AccessorKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword | DefaultKeyword | ExportKeyword | InKeyword | PrivateKeyword | ProtectedKeyword | PublicKeyword | OutKeyword | OverrideKeyword | ReadonlyKeyword | StaticKeyword; export type ModifierLike = Modifier | Decorator; export type AccessibilityModifier = PublicKeyword | PrivateKeyword | ProtectedKeyword; export type ParameterPropertyModifier = AccessibilityModifier | ReadonlyKeyword; - export type ClassMemberModifier = AccessibilityModifier | ReadonlyKeyword | StaticKeyword; + export type ClassMemberModifier = AccessibilityModifier | ReadonlyKeyword | StaticKeyword | AccessorKeyword; export type ModifiersArray = NodeArray; export enum GeneratedIdentifierFlags { None = 0, @@ -764,6 +769,9 @@ declare namespace ts { readonly type?: TypeNode; readonly initializer?: Expression; } + export interface AutoAccessorPropertyDeclaration extends PropertyDeclaration { + _autoAccessorBrand: any; + } export interface ObjectLiteralElement extends NamedDeclaration { _objectLiteralBrand: any; readonly name?: PropertyName; @@ -1340,6 +1348,11 @@ declare namespace ts { readonly type: TypeNode; readonly expression: UnaryExpression; } + export interface SatisfiesExpression extends Expression { + readonly kind: SyntaxKind.SatisfiesExpression; + readonly expression: Expression; + readonly type: TypeNode; + } export type AssertionExpression = TypeAssertion | AsExpression; export interface NonNullExpression extends LeftHandSideExpression { readonly kind: SyntaxKind.NonNullExpression; @@ -2316,6 +2329,7 @@ declare namespace ts { getPrivateIdentifierPropertyOfType(leftType: Type, name: string, location: Node): Symbol | undefined; getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo | undefined; getIndexInfosOfType(type: Type): readonly IndexInfo[]; + getIndexInfosOfIndexSymbol: (indexSymbol: Symbol) => IndexInfo[]; getSignaturesOfType(type: Type, kind: SignatureKind): readonly Signature[]; getIndexTypeOfType(type: Type, kind: IndexKind): Type | undefined; getBaseTypes(type: InterfaceType): BaseType[]; @@ -2562,6 +2576,7 @@ declare namespace ts { MethodExcludes = 103359, GetAccessorExcludes = 46015, SetAccessorExcludes = 78783, + AccessorExcludes = 13247, TypeParameterExcludes = 526824, TypeAliasExcludes = 788968, AliasExcludes = 2097152, @@ -2832,7 +2847,7 @@ declare namespace ts { export interface SubstitutionType extends InstantiableType { objectFlags: ObjectFlags; baseType: Type; - substitute: Type; + constraint: Type; } export enum SignatureKind { Call = 0, @@ -3387,7 +3402,7 @@ declare namespace ts { createNumericLiteral(value: string | number, numericLiteralFlags?: TokenFlags): NumericLiteral; createBigIntLiteral(value: string | PseudoBigInt): BigIntLiteral; createStringLiteral(text: string, isSingleQuote?: boolean): StringLiteral; - createStringLiteralFromNode(sourceNode: PropertyNameLiteral, isSingleQuote?: boolean): StringLiteral; + createStringLiteralFromNode(sourceNode: PropertyNameLiteral | PrivateIdentifier, isSingleQuote?: boolean): StringLiteral; createRegularExpressionLiteral(text: string): RegularExpressionLiteral; createIdentifier(text: string): Identifier; /** @@ -3412,6 +3427,8 @@ declare namespace ts { /** Create a unique name generated for a node. */ getGeneratedNameForNode(node: Node | undefined, flags?: GeneratedIdentifierFlags): Identifier; createPrivateIdentifier(text: string): PrivateIdentifier; + createUniquePrivateName(text?: string): PrivateIdentifier; + getGeneratedPrivateNameForNode(node: Node): PrivateIdentifier; createToken(token: SyntaxKind.SuperKeyword): SuperExpression; createToken(token: SyntaxKind.ThisKeyword): ThisExpression; createToken(token: SyntaxKind.NullKeyword): NullLiteral; @@ -3587,6 +3604,8 @@ declare namespace ts { updateNonNullChain(node: NonNullChain, expression: Expression): NonNullChain; createMetaProperty(keywordToken: MetaProperty["keywordToken"], name: Identifier): MetaProperty; updateMetaProperty(node: MetaProperty, name: Identifier): MetaProperty; + createSatisfiesExpression(expression: Expression, type: TypeNode): SatisfiesExpression; + updateSatisfiesExpression(node: SatisfiesExpression, expression: Expression, type: TypeNode): SatisfiesExpression; createTemplateSpan(expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; updateTemplateSpan(node: TemplateSpan, expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; createSemicolonClassElement(): SemicolonClassElement; @@ -3948,7 +3967,7 @@ declare namespace ts { (nodes: NodeArray, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray; (nodes: NodeArray | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray | undefined; } - export type VisitResult = T | T[] | undefined; + export type VisitResult = T | readonly T[] | undefined; export interface Printer { /** * Print a node and its subtree as-is, without any emit transformations. @@ -4515,6 +4534,7 @@ declare namespace ts { function isClassElement(node: Node): node is ClassElement; function isClassLike(node: Node): node is ClassLikeDeclaration; function isAccessor(node: Node): node is AccessorDeclaration; + function isAutoAccessorPropertyDeclaration(node: Node): node is AutoAccessorPropertyDeclaration; function isModifierLike(node: Node): node is ModifierLike; function isTypeElement(node: Node): node is TypeElement; function isClassOrTypeElement(node: Node): node is ClassElement | TypeElement; @@ -4716,6 +4736,7 @@ declare namespace ts { function isOmittedExpression(node: Node): node is OmittedExpression; function isExpressionWithTypeArguments(node: Node): node is ExpressionWithTypeArguments; function isAsExpression(node: Node): node is AsExpression; + function isSatisfiesExpression(node: Node): node is SatisfiesExpression; function isNonNullExpression(node: Node): node is NonNullExpression; function isMetaProperty(node: Node): node is MetaProperty; function isSyntheticExpression(node: Node): node is SyntheticExpression; @@ -6526,7 +6547,7 @@ declare namespace ts { isGlobalCompletion: boolean; isMemberCompletion: boolean; /** - * In the absence of `CompletionEntry["replacementSpan"], the editor may choose whether to use + * In the absence of `CompletionEntry["replacementSpan"]`, the editor may choose whether to use * this span or its default one. If `CompletionEntry["replacementSpan"]` is defined, that span * must be used to commit that completion entry. */ @@ -6739,6 +6760,8 @@ declare namespace ts { * interface Y { foo:number; } */ memberVariableElement = "property", + /** class X { [public|private]* accessor foo: number; } */ + memberAccessorVariableElement = "accessor", /** * class X { constructor() { } } * class X { static { } } @@ -7018,7 +7041,7 @@ declare namespace ts { (text: string, isSingleQuote?: boolean | undefined, hasExtendedUnicodeEscape?: boolean | undefined): StringLiteral; }; /** @deprecated Use `factory.createStringLiteralFromNode` or the factory supplied by your transformation context instead. */ - const createStringLiteralFromNode: (sourceNode: PropertyNameLiteral, isSingleQuote?: boolean | undefined) => StringLiteral; + const createStringLiteralFromNode: (sourceNode: PrivateIdentifier | PropertyNameLiteral, isSingleQuote?: boolean | undefined) => StringLiteral; /** @deprecated Use `factory.createRegularExpressionLiteral` or the factory supplied by your transformation context instead. */ const createRegularExpressionLiteral: (text: string) => RegularExpressionLiteral; /** @deprecated Use `factory.createLoopVariable` or the factory supplied by your transformation context instead. */ diff --git a/lib/typescript.js b/lib/typescript.js index 3c93c04e0e4..509255acc39 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -91,210 +91,15 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); -/* @internal */ -var ts; -(function (ts) { - function createMapData() { - var sentinel = {}; - sentinel.prev = sentinel; - return { head: sentinel, tail: sentinel, size: 0 }; - } - function createMapEntry(key, value) { - return { key: key, value: value, next: undefined, prev: undefined }; - } - function sameValueZero(x, y) { - // Treats -0 === 0 and NaN === NaN - return x === y || x !== x && y !== y; - } - function getPrev(entry) { - var prev = entry.prev; - // Entries without a 'prev' have been removed from the map. - // An entry whose 'prev' points to itself is the head of the list and is invalid here. - if (!prev || prev === entry) - throw new Error("Illegal state"); - return prev; - } - function getNext(entry) { - while (entry) { - // Entries without a 'prev' have been removed from the map. Their 'next' - // pointer should point to the previous entry prior to deletion and - // that entry should be skipped to resume iteration. - var skipNext = !entry.prev; - entry = entry.next; - if (skipNext) { - continue; - } - return entry; - } - } - function getEntry(data, key) { - // We walk backwards from 'tail' to prioritize recently added entries. - // We skip 'head' because it is an empty entry used to track iteration start. - for (var entry = data.tail; entry !== data.head; entry = getPrev(entry)) { - if (sameValueZero(entry.key, key)) { - return entry; - } - } - } - function addOrUpdateEntry(data, key, value) { - var existing = getEntry(data, key); - if (existing) { - existing.value = value; - return; - } - var entry = createMapEntry(key, value); - entry.prev = data.tail; - data.tail.next = entry; - data.tail = entry; - data.size++; - return entry; - } - function deleteEntry(data, key) { - // We walk backwards from 'tail' to prioritize recently added entries. - // We skip 'head' because it is an empty entry used to track iteration start. - for (var entry = data.tail; entry !== data.head; entry = getPrev(entry)) { - // all entries in the map should have a 'prev' pointer. - if (entry.prev === undefined) - throw new Error("Illegal state"); - if (sameValueZero(entry.key, key)) { - if (entry.next) { - entry.next.prev = entry.prev; - } - else { - // an entry in the map without a 'next' pointer must be the 'tail'. - if (data.tail !== entry) - throw new Error("Illegal state"); - data.tail = entry.prev; - } - entry.prev.next = entry.next; - entry.next = entry.prev; - entry.prev = undefined; - data.size--; - return entry; - } - } - } - function clearEntries(data) { - var node = data.tail; - while (node !== data.head) { - var prev = getPrev(node); - node.next = data.head; - node.prev = undefined; - node = prev; - } - data.head.next = undefined; - data.tail = data.head; - data.size = 0; - } - function forEachEntry(data, action) { - var entry = data.head; - while (entry) { - entry = getNext(entry); - if (entry) { - action(entry.value, entry.key); - } - } - } - function forEachIteration(iterator, action) { - if (iterator) { - for (var step = iterator.next(); !step.done; step = iterator.next()) { - action(step.value); - } - } - } - function createIteratorData(data, selector) { - return { current: data.head, selector: selector }; - } - function iteratorNext(data) { - // Navigate to the next entry. - data.current = getNext(data.current); - if (data.current) { - return { value: data.selector(data.current.key, data.current.value), done: false }; - } - else { - return { value: undefined, done: true }; - } - } - /* @internal */ - var ShimCollections; - (function (ShimCollections) { - function createMapShim(getIterator) { - var MapIterator = /** @class */ (function () { - function MapIterator(data, selector) { - this._data = createIteratorData(data, selector); - } - MapIterator.prototype.next = function () { return iteratorNext(this._data); }; - return MapIterator; - }()); - return /** @class */ (function () { - function Map(iterable) { - var _this = this; - this._mapData = createMapData(); - forEachIteration(getIterator(iterable), function (_a) { - var key = _a[0], value = _a[1]; - return _this.set(key, value); - }); - } - Object.defineProperty(Map.prototype, "size", { - get: function () { return this._mapData.size; }, - enumerable: false, - configurable: true - }); - Map.prototype.get = function (key) { var _a; return (_a = getEntry(this._mapData, key)) === null || _a === void 0 ? void 0 : _a.value; }; - Map.prototype.set = function (key, value) { return addOrUpdateEntry(this._mapData, key, value), this; }; - Map.prototype.has = function (key) { return !!getEntry(this._mapData, key); }; - Map.prototype.delete = function (key) { return !!deleteEntry(this._mapData, key); }; - Map.prototype.clear = function () { clearEntries(this._mapData); }; - Map.prototype.keys = function () { return new MapIterator(this._mapData, function (key, _value) { return key; }); }; - Map.prototype.values = function () { return new MapIterator(this._mapData, function (_key, value) { return value; }); }; - Map.prototype.entries = function () { return new MapIterator(this._mapData, function (key, value) { return [key, value]; }); }; - Map.prototype.forEach = function (action) { forEachEntry(this._mapData, action); }; - return Map; - }()); - } - ShimCollections.createMapShim = createMapShim; - function createSetShim(getIterator) { - var SetIterator = /** @class */ (function () { - function SetIterator(data, selector) { - this._data = createIteratorData(data, selector); - } - SetIterator.prototype.next = function () { return iteratorNext(this._data); }; - return SetIterator; - }()); - return /** @class */ (function () { - function Set(iterable) { - var _this = this; - this._mapData = createMapData(); - forEachIteration(getIterator(iterable), function (value) { return _this.add(value); }); - } - Object.defineProperty(Set.prototype, "size", { - get: function () { return this._mapData.size; }, - enumerable: false, - configurable: true - }); - Set.prototype.add = function (value) { return addOrUpdateEntry(this._mapData, value, value), this; }; - Set.prototype.has = function (value) { return !!getEntry(this._mapData, value); }; - Set.prototype.delete = function (value) { return !!deleteEntry(this._mapData, value); }; - Set.prototype.clear = function () { clearEntries(this._mapData); }; - Set.prototype.keys = function () { return new SetIterator(this._mapData, function (key, _value) { return key; }); }; - Set.prototype.values = function () { return new SetIterator(this._mapData, function (_key, value) { return value; }); }; - Set.prototype.entries = function () { return new SetIterator(this._mapData, function (key, value) { return [key, value]; }); }; - Set.prototype.forEach = function (action) { forEachEntry(this._mapData, action); }; - return Set; - }()); - } - ShimCollections.createSetShim = createSetShim; - })(ShimCollections = ts.ShimCollections || (ts.ShimCollections = {})); -})(ts || (ts = {})); var ts; (function (ts) { // WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values. // If changing the text in this section, be sure to test `configurePrerelease` too. - ts.versionMajorMinor = "4.8"; + ts.versionMajorMinor = "4.9"; // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types - ts.version = "4.8.3"; + ts.version = "".concat(ts.versionMajorMinor, ".0-beta"); /* @internal */ var Comparison; (function (Comparison) { @@ -315,8 +120,12 @@ var ts; function tryGetNativeMap() { // Internet Explorer's Map doesn't support iteration, so don't use it. var gMap = globals === null || globals === void 0 ? void 0 : globals.Map; - // eslint-disable-next-line no-in-operator - return typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; + // eslint-disable-next-line local/no-in-operator + var constructor = typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; + if (!constructor) { + throw new Error("No compatible Map implementation found."); + } + return constructor; } NativeCollections.tryGetNativeMap = tryGetNativeMap; /** @@ -325,24 +134,19 @@ var ts; function tryGetNativeSet() { // Internet Explorer's Set doesn't support iteration, so don't use it. var gSet = globals === null || globals === void 0 ? void 0 : globals.Set; - // eslint-disable-next-line no-in-operator - return typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; + // eslint-disable-next-line local/no-in-operator + var constructor = typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; + if (!constructor) { + throw new Error("No compatible Set implementation found."); + } + return constructor; } NativeCollections.tryGetNativeSet = tryGetNativeSet; })(NativeCollections || (NativeCollections = {})); /* @internal */ - ts.Map = getCollectionImplementation("Map", "tryGetNativeMap", "createMapShim"); + ts.Map = NativeCollections.tryGetNativeMap(); /* @internal */ - ts.Set = getCollectionImplementation("Set", "tryGetNativeSet", "createSetShim"); - /* @internal */ - function getCollectionImplementation(name, nativeFactory, shimFactory) { - var _a; - // NOTE: ts.ShimCollections will be defined for typescriptServices.js but not for tsc.js, so we must test for it. - var constructor = (_a = NativeCollections[nativeFactory]()) !== null && _a !== void 0 ? _a : ts.ShimCollections === null || ts.ShimCollections === void 0 ? void 0 : ts.ShimCollections[shimFactory](ts.getIterator); - if (constructor) - return constructor; - throw new Error("TypeScript requires an environment that provides a compatible native ".concat(name, " implementation.")); - } + ts.Set = NativeCollections.tryGetNativeSet(); })(ts || (ts = {})); /* @internal */ var ts; @@ -1058,15 +862,18 @@ var ts; function insertSorted(array, insert, compare, allowDuplicates) { if (array.length === 0) { array.push(insert); - return; + return true; } var insertIndex = binarySearch(array, insert, identity, compare); if (insertIndex < 0) { array.splice(~insertIndex, 0, insert); + return true; } - else if (allowDuplicates) { + if (allowDuplicates) { array.splice(insertIndex, 0, insert); + return true; } + return false; } ts.insertSorted = insertSorted; function sortAndDeduplicate(array, comparer, equalityComparer) { @@ -1346,6 +1153,13 @@ var ts; : undefined; } ts.singleOrUndefined = singleOrUndefined; + /** + * Returns the only element of an array if it contains only one element; throws otherwise. + */ + function single(array) { + return ts.Debug.checkDefined(singleOrUndefined(array)); + } + ts.single = single; function singleOrMany(array) { return array && array.length === 1 ? array[0] @@ -2869,7 +2683,7 @@ var ts; if (typeof func !== "function") { return ""; } - else if (func.hasOwnProperty("name")) { + else if (ts.hasProperty(func, "name")) { return func.name; } else { @@ -3019,7 +2833,7 @@ var ts; Debug.formatControlFlowGraph = formatControlFlowGraph; var flowNodeProto; function attachFlowNodeDebugInfoWorker(flowNode) { - if (!("__debugFlowFlags" in flowNode)) { // eslint-disable-line no-in-operator + if (!("__debugFlowFlags" in flowNode)) { // eslint-disable-line local/no-in-operator Object.defineProperties(flowNode, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { @@ -3065,7 +2879,7 @@ var ts; Debug.attachFlowNodeDebugInfo = attachFlowNodeDebugInfo; var nodeArrayProto; function attachNodeArrayDebugInfoWorker(array) { - if (!("__tsDebuggerDisplay" in array)) { // eslint-disable-line no-in-operator + if (!("__tsDebuggerDisplay" in array)) { // eslint-disable-line local/no-in-operator Object.defineProperties(array, { __tsDebuggerDisplay: { value: function (defaultValue) { @@ -3194,7 +3008,7 @@ var ts; ]; for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) { var ctor = nodeConstructors_1[_i]; - if (!ctor.prototype.hasOwnProperty("__debugKind")) { + if (!ts.hasProperty(ctor.prototype, "__debugKind")) { Object.defineProperties(ctor.prototype, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { @@ -3747,6 +3561,8 @@ var ts; typeof performance.mark === "function" && typeof performance.measure === "function" && typeof performance.now === "function" && + typeof performance.clearMarks === "function" && + typeof performance.clearMeasures === "function" && typeof PerformanceObserver === "function"; } function tryGetWebPerformanceHooks() { @@ -3791,7 +3607,9 @@ var ts; if (end === "__performance.measure-fix__") { nodePerformance_1.clearMarks("__performance.measure-fix__"); } - } + }, + clearMarks: function (name) { return nodePerformance_1.clearMarks(name); }, + clearMeasures: function (name) { return nodePerformance_1.clearMeasures(name); }, }; } return { @@ -3924,6 +3742,30 @@ var ts; durations.forEach(function (duration, measureName) { return cb(measureName, duration); }); } performance.forEachMeasure = forEachMeasure; + function forEachMark(cb) { + marks.forEach(function (_time, markName) { return cb(markName); }); + } + performance.forEachMark = forEachMark; + function clearMeasures(name) { + if (name !== undefined) + durations.delete(name); + else + durations.clear(); + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMeasures(name); + } + performance.clearMeasures = clearMeasures; + function clearMarks(name) { + if (name !== undefined) { + counts.delete(name); + marks.delete(name); + } + else { + counts.clear(); + marks.clear(); + } + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMarks(name); + } + performance.clearMarks = clearMarks; /** * Indicates whether the performance API is enabled. */ @@ -4021,7 +3863,6 @@ var ts; var typeCatalog = []; // NB: id is index + 1 var legendPath; var legend = []; - ; /** Starts tracing for the given project. */ function startTracing(tracingMode, traceDir, configFilePath) { ts.Debug.assert(!ts.tracing, "Tracing already started"); @@ -4226,7 +4067,7 @@ var ts; var substitutionType = type; substitutionProperties = { substitutionBaseType: (_o = substitutionType.baseType) === null || _o === void 0 ? void 0 : _o.id, - substituteType: (_p = substitutionType.substitute) === null || _p === void 0 ? void 0 : _p.id, + constraintType: (_p = substitutionType.constraint) === null || _p === void 0 ? void 0 : _p.id, }; } var reverseMappedProperties = {}; @@ -4426,257 +4267,260 @@ var ts; SyntaxKind[SyntaxKind["YieldKeyword"] = 125] = "YieldKeyword"; // Contextual keywords SyntaxKind[SyntaxKind["AbstractKeyword"] = 126] = "AbstractKeyword"; - SyntaxKind[SyntaxKind["AsKeyword"] = 127] = "AsKeyword"; - SyntaxKind[SyntaxKind["AssertsKeyword"] = 128] = "AssertsKeyword"; - SyntaxKind[SyntaxKind["AssertKeyword"] = 129] = "AssertKeyword"; - SyntaxKind[SyntaxKind["AnyKeyword"] = 130] = "AnyKeyword"; - SyntaxKind[SyntaxKind["AsyncKeyword"] = 131] = "AsyncKeyword"; - SyntaxKind[SyntaxKind["AwaitKeyword"] = 132] = "AwaitKeyword"; - SyntaxKind[SyntaxKind["BooleanKeyword"] = 133] = "BooleanKeyword"; - SyntaxKind[SyntaxKind["ConstructorKeyword"] = 134] = "ConstructorKeyword"; - SyntaxKind[SyntaxKind["DeclareKeyword"] = 135] = "DeclareKeyword"; - SyntaxKind[SyntaxKind["GetKeyword"] = 136] = "GetKeyword"; - SyntaxKind[SyntaxKind["InferKeyword"] = 137] = "InferKeyword"; - SyntaxKind[SyntaxKind["IntrinsicKeyword"] = 138] = "IntrinsicKeyword"; - SyntaxKind[SyntaxKind["IsKeyword"] = 139] = "IsKeyword"; - SyntaxKind[SyntaxKind["KeyOfKeyword"] = 140] = "KeyOfKeyword"; - SyntaxKind[SyntaxKind["ModuleKeyword"] = 141] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["NamespaceKeyword"] = 142] = "NamespaceKeyword"; - SyntaxKind[SyntaxKind["NeverKeyword"] = 143] = "NeverKeyword"; - SyntaxKind[SyntaxKind["OutKeyword"] = 144] = "OutKeyword"; - SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 145] = "ReadonlyKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 146] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 147] = "NumberKeyword"; - SyntaxKind[SyntaxKind["ObjectKeyword"] = 148] = "ObjectKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 149] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 150] = "StringKeyword"; - SyntaxKind[SyntaxKind["SymbolKeyword"] = 151] = "SymbolKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 152] = "TypeKeyword"; - SyntaxKind[SyntaxKind["UndefinedKeyword"] = 153] = "UndefinedKeyword"; - SyntaxKind[SyntaxKind["UniqueKeyword"] = 154] = "UniqueKeyword"; - SyntaxKind[SyntaxKind["UnknownKeyword"] = 155] = "UnknownKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 156] = "FromKeyword"; - SyntaxKind[SyntaxKind["GlobalKeyword"] = 157] = "GlobalKeyword"; - SyntaxKind[SyntaxKind["BigIntKeyword"] = 158] = "BigIntKeyword"; - SyntaxKind[SyntaxKind["OverrideKeyword"] = 159] = "OverrideKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 160] = "OfKeyword"; + SyntaxKind[SyntaxKind["AccessorKeyword"] = 127] = "AccessorKeyword"; + SyntaxKind[SyntaxKind["AsKeyword"] = 128] = "AsKeyword"; + SyntaxKind[SyntaxKind["AssertsKeyword"] = 129] = "AssertsKeyword"; + SyntaxKind[SyntaxKind["AssertKeyword"] = 130] = "AssertKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 131] = "AnyKeyword"; + SyntaxKind[SyntaxKind["AsyncKeyword"] = 132] = "AsyncKeyword"; + SyntaxKind[SyntaxKind["AwaitKeyword"] = 133] = "AwaitKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 134] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 135] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 136] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 137] = "GetKeyword"; + SyntaxKind[SyntaxKind["InferKeyword"] = 138] = "InferKeyword"; + SyntaxKind[SyntaxKind["IntrinsicKeyword"] = 139] = "IntrinsicKeyword"; + SyntaxKind[SyntaxKind["IsKeyword"] = 140] = "IsKeyword"; + SyntaxKind[SyntaxKind["KeyOfKeyword"] = 141] = "KeyOfKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 142] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["NamespaceKeyword"] = 143] = "NamespaceKeyword"; + SyntaxKind[SyntaxKind["NeverKeyword"] = 144] = "NeverKeyword"; + SyntaxKind[SyntaxKind["OutKeyword"] = 145] = "OutKeyword"; + SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 146] = "ReadonlyKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 147] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 148] = "NumberKeyword"; + SyntaxKind[SyntaxKind["ObjectKeyword"] = 149] = "ObjectKeyword"; + SyntaxKind[SyntaxKind["SatisfiesKeyword"] = 150] = "SatisfiesKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 151] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 152] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 153] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 154] = "TypeKeyword"; + SyntaxKind[SyntaxKind["UndefinedKeyword"] = 155] = "UndefinedKeyword"; + SyntaxKind[SyntaxKind["UniqueKeyword"] = 156] = "UniqueKeyword"; + SyntaxKind[SyntaxKind["UnknownKeyword"] = 157] = "UnknownKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 158] = "FromKeyword"; + SyntaxKind[SyntaxKind["GlobalKeyword"] = 159] = "GlobalKeyword"; + SyntaxKind[SyntaxKind["BigIntKeyword"] = 160] = "BigIntKeyword"; + SyntaxKind[SyntaxKind["OverrideKeyword"] = 161] = "OverrideKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 162] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 161] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 162] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 163] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 164] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 163] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 164] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 165] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 165] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 166] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 167] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 166] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 167] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 168] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 169] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["ClassStaticBlockDeclaration"] = 170] = "ClassStaticBlockDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 171] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 172] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 173] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 174] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 175] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 176] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 168] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 169] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 170] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 171] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["ClassStaticBlockDeclaration"] = 172] = "ClassStaticBlockDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 173] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 174] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 175] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 176] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 177] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 178] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypePredicate"] = 177] = "TypePredicate"; - SyntaxKind[SyntaxKind["TypeReference"] = 178] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 179] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 180] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 181] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 182] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 183] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 184] = "TupleType"; - SyntaxKind[SyntaxKind["OptionalType"] = 185] = "OptionalType"; - SyntaxKind[SyntaxKind["RestType"] = 186] = "RestType"; - SyntaxKind[SyntaxKind["UnionType"] = 187] = "UnionType"; - SyntaxKind[SyntaxKind["IntersectionType"] = 188] = "IntersectionType"; - SyntaxKind[SyntaxKind["ConditionalType"] = 189] = "ConditionalType"; - SyntaxKind[SyntaxKind["InferType"] = 190] = "InferType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 191] = "ParenthesizedType"; - SyntaxKind[SyntaxKind["ThisType"] = 192] = "ThisType"; - SyntaxKind[SyntaxKind["TypeOperator"] = 193] = "TypeOperator"; - SyntaxKind[SyntaxKind["IndexedAccessType"] = 194] = "IndexedAccessType"; - SyntaxKind[SyntaxKind["MappedType"] = 195] = "MappedType"; - SyntaxKind[SyntaxKind["LiteralType"] = 196] = "LiteralType"; - SyntaxKind[SyntaxKind["NamedTupleMember"] = 197] = "NamedTupleMember"; - SyntaxKind[SyntaxKind["TemplateLiteralType"] = 198] = "TemplateLiteralType"; - SyntaxKind[SyntaxKind["TemplateLiteralTypeSpan"] = 199] = "TemplateLiteralTypeSpan"; - SyntaxKind[SyntaxKind["ImportType"] = 200] = "ImportType"; + SyntaxKind[SyntaxKind["TypePredicate"] = 179] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 180] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 181] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 182] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 183] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 184] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 185] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 186] = "TupleType"; + SyntaxKind[SyntaxKind["OptionalType"] = 187] = "OptionalType"; + SyntaxKind[SyntaxKind["RestType"] = 188] = "RestType"; + SyntaxKind[SyntaxKind["UnionType"] = 189] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 190] = "IntersectionType"; + SyntaxKind[SyntaxKind["ConditionalType"] = 191] = "ConditionalType"; + SyntaxKind[SyntaxKind["InferType"] = 192] = "InferType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 193] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ThisType"] = 194] = "ThisType"; + SyntaxKind[SyntaxKind["TypeOperator"] = 195] = "TypeOperator"; + SyntaxKind[SyntaxKind["IndexedAccessType"] = 196] = "IndexedAccessType"; + SyntaxKind[SyntaxKind["MappedType"] = 197] = "MappedType"; + SyntaxKind[SyntaxKind["LiteralType"] = 198] = "LiteralType"; + SyntaxKind[SyntaxKind["NamedTupleMember"] = 199] = "NamedTupleMember"; + SyntaxKind[SyntaxKind["TemplateLiteralType"] = 200] = "TemplateLiteralType"; + SyntaxKind[SyntaxKind["TemplateLiteralTypeSpan"] = 201] = "TemplateLiteralTypeSpan"; + SyntaxKind[SyntaxKind["ImportType"] = 202] = "ImportType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 201] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 202] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 203] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 203] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 204] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 205] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 204] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 205] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 206] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 207] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 208] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 209] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 210] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 211] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 212] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 213] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 214] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 215] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 216] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 217] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 218] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 219] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 220] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 221] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 222] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 223] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 224] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElement"] = 225] = "SpreadElement"; - SyntaxKind[SyntaxKind["ClassExpression"] = 226] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 227] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 228] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 229] = "AsExpression"; - SyntaxKind[SyntaxKind["NonNullExpression"] = 230] = "NonNullExpression"; - SyntaxKind[SyntaxKind["MetaProperty"] = 231] = "MetaProperty"; - SyntaxKind[SyntaxKind["SyntheticExpression"] = 232] = "SyntheticExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 206] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 207] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 208] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 209] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 210] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 211] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 212] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 213] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 214] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 215] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 216] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 217] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 218] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 219] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 220] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 221] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 222] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 223] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 224] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 225] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 226] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElement"] = 227] = "SpreadElement"; + SyntaxKind[SyntaxKind["ClassExpression"] = 228] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 229] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 230] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 231] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 232] = "NonNullExpression"; + SyntaxKind[SyntaxKind["MetaProperty"] = 233] = "MetaProperty"; + SyntaxKind[SyntaxKind["SyntheticExpression"] = 234] = "SyntheticExpression"; + SyntaxKind[SyntaxKind["SatisfiesExpression"] = 235] = "SatisfiesExpression"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 233] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 234] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 236] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 237] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 235] = "Block"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 236] = "EmptyStatement"; - SyntaxKind[SyntaxKind["VariableStatement"] = 237] = "VariableStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 238] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 239] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 240] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 241] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 242] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 243] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 244] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 245] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 246] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 247] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 248] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 249] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 250] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 251] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 252] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 253] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 254] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 255] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 256] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 257] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 258] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 259] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 260] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 261] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 262] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 263] = "CaseBlock"; - SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 264] = "NamespaceExportDeclaration"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 265] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 266] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 267] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 268] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 269] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 270] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 271] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 272] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 273] = "NamedExports"; - SyntaxKind[SyntaxKind["NamespaceExport"] = 274] = "NamespaceExport"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 275] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 276] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 238] = "Block"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 239] = "EmptyStatement"; + SyntaxKind[SyntaxKind["VariableStatement"] = 240] = "VariableStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 241] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 242] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 243] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 244] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 245] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 246] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 247] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 248] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 249] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 250] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 251] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 252] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 253] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 254] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 255] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 256] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 257] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 258] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 259] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 260] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 261] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 262] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 263] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 264] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 265] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 266] = "CaseBlock"; + SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 267] = "NamespaceExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 268] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 269] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 270] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 271] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 272] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 273] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 274] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 275] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 276] = "NamedExports"; + SyntaxKind[SyntaxKind["NamespaceExport"] = 277] = "NamespaceExport"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 278] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 279] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 277] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 280] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 278] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 279] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 280] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 281] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxFragment"] = 282] = "JsxFragment"; - SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 283] = "JsxOpeningFragment"; - SyntaxKind[SyntaxKind["JsxClosingFragment"] = 284] = "JsxClosingFragment"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 285] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxAttributes"] = 286] = "JsxAttributes"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 287] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 288] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 281] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 282] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 283] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 284] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxFragment"] = 285] = "JsxFragment"; + SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 286] = "JsxOpeningFragment"; + SyntaxKind[SyntaxKind["JsxClosingFragment"] = 287] = "JsxClosingFragment"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 288] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxAttributes"] = 289] = "JsxAttributes"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 290] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 291] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 289] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 290] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 291] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 292] = "CatchClause"; - SyntaxKind[SyntaxKind["AssertClause"] = 293] = "AssertClause"; - SyntaxKind[SyntaxKind["AssertEntry"] = 294] = "AssertEntry"; - SyntaxKind[SyntaxKind["ImportTypeAssertionContainer"] = 295] = "ImportTypeAssertionContainer"; + SyntaxKind[SyntaxKind["CaseClause"] = 292] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 293] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 294] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 295] = "CatchClause"; + SyntaxKind[SyntaxKind["AssertClause"] = 296] = "AssertClause"; + SyntaxKind[SyntaxKind["AssertEntry"] = 297] = "AssertEntry"; + SyntaxKind[SyntaxKind["ImportTypeAssertionContainer"] = 298] = "ImportTypeAssertionContainer"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 296] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 297] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 298] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 299] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 300] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 301] = "SpreadAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 299] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 302] = "EnumMember"; // Unparsed - SyntaxKind[SyntaxKind["UnparsedPrologue"] = 300] = "UnparsedPrologue"; - SyntaxKind[SyntaxKind["UnparsedPrepend"] = 301] = "UnparsedPrepend"; - SyntaxKind[SyntaxKind["UnparsedText"] = 302] = "UnparsedText"; - SyntaxKind[SyntaxKind["UnparsedInternalText"] = 303] = "UnparsedInternalText"; - SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 304] = "UnparsedSyntheticReference"; + SyntaxKind[SyntaxKind["UnparsedPrologue"] = 303] = "UnparsedPrologue"; + SyntaxKind[SyntaxKind["UnparsedPrepend"] = 304] = "UnparsedPrepend"; + SyntaxKind[SyntaxKind["UnparsedText"] = 305] = "UnparsedText"; + SyntaxKind[SyntaxKind["UnparsedInternalText"] = 306] = "UnparsedInternalText"; + SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 307] = "UnparsedSyntheticReference"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 305] = "SourceFile"; - SyntaxKind[SyntaxKind["Bundle"] = 306] = "Bundle"; - SyntaxKind[SyntaxKind["UnparsedSource"] = 307] = "UnparsedSource"; - SyntaxKind[SyntaxKind["InputFiles"] = 308] = "InputFiles"; + SyntaxKind[SyntaxKind["SourceFile"] = 308] = "SourceFile"; + SyntaxKind[SyntaxKind["Bundle"] = 309] = "Bundle"; + SyntaxKind[SyntaxKind["UnparsedSource"] = 310] = "UnparsedSource"; + SyntaxKind[SyntaxKind["InputFiles"] = 311] = "InputFiles"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 309] = "JSDocTypeExpression"; - SyntaxKind[SyntaxKind["JSDocNameReference"] = 310] = "JSDocNameReference"; - SyntaxKind[SyntaxKind["JSDocMemberName"] = 311] = "JSDocMemberName"; - SyntaxKind[SyntaxKind["JSDocAllType"] = 312] = "JSDocAllType"; - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 313] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 314] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 315] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 316] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 317] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 318] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocNamepathType"] = 319] = "JSDocNamepathType"; - SyntaxKind[SyntaxKind["JSDoc"] = 320] = "JSDoc"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 312] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocNameReference"] = 313] = "JSDocNameReference"; + SyntaxKind[SyntaxKind["JSDocMemberName"] = 314] = "JSDocMemberName"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 315] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 316] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 317] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 318] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 319] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 320] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 321] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocNamepathType"] = 322] = "JSDocNamepathType"; + SyntaxKind[SyntaxKind["JSDoc"] = 323] = "JSDoc"; /** @deprecated Use SyntaxKind.JSDoc */ - SyntaxKind[SyntaxKind["JSDocComment"] = 320] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocText"] = 321] = "JSDocText"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 322] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocSignature"] = 323] = "JSDocSignature"; - SyntaxKind[SyntaxKind["JSDocLink"] = 324] = "JSDocLink"; - SyntaxKind[SyntaxKind["JSDocLinkCode"] = 325] = "JSDocLinkCode"; - SyntaxKind[SyntaxKind["JSDocLinkPlain"] = 326] = "JSDocLinkPlain"; - SyntaxKind[SyntaxKind["JSDocTag"] = 327] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 328] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocImplementsTag"] = 329] = "JSDocImplementsTag"; - SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 330] = "JSDocAuthorTag"; - SyntaxKind[SyntaxKind["JSDocDeprecatedTag"] = 331] = "JSDocDeprecatedTag"; - SyntaxKind[SyntaxKind["JSDocClassTag"] = 332] = "JSDocClassTag"; - SyntaxKind[SyntaxKind["JSDocPublicTag"] = 333] = "JSDocPublicTag"; - SyntaxKind[SyntaxKind["JSDocPrivateTag"] = 334] = "JSDocPrivateTag"; - SyntaxKind[SyntaxKind["JSDocProtectedTag"] = 335] = "JSDocProtectedTag"; - SyntaxKind[SyntaxKind["JSDocReadonlyTag"] = 336] = "JSDocReadonlyTag"; - SyntaxKind[SyntaxKind["JSDocOverrideTag"] = 337] = "JSDocOverrideTag"; - SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 338] = "JSDocCallbackTag"; - SyntaxKind[SyntaxKind["JSDocEnumTag"] = 339] = "JSDocEnumTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 340] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 341] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocThisTag"] = 342] = "JSDocThisTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 343] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 344] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 345] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocSeeTag"] = 346] = "JSDocSeeTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 347] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocComment"] = 323] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocText"] = 324] = "JSDocText"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 325] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocSignature"] = 326] = "JSDocSignature"; + SyntaxKind[SyntaxKind["JSDocLink"] = 327] = "JSDocLink"; + SyntaxKind[SyntaxKind["JSDocLinkCode"] = 328] = "JSDocLinkCode"; + SyntaxKind[SyntaxKind["JSDocLinkPlain"] = 329] = "JSDocLinkPlain"; + SyntaxKind[SyntaxKind["JSDocTag"] = 330] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 331] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocImplementsTag"] = 332] = "JSDocImplementsTag"; + SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 333] = "JSDocAuthorTag"; + SyntaxKind[SyntaxKind["JSDocDeprecatedTag"] = 334] = "JSDocDeprecatedTag"; + SyntaxKind[SyntaxKind["JSDocClassTag"] = 335] = "JSDocClassTag"; + SyntaxKind[SyntaxKind["JSDocPublicTag"] = 336] = "JSDocPublicTag"; + SyntaxKind[SyntaxKind["JSDocPrivateTag"] = 337] = "JSDocPrivateTag"; + SyntaxKind[SyntaxKind["JSDocProtectedTag"] = 338] = "JSDocProtectedTag"; + SyntaxKind[SyntaxKind["JSDocReadonlyTag"] = 339] = "JSDocReadonlyTag"; + SyntaxKind[SyntaxKind["JSDocOverrideTag"] = 340] = "JSDocOverrideTag"; + SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 341] = "JSDocCallbackTag"; + SyntaxKind[SyntaxKind["JSDocEnumTag"] = 342] = "JSDocEnumTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 343] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 344] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocThisTag"] = 345] = "JSDocThisTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 346] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 347] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 348] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocSeeTag"] = 349] = "JSDocSeeTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 350] = "JSDocPropertyTag"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 348] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 351] = "SyntaxList"; // Transformation nodes - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 349] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 350] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["CommaListExpression"] = 351] = "CommaListExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 352] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 353] = "EndOfDeclarationMarker"; - SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 354] = "SyntheticReferenceExpression"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 352] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 353] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["CommaListExpression"] = 354] = "CommaListExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 355] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 356] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 357] = "SyntheticReferenceExpression"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 355] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 358] = "Count"; // Markers SyntaxKind[SyntaxKind["FirstAssignment"] = 63] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 78] = "LastAssignment"; @@ -4685,15 +4529,15 @@ var ts; SyntaxKind[SyntaxKind["FirstReservedWord"] = 81] = "FirstReservedWord"; SyntaxKind[SyntaxKind["LastReservedWord"] = 116] = "LastReservedWord"; SyntaxKind[SyntaxKind["FirstKeyword"] = 81] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 160] = "LastKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 162] = "LastKeyword"; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 117] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 125] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 177] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 200] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 179] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 202] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 18] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 78] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 160] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 162] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; @@ -4702,15 +4546,15 @@ var ts; SyntaxKind[SyntaxKind["LastTemplateToken"] = 17] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 29] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 78] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstStatement"] = 237] = "FirstStatement"; - SyntaxKind[SyntaxKind["LastStatement"] = 253] = "LastStatement"; - SyntaxKind[SyntaxKind["FirstNode"] = 161] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 309] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 347] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 327] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 347] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstStatement"] = 240] = "FirstStatement"; + SyntaxKind[SyntaxKind["LastStatement"] = 256] = "LastStatement"; + SyntaxKind[SyntaxKind["FirstNode"] = 163] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 312] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 350] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 330] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 350] = "LastJSDocTagNode"; /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 126] = "FirstContextualKeyword"; - /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 160] = "LastContextualKeyword"; + /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 162] = "LastContextualKeyword"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); var NodeFlags; (function (NodeFlags) { @@ -4775,9 +4619,10 @@ var ts; ModifierFlags[ModifierFlags["Protected"] = 16] = "Protected"; ModifierFlags[ModifierFlags["Static"] = 32] = "Static"; ModifierFlags[ModifierFlags["Readonly"] = 64] = "Readonly"; - ModifierFlags[ModifierFlags["Abstract"] = 128] = "Abstract"; - ModifierFlags[ModifierFlags["Async"] = 256] = "Async"; - ModifierFlags[ModifierFlags["Default"] = 512] = "Default"; + ModifierFlags[ModifierFlags["Accessor"] = 128] = "Accessor"; + ModifierFlags[ModifierFlags["Abstract"] = 256] = "Abstract"; + ModifierFlags[ModifierFlags["Async"] = 512] = "Async"; + ModifierFlags[ModifierFlags["Default"] = 1024] = "Default"; ModifierFlags[ModifierFlags["Const"] = 2048] = "Const"; ModifierFlags[ModifierFlags["HasComputedJSDocModifiers"] = 4096] = "HasComputedJSDocModifiers"; ModifierFlags[ModifierFlags["Deprecated"] = 8192] = "Deprecated"; @@ -4790,10 +4635,10 @@ var ts; // Accessibility modifiers and 'readonly' can be attached to a parameter in a constructor to make it a property. ModifierFlags[ModifierFlags["ParameterPropertyModifier"] = 16476] = "ParameterPropertyModifier"; ModifierFlags[ModifierFlags["NonPublicAccessibilityModifier"] = 24] = "NonPublicAccessibilityModifier"; - ModifierFlags[ModifierFlags["TypeScriptModifier"] = 116958] = "TypeScriptModifier"; - ModifierFlags[ModifierFlags["ExportDefault"] = 513] = "ExportDefault"; - ModifierFlags[ModifierFlags["All"] = 257023] = "All"; - ModifierFlags[ModifierFlags["Modifier"] = 125951] = "Modifier"; + ModifierFlags[ModifierFlags["TypeScriptModifier"] = 117086] = "TypeScriptModifier"; + ModifierFlags[ModifierFlags["ExportDefault"] = 1025] = "ExportDefault"; + ModifierFlags[ModifierFlags["All"] = 258047] = "All"; + ModifierFlags[ModifierFlags["Modifier"] = 126975] = "Modifier"; })(ModifierFlags = ts.ModifierFlags || (ts.ModifierFlags = {})); var JsxFlags; (function (JsxFlags) { @@ -4989,6 +4834,7 @@ var ts; NodeBuilderFlags[NodeBuilderFlags["AllowEmptyTuple"] = 524288] = "AllowEmptyTuple"; NodeBuilderFlags[NodeBuilderFlags["AllowUniqueESSymbolType"] = 1048576] = "AllowUniqueESSymbolType"; NodeBuilderFlags[NodeBuilderFlags["AllowEmptyIndexInfoType"] = 2097152] = "AllowEmptyIndexInfoType"; + /* @internal */ NodeBuilderFlags[NodeBuilderFlags["WriteComputedProps"] = 1073741824] = "WriteComputedProps"; // Errors (cont.) NodeBuilderFlags[NodeBuilderFlags["AllowNodeModulesRelativePaths"] = 67108864] = "AllowNodeModulesRelativePaths"; /* @internal */ NodeBuilderFlags[NodeBuilderFlags["DoNotIncludeSymbolChain"] = 134217728] = "DoNotIncludeSymbolChain"; @@ -5049,8 +4895,10 @@ var ts; SymbolFormatFlags[SymbolFormatFlags["AllowAnyNodeKind"] = 4] = "AllowAnyNodeKind"; // Prefer aliases which are not directly visible SymbolFormatFlags[SymbolFormatFlags["UseAliasDefinedOutsideCurrentScope"] = 8] = "UseAliasDefinedOutsideCurrentScope"; + // { [E.A]: 1 } + /* @internal */ SymbolFormatFlags[SymbolFormatFlags["WriteComputedProps"] = 16] = "WriteComputedProps"; // Skip building an accessible symbol chain - /* @internal */ SymbolFormatFlags[SymbolFormatFlags["DoNotIncludeSymbolChain"] = 16] = "DoNotIncludeSymbolChain"; + /* @internal */ SymbolFormatFlags[SymbolFormatFlags["DoNotIncludeSymbolChain"] = 32] = "DoNotIncludeSymbolChain"; })(SymbolFormatFlags = ts.SymbolFormatFlags || (ts.SymbolFormatFlags = {})); /* @internal */ var SymbolAccessibility; @@ -5164,6 +5012,7 @@ var ts; SymbolFlags[SymbolFlags["MethodExcludes"] = 103359] = "MethodExcludes"; SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 46015] = "GetAccessorExcludes"; SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 78783] = "SetAccessorExcludes"; + SymbolFlags[SymbolFlags["AccessorExcludes"] = 13247] = "AccessorExcludes"; SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 526824] = "TypeParameterExcludes"; SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 788968] = "TypeAliasExcludes"; SymbolFlags[SymbolFlags["AliasExcludes"] = 2097152] = "AliasExcludes"; @@ -6290,7 +6139,6 @@ var ts; var pollingChunkSize = createPollingIntervalBasedLevels(defaultChunkLevels); /* @internal */ ts.unchangedPollThresholds = createPollingIntervalBasedLevels(defaultChunkLevels); - /* @internal */ function setCustomPollingValues(system) { if (!system.getEnvironmentVariable) { return; @@ -6333,7 +6181,6 @@ var ts; createPollingIntervalBasedLevels(customLevels ? __assign(__assign({}, defaultLevels), customLevels) : defaultLevels); } } - ts.setCustomPollingValues = setCustomPollingValues; function pollWatchedFileQueue(host, queue, pollIndex, chunkSize, callbackOnWatchFileStat) { var definedValueCopyToIndex = pollIndex; // Max visit would be all elements of the queue @@ -6379,7 +6226,6 @@ var ts; } } } - /* @internal */ function createDynamicPriorityPollingWatchFile(host) { var watchedFiles = []; var changedFilesInLastPoll = []; @@ -6488,7 +6334,6 @@ var ts; pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === PollingInterval.Low ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval)); } } - ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile; function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) { // One file can have multiple watchers var fileWatcherCallbacks = ts.createMultiMap(); @@ -6567,42 +6412,38 @@ var ts; pollScheduled = host.setTimeout(pollQueue, PollingInterval.High); } } - /* @internal */ - function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) { - var cache = new ts.Map(); - var callbacksCache = ts.createMultiMap(); + function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) { var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); - return function (fileName, callback, pollingInterval, options) { - var path = toCanonicalFileName(fileName); - var existing = cache.get(path); - if (existing) { - existing.refCount++; + var path = toCanonicalFileName(name); + var existing = cache.get(path); + if (existing) { + existing.callbacks.push(callback); + } + else { + cache.set(path, { + watcher: createWatcher(( + // Cant infer types correctly so lets satisfy checker + function (param1, param2, param3) { var _a; return (_a = cache.get(path)) === null || _a === void 0 ? void 0 : _a.callbacks.slice().forEach(function (cb) { return cb(param1, param2, param3); }); })), + callbacks: [callback] + }); + } + return { + close: function () { + var watcher = cache.get(path); + // Watcher is not expected to be undefined, but if it is normally its because + // exception was thrown somewhere else and watch state is not what it should be + if (!watcher) + return; + if (!ts.orderedRemoveItem(watcher.callbacks, callback) || watcher.callbacks.length) + return; + cache.delete(path); + ts.closeFileWatcherOf(watcher); } - else { - cache.set(path, { - watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options), - refCount: 1 - }); - } - callbacksCache.add(path, callback); - return { - close: function () { - var watcher = ts.Debug.checkDefined(cache.get(path)); - callbacksCache.remove(path, callback); - watcher.refCount--; - if (watcher.refCount) - return; - cache.delete(path); - ts.closeFileWatcherOf(watcher); - } - }; }; } - ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName; /** * Returns true if file status changed */ - /*@internal*/ function onWatchedFileStat(watchedFile, modifiedTime) { var oldTime = watchedFile.mtime.getTime(); var newTime = modifiedTime.getTime(); @@ -6614,7 +6455,6 @@ var ts; } return false; } - ts.onWatchedFileStat = onWatchedFileStat; /*@internal*/ function getFileWatcherEventKind(oldTime, newTime) { return oldTime === 0 @@ -6642,7 +6482,6 @@ var ts; * that means if this is recursive watcher, watch the children directories as well * (eg on OS that dont support recursive watch using fs.watch use fs.watchFile) */ - /*@internal*/ function createDirectoryWatcherSupportingRecursive(_a) { var watchDirectory = _a.watchDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, fileSystemEntryExists = _a.fileSystemEntryExists, realpath = _a.realpath, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout; var cache = new ts.Map(); @@ -6851,18 +6690,15 @@ var ts; return ts.stringContains(toCanonicalFilePath(path), searchPath); } } - ts.createDirectoryWatcherSupportingRecursive = createDirectoryWatcherSupportingRecursive; /*@internal*/ var FileSystemEntryKind; (function (FileSystemEntryKind) { FileSystemEntryKind[FileSystemEntryKind["File"] = 0] = "File"; FileSystemEntryKind[FileSystemEntryKind["Directory"] = 1] = "Directory"; })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {})); - /*@internal*/ function createFileWatcherCallback(callback) { return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); }; } - ts.createFileWatcherCallback = createFileWatcherCallback; function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) { return function (eventName, _relativeFileName, modifiedTime) { if (eventName === "rename") { @@ -6896,7 +6732,10 @@ var ts; } /*@internal*/ function createSystemWatchFunctions(_a) { - var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog; + var pollingWatchFileWorker = _a.pollingWatchFileWorker, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog; + var pollingWatches = new ts.Map(); + var fsWatches = new ts.Map(); + var fsWatchesRecursive = new ts.Map(); var dynamicPollingWatchFile; var fixedChunkSizePollingWatchFile; var nonPollingWatchFile; @@ -6960,7 +6799,7 @@ var ts; // Use notifications from FS to watch with falling back to fs.watchFile generateWatchFileOptions(ts.WatchFileKind.UseFsEventsOnParentDirectory, ts.PollingWatchKind.PriorityInterval, options) : // Default to do not use fixed polling interval - { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.FixedPollingInterval }; + { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.UseFsEvents }; } } function generateWatchFileOptions(watchFile, fallbackPolling, options) { @@ -7031,7 +6870,13 @@ var ts; }; } } + function pollingWatchFile(fileName, callback, pollingInterval, options) { + return createSingleWatcherPerName(pollingWatches, useCaseSensitiveFileNames, fileName, callback, function (cb) { return pollingWatchFileWorker(fileName, cb, pollingInterval, options); }); + } function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { + return createSingleWatcherPerName(recursive ? fsWatchesRecursive : fsWatches, useCaseSensitiveFileNames, fileOrDirectory, callback, function (cb) { return fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, cb, recursive, fallbackPollingInterval, fallbackOptions); }); + } + function fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { var lastDirectoryPartWithDirectorySeparator; var lastDirectoryPart; if (inodeWatching) { @@ -7210,7 +7055,7 @@ var ts; var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin"); var getCurrentDirectory = ts.memoize(function () { return process.cwd(); }); var _b = createSystemWatchFunctions({ - pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames), + pollingWatchFileWorker: fsWatchFileWorker, getModifiedTime: getModifiedTime, setTimeout: setTimeout, clearTimeout: clearTimeout, @@ -8030,12 +7875,9 @@ var ts; * Normalize path separators, converting `\` into `/`. */ function normalizeSlashes(path) { - var index = path.indexOf("\\"); - if (index === -1) { - return path; - } - backslashRegExp.lastIndex = index; // prime regex with known position - return path.replace(backslashRegExp, ts.directorySeparator); + return path.indexOf("\\") !== -1 + ? path.replace(backslashRegExp, ts.directorySeparator) + : path; } ts.normalizeSlashes = normalizeSlashes; /** @@ -8618,6 +8460,8 @@ var ts; A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled: diag(1272, ts.DiagnosticCategory.Error, "A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_w_1272", "A type referenced in a decorated signature must be imported with 'import type' or a namespace import when 'isolatedModules' and 'emitDecoratorMetadata' are enabled."), _0_modifier_cannot_appear_on_a_type_parameter: diag(1273, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_type_parameter_1273", "'{0}' modifier cannot appear on a type parameter"), _0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias: diag(1274, ts.DiagnosticCategory.Error, "_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias_1274", "'{0}' modifier can only appear on a type parameter of a class, interface or type alias"), + accessor_modifier_can_only_appear_on_a_property_declaration: diag(1275, ts.DiagnosticCategory.Error, "accessor_modifier_can_only_appear_on_a_property_declaration_1275", "'accessor' modifier can only appear on a property declaration."), + An_accessor_property_cannot_be_declared_optional: diag(1276, ts.DiagnosticCategory.Error, "An_accessor_property_cannot_be_declared_optional_1276", "An 'accessor' property cannot be declared optional."), with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."), await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."), The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, ts.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."), @@ -8668,7 +8512,7 @@ var ts; An_enum_member_name_must_be_followed_by_a_or: diag(1357, ts.DiagnosticCategory.Error, "An_enum_member_name_must_be_followed_by_a_or_1357", "An enum member name must be followed by a ',', '=', or '}'."), Tagged_template_expressions_are_not_permitted_in_an_optional_chain: diag(1358, ts.DiagnosticCategory.Error, "Tagged_template_expressions_are_not_permitted_in_an_optional_chain_1358", "Tagged template expressions are not permitted in an optional chain."), Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here: diag(1359, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here_1359", "Identifier expected. '{0}' is a reserved word that cannot be used here."), - Class_constructor_may_not_be_a_generator: diag(1360, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1360", "Class constructor may not be a generator."), + Type_0_does_not_satisfy_the_expected_type_1: diag(1360, ts.DiagnosticCategory.Error, "Type_0_does_not_satisfy_the_expected_type_1_1360", "Type '{0}' does not satisfy the expected type '{1}'."), _0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type: diag(1361, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type_1361", "'{0}' cannot be used as a value because it was imported using 'import type'."), _0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type: diag(1362, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type_1362", "'{0}' cannot be used as a value because it was exported using 'export type'."), A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both: diag(1363, ts.DiagnosticCategory.Error, "A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both_1363", "A type-only import can specify a default import or named bindings, but not both."), @@ -8676,6 +8520,7 @@ var ts; Convert_all_re_exported_types_to_type_only_exports: diag(1365, ts.DiagnosticCategory.Message, "Convert_all_re_exported_types_to_type_only_exports_1365", "Convert all re-exported types to type-only exports"), Split_into_two_separate_import_declarations: diag(1366, ts.DiagnosticCategory.Message, "Split_into_two_separate_import_declarations_1366", "Split into two separate import declarations"), Split_all_invalid_type_only_imports: diag(1367, ts.DiagnosticCategory.Message, "Split_all_invalid_type_only_imports_1367", "Split all invalid type-only imports"), + Class_constructor_may_not_be_a_generator: diag(1368, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1368", "Class constructor may not be a generator."), Did_you_mean_0: diag(1369, ts.DiagnosticCategory.Message, "Did_you_mean_0_1369", "Did you mean '{0}'?"), This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error: diag(1371, ts.DiagnosticCategory.Error, "This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set__1371", "This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'."), Convert_to_type_only_import: diag(1373, ts.DiagnosticCategory.Message, "Convert_to_type_only_import_1373", "Convert to type-only import"), @@ -8849,14 +8694,12 @@ var ts; The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."), The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."), The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."), - The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360", "The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."), - The_right_hand_side_of_an_in_expression_must_not_be_a_primitive: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361", "The right-hand side of an 'in' expression must not be a primitive."), The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."), Operator_0_cannot_be_applied_to_types_1_and_2: diag(2365, ts.DiagnosticCategory.Error, "Operator_0_cannot_be_applied_to_types_1_and_2_2365", "Operator '{0}' cannot be applied to types '{1}' and '{2}'."), Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: diag(2366, ts.DiagnosticCategory.Error, "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", "Function lacks ending return statement and return type does not include 'undefined'."), - This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367", "This condition will always return '{0}' since the types '{1}' and '{2}' have no overlap."), + This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367", "This comparison appears to be unintentional because the types '{0}' and '{1}' have no overlap."), Type_parameter_name_cannot_be_0: diag(2368, ts.DiagnosticCategory.Error, "Type_parameter_name_cannot_be_0_2368", "Type parameter name cannot be '{0}'."), A_parameter_property_is_only_allowed_in_a_constructor_implementation: diag(2369, ts.DiagnosticCategory.Error, "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", "A parameter property is only allowed in a constructor implementation."), A_rest_parameter_must_be_of_an_array_type: diag(2370, ts.DiagnosticCategory.Error, "A_rest_parameter_must_be_of_an_array_type_2370", "A rest parameter must be of an array type."), @@ -9099,6 +8942,7 @@ var ts; Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."), Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation: diag(2636, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation_2636", "Type '{0}' is not assignable to type '{1}' as implied by variance annotation."), Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types: diag(2637, ts.DiagnosticCategory.Error, "Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_t_2637", "Variance annotations are only supported in type aliases for object, function, constructor, and mapped types."), + Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator: diag(2638, ts.DiagnosticCategory.Error, "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638", "Type '{0}' may represent a primitive value, which is not permitted as the right operand of the 'in' operator."), Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."), A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."), Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."), @@ -9279,6 +9123,7 @@ var ts; _0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation: diag(2842, ts.DiagnosticCategory.Error, "_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842", "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"), We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here: diag(2843, ts.DiagnosticCategory.Error, "We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843", "We can only write a type for '{0}' by adding a type for the entire parameter here."), Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, ts.DiagnosticCategory.Error, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."), + This_condition_will_always_return_0: diag(2845, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."), Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."), Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."), Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."), @@ -9736,6 +9581,7 @@ var ts; Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved: diag(6398, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."), Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes were not emitted"), Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs to update timestamps of output files that are older than input files"), + Project_0_is_out_of_date_because_there_was_error_reading_file_1: diag(6401, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401", "Project '{0}' is out of date because there was error reading file '{1}'"), The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"), The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."), The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."), @@ -9978,6 +9824,7 @@ var ts; The_tag_was_first_specified_here: diag(8034, ts.DiagnosticCategory.Error, "The_tag_was_first_specified_here_8034", "The tag was first specified here."), You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder: diag(8035, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder_8035", "You cannot rename elements that are defined in a 'node_modules' folder."), You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder: diag(8036, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder_8036", "You cannot rename elements that are defined in another 'node_modules' folder."), + Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files: diag(8037, ts.DiagnosticCategory.Error, "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037", "Type satisfaction expressions can only be used in TypeScript files."), Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."), Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."), JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17000, ts.DiagnosticCategory.Error, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."), @@ -10149,6 +9996,7 @@ var ts; Set_the_module_option_in_your_configuration_file_to_0: diag(95099, ts.DiagnosticCategory.Message, "Set_the_module_option_in_your_configuration_file_to_0_95099", "Set the 'module' option in your configuration file to '{0}'"), Convert_invalid_character_to_its_html_entity_code: diag(95100, ts.DiagnosticCategory.Message, "Convert_invalid_character_to_its_html_entity_code_95100", "Convert invalid character to its html entity code"), Convert_all_invalid_characters_to_HTML_entity_code: diag(95101, ts.DiagnosticCategory.Message, "Convert_all_invalid_characters_to_HTML_entity_code_95101", "Convert all invalid characters to HTML entity code"), + Convert_all_const_to_let: diag(95102, ts.DiagnosticCategory.Message, "Convert_all_const_to_let_95102", "Convert all 'const' to 'let'"), Convert_function_expression_0_to_arrow_function: diag(95105, ts.DiagnosticCategory.Message, "Convert_function_expression_0_to_arrow_function_95105", "Convert function expression '{0}' to arrow function"), Convert_function_declaration_0_to_arrow_function: diag(95106, ts.DiagnosticCategory.Message, "Convert_function_declaration_0_to_arrow_function_95106", "Convert function declaration '{0}' to arrow function"), Fix_all_implicit_this_errors: diag(95107, ts.DiagnosticCategory.Message, "Fix_all_implicit_this_errors_95107", "Fix all implicit-'this' errors"), @@ -10218,6 +10066,8 @@ var ts; Delete_unused_param_tag_0: diag(95171, ts.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"), Delete_all_unused_param_tags: diag(95172, ts.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"), Rename_param_tag_name_0_to_1: diag(95173, ts.DiagnosticCategory.Message, "Rename_param_tag_name_0_to_1_95173", "Rename '@param' tag name '{0}' to '{1}'"), + Use_0: diag(95174, ts.DiagnosticCategory.Message, "Use_0_95174", "Use `{0}`."), + Use_Number_isNaN_in_all_conditions: diag(95175, ts.DiagnosticCategory.Message, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."), No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."), Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."), JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, ts.DiagnosticCategory.Error, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"), @@ -10251,6 +10101,12 @@ var ts; _0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation: diag(18042, ts.DiagnosticCategory.Error, "_0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation_18042", "'{0}' is a type and cannot be imported in JavaScript files. Use '{1}' in a JSDoc type annotation."), Types_cannot_appear_in_export_declarations_in_JavaScript_files: diag(18043, ts.DiagnosticCategory.Error, "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043", "Types cannot appear in export declarations in JavaScript files."), _0_is_automatically_exported_here: diag(18044, ts.DiagnosticCategory.Message, "_0_is_automatically_exported_here_18044", "'{0}' is automatically exported here."), + Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher: diag(18045, ts.DiagnosticCategory.Error, "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045", "Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher."), + _0_is_of_type_unknown: diag(18046, ts.DiagnosticCategory.Error, "_0_is_of_type_unknown_18046", "'{0}' is of type 'unknown'."), + _0_is_possibly_null: diag(18047, ts.DiagnosticCategory.Error, "_0_is_possibly_null_18047", "'{0}' is possibly 'null'."), + _0_is_possibly_undefined: diag(18048, ts.DiagnosticCategory.Error, "_0_is_possibly_undefined_18048", "'{0}' is possibly 'undefined'."), + _0_is_possibly_null_or_undefined: diag(18049, ts.DiagnosticCategory.Error, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."), + The_value_0_cannot_be_used_here: diag(18050, ts.DiagnosticCategory.Error, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."), }; })(ts || (ts = {})); var ts; @@ -10269,12 +10125,13 @@ var ts; /** @internal */ ts.textToKeywordObj = (_a = { abstract: 126 /* SyntaxKind.AbstractKeyword */, - any: 130 /* SyntaxKind.AnyKeyword */, - as: 127 /* SyntaxKind.AsKeyword */, - asserts: 128 /* SyntaxKind.AssertsKeyword */, - assert: 129 /* SyntaxKind.AssertKeyword */, - bigint: 158 /* SyntaxKind.BigIntKeyword */, - boolean: 133 /* SyntaxKind.BooleanKeyword */, + accessor: 127 /* SyntaxKind.AccessorKeyword */, + any: 131 /* SyntaxKind.AnyKeyword */, + as: 128 /* SyntaxKind.AsKeyword */, + asserts: 129 /* SyntaxKind.AssertsKeyword */, + assert: 130 /* SyntaxKind.AssertKeyword */, + bigint: 160 /* SyntaxKind.BigIntKeyword */, + boolean: 134 /* SyntaxKind.BooleanKeyword */, break: 81 /* SyntaxKind.BreakKeyword */, case: 82 /* SyntaxKind.CaseKeyword */, catch: 83 /* SyntaxKind.CatchKeyword */, @@ -10282,9 +10139,9 @@ var ts; continue: 86 /* SyntaxKind.ContinueKeyword */, const: 85 /* SyntaxKind.ConstKeyword */ }, - _a["" + "constructor"] = 134 /* SyntaxKind.ConstructorKeyword */, + _a["" + "constructor"] = 135 /* SyntaxKind.ConstructorKeyword */, _a.debugger = 87 /* SyntaxKind.DebuggerKeyword */, - _a.declare = 135 /* SyntaxKind.DeclareKeyword */, + _a.declare = 136 /* SyntaxKind.DeclareKeyword */, _a.default = 88 /* SyntaxKind.DefaultKeyword */, _a.delete = 89 /* SyntaxKind.DeleteKeyword */, _a.do = 90 /* SyntaxKind.DoKeyword */, @@ -10295,60 +10152,61 @@ var ts; _a.false = 95 /* SyntaxKind.FalseKeyword */, _a.finally = 96 /* SyntaxKind.FinallyKeyword */, _a.for = 97 /* SyntaxKind.ForKeyword */, - _a.from = 156 /* SyntaxKind.FromKeyword */, + _a.from = 158 /* SyntaxKind.FromKeyword */, _a.function = 98 /* SyntaxKind.FunctionKeyword */, - _a.get = 136 /* SyntaxKind.GetKeyword */, + _a.get = 137 /* SyntaxKind.GetKeyword */, _a.if = 99 /* SyntaxKind.IfKeyword */, _a.implements = 117 /* SyntaxKind.ImplementsKeyword */, _a.import = 100 /* SyntaxKind.ImportKeyword */, _a.in = 101 /* SyntaxKind.InKeyword */, - _a.infer = 137 /* SyntaxKind.InferKeyword */, + _a.infer = 138 /* SyntaxKind.InferKeyword */, _a.instanceof = 102 /* SyntaxKind.InstanceOfKeyword */, _a.interface = 118 /* SyntaxKind.InterfaceKeyword */, - _a.intrinsic = 138 /* SyntaxKind.IntrinsicKeyword */, - _a.is = 139 /* SyntaxKind.IsKeyword */, - _a.keyof = 140 /* SyntaxKind.KeyOfKeyword */, + _a.intrinsic = 139 /* SyntaxKind.IntrinsicKeyword */, + _a.is = 140 /* SyntaxKind.IsKeyword */, + _a.keyof = 141 /* SyntaxKind.KeyOfKeyword */, _a.let = 119 /* SyntaxKind.LetKeyword */, - _a.module = 141 /* SyntaxKind.ModuleKeyword */, - _a.namespace = 142 /* SyntaxKind.NamespaceKeyword */, - _a.never = 143 /* SyntaxKind.NeverKeyword */, + _a.module = 142 /* SyntaxKind.ModuleKeyword */, + _a.namespace = 143 /* SyntaxKind.NamespaceKeyword */, + _a.never = 144 /* SyntaxKind.NeverKeyword */, _a.new = 103 /* SyntaxKind.NewKeyword */, _a.null = 104 /* SyntaxKind.NullKeyword */, - _a.number = 147 /* SyntaxKind.NumberKeyword */, - _a.object = 148 /* SyntaxKind.ObjectKeyword */, + _a.number = 148 /* SyntaxKind.NumberKeyword */, + _a.object = 149 /* SyntaxKind.ObjectKeyword */, _a.package = 120 /* SyntaxKind.PackageKeyword */, _a.private = 121 /* SyntaxKind.PrivateKeyword */, _a.protected = 122 /* SyntaxKind.ProtectedKeyword */, _a.public = 123 /* SyntaxKind.PublicKeyword */, - _a.override = 159 /* SyntaxKind.OverrideKeyword */, - _a.out = 144 /* SyntaxKind.OutKeyword */, - _a.readonly = 145 /* SyntaxKind.ReadonlyKeyword */, - _a.require = 146 /* SyntaxKind.RequireKeyword */, - _a.global = 157 /* SyntaxKind.GlobalKeyword */, + _a.override = 161 /* SyntaxKind.OverrideKeyword */, + _a.out = 145 /* SyntaxKind.OutKeyword */, + _a.readonly = 146 /* SyntaxKind.ReadonlyKeyword */, + _a.require = 147 /* SyntaxKind.RequireKeyword */, + _a.global = 159 /* SyntaxKind.GlobalKeyword */, _a.return = 105 /* SyntaxKind.ReturnKeyword */, - _a.set = 149 /* SyntaxKind.SetKeyword */, + _a.satisfies = 150 /* SyntaxKind.SatisfiesKeyword */, + _a.set = 151 /* SyntaxKind.SetKeyword */, _a.static = 124 /* SyntaxKind.StaticKeyword */, - _a.string = 150 /* SyntaxKind.StringKeyword */, + _a.string = 152 /* SyntaxKind.StringKeyword */, _a.super = 106 /* SyntaxKind.SuperKeyword */, _a.switch = 107 /* SyntaxKind.SwitchKeyword */, - _a.symbol = 151 /* SyntaxKind.SymbolKeyword */, + _a.symbol = 153 /* SyntaxKind.SymbolKeyword */, _a.this = 108 /* SyntaxKind.ThisKeyword */, _a.throw = 109 /* SyntaxKind.ThrowKeyword */, _a.true = 110 /* SyntaxKind.TrueKeyword */, _a.try = 111 /* SyntaxKind.TryKeyword */, - _a.type = 152 /* SyntaxKind.TypeKeyword */, + _a.type = 154 /* SyntaxKind.TypeKeyword */, _a.typeof = 112 /* SyntaxKind.TypeOfKeyword */, - _a.undefined = 153 /* SyntaxKind.UndefinedKeyword */, - _a.unique = 154 /* SyntaxKind.UniqueKeyword */, - _a.unknown = 155 /* SyntaxKind.UnknownKeyword */, + _a.undefined = 155 /* SyntaxKind.UndefinedKeyword */, + _a.unique = 156 /* SyntaxKind.UniqueKeyword */, + _a.unknown = 157 /* SyntaxKind.UnknownKeyword */, _a.var = 113 /* SyntaxKind.VarKeyword */, _a.void = 114 /* SyntaxKind.VoidKeyword */, _a.while = 115 /* SyntaxKind.WhileKeyword */, _a.with = 116 /* SyntaxKind.WithKeyword */, _a.yield = 125 /* SyntaxKind.YieldKeyword */, - _a.async = 131 /* SyntaxKind.AsyncKeyword */, - _a.await = 132 /* SyntaxKind.AwaitKeyword */, - _a.of = 160 /* SyntaxKind.OfKeyword */, + _a.async = 132 /* SyntaxKind.AsyncKeyword */, + _a.await = 133 /* SyntaxKind.AwaitKeyword */, + _a.of = 162 /* SyntaxKind.OfKeyword */, _a); var textToKeyword = new ts.Map(ts.getEntries(ts.textToKeywordObj)); var textToToken = new ts.Map(ts.getEntries(__assign(__assign({}, ts.textToKeywordObj), { "{": 18 /* SyntaxKind.OpenBraceToken */, "}": 19 /* SyntaxKind.CloseBraceToken */, "(": 20 /* SyntaxKind.OpenParenToken */, ")": 21 /* SyntaxKind.CloseParenToken */, "[": 22 /* SyntaxKind.OpenBracketToken */, "]": 23 /* SyntaxKind.CloseBracketToken */, ".": 24 /* SyntaxKind.DotToken */, "...": 25 /* SyntaxKind.DotDotDotToken */, ";": 26 /* SyntaxKind.SemicolonToken */, ",": 27 /* SyntaxKind.CommaToken */, "<": 29 /* SyntaxKind.LessThanToken */, ">": 31 /* SyntaxKind.GreaterThanToken */, "<=": 32 /* SyntaxKind.LessThanEqualsToken */, ">=": 33 /* SyntaxKind.GreaterThanEqualsToken */, "==": 34 /* SyntaxKind.EqualsEqualsToken */, "!=": 35 /* SyntaxKind.ExclamationEqualsToken */, "===": 36 /* SyntaxKind.EqualsEqualsEqualsToken */, "!==": 37 /* SyntaxKind.ExclamationEqualsEqualsToken */, "=>": 38 /* SyntaxKind.EqualsGreaterThanToken */, "+": 39 /* SyntaxKind.PlusToken */, "-": 40 /* SyntaxKind.MinusToken */, "**": 42 /* SyntaxKind.AsteriskAsteriskToken */, "*": 41 /* SyntaxKind.AsteriskToken */, "/": 43 /* SyntaxKind.SlashToken */, "%": 44 /* SyntaxKind.PercentToken */, "++": 45 /* SyntaxKind.PlusPlusToken */, "--": 46 /* SyntaxKind.MinusMinusToken */, "<<": 47 /* SyntaxKind.LessThanLessThanToken */, ">": 48 /* SyntaxKind.GreaterThanGreaterThanToken */, ">>>": 49 /* SyntaxKind.GreaterThanGreaterThanGreaterThanToken */, "&": 50 /* SyntaxKind.AmpersandToken */, "|": 51 /* SyntaxKind.BarToken */, "^": 52 /* SyntaxKind.CaretToken */, "!": 53 /* SyntaxKind.ExclamationToken */, "~": 54 /* SyntaxKind.TildeToken */, "&&": 55 /* SyntaxKind.AmpersandAmpersandToken */, "||": 56 /* SyntaxKind.BarBarToken */, "?": 57 /* SyntaxKind.QuestionToken */, "??": 60 /* SyntaxKind.QuestionQuestionToken */, "?.": 28 /* SyntaxKind.QuestionDotToken */, ":": 58 /* SyntaxKind.ColonToken */, "=": 63 /* SyntaxKind.EqualsToken */, "+=": 64 /* SyntaxKind.PlusEqualsToken */, "-=": 65 /* SyntaxKind.MinusEqualsToken */, "*=": 66 /* SyntaxKind.AsteriskEqualsToken */, "**=": 67 /* SyntaxKind.AsteriskAsteriskEqualsToken */, "/=": 68 /* SyntaxKind.SlashEqualsToken */, "%=": 69 /* SyntaxKind.PercentEqualsToken */, "<<=": 70 /* SyntaxKind.LessThanLessThanEqualsToken */, ">>=": 71 /* SyntaxKind.GreaterThanGreaterThanEqualsToken */, ">>>=": 72 /* SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 73 /* SyntaxKind.AmpersandEqualsToken */, "|=": 74 /* SyntaxKind.BarEqualsToken */, "^=": 78 /* SyntaxKind.CaretEqualsToken */, "||=": 75 /* SyntaxKind.BarBarEqualsToken */, "&&=": 76 /* SyntaxKind.AmpersandAmpersandEqualsToken */, "??=": 77 /* SyntaxKind.QuestionQuestionEqualsToken */, "@": 59 /* SyntaxKind.AtToken */, "#": 62 /* SyntaxKind.HashToken */, "`": 61 /* SyntaxKind.BacktickToken */ }))); @@ -10471,7 +10329,7 @@ var ts; ts.stringToToken = stringToToken; /* @internal */ function computeLineStarts(text) { - var result = new Array(); + var result = []; var pos = 0; var lineStart = 0; while (pos < text.length) { @@ -12032,12 +11890,36 @@ var ts; pos++; return token = 0 /* SyntaxKind.Unknown */; } - if (isIdentifierStart(codePointAt(text, pos + 1), languageVersion)) { + var charAfterHash = codePointAt(text, pos + 1); + if (charAfterHash === 92 /* CharacterCodes.backslash */) { pos++; - scanIdentifier(codePointAt(text, pos), languageVersion); + var extendedCookedChar_1 = peekExtendedUnicodeEscape(); + if (extendedCookedChar_1 >= 0 && isIdentifierStart(extendedCookedChar_1, languageVersion)) { + pos += 3; + tokenFlags |= 8 /* TokenFlags.ExtendedUnicodeEscape */; + tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts(); + return token = 80 /* SyntaxKind.PrivateIdentifier */; + } + var cookedChar_1 = peekUnicodeEscape(); + if (cookedChar_1 >= 0 && isIdentifierStart(cookedChar_1, languageVersion)) { + pos += 6; + tokenFlags |= 1024 /* TokenFlags.UnicodeEscape */; + tokenValue = "#" + String.fromCharCode(cookedChar_1) + scanIdentifierParts(); + return token = 80 /* SyntaxKind.PrivateIdentifier */; + } + pos--; + } + if (isIdentifierStart(charAfterHash, languageVersion)) { + pos++; + // We're relying on scanIdentifier's behavior and adjusting the token kind after the fact. + // Notably absent from this block is the fact that calling a function named "scanIdentifier", + // but identifiers don't include '#', and that function doesn't deal with it at all. + // This works because 'scanIdentifier' tries to reuse source characters and builds up substrings; + // however, it starts at the 'tokenPos' which includes the '#', and will "accidentally" prepend the '#' for us. + scanIdentifier(charAfterHash, languageVersion); } else { - tokenValue = String.fromCharCode(codePointAt(text, pos)); + tokenValue = "#"; error(ts.Diagnostics.Invalid_character, pos++, charSize(ch)); } return token = 80 /* SyntaxKind.PrivateIdentifier */; @@ -12788,9 +12670,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 163 /* SyntaxKind.TypeParameter */) { + if (d && d.kind === 165 /* SyntaxKind.TypeParameter */) { for (var current = d; current; current = current.parent) { - if (isFunctionLike(current) || isClassLike(current) || current.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (isFunctionLike(current) || isClassLike(current) || current.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return current; } } @@ -12798,7 +12680,7 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node, parent) { - return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) && parent.kind === 171 /* SyntaxKind.Constructor */; + return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) && parent.kind === 173 /* SyntaxKind.Constructor */; } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; function isEmptyBindingPattern(node) { @@ -12828,14 +12710,14 @@ var ts; node = walkUpBindingElementsAndPatterns(node); } var flags = getFlags(node); - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node && node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { flags |= getFlags(node); node = node.parent; } - if (node && node.kind === 237 /* SyntaxKind.VariableStatement */) { + if (node && node.kind === 240 /* SyntaxKind.VariableStatement */) { flags |= getFlags(node); } return flags; @@ -13008,30 +12890,30 @@ var ts; } // Covers remaining cases (returning undefined if none match). switch (hostNode.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: if (hostNode.declarationList && hostNode.declarationList.declarations[0]) { return getDeclarationIdentifier(hostNode.declarationList.declarations[0]); } break; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: var expr = hostNode.expression; - if (expr.kind === 221 /* SyntaxKind.BinaryExpression */ && expr.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (expr.kind === 223 /* SyntaxKind.BinaryExpression */ && expr.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { expr = expr.left; } switch (expr.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return expr.name; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var arg = expr.argumentExpression; if (ts.isIdentifier(arg)) { return arg; } } break; - case 212 /* SyntaxKind.ParenthesizedExpression */: { + case 214 /* SyntaxKind.ParenthesizedExpression */: { return getDeclarationIdentifier(hostNode.expression); } - case 250 /* SyntaxKind.LabeledStatement */: { + case 253 /* SyntaxKind.LabeledStatement */: { if (isDeclaration(hostNode.statement) || isExpression(hostNode.statement)) { return getDeclarationIdentifier(hostNode.statement); } @@ -13068,16 +12950,16 @@ var ts; switch (declaration.kind) { case 79 /* SyntaxKind.Identifier */: return declaration; - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: { + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: { var name = declaration.name; - if (name.kind === 161 /* SyntaxKind.QualifiedName */) { + if (name.kind === 163 /* SyntaxKind.QualifiedName */) { return name.right; } break; } - case 208 /* SyntaxKind.CallExpression */: - case 221 /* SyntaxKind.BinaryExpression */: { + case 210 /* SyntaxKind.CallExpression */: + case 223 /* SyntaxKind.BinaryExpression */: { var expr_1 = declaration; switch (ts.getAssignmentDeclarationKind(expr_1)) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -13093,15 +12975,15 @@ var ts; return undefined; } } - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return getNameOfJSDocTypedef(declaration); - case 339 /* SyntaxKind.JSDocEnumTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return nameForNamelessJSDocTypedef(declaration); - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var expression = declaration.expression; return ts.isIdentifier(expression) ? expression : undefined; } - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = declaration; if (ts.isBindableStaticElementAccessExpression(expr)) { return expr.argumentExpression; @@ -13145,7 +13027,7 @@ var ts; } ts.getDecorators = getDecorators; function getModifiers(node) { - if (ts.hasSyntacticModifier(node, 125951 /* ModifierFlags.Modifier */)) { + if (ts.hasSyntacticModifier(node, 126975 /* ModifierFlags.Modifier */)) { return ts.filter(node.modifiers, isModifier); } } @@ -13406,12 +13288,12 @@ var ts; /** Gets the text of a jsdoc comment, flattening links to their text. */ function getTextOfJSDocComment(comment) { return typeof comment === "string" ? comment - : comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 321 /* SyntaxKind.JSDocText */ ? c.text : formatJSDocLink(c); }).join(""); + : comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 324 /* SyntaxKind.JSDocText */ ? c.text : formatJSDocLink(c); }).join(""); } ts.getTextOfJSDocComment = getTextOfJSDocComment; function formatJSDocLink(link) { - var kind = link.kind === 324 /* SyntaxKind.JSDocLink */ ? "link" - : link.kind === 325 /* SyntaxKind.JSDocLinkCode */ ? "linkcode" + var kind = link.kind === 327 /* SyntaxKind.JSDocLink */ ? "link" + : link.kind === 328 /* SyntaxKind.JSDocLinkCode */ ? "linkcode" : "linkplain"; var name = link.name ? ts.entityNameToString(link.name) : ""; var space = link.name && link.text.startsWith("://") ? "" : " "; @@ -13432,7 +13314,7 @@ var ts; return ts.emptyArray; } if (ts.isJSDocTypeAlias(node)) { - ts.Debug.assert(node.parent.kind === 320 /* SyntaxKind.JSDoc */); + ts.Debug.assert(node.parent.kind === 323 /* SyntaxKind.JSDoc */); return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; }); } if (node.typeParameters) { @@ -13467,7 +13349,7 @@ var ts; ts.isMemberName = isMemberName; /* @internal */ function isGetOrSetAccessorDeclaration(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */ || node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */ || node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetOrSetAccessorDeclaration = isGetOrSetAccessorDeclaration; function isPropertyAccessChain(node) { @@ -13485,10 +13367,10 @@ var ts; function isOptionalChain(node) { var kind = node.kind; return !!(node.flags & 32 /* NodeFlags.OptionalChain */) && - (kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 207 /* SyntaxKind.ElementAccessExpression */ - || kind === 208 /* SyntaxKind.CallExpression */ - || kind === 230 /* SyntaxKind.NonNullExpression */); + (kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 209 /* SyntaxKind.ElementAccessExpression */ + || kind === 210 /* SyntaxKind.CallExpression */ + || kind === 232 /* SyntaxKind.NonNullExpression */); } ts.isOptionalChain = isOptionalChain; /* @internal */ @@ -13523,7 +13405,7 @@ var ts; } ts.isOutermostOptionalChain = isOutermostOptionalChain; function isNullishCoalesce(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */; } ts.isNullishCoalesce = isNullishCoalesce; function isConstTypeReference(node) { @@ -13540,17 +13422,17 @@ var ts; } ts.isNonNullChain = isNonNullChain; function isBreakOrContinueStatement(node) { - return node.kind === 246 /* SyntaxKind.BreakStatement */ || node.kind === 245 /* SyntaxKind.ContinueStatement */; + return node.kind === 249 /* SyntaxKind.BreakStatement */ || node.kind === 248 /* SyntaxKind.ContinueStatement */; } ts.isBreakOrContinueStatement = isBreakOrContinueStatement; function isNamedExportBindings(node) { - return node.kind === 274 /* SyntaxKind.NamespaceExport */ || node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 277 /* SyntaxKind.NamespaceExport */ || node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedExportBindings = isNamedExportBindings; function isUnparsedTextLike(node) { switch (node.kind) { - case 302 /* SyntaxKind.UnparsedText */: - case 303 /* SyntaxKind.UnparsedInternalText */: + case 305 /* SyntaxKind.UnparsedText */: + case 306 /* SyntaxKind.UnparsedInternalText */: return true; default: return false; @@ -13559,12 +13441,12 @@ var ts; ts.isUnparsedTextLike = isUnparsedTextLike; function isUnparsedNode(node) { return isUnparsedTextLike(node) || - node.kind === 300 /* SyntaxKind.UnparsedPrologue */ || - node.kind === 304 /* SyntaxKind.UnparsedSyntheticReference */; + node.kind === 303 /* SyntaxKind.UnparsedPrologue */ || + node.kind === 307 /* SyntaxKind.UnparsedSyntheticReference */; } ts.isUnparsedNode = isUnparsedNode; function isJSDocPropertyLikeTag(node) { - return node.kind === 347 /* SyntaxKind.JSDocPropertyTag */ || node.kind === 340 /* SyntaxKind.JSDocParameterTag */; + return node.kind === 350 /* SyntaxKind.JSDocPropertyTag */ || node.kind === 343 /* SyntaxKind.JSDocParameterTag */; } ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; // #endregion @@ -13580,7 +13462,7 @@ var ts; ts.isNode = isNode; /* @internal */ function isNodeKind(kind) { - return kind >= 161 /* SyntaxKind.FirstNode */; + return kind >= 163 /* SyntaxKind.FirstNode */; } ts.isNodeKind = isNodeKind; /** @@ -13589,7 +13471,7 @@ var ts; * Literals are considered tokens, except TemplateLiteral, but does include TemplateHead/Middle/Tail. */ function isTokenKind(kind) { - return kind >= 0 /* SyntaxKind.FirstToken */ && kind <= 160 /* SyntaxKind.LastToken */; + return kind >= 0 /* SyntaxKind.FirstToken */ && kind <= 162 /* SyntaxKind.LastToken */; } ts.isTokenKind = isTokenKind; /** @@ -13604,7 +13486,7 @@ var ts; // Node Arrays /* @internal */ function isNodeArray(array) { - return array.hasOwnProperty("pos") && array.hasOwnProperty("end"); + return ts.hasProperty(array, "pos") && ts.hasProperty(array, "end"); } ts.isNodeArray = isNodeArray; // Literals @@ -13620,11 +13502,11 @@ var ts; /** @internal */ function isLiteralExpressionOfObject(node) { switch (node.kind) { - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: return true; } return false; @@ -13652,13 +13534,13 @@ var ts; ts.isImportOrExportSpecifier = isImportOrExportSpecifier; function isTypeOnlyImportOrExportDeclaration(node) { switch (node.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return node.isTypeOnly || node.parent.parent.isTypeOnly; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.isTypeOnly; - case 267 /* SyntaxKind.ImportClause */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 270 /* SyntaxKind.ImportClause */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.isTypeOnly; default: return false; @@ -13679,6 +13561,11 @@ var ts; return ts.isIdentifier(node) && (node.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) > 0 /* GeneratedIdentifierFlags.None */; } ts.isGeneratedIdentifier = isGeneratedIdentifier; + /* @internal */ + function isGeneratedPrivateIdentifier(node) { + return ts.isPrivateIdentifier(node) && (node.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) > 0 /* GeneratedIdentifierFlags.None */; + } + ts.isGeneratedPrivateIdentifier = isGeneratedPrivateIdentifier; // Private Identifiers /*@internal*/ function isPrivateIdentifierClassElementDeclaration(node) { @@ -13695,19 +13582,20 @@ var ts; function isModifierKind(token) { switch (token) { case 126 /* SyntaxKind.AbstractKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 88 /* SyntaxKind.DefaultKeyword */: case 93 /* SyntaxKind.ExportKeyword */: case 101 /* SyntaxKind.InKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 144 /* SyntaxKind.OutKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 145 /* SyntaxKind.OutKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: return true; } return false; @@ -13720,7 +13608,10 @@ var ts; ts.isParameterPropertyModifier = isParameterPropertyModifier; /* @internal */ function isClassMemberModifier(idToken) { - return isParameterPropertyModifier(idToken) || idToken === 124 /* SyntaxKind.StaticKeyword */ || idToken === 159 /* SyntaxKind.OverrideKeyword */; + return isParameterPropertyModifier(idToken) || + idToken === 124 /* SyntaxKind.StaticKeyword */ || + idToken === 161 /* SyntaxKind.OverrideKeyword */ || + idToken === 127 /* SyntaxKind.AccessorKeyword */; } ts.isClassMemberModifier = isClassMemberModifier; function isModifier(node) { @@ -13729,7 +13620,7 @@ var ts; ts.isModifier = isModifier; function isEntityName(node) { var kind = node.kind; - return kind === 161 /* SyntaxKind.QualifiedName */ + return kind === 163 /* SyntaxKind.QualifiedName */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isEntityName = isEntityName; @@ -13739,14 +13630,14 @@ var ts; || kind === 80 /* SyntaxKind.PrivateIdentifier */ || kind === 10 /* SyntaxKind.StringLiteral */ || kind === 8 /* SyntaxKind.NumericLiteral */ - || kind === 162 /* SyntaxKind.ComputedPropertyName */; + || kind === 164 /* SyntaxKind.ComputedPropertyName */; } ts.isPropertyName = isPropertyName; function isBindingName(node) { var kind = node.kind; return kind === 79 /* SyntaxKind.Identifier */ - || kind === 201 /* SyntaxKind.ObjectBindingPattern */ - || kind === 202 /* SyntaxKind.ArrayBindingPattern */; + || kind === 203 /* SyntaxKind.ObjectBindingPattern */ + || kind === 204 /* SyntaxKind.ArrayBindingPattern */; } ts.isBindingName = isBindingName; // Functions @@ -13771,13 +13662,13 @@ var ts; ts.isBooleanLiteral = isBooleanLiteral; function isFunctionLikeDeclarationKind(kind) { switch (kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: return false; @@ -13786,14 +13677,14 @@ var ts; /* @internal */ function isFunctionLikeKind(kind) { switch (kind) { - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return true; default: return isFunctionLikeDeclarationKind(kind); @@ -13808,36 +13699,53 @@ var ts; // Classes function isClassElement(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 234 /* SyntaxKind.SemicolonClassElement */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 237 /* SyntaxKind.SemicolonClassElement */; } ts.isClassElement = isClassElement; function isClassLike(node) { - return node && (node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */); + return node && (node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */); } ts.isClassLike = isClassLike; function isAccessor(node) { - return node && (node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */); + return node && (node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */); } ts.isAccessor = isAccessor; + function isAutoAccessorPropertyDeclaration(node) { + return ts.isPropertyDeclaration(node) && ts.hasAccessorModifier(node); + } + ts.isAutoAccessorPropertyDeclaration = isAutoAccessorPropertyDeclaration; /* @internal */ function isMethodOrAccessor(node) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; default: return false; } } ts.isMethodOrAccessor = isMethodOrAccessor; + /* @internal */ + function isNamedClassElement(node) { + switch (node.kind) { + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + return true; + default: + return false; + } + } + ts.isNamedClassElement = isNamedClassElement; // Type members function isModifierLike(node) { return isModifier(node) || ts.isDecorator(node); @@ -13845,13 +13753,13 @@ var ts; ts.isModifierLike = isModifierLike; function isTypeElement(node) { var kind = node.kind; - return kind === 175 /* SyntaxKind.ConstructSignature */ - || kind === 174 /* SyntaxKind.CallSignature */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 177 /* SyntaxKind.ConstructSignature */ + || kind === 176 /* SyntaxKind.CallSignature */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.isTypeElement = isTypeElement; function isClassOrTypeElement(node) { @@ -13860,12 +13768,12 @@ var ts; ts.isClassOrTypeElement = isClassOrTypeElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 298 /* SyntaxKind.SpreadAssignment */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 301 /* SyntaxKind.SpreadAssignment */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; // Type @@ -13880,8 +13788,8 @@ var ts; ts.isTypeNode = isTypeNode; function isFunctionOrConstructorTypeNode(node) { switch (node.kind) { - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return true; } return false; @@ -13892,8 +13800,8 @@ var ts; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 202 /* SyntaxKind.ArrayBindingPattern */ - || kind === 201 /* SyntaxKind.ObjectBindingPattern */; + return kind === 204 /* SyntaxKind.ArrayBindingPattern */ + || kind === 203 /* SyntaxKind.ObjectBindingPattern */; } return false; } @@ -13901,15 +13809,15 @@ var ts; /* @internal */ function isAssignmentPattern(node) { var kind = node.kind; - return kind === 204 /* SyntaxKind.ArrayLiteralExpression */ - || kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return kind === 206 /* SyntaxKind.ArrayLiteralExpression */ + || kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isAssignmentPattern = isAssignmentPattern; /* @internal */ function isArrayBindingElement(node) { var kind = node.kind; - return kind === 203 /* SyntaxKind.BindingElement */ - || kind === 227 /* SyntaxKind.OmittedExpression */; + return kind === 205 /* SyntaxKind.BindingElement */ + || kind === 229 /* SyntaxKind.OmittedExpression */; } ts.isArrayBindingElement = isArrayBindingElement; /** @@ -13918,9 +13826,9 @@ var ts; /* @internal */ function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: return true; } return false; @@ -13941,8 +13849,8 @@ var ts; /* @internal */ function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return true; } return false; @@ -13951,10 +13859,10 @@ var ts; /* @internal */ function isObjectBindingOrAssignmentElement(node) { switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: // AssignmentProperty - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: // AssignmentProperty - case 298 /* SyntaxKind.SpreadAssignment */: // AssignmentRestProperty + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: // AssignmentProperty + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // AssignmentProperty + case 301 /* SyntaxKind.SpreadAssignment */: // AssignmentRestProperty return true; } return false; @@ -13966,8 +13874,8 @@ var ts; /* @internal */ function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return true; } return false; @@ -13976,26 +13884,26 @@ var ts; /* @internal */ function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) { var kind = node.kind; - return kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 161 /* SyntaxKind.QualifiedName */ - || kind === 200 /* SyntaxKind.ImportType */; + return kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 163 /* SyntaxKind.QualifiedName */ + || kind === 202 /* SyntaxKind.ImportType */; } ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode; // Expression function isPropertyAccessOrQualifiedName(node) { var kind = node.kind; - return kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 161 /* SyntaxKind.QualifiedName */; + return kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 163 /* SyntaxKind.QualifiedName */; } ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName; function isCallLikeExpression(node) { switch (node.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 165 /* SyntaxKind.Decorator */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 167 /* SyntaxKind.Decorator */: return true; default: return false; @@ -14003,12 +13911,12 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function isCallOrNewExpression(node) { - return node.kind === 208 /* SyntaxKind.CallExpression */ || node.kind === 209 /* SyntaxKind.NewExpression */; + return node.kind === 210 /* SyntaxKind.CallExpression */ || node.kind === 211 /* SyntaxKind.NewExpression */; } ts.isCallOrNewExpression = isCallOrNewExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 223 /* SyntaxKind.TemplateExpression */ + return kind === 225 /* SyntaxKind.TemplateExpression */ || kind === 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */; } ts.isTemplateLiteral = isTemplateLiteral; @@ -14019,19 +13927,19 @@ var ts; ts.isLeftHandSideExpression = isLeftHandSideExpression; function isLeftHandSideExpressionKind(kind) { switch (kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: // technically this is only an Expression if it's in a `#field in expr` BinaryExpression case 13 /* SyntaxKind.RegularExpressionLiteral */: @@ -14039,15 +13947,15 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 108 /* SyntaxKind.ThisKeyword */: case 110 /* SyntaxKind.TrueKeyword */: case 106 /* SyntaxKind.SuperKeyword */: - case 230 /* SyntaxKind.NonNullExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 231 /* SyntaxKind.MetaProperty */: + case 232 /* SyntaxKind.NonNullExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 233 /* SyntaxKind.MetaProperty */: case 100 /* SyntaxKind.ImportKeyword */: // technically this is only an Expression if it's in a CallExpression return true; default: @@ -14061,13 +13969,13 @@ var ts; ts.isUnaryExpression = isUnaryExpression; function isUnaryExpressionKind(kind) { switch (kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return true; default: return isLeftHandSideExpressionKind(kind); @@ -14076,9 +13984,9 @@ var ts; /* @internal */ function isUnaryExpressionWithWrite(expr) { switch (expr.kind) { - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return true; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 45 /* SyntaxKind.PlusPlusToken */ || expr.operator === 46 /* SyntaxKind.MinusMinusToken */; default: @@ -14097,15 +14005,16 @@ var ts; ts.isExpression = isExpression; function isExpressionKind(kind) { switch (kind) { - case 222 /* SyntaxKind.ConditionalExpression */: - case 224 /* SyntaxKind.YieldExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 221 /* SyntaxKind.BinaryExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 229 /* SyntaxKind.AsExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 351 /* SyntaxKind.CommaListExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 226 /* SyntaxKind.YieldExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 223 /* SyntaxKind.BinaryExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 231 /* SyntaxKind.AsExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 354 /* SyntaxKind.CommaListExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return true; default: return isUnaryExpressionKind(kind); @@ -14113,8 +14022,8 @@ var ts; } function isAssertionExpression(node) { var kind = node.kind; - return kind === 211 /* SyntaxKind.TypeAssertionExpression */ - || kind === 229 /* SyntaxKind.AsExpression */; + return kind === 213 /* SyntaxKind.TypeAssertionExpression */ + || kind === 231 /* SyntaxKind.AsExpression */; } ts.isAssertionExpression = isAssertionExpression; /* @internal */ @@ -14125,13 +14034,13 @@ var ts; ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return true; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -14160,7 +14069,7 @@ var ts; ts.isExternalModuleIndicator = isExternalModuleIndicator; /* @internal */ function isForInOrOfStatement(node) { - return node.kind === 243 /* SyntaxKind.ForInStatement */ || node.kind === 244 /* SyntaxKind.ForOfStatement */; + return node.kind === 246 /* SyntaxKind.ForInStatement */ || node.kind === 247 /* SyntaxKind.ForOfStatement */; } ts.isForInOrOfStatement = isForInOrOfStatement; // Element @@ -14184,115 +14093,115 @@ var ts; /* @internal */ function isModuleBody(node) { var kind = node.kind; - return kind === 262 /* SyntaxKind.ModuleBlock */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ + return kind === 265 /* SyntaxKind.ModuleBlock */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isModuleBody = isModuleBody; /* @internal */ function isNamespaceBody(node) { var kind = node.kind; - return kind === 262 /* SyntaxKind.ModuleBlock */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */; + return kind === 265 /* SyntaxKind.ModuleBlock */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isNamespaceBody = isNamespaceBody; /* @internal */ function isJSDocNamespaceBody(node) { var kind = node.kind; return kind === 79 /* SyntaxKind.Identifier */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */; + || kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isJSDocNamespaceBody = isJSDocNamespaceBody; /* @internal */ function isNamedImportBindings(node) { var kind = node.kind; - return kind === 269 /* SyntaxKind.NamedImports */ - || kind === 268 /* SyntaxKind.NamespaceImport */; + return kind === 272 /* SyntaxKind.NamedImports */ + || kind === 271 /* SyntaxKind.NamespaceImport */; } ts.isNamedImportBindings = isNamedImportBindings; /* @internal */ function isModuleOrEnumDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */ || node.kind === 260 /* SyntaxKind.EnumDeclaration */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */ || node.kind === 263 /* SyntaxKind.EnumDeclaration */; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 203 /* SyntaxKind.BindingElement */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 299 /* SyntaxKind.EnumMember */ - || kind === 275 /* SyntaxKind.ExportSpecifier */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 267 /* SyntaxKind.ImportClause */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 270 /* SyntaxKind.ImportSpecifier */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 285 /* SyntaxKind.JsxAttribute */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 268 /* SyntaxKind.NamespaceImport */ - || kind === 274 /* SyntaxKind.NamespaceExport */ - || kind === 164 /* SyntaxKind.Parameter */ - || kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 163 /* SyntaxKind.TypeParameter */ - || kind === 254 /* SyntaxKind.VariableDeclaration */ - || kind === 345 /* SyntaxKind.JSDocTypedefTag */ - || kind === 338 /* SyntaxKind.JSDocCallbackTag */ - || kind === 347 /* SyntaxKind.JSDocPropertyTag */; + return kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 205 /* SyntaxKind.BindingElement */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 302 /* SyntaxKind.EnumMember */ + || kind === 278 /* SyntaxKind.ExportSpecifier */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 270 /* SyntaxKind.ImportClause */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 273 /* SyntaxKind.ImportSpecifier */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 288 /* SyntaxKind.JsxAttribute */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 271 /* SyntaxKind.NamespaceImport */ + || kind === 277 /* SyntaxKind.NamespaceExport */ + || kind === 166 /* SyntaxKind.Parameter */ + || kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 165 /* SyntaxKind.TypeParameter */ + || kind === 257 /* SyntaxKind.VariableDeclaration */ + || kind === 348 /* SyntaxKind.JSDocTypedefTag */ + || kind === 341 /* SyntaxKind.JSDocCallbackTag */ + || kind === 350 /* SyntaxKind.JSDocPropertyTag */; } function isDeclarationStatementKind(kind) { - return kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 246 /* SyntaxKind.BreakStatement */ - || kind === 245 /* SyntaxKind.ContinueStatement */ - || kind === 253 /* SyntaxKind.DebuggerStatement */ - || kind === 240 /* SyntaxKind.DoStatement */ - || kind === 238 /* SyntaxKind.ExpressionStatement */ - || kind === 236 /* SyntaxKind.EmptyStatement */ - || kind === 243 /* SyntaxKind.ForInStatement */ - || kind === 244 /* SyntaxKind.ForOfStatement */ - || kind === 242 /* SyntaxKind.ForStatement */ - || kind === 239 /* SyntaxKind.IfStatement */ - || kind === 250 /* SyntaxKind.LabeledStatement */ - || kind === 247 /* SyntaxKind.ReturnStatement */ - || kind === 249 /* SyntaxKind.SwitchStatement */ - || kind === 251 /* SyntaxKind.ThrowStatement */ - || kind === 252 /* SyntaxKind.TryStatement */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 241 /* SyntaxKind.WhileStatement */ - || kind === 248 /* SyntaxKind.WithStatement */ - || kind === 349 /* SyntaxKind.NotEmittedStatement */ - || kind === 353 /* SyntaxKind.EndOfDeclarationMarker */ - || kind === 352 /* SyntaxKind.MergeDeclarationMarker */; + return kind === 249 /* SyntaxKind.BreakStatement */ + || kind === 248 /* SyntaxKind.ContinueStatement */ + || kind === 256 /* SyntaxKind.DebuggerStatement */ + || kind === 243 /* SyntaxKind.DoStatement */ + || kind === 241 /* SyntaxKind.ExpressionStatement */ + || kind === 239 /* SyntaxKind.EmptyStatement */ + || kind === 246 /* SyntaxKind.ForInStatement */ + || kind === 247 /* SyntaxKind.ForOfStatement */ + || kind === 245 /* SyntaxKind.ForStatement */ + || kind === 242 /* SyntaxKind.IfStatement */ + || kind === 253 /* SyntaxKind.LabeledStatement */ + || kind === 250 /* SyntaxKind.ReturnStatement */ + || kind === 252 /* SyntaxKind.SwitchStatement */ + || kind === 254 /* SyntaxKind.ThrowStatement */ + || kind === 255 /* SyntaxKind.TryStatement */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 244 /* SyntaxKind.WhileStatement */ + || kind === 251 /* SyntaxKind.WithStatement */ + || kind === 352 /* SyntaxKind.NotEmittedStatement */ + || kind === 356 /* SyntaxKind.EndOfDeclarationMarker */ + || kind === 355 /* SyntaxKind.MergeDeclarationMarker */; } /* @internal */ function isDeclaration(node) { - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { - return (node.parent && node.parent.kind !== 344 /* SyntaxKind.JSDocTemplateTag */) || ts.isInJSFile(node); + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { + return (node.parent && node.parent.kind !== 347 /* SyntaxKind.JSDocTemplateTag */) || ts.isInJSFile(node); } return isDeclarationKind(node.kind); } @@ -14319,10 +14228,10 @@ var ts; } ts.isStatement = isStatement; function isBlockStatement(node) { - if (node.kind !== 235 /* SyntaxKind.Block */) + if (node.kind !== 238 /* SyntaxKind.Block */) return false; if (node.parent !== undefined) { - if (node.parent.kind === 252 /* SyntaxKind.TryStatement */ || node.parent.kind === 292 /* SyntaxKind.CatchClause */) { + if (node.parent.kind === 255 /* SyntaxKind.TryStatement */ || node.parent.kind === 295 /* SyntaxKind.CatchClause */) { return false; } } @@ -14336,15 +14245,15 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 235 /* SyntaxKind.Block */; + || kind === 238 /* SyntaxKind.Block */; } ts.isStatementOrBlock = isStatementOrBlock; // Module references /* @internal */ function isModuleReference(node) { var kind = node.kind; - return kind === 277 /* SyntaxKind.ExternalModuleReference */ - || kind === 161 /* SyntaxKind.QualifiedName */ + return kind === 280 /* SyntaxKind.ExternalModuleReference */ + || kind === 163 /* SyntaxKind.QualifiedName */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isModuleReference = isModuleReference; @@ -14354,58 +14263,58 @@ var ts; var kind = node.kind; return kind === 108 /* SyntaxKind.ThisKeyword */ || kind === 79 /* SyntaxKind.Identifier */ - || kind === 206 /* SyntaxKind.PropertyAccessExpression */; + || kind === 208 /* SyntaxKind.PropertyAccessExpression */; } ts.isJsxTagNameExpression = isJsxTagNameExpression; /* @internal */ function isJsxChild(node) { var kind = node.kind; - return kind === 278 /* SyntaxKind.JsxElement */ - || kind === 288 /* SyntaxKind.JsxExpression */ - || kind === 279 /* SyntaxKind.JsxSelfClosingElement */ + return kind === 281 /* SyntaxKind.JsxElement */ + || kind === 291 /* SyntaxKind.JsxExpression */ + || kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || kind === 11 /* SyntaxKind.JsxText */ - || kind === 282 /* SyntaxKind.JsxFragment */; + || kind === 285 /* SyntaxKind.JsxFragment */; } ts.isJsxChild = isJsxChild; /* @internal */ function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 285 /* SyntaxKind.JsxAttribute */ - || kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return kind === 288 /* SyntaxKind.JsxAttribute */ + || kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } ts.isJsxAttributeLike = isJsxAttributeLike; /* @internal */ function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 10 /* SyntaxKind.StringLiteral */ - || kind === 288 /* SyntaxKind.JsxExpression */; + || kind === 291 /* SyntaxKind.JsxExpression */; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isJsxOpeningLikeElement(node) { var kind = node.kind; - return kind === 280 /* SyntaxKind.JsxOpeningElement */ - || kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return kind === 283 /* SyntaxKind.JsxOpeningElement */ + || kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; // Clauses function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 289 /* SyntaxKind.CaseClause */ - || kind === 290 /* SyntaxKind.DefaultClause */; + return kind === 292 /* SyntaxKind.CaseClause */ + || kind === 293 /* SyntaxKind.DefaultClause */; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; // JSDoc /** True if node is of some JSDoc syntax kind. */ /* @internal */ function isJSDocNode(node) { - return node.kind >= 309 /* SyntaxKind.FirstJSDocNode */ && node.kind <= 347 /* SyntaxKind.LastJSDocNode */; + return node.kind >= 312 /* SyntaxKind.FirstJSDocNode */ && node.kind <= 350 /* SyntaxKind.LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; /** True if node is of a kind that may contain comment text. */ function isJSDocCommentContainingNode(node) { - return node.kind === 320 /* SyntaxKind.JSDoc */ - || node.kind === 319 /* SyntaxKind.JSDocNamepathType */ - || node.kind === 321 /* SyntaxKind.JSDocText */ + return node.kind === 323 /* SyntaxKind.JSDoc */ + || node.kind === 322 /* SyntaxKind.JSDocNamepathType */ + || node.kind === 324 /* SyntaxKind.JSDocText */ || isJSDocLinkLike(node) || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) @@ -14415,15 +14324,15 @@ var ts; // TODO: determine what this does before making it public. /* @internal */ function isJSDocTag(node) { - return node.kind >= 327 /* SyntaxKind.FirstJSDocTagNode */ && node.kind <= 347 /* SyntaxKind.LastJSDocTagNode */; + return node.kind >= 330 /* SyntaxKind.FirstJSDocTagNode */ && node.kind <= 350 /* SyntaxKind.LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function isSetAccessor(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */; } ts.isSetAccessor = isSetAccessor; function isGetAccessor(node) { - return node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetAccessor = isGetAccessor; /** True if has jsdoc nodes attached to it. */ @@ -14449,12 +14358,12 @@ var ts; /** True if has initializer node attached to it. */ function hasOnlyExpressionInitializer(node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 299 /* SyntaxKind.EnumMember */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 302 /* SyntaxKind.EnumMember */: return true; default: return false; @@ -14462,12 +14371,12 @@ var ts; } ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer; function isObjectLiteralElement(node) { - return node.kind === 285 /* SyntaxKind.JsxAttribute */ || node.kind === 287 /* SyntaxKind.JsxSpreadAttribute */ || isObjectLiteralElementLike(node); + return node.kind === 288 /* SyntaxKind.JsxAttribute */ || node.kind === 290 /* SyntaxKind.JsxSpreadAttribute */ || isObjectLiteralElementLike(node); } ts.isObjectLiteralElement = isObjectLiteralElement; /* @internal */ function isTypeReferenceType(node) { - return node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } ts.isTypeReferenceType = isTypeReferenceType; var MAX_SMI_X86 = 1073741823; @@ -14500,7 +14409,7 @@ var ts; } ts.isStringLiteralLike = isStringLiteralLike; function isJSDocLinkLike(node) { - return node.kind === 324 /* SyntaxKind.JSDocLink */ || node.kind === 325 /* SyntaxKind.JSDocLinkCode */ || node.kind === 326 /* SyntaxKind.JSDocLinkPlain */; + return node.kind === 327 /* SyntaxKind.JSDocLink */ || node.kind === 328 /* SyntaxKind.JSDocLinkCode */ || node.kind === 329 /* SyntaxKind.JSDocLinkPlain */; } ts.isJSDocLinkLike = isJSDocLinkLike; function hasRestParameter(s) { @@ -14510,7 +14419,7 @@ var ts; ts.hasRestParameter = hasRestParameter; function isRestParameter(node) { var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type; - return node.dotDotDotToken !== undefined || !!type && type.kind === 318 /* SyntaxKind.JSDocVariadicType */; + return node.dotDotDotToken !== undefined || !!type && type.kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isRestParameter = isRestParameter; // #endregion @@ -14768,7 +14677,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 305 /* SyntaxKind.SourceFile */) { + while (node && node.kind !== 308 /* SyntaxKind.SourceFile */) { node = node.parent; } return node; @@ -14784,11 +14693,11 @@ var ts; ts.isPlainJsFile = isPlainJsFile; function isStatementWithLocals(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return true; } return false; @@ -14984,7 +14893,7 @@ var ts; // the syntax list itself considers them as normal trivia. Therefore if we simply skip // trivia for the list, we may have skipped the JSDocComment as well. So we should process its // first child to determine the actual position of its first token. - if (node.kind === 348 /* SyntaxKind.SyntaxList */ && node._children.length > 0) { + if (node.kind === 351 /* SyntaxKind.SyntaxList */ && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, @@ -15049,7 +14958,6 @@ var ts; return emitNode && emitNode.flags || 0; } ts.getEmitFlags = getEmitFlags; - ; function getScriptTargetFeatures() { return { es2015: { @@ -15222,7 +15130,7 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { @@ -15254,11 +15162,11 @@ var ts; ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { // The only kind of module that can be missing a body is a shorthand ambient module. - return !!node && node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && (!node.body); + return !!node && node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ || - node.kind === 261 /* SyntaxKind.ModuleDeclaration */ || + return node.kind === 308 /* SyntaxKind.SourceFile */ || + node.kind === 264 /* SyntaxKind.ModuleDeclaration */ || ts.isFunctionLikeOrClassStaticBlockDeclaration(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -15275,9 +15183,9 @@ var ts; // - defined in the top level scope and source file is an external module // - defined inside ambient module declaration located in the top level scope and source file not an external module switch (node.parent.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return ts.isExternalModule(node.parent); - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -15332,26 +15240,30 @@ var ts; return false; } ts.isEffectiveStrictModeSourceFile = isEffectiveStrictModeSourceFile; + function isAmbientPropertyDeclaration(node) { + return !!(node.flags & 16777216 /* NodeFlags.Ambient */) || hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */); + } + ts.isAmbientPropertyDeclaration = isAmbientPropertyDeclaration; function isBlockScope(node, parentNode) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 263 /* SyntaxKind.CaseBlock */: - case 292 /* SyntaxKind.CatchClause */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 266 /* SyntaxKind.CaseBlock */: + case 295 /* SyntaxKind.CatchClause */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block return !ts.isFunctionLikeOrClassStaticBlockDeclaration(parentNode); @@ -15361,9 +15273,9 @@ var ts; ts.isBlockScope = isBlockScope; function isDeclarationWithTypeParameters(node) { switch (node.kind) { - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 323 /* SyntaxKind.JSDocSignature */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 326 /* SyntaxKind.JSDocSignature */: return true; default: ts.assertType(node); @@ -15373,25 +15285,25 @@ var ts; ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters; function isDeclarationWithTypeParameterChildren(node) { switch (node.kind) { - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: ts.assertType(node); @@ -15401,8 +15313,8 @@ var ts; ts.isDeclarationWithTypeParameterChildren = isDeclarationWithTypeParameterChildren; function isAnyImportSyntax(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return true; default: return false; @@ -15415,15 +15327,15 @@ var ts; ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire; function isLateVisibilityPaintedStatement(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return true; default: return false; @@ -15464,19 +15376,19 @@ var ts; } ts.getNameFromIndexInfo = getNameFromIndexInfo; function isComputedNonLiteralName(name) { - return name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression); + return name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression); } ts.isComputedNonLiteralName = isComputedNonLiteralName; function tryGetTextOfPropertyName(name) { switch (name.kind) { case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: - return name.escapedText; + return name.autoGenerateFlags ? undefined : name.escapedText; case 10 /* SyntaxKind.StringLiteral */: case 8 /* SyntaxKind.NumericLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return ts.escapeLeadingUnderscores(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: if (isStringOrNumericLiteralLike(name.expression)) return ts.escapeLeadingUnderscores(name.expression.text); return undefined; @@ -15496,16 +15408,16 @@ var ts; case 80 /* SyntaxKind.PrivateIdentifier */: case 79 /* SyntaxKind.Identifier */: return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (ts.isIdentifier(name.name) || ts.isPrivateIdentifier(name.name)) { return entityNameToString(name.expression) + "." + entityNameToString(name.name); } else { return ts.Debug.assertNever(name.name); } - case 311 /* SyntaxKind.JSDocMemberName */: + case 314 /* SyntaxKind.JSDocMemberName */: return entityNameToString(name.left) + entityNameToString(name.right); default: return ts.Debug.assertNever(name); @@ -15595,7 +15507,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 235 /* SyntaxKind.Block */) { + if (node.body && node.body.kind === 238 /* SyntaxKind.Block */) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -15609,7 +15521,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file @@ -15618,29 +15530,29 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 268 /* SyntaxKind.NamespaceImport */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 271 /* SyntaxKind.NamespaceImport */: errorNode = node.name; break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return getErrorSpanForArrowFunction(sourceFile, node); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: var start = ts.skipTrivia(sourceFile.text, node.pos); var end = node.statements.length > 0 ? node.statements[0].pos : node.end; return ts.createTextSpanFromBounds(start, end); @@ -15692,11 +15604,11 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 208 /* SyntaxKind.CallExpression */ && n.expression.kind === 106 /* SyntaxKind.SuperKeyword */; + return n.kind === 210 /* SyntaxKind.CallExpression */ && n.expression.kind === 106 /* SyntaxKind.SuperKeyword */; } ts.isSuperCall = isSuperCall; function isImportCall(n) { - return n.kind === 208 /* SyntaxKind.CallExpression */ && n.expression.kind === 100 /* SyntaxKind.ImportKeyword */; + return n.kind === 210 /* SyntaxKind.CallExpression */ && n.expression.kind === 100 /* SyntaxKind.ImportKeyword */; } ts.isImportCall = isImportCall; function isImportMeta(n) { @@ -15710,7 +15622,7 @@ var ts; } ts.isLiteralImportTypeNode = isLiteralImportTypeNode; function isPrologueDirective(node) { - return node.kind === 238 /* SyntaxKind.ExpressionStatement */ + return node.kind === 241 /* SyntaxKind.ExpressionStatement */ && node.expression.kind === 10 /* SyntaxKind.StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; @@ -15738,13 +15650,13 @@ var ts; } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; function getJSDocCommentRanges(node, text) { - var commentRanges = (node.kind === 164 /* SyntaxKind.Parameter */ || - node.kind === 163 /* SyntaxKind.TypeParameter */ || - node.kind === 213 /* SyntaxKind.FunctionExpression */ || - node.kind === 214 /* SyntaxKind.ArrowFunction */ || - node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ || - node.kind === 254 /* SyntaxKind.VariableDeclaration */ || - node.kind === 275 /* SyntaxKind.ExportSpecifier */) ? + var commentRanges = (node.kind === 166 /* SyntaxKind.Parameter */ || + node.kind === 165 /* SyntaxKind.TypeParameter */ || + node.kind === 215 /* SyntaxKind.FunctionExpression */ || + node.kind === 216 /* SyntaxKind.ArrowFunction */ || + node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || + node.kind === 257 /* SyntaxKind.VariableDeclaration */ || + node.kind === 278 /* SyntaxKind.ExportSpecifier */) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : ts.getLeadingCommentRanges(text, node.pos); // True if the comment starts with '/**' but not if it is '/**/' @@ -15760,48 +15672,48 @@ var ts; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; var defaultLibReferenceRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (177 /* SyntaxKind.FirstTypeNode */ <= node.kind && node.kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (179 /* SyntaxKind.FirstTypeNode */ <= node.kind && node.kind <= 202 /* SyntaxKind.LastTypeNode */) { return true; } switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return true; case 114 /* SyntaxKind.VoidKeyword */: - return node.parent.kind !== 217 /* SyntaxKind.VoidExpression */; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + return node.parent.kind !== 219 /* SyntaxKind.VoidExpression */; + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node); - case 163 /* SyntaxKind.TypeParameter */: - return node.parent.kind === 195 /* SyntaxKind.MappedType */ || node.parent.kind === 190 /* SyntaxKind.InferType */; + case 165 /* SyntaxKind.TypeParameter */: + return node.parent.kind === 197 /* SyntaxKind.MappedType */ || node.parent.kind === 192 /* SyntaxKind.InferType */; // Identifiers and qualified names may be type nodes, depending on their context. Climb // above them to find the lowest container case 79 /* SyntaxKind.Identifier */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 161 /* SyntaxKind.QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 163 /* SyntaxKind.QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } // At this point, node is either a qualified name or an identifier - ts.Debug.assert(node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 161 /* SyntaxKind.QualifiedName */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + ts.Debug.assert(node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 163 /* SyntaxKind.QualifiedName */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); // falls through - case 161 /* SyntaxKind.QualifiedName */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: case 108 /* SyntaxKind.ThisKeyword */: { var parent = node.parent; - if (parent.kind === 181 /* SyntaxKind.TypeQuery */) { + if (parent.kind === 183 /* SyntaxKind.TypeQuery */) { return false; } - if (parent.kind === 200 /* SyntaxKind.ImportType */) { + if (parent.kind === 202 /* SyntaxKind.ImportType */) { return !parent.isTypeOf; } // Do not recursively call isPartOfTypeNode on the parent. In the example: @@ -15810,40 +15722,40 @@ var ts; // // Calling isPartOfTypeNode would consider the qualified name A.B a type node. // Only C and A.B.C are type nodes. - if (177 /* SyntaxKind.FirstTypeNode */ <= parent.kind && parent.kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (179 /* SyntaxKind.FirstTypeNode */ <= parent.kind && parent.kind <= 202 /* SyntaxKind.LastTypeNode */) { return true; } switch (parent.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isHeritageClause(parent.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(parent); - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return node === parent.constraint; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return node === parent.constraint; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 164 /* SyntaxKind.Parameter */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: return node === parent.type; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return node === parent.type; - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return node === parent.type; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return node === parent.type; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return ts.contains(parent.typeArguments, node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -15868,23 +15780,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitor(node); - case 263 /* SyntaxKind.CaseBlock */: - case 235 /* SyntaxKind.Block */: - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 250 /* SyntaxKind.LabeledStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 266 /* SyntaxKind.CaseBlock */: + case 238 /* SyntaxKind.Block */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 253 /* SyntaxKind.LabeledStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 295 /* SyntaxKind.CatchClause */: return ts.forEachChild(node, traverse); } } @@ -15894,23 +15806,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } return; - case 260 /* SyntaxKind.EnumDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // These are not allowed inside a generator now, but eventually they may be allowed // as local types. Regardless, skip them to avoid the work. return; default: if (ts.isFunctionLike(node)) { - if (node.name && node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name && node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // Note that we will not include methods/accessors of a class because they would require // first descending into the class. This is by design. traverse(node.name.expression); @@ -15933,10 +15845,10 @@ var ts; * @param node The type node. */ function getRestParameterElementType(node) { - if (node && node.kind === 183 /* SyntaxKind.ArrayType */) { + if (node && node.kind === 185 /* SyntaxKind.ArrayType */) { return node.elementType; } - else if (node && node.kind === 178 /* SyntaxKind.TypeReference */) { + else if (node && node.kind === 180 /* SyntaxKind.TypeReference */) { return ts.singleOrUndefined(node.typeArguments); } else { @@ -15946,12 +15858,12 @@ var ts; ts.getRestParameterElementType = getRestParameterElementType; function getMembersOfDeclaration(node) { switch (node.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 182 /* SyntaxKind.TypeLiteral */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 184 /* SyntaxKind.TypeLiteral */: return node.members; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return node.properties; } } @@ -15959,14 +15871,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 299 /* SyntaxKind.EnumMember */: - case 164 /* SyntaxKind.Parameter */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 302 /* SyntaxKind.EnumMember */: + case 166 /* SyntaxKind.Parameter */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; } } @@ -15978,8 +15890,8 @@ var ts; } ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor; function isVariableDeclarationInVariableStatement(node) { - return node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */ - && node.parent.parent.kind === 237 /* SyntaxKind.VariableStatement */; + return node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */ + && node.parent.parent.kind === 240 /* SyntaxKind.VariableStatement */; } ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement; function isCommonJsExportedExpression(node) { @@ -16003,13 +15915,13 @@ var ts; ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return true; } return false; @@ -16020,7 +15932,7 @@ var ts; if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 250 /* SyntaxKind.LabeledStatement */) { + if (node.statement.kind !== 253 /* SyntaxKind.LabeledStatement */) { return node.statement; } node = node.statement; @@ -16028,17 +15940,17 @@ var ts; } ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel; function isFunctionBlock(node) { - return node && node.kind === 235 /* SyntaxKind.Block */ && ts.isFunctionLike(node.parent); + return node && node.kind === 238 /* SyntaxKind.Block */ && ts.isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 169 /* SyntaxKind.MethodDeclaration */ && node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return node && node.kind === 171 /* SyntaxKind.MethodDeclaration */ && node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethodOrAccessor(node) { - return (node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */) && - (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || - node.parent.kind === 226 /* SyntaxKind.ClassExpression */); + return (node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */) && + (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || + node.parent.kind === 228 /* SyntaxKind.ClassExpression */); } ts.isObjectLiteralOrClassExpressionMethodOrAccessor = isObjectLiteralOrClassExpressionMethodOrAccessor; function isIdentifierTypePredicate(predicate) { @@ -16051,7 +15963,7 @@ var ts; ts.isThisTypePredicate = isThisTypePredicate; function getPropertyAssignment(objectLiteral, key, key2) { return objectLiteral.properties.filter(function (property) { - if (property.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (property.kind === 299 /* SyntaxKind.PropertyAssignment */) { var propName = tryGetTextOfPropertyName(property.name); return key === propName || (!!key2 && key2 === propName); } @@ -16113,14 +16025,14 @@ var ts; } ts.getContainingFunctionOrClassStaticBlock = getContainingFunctionOrClassStaticBlock; function getThisContainer(node, includeArrowFunctions) { - ts.Debug.assert(node.kind !== 305 /* SyntaxKind.SourceFile */); + ts.Debug.assert(node.kind !== 308 /* SyntaxKind.SourceFile */); while (true) { node = node.parent; if (!node) { return ts.Debug.fail(); // If we never pass in a SourceFile, this should be unreachable, since we'll stop when we reach that. } switch (node.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'this' container. // A computed property name in a class needs to be a this container @@ -16135,9 +16047,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 164 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { + if (node.parent.kind === 166 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -16148,27 +16060,27 @@ var ts; node = node.parent; } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: if (!includeArrowFunctions) { continue; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 305 /* SyntaxKind.SourceFile */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 308 /* SyntaxKind.SourceFile */: return node; } } @@ -16181,17 +16093,17 @@ var ts; switch (node.kind) { // Arrow functions use the same scope, but may do so in a "delayed" manner // For example, `const getThis = () => this` may be before a super() call in a derived constructor - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: switch (node.parent.kind) { - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Object properties can have computed names; only method-like bodies start a new scope return true; default: @@ -16215,9 +16127,9 @@ var ts; var container = getThisContainer(node, /*includeArrowFunctions*/ false); if (container) { switch (container.kind) { - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return container; } } @@ -16239,28 +16151,28 @@ var ts; return node; } switch (node.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: node = node.parent; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (!stopOnFunctions) { continue; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return node; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 164 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { + if (node.parent.kind === 166 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -16276,14 +16188,14 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 213 /* SyntaxKind.FunctionExpression */ || func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 215 /* SyntaxKind.FunctionExpression */ || func.kind === 216 /* SyntaxKind.ArrowFunction */) { var prev = func; var parent = func.parent; - while (parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { prev = parent; parent = parent.parent; } - if (parent.kind === 208 /* SyntaxKind.CallExpression */ && parent.expression === prev) { + if (parent.kind === 210 /* SyntaxKind.CallExpression */ && parent.expression === prev) { return parent; } } @@ -16299,7 +16211,7 @@ var ts; */ function isSuperProperty(node) { var kind = node.kind; - return (kind === 206 /* SyntaxKind.PropertyAccessExpression */ || kind === 207 /* SyntaxKind.ElementAccessExpression */) + return (kind === 208 /* SyntaxKind.PropertyAccessExpression */ || kind === 209 /* SyntaxKind.ElementAccessExpression */) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */; } ts.isSuperProperty = isSuperProperty; @@ -16308,7 +16220,7 @@ var ts; */ function isThisProperty(node) { var kind = node.kind; - return (kind === 206 /* SyntaxKind.PropertyAccessExpression */ || kind === 207 /* SyntaxKind.ElementAccessExpression */) + return (kind === 208 /* SyntaxKind.PropertyAccessExpression */ || kind === 209 /* SyntaxKind.ElementAccessExpression */) && node.expression.kind === 108 /* SyntaxKind.ThisKeyword */; } ts.isThisProperty = isThisProperty; @@ -16327,15 +16239,15 @@ var ts; ts.isThisInitializedObjectBindingExpression = isThisInitializedObjectBindingExpression; function getEntityNameFromTypeNode(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return isEntityNameExpression(node.expression) ? node.expression : undefined; // TODO(rbuckton): These aren't valid TypeNodes, but we treat them as such because of `isPartOfTypeNode`, which returns `true` for things that aren't `TypeNode`s. case 79 /* SyntaxKind.Identifier */: - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return node; } return undefined; @@ -16343,10 +16255,10 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { switch (node.kind) { - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return node.tag; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return node.tagName; default: return node.expression; @@ -16359,25 +16271,25 @@ var ts; return false; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // classes are valid targets return true; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return parent.kind === 257 /* SyntaxKind.ClassDeclaration */; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + return parent.kind === 260 /* SyntaxKind.ClassDeclaration */; + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. return node.body !== undefined - && parent.kind === 257 /* SyntaxKind.ClassDeclaration */; - case 164 /* SyntaxKind.Parameter */: + && parent.kind === 260 /* SyntaxKind.ClassDeclaration */; + case 166 /* SyntaxKind.Parameter */: // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; return parent.body !== undefined - && (parent.kind === 171 /* SyntaxKind.Constructor */ - || parent.kind === 169 /* SyntaxKind.MethodDeclaration */ - || parent.kind === 173 /* SyntaxKind.SetAccessor */) - && grandparent.kind === 257 /* SyntaxKind.ClassDeclaration */; + && (parent.kind === 173 /* SyntaxKind.Constructor */ + || parent.kind === 171 /* SyntaxKind.MethodDeclaration */ + || parent.kind === 175 /* SyntaxKind.SetAccessor */) + && grandparent.kind === 260 /* SyntaxKind.ClassDeclaration */; } return false; } @@ -16393,11 +16305,11 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node, parent) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return ts.some(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); }); // TODO: GH#18217 - case 169 /* SyntaxKind.MethodDeclaration */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: return ts.some(node.parameters, function (p) { return nodeIsDecorated(p, node, parent); }); // TODO: GH#18217 default: return false; @@ -16413,9 +16325,9 @@ var ts; ts.classOrConstructorParameterIsDecorated = classOrConstructorParameterIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 280 /* SyntaxKind.JsxOpeningElement */ || - parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */ || - parent.kind === 281 /* SyntaxKind.JsxClosingElement */) { + if (parent.kind === 283 /* SyntaxKind.JsxOpeningElement */ || + parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || + parent.kind === 284 /* SyntaxKind.JsxClosingElement */) { return parent.tagName === node; } return false; @@ -16428,53 +16340,54 @@ var ts; case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 229 /* SyntaxKind.AsExpression */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 221 /* SyntaxKind.BinaryExpression */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 223 /* SyntaxKind.TemplateExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: - case 224 /* SyntaxKind.YieldExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 231 /* SyntaxKind.MetaProperty */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 225 /* SyntaxKind.TemplateExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: + case 226 /* SyntaxKind.YieldExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 233 /* SyntaxKind.MetaProperty */: return true; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return !ts.isHeritageClause(node.parent); - case 161 /* SyntaxKind.QualifiedName */: - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + case 163 /* SyntaxKind.QualifiedName */: + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); - case 311 /* SyntaxKind.JSDocMemberName */: + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); + case 314 /* SyntaxKind.JSDocMemberName */: while (ts.isJSDocMemberName(node.parent)) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); case 80 /* SyntaxKind.PrivateIdentifier */: return ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 101 /* SyntaxKind.InKeyword */; case 79 /* SyntaxKind.Identifier */: - if (node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) { + if (node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) { return true; } // falls through @@ -16492,60 +16405,62 @@ var ts; function isInExpressionContext(node) { var parent = node.parent; switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 299 /* SyntaxKind.EnumMember */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 205 /* SyntaxKind.BindingElement */: return parent.initializer === node; - case 238 /* SyntaxKind.ExpressionStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 247 /* SyntaxKind.ReturnStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 289 /* SyntaxKind.CaseClause */: - case 251 /* SyntaxKind.ThrowStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 292 /* SyntaxKind.CaseClause */: + case 254 /* SyntaxKind.ThrowStatement */: return parent.expression === node; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) || forInStatement.expression === node; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return node === parent.expression; - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return node === parent.expression; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return node === parent.expression; - case 165 /* SyntaxKind.Decorator */: - case 288 /* SyntaxKind.JsxExpression */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 167 /* SyntaxKind.Decorator */: + case 291 /* SyntaxKind.JsxExpression */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + case 301 /* SyntaxKind.SpreadAssignment */: return true; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return parent.expression === node && !isPartOfTypeNode(parent); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return parent.objectAssignmentInitializer === node; + case 235 /* SyntaxKind.SatisfiesExpression */: + return node === parent.expression; default: return isExpressionNode(parent); } } ts.isInExpressionContext = isInExpressionContext; function isPartOfTypeQuery(node) { - while (node.kind === 161 /* SyntaxKind.QualifiedName */ || node.kind === 79 /* SyntaxKind.Identifier */) { + while (node.kind === 163 /* SyntaxKind.QualifiedName */ || node.kind === 79 /* SyntaxKind.Identifier */) { node = node.parent; } - return node.kind === 181 /* SyntaxKind.TypeQuery */; + return node.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isPartOfTypeQuery = isPartOfTypeQuery; function isNamespaceReexportDeclaration(node) { @@ -16553,7 +16468,7 @@ var ts; } ts.isNamespaceReexportDeclaration = isNamespaceReexportDeclaration; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -16566,7 +16481,7 @@ var ts; } ts.getExternalModuleRequireArgument = getExternalModuleRequireArgument; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind !== 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJS(file) { @@ -16598,11 +16513,11 @@ var ts; ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && node.typeArguments && node.typeArguments.length === 2 && - (node.typeArguments[0].kind === 150 /* SyntaxKind.StringKeyword */ || node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */); + (node.typeArguments[0].kind === 152 /* SyntaxKind.StringKeyword */ || node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */); } ts.isJSDocIndexSignature = isJSDocIndexSignature; function isRequireCall(callExpression, requireStringLiteralLikeArgument) { - if (callExpression.kind !== 208 /* SyntaxKind.CallExpression */) { + if (callExpression.kind !== 210 /* SyntaxKind.CallExpression */) { return false; } var _a = callExpression, expression = _a.expression, args = _a.arguments; @@ -16711,11 +16626,11 @@ var ts; function getExpandoInitializer(initializer, isPrototypeAssignment) { if (ts.isCallExpression(initializer)) { var e = skipParentheses(initializer.expression); - return e.kind === 213 /* SyntaxKind.FunctionExpression */ || e.kind === 214 /* SyntaxKind.ArrowFunction */ ? initializer : undefined; + return e.kind === 215 /* SyntaxKind.FunctionExpression */ || e.kind === 216 /* SyntaxKind.ArrowFunction */ ? initializer : undefined; } - if (initializer.kind === 213 /* SyntaxKind.FunctionExpression */ || - initializer.kind === 226 /* SyntaxKind.ClassExpression */ || - initializer.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (initializer.kind === 215 /* SyntaxKind.FunctionExpression */ || + initializer.kind === 228 /* SyntaxKind.ClassExpression */ || + initializer.kind === 216 /* SyntaxKind.ArrowFunction */) { return initializer; } if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) { @@ -16961,7 +16876,7 @@ var ts; ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment; function isSpecialPropertyDeclaration(expr) { return isInJSFile(expr) && - expr.parent && expr.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && + expr.parent && expr.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && (!ts.isElementAccessExpression(expr) || isLiteralLikeElementAccess(expr)) && !!ts.getJSDocTypeTag(expr.parent); } @@ -16982,17 +16897,17 @@ var ts; return false; } var decl = symbol.valueDeclaration; - return decl.kind === 256 /* SyntaxKind.FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); + return decl.kind === 259 /* SyntaxKind.FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); } ts.isFunctionSymbol = isFunctionSymbol; function tryGetModuleSpecifierFromDeclaration(node) { var _a, _b; switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return (_a = ts.findAncestor(node.initializer, function (node) { return isRequireCall(node, /*requireStringLiteralLikeArgument*/ true); })) === null || _a === void 0 ? void 0 : _a.arguments[0]; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike); default: ts.Debug.assertNever(node); @@ -17005,14 +16920,14 @@ var ts; ts.importFromModuleSpecifier = importFromModuleSpecifier; function tryGetImportFromModuleSpecifier(node) { switch (node.parent.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.parent; - case 277 /* SyntaxKind.ExternalModuleReference */: + case 280 /* SyntaxKind.ExternalModuleReference */: return node.parent.parent; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return isImportCall(node.parent) || isRequireCall(node.parent, /*checkArg*/ false) ? node.parent : undefined; - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: ts.Debug.assert(ts.isStringLiteral(node)); return ts.tryCast(node.parent.parent, ts.isImportTypeNode); default: @@ -17022,16 +16937,16 @@ var ts; ts.tryGetImportFromModuleSpecifier = tryGetImportFromModuleSpecifier; function getExternalModuleName(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.moduleSpecifier; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */ ? node.moduleReference.expression : undefined; - case 200 /* SyntaxKind.ImportType */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + return node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */ ? node.moduleReference.expression : undefined; + case 202 /* SyntaxKind.ImportType */: return isLiteralImportTypeNode(node) ? node.argument.literal : undefined; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return node.arguments[0]; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return node.name.kind === 10 /* SyntaxKind.StringLiteral */ ? node.name : undefined; default: return ts.Debug.assertNever(node); @@ -17040,11 +16955,11 @@ var ts; ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.exportClause && ts.tryCast(node.exportClause, ts.isNamespaceExport); default: return ts.Debug.assertNever(node); @@ -17052,7 +16967,7 @@ var ts; } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 266 /* SyntaxKind.ImportDeclaration */ && !!node.importClause && !!node.importClause.name; + return node.kind === 269 /* SyntaxKind.ImportDeclaration */ && !!node.importClause && !!node.importClause.name; } ts.isDefaultImport = isDefaultImport; function forEachImportClauseDeclaration(node, action) { @@ -17073,13 +16988,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 164 /* SyntaxKind.Parameter */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return node.questionToken !== undefined; } } @@ -17093,7 +17008,7 @@ var ts; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function isJSDocTypeAlias(node) { - return node.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || node.kind === 338 /* SyntaxKind.JSDocCallbackTag */ || node.kind === 339 /* SyntaxKind.JSDocEnumTag */; + return node.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || node.kind === 341 /* SyntaxKind.JSDocCallbackTag */ || node.kind === 342 /* SyntaxKind.JSDocEnumTag */; } ts.isJSDocTypeAlias = isJSDocTypeAlias; function isTypeAlias(node) { @@ -17118,12 +17033,12 @@ var ts; } function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: var v = getSingleVariableOfVariableStatement(node); return v && v.initializer; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return node.initializer; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return node.initializer; } } @@ -17135,7 +17050,7 @@ var ts; function getNestedModuleDeclaration(node) { return ts.isModuleDeclaration(node) && node.body && - node.body.kind === 261 /* SyntaxKind.ModuleDeclaration */ + node.body.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? node.body : undefined; } @@ -17150,11 +17065,11 @@ var ts; if (ts.hasJSDocNodes(node)) { result = ts.addRange(result, filterOwnedJSDocTags(hostNode, ts.last(node.jsDoc))); } - if (node.kind === 164 /* SyntaxKind.Parameter */) { + if (node.kind === 166 /* SyntaxKind.Parameter */) { result = ts.addRange(result, (noCache ? ts.getJSDocParameterTagsNoCache : ts.getJSDocParameterTags)(node)); break; } - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { result = ts.addRange(result, (noCache ? ts.getJSDocTypeParameterTagsNoCache : ts.getJSDocTypeParameterTags)(node)); break; } @@ -17183,11 +17098,11 @@ var ts; } function getNextJSDocCommentLocation(node) { var parent = node.parent; - if (parent.kind === 296 /* SyntaxKind.PropertyAssignment */ || - parent.kind === 271 /* SyntaxKind.ExportAssignment */ || - parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - parent.kind === 247 /* SyntaxKind.ReturnStatement */ || + if (parent.kind === 299 /* SyntaxKind.PropertyAssignment */ || + parent.kind === 274 /* SyntaxKind.ExportAssignment */ || + parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + parent.kind === 250 /* SyntaxKind.ReturnStatement */ || getNestedModuleDeclaration(parent) || ts.isBinaryExpression(node) && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { return parent; @@ -17297,34 +17212,34 @@ var ts; var parent = node.parent; while (true) { switch (parent.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 63 /* SyntaxKind.EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* AssignmentKind.Definite */ : 2 /* AssignmentKind.Compound */ : 0 /* AssignmentKind.None */; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: var unaryOperator = parent.operator; return unaryOperator === 45 /* SyntaxKind.PlusPlusToken */ || unaryOperator === 46 /* SyntaxKind.MinusMinusToken */ ? 2 /* AssignmentKind.Compound */ : 0 /* AssignmentKind.None */; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return parent.initializer === node ? 1 /* AssignmentKind.Definite */ : 0 /* AssignmentKind.None */; - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 232 /* SyntaxKind.NonNullExpression */: node = parent; break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: node = parent.parent; break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: if (parent.name !== node) { return 0 /* AssignmentKind.None */; } node = parent.parent; break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (parent.name === node) { return 0 /* AssignmentKind.None */; } @@ -17351,22 +17266,22 @@ var ts; */ function isNodeWithPossibleHoistedDeclaration(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 237 /* SyntaxKind.VariableStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 263 /* SyntaxKind.CaseBlock */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 250 /* SyntaxKind.LabeledStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 238 /* SyntaxKind.Block */: + case 240 /* SyntaxKind.VariableStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 266 /* SyntaxKind.CaseBlock */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 253 /* SyntaxKind.LabeledStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 295 /* SyntaxKind.CatchClause */: return true; } return false; @@ -17383,11 +17298,11 @@ var ts; return node; } function walkUpParenthesizedTypes(node) { - return walkUp(node, 191 /* SyntaxKind.ParenthesizedType */); + return walkUp(node, 193 /* SyntaxKind.ParenthesizedType */); } ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes; function walkUpParenthesizedExpressions(node) { - return walkUp(node, 212 /* SyntaxKind.ParenthesizedExpression */); + return walkUp(node, 214 /* SyntaxKind.ParenthesizedExpression */); } ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions; /** @@ -17397,7 +17312,7 @@ var ts; */ function walkUpParenthesizedTypesAndGetParentAndChild(node) { var child; - while (node && node.kind === 191 /* SyntaxKind.ParenthesizedType */) { + while (node && node.kind === 193 /* SyntaxKind.ParenthesizedType */) { child = node; node = node.parent; } @@ -17419,11 +17334,11 @@ var ts; ts.skipParentheses = skipParentheses; // a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped function isDeleteTarget(node) { - if (node.kind !== 206 /* SyntaxKind.PropertyAccessExpression */ && node.kind !== 207 /* SyntaxKind.ElementAccessExpression */) { + if (node.kind !== 208 /* SyntaxKind.PropertyAccessExpression */ && node.kind !== 209 /* SyntaxKind.ElementAccessExpression */) { return false; } node = walkUpParenthesizedExpressions(node.parent); - return node && node.kind === 215 /* SyntaxKind.DeleteExpression */; + return node && node.kind === 217 /* SyntaxKind.DeleteExpression */; } ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { @@ -17476,7 +17391,7 @@ var ts; ts.getDeclarationFromName = getDeclarationFromName; function isLiteralComputedPropertyDeclarationName(node) { return isStringOrNumericLiteralLike(node) && - node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */ && + node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */ && ts.isDeclaration(node.parent.parent); } ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; @@ -17484,29 +17399,29 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 299 /* SyntaxKind.EnumMember */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 302 /* SyntaxKind.EnumMember */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: // Name on right hand side of dot in a type query or type reference return parent.right === node; - case 203 /* SyntaxKind.BindingElement */: - case 270 /* SyntaxKind.ImportSpecifier */: + case 205 /* SyntaxKind.BindingElement */: + case 273 /* SyntaxKind.ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 275 /* SyntaxKind.ExportSpecifier */: - case 285 /* SyntaxKind.JsxAttribute */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 288 /* SyntaxKind.JsxAttribute */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: // Any name in an export specifier or JSX Attribute or Jsx Element return true; } @@ -17529,14 +17444,14 @@ var ts; // const x = require("...").y // const { x } = require("...").y function isAliasSymbolDeclaration(node) { - if (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ || - node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ || - node.kind === 267 /* SyntaxKind.ImportClause */ && !!node.name || - node.kind === 268 /* SyntaxKind.NamespaceImport */ || - node.kind === 274 /* SyntaxKind.NamespaceExport */ || - node.kind === 270 /* SyntaxKind.ImportSpecifier */ || - node.kind === 275 /* SyntaxKind.ExportSpecifier */ || - node.kind === 271 /* SyntaxKind.ExportAssignment */ && exportAssignmentIsAlias(node)) { + if (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ || + node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ || + node.kind === 270 /* SyntaxKind.ImportClause */ && !!node.name || + node.kind === 271 /* SyntaxKind.NamespaceImport */ || + node.kind === 277 /* SyntaxKind.NamespaceExport */ || + node.kind === 273 /* SyntaxKind.ImportSpecifier */ || + node.kind === 278 /* SyntaxKind.ExportSpecifier */ || + node.kind === 274 /* SyntaxKind.ExportAssignment */ && exportAssignmentIsAlias(node)) { return true; } return isInJSFile(node) && (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */ && exportAssignmentIsAlias(node) || @@ -17549,18 +17464,18 @@ var ts; ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getAliasDeclarationFromName(node) { switch (node.parent.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 271 /* SyntaxKind.ExportAssignment */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 274 /* SyntaxKind.NamespaceExport */: + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 274 /* SyntaxKind.ExportAssignment */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 277 /* SyntaxKind.NamespaceExport */: return node.parent; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.parent; - } while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */); + } while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */); return getAliasDeclarationFromName(node); } } @@ -17579,7 +17494,7 @@ var ts; } ts.getExportAssignmentExpression = getExportAssignmentExpression; function getPropertyAssignmentAliasLikeExpression(node) { - return node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? node.name : node.kind === 296 /* SyntaxKind.PropertyAssignment */ ? node.initializer : + return node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? node.name : node.kind === 299 /* SyntaxKind.PropertyAssignment */ ? node.initializer : node.parent.right; } ts.getPropertyAssignmentAliasLikeExpression = getPropertyAssignmentAliasLikeExpression; @@ -17645,11 +17560,11 @@ var ts; } ts.getAncestor = getAncestor; function isKeyword(token) { - return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 160 /* SyntaxKind.LastKeyword */; + return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 162 /* SyntaxKind.LastKeyword */; } ts.isKeyword = isKeyword; function isContextualKeyword(token) { - return 126 /* SyntaxKind.FirstContextualKeyword */ <= token && token <= 160 /* SyntaxKind.LastContextualKeyword */; + return 126 /* SyntaxKind.FirstContextualKeyword */ <= token && token <= 162 /* SyntaxKind.LastContextualKeyword */; } ts.isContextualKeyword = isContextualKeyword; function isNonContextualKeyword(token) { @@ -17693,15 +17608,15 @@ var ts; } var flags = 0 /* FunctionFlags.Normal */; switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: if (node.asteriskToken) { flags |= 1 /* FunctionFlags.Generator */; } // falls through - case 214 /* SyntaxKind.ArrowFunction */: - if (hasSyntacticModifier(node, 256 /* ModifierFlags.Async */)) { + case 216 /* SyntaxKind.ArrowFunction */: + if (hasSyntacticModifier(node, 512 /* ModifierFlags.Async */)) { flags |= 2 /* FunctionFlags.Async */; } break; @@ -17714,13 +17629,13 @@ var ts; ts.getFunctionFlags = getFunctionFlags; function isAsyncFunction(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: return node.body !== undefined && node.asteriskToken === undefined - && hasSyntacticModifier(node, 256 /* ModifierFlags.Async */); + && hasSyntacticModifier(node, 512 /* ModifierFlags.Async */); } return false; } @@ -17747,7 +17662,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - if (!(name.kind === 162 /* SyntaxKind.ComputedPropertyName */ || name.kind === 207 /* SyntaxKind.ElementAccessExpression */)) { + if (!(name.kind === 164 /* SyntaxKind.ComputedPropertyName */ || name.kind === 209 /* SyntaxKind.ElementAccessExpression */)) { return false; } var expr = ts.isElementAccessExpression(name) ? skipParentheses(name.argumentExpression) : name.expression; @@ -17763,7 +17678,7 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 8 /* SyntaxKind.NumericLiteral */: return ts.escapeLeadingUnderscores(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: var nameExpression = name.expression; if (isStringOrNumericLiteralLike(nameExpression)) { return ts.escapeLeadingUnderscores(nameExpression.text); @@ -17829,11 +17744,11 @@ var ts; ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 164 /* SyntaxKind.Parameter */; + return root.kind === 166 /* SyntaxKind.Parameter */; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 203 /* SyntaxKind.BindingElement */) { + while (node.kind === 205 /* SyntaxKind.BindingElement */) { node = node.parent.parent; } return node; @@ -17841,15 +17756,15 @@ var ts; ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 305 /* SyntaxKind.SourceFile */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 308 /* SyntaxKind.SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(range) { @@ -17868,23 +17783,23 @@ var ts; })(Associativity = ts.Associativity || (ts.Associativity = {})); function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 209 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 211 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return hasArguments ? 0 /* Associativity.Left */ : 1 /* Associativity.Right */; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 224 /* SyntaxKind.YieldExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 226 /* SyntaxKind.YieldExpression */: return 1 /* Associativity.Right */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (operator) { case 42 /* SyntaxKind.AsteriskAsteriskToken */: case 63 /* SyntaxKind.EqualsToken */: @@ -17911,15 +17826,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 209 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 211 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (expression.kind === 223 /* SyntaxKind.BinaryExpression */) { return expression.operatorToken.kind; } - else if (expression.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || expression.kind === 220 /* SyntaxKind.PostfixUnaryExpression */) { + else if (expression.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || expression.kind === 222 /* SyntaxKind.PostfixUnaryExpression */) { return expression.operator; } else { @@ -18098,15 +18013,15 @@ var ts; })(OperatorPrecedence = ts.OperatorPrecedence || (ts.OperatorPrecedence = {})); function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { switch (nodeKind) { - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return 0 /* OperatorPrecedence.Comma */; - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return 1 /* OperatorPrecedence.Spread */; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return 2 /* OperatorPrecedence.Yield */; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return 4 /* OperatorPrecedence.Conditional */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (operatorKind) { case 27 /* SyntaxKind.CommaToken */: return 0 /* OperatorPrecedence.Comma */; @@ -18131,26 +18046,27 @@ var ts; return getBinaryOperatorPrecedence(operatorKind); } // TODO: Should prefix `++` and `--` be moved to the `Update` precedence? - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 218 /* SyntaxKind.AwaitExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return 16 /* OperatorPrecedence.Unary */; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return 17 /* OperatorPrecedence.Update */; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return 18 /* OperatorPrecedence.LeftHandSide */; - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return hasArguments ? 19 /* OperatorPrecedence.Member */ : 18 /* OperatorPrecedence.LeftHandSide */; - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 231 /* SyntaxKind.MetaProperty */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 233 /* SyntaxKind.MetaProperty */: return 19 /* OperatorPrecedence.Member */; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return 11 /* OperatorPrecedence.Relational */; case 108 /* SyntaxKind.ThisKeyword */: case 106 /* SyntaxKind.SuperKeyword */: @@ -18162,19 +18078,19 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 226 /* SyntaxKind.ClassExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: case 13 /* SyntaxKind.RegularExpressionLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 225 /* SyntaxKind.TemplateExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: return 20 /* OperatorPrecedence.Primary */; default: return -1 /* OperatorPrecedence.Invalid */; @@ -18206,7 +18122,8 @@ var ts; case 33 /* SyntaxKind.GreaterThanEqualsToken */: case 102 /* SyntaxKind.InstanceOfKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: + case 150 /* SyntaxKind.SatisfiesKeyword */: return 11 /* OperatorPrecedence.Relational */; case 47 /* SyntaxKind.LessThanLessThanToken */: case 48 /* SyntaxKind.GreaterThanGreaterThanToken */: @@ -18230,7 +18147,7 @@ var ts; function getSemanticJsxChildren(children) { return ts.filter(children, function (i) { switch (i.kind) { - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return !!i.expression; case 11 /* SyntaxKind.JsxText */: return !i.containsOnlyTriviaWhiteSpaces; @@ -18286,7 +18203,7 @@ var ts; } diagnostics = nonFileDiagnostics; } - ts.insertSorted(diagnostics, diagnostic, compareDiagnostics); + ts.insertSorted(diagnostics, diagnostic, compareDiagnosticsSkipRelatedInformation); } function getGlobalDiagnostics() { hasReadNonFileDiagnostics = true; @@ -18822,7 +18739,7 @@ var ts; while (ts.isQualifiedName(node.parent) && node.parent.left === node) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */; + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isThisInTypeQuery = isThisInTypeQuery; function identifierIsThisKeyword(id) { @@ -18837,10 +18754,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 172 /* SyntaxKind.GetAccessor */) { + if (accessor.kind === 174 /* SyntaxKind.GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (accessor.kind === 175 /* SyntaxKind.SetAccessor */) { setAccessor = accessor; } else { @@ -18860,10 +18777,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 172 /* SyntaxKind.GetAccessor */ && !getAccessor) { + if (member.kind === 174 /* SyntaxKind.GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 173 /* SyntaxKind.SetAccessor */ && !setAccessor) { + if (member.kind === 175 /* SyntaxKind.SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -18912,7 +18829,7 @@ var ts; ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations; /** template tags are only available when a typedef isn't already using them */ function isNonTypeAliasTemplate(tag) { - return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 320 /* SyntaxKind.JSDoc */ && tag.parent.tags.some(isJSDocTypeAlias)); + return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 323 /* SyntaxKind.JSDoc */ && tag.parent.tags.some(isJSDocTypeAlias)); } /** * Gets the effective type annotation of the value parameter of a set accessor. If the node @@ -19145,13 +19062,17 @@ var ts; } ts.hasOverrideModifier = hasOverrideModifier; function hasAbstractModifier(node) { - return hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */); + return hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */); } ts.hasAbstractModifier = hasAbstractModifier; function hasAmbientModifier(node) { return hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */); } ts.hasAmbientModifier = hasAmbientModifier; + function hasAccessorModifier(node) { + return hasSyntacticModifier(node, 128 /* ModifierFlags.Accessor */); + } + ts.hasAccessorModifier = hasAccessorModifier; function hasEffectiveReadonlyModifier(node) { return hasEffectiveModifier(node, 64 /* ModifierFlags.Readonly */); } @@ -19169,7 +19090,7 @@ var ts; } ts.getSelectedSyntacticModifierFlags = getSelectedSyntacticModifierFlags; function getModifierFlagsWorker(node, includeJSDoc, alwaysIncludeJSDoc) { - if (node.kind >= 0 /* SyntaxKind.FirstToken */ && node.kind <= 160 /* SyntaxKind.LastToken */) { + if (node.kind >= 0 /* SyntaxKind.FirstToken */ && node.kind <= 162 /* SyntaxKind.LastToken */) { return 0 /* ModifierFlags.None */; } if (!(node.modifierFlagsCache & 536870912 /* ModifierFlags.HasComputedFlags */)) { @@ -19261,25 +19182,22 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: return 4 /* ModifierFlags.Public */; case 122 /* SyntaxKind.ProtectedKeyword */: return 16 /* ModifierFlags.Protected */; case 121 /* SyntaxKind.PrivateKeyword */: return 8 /* ModifierFlags.Private */; - case 126 /* SyntaxKind.AbstractKeyword */: return 128 /* ModifierFlags.Abstract */; + case 126 /* SyntaxKind.AbstractKeyword */: return 256 /* ModifierFlags.Abstract */; + case 127 /* SyntaxKind.AccessorKeyword */: return 128 /* ModifierFlags.Accessor */; case 93 /* SyntaxKind.ExportKeyword */: return 1 /* ModifierFlags.Export */; - case 135 /* SyntaxKind.DeclareKeyword */: return 2 /* ModifierFlags.Ambient */; + case 136 /* SyntaxKind.DeclareKeyword */: return 2 /* ModifierFlags.Ambient */; case 85 /* SyntaxKind.ConstKeyword */: return 2048 /* ModifierFlags.Const */; - case 88 /* SyntaxKind.DefaultKeyword */: return 512 /* ModifierFlags.Default */; - case 131 /* SyntaxKind.AsyncKeyword */: return 256 /* ModifierFlags.Async */; - case 145 /* SyntaxKind.ReadonlyKeyword */: return 64 /* ModifierFlags.Readonly */; - case 159 /* SyntaxKind.OverrideKeyword */: return 16384 /* ModifierFlags.Override */; + case 88 /* SyntaxKind.DefaultKeyword */: return 1024 /* ModifierFlags.Default */; + case 132 /* SyntaxKind.AsyncKeyword */: return 512 /* ModifierFlags.Async */; + case 146 /* SyntaxKind.ReadonlyKeyword */: return 64 /* ModifierFlags.Readonly */; + case 161 /* SyntaxKind.OverrideKeyword */: return 16384 /* ModifierFlags.Override */; case 101 /* SyntaxKind.InKeyword */: return 32768 /* ModifierFlags.In */; - case 144 /* SyntaxKind.OutKeyword */: return 65536 /* ModifierFlags.Out */; - case 165 /* SyntaxKind.Decorator */: return 131072 /* ModifierFlags.Decorator */; + case 145 /* SyntaxKind.OutKeyword */: return 65536 /* ModifierFlags.Out */; + case 167 /* SyntaxKind.Decorator */: return 131072 /* ModifierFlags.Decorator */; } return 0 /* ModifierFlags.None */; } ts.modifierToFlag = modifierToFlag; - function createModifiers(modifierFlags) { - return modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; - } - ts.createModifiers = createModifiers; function isLogicalOperator(token) { return token === 56 /* SyntaxKind.BarBarToken */ || token === 55 /* SyntaxKind.AmpersandAmpersandToken */ @@ -19329,8 +19247,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { var kind = node.left.kind; - return kind === 205 /* SyntaxKind.ObjectLiteralExpression */ - || kind === 204 /* SyntaxKind.ArrayLiteralExpression */; + return kind === 207 /* SyntaxKind.ObjectLiteralExpression */ + || kind === 206 /* SyntaxKind.ArrayLiteralExpression */; } return false; } @@ -19347,12 +19265,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.left; } while (node.kind !== 79 /* SyntaxKind.Identifier */); return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: do { node = node.expression; } while (node.kind !== 79 /* SyntaxKind.Identifier */); @@ -19364,9 +19282,9 @@ var ts; return node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 108 /* SyntaxKind.ThisKeyword */ || node.kind === 106 /* SyntaxKind.SuperKeyword */ - || node.kind === 231 /* SyntaxKind.MetaProperty */ - || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && isDottedName(node.expression) - || node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ && isDottedName(node.expression); + || node.kind === 233 /* SyntaxKind.MetaProperty */ + || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isDottedName(node.expression) + || node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ && isDottedName(node.expression); } ts.isDottedName = isDottedName; function isPropertyAccessEntityNameExpression(node) { @@ -19397,8 +19315,8 @@ var ts; } ts.isPrototypeAccess = isPrototypeAccess; function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 161 /* SyntaxKind.QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 163 /* SyntaxKind.QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isRightSideOfAccessExpression(node) { @@ -19413,12 +19331,12 @@ var ts; } ts.isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName = isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName; function isEmptyObjectLiteral(expression) { - return expression.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + return expression.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && expression.properties.length === 0; } ts.isEmptyObjectLiteral = isEmptyObjectLiteral; function isEmptyArrayLiteral(expression) { - return expression.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && + return expression.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && expression.elements.length === 0; } ts.isEmptyArrayLiteral = isEmptyArrayLiteral; @@ -19434,7 +19352,7 @@ var ts; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; function isExportDefaultSymbol(symbol) { - return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 512 /* ModifierFlags.Default */); + return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 1024 /* ModifierFlags.Default */); } /** Return ".ts", ".d.ts", or ".tsx", if that is the extension. */ function tryExtractTSExtension(fileName) { @@ -19579,21 +19497,17 @@ var ts; return getStringFromExpandedCharCodes(expandedCharCodes); } ts.base64decode = base64decode; + function readJsonOrUndefined(path, hostOrText) { + var jsonText = ts.isString(hostOrText) ? hostOrText : hostOrText.readFile(path); + if (!jsonText) + return undefined; + // gracefully handle if readFile fails or returns not JSON + var result = ts.parseConfigFileTextToJson(path, jsonText); + return !result.error ? result.config : undefined; + } + ts.readJsonOrUndefined = readJsonOrUndefined; function readJson(path, host) { - try { - var jsonText = host.readFile(path); - if (!jsonText) - return {}; - var result = ts.parseConfigFileTextToJson(path, jsonText); - if (result.error) { - return {}; - } - return result.config; - } - catch (e) { - // gracefully handle if readFile fails or returns not JSON - return {}; - } + return readJsonOrUndefined(path, host) || {}; } ts.readJson = readJson; function directoryProbablyExists(directoryName, host) { @@ -19752,8 +19666,8 @@ var ts; var parseNode = ts.getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return parseNode === parseNode.parent.name; } } @@ -19769,7 +19683,7 @@ var ts; } function isWatchSet(options) { // Firefox has Object.prototype.watch - return options.watch && options.hasOwnProperty("watch"); + return options.watch && ts.hasProperty(options, "watch"); } ts.isWatchSet = isWatchSet; function closeFileWatcher(watcher) { @@ -19833,35 +19747,35 @@ var ts; if (!parent) return 0 /* AccessKind.Read */; switch (parent.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return accessKind(parent); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var operator = parent.operator; return operator === 45 /* SyntaxKind.PlusPlusToken */ || operator === 46 /* SyntaxKind.MinusMinusToken */ ? writeOrReadWrite() : 0 /* AccessKind.Read */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var _a = parent, left = _a.left, operatorToken = _a.operatorToken; return left === node && isAssignmentOperator(operatorToken.kind) ? operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ ? 1 /* AccessKind.Write */ : writeOrReadWrite() : 0 /* AccessKind.Read */; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return parent.name !== node ? 0 /* AccessKind.Read */ : accessKind(parent); - case 296 /* SyntaxKind.PropertyAssignment */: { + case 299 /* SyntaxKind.PropertyAssignment */: { var parentAccess = accessKind(parent.parent); // In `({ x: varname }) = { x: 1 }`, the left `x` is a read, the right `x` is a write. return node === parent.name ? reverseAccessKind(parentAccess) : parentAccess; } - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // Assume it's the local variable being accessed, since we don't check public properties for --noUnusedLocals. return node === parent.objectAssignmentInitializer ? 0 /* AccessKind.Read */ : accessKind(parent.parent); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return accessKind(parent); default: return 0 /* AccessKind.Read */; } function writeOrReadWrite() { // If grandparent is not an ExpressionStatement, this is used as an expression in addition to having a side effect. - return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 238 /* SyntaxKind.ExpressionStatement */ ? 1 /* AccessKind.Write */ : 2 /* AccessKind.ReadWrite */; + return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 241 /* SyntaxKind.ExpressionStatement */ ? 1 /* AccessKind.Write */ : 2 /* AccessKind.ReadWrite */; } } function reverseAccessKind(a) { @@ -19943,7 +19857,7 @@ var ts; function isAbstractConstructorSymbol(symbol) { if (symbol.flags & 32 /* SymbolFlags.Class */) { var declaration = getClassLikeDeclarationOfSymbol(symbol); - return !!declaration && hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */); + return !!declaration && hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */); } return false; } @@ -20005,37 +19919,37 @@ var ts; } ts.isObjectTypeDeclaration = isObjectTypeDeclaration; function isTypeNodeKind(kind) { - return (kind >= 177 /* SyntaxKind.FirstTypeNode */ && kind <= 200 /* SyntaxKind.LastTypeNode */) - || kind === 130 /* SyntaxKind.AnyKeyword */ - || kind === 155 /* SyntaxKind.UnknownKeyword */ - || kind === 147 /* SyntaxKind.NumberKeyword */ - || kind === 158 /* SyntaxKind.BigIntKeyword */ - || kind === 148 /* SyntaxKind.ObjectKeyword */ - || kind === 133 /* SyntaxKind.BooleanKeyword */ - || kind === 150 /* SyntaxKind.StringKeyword */ - || kind === 151 /* SyntaxKind.SymbolKeyword */ + return (kind >= 179 /* SyntaxKind.FirstTypeNode */ && kind <= 202 /* SyntaxKind.LastTypeNode */) + || kind === 131 /* SyntaxKind.AnyKeyword */ + || kind === 157 /* SyntaxKind.UnknownKeyword */ + || kind === 148 /* SyntaxKind.NumberKeyword */ + || kind === 160 /* SyntaxKind.BigIntKeyword */ + || kind === 149 /* SyntaxKind.ObjectKeyword */ + || kind === 134 /* SyntaxKind.BooleanKeyword */ + || kind === 152 /* SyntaxKind.StringKeyword */ + || kind === 153 /* SyntaxKind.SymbolKeyword */ || kind === 114 /* SyntaxKind.VoidKeyword */ - || kind === 153 /* SyntaxKind.UndefinedKeyword */ - || kind === 143 /* SyntaxKind.NeverKeyword */ - || kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ - || kind === 312 /* SyntaxKind.JSDocAllType */ - || kind === 313 /* SyntaxKind.JSDocUnknownType */ - || kind === 314 /* SyntaxKind.JSDocNullableType */ - || kind === 315 /* SyntaxKind.JSDocNonNullableType */ - || kind === 316 /* SyntaxKind.JSDocOptionalType */ - || kind === 317 /* SyntaxKind.JSDocFunctionType */ - || kind === 318 /* SyntaxKind.JSDocVariadicType */; + || kind === 155 /* SyntaxKind.UndefinedKeyword */ + || kind === 144 /* SyntaxKind.NeverKeyword */ + || kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ + || kind === 315 /* SyntaxKind.JSDocAllType */ + || kind === 316 /* SyntaxKind.JSDocUnknownType */ + || kind === 317 /* SyntaxKind.JSDocNullableType */ + || kind === 318 /* SyntaxKind.JSDocNonNullableType */ + || kind === 319 /* SyntaxKind.JSDocOptionalType */ + || kind === 320 /* SyntaxKind.JSDocFunctionType */ + || kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isTypeNodeKind = isTypeNodeKind; function isAccessExpression(node) { - return node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 207 /* SyntaxKind.ElementAccessExpression */; + return node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 209 /* SyntaxKind.ElementAccessExpression */; } ts.isAccessExpression = isAccessExpression; function getNameOfAccessExpression(node) { - if (node.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { return node.name; } - ts.Debug.assert(node.kind === 207 /* SyntaxKind.ElementAccessExpression */); + ts.Debug.assert(node.kind === 209 /* SyntaxKind.ElementAccessExpression */); return node.argumentExpression; } ts.getNameOfAccessExpression = getNameOfAccessExpression; @@ -20050,7 +19964,7 @@ var ts; } ts.isBundleFileTextLike = isBundleFileTextLike; function isNamedImportsOrExports(node) { - return node.kind === 269 /* SyntaxKind.NamedImports */ || node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 272 /* SyntaxKind.NamedImports */ || node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedImportsOrExports = isNamedImportsOrExports; function getLeftmostAccessExpression(expr) { @@ -20065,13 +19979,13 @@ var ts; return walkAccessExpression(name.parent); } function walkAccessExpression(access) { - if (access.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (access.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var res = action(access.name); if (res !== undefined) { return res; } } - else if (access.kind === 207 /* SyntaxKind.ElementAccessExpression */) { + else if (access.kind === 209 /* SyntaxKind.ElementAccessExpression */) { if (ts.isIdentifier(access.argumentExpression) || ts.isStringLiteralLike(access.argumentExpression)) { var res = action(access.argumentExpression); if (res !== undefined) { @@ -20098,28 +20012,29 @@ var ts; function getLeftmostExpression(node, stopAtCallExpressions) { while (true) { switch (node.kind) { - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: node = node.operand; continue; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: node = node.left; continue; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: node = node.condition; continue; - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: node = node.tag; continue; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (stopAtCallExpressions) { return node; } // falls through - case 229 /* SyntaxKind.AsExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: node = node.expression; continue; } @@ -21355,17 +21270,17 @@ var ts; return ts.isIdentifier(useSite) && ts.isShorthandPropertyAssignment(useSite.parent) && useSite.parent.name === useSite; } function isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(node) { - while (node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { node = node.parent; } - if (node.kind !== 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.kind !== 164 /* SyntaxKind.ComputedPropertyName */) { return false; } - if (hasSyntacticModifier(node.parent, 128 /* ModifierFlags.Abstract */)) { + if (hasSyntacticModifier(node.parent, 256 /* ModifierFlags.Abstract */)) { return true; } var containerKind = node.parent.parent.kind; - return containerKind === 258 /* SyntaxKind.InterfaceDeclaration */ || containerKind === 182 /* SyntaxKind.TypeLiteral */; + return containerKind === 261 /* SyntaxKind.InterfaceDeclaration */ || containerKind === 184 /* SyntaxKind.TypeLiteral */; } /** Returns true for an identifier in 1) an `implements` clause, and 2) an `extends` clause of an interface. */ function isIdentifierInNonEmittingHeritageClause(node) { @@ -21373,16 +21288,16 @@ var ts; return false; var heritageClause = ts.findAncestor(node.parent, function (parent) { switch (parent.kind) { - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return true; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return false; default: return "quit"; } }); - return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 /* SyntaxKind.ImplementsKeyword */ || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 258 /* SyntaxKind.InterfaceDeclaration */; + return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 /* SyntaxKind.ImplementsKeyword */ || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 261 /* SyntaxKind.InterfaceDeclaration */; } function isIdentifierTypeReference(node) { return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName); @@ -21543,22 +21458,22 @@ var ts; if (!node.parent) return undefined; switch (node.kind) { - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: var parent_1 = node.parent; - return parent_1.kind === 190 /* SyntaxKind.InferType */ ? undefined : parent_1.typeParameters; - case 164 /* SyntaxKind.Parameter */: + return parent_1.kind === 192 /* SyntaxKind.InferType */ ? undefined : parent_1.typeParameters; + case 166 /* SyntaxKind.Parameter */: return node.parent.parameters; - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: + case 201 /* SyntaxKind.TemplateLiteralTypeSpan */: return node.parent.templateSpans; - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return node.parent.templateSpans; - case 165 /* SyntaxKind.Decorator */: { + case 167 /* SyntaxKind.Decorator */: { var parent_2 = node.parent; return ts.canHaveDecorators(parent_2) ? parent_2.modifiers : ts.canHaveIllegalDecorators(parent_2) ? parent_2.illegalDecorators : undefined; } - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return node.parent.heritageClauses; } var parent = node.parent; @@ -21566,45 +21481,45 @@ var ts; return ts.isJSDocTypeLiteral(node.parent) ? undefined : node.parent.tags; } switch (parent.kind) { - case 182 /* SyntaxKind.TypeLiteral */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.isTypeElement(node) ? parent.members : undefined; - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return parent.types; - case 184 /* SyntaxKind.TupleType */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 351 /* SyntaxKind.CommaListExpression */: - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 186 /* SyntaxKind.TupleType */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 354 /* SyntaxKind.CommaListExpression */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return parent.elements; - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 286 /* SyntaxKind.JsxAttributes */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 289 /* SyntaxKind.JsxAttributes */: return parent.properties; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return ts.isTypeNode(node) ? parent.typeArguments : parent.expression === node ? undefined : parent.arguments; - case 278 /* SyntaxKind.JsxElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 281 /* SyntaxKind.JsxElement */: + case 285 /* SyntaxKind.JsxFragment */: return ts.isJsxChild(node) ? parent.children : undefined; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return ts.isTypeNode(node) ? parent.typeArguments : undefined; - case 235 /* SyntaxKind.Block */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 265 /* SyntaxKind.ModuleBlock */: return parent.statements; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return parent.clauses; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.isClassElement(node) ? parent.members : undefined; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.isEnumMember(node) ? parent.members : undefined; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return parent.statements; } } @@ -21616,7 +21531,7 @@ var ts; if (ts.some(node.parameters, function (p) { return !getEffectiveTypeAnnotationNode(p); })) { return true; } - if (node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind !== 216 /* SyntaxKind.ArrowFunction */) { // If the first parameter is not an explicit 'this' parameter, then the function has // an implicit 'this' parameter which is subject to contextual typing. var parameter = ts.firstOrUndefined(node.parameters); @@ -21634,7 +21549,7 @@ var ts; } ts.isInfinityOrNaNString = isInfinityOrNaNString; function isCatchClauseVariableDeclaration(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function isParameterOrCatchClauseVariable(symbol) { @@ -21643,7 +21558,7 @@ var ts; } ts.isParameterOrCatchClauseVariable = isParameterOrCatchClauseVariable; function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 213 /* SyntaxKind.FunctionExpression */ || node.kind === 214 /* SyntaxKind.ArrowFunction */; + return node.kind === 215 /* SyntaxKind.FunctionExpression */ || node.kind === 216 /* SyntaxKind.ArrowFunction */; } ts.isFunctionExpressionOrArrowFunction = isFunctionExpressionOrArrowFunction; function escapeSnippetText(text) { @@ -21740,7 +21655,7 @@ var ts; ts.getNodeModulePathParts = getNodeModulePathParts; function getParameterTypeNode(parameter) { var _a; - return parameter.kind === 340 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; + return parameter.kind === 343 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; } ts.getParameterTypeNode = getParameterTypeNode; })(ts || (ts = {})); @@ -21865,10 +21780,10 @@ var ts; // // If `a ** d` is on the left of operator `**`, we need to parenthesize to preserve // the intended order of operations: `(a ** b) ** c` - var binaryOperatorPrecedence = ts.getOperatorPrecedence(221 /* SyntaxKind.BinaryExpression */, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(221 /* SyntaxKind.BinaryExpression */, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(223 /* SyntaxKind.BinaryExpression */, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(223 /* SyntaxKind.BinaryExpression */, binaryOperator); var emittedOperand = ts.skipPartiallyEmittedExpressions(operand); - if (!isLeftSideOfBinary && operand.kind === 214 /* SyntaxKind.ArrowFunction */ && binaryOperatorPrecedence > 3 /* OperatorPrecedence.Assignment */) { + if (!isLeftSideOfBinary && operand.kind === 216 /* SyntaxKind.ArrowFunction */ && binaryOperatorPrecedence > 3 /* OperatorPrecedence.Assignment */) { // We need to parenthesize arrow functions on the right side to avoid it being // parsed as parenthesized expression: `a && (() => {})` return true; @@ -21880,7 +21795,7 @@ var ts; // and is a yield expression, then we do not need parentheses. if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 /* Associativity.Right */ - && operand.kind === 224 /* SyntaxKind.YieldExpression */) { + && operand.kind === 226 /* SyntaxKind.YieldExpression */) { return false; } return true; @@ -21949,13 +21864,15 @@ var ts; // (a|b)|c -> a|(b|c) -> a|b|c // (a&b)&c -> a&(b&c) -> a&b&c // (a^b)^c -> a^(b^c) -> a^b^c + // (a,b),c -> a,(b,c) -> a,b,c // // While addition is associative in mathematics, JavaScript's `+` is not // guaranteed to be associative as it is overloaded with string concatenation. return binaryOperator === 41 /* SyntaxKind.AsteriskToken */ || binaryOperator === 51 /* SyntaxKind.BarToken */ || binaryOperator === 50 /* SyntaxKind.AmpersandToken */ - || binaryOperator === 52 /* SyntaxKind.CaretToken */; + || binaryOperator === 52 /* SyntaxKind.CaretToken */ + || binaryOperator === 27 /* SyntaxKind.CommaToken */; } /** * This function determines whether an expression consists of a homogeneous set of @@ -21968,7 +21885,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 39 /* SyntaxKind.PlusToken */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 39 /* SyntaxKind.PlusToken */) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -21994,7 +21911,7 @@ var ts; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = ts.skipPartiallyEmittedExpressions(operand); // If the resulting expression is already parenthesized, we do not need to do any further processing. - if (skipped.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (skipped.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) @@ -22011,7 +21928,7 @@ var ts; return ts.isCommaSequence(expression) ? factory.createParenthesizedExpression(expression) : expression; } function parenthesizeConditionOfConditionalExpression(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(222 /* SyntaxKind.ConditionalExpression */, 57 /* SyntaxKind.QuestionToken */); + var conditionalPrecedence = ts.getOperatorPrecedence(224 /* SyntaxKind.ConditionalExpression */, 57 /* SyntaxKind.QuestionToken */); var emittedCondition = ts.skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) !== 1 /* Comparison.GreaterThan */) { @@ -22044,8 +21961,8 @@ var ts; var needsParens = ts.isCommaSequence(check); if (!needsParens) { switch (ts.getLeftmostExpression(check, /*stopAtCallExpression*/ false).kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: needsParens = true; } } @@ -22058,9 +21975,9 @@ var ts; function parenthesizeExpressionOfNew(expression) { var leftmostExpr = ts.getLeftmostExpression(expression, /*stopAtCallExpressions*/ true); switch (leftmostExpr.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return factory.createParenthesizedExpression(expression); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return !leftmostExpr.arguments ? factory.createParenthesizedExpression(expression) : expression; // TODO(rbuckton): Verify this assertion holds @@ -22080,7 +21997,7 @@ var ts; // var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 209 /* SyntaxKind.NewExpression */ || emittedExpression.arguments) + && (emittedExpression.kind !== 211 /* SyntaxKind.NewExpression */ || emittedExpression.arguments) && (optionalChain || !ts.isOptionalChain(emittedExpression))) { // TODO(rbuckton): Verify whether this assertion holds. return expression; @@ -22103,7 +22020,7 @@ var ts; function parenthesizeExpressionForDisallowedComma(expression) { var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(221 /* SyntaxKind.BinaryExpression */, 27 /* SyntaxKind.CommaToken */); + var commaPrecedence = ts.getOperatorPrecedence(223 /* SyntaxKind.BinaryExpression */, 27 /* SyntaxKind.CommaToken */); // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return expressionPrecedence > commaPrecedence ? expression : ts.setTextRange(factory.createParenthesizedExpression(expression), expression); } @@ -22112,21 +22029,21 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = ts.skipPartiallyEmittedExpressions(callee).kind; - if (kind === 213 /* SyntaxKind.FunctionExpression */ || kind === 214 /* SyntaxKind.ArrowFunction */) { + if (kind === 215 /* SyntaxKind.FunctionExpression */ || kind === 216 /* SyntaxKind.ArrowFunction */) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. var updated = factory.updateCallExpression(emittedExpression, ts.setTextRange(factory.createParenthesizedExpression(callee), callee), emittedExpression.typeArguments, emittedExpression.arguments); return factory.restoreOuterExpressions(expression, updated, 8 /* OuterExpressionKinds.PartiallyEmittedExpressions */); } } var leftmostExpressionKind = ts.getLeftmostExpression(emittedExpression, /*stopAtCallExpressions*/ false).kind; - if (leftmostExpressionKind === 205 /* SyntaxKind.ObjectLiteralExpression */ || leftmostExpressionKind === 213 /* SyntaxKind.FunctionExpression */) { + if (leftmostExpressionKind === 207 /* SyntaxKind.ObjectLiteralExpression */ || leftmostExpressionKind === 215 /* SyntaxKind.FunctionExpression */) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return ts.setTextRange(factory.createParenthesizedExpression(expression), expression); } return expression; } function parenthesizeConciseBodyOfArrowFunction(body) { - if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 205 /* SyntaxKind.ObjectLiteralExpression */)) { + if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 207 /* SyntaxKind.ObjectLiteralExpression */)) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return ts.setTextRange(factory.createParenthesizedExpression(body), body); } @@ -22144,16 +22061,16 @@ var ts; // - The true and false branch types (the second and third `Type` non-terminals, above) allow any type function parenthesizeCheckTypeOfConditionalType(checkType) { switch (checkType.kind) { - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 189 /* SyntaxKind.ConditionalType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 191 /* SyntaxKind.ConditionalType */: return factory.createParenthesizedType(checkType); } return checkType; } function parenthesizeExtendsTypeOfConditionalType(extendsType) { switch (extendsType.kind) { - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return factory.createParenthesizedType(extendsType); } return extendsType; @@ -22165,8 +22082,8 @@ var ts; // - A union type constituent has the same precedence as the check type of a conditional type function parenthesizeConstituentTypeOfUnionType(type) { switch (type.kind) { - case 187 /* SyntaxKind.UnionType */: // Not strictly necessary, but a union containing a union should have been flattened - case 188 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests + case 189 /* SyntaxKind.UnionType */: // Not strictly necessary, but a union containing a union should have been flattened + case 190 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests return factory.createParenthesizedType(type); } return parenthesizeCheckTypeOfConditionalType(type); @@ -22181,8 +22098,8 @@ var ts; // - An intersection type constituent does not allow function, constructor, conditional, or union types (they must be parenthesized) function parenthesizeConstituentTypeOfIntersectionType(type) { switch (type.kind) { - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but an intersection containing an intersection should have been flattened + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but an intersection containing an intersection should have been flattened return factory.createParenthesizedType(type); } return parenthesizeConstituentTypeOfUnionType(type); @@ -22199,14 +22116,14 @@ var ts; // function parenthesizeOperandOfTypeOperator(type) { switch (type.kind) { - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return factory.createParenthesizedType(type); } return parenthesizeConstituentTypeOfIntersectionType(type); } function parenthesizeOperandOfReadonlyTypeOperator(type) { switch (type.kind) { - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return factory.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); @@ -22226,9 +22143,9 @@ var ts; // function parenthesizeNonArrayTypeOfPostfixType(type) { switch (type.kind) { - case 190 /* SyntaxKind.InferType */: - case 193 /* SyntaxKind.TypeOperator */: - case 181 /* SyntaxKind.TypeQuery */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests + case 192 /* SyntaxKind.InferType */: + case 195 /* SyntaxKind.TypeOperator */: + case 183 /* SyntaxKind.TypeQuery */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests return factory.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); @@ -22422,11 +22339,11 @@ var ts; } function convertToAssignmentPattern(node) { switch (node.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return convertToArrayAssignmentPattern(node); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return convertToObjectAssignmentPattern(node); } } @@ -22520,6 +22437,8 @@ var ts; createUniqueName: createUniqueName, getGeneratedNameForNode: getGeneratedNameForNode, createPrivateIdentifier: createPrivateIdentifier, + createUniquePrivateName: createUniquePrivateName, + getGeneratedPrivateNameForNode: getGeneratedPrivateNameForNode, createToken: createToken, createSuper: createSuper, createThis: createThis, @@ -22682,6 +22601,8 @@ var ts; updateAsExpression: updateAsExpression, createNonNullExpression: createNonNullExpression, updateNonNullExpression: updateNonNullExpression, + createSatisfiesExpression: createSatisfiesExpression, + updateSatisfiesExpression: updateSatisfiesExpression, createNonNullChain: createNonNullChain, updateNonNullChain: updateNonNullChain, createMetaProperty: createMetaProperty, @@ -22779,18 +22700,18 @@ var ts; createExternalModuleReference: createExternalModuleReference, updateExternalModuleReference: updateExternalModuleReference, // lazily load factory members for JSDoc types with similar structure - get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(312 /* SyntaxKind.JSDocAllType */); }, - get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(313 /* SyntaxKind.JSDocUnknownType */); }, - get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(315 /* SyntaxKind.JSDocNonNullableType */); }, - get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(315 /* SyntaxKind.JSDocNonNullableType */); }, - get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(314 /* SyntaxKind.JSDocNullableType */); }, - get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(314 /* SyntaxKind.JSDocNullableType */); }, - get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(316 /* SyntaxKind.JSDocOptionalType */); }, - get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(316 /* SyntaxKind.JSDocOptionalType */); }, - get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(318 /* SyntaxKind.JSDocVariadicType */); }, - get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(318 /* SyntaxKind.JSDocVariadicType */); }, - get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(319 /* SyntaxKind.JSDocNamepathType */); }, - get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(319 /* SyntaxKind.JSDocNamepathType */); }, + get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(315 /* SyntaxKind.JSDocAllType */); }, + get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(316 /* SyntaxKind.JSDocUnknownType */); }, + get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(318 /* SyntaxKind.JSDocNonNullableType */); }, + get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(318 /* SyntaxKind.JSDocNonNullableType */); }, + get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(317 /* SyntaxKind.JSDocNullableType */); }, + get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(317 /* SyntaxKind.JSDocNullableType */); }, + get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(319 /* SyntaxKind.JSDocOptionalType */); }, + get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(319 /* SyntaxKind.JSDocOptionalType */); }, + get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(321 /* SyntaxKind.JSDocVariadicType */); }, + get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(321 /* SyntaxKind.JSDocVariadicType */); }, + get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(322 /* SyntaxKind.JSDocNamepathType */); }, + get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(322 /* SyntaxKind.JSDocNamepathType */); }, createJSDocFunctionType: createJSDocFunctionType, updateJSDocFunctionType: updateJSDocFunctionType, createJSDocTypeLiteral: createJSDocTypeLiteral, @@ -22826,30 +22747,30 @@ var ts; createJSDocLinkPlain: createJSDocLinkPlain, updateJSDocLinkPlain: updateJSDocLinkPlain, // lazily load factory members for JSDoc tags with similar structure - get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(343 /* SyntaxKind.JSDocTypeTag */); }, - get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(343 /* SyntaxKind.JSDocTypeTag */); }, - get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(341 /* SyntaxKind.JSDocReturnTag */); }, - get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(341 /* SyntaxKind.JSDocReturnTag */); }, - get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(342 /* SyntaxKind.JSDocThisTag */); }, - get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(342 /* SyntaxKind.JSDocThisTag */); }, - get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(339 /* SyntaxKind.JSDocEnumTag */); }, - get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(339 /* SyntaxKind.JSDocEnumTag */); }, - get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(330 /* SyntaxKind.JSDocAuthorTag */); }, - get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(330 /* SyntaxKind.JSDocAuthorTag */); }, - get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(332 /* SyntaxKind.JSDocClassTag */); }, - get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(332 /* SyntaxKind.JSDocClassTag */); }, - get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(333 /* SyntaxKind.JSDocPublicTag */); }, - get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(333 /* SyntaxKind.JSDocPublicTag */); }, - get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(334 /* SyntaxKind.JSDocPrivateTag */); }, - get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(334 /* SyntaxKind.JSDocPrivateTag */); }, - get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(335 /* SyntaxKind.JSDocProtectedTag */); }, - get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(335 /* SyntaxKind.JSDocProtectedTag */); }, - get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(336 /* SyntaxKind.JSDocReadonlyTag */); }, - get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(336 /* SyntaxKind.JSDocReadonlyTag */); }, - get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(337 /* SyntaxKind.JSDocOverrideTag */); }, - get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(337 /* SyntaxKind.JSDocOverrideTag */); }, - get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(331 /* SyntaxKind.JSDocDeprecatedTag */); }, - get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(331 /* SyntaxKind.JSDocDeprecatedTag */); }, + get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(346 /* SyntaxKind.JSDocTypeTag */); }, + get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(346 /* SyntaxKind.JSDocTypeTag */); }, + get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(344 /* SyntaxKind.JSDocReturnTag */); }, + get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(344 /* SyntaxKind.JSDocReturnTag */); }, + get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(345 /* SyntaxKind.JSDocThisTag */); }, + get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(345 /* SyntaxKind.JSDocThisTag */); }, + get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(342 /* SyntaxKind.JSDocEnumTag */); }, + get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(342 /* SyntaxKind.JSDocEnumTag */); }, + get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(333 /* SyntaxKind.JSDocAuthorTag */); }, + get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(333 /* SyntaxKind.JSDocAuthorTag */); }, + get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(335 /* SyntaxKind.JSDocClassTag */); }, + get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(335 /* SyntaxKind.JSDocClassTag */); }, + get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(336 /* SyntaxKind.JSDocPublicTag */); }, + get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(336 /* SyntaxKind.JSDocPublicTag */); }, + get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(337 /* SyntaxKind.JSDocPrivateTag */); }, + get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(337 /* SyntaxKind.JSDocPrivateTag */); }, + get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(338 /* SyntaxKind.JSDocProtectedTag */); }, + get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(338 /* SyntaxKind.JSDocProtectedTag */); }, + get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(339 /* SyntaxKind.JSDocReadonlyTag */); }, + get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(339 /* SyntaxKind.JSDocReadonlyTag */); }, + get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(340 /* SyntaxKind.JSDocOverrideTag */); }, + get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(340 /* SyntaxKind.JSDocOverrideTag */); }, + get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(334 /* SyntaxKind.JSDocDeprecatedTag */); }, + get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(334 /* SyntaxKind.JSDocDeprecatedTag */); }, createJSDocUnknownTag: createJSDocUnknownTag, updateJSDocUnknownTag: updateJSDocUnknownTag, createJSDocText: createJSDocText, @@ -23052,11 +22973,11 @@ var ts; // don't propagate child flags. if (name) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: if (ts.isIdentifier(name)) { node.transformFlags |= propagateIdentifierNameFlags(name); break; @@ -23205,10 +23126,12 @@ var ts; node.escapedText = ts.escapeLeadingUnderscores(text); return node; } - function createBaseGeneratedIdentifier(text, autoGenerateFlags) { + function createBaseGeneratedIdentifier(text, autoGenerateFlags, prefix, suffix) { var node = createBaseIdentifier(text, /*originalKeywordKind*/ undefined); node.autoGenerateFlags = autoGenerateFlags; node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; nextAutoGenerateId++; return node; } @@ -23219,7 +23142,7 @@ var ts; // NOTE: we do not use `setChildren` here because typeArguments in an identifier do not contribute to transformations node.typeArguments = createNodeArray(typeArguments); } - if (node.originalKeywordKind === 132 /* SyntaxKind.AwaitKeyword */) { + if (node.originalKeywordKind === 133 /* SyntaxKind.AwaitKeyword */) { node.transformFlags |= 67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; } return node; @@ -23231,11 +23154,11 @@ var ts; : node; } // @api - function createTempVariable(recordTempVariable, reservedInNestedScopes) { + function createTempVariable(recordTempVariable, reservedInNestedScopes, prefix, suffix) { var flags = 1 /* GeneratedIdentifierFlags.Auto */; if (reservedInNestedScopes) flags |= 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */; - var name = createBaseGeneratedIdentifier("", flags); + var name = createBaseGeneratedIdentifier("", flags, prefix, suffix); if (recordTempVariable) { recordTempVariable(name); } @@ -23247,34 +23170,69 @@ var ts; var flags = 2 /* GeneratedIdentifierFlags.Loop */; if (reservedInNestedScopes) flags |= 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */; - return createBaseGeneratedIdentifier("", flags); + return createBaseGeneratedIdentifier("", flags, /*prefix*/ undefined, /*suffix*/ undefined); } /** Create a unique name based on the supplied text. */ // @api - function createUniqueName(text, flags) { + function createUniqueName(text, flags, prefix, suffix) { if (flags === void 0) { flags = 0 /* GeneratedIdentifierFlags.None */; } ts.Debug.assert(!(flags & 7 /* GeneratedIdentifierFlags.KindMask */), "Argument out of range: flags"); ts.Debug.assert((flags & (16 /* GeneratedIdentifierFlags.Optimistic */ | 32 /* GeneratedIdentifierFlags.FileLevel */)) !== 32 /* GeneratedIdentifierFlags.FileLevel */, "GeneratedIdentifierFlags.FileLevel cannot be set without also setting GeneratedIdentifierFlags.Optimistic"); - return createBaseGeneratedIdentifier(text, 3 /* GeneratedIdentifierFlags.Unique */ | flags); + return createBaseGeneratedIdentifier(text, 3 /* GeneratedIdentifierFlags.Unique */ | flags, prefix, suffix); } /** Create a unique name generated for a node. */ // @api - function getGeneratedNameForNode(node, flags) { + function getGeneratedNameForNode(node, flags, prefix, suffix) { if (flags === void 0) { flags = 0; } ts.Debug.assert(!(flags & 7 /* GeneratedIdentifierFlags.KindMask */), "Argument out of range: flags"); - var name = createBaseGeneratedIdentifier(node && ts.isIdentifier(node) ? ts.idText(node) : "", 4 /* GeneratedIdentifierFlags.Node */ | flags); + var text = !node ? "" : + ts.isMemberName(node) ? ts.formatGeneratedName(/*privateName*/ false, prefix, node, suffix, ts.idText) : + "generated@".concat(ts.getNodeId(node)); + if (prefix || suffix) + flags |= 16 /* GeneratedIdentifierFlags.Optimistic */; + var name = createBaseGeneratedIdentifier(text, 4 /* GeneratedIdentifierFlags.Node */ | flags, prefix, suffix); name.original = node; return name; } + function createBasePrivateIdentifier(text) { + var node = baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */); + node.escapedText = ts.escapeLeadingUnderscores(text); + node.transformFlags |= 16777216 /* TransformFlags.ContainsClassFields */; + return node; + } // @api function createPrivateIdentifier(text) { if (!ts.startsWith(text, "#")) ts.Debug.fail("First character of private identifier must be #: " + text); - var node = baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */); - node.escapedText = ts.escapeLeadingUnderscores(text); - node.transformFlags |= 16777216 /* TransformFlags.ContainsClassFields */; + return createBasePrivateIdentifier(text); + } + function createBaseGeneratedPrivateIdentifier(text, autoGenerateFlags, prefix, suffix) { + var node = createBasePrivateIdentifier(text); + node.autoGenerateFlags = autoGenerateFlags; + node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; + nextAutoGenerateId++; return node; } + /** Create a unique name based on the supplied text. */ + // @api + function createUniquePrivateName(text, prefix, suffix) { + if (text && !ts.startsWith(text, "#")) + ts.Debug.fail("First character of private identifier must be #: " + text); + var autoGenerateFlags = 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */ | + (text ? 3 /* GeneratedIdentifierFlags.Unique */ : 1 /* GeneratedIdentifierFlags.Auto */); + return createBaseGeneratedPrivateIdentifier(text !== null && text !== void 0 ? text : "", autoGenerateFlags, prefix, suffix); + } + // @api + function getGeneratedPrivateNameForNode(node, prefix, suffix) { + var text = ts.isMemberName(node) ? ts.formatGeneratedName(/*privateName*/ true, prefix, node, suffix, ts.idText) : + "#generated@".concat(ts.getNodeId(node)); + var flags = prefix || suffix ? 16 /* GeneratedIdentifierFlags.Optimistic */ : 0 /* GeneratedIdentifierFlags.None */; + var name = createBaseGeneratedPrivateIdentifier(text, 4 /* GeneratedIdentifierFlags.Node */ | flags, prefix, suffix); + name.original = node; + return name; + } // // Punctuation // @@ -23282,14 +23240,14 @@ var ts; return baseFactory.createBaseTokenNode(kind); } function createToken(token) { - ts.Debug.assert(token >= 0 /* SyntaxKind.FirstToken */ && token <= 160 /* SyntaxKind.LastToken */, "Invalid token"); + ts.Debug.assert(token >= 0 /* SyntaxKind.FirstToken */ && token <= 162 /* SyntaxKind.LastToken */, "Invalid token"); ts.Debug.assert(token <= 14 /* SyntaxKind.FirstTemplateToken */ || token >= 17 /* SyntaxKind.LastTemplateToken */, "Invalid token. Use 'createTemplateLiteralLikeNode' to create template literals."); ts.Debug.assert(token <= 8 /* SyntaxKind.FirstLiteralToken */ || token >= 14 /* SyntaxKind.LastLiteralToken */, "Invalid token. Use 'createLiteralLikeNode' to create literals."); ts.Debug.assert(token !== 79 /* SyntaxKind.Identifier */, "Invalid token. Use 'createIdentifier' to create identifiers"); var node = createBaseToken(token); var transformFlags = 0 /* TransformFlags.None */; switch (token) { - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // 'async' modifier is ES2017 (async functions) or ES2018 (async generators) transformFlags = 256 /* TransformFlags.ContainsES2017 */ | @@ -23298,24 +23256,24 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 130 /* SyntaxKind.AnyKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 145 /* SyntaxKind.OutKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: // `undefined` is an Identifier in the expression case. + case 157 /* SyntaxKind.UnknownKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: // `undefined` is an Identifier in the expression case. transformFlags = 1 /* TransformFlags.ContainsTypeScript */; break; case 106 /* SyntaxKind.SuperKeyword */: @@ -23324,6 +23282,9 @@ var ts; case 124 /* SyntaxKind.StaticKeyword */: transformFlags = 1024 /* TransformFlags.ContainsES2015 */; break; + case 127 /* SyntaxKind.AccessorKeyword */: + transformFlags = 16777216 /* TransformFlags.ContainsClassFields */; + break; case 108 /* SyntaxKind.ThisKeyword */: // 'this' indicates a lexical 'this' transformFlags = 16384 /* TransformFlags.ContainsLexicalThis */; @@ -23370,8 +23331,8 @@ var ts; if (flags & 1 /* ModifierFlags.Export */) result.push(createModifier(93 /* SyntaxKind.ExportKeyword */)); if (flags & 2 /* ModifierFlags.Ambient */) - result.push(createModifier(135 /* SyntaxKind.DeclareKeyword */)); - if (flags & 512 /* ModifierFlags.Default */) + result.push(createModifier(136 /* SyntaxKind.DeclareKeyword */)); + if (flags & 1024 /* ModifierFlags.Default */) result.push(createModifier(88 /* SyntaxKind.DefaultKeyword */)); if (flags & 2048 /* ModifierFlags.Const */) result.push(createModifier(85 /* SyntaxKind.ConstKeyword */)); @@ -23381,20 +23342,22 @@ var ts; result.push(createModifier(121 /* SyntaxKind.PrivateKeyword */)); if (flags & 16 /* ModifierFlags.Protected */) result.push(createModifier(122 /* SyntaxKind.ProtectedKeyword */)); - if (flags & 128 /* ModifierFlags.Abstract */) + if (flags & 256 /* ModifierFlags.Abstract */) result.push(createModifier(126 /* SyntaxKind.AbstractKeyword */)); if (flags & 32 /* ModifierFlags.Static */) result.push(createModifier(124 /* SyntaxKind.StaticKeyword */)); if (flags & 16384 /* ModifierFlags.Override */) - result.push(createModifier(159 /* SyntaxKind.OverrideKeyword */)); + result.push(createModifier(161 /* SyntaxKind.OverrideKeyword */)); if (flags & 64 /* ModifierFlags.Readonly */) - result.push(createModifier(145 /* SyntaxKind.ReadonlyKeyword */)); - if (flags & 256 /* ModifierFlags.Async */) - result.push(createModifier(131 /* SyntaxKind.AsyncKeyword */)); + result.push(createModifier(146 /* SyntaxKind.ReadonlyKeyword */)); + if (flags & 128 /* ModifierFlags.Accessor */) + result.push(createModifier(127 /* SyntaxKind.AccessorKeyword */)); + if (flags & 512 /* ModifierFlags.Async */) + result.push(createModifier(132 /* SyntaxKind.AsyncKeyword */)); if (flags & 32768 /* ModifierFlags.In */) result.push(createModifier(101 /* SyntaxKind.InKeyword */)); if (flags & 65536 /* ModifierFlags.Out */) - result.push(createModifier(144 /* SyntaxKind.OutKeyword */)); + result.push(createModifier(145 /* SyntaxKind.OutKeyword */)); return result.length ? result : undefined; } // @@ -23402,7 +23365,7 @@ var ts; // // @api function createQualifiedName(left, right) { - var node = createBaseNode(161 /* SyntaxKind.QualifiedName */); + var node = createBaseNode(163 /* SyntaxKind.QualifiedName */); node.left = left; node.right = asName(right); node.transformFlags |= @@ -23419,7 +23382,7 @@ var ts; } // @api function createComputedPropertyName(expression) { - var node = createBaseNode(162 /* SyntaxKind.ComputedPropertyName */); + var node = createBaseNode(164 /* SyntaxKind.ComputedPropertyName */); node.expression = parenthesizerRules().parenthesizeExpressionOfComputedPropertyName(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -23438,7 +23401,7 @@ var ts; // // @api function createTypeParameterDeclaration(modifiers, name, constraint, defaultType) { - var node = createBaseNamedDeclaration(163 /* SyntaxKind.TypeParameter */, modifiers, name); + var node = createBaseNamedDeclaration(165 /* SyntaxKind.TypeParameter */, modifiers, name); node.constraint = constraint; node.default = defaultType; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23455,7 +23418,7 @@ var ts; } // @api function createParameterDeclaration(modifiers, dotDotDotToken, name, questionToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(164 /* SyntaxKind.Parameter */, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); + var node = createBaseVariableLikeDeclaration(166 /* SyntaxKind.Parameter */, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.dotDotDotToken = dotDotDotToken; node.questionToken = questionToken; if (ts.isThisIdentifier(node.name)) { @@ -23487,7 +23450,7 @@ var ts; } // @api function createDecorator(expression) { - var node = createBaseNode(165 /* SyntaxKind.Decorator */); + var node = createBaseNode(167 /* SyntaxKind.Decorator */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.transformFlags |= propagateChildFlags(node.expression) | @@ -23507,7 +23470,7 @@ var ts; // // @api function createPropertySignature(modifiers, name, questionToken, type) { - var node = createBaseNamedDeclaration(166 /* SyntaxKind.PropertySignature */, modifiers, name); + var node = createBaseNamedDeclaration(168 /* SyntaxKind.PropertySignature */, modifiers, name); node.type = type; node.questionToken = questionToken; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23533,7 +23496,7 @@ var ts; } // @api function createPropertyDeclaration(modifiers, name, questionOrExclamationToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(167 /* SyntaxKind.PropertyDeclaration */, modifiers, name, type, initializer); + var node = createBaseVariableLikeDeclaration(169 /* SyntaxKind.PropertyDeclaration */, modifiers, name, type, initializer); node.questionToken = questionOrExclamationToken && ts.isQuestionToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.exclamationToken = questionOrExclamationToken && ts.isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.transformFlags |= @@ -23561,7 +23524,7 @@ var ts; } // @api function createMethodSignature(modifiers, name, questionToken, typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(168 /* SyntaxKind.MethodSignature */, modifiers, name, typeParameters, parameters, type); + var node = createBaseSignatureDeclaration(170 /* SyntaxKind.MethodSignature */, modifiers, name, typeParameters, parameters, type); node.questionToken = questionToken; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23579,7 +23542,7 @@ var ts; } // @api function createMethodDeclaration(modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(169 /* SyntaxKind.MethodDeclaration */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(171 /* SyntaxKind.MethodDeclaration */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; node.questionToken = questionToken; node.transformFlags |= @@ -23589,7 +23552,7 @@ var ts; if (questionToken) { node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; } - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -23625,7 +23588,7 @@ var ts; } // @api function createClassStaticBlockDeclaration(body) { - var node = createBaseGenericNamedDeclaration(170 /* SyntaxKind.ClassStaticBlockDeclaration */, + var node = createBaseGenericNamedDeclaration(172 /* SyntaxKind.ClassStaticBlockDeclaration */, /*modifiers*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined); @@ -23651,7 +23614,7 @@ var ts; } // @api function createConstructorDeclaration(modifiers, parameters, body) { - var node = createBaseFunctionLikeDeclaration(171 /* SyntaxKind.Constructor */, modifiers, + var node = createBaseFunctionLikeDeclaration(173 /* SyntaxKind.Constructor */, modifiers, /*name*/ undefined, /*typeParameters*/ undefined, parameters, /*type*/ undefined, body); @@ -23680,7 +23643,7 @@ var ts; } // @api function createGetAccessorDeclaration(modifiers, name, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(172 /* SyntaxKind.GetAccessor */, modifiers, name, + var node = createBaseFunctionLikeDeclaration(174 /* SyntaxKind.GetAccessor */, modifiers, name, /*typeParameters*/ undefined, parameters, type, body); // The following properties are used only to report grammar errors node.typeParameters = undefined; @@ -23704,7 +23667,7 @@ var ts; } // @api function createSetAccessorDeclaration(modifiers, name, parameters, body) { - var node = createBaseFunctionLikeDeclaration(173 /* SyntaxKind.SetAccessor */, modifiers, name, + var node = createBaseFunctionLikeDeclaration(175 /* SyntaxKind.SetAccessor */, modifiers, name, /*typeParameters*/ undefined, parameters, /*type*/ undefined, body); // The following properties are used only to report grammar errors @@ -23730,7 +23693,7 @@ var ts; } // @api function createCallSignature(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(174 /* SyntaxKind.CallSignature */, + var node = createBaseSignatureDeclaration(176 /* SyntaxKind.CallSignature */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23746,7 +23709,7 @@ var ts; } // @api function createConstructSignature(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(175 /* SyntaxKind.ConstructSignature */, + var node = createBaseSignatureDeclaration(177 /* SyntaxKind.ConstructSignature */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23762,7 +23725,7 @@ var ts; } // @api function createIndexSignature(modifiers, parameters, type) { - var node = createBaseSignatureDeclaration(176 /* SyntaxKind.IndexSignature */, modifiers, + var node = createBaseSignatureDeclaration(178 /* SyntaxKind.IndexSignature */, modifiers, /*name*/ undefined, /*typeParameters*/ undefined, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23778,7 +23741,7 @@ var ts; } // @api function createTemplateLiteralTypeSpan(type, literal) { - var node = createBaseNode(199 /* SyntaxKind.TemplateLiteralTypeSpan */); + var node = createBaseNode(201 /* SyntaxKind.TemplateLiteralTypeSpan */); node.type = type; node.literal = literal; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23800,7 +23763,7 @@ var ts; } // @api function createTypePredicateNode(assertsModifier, parameterName, type) { - var node = createBaseNode(177 /* SyntaxKind.TypePredicate */); + var node = createBaseNode(179 /* SyntaxKind.TypePredicate */); node.assertsModifier = assertsModifier; node.parameterName = asName(parameterName); node.type = type; @@ -23817,7 +23780,7 @@ var ts; } // @api function createTypeReferenceNode(typeName, typeArguments) { - var node = createBaseNode(178 /* SyntaxKind.TypeReference */); + var node = createBaseNode(180 /* SyntaxKind.TypeReference */); node.typeName = asName(typeName); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(createNodeArray(typeArguments)); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23832,7 +23795,7 @@ var ts; } // @api function createFunctionTypeNode(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(179 /* SyntaxKind.FunctionType */, + var node = createBaseSignatureDeclaration(181 /* SyntaxKind.FunctionType */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23865,7 +23828,7 @@ var ts; ts.Debug.fail("Incorrect number of arguments specified."); } function createConstructorTypeNode1(modifiers, typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(180 /* SyntaxKind.ConstructorType */, modifiers, + var node = createBaseSignatureDeclaration(182 /* SyntaxKind.ConstructorType */, modifiers, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23898,7 +23861,7 @@ var ts; } // @api function createTypeQueryNode(exprName, typeArguments) { - var node = createBaseNode(181 /* SyntaxKind.TypeQuery */); + var node = createBaseNode(183 /* SyntaxKind.TypeQuery */); node.exprName = exprName; node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23913,7 +23876,7 @@ var ts; } // @api function createTypeLiteralNode(members) { - var node = createBaseNode(182 /* SyntaxKind.TypeLiteral */); + var node = createBaseNode(184 /* SyntaxKind.TypeLiteral */); node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23926,7 +23889,7 @@ var ts; } // @api function createArrayTypeNode(elementType) { - var node = createBaseNode(183 /* SyntaxKind.ArrayType */); + var node = createBaseNode(185 /* SyntaxKind.ArrayType */); node.elementType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(elementType); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23939,7 +23902,7 @@ var ts; } // @api function createTupleTypeNode(elements) { - var node = createBaseNode(184 /* SyntaxKind.TupleType */); + var node = createBaseNode(186 /* SyntaxKind.TupleType */); node.elements = createNodeArray(parenthesizerRules().parenthesizeElementTypesOfTupleType(elements)); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23952,7 +23915,7 @@ var ts; } // @api function createNamedTupleMember(dotDotDotToken, name, questionToken, type) { - var node = createBaseNode(197 /* SyntaxKind.NamedTupleMember */); + var node = createBaseNode(199 /* SyntaxKind.NamedTupleMember */); node.dotDotDotToken = dotDotDotToken; node.name = name; node.questionToken = questionToken; @@ -23971,7 +23934,7 @@ var ts; } // @api function createOptionalTypeNode(type) { - var node = createBaseNode(185 /* SyntaxKind.OptionalType */); + var node = createBaseNode(187 /* SyntaxKind.OptionalType */); node.type = parenthesizerRules().parenthesizeTypeOfOptionalType(type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23984,7 +23947,7 @@ var ts; } // @api function createRestTypeNode(type) { - var node = createBaseNode(186 /* SyntaxKind.RestType */); + var node = createBaseNode(188 /* SyntaxKind.RestType */); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -24008,7 +23971,7 @@ var ts; } // @api function createUnionTypeNode(types) { - return createUnionOrIntersectionTypeNode(187 /* SyntaxKind.UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); + return createUnionOrIntersectionTypeNode(189 /* SyntaxKind.UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); } // @api function updateUnionTypeNode(node, types) { @@ -24016,7 +23979,7 @@ var ts; } // @api function createIntersectionTypeNode(types) { - return createUnionOrIntersectionTypeNode(188 /* SyntaxKind.IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); + return createUnionOrIntersectionTypeNode(190 /* SyntaxKind.IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); } // @api function updateIntersectionTypeNode(node, types) { @@ -24024,7 +23987,7 @@ var ts; } // @api function createConditionalTypeNode(checkType, extendsType, trueType, falseType) { - var node = createBaseNode(189 /* SyntaxKind.ConditionalType */); + var node = createBaseNode(191 /* SyntaxKind.ConditionalType */); node.checkType = parenthesizerRules().parenthesizeCheckTypeOfConditionalType(checkType); node.extendsType = parenthesizerRules().parenthesizeExtendsTypeOfConditionalType(extendsType); node.trueType = trueType; @@ -24043,7 +24006,7 @@ var ts; } // @api function createInferTypeNode(typeParameter) { - var node = createBaseNode(190 /* SyntaxKind.InferType */); + var node = createBaseNode(192 /* SyntaxKind.InferType */); node.typeParameter = typeParameter; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -24056,7 +24019,7 @@ var ts; } // @api function createTemplateLiteralType(head, templateSpans) { - var node = createBaseNode(198 /* SyntaxKind.TemplateLiteralType */); + var node = createBaseNode(200 /* SyntaxKind.TemplateLiteralType */); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -24072,7 +24035,7 @@ var ts; // @api function createImportTypeNode(argument, assertions, qualifier, typeArguments, isTypeOf) { if (isTypeOf === void 0) { isTypeOf = false; } - var node = createBaseNode(200 /* SyntaxKind.ImportType */); + var node = createBaseNode(202 /* SyntaxKind.ImportType */); node.argument = argument; node.assertions = assertions; node.qualifier = qualifier; @@ -24094,7 +24057,7 @@ var ts; } // @api function createParenthesizedType(type) { - var node = createBaseNode(191 /* SyntaxKind.ParenthesizedType */); + var node = createBaseNode(193 /* SyntaxKind.ParenthesizedType */); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -24107,15 +24070,15 @@ var ts; } // @api function createThisTypeNode() { - var node = createBaseNode(192 /* SyntaxKind.ThisType */); + var node = createBaseNode(194 /* SyntaxKind.ThisType */); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; } // @api function createTypeOperatorNode(operator, type) { - var node = createBaseNode(193 /* SyntaxKind.TypeOperator */); + var node = createBaseNode(195 /* SyntaxKind.TypeOperator */); node.operator = operator; - node.type = operator === 145 /* SyntaxKind.ReadonlyKeyword */ ? + node.type = operator === 146 /* SyntaxKind.ReadonlyKeyword */ ? parenthesizerRules().parenthesizeOperandOfReadonlyTypeOperator(type) : parenthesizerRules().parenthesizeOperandOfTypeOperator(type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -24129,7 +24092,7 @@ var ts; } // @api function createIndexedAccessTypeNode(objectType, indexType) { - var node = createBaseNode(194 /* SyntaxKind.IndexedAccessType */); + var node = createBaseNode(196 /* SyntaxKind.IndexedAccessType */); node.objectType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(objectType); node.indexType = indexType; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -24144,7 +24107,7 @@ var ts; } // @api function createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members) { - var node = createBaseNode(195 /* SyntaxKind.MappedType */); + var node = createBaseNode(197 /* SyntaxKind.MappedType */); node.readonlyToken = readonlyToken; node.typeParameter = typeParameter; node.nameType = nameType; @@ -24167,7 +24130,7 @@ var ts; } // @api function createLiteralTypeNode(literal) { - var node = createBaseNode(196 /* SyntaxKind.LiteralType */); + var node = createBaseNode(198 /* SyntaxKind.LiteralType */); node.literal = literal; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -24183,7 +24146,7 @@ var ts; // // @api function createObjectBindingPattern(elements) { - var node = createBaseNode(201 /* SyntaxKind.ObjectBindingPattern */); + var node = createBaseNode(203 /* SyntaxKind.ObjectBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | @@ -24204,7 +24167,7 @@ var ts; } // @api function createArrayBindingPattern(elements) { - var node = createBaseNode(202 /* SyntaxKind.ArrayBindingPattern */); + var node = createBaseNode(204 /* SyntaxKind.ArrayBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | @@ -24220,7 +24183,7 @@ var ts; } // @api function createBindingElement(dotDotDotToken, propertyName, name, initializer) { - var node = createBaseBindingLikeDeclaration(203 /* SyntaxKind.BindingElement */, + var node = createBaseBindingLikeDeclaration(205 /* SyntaxKind.BindingElement */, /*modifiers*/ undefined, name, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.propertyName = asName(propertyName); node.dotDotDotToken = dotDotDotToken; @@ -24255,7 +24218,7 @@ var ts; } // @api function createArrayLiteralExpression(elements, multiLine) { - var node = createBaseExpression(204 /* SyntaxKind.ArrayLiteralExpression */); + var node = createBaseExpression(206 /* SyntaxKind.ArrayLiteralExpression */); // Ensure we add a trailing comma for something like `[NumericLiteral(1), NumericLiteral(2), OmittedExpresion]` so that // we end up with `[1, 2, ,]` instead of `[1, 2, ]` otherwise the `OmittedExpression` will just end up being treated like // a trailing comma. @@ -24274,7 +24237,7 @@ var ts; } // @api function createObjectLiteralExpression(properties, multiLine) { - var node = createBaseExpression(205 /* SyntaxKind.ObjectLiteralExpression */); + var node = createBaseExpression(207 /* SyntaxKind.ObjectLiteralExpression */); node.properties = createNodeArray(properties); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.properties); @@ -24288,7 +24251,7 @@ var ts; } // @api function createPropertyAccessExpression(expression, name) { - var node = createBaseExpression(206 /* SyntaxKind.PropertyAccessExpression */); + var node = createBaseExpression(208 /* SyntaxKind.PropertyAccessExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.name = asName(name); node.transformFlags = @@ -24317,7 +24280,7 @@ var ts; } // @api function createPropertyAccessChain(expression, questionDotToken, name) { - var node = createBaseExpression(206 /* SyntaxKind.PropertyAccessExpression */); + var node = createBaseExpression(208 /* SyntaxKind.PropertyAccessExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24344,7 +24307,7 @@ var ts; } // @api function createElementAccessExpression(expression, index) { - var node = createBaseExpression(207 /* SyntaxKind.ElementAccessExpression */); + var node = createBaseExpression(209 /* SyntaxKind.ElementAccessExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.argumentExpression = asExpression(index); node.transformFlags |= @@ -24371,7 +24334,7 @@ var ts; } // @api function createElementAccessChain(expression, questionDotToken, index) { - var node = createBaseExpression(207 /* SyntaxKind.ElementAccessExpression */); + var node = createBaseExpression(209 /* SyntaxKind.ElementAccessExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24396,7 +24359,7 @@ var ts; } // @api function createCallExpression(expression, typeArguments, argumentsArray) { - var node = createBaseExpression(208 /* SyntaxKind.CallExpression */); + var node = createBaseExpression(210 /* SyntaxKind.CallExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.typeArguments = asNodeArray(typeArguments); node.arguments = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(createNodeArray(argumentsArray)); @@ -24428,7 +24391,7 @@ var ts; } // @api function createCallChain(expression, questionDotToken, typeArguments, argumentsArray) { - var node = createBaseExpression(208 /* SyntaxKind.CallExpression */); + var node = createBaseExpression(210 /* SyntaxKind.CallExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24460,7 +24423,7 @@ var ts; } // @api function createNewExpression(expression, typeArguments, argumentsArray) { - var node = createBaseExpression(209 /* SyntaxKind.NewExpression */); + var node = createBaseExpression(211 /* SyntaxKind.NewExpression */); node.expression = parenthesizerRules().parenthesizeExpressionOfNew(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = argumentsArray ? parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(argumentsArray) : undefined; @@ -24484,7 +24447,7 @@ var ts; } // @api function createTaggedTemplateExpression(tag, typeArguments, template) { - var node = createBaseExpression(210 /* SyntaxKind.TaggedTemplateExpression */); + var node = createBaseExpression(212 /* SyntaxKind.TaggedTemplateExpression */); node.tag = parenthesizerRules().parenthesizeLeftSideOfAccess(tag, /*optionalChain*/ false); node.typeArguments = asNodeArray(typeArguments); node.template = template; @@ -24511,7 +24474,7 @@ var ts; } // @api function createTypeAssertion(type, expression) { - var node = createBaseExpression(211 /* SyntaxKind.TypeAssertionExpression */); + var node = createBaseExpression(213 /* SyntaxKind.TypeAssertionExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.type = type; node.transformFlags |= @@ -24529,7 +24492,7 @@ var ts; } // @api function createParenthesizedExpression(expression) { - var node = createBaseExpression(212 /* SyntaxKind.ParenthesizedExpression */); + var node = createBaseExpression(214 /* SyntaxKind.ParenthesizedExpression */); node.expression = expression; node.transformFlags = propagateChildFlags(node.expression); return node; @@ -24542,13 +24505,13 @@ var ts; } // @api function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(213 /* SyntaxKind.FunctionExpression */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(215 /* SyntaxKind.FunctionExpression */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; node.transformFlags |= propagateChildFlags(node.asteriskToken); if (node.typeParameters) { node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; } - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (node.asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -24575,13 +24538,13 @@ var ts; } // @api function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { - var node = createBaseFunctionLikeDeclaration(214 /* SyntaxKind.ArrowFunction */, modifiers, + var node = createBaseFunctionLikeDeclaration(216 /* SyntaxKind.ArrowFunction */, modifiers, /*name*/ undefined, typeParameters, parameters, type, parenthesizerRules().parenthesizeConciseBodyOfArrowFunction(body)); node.equalsGreaterThanToken = equalsGreaterThanToken !== null && equalsGreaterThanToken !== void 0 ? equalsGreaterThanToken : createToken(38 /* SyntaxKind.EqualsGreaterThanToken */); node.transformFlags |= propagateChildFlags(node.equalsGreaterThanToken) | 1024 /* TransformFlags.ContainsES2015 */; - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { node.transformFlags |= 256 /* TransformFlags.ContainsES2017 */ | 16384 /* TransformFlags.ContainsLexicalThis */; } return node; @@ -24599,7 +24562,7 @@ var ts; } // @api function createDeleteExpression(expression) { - var node = createBaseExpression(215 /* SyntaxKind.DeleteExpression */); + var node = createBaseExpression(217 /* SyntaxKind.DeleteExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24612,7 +24575,7 @@ var ts; } // @api function createTypeOfExpression(expression) { - var node = createBaseExpression(216 /* SyntaxKind.TypeOfExpression */); + var node = createBaseExpression(218 /* SyntaxKind.TypeOfExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24625,7 +24588,7 @@ var ts; } // @api function createVoidExpression(expression) { - var node = createBaseExpression(217 /* SyntaxKind.VoidExpression */); + var node = createBaseExpression(219 /* SyntaxKind.VoidExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24638,7 +24601,7 @@ var ts; } // @api function createAwaitExpression(expression) { - var node = createBaseExpression(218 /* SyntaxKind.AwaitExpression */); + var node = createBaseExpression(220 /* SyntaxKind.AwaitExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24655,7 +24618,7 @@ var ts; } // @api function createPrefixUnaryExpression(operator, operand) { - var node = createBaseExpression(219 /* SyntaxKind.PrefixUnaryExpression */); + var node = createBaseExpression(221 /* SyntaxKind.PrefixUnaryExpression */); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPrefixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -24677,7 +24640,7 @@ var ts; } // @api function createPostfixUnaryExpression(operand, operator) { - var node = createBaseExpression(220 /* SyntaxKind.PostfixUnaryExpression */); + var node = createBaseExpression(222 /* SyntaxKind.PostfixUnaryExpression */); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPostfixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -24698,7 +24661,7 @@ var ts; } // @api function createBinaryExpression(left, operator, right) { - var node = createBaseExpression(221 /* SyntaxKind.BinaryExpression */); + var node = createBaseExpression(223 /* SyntaxKind.BinaryExpression */); var operatorToken = asToken(operator); var operatorKind = operatorToken.kind; node.left = parenthesizerRules().parenthesizeLeftSideOfBinary(operatorKind, left); @@ -24770,7 +24733,7 @@ var ts; } // @api function createConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse) { - var node = createBaseExpression(222 /* SyntaxKind.ConditionalExpression */); + var node = createBaseExpression(224 /* SyntaxKind.ConditionalExpression */); node.condition = parenthesizerRules().parenthesizeConditionOfConditionalExpression(condition); node.questionToken = questionToken !== null && questionToken !== void 0 ? questionToken : createToken(57 /* SyntaxKind.QuestionToken */); node.whenTrue = parenthesizerRules().parenthesizeBranchOfConditionalExpression(whenTrue); @@ -24796,7 +24759,7 @@ var ts; } // @api function createTemplateExpression(head, templateSpans) { - var node = createBaseExpression(223 /* SyntaxKind.TemplateExpression */); + var node = createBaseExpression(225 /* SyntaxKind.TemplateExpression */); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags |= @@ -24866,7 +24829,7 @@ var ts; // @api function createYieldExpression(asteriskToken, expression) { ts.Debug.assert(!asteriskToken || !!expression, "A `YieldExpression` with an asteriskToken must have an expression."); - var node = createBaseExpression(224 /* SyntaxKind.YieldExpression */); + var node = createBaseExpression(226 /* SyntaxKind.YieldExpression */); node.expression = expression && parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.asteriskToken = asteriskToken; node.transformFlags |= @@ -24886,7 +24849,7 @@ var ts; } // @api function createSpreadElement(expression) { - var node = createBaseExpression(225 /* SyntaxKind.SpreadElement */); + var node = createBaseExpression(227 /* SyntaxKind.SpreadElement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24902,7 +24865,7 @@ var ts; } // @api function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseClassLikeDeclaration(226 /* SyntaxKind.ClassExpression */, modifiers, name, typeParameters, heritageClauses, members); + var node = createBaseClassLikeDeclaration(228 /* SyntaxKind.ClassExpression */, modifiers, name, typeParameters, heritageClauses, members); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; return node; } @@ -24918,11 +24881,11 @@ var ts; } // @api function createOmittedExpression() { - return createBaseExpression(227 /* SyntaxKind.OmittedExpression */); + return createBaseExpression(229 /* SyntaxKind.OmittedExpression */); } // @api function createExpressionWithTypeArguments(expression, typeArguments) { - var node = createBaseNode(228 /* SyntaxKind.ExpressionWithTypeArguments */); + var node = createBaseNode(230 /* SyntaxKind.ExpressionWithTypeArguments */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags |= @@ -24940,7 +24903,7 @@ var ts; } // @api function createAsExpression(expression, type) { - var node = createBaseExpression(229 /* SyntaxKind.AsExpression */); + var node = createBaseExpression(231 /* SyntaxKind.AsExpression */); node.expression = expression; node.type = type; node.transformFlags |= @@ -24958,7 +24921,7 @@ var ts; } // @api function createNonNullExpression(expression) { - var node = createBaseExpression(230 /* SyntaxKind.NonNullExpression */); + var node = createBaseExpression(232 /* SyntaxKind.NonNullExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24975,8 +24938,26 @@ var ts; : node; } // @api + function createSatisfiesExpression(expression, type) { + var node = createBaseExpression(235 /* SyntaxKind.SatisfiesExpression */); + node.expression = expression; + node.type = type; + node.transformFlags |= + propagateChildFlags(node.expression) | + propagateChildFlags(node.type) | + 1 /* TransformFlags.ContainsTypeScript */; + return node; + } + // @api + function updateSatisfiesExpression(node, expression, type) { + return node.expression !== expression + || node.type !== type + ? update(createSatisfiesExpression(expression, type), node) + : node; + } + // @api function createNonNullChain(expression) { - var node = createBaseExpression(230 /* SyntaxKind.NonNullExpression */); + var node = createBaseExpression(232 /* SyntaxKind.NonNullExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.transformFlags |= @@ -24993,7 +24974,7 @@ var ts; } // @api function createMetaProperty(keywordToken, name) { - var node = createBaseExpression(231 /* SyntaxKind.MetaProperty */); + var node = createBaseExpression(233 /* SyntaxKind.MetaProperty */); node.keywordToken = keywordToken; node.name = name; node.transformFlags |= propagateChildFlags(node.name); @@ -25020,7 +25001,7 @@ var ts; // // @api function createTemplateSpan(expression, literal) { - var node = createBaseNode(233 /* SyntaxKind.TemplateSpan */); + var node = createBaseNode(236 /* SyntaxKind.TemplateSpan */); node.expression = expression; node.literal = literal; node.transformFlags |= @@ -25038,7 +25019,7 @@ var ts; } // @api function createSemicolonClassElement() { - var node = createBaseNode(234 /* SyntaxKind.SemicolonClassElement */); + var node = createBaseNode(237 /* SyntaxKind.SemicolonClassElement */); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; return node; } @@ -25047,7 +25028,7 @@ var ts; // // @api function createBlock(statements, multiLine) { - var node = createBaseNode(235 /* SyntaxKind.Block */); + var node = createBaseNode(238 /* SyntaxKind.Block */); node.statements = createNodeArray(statements); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.statements); @@ -25061,7 +25042,7 @@ var ts; } // @api function createVariableStatement(modifiers, declarationList) { - var node = createBaseDeclaration(237 /* SyntaxKind.VariableStatement */); + var node = createBaseDeclaration(240 /* SyntaxKind.VariableStatement */); node.modifiers = asNodeArray(modifiers); node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; node.transformFlags |= @@ -25081,11 +25062,11 @@ var ts; } // @api function createEmptyStatement() { - return createBaseNode(236 /* SyntaxKind.EmptyStatement */); + return createBaseNode(239 /* SyntaxKind.EmptyStatement */); } // @api function createExpressionStatement(expression) { - var node = createBaseNode(238 /* SyntaxKind.ExpressionStatement */); + var node = createBaseNode(241 /* SyntaxKind.ExpressionStatement */); node.expression = parenthesizerRules().parenthesizeExpressionOfExpressionStatement(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -25098,7 +25079,7 @@ var ts; } // @api function createIfStatement(expression, thenStatement, elseStatement) { - var node = createBaseNode(239 /* SyntaxKind.IfStatement */); + var node = createBaseNode(242 /* SyntaxKind.IfStatement */); node.expression = expression; node.thenStatement = asEmbeddedStatement(thenStatement); node.elseStatement = asEmbeddedStatement(elseStatement); @@ -25118,7 +25099,7 @@ var ts; } // @api function createDoStatement(statement, expression) { - var node = createBaseNode(240 /* SyntaxKind.DoStatement */); + var node = createBaseNode(243 /* SyntaxKind.DoStatement */); node.statement = asEmbeddedStatement(statement); node.expression = expression; node.transformFlags |= @@ -25135,7 +25116,7 @@ var ts; } // @api function createWhileStatement(expression, statement) { - var node = createBaseNode(241 /* SyntaxKind.WhileStatement */); + var node = createBaseNode(244 /* SyntaxKind.WhileStatement */); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -25152,7 +25133,7 @@ var ts; } // @api function createForStatement(initializer, condition, incrementor, statement) { - var node = createBaseNode(242 /* SyntaxKind.ForStatement */); + var node = createBaseNode(245 /* SyntaxKind.ForStatement */); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -25175,7 +25156,7 @@ var ts; } // @api function createForInStatement(initializer, expression, statement) { - var node = createBaseNode(243 /* SyntaxKind.ForInStatement */); + var node = createBaseNode(246 /* SyntaxKind.ForInStatement */); node.initializer = initializer; node.expression = expression; node.statement = asEmbeddedStatement(statement); @@ -25195,7 +25176,7 @@ var ts; } // @api function createForOfStatement(awaitModifier, initializer, expression, statement) { - var node = createBaseNode(244 /* SyntaxKind.ForOfStatement */); + var node = createBaseNode(247 /* SyntaxKind.ForOfStatement */); node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); @@ -25221,7 +25202,7 @@ var ts; } // @api function createContinueStatement(label) { - var node = createBaseNode(245 /* SyntaxKind.ContinueStatement */); + var node = createBaseNode(248 /* SyntaxKind.ContinueStatement */); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | @@ -25236,7 +25217,7 @@ var ts; } // @api function createBreakStatement(label) { - var node = createBaseNode(246 /* SyntaxKind.BreakStatement */); + var node = createBaseNode(249 /* SyntaxKind.BreakStatement */); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | @@ -25251,7 +25232,7 @@ var ts; } // @api function createReturnStatement(expression) { - var node = createBaseNode(247 /* SyntaxKind.ReturnStatement */); + var node = createBaseNode(250 /* SyntaxKind.ReturnStatement */); node.expression = expression; // return in an ES2018 async generator must be awaited node.transformFlags |= @@ -25268,7 +25249,7 @@ var ts; } // @api function createWithStatement(expression, statement) { - var node = createBaseNode(248 /* SyntaxKind.WithStatement */); + var node = createBaseNode(251 /* SyntaxKind.WithStatement */); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -25285,7 +25266,7 @@ var ts; } // @api function createSwitchStatement(expression, caseBlock) { - var node = createBaseNode(249 /* SyntaxKind.SwitchStatement */); + var node = createBaseNode(252 /* SyntaxKind.SwitchStatement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.caseBlock = caseBlock; node.transformFlags |= @@ -25302,7 +25283,7 @@ var ts; } // @api function createLabeledStatement(label, statement) { - var node = createBaseNode(250 /* SyntaxKind.LabeledStatement */); + var node = createBaseNode(253 /* SyntaxKind.LabeledStatement */); node.label = asName(label); node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -25319,7 +25300,7 @@ var ts; } // @api function createThrowStatement(expression) { - var node = createBaseNode(251 /* SyntaxKind.ThrowStatement */); + var node = createBaseNode(254 /* SyntaxKind.ThrowStatement */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -25332,7 +25313,7 @@ var ts; } // @api function createTryStatement(tryBlock, catchClause, finallyBlock) { - var node = createBaseNode(252 /* SyntaxKind.TryStatement */); + var node = createBaseNode(255 /* SyntaxKind.TryStatement */); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -25352,11 +25333,11 @@ var ts; } // @api function createDebuggerStatement() { - return createBaseNode(253 /* SyntaxKind.DebuggerStatement */); + return createBaseNode(256 /* SyntaxKind.DebuggerStatement */); } // @api function createVariableDeclaration(name, exclamationToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(254 /* SyntaxKind.VariableDeclaration */, + var node = createBaseVariableLikeDeclaration(257 /* SyntaxKind.VariableDeclaration */, /*modifiers*/ undefined, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.exclamationToken = exclamationToken; node.transformFlags |= propagateChildFlags(node.exclamationToken); @@ -25377,7 +25358,7 @@ var ts; // @api function createVariableDeclarationList(declarations, flags) { if (flags === void 0) { flags = 0 /* NodeFlags.None */; } - var node = createBaseNode(255 /* SyntaxKind.VariableDeclarationList */); + var node = createBaseNode(258 /* SyntaxKind.VariableDeclarationList */); node.flags |= flags & 3 /* NodeFlags.BlockScoped */; node.declarations = createNodeArray(declarations); node.transformFlags |= @@ -25398,7 +25379,7 @@ var ts; } // @api function createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(256 /* SyntaxKind.FunctionDeclaration */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(259 /* SyntaxKind.FunctionDeclaration */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; if (!node.body || ts.modifiersToFlags(node.modifiers) & 2 /* ModifierFlags.Ambient */) { node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -25407,7 +25388,7 @@ var ts; node.transformFlags |= propagateChildFlags(node.asteriskToken) | 4194304 /* TransformFlags.ContainsHoistedDeclarationOrCompletion */; - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (node.asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -25444,7 +25425,7 @@ var ts; } // @api function createClassDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseClassLikeDeclaration(257 /* SyntaxKind.ClassDeclaration */, modifiers, name, typeParameters, heritageClauses, members); + var node = createBaseClassLikeDeclaration(260 /* SyntaxKind.ClassDeclaration */, modifiers, name, typeParameters, heritageClauses, members); if (ts.modifiersToFlags(node.modifiers) & 2 /* ModifierFlags.Ambient */) { node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; } @@ -25468,7 +25449,7 @@ var ts; } // @api function createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseInterfaceOrClassLikeDeclaration(258 /* SyntaxKind.InterfaceDeclaration */, modifiers, name, typeParameters, heritageClauses); + var node = createBaseInterfaceOrClassLikeDeclaration(261 /* SyntaxKind.InterfaceDeclaration */, modifiers, name, typeParameters, heritageClauses); node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25493,7 +25474,7 @@ var ts; } // @api function createTypeAliasDeclaration(modifiers, name, typeParameters, type) { - var node = createBaseGenericNamedDeclaration(259 /* SyntaxKind.TypeAliasDeclaration */, modifiers, name, typeParameters); + var node = createBaseGenericNamedDeclaration(262 /* SyntaxKind.TypeAliasDeclaration */, modifiers, name, typeParameters); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25517,7 +25498,7 @@ var ts; } // @api function createEnumDeclaration(modifiers, name, members) { - var node = createBaseNamedDeclaration(260 /* SyntaxKind.EnumDeclaration */, modifiers, name); + var node = createBaseNamedDeclaration(263 /* SyntaxKind.EnumDeclaration */, modifiers, name); node.members = createNodeArray(members); node.transformFlags |= propagateChildrenFlags(node.members) | @@ -25544,7 +25525,7 @@ var ts; // @api function createModuleDeclaration(modifiers, name, body, flags) { if (flags === void 0) { flags = 0 /* NodeFlags.None */; } - var node = createBaseDeclaration(261 /* SyntaxKind.ModuleDeclaration */); + var node = createBaseDeclaration(264 /* SyntaxKind.ModuleDeclaration */); node.modifiers = asNodeArray(modifiers); node.flags |= flags & (16 /* NodeFlags.Namespace */ | 4 /* NodeFlags.NestedNamespace */ | 1024 /* NodeFlags.GlobalAugmentation */); node.name = name; @@ -25580,7 +25561,7 @@ var ts; } // @api function createModuleBlock(statements) { - var node = createBaseNode(262 /* SyntaxKind.ModuleBlock */); + var node = createBaseNode(265 /* SyntaxKind.ModuleBlock */); node.statements = createNodeArray(statements); node.transformFlags |= propagateChildrenFlags(node.statements); return node; @@ -25593,7 +25574,7 @@ var ts; } // @api function createCaseBlock(clauses) { - var node = createBaseNode(263 /* SyntaxKind.CaseBlock */); + var node = createBaseNode(266 /* SyntaxKind.CaseBlock */); node.clauses = createNodeArray(clauses); node.transformFlags |= propagateChildrenFlags(node.clauses); return node; @@ -25606,7 +25587,7 @@ var ts; } // @api function createNamespaceExportDeclaration(name) { - var node = createBaseNamedDeclaration(264 /* SyntaxKind.NamespaceExportDeclaration */, + var node = createBaseNamedDeclaration(267 /* SyntaxKind.NamespaceExportDeclaration */, /*modifiers*/ undefined, name); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25629,7 +25610,7 @@ var ts; } // @api function createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference) { - var node = createBaseNamedDeclaration(265 /* SyntaxKind.ImportEqualsDeclaration */, modifiers, name); + var node = createBaseNamedDeclaration(268 /* SyntaxKind.ImportEqualsDeclaration */, modifiers, name); node.isTypeOnly = isTypeOnly; node.moduleReference = moduleReference; node.transformFlags |= propagateChildFlags(node.moduleReference); @@ -25657,7 +25638,7 @@ var ts; } // @api function createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause) { - var node = createBaseDeclaration(266 /* SyntaxKind.ImportDeclaration */); + var node = createBaseDeclaration(269 /* SyntaxKind.ImportDeclaration */); node.modifiers = asNodeArray(modifiers); node.importClause = importClause; node.moduleSpecifier = moduleSpecifier; @@ -25687,7 +25668,7 @@ var ts; } // @api function createImportClause(isTypeOnly, name, namedBindings) { - var node = createBaseNode(267 /* SyntaxKind.ImportClause */); + var node = createBaseNode(270 /* SyntaxKind.ImportClause */); node.isTypeOnly = isTypeOnly; node.name = name; node.namedBindings = namedBindings; @@ -25710,7 +25691,7 @@ var ts; } // @api function createAssertClause(elements, multiLine) { - var node = createBaseNode(293 /* SyntaxKind.AssertClause */); + var node = createBaseNode(296 /* SyntaxKind.AssertClause */); node.elements = createNodeArray(elements); node.multiLine = multiLine; node.transformFlags |= 4 /* TransformFlags.ContainsESNext */; @@ -25725,7 +25706,7 @@ var ts; } // @api function createAssertEntry(name, value) { - var node = createBaseNode(294 /* SyntaxKind.AssertEntry */); + var node = createBaseNode(297 /* SyntaxKind.AssertEntry */); node.name = name; node.value = value; node.transformFlags |= 4 /* TransformFlags.ContainsESNext */; @@ -25740,7 +25721,7 @@ var ts; } // @api function createImportTypeAssertionContainer(clause, multiLine) { - var node = createBaseNode(295 /* SyntaxKind.ImportTypeAssertionContainer */); + var node = createBaseNode(298 /* SyntaxKind.ImportTypeAssertionContainer */); node.assertClause = clause; node.multiLine = multiLine; return node; @@ -25754,7 +25735,7 @@ var ts; } // @api function createNamespaceImport(name) { - var node = createBaseNode(268 /* SyntaxKind.NamespaceImport */); + var node = createBaseNode(271 /* SyntaxKind.NamespaceImport */); node.name = name; node.transformFlags |= propagateChildFlags(node.name); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25768,7 +25749,7 @@ var ts; } // @api function createNamespaceExport(name) { - var node = createBaseNode(274 /* SyntaxKind.NamespaceExport */); + var node = createBaseNode(277 /* SyntaxKind.NamespaceExport */); node.name = name; node.transformFlags |= propagateChildFlags(node.name) | @@ -25784,7 +25765,7 @@ var ts; } // @api function createNamedImports(elements) { - var node = createBaseNode(269 /* SyntaxKind.NamedImports */); + var node = createBaseNode(272 /* SyntaxKind.NamedImports */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25798,7 +25779,7 @@ var ts; } // @api function createImportSpecifier(isTypeOnly, propertyName, name) { - var node = createBaseNode(270 /* SyntaxKind.ImportSpecifier */); + var node = createBaseNode(273 /* SyntaxKind.ImportSpecifier */); node.isTypeOnly = isTypeOnly; node.propertyName = propertyName; node.name = name; @@ -25818,7 +25799,7 @@ var ts; } // @api function createExportAssignment(modifiers, isExportEquals, expression) { - var node = createBaseDeclaration(271 /* SyntaxKind.ExportAssignment */); + var node = createBaseDeclaration(274 /* SyntaxKind.ExportAssignment */); node.modifiers = asNodeArray(modifiers); node.isExportEquals = isExportEquals; node.expression = isExportEquals @@ -25845,7 +25826,7 @@ var ts; } // @api function createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause) { - var node = createBaseDeclaration(272 /* SyntaxKind.ExportDeclaration */); + var node = createBaseDeclaration(275 /* SyntaxKind.ExportDeclaration */); node.modifiers = asNodeArray(modifiers); node.isTypeOnly = isTypeOnly; node.exportClause = exportClause; @@ -25878,7 +25859,7 @@ var ts; } // @api function createNamedExports(elements) { - var node = createBaseNode(273 /* SyntaxKind.NamedExports */); + var node = createBaseNode(276 /* SyntaxKind.NamedExports */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25892,7 +25873,7 @@ var ts; } // @api function createExportSpecifier(isTypeOnly, propertyName, name) { - var node = createBaseNode(275 /* SyntaxKind.ExportSpecifier */); + var node = createBaseNode(278 /* SyntaxKind.ExportSpecifier */); node.isTypeOnly = isTypeOnly; node.propertyName = asName(propertyName); node.name = asName(name); @@ -25912,7 +25893,7 @@ var ts; } // @api function createMissingDeclaration() { - var node = createBaseDeclaration(276 /* SyntaxKind.MissingDeclaration */); + var node = createBaseDeclaration(279 /* SyntaxKind.MissingDeclaration */); return node; } // @@ -25920,7 +25901,7 @@ var ts; // // @api function createExternalModuleReference(expression) { - var node = createBaseNode(277 /* SyntaxKind.ExternalModuleReference */); + var node = createBaseNode(280 /* SyntaxKind.ExternalModuleReference */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25978,7 +25959,7 @@ var ts; } // @api function createJSDocFunctionType(parameters, type) { - var node = createBaseSignatureDeclaration(317 /* SyntaxKind.JSDocFunctionType */, + var node = createBaseSignatureDeclaration(320 /* SyntaxKind.JSDocFunctionType */, /*modifiers*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined, parameters, type); @@ -25994,7 +25975,7 @@ var ts; // @api function createJSDocTypeLiteral(propertyTags, isArrayType) { if (isArrayType === void 0) { isArrayType = false; } - var node = createBaseNode(322 /* SyntaxKind.JSDocTypeLiteral */); + var node = createBaseNode(325 /* SyntaxKind.JSDocTypeLiteral */); node.jsDocPropertyTags = asNodeArray(propertyTags); node.isArrayType = isArrayType; return node; @@ -26008,7 +25989,7 @@ var ts; } // @api function createJSDocTypeExpression(type) { - var node = createBaseNode(309 /* SyntaxKind.JSDocTypeExpression */); + var node = createBaseNode(312 /* SyntaxKind.JSDocTypeExpression */); node.type = type; return node; } @@ -26020,7 +26001,7 @@ var ts; } // @api function createJSDocSignature(typeParameters, parameters, type) { - var node = createBaseNode(323 /* SyntaxKind.JSDocSignature */); + var node = createBaseNode(326 /* SyntaxKind.JSDocSignature */); node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; @@ -26049,7 +26030,7 @@ var ts; } // @api function createJSDocTemplateTag(tagName, constraint, typeParameters, comment) { - var node = createBaseJSDocTag(344 /* SyntaxKind.JSDocTemplateTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); + var node = createBaseJSDocTag(347 /* SyntaxKind.JSDocTemplateTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); node.constraint = constraint; node.typeParameters = createNodeArray(typeParameters); return node; @@ -26066,7 +26047,7 @@ var ts; } // @api function createJSDocTypedefTag(tagName, typeExpression, fullName, comment) { - var node = createBaseJSDocTag(345 /* SyntaxKind.JSDocTypedefTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); + var node = createBaseJSDocTag(348 /* SyntaxKind.JSDocTypedefTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = ts.getJSDocTypeAliasName(fullName); @@ -26084,7 +26065,7 @@ var ts; } // @api function createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - var node = createBaseJSDocTag(340 /* SyntaxKind.JSDocParameterTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); + var node = createBaseJSDocTag(343 /* SyntaxKind.JSDocParameterTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -26105,7 +26086,7 @@ var ts; } // @api function createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - var node = createBaseJSDocTag(347 /* SyntaxKind.JSDocPropertyTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); + var node = createBaseJSDocTag(350 /* SyntaxKind.JSDocPropertyTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -26126,7 +26107,7 @@ var ts; } // @api function createJSDocCallbackTag(tagName, typeExpression, fullName, comment) { - var node = createBaseJSDocTag(338 /* SyntaxKind.JSDocCallbackTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); + var node = createBaseJSDocTag(341 /* SyntaxKind.JSDocCallbackTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = ts.getJSDocTypeAliasName(fullName); @@ -26144,7 +26125,7 @@ var ts; } // @api function createJSDocAugmentsTag(tagName, className, comment) { - var node = createBaseJSDocTag(328 /* SyntaxKind.JSDocAugmentsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); + var node = createBaseJSDocTag(331 /* SyntaxKind.JSDocAugmentsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); node.class = className; return node; } @@ -26159,13 +26140,13 @@ var ts; } // @api function createJSDocImplementsTag(tagName, className, comment) { - var node = createBaseJSDocTag(329 /* SyntaxKind.JSDocImplementsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); + var node = createBaseJSDocTag(332 /* SyntaxKind.JSDocImplementsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); node.class = className; return node; } // @api function createJSDocSeeTag(tagName, name, comment) { - var node = createBaseJSDocTag(346 /* SyntaxKind.JSDocSeeTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); + var node = createBaseJSDocTag(349 /* SyntaxKind.JSDocSeeTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); node.name = name; return node; } @@ -26179,7 +26160,7 @@ var ts; } // @api function createJSDocNameReference(name) { - var node = createBaseNode(310 /* SyntaxKind.JSDocNameReference */); + var node = createBaseNode(313 /* SyntaxKind.JSDocNameReference */); node.name = name; return node; } @@ -26191,7 +26172,7 @@ var ts; } // @api function createJSDocMemberName(left, right) { - var node = createBaseNode(311 /* SyntaxKind.JSDocMemberName */); + var node = createBaseNode(314 /* SyntaxKind.JSDocMemberName */); node.left = left; node.right = right; node.transformFlags |= @@ -26208,7 +26189,7 @@ var ts; } // @api function createJSDocLink(name, text) { - var node = createBaseNode(324 /* SyntaxKind.JSDocLink */); + var node = createBaseNode(327 /* SyntaxKind.JSDocLink */); node.name = name; node.text = text; return node; @@ -26221,7 +26202,7 @@ var ts; } // @api function createJSDocLinkCode(name, text) { - var node = createBaseNode(325 /* SyntaxKind.JSDocLinkCode */); + var node = createBaseNode(328 /* SyntaxKind.JSDocLinkCode */); node.name = name; node.text = text; return node; @@ -26234,7 +26215,7 @@ var ts; } // @api function createJSDocLinkPlain(name, text) { - var node = createBaseNode(326 /* SyntaxKind.JSDocLinkPlain */); + var node = createBaseNode(329 /* SyntaxKind.JSDocLinkPlain */); node.name = name; node.text = text; return node; @@ -26306,7 +26287,7 @@ var ts; } // @api function createJSDocUnknownTag(tagName, comment) { - var node = createBaseJSDocTag(327 /* SyntaxKind.JSDocTag */, tagName, comment); + var node = createBaseJSDocTag(330 /* SyntaxKind.JSDocTag */, tagName, comment); return node; } // @api @@ -26318,7 +26299,7 @@ var ts; } // @api function createJSDocText(text) { - var node = createBaseNode(321 /* SyntaxKind.JSDocText */); + var node = createBaseNode(324 /* SyntaxKind.JSDocText */); node.text = text; return node; } @@ -26330,7 +26311,7 @@ var ts; } // @api function createJSDocComment(comment, tags) { - var node = createBaseNode(320 /* SyntaxKind.JSDoc */); + var node = createBaseNode(323 /* SyntaxKind.JSDoc */); node.comment = comment; node.tags = asNodeArray(tags); return node; @@ -26347,7 +26328,7 @@ var ts; // // @api function createJsxElement(openingElement, children, closingElement) { - var node = createBaseNode(278 /* SyntaxKind.JsxElement */); + var node = createBaseNode(281 /* SyntaxKind.JsxElement */); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -26368,7 +26349,7 @@ var ts; } // @api function createJsxSelfClosingElement(tagName, typeArguments, attributes) { - var node = createBaseNode(279 /* SyntaxKind.JsxSelfClosingElement */); + var node = createBaseNode(282 /* SyntaxKind.JsxSelfClosingElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -26392,7 +26373,7 @@ var ts; } // @api function createJsxOpeningElement(tagName, typeArguments, attributes) { - var node = createBaseNode(280 /* SyntaxKind.JsxOpeningElement */); + var node = createBaseNode(283 /* SyntaxKind.JsxOpeningElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -26416,7 +26397,7 @@ var ts; } // @api function createJsxClosingElement(tagName) { - var node = createBaseNode(281 /* SyntaxKind.JsxClosingElement */); + var node = createBaseNode(284 /* SyntaxKind.JsxClosingElement */); node.tagName = tagName; node.transformFlags |= propagateChildFlags(node.tagName) | @@ -26431,7 +26412,7 @@ var ts; } // @api function createJsxFragment(openingFragment, children, closingFragment) { - var node = createBaseNode(282 /* SyntaxKind.JsxFragment */); + var node = createBaseNode(285 /* SyntaxKind.JsxFragment */); node.openingFragment = openingFragment; node.children = createNodeArray(children); node.closingFragment = closingFragment; @@ -26467,19 +26448,19 @@ var ts; } // @api function createJsxOpeningFragment() { - var node = createBaseNode(283 /* SyntaxKind.JsxOpeningFragment */); + var node = createBaseNode(286 /* SyntaxKind.JsxOpeningFragment */); node.transformFlags |= 2 /* TransformFlags.ContainsJsx */; return node; } // @api function createJsxJsxClosingFragment() { - var node = createBaseNode(284 /* SyntaxKind.JsxClosingFragment */); + var node = createBaseNode(287 /* SyntaxKind.JsxClosingFragment */); node.transformFlags |= 2 /* TransformFlags.ContainsJsx */; return node; } // @api function createJsxAttribute(name, initializer) { - var node = createBaseNode(285 /* SyntaxKind.JsxAttribute */); + var node = createBaseNode(288 /* SyntaxKind.JsxAttribute */); node.name = name; node.initializer = initializer; node.transformFlags |= @@ -26497,7 +26478,7 @@ var ts; } // @api function createJsxAttributes(properties) { - var node = createBaseNode(286 /* SyntaxKind.JsxAttributes */); + var node = createBaseNode(289 /* SyntaxKind.JsxAttributes */); node.properties = createNodeArray(properties); node.transformFlags |= propagateChildrenFlags(node.properties) | @@ -26512,7 +26493,7 @@ var ts; } // @api function createJsxSpreadAttribute(expression) { - var node = createBaseNode(287 /* SyntaxKind.JsxSpreadAttribute */); + var node = createBaseNode(290 /* SyntaxKind.JsxSpreadAttribute */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression) | @@ -26527,7 +26508,7 @@ var ts; } // @api function createJsxExpression(dotDotDotToken, expression) { - var node = createBaseNode(288 /* SyntaxKind.JsxExpression */); + var node = createBaseNode(291 /* SyntaxKind.JsxExpression */); node.dotDotDotToken = dotDotDotToken; node.expression = expression; node.transformFlags |= @@ -26547,7 +26528,7 @@ var ts; // // @api function createCaseClause(expression, statements) { - var node = createBaseNode(289 /* SyntaxKind.CaseClause */); + var node = createBaseNode(292 /* SyntaxKind.CaseClause */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.statements = createNodeArray(statements); node.transformFlags |= @@ -26564,7 +26545,7 @@ var ts; } // @api function createDefaultClause(statements) { - var node = createBaseNode(290 /* SyntaxKind.DefaultClause */); + var node = createBaseNode(293 /* SyntaxKind.DefaultClause */); node.statements = createNodeArray(statements); node.transformFlags = propagateChildrenFlags(node.statements); return node; @@ -26577,7 +26558,7 @@ var ts; } // @api function createHeritageClause(token, types) { - var node = createBaseNode(291 /* SyntaxKind.HeritageClause */); + var node = createBaseNode(294 /* SyntaxKind.HeritageClause */); node.token = token; node.types = createNodeArray(types); node.transformFlags |= propagateChildrenFlags(node.types); @@ -26601,7 +26582,7 @@ var ts; } // @api function createCatchClause(variableDeclaration, block) { - var node = createBaseNode(292 /* SyntaxKind.CatchClause */); + var node = createBaseNode(295 /* SyntaxKind.CatchClause */); if (typeof variableDeclaration === "string" || variableDeclaration && !ts.isVariableDeclaration(variableDeclaration)) { variableDeclaration = createVariableDeclaration(variableDeclaration, /*exclamationToken*/ undefined, @@ -26629,7 +26610,7 @@ var ts; // // @api function createPropertyAssignment(name, initializer) { - var node = createBaseNamedDeclaration(296 /* SyntaxKind.PropertyAssignment */, + var node = createBaseNamedDeclaration(299 /* SyntaxKind.PropertyAssignment */, /*modifiers*/ undefined, name); node.initializer = parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= @@ -26661,7 +26642,7 @@ var ts; } // @api function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - var node = createBaseNamedDeclaration(297 /* SyntaxKind.ShorthandPropertyAssignment */, + var node = createBaseNamedDeclaration(300 /* SyntaxKind.ShorthandPropertyAssignment */, /*modifiers*/ undefined, name); node.objectAssignmentInitializer = objectAssignmentInitializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(objectAssignmentInitializer); node.transformFlags |= @@ -26695,7 +26676,7 @@ var ts; } // @api function createSpreadAssignment(expression) { - var node = createBaseNode(298 /* SyntaxKind.SpreadAssignment */); + var node = createBaseNode(301 /* SyntaxKind.SpreadAssignment */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -26714,7 +26695,7 @@ var ts; // // @api function createEnumMember(name, initializer) { - var node = createBaseNode(299 /* SyntaxKind.EnumMember */); + var node = createBaseNode(302 /* SyntaxKind.EnumMember */); node.name = asName(name); node.initializer = initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= @@ -26735,7 +26716,7 @@ var ts; // // @api function createSourceFile(statements, endOfFileToken, flags) { - var node = baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */); + var node = baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */); node.statements = createNodeArray(statements); node.endOfFileToken = endOfFileToken; node.flags |= flags; @@ -26752,7 +26733,7 @@ var ts; return node; } function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) { - var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */)); + var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */)); for (var p in source) { if (p === "emitNode" || ts.hasProperty(node, p) || !ts.hasProperty(source, p)) continue; @@ -26791,7 +26772,7 @@ var ts; // @api function createBundle(sourceFiles, prepends) { if (prepends === void 0) { prepends = ts.emptyArray; } - var node = createBaseNode(306 /* SyntaxKind.Bundle */); + var node = createBaseNode(309 /* SyntaxKind.Bundle */); node.prepends = prepends; node.sourceFiles = sourceFiles; return node; @@ -26806,7 +26787,7 @@ var ts; } // @api function createUnparsedSource(prologues, syntheticReferences, texts) { - var node = createBaseNode(307 /* SyntaxKind.UnparsedSource */); + var node = createBaseNode(310 /* SyntaxKind.UnparsedSource */); node.prologues = prologues; node.syntheticReferences = syntheticReferences; node.texts = texts; @@ -26824,28 +26805,28 @@ var ts; } // @api function createUnparsedPrologue(data) { - return createBaseUnparsedNode(300 /* SyntaxKind.UnparsedPrologue */, data); + return createBaseUnparsedNode(303 /* SyntaxKind.UnparsedPrologue */, data); } // @api function createUnparsedPrepend(data, texts) { - var node = createBaseUnparsedNode(301 /* SyntaxKind.UnparsedPrepend */, data); + var node = createBaseUnparsedNode(304 /* SyntaxKind.UnparsedPrepend */, data); node.texts = texts; return node; } // @api function createUnparsedTextLike(data, internal) { - return createBaseUnparsedNode(internal ? 303 /* SyntaxKind.UnparsedInternalText */ : 302 /* SyntaxKind.UnparsedText */, data); + return createBaseUnparsedNode(internal ? 306 /* SyntaxKind.UnparsedInternalText */ : 305 /* SyntaxKind.UnparsedText */, data); } // @api function createUnparsedSyntheticReference(section) { - var node = createBaseNode(304 /* SyntaxKind.UnparsedSyntheticReference */); + var node = createBaseNode(307 /* SyntaxKind.UnparsedSyntheticReference */); node.data = section.data; node.section = section; return node; } // @api function createInputFiles() { - var node = createBaseNode(308 /* SyntaxKind.InputFiles */); + var node = createBaseNode(311 /* SyntaxKind.InputFiles */); node.javascriptText = ""; node.declarationText = ""; return node; @@ -26856,7 +26837,7 @@ var ts; // @api function createSyntheticExpression(type, isSpread, tupleNameSource) { if (isSpread === void 0) { isSpread = false; } - var node = createBaseNode(232 /* SyntaxKind.SyntheticExpression */); + var node = createBaseNode(234 /* SyntaxKind.SyntheticExpression */); node.type = type; node.isSpread = isSpread; node.tupleNameSource = tupleNameSource; @@ -26864,7 +26845,7 @@ var ts; } // @api function createSyntaxList(children) { - var node = createBaseNode(348 /* SyntaxKind.SyntaxList */); + var node = createBaseNode(351 /* SyntaxKind.SyntaxList */); node._children = children; return node; } @@ -26879,7 +26860,7 @@ var ts; */ // @api function createNotEmittedStatement(original) { - var node = createBaseNode(349 /* SyntaxKind.NotEmittedStatement */); + var node = createBaseNode(352 /* SyntaxKind.NotEmittedStatement */); node.original = original; ts.setTextRange(node, original); return node; @@ -26893,7 +26874,7 @@ var ts; */ // @api function createPartiallyEmittedExpression(expression, original) { - var node = createBaseNode(350 /* SyntaxKind.PartiallyEmittedExpression */); + var node = createBaseNode(353 /* SyntaxKind.PartiallyEmittedExpression */); node.expression = expression; node.original = original; node.transformFlags |= @@ -26921,7 +26902,7 @@ var ts; } // @api function createCommaListExpression(elements) { - var node = createBaseNode(351 /* SyntaxKind.CommaListExpression */); + var node = createBaseNode(354 /* SyntaxKind.CommaListExpression */); node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)); node.transformFlags |= propagateChildrenFlags(node.elements); return node; @@ -26938,7 +26919,7 @@ var ts; */ // @api function createEndOfDeclarationMarker(original) { - var node = createBaseNode(353 /* SyntaxKind.EndOfDeclarationMarker */); + var node = createBaseNode(356 /* SyntaxKind.EndOfDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -26949,14 +26930,14 @@ var ts; */ // @api function createMergeDeclarationMarker(original) { - var node = createBaseNode(352 /* SyntaxKind.MergeDeclarationMarker */); + var node = createBaseNode(355 /* SyntaxKind.MergeDeclarationMarker */); node.emitNode = {}; node.original = original; return node; } // @api function createSyntheticReferenceExpression(expression, thisArg) { - var node = createBaseNode(354 /* SyntaxKind.SyntheticReferenceExpression */); + var node = createBaseNode(357 /* SyntaxKind.SyntheticReferenceExpression */); node.expression = expression; node.thisArg = thisArg; node.transformFlags |= @@ -26978,7 +26959,7 @@ var ts; if (node === undefined) { return node; } - var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */) : + var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */) : ts.isIdentifier(node) ? baseFactory.createBaseIdentifierNode(79 /* SyntaxKind.Identifier */) : ts.isPrivateIdentifier(node) ? baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */) : !ts.isNodeKind(node.kind) ? baseFactory.createBaseTokenNode(node.kind) : @@ -26987,7 +26968,7 @@ var ts; clone.transformFlags = node.transformFlags; setOriginalNode(clone, node); for (var key in node) { - if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { + if (ts.hasProperty(clone, key) || !ts.hasProperty(node, key)) { continue; } clone[key] = node[key]; @@ -27095,11 +27076,12 @@ var ts; } function updateOuterExpression(outerExpression, expression) { switch (outerExpression.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: return updateParenthesizedExpression(outerExpression, expression); - case 211 /* SyntaxKind.TypeAssertionExpression */: return updateTypeAssertion(outerExpression, outerExpression.type, expression); - case 229 /* SyntaxKind.AsExpression */: return updateAsExpression(outerExpression, expression, outerExpression.type); - case 230 /* SyntaxKind.NonNullExpression */: return updateNonNullExpression(outerExpression, expression); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: return updatePartiallyEmittedExpression(outerExpression, expression); + case 214 /* SyntaxKind.ParenthesizedExpression */: return updateParenthesizedExpression(outerExpression, expression); + case 213 /* SyntaxKind.TypeAssertionExpression */: return updateTypeAssertion(outerExpression, outerExpression.type, expression); + case 231 /* SyntaxKind.AsExpression */: return updateAsExpression(outerExpression, expression, outerExpression.type); + case 235 /* SyntaxKind.SatisfiesExpression */: return updateSatisfiesExpression(outerExpression, expression, outerExpression.type); + case 232 /* SyntaxKind.NonNullExpression */: return updateNonNullExpression(outerExpression, expression); + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return updatePartiallyEmittedExpression(outerExpression, expression); } } /** @@ -27153,13 +27135,13 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: return false; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return target.properties.length > 0; default: return true; @@ -27585,24 +27567,24 @@ var ts; } function getDefaultTagNameForKind(kind) { switch (kind) { - case 343 /* SyntaxKind.JSDocTypeTag */: return "type"; - case 341 /* SyntaxKind.JSDocReturnTag */: return "returns"; - case 342 /* SyntaxKind.JSDocThisTag */: return "this"; - case 339 /* SyntaxKind.JSDocEnumTag */: return "enum"; - case 330 /* SyntaxKind.JSDocAuthorTag */: return "author"; - case 332 /* SyntaxKind.JSDocClassTag */: return "class"; - case 333 /* SyntaxKind.JSDocPublicTag */: return "public"; - case 334 /* SyntaxKind.JSDocPrivateTag */: return "private"; - case 335 /* SyntaxKind.JSDocProtectedTag */: return "protected"; - case 336 /* SyntaxKind.JSDocReadonlyTag */: return "readonly"; - case 337 /* SyntaxKind.JSDocOverrideTag */: return "override"; - case 344 /* SyntaxKind.JSDocTemplateTag */: return "template"; - case 345 /* SyntaxKind.JSDocTypedefTag */: return "typedef"; - case 340 /* SyntaxKind.JSDocParameterTag */: return "param"; - case 347 /* SyntaxKind.JSDocPropertyTag */: return "prop"; - case 338 /* SyntaxKind.JSDocCallbackTag */: return "callback"; - case 328 /* SyntaxKind.JSDocAugmentsTag */: return "augments"; - case 329 /* SyntaxKind.JSDocImplementsTag */: return "implements"; + case 346 /* SyntaxKind.JSDocTypeTag */: return "type"; + case 344 /* SyntaxKind.JSDocReturnTag */: return "returns"; + case 345 /* SyntaxKind.JSDocThisTag */: return "this"; + case 342 /* SyntaxKind.JSDocEnumTag */: return "enum"; + case 333 /* SyntaxKind.JSDocAuthorTag */: return "author"; + case 335 /* SyntaxKind.JSDocClassTag */: return "class"; + case 336 /* SyntaxKind.JSDocPublicTag */: return "public"; + case 337 /* SyntaxKind.JSDocPrivateTag */: return "private"; + case 338 /* SyntaxKind.JSDocProtectedTag */: return "protected"; + case 339 /* SyntaxKind.JSDocReadonlyTag */: return "readonly"; + case 340 /* SyntaxKind.JSDocOverrideTag */: return "override"; + case 347 /* SyntaxKind.JSDocTemplateTag */: return "template"; + case 348 /* SyntaxKind.JSDocTypedefTag */: return "typedef"; + case 343 /* SyntaxKind.JSDocParameterTag */: return "param"; + case 350 /* SyntaxKind.JSDocPropertyTag */: return "prop"; + case 341 /* SyntaxKind.JSDocCallbackTag */: return "callback"; + case 331 /* SyntaxKind.JSDocAugmentsTag */: return "augments"; + case 332 /* SyntaxKind.JSDocImplementsTag */: return "implements"; default: return ts.Debug.fail("Unsupported kind: ".concat(ts.Debug.formatSyntaxKind(kind))); } @@ -27682,69 +27664,70 @@ var ts; */ /* @internal */ function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 177 /* SyntaxKind.FirstTypeNode */ && kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (kind >= 179 /* SyntaxKind.FirstTypeNode */ && kind <= 202 /* SyntaxKind.LastTypeNode */) { return -2 /* TransformFlags.TypeExcludes */; } switch (kind) { - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return -2147450880 /* TransformFlags.ArrayLiteralOrCallOrNewExcludes */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return -1941676032 /* TransformFlags.ModuleExcludes */; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return -2147483648 /* TransformFlags.ParameterExcludes */; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return -2072174592 /* TransformFlags.ArrowFunctionExcludes */; - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return -1937940480 /* TransformFlags.FunctionExcludes */; - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return -2146893824 /* TransformFlags.VariableDeclarationListExcludes */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return -2147344384 /* TransformFlags.ClassExcludes */; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return -1937948672 /* TransformFlags.ConstructorExcludes */; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return -2013249536 /* TransformFlags.PropertyExcludes */; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return -2005057536 /* TransformFlags.MethodOrAccessorExcludes */; - case 130 /* SyntaxKind.AnyKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 163 /* SyntaxKind.TypeParameter */: - case 166 /* SyntaxKind.PropertySignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: + case 168 /* SyntaxKind.PropertySignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return -2 /* TransformFlags.TypeExcludes */; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return -2147278848 /* TransformFlags.ObjectLiteralExcludes */; - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return -2147418112 /* TransformFlags.CatchClauseExcludes */; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return -2147450880 /* TransformFlags.BindingPatternExcludes */; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: case 106 /* SyntaxKind.SuperKeyword */: return -2147483648 /* TransformFlags.OuterExpressionExcludes */; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return -2147483648 /* TransformFlags.PropertyAccessExcludes */; default: return -2147483648 /* TransformFlags.NodeExcludes */; @@ -27944,9 +27927,10 @@ var ts; }; var buildInfo_1; var getAndCacheBuildInfo_1 = function (getText) { + var _a; if (buildInfo_1 === undefined) { var result = getText(); - buildInfo_1 = result !== undefined ? ts.getBuildInfo(result) : false; + buildInfo_1 = result !== undefined ? (_a = ts.getBuildInfo(node.buildInfoPath, result)) !== null && _a !== void 0 ? _a : false : false; } return buildInfo_1 || undefined; }; @@ -28000,7 +27984,7 @@ var ts; } ts.setOriginalNode = setOriginalNode; function mergeEmitNode(sourceEmitNode, destEmitNode) { - var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine; + var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine, snippetElement = sourceEmitNode.snippetElement; if (!destEmitNode) destEmitNode = {}; // We are using `.slice()` here in case `destEmitNode.leadingComments` is pushed to later. @@ -28026,6 +28010,8 @@ var ts; } if (startsOnNewLine !== undefined) destEmitNode.startsOnNewLine = startsOnNewLine; + if (snippetElement !== undefined) + destEmitNode.snippetElement = snippetElement; return destEmitNode; } function mergeTokenSourceMapRanges(sourceRanges, destRanges) { @@ -28051,7 +28037,7 @@ var ts; // To avoid holding onto transformation artifacts, we keep track of any // parse tree node we are annotating. This allows us to clean them up after // all transformations have completed. - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = (_a = ts.getSourceFileOfNode(ts.getParseTreeNode(ts.getSourceFileOfNode(node)))) !== null && _a !== void 0 ? _a : ts.Debug.fail("Could not determine parsed source file."); @@ -29129,22 +29115,22 @@ var ts; ts.isExportModifier = isExportModifier; /* @internal */ function isAsyncModifier(node) { - return node.kind === 131 /* SyntaxKind.AsyncKeyword */; + return node.kind === 132 /* SyntaxKind.AsyncKeyword */; } ts.isAsyncModifier = isAsyncModifier; /* @internal */ function isAssertsKeyword(node) { - return node.kind === 128 /* SyntaxKind.AssertsKeyword */; + return node.kind === 129 /* SyntaxKind.AssertsKeyword */; } ts.isAssertsKeyword = isAssertsKeyword; /* @internal */ function isAwaitKeyword(node) { - return node.kind === 132 /* SyntaxKind.AwaitKeyword */; + return node.kind === 133 /* SyntaxKind.AwaitKeyword */; } ts.isAwaitKeyword = isAwaitKeyword; /* @internal */ function isReadonlyKeyword(node) { - return node.kind === 145 /* SyntaxKind.ReadonlyKeyword */; + return node.kind === 146 /* SyntaxKind.ReadonlyKeyword */; } ts.isReadonlyKeyword = isReadonlyKeyword; /* @internal */ @@ -29159,9 +29145,14 @@ var ts; ts.isAbstractModifier = isAbstractModifier; /* @internal */ function isOverrideModifier(node) { - return node.kind === 159 /* SyntaxKind.OverrideKeyword */; + return node.kind === 161 /* SyntaxKind.OverrideKeyword */; } ts.isOverrideModifier = isOverrideModifier; + /* @internal */ + function isAccessorModifier(node) { + return node.kind === 127 /* SyntaxKind.AccessorKeyword */; + } + ts.isAccessorModifier = isAccessorModifier; /*@internal*/ function isSuperKeyword(node) { return node.kind === 106 /* SyntaxKind.SuperKeyword */; @@ -29174,605 +29165,609 @@ var ts; ts.isImportKeyword = isImportKeyword; // Names function isQualifiedName(node) { - return node.kind === 161 /* SyntaxKind.QualifiedName */; + return node.kind === 163 /* SyntaxKind.QualifiedName */; } ts.isQualifiedName = isQualifiedName; function isComputedPropertyName(node) { - return node.kind === 162 /* SyntaxKind.ComputedPropertyName */; + return node.kind === 164 /* SyntaxKind.ComputedPropertyName */; } ts.isComputedPropertyName = isComputedPropertyName; // Signature elements function isTypeParameterDeclaration(node) { - return node.kind === 163 /* SyntaxKind.TypeParameter */; + return node.kind === 165 /* SyntaxKind.TypeParameter */; } ts.isTypeParameterDeclaration = isTypeParameterDeclaration; // TODO(rbuckton): Rename to 'isParameterDeclaration' function isParameter(node) { - return node.kind === 164 /* SyntaxKind.Parameter */; + return node.kind === 166 /* SyntaxKind.Parameter */; } ts.isParameter = isParameter; function isDecorator(node) { - return node.kind === 165 /* SyntaxKind.Decorator */; + return node.kind === 167 /* SyntaxKind.Decorator */; } ts.isDecorator = isDecorator; // TypeMember function isPropertySignature(node) { - return node.kind === 166 /* SyntaxKind.PropertySignature */; + return node.kind === 168 /* SyntaxKind.PropertySignature */; } ts.isPropertySignature = isPropertySignature; function isPropertyDeclaration(node) { - return node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + return node.kind === 169 /* SyntaxKind.PropertyDeclaration */; } ts.isPropertyDeclaration = isPropertyDeclaration; function isMethodSignature(node) { - return node.kind === 168 /* SyntaxKind.MethodSignature */; + return node.kind === 170 /* SyntaxKind.MethodSignature */; } ts.isMethodSignature = isMethodSignature; function isMethodDeclaration(node) { - return node.kind === 169 /* SyntaxKind.MethodDeclaration */; + return node.kind === 171 /* SyntaxKind.MethodDeclaration */; } ts.isMethodDeclaration = isMethodDeclaration; function isClassStaticBlockDeclaration(node) { - return node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + return node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; } ts.isClassStaticBlockDeclaration = isClassStaticBlockDeclaration; function isConstructorDeclaration(node) { - return node.kind === 171 /* SyntaxKind.Constructor */; + return node.kind === 173 /* SyntaxKind.Constructor */; } ts.isConstructorDeclaration = isConstructorDeclaration; function isGetAccessorDeclaration(node) { - return node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetAccessorDeclaration = isGetAccessorDeclaration; function isSetAccessorDeclaration(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */; } ts.isSetAccessorDeclaration = isSetAccessorDeclaration; function isCallSignatureDeclaration(node) { - return node.kind === 174 /* SyntaxKind.CallSignature */; + return node.kind === 176 /* SyntaxKind.CallSignature */; } ts.isCallSignatureDeclaration = isCallSignatureDeclaration; function isConstructSignatureDeclaration(node) { - return node.kind === 175 /* SyntaxKind.ConstructSignature */; + return node.kind === 177 /* SyntaxKind.ConstructSignature */; } ts.isConstructSignatureDeclaration = isConstructSignatureDeclaration; function isIndexSignatureDeclaration(node) { - return node.kind === 176 /* SyntaxKind.IndexSignature */; + return node.kind === 178 /* SyntaxKind.IndexSignature */; } ts.isIndexSignatureDeclaration = isIndexSignatureDeclaration; // Type function isTypePredicateNode(node) { - return node.kind === 177 /* SyntaxKind.TypePredicate */; + return node.kind === 179 /* SyntaxKind.TypePredicate */; } ts.isTypePredicateNode = isTypePredicateNode; function isTypeReferenceNode(node) { - return node.kind === 178 /* SyntaxKind.TypeReference */; + return node.kind === 180 /* SyntaxKind.TypeReference */; } ts.isTypeReferenceNode = isTypeReferenceNode; function isFunctionTypeNode(node) { - return node.kind === 179 /* SyntaxKind.FunctionType */; + return node.kind === 181 /* SyntaxKind.FunctionType */; } ts.isFunctionTypeNode = isFunctionTypeNode; function isConstructorTypeNode(node) { - return node.kind === 180 /* SyntaxKind.ConstructorType */; + return node.kind === 182 /* SyntaxKind.ConstructorType */; } ts.isConstructorTypeNode = isConstructorTypeNode; function isTypeQueryNode(node) { - return node.kind === 181 /* SyntaxKind.TypeQuery */; + return node.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isTypeQueryNode = isTypeQueryNode; function isTypeLiteralNode(node) { - return node.kind === 182 /* SyntaxKind.TypeLiteral */; + return node.kind === 184 /* SyntaxKind.TypeLiteral */; } ts.isTypeLiteralNode = isTypeLiteralNode; function isArrayTypeNode(node) { - return node.kind === 183 /* SyntaxKind.ArrayType */; + return node.kind === 185 /* SyntaxKind.ArrayType */; } ts.isArrayTypeNode = isArrayTypeNode; function isTupleTypeNode(node) { - return node.kind === 184 /* SyntaxKind.TupleType */; + return node.kind === 186 /* SyntaxKind.TupleType */; } ts.isTupleTypeNode = isTupleTypeNode; function isNamedTupleMember(node) { - return node.kind === 197 /* SyntaxKind.NamedTupleMember */; + return node.kind === 199 /* SyntaxKind.NamedTupleMember */; } ts.isNamedTupleMember = isNamedTupleMember; function isOptionalTypeNode(node) { - return node.kind === 185 /* SyntaxKind.OptionalType */; + return node.kind === 187 /* SyntaxKind.OptionalType */; } ts.isOptionalTypeNode = isOptionalTypeNode; function isRestTypeNode(node) { - return node.kind === 186 /* SyntaxKind.RestType */; + return node.kind === 188 /* SyntaxKind.RestType */; } ts.isRestTypeNode = isRestTypeNode; function isUnionTypeNode(node) { - return node.kind === 187 /* SyntaxKind.UnionType */; + return node.kind === 189 /* SyntaxKind.UnionType */; } ts.isUnionTypeNode = isUnionTypeNode; function isIntersectionTypeNode(node) { - return node.kind === 188 /* SyntaxKind.IntersectionType */; + return node.kind === 190 /* SyntaxKind.IntersectionType */; } ts.isIntersectionTypeNode = isIntersectionTypeNode; function isConditionalTypeNode(node) { - return node.kind === 189 /* SyntaxKind.ConditionalType */; + return node.kind === 191 /* SyntaxKind.ConditionalType */; } ts.isConditionalTypeNode = isConditionalTypeNode; function isInferTypeNode(node) { - return node.kind === 190 /* SyntaxKind.InferType */; + return node.kind === 192 /* SyntaxKind.InferType */; } ts.isInferTypeNode = isInferTypeNode; function isParenthesizedTypeNode(node) { - return node.kind === 191 /* SyntaxKind.ParenthesizedType */; + return node.kind === 193 /* SyntaxKind.ParenthesizedType */; } ts.isParenthesizedTypeNode = isParenthesizedTypeNode; function isThisTypeNode(node) { - return node.kind === 192 /* SyntaxKind.ThisType */; + return node.kind === 194 /* SyntaxKind.ThisType */; } ts.isThisTypeNode = isThisTypeNode; function isTypeOperatorNode(node) { - return node.kind === 193 /* SyntaxKind.TypeOperator */; + return node.kind === 195 /* SyntaxKind.TypeOperator */; } ts.isTypeOperatorNode = isTypeOperatorNode; function isIndexedAccessTypeNode(node) { - return node.kind === 194 /* SyntaxKind.IndexedAccessType */; + return node.kind === 196 /* SyntaxKind.IndexedAccessType */; } ts.isIndexedAccessTypeNode = isIndexedAccessTypeNode; function isMappedTypeNode(node) { - return node.kind === 195 /* SyntaxKind.MappedType */; + return node.kind === 197 /* SyntaxKind.MappedType */; } ts.isMappedTypeNode = isMappedTypeNode; function isLiteralTypeNode(node) { - return node.kind === 196 /* SyntaxKind.LiteralType */; + return node.kind === 198 /* SyntaxKind.LiteralType */; } ts.isLiteralTypeNode = isLiteralTypeNode; function isImportTypeNode(node) { - return node.kind === 200 /* SyntaxKind.ImportType */; + return node.kind === 202 /* SyntaxKind.ImportType */; } ts.isImportTypeNode = isImportTypeNode; function isTemplateLiteralTypeSpan(node) { - return node.kind === 199 /* SyntaxKind.TemplateLiteralTypeSpan */; + return node.kind === 201 /* SyntaxKind.TemplateLiteralTypeSpan */; } ts.isTemplateLiteralTypeSpan = isTemplateLiteralTypeSpan; function isTemplateLiteralTypeNode(node) { - return node.kind === 198 /* SyntaxKind.TemplateLiteralType */; + return node.kind === 200 /* SyntaxKind.TemplateLiteralType */; } ts.isTemplateLiteralTypeNode = isTemplateLiteralTypeNode; // Binding patterns function isObjectBindingPattern(node) { - return node.kind === 201 /* SyntaxKind.ObjectBindingPattern */; + return node.kind === 203 /* SyntaxKind.ObjectBindingPattern */; } ts.isObjectBindingPattern = isObjectBindingPattern; function isArrayBindingPattern(node) { - return node.kind === 202 /* SyntaxKind.ArrayBindingPattern */; + return node.kind === 204 /* SyntaxKind.ArrayBindingPattern */; } ts.isArrayBindingPattern = isArrayBindingPattern; function isBindingElement(node) { - return node.kind === 203 /* SyntaxKind.BindingElement */; + return node.kind === 205 /* SyntaxKind.BindingElement */; } ts.isBindingElement = isBindingElement; // Expression function isArrayLiteralExpression(node) { - return node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */; + return node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 206 /* SyntaxKind.PropertyAccessExpression */; + return node.kind === 208 /* SyntaxKind.PropertyAccessExpression */; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 207 /* SyntaxKind.ElementAccessExpression */; + return node.kind === 209 /* SyntaxKind.ElementAccessExpression */; } ts.isElementAccessExpression = isElementAccessExpression; function isCallExpression(node) { - return node.kind === 208 /* SyntaxKind.CallExpression */; + return node.kind === 210 /* SyntaxKind.CallExpression */; } ts.isCallExpression = isCallExpression; function isNewExpression(node) { - return node.kind === 209 /* SyntaxKind.NewExpression */; + return node.kind === 211 /* SyntaxKind.NewExpression */; } ts.isNewExpression = isNewExpression; function isTaggedTemplateExpression(node) { - return node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */; + return node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */; } ts.isTaggedTemplateExpression = isTaggedTemplateExpression; function isTypeAssertionExpression(node) { - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */; } ts.isTypeAssertionExpression = isTypeAssertionExpression; function isParenthesizedExpression(node) { - return node.kind === 212 /* SyntaxKind.ParenthesizedExpression */; + return node.kind === 214 /* SyntaxKind.ParenthesizedExpression */; } ts.isParenthesizedExpression = isParenthesizedExpression; function isFunctionExpression(node) { - return node.kind === 213 /* SyntaxKind.FunctionExpression */; + return node.kind === 215 /* SyntaxKind.FunctionExpression */; } ts.isFunctionExpression = isFunctionExpression; function isArrowFunction(node) { - return node.kind === 214 /* SyntaxKind.ArrowFunction */; + return node.kind === 216 /* SyntaxKind.ArrowFunction */; } ts.isArrowFunction = isArrowFunction; function isDeleteExpression(node) { - return node.kind === 215 /* SyntaxKind.DeleteExpression */; + return node.kind === 217 /* SyntaxKind.DeleteExpression */; } ts.isDeleteExpression = isDeleteExpression; function isTypeOfExpression(node) { - return node.kind === 216 /* SyntaxKind.TypeOfExpression */; + return node.kind === 218 /* SyntaxKind.TypeOfExpression */; } ts.isTypeOfExpression = isTypeOfExpression; function isVoidExpression(node) { - return node.kind === 217 /* SyntaxKind.VoidExpression */; + return node.kind === 219 /* SyntaxKind.VoidExpression */; } ts.isVoidExpression = isVoidExpression; function isAwaitExpression(node) { - return node.kind === 218 /* SyntaxKind.AwaitExpression */; + return node.kind === 220 /* SyntaxKind.AwaitExpression */; } ts.isAwaitExpression = isAwaitExpression; function isPrefixUnaryExpression(node) { - return node.kind === 219 /* SyntaxKind.PrefixUnaryExpression */; + return node.kind === 221 /* SyntaxKind.PrefixUnaryExpression */; } ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function isPostfixUnaryExpression(node) { - return node.kind === 220 /* SyntaxKind.PostfixUnaryExpression */; + return node.kind === 222 /* SyntaxKind.PostfixUnaryExpression */; } ts.isPostfixUnaryExpression = isPostfixUnaryExpression; function isBinaryExpression(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 222 /* SyntaxKind.ConditionalExpression */; + return node.kind === 224 /* SyntaxKind.ConditionalExpression */; } ts.isConditionalExpression = isConditionalExpression; function isTemplateExpression(node) { - return node.kind === 223 /* SyntaxKind.TemplateExpression */; + return node.kind === 225 /* SyntaxKind.TemplateExpression */; } ts.isTemplateExpression = isTemplateExpression; function isYieldExpression(node) { - return node.kind === 224 /* SyntaxKind.YieldExpression */; + return node.kind === 226 /* SyntaxKind.YieldExpression */; } ts.isYieldExpression = isYieldExpression; function isSpreadElement(node) { - return node.kind === 225 /* SyntaxKind.SpreadElement */; + return node.kind === 227 /* SyntaxKind.SpreadElement */; } ts.isSpreadElement = isSpreadElement; function isClassExpression(node) { - return node.kind === 226 /* SyntaxKind.ClassExpression */; + return node.kind === 228 /* SyntaxKind.ClassExpression */; } ts.isClassExpression = isClassExpression; function isOmittedExpression(node) { - return node.kind === 227 /* SyntaxKind.OmittedExpression */; + return node.kind === 229 /* SyntaxKind.OmittedExpression */; } ts.isOmittedExpression = isOmittedExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isAsExpression(node) { - return node.kind === 229 /* SyntaxKind.AsExpression */; + return node.kind === 231 /* SyntaxKind.AsExpression */; } ts.isAsExpression = isAsExpression; + function isSatisfiesExpression(node) { + return node.kind === 235 /* SyntaxKind.SatisfiesExpression */; + } + ts.isSatisfiesExpression = isSatisfiesExpression; function isNonNullExpression(node) { - return node.kind === 230 /* SyntaxKind.NonNullExpression */; + return node.kind === 232 /* SyntaxKind.NonNullExpression */; } ts.isNonNullExpression = isNonNullExpression; function isMetaProperty(node) { - return node.kind === 231 /* SyntaxKind.MetaProperty */; + return node.kind === 233 /* SyntaxKind.MetaProperty */; } ts.isMetaProperty = isMetaProperty; function isSyntheticExpression(node) { - return node.kind === 232 /* SyntaxKind.SyntheticExpression */; + return node.kind === 234 /* SyntaxKind.SyntheticExpression */; } ts.isSyntheticExpression = isSyntheticExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 350 /* SyntaxKind.PartiallyEmittedExpression */; + return node.kind === 353 /* SyntaxKind.PartiallyEmittedExpression */; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isCommaListExpression(node) { - return node.kind === 351 /* SyntaxKind.CommaListExpression */; + return node.kind === 354 /* SyntaxKind.CommaListExpression */; } ts.isCommaListExpression = isCommaListExpression; // Misc function isTemplateSpan(node) { - return node.kind === 233 /* SyntaxKind.TemplateSpan */; + return node.kind === 236 /* SyntaxKind.TemplateSpan */; } ts.isTemplateSpan = isTemplateSpan; function isSemicolonClassElement(node) { - return node.kind === 234 /* SyntaxKind.SemicolonClassElement */; + return node.kind === 237 /* SyntaxKind.SemicolonClassElement */; } ts.isSemicolonClassElement = isSemicolonClassElement; // Elements function isBlock(node) { - return node.kind === 235 /* SyntaxKind.Block */; + return node.kind === 238 /* SyntaxKind.Block */; } ts.isBlock = isBlock; function isVariableStatement(node) { - return node.kind === 237 /* SyntaxKind.VariableStatement */; + return node.kind === 240 /* SyntaxKind.VariableStatement */; } ts.isVariableStatement = isVariableStatement; function isEmptyStatement(node) { - return node.kind === 236 /* SyntaxKind.EmptyStatement */; + return node.kind === 239 /* SyntaxKind.EmptyStatement */; } ts.isEmptyStatement = isEmptyStatement; function isExpressionStatement(node) { - return node.kind === 238 /* SyntaxKind.ExpressionStatement */; + return node.kind === 241 /* SyntaxKind.ExpressionStatement */; } ts.isExpressionStatement = isExpressionStatement; function isIfStatement(node) { - return node.kind === 239 /* SyntaxKind.IfStatement */; + return node.kind === 242 /* SyntaxKind.IfStatement */; } ts.isIfStatement = isIfStatement; function isDoStatement(node) { - return node.kind === 240 /* SyntaxKind.DoStatement */; + return node.kind === 243 /* SyntaxKind.DoStatement */; } ts.isDoStatement = isDoStatement; function isWhileStatement(node) { - return node.kind === 241 /* SyntaxKind.WhileStatement */; + return node.kind === 244 /* SyntaxKind.WhileStatement */; } ts.isWhileStatement = isWhileStatement; function isForStatement(node) { - return node.kind === 242 /* SyntaxKind.ForStatement */; + return node.kind === 245 /* SyntaxKind.ForStatement */; } ts.isForStatement = isForStatement; function isForInStatement(node) { - return node.kind === 243 /* SyntaxKind.ForInStatement */; + return node.kind === 246 /* SyntaxKind.ForInStatement */; } ts.isForInStatement = isForInStatement; function isForOfStatement(node) { - return node.kind === 244 /* SyntaxKind.ForOfStatement */; + return node.kind === 247 /* SyntaxKind.ForOfStatement */; } ts.isForOfStatement = isForOfStatement; function isContinueStatement(node) { - return node.kind === 245 /* SyntaxKind.ContinueStatement */; + return node.kind === 248 /* SyntaxKind.ContinueStatement */; } ts.isContinueStatement = isContinueStatement; function isBreakStatement(node) { - return node.kind === 246 /* SyntaxKind.BreakStatement */; + return node.kind === 249 /* SyntaxKind.BreakStatement */; } ts.isBreakStatement = isBreakStatement; function isReturnStatement(node) { - return node.kind === 247 /* SyntaxKind.ReturnStatement */; + return node.kind === 250 /* SyntaxKind.ReturnStatement */; } ts.isReturnStatement = isReturnStatement; function isWithStatement(node) { - return node.kind === 248 /* SyntaxKind.WithStatement */; + return node.kind === 251 /* SyntaxKind.WithStatement */; } ts.isWithStatement = isWithStatement; function isSwitchStatement(node) { - return node.kind === 249 /* SyntaxKind.SwitchStatement */; + return node.kind === 252 /* SyntaxKind.SwitchStatement */; } ts.isSwitchStatement = isSwitchStatement; function isLabeledStatement(node) { - return node.kind === 250 /* SyntaxKind.LabeledStatement */; + return node.kind === 253 /* SyntaxKind.LabeledStatement */; } ts.isLabeledStatement = isLabeledStatement; function isThrowStatement(node) { - return node.kind === 251 /* SyntaxKind.ThrowStatement */; + return node.kind === 254 /* SyntaxKind.ThrowStatement */; } ts.isThrowStatement = isThrowStatement; function isTryStatement(node) { - return node.kind === 252 /* SyntaxKind.TryStatement */; + return node.kind === 255 /* SyntaxKind.TryStatement */; } ts.isTryStatement = isTryStatement; function isDebuggerStatement(node) { - return node.kind === 253 /* SyntaxKind.DebuggerStatement */; + return node.kind === 256 /* SyntaxKind.DebuggerStatement */; } ts.isDebuggerStatement = isDebuggerStatement; function isVariableDeclaration(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 255 /* SyntaxKind.VariableDeclarationList */; + return node.kind === 258 /* SyntaxKind.VariableDeclarationList */; } ts.isVariableDeclarationList = isVariableDeclarationList; function isFunctionDeclaration(node) { - return node.kind === 256 /* SyntaxKind.FunctionDeclaration */; + return node.kind === 259 /* SyntaxKind.FunctionDeclaration */; } ts.isFunctionDeclaration = isFunctionDeclaration; function isClassDeclaration(node) { - return node.kind === 257 /* SyntaxKind.ClassDeclaration */; + return node.kind === 260 /* SyntaxKind.ClassDeclaration */; } ts.isClassDeclaration = isClassDeclaration; function isInterfaceDeclaration(node) { - return node.kind === 258 /* SyntaxKind.InterfaceDeclaration */; + return node.kind === 261 /* SyntaxKind.InterfaceDeclaration */; } ts.isInterfaceDeclaration = isInterfaceDeclaration; function isTypeAliasDeclaration(node) { - return node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */; + return node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */; } ts.isTypeAliasDeclaration = isTypeAliasDeclaration; function isEnumDeclaration(node) { - return node.kind === 260 /* SyntaxKind.EnumDeclaration */; + return node.kind === 263 /* SyntaxKind.EnumDeclaration */; } ts.isEnumDeclaration = isEnumDeclaration; function isModuleDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isModuleDeclaration = isModuleDeclaration; function isModuleBlock(node) { - return node.kind === 262 /* SyntaxKind.ModuleBlock */; + return node.kind === 265 /* SyntaxKind.ModuleBlock */; } ts.isModuleBlock = isModuleBlock; function isCaseBlock(node) { - return node.kind === 263 /* SyntaxKind.CaseBlock */; + return node.kind === 266 /* SyntaxKind.CaseBlock */; } ts.isCaseBlock = isCaseBlock; function isNamespaceExportDeclaration(node) { - return node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration; function isImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportDeclaration(node) { - return node.kind === 266 /* SyntaxKind.ImportDeclaration */; + return node.kind === 269 /* SyntaxKind.ImportDeclaration */; } ts.isImportDeclaration = isImportDeclaration; function isImportClause(node) { - return node.kind === 267 /* SyntaxKind.ImportClause */; + return node.kind === 270 /* SyntaxKind.ImportClause */; } ts.isImportClause = isImportClause; function isImportTypeAssertionContainer(node) { - return node.kind === 295 /* SyntaxKind.ImportTypeAssertionContainer */; + return node.kind === 298 /* SyntaxKind.ImportTypeAssertionContainer */; } ts.isImportTypeAssertionContainer = isImportTypeAssertionContainer; function isAssertClause(node) { - return node.kind === 293 /* SyntaxKind.AssertClause */; + return node.kind === 296 /* SyntaxKind.AssertClause */; } ts.isAssertClause = isAssertClause; function isAssertEntry(node) { - return node.kind === 294 /* SyntaxKind.AssertEntry */; + return node.kind === 297 /* SyntaxKind.AssertEntry */; } ts.isAssertEntry = isAssertEntry; function isNamespaceImport(node) { - return node.kind === 268 /* SyntaxKind.NamespaceImport */; + return node.kind === 271 /* SyntaxKind.NamespaceImport */; } ts.isNamespaceImport = isNamespaceImport; function isNamespaceExport(node) { - return node.kind === 274 /* SyntaxKind.NamespaceExport */; + return node.kind === 277 /* SyntaxKind.NamespaceExport */; } ts.isNamespaceExport = isNamespaceExport; function isNamedImports(node) { - return node.kind === 269 /* SyntaxKind.NamedImports */; + return node.kind === 272 /* SyntaxKind.NamedImports */; } ts.isNamedImports = isNamedImports; function isImportSpecifier(node) { - return node.kind === 270 /* SyntaxKind.ImportSpecifier */; + return node.kind === 273 /* SyntaxKind.ImportSpecifier */; } ts.isImportSpecifier = isImportSpecifier; function isExportAssignment(node) { - return node.kind === 271 /* SyntaxKind.ExportAssignment */; + return node.kind === 274 /* SyntaxKind.ExportAssignment */; } ts.isExportAssignment = isExportAssignment; function isExportDeclaration(node) { - return node.kind === 272 /* SyntaxKind.ExportDeclaration */; + return node.kind === 275 /* SyntaxKind.ExportDeclaration */; } ts.isExportDeclaration = isExportDeclaration; function isNamedExports(node) { - return node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 275 /* SyntaxKind.ExportSpecifier */; + return node.kind === 278 /* SyntaxKind.ExportSpecifier */; } ts.isExportSpecifier = isExportSpecifier; function isMissingDeclaration(node) { - return node.kind === 276 /* SyntaxKind.MissingDeclaration */; + return node.kind === 279 /* SyntaxKind.MissingDeclaration */; } ts.isMissingDeclaration = isMissingDeclaration; function isNotEmittedStatement(node) { - return node.kind === 349 /* SyntaxKind.NotEmittedStatement */; + return node.kind === 352 /* SyntaxKind.NotEmittedStatement */; } ts.isNotEmittedStatement = isNotEmittedStatement; /* @internal */ function isSyntheticReference(node) { - return node.kind === 354 /* SyntaxKind.SyntheticReferenceExpression */; + return node.kind === 357 /* SyntaxKind.SyntheticReferenceExpression */; } ts.isSyntheticReference = isSyntheticReference; /* @internal */ function isMergeDeclarationMarker(node) { - return node.kind === 352 /* SyntaxKind.MergeDeclarationMarker */; + return node.kind === 355 /* SyntaxKind.MergeDeclarationMarker */; } ts.isMergeDeclarationMarker = isMergeDeclarationMarker; /* @internal */ function isEndOfDeclarationMarker(node) { - return node.kind === 353 /* SyntaxKind.EndOfDeclarationMarker */; + return node.kind === 356 /* SyntaxKind.EndOfDeclarationMarker */; } ts.isEndOfDeclarationMarker = isEndOfDeclarationMarker; // Module References function isExternalModuleReference(node) { - return node.kind === 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 280 /* SyntaxKind.ExternalModuleReference */; } ts.isExternalModuleReference = isExternalModuleReference; // JSX function isJsxElement(node) { - return node.kind === 278 /* SyntaxKind.JsxElement */; + return node.kind === 281 /* SyntaxKind.JsxElement */; } ts.isJsxElement = isJsxElement; function isJsxSelfClosingElement(node) { - return node.kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return node.kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } ts.isJsxSelfClosingElement = isJsxSelfClosingElement; function isJsxOpeningElement(node) { - return node.kind === 280 /* SyntaxKind.JsxOpeningElement */; + return node.kind === 283 /* SyntaxKind.JsxOpeningElement */; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 281 /* SyntaxKind.JsxClosingElement */; + return node.kind === 284 /* SyntaxKind.JsxClosingElement */; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxFragment(node) { - return node.kind === 282 /* SyntaxKind.JsxFragment */; + return node.kind === 285 /* SyntaxKind.JsxFragment */; } ts.isJsxFragment = isJsxFragment; function isJsxOpeningFragment(node) { - return node.kind === 283 /* SyntaxKind.JsxOpeningFragment */; + return node.kind === 286 /* SyntaxKind.JsxOpeningFragment */; } ts.isJsxOpeningFragment = isJsxOpeningFragment; function isJsxClosingFragment(node) { - return node.kind === 284 /* SyntaxKind.JsxClosingFragment */; + return node.kind === 287 /* SyntaxKind.JsxClosingFragment */; } ts.isJsxClosingFragment = isJsxClosingFragment; function isJsxAttribute(node) { - return node.kind === 285 /* SyntaxKind.JsxAttribute */; + return node.kind === 288 /* SyntaxKind.JsxAttribute */; } ts.isJsxAttribute = isJsxAttribute; function isJsxAttributes(node) { - return node.kind === 286 /* SyntaxKind.JsxAttributes */; + return node.kind === 289 /* SyntaxKind.JsxAttributes */; } ts.isJsxAttributes = isJsxAttributes; function isJsxSpreadAttribute(node) { - return node.kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return node.kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxExpression(node) { - return node.kind === 288 /* SyntaxKind.JsxExpression */; + return node.kind === 291 /* SyntaxKind.JsxExpression */; } ts.isJsxExpression = isJsxExpression; // Clauses function isCaseClause(node) { - return node.kind === 289 /* SyntaxKind.CaseClause */; + return node.kind === 292 /* SyntaxKind.CaseClause */; } ts.isCaseClause = isCaseClause; function isDefaultClause(node) { - return node.kind === 290 /* SyntaxKind.DefaultClause */; + return node.kind === 293 /* SyntaxKind.DefaultClause */; } ts.isDefaultClause = isDefaultClause; function isHeritageClause(node) { - return node.kind === 291 /* SyntaxKind.HeritageClause */; + return node.kind === 294 /* SyntaxKind.HeritageClause */; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClause = isCatchClause; // Property assignments function isPropertyAssignment(node) { - return node.kind === 296 /* SyntaxKind.PropertyAssignment */; + return node.kind === 299 /* SyntaxKind.PropertyAssignment */; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */; + return node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isSpreadAssignment(node) { - return node.kind === 298 /* SyntaxKind.SpreadAssignment */; + return node.kind === 301 /* SyntaxKind.SpreadAssignment */; } ts.isSpreadAssignment = isSpreadAssignment; // Enum function isEnumMember(node) { - return node.kind === 299 /* SyntaxKind.EnumMember */; + return node.kind === 302 /* SyntaxKind.EnumMember */; } ts.isEnumMember = isEnumMember; // Unparsed // TODO(rbuckton): isUnparsedPrologue function isUnparsedPrepend(node) { - return node.kind === 301 /* SyntaxKind.UnparsedPrepend */; + return node.kind === 304 /* SyntaxKind.UnparsedPrepend */; } ts.isUnparsedPrepend = isUnparsedPrepend; // TODO(rbuckton): isUnparsedText @@ -29780,176 +29775,176 @@ var ts; // TODO(rbuckton): isUnparsedSyntheticReference // Top-level nodes function isSourceFile(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */; + return node.kind === 308 /* SyntaxKind.SourceFile */; } ts.isSourceFile = isSourceFile; function isBundle(node) { - return node.kind === 306 /* SyntaxKind.Bundle */; + return node.kind === 309 /* SyntaxKind.Bundle */; } ts.isBundle = isBundle; function isUnparsedSource(node) { - return node.kind === 307 /* SyntaxKind.UnparsedSource */; + return node.kind === 310 /* SyntaxKind.UnparsedSource */; } ts.isUnparsedSource = isUnparsedSource; // TODO(rbuckton): isInputFiles // JSDoc Elements function isJSDocTypeExpression(node) { - return node.kind === 309 /* SyntaxKind.JSDocTypeExpression */; + return node.kind === 312 /* SyntaxKind.JSDocTypeExpression */; } ts.isJSDocTypeExpression = isJSDocTypeExpression; function isJSDocNameReference(node) { - return node.kind === 310 /* SyntaxKind.JSDocNameReference */; + return node.kind === 313 /* SyntaxKind.JSDocNameReference */; } ts.isJSDocNameReference = isJSDocNameReference; function isJSDocMemberName(node) { - return node.kind === 311 /* SyntaxKind.JSDocMemberName */; + return node.kind === 314 /* SyntaxKind.JSDocMemberName */; } ts.isJSDocMemberName = isJSDocMemberName; function isJSDocLink(node) { - return node.kind === 324 /* SyntaxKind.JSDocLink */; + return node.kind === 327 /* SyntaxKind.JSDocLink */; } ts.isJSDocLink = isJSDocLink; function isJSDocLinkCode(node) { - return node.kind === 325 /* SyntaxKind.JSDocLinkCode */; + return node.kind === 328 /* SyntaxKind.JSDocLinkCode */; } ts.isJSDocLinkCode = isJSDocLinkCode; function isJSDocLinkPlain(node) { - return node.kind === 326 /* SyntaxKind.JSDocLinkPlain */; + return node.kind === 329 /* SyntaxKind.JSDocLinkPlain */; } ts.isJSDocLinkPlain = isJSDocLinkPlain; function isJSDocAllType(node) { - return node.kind === 312 /* SyntaxKind.JSDocAllType */; + return node.kind === 315 /* SyntaxKind.JSDocAllType */; } ts.isJSDocAllType = isJSDocAllType; function isJSDocUnknownType(node) { - return node.kind === 313 /* SyntaxKind.JSDocUnknownType */; + return node.kind === 316 /* SyntaxKind.JSDocUnknownType */; } ts.isJSDocUnknownType = isJSDocUnknownType; function isJSDocNullableType(node) { - return node.kind === 314 /* SyntaxKind.JSDocNullableType */; + return node.kind === 317 /* SyntaxKind.JSDocNullableType */; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 315 /* SyntaxKind.JSDocNonNullableType */; + return node.kind === 318 /* SyntaxKind.JSDocNonNullableType */; } ts.isJSDocNonNullableType = isJSDocNonNullableType; function isJSDocOptionalType(node) { - return node.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return node.kind === 319 /* SyntaxKind.JSDocOptionalType */; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 317 /* SyntaxKind.JSDocFunctionType */; + return node.kind === 320 /* SyntaxKind.JSDocFunctionType */; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 318 /* SyntaxKind.JSDocVariadicType */; + return node.kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isJSDocVariadicType = isJSDocVariadicType; function isJSDocNamepathType(node) { - return node.kind === 319 /* SyntaxKind.JSDocNamepathType */; + return node.kind === 322 /* SyntaxKind.JSDocNamepathType */; } ts.isJSDocNamepathType = isJSDocNamepathType; function isJSDoc(node) { - return node.kind === 320 /* SyntaxKind.JSDoc */; + return node.kind === 323 /* SyntaxKind.JSDoc */; } ts.isJSDoc = isJSDoc; function isJSDocTypeLiteral(node) { - return node.kind === 322 /* SyntaxKind.JSDocTypeLiteral */; + return node.kind === 325 /* SyntaxKind.JSDocTypeLiteral */; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; function isJSDocSignature(node) { - return node.kind === 323 /* SyntaxKind.JSDocSignature */; + return node.kind === 326 /* SyntaxKind.JSDocSignature */; } ts.isJSDocSignature = isJSDocSignature; // JSDoc Tags function isJSDocAugmentsTag(node) { - return node.kind === 328 /* SyntaxKind.JSDocAugmentsTag */; + return node.kind === 331 /* SyntaxKind.JSDocAugmentsTag */; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocAuthorTag(node) { - return node.kind === 330 /* SyntaxKind.JSDocAuthorTag */; + return node.kind === 333 /* SyntaxKind.JSDocAuthorTag */; } ts.isJSDocAuthorTag = isJSDocAuthorTag; function isJSDocClassTag(node) { - return node.kind === 332 /* SyntaxKind.JSDocClassTag */; + return node.kind === 335 /* SyntaxKind.JSDocClassTag */; } ts.isJSDocClassTag = isJSDocClassTag; function isJSDocCallbackTag(node) { - return node.kind === 338 /* SyntaxKind.JSDocCallbackTag */; + return node.kind === 341 /* SyntaxKind.JSDocCallbackTag */; } ts.isJSDocCallbackTag = isJSDocCallbackTag; function isJSDocPublicTag(node) { - return node.kind === 333 /* SyntaxKind.JSDocPublicTag */; + return node.kind === 336 /* SyntaxKind.JSDocPublicTag */; } ts.isJSDocPublicTag = isJSDocPublicTag; function isJSDocPrivateTag(node) { - return node.kind === 334 /* SyntaxKind.JSDocPrivateTag */; + return node.kind === 337 /* SyntaxKind.JSDocPrivateTag */; } ts.isJSDocPrivateTag = isJSDocPrivateTag; function isJSDocProtectedTag(node) { - return node.kind === 335 /* SyntaxKind.JSDocProtectedTag */; + return node.kind === 338 /* SyntaxKind.JSDocProtectedTag */; } ts.isJSDocProtectedTag = isJSDocProtectedTag; function isJSDocReadonlyTag(node) { - return node.kind === 336 /* SyntaxKind.JSDocReadonlyTag */; + return node.kind === 339 /* SyntaxKind.JSDocReadonlyTag */; } ts.isJSDocReadonlyTag = isJSDocReadonlyTag; function isJSDocOverrideTag(node) { - return node.kind === 337 /* SyntaxKind.JSDocOverrideTag */; + return node.kind === 340 /* SyntaxKind.JSDocOverrideTag */; } ts.isJSDocOverrideTag = isJSDocOverrideTag; function isJSDocDeprecatedTag(node) { - return node.kind === 331 /* SyntaxKind.JSDocDeprecatedTag */; + return node.kind === 334 /* SyntaxKind.JSDocDeprecatedTag */; } ts.isJSDocDeprecatedTag = isJSDocDeprecatedTag; function isJSDocSeeTag(node) { - return node.kind === 346 /* SyntaxKind.JSDocSeeTag */; + return node.kind === 349 /* SyntaxKind.JSDocSeeTag */; } ts.isJSDocSeeTag = isJSDocSeeTag; function isJSDocEnumTag(node) { - return node.kind === 339 /* SyntaxKind.JSDocEnumTag */; + return node.kind === 342 /* SyntaxKind.JSDocEnumTag */; } ts.isJSDocEnumTag = isJSDocEnumTag; function isJSDocParameterTag(node) { - return node.kind === 340 /* SyntaxKind.JSDocParameterTag */; + return node.kind === 343 /* SyntaxKind.JSDocParameterTag */; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 341 /* SyntaxKind.JSDocReturnTag */; + return node.kind === 344 /* SyntaxKind.JSDocReturnTag */; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocThisTag(node) { - return node.kind === 342 /* SyntaxKind.JSDocThisTag */; + return node.kind === 345 /* SyntaxKind.JSDocThisTag */; } ts.isJSDocThisTag = isJSDocThisTag; function isJSDocTypeTag(node) { - return node.kind === 343 /* SyntaxKind.JSDocTypeTag */; + return node.kind === 346 /* SyntaxKind.JSDocTypeTag */; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 344 /* SyntaxKind.JSDocTemplateTag */; + return node.kind === 347 /* SyntaxKind.JSDocTemplateTag */; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 345 /* SyntaxKind.JSDocTypedefTag */; + return node.kind === 348 /* SyntaxKind.JSDocTypedefTag */; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocUnknownTag(node) { - return node.kind === 327 /* SyntaxKind.JSDocTag */; + return node.kind === 330 /* SyntaxKind.JSDocTag */; } ts.isJSDocUnknownTag = isJSDocUnknownTag; function isJSDocPropertyTag(node) { - return node.kind === 347 /* SyntaxKind.JSDocPropertyTag */; + return node.kind === 350 /* SyntaxKind.JSDocPropertyTag */; } ts.isJSDocPropertyTag = isJSDocPropertyTag; function isJSDocImplementsTag(node) { - return node.kind === 329 /* SyntaxKind.JSDocImplementsTag */; + return node.kind === 332 /* SyntaxKind.JSDocImplementsTag */; } ts.isJSDocImplementsTag = isJSDocImplementsTag; // Synthesized list /* @internal */ function isSyntaxList(n) { - return n.kind === 348 /* SyntaxKind.SyntaxList */; + return n.kind === 351 /* SyntaxKind.SyntaxList */; } ts.isSyntaxList = isSyntaxList; })(ts || (ts = {})); @@ -30148,14 +30143,14 @@ var ts; ts.Debug.failBadSyntaxKind(property.name, "Private identifiers are not allowed in object literals."); } switch (property.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return createExpressionForAccessorDeclaration(factory, node.properties, property, receiver, !!node.multiLine); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return createExpressionForPropertyAssignment(factory, property, receiver); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return createExpressionForShorthandPropertyAssignment(factory, property, receiver); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return createExpressionForMethodDeclaration(factory, property, receiver); } } @@ -30263,8 +30258,8 @@ var ts; } ts.startsWithUseStrict = startsWithUseStrict; function isCommaSequence(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ || - node.kind === 351 /* SyntaxKind.CommaListExpression */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ || + node.kind === 354 /* SyntaxKind.CommaListExpression */; } ts.isCommaSequence = isCommaSequence; function isJSDocTypeAssertion(node) { @@ -30282,17 +30277,18 @@ var ts; function isOuterExpression(node, kinds) { if (kinds === void 0) { kinds = 15 /* OuterExpressionKinds.All */; } switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: if (kinds & 16 /* OuterExpressionKinds.ExcludeJSDocTypeAssertion */ && isJSDocTypeAssertion(node)) { return false; } return (kinds & 1 /* OuterExpressionKinds.Parentheses */) !== 0; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return (kinds & 2 /* OuterExpressionKinds.TypeAssertions */) !== 0; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return (kinds & 4 /* OuterExpressionKinds.NonNullAssertions */) !== 0; - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return (kinds & 8 /* OuterExpressionKinds.PartiallyEmittedExpressions */) !== 0; } return false; @@ -30413,10 +30409,10 @@ var ts; var name = namespaceDeclaration.name; return ts.isGeneratedIdentifier(name) ? name : factory.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name)); } - if (node.kind === 266 /* SyntaxKind.ImportDeclaration */ && node.importClause) { + if (node.kind === 269 /* SyntaxKind.ImportDeclaration */ && node.importClause) { return factory.getGeneratedNameForNode(node); } - if (node.kind === 272 /* SyntaxKind.ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 275 /* SyntaxKind.ExportDeclaration */ && node.moduleSpecifier) { return factory.getGeneratedNameForNode(node); } return undefined; @@ -30535,7 +30531,7 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // `b` in `({ a: b } = ...)` // `b` in `({ a: b = 1 } = ...)` // `{b}` in `({ a: {b} } = ...)` @@ -30547,11 +30543,11 @@ var ts; // `b[0]` in `({ a: b[0] } = ...)` // `b[0]` in `({ a: b[0] = 1 } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // `a` in `({ a } = ...)` // `a` in `({ a = 1 } = ...)` return bindingElement.name; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: // `a` in `({ ...a } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } @@ -30583,12 +30579,12 @@ var ts; */ function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: // `...` in `let [...a] = ...` return bindingElement.dotDotDotToken; - case 225 /* SyntaxKind.SpreadElement */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 227 /* SyntaxKind.SpreadElement */: + case 301 /* SyntaxKind.SpreadAssignment */: // `...` in `[...a] = ...` return bindingElement; } @@ -30606,7 +30602,7 @@ var ts; ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; function tryGetPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: // `a` in `let { a: b } = ...` // `[a]` in `let { [a]: b } = ...` // `"a"` in `let { "a": b } = ...` @@ -30621,7 +30617,7 @@ var ts; : propertyName; } break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // `a` in `({ a: b } = ...)` // `[a]` in `({ [a]: b } = ...)` // `"a"` in `({ "a": b } = ...)` @@ -30636,7 +30632,7 @@ var ts; : propertyName; } break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: // `a` in `({ ...a } = ...)` if (bindingElement.name && ts.isPrivateIdentifier(bindingElement.name)) { return ts.Debug.failBadSyntaxKind(bindingElement.name); @@ -30659,13 +30655,13 @@ var ts; */ function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: // `a` in `{a}` // `a` in `[a]` return name.elements; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: // `a` in `{a}` return name.properties; } @@ -30686,46 +30682,46 @@ var ts; ts.getJSDocTypeAliasName = getJSDocTypeAliasName; function canHaveIllegalType(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.canHaveIllegalType = canHaveIllegalType; function canHaveIllegalTypeParameters(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.canHaveIllegalTypeParameters = canHaveIllegalTypeParameters; function canHaveIllegalDecorators(node) { var kind = node.kind; - return kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */; + return kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */; } ts.canHaveIllegalDecorators = canHaveIllegalDecorators; function canHaveIllegalModifiers(node) { var kind = node.kind; - return kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 179 /* SyntaxKind.FunctionType */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 181 /* SyntaxKind.FunctionType */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } ts.canHaveIllegalModifiers = canHaveIllegalModifiers; ts.isTypeNodeOrTypeParameterDeclaration = ts.or(ts.isTypeNode, ts.isTypeParameterDeclaration); @@ -30999,6 +30995,83 @@ var ts; return ts.setTextRange(factory.createNodeArray([], nodes.hasTrailingComma), nodes); } ts.elideNodes = elideNodes; + /** + * Gets the node from which a name should be generated. + */ + function getNodeForGeneratedName(name) { + if (name.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) { + var autoGenerateId = name.autoGenerateId; + var node = name; + var original = node.original; + while (original) { + node = original; + // if "node" is a different generated name (having a different "autoGenerateId"), use it and stop traversing. + if (ts.isMemberName(node) + && !!(node.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) + && node.autoGenerateId !== autoGenerateId) { + break; + } + original = node.original; + } + // otherwise, return the original node for the source + return node; + } + return name; + } + ts.getNodeForGeneratedName = getNodeForGeneratedName; + function formatGeneratedNamePart(part, generateName) { + return typeof part === "object" ? formatGeneratedName(/*privateName*/ false, part.prefix, part.node, part.suffix, generateName) : + typeof part === "string" ? part.length > 0 && part.charCodeAt(0) === 35 /* CharacterCodes.hash */ ? part.slice(1) : part : + ""; + } + ts.formatGeneratedNamePart = formatGeneratedNamePart; + function formatIdentifier(name, generateName) { + return typeof name === "string" ? name : + formatIdentifierWorker(name, ts.Debug.checkDefined(generateName)); + } + function formatIdentifierWorker(node, generateName) { + return ts.isGeneratedPrivateIdentifier(node) ? generateName(node).slice(1) : + ts.isGeneratedIdentifier(node) ? generateName(node) : + ts.isPrivateIdentifier(node) ? node.escapedText.slice(1) : + ts.idText(node); + } + function formatGeneratedName(privateName, prefix, baseName, suffix, generateName) { + prefix = formatGeneratedNamePart(prefix, generateName); + suffix = formatGeneratedNamePart(suffix, generateName); + baseName = formatIdentifier(baseName, generateName); + return "".concat(privateName ? "#" : "").concat(prefix).concat(baseName).concat(suffix); + } + ts.formatGeneratedName = formatGeneratedName; + /** + * Creates a private backing field for an `accessor` {@link PropertyDeclaration}. + */ + function createAccessorPropertyBackingField(factory, node, modifiers, initializer) { + return factory.updatePropertyDeclaration(node, modifiers, factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage"), + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, initializer); + } + ts.createAccessorPropertyBackingField = createAccessorPropertyBackingField; + /** + * Creates a {@link GetAccessorDeclaration} that reads from a private backing field. + */ + function createAccessorPropertyGetRedirector(factory, node, modifiers, name) { + return factory.createGetAccessorDeclaration(modifiers, name, [], + /*type*/ undefined, factory.createBlock([ + factory.createReturnStatement(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage"))) + ])); + } + ts.createAccessorPropertyGetRedirector = createAccessorPropertyGetRedirector; + /** + * Creates a {@link SetAccessorDeclaration} that writes to a private backing field. + */ + function createAccessorPropertySetRedirector(factory, node, modifiers, name) { + return factory.createSetAccessorDeclaration(modifiers, name, [factory.createParameterDeclaration( + /*modifiers*/ undefined, + /*dotdotDotToken*/ undefined, "value")], factory.createBlock([ + factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage")), factory.createIdentifier("value"))) + ])); + } + ts.createAccessorPropertySetRedirector = createAccessorPropertySetRedirector; })(ts || (ts = {})); var ts; (function (ts) { @@ -31008,47 +31081,48 @@ var ts; ts.setTextRange = setTextRange; function canHaveModifiers(node) { var kind = node.kind; - return kind === 163 /* SyntaxKind.TypeParameter */ - || kind === 164 /* SyntaxKind.Parameter */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 180 /* SyntaxKind.ConstructorType */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */ - || kind === 272 /* SyntaxKind.ExportDeclaration */; + return kind === 165 /* SyntaxKind.TypeParameter */ + || kind === 166 /* SyntaxKind.Parameter */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 182 /* SyntaxKind.ConstructorType */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */ + || kind === 275 /* SyntaxKind.ExportDeclaration */; } ts.canHaveModifiers = canHaveModifiers; function canHaveDecorators(node) { var kind = node.kind; - return kind === 164 /* SyntaxKind.Parameter */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 257 /* SyntaxKind.ClassDeclaration */; + return kind === 166 /* SyntaxKind.Parameter */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 260 /* SyntaxKind.ClassDeclaration */; } ts.canHaveDecorators = canHaveDecorators; })(ts || (ts = {})); var ts; (function (ts) { + var _a; var SignatureFlags; (function (SignatureFlags) { SignatureFlags[SignatureFlags["None"] = 0] = "None"; @@ -31136,6 +31210,718 @@ var ts; function isImportMeta(node) { return ts.isMetaProperty(node) && node.keywordToken === 100 /* SyntaxKind.ImportKeyword */ && node.name.escapedText === "meta"; } + var forEachChildTable = (_a = {}, + _a[163 /* SyntaxKind.QualifiedName */] = function forEachChildInQualifiedName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + }, + _a[165 /* SyntaxKind.TypeParameter */] = function forEachChildInTypeParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.default) || + visitNode(cbNode, node.expression); + }, + _a[300 /* SyntaxKind.ShorthandPropertyAssignment */] = function forEachChildInShorthandPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.equalsToken) || + visitNode(cbNode, node.objectAssignmentInitializer); + }, + _a[301 /* SyntaxKind.SpreadAssignment */] = function forEachChildInSpreadAssignment(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[166 /* SyntaxKind.Parameter */] = function forEachChildInParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[169 /* SyntaxKind.PropertyDeclaration */] = function forEachChildInPropertyDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[168 /* SyntaxKind.PropertySignature */] = function forEachChildInPropertySignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[299 /* SyntaxKind.PropertyAssignment */] = function forEachChildInPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.initializer); + }, + _a[257 /* SyntaxKind.VariableDeclaration */] = function forEachChildInVariableDeclaration(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[205 /* SyntaxKind.BindingElement */] = function forEachChildInBindingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[178 /* SyntaxKind.IndexSignature */] = function forEachChildInIndexSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[182 /* SyntaxKind.ConstructorType */] = function forEachChildInConstructorType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[181 /* SyntaxKind.FunctionType */] = function forEachChildInFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[176 /* SyntaxKind.CallSignature */] = forEachChildInCallOrConstructSignature, + _a[177 /* SyntaxKind.ConstructSignature */] = forEachChildInCallOrConstructSignature, + _a[171 /* SyntaxKind.MethodDeclaration */] = function forEachChildInMethodDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[170 /* SyntaxKind.MethodSignature */] = function forEachChildInMethodSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[173 /* SyntaxKind.Constructor */] = function forEachChildInConstructor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[174 /* SyntaxKind.GetAccessor */] = function forEachChildInGetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[175 /* SyntaxKind.SetAccessor */] = function forEachChildInSetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[259 /* SyntaxKind.FunctionDeclaration */] = function forEachChildInFunctionDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[215 /* SyntaxKind.FunctionExpression */] = function forEachChildInFunctionExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[216 /* SyntaxKind.ArrowFunction */] = function forEachChildInArrowFunction(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.equalsGreaterThanToken) || + visitNode(cbNode, node.body); + }, + _a[172 /* SyntaxKind.ClassStaticBlockDeclaration */] = function forEachChildInClassStaticBlockDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.body); + }, + _a[180 /* SyntaxKind.TypeReference */] = function forEachChildInTypeReference(node, cbNode, cbNodes) { + return visitNode(cbNode, node.typeName) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[179 /* SyntaxKind.TypePredicate */] = function forEachChildInTypePredicate(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertsModifier) || + visitNode(cbNode, node.parameterName) || + visitNode(cbNode, node.type); + }, + _a[183 /* SyntaxKind.TypeQuery */] = function forEachChildInTypeQuery(node, cbNode, cbNodes) { + return visitNode(cbNode, node.exprName) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[184 /* SyntaxKind.TypeLiteral */] = function forEachChildInTypeLiteral(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.members); + }, + _a[185 /* SyntaxKind.ArrayType */] = function forEachChildInArrayType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.elementType); + }, + _a[186 /* SyntaxKind.TupleType */] = function forEachChildInTupleType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[189 /* SyntaxKind.UnionType */] = forEachChildInUnionOrIntersectionType, + _a[190 /* SyntaxKind.IntersectionType */] = forEachChildInUnionOrIntersectionType, + _a[191 /* SyntaxKind.ConditionalType */] = function forEachChildInConditionalType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.checkType) || + visitNode(cbNode, node.extendsType) || + visitNode(cbNode, node.trueType) || + visitNode(cbNode, node.falseType); + }, + _a[192 /* SyntaxKind.InferType */] = function forEachChildInInferType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.typeParameter); + }, + _a[202 /* SyntaxKind.ImportType */] = function forEachChildInImportType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.argument) || + visitNode(cbNode, node.assertions) || + visitNode(cbNode, node.qualifier) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[298 /* SyntaxKind.ImportTypeAssertionContainer */] = function forEachChildInImportTypeAssertionContainer(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertClause); + }, + _a[193 /* SyntaxKind.ParenthesizedType */] = forEachChildInParenthesizedTypeOrTypeOperator, + _a[195 /* SyntaxKind.TypeOperator */] = forEachChildInParenthesizedTypeOrTypeOperator, + _a[196 /* SyntaxKind.IndexedAccessType */] = function forEachChildInIndexedAccessType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.objectType) || + visitNode(cbNode, node.indexType); + }, + _a[197 /* SyntaxKind.MappedType */] = function forEachChildInMappedType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.readonlyToken) || + visitNode(cbNode, node.typeParameter) || + visitNode(cbNode, node.nameType) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[198 /* SyntaxKind.LiteralType */] = function forEachChildInLiteralType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.literal); + }, + _a[199 /* SyntaxKind.NamedTupleMember */] = function forEachChildInNamedTupleMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type); + }, + _a[203 /* SyntaxKind.ObjectBindingPattern */] = forEachChildInObjectOrArrayBindingPattern, + _a[204 /* SyntaxKind.ArrayBindingPattern */] = forEachChildInObjectOrArrayBindingPattern, + _a[206 /* SyntaxKind.ArrayLiteralExpression */] = function forEachChildInArrayLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[207 /* SyntaxKind.ObjectLiteralExpression */] = function forEachChildInObjectLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, + _a[208 /* SyntaxKind.PropertyAccessExpression */] = function forEachChildInPropertyAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNode(cbNode, node.name); + }, + _a[209 /* SyntaxKind.ElementAccessExpression */] = function forEachChildInElementAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNode(cbNode, node.argumentExpression); + }, + _a[210 /* SyntaxKind.CallExpression */] = forEachChildInCallOrNewExpression, + _a[211 /* SyntaxKind.NewExpression */] = forEachChildInCallOrNewExpression, + _a[212 /* SyntaxKind.TaggedTemplateExpression */] = function forEachChildInTaggedTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tag) || + visitNode(cbNode, node.questionDotToken) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNode(cbNode, node.template); + }, + _a[213 /* SyntaxKind.TypeAssertionExpression */] = function forEachChildInTypeAssertionExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.expression); + }, + _a[214 /* SyntaxKind.ParenthesizedExpression */] = function forEachChildInParenthesizedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[217 /* SyntaxKind.DeleteExpression */] = function forEachChildInDeleteExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[218 /* SyntaxKind.TypeOfExpression */] = function forEachChildInTypeOfExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[219 /* SyntaxKind.VoidExpression */] = function forEachChildInVoidExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[221 /* SyntaxKind.PrefixUnaryExpression */] = function forEachChildInPrefixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, + _a[226 /* SyntaxKind.YieldExpression */] = function forEachChildInYieldExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + }, + _a[220 /* SyntaxKind.AwaitExpression */] = function forEachChildInAwaitExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[222 /* SyntaxKind.PostfixUnaryExpression */] = function forEachChildInPostfixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, + _a[223 /* SyntaxKind.BinaryExpression */] = function forEachChildInBinaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.operatorToken) || + visitNode(cbNode, node.right); + }, + _a[231 /* SyntaxKind.AsExpression */] = function forEachChildInAsExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.type); + }, + _a[232 /* SyntaxKind.NonNullExpression */] = function forEachChildInNonNullExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[235 /* SyntaxKind.SatisfiesExpression */] = function forEachChildInSatisfiesExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); + }, + _a[233 /* SyntaxKind.MetaProperty */] = function forEachChildInMetaProperty(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[224 /* SyntaxKind.ConditionalExpression */] = function forEachChildInConditionalExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.condition) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.whenTrue) || + visitNode(cbNode, node.colonToken) || + visitNode(cbNode, node.whenFalse); + }, + _a[227 /* SyntaxKind.SpreadElement */] = function forEachChildInSpreadElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[238 /* SyntaxKind.Block */] = forEachChildInBlock, + _a[265 /* SyntaxKind.ModuleBlock */] = forEachChildInBlock, + _a[308 /* SyntaxKind.SourceFile */] = function forEachChildInSourceFile(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements) || + visitNode(cbNode, node.endOfFileToken); + }, + _a[240 /* SyntaxKind.VariableStatement */] = function forEachChildInVariableStatement(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.declarationList); + }, + _a[258 /* SyntaxKind.VariableDeclarationList */] = function forEachChildInVariableDeclarationList(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.declarations); + }, + _a[241 /* SyntaxKind.ExpressionStatement */] = function forEachChildInExpressionStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[242 /* SyntaxKind.IfStatement */] = function forEachChildInIfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.thenStatement) || + visitNode(cbNode, node.elseStatement); + }, + _a[243 /* SyntaxKind.DoStatement */] = function forEachChildInDoStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.statement) || + visitNode(cbNode, node.expression); + }, + _a[244 /* SyntaxKind.WhileStatement */] = function forEachChildInWhileStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[245 /* SyntaxKind.ForStatement */] = function forEachChildInForStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.incrementor) || + visitNode(cbNode, node.statement); + }, + _a[246 /* SyntaxKind.ForInStatement */] = function forEachChildInForInStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[247 /* SyntaxKind.ForOfStatement */] = function forEachChildInForOfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.awaitModifier) || + visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[248 /* SyntaxKind.ContinueStatement */] = forEachChildInContinueOrBreakStatement, + _a[249 /* SyntaxKind.BreakStatement */] = forEachChildInContinueOrBreakStatement, + _a[250 /* SyntaxKind.ReturnStatement */] = function forEachChildInReturnStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[251 /* SyntaxKind.WithStatement */] = function forEachChildInWithStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[252 /* SyntaxKind.SwitchStatement */] = function forEachChildInSwitchStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.caseBlock); + }, + _a[266 /* SyntaxKind.CaseBlock */] = function forEachChildInCaseBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.clauses); + }, + _a[292 /* SyntaxKind.CaseClause */] = function forEachChildInCaseClause(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNodes(cbNode, cbNodes, node.statements); + }, + _a[293 /* SyntaxKind.DefaultClause */] = function forEachChildInDefaultClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + }, + _a[253 /* SyntaxKind.LabeledStatement */] = function forEachChildInLabeledStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + }, + _a[254 /* SyntaxKind.ThrowStatement */] = function forEachChildInThrowStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[255 /* SyntaxKind.TryStatement */] = function forEachChildInTryStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tryBlock) || + visitNode(cbNode, node.catchClause) || + visitNode(cbNode, node.finallyBlock); + }, + _a[295 /* SyntaxKind.CatchClause */] = function forEachChildInCatchClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.variableDeclaration) || + visitNode(cbNode, node.block); + }, + _a[167 /* SyntaxKind.Decorator */] = function forEachChildInDecorator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[260 /* SyntaxKind.ClassDeclaration */] = forEachChildInClassDeclarationOrExpression, + _a[228 /* SyntaxKind.ClassExpression */] = forEachChildInClassDeclarationOrExpression, + _a[261 /* SyntaxKind.InterfaceDeclaration */] = function forEachChildInInterfaceDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[262 /* SyntaxKind.TypeAliasDeclaration */] = function forEachChildInTypeAliasDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNode(cbNode, node.type); + }, + _a[263 /* SyntaxKind.EnumDeclaration */] = function forEachChildInEnumDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[302 /* SyntaxKind.EnumMember */] = function forEachChildInEnumMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[264 /* SyntaxKind.ModuleDeclaration */] = function forEachChildInModuleDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); + }, + _a[268 /* SyntaxKind.ImportEqualsDeclaration */] = function forEachChildInImportEqualsDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.moduleReference); + }, + _a[269 /* SyntaxKind.ImportDeclaration */] = function forEachChildInImportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.importClause) || + visitNode(cbNode, node.moduleSpecifier) || + visitNode(cbNode, node.assertClause); + }, + _a[270 /* SyntaxKind.ImportClause */] = function forEachChildInImportClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.namedBindings); + }, + _a[296 /* SyntaxKind.AssertClause */] = function forEachChildInAssertClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[297 /* SyntaxKind.AssertEntry */] = function forEachChildInAssertEntry(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.value); + }, + _a[267 /* SyntaxKind.NamespaceExportDeclaration */] = function forEachChildInNamespaceExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNode(cbNode, node.name); + }, + _a[271 /* SyntaxKind.NamespaceImport */] = function forEachChildInNamespaceImport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[277 /* SyntaxKind.NamespaceExport */] = function forEachChildInNamespaceExport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[272 /* SyntaxKind.NamedImports */] = forEachChildInNamedImportsOrExports, + _a[276 /* SyntaxKind.NamedExports */] = forEachChildInNamedImportsOrExports, + _a[275 /* SyntaxKind.ExportDeclaration */] = function forEachChildInExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.exportClause) || + visitNode(cbNode, node.moduleSpecifier) || + visitNode(cbNode, node.assertClause); + }, + _a[273 /* SyntaxKind.ImportSpecifier */] = forEachChildInImportOrExportSpecifier, + _a[278 /* SyntaxKind.ExportSpecifier */] = forEachChildInImportOrExportSpecifier, + _a[274 /* SyntaxKind.ExportAssignment */] = function forEachChildInExportAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.expression); + }, + _a[225 /* SyntaxKind.TemplateExpression */] = function forEachChildInTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || + visitNodes(cbNode, cbNodes, node.templateSpans); + }, + _a[236 /* SyntaxKind.TemplateSpan */] = function forEachChildInTemplateSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.literal); + }, + _a[200 /* SyntaxKind.TemplateLiteralType */] = function forEachChildInTemplateLiteralType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || + visitNodes(cbNode, cbNodes, node.templateSpans); + }, + _a[201 /* SyntaxKind.TemplateLiteralTypeSpan */] = function forEachChildInTemplateLiteralTypeSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.literal); + }, + _a[164 /* SyntaxKind.ComputedPropertyName */] = function forEachChildInComputedPropertyName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[294 /* SyntaxKind.HeritageClause */] = function forEachChildInHeritageClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + }, + _a[230 /* SyntaxKind.ExpressionWithTypeArguments */] = function forEachChildInExpressionWithTypeArguments(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[280 /* SyntaxKind.ExternalModuleReference */] = function forEachChildInExternalModuleReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[279 /* SyntaxKind.MissingDeclaration */] = function forEachChildInMissingDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers); + }, + _a[354 /* SyntaxKind.CommaListExpression */] = function forEachChildInCommaListExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[281 /* SyntaxKind.JsxElement */] = function forEachChildInJsxElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingElement) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingElement); + }, + _a[285 /* SyntaxKind.JsxFragment */] = function forEachChildInJsxFragment(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingFragment) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingFragment); + }, + _a[282 /* SyntaxKind.JsxSelfClosingElement */] = forEachChildInJsxOpeningOrSelfClosingElement, + _a[283 /* SyntaxKind.JsxOpeningElement */] = forEachChildInJsxOpeningOrSelfClosingElement, + _a[289 /* SyntaxKind.JsxAttributes */] = function forEachChildInJsxAttributes(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, + _a[288 /* SyntaxKind.JsxAttribute */] = function forEachChildInJsxAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[290 /* SyntaxKind.JsxSpreadAttribute */] = function forEachChildInJsxSpreadAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[291 /* SyntaxKind.JsxExpression */] = function forEachChildInJsxExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.expression); + }, + _a[284 /* SyntaxKind.JsxClosingElement */] = function forEachChildInJsxClosingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tagName); + }, + _a[187 /* SyntaxKind.OptionalType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[188 /* SyntaxKind.RestType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[312 /* SyntaxKind.JSDocTypeExpression */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[318 /* SyntaxKind.JSDocNonNullableType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[317 /* SyntaxKind.JSDocNullableType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[319 /* SyntaxKind.JSDocOptionalType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[321 /* SyntaxKind.JSDocVariadicType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[320 /* SyntaxKind.JSDocFunctionType */] = function forEachChildInJSDocFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[323 /* SyntaxKind.JSDoc */] = function forEachChildInJSDoc(node, cbNode, cbNodes) { + return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) + || visitNodes(cbNode, cbNodes, node.tags); + }, + _a[349 /* SyntaxKind.JSDocSeeTag */] = function forEachChildInJSDocSeeTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.name) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[313 /* SyntaxKind.JSDocNameReference */] = function forEachChildInJSDocNameReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[314 /* SyntaxKind.JSDocMemberName */] = function forEachChildInJSDocMemberName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + }, + _a[343 /* SyntaxKind.JSDocParameterTag */] = forEachChildInJSDocParameterOrPropertyTag, + _a[350 /* SyntaxKind.JSDocPropertyTag */] = forEachChildInJSDocParameterOrPropertyTag, + _a[333 /* SyntaxKind.JSDocAuthorTag */] = function forEachChildInJSDocAuthorTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[332 /* SyntaxKind.JSDocImplementsTag */] = function forEachChildInJSDocImplementsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.class) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[331 /* SyntaxKind.JSDocAugmentsTag */] = function forEachChildInJSDocAugmentsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.class) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[347 /* SyntaxKind.JSDocTemplateTag */] = function forEachChildInJSDocTemplateTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.constraint) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[348 /* SyntaxKind.JSDocTypedefTag */] = function forEachChildInJSDocTypedefTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (node.typeExpression && + node.typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */ + ? visitNode(cbNode, node.typeExpression) || + visitNode(cbNode, node.fullName) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) + : visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); + }, + _a[341 /* SyntaxKind.JSDocCallbackTag */] = function forEachChildInJSDocCallbackTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[344 /* SyntaxKind.JSDocReturnTag */] = forEachChildInJSDocReturnTag, + _a[346 /* SyntaxKind.JSDocTypeTag */] = forEachChildInJSDocReturnTag, + _a[345 /* SyntaxKind.JSDocThisTag */] = forEachChildInJSDocReturnTag, + _a[342 /* SyntaxKind.JSDocEnumTag */] = forEachChildInJSDocReturnTag, + _a[326 /* SyntaxKind.JSDocSignature */] = function forEachChildInJSDocSignature(node, cbNode, _cbNodes) { + return ts.forEach(node.typeParameters, cbNode) || + ts.forEach(node.parameters, cbNode) || + visitNode(cbNode, node.type); + }, + _a[327 /* SyntaxKind.JSDocLink */] = forEachChildInJSDocLinkCodeOrPlain, + _a[328 /* SyntaxKind.JSDocLinkCode */] = forEachChildInJSDocLinkCodeOrPlain, + _a[329 /* SyntaxKind.JSDocLinkPlain */] = forEachChildInJSDocLinkCodeOrPlain, + _a[325 /* SyntaxKind.JSDocTypeLiteral */] = function forEachChildInJSDocTypeLiteral(node, cbNode, _cbNodes) { + return ts.forEach(node.jsDocPropertyTags, cbNode); + }, + _a[330 /* SyntaxKind.JSDocTag */] = forEachChildInJSDocTag, + _a[335 /* SyntaxKind.JSDocClassTag */] = forEachChildInJSDocTag, + _a[336 /* SyntaxKind.JSDocPublicTag */] = forEachChildInJSDocTag, + _a[337 /* SyntaxKind.JSDocPrivateTag */] = forEachChildInJSDocTag, + _a[338 /* SyntaxKind.JSDocProtectedTag */] = forEachChildInJSDocTag, + _a[339 /* SyntaxKind.JSDocReadonlyTag */] = forEachChildInJSDocTag, + _a[334 /* SyntaxKind.JSDocDeprecatedTag */] = forEachChildInJSDocTag, + _a[340 /* SyntaxKind.JSDocOverrideTag */] = forEachChildInJSDocTag, + _a[353 /* SyntaxKind.PartiallyEmittedExpression */] = forEachChildInPartiallyEmittedExpression, + _a); + // shared + function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + } + function forEachChildInUnionOrIntersectionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + } + function forEachChildInParenthesizedTypeOrTypeOperator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInObjectOrArrayBindingPattern(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInCallOrNewExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + // TODO: should we separate these branches out? + visitNode(cbNode, node.questionDotToken) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNodes(cbNode, cbNodes, node.arguments); + } + function forEachChildInBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + } + function forEachChildInContinueOrBreakStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label); + } + function forEachChildInClassDeclarationOrExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); + } + function forEachChildInNamedImportsOrExports(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInImportOrExportSpecifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name); + } + function forEachChildInJsxOpeningOrSelfClosingElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNode(cbNode, node.attributes); + } + function forEachChildInOptionalRestOrJSDocParameterModifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInJSDocParameterOrPropertyTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (node.isNameFirst + ? visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression) + : visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name)) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocReturnTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocLinkCodeOrPlain(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + } + function forEachChildInJSDocTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) + || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInPartiallyEmittedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + } /** * Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes * stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise, @@ -31150,562 +31936,11 @@ var ts; * that they appear in the source code. The language service depends on this property to locate nodes by position. */ function forEachChild(node, cbNode, cbNodes) { - if (!node || node.kind <= 160 /* SyntaxKind.LastToken */) { + if (node === undefined || node.kind <= 162 /* SyntaxKind.LastToken */) { return; } - switch (node.kind) { - case 161 /* SyntaxKind.QualifiedName */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); - case 163 /* SyntaxKind.TypeParameter */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.constraint) || - visitNode(cbNode, node.default) || - visitNode(cbNode, node.expression); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.equalsToken) || - visitNode(cbNode, node.objectAssignmentInitializer); - case 298 /* SyntaxKind.SpreadAssignment */: - return visitNode(cbNode, node.expression); - case 164 /* SyntaxKind.Parameter */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 166 /* SyntaxKind.PropertySignature */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 296 /* SyntaxKind.PropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.initializer); - case 254 /* SyntaxKind.VariableDeclaration */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 203 /* SyntaxKind.BindingElement */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 176 /* SyntaxKind.IndexSignature */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 180 /* SyntaxKind.ConstructorType */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 179 /* SyntaxKind.FunctionType */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - return visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 169 /* SyntaxKind.MethodDeclaration */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 168 /* SyntaxKind.MethodSignature */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 171 /* SyntaxKind.Constructor */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 172 /* SyntaxKind.GetAccessor */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 173 /* SyntaxKind.SetAccessor */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 256 /* SyntaxKind.FunctionDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 213 /* SyntaxKind.FunctionExpression */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 214 /* SyntaxKind.ArrowFunction */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.equalsGreaterThanToken) || - visitNode(cbNode, node.body); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.body); - case 178 /* SyntaxKind.TypeReference */: - return visitNode(cbNode, node.typeName) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 177 /* SyntaxKind.TypePredicate */: - return visitNode(cbNode, node.assertsModifier) || - visitNode(cbNode, node.parameterName) || - visitNode(cbNode, node.type); - case 181 /* SyntaxKind.TypeQuery */: - return visitNode(cbNode, node.exprName) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 182 /* SyntaxKind.TypeLiteral */: - return visitNodes(cbNode, cbNodes, node.members); - case 183 /* SyntaxKind.ArrayType */: - return visitNode(cbNode, node.elementType); - case 184 /* SyntaxKind.TupleType */: - return visitNodes(cbNode, cbNodes, node.elements); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - return visitNodes(cbNode, cbNodes, node.types); - case 189 /* SyntaxKind.ConditionalType */: - return visitNode(cbNode, node.checkType) || - visitNode(cbNode, node.extendsType) || - visitNode(cbNode, node.trueType) || - visitNode(cbNode, node.falseType); - case 190 /* SyntaxKind.InferType */: - return visitNode(cbNode, node.typeParameter); - case 200 /* SyntaxKind.ImportType */: - return visitNode(cbNode, node.argument) || - visitNode(cbNode, node.assertions) || - visitNode(cbNode, node.qualifier) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 295 /* SyntaxKind.ImportTypeAssertionContainer */: - return visitNode(cbNode, node.assertClause); - case 191 /* SyntaxKind.ParenthesizedType */: - case 193 /* SyntaxKind.TypeOperator */: - return visitNode(cbNode, node.type); - case 194 /* SyntaxKind.IndexedAccessType */: - return visitNode(cbNode, node.objectType) || - visitNode(cbNode, node.indexType); - case 195 /* SyntaxKind.MappedType */: - return visitNode(cbNode, node.readonlyToken) || - visitNode(cbNode, node.typeParameter) || - visitNode(cbNode, node.nameType) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNodes(cbNode, cbNodes, node.members); - case 196 /* SyntaxKind.LiteralType */: - return visitNode(cbNode, node.literal); - case 197 /* SyntaxKind.NamedTupleMember */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - return visitNodes(cbNode, cbNodes, node.elements); - case 204 /* SyntaxKind.ArrayLiteralExpression */: - return visitNodes(cbNode, cbNodes, node.elements); - case 205 /* SyntaxKind.ObjectLiteralExpression */: - return visitNodes(cbNode, cbNodes, node.properties); - case 206 /* SyntaxKind.PropertyAccessExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNode(cbNode, node.name); - case 207 /* SyntaxKind.ElementAccessExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNode(cbNode, node.argumentExpression); - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNodes(cbNode, cbNodes, node.arguments); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - return visitNode(cbNode, node.tag) || - visitNode(cbNode, node.questionDotToken) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNode(cbNode, node.template); - case 211 /* SyntaxKind.TypeAssertionExpression */: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.expression); - case 212 /* SyntaxKind.ParenthesizedExpression */: - return visitNode(cbNode, node.expression); - case 215 /* SyntaxKind.DeleteExpression */: - return visitNode(cbNode, node.expression); - case 216 /* SyntaxKind.TypeOfExpression */: - return visitNode(cbNode, node.expression); - case 217 /* SyntaxKind.VoidExpression */: - return visitNode(cbNode, node.expression); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - return visitNode(cbNode, node.operand); - case 224 /* SyntaxKind.YieldExpression */: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); - case 218 /* SyntaxKind.AwaitExpression */: - return visitNode(cbNode, node.expression); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - return visitNode(cbNode, node.operand); - case 221 /* SyntaxKind.BinaryExpression */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.operatorToken) || - visitNode(cbNode, node.right); - case 229 /* SyntaxKind.AsExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.type); - case 230 /* SyntaxKind.NonNullExpression */: - return visitNode(cbNode, node.expression); - case 231 /* SyntaxKind.MetaProperty */: - return visitNode(cbNode, node.name); - case 222 /* SyntaxKind.ConditionalExpression */: - return visitNode(cbNode, node.condition) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.whenTrue) || - visitNode(cbNode, node.colonToken) || - visitNode(cbNode, node.whenFalse); - case 225 /* SyntaxKind.SpreadElement */: - return visitNode(cbNode, node.expression); - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - return visitNodes(cbNode, cbNodes, node.statements); - case 305 /* SyntaxKind.SourceFile */: - return visitNodes(cbNode, cbNodes, node.statements) || - visitNode(cbNode, node.endOfFileToken); - case 237 /* SyntaxKind.VariableStatement */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.declarationList); - case 255 /* SyntaxKind.VariableDeclarationList */: - return visitNodes(cbNode, cbNodes, node.declarations); - case 238 /* SyntaxKind.ExpressionStatement */: - return visitNode(cbNode, node.expression); - case 239 /* SyntaxKind.IfStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.thenStatement) || - visitNode(cbNode, node.elseStatement); - case 240 /* SyntaxKind.DoStatement */: - return visitNode(cbNode, node.statement) || - visitNode(cbNode, node.expression); - case 241 /* SyntaxKind.WhileStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 242 /* SyntaxKind.ForStatement */: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.condition) || - visitNode(cbNode, node.incrementor) || - visitNode(cbNode, node.statement); - case 243 /* SyntaxKind.ForInStatement */: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 244 /* SyntaxKind.ForOfStatement */: - return visitNode(cbNode, node.awaitModifier) || - visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: - return visitNode(cbNode, node.label); - case 247 /* SyntaxKind.ReturnStatement */: - return visitNode(cbNode, node.expression); - case 248 /* SyntaxKind.WithStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 249 /* SyntaxKind.SwitchStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.caseBlock); - case 263 /* SyntaxKind.CaseBlock */: - return visitNodes(cbNode, cbNodes, node.clauses); - case 289 /* SyntaxKind.CaseClause */: - return visitNode(cbNode, node.expression) || - visitNodes(cbNode, cbNodes, node.statements); - case 290 /* SyntaxKind.DefaultClause */: - return visitNodes(cbNode, cbNodes, node.statements); - case 250 /* SyntaxKind.LabeledStatement */: - return visitNode(cbNode, node.label) || - visitNode(cbNode, node.statement); - case 251 /* SyntaxKind.ThrowStatement */: - return visitNode(cbNode, node.expression); - case 252 /* SyntaxKind.TryStatement */: - return visitNode(cbNode, node.tryBlock) || - visitNode(cbNode, node.catchClause) || - visitNode(cbNode, node.finallyBlock); - case 292 /* SyntaxKind.CatchClause */: - return visitNode(cbNode, node.variableDeclaration) || - visitNode(cbNode, node.block); - case 165 /* SyntaxKind.Decorator */: - return visitNode(cbNode, node.expression); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.heritageClauses) || - visitNodes(cbNode, cbNodes, node.members); - case 258 /* SyntaxKind.InterfaceDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.heritageClauses) || - visitNodes(cbNode, cbNodes, node.members); - case 259 /* SyntaxKind.TypeAliasDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNode(cbNode, node.type); - case 260 /* SyntaxKind.EnumDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.members); - case 299 /* SyntaxKind.EnumMember */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 261 /* SyntaxKind.ModuleDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.body); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.moduleReference); - case 266 /* SyntaxKind.ImportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.importClause) || - visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); - case 267 /* SyntaxKind.ImportClause */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.namedBindings); - case 293 /* SyntaxKind.AssertClause */: - return visitNodes(cbNode, cbNodes, node.elements); - case 294 /* SyntaxKind.AssertEntry */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.value); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNode(cbNode, node.name); - case 268 /* SyntaxKind.NamespaceImport */: - return visitNode(cbNode, node.name); - case 274 /* SyntaxKind.NamespaceExport */: - return visitNode(cbNode, node.name); - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: - return visitNodes(cbNode, cbNodes, node.elements); - case 272 /* SyntaxKind.ExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.exportClause) || - visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: - return visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name); - case 271 /* SyntaxKind.ExportAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.expression); - case 223 /* SyntaxKind.TemplateExpression */: - return visitNode(cbNode, node.head) || - visitNodes(cbNode, cbNodes, node.templateSpans); - case 233 /* SyntaxKind.TemplateSpan */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.literal); - case 198 /* SyntaxKind.TemplateLiteralType */: - return visitNode(cbNode, node.head) || - visitNodes(cbNode, cbNodes, node.templateSpans); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.literal); - case 162 /* SyntaxKind.ComputedPropertyName */: - return visitNode(cbNode, node.expression); - case 291 /* SyntaxKind.HeritageClause */: - return visitNodes(cbNode, cbNodes, node.types); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - return visitNode(cbNode, node.expression) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 277 /* SyntaxKind.ExternalModuleReference */: - return visitNode(cbNode, node.expression); - case 276 /* SyntaxKind.MissingDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers); - case 351 /* SyntaxKind.CommaListExpression */: - return visitNodes(cbNode, cbNodes, node.elements); - case 278 /* SyntaxKind.JsxElement */: - return visitNode(cbNode, node.openingElement) || - visitNodes(cbNode, cbNodes, node.children) || - visitNode(cbNode, node.closingElement); - case 282 /* SyntaxKind.JsxFragment */: - return visitNode(cbNode, node.openingFragment) || - visitNodes(cbNode, cbNodes, node.children) || - visitNode(cbNode, node.closingFragment); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - return visitNode(cbNode, node.tagName) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNode(cbNode, node.attributes); - case 286 /* SyntaxKind.JsxAttributes */: - return visitNodes(cbNode, cbNodes, node.properties); - case 285 /* SyntaxKind.JsxAttribute */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 287 /* SyntaxKind.JsxSpreadAttribute */: - return visitNode(cbNode, node.expression); - case 288 /* SyntaxKind.JsxExpression */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.expression); - case 281 /* SyntaxKind.JsxClosingElement */: - return visitNode(cbNode, node.tagName); - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 316 /* SyntaxKind.JSDocOptionalType */: - case 318 /* SyntaxKind.JSDocVariadicType */: - return visitNode(cbNode, node.type); - case 317 /* SyntaxKind.JSDocFunctionType */: - return visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 320 /* SyntaxKind.JSDoc */: - return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - || visitNodes(cbNode, cbNodes, node.tags); - case 346 /* SyntaxKind.JSDocSeeTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.name) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 310 /* SyntaxKind.JSDocNameReference */: - return visitNode(cbNode, node.name); - case 311 /* SyntaxKind.JSDocMemberName */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - return visitNode(cbNode, node.tagName) || - (node.isNameFirst - ? visitNode(cbNode, node.name) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - : visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.name) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); - case 330 /* SyntaxKind.JSDocAuthorTag */: - return visitNode(cbNode, node.tagName) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 329 /* SyntaxKind.JSDocImplementsTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.class) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 328 /* SyntaxKind.JSDocAugmentsTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.class) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 344 /* SyntaxKind.JSDocTemplateTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.constraint) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 345 /* SyntaxKind.JSDocTypedefTag */: - return visitNode(cbNode, node.tagName) || - (node.typeExpression && - node.typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */ - ? visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.fullName) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - : visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); - case 338 /* SyntaxKind.JSDocCallbackTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 341 /* SyntaxKind.JSDocReturnTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: - case 342 /* SyntaxKind.JSDocThisTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 323 /* SyntaxKind.JSDocSignature */: - return ts.forEach(node.typeParameters, cbNode) || - ts.forEach(node.parameters, cbNode) || - visitNode(cbNode, node.type); - case 324 /* SyntaxKind.JSDocLink */: - case 325 /* SyntaxKind.JSDocLinkCode */: - case 326 /* SyntaxKind.JSDocLinkPlain */: - return visitNode(cbNode, node.name); - case 322 /* SyntaxKind.JSDocTypeLiteral */: - return ts.forEach(node.jsDocPropertyTags, cbNode); - case 327 /* SyntaxKind.JSDocTag */: - case 332 /* SyntaxKind.JSDocClassTag */: - case 333 /* SyntaxKind.JSDocPublicTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 336 /* SyntaxKind.JSDocReadonlyTag */: - case 331 /* SyntaxKind.JSDocDeprecatedTag */: - return visitNode(cbNode, node.tagName) - || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - return visitNode(cbNode, node.expression); - } + var fn = forEachChildTable[node.kind]; + return fn === undefined ? undefined : fn(node, cbNode, cbNodes); } ts.forEachChild = forEachChild; /** @internal */ @@ -31752,7 +31987,7 @@ var ts; continue; return res; } - if (current.kind >= 161 /* SyntaxKind.FirstNode */) { + if (current.kind >= 163 /* SyntaxKind.FirstNode */) { // add children in reverse order to the queue, so popping gives the first child for (var _i = 0, _a = gatherPossibleChildren(current); _i < _a.length; _i++) { var child = _a[_i]; @@ -32577,7 +32812,7 @@ var ts; } // If we have a 'await' keyword, and we're in the [Await] context, then 'await' is // considered a keyword and is not an identifier. - if (token() === 132 /* SyntaxKind.AwaitKeyword */ && inAwaitContext()) { + if (token() === 133 /* SyntaxKind.AwaitKeyword */ && inAwaitContext()) { return false; } return token() > 116 /* SyntaxKind.LastReservedWord */; @@ -32823,7 +33058,7 @@ var ts; ts.isTemplateLiteralKind(kind) ? factory.createTemplateLiteralLikeNode(kind, "", "", /*templateFlags*/ undefined) : kind === 8 /* SyntaxKind.NumericLiteral */ ? factory.createNumericLiteral("", /*numericLiteralFlags*/ undefined) : kind === 10 /* SyntaxKind.StringLiteral */ ? factory.createStringLiteral("", /*isSingleQuote*/ undefined) : - kind === 276 /* SyntaxKind.MissingDeclaration */ ? factory.createMissingDeclaration() : + kind === 279 /* SyntaxKind.MissingDeclaration */ ? factory.createMissingDeclaration() : factory.createToken(kind); return finishNode(result, pos); } @@ -32922,7 +33157,7 @@ var ts; } function parsePrivateIdentifier() { var pos = getNodePos(); - var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenText())); + var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenValue())); nextToken(); return finishNode(node, pos); } @@ -32946,15 +33181,16 @@ var ts; if (token() === 88 /* SyntaxKind.DefaultKeyword */) { return lookAhead(nextTokenCanFollowDefaultKeyword); } - if (token() === 152 /* SyntaxKind.TypeKeyword */) { + if (token() === 154 /* SyntaxKind.TypeKeyword */) { return lookAhead(nextTokenCanFollowExportModifier); } return canFollowExportModifier(); case 88 /* SyntaxKind.DefaultKeyword */: return nextTokenCanFollowDefaultKeyword(); + case 127 /* SyntaxKind.AccessorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: nextToken(); return canFollowModifier(); default: @@ -32963,7 +33199,7 @@ var ts; } function canFollowExportModifier() { return token() !== 41 /* SyntaxKind.AsteriskToken */ - && token() !== 127 /* SyntaxKind.AsKeyword */ + && token() !== 128 /* SyntaxKind.AsKeyword */ && token() !== 18 /* SyntaxKind.OpenBraceToken */ && canFollowModifier(); } @@ -32986,7 +33222,7 @@ var ts; return token() === 84 /* SyntaxKind.ClassKeyword */ || token() === 98 /* SyntaxKind.FunctionKeyword */ || token() === 118 /* SyntaxKind.InterfaceKeyword */ || (token() === 126 /* SyntaxKind.AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine)) || - (token() === 131 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); + (token() === 132 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); } // True if positioned at the start of a list element function isListElement(parsingContext, inErrorRecovery) { @@ -33366,20 +33602,20 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 176 /* SyntaxKind.IndexSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 234 /* SyntaxKind.SemicolonClassElement */: + case 173 /* SyntaxKind.Constructor */: + case 178 /* SyntaxKind.IndexSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 237 /* SyntaxKind.SemicolonClassElement */: return true; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // Method declarations are not necessarily reusable. An object-literal // may have a method calls "constructor(...)" and we must reparse that // into an actual .ConstructorDeclaration. var methodDeclaration = node; var nameIsConstructor = methodDeclaration.name.kind === 79 /* SyntaxKind.Identifier */ && - methodDeclaration.name.originalKeywordKind === 134 /* SyntaxKind.ConstructorKeyword */; + methodDeclaration.name.originalKeywordKind === 135 /* SyntaxKind.ConstructorKeyword */; return !nameIsConstructor; } } @@ -33388,8 +33624,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: return true; } } @@ -33398,58 +33634,58 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 235 /* SyntaxKind.Block */: - case 239 /* SyntaxKind.IfStatement */: - case 238 /* SyntaxKind.ExpressionStatement */: - case 251 /* SyntaxKind.ThrowStatement */: - case 247 /* SyntaxKind.ReturnStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 236 /* SyntaxKind.EmptyStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 250 /* SyntaxKind.LabeledStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 253 /* SyntaxKind.DebuggerStatement */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 238 /* SyntaxKind.Block */: + case 242 /* SyntaxKind.IfStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 254 /* SyntaxKind.ThrowStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 239 /* SyntaxKind.EmptyStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 253 /* SyntaxKind.LabeledStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 299 /* SyntaxKind.EnumMember */; + return node.kind === 302 /* SyntaxKind.EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 166 /* SyntaxKind.PropertySignature */: - case 174 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 168 /* SyntaxKind.PropertySignature */: + case 176 /* SyntaxKind.CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 254 /* SyntaxKind.VariableDeclaration */) { + if (node.kind !== 257 /* SyntaxKind.VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -33470,7 +33706,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 164 /* SyntaxKind.Parameter */) { + if (node.kind !== 166 /* SyntaxKind.Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -33763,14 +33999,14 @@ var ts; // If true, we should abort parsing an error function. function typeHasArrowFunctionBlockingParseError(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return ts.nodeIsMissing(node.typeName); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: { + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: { var _a = node, parameters = _a.parameters, type = _a.type; return isMissingList(parameters) || typeHasArrowFunctionBlockingParseError(type); } - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return typeHasArrowFunctionBlockingParseError(node.type); default: return false; @@ -33849,7 +34085,7 @@ var ts; function parseJSDocType() { scanner.setInJSDocType(true); var pos = getNodePos(); - if (parseOptional(141 /* SyntaxKind.ModuleKeyword */)) { + if (parseOptional(142 /* SyntaxKind.ModuleKeyword */)) { // TODO(rbuckton): We never set the type for a JSDocNamepathType. What should we put here? var moduleTag = factory.createJSDocNamepathType(/*type*/ undefined); terminate: while (true) { @@ -34065,14 +34301,14 @@ var ts; function parseSignatureMember(kind) { var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); - if (kind === 175 /* SyntaxKind.ConstructSignature */) { + if (kind === 177 /* SyntaxKind.ConstructSignature */) { parseExpected(103 /* SyntaxKind.NewKeyword */); } var typeParameters = parseTypeParameters(); var parameters = parseParameters(4 /* SignatureFlags.Type */); var type = parseReturnType(58 /* SyntaxKind.ColonToken */, /*isType*/ true); parseTypeMemberSemicolon(); - var node = kind === 174 /* SyntaxKind.CallSignature */ + var node = kind === 176 /* SyntaxKind.CallSignature */ ? factory.createCallSignature(typeParameters, parameters, type) : factory.createConstructSignature(typeParameters, parameters, type); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -34166,8 +34402,8 @@ var ts; // Return true if we have the start of a signature member if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || - token() === 136 /* SyntaxKind.GetKeyword */ || - token() === 149 /* SyntaxKind.SetKeyword */) { + token() === 137 /* SyntaxKind.GetKeyword */ || + token() === 151 /* SyntaxKind.SetKeyword */) { return true; } var idToken = false; @@ -34199,19 +34435,19 @@ var ts; } function parseTypeMember() { if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */) { - return parseSignatureMember(174 /* SyntaxKind.CallSignature */); + return parseSignatureMember(176 /* SyntaxKind.CallSignature */); } if (token() === 103 /* SyntaxKind.NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) { - return parseSignatureMember(175 /* SyntaxKind.ConstructSignature */); + return parseSignatureMember(177 /* SyntaxKind.ConstructSignature */); } var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); var modifiers = parseModifiers(); - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 172 /* SyntaxKind.GetAccessor */, 4 /* SignatureFlags.Type */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 174 /* SyntaxKind.GetAccessor */, 4 /* SignatureFlags.Type */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 173 /* SyntaxKind.SetAccessor */, 4 /* SignatureFlags.Type */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 175 /* SyntaxKind.SetAccessor */, 4 /* SignatureFlags.Type */); } if (isIndexSignature()) { return parseIndexSignatureDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers); @@ -34252,9 +34488,9 @@ var ts; function isStartOfMappedType() { nextToken(); if (token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { - return nextToken() === 145 /* SyntaxKind.ReadonlyKeyword */; + return nextToken() === 146 /* SyntaxKind.ReadonlyKeyword */; } - if (token() === 145 /* SyntaxKind.ReadonlyKeyword */) { + if (token() === 146 /* SyntaxKind.ReadonlyKeyword */) { nextToken(); } return token() === 22 /* SyntaxKind.OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 101 /* SyntaxKind.InKeyword */; @@ -34270,15 +34506,15 @@ var ts; var pos = getNodePos(); parseExpected(18 /* SyntaxKind.OpenBraceToken */); var readonlyToken; - if (token() === 145 /* SyntaxKind.ReadonlyKeyword */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { + if (token() === 146 /* SyntaxKind.ReadonlyKeyword */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { readonlyToken = parseTokenNode(); - if (readonlyToken.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { - parseExpected(145 /* SyntaxKind.ReadonlyKeyword */); + if (readonlyToken.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { + parseExpected(146 /* SyntaxKind.ReadonlyKeyword */); } } parseExpected(22 /* SyntaxKind.OpenBracketToken */); var typeParameter = parseMappedTypeParameter(); - var nameType = parseOptional(127 /* SyntaxKind.AsKeyword */) ? parseType() : undefined; + var nameType = parseOptional(128 /* SyntaxKind.AsKeyword */) ? parseType() : undefined; parseExpected(23 /* SyntaxKind.CloseBracketToken */); var questionToken; if (token() === 57 /* SyntaxKind.QuestionToken */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { @@ -34392,7 +34628,7 @@ var ts; var openBracePosition = scanner.getTokenPos(); parseExpected(18 /* SyntaxKind.OpenBraceToken */); var multiLine = scanner.hasPrecedingLineBreak(); - parseExpected(129 /* SyntaxKind.AssertKeyword */); + parseExpected(130 /* SyntaxKind.AssertKeyword */); parseExpected(58 /* SyntaxKind.ColonToken */); var clause = parseAssertClause(/*skipAssertKeyword*/ true); if (!parseExpected(19 /* SyntaxKind.CloseBraceToken */)) { @@ -34425,16 +34661,16 @@ var ts; } function parseNonArrayType() { switch (token()) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: // If these are followed by a dot, then parse these out as a dotted type reference instead. return tryParse(parseKeywordAndNoDot) || parseTypeReference(); case 66 /* SyntaxKind.AsteriskEqualsToken */: @@ -34467,7 +34703,7 @@ var ts; return parseTokenNode(); case 108 /* SyntaxKind.ThisKeyword */: { var thisKeyword = parseThisTypeNode(); - if (token() === 139 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 140 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { return parseThisTypePredicate(thisKeyword); } else { @@ -34484,7 +34720,7 @@ var ts; return parseParenthesizedType(); case 100 /* SyntaxKind.ImportKeyword */: return parseImportType(); - case 128 /* SyntaxKind.AssertsKeyword */: + case 129 /* SyntaxKind.AssertsKeyword */: return lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine) ? parseAssertsTypePredicate() : parseTypeReference(); case 15 /* SyntaxKind.TemplateHead */: return parseTemplateType(); @@ -34494,21 +34730,21 @@ var ts; } function isStartOfType(inStartOfParameter) { switch (token()) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 108 /* SyntaxKind.ThisKeyword */: case 112 /* SyntaxKind.TypeOfKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: case 18 /* SyntaxKind.OpenBraceToken */: case 22 /* SyntaxKind.OpenBracketToken */: case 29 /* SyntaxKind.LessThanToken */: @@ -34520,14 +34756,14 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 41 /* SyntaxKind.AsteriskToken */: case 57 /* SyntaxKind.QuestionToken */: case 53 /* SyntaxKind.ExclamationToken */: case 25 /* SyntaxKind.DotDotDotToken */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: case 100 /* SyntaxKind.ImportKeyword */: - case 128 /* SyntaxKind.AssertsKeyword */: + case 129 /* SyntaxKind.AssertsKeyword */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 15 /* SyntaxKind.TemplateHead */: return true; @@ -34604,17 +34840,17 @@ var ts; } function parseInferType() { var pos = getNodePos(); - parseExpected(137 /* SyntaxKind.InferKeyword */); + parseExpected(138 /* SyntaxKind.InferKeyword */); return finishNode(factory.createInferTypeNode(parseTypeParameterOfInferType()), pos); } function parseTypeOperatorOrHigher() { var operator = token(); switch (operator) { - case 140 /* SyntaxKind.KeyOfKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: return parseTypeOperator(operator); - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: return parseInferType(); } return allowConditionalTypesAnd(parsePostfixTypeOrHigher); @@ -34734,16 +34970,16 @@ var ts; } function parseTypePredicatePrefix() { var id = parseIdentifier(); - if (token() === 139 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 140 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { nextToken(); return id; } } function parseAssertsTypePredicate() { var pos = getNodePos(); - var assertsModifier = parseExpectedToken(128 /* SyntaxKind.AssertsKeyword */); + var assertsModifier = parseExpectedToken(129 /* SyntaxKind.AssertsKeyword */); var parameterName = token() === 108 /* SyntaxKind.ThisKeyword */ ? parseThisTypeNode() : parseIdentifier(); - var type = parseOptional(139 /* SyntaxKind.IsKeyword */) ? parseType() : undefined; + var type = parseOptional(140 /* SyntaxKind.IsKeyword */) ? parseType() : undefined; return finishNode(factory.createTypePredicateNode(assertsModifier, parameterName, type), pos); } function parseType() { @@ -34813,7 +35049,7 @@ var ts; case 45 /* SyntaxKind.PlusPlusToken */: case 46 /* SyntaxKind.MinusMinusToken */: case 29 /* SyntaxKind.LessThanToken */: - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: case 125 /* SyntaxKind.YieldKeyword */: case 80 /* SyntaxKind.PrivateIdentifier */: // Yield/await always starts an expression. Either it is an identifier (in which case @@ -35001,7 +35237,7 @@ var ts; // Unknown -> There *might* be a parenthesized arrow function here. // Speculatively look ahead to be sure, and rollback if not. function isParenthesizedArrowFunctionExpression() { - if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || token() === 132 /* SyntaxKind.AsyncKeyword */) { return lookAhead(isParenthesizedArrowFunctionExpressionWorker); } if (token() === 38 /* SyntaxKind.EqualsGreaterThanToken */) { @@ -35014,7 +35250,7 @@ var ts; return 0 /* Tristate.False */; } function isParenthesizedArrowFunctionExpressionWorker() { - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { nextToken(); if (scanner.hasPrecedingLineBreak()) { return 0 /* Tristate.False */; @@ -35058,8 +35294,8 @@ var ts; // Check for "(xxx yyy", where xxx is a modifier and yyy is an identifier. This // isn't actually allowed, but we want to treat it as a lambda so we can provide // a good error message. - if (ts.isModifierKind(second) && second !== 131 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) { - if (nextToken() === 127 /* SyntaxKind.AsKeyword */) { + if (ts.isModifierKind(second) && second !== 132 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) { + if (nextToken() === 128 /* SyntaxKind.AsKeyword */) { // https://github.com/microsoft/TypeScript/issues/44466 return 0 /* Tristate.False */; } @@ -35141,7 +35377,7 @@ var ts; } function tryParseAsyncSimpleArrowFunctionExpression(allowReturnTypeInArrowFunction) { // We do a check here so that we won't be doing unnecessarily call to "lookAhead" - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* Tristate.True */) { var pos = getNodePos(); var asyncModifier = parseModifiersForArrowFunction(); @@ -35155,7 +35391,7 @@ var ts; // AsyncArrowFunctionExpression: // 1) async[no LineTerminator here]AsyncArrowBindingIdentifier[?Yield][no LineTerminator here]=>AsyncConciseBody[?In] // 2) CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In] - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { nextToken(); // If the "async" is followed by "=>" token then it is not a beginning of an async arrow-function // but instead a simple arrow-function which will be parsed inside "parseAssignmentExpressionOrHigher" @@ -35221,7 +35457,7 @@ var ts; // // So we need just a bit of lookahead to ensure that it can only be a signature. var unwrappedType = type; - while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 191 /* SyntaxKind.ParenthesizedType */) { + while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 193 /* SyntaxKind.ParenthesizedType */) { unwrappedType = unwrappedType.type; // Skip parens if need be } var hasJSDocFunctionType = unwrappedType && ts.isJSDocFunctionType(unwrappedType); @@ -35316,7 +35552,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand, pos); } function isInOrOfKeyword(t) { - return t === 101 /* SyntaxKind.InKeyword */ || t === 160 /* SyntaxKind.OfKeyword */; + return t === 101 /* SyntaxKind.InKeyword */ || t === 162 /* SyntaxKind.OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand, pos) { while (true) { @@ -35354,7 +35590,7 @@ var ts; if (token() === 101 /* SyntaxKind.InKeyword */ && inDisallowInContext()) { break; } - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */ || token() === 150 /* SyntaxKind.SatisfiesKeyword */) { // Make sure we *do* perform ASI for constructs like this: // var x = foo // as (Bar) @@ -35364,8 +35600,10 @@ var ts; break; } else { + var keywordKind = token(); nextToken(); - leftOperand = makeAsExpression(leftOperand, parseType()); + leftOperand = keywordKind === 150 /* SyntaxKind.SatisfiesKeyword */ ? makeSatisfiesExpression(leftOperand, parseType()) : + makeAsExpression(leftOperand, parseType()); } } else { @@ -35380,6 +35618,9 @@ var ts; } return ts.getBinaryOperatorPrecedence(token()) > 0; } + function makeSatisfiesExpression(left, right) { + return finishNode(factory.createSatisfiesExpression(left, right), left.pos); + } function makeBinaryExpression(left, operatorToken, right, pos) { return finishNode(factory.createBinaryExpression(left, operatorToken, right), pos); } @@ -35403,7 +35644,7 @@ var ts; return finishNode(factory.createVoidExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos); } function isAwaitExpression() { - if (token() === 132 /* SyntaxKind.AwaitKeyword */) { + if (token() === 133 /* SyntaxKind.AwaitKeyword */) { if (inAwaitContext()) { return true; } @@ -35456,7 +35697,7 @@ var ts; if (token() === 42 /* SyntaxKind.AsteriskAsteriskToken */) { var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); var end = simpleUnaryExpression.end; - if (simpleUnaryExpression.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (simpleUnaryExpression.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { parseErrorAt(pos, end, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { @@ -35497,7 +35738,7 @@ var ts; // UnaryExpression (modified): // < type > UnaryExpression return parseTypeAssertion(); - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: if (isAwaitExpression()) { return parseAwaitExpression(); } @@ -35527,7 +35768,7 @@ var ts; case 89 /* SyntaxKind.DeleteKeyword */: case 112 /* SyntaxKind.TypeOfKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: return false; case 29 /* SyntaxKind.LessThanToken */: // If we are not in JSX context, we are parsing TypeAssertion which is an UnaryExpression @@ -35710,11 +35951,11 @@ var ts; var pos = getNodePos(); var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); var result; - if (opening.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (opening.kind === 283 /* SyntaxKind.JsxOpeningElement */) { var children = parseJsxChildren(opening); var closingElement = void 0; var lastChild = children[children.length - 1]; - if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 278 /* SyntaxKind.JsxElement */ + if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 281 /* SyntaxKind.JsxElement */ && !tagNamesAreEquivalent(lastChild.openingElement.tagName, lastChild.closingElement.tagName) && tagNamesAreEquivalent(opening.tagName, lastChild.closingElement.tagName)) { // when an unclosed JsxOpeningElement incorrectly parses its parent's JsxClosingElement, @@ -35740,11 +35981,11 @@ var ts; } result = finishNode(factory.createJsxElement(opening, children, closingElement), pos); } - else if (opening.kind === 283 /* SyntaxKind.JsxOpeningFragment */) { + else if (opening.kind === 286 /* SyntaxKind.JsxOpeningFragment */) { result = finishNode(factory.createJsxFragment(opening, parseJsxChildren(opening), parseJsxClosingFragment(inExpressionContext)), pos); } else { - ts.Debug.assert(opening.kind === 279 /* SyntaxKind.JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 282 /* SyntaxKind.JsxSelfClosingElement */); // Nothing else to do for self-closing elements result = opening; } @@ -35814,7 +36055,7 @@ var ts; break; list.push(child); if (ts.isJsxOpeningElement(openingTag) - && (child === null || child === void 0 ? void 0 : child.kind) === 278 /* SyntaxKind.JsxElement */ + && (child === null || child === void 0 ? void 0 : child.kind) === 281 /* SyntaxKind.JsxElement */ && !tagNamesAreEquivalent(child.openingElement.tagName, child.closingElement.tagName) && tagNamesAreEquivalent(openingTag.tagName, child.closingElement.tagName)) { // stop after parsing a mismatched child like
...(
) in order to reattach the
higher @@ -36059,7 +36300,7 @@ var ts; } if (isTemplateStartOfTaggedTemplate()) { // Absorb type arguments into TemplateExpression when preceding expression is ExpressionWithTypeArguments - expression = !questionDotToken && expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ ? + expression = !questionDotToken && expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ ? parseTaggedTemplateRest(pos, expression.expression, questionDotToken, expression.typeArguments) : parseTaggedTemplateRest(pos, expression, questionDotToken, /*typeArguments*/ undefined); continue; @@ -36106,7 +36347,7 @@ var ts; } if (typeArguments || token() === 20 /* SyntaxKind.OpenParenToken */) { // Absorb type arguments into CallExpression when preceding expression is ExpressionWithTypeArguments - if (!questionDotToken && expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (!questionDotToken && expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -36192,7 +36433,7 @@ var ts; return parseArrayLiteralExpression(); case 18 /* SyntaxKind.OpenBraceToken */: return parseObjectLiteralExpression(); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // Async arrow functions are parsed earlier in parseAssignmentExpressionOrHigher. // If we encounter `async [no LineTerminator here] function` then this is an async // function; otherwise, its an identifier. @@ -36259,11 +36500,11 @@ var ts; } var decorators = parseDecorators(); var modifiers = parseModifiers(); - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 174 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 175 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); } var asteriskToken = parseOptionalToken(41 /* SyntaxKind.AsteriskToken */); var tokenIsIdentifier = isIdentifier(); @@ -36351,7 +36592,7 @@ var ts; var expression = parseMemberExpressionRest(expressionPos, parsePrimaryExpression(), /*allowOptionalChain*/ false); var typeArguments; // Absorb type arguments into NewExpression when preceding expression is ExpressionWithTypeArguments - if (expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -36455,7 +36696,7 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(97 /* SyntaxKind.ForKeyword */); - var awaitToken = parseOptionalToken(132 /* SyntaxKind.AwaitKeyword */); + var awaitToken = parseOptionalToken(133 /* SyntaxKind.AwaitKeyword */); parseExpected(20 /* SyntaxKind.OpenParenToken */); var initializer; if (token() !== 26 /* SyntaxKind.SemicolonToken */) { @@ -36467,7 +36708,7 @@ var ts; } } var node; - if (awaitToken ? parseExpected(160 /* SyntaxKind.OfKeyword */) : parseOptional(160 /* SyntaxKind.OfKeyword */)) { + if (awaitToken ? parseExpected(162 /* SyntaxKind.OfKeyword */) : parseOptional(162 /* SyntaxKind.OfKeyword */)) { var expression = allowInAnd(function () { return parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true); }); parseExpected(21 /* SyntaxKind.CloseParenToken */); node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement()); @@ -36494,10 +36735,10 @@ var ts; function parseBreakOrContinueStatement(kind) { var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(kind === 246 /* SyntaxKind.BreakStatement */ ? 81 /* SyntaxKind.BreakKeyword */ : 86 /* SyntaxKind.ContinueKeyword */); + parseExpected(kind === 249 /* SyntaxKind.BreakStatement */ ? 81 /* SyntaxKind.BreakKeyword */ : 86 /* SyntaxKind.ContinueKeyword */); var label = canParseSemicolon() ? undefined : parseIdentifier(); parseSemicolon(); - var node = kind === 246 /* SyntaxKind.BreakStatement */ + var node = kind === 249 /* SyntaxKind.BreakStatement */ ? factory.createBreakStatement(label) : factory.createContinueStatement(label); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -36688,25 +36929,26 @@ var ts; // // could be legal, it would add complexity for very little gain. case 118 /* SyntaxKind.InterfaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: return nextTokenIsIdentifierOnSameLine(); - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); case 126 /* SyntaxKind.AbstractKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: nextToken(); // ASI takes effect for this modifier. if (scanner.hasPrecedingLineBreak()) { return false; } continue; - case 157 /* SyntaxKind.GlobalKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: nextToken(); return token() === 18 /* SyntaxKind.OpenBraceToken */ || token() === 79 /* SyntaxKind.Identifier */ || token() === 93 /* SyntaxKind.ExportKeyword */; case 100 /* SyntaxKind.ImportKeyword */: @@ -36715,12 +36957,12 @@ var ts; token() === 18 /* SyntaxKind.OpenBraceToken */ || ts.tokenIsIdentifierOrKeyword(token()); case 93 /* SyntaxKind.ExportKeyword */: var currentToken_1 = nextToken(); - if (currentToken_1 === 152 /* SyntaxKind.TypeKeyword */) { + if (currentToken_1 === 154 /* SyntaxKind.TypeKeyword */) { currentToken_1 = lookAhead(nextToken); } if (currentToken_1 === 63 /* SyntaxKind.EqualsToken */ || currentToken_1 === 41 /* SyntaxKind.AsteriskToken */ || currentToken_1 === 18 /* SyntaxKind.OpenBraceToken */ || currentToken_1 === 88 /* SyntaxKind.DefaultKeyword */ || - currentToken_1 === 127 /* SyntaxKind.AsKeyword */) { + currentToken_1 === 128 /* SyntaxKind.AsKeyword */) { return true; } continue; @@ -36768,20 +37010,21 @@ var ts; case 85 /* SyntaxKind.ConstKeyword */: case 93 /* SyntaxKind.ExportKeyword */: return isStartOfDeclaration(); - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: // When these don't start a declaration, they're an identifier in an expression statement return true; + case 127 /* SyntaxKind.AccessorKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: // When these don't start a declaration, they may be the start of a class member if an identifier // immediately follows. Otherwise they're an identifier in an expression statement. return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); @@ -36824,9 +37067,9 @@ var ts; case 97 /* SyntaxKind.ForKeyword */: return parseForOrForInOrForOfStatement(); case 86 /* SyntaxKind.ContinueKeyword */: - return parseBreakOrContinueStatement(245 /* SyntaxKind.ContinueStatement */); + return parseBreakOrContinueStatement(248 /* SyntaxKind.ContinueStatement */); case 81 /* SyntaxKind.BreakKeyword */: - return parseBreakOrContinueStatement(246 /* SyntaxKind.BreakStatement */); + return parseBreakOrContinueStatement(249 /* SyntaxKind.BreakStatement */); case 105 /* SyntaxKind.ReturnKeyword */: return parseReturnStatement(); case 116 /* SyntaxKind.WithKeyword */: @@ -36845,12 +37088,12 @@ var ts; return parseDebuggerStatement(); case 59 /* SyntaxKind.AtToken */: return parseDeclaration(); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 85 /* SyntaxKind.ConstKeyword */: case 92 /* SyntaxKind.EnumKeyword */: case 93 /* SyntaxKind.ExportKeyword */: @@ -36859,9 +37102,10 @@ var ts; case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -36870,7 +37114,7 @@ var ts; return parseExpressionOrLabeledStatement(); } function isDeclareModifier(modifier) { - return modifier.kind === 135 /* SyntaxKind.DeclareKeyword */; + return modifier.kind === 136 /* SyntaxKind.DeclareKeyword */; } function parseDeclaration() { // `parseListElement` attempted to get the reused node at this position, @@ -36916,13 +37160,13 @@ var ts; return parseClassDeclaration(pos, hasJSDoc, decorators, modifiers); case 118 /* SyntaxKind.InterfaceKeyword */: return parseInterfaceDeclaration(pos, hasJSDoc, decorators, modifiers); - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: return parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers); case 92 /* SyntaxKind.EnumKeyword */: return parseEnumDeclaration(pos, hasJSDoc, decorators, modifiers); - case 157 /* SyntaxKind.GlobalKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: return parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers); case 100 /* SyntaxKind.ImportKeyword */: return parseImportDeclarationOrImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers); @@ -36932,7 +37176,7 @@ var ts; case 88 /* SyntaxKind.DefaultKeyword */: case 63 /* SyntaxKind.EqualsToken */: return parseExportAssignment(pos, hasJSDoc, decorators, modifiers); - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: return parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers); default: return parseExportDeclaration(pos, hasJSDoc, decorators, modifiers); @@ -36941,7 +37185,7 @@ var ts; if (decorators || modifiers) { // We reached this point because we encountered decorators and/or modifiers and assumed a declaration // would follow. For recovery and error reporting purposes, return an incomplete declaration. - var missing = createMissingNode(276 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var missing = createMissingNode(279 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); ts.setTextRangePos(missing, pos); missing.illegalDecorators = decorators; missing.modifiers = modifiers; @@ -37067,7 +37311,7 @@ var ts; // this context. // The checker will then give an error that there is an empty declaration list. var declarations; - if (token() === 160 /* SyntaxKind.OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 162 /* SyntaxKind.OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { declarations = createMissingList(); } else { @@ -37095,9 +37339,9 @@ var ts; parseExpected(98 /* SyntaxKind.FunctionKeyword */); var asteriskToken = parseOptionalToken(41 /* SyntaxKind.AsteriskToken */); // We don't parse the name here in await context, instead we will report a grammar error in the checker. - var name = modifierFlags & 512 /* ModifierFlags.Default */ ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); + var name = modifierFlags & 1024 /* ModifierFlags.Default */ ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); var isGenerator = asteriskToken ? 1 /* SignatureFlags.Yield */ : 0 /* SignatureFlags.None */; - var isAsync = modifierFlags & 256 /* ModifierFlags.Async */ ? 2 /* SignatureFlags.Await */ : 0 /* SignatureFlags.None */; + var isAsync = modifierFlags & 512 /* ModifierFlags.Async */ ? 2 /* SignatureFlags.Await */ : 0 /* SignatureFlags.None */; var typeParameters = parseTypeParameters(); if (modifierFlags & 1 /* ModifierFlags.Export */) setAwaitContext(/*value*/ true); @@ -37110,8 +37354,8 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseConstructorName() { - if (token() === 134 /* SyntaxKind.ConstructorKeyword */) { - return parseExpected(134 /* SyntaxKind.ConstructorKeyword */); + if (token() === 135 /* SyntaxKind.ConstructorKeyword */) { + return parseExpected(135 /* SyntaxKind.ConstructorKeyword */); } if (token() === 10 /* SyntaxKind.StringLiteral */ && lookAhead(nextToken) === 20 /* SyntaxKind.OpenParenToken */) { return tryParse(function () { @@ -37173,7 +37417,7 @@ var ts; var parameters = parseParameters(0 /* SignatureFlags.None */); var type = parseReturnType(58 /* SyntaxKind.ColonToken */, /*isType*/ false); var body = parseFunctionBlockOrSemicolon(flags); - var node = kind === 172 /* SyntaxKind.GetAccessor */ + var node = kind === 174 /* SyntaxKind.GetAccessor */ ? factory.createGetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, type, body) : factory.createSetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, body); // Keep track of `typeParameters` (for both) and `type` (for setters) if they were parsed those indicate grammar errors @@ -37217,7 +37461,7 @@ var ts; // If we were able to get any potential identifier... if (idToken !== undefined) { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. - if (!ts.isKeyword(idToken) || idToken === 149 /* SyntaxKind.SetKeyword */ || idToken === 136 /* SyntaxKind.GetKeyword */) { + if (!ts.isKeyword(idToken) || idToken === 151 /* SyntaxKind.SetKeyword */ || idToken === 137 /* SyntaxKind.GetKeyword */) { return true; } // If it *is* a keyword, but not an accessor, check a little farther along @@ -37260,7 +37504,7 @@ var ts; return body; } function parseDecoratorExpression() { - if (inAwaitContext() && token() === 132 /* SyntaxKind.AwaitKeyword */) { + if (inAwaitContext() && token() === 133 /* SyntaxKind.AwaitKeyword */) { // `@await` is is disallowed in an [Await] context, but can cause parsing to go off the rails // This simply parses the missing identifier and moves on. var pos = getNodePos(); @@ -37338,10 +37582,10 @@ var ts; } function parseModifiersForArrowFunction() { var modifiers; - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { var pos = getNodePos(); nextToken(); - var modifier = finishNode(factory.createToken(131 /* SyntaxKind.AsyncKeyword */), pos); + var modifier = finishNode(factory.createToken(132 /* SyntaxKind.AsyncKeyword */), pos); modifiers = createNodeArray([modifier], pos); } return modifiers; @@ -37358,13 +37602,13 @@ var ts; if (token() === 124 /* SyntaxKind.StaticKeyword */ && lookAhead(nextTokenIsOpenBrace)) { return parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers); } - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 174 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 175 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); } - if (token() === 134 /* SyntaxKind.ConstructorKeyword */ || token() === 10 /* SyntaxKind.StringLiteral */) { + if (token() === 135 /* SyntaxKind.ConstructorKeyword */ || token() === 10 /* SyntaxKind.StringLiteral */) { var constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers); if (constructorDeclaration) { return constructorDeclaration; @@ -37401,10 +37645,10 @@ var ts; return ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined, 226 /* SyntaxKind.ClassExpression */); + return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined, 228 /* SyntaxKind.ClassExpression */); } function parseClassDeclaration(pos, hasJSDoc, decorators, modifiers) { - return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 257 /* SyntaxKind.ClassDeclaration */); + return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 260 /* SyntaxKind.ClassDeclaration */); } function parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, kind) { var savedAwaitContext = inAwaitContext(); @@ -37426,7 +37670,7 @@ var ts; members = createMissingList(); } setAwaitContext(savedAwaitContext); - var node = kind === 257 /* SyntaxKind.ClassDeclaration */ + var node = kind === 260 /* SyntaxKind.ClassDeclaration */ ? factory.createClassDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members) : factory.createClassExpression(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -37463,7 +37707,7 @@ var ts; function parseExpressionWithTypeArguments() { var pos = getNodePos(); var expression = parseLeftHandSideExpressionOrHigher(); - if (expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { return expression; } var typeArguments = tryParseTypeArguments(); @@ -37490,11 +37734,11 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers) { - parseExpected(152 /* SyntaxKind.TypeKeyword */); + parseExpected(154 /* SyntaxKind.TypeKeyword */); var name = parseIdentifier(); var typeParameters = parseTypeParameters(); parseExpected(63 /* SyntaxKind.EqualsToken */); - var type = token() === 138 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); + var type = token() === 139 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); parseSemicolon(); var node = factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type); node.illegalDecorators = decorators; @@ -37553,7 +37797,7 @@ var ts; function parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { var flags = 0; var name; - if (token() === 157 /* SyntaxKind.GlobalKeyword */) { + if (token() === 159 /* SyntaxKind.GlobalKeyword */) { // parse 'global' as name of global scope augmentation name = parseIdentifier(); flags |= 1024 /* NodeFlags.GlobalAugmentation */; @@ -37575,15 +37819,15 @@ var ts; } function parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { var flags = 0; - if (token() === 157 /* SyntaxKind.GlobalKeyword */) { + if (token() === 159 /* SyntaxKind.GlobalKeyword */) { // global augmentation return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); } - else if (parseOptional(142 /* SyntaxKind.NamespaceKeyword */)) { + else if (parseOptional(143 /* SyntaxKind.NamespaceKeyword */)) { flags |= 16 /* NodeFlags.Namespace */; } else { - parseExpected(141 /* SyntaxKind.ModuleKeyword */); + parseExpected(142 /* SyntaxKind.ModuleKeyword */); if (token() === 10 /* SyntaxKind.StringLiteral */) { return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); } @@ -37591,7 +37835,7 @@ var ts; return parseModuleOrNamespaceDeclaration(pos, hasJSDoc, decorators, modifiers, flags); } function isExternalModuleReference() { - return token() === 146 /* SyntaxKind.RequireKeyword */ && + return token() === 147 /* SyntaxKind.RequireKeyword */ && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { @@ -37604,8 +37848,8 @@ var ts; return nextToken() === 43 /* SyntaxKind.SlashToken */; } function parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers) { - parseExpected(127 /* SyntaxKind.AsKeyword */); - parseExpected(142 /* SyntaxKind.NamespaceKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); + parseExpected(143 /* SyntaxKind.NamespaceKeyword */); var name = parseIdentifier(); parseSemicolon(); var node = factory.createNamespaceExportDeclaration(name); @@ -37623,7 +37867,7 @@ var ts; identifier = parseIdentifier(); } var isTypeOnly = false; - if (token() !== 156 /* SyntaxKind.FromKeyword */ && + if (token() !== 158 /* SyntaxKind.FromKeyword */ && (identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) === "type" && (isIdentifier() || tokenAfterImportDefinitelyProducesImportDeclaration())) { isTypeOnly = true; @@ -37641,11 +37885,11 @@ var ts; token() === 18 /* SyntaxKind.OpenBraceToken */ // import { ) { importClause = parseImportClause(identifier, afterImportPos, isTypeOnly); - parseExpected(156 /* SyntaxKind.FromKeyword */); + parseExpected(158 /* SyntaxKind.FromKeyword */); } var moduleSpecifier = parseModuleSpecifier(); var assertClause; - if (token() === 129 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 130 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -37663,7 +37907,7 @@ var ts; function parseAssertClause(skipAssertKeyword) { var pos = getNodePos(); if (!skipAssertKeyword) { - parseExpected(129 /* SyntaxKind.AssertKeyword */); + parseExpected(130 /* SyntaxKind.AssertKeyword */); } var openBracePosition = scanner.getTokenPos(); if (parseExpected(18 /* SyntaxKind.OpenBraceToken */)) { @@ -37688,7 +37932,7 @@ var ts; function tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration() { // In `import id ___`, the current token decides whether to produce // an ImportDeclaration or ImportEqualsDeclaration. - return token() === 27 /* SyntaxKind.CommaToken */ || token() === 156 /* SyntaxKind.FromKeyword */; + return token() === 27 /* SyntaxKind.CommaToken */ || token() === 158 /* SyntaxKind.FromKeyword */; } function parseImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers, identifier, isTypeOnly) { parseExpected(63 /* SyntaxKind.EqualsToken */); @@ -37711,7 +37955,7 @@ var ts; var namedBindings; if (!identifier || parseOptional(27 /* SyntaxKind.CommaToken */)) { - namedBindings = token() === 41 /* SyntaxKind.AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(269 /* SyntaxKind.NamedImports */); + namedBindings = token() === 41 /* SyntaxKind.AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(272 /* SyntaxKind.NamedImports */); } return finishNode(factory.createImportClause(isTypeOnly, identifier, namedBindings), pos); } @@ -37722,7 +37966,7 @@ var ts; } function parseExternalModuleReference() { var pos = getNodePos(); - parseExpected(146 /* SyntaxKind.RequireKeyword */); + parseExpected(147 /* SyntaxKind.RequireKeyword */); parseExpected(20 /* SyntaxKind.OpenParenToken */); var expression = parseModuleSpecifier(); parseExpected(21 /* SyntaxKind.CloseParenToken */); @@ -37746,7 +37990,7 @@ var ts; // * as ImportedBinding var pos = getNodePos(); parseExpected(41 /* SyntaxKind.AsteriskToken */); - parseExpected(127 /* SyntaxKind.AsKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); var name = parseIdentifier(); return finishNode(factory.createNamespaceImport(name), pos); } @@ -37759,17 +38003,17 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - var node = kind === 269 /* SyntaxKind.NamedImports */ + var node = kind === 272 /* SyntaxKind.NamedImports */ ? factory.createNamedImports(parseBracketedList(23 /* ParsingContext.ImportOrExportSpecifiers */, parseImportSpecifier, 18 /* SyntaxKind.OpenBraceToken */, 19 /* SyntaxKind.CloseBraceToken */)) : factory.createNamedExports(parseBracketedList(23 /* ParsingContext.ImportOrExportSpecifiers */, parseExportSpecifier, 18 /* SyntaxKind.OpenBraceToken */, 19 /* SyntaxKind.CloseBraceToken */)); return finishNode(node, pos); } function parseExportSpecifier() { var hasJSDoc = hasPrecedingJSDocComment(); - return withJSDoc(parseImportOrExportSpecifier(275 /* SyntaxKind.ExportSpecifier */), hasJSDoc); + return withJSDoc(parseImportOrExportSpecifier(278 /* SyntaxKind.ExportSpecifier */), hasJSDoc); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(270 /* SyntaxKind.ImportSpecifier */); + return parseImportOrExportSpecifier(273 /* SyntaxKind.ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var pos = getNodePos(); @@ -37794,10 +38038,10 @@ var ts; // import { type as } from "mod"; - isTypeOnly: true, name: as // import { type as as } from "mod"; - isTypeOnly: false, name: as, propertyName: type // import { type as as as } from "mod"; - isTypeOnly: true, name: as, propertyName: as - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */) { // { type as ...? } var firstAs = parseIdentifierName(); - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */) { // { type as as ...? } var secondAs = parseIdentifierName(); if (ts.tokenIsIdentifierOrKeyword(token())) { @@ -37832,15 +38076,15 @@ var ts; name = parseNameWithKeywordCheck(); } } - if (canParseAsKeyword && token() === 127 /* SyntaxKind.AsKeyword */) { + if (canParseAsKeyword && token() === 128 /* SyntaxKind.AsKeyword */) { propertyName = name; - parseExpected(127 /* SyntaxKind.AsKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); name = parseNameWithKeywordCheck(); } - if (kind === 270 /* SyntaxKind.ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 273 /* SyntaxKind.ImportSpecifier */ && checkIdentifierIsKeyword) { parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected); } - var node = kind === 270 /* SyntaxKind.ImportSpecifier */ + var node = kind === 273 /* SyntaxKind.ImportSpecifier */ ? factory.createImportSpecifier(isTypeOnly, propertyName, name) : factory.createExportSpecifier(isTypeOnly, propertyName, name); return finishNode(node, pos); @@ -37860,26 +38104,26 @@ var ts; var exportClause; var moduleSpecifier; var assertClause; - var isTypeOnly = parseOptional(152 /* SyntaxKind.TypeKeyword */); + var isTypeOnly = parseOptional(154 /* SyntaxKind.TypeKeyword */); var namespaceExportPos = getNodePos(); if (parseOptional(41 /* SyntaxKind.AsteriskToken */)) { - if (parseOptional(127 /* SyntaxKind.AsKeyword */)) { + if (parseOptional(128 /* SyntaxKind.AsKeyword */)) { exportClause = parseNamespaceExport(namespaceExportPos); } - parseExpected(156 /* SyntaxKind.FromKeyword */); + parseExpected(158 /* SyntaxKind.FromKeyword */); moduleSpecifier = parseModuleSpecifier(); } else { - exportClause = parseNamedImportsOrExports(273 /* SyntaxKind.NamedExports */); + exportClause = parseNamedImportsOrExports(276 /* SyntaxKind.NamedExports */); // It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios, // the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`) // If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect. - if (token() === 156 /* SyntaxKind.FromKeyword */ || (token() === 10 /* SyntaxKind.StringLiteral */ && !scanner.hasPrecedingLineBreak())) { - parseExpected(156 /* SyntaxKind.FromKeyword */); + if (token() === 158 /* SyntaxKind.FromKeyword */ || (token() === 10 /* SyntaxKind.StringLiteral */ && !scanner.hasPrecedingLineBreak())) { + parseExpected(158 /* SyntaxKind.FromKeyword */); moduleSpecifier = parseModuleSpecifier(); } } - if (moduleSpecifier && token() === 129 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (moduleSpecifier && token() === 130 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -38492,9 +38736,9 @@ var ts; } function isObjectOrObjectArrayTypeReference(node) { switch (node.kind) { - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return true; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return isObjectOrObjectArrayTypeReference(node.elementType); default: return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && !node.typeArguments; @@ -38526,12 +38770,12 @@ var ts; var child = void 0; var children = void 0; while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) { - if (child.kind === 340 /* SyntaxKind.JSDocParameterTag */ || child.kind === 347 /* SyntaxKind.JSDocPropertyTag */) { + if (child.kind === 343 /* SyntaxKind.JSDocParameterTag */ || child.kind === 350 /* SyntaxKind.JSDocPropertyTag */) { children = ts.append(children, child); } } if (children) { - var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 183 /* SyntaxKind.ArrayType */), pos); + var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 185 /* SyntaxKind.ArrayType */), pos); return finishNode(factory.createJSDocTypeExpression(literal), pos); } } @@ -38649,7 +38893,7 @@ var ts; var hasChildren = false; while (child = tryParse(function () { return parseChildPropertyTag(indent); })) { hasChildren = true; - if (child.kind === 343 /* SyntaxKind.JSDocTypeTag */) { + if (child.kind === 346 /* SyntaxKind.JSDocTypeTag */) { if (childTypeTag) { var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); if (lastError) { @@ -38666,7 +38910,7 @@ var ts; } } if (hasChildren) { - var isArrayType = typeExpression && typeExpression.type.kind === 183 /* SyntaxKind.ArrayType */; + var isArrayType = typeExpression && typeExpression.type.kind === 185 /* SyntaxKind.ArrayType */; var jsdocTypeLiteral = factory.createJSDocTypeLiteral(jsDocPropertyTags, isArrayType); typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ? childTypeTag.typeExpression : @@ -38718,7 +38962,7 @@ var ts; var returnTag = tryParse(function () { if (parseOptionalJsdoc(59 /* SyntaxKind.AtToken */)) { var tag = parseTag(indent); - if (tag && tag.kind === 341 /* SyntaxKind.JSDocReturnTag */) { + if (tag && tag.kind === 344 /* SyntaxKind.JSDocReturnTag */) { return tag; } } @@ -38753,7 +38997,7 @@ var ts; case 59 /* SyntaxKind.AtToken */: if (canParseTag) { var child = tryParseChildTag(target, indent); - if (child && (child.kind === 340 /* SyntaxKind.JSDocParameterTag */ || child.kind === 347 /* SyntaxKind.JSDocPropertyTag */) && + if (child && (child.kind === 343 /* SyntaxKind.JSDocParameterTag */ || child.kind === 350 /* SyntaxKind.JSDocPropertyTag */) && target !== 4 /* PropertyLikeParse.CallbackParameter */ && name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; @@ -39723,6 +39967,7 @@ var ts; ["es2019.object", "lib.es2019.object.d.ts"], ["es2019.string", "lib.es2019.string.d.ts"], ["es2019.symbol", "lib.es2019.symbol.d.ts"], + ["es2019.intl", "lib.es2019.intl.d.ts"], ["es2020.bigint", "lib.es2020.bigint.d.ts"], ["es2020.date", "lib.es2020.date.d.ts"], ["es2020.promise", "lib.es2020.promise.d.ts"], @@ -39843,6 +40088,7 @@ var ts; shortName: "h", type: "boolean", showInSimplifiedHelpView: true, + isCommandLineOnly: true, category: ts.Diagnostics.Command_line_Options, description: ts.Diagnostics.Print_this_message, defaultValueDescription: false, @@ -39851,6 +40097,8 @@ var ts; name: "help", shortName: "?", type: "boolean", + isCommandLineOnly: true, + category: ts.Diagnostics.Command_line_Options, defaultValueDescription: false, }, { @@ -41582,7 +41830,7 @@ var ts; var _a; var rootExpression = (_a = sourceFile.statements[0]) === null || _a === void 0 ? void 0 : _a.expression; var knownRootOptions = reportOptionsErrors ? getTsconfigRootOptionsMap() : undefined; - if (rootExpression && rootExpression.kind !== 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (rootExpression && rootExpression.kind !== 207 /* SyntaxKind.ObjectLiteralExpression */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, rootExpression, ts.Diagnostics.The_root_value_of_a_0_file_must_be_an_object, ts.getBaseFileName(sourceFile.fileName) === "jsconfig.json" ? "jsconfig.json" : "tsconfig.json")); // Last-ditch error recovery. Somewhat useful because the JSON parser will recover from some parse errors by // synthesizing a top-level array literal expression. There's a reasonable chance the first element of that @@ -41622,7 +41870,7 @@ var ts; function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) { var result = returnValue ? {} : undefined; var _loop_4 = function (element) { - if (element.kind !== 296 /* SyntaxKind.PropertyAssignment */) { + if (element.kind !== 299 /* SyntaxKind.PropertyAssignment */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); return "continue"; } @@ -41716,13 +41964,13 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: reportInvalidOptionValue(option && option.type !== "number"); return validateValue(Number(valueExpression.text)); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: if (valueExpression.operator !== 40 /* SyntaxKind.MinusToken */ || valueExpression.operand.kind !== 8 /* SyntaxKind.NumericLiteral */) { break; // not valid JSON syntax } reportInvalidOptionValue(option && option.type !== "number"); return validateValue(-Number(valueExpression.operand.text)); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: reportInvalidOptionValue(option && option.type !== "object"); var objectLiteralExpression = valueExpression; // Currently having element option declaration in the tsconfig with type "object" @@ -41739,7 +41987,7 @@ var ts; return validateValue(convertObjectLiteralExpressionToJson(objectLiteralExpression, /* knownOptions*/ undefined, /*extraKeyDiagnosticMessage */ undefined, /*parentOption*/ undefined)); } - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: reportInvalidOptionValue(option && option.type !== "list"); return validateValue(convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element)); } @@ -42923,7 +43171,7 @@ var ts; function convertCompilerOptionsForTelemetry(opts) { var out = {}; for (var key in opts) { - if (opts.hasOwnProperty(key)) { + if (ts.hasProperty(opts, key)) { var type = getOptionFromName(key); if (type !== undefined) { // Ignore unknown options out[key] = getOptionValueWithEmptyStrings(opts[key], type); @@ -42989,7 +43237,7 @@ var ts; function withPackageId(packageInfo, r) { var packageId; if (r && packageInfo) { - var packageJsonContent = packageInfo.packageJsonContent; + var packageJsonContent = packageInfo.contents.packageJsonContent; if (typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string") { packageId = { name: packageJsonContent.name, @@ -44308,16 +44556,16 @@ var ts; function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson) { if (considerPackageJson === void 0) { considerPackageJson = true; } var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : undefined; - var packageJsonContent = packageInfo && packageInfo.packageJsonContent; - var versionPaths = packageInfo && packageInfo.versionPaths; + var packageJsonContent = packageInfo && packageInfo.contents.packageJsonContent; + var versionPaths = packageInfo && packageInfo.contents.versionPaths; return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths)); } /* @internal */ function getEntrypointsFromPackageJsonInfo(packageJsonInfo, options, host, cache, resolveJs) { - if (!resolveJs && packageJsonInfo.resolvedEntrypoints !== undefined) { + if (!resolveJs && packageJsonInfo.contents.resolvedEntrypoints !== undefined) { // Cached value excludes resolutions to JS files - those could be // cached separately, but they're used rarely. - return packageJsonInfo.resolvedEntrypoints; + return packageJsonInfo.contents.resolvedEntrypoints; } var entrypoints; var extensions = resolveJs ? Extensions.JavaScript : Extensions.TypeScript; @@ -44326,13 +44574,13 @@ var ts; requireState.conditions = ["node", "require", "types"]; requireState.requestContainingDirectory = packageJsonInfo.packageDirectory; var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory, - /*onlyRecordFailures*/ false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths); + /*onlyRecordFailures*/ false, requireState, packageJsonInfo.contents.packageJsonContent, packageJsonInfo.contents.versionPaths); entrypoints = ts.append(entrypoints, requireResolution === null || requireResolution === void 0 ? void 0 : requireResolution.path); - if (features & NodeResolutionFeatures.Exports && packageJsonInfo.packageJsonContent.exports) { + if (features & NodeResolutionFeatures.Exports && packageJsonInfo.contents.packageJsonContent.exports) { for (var _i = 0, _a = [["node", "import", "types"], ["node", "require", "types"]]; _i < _a.length; _i++) { var conditions = _a[_i]; var exportState = __assign(__assign({}, requireState), { failedLookupLocations: [], conditions: conditions }); - var exportResolutions = loadEntrypointsFromExportMap(packageJsonInfo, packageJsonInfo.packageJsonContent.exports, exportState, extensions); + var exportResolutions = loadEntrypointsFromExportMap(packageJsonInfo, packageJsonInfo.contents.packageJsonContent.exports, exportState, extensions); if (exportResolutions) { for (var _b = 0, exportResolutions_1 = exportResolutions; _b < exportResolutions_1.length; _b++) { var resolution = exportResolutions_1[_b]; @@ -44341,7 +44589,7 @@ var ts; } } } - return packageJsonInfo.resolvedEntrypoints = entrypoints || false; + return packageJsonInfo.contents.resolvedEntrypoints = entrypoints || false; } ts.getEntrypointsFromPackageJsonInfo = getEntrypointsFromPackageJsonInfo; function loadEntrypointsFromExportMap(scope, exports, state, extensions) { @@ -44445,7 +44693,9 @@ var ts; if (traceEnabled) trace(host, ts.Diagnostics.File_0_exists_according_to_earlier_cached_lookups, packageJsonPath); state.affectingLocations.push(packageJsonPath); - return existing; + return existing.packageDirectory === packageDirectory ? + existing : + { packageDirectory: packageDirectory, contents: existing.contents }; } else { if (existing && traceEnabled) @@ -44461,7 +44711,7 @@ var ts; trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); } var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state); - var result = { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined }; + var result = { packageDirectory: packageDirectory, contents: { packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined } }; (_b = state.packageJsonInfoCache) === null || _b === void 0 ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result); state.affectingLocations.push(packageJsonPath); return result; @@ -44586,17 +44836,16 @@ var ts; } function loadModuleFromSelfNameReference(extensions, moduleName, directory, state, cache, redirectedReference) { var _a, _b; - var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames; - var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames)); + var directoryPath = ts.getNormalizedAbsolutePath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)); var scope = getPackageScopeForPath(directoryPath, state); - if (!scope || !scope.packageJsonContent.exports) { + if (!scope || !scope.contents.packageJsonContent.exports) { return undefined; } - if (typeof scope.packageJsonContent.name !== "string") { + if (typeof scope.contents.packageJsonContent.name !== "string") { return undefined; } var parts = ts.getPathComponents(moduleName); // unrooted paths should have `""` as their 0th entry - var nameParts = ts.getPathComponents(scope.packageJsonContent.name); + var nameParts = ts.getPathComponents(scope.contents.packageJsonContent.name); if (!ts.every(nameParts, function (p, i) { return parts[i] === p; })) { return undefined; } @@ -44604,30 +44853,30 @@ var ts; return loadModuleFromExports(scope, extensions, !ts.length(trailingParts) ? "." : ".".concat(ts.directorySeparator).concat(trailingParts.join(ts.directorySeparator)), state, cache, redirectedReference); } function loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference) { - if (!scope.packageJsonContent.exports) { + if (!scope.contents.packageJsonContent.exports) { return undefined; } if (subpath === ".") { var mainExport = void 0; - if (typeof scope.packageJsonContent.exports === "string" || Array.isArray(scope.packageJsonContent.exports) || (typeof scope.packageJsonContent.exports === "object" && noKeyStartsWithDot(scope.packageJsonContent.exports))) { - mainExport = scope.packageJsonContent.exports; + if (typeof scope.contents.packageJsonContent.exports === "string" || Array.isArray(scope.contents.packageJsonContent.exports) || (typeof scope.contents.packageJsonContent.exports === "object" && noKeyStartsWithDot(scope.contents.packageJsonContent.exports))) { + mainExport = scope.contents.packageJsonContent.exports; } - else if (ts.hasProperty(scope.packageJsonContent.exports, ".")) { - mainExport = scope.packageJsonContent.exports["."]; + else if (ts.hasProperty(scope.contents.packageJsonContent.exports, ".")) { + mainExport = scope.contents.packageJsonContent.exports["."]; } if (mainExport) { var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, subpath, scope, /*isImports*/ false); return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false); } } - else if (allKeysStartWithDot(scope.packageJsonContent.exports)) { - if (typeof scope.packageJsonContent.exports !== "object") { + else if (allKeysStartWithDot(scope.contents.packageJsonContent.exports)) { + if (typeof scope.contents.packageJsonContent.exports !== "object") { if (state.traceEnabled) { trace(state.host, ts.Diagnostics.Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1, subpath, scope.packageDirectory); } return toSearchResult(/*value*/ undefined); } - var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, subpath, scope.packageJsonContent.exports, scope, /*isImports*/ false); + var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, subpath, scope.contents.packageJsonContent.exports, scope, /*isImports*/ false); if (result) { return result; } @@ -44645,8 +44894,7 @@ var ts; } return toSearchResult(/*value*/ undefined); } - var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames; - var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames)); + var directoryPath = ts.getNormalizedAbsolutePath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)); var scope = getPackageScopeForPath(directoryPath, state); if (!scope) { if (state.traceEnabled) { @@ -44654,13 +44902,13 @@ var ts; } return toSearchResult(/*value*/ undefined); } - if (!scope.packageJsonContent.imports) { + if (!scope.contents.packageJsonContent.imports) { if (state.traceEnabled) { trace(state.host, ts.Diagnostics.package_json_scope_0_has_no_imports_defined, scope.packageDirectory); } return toSearchResult(/*value*/ undefined); } - var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, scope.packageJsonContent.imports, scope, /*isImports*/ true); + var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, scope.contents.packageJsonContent.imports, scope, /*isImports*/ true); if (result) { return result; } @@ -45005,7 +45253,7 @@ var ts; if (fromFile) { return noPackageId(fromFile); } - var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.packageJsonContent, packageInfo.versionPaths); + var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.contents.packageJsonContent, packageInfo.contents.versionPaths); return withPackageId(packageInfo, fromDirectory); } } @@ -45013,14 +45261,14 @@ var ts; 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.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { + 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.packageJsonContent, packageInfo && packageInfo.versionPaths); + loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths); if (!pathAndExtension && packageInfo // eslint-disable-next-line no-null/no-null - && (packageInfo.packageJsonContent.exports === undefined || packageInfo.packageJsonContent.exports === null) + && (packageInfo.contents.packageJsonContent.exports === undefined || packageInfo.contents.packageJsonContent.exports === null) && state.features & NodeResolutionFeatures.EsmMode) { // EsmMode disables index lookup in `loadNodeModuleFromDirectoryWorker` generally, however non-relative package resolutions still assume // a default `index.js` entrypoint if no `main` or `exports` are present @@ -45032,12 +45280,12 @@ var ts; 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. packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state); - if (packageInfo && packageInfo.versionPaths) { + 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.versionPaths.version, ts.version, rest); + 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.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); + var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); if (fromPaths) { return fromPaths.value; } @@ -45250,26 +45498,26 @@ var ts; // A module is uninstantiated if it contains only switch (node.kind) { // 1. interface declarations, type alias declarations - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return 0 /* ModuleInstanceState.NonInstantiated */; // 2. const enum declarations - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (ts.isEnumConst(node)) { return 2 /* ModuleInstanceState.ConstEnumOnly */; } break; // 3. non-exported import declarations - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: if (!(ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */))) { return 0 /* ModuleInstanceState.NonInstantiated */; } break; // 4. Export alias declarations pointing at only uninstantiated modules or things uninstantiated modules contain - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportDeclaration = node; - if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 273 /* SyntaxKind.NamedExports */) { + if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 276 /* SyntaxKind.NamedExports */) { var state = 0 /* ModuleInstanceState.NonInstantiated */; for (var _i = 0, _a = exportDeclaration.exportClause.elements; _i < _a.length; _i++) { var specifier = _a[_i]; @@ -45285,7 +45533,7 @@ var ts; } break; // 5. other uninstantiated module declarations. - case 262 /* SyntaxKind.ModuleBlock */: { + case 265 /* SyntaxKind.ModuleBlock */: { var state_1 = 0 /* ModuleInstanceState.NonInstantiated */; ts.forEachChild(node, function (n) { var childState = getModuleInstanceStateCached(n, visited); @@ -45307,7 +45555,7 @@ var ts; }); return state_1; } - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return getModuleInstanceState(node, visited); case 79 /* SyntaxKind.Identifier */: // Only jsdoc typedef definition can exist in jsdoc namespace, and it should @@ -45508,7 +45756,7 @@ var ts; // Should not be called on a declaration with a computed property name, // unless it is a well known Symbol. function getDeclarationName(node) { - if (node.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (node.kind === 274 /* SyntaxKind.ExportAssignment */) { return node.isExportEquals ? "export=" /* InternalSymbolName.ExportEquals */ : "default" /* InternalSymbolName.Default */; } var name = ts.getNameOfDeclaration(node); @@ -45517,7 +45765,7 @@ var ts; var moduleName = ts.getTextOfIdentifierOrLiteral(name); return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"".concat(moduleName, "\"")); } - if (name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { var nameExpression = name.expression; // treat computed property names where expression is string/numeric literal as just string/numeric literal if (ts.isStringOrNumericLiteralLike(nameExpression)) { @@ -45543,36 +45791,36 @@ var ts; return ts.isPropertyNameLiteral(name) ? ts.getEscapedTextOfIdentifierOrLiteral(name) : undefined; } switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "__constructor" /* InternalSymbolName.Constructor */; - case 179 /* SyntaxKind.FunctionType */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: return "__call" /* InternalSymbolName.Call */; - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return "__new" /* InternalSymbolName.New */; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return "__index" /* InternalSymbolName.Index */; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return "__export" /* InternalSymbolName.ExportStar */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // json file should behave as // module.exports = ... return "export=" /* InternalSymbolName.ExportEquals */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */) { // module.exports = ... return "export=" /* InternalSymbolName.ExportEquals */; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return (ts.isJSDocConstructSignature(node) ? "__new" /* InternalSymbolName.New */ : "__call" /* InternalSymbolName.Call */); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Parameters with names are handled at the top of this function. Parameters // without names can only come from JSDocFunctionTypes. - ts.Debug.assert(node.parent.kind === 317 /* SyntaxKind.JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); }); + ts.Debug.assert(node.parent.kind === 320 /* SyntaxKind.JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); }); var functionType = node.parent; var index = functionType.parameters.indexOf(node); return "arg" + index; @@ -45591,7 +45839,7 @@ var ts; */ function declareSymbol(symbolTable, parent, node, includes, excludes, isReplaceableByMethod, isComputedName) { ts.Debug.assert(isComputedName || !ts.hasDynamicName(node)); - var isDefaultExport = ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) || ts.isExportSpecifier(node) && node.name.escapedText === "default"; + var isDefaultExport = ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) || ts.isExportSpecifier(node) && node.name.escapedText === "default"; // The exported symbol for an export default function/class node is always named "default" var name = isComputedName ? "__computed" /* InternalSymbolName.Computed */ : isDefaultExport && parent ? "default" /* InternalSymbolName.Default */ @@ -45674,7 +45922,7 @@ var ts; // 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default // 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers) if (symbol.declarations && symbol.declarations.length && - (node.kind === 271 /* SyntaxKind.ExportAssignment */ && !node.isExportEquals)) { + (node.kind === 274 /* SyntaxKind.ExportAssignment */ && !node.isExportEquals)) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; messageNeedsName_1 = false; multipleDefaultExports_1 = true; @@ -45713,7 +45961,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = !!(ts.getCombinedModifierFlags(node) & 1 /* ModifierFlags.Export */) || jsdocTreatAsExported(node); if (symbolFlags & 2097152 /* SymbolFlags.Alias */) { - if (node.kind === 275 /* SyntaxKind.ExportSpecifier */ || (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 278 /* SyntaxKind.ExportSpecifier */ || (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -45738,7 +45986,7 @@ var ts; if (ts.isJSDocTypeAlias(node)) ts.Debug.assert(ts.isInJSFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file. if (!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 64 /* NodeFlags.ExportContext */)) { - if (!container.locals || (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) && !getDeclarationName(node))) { + if (!container.locals || (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) && !getDeclarationName(node))) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); // No local symbol for an unnamed default! } var exportKind = symbolFlags & 111551 /* SymbolFlags.Value */ ? 1048576 /* SymbolFlags.ExportValue */ : 0; @@ -45802,7 +46050,7 @@ var ts; // for it. We must clear this so we don't accidentally move any stale data forward from // a previous compilation. if (containerFlags & 1 /* ContainerFlags.IsContainer */) { - if (node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind !== 216 /* SyntaxKind.ArrowFunction */) { thisParentContainer = container; } container = blockScopeContainer = node; @@ -45824,10 +46072,10 @@ var ts; var saveActiveLabelList = activeLabelList; var saveHasExplicitReturn = hasExplicitReturn; var isImmediatelyInvoked = (containerFlags & 16 /* ContainerFlags.IsFunctionExpression */ && - !ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Async */) && + !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Async */) && !node.asteriskToken && !!ts.getImmediatelyInvokedFunctionExpression(node)) || - node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; // A non-async, non-generator IIFE is considered part of the containing control flow. Return statements behave // similarly to break statements that exit to a label just past the statement body. if (!isImmediatelyInvoked) { @@ -45838,7 +46086,7 @@ var ts; } // We create a return control flow graph for IIFEs and constructors. For constructors // we use the return control flow graph in strict property initialization checks. - currentReturnTarget = isImmediatelyInvoked || node.kind === 171 /* SyntaxKind.Constructor */ || (ts.isInJSFile(node) && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */)) ? createBranchLabel() : undefined; + currentReturnTarget = isImmediatelyInvoked || node.kind === 173 /* SyntaxKind.Constructor */ || (ts.isInJSFile(node) && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */)) ? createBranchLabel() : undefined; currentExceptionTarget = undefined; currentBreakTarget = undefined; currentContinueTarget = undefined; @@ -45853,14 +46101,14 @@ var ts; node.flags |= 512 /* NodeFlags.HasExplicitReturn */; node.endFlowNode = currentFlow; } - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { node.flags |= emitFlags; node.endFlowNode = currentFlow; } if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); currentFlow = finishFlowLabel(currentReturnTarget); - if (node.kind === 171 /* SyntaxKind.Constructor */ || node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ || (ts.isInJSFile(node) && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */))) { + if (node.kind === 173 /* SyntaxKind.Constructor */ || node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ || (ts.isInJSFile(node) && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */))) { node.returnFlowNode = currentFlow; } } @@ -45887,8 +46135,8 @@ var ts; blockScopeContainer = savedBlockScopeContainer; } function bindEachFunctionsFirst(nodes) { - bindEach(nodes, function (n) { return n.kind === 256 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); - bindEach(nodes, function (n) { return n.kind !== 256 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind === 259 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind !== 259 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); } function bindEach(nodes, bindFunction) { if (bindFunction === void 0) { bindFunction = bind; } @@ -45911,59 +46159,59 @@ var ts; inAssignmentPattern = saveInAssignmentPattern; return; } - if (node.kind >= 237 /* SyntaxKind.FirstStatement */ && node.kind <= 253 /* SyntaxKind.LastStatement */ && !options.allowUnreachableCode) { + if (node.kind >= 240 /* SyntaxKind.FirstStatement */ && node.kind <= 256 /* SyntaxKind.LastStatement */ && !options.allowUnreachableCode) { node.flowNode = currentFlow; } switch (node.kind) { - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: bindWhileStatement(node); break; - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: bindDoStatement(node); break; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: bindForStatement(node); break; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: bindForInOrForOfStatement(node); break; - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: bindIfStatement(node); break; - case 247 /* SyntaxKind.ReturnStatement */: - case 251 /* SyntaxKind.ThrowStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 254 /* SyntaxKind.ThrowStatement */: bindReturnOrThrow(node); break; - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: bindTryStatement(node); break; - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: bindSwitchStatement(node); break; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: bindCaseBlock(node); break; - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: bindCaseClause(node); break; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: bindExpressionStatement(node); break; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: bindLabeledStatement(node); break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: bindPrefixUnaryExpressionFlow(node); break; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: bindPostfixUnaryExpressionFlow(node); break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { // Carry over whether we are in an assignment pattern to // binary expressions that could actually be an initializer @@ -45973,47 +46221,50 @@ var ts; } bindBinaryExpressionFlow(node); break; - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: bindDeleteExpressionFlow(node); break; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: bindConditionalExpressionFlow(node); break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: bindVariableDeclarationFlow(node); break; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: bindAccessExpressionFlow(node); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: bindCallExpressionFlow(node); break; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: bindNonNullExpressionFlow(node); break; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: bindJSDocTypeAlias(node); break; // In source files and blocks, bind functions first to match hoisting that occurs at runtime - case 305 /* SyntaxKind.SourceFile */: { + case 308 /* SyntaxKind.SourceFile */: { bindEachFunctionsFirst(node.statements); bind(node.endOfFileToken); break; } - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: bindEachFunctionsFirst(node.statements); break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: bindBindingElementFlow(node); break; - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 225 /* SyntaxKind.SpreadElement */: + case 166 /* SyntaxKind.Parameter */: + bindParameterFlow(node); + break; + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 227 /* SyntaxKind.SpreadElement */: // Carry over whether we are in an assignment pattern of Object and Array literals // as well as their children that are valid assignment targets. inAssignmentPattern = saveInAssignmentPattern; @@ -46030,19 +46281,19 @@ var ts; case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: case 108 /* SyntaxKind.ThisKeyword */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return containsNarrowableReference(expr); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return hasNarrowableArgument(expr); - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return isNarrowingExpression(expr.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isNarrowingBinaryExpression(expr); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 53 /* SyntaxKind.ExclamationToken */ && isNarrowingExpression(expr.operand); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return isNarrowingExpression(expr.expression); } return false; @@ -46066,7 +46317,7 @@ var ts; } } } - if (expr.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + if (expr.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && containsNarrowableReference(expr.expression.expression)) { return true; } @@ -46099,9 +46350,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isNarrowableOperand(expr.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (expr.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: return isNarrowableOperand(expr.left); @@ -46177,26 +46428,26 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: return parent.expression === node; - case 242 /* SyntaxKind.ForStatement */: - case 222 /* SyntaxKind.ConditionalExpression */: + case 245 /* SyntaxKind.ForStatement */: + case 224 /* SyntaxKind.ConditionalExpression */: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (node.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { node = node.expression; } - else if (node.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && node.operator === 53 /* SyntaxKind.ExclamationToken */) { + else if (node.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && node.operator === 53 /* SyntaxKind.ExclamationToken */) { node = node.operand; } else { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ || node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */); } @@ -46242,7 +46493,7 @@ var ts; } function setContinueTarget(node, target) { var label = activeLabelList; - while (label && node.parent.kind === 250 /* SyntaxKind.LabeledStatement */) { + while (label && node.parent.kind === 253 /* SyntaxKind.LabeledStatement */) { label.continueTarget = target; label = label.next; node = node.parent; @@ -46293,12 +46544,12 @@ var ts; bind(node.expression); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; - if (node.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.kind === 247 /* SyntaxKind.ForOfStatement */) { bind(node.awaitModifier); } addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -46320,7 +46571,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 247 /* SyntaxKind.ReturnStatement */) { + if (node.kind === 250 /* SyntaxKind.ReturnStatement */) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -46337,7 +46588,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 246 /* SyntaxKind.BreakStatement */ ? breakTarget : continueTarget; + var flowLabel = node.kind === 249 /* SyntaxKind.BreakStatement */ ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -46442,7 +46693,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 290 /* SyntaxKind.DefaultClause */; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 293 /* SyntaxKind.DefaultClause */; }); // We mark a switch statement as possibly exhaustive if it has no default clause and if all // case clauses have unreachable end points (e.g. they all return). Note, we no longer need // this property in control flow analysis, it's there only for backwards compatibility. @@ -46490,7 +46741,7 @@ var ts; function maybeBindExpressionFlowIfCall(node) { // A top level or comma expression call expression with a dotted function name and at least one argument // is potentially an assertion and is therefore included in the control flow. - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { var call = node; if (call.expression.kind !== 106 /* SyntaxKind.SuperKeyword */ && ts.isDottedName(call.expression)) { currentFlow = createFlowCall(currentFlow, call); @@ -46516,7 +46767,7 @@ var ts; currentFlow = finishFlowLabel(postStatementLabel); } function bindDestructuringTargetFlow(node) { - if (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { bindAssignmentTargetFlow(node.left); } else { @@ -46527,10 +46778,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowMutation(16 /* FlowFlags.Assignment */, currentFlow, node); } - else if (node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */) { + else if (node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 225 /* SyntaxKind.SpreadElement */) { + if (e.kind === 227 /* SyntaxKind.SpreadElement */) { bindAssignmentTargetFlow(e.expression); } else { @@ -46538,16 +46789,16 @@ var ts; } } } - else if (node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + else if (node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (p.kind === 299 /* SyntaxKind.PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + else if (p.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (p.kind === 301 /* SyntaxKind.SpreadAssignment */) { bindAssignmentTargetFlow(p.expression); } } @@ -46684,7 +46935,7 @@ var ts; var operator = node.operatorToken.kind; if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 63 /* SyntaxKind.EqualsToken */ && node.left.kind === 207 /* SyntaxKind.ElementAccessExpression */) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && node.left.kind === 209 /* SyntaxKind.ElementAccessExpression */) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowMutation(256 /* FlowFlags.ArrayMutation */, currentFlow, node); @@ -46712,7 +46963,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { bindAssignmentTargetFlow(node.expression); } } @@ -46750,24 +47001,42 @@ var ts; } } function bindBindingElementFlow(node) { - if (ts.isBindingPattern(node.name)) { - // When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per: - // - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization - // - `BindingElement: BindingPattern Initializer?` - // - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization - // - `BindingElement: BindingPattern Initializer?` - bind(node.dotDotDotToken); - bind(node.propertyName); - bind(node.initializer); - bind(node.name); + // When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per: + // - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization + // - `BindingElement: BindingPattern Initializer?` + // - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization + // - `BindingElement: BindingPattern Initializer?` + bind(node.dotDotDotToken); + bind(node.propertyName); + bindInitializer(node.initializer); + bind(node.name); + } + function bindParameterFlow(node) { + bindEach(node.modifiers); + bind(node.dotDotDotToken); + bind(node.questionToken); + bind(node.type); + bindInitializer(node.initializer); + bind(node.name); + } + // a BindingElement/Parameter does not have side effects if initializers are not evaluated and used. (see GH#49759) + function bindInitializer(node) { + if (!node) { + return; } - else { - bindEachChild(node); + var entryFlow = currentFlow; + bind(node); + if (entryFlow === unreachableFlow || entryFlow === currentFlow) { + return; } + var exitFlow = createBranchLabel(); + addAntecedent(exitFlow, entryFlow); + addAntecedent(exitFlow, currentFlow); + currentFlow = finishFlowLabel(exitFlow); } function bindJSDocTypeAlias(node) { bind(node.tagName); - if (node.kind !== 339 /* SyntaxKind.JSDocEnumTag */ && node.fullName) { + if (node.kind !== 342 /* SyntaxKind.JSDocEnumTag */ && node.fullName) { // don't bind the type name yet; that's delayed until delayedBindJSDocTypedefTag ts.setParent(node.fullName, node); ts.setParentRecursive(node.fullName, /*incremental*/ false); @@ -46779,7 +47048,7 @@ var ts; function bindJSDocClassTag(node) { bindEachChild(node); var host = ts.getHostSignatureFromJSDoc(node); - if (host && host.kind !== 169 /* SyntaxKind.MethodDeclaration */) { + if (host && host.kind !== 171 /* SyntaxKind.MethodDeclaration */) { addDeclarationToSymbol(host.symbol, host, 32 /* SymbolFlags.Class */); } } @@ -46792,15 +47061,15 @@ var ts; } function bindOptionalChainRest(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: bind(node.questionDotToken); bind(node.name); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: bind(node.questionDotToken); bind(node.argumentExpression); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: bind(node.questionDotToken); bindEach(node.typeArguments); bindEach(node.arguments); @@ -46865,7 +47134,7 @@ var ts; // an immediately invoked function expression (IIFE). Initialize the flowNode property to // the current control flow (which includes evaluation of the IIFE arguments). var expr = ts.skipParentheses(node.expression); - if (expr.kind === 213 /* SyntaxKind.FunctionExpression */ || expr.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (expr.kind === 215 /* SyntaxKind.FunctionExpression */ || expr.kind === 216 /* SyntaxKind.ArrowFunction */) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -46877,7 +47146,7 @@ var ts; } } } - if (node.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var propertyAccess = node.expression; if (ts.isIdentifier(propertyAccess.name) && isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowMutation(256 /* FlowFlags.ArrayMutation */, currentFlow, node); @@ -46886,55 +47155,55 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 286 /* SyntaxKind.JsxAttributes */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 289 /* SyntaxKind.JsxAttributes */: return 1 /* ContainerFlags.IsContainer */; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return 1 /* ContainerFlags.IsContainer */ | 64 /* ContainerFlags.IsInterface */; - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 195 /* SyntaxKind.MappedType */: - case 176 /* SyntaxKind.IndexSignature */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 197 /* SyntaxKind.MappedType */: + case 178 /* SyntaxKind.IndexSignature */: return 1 /* ContainerFlags.IsContainer */ | 32 /* ContainerFlags.HasLocals */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: if (ts.isObjectLiteralOrClassExpressionMethodOrAccessor(node)) { return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */ | 128 /* ContainerFlags.IsObjectLiteralOrClassExpressionMethodOrAccessor */; } // falls through - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 179 /* SyntaxKind.FunctionType */: - case 175 /* SyntaxKind.ConstructSignature */: - case 180 /* SyntaxKind.ConstructorType */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 181 /* SyntaxKind.FunctionType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */ | 16 /* ContainerFlags.IsFunctionExpression */; - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return 4 /* ContainerFlags.IsControlFlowContainer */; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return node.initializer ? 4 /* ContainerFlags.IsControlFlowContainer */ : 0; - case 292 /* SyntaxKind.CatchClause */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 263 /* SyntaxKind.CaseBlock */: + case 295 /* SyntaxKind.CatchClause */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 266 /* SyntaxKind.CaseBlock */: return 2 /* ContainerFlags.IsBlockScopedContainer */; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: // do not treat blocks directly inside a function as a block-scoped-container. // Locals that reside in this block should go to the function locals. Otherwise 'x' // would not appear to be a redeclaration of a block scoped local in the following @@ -46967,46 +47236,46 @@ var ts; // members are declared (for example, a member of a class will go into a specific // symbol table depending on if it is static or not). We defer to specialized // handlers to take care of declaring these child members. - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 286 /* SyntaxKind.JsxAttributes */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 289 /* SyntaxKind.JsxAttributes */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the // object / type / interface declaring them). An exception is type parameters, // which are in scope without qualification (similar to 'locals'). return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 195 /* SyntaxKind.MappedType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 197 /* SyntaxKind.MappedType */: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, // they're only accessed 'lexically' (i.e. from code that exists underneath @@ -47114,10 +47383,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (ts.isExternalOrCommonJsModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -47214,7 +47483,7 @@ var ts; node.originalKeywordKind <= 125 /* SyntaxKind.LastFutureReservedWord */) { file.bindDiagnostics.push(createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); } - else if (node.originalKeywordKind === 132 /* SyntaxKind.AwaitKeyword */) { + else if (node.originalKeywordKind === 133 /* SyntaxKind.AwaitKeyword */) { if (ts.isExternalModule(file) && ts.isInTopLevelContext(node)) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module, ts.declarationNameToString(node))); } @@ -47316,8 +47585,8 @@ var ts; function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { // Report error if function is not top level function declaration - if (blockScopeContainer.kind !== 305 /* SyntaxKind.SourceFile */ && - blockScopeContainer.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && + if (blockScopeContainer.kind !== 308 /* SyntaxKind.SourceFile */ && + blockScopeContainer.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isFunctionLikeOrClassStaticBlockDeclaration(blockScopeContainer)) { // We check first if the name is inside class declaration or class expression; if so give explicit message // otherwise report generic error message. @@ -47414,7 +47683,7 @@ var ts; // the current 'container' node when it changes. This helps us know which symbol table // a local should go into for example. Since terminal nodes are known not to have // children, as an optimization we don't process those. - if (node.kind > 160 /* SyntaxKind.LastToken */) { + if (node.kind > 162 /* SyntaxKind.LastToken */) { var saveParent = parent; parent = node; var containerFlags = getContainerFlags(node); @@ -47490,23 +47759,23 @@ var ts; } // falls through case 108 /* SyntaxKind.ThisKeyword */: - if (currentFlow && (ts.isExpression(node) || parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkContextualIdentifier(node); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: if (currentFlow && ts.isPartOfTypeQuery(node)) { node.flowNode = currentFlow; } break; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: case 106 /* SyntaxKind.SuperKeyword */: node.flowNode = currentFlow; break; case 80 /* SyntaxKind.PrivateIdentifier */: return checkPrivateIdentifier(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = node; if (currentFlow && isNarrowableReference(expr)) { expr.flowNode = currentFlow; @@ -47521,7 +47790,7 @@ var ts; declareSymbol(file.locals, /*parent*/ undefined, expr.expression, 1 /* SymbolFlags.FunctionScopedVariable */ | 134217728 /* SymbolFlags.ModuleExports */, 111550 /* SymbolFlags.FunctionScopedVariableExcludes */); } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var specialKind = ts.getAssignmentDeclarationKind(node); switch (specialKind) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -47557,78 +47826,78 @@ var ts; ts.Debug.fail("Unknown binary expression special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return checkStrictModeCatchClause(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return checkStrictModeDeleteExpression(node); case 8 /* SyntaxKind.NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return checkStrictModeWithStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return checkStrictModeLabeledStatement(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: seenThisKeyword = true; return; - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: break; // Binding the children will handle everything - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return bindTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return bindParameter(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return bindVariableDeclarationOrBindingElement(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: node.flowNode = currentFlow; return bindVariableDeclarationOrBindingElement(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return bindPropertyWorker(node); - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* SymbolFlags.Property */, 0 /* SymbolFlags.PropertyExcludes */); - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* SymbolFlags.EnumMember */, 900095 /* SymbolFlags.EnumMemberExcludes */); - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* SymbolFlags.Signature */, 0 /* SymbolFlags.None */); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: // If this is an ObjectLiteralExpression method, then it sits in the same space // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes // so that it will conflict with any other object literal members with the same // name. return bindPropertyOrMethodOrAccessor(node, 8192 /* SymbolFlags.Method */ | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), ts.isObjectLiteralMethod(node) ? 0 /* SymbolFlags.PropertyExcludes */ : 103359 /* SymbolFlags.MethodExcludes */); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return bindFunctionDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* SymbolFlags.Constructor */, /*symbolExcludes:*/ 0 /* SymbolFlags.None */); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* SymbolFlags.GetAccessor */, 46015 /* SymbolFlags.GetAccessorExcludes */); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SymbolFlags.SetAccessor */, 78783 /* SymbolFlags.SetAccessorExcludes */); - case 179 /* SyntaxKind.FunctionType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 323 /* SyntaxKind.JSDocSignature */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 326 /* SyntaxKind.JSDocSignature */: + case 182 /* SyntaxKind.ConstructorType */: return bindFunctionOrConstructorType(node); - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 195 /* SyntaxKind.MappedType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 197 /* SyntaxKind.MappedType */: return bindAnonymousTypeWorker(node); - case 332 /* SyntaxKind.JSDocClassTag */: + case 335 /* SyntaxKind.JSDocClassTag */: return bindJSDocClassTag(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return bindFunctionExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: var assignmentKind = ts.getAssignmentDeclarationKind(node); switch (assignmentKind) { case 7 /* AssignmentDeclarationKind.ObjectDefinePropertyValue */: @@ -47647,70 +47916,73 @@ var ts; } break; // Members of classes, interfaces, and modules - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return bindClassLikeDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* SymbolFlags.Interface */, 788872 /* SymbolFlags.InterfaceExcludes */); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* SymbolFlags.TypeAlias */, 788968 /* SymbolFlags.TypeAliasExcludes */); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return bindEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return bindModuleDeclaration(node); // Jsx-attributes - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return bindJsxAttributes(node); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return bindJsxAttribute(node, 4 /* SymbolFlags.Property */, 0 /* SymbolFlags.PropertyExcludes */); // Imports and exports - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 2097152 /* SymbolFlags.Alias */, 2097152 /* SymbolFlags.AliasExcludes */); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return bindNamespaceExportDeclaration(node); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return bindImportClause(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return bindExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return bindExportAssignment(node); - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (!ts.isFunctionLikeOrClassStaticBlockDeclaration(node.parent)) { return; } // falls through - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return updateStrictModeStatementList(node.statements); - case 340 /* SyntaxKind.JSDocParameterTag */: - if (node.parent.kind === 323 /* SyntaxKind.JSDocSignature */) { + case 343 /* SyntaxKind.JSDocParameterTag */: + if (node.parent.kind === 326 /* SyntaxKind.JSDocSignature */) { return bindParameter(node); } - if (node.parent.kind !== 322 /* SyntaxKind.JSDocTypeLiteral */) { + if (node.parent.kind !== 325 /* SyntaxKind.JSDocTypeLiteral */) { break; } // falls through - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: var propTag = node; - var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */ ? + var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */ ? 4 /* SymbolFlags.Property */ | 16777216 /* SymbolFlags.Optional */ : 4 /* SymbolFlags.Property */; return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* SymbolFlags.PropertyExcludes */); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return (delayedTypeAliases || (delayedTypeAliases = [])).push(node); } } function bindPropertyWorker(node) { - return bindPropertyOrMethodOrAccessor(node, 4 /* SymbolFlags.Property */ | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), 0 /* SymbolFlags.PropertyExcludes */); + var isAutoAccessor = ts.isAutoAccessorPropertyDeclaration(node); + var includes = isAutoAccessor ? 98304 /* SymbolFlags.Accessor */ : 4 /* SymbolFlags.Property */; + var excludes = isAutoAccessor ? 13247 /* SymbolFlags.AccessorExcludes */ : 0 /* SymbolFlags.PropertyExcludes */; + return bindPropertyOrMethodOrAccessor(node, includes | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), excludes); } function bindAnonymousTypeWorker(node) { return bindAnonymousDeclaration(node, 2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */); @@ -47870,8 +48142,8 @@ var ts; } var thisContainer = ts.getThisContainer(node, /*includeArrowFunctions*/ false); switch (thisContainer.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: var constructorSymbol = thisContainer.symbol; // For `f.prototype.m = function() { this.x = 0; }`, `this.x = 0` should modify `f`'s members, not the function expression. if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { @@ -47893,12 +48165,12 @@ var ts; addDeclarationToSymbol(constructorSymbol, constructorSymbol.valueDeclaration, 32 /* SymbolFlags.Class */); } break; - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // this.foo assignment in a JavaScript class // Bind this property to the containing class var containingClass = thisContainer.parent; @@ -47910,7 +48182,7 @@ var ts; declareSymbol(symbolTable, containingClass.symbol, node, 4 /* SymbolFlags.Property */ | 67108864 /* SymbolFlags.Assignment */, 0 /* SymbolFlags.None */, /*isReplaceableByMethod*/ true); } break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // this.property = assignment in a source file -- declare symbol in exports for a module, in locals for a script if (ts.hasDynamicName(node)) { break; @@ -47939,7 +48211,7 @@ var ts; if (node.expression.kind === 108 /* SyntaxKind.ThisKeyword */) { bindThisPropertyAssignment(node); } - else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 308 /* SyntaxKind.SourceFile */) { if (ts.isPrototypeAccess(node.expression)) { bindPrototypePropertyAssignment(node, node.parent); } @@ -47979,7 +48251,7 @@ var ts; } function bindObjectDefinePropertyAssignment(node) { var namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0]); - var isToplevel = node.parent.parent.kind === 305 /* SyntaxKind.SourceFile */; + var isToplevel = node.parent.parent.kind === 308 /* SyntaxKind.SourceFile */; namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, node.arguments[0], isToplevel, /*isPrototypeProperty*/ false, /*containerIsClass*/ false); bindPotentiallyNewExpandoMemberToNamespace(node, namespaceSymbol, /*isPrototypeProperty*/ false); } @@ -48088,8 +48360,8 @@ var ts; } function isTopLevelNamespaceAssignment(propertyAccess) { return ts.isBinaryExpression(propertyAccess.parent) - ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 305 /* SyntaxKind.SourceFile */ - : propertyAccess.parent.parent.kind === 305 /* SyntaxKind.SourceFile */; + ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 308 /* SyntaxKind.SourceFile */ + : propertyAccess.parent.parent.kind === 308 /* SyntaxKind.SourceFile */; } function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty, containerIsClass) { var namespaceSymbol = lookupSymbolForPropertyAccess(name, container) || lookupSymbolForPropertyAccess(name, blockScopeContainer); @@ -48168,7 +48440,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 257 /* SyntaxKind.ClassDeclaration */) { + if (node.kind === 260 /* SyntaxKind.ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* SymbolFlags.Class */, 899503 /* SymbolFlags.ClassExcludes */); } else { @@ -48210,7 +48482,7 @@ var ts; checkStrictModeEvalOrArguments(node, node.name); } if (!ts.isBindingPattern(node.name)) { - var possibleVariableDecl = node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? node : node.parent.parent; + var possibleVariableDecl = node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? node : node.parent.parent; if (ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !ts.getJSDocTypeTag(node) && @@ -48238,7 +48510,7 @@ var ts; } } function bindParameter(node) { - if (node.kind === 340 /* SyntaxKind.JSDocParameterTag */ && container.kind !== 323 /* SyntaxKind.JSDocSignature */) { + if (node.kind === 343 /* SyntaxKind.JSDocParameterTag */ && container.kind !== 326 /* SyntaxKind.JSDocSignature */) { return; } if (inStrictMode && !(node.flags & 16777216 /* NodeFlags.Ambient */)) { @@ -48315,7 +48587,7 @@ var ts; declareSymbolAndAddToSymbolTable(node, 262144 /* SymbolFlags.TypeParameter */, 526824 /* SymbolFlags.TypeParameterExcludes */); } } - else if (node.parent.kind === 190 /* SyntaxKind.InferType */) { + else if (node.parent.kind === 192 /* SyntaxKind.InferType */) { var container_2 = getInferTypeContainer(node.parent); if (container_2) { if (!container_2.locals) { @@ -48343,11 +48615,11 @@ var ts; if (currentFlow === unreachableFlow) { var reportError = // report error on all statements except empty ones - (ts.isStatementButNotDeclaration(node) && node.kind !== 236 /* SyntaxKind.EmptyStatement */) || + (ts.isStatementButNotDeclaration(node) && node.kind !== 239 /* SyntaxKind.EmptyStatement */) || // report error on class declarations - node.kind === 257 /* SyntaxKind.ClassDeclaration */ || + node.kind === 260 /* SyntaxKind.ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)); + (node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)); if (reportError) { currentFlow = reportedUnreachableFlow; if (!options.allowUnreachableCode) { @@ -48391,12 +48663,12 @@ var ts; } function isPurelyTypeDeclaration(s) { switch (s.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return getModuleInstanceState(s) !== 1 /* ModuleInstanceState.Instantiated */; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.hasSyntacticModifier(s, 2048 /* ModifierFlags.Const */); default: return false; @@ -48597,7 +48869,7 @@ var ts; // (their type resolved directly to the member deeply referenced) // So to get the intervening symbols, we need to check if there's a type // query node on any of the symbol's declarations and get symbols there - if (d.type && d.type.kind === 181 /* SyntaxKind.TypeQuery */) { + if (d.type && d.type.kind === 183 /* SyntaxKind.TypeQuery */) { var query = d.type; var entity = getResolvedSymbol(getFirstIdentifier(query.exprName)); visitSymbol(entity); @@ -49008,6 +49280,7 @@ var ts; getTypeOfPropertyOfType: function (type, name) { return getTypeOfPropertyOfType(type, ts.escapeLeadingUnderscores(name)); }, getIndexInfoOfType: function (type, kind) { return getIndexInfoOfType(type, kind === 0 /* IndexKind.String */ ? stringType : numberType); }, getIndexInfosOfType: getIndexInfosOfType, + getIndexInfosOfIndexSymbol: getIndexInfosOfIndexSymbol, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: function (type, kind) { return getIndexTypeOfType(type, kind === 0 /* IndexKind.String */ ? stringType : numberType); }, getIndexType: function (type) { return getIndexType(type); }, @@ -49033,6 +49306,7 @@ var ts; signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration, symbolToEntityName: nodeBuilder.symbolToEntityName, symbolToExpression: nodeBuilder.symbolToExpression, + symbolToNode: nodeBuilder.symbolToNode, symbolToTypeParameterDeclarations: nodeBuilder.symbolToTypeParameterDeclarations, symbolToParameterDeclaration: nodeBuilder.symbolToParameterDeclaration, typeParameterToDeclaration: nodeBuilder.typeParameterToDeclaration, @@ -49281,6 +49555,7 @@ var ts; isPropertyAccessible: isPropertyAccessible, getTypeOnlyAliasDeclaration: getTypeOnlyAliasDeclaration, getMemberOverrideModifierStatus: getMemberOverrideModifierStatus, + isTypeParameterPossiblyReferenced: isTypeParameterPossiblyReferenced, }; function runWithInferenceBlockedFromSourceNode(node, fn) { var containingCall = ts.findAncestor(node, ts.isCallLikeExpression); @@ -49338,6 +49613,7 @@ var ts; var wildcardType = createIntrinsicType(1 /* TypeFlags.Any */, "any"); var errorType = createIntrinsicType(1 /* TypeFlags.Any */, "error"); var unresolvedType = createIntrinsicType(1 /* TypeFlags.Any */, "unresolved"); + var nonInferrableAnyType = createIntrinsicType(1 /* TypeFlags.Any */, "any", 65536 /* ObjectFlags.ContainsWideningType */); var intrinsicMarkerType = createIntrinsicType(1 /* TypeFlags.Any */, "intrinsic"); var unknownType = createIntrinsicType(2 /* TypeFlags.Unknown */, "unknown"); var nonNullUnknownType = createIntrinsicType(2 /* TypeFlags.Unknown */, "unknown"); @@ -49399,7 +49675,8 @@ var ts; var emptyTypeLiteralSymbol = createSymbol(2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */); emptyTypeLiteralSymbol.members = ts.createSymbolTable(); var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); - var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType; + var unknownEmptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); + var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType; var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); emptyGenericType.instantiations = new ts.Map(); var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); @@ -49513,6 +49790,8 @@ var ts; var deferredGlobalOmitSymbol; var deferredGlobalAwaitedSymbol; var deferredGlobalBigIntType; + var deferredGlobalNaNSymbol; + var deferredGlobalRecordSymbol; var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name var flowLoopStart = 0; var flowLoopCount = 0; @@ -49702,10 +49981,10 @@ var ts; } // Issue errors globally var file = ts.getSourceFileOfNode(location); - addErrorOrSuggestion(isError, "message" in message ? ts.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForFileFromMessageChain(file, message)); // eslint-disable-line no-in-operator + addErrorOrSuggestion(isError, "message" in message ? ts.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForFileFromMessageChain(file, message)); // eslint-disable-line local/no-in-operator return; } - addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line no-in-operator + addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line local/no-in-operator } function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, arg0, arg1, arg2, arg3) { var diagnostic = error(location, message, arg0, arg1, arg2, arg3); @@ -49934,7 +50213,7 @@ var ts; if (unidirectional === void 0) { unidirectional = false; } source.forEach(function (sourceSymbol, id) { var targetSymbol = target.get(id); - target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol); + target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol)); }); } function mergeModuleAugmentation(moduleName) { @@ -50022,7 +50301,7 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = new NodeLinks()); } function isGlobalSourceFile(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -50081,17 +50360,17 @@ var ts; } if (declaration.pos <= usage.pos && !(ts.isPropertyDeclaration(declaration) && ts.isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) { // declaration is before usage - if (declaration.kind === 203 /* SyntaxKind.BindingElement */) { + if (declaration.kind === 205 /* SyntaxKind.BindingElement */) { // still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2]) - var errorBindingElement = ts.getAncestor(usage, 203 /* SyntaxKind.BindingElement */); + var errorBindingElement = ts.getAncestor(usage, 205 /* SyntaxKind.BindingElement */); if (errorBindingElement) { return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) || declaration.pos < errorBindingElement.pos; } // or it might be illegal if usage happens before parent variable is declared (eg var [a] = a) - return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 254 /* SyntaxKind.VariableDeclaration */), usage); + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 257 /* SyntaxKind.VariableDeclaration */), usage); } - else if (declaration.kind === 254 /* SyntaxKind.VariableDeclaration */) { + else if (declaration.kind === 257 /* SyntaxKind.VariableDeclaration */) { // still might be illegal if usage is in the initializer of the variable declaration (eg var a = a) return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } @@ -50121,12 +50400,12 @@ var ts; // or if usage is in a type context: // 1. inside a type query (typeof in type position) // 2. inside a jsdoc comment - if (usage.parent.kind === 275 /* SyntaxKind.ExportSpecifier */ || (usage.parent.kind === 271 /* SyntaxKind.ExportAssignment */ && usage.parent.isExportEquals)) { + if (usage.parent.kind === 278 /* SyntaxKind.ExportSpecifier */ || (usage.parent.kind === 274 /* SyntaxKind.ExportAssignment */ && usage.parent.isExportEquals)) { // export specifiers do not use the variable, they only make it available for use return true; } // When resolving symbols for exports, the `usage` location passed in can be the export site directly - if (usage.kind === 271 /* SyntaxKind.ExportAssignment */ && usage.isExportEquals) { + if (usage.kind === 274 /* SyntaxKind.ExportAssignment */ && usage.isExportEquals) { return true; } if (!!(usage.flags & 8388608 /* NodeFlags.JSDoc */) || isInTypeQuery(usage) || usageInTypeDeclaration()) { @@ -50148,9 +50427,9 @@ var ts; } function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { switch (declaration.parent.parent.kind) { - case 237 /* SyntaxKind.VariableStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 240 /* SyntaxKind.VariableStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: // variable statement/for/for-of statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) if (isSameScopeDescendentOf(usage, declaration, declContainer)) { @@ -50178,7 +50457,7 @@ var ts; var initializerOfProperty = propertyDeclaration.initializer === current; if (initializerOfProperty) { if (ts.isStatic(current.parent)) { - if (declaration.kind === 169 /* SyntaxKind.MethodDeclaration */) { + if (declaration.kind === 171 /* SyntaxKind.MethodDeclaration */) { return true; } if (ts.isPropertyDeclaration(declaration) && ts.getContainingClass(usage) === ts.getContainingClass(declaration)) { @@ -50193,7 +50472,7 @@ var ts; } } else { - var isDeclarationInstanceProperty = declaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(declaration); + var isDeclarationInstanceProperty = declaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(declaration); if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) { return true; } @@ -50216,19 +50495,19 @@ var ts; return "quit"; } switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return true; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // even when stopping at any property declaration, they need to come from the same class return stopAtAnyPropertyDeclaration && (ts.isPropertyDeclaration(declaration) && node.parent === declaration.parent || ts.isParameterPropertyDeclaration(declaration, declaration.parent) && node.parent === declaration.parent.parent) ? "quit" : true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: switch (node.parent.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 175 /* SyntaxKind.SetAccessor */: return true; default: return false; @@ -50268,18 +50547,18 @@ var ts; } function requiresScopeChangeWorker(node) { switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: // do not descend into these return false; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 299 /* SyntaxKind.PropertyAssignment */: return requiresScopeChangeWorker(node.name); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // static properties in classes introduce temporary variables if (ts.hasStaticModifier(node)) { return target < 99 /* ScriptTarget.ESNext */ || !useDefineForClassFields; @@ -50308,12 +50587,13 @@ var ts; * the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with * the given name can be found. * + * @param nameNotFoundMessage If defined, we will report errors found during resolve. * @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters. */ - function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions) { + function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions) { if (excludeGlobals === void 0) { excludeGlobals = false; } - if (getSpellingSuggstions === void 0) { getSpellingSuggstions = true; } - return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions, getSymbol); + if (getSpellingSuggestions === void 0) { getSpellingSuggestions = true; } + return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol); } function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) { var _a, _b, _c; @@ -50344,14 +50624,14 @@ var ts; // - parameters are only in the scope of function body // This restriction does not apply to JSDoc comment types because they are parented // at a higher level than type parameters would normally be - if (meaning & result.flags & 788968 /* SymbolFlags.Type */ && lastLocation.kind !== 320 /* SyntaxKind.JSDoc */) { + if (meaning & result.flags & 788968 /* SymbolFlags.Type */ && lastLocation.kind !== 323 /* SyntaxKind.JSDoc */) { useResult = result.flags & 262144 /* SymbolFlags.TypeParameter */ // type parameters are visible in parameter list, return type and type parameter list ? lastLocation === location.type || - lastLocation.kind === 164 /* SyntaxKind.Parameter */ || - lastLocation.kind === 340 /* SyntaxKind.JSDocParameterTag */ || - lastLocation.kind === 341 /* SyntaxKind.JSDocReturnTag */ || - lastLocation.kind === 163 /* SyntaxKind.TypeParameter */ + lastLocation.kind === 166 /* SyntaxKind.Parameter */ || + lastLocation.kind === 343 /* SyntaxKind.JSDocParameterTag */ || + lastLocation.kind === 344 /* SyntaxKind.JSDocReturnTag */ || + lastLocation.kind === 165 /* SyntaxKind.TypeParameter */ // local types not visible outside the function body : false; } @@ -50366,13 +50646,13 @@ var ts; // however it is detected separately when checking initializers of parameters // to make sure that they reference no variables declared after them. useResult = - lastLocation.kind === 164 /* SyntaxKind.Parameter */ || + lastLocation.kind === 166 /* SyntaxKind.Parameter */ || (lastLocation === location.type && !!ts.findAncestor(result.valueDeclaration, ts.isParameter)); } } } - else if (location.kind === 189 /* SyntaxKind.ConditionalType */) { + else if (location.kind === 191 /* SyntaxKind.ConditionalType */) { // A type parameter declared using 'infer T' in a conditional type is visible only in // the true branch of the conditional type. useResult = lastLocation === location.trueType; @@ -50387,14 +50667,14 @@ var ts; } withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation); switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var moduleExports = ((_a = getSymbolOfNode(location)) === null || _a === void 0 ? void 0 : _a.exports) || emptySymbols; - if (location.kind === 305 /* SyntaxKind.SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 16777216 /* NodeFlags.Ambient */ && !ts.isGlobalScopeAugmentation(location))) { + if (location.kind === 308 /* SyntaxKind.SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 16777216 /* NodeFlags.Ambient */ && !ts.isGlobalScopeAugmentation(location))) { // It's an external module. First see if the module has an export default and if the local // name of that export default matches. if (result = moduleExports.get("default" /* InternalSymbolName.Default */)) { @@ -50418,7 +50698,7 @@ var ts; var moduleExport = moduleExports.get(name); if (moduleExport && moduleExport.flags === 2097152 /* SymbolFlags.Alias */ && - (ts.getDeclarationOfKind(moduleExport, 275 /* SyntaxKind.ExportSpecifier */) || ts.getDeclarationOfKind(moduleExport, 274 /* SyntaxKind.NamespaceExport */))) { + (ts.getDeclarationOfKind(moduleExport, 278 /* SyntaxKind.ExportSpecifier */) || ts.getDeclarationOfKind(moduleExport, 277 /* SyntaxKind.NamespaceExport */))) { break; } } @@ -50432,12 +50712,12 @@ var ts; } } break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (result = lookup(((_c = getSymbolOfNode(location)) === null || _c === void 0 ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* SymbolFlags.EnumMember */)) { break loop; } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // TypeScript 1.0 spec (April 2014): 8.4.1 // Initializer expressions for instance member variables are evaluated in the scope // of the class constructor body but are not permitted to reference parameters or @@ -50455,9 +50735,9 @@ var ts; } } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // The below is used to lookup type parameters within a class or interface, as they are added to the class/interface locals // These can never be latebound, so the symbol's raw members are sufficient. `getMembersOfNode` cannot be used, as it would // trigger resolving late-bound names, which we may already be in the process of doing while we're here! @@ -50471,12 +50751,14 @@ var ts; // TypeScript 1.0 spec (April 2014): 3.4.1 // The scope of a type parameter extends over the entire declaration with which the type // parameter list is associated, with the exception of static member declarations in classes. - error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + if (nameNotFoundMessage) { + error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + } return undefined; } break loop; } - if (location.kind === 226 /* SyntaxKind.ClassExpression */ && meaning & 32 /* SymbolFlags.Class */) { + if (location.kind === 228 /* SyntaxKind.ClassExpression */ && meaning & 32 /* SymbolFlags.Class */) { var className = location.name; if (className && name === className.escapedText) { result = location.symbol; @@ -50484,7 +50766,7 @@ var ts; } } break; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // The type parameters of a class are not in scope in the base class expression. if (lastLocation === location.expression && location.parent.token === 94 /* SyntaxKind.ExtendsKeyword */) { var container = location.parent.parent; @@ -50504,34 +50786,36 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968 /* SymbolFlags.Type */)) { - error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + if (nameNotFoundMessage) { + error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + } return undefined; } } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // when targeting ES6 or higher there is no 'arguments' in an arrow function // for lower compile targets the resolved symbol is used to emit an error if (ts.getEmitScriptTarget(compilerOptions) >= 2 /* ScriptTarget.ES2015 */) { break; } // falls through - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (meaning & 3 /* SymbolFlags.Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (meaning & 3 /* SymbolFlags.Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -50544,7 +50828,7 @@ var ts; } } break; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -50553,7 +50837,7 @@ var ts; // method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter. // } // - if (location.parent && location.parent.kind === 164 /* SyntaxKind.Parameter */) { + if (location.parent && location.parent.kind === 166 /* SyntaxKind.Parameter */) { location = location.parent; } // @@ -50568,20 +50852,20 @@ var ts; // declare function y(x: T): any; // @param(1 as T) // <-- T should resolve to the type alias outside of class C // class C {} - if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 257 /* SyntaxKind.ClassDeclaration */)) { + if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 260 /* SyntaxKind.ClassDeclaration */)) { location = location.parent; } break; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: // js type aliases do not resolve names from their host, so skip past it var root = ts.getJSDocRoot(location); if (root) { location = root.parent; } break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts.isBindingPattern(lastLocation))) { if (!associatedDeclarationForContainingInitializerOrBindingName) { @@ -50589,7 +50873,7 @@ var ts; } } break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts.isBindingPattern(lastLocation))) { if (ts.isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) { @@ -50597,7 +50881,7 @@ var ts; } } break; - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: if (meaning & 262144 /* SymbolFlags.TypeParameter */) { var parameterName = location.typeParameter.name; if (parameterName && name === parameterName.escapedText) { @@ -50623,7 +50907,7 @@ var ts; } if (!result) { if (lastLocation) { - ts.Debug.assert(lastLocation.kind === 305 /* SyntaxKind.SourceFile */); + ts.Debug.assert(lastLocation.kind === 308 /* SyntaxKind.SourceFile */); if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) { return lastLocation.symbol; } @@ -50705,7 +50989,7 @@ var ts; } return undefined; } - else if (checkAndReportErrorForInvalidInitializer()) { + else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) { return undefined; } // Perform extra checks only if error reporting was requested @@ -50753,7 +51037,7 @@ var ts; if (result && errorLocation && meaning & 111551 /* SymbolFlags.Value */ && result.flags & 2097152 /* SymbolFlags.Alias */ && !(result.flags & 111551 /* SymbolFlags.Value */) && !ts.isValidTypeOnlyAliasUseSite(errorLocation)) { var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result); if (typeOnlyDeclaration) { - var message = typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */ + var message = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type; var unescapedName = ts.unescapeLeadingUnderscores(name); @@ -50767,31 +51051,31 @@ var ts; function addTypeOnlyDeclarationRelatedInfo(diagnostic, typeOnlyDeclaration, unescapedName) { if (!typeOnlyDeclaration) return diagnostic; - return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName)); + return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName)); } function getIsDeferredContext(location, lastLocation) { - if (location.kind !== 214 /* SyntaxKind.ArrowFunction */ && location.kind !== 213 /* SyntaxKind.FunctionExpression */) { + if (location.kind !== 216 /* SyntaxKind.ArrowFunction */ && location.kind !== 215 /* SyntaxKind.FunctionExpression */) { // initializers in instance property declaration of class like entities are executed in constructor and thus deferred return ts.isTypeQueryNode(location) || ((ts.isFunctionLikeDeclaration(location) || - (location.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred + (location.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred } if (lastLocation && lastLocation === location.name) { return false; } // generator functions and async functions are not inlined in control flow when immediately invoked - if (location.asteriskToken || ts.hasSyntacticModifier(location, 256 /* ModifierFlags.Async */)) { + if (location.asteriskToken || ts.hasSyntacticModifier(location, 512 /* ModifierFlags.Async */)) { return true; } return !ts.getImmediatelyInvokedFunctionExpression(location); } function isSelfReferenceLocation(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: // For `namespace N { N; }` + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // For `namespace N { N; }` return true; default: return false; @@ -50804,7 +51088,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - if (decl.kind === 163 /* SyntaxKind.TypeParameter */) { + if (decl.kind === 165 /* SyntaxKind.TypeParameter */) { var parent = ts.isJSDocTemplateTag(decl.parent) ? ts.getJSDocHost(decl.parent) : decl.parent; if (parent === container) { return !(ts.isJSDocTemplateTag(decl.parent) && ts.find(decl.parent.parent.tags, ts.isJSDocTypeAlias)); @@ -50861,9 +51145,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: if (ts.isEntityNameExpression(node.expression)) { return node.expression; } @@ -50907,7 +51191,7 @@ var ts; return name === "any" || name === "string" || name === "number" || name === "boolean" || name === "never" || name === "unknown"; } function checkAndReportErrorForExportingPrimitiveType(errorLocation, name) { - if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) { + if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) { error(errorLocation, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, name); return true; } @@ -50998,7 +51282,7 @@ var ts; return; } // Block-scoped variables cannot be used before their definition - var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 260 /* SyntaxKind.EnumDeclaration */); }); + var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 263 /* SyntaxKind.EnumDeclaration */); }); if (declaration === undefined) return ts.Debug.fail("checkResolvedBlockScopedVariable could not find block-scoped declaration"); if (!(declaration.flags & 16777216 /* NodeFlags.Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { @@ -51035,13 +51319,13 @@ var ts; } function getAnyImportSyntax(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return node.parent; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent; default: return undefined; @@ -51066,24 +51350,24 @@ var ts; * const { x } = require ... */ function isAliasSymbolDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || node.kind === 267 /* SyntaxKind.ImportClause */ && !!node.name - || node.kind === 268 /* SyntaxKind.NamespaceImport */ - || node.kind === 274 /* SyntaxKind.NamespaceExport */ - || node.kind === 270 /* SyntaxKind.ImportSpecifier */ - || node.kind === 275 /* SyntaxKind.ExportSpecifier */ - || node.kind === 271 /* SyntaxKind.ExportAssignment */ && ts.exportAssignmentIsAlias(node) + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || node.kind === 270 /* SyntaxKind.ImportClause */ && !!node.name + || node.kind === 271 /* SyntaxKind.NamespaceImport */ + || node.kind === 277 /* SyntaxKind.NamespaceExport */ + || node.kind === 273 /* SyntaxKind.ImportSpecifier */ + || node.kind === 278 /* SyntaxKind.ExportSpecifier */ + || node.kind === 274 /* SyntaxKind.ExportAssignment */ && ts.exportAssignmentIsAlias(node) || ts.isBinaryExpression(node) && ts.getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */ && ts.exportAssignmentIsAlias(node) || ts.isAccessExpression(node) && ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && isAliasableOrJsExpression(node.parent.right) - || node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || node.kind === 296 /* SyntaxKind.PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) - || node.kind === 254 /* SyntaxKind.VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) - || node.kind === 203 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); + || node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || node.kind === 299 /* SyntaxKind.PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) + || node.kind === 257 /* SyntaxKind.VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) + || node.kind === 205 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); } function isAliasableOrJsExpression(e) { return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e); @@ -51096,7 +51380,7 @@ var ts; ? resolveSymbol(getPropertyOfType(resolveExternalModuleTypeByLiteral(name), commonJSPropertyAccess.name.escapedText)) : undefined; } - if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { var immediate = resolveExternalModuleName(node, ts.getExternalModuleRequireArgument(node) || ts.getExternalModuleImportEqualsDeclarationExpression(node)); var resolved_4 = resolveExternalModuleSymbol(immediate); markSymbolOfAliasDeclarationIfTypeOnly(node, immediate, resolved_4, /*overwriteEmpty*/ false); @@ -51109,7 +51393,7 @@ var ts; function checkAndReportErrorForResolvingImportAliasToTypeOnlySymbol(node, resolved) { if (markSymbolOfAliasDeclarationIfTypeOnly(node, /*immediateTarget*/ undefined, resolved, /*overwriteEmpty*/ false) && !node.isTypeOnly) { var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(getSymbolOfNode(node)); - var isExport = typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */; + var isExport = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */; var message = isExport ? ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type : ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type; @@ -51128,7 +51412,7 @@ var ts; return resolved; } function isSyntacticDefault(node) { - return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) || ts.isExportSpecifier(node)); + return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) || ts.isExportSpecifier(node)); } function getUsageModeForExpression(usage) { return ts.isStringLiteralLike(usage) ? ts.getModeForUsageLocation(ts.getSourceFileOfNode(usage), usage) : undefined; @@ -51228,11 +51512,11 @@ var ts; } function getModuleSpecifierForImportOrExport(node) { switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; - case 268 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier; - case 270 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier; - case 275 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier; + case 270 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier; + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier; + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier; + case 278 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier; default: return ts.Debug.assertNever(node); } } @@ -51501,31 +51785,31 @@ var ts; function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { if (dontRecursivelyResolve === void 0) { dontRecursivelyResolve = false; } switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return getTargetOfImportClause(node, dontRecursivelyResolve); - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return getTargetOfNamespaceImport(node, dontRecursivelyResolve); - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: return getTargetOfNamespaceExport(node, dontRecursivelyResolve); - case 270 /* SyntaxKind.ImportSpecifier */: - case 203 /* SyntaxKind.BindingElement */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 205 /* SyntaxKind.BindingElement */: return getTargetOfImportSpecifier(node, dontRecursivelyResolve); - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return getTargetOfExportSpecifier(node, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, dontRecursivelyResolve); - case 271 /* SyntaxKind.ExportAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: + case 274 /* SyntaxKind.ExportAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: return getTargetOfExportAssignment(node, dontRecursivelyResolve); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return resolveEntityName(node.name, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ true, dontRecursivelyResolve); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getTargetOfAliasLikeExpression(node.initializer, dontRecursivelyResolve); - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return getTargetOfAccessExpression(node, dontRecursivelyResolve); default: return ts.Debug.fail(); @@ -51677,18 +51961,18 @@ var ts; entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 79 /* SyntaxKind.Identifier */ || entityName.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + if (entityName.kind === 79 /* SyntaxKind.Identifier */ || entityName.parent.kind === 163 /* SyntaxKind.QualifiedName */) { return resolveEntityName(entityName, 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */); return resolveEntityName(entityName, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } } function getFullyQualifiedName(symbol, containingLocation) { - return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, /*meaning*/ undefined, 16 /* SymbolFormatFlags.DoNotIncludeSymbolChain */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, /*meaning*/ undefined, 32 /* SymbolFormatFlags.DoNotIncludeSymbolChain */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); } function getContainingQualifiedNameNode(node) { while (ts.isQualifiedName(node.parent)) { @@ -51729,9 +52013,9 @@ var ts; return getMergedSymbol(symbolFromJSPrototype); } } - else if (name.kind === 161 /* SyntaxKind.QualifiedName */ || name.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { - var left = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.left : name.expression; - var right = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.right : name.name; + else if (name.kind === 163 /* SyntaxKind.QualifiedName */ || name.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { + var left = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.left : name.expression; + var right = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, namespaceMeaning, ignoreErrors, /*dontResolveAlias*/ false, location); if (!namespace || ts.nodeIsMissing(right)) { return undefined; @@ -51789,7 +52073,7 @@ var ts; throw ts.Debug.assertNever(name, "Unknown entity name kind."); } ts.Debug.assert((ts.getCheckFlags(symbol) & 1 /* CheckFlags.Instantiated */) === 0, "Should never get an instantiated symbol here."); - if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 /* SymbolFlags.Alias */ || name.parent.kind === 271 /* SyntaxKind.ExportAssignment */)) { + if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 /* SymbolFlags.Alias */ || name.parent.kind === 274 /* SyntaxKind.ExportAssignment */)) { markSymbolOfAliasDeclarationIfTypeOnly(ts.getAliasDeclarationFromName(name), symbol, /*finalTarget*/ undefined, /*overwriteEmpty*/ true); } return (symbol.flags & meaning) || dontResolveAlias ? symbol : resolveAlias(symbol); @@ -51939,7 +52223,7 @@ var ts; if (ext === ".ts" /* Extension.Ts */ || ext === ".js" /* Extension.Js */ || ext === ".tsx" /* Extension.Tsx */ || ext === ".jsx" /* Extension.Jsx */) { var scope = currentSourceFile.packageJsonScope; var targetExt = ext === ".ts" /* Extension.Ts */ ? ".mts" /* Extension.Mts */ : ext === ".js" /* Extension.Js */ ? ".mjs" /* Extension.Mjs */ : undefined; - if (scope && !scope.packageJsonContent.type) { + if (scope && !scope.contents.packageJsonContent.type) { if (targetExt) { diagnosticDetails = ts.chainDiagnosticMessages( /*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1, targetExt, ts.combinePaths(scope.packageDirectory, "package.json")); @@ -52112,7 +52396,7 @@ var ts; var _a; var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); if (!dontResolveAlias && symbol) { - if (!suppressInteropError && !(symbol.flags & (1536 /* SymbolFlags.Module */ | 3 /* SymbolFlags.Variable */)) && !ts.getDeclarationOfKind(symbol, 305 /* SyntaxKind.SourceFile */)) { + if (!suppressInteropError && !(symbol.flags & (1536 /* SymbolFlags.Module */ | 3 /* SymbolFlags.Variable */)) && !ts.getDeclarationOfKind(symbol, 308 /* SyntaxKind.SourceFile */)) { var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop"; @@ -52478,7 +52762,7 @@ var ts; var members = node.members; for (var _i = 0, members_3 = members; _i < members_3.length; _i++) { var member = members_3[_i]; - if (member.kind === 171 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 173 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } @@ -52586,12 +52870,12 @@ var ts; } } switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var sym = getSymbolOfNode(location); // `sym` may not have exports if this module declaration is backed by the symbol for a `const` that's being rewritten // into a namespace - in such cases, it's best to just let the namespace appear empty (the const members couldn't have referred @@ -52600,9 +52884,9 @@ var ts; return { value: result }; } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // Type parameters are bound into `members` lists so they can merge across declarations // This is troublesome, since in all other respects, they behave like locals :cries: // TODO: the below is shared with similar code in `resolveName` - in fact, rephrasing all this symbol @@ -52697,7 +52981,7 @@ var ts; && (isLocalNameLookup ? !ts.some(symbolFromSymbolTable.declarations, ts.isNamespaceReexportDeclaration) : true) // While exports are generally considered to be in scope, export-specifier declared symbols are _not_ // See similar comment in `resolveName` for details - && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 275 /* SyntaxKind.ExportSpecifier */))) { + && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */))) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); var candidate = getCandidateListForSymbol(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification); if (candidate) { @@ -52741,7 +53025,7 @@ var ts; return true; } // Qualify if the symbol from symbol table has same meaning as expected - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 275 /* SyntaxKind.ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -52756,10 +53040,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: continue; default: return false; @@ -52889,10 +53173,10 @@ var ts; return node && getSymbolOfNode(node); } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasNonGlobalAugmentationExternalModuleSymbol(declaration) { - return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -52960,14 +53244,14 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 181 /* SyntaxKind.TypeQuery */ || - entityName.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) || - entityName.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (entityName.parent.kind === 183 /* SyntaxKind.TypeQuery */ || + entityName.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) || + entityName.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // Typeof value meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } - else if (entityName.kind === 161 /* SyntaxKind.QualifiedName */ || entityName.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - entityName.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + else if (entityName.kind === 163 /* SyntaxKind.QualifiedName */ || entityName.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + entityName.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1920 /* SymbolFlags.Namespace */; @@ -53003,15 +53287,18 @@ var ts; if (flags & 8 /* SymbolFormatFlags.UseAliasDefinedOutsideCurrentScope */) { nodeFlags |= 16384 /* NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope */; } - if (flags & 16 /* SymbolFormatFlags.DoNotIncludeSymbolChain */) { + if (flags & 32 /* SymbolFormatFlags.DoNotIncludeSymbolChain */) { nodeFlags |= 134217728 /* NodeBuilderFlags.DoNotIncludeSymbolChain */; } - var builder = flags & 4 /* SymbolFormatFlags.AllowAnyNodeKind */ ? nodeBuilder.symbolToExpression : nodeBuilder.symbolToEntityName; + if (flags & 16 /* SymbolFormatFlags.WriteComputedProps */) { + nodeFlags |= 1073741824 /* NodeBuilderFlags.WriteComputedProps */; + } + var builder = flags & 4 /* SymbolFormatFlags.AllowAnyNodeKind */ ? nodeBuilder.symbolToNode : nodeBuilder.symbolToEntityName; return writer ? symbolToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(symbolToStringWorker); function symbolToStringWorker(writer) { var entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags); // TODO: GH#18217 // add neverAsciiEscape for GH#39027 - var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 305 /* SyntaxKind.SourceFile */ ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true }); + var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 308 /* SyntaxKind.SourceFile */ ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true }); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); printer.writeNode(4 /* EmitHint.Unspecified */, entity, /*sourceFile*/ sourceFile, writer); return writer; @@ -53023,10 +53310,10 @@ var ts; function signatureToStringWorker(writer) { var sigOutput; if (flags & 262144 /* TypeFormatFlags.WriteArrowStyleSignature */) { - sigOutput = kind === 1 /* SignatureKind.Construct */ ? 180 /* SyntaxKind.ConstructorType */ : 179 /* SyntaxKind.FunctionType */; + sigOutput = kind === 1 /* SignatureKind.Construct */ ? 182 /* SyntaxKind.ConstructorType */ : 181 /* SyntaxKind.FunctionType */; } else { - sigOutput = kind === 1 /* SignatureKind.Construct */ ? 175 /* SyntaxKind.ConstructSignature */ : 174 /* SyntaxKind.CallSignature */; + sigOutput = kind === 1 /* SignatureKind.Construct */ ? 177 /* SyntaxKind.ConstructSignature */ : 176 /* SyntaxKind.CallSignature */; } var sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */); var printer = ts.createPrinter({ removeComments: true, omitTrailingSemicolon: true }); @@ -53106,7 +53393,25 @@ var ts; symbolTableToDeclarationStatements: function (symbolTable, enclosingDeclaration, flags, tracker, bundled) { return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolTableToDeclarationStatements(symbolTable, context, bundled); }); }, + symbolToNode: function (symbol, meaning, enclosingDeclaration, flags, tracker) { + return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolToNode(symbol, context, meaning); }); + }, }; + function symbolToNode(symbol, context, meaning) { + if (context.flags & 1073741824 /* NodeBuilderFlags.WriteComputedProps */) { + if (symbol.valueDeclaration) { + var name = ts.getNameOfDeclaration(symbol.valueDeclaration); + if (name && ts.isComputedPropertyName(name)) + return name; + } + var nameType = getSymbolLinks(symbol).nameType; + if (nameType && nameType.flags & (1024 /* TypeFlags.EnumLiteral */ | 8192 /* TypeFlags.UniqueESSymbol */)) { + context.enclosingDeclaration = nameType.symbol.valueDeclaration; + return ts.factory.createComputedPropertyName(symbolToExpression(nameType.symbol, context, meaning)); + } + } + return symbolToExpression(symbol, context, meaning); + } function withContext(enclosingDeclaration, flags, tracker, cb) { var _a, _b; ts.Debug.assert(enclosingDeclaration === undefined || (enclosingDeclaration.flags & 8 /* NodeFlags.Synthesized */) === 0); @@ -53191,7 +53496,7 @@ var ts; return undefined; // TODO: GH#18217 } context.approximateLength += 3; - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } if (!(context.flags & 536870912 /* NodeBuilderFlags.NoTypeReduction */)) { type = getReducedType(type); @@ -53201,29 +53506,29 @@ var ts; return ts.factory.createTypeReferenceNode(symbolToEntityNameNode(type.aliasSymbol), mapToTypeNodes(type.aliasTypeArguments, context)); } if (type === unresolvedType) { - return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */), 3 /* SyntaxKind.MultiLineCommentTrivia */, "unresolved"); + return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */), 3 /* SyntaxKind.MultiLineCommentTrivia */, "unresolved"); } context.approximateLength += 3; - return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 138 /* SyntaxKind.IntrinsicKeyword */ : 130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 139 /* SyntaxKind.IntrinsicKeyword */ : 131 /* SyntaxKind.AnyKeyword */); } if (type.flags & 2 /* TypeFlags.Unknown */) { - return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */); + return ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */); } if (type.flags & 4 /* TypeFlags.String */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(150 /* SyntaxKind.StringKeyword */); + return ts.factory.createKeywordTypeNode(152 /* SyntaxKind.StringKeyword */); } if (type.flags & 8 /* TypeFlags.Number */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(147 /* SyntaxKind.NumberKeyword */); + return ts.factory.createKeywordTypeNode(148 /* SyntaxKind.NumberKeyword */); } if (type.flags & 64 /* TypeFlags.BigInt */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(158 /* SyntaxKind.BigIntKeyword */); + return ts.factory.createKeywordTypeNode(160 /* SyntaxKind.BigIntKeyword */); } if (type.flags & 16 /* TypeFlags.Boolean */ && !type.aliasSymbol) { context.approximateLength += 7; - return ts.factory.createKeywordTypeNode(133 /* SyntaxKind.BooleanKeyword */); + return ts.factory.createKeywordTypeNode(134 /* SyntaxKind.BooleanKeyword */); } if (type.flags & 1024 /* TypeFlags.EnumLiteral */ && !(type.flags & 1048576 /* TypeFlags.Union */)) { var parentSymbol = getParentOfSymbol(type.symbol); @@ -53277,7 +53582,7 @@ var ts; } } context.approximateLength += 13; - return ts.factory.createTypeOperatorNode(154 /* SyntaxKind.UniqueKeyword */, ts.factory.createKeywordTypeNode(151 /* SyntaxKind.SymbolKeyword */)); + return ts.factory.createTypeOperatorNode(156 /* SyntaxKind.UniqueKeyword */, ts.factory.createKeywordTypeNode(153 /* SyntaxKind.SymbolKeyword */)); } if (type.flags & 16384 /* TypeFlags.Void */) { context.approximateLength += 4; @@ -53285,7 +53590,7 @@ var ts; } if (type.flags & 32768 /* TypeFlags.Undefined */) { context.approximateLength += 9; - return ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */); + return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */); } if (type.flags & 65536 /* TypeFlags.Null */) { context.approximateLength += 4; @@ -53293,15 +53598,15 @@ var ts; } if (type.flags & 131072 /* TypeFlags.Never */) { context.approximateLength += 5; - return ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */); + return ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */); } if (type.flags & 4096 /* TypeFlags.ESSymbol */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(151 /* SyntaxKind.SymbolKeyword */); + return ts.factory.createKeywordTypeNode(153 /* SyntaxKind.SymbolKeyword */); } if (type.flags & 67108864 /* TypeFlags.NonPrimitive */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(148 /* SyntaxKind.ObjectKeyword */); + return ts.factory.createKeywordTypeNode(149 /* SyntaxKind.ObjectKeyword */); } if (ts.isThisTypeParameter(type)) { if (context.flags & 4194304 /* NodeBuilderFlags.InObjectTypeLiteral */) { @@ -53390,7 +53695,7 @@ var ts; var indexedType = type.type; context.approximateLength += 6; var indexTypeNode = typeToTypeNodeHelper(indexedType, context); - return ts.factory.createTypeOperatorNode(140 /* SyntaxKind.KeyOfKeyword */, indexTypeNode); + return ts.factory.createTypeOperatorNode(141 /* SyntaxKind.KeyOfKeyword */, indexTypeNode); } if (type.flags & 134217728 /* TypeFlags.TemplateLiteral */) { var texts_1 = type.texts; @@ -53442,7 +53747,7 @@ var ts; // On the other hand, // checkType extends infer T extends checkType ? T extends extendsType ? trueType : falseType : never; // may also work with `infer ... extends ...` in, but would produce declarations only compatible with the latest TS. - return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)), ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)); + return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)), ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)); } var saveInferTypeParameters = context.inferTypeParameters; context.inferTypeParameters = type.root.inferTypeParameters; @@ -53484,7 +53789,7 @@ var ts; var name = typeParameterToName(newParam, context); newTypeVariable = ts.factory.createTypeReferenceNode(name); } - appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(140 /* SyntaxKind.KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)); + appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(141 /* SyntaxKind.KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)); } else { appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type), context); @@ -53500,7 +53805,7 @@ var ts; // wrap it with a conditional like `SomeModifiersType extends infer U ? {..the mapped type...} : never` to ensure the resulting // type stays homomorphic var originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode(type.declaration.typeParameter.constraint.type)) || unknownType, type.mapper); - return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 /* TypeFlags.Unknown */ ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)); + return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 /* TypeFlags.Unknown */ ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)); } return result; } @@ -53548,7 +53853,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* SymbolFlags.Function */) && (symbol.parent || // is exported function symbol ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 305 /* SyntaxKind.SourceFile */ || declaration.parent.kind === 262 /* SyntaxKind.ModuleBlock */; + return declaration.parent.kind === 308 /* SyntaxKind.SourceFile */ || declaration.parent.kind === 265 /* SyntaxKind.ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -53637,12 +53942,12 @@ var ts; } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { var signature = resolved.callSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 179 /* SyntaxKind.FunctionType */, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 181 /* SyntaxKind.FunctionType */, context); return signatureNode; } if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { var signature = resolved.constructSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 180 /* SyntaxKind.ConstructorType */, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 182 /* SyntaxKind.ConstructorType */, context); return signatureNode; } } @@ -53685,7 +53990,7 @@ var ts; } var elementType = typeToTypeNodeHelper(typeArguments[0], context); var arrayType = ts.factory.createArrayTypeNode(elementType); - return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, arrayType); + return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, arrayType); } else if (type.target.objectFlags & 8 /* ObjectFlags.Tuple */) { typeArguments = ts.sameMap(typeArguments, function (t, i) { return removeMissingType(t, !!(type.target.elementFlags[i] & 2 /* ElementFlags.Optional */)); }); @@ -53710,12 +54015,12 @@ var ts; } } var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode(tupleConstituentNodes), 1 /* EmitFlags.SingleLine */); - return type.target.readonly ? ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; } } if (context.encounteredError || (context.flags & 524288 /* NodeBuilderFlags.AllowEmptyTuple */)) { var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode([]), 1 /* EmitFlags.SingleLine */); - return type.target.readonly ? ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; } context.encounteredError = true; return undefined; // TODO: GH#18217 @@ -53822,13 +54127,13 @@ var ts; var typeElements = []; for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 174 /* SyntaxKind.CallSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 176 /* SyntaxKind.CallSignature */, context)); } for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; if (signature.flags & 4 /* SignatureFlags.Abstract */) continue; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 175 /* SyntaxKind.ConstructSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 177 /* SyntaxKind.ConstructSignature */, context)); } for (var _d = 0, _e = resolvedType.indexInfos; _d < _e.length; _d++) { var info = _e[_d]; @@ -53865,7 +54170,7 @@ var ts; if (!(context.flags & 1 /* NodeBuilderFlags.NoTruncation */)) { return ts.factory.createTypeReferenceNode(ts.factory.createIdentifier("..."), /*typeArguments*/ undefined); } - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } function shouldUsePlaceholderForProperty(propertySymbol, context) { var _a; @@ -53915,7 +54220,7 @@ var ts; var signatures = getSignaturesOfType(filterType(propertyType, function (t) { return !(t.flags & 32768 /* TypeFlags.Undefined */); }), 0 /* SignatureKind.Call */); for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) { var signature = signatures_1[_i]; - var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 168 /* SyntaxKind.MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); + var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 170 /* SyntaxKind.MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); typeElements.push(preserveCommentsOn(methodDeclaration)); } } @@ -53929,12 +54234,12 @@ var ts; context.reverseMappedStack || (context.reverseMappedStack = []); context.reverseMappedStack.push(propertySymbol); } - propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); if (propertyIsReverseMapped) { context.reverseMappedStack.pop(); } } - var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(145 /* SyntaxKind.ReadonlyKeyword */)] : undefined; + var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(146 /* SyntaxKind.ReadonlyKeyword */)] : undefined; if (modifiers) { context.approximateLength += 9; } @@ -53943,8 +54248,8 @@ var ts; } function preserveCommentsOn(node) { var _a; - if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 347 /* SyntaxKind.JSDocPropertyTag */; })) { - var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 347 /* SyntaxKind.JSDocPropertyTag */; }); + if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 350 /* SyntaxKind.JSDocPropertyTag */; })) { + var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 350 /* SyntaxKind.JSDocPropertyTag */; }); var commentText = ts.getTextOfJSDocComment(d.comment); if (commentText) { ts.setSyntheticLeadingComments(node, [{ kind: 3 /* SyntaxKind.MultiLineCommentTrivia */, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]); @@ -54043,7 +54348,7 @@ var ts; context.encounteredError = true; } context.approximateLength += (name.length + 4); - return ts.factory.createIndexSignature(indexInfo.isReadonly ? [ts.factory.createToken(145 /* SyntaxKind.ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); + return ts.factory.createIndexSignature(indexInfo.isReadonly ? [ts.factory.createToken(146 /* SyntaxKind.ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); } function signatureToSignatureDeclarationHelper(signature, kind, context, options) { var _a, _b, _c, _d; @@ -54061,7 +54366,7 @@ var ts; } var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0]; // If the expanded parameter list had a variadic in a non-trailing position, don't expand it - var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* CheckFlags.RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 171 /* SyntaxKind.Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); + var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* CheckFlags.RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 173 /* SyntaxKind.Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); var thisParameter = context.flags & 33554432 /* NodeBuilderFlags.OmitThisParameter */ ? undefined : tryGetThisParameterDeclaration(signature, context); if (thisParameter) { parameters.unshift(thisParameter); @@ -54070,7 +54375,7 @@ var ts; var typePredicate = getTypePredicateOfSignature(signature); if (typePredicate) { var assertsModifier = typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? - ts.factory.createToken(128 /* SyntaxKind.AssertsKeyword */) : + ts.factory.createToken(129 /* SyntaxKind.AssertsKeyword */) : undefined; var parameterName = typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.setEmitFlags(ts.factory.createIdentifier(typePredicate.parameterName), 16777216 /* EmitFlags.NoAsciiEscaping */) : @@ -54084,28 +54389,28 @@ var ts; returnTypeNode = serializeReturnTypeForSignature(context, returnType, signature, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); } else if (!suppressAny) { - returnTypeNode = ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + returnTypeNode = ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } } var modifiers = options === null || options === void 0 ? void 0 : options.modifiers; - if ((kind === 180 /* SyntaxKind.ConstructorType */) && signature.flags & 4 /* SignatureFlags.Abstract */) { + if ((kind === 182 /* SyntaxKind.ConstructorType */) && signature.flags & 4 /* SignatureFlags.Abstract */) { var flags = ts.modifiersToFlags(modifiers); - modifiers = ts.factory.createModifiersFromModifierFlags(flags | 128 /* ModifierFlags.Abstract */); + modifiers = ts.factory.createModifiersFromModifierFlags(flags | 256 /* ModifierFlags.Abstract */); } - var node = kind === 174 /* SyntaxKind.CallSignature */ ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : - kind === 175 /* SyntaxKind.ConstructSignature */ ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : - kind === 168 /* SyntaxKind.MethodSignature */ ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : - kind === 169 /* SyntaxKind.MethodDeclaration */ ? ts.factory.createMethodDeclaration(modifiers, /*asteriskToken*/ undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), /*questionToken*/ undefined, typeParameters, parameters, returnTypeNode, /*body*/ undefined) : - kind === 171 /* SyntaxKind.Constructor */ ? ts.factory.createConstructorDeclaration(modifiers, parameters, /*body*/ undefined) : - kind === 172 /* SyntaxKind.GetAccessor */ ? ts.factory.createGetAccessorDeclaration(modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, /*body*/ undefined) : - kind === 173 /* SyntaxKind.SetAccessor */ ? ts.factory.createSetAccessorDeclaration(modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, /*body*/ undefined) : - kind === 176 /* SyntaxKind.IndexSignature */ ? ts.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : - kind === 317 /* SyntaxKind.JSDocFunctionType */ ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : - kind === 179 /* SyntaxKind.FunctionType */ ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : - kind === 180 /* SyntaxKind.ConstructorType */ ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : - kind === 256 /* SyntaxKind.FunctionDeclaration */ ? ts.factory.createFunctionDeclaration(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, /*body*/ undefined) : - kind === 213 /* SyntaxKind.FunctionExpression */ ? ts.factory.createFunctionExpression(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) : - kind === 214 /* SyntaxKind.ArrowFunction */ ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, /*equalsGreaterThanToken*/ undefined, ts.factory.createBlock([])) : + var node = kind === 176 /* SyntaxKind.CallSignature */ ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : + kind === 177 /* SyntaxKind.ConstructSignature */ ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : + kind === 170 /* SyntaxKind.MethodSignature */ ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : + kind === 171 /* SyntaxKind.MethodDeclaration */ ? ts.factory.createMethodDeclaration(modifiers, /*asteriskToken*/ undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), /*questionToken*/ undefined, typeParameters, parameters, returnTypeNode, /*body*/ undefined) : + kind === 173 /* SyntaxKind.Constructor */ ? ts.factory.createConstructorDeclaration(modifiers, parameters, /*body*/ undefined) : + kind === 174 /* SyntaxKind.GetAccessor */ ? ts.factory.createGetAccessorDeclaration(modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, /*body*/ undefined) : + kind === 175 /* SyntaxKind.SetAccessor */ ? ts.factory.createSetAccessorDeclaration(modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, /*body*/ undefined) : + kind === 178 /* SyntaxKind.IndexSignature */ ? ts.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : + kind === 320 /* SyntaxKind.JSDocFunctionType */ ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : + kind === 181 /* SyntaxKind.FunctionType */ ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : + kind === 182 /* SyntaxKind.ConstructorType */ ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : + kind === 259 /* SyntaxKind.FunctionDeclaration */ ? ts.factory.createFunctionDeclaration(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, /*body*/ undefined) : + kind === 215 /* SyntaxKind.FunctionExpression */ ? ts.factory.createFunctionExpression(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) : + kind === 216 /* SyntaxKind.ArrowFunction */ ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, /*equalsGreaterThanToken*/ undefined, ts.factory.createBlock([])) : ts.Debug.assertNever(kind); if (typeArguments) { node.typeArguments = ts.factory.createNodeArray(typeArguments); @@ -54142,9 +54447,9 @@ var ts; return typeParameterToDeclarationWithConstraint(type, context, constraintNode); } function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) { - var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 164 /* SyntaxKind.Parameter */); + var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 166 /* SyntaxKind.Parameter */); if (!parameterDeclaration && !ts.isTransientSymbol(parameterSymbol)) { - parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 340 /* SyntaxKind.JSDocParameterTag */); + parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 343 /* SyntaxKind.JSDocParameterTag */); } var parameterType = getTypeOfSymbol(parameterSymbol); if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) { @@ -54156,7 +54461,7 @@ var ts; var dotDotDotToken = isRest ? ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */) : undefined; var name = parameterDeclaration ? parameterDeclaration.name ? parameterDeclaration.name.kind === 79 /* SyntaxKind.Identifier */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name), 16777216 /* EmitFlags.NoAsciiEscaping */) : - parameterDeclaration.name.kind === 161 /* SyntaxKind.QualifiedName */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216 /* EmitFlags.NoAsciiEscaping */) : + parameterDeclaration.name.kind === 163 /* SyntaxKind.QualifiedName */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216 /* EmitFlags.NoAsciiEscaping */) : cloneBindingName(parameterDeclaration.name) : ts.symbolName(parameterSymbol) : ts.symbolName(parameterSymbol); @@ -54167,22 +54472,15 @@ var ts; context.approximateLength += ts.symbolName(parameterSymbol).length + 3; return parameterNode; function cloneBindingName(node) { - return elideInitializerAndPropertyRenamingAndSetEmitFlags(node); - function elideInitializerAndPropertyRenamingAndSetEmitFlags(node) { + return elideInitializerAndSetEmitFlags(node); + function elideInitializerAndSetEmitFlags(node) { if (context.tracker.trackSymbol && ts.isComputedPropertyName(node) && isLateBindableName(node)) { trackComputedName(node.expression, context.enclosingDeclaration, context); } - var visited = ts.visitEachChild(node, elideInitializerAndPropertyRenamingAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndPropertyRenamingAndSetEmitFlags); + var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndSetEmitFlags); if (ts.isBindingElement(visited)) { - if (visited.propertyName && ts.isIdentifier(visited.propertyName) && ts.isIdentifier(visited.name)) { - visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, - /* propertyName*/ undefined, visited.propertyName, - /*initializer*/ undefined); - } - else { - visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name, - /*initializer*/ undefined); - } + visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name, + /*initializer*/ undefined); } if (!ts.nodeIsSynthesized(visited)) { visited = ts.factory.cloneNode(visited); @@ -54327,11 +54625,11 @@ var ts; } function getSpecifierForModuleSymbol(symbol, context, overrideImportMode) { var _a; - var file = ts.getDeclarationOfKind(symbol, 305 /* SyntaxKind.SourceFile */); + var file = ts.getDeclarationOfKind(symbol, 308 /* SyntaxKind.SourceFile */); if (!file) { var equivalentFileSymbol = ts.firstDefined(symbol.declarations, function (d) { return getFileSymbolIfFileSymbolExportEqualsContainer(d, symbol); }); if (equivalentFileSymbol) { - file = ts.getDeclarationOfKind(equivalentFileSymbol, 305 /* SyntaxKind.SourceFile */); + file = ts.getDeclarationOfKind(equivalentFileSymbol, 308 /* SyntaxKind.SourceFile */); } } if (file && file.moduleName !== undefined) { @@ -54799,17 +55097,17 @@ var ts; return transformed === existing ? ts.setTextRange(ts.factory.cloneNode(existing), existing) : transformed; function visitExistingNodeTreeSymbols(node) { // We don't _actually_ support jsdoc namepath types, emit `any` instead - if (ts.isJSDocAllType(node) || node.kind === 319 /* SyntaxKind.JSDocNamepathType */) { - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + if (ts.isJSDocAllType(node) || node.kind === 322 /* SyntaxKind.JSDocNamepathType */) { + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } if (ts.isJSDocUnknownType(node)) { - return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */); + return ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */); } if (ts.isJSDocNullableType(node)) { return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createLiteralTypeNode(ts.factory.createNull())]); } if (ts.isJSDocOptionalType(node)) { - return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)]); + return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)]); } if (ts.isJSDocNonNullableType(node)) { return ts.visitNode(node.type, visitExistingNodeTreeSymbols); @@ -54823,11 +55121,11 @@ var ts; var typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode(node), name.escapedText); var overrideTypeNode = typeViaParent && t.typeExpression && getTypeFromTypeNode(t.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : undefined; return ts.factory.createPropertySignature( - /*modifiers*/ undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*modifiers*/ undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); })); } if (ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "") { - return ts.setOriginalNode(ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */), node); + return ts.setOriginalNode(ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */), node); } if ((ts.isExpressionWithTypeArguments(node) || ts.isTypeReferenceNode(node)) && ts.isJSDocIndexSignature(node)) { return ts.factory.createTypeLiteralNode([ts.factory.createIndexSignature( @@ -54842,12 +55140,12 @@ var ts; return ts.factory.createConstructorTypeNode( /*modifiers*/ undefined, ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.mapDefined(node.parameters, function (p, i) { return p.name && ts.isIdentifier(p.name) && p.name.escapedText === "new" ? (newTypeNode_1 = p.type, undefined) : ts.factory.createParameterDeclaration( /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), - /*initializer*/ undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*initializer*/ undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } else { return ts.factory.createFunctionTypeNode(ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.map(node.parameters, function (p, i) { return ts.factory.createParameterDeclaration( /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), - /*initializer*/ undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*initializer*/ undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } } if (ts.isTypeReferenceNode(node) && ts.isInJSDoc(node) && (!existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(node, getTypeFromTypeNode(node)) || getIntendedTypeFromJSDocTypeReference(node) || unknownSymbol === resolveTypeReferenceName(node, 788968 /* SymbolFlags.Type */, /*ignoreErrors*/ true))) { @@ -54915,8 +55213,8 @@ var ts; } } function symbolTableToDeclarationStatements(symbolTable, context, bundled) { - var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 169 /* SyntaxKind.MethodDeclaration */, /*useAcessors*/ true); - var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 168 /* SyntaxKind.MethodSignature */, /*useAcessors*/ false); + var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 171 /* SyntaxKind.MethodDeclaration */, /*useAcessors*/ true); + var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 170 /* SyntaxKind.MethodSignature */, /*useAcessors*/ false); // TODO: Use `setOriginalNode` on original declaration names where possible so these declarations see some kind of // declaration mapping // We save the enclosing declaration off here so it's not adjusted by well-meaning declaration @@ -55154,7 +55452,7 @@ var ts; if (needsPostExportDefault || needsExportDeclaration) { isPrivate = true; } - var modifierFlags = (!isPrivate ? 1 /* ModifierFlags.Export */ : 0) | (isDefault && !needsPostExportDefault ? 512 /* ModifierFlags.Default */ : 0); + var modifierFlags = (!isPrivate ? 1 /* ModifierFlags.Export */ : 0) | (isDefault && !needsPostExportDefault ? 1024 /* ModifierFlags.Default */ : 0); var isConstMergedWithNS = symbol.flags & 1536 /* SymbolFlags.Module */ && symbol.flags & (2 /* SymbolFlags.BlockScopedVariable */ | 1 /* SymbolFlags.FunctionScopedVariable */ | 4 /* SymbolFlags.Property */) && symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */; @@ -55338,8 +55636,8 @@ var ts; // Classes, namespaces, variables, enums, and functions all need `declare` modifiers to be valid in a declaration file top-level scope newModifierFlags |= 2 /* ModifierFlags.Ambient */; } - if ((additionalModifierFlags & 512 /* ModifierFlags.Default */) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) { - newModifierFlags |= 512 /* ModifierFlags.Default */; + if ((additionalModifierFlags & 1024 /* ModifierFlags.Default */) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) { + newModifierFlags |= 1024 /* ModifierFlags.Default */; } if (newModifierFlags) { node = ts.factory.updateModifiers(node, newModifierFlags | ts.getEffectiveModifierFlags(node)); @@ -55373,8 +55671,8 @@ var ts; var baseTypes = getBaseTypes(interfaceType); var baseType = ts.length(baseTypes) ? getIntersectionType(baseTypes) : undefined; var members = ts.flatMap(getPropertiesOfType(interfaceType), function (p) { return serializePropertySymbolForInterface(p, baseType); }); - var callSignatures = serializeSignatures(0 /* SignatureKind.Call */, interfaceType, baseType, 174 /* SyntaxKind.CallSignature */); - var constructSignatures = serializeSignatures(1 /* SignatureKind.Construct */, interfaceType, baseType, 175 /* SyntaxKind.ConstructSignature */); + var callSignatures = serializeSignatures(0 /* SignatureKind.Call */, interfaceType, baseType, 176 /* SyntaxKind.CallSignature */); + var constructSignatures = serializeSignatures(1 /* SignatureKind.Construct */, interfaceType, baseType, 177 /* SyntaxKind.ConstructSignature */); var indexSignatures = serializeIndexSignatures(interfaceType, baseType); var heritageClauses = !ts.length(baseTypes) ? undefined : [ts.factory.createHeritageClause(94 /* SyntaxKind.ExtendsKeyword */, ts.mapDefined(baseTypes, function (b) { return trySerializeAsTypeReference(b, 111551 /* SymbolFlags.Value */); }))]; addResult(ts.factory.createInterfaceDeclaration( @@ -55439,7 +55737,7 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var sig = signatures_2[_i]; // Each overload becomes a separate function declaration, in order - var decl = signatureToSignatureDeclarationHelper(sig, 256 /* SyntaxKind.FunctionDeclaration */, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); + var decl = signatureToSignatureDeclarationHelper(sig, 259 /* SyntaxKind.FunctionDeclaration */, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); addResult(ts.setTextRange(decl, getSignatureTextRangeLocation(sig)), modifierFlags); } // Module symbol emit will take care of module-y members, provided it has exports @@ -55597,7 +55895,7 @@ var ts; !ts.some(getSignaturesOfType(staticType, 1 /* SignatureKind.Construct */)); var constructors = isNonConstructableClassLikeInJsFile ? [ts.factory.createConstructorDeclaration(ts.factory.createModifiersFromModifierFlags(8 /* ModifierFlags.Private */), [], /*body*/ undefined)] : - serializeSignatures(1 /* SignatureKind.Construct */, staticType, staticBaseType, 171 /* SyntaxKind.Constructor */); + serializeSignatures(1 /* SignatureKind.Construct */, staticType, staticBaseType, 173 /* SyntaxKind.Constructor */); var indexSignatures = serializeIndexSignatures(classType, baseTypes[0]); context.enclosingDeclaration = oldEnclosing; addResult(ts.setTextRange(ts.factory.createClassDeclaration( @@ -55646,8 +55944,8 @@ var ts; var targetName = getInternalSymbolName(target, verbatimTargetName); includePrivateSymbol(target); // the target may be within the same scope - attempt to serialize it first switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 254 /* SyntaxKind.VariableDeclaration */) { + case 205 /* SyntaxKind.BindingElement */: + if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 257 /* SyntaxKind.VariableDeclaration */) { // const { SomeClass } = require('./lib'); var specifier_1 = getSpecifierForModuleSymbol(target.parent || target, context); // './lib' var propertyName = node.propertyName; @@ -55660,13 +55958,13 @@ var ts; // We don't know how to serialize this (nested?) binding element ts.Debug.failBadSyntaxKind(((_c = node.parent) === null || _c === void 0 ? void 0 : _c.parent) || node, "Unhandled binding element grandparent kind in declaration serialization"); break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 221 /* SyntaxKind.BinaryExpression */) { + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 223 /* SyntaxKind.BinaryExpression */) { // module.exports = { SomeClass } serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), targetName); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: // commonjs require: const x = require('y') if (ts.isPropertyAccessExpression(node.initializer)) { // const x = require('y').z @@ -55684,7 +55982,7 @@ var ts; break; } // else fall through and treat commonjs require just like import= - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // This _specifically_ only exists to handle json declarations - where we make aliases, but since // we emit no declarations for the json document, must not refer to it in the declarations if (target.escapedName === "export=" /* InternalSymbolName.ExportEquals */ && ts.some(target.declarations, ts.isJsonSourceFile)) { @@ -55700,13 +55998,13 @@ var ts; ? symbolToName(target, context, 67108863 /* SymbolFlags.All */, /*expectsIdentifier*/ false) : ts.factory.createExternalModuleReference(ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)))), isLocalImport ? modifierFlags : 0 /* ModifierFlags.None */); break; - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: // export as namespace foo // TODO: Not part of a file's local or export symbol tables // Is bound into file.symbol.globalExports instead, which we don't currently traverse addResult(ts.factory.createNamespaceExportDeclaration(ts.idText(node.name)), 0 /* ModifierFlags.None */); break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, ts.factory.createIdentifier(localName), /*namedBindings*/ undefined), // We use `target.parent || target` below as `target.parent` is unset when the target is a module which has been export assigned @@ -55715,17 +56013,17 @@ var ts; ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, /*importClause*/ undefined, ts.factory.createNamespaceImport(ts.factory.createIdentifier(localName))), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: addResult(ts.factory.createExportDeclaration( /*modifiers*/ undefined, /*isTypeOnly*/ false, ts.factory.createNamespaceExport(ts.factory.createIdentifier(localName)), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context))), 0 /* ModifierFlags.None */); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause( /*isTypeOnly*/ false, @@ -55735,7 +56033,7 @@ var ts; ])), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: // does not use localName because the symbol name in this case refers to the name in the exports table, // which we must exactly preserve var specifier = node.parent.parent.moduleSpecifier; @@ -55743,12 +56041,12 @@ var ts; // another file serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), specifier ? verbatimTargetName : targetName, specifier && ts.isStringLiteralLike(specifier) ? ts.factory.createStringLiteral(specifier.text) : undefined); break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: serializeMaybeAliasAssignment(symbol); break; - case 221 /* SyntaxKind.BinaryExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // Could be best encoded as though an export specifier or as though an export assignment // If name is default or export=, do an export assignment // Otherwise do an export specifier @@ -55892,7 +56190,7 @@ var ts; && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName)))) { return []; } - var flag = (modifierFlags & ~256 /* ModifierFlags.Async */) | (isStatic ? 32 /* ModifierFlags.Static */ : 0); + var flag = (modifierFlags & ~512 /* ModifierFlags.Async */) | (isStatic ? 32 /* ModifierFlags.Static */ : 0); var name = getPropertyNameNodeForSymbol(p, context); var firstPropertyLikeDecl = (_a = p.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.or(ts.isPropertyDeclaration, ts.isAccessor, ts.isVariableDeclaration, ts.isPropertySignature, ts.isBinaryExpression, ts.isPropertyAccessExpression)); if (p.flags & 98304 /* SymbolFlags.Accessor */ && useAccessors) { @@ -55914,7 +56212,7 @@ var ts; // This is an else/if as accessors and properties can't merge in TS, but might in JS // If this happens, we assume the accessor takes priority, as it imposes more constraints else if (p.flags & (4 /* SymbolFlags.Property */ | 3 /* SymbolFlags.Variable */ | 98304 /* SymbolFlags.Accessor */)) { - return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* ModifierFlags.Readonly */ : 0) | flag), name, p.flags & 16777216 /* SymbolFlags.Optional */ ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), + return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* ModifierFlags.Readonly */ : 0) | flag), name, p.flags & 16777216 /* SymbolFlags.Optional */ ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), // TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357 // interface members can't have initializers, however class members _can_ /*initializer*/ undefined), ((_d = p.declarations) === null || _d === void 0 ? void 0 : _d.find(ts.or(ts.isPropertyDeclaration, ts.isVariableDeclaration))) || firstPropertyLikeDecl); @@ -56104,7 +56402,7 @@ var ts; if (flags === void 0) { flags = 16384 /* TypeFormatFlags.UseAliasDefinedOutsideCurrentScope */; } return writer ? typePredicateToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(typePredicateToStringWorker); function typePredicateToStringWorker(writer) { - var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createToken(128 /* SyntaxKind.AssertsKeyword */) : undefined, typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */) // TODO: GH#18217 + var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createToken(129 /* SyntaxKind.AssertsKeyword */) : undefined, typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */) // TODO: GH#18217 ); var printer = ts.createPrinter({ removeComments: true }); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); @@ -56151,7 +56449,7 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* SymbolFlags.TypeLiteral */ && type.symbol.declarations) { var node = ts.walkUpParenthesizedTypes(type.symbol.declarations[0].parent); - if (node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + if (node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -56159,11 +56457,11 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && + node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isExternalModuleAugmentation(node.parent.parent); } function isDefaultBindingContext(location) { - return location.kind === 305 /* SyntaxKind.SourceFile */ || ts.isAmbientModule(location); + return location.kind === 308 /* SyntaxKind.SourceFile */ || ts.isAmbientModule(location); } function getNameOfSymbolFromNameType(symbol, context) { var nameType = getSymbolLinks(symbol).nameType; @@ -56222,17 +56520,17 @@ var ts; if (!declaration) { declaration = symbol.declarations[0]; // Declaration may be nameless, but we'll try anyway } - if (declaration.parent && declaration.parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (declaration.parent && declaration.parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { return ts.declarationNameToString(declaration.parent.name); } switch (declaration.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (context && !context.encounteredError && !(context.flags & 131072 /* NodeBuilderFlags.AllowAnonymousIdentifier */)) { context.encounteredError = true; } - return declaration.kind === 226 /* SyntaxKind.ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; + return declaration.kind === 228 /* SyntaxKind.ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; } } var name = getNameOfSymbolFromNameType(symbol, context); @@ -56249,28 +56547,28 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: // Top-level jsdoc type aliases are considered exported // First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent)); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return isDeclarationVisible(node.parent.parent); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { // If the binding pattern is empty, this variable declaration is not visible return false; } // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // external module augmentation is always visible if (ts.isExternalModuleAugmentation(node)) { return true; @@ -56278,55 +56576,55 @@ var ts; var parent = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedModifierFlags(node) & 1 /* ModifierFlags.Export */) && - !(node.kind !== 265 /* SyntaxKind.ImportEqualsDeclaration */ && parent.kind !== 305 /* SyntaxKind.SourceFile */ && parent.flags & 16777216 /* NodeFlags.Ambient */)) { + !(node.kind !== 268 /* SyntaxKind.ImportEqualsDeclaration */ && parent.kind !== 308 /* SyntaxKind.SourceFile */ && parent.flags & 16777216 /* NodeFlags.Ambient */)) { return isGlobalSourceFile(parent); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible return isDeclarationVisible(parent); - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.hasEffectiveModifier(node, 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */)) { // Private/protected properties/methods are not visible return false; } // Public properties/methods are visible if its parents are visible, so: // falls through - case 171 /* SyntaxKind.Constructor */: - case 175 /* SyntaxKind.ConstructSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 164 /* SyntaxKind.Parameter */: - case 262 /* SyntaxKind.ModuleBlock */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 178 /* SyntaxKind.TypeReference */: - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 173 /* SyntaxKind.Constructor */: + case 177 /* SyntaxKind.ConstructSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 166 /* SyntaxKind.Parameter */: + case 265 /* SyntaxKind.ModuleBlock */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 180 /* SyntaxKind.TypeReference */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: return false; // Type parameters are always visible - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: // Source file and namespace export are always visible // falls through - case 305 /* SyntaxKind.SourceFile */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return true; // Export assignments do not create name bindings outside the module - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return false; default: return false; @@ -56335,10 +56633,10 @@ var ts; } function collectLinkedAliases(node, setVisibility) { var exportSymbol; - if (node.parent && node.parent.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (node.parent && node.parent.kind === 274 /* SyntaxKind.ExportAssignment */) { exportSymbol = resolveName(node, node.escapedText, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false); } - else if (node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) { + else if (node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) { exportSymbol = getTargetOfExportSpecifier(node.parent, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */); } var result; @@ -56445,12 +56743,12 @@ var ts; function getDeclarationContainer(node) { return ts.findAncestor(ts.getRootDeclaration(node), function (node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 255 /* SyntaxKind.VariableDeclarationList */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 269 /* SyntaxKind.NamedImports */: - case 268 /* SyntaxKind.NamespaceImport */: - case 267 /* SyntaxKind.ImportClause */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 258 /* SyntaxKind.VariableDeclarationList */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 272 /* SyntaxKind.NamedImports */: + case 271 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: return false; default: return true; @@ -56580,23 +56878,23 @@ var ts; function getParentElementAccess(node) { var ancestor = node.parent.parent; switch (ancestor.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: return getSyntheticElementAccess(ancestor); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getSyntheticElementAccess(node.parent); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ancestor.initializer; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return ancestor.right; } } function getDestructuringPropertyName(node) { var parent = node.parent; - if (node.kind === 203 /* SyntaxKind.BindingElement */ && parent.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (node.kind === 205 /* SyntaxKind.BindingElement */ && parent.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { return getLiteralPropertyNameText(node.propertyName || node.name); } - if (node.kind === 296 /* SyntaxKind.PropertyAssignment */ || node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.kind === 299 /* SyntaxKind.PropertyAssignment */ || node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return getLiteralPropertyNameText(node.name); } return "" + parent.elements.indexOf(node); @@ -56626,7 +56924,7 @@ var ts; parentType = getTypeWithFacts(parentType, 524288 /* TypeFacts.NEUndefined */); } var type; - if (pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (declaration.dotDotDotToken) { parentType = getReducedType(parentType); if (parentType.flags & 2 /* TypeFlags.Unknown */ || !isValidSpreadType(parentType)) { @@ -56697,7 +56995,7 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node, /*excludeJSDocTypeAssertions*/ true); - return expr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && expr.elements.length === 0; + return expr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && expr.elements.length === 0; } function addOptionality(type, isProperty, isOptional) { if (isProperty === void 0) { isProperty = false; } @@ -56708,11 +57006,11 @@ var ts; function getTypeForVariableLikeDeclaration(declaration, includeOptionality, checkMode) { // A variable declared in a for..in statement is of type string, or of type keyof T when the // right hand expression is of a type parameter type. - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression, /*checkMode*/ checkMode))); return indexType.flags & (262144 /* TypeFlags.TypeParameter */ | 4194304 /* TypeFlags.Index */) ? getExtractStringType(indexType) : stringType; } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { // checkRightHandSideOfForOf will return undefined if the for-of expression type was // missing properties/signatures required to get its iteratedType (like // [Symbol.iterator] or next). This may be because we accessed properties from anyType, @@ -56723,7 +57021,7 @@ var ts; if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } - var isProperty = ts.isPropertyDeclaration(declaration) || ts.isPropertySignature(declaration); + var isProperty = ts.isPropertyDeclaration(declaration) && !ts.hasAccessorModifier(declaration) || ts.isPropertySignature(declaration); var isOptional = includeOptionality && (isProperty && !!declaration.questionToken || ts.isParameter(declaration) && (!!declaration.questionToken || isJSDocOptionalParameter(declaration)) || isOptionalJSDocPropertyLikeTag(declaration)); @@ -56750,8 +57048,8 @@ var ts; if (ts.isParameter(declaration)) { var func = declaration.parent; // For a parameter of a set accessor, use the type of the get accessor if one is present - if (func.kind === 173 /* SyntaxKind.SetAccessor */ && hasBindableName(func)) { - var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 172 /* SyntaxKind.GetAccessor */); + if (func.kind === 175 /* SyntaxKind.SetAccessor */ && hasBindableName(func)) { + var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 174 /* SyntaxKind.GetAccessor */); if (getter) { var getterSignature = getSignatureFromDeclaration(getter); var thisParameter = getAccessorThisParameter(func); @@ -56763,11 +57061,9 @@ var ts; return getReturnTypeOfSignature(getterSignature); } } - if (ts.isInJSFile(declaration)) { - var type_1 = getParameterTypeOfTypeTag(func, declaration); - if (type_1) - return type_1; - } + var parameterTypeOfTypeTag = getParameterTypeOfTypeTag(func, declaration); + if (parameterTypeOfTypeTag) + return parameterTypeOfTypeTag; // Use contextual parameter type if one is available var type = declaration.symbol.escapedName === "this" /* InternalSymbolName.This */ ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration); if (type) { @@ -56828,7 +57124,7 @@ var ts; links.isConstructorDeclaredProperty = !!getDeclaringConstructor(symbol) && ts.every(symbol.declarations, function (declaration) { return ts.isBinaryExpression(declaration) && isPossiblyAliasedThisProperty(declaration) && - (declaration.left.kind !== 207 /* SyntaxKind.ElementAccessExpression */ || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && + (declaration.left.kind !== 209 /* SyntaxKind.ElementAccessExpression */ || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && !getAnnotatedTypeForAssignmentDeclaration(/*declaredType*/ undefined, declaration, symbol, declaration); }); } @@ -56850,11 +57146,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; var container = ts.getThisContainer(declaration, /*includeArrowFunctions*/ false); - if (container && (container.kind === 171 /* SyntaxKind.Constructor */ || isJSConstructor(container))) { + if (container && (container.kind === 173 /* SyntaxKind.Constructor */ || isJSConstructor(container))) { return container; } } - ; } /** Create a synthetic property access flow node after the last statement of the file */ function getFlowTypeFromCommonJSExport(symbol) { @@ -57147,9 +57442,9 @@ var ts; var thisContainer = ts.getThisContainer(expression, /*includeArrowFunctions*/ false); // Properties defined in a constructor (or base constructor, or javascript constructor function) don't get undefined added. // Function expressions that are assigned to the prototype count as methods. - return thisContainer.kind === 171 /* SyntaxKind.Constructor */ || - thisContainer.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - (thisContainer.kind === 213 /* SyntaxKind.FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); + return thisContainer.kind === 173 /* SyntaxKind.Constructor */ || + thisContainer.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + (thisContainer.kind === 215 /* SyntaxKind.FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); } function getConstructorDefinedThisAssignmentTypes(types, declarations) { ts.Debug.assert(types.length === declarations.length); @@ -57177,7 +57472,11 @@ var ts; if (reportErrors && !declarationBelongsToPrivateAmbientMember(element)) { reportImplicitAny(element, anyType); } - return anyType; + // When we're including the pattern in the type (an indication we're obtaining a contextual type), we + // use a non-inferrable any type. Inference will never directly infer this type, but it is possible + // to infer a type that contains it, e.g. for a binding pattern like [foo] or { foo }. In such cases, + // widening of the binding pattern type substitutes a regular any for the non-inferrable any. + return includePatternInType ? nonInferrableAnyType : anyType; } // Return the type implied by an object binding pattern function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) { @@ -57215,7 +57514,7 @@ var ts; function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) { var elements = pattern.elements; var lastElement = ts.lastOrUndefined(elements); - var restElement = lastElement && lastElement.kind === 203 /* SyntaxKind.BindingElement */ && lastElement.dotDotDotToken ? lastElement : undefined; + var restElement = lastElement && lastElement.kind === 205 /* SyntaxKind.BindingElement */ && lastElement.dotDotDotToken ? lastElement : undefined; if (elements.length === 0 || elements.length === 1 && restElement) { return languageVersion >= 2 /* ScriptTarget.ES2015 */ ? createIterableType(anyType) : anyArrayType; } @@ -57240,7 +57539,7 @@ var ts; function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { if (includePatternInType === void 0) { includePatternInType = false; } if (reportErrors === void 0) { reportErrors = false; } - return pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ + return pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -57288,7 +57587,7 @@ var ts; } function declarationBelongsToPrivateAmbientMember(declaration) { var root = ts.getRootDeclaration(declaration); - var memberDeclaration = root.kind === 164 /* SyntaxKind.Parameter */ ? root.parent : root; + var memberDeclaration = root.kind === 166 /* SyntaxKind.Parameter */ ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function tryGetTypeFromEffectiveTypeNode(node) { @@ -57343,9 +57642,9 @@ var ts; if (typeNode === undefined) { return useUnknownInCatchVariables ? unknownType : anyType; } - var type_2 = getTypeOfNode(typeNode); + var type_1 = getTypeOfNode(typeNode); // an errorType will make `checkTryStatement` issue an error - return isTypeAny(type_2) || type_2 === unknownType ? type_2 : errorType; + return isTypeAny(type_1) || type_1 === unknownType ? type_1 : errorType; } // Handle export default expressions if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) { @@ -57368,7 +57667,7 @@ var ts; return reportCircularityError(symbol); } var type; - if (declaration.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (declaration.kind === 274 /* SyntaxKind.ExportAssignment */) { type = widenTypeForVariableLikeDeclaration(tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionCached(declaration.expression), declaration); } else if (ts.isBinaryExpression(declaration) || @@ -57436,13 +57735,17 @@ var ts; } function getAnnotatedAccessorTypeNode(accessor) { if (accessor) { - if (accessor.kind === 172 /* SyntaxKind.GetAccessor */) { - var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); - return getterTypeAnnotation; - } - else { - var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation; + switch (accessor.kind) { + case 174 /* SyntaxKind.GetAccessor */: + var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); + return getterTypeAnnotation; + case 175 /* SyntaxKind.SetAccessor */: + var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); + return setterTypeAnnotation; + case 169 /* SyntaxKind.PropertyDeclaration */: + ts.Debug.assert(ts.hasAccessorModifier(accessor)); + var accessorTypeAnnotation = ts.getEffectiveTypeAnnotationNode(accessor); + return accessorTypeAnnotation; } } return undefined; @@ -57464,14 +57767,17 @@ var ts; if (!pushTypeResolution(symbol, 0 /* TypeSystemPropertyName.Type */)) { return errorType; } - var getter = ts.getDeclarationOfKind(symbol, 172 /* SyntaxKind.GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 174 /* SyntaxKind.GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */); + var accessor = ts.tryCast(ts.getDeclarationOfKind(symbol, 169 /* SyntaxKind.PropertyDeclaration */), ts.isAutoAccessorPropertyDeclaration); // We try to resolve a getter type annotation, a setter type annotation, or a getter function // body return type inference, in that order. var type = getter && ts.isInJSFile(getter) && getTypeForDeclarationFromJSDocComment(getter) || getAnnotatedAccessorType(getter) || getAnnotatedAccessorType(setter) || - getter && getter.body && getReturnTypeFromBody(getter); + getAnnotatedAccessorType(accessor) || + getter && getter.body && getReturnTypeFromBody(getter) || + accessor && accessor.initializer && getWidenedTypeForVariableLikeDeclaration(accessor, /*includeOptionality*/ true); if (!type) { if (setter && !isPrivateWithinAmbient(setter)) { errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol)); @@ -57479,6 +57785,9 @@ var ts; else if (getter && !isPrivateWithinAmbient(getter)) { errorOrSuggestion(noImplicitAny, getter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol)); } + else if (accessor && !isPrivateWithinAmbient(accessor)) { + errorOrSuggestion(noImplicitAny, accessor, ts.Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), "any"); + } type = anyType; } if (!popTypeResolution()) { @@ -57488,6 +57797,9 @@ var ts; else if (getAnnotatedAccessorTypeNode(setter)) { error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); } + else if (getAnnotatedAccessorTypeNode(accessor)) { + error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } else if (getter && noImplicitAny) { error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } @@ -57498,12 +57810,13 @@ var ts; return links.type; } function getWriteTypeOfAccessors(symbol) { + var _a; var links = getSymbolLinks(symbol); if (!links.writeType) { if (!pushTypeResolution(symbol, 8 /* TypeSystemPropertyName.WriteType */)) { return errorType; } - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var setter = (_a = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */)) !== null && _a !== void 0 ? _a : ts.tryCast(ts.getDeclarationOfKind(symbol, 169 /* SyntaxKind.PropertyDeclaration */), ts.isAutoAccessorPropertyDeclaration); var writeType = getAnnotatedAccessorType(setter); if (!popTypeResolution()) { if (getAnnotatedAccessorTypeNode(setter)) { @@ -57543,9 +57856,9 @@ var ts; if (symbol.flags & 1536 /* SymbolFlags.Module */ && ts.isShorthandAmbientModuleSymbol(symbol)) { return anyType; } - else if (declaration && (declaration.kind === 221 /* SyntaxKind.BinaryExpression */ || + else if (declaration && (declaration.kind === 223 /* SyntaxKind.BinaryExpression */ || ts.isAccessExpression(declaration) && - declaration.parent.kind === 221 /* SyntaxKind.BinaryExpression */)) { + declaration.parent.kind === 223 /* SyntaxKind.BinaryExpression */)) { return getWidenedTypeForAssignmentDeclaration(symbol); } else if (symbol.flags & 512 /* SymbolFlags.ValueModule */ && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) { @@ -57555,11 +57868,11 @@ var ts; return errorType; } var exportEquals = getMergedSymbol(symbol.exports.get("export=" /* InternalSymbolName.ExportEquals */)); - var type_3 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule); + var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule); if (!popTypeResolution()) { return reportCircularityError(symbol); } - return type_3; + return type_2; } } var type = createObjectType(16 /* ObjectFlags.Anonymous */, symbol); @@ -57610,7 +57923,7 @@ var ts; return errorType; } // Check if variable has initializer that circularly references the variable itself - if (noImplicitAny && (declaration.kind !== 164 /* SyntaxKind.Parameter */ || declaration.initializer)) { + if (noImplicitAny && (declaration.kind !== 166 /* SyntaxKind.Parameter */ || declaration.initializer)) { error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); } // Circularities could also result from parameters in function expressions that end up @@ -57742,46 +58055,46 @@ var ts; return undefined; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 195 /* SyntaxKind.MappedType */: - case 189 /* SyntaxKind.ConditionalType */: { + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 197 /* SyntaxKind.MappedType */: + case 191 /* SyntaxKind.ConditionalType */: { var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); - if (node.kind === 195 /* SyntaxKind.MappedType */) { + if (node.kind === 197 /* SyntaxKind.MappedType */) { return ts.append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter))); } - else if (node.kind === 189 /* SyntaxKind.ConditionalType */) { + else if (node.kind === 191 /* SyntaxKind.ConditionalType */) { return ts.concatenate(outerTypeParameters, getInferTypeParameters(node)); } var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node)); var thisType = includeThisTypes && - (node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */ || node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || isJSConstructor(node)) && + (node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */ || node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || isJSConstructor(node)) && getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters; } - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: var paramSymbol = ts.getParameterSymbolFromJSDoc(node); if (paramSymbol) { node = paramSymbol.valueDeclaration; } break; - case 320 /* SyntaxKind.JSDoc */: { + case 323 /* SyntaxKind.JSDoc */: { var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); return node.tags ? appendTypeParameters(outerTypeParameters, ts.flatMap(node.tags, function (t) { return ts.isJSDocTemplateTag(t) ? t.typeParameters : undefined; })) @@ -57792,7 +58105,7 @@ var ts; } // The outer type parameters are those defined by enclosing generic classes, methods, or functions. function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 /* SymbolFlags.Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 258 /* SyntaxKind.InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* SymbolFlags.Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.InterfaceDeclaration */); ts.Debug.assert(!!declaration, "Class was missing valueDeclaration -OR- non-class had no interface declarations"); return getOuterTypeParameters(declaration); } @@ -57805,9 +58118,9 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - node.kind === 257 /* SyntaxKind.ClassDeclaration */ || - node.kind === 226 /* SyntaxKind.ClassExpression */ || + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + node.kind === 260 /* SyntaxKind.ClassDeclaration */ || + node.kind === 228 /* SyntaxKind.ClassExpression */ || isJSConstructor(node) || ts.isTypeAlias(node)) { var declaration = node; @@ -57959,7 +58272,7 @@ var ts; if (!popTypeResolution() && type.symbol.declarations) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ || declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ || declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { reportCircularBaseType(declaration, type); } } @@ -58055,7 +58368,7 @@ var ts; if (type.symbol.declarations) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getReducedType(getTypeFromTypeNode(node)); @@ -58095,7 +58408,7 @@ var ts; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { if (declaration.flags & 128 /* NodeFlags.ContainsThis */) { return false; } @@ -58174,7 +58487,7 @@ var ts; } else { type = errorType; - if (declaration.kind === 339 /* SyntaxKind.JSDocEnumTag */) { + if (declaration.kind === 342 /* SyntaxKind.JSDocEnumTag */) { error(declaration.typeExpression.type, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } else { @@ -58189,7 +58502,7 @@ var ts; if (ts.isStringLiteralLike(expr)) { return true; } - else if (expr.kind === 221 /* SyntaxKind.BinaryExpression */) { + else if (expr.kind === 223 /* SyntaxKind.BinaryExpression */) { return isStringConcatExpression(expr.left) && isStringConcatExpression(expr.right); } return false; @@ -58204,12 +58517,12 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return true; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 8 /* SyntaxKind.NumericLiteral */; case 79 /* SyntaxKind.Identifier */: return ts.nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isStringConcatExpression(expr); default: return false; @@ -58224,7 +58537,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind === 263 /* SyntaxKind.EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (member.initializer && ts.isStringLiteralLike(member.initializer)) { @@ -58253,7 +58566,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind === 263 /* SyntaxKind.EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; var value = getEnumMemberValue(member); @@ -58326,22 +58639,22 @@ var ts; */ function isThislessType(node) { switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 196 /* SyntaxKind.LiteralType */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 198 /* SyntaxKind.LiteralType */: return true; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return isThislessType(node.elementType); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return !node.typeArguments || node.typeArguments.every(isThislessType); } return false; @@ -58367,7 +58680,7 @@ var ts; function isThislessFunctionLikeDeclaration(node) { var returnType = ts.getEffectiveReturnTypeNode(node); var typeParameters = ts.getEffectiveTypeParameterDeclarations(node); - return (node.kind === 171 /* SyntaxKind.Constructor */ || (!!returnType && isThislessType(returnType))) && + return (node.kind === 173 /* SyntaxKind.Constructor */ || (!!returnType && isThislessType(returnType))) && node.parameters.every(isThislessVariableLikeDeclaration) && typeParameters.every(isThislessTypeParameter); } @@ -58383,14 +58696,14 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return isThislessVariableLikeDeclaration(declaration); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return isThislessFunctionLikeDeclaration(declaration); } } @@ -58601,8 +58914,10 @@ var ts; if (members) { for (var _b = 0, members_5 = members; _b < members_5.length; _b++) { var member = members_5[_b]; - if (isStatic_1 === ts.hasStaticModifier(member) && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic_1 === ts.hasStaticModifier(member)) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -58617,8 +58932,10 @@ var ts; || ts.isBinaryExpression(member) && isPossiblyAliasedThisProperty(member, assignmentKind) || assignmentKind === 9 /* AssignmentDeclarationKind.ObjectDefinePrototypeProperty */ || assignmentKind === 6 /* AssignmentDeclarationKind.Prototype */; // A straight `Prototype` assignment probably can never have a computed name - if (isStatic_1 === !isInstanceMember && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic_1 === !isInstanceMember) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -58805,7 +59122,7 @@ var ts; var baseConstructorType = getBaseConstructorTypeOfClass(classType); var baseSignatures = getSignaturesOfType(baseConstructorType, 1 /* SignatureKind.Construct */); var declaration = ts.getClassLikeDeclarationOfSymbol(classType.symbol); - var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */); + var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */); if (baseSignatures.length === 0) { return [createSignature(undefined, classType.localTypeParameters, undefined, ts.emptyArray, classType, /*resolvedTypePredicate*/ undefined, 0, isAbstract ? 4 /* SignatureFlags.Abstract */ : 0 /* SignatureFlags.None */)]; } @@ -59278,6 +59595,12 @@ var ts; return mapType(type, getLowerBoundOfKeyType); } if (type.flags & 2097152 /* TypeFlags.Intersection */) { + // Similarly to getTypeFromIntersectionTypeNode, we preserve the special string & {}, number & {}, + // and bigint & {} intersections that are used to prevent subtype reduction in union types. + var types = type.types; + if (types.length === 2 && !!(types[0].flags & (4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) && types[1] === emptyTypeLiteralType) { + return type; + } return getIntersectionType(ts.sameMap(type.types, getLowerBoundOfKeyType)); } return type; @@ -59421,8 +59744,8 @@ var ts; } function isMappedTypeWithKeyofConstraintDeclaration(type) { var constraintDeclaration = getConstraintDeclarationForMappedType(type); // TODO: GH#18217 - return constraintDeclaration.kind === 193 /* SyntaxKind.TypeOperator */ && - constraintDeclaration.operator === 140 /* SyntaxKind.KeyOfKeyword */; + return constraintDeclaration.kind === 195 /* SyntaxKind.TypeOperator */ && + constraintDeclaration.operator === 141 /* SyntaxKind.KeyOfKeyword */; } function getModifiersTypeFromMappedType(type) { if (!type.modifiersType) { @@ -59782,10 +60105,10 @@ var ts; var baseTypes = []; var different = false; for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var type_4 = types_7[_i]; - var baseType = getBaseConstraint(type_4); + var type_3 = types_7[_i]; + var baseType = getBaseConstraint(type_3); if (baseType) { - if (baseType !== type_4) { + if (baseType !== type_3) { different = true; } baseTypes.push(baseType); @@ -59829,7 +60152,7 @@ var ts; return constraint && getBaseConstraint(constraint); } if (t.flags & 33554432 /* TypeFlags.Substitution */) { - return getBaseConstraint(t.substitute); + return getBaseConstraint(getSubstitutionIntersection(t)); } return t; } @@ -59956,7 +60279,7 @@ var ts; var isInstantiation = (getTargetSymbol(prop) || prop) === (getTargetSymbol(singleProp) || singleProp); // If the symbols are instances of one another with identical types - consider the symbols // equivalent and just use the first one, which thus allows us to avoid eliding private - // members when intersecting a (this-)instantiations of a class with it's raw base or another instance + // members when intersecting a (this-)instantiations of a class with its raw base or another instance if (isInstantiation && compareProperties(singleProp, prop, function (a, b) { return a === b ? -1 /* Ternary.True */ : 0 /* Ternary.False */; }) === -1 /* Ternary.True */) { // If we merged instantiations of a generic type, we replicate the symbol parent resetting behavior we used // to do when we recorded multiple distinct symbols so that we still get, eg, `Array.length` printed @@ -60004,7 +60327,11 @@ var ts; } } } - if (!singleProp || isUnion && (propSet || checkFlags & 48 /* CheckFlags.Partial */) && checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */)) { + if (!singleProp || + isUnion && + (propSet || checkFlags & 48 /* CheckFlags.Partial */) && + checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */) && + !(propSet && getCommonDeclarationsOfSymbols(ts.arrayFrom(propSet.values())))) { // No property was found, or, in a union, a property has a private or protected declaration in one // constituent, but is missing or has a different declaration in another constituent. return undefined; @@ -60106,6 +60433,33 @@ var ts; } return property; } + function getCommonDeclarationsOfSymbols(symbols) { + var commonDeclarations; + var _loop_14 = function (symbol) { + if (!symbol.declarations) { + return { value: undefined }; + } + if (!commonDeclarations) { + commonDeclarations = new ts.Set(symbol.declarations); + return "continue"; + } + commonDeclarations.forEach(function (declaration) { + if (!ts.contains(symbol.declarations, declaration)) { + commonDeclarations.delete(declaration); + } + }); + if (commonDeclarations.size === 0) { + return { value: undefined }; + } + }; + for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) { + var symbol = symbols_3[_i]; + var state_4 = _loop_14(symbol); + if (typeof state_4 === "object") + return state_4.value; + } + return commonDeclarations; + } function getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment) { var property = getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment); // We need to filter out partial properties in union types @@ -60309,10 +60663,10 @@ var ts; function isJSDocOptionalParameter(node) { return ts.isInJSFile(node) && ( // node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType - node.type && node.type.kind === 316 /* SyntaxKind.JSDocOptionalType */ + node.type && node.type.kind === 319 /* SyntaxKind.JSDocOptionalType */ || ts.getJSDocParameterTags(node).some(function (_a) { var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */; })); } function tryFindAmbientModule(moduleName, withAugmentations) { @@ -60345,14 +60699,14 @@ var ts; return false; } function isOptionalPropertyDeclaration(node) { - return ts.isPropertyDeclaration(node) && node.questionToken; + return ts.isPropertyDeclaration(node) && !ts.hasAccessorModifier(node) && node.questionToken; } function isOptionalJSDocPropertyLikeTag(node) { if (!ts.isJSDocPropertyLikeTag(node)) { return false; } var isBracketed = node.isBracketed, typeExpression = node.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */; } function createTypePredicate(kind, parameterName, parameterIndex, type) { return { kind: kind, parameterName: parameterName, parameterIndex: parameterIndex, type: type }; @@ -60434,7 +60788,7 @@ var ts; else { parameters.push(paramSymbol); } - if (type && type.kind === 196 /* SyntaxKind.LiteralType */) { + if (type && type.kind === 198 /* SyntaxKind.LiteralType */) { flags |= 2 /* SignatureFlags.HasLiteralTypes */; } // Record a new minimum argument count if this is not an optional parameter @@ -60447,24 +60801,24 @@ var ts; } } // If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation - if ((declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) && + if ((declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) && hasBindableName(declaration) && (!hasThisParameter || !thisParameter)) { - var otherKind = declaration.kind === 172 /* SyntaxKind.GetAccessor */ ? 173 /* SyntaxKind.SetAccessor */ : 172 /* SyntaxKind.GetAccessor */; + var otherKind = declaration.kind === 174 /* SyntaxKind.GetAccessor */ ? 175 /* SyntaxKind.SetAccessor */ : 174 /* SyntaxKind.GetAccessor */; var other = ts.getDeclarationOfKind(getSymbolOfNode(declaration), otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); } } - var classType = declaration.kind === 171 /* SyntaxKind.Constructor */ ? + var classType = declaration.kind === 173 /* SyntaxKind.Constructor */ ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration); if (ts.hasRestParameter(declaration) || ts.isInJSFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters)) { flags |= 1 /* SignatureFlags.HasRestParameter */; } - if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */) || - ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 128 /* ModifierFlags.Abstract */)) { + if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */) || + ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 256 /* ModifierFlags.Abstract */)) { flags |= 4 /* SignatureFlags.Abstract */; } links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, @@ -60543,16 +60897,16 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node.escapedText === argumentsSymbol.escapedName && getReferencedValueSymbol(node) === argumentsSymbol; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && traverse(node.name); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return traverse(node.expression); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return traverse(node.initializer); default: return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && !!ts.forEachChild(node, traverse); @@ -60576,7 +60930,12 @@ var ts; continue; } } - result.push(getSignatureFromDeclaration(decl)); + // If this is a function or method declaration, get the signature from the @type tag for the sake of optional parameters. + // Exclude contextually-typed kinds because we already apply the @type tag to the context, plus applying it here to the initializer would supress checks that the two are compatible. + result.push((!ts.isFunctionExpressionOrArrowFunction(decl) && + !ts.isObjectLiteralMethod(decl) && + getSignatureOfTypeTag(decl)) || + getSignatureFromDeclaration(decl)); } return result; } @@ -60607,7 +60966,7 @@ var ts; else { var type = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration); var jsdocPredicate = void 0; - if (!type && ts.isInJSFile(signature.declaration)) { + if (!type) { var jsdocSignature = getSignatureOfTypeTag(signature.declaration); if (jsdocSignature && signature !== jsdocSignature) { jsdocPredicate = getTypePredicateOfSignature(jsdocSignature); @@ -60624,7 +60983,7 @@ var ts; function createTypePredicateFromTypePredicateNode(node, signature) { var parameterName = node.parameterName; var type = node.type && getTypeFromTypeNode(node.type); - return parameterName.kind === 192 /* SyntaxKind.ThisType */ ? + return parameterName.kind === 194 /* SyntaxKind.ThisType */ ? createTypePredicate(node.assertsModifier ? 2 /* TypePredicateKind.AssertsThis */ : 0 /* TypePredicateKind.This */, /*parameterName*/ undefined, /*parameterIndex*/ undefined, type) : createTypePredicate(node.assertsModifier ? 3 /* TypePredicateKind.AssertsIdentifier */ : 1 /* TypePredicateKind.Identifier */, parameterName.escapedText, ts.findIndex(signature.parameters, function (p) { return p.escapedName === parameterName.escapedText; }), type); } @@ -60670,7 +61029,7 @@ var ts; return signature.resolvedReturnType; } function getReturnTypeFromAnnotation(declaration) { - if (declaration.kind === 171 /* SyntaxKind.Constructor */) { + if (declaration.kind === 173 /* SyntaxKind.Constructor */) { return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)); } if (ts.isJSDocConstructSignature(declaration)) { @@ -60680,12 +61039,12 @@ var ts; if (typeNode) { return getTypeFromTypeNode(typeNode); } - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ && hasBindableName(declaration)) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ && hasBindableName(declaration)) { var jsDocType = ts.isInJSFile(declaration) && getTypeForDeclarationFromJSDocComment(declaration); if (jsDocType) { return jsDocType; } - var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 173 /* SyntaxKind.SetAccessor */); + var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 175 /* SyntaxKind.SetAccessor */); var setterType = getAnnotatedAccessorType(setter); if (setterType) { return setterType; @@ -60788,7 +61147,7 @@ var ts; if (!signature.isolatedSignatureType) { var kind = (_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind; // If declaration is undefined, it is likely to be the signature of the default constructor. - var isConstructor = kind === undefined || kind === 171 /* SyntaxKind.Constructor */ || kind === 175 /* SyntaxKind.ConstructSignature */ || kind === 180 /* SyntaxKind.ConstructorType */; + var isConstructor = kind === undefined || kind === 173 /* SyntaxKind.Constructor */ || kind === 177 /* SyntaxKind.ConstructSignature */ || kind === 182 /* SyntaxKind.ConstructorType */; var type = createObjectType(16 /* ObjectFlags.Anonymous */); type.members = emptySymbols; type.properties = ts.emptyArray; @@ -60815,7 +61174,7 @@ var ts; function getIndexInfosOfIndexSymbol(indexSymbol) { if (indexSymbol.declarations) { var indexInfos_4 = []; - var _loop_14 = function (declaration) { + var _loop_15 = function (declaration) { if (declaration.parameters.length === 1) { var parameter = declaration.parameters[0]; if (parameter.type) { @@ -60829,7 +61188,7 @@ var ts; }; for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - _loop_14(declaration); + _loop_15(declaration); } return indexInfos_4; } @@ -60846,14 +61205,14 @@ var ts; var _a; var inferences; if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) { - var _loop_15 = function (declaration) { - if (declaration.parent.kind === 190 /* SyntaxKind.InferType */) { + var _loop_16 = function (declaration) { + if (declaration.parent.kind === 192 /* SyntaxKind.InferType */) { // When an 'infer T' declaration is immediately contained in a type reference node // (such as 'Foo'), T's constraint is inferred from the constraint of the // corresponding type parameter in 'Foo'. When multiple 'infer T' declarations are // present, we form an intersection of the inferred constraint types. var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1]; - if (grandParent.kind === 178 /* SyntaxKind.TypeReference */ && !omitTypeReferences) { + if (grandParent.kind === 180 /* SyntaxKind.TypeReference */ && !omitTypeReferences) { var typeReference_1 = grandParent; var typeParameters_1 = getTypeParametersForTypeReference(typeReference_1); if (typeParameters_1) { @@ -60880,27 +61239,27 @@ var ts; } // When an 'infer T' declaration is immediately contained in a rest parameter declaration, a rest type // or a named rest tuple element, we infer an 'unknown[]' constraint. - else if (grandParent.kind === 164 /* SyntaxKind.Parameter */ && grandParent.dotDotDotToken || - grandParent.kind === 186 /* SyntaxKind.RestType */ || - grandParent.kind === 197 /* SyntaxKind.NamedTupleMember */ && grandParent.dotDotDotToken) { + else if (grandParent.kind === 166 /* SyntaxKind.Parameter */ && grandParent.dotDotDotToken || + grandParent.kind === 188 /* SyntaxKind.RestType */ || + grandParent.kind === 199 /* SyntaxKind.NamedTupleMember */ && grandParent.dotDotDotToken) { inferences = ts.append(inferences, createArrayType(unknownType)); } // When an 'infer T' declaration is immediately contained in a string template type, we infer a 'string' // constraint. - else if (grandParent.kind === 199 /* SyntaxKind.TemplateLiteralTypeSpan */) { + else if (grandParent.kind === 201 /* SyntaxKind.TemplateLiteralTypeSpan */) { inferences = ts.append(inferences, stringType); } // When an 'infer T' declaration is in the constraint position of a mapped type, we infer a 'keyof any' // constraint. - else if (grandParent.kind === 163 /* SyntaxKind.TypeParameter */ && grandParent.parent.kind === 195 /* SyntaxKind.MappedType */) { + else if (grandParent.kind === 165 /* SyntaxKind.TypeParameter */ && grandParent.parent.kind === 197 /* SyntaxKind.MappedType */) { inferences = ts.append(inferences, keyofConstraintType); } // When an 'infer T' declaration is the template of a mapped type, and that mapped type is the extends // clause of a conditional whose check type is also a mapped type, give it a constraint equal to the template // of the check type's mapped type - else if (grandParent.kind === 195 /* SyntaxKind.MappedType */ && grandParent.type && - ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 189 /* SyntaxKind.ConditionalType */ && - grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 195 /* SyntaxKind.MappedType */ && + else if (grandParent.kind === 197 /* SyntaxKind.MappedType */ && grandParent.type && + ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 191 /* SyntaxKind.ConditionalType */ && + grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 197 /* SyntaxKind.MappedType */ && grandParent.parent.checkType.type) { var checkMappedType_1 = grandParent.parent.checkType; var nodeType = getTypeFromTypeNode(checkMappedType_1.type); @@ -60910,7 +61269,7 @@ var ts; }; for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) { var declaration = _b[_i]; - _loop_15(declaration); + _loop_16(declaration); } } return inferences && getIntersectionType(inferences); @@ -60932,7 +61291,7 @@ var ts; if (type.flags & 1 /* TypeFlags.Any */ && !isErrorType(type)) { // Allow errorType to propegate to keep downstream errors suppressed // use keyofConstraintType as the base constraint for mapped type key constraints (unknown isn;t assignable to that, but `any` was), // use unknown otherwise - type = constraintDeclaration.parent.parent.kind === 195 /* SyntaxKind.MappedType */ ? keyofConstraintType : unknownType; + type = constraintDeclaration.parent.parent.kind === 197 /* SyntaxKind.MappedType */ ? keyofConstraintType : unknownType; } typeParameter.constraint = type; } @@ -60941,7 +61300,7 @@ var ts; return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - var tp = ts.getDeclarationOfKind(typeParameter.symbol, 163 /* SyntaxKind.TypeParameter */); + var tp = ts.getDeclarationOfKind(typeParameter.symbol, 165 /* SyntaxKind.TypeParameter */); var host = ts.isJSDocTemplateTag(tp.parent) ? ts.getEffectiveContainerForJSDocTemplateTag(tp.parent) : tp.parent; return host && getSymbolOfNode(host); } @@ -61027,8 +61386,8 @@ var ts; } var node = type.node; var typeArguments = !node ? ts.emptyArray : - node.kind === 178 /* SyntaxKind.TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : - node.kind === 183 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : + node.kind === 180 /* SyntaxKind.TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : + node.kind === 185 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); if (popTypeResolution()) { type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments; @@ -61070,7 +61429,7 @@ var ts; return errorType; } } - if (node.kind === 178 /* SyntaxKind.TypeReference */ && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) { return createDeferredTypeReference(type, node, /*mapper*/ undefined); } // In a type reference, the outer type parameters of the referenced class or interface are automatically @@ -61141,9 +61500,9 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // We only support expressions that are simple qualified names. For other // expressions this produces undefined. var expr = node.expression; @@ -61158,13 +61517,13 @@ var ts; return symbol.parent ? "".concat(getSymbolPath(symbol.parent), ".").concat(symbol.escapedName) : symbol.escapedName; } function getUnresolvedSymbolForEntityName(name) { - var identifier = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.right : - name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ ? name.name : + var identifier = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.right : + name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? name.name : name; var text = identifier.escapedText; if (text) { - var parentSymbol = name.kind === 161 /* SyntaxKind.QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) : - name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) : + var parentSymbol = name.kind === 163 /* SyntaxKind.QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) : + name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) : undefined; var path = parentSymbol ? "".concat(getSymbolPath(parentSymbol), ".").concat(text) : text; var result = unresolvedSymbols.get(path); @@ -61225,7 +61584,7 @@ var ts; var valueType = getTypeOfSymbol(symbol); var typeType = valueType; if (symbol.valueDeclaration) { - var isImportTypeWithQualifier = node.kind === 200 /* SyntaxKind.ImportType */ && node.qualifier; + var isImportTypeWithQualifier = node.kind === 202 /* SyntaxKind.ImportType */ && node.qualifier; // valueType might not have a symbol, eg, {import('./b').STRING_LITERAL} if (valueType.symbol && valueType.symbol !== symbol && isImportTypeWithQualifier) { typeType = getTypeReferenceType(node, valueType.symbol); @@ -61235,23 +61594,27 @@ var ts; } return links.resolvedJSDocType; } - function getSubstitutionType(baseType, substitute) { - if (substitute.flags & 3 /* TypeFlags.AnyOrUnknown */ || substitute === baseType) { + function getSubstitutionType(baseType, constraint) { + if (constraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || constraint === baseType || + !isGenericType(baseType) && !isGenericType(constraint)) { return baseType; } - var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(substitute)); + var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(constraint)); var cached = substitutionTypes.get(id); if (cached) { return cached; } var result = createType(33554432 /* TypeFlags.Substitution */); result.baseType = baseType; - result.substitute = substitute; + result.constraint = constraint; substitutionTypes.set(id, result); return result; } + function getSubstitutionIntersection(substitutionType) { + return getIntersectionType([substitutionType.constraint, substitutionType.baseType]); + } function isUnaryTupleTypeNode(node) { - return node.kind === 184 /* SyntaxKind.TupleType */ && node.elements.length === 1; + return node.kind === 186 /* SyntaxKind.TupleType */ && node.elements.length === 1; } function getImpliedConstraint(type, checkNode, extendsNode) { return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(type, checkNode.elements[0], extendsNode.elements[0]) : @@ -61261,16 +61624,16 @@ var ts; function getConditionalFlowTypeOfType(type, node) { var constraints; var covariant = true; - while (node && !ts.isStatement(node) && node.kind !== 320 /* SyntaxKind.JSDoc */) { + while (node && !ts.isStatement(node) && node.kind !== 323 /* SyntaxKind.JSDoc */) { var parent = node.parent; // only consider variance flipped by parameter locations - `keyof` types would usually be considered variance inverting, but // often get used in indexed accesses where they behave sortof invariantly, but our checking is lax - if (parent.kind === 164 /* SyntaxKind.Parameter */) { + if (parent.kind === 166 /* SyntaxKind.Parameter */) { covariant = !covariant; } // Always substitute on type parameters, regardless of variance, since even // in contravariant positions, they may rely on substituted constraints to be valid - if ((covariant || type.flags & 8650752 /* TypeFlags.TypeVariable */) && parent.kind === 189 /* SyntaxKind.ConditionalType */ && node === parent.trueType) { + if ((covariant || type.flags & 8650752 /* TypeFlags.TypeVariable */) && parent.kind === 191 /* SyntaxKind.ConditionalType */ && node === parent.trueType) { var constraint = getImpliedConstraint(type, parent.checkType, parent.extendsType); if (constraint) { constraints = ts.append(constraints, constraint); @@ -61278,7 +61641,7 @@ var ts; } // Given a homomorphic mapped type { [K in keyof T]: XXX }, where T is constrained to an array or tuple type, in the // template type XXX, K has an added constraint of number | `${number}`. - else if (type.flags & 262144 /* TypeFlags.TypeParameter */ && parent.kind === 195 /* SyntaxKind.MappedType */ && node === parent.type) { + else if (type.flags & 262144 /* TypeFlags.TypeParameter */ && parent.kind === 197 /* SyntaxKind.MappedType */ && node === parent.type) { var mappedType = getTypeFromTypeNode(parent); if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) { var typeParameter = getHomomorphicTypeVariable(mappedType); @@ -61292,10 +61655,10 @@ var ts; } node = parent; } - return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type; + return constraints ? getSubstitutionType(type, getIntersectionType(constraints)) : type; } function isJSDocTypeReference(node) { - return !!(node.flags & 8388608 /* NodeFlags.JSDoc */) && (node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 200 /* SyntaxKind.ImportType */); + return !!(node.flags & 8388608 /* NodeFlags.JSDoc */) && (node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 202 /* SyntaxKind.ImportType */); } function checkNoTypeArguments(node, symbol) { if (node.typeArguments) { @@ -61410,9 +61773,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return declaration; } } @@ -61563,6 +61926,13 @@ var ts; function getGlobalBigIntType() { return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType; } + function getGlobalNaNSymbol() { + return (deferredGlobalNaNSymbol || (deferredGlobalNaNSymbol = getGlobalValueSymbol("NaN", /*reportErrors*/ false))); + } + function getGlobalRecordSymbol() { + deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol); + return deferredGlobalRecordSymbol === unknownSymbol ? undefined : deferredGlobalRecordSymbol; + } /** * Instantiates a global type that is generic with some element type, and returns that instantiation. */ @@ -61580,11 +61950,11 @@ var ts; } function getTupleElementFlags(node) { switch (node.kind) { - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return 2 /* ElementFlags.Optional */; - case 186 /* SyntaxKind.RestType */: + case 188 /* SyntaxKind.RestType */: return getRestTypeElementFlags(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return node.questionToken ? 2 /* ElementFlags.Optional */ : node.dotDotDotToken ? getRestTypeElementFlags(node) : 1 /* ElementFlags.Required */; @@ -61602,14 +61972,14 @@ var ts; return readonly ? globalReadonlyArrayType : globalArrayType; } var elementFlags = ts.map(node.elements, getTupleElementFlags); - var missingName = ts.some(node.elements, function (e) { return e.kind !== 197 /* SyntaxKind.NamedTupleMember */; }); + var missingName = ts.some(node.elements, function (e) { return e.kind !== 199 /* SyntaxKind.NamedTupleMember */; }); return getTupleTargetType(elementFlags, readonly, /*associatedNames*/ missingName ? undefined : node.elements); } // Return true if the given type reference node is directly aliased or if it needs to be deferred // because it is possibly contained in a circular chain of eagerly resolved types. function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) { - return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 183 /* SyntaxKind.ArrayType */ ? mayResolveTypeAlias(node.elementType) : - node.kind === 184 /* SyntaxKind.TupleType */ ? ts.some(node.elements, mayResolveTypeAlias) : + return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 185 /* SyntaxKind.ArrayType */ ? mayResolveTypeAlias(node.elementType) : + node.kind === 186 /* SyntaxKind.TupleType */ ? ts.some(node.elements, mayResolveTypeAlias) : hasDefaultTypeArguments || ts.some(node.typeArguments, mayResolveTypeAlias)); } // Return true when the given node is transitively contained in type constructs that eagerly @@ -61618,18 +61988,18 @@ var ts; function isResolvedByTypeAlias(node) { var parent = node.parent; switch (parent.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: - case 178 /* SyntaxKind.TypeReference */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 189 /* SyntaxKind.ConditionalType */: - case 193 /* SyntaxKind.TypeOperator */: - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: + case 180 /* SyntaxKind.TypeReference */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 191 /* SyntaxKind.ConditionalType */: + case 195 /* SyntaxKind.TypeOperator */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return isResolvedByTypeAlias(parent); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; } return false; @@ -61638,28 +62008,28 @@ var ts; // of a type alias. function mayResolveTypeAlias(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return isJSDocTypeReference(node) || !!(resolveTypeReferenceName(node, 788968 /* SymbolFlags.Type */).flags & 524288 /* SymbolFlags.TypeAlias */); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return true; - case 193 /* SyntaxKind.TypeOperator */: - return node.operator !== 154 /* SyntaxKind.UniqueKeyword */ && mayResolveTypeAlias(node.type); - case 191 /* SyntaxKind.ParenthesizedType */: - case 185 /* SyntaxKind.OptionalType */: - case 197 /* SyntaxKind.NamedTupleMember */: - case 316 /* SyntaxKind.JSDocOptionalType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 195 /* SyntaxKind.TypeOperator */: + return node.operator !== 156 /* SyntaxKind.UniqueKeyword */ && mayResolveTypeAlias(node.type); + case 193 /* SyntaxKind.ParenthesizedType */: + case 187 /* SyntaxKind.OptionalType */: + case 199 /* SyntaxKind.NamedTupleMember */: + case 319 /* SyntaxKind.JSDocOptionalType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return mayResolveTypeAlias(node.type); - case 186 /* SyntaxKind.RestType */: - return node.type.kind !== 183 /* SyntaxKind.ArrayType */ || mayResolveTypeAlias(node.type.elementType); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 188 /* SyntaxKind.RestType */: + return node.type.kind !== 185 /* SyntaxKind.ArrayType */ || mayResolveTypeAlias(node.type.elementType); + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return ts.some(node.types, mayResolveTypeAlias); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return mayResolveTypeAlias(node.objectType) || mayResolveTypeAlias(node.indexType); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return mayResolveTypeAlias(node.checkType) || mayResolveTypeAlias(node.extendsType) || mayResolveTypeAlias(node.trueType) || mayResolveTypeAlias(node.falseType); } @@ -61672,19 +62042,19 @@ var ts; if (target === emptyGenericType) { links.resolvedType = emptyObjectType; } - else if (!(node.kind === 184 /* SyntaxKind.TupleType */ && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8 /* ElementFlags.Variadic */); })) && isDeferredTypeReferenceNode(node)) { - links.resolvedType = node.kind === 184 /* SyntaxKind.TupleType */ && node.elements.length === 0 ? target : + else if (!(node.kind === 186 /* SyntaxKind.TupleType */ && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8 /* ElementFlags.Variadic */); })) && isDeferredTypeReferenceNode(node)) { + links.resolvedType = node.kind === 186 /* SyntaxKind.TupleType */ && node.elements.length === 0 ? target : createDeferredTypeReference(target, node, /*mapper*/ undefined); } else { - var elementTypes = node.kind === 183 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); + var elementTypes = node.kind === 185 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); links.resolvedType = createNormalizedTypeReference(target, elementTypes); } } return links.resolvedType; } function isReadonlyTypeOperator(node) { - return ts.isTypeOperatorNode(node) && node.operator === 145 /* SyntaxKind.ReadonlyKeyword */; + return ts.isTypeOperatorNode(node) && node.operator === 146 /* SyntaxKind.ReadonlyKeyword */; } function createTupleType(elementTypes, elementFlags, readonly, namedMemberDeclarations) { if (readonly === void 0) { readonly = false; } @@ -61799,7 +62169,7 @@ var ts; var lastRequiredIndex = -1; var firstRestIndex = -1; var lastOptionalOrRestIndex = -1; - var _loop_16 = function (i) { + var _loop_17 = function (i) { var type = elementTypes[i]; var flags = target.elementFlags[i]; if (flags & 8 /* ElementFlags.Variadic */) { @@ -61829,9 +62199,9 @@ var ts; } }; for (var i = 0; i < elementTypes.length; i++) { - var state_4 = _loop_16(i); - if (typeof state_4 === "object") - return state_4.value; + var state_5 = _loop_17(i); + if (typeof state_5 === "object") + return state_5.value; } // Turn optional elements preceding the last required element into required elements for (var i = 0; i < lastRequiredIndex; i++) { @@ -61859,7 +62229,7 @@ var ts; if (flags & (2 /* ElementFlags.Optional */ | 4 /* ElementFlags.Rest */)) { lastOptionalOrRestIndex = expandedFlags.length; } - expandedTypes.push(type); + expandedTypes.push(flags & 2 /* ElementFlags.Optional */ ? addOptionality(type, /*isProperty*/ true) : type); expandedFlags.push(flags); if (expandedDeclarations && declaration) { expandedDeclarations.push(declaration); @@ -62025,7 +62395,7 @@ var ts; var templates = ts.filter(types, isPatternLiteralType); if (templates.length) { var i = types.length; - var _loop_17 = function () { + var _loop_18 = function () { i--; var t = types[i]; if (t.flags & 128 /* TypeFlags.StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) { @@ -62033,7 +62403,7 @@ var ts; } }; while (i > 0) { - _loop_17(); + _loop_18(); } } } @@ -62110,14 +62480,14 @@ var ts; var namedUnions = []; addNamedUnions(namedUnions, types); var reducedTypes = []; - var _loop_18 = function (t) { + var _loop_19 = function (t) { if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) { reducedTypes.push(t); } }; for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) { var t = typeSet_1[_i]; - _loop_18(t); + _loop_19(t); } if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) { return namedUnions[0]; @@ -62607,7 +62977,7 @@ var ts; type.flags & 16777216 /* TypeFlags.Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* TypeFlags.UnionOrIntersection */ | 134217728 /* TypeFlags.TemplateLiteral */) ? ts.every(type.types, isDistributive) : type.flags & 8388608 /* TypeFlags.IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : - type.flags & 33554432 /* TypeFlags.Substitution */ ? isDistributive(type.substitute) : + type.flags & 33554432 /* TypeFlags.Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* TypeFlags.StringMapping */ ? isDistributive(type.type) : false; } @@ -62688,15 +63058,15 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { switch (node.operator) { - case 140 /* SyntaxKind.KeyOfKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: links.resolvedType = getIndexType(getTypeFromTypeNode(node.type)); break; - case 154 /* SyntaxKind.UniqueKeyword */: - links.resolvedType = node.type.kind === 151 /* SyntaxKind.SymbolKeyword */ + case 156 /* SyntaxKind.UniqueKeyword */: + links.resolvedType = node.type.kind === 153 /* SyntaxKind.SymbolKeyword */ ? getESSymbolLikeTypeForNode(ts.walkUpParenthesizedTypes(node.parent)) : errorType; break; - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: links.resolvedType = getTypeFromTypeNode(node.type); break; default: @@ -62888,7 +63258,7 @@ var ts; } function getPropertyTypeForIndexType(originalObjectType, objectType, indexType, fullIndexType, accessNode, accessFlags) { var _a; - var accessExpression = accessNode && accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ ? accessNode : undefined; var propName = accessNode && ts.isPrivateIdentifier(accessNode) ? undefined : getPropertyNameFromIndex(indexType, accessNode); if (propName !== undefined) { if (accessFlags & 256 /* AccessFlags.Contextual */) { @@ -63059,9 +63429,9 @@ var ts; } } function getIndexNodeForAccessExpression(accessNode) { - return accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ ? accessNode.argumentExpression : - accessNode.kind === 194 /* SyntaxKind.IndexedAccessType */ ? accessNode.indexType : - accessNode.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? accessNode.expression : + return accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ ? accessNode.argumentExpression : + accessNode.kind === 196 /* SyntaxKind.IndexedAccessType */ ? accessNode.indexType : + accessNode.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? accessNode.expression : accessNode; } function isPatternLiteralPlaceholderType(type) { @@ -63090,7 +63460,7 @@ var ts; if (type.flags & 33554432 /* TypeFlags.Substitution */) { if (!(type.objectFlags & 2097152 /* ObjectFlags.IsGenericTypeComputed */)) { type.objectFlags |= 2097152 /* ObjectFlags.IsGenericTypeComputed */ | - getGenericObjectFlags(type.substitute) | getGenericObjectFlags(type.baseType); + getGenericObjectFlags(type.baseType) | getGenericObjectFlags(type.constraint); } return type.objectFlags & 12582912 /* ObjectFlags.IsGenericType */; } @@ -63241,7 +63611,7 @@ var ts; // for a generic T and a non-generic K, we eagerly resolve T[K] if it originates in an expression. This is to // preserve backwards compatibility. For example, an element access 'this["foo"]' has always been resolved // eagerly using the constraint type of 'this' at the given location. - if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 194 /* SyntaxKind.IndexedAccessType */ ? + if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 196 /* SyntaxKind.IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) { if (objectType.flags & 3 /* TypeFlags.AnyOrUnknown */) { @@ -63293,11 +63663,7 @@ var ts; var objectType = getTypeFromTypeNode(node.objectType); var indexType = getTypeFromTypeNode(node.indexType); var potentialAlias = getAliasSymbolForTypeNode(node); - var resolved = getIndexedAccessType(objectType, indexType, 0 /* AccessFlags.None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); - links.resolvedType = resolved.flags & 8388608 /* TypeFlags.IndexedAccess */ && - resolved.objectType === objectType && - resolved.indexType === indexType ? - getConditionalFlowTypeOfType(resolved, node) : resolved; + links.resolvedType = getIndexedAccessType(objectType, indexType, 0 /* AccessFlags.None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); } return links.resolvedType; } @@ -63351,7 +63717,7 @@ var ts; var result; var extraTypes; var tailCount = 0; - var _loop_19 = function () { + var _loop_20 = function () { if (tailCount === 1000) { error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite); result = errorType; @@ -63472,10 +63838,10 @@ var ts; // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive // cases we increment the tail recursion counter and stop after 1000 iterations. while (true) { - var state_5 = _loop_19(); - if (typeof state_5 === "object") - return state_5.value; - if (state_5 === "break") + var state_6 = _loop_20(); + if (typeof state_6 === "object") + return state_6.value; + if (state_6 === "break") break; } return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result; @@ -63668,7 +64034,7 @@ var ts; } function getAliasSymbolForTypeNode(node) { var host = node.parent; - while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { + while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { host = host.parent; } return ts.isTypeAlias(host) ? getSymbolOfNode(host) : undefined; @@ -63913,7 +64279,7 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */)) { if (!ts.isStatic(container) && (!ts.isConstructorDeclaration(container) || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; @@ -63948,17 +64314,17 @@ var ts; } function getArrayElementTypeNode(node) { switch (node.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return getArrayElementTypeNode(node.type); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: if (node.elements.length === 1) { node = node.elements[0]; - if (node.kind === 186 /* SyntaxKind.RestType */ || node.kind === 197 /* SyntaxKind.NamedTupleMember */ && node.dotDotDotToken) { + if (node.kind === 188 /* SyntaxKind.RestType */ || node.kind === 199 /* SyntaxKind.NamedTupleMember */ && node.dotDotDotToken) { return getArrayElementTypeNode(node.type); } } break; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return node.elementType; } return undefined; @@ -63974,99 +64340,99 @@ var ts; } function getTypeFromTypeNodeWorker(node) { switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: + case 131 /* SyntaxKind.AnyKeyword */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return anyType; - case 155 /* SyntaxKind.UnknownKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: return unknownType; - case 150 /* SyntaxKind.StringKeyword */: + case 152 /* SyntaxKind.StringKeyword */: return stringType; - case 147 /* SyntaxKind.NumberKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: return numberType; - case 158 /* SyntaxKind.BigIntKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: return bigintType; - case 133 /* SyntaxKind.BooleanKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: return booleanType; - case 151 /* SyntaxKind.SymbolKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: return esSymbolType; case 114 /* SyntaxKind.VoidKeyword */: return voidType; - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: return undefinedType; case 104 /* SyntaxKind.NullKeyword */: // TODO(rbuckton): `NullKeyword` is no longer a `TypeNode`, but we defensively allow it here because of incorrect casts in the Language Service. return nullType; - case 143 /* SyntaxKind.NeverKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return neverType; - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return node.flags & 262144 /* NodeFlags.JavaScriptFile */ && !noImplicitAny ? anyType : nonPrimitiveType; - case 138 /* SyntaxKind.IntrinsicKeyword */: + case 139 /* SyntaxKind.IntrinsicKeyword */: return intrinsicMarkerType; - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 108 /* SyntaxKind.ThisKeyword */: // TODO(rbuckton): `ThisKeyword` is no longer a `TypeNode`, but we defensively allow it here because of incorrect casts in the Language Service and because of `isPartOfTypeNode`. return getTypeFromThisTypeNode(node); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return getTypeFromLiteralTypeNode(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return getTypeFromTypeReference(node); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return node.assertsModifier ? voidType : booleanType; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return getTypeFromTypeQueryNode(node); - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return getTypeFromArrayOrTupleTypeNode(node); - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return getTypeFromOptionalTypeNode(node); - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return getTypeFromUnionTypeNode(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return getTypeFromJSDocNullableTypeNode(node); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return addOptionality(getTypeFromTypeNode(node.type)); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return getTypeFromNamedTupleTypeNode(node); - case 191 /* SyntaxKind.ParenthesizedType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return getTypeFromTypeNode(node.type); - case 186 /* SyntaxKind.RestType */: + case 188 /* SyntaxKind.RestType */: return getTypeFromRestTypeNode(node); - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 323 /* SyntaxKind.JSDocSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 326 /* SyntaxKind.JSDocSignature */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return getTypeFromTypeOperatorNode(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return getTypeFromIndexedAccessTypeNode(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return getTypeFromMappedTypeNode(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return getTypeFromConditionalTypeNode(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return getTypeFromInferTypeNode(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return getTypeFromTemplateTypeNode(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return getTypeFromImportTypeNode(node); // This function assumes that an identifier, qualified name, or property access expression is a type expression // Callers should first ensure this by calling `isPartOfTypeNode` // TODO(rbuckton): These aren't valid TypeNodes, but we treat them as such because of `isPartOfTypeNode`, which returns `true` for things that aren't `TypeNode`s. case 79 /* SyntaxKind.Identifier */: - case 161 /* SyntaxKind.QualifiedName */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var symbol = getSymbolAtLocation(node); return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType; default: @@ -64173,8 +64539,8 @@ var ts; return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* TypeMapKind.Merged */, mapper, makeUnaryTypeMapper(source, target)); } function getRestrictiveTypeParameter(tp) { - return tp.constraint === unknownType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), - tp.restrictiveInstantiation.constraint = unknownType, + return !tp.constraint && !getConstraintDeclaration(tp) || tp.constraint === noConstraintType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), + tp.restrictiveInstantiation.constraint = noConstraintType, tp.restrictiveInstantiation); } function cloneTypeParameter(typeParameter) { @@ -64288,17 +64654,18 @@ var ts; return type; } function maybeTypeParameterReference(node) { - return !(node.parent.kind === 178 /* SyntaxKind.TypeReference */ && node.parent.typeArguments && node === node.parent.typeName || - node.parent.kind === 200 /* SyntaxKind.ImportType */ && node.parent.typeArguments && node === node.parent.qualifier); + return !(node.parent.kind === 180 /* SyntaxKind.TypeReference */ && node.parent.typeArguments && node === node.parent.typeName || + node.parent.kind === 202 /* SyntaxKind.ImportType */ && node.parent.typeArguments && node === node.parent.qualifier); } function isTypeParameterPossiblyReferenced(tp, node) { - // If the type parameter doesn't have exactly one declaration, if there are invening statement blocks + // If the type parameter doesn't have exactly one declaration, if there are intervening statement blocks // between the node and the type parameter declaration, if the node contains actual references to the - // type parameter, or if the node contains type queries, we consider the type parameter possibly referenced. + // type parameter, or if the node contains type queries that we can't prove couldn't contain references to the type parameter, + // we consider the type parameter possibly referenced. if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) { var container = tp.symbol.declarations[0].parent; for (var n = node; n !== container; n = n.parent) { - if (!n || n.kind === 235 /* SyntaxKind.Block */ || n.kind === 189 /* SyntaxKind.ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) { + if (!n || n.kind === 238 /* SyntaxKind.Block */ || n.kind === 191 /* SyntaxKind.ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) { return true; } } @@ -64307,15 +64674,36 @@ var ts; return true; function containsReference(node) { switch (node.kind) { - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return !!tp.isThisType; case 79 /* SyntaxKind.Identifier */: return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) && getTypeFromTypeNodeWorker(node) === tp; // use worker because we're looking for === equality - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: + var entityName = node.exprName; + var firstIdentifier = ts.getFirstIdentifier(entityName); + var firstIdentifierSymbol = getResolvedSymbol(firstIdentifier); + var tpDeclaration = tp.symbol.declarations[0]; // There is exactly one declaration, otherwise `containsReference` is not called + var tpScope_1; + if (tpDeclaration.kind === 165 /* SyntaxKind.TypeParameter */) { // Type parameter is a regular type parameter, e.g. foo + tpScope_1 = tpDeclaration.parent; + } + else if (tp.isThisType) { + // Type parameter is the this type, and its declaration is the class declaration. + tpScope_1 = tpDeclaration; + } + else { + // Type parameter's declaration was unrecognized. + // This could happen if the type parameter comes from e.g. a JSDoc annotation, so we default to returning true. + return true; + } + if (firstIdentifierSymbol.declarations) { + return ts.some(firstIdentifierSymbol.declarations, function (idDecl) { return ts.isNodeDescendantOf(idDecl, tpScope_1); }) || + ts.some(node.typeArguments, containsReference); + } return true; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return !node.type && !!node.body || ts.some(node.typeParameters, containsReference) || ts.some(node.parameters, containsReference) || @@ -64537,17 +64925,18 @@ var ts; return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments); } if (flags & 33554432 /* TypeFlags.Substitution */) { - var maybeVariable = instantiateType(type.baseType, mapper); - if (maybeVariable.flags & 8650752 /* TypeFlags.TypeVariable */) { - return getSubstitutionType(maybeVariable, instantiateType(type.substitute, mapper)); + var newBaseType = instantiateType(type.baseType, mapper); + var newConstraint = instantiateType(type.constraint, mapper); + // A substitution type originates in the true branch of a conditional type and can be resolved + // to just the base type in the same cases as the conditional type resolves to its true branch + // (because the base type is then known to satisfy the constraint). + if (newBaseType.flags & 8650752 /* TypeFlags.TypeVariable */ && isGenericType(newConstraint)) { + return getSubstitutionType(newBaseType, newConstraint); } - else { - var sub = instantiateType(type.substitute, mapper); - if (sub.flags & 3 /* TypeFlags.AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) { - return maybeVariable; - } - return sub; + if (newConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(newBaseType), getRestrictiveInstantiation(newConstraint))) { + return newBaseType; } + return newBaseType.flags & 8650752 /* TypeFlags.TypeVariable */ ? getSubstitutionType(newBaseType, newConstraint) : getIntersectionType([newConstraint, newBaseType]); } return type; } @@ -64596,35 +64985,35 @@ var ts; // Returns true if the given expression contains (at any level of nesting) a function or arrow expression // that is subject to contextual typing. function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type return isContextSensitiveFunctionLikeDeclaration(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return ts.some(node.properties, isContextSensitive); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return ts.some(node.elements, isContextSensitive); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ || node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */) && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return isContextSensitive(node.initializer); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isContextSensitive(node.expression); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return ts.some(node.properties, isContextSensitive) || ts.isJsxOpeningElement(node.parent) && ts.some(node.parent.parent.children, isContextSensitive); - case 285 /* SyntaxKind.JsxAttribute */: { + case 288 /* SyntaxKind.JsxAttribute */: { // If there is no initializer, JSX attribute has a boolean value of true which is not context sensitive. var initializer = node.initializer; return !!initializer && isContextSensitive(initializer); } - case 288 /* SyntaxKind.JsxExpression */: { + case 291 /* SyntaxKind.JsxExpression */: { // It is possible to that node.expression is undefined (e.g
) var expression = node.expression; return !!expression && isContextSensitive(expression); @@ -64633,15 +65022,14 @@ var ts; return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return (!ts.isFunctionDeclaration(node) || ts.isInJSFile(node) && !!getTypeForDeclarationFromJSDocComment(node)) && - (ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node)); + return ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node); } function hasContextSensitiveReturnExpression(node) { // TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value. - return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 235 /* SyntaxKind.Block */ && isContextSensitive(node.body); + return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 238 /* SyntaxKind.Block */ && isContextSensitive(node.body); } function isContextSensitiveFunctionOrObjectLiteralMethod(func) { - return (ts.isInJSFile(func) && ts.isFunctionDeclaration(func) || ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && + return (ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func); } function getTypeWithoutSignatures(type) { @@ -64742,23 +65130,23 @@ var ts; return true; } switch (node.kind) { - case 288 /* SyntaxKind.JsxExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 291 /* SyntaxKind.JsxExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (node.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: case 27 /* SyntaxKind.CommaToken */: return elaborateError(node.right, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); } break; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return elaborateJsxComponents(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return elaborateArrowFunction(node, source, target, relation, containingMessageChain, errorOutputContainer); } return false; @@ -64967,7 +65355,7 @@ var ts; } function getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic) { switch (child.kind) { - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: // child is of the type of the expression return { errorNode: child, innerExpression: child.expression, nameType: nameType }; case 11 /* SyntaxKind.JsxText */: @@ -64976,9 +65364,9 @@ var ts; } // child is a string return { errorNode: child, innerExpression: undefined, nameType: nameType, errorMessage: getInvalidTextDiagnostic() }; - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: // child is of type JSX.Element return { errorNode: child, innerExpression: child, nameType: nameType }; default: @@ -65126,11 +65514,11 @@ var ts; } _b = prop.kind; switch (_b) { - case 173 /* SyntaxKind.SetAccessor */: return [3 /*break*/, 2]; - case 172 /* SyntaxKind.GetAccessor */: return [3 /*break*/, 2]; - case 169 /* SyntaxKind.MethodDeclaration */: return [3 /*break*/, 2]; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: return [3 /*break*/, 2]; - case 296 /* SyntaxKind.PropertyAssignment */: return [3 /*break*/, 4]; + case 175 /* SyntaxKind.SetAccessor */: return [3 /*break*/, 2]; + case 174 /* SyntaxKind.GetAccessor */: return [3 /*break*/, 2]; + case 171 /* SyntaxKind.MethodDeclaration */: return [3 /*break*/, 2]; + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return [3 /*break*/, 2]; + case 299 /* SyntaxKind.PropertyAssignment */: return [3 /*break*/, 4]; } return [3 /*break*/, 6]; case 2: return [4 /*yield*/, { errorNode: prop.name, innerExpression: undefined, nameType: type }]; @@ -65203,8 +65591,8 @@ var ts; void instantiateType(sourceRestType || targetRestType, reportUnreliableMarkers); } var kind = target.declaration ? target.declaration.kind : 0 /* SyntaxKind.Unknown */; - var strictVariance = !(checkMode & 3 /* SignatureCheckMode.Callback */) && strictFunctionTypes && kind !== 169 /* SyntaxKind.MethodDeclaration */ && - kind !== 168 /* SyntaxKind.MethodSignature */ && kind !== 171 /* SyntaxKind.Constructor */; + var strictVariance = !(checkMode & 3 /* SignatureCheckMode.Callback */) && strictFunctionTypes && kind !== 171 /* SyntaxKind.MethodDeclaration */ && + kind !== 170 /* SyntaxKind.MethodSignature */ && kind !== 173 /* SyntaxKind.Constructor */; var result = -1 /* Ternary.True */; var sourceThisType = getThisTypeOfSignature(source); if (sourceThisType && sourceThisType !== voidType) { @@ -65501,7 +65889,7 @@ var ts; var t = isFreshLiteralType(type) ? type.regularType : ts.getObjectFlags(type) & 4 /* ObjectFlags.Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 /* TypeFlags.UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : - type.flags & 33554432 /* TypeFlags.Substitution */ ? writing ? type.baseType : type.substitute : + type.flags & 33554432 /* TypeFlags.Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 /* TypeFlags.Simplifiable */ ? getSimplifiedType(type, writing) : type; if (t === type) @@ -65908,7 +66296,8 @@ var ts; return 0 /* Ternary.False */; } } - var isPerformingCommonPropertyChecks = relation !== comparableRelation && !(intersectionState & 2 /* IntersectionState.Target */) && + var isPerformingCommonPropertyChecks = (relation !== comparableRelation || !(source.flags & 1048576 /* TypeFlags.Union */) && isLiteralType(source)) && + !(intersectionState & 2 /* IntersectionState.Target */) && source.flags & (131068 /* TypeFlags.Primitive */ | 524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && source !== globalObjectType && target.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && isWeakType(target) && (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source)); @@ -66067,7 +66456,7 @@ var ts; reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target); checkTypes = reducedTarget.flags & 1048576 /* TypeFlags.Union */ ? reducedTarget.types : [reducedTarget]; } - var _loop_20 = function (prop) { + var _loop_21 = function (prop) { if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) { if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) { if (reportErrors) { @@ -66130,9 +66519,9 @@ var ts; }; for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) { var prop = _b[_i]; - var state_6 = _loop_20(prop); - if (typeof state_6 === "object") - return state_6.value; + var state_7 = _loop_21(prop); + if (typeof state_7 === "object") + return state_7.value; } return false; } @@ -66160,11 +66549,15 @@ var ts; // parameter 'T extends 1 | 2', the intersection 'T & 1' should be reduced to '1' such that it doesn't // appear to be comparable to '2'. if (relation === comparableRelation && target.flags & 131068 /* TypeFlags.Primitive */) { - var constraints = ts.sameMap(source.types, getBaseConstraintOrType); + var constraints = ts.sameMap(source.types, function (t) { return t.flags & 465829888 /* TypeFlags.Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t; }); if (constraints !== source.types) { source = getIntersectionType(constraints); + if (source.flags & 131072 /* TypeFlags.Never */) { + return 0 /* Ternary.False */; + } if (!(source.flags & 2097152 /* TypeFlags.Intersection */)) { - return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false); + return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false) || + isRelatedTo(target, source, 1 /* RecursionFlags.Source */, /*reportErrors*/ false); } } } @@ -66482,7 +66875,7 @@ var ts; // the type param can be compared with itself in the target (with the influence of its constraint to match other parts) // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)` var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */)); - if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself + if (constraint && !(constraint.flags & 131072 /* TypeFlags.Never */) && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState); } @@ -66534,7 +66927,11 @@ var ts; } } if (sourceFlags & 33554432 /* TypeFlags.Substitution */) { - return isRelatedTo(source.substitute, target.substitute, 3 /* RecursionFlags.Both */, /*reportErrors*/ false); + if (result = isRelatedTo(source.baseType, target.baseType, 3 /* RecursionFlags.Both */, /*reportErrors*/ false)) { + if (result &= isRelatedTo(source.constraint, target.constraint, 3 /* RecursionFlags.Both */, /*reportErrors*/ false)) { + return result; + } + } } if (!(sourceFlags & 524288 /* TypeFlags.Object */)) { return 0 /* Ternary.False */; @@ -67115,11 +67512,11 @@ var ts; // constituents of 'target'. If any combination does not have a match then 'source' is not relatable. var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes); var matchingTypes = []; - var _loop_21 = function (combination) { + var _loop_22 = function (combination) { var hasMatch = false; outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) { var type = _d[_c]; - var _loop_22 = function (i) { + var _loop_23 = function (i) { var sourceProperty = sourcePropertiesFiltered[i]; var targetProperty = getPropertyOfType(type, sourceProperty.escapedName); if (!targetProperty) @@ -67135,8 +67532,8 @@ var ts; } }; for (var i = 0; i < sourcePropertiesFiltered.length; i++) { - var state_8 = _loop_22(i); - switch (state_8) { + var state_9 = _loop_23(i); + switch (state_9) { case "continue-outer": continue outer; } } @@ -67149,9 +67546,9 @@ var ts; }; for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) { var combination = discriminantCombinations_1[_a]; - var state_7 = _loop_21(combination); - if (typeof state_7 === "object") - return state_7.value; + var state_8 = _loop_22(combination); + if (typeof state_8 === "object") + return state_8.value; } // Compare the remaining non-discriminant properties of each match. var result = -1 /* Ternary.True */; @@ -67286,7 +67683,7 @@ var ts; shouldSkipElaboration = true; // Retain top-level error for interface implementing issues, otherwise omit it } if (props.length === 1) { - var propName = symbolToString(unmatchedProperty); + var propName = symbolToString(unmatchedProperty, /*enclosingDeclaration*/ undefined, 0 /* SymbolFlags.None */, 4 /* SymbolFormatFlags.AllowAnyNodeKind */ | 16 /* SymbolFormatFlags.WriteComputedProps */); reportError.apply(void 0, __spreadArray([ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName], getTypeNamesForErrorDisplay(source, target), false)); if (ts.length(unmatchedProperty.declarations)) { associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName)); @@ -67535,7 +67932,7 @@ var ts; var targetSignature = ts.first(targetSignatures); result = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors, incompatibleReporter(sourceSignature, targetSignature)); if (!result && reportErrors && kind === 1 /* SignatureKind.Construct */ && (sourceObjectFlags & targetObjectFlags) && - (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 171 /* SyntaxKind.Constructor */ || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 171 /* SyntaxKind.Constructor */)) { + (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 173 /* SyntaxKind.Constructor */ || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 173 /* SyntaxKind.Constructor */)) { var constructSignatureToString = function (signature) { return signatureToString(signature, /*enclosingDeclaration*/ undefined, 262144 /* TypeFormatFlags.WriteArrowStyleSignature */, kind); }; @@ -67856,7 +68253,7 @@ var ts; ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* tracing.Phase.CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) }); links.variances = ts.emptyArray; var variances = []; - var _loop_23 = function (tp) { + var _loop_24 = function (tp) { var modifiers = getVarianceModifiers(tp); var variance = modifiers & 65536 /* ModifierFlags.Out */ ? modifiers & 32768 /* ModifierFlags.In */ ? 0 /* VarianceFlags.Invariant */ : 1 /* VarianceFlags.Covariant */ : @@ -67894,7 +68291,7 @@ var ts; }; for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) { var tp = typeParameters_2[_i]; - _loop_23(tp); + _loop_24(tp); } links.variances = variances; ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) }); @@ -68300,7 +68697,7 @@ var ts; var baseTypeNode = getBaseTypeNodeOfClass(target); // A base type expression may circularly reference the class itself (e.g. as an argument to function call), so we only // check for base types specified as simple qualified names. - if (baseTypeNode && baseTypeNode.expression.kind !== 79 /* SyntaxKind.Identifier */ && baseTypeNode.expression.kind !== 206 /* SyntaxKind.PropertyAccessExpression */) { + if (baseTypeNode && baseTypeNode.expression.kind !== 79 /* SyntaxKind.Identifier */ && baseTypeNode.expression.kind !== 208 /* SyntaxKind.PropertyAccessExpression */) { return undefined; } } @@ -68391,7 +68788,7 @@ var ts; if (!isLiteralOfContextualType(type, contextualType)) { type = getWidenedUniqueESSymbolType(getWidenedLiteralType(type)); } - return type; + return getRegularTypeOfLiteralType(type); } function getWidenedLiteralLikeTypeForContextualReturnTypeIfNeeded(type, contextualSignatureReturnType, isAsync) { if (type && isUnitType(type)) { @@ -68486,7 +68883,8 @@ var ts; function getOptionalType(type, isProperty) { if (isProperty === void 0) { isProperty = false; } ts.Debug.assert(strictNullChecks); - return type.flags & 32768 /* TypeFlags.Undefined */ ? type : getUnionType([type, isProperty ? missingType : undefinedType]); + var missingOrUndefined = isProperty ? missingType : undefinedType; + return type.flags & 32768 /* TypeFlags.Undefined */ || type.flags & 1048576 /* TypeFlags.Union */ && type.types[0] === missingOrUndefined ? type : getUnionType([type, missingOrUndefined]); } function getGlobalNonNullableTypeInstantiation(type) { if (!deferredGlobalNonNullableTypeAlias) { @@ -68775,12 +69173,12 @@ var ts; } var diagnostic; switch (declaration.kind) { - case 221 /* SyntaxKind.BinaryExpression */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 223 /* SyntaxKind.BinaryExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: diagnostic = noImplicitAny ? ts.Diagnostics.Member_0_implicitly_has_an_1_type : ts.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: var param = declaration; if (ts.isIdentifier(param.name) && (ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) && @@ -68796,23 +69194,23 @@ var ts; noImplicitAny ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage : noImplicitAny ? ts.Diagnostics.Parameter_0_implicitly_has_an_1_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; if (!noImplicitAny) { // Don't issue a suggestion for binding elements since the codefix doesn't yet support them. return; } break; - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: error(declaration, ts.Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (noImplicitAny && !declaration.name) { if (wideningKind === 3 /* WideningKind.GeneratorYield */) { error(declaration, ts.Diagnostics.Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation, typeAsString); @@ -68826,7 +69224,7 @@ var ts; wideningKind === 3 /* WideningKind.GeneratorYield */ ? ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type : ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; break; - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: if (noImplicitAny) { error(declaration, ts.Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type); } @@ -68943,7 +69341,7 @@ var ts; if (context.intraExpressionInferenceSites) { for (var _i = 0, _a = context.intraExpressionInferenceSites; _i < _a.length; _i++) { var _b = _a[_i], node = _b.node, type = _b.type; - var contextualType = node.kind === 169 /* SyntaxKind.MethodDeclaration */ ? + var contextualType = node.kind === 171 /* SyntaxKind.MethodDeclaration */ ? getContextualTypeForObjectLiteralMethod(node, 2 /* ContextFlags.NoConstraints */) : getContextualType(node, 2 /* ContextFlags.NoConstraints */); if (contextualType) { @@ -69006,8 +69404,8 @@ var ts; } function isNonGenericTopLevelType(type) { if (type.aliasSymbol && !type.aliasTypeArguments) { - var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 259 /* SyntaxKind.TypeAliasDeclaration */); - return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 305 /* SyntaxKind.SourceFile */ ? true : n.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? false : "quit"; })); + var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 262 /* SyntaxKind.TypeAliasDeclaration */); + return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 308 /* SyntaxKind.SourceFile */ ? true : n.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? false : "quit"; })); } return false; } @@ -69465,7 +69863,10 @@ var ts; // // This flag is infectious; if we produce Box (where never is silentNeverType), Box is // also non-inferrable. - if (ts.getObjectFlags(source) & 262144 /* ObjectFlags.NonInferrableType */) { + // + // As a special case, also ignore nonInferrableAnyType, which is a special form of the any type + // used as a stand-in for binding elements when they are being inferred. + if (ts.getObjectFlags(source) & 262144 /* ObjectFlags.NonInferrableType */ || source === nonInferrableAnyType) { return; } if (!inference.isFixed) { @@ -69538,7 +69939,7 @@ var ts; } else if (source.flags & 33554432 /* TypeFlags.Substitution */) { inferFromTypes(source.baseType, target); - inferWithPriority(source.substitute, target, 4 /* InferencePriority.SubstituteSource */); // Make substitute inference at a lower priority + inferWithPriority(getSubstitutionIntersection(source), target, 4 /* InferencePriority.SubstituteSource */); // Make substitute inference at a lower priority } else if (target.flags & 16777216 /* TypeFlags.Conditional */) { invokeOnce(source, target, inferToConditionalType); @@ -69848,7 +70249,7 @@ var ts; // upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might // succeed. That would be a pointless and confusing outcome. if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) { - var _loop_24 = function (i) { + var _loop_25 = function (i) { var source_1 = matches ? matches[i] : neverType; var target_3 = types[i]; // If we are inferring from a string literal type to a type variable whose constraint includes one of the @@ -69898,7 +70299,7 @@ var ts; inferFromTypes(source_1, target_3); }; for (var i = 0; i < types.length; i++) { - _loop_24(i); + _loop_25(i); } } } @@ -70020,7 +70421,7 @@ var ts; var saveBivariant = bivariant; var kind = target.declaration ? target.declaration.kind : 0 /* SyntaxKind.Unknown */; // Once we descend into a bivariant signature we remain bivariant for all nested inferences - bivariant = bivariant || kind === 169 /* SyntaxKind.MethodDeclaration */ || kind === 168 /* SyntaxKind.MethodSignature */ || kind === 171 /* SyntaxKind.Constructor */; + bivariant = bivariant || kind === 171 /* SyntaxKind.MethodDeclaration */ || kind === 170 /* SyntaxKind.MethodSignature */ || kind === 173 /* SyntaxKind.Constructor */; applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes); bivariant = saveBivariant; applyToReturnTypes(source, target, inferFromTypes); @@ -70219,7 +70620,7 @@ var ts; } // falls through default: - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer; } else { @@ -70240,7 +70641,7 @@ var ts; // TypeScript 1.0 spec (April 2014): 3.6.3 // A type query consists of the keyword typeof followed by an expression. // The expression is restricted to a single identifier or a sequence of identifiers separated by periods - return !!ts.findAncestor(node, function (n) { return n.kind === 181 /* SyntaxKind.TypeQuery */ ? true : n.kind === 79 /* SyntaxKind.Identifier */ || n.kind === 161 /* SyntaxKind.QualifiedName */ ? false : "quit"; }); + return !!ts.findAncestor(node, function (n) { return n.kind === 183 /* SyntaxKind.TypeQuery */ ? true : n.kind === 79 /* SyntaxKind.Identifier */ || n.kind === 163 /* SyntaxKind.QualifiedName */ ? false : "quit"; }); } // Return the flow cache key for a "dotted name" (i.e. a sequence of identifiers // separated by dots). The key consists of the id of the symbol referenced by the @@ -70256,26 +70657,26 @@ var ts; // falls through case 108 /* SyntaxKind.ThisKeyword */: return "0|".concat(flowContainer ? getNodeId(flowContainer) : "-1", "|").concat(getTypeId(declaredType), "|").concat(getTypeId(initialType)); - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: var left = getFlowCacheKey(node.left, declaredType, initialType, flowContainer); return left && left + "." + node.right.escapedText; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var propName = getAccessedPropertyName(node); if (propName !== undefined) { var key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); return key && key + "." + propName; } break; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: // Handle pseudo-references originating in getNarrowedTypeOfSymbol. return "".concat(getNodeId(node), "#").concat(getTypeId(declaredType)); } @@ -70283,16 +70684,16 @@ var ts; } function isMatchingReference(source, target) { switch (target.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return isMatchingReference(source, target.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (ts.isAssignmentExpression(target) && isMatchingReference(source, target.left)) || (ts.isBinaryExpression(target) && target.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && isMatchingReference(source, target.right)); } switch (source.kind) { - case 231 /* SyntaxKind.MetaProperty */: - return target.kind === 231 /* SyntaxKind.MetaProperty */ + case 233 /* SyntaxKind.MetaProperty */: + return target.kind === 233 /* SyntaxKind.MetaProperty */ && source.keywordToken === target.keywordToken && source.name.escapedText === target.name.escapedText; case 79 /* SyntaxKind.Identifier */: @@ -70300,26 +70701,26 @@ var ts; return ts.isThisInTypeQuery(source) ? target.kind === 108 /* SyntaxKind.ThisKeyword */ : target.kind === 79 /* SyntaxKind.Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 254 /* SyntaxKind.VariableDeclaration */ || target.kind === 203 /* SyntaxKind.BindingElement */) && + (target.kind === 257 /* SyntaxKind.VariableDeclaration */ || target.kind === 205 /* SyntaxKind.BindingElement */) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 108 /* SyntaxKind.ThisKeyword */: return target.kind === 108 /* SyntaxKind.ThisKeyword */; case 106 /* SyntaxKind.SuperKeyword */: return target.kind === 106 /* SyntaxKind.SuperKeyword */; - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isMatchingReference(source.expression, target); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var sourcePropertyName = getAccessedPropertyName(source); var targetPropertyName = ts.isAccessExpression(target) ? getAccessedPropertyName(target) : undefined; return sourcePropertyName !== undefined && targetPropertyName !== undefined && targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return ts.isAccessExpression(target) && source.right.escapedText === getAccessedPropertyName(target) && isMatchingReference(source.left, target.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (ts.isBinaryExpression(source) && source.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && isMatchingReference(source.right, target)); } return false; @@ -70362,7 +70763,7 @@ var ts; return name; } } - if (ts.hasOnlyExpressionInitializer(declaration)) { + if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) { var initializer = ts.getEffectiveInitializer(declaration); return initializer && tryGetNameFromType(getTypeOfExpression(initializer)); } @@ -70422,7 +70823,7 @@ var ts; function mapTypesByKeyProperty(types, name) { var map = new ts.Map(); var count = 0; - var _loop_25 = function (type) { + var _loop_26 = function (type) { if (type.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */)) { var discriminant = getTypeOfPropertyOfType(type, name); if (discriminant) { @@ -70448,9 +70849,9 @@ var ts; }; for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { var type = types_15[_i]; - var state_9 = _loop_25(type); - if (typeof state_9 === "object") - return state_9.value; + var state_10 = _loop_26(type); + if (typeof state_10 === "object") + return state_10.value; } return count >= 10 && count * 2 >= types.length ? map : undefined; } @@ -70491,7 +70892,7 @@ var ts; } function getMatchingUnionConstituentForObjectLiteral(unionType, node) { var keyPropertyName = getKeyPropertyName(unionType); - var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 296 /* SyntaxKind.PropertyAssignment */ && + var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 299 /* SyntaxKind.PropertyAssignment */ && p.symbol.escapedName === keyPropertyName && isPossiblyDiscriminantValue(p.initializer); }); var propType = propNode && getContextFreeTypeOfExpression(propNode.initializer); return propType && getConstituentTypeForKeyType(unionType, propType); @@ -70508,7 +70909,7 @@ var ts; } } } - if (expression.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + if (expression.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isOrContainsMatchingReference(reference, expression.expression.expression)) { return true; } @@ -70708,15 +71109,15 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(65 /* IterationUse.Destructuring */, type, undefinedType, /*errorNode*/ undefined) || errorType); } function getAssignedTypeOfBinaryExpression(node) { - var isDestructuringDefaultAssignment = node.parent.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || - node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); + var isDestructuringDefaultAssignment = node.parent.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || + node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } function isDestructuringAssignmentTarget(parent) { - return parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.parent.left === parent || - parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */ && parent.parent.initializer === parent; + return parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.parent.left === parent || + parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */ && parent.parent.initializer === parent; } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element)); @@ -70733,21 +71134,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return stringType; - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return checkRightHandSideOfForOf(parent) || errorType; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return getAssignedTypeOfBinaryExpression(parent); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return undefinedType; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return getAssignedTypeOfSpreadExpression(parent); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return errorType; @@ -70755,7 +71156,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ ? + var type = pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) : @@ -70773,30 +71174,30 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (node.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { return stringType; } - if (node.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { return checkRightHandSideOfForOf(node.parent.parent) || errorType; } return errorType; } function getInitialType(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function isEmptyArrayAssignment(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.initializer && + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 203 /* SyntaxKind.BindingElement */ && node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + node.kind !== 205 /* SyntaxKind.BindingElement */ && node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getReferenceCandidate(node.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (node.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: case 75 /* SyntaxKind.BarBarEqualsToken */: @@ -70811,13 +71212,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */ || - parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.left === node || - parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && parent.right === node ? + return parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || + parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.left === node || + parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { return getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); } return neverType; @@ -70836,13 +71237,13 @@ var ts; // Get the type names from all cases in a switch on `typeof`. The default clause and/or duplicate type names are // represented as undefined. Return undefined if one or more case clause expressions are not string literals. function getSwitchClauseTypeOfWitnesses(switchStatement) { - if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 289 /* SyntaxKind.CaseClause */ && !ts.isStringLiteralLike(clause.expression); })) { + if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 292 /* SyntaxKind.CaseClause */ && !ts.isStringLiteralLike(clause.expression); })) { return undefined; } var witnesses = []; for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) { var clause = _a[_i]; - var text = clause.kind === 289 /* SyntaxKind.CaseClause */ ? clause.expression.text : undefined; + var text = clause.kind === 292 /* SyntaxKind.CaseClause */ ? clause.expression.text : undefined; witnesses.push(text && !ts.contains(witnesses, text) ? text : undefined); } return witnesses; @@ -71029,12 +71430,12 @@ var ts; var root = getReferenceRoot(node); var parent = root.parent; var isLengthPushOrUnshift = ts.isPropertyAccessExpression(parent) && (parent.name.escapedText === "length" || - parent.parent.kind === 208 /* SyntaxKind.CallExpression */ + parent.parent.kind === 210 /* SyntaxKind.CallExpression */ && ts.isIdentifier(parent.name) && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && + var isElementAssignment = parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && parent.expression === root && - parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -71062,7 +71463,7 @@ var ts; if (isDeclarationWithExplicitTypeAnnotation(declaration)) { return getTypeOfSymbol(symbol); } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { var statement = declaration.parent.parent; var expressionType = getTypeOfDottedName(statement.expression, /*diagnostic*/ undefined); if (expressionType) { @@ -71090,7 +71491,7 @@ var ts; return getExplicitThisType(node); case 106 /* SyntaxKind.SuperKeyword */: return checkSuperExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: { + case 208 /* SyntaxKind.PropertyAccessExpression */: { var type = getTypeOfDottedName(node.expression, diagnostic); if (type) { var name = node.name; @@ -71108,7 +71509,7 @@ var ts; } return undefined; } - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getTypeOfDottedName(node.expression, diagnostic); } } @@ -71122,7 +71523,7 @@ var ts; // circularities in control flow analysis, we use getTypeOfDottedName when resolving the call // target expression of an assertion. var funcType = void 0; - if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */) { + if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */) { funcType = getTypeOfDottedName(node.expression, /*diagnostic*/ undefined); } else if (node.expression.kind !== 106 /* SyntaxKind.SuperKeyword */) { @@ -71166,7 +71567,7 @@ var ts; } function isFalseExpression(expr) { var node = ts.skipParentheses(expr, /*excludeJSDocTypeAssertions*/ true); - return node.kind === 95 /* SyntaxKind.FalseKeyword */ || node.kind === 221 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ && (isFalseExpression(node.left) || isFalseExpression(node.right)) || + return node.kind === 95 /* SyntaxKind.FalseKeyword */ || node.kind === 223 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ && (isFalseExpression(node.left) || isFalseExpression(node.right)) || node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ && isFalseExpression(node.left) && isFalseExpression(node.right)); } function isReachableFlowNodeWorker(flow, noCacheCheck) { @@ -71287,8 +71688,8 @@ var ts; var symbol = getResolvedSymbol(node); return isConstVariable(symbol) || ts.isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol); } - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // The resolvedSymbol property is initialized by checkPropertyAccess or checkElementAccess before we get here. return isConstantReference(node.expression) && isReadonlySymbol(getNodeLinks(node).resolvedSymbol || unknownSymbol); } @@ -71315,7 +71716,7 @@ var ts; // on empty arrays are possible without implicit any errors and new element types can be inferred without // type mismatch errors. var resultType = ts.getObjectFlags(evolvedType) & 256 /* ObjectFlags.EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType); - if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 230 /* SyntaxKind.NonNullExpression */ && !(resultType.flags & 131072 /* TypeFlags.Never */) && getTypeWithFacts(resultType, 2097152 /* TypeFacts.NEUndefinedOrNull */).flags & 131072 /* TypeFlags.Never */) { + if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 232 /* SyntaxKind.NonNullExpression */ && !(resultType.flags & 131072 /* TypeFlags.Never */) && getTypeWithFacts(resultType, 2097152 /* TypeFacts.NEUndefinedOrNull */).flags & 131072 /* TypeFlags.Never */) { return declaredType; } // The non-null unknown type should never escape control flow analysis. @@ -71400,8 +71801,8 @@ var ts; // Check if we should continue with the control flow of the containing function. var container = flow.node; if (container && container !== flowContainer && - reference.kind !== 206 /* SyntaxKind.PropertyAccessExpression */ && - reference.kind !== 207 /* SyntaxKind.ElementAccessExpression */ && + reference.kind !== 208 /* SyntaxKind.PropertyAccessExpression */ && + reference.kind !== 209 /* SyntaxKind.ElementAccessExpression */ && reference.kind !== 108 /* SyntaxKind.ThisKeyword */) { flow = container.flowNode; continue; @@ -71426,7 +71827,7 @@ var ts; } function getInitialOrAssignedType(flow) { var node = flow.node; - return getNarrowableTypeForReference(node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */ ? + return getNarrowableTypeForReference(node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */ ? getInitialType(node) : getAssignedType(node), reference); } @@ -71466,14 +71867,14 @@ var ts; // in which case we continue control flow analysis back to the function's declaration if (ts.isVariableDeclaration(node) && (ts.isInJSFile(node) || ts.isVarConst(node))) { var init = ts.getDeclaredExpandoInitializer(node); - if (init && (init.kind === 213 /* SyntaxKind.FunctionExpression */ || init.kind === 214 /* SyntaxKind.ArrowFunction */)) { + if (init && (init.kind === 215 /* SyntaxKind.FunctionExpression */ || init.kind === 216 /* SyntaxKind.ArrowFunction */)) { return getTypeAtFlowNode(flow.antecedent); } } return declaredType; } // for (const _ in ref) acts as a nonnull on ref - if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) { + if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) { return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)))); } // Assignment doesn't affect reference @@ -71484,7 +71885,7 @@ var ts; if (node.kind === 95 /* SyntaxKind.FalseKeyword */) { return unreachableNeverType; } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */) { if (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */) { return narrowTypeByAssertion(narrowTypeByAssertion(type, node.left), node.right); } @@ -71515,7 +71916,7 @@ var ts; function getTypeAtFlowArrayMutation(flow) { if (declaredType === autoType || declaredType === autoArrayType) { var node = flow.node; - var expr = node.kind === 208 /* SyntaxKind.CallExpression */ ? + var expr = node.kind === 210 /* SyntaxKind.CallExpression */ ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -71523,7 +71924,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (ts.getObjectFlags(type) & 256 /* ObjectFlags.EvolvingArray */) { var evolvedType_1 = type; - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -71571,7 +71972,7 @@ var ts; if (isMatchingReference(reference, expr)) { type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } - else if (expr.kind === 216 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { + else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } else { @@ -71579,7 +71980,7 @@ var ts; if (optionalChainContainsReference(expr, reference)) { type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & (32768 /* TypeFlags.Undefined */ | 131072 /* TypeFlags.Never */)); }); } - else if (expr.kind === 216 /* SyntaxKind.TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { + else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & 131072 /* TypeFlags.Never */ || t.flags & 128 /* TypeFlags.StringLiteral */ && t.value === "undefined"); }); } } @@ -71807,7 +72208,7 @@ var ts; var narrowedPropType = narrowType(propType); return filterType(type, function (t) { var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName); - return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType); + return !(discriminantType.flags & 131072 /* TypeFlags.Never */) && !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType); }); } function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) { @@ -71849,18 +72250,26 @@ var ts; } function isTypePresencePossible(type, propName, assumeTrue) { var prop = getPropertyOfType(type, propName); - if (prop) { - return prop.flags & 16777216 /* SymbolFlags.Optional */ ? true : assumeTrue; - } - return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue; + return prop ? + !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue : + !!getApplicableIndexInfoForName(type, propName) || !assumeTrue; } - function narrowByInKeyword(type, name, assumeTrue) { - if (type.flags & 1048576 /* TypeFlags.Union */ - || type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type)) - || ts.isThisTypeParameter(type) - || type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) { + function narrowByInKeyword(type, nameType, assumeTrue) { + var name = getPropertyNameFromType(nameType); + var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); }); + if (isKnownProperty) { + // If the check is for a known property (i.e. a property declared in some constituent of + // the target type), we filter the target type by presence of absence of the property. return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); }); } + if (assumeTrue) { + // If the check is for an unknown property, we intersect the target type with `Record`, + // where X is the name of the property. + var recordSymbol = getGlobalRecordSymbol(); + if (recordSymbol) { + return getIntersectionType([type, getTypeAliasInstantiation(recordSymbol, [nameType, unknownType])]); + } + } return type; } function narrowTypeByBinaryExpression(type, expr, assumeTrue) { @@ -71877,10 +72286,10 @@ var ts; var operator = expr.operatorToken.kind; var left = getReferenceCandidate(expr.left); var right = getReferenceCandidate(expr.right); - if (left.kind === 216 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(right)) { + if (left.kind === 218 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(right)) { return narrowTypeByTypeof(type, left, operator, right, assumeTrue); } - if (right.kind === 216 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(left)) { + if (right.kind === 218 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(left)) { return narrowTypeByTypeof(type, right, operator, left, assumeTrue); } if (isMatchingReference(reference, left)) { @@ -71919,15 +72328,14 @@ var ts; return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue); } var target = getReferenceCandidate(expr.right); - var leftType = getTypeOfNode(expr.left); - if (leftType.flags & 128 /* TypeFlags.StringLiteral */) { - var name = ts.escapeLeadingUnderscores(leftType.value); + var leftType = getTypeOfExpression(expr.left); + if (leftType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */) { if (containsMissingType(type) && ts.isAccessExpression(reference) && isMatchingReference(reference.expression, target) && - getAccessedPropertyName(reference) === name) { + getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) { return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */); } if (isMatchingReference(reference, target)) { - return narrowByInKeyword(type, name, assumeTrue); + return narrowByInKeyword(type, leftType, assumeTrue); } } break; @@ -71989,24 +72397,11 @@ var ts; assumeTrue = !assumeTrue; } var valueType = getTypeOfExpression(value); - if (((type.flags & 2 /* TypeFlags.Unknown */) || isEmptyAnonymousObjectType(type) && !(valueType.flags & 98304 /* TypeFlags.Nullable */)) && - assumeTrue && - (operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */)) { - if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */)) { - return valueType; - } - if (valueType.flags & 524288 /* TypeFlags.Object */) { - return nonPrimitiveType; - } - if (type.flags & 2 /* TypeFlags.Unknown */) { - return type; - } - } + var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */; if (valueType.flags & 98304 /* TypeFlags.Nullable */) { if (!strictNullChecks) { return type; } - var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */; var facts = doubleEquals ? assumeTrue ? 262144 /* TypeFacts.EQUndefinedOrNull */ : 2097152 /* TypeFacts.NEUndefinedOrNull */ : valueType.flags & 65536 /* TypeFlags.Null */ ? @@ -72015,10 +72410,16 @@ var ts; return getAdjustedTypeWithFacts(type, facts); } if (assumeTrue) { - var filterFn = operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? - function (t) { return areTypesComparable(t, valueType) || isCoercibleUnderDoubleEquals(t, valueType); } : - function (t) { return areTypesComparable(t, valueType); }; - return replacePrimitivesWithLiterals(filterType(type, filterFn), valueType); + if (!doubleEquals && (type.flags & 2 /* TypeFlags.Unknown */ || someType(type, isEmptyAnonymousObjectType))) { + if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) { + return valueType; + } + if (valueType.flags & 524288 /* TypeFlags.Object */) { + return nonPrimitiveType; + } + } + var filteredType = filterType(type, function (t) { return areTypesComparable(t, valueType) || doubleEquals && isCoercibleUnderDoubleEquals(t, valueType); }); + return replacePrimitivesWithLiterals(filteredType, valueType); } if (isUnitType(valueType)) { return filterType(type, function (t) { return !(isUnitLikeType(t) && areTypesComparable(t, valueType)); }); @@ -72032,11 +72433,18 @@ var ts; } var target = getReferenceCandidate(typeOfExpr.expression); if (!isMatchingReference(reference, target)) { + var propertyAccess = getDiscriminantPropertyAccess(typeOfExpr.expression, type); + if (propertyAccess) { + return narrowTypeByDiscriminant(type, propertyAccess, function (t) { return narrowTypeByLiteralExpression(t, literal, assumeTrue); }); + } if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) { return getAdjustedTypeWithFacts(type, 2097152 /* TypeFacts.NEUndefinedOrNull */); } return type; } + return narrowTypeByLiteralExpression(type, literal, assumeTrue); + } + function narrowTypeByLiteralExpression(type, literal, assumeTrue) { return assumeTrue ? narrowTypeByTypeName(type, literal.text) : getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768 /* TypeFacts.TypeofNEHostObject */); @@ -72122,7 +72530,7 @@ var ts; return type; } // Equal start and end denotes implicit fallthrough; undefined marks explicit default clause. - var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 290 /* SyntaxKind.DefaultClause */; }); + var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 293 /* SyntaxKind.DefaultClause */; }); var hasDefaultClause = clauseStart === clauseEnd || (defaultIndex >= clauseStart && defaultIndex < clauseEnd); if (hasDefaultClause) { // In the default clause we filter constituents down to those that are not-equal to all handled cases. @@ -72326,17 +72734,17 @@ var ts; // falls through case 108 /* SyntaxKind.ThisKeyword */: case 106 /* SyntaxKind.SuperKeyword */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return narrowTypeByCallExpression(type, expr, assumeTrue); - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return narrowType(type, expr.expression, assumeTrue); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: if (expr.operator === 53 /* SyntaxKind.ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -72385,9 +72793,9 @@ var ts; function getControlFlowContainer(node) { return ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 262 /* SyntaxKind.ModuleBlock */ || - node.kind === 305 /* SyntaxKind.SourceFile */ || - node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + node.kind === 265 /* SyntaxKind.ModuleBlock */ || + node.kind === 308 /* SyntaxKind.SourceFile */ || + node.kind === 169 /* SyntaxKind.PropertyDeclaration */; }); } // Check if a parameter or catch variable is assigned anywhere @@ -72430,7 +72838,7 @@ var ts; function removeOptionalityFromDeclaredType(declaredType, declaration) { if (pushTypeResolution(declaration.symbol, 2 /* TypeSystemPropertyName.DeclaredType */)) { var annotationIncludesUndefined = strictNullChecks && - declaration.kind === 164 /* SyntaxKind.Parameter */ && + declaration.kind === 166 /* SyntaxKind.Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* TypeFacts.IsUndefined */ && !(getTypeFacts(checkExpression(declaration.initializer)) & 16777216 /* TypeFacts.IsUndefined */); @@ -72447,10 +72855,10 @@ var ts; // In an element access obj[x], we consider obj to be in a constraint position, except when obj is of // a generic type without a nullable constraint and x is a generic type. This is because when both obj // and x are of generic types T and K, we want the resulting type to be T[K]. - return parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - parent.kind === 161 /* SyntaxKind.QualifiedName */ || - parent.kind === 208 /* SyntaxKind.CallExpression */ && parent.expression === node || - parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && parent.expression === node && + return parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + parent.kind === 163 /* SyntaxKind.QualifiedName */ || + parent.kind === 210 /* SyntaxKind.CallExpression */ && parent.expression === node || + parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && parent.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression))); } function isGenericTypeWithUnionConstraint(type) { @@ -72549,15 +72957,16 @@ var ts; // destructuring from the narrowed parent type. if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) { var parent = declaration.parent.parent; - if (parent.kind === 254 /* SyntaxKind.VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* NodeFlags.Const */ || parent.kind === 164 /* SyntaxKind.Parameter */) { + if (parent.kind === 257 /* SyntaxKind.VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* NodeFlags.Const */ || parent.kind === 166 /* SyntaxKind.Parameter */) { var links = getNodeLinks(parent); if (!(links.flags & 268435456 /* NodeCheckFlags.InCheckIdentifier */)) { links.flags |= 268435456 /* NodeCheckFlags.InCheckIdentifier */; var parentType = getTypeForBindingElementParent(parent, 0 /* CheckMode.Normal */); + var parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType); links.flags &= ~268435456 /* NodeCheckFlags.InCheckIdentifier */; - if (parentType && parentType.flags & 1048576 /* TypeFlags.Union */ && !(parent.kind === 164 /* SyntaxKind.Parameter */ && isSymbolAssigned(symbol))) { + if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* TypeFlags.Union */ && !(parent.kind === 166 /* SyntaxKind.Parameter */ && isSymbolAssigned(symbol))) { var pattern = declaration.parent; - var narrowedType = getFlowTypeOfReference(pattern, parentType, parentType, /*flowContainer*/ undefined, location.flowNode); + var narrowedType = getFlowTypeOfReference(pattern, parentTypeConstraint, parentTypeConstraint, /*flowContainer*/ undefined, location.flowNode); if (narrowedType.flags & 131072 /* TypeFlags.Never */) { return neverType; } @@ -72624,10 +73033,10 @@ var ts; } var container = ts.getContainingFunction(node); if (languageVersion < 2 /* ScriptTarget.ES2015 */) { - if (container.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (container.kind === 216 /* SyntaxKind.ArrowFunction */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } - else if (ts.hasSyntacticModifier(container, 256 /* ModifierFlags.Async */)) { + else if (ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); } } @@ -72647,7 +73056,7 @@ var ts; // Due to the emit for class decorators, any reference to the class from inside of the class body // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind // behavior of class names in ES6. - if (declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ + if (declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ && ts.nodeIsDecorated(declaration)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -72659,12 +73068,12 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration.kind === 226 /* SyntaxKind.ClassExpression */) { + else if (declaration.kind === 228 /* SyntaxKind.ClassExpression */) { // When we emit a class expression with static members that contain a reference // to the constructor in the initializer, we will need to substitute that // binding with an alias as the class name is not in scope. var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); - while (container.kind !== 305 /* SyntaxKind.SourceFile */) { + while (container.kind !== 308 /* SyntaxKind.SourceFile */) { if (container.parent === declaration) { if (ts.isPropertyDeclaration(container) && ts.isStatic(container) || ts.isClassStaticBlockDeclaration(container)) { getNodeLinks(declaration).flags |= 16777216 /* NodeCheckFlags.ClassWithConstructorReference */; @@ -72722,7 +73131,7 @@ var ts; // The declaration container is the innermost function that encloses the declaration of the variable // or parameter. The flow container is the innermost function starting with which we analyze the control // flow graph to determine the control flow based type. - var isParameter = ts.getRootDeclaration(declaration).kind === 164 /* SyntaxKind.Parameter */; + var isParameter = ts.getRootDeclaration(declaration).kind === 166 /* SyntaxKind.Parameter */; var declarationContainer = getControlFlowContainer(declaration); var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; @@ -72731,8 +73140,8 @@ var ts; // When the control flow originates in a function expression or arrow function and we are referencing // a const variable or parameter from an outer function, we extend the origin of the control flow // analysis to include the immediately enclosing function. - while (flowContainer !== declarationContainer && (flowContainer.kind === 213 /* SyntaxKind.FunctionExpression */ || - flowContainer.kind === 214 /* SyntaxKind.ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 215 /* SyntaxKind.FunctionExpression */ || + flowContainer.kind === 216 /* SyntaxKind.ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter && !isSymbolAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } @@ -72741,9 +73150,9 @@ var ts; // declaration container are the same). var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || ts.isBindingElement(declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* TypeFlags.AnyOrUnknown */ | 16384 /* TypeFlags.Void */)) !== 0 || - isInTypeQuery(node) || node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) || - node.parent.kind === 230 /* SyntaxKind.NonNullExpression */ || - declaration.kind === 254 /* SyntaxKind.VariableDeclaration */ && declaration.exclamationToken || + isInTypeQuery(node) || node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) || + node.parent.kind === 232 /* SyntaxKind.NonNullExpression */ || + declaration.kind === 257 /* SyntaxKind.VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* NodeFlags.Ambient */; var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) : type === autoType || type === autoArrayType ? undefinedType : @@ -72801,7 +73210,7 @@ var ts; (symbol.flags & (2 /* SymbolFlags.BlockScopedVariable */ | 32 /* SymbolFlags.Class */)) === 0 || !symbol.valueDeclaration || ts.isSourceFile(symbol.valueDeclaration) || - symbol.valueDeclaration.parent.kind === 292 /* SyntaxKind.CatchClause */) { + symbol.valueDeclaration.parent.kind === 295 /* SyntaxKind.CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -72816,7 +73225,7 @@ var ts; // mark iteration statement as containing block-scoped binding captured in some function var capturesBlockScopeBindingInLoopBody = true; if (ts.isForStatement(container)) { - var varDeclList = ts.getAncestor(symbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); + var varDeclList = ts.getAncestor(symbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); if (varDeclList && varDeclList.parent === container) { var part = getPartOfForStatementContainingNode(node.parent, container); if (part) { @@ -72837,7 +73246,7 @@ var ts; // mark variables that are declared in loop initializer and reassigned inside the body of ForStatement. // if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back. if (ts.isForStatement(container)) { - var varDeclList = ts.getAncestor(symbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); + var varDeclList = ts.getAncestor(symbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); if (varDeclList && varDeclList.parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 4194304 /* NodeCheckFlags.NeedsLoopOutParameter */; } @@ -72856,7 +73265,7 @@ var ts; function isAssignedInBodyOfForStatement(node, container) { // skip parenthesized nodes var current = node; - while (current.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (current.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { current = current.parent; } // check if node is used as LHS in some assignment expression @@ -72864,7 +73273,7 @@ var ts; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || current.parent.kind === 220 /* SyntaxKind.PostfixUnaryExpression */)) { + else if ((current.parent.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || current.parent.kind === 222 /* SyntaxKind.PostfixUnaryExpression */)) { var expr = current.parent; isAssigned = expr.operator === 45 /* SyntaxKind.PlusPlusToken */ || expr.operator === 46 /* SyntaxKind.MinusMinusToken */; } @@ -72877,7 +73286,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* NodeCheckFlags.LexicalThis */; - if (container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || container.kind === 171 /* SyntaxKind.Constructor */) { + if (container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || container.kind === 173 /* SyntaxKind.Constructor */) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* NodeCheckFlags.CaptureThis */; } @@ -72924,31 +73333,31 @@ var ts; // tell whether 'this' needs to be captured. var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var capturedByArrowFunction = false; - if (container.kind === 171 /* SyntaxKind.Constructor */) { + if (container.kind === 173 /* SyntaxKind.Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (container.kind === 216 /* SyntaxKind.ArrowFunction */) { container = ts.getThisContainer(container, /* includeArrowFunctions */ false); capturedByArrowFunction = true; } checkThisInStaticClassFieldInitializerInDecoratedClass(node, container); switch (container.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks } break; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -73036,7 +73445,7 @@ var ts; } function getClassNameFromPrototypeMethod(container) { // Check if it's the RHS of a x.prototype.y = function [name]() { .... } - if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && + if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && ts.isBinaryExpression(container.parent) && ts.getAssignmentDeclarationKind(container.parent) === 3 /* AssignmentDeclarationKind.PrototypeProperty */) { // Get the 'x' of 'x.prototype.y = container' @@ -73046,16 +73455,16 @@ var ts; .expression; // x } // x.prototype = { method() { } } - else if (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && - container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + else if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && + container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && ts.isBinaryExpression(container.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent) === 6 /* AssignmentDeclarationKind.Prototype */) { return container.parent.parent.left.expression; } // x.prototype = { method: function() { } } - else if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && - container.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ && - container.parent.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + else if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && + container.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ && + container.parent.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && ts.isBinaryExpression(container.parent.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent.parent) === 6 /* AssignmentDeclarationKind.Prototype */) { return container.parent.parent.parent.left.expression; @@ -73063,7 +73472,7 @@ var ts; // Object.defineProperty(x, "method", { value: function() { } }); // Object.defineProperty(x, "method", { set: (x: () => void) => void }); // Object.defineProperty(x, "method", { get: () => function() { }) }); - else if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && + else if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && ts.isPropertyAssignment(container.parent) && ts.isIdentifier(container.parent.name) && (container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") && @@ -73088,7 +73497,7 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 317 /* SyntaxKind.JSDocFunctionType */) { + if (jsdocType && jsdocType.kind === 320 /* SyntaxKind.JSDocFunctionType */) { var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && @@ -73102,16 +73511,16 @@ var ts; } } function isInConstructorArgumentInitializer(node, constructorDecl) { - return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 164 /* SyntaxKind.Parameter */ && n.parent === constructorDecl; }); + return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 166 /* SyntaxKind.Parameter */ && n.parent === constructorDecl; }); } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 208 /* SyntaxKind.CallExpression */ && node.parent.expression === node; + var isCallExpression = node.parent.kind === 210 /* SyntaxKind.CallExpression */ && node.parent.expression === node; var immediateContainer = ts.getSuperContainer(node, /*stopOnFunctions*/ true); var container = immediateContainer; var needToCaptureLexicalThis = false; // adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting if (!isCallExpression) { - while (container && container.kind === 214 /* SyntaxKind.ArrowFunction */) { + while (container && container.kind === 216 /* SyntaxKind.ArrowFunction */) { container = ts.getSuperContainer(container, /*stopOnFunctions*/ true); needToCaptureLexicalThis = languageVersion < 2 /* ScriptTarget.ES2015 */; } @@ -73124,14 +73533,14 @@ var ts; // class B { // [super.foo()]() {} // } - var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 162 /* SyntaxKind.ComputedPropertyName */; }); - if (current && current.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 164 /* SyntaxKind.ComputedPropertyName */; }); + if (current && current.kind === 164 /* SyntaxKind.ComputedPropertyName */) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } - else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -73139,7 +73548,7 @@ var ts; } return errorType; } - if (!isCallExpression && immediateContainer.kind === 171 /* SyntaxKind.Constructor */) { + if (!isCallExpression && immediateContainer.kind === 173 /* SyntaxKind.Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); } if (ts.isStatic(container) || isCallExpression) { @@ -73220,7 +73629,7 @@ var ts; // as a call expression cannot be used as the target of a destructuring assignment while a property access can. // // For element access expressions (`super[x]`), we emit a generic helper that forwards the element access in both situations. - if (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && ts.hasSyntacticModifier(container, 256 /* ModifierFlags.Async */)) { + if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) { if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */; } @@ -73234,7 +73643,7 @@ var ts; // in this case they should also use correct lexical this captureLexicalThis(node.parent, container); } - if (container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return errorType; @@ -73255,7 +73664,7 @@ var ts; if (!baseClassType) { return errorType; } - if (container.kind === 171 /* SyntaxKind.Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 173 /* SyntaxKind.Constructor */ && isInConstructorArgumentInitializer(node, container)) { // issue custom error message for super property access in constructor arguments (to be aligned with old compiler) error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return errorType; @@ -73270,7 +73679,7 @@ var ts; if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes - return container.kind === 171 /* SyntaxKind.Constructor */; + return container.kind === 173 /* SyntaxKind.Constructor */; } else { // TS 1.0 SPEC (April 2014) @@ -73278,23 +73687,23 @@ var ts; // - In a constructor, instance member function, instance member accessor, or instance member variable initializer where this references a derived class instance // - In a static member function or static member accessor // topmost container must be something that is directly nested in the class declaration\object literal expression - if (ts.isClassLike(container.parent) || container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (ts.isClassLike(container.parent) || container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { if (ts.isStatic(container)) { - return container.kind === 169 /* SyntaxKind.MethodDeclaration */ || - container.kind === 168 /* SyntaxKind.MethodSignature */ || - container.kind === 172 /* SyntaxKind.GetAccessor */ || - container.kind === 173 /* SyntaxKind.SetAccessor */ || - container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - container.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + return container.kind === 171 /* SyntaxKind.MethodDeclaration */ || + container.kind === 170 /* SyntaxKind.MethodSignature */ || + container.kind === 174 /* SyntaxKind.GetAccessor */ || + container.kind === 175 /* SyntaxKind.SetAccessor */ || + container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + container.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; } else { - return container.kind === 169 /* SyntaxKind.MethodDeclaration */ || - container.kind === 168 /* SyntaxKind.MethodSignature */ || - container.kind === 172 /* SyntaxKind.GetAccessor */ || - container.kind === 173 /* SyntaxKind.SetAccessor */ || - container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - container.kind === 166 /* SyntaxKind.PropertySignature */ || - container.kind === 171 /* SyntaxKind.Constructor */; + return container.kind === 171 /* SyntaxKind.MethodDeclaration */ || + container.kind === 170 /* SyntaxKind.MethodSignature */ || + container.kind === 174 /* SyntaxKind.GetAccessor */ || + container.kind === 175 /* SyntaxKind.SetAccessor */ || + container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + container.kind === 168 /* SyntaxKind.PropertySignature */ || + container.kind === 173 /* SyntaxKind.Constructor */; } } } @@ -73302,10 +73711,10 @@ var ts; } } function getContainingObjectLiteral(func) { - return (func.kind === 169 /* SyntaxKind.MethodDeclaration */ || - func.kind === 172 /* SyntaxKind.GetAccessor */ || - func.kind === 173 /* SyntaxKind.SetAccessor */) && func.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ ? func.parent : - func.kind === 213 /* SyntaxKind.FunctionExpression */ && func.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ ? func.parent.parent : + return (func.kind === 171 /* SyntaxKind.MethodDeclaration */ || + func.kind === 174 /* SyntaxKind.GetAccessor */ || + func.kind === 175 /* SyntaxKind.SetAccessor */) && func.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ ? func.parent : + func.kind === 215 /* SyntaxKind.FunctionExpression */ && func.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ ? func.parent.parent : undefined; } function getThisTypeArgument(type) { @@ -73317,7 +73726,7 @@ var ts; }); } function getContextualThisParameterType(func) { - if (func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 216 /* SyntaxKind.ArrowFunction */) { return undefined; } if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { @@ -73344,7 +73753,7 @@ var ts; if (thisType) { return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral))); } - if (literal.parent.kind !== 296 /* SyntaxKind.PropertyAssignment */) { + if (literal.parent.kind !== 299 /* SyntaxKind.PropertyAssignment */) { break; } literal = literal.parent.parent; @@ -73358,7 +73767,7 @@ var ts; // In an assignment of the form 'obj.xxx = function(...)' or 'obj[xxx] = function(...)', the // contextual type for 'this' is 'obj'. var parent = ts.walkUpParenthesizedExpressions(func.parent); - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { var target = parent.left; if (ts.isAccessExpression(target)) { var expression = target.expression; @@ -73411,11 +73820,11 @@ var ts; return getTypeFromTypeNode(typeNode); } switch (declaration.kind) { - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return getContextuallyTypedParameterType(declaration); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getContextualTypeForBindingElement(declaration, contextFlags); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (ts.isStatic(declaration)) { return getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags); } @@ -73426,10 +73835,10 @@ var ts; var parent = declaration.parent.parent; var name = declaration.propertyName || declaration.name; var parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || - parent.kind !== 203 /* SyntaxKind.BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* CheckMode.RestBindingElement */ : 0 /* CheckMode.Normal */); + parent.kind !== 205 /* SyntaxKind.BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* CheckMode.RestBindingElement */ : 0 /* CheckMode.Normal */); if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name)) return undefined; - if (parent.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */) { + if (parent.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */) { var index = ts.indexOfNode(declaration.parent.elements, declaration); if (index < 0) return undefined; @@ -73586,7 +73995,7 @@ var ts; getTypeAtPosition(signature, argIndex); } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (template.parent.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -73705,9 +74114,11 @@ var ts; case 1 /* AssignmentDeclarationKind.ExportsProperty */: case 6 /* AssignmentDeclarationKind.Prototype */: case 3 /* AssignmentDeclarationKind.PrototypeProperty */: - var valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; - // falls through case 2 /* AssignmentDeclarationKind.ModuleExports */: + var valueDeclaration = void 0; + if (kind !== 2 /* AssignmentDeclarationKind.ModuleExports */) { + valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; + } valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration); var annotated = valueDeclaration && ts.getEffectiveTypeAnnotationNode(valueDeclaration); return annotated ? getTypeFromTypeNode(annotated) : undefined; @@ -73884,21 +74295,21 @@ var ts; case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 79 /* SyntaxKind.Identifier */: - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: return true; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isPossiblyDiscriminantValue(node.expression); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return !node.expression || isPossiblyDiscriminantValue(node.expression); } return false; } function discriminateContextualTypeByObjectMembers(node, contextualType) { - return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 296 /* SyntaxKind.PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); + return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 299 /* SyntaxKind.PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); } function discriminateContextualTypeByJSXAttributes(node, contextualType) { - return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 285 /* SyntaxKind.JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); + return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 288 /* SyntaxKind.JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); } // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily // be "pushed" onto a node using the contextualType property. @@ -73981,60 +74392,62 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 205 /* SyntaxKind.BindingElement */: return getContextualTypeForInitializerExpression(node, contextFlags); - case 214 /* SyntaxKind.ArrowFunction */: - case 247 /* SyntaxKind.ReturnStatement */: + case 216 /* SyntaxKind.ArrowFunction */: + case 250 /* SyntaxKind.ReturnStatement */: return getContextualTypeForReturnExpression(node, contextFlags); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return getContextualTypeForYieldOperand(parent, contextFlags); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return getContextualTypeForAwaitOperand(parent, contextFlags); - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return getContextualTypeForArgument(parent, node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return ts.isConstTypeReference(parent.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(parent.type); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return getContextualTypeForBinaryOperand(node, contextFlags); - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent, contextFlags); - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return getContextualType(parent.parent, contextFlags); - case 204 /* SyntaxKind.ArrayLiteralExpression */: { + case 206 /* SyntaxKind.ArrayLiteralExpression */: { var arrayLiteral = parent; var type = getApparentTypeOfContextualType(arrayLiteral, contextFlags); return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node)); } - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return getContextualTypeForConditionalOperand(node, contextFlags); - case 233 /* SyntaxKind.TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 223 /* SyntaxKind.TemplateExpression */); + case 236 /* SyntaxKind.TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 225 /* SyntaxKind.TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 212 /* SyntaxKind.ParenthesizedExpression */: { + case 214 /* SyntaxKind.ParenthesizedExpression */: { // Like in `checkParenthesizedExpression`, an `/** @type {xyz} */` comment before a parenthesized expression acts as a type cast. var tag = ts.isInJSFile(parent) ? ts.getJSDocTypeTag(parent) : undefined; return !tag ? getContextualType(parent, contextFlags) : ts.isJSDocTypeTag(tag) && ts.isConstTypeReference(tag.typeExpression.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(tag.typeExpression.type); } - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return getContextualType(parent, contextFlags); - case 271 /* SyntaxKind.ExportAssignment */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return getTypeFromTypeNode(parent.type); + case 274 /* SyntaxKind.ExportAssignment */: return tryGetTypeFromEffectiveTypeNode(parent); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return getContextualTypeForJsxExpression(parent, contextFlags); - case 285 /* SyntaxKind.JsxAttribute */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent, contextFlags); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return getContextualJsxElementAttributesType(parent, contextFlags); } return undefined; @@ -74160,9 +74573,16 @@ var ts; if (!isErrorType(intrinsicClassAttribs)) { var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); var hostClassType = getReturnTypeOfSignature(sig); - apparentAttributesType = intersectTypes(typeParams - ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context))) - : intrinsicClassAttribs, apparentAttributesType); + var libraryManagedAttributeType = void 0; + if (typeParams) { + // apply JSX.IntrinsicClassElements + var inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context)); + libraryManagedAttributeType = instantiateType(intrinsicClassAttribs, createTypeMapper(typeParams, inferredArgs)); + } + // or JSX.IntrinsicClassElements has no generics. + else + libraryManagedAttributeType = intrinsicClassAttribs; + apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType); } var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); if (!isErrorType(intrinsicAttribs)) { @@ -74285,7 +74705,7 @@ var ts; // all identical ignoring their return type, the result is same signature but with return type as // union type of return types from these signatures function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var typeTagSignature = getSignatureOfTypeTag(node); if (typeTagSignature) { return typeTagSignature; @@ -74333,8 +74753,8 @@ var ts; return node.isSpread ? getIndexedAccessType(node.type, numberType) : node.type; } function hasDefaultValue(node) { - return (node.kind === 203 /* SyntaxKind.BindingElement */ && !!node.initializer) || - (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */); + return (node.kind === 205 /* SyntaxKind.BindingElement */ && !!node.initializer) || + (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */); } function checkArrayLiteral(node, checkMode, forceTuple) { var elements = node.elements; @@ -74347,7 +74767,7 @@ var ts; var hasOmittedExpression = false; for (var i = 0; i < elementCount; i++) { var e = elements[i]; - if (e.kind === 225 /* SyntaxKind.SpreadElement */) { + if (e.kind === 227 /* SyntaxKind.SpreadElement */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { checkExternalEmitHelpers(e, compilerOptions.downlevelIteration ? 1536 /* ExternalEmitHelpers.SpreadIncludes */ : 1024 /* ExternalEmitHelpers.SpreadArray */); } @@ -74380,7 +74800,7 @@ var ts; elementFlags.push(4 /* ElementFlags.Rest */); } } - else if (exactOptionalPropertyTypes && e.kind === 227 /* SyntaxKind.OmittedExpression */) { + else if (exactOptionalPropertyTypes && e.kind === 229 /* SyntaxKind.OmittedExpression */) { hasOmittedExpression = true; elementTypes.push(missingType); elementFlags.push(2 /* ElementFlags.Optional */); @@ -74420,7 +74840,7 @@ var ts; } function isNumericName(name) { switch (name.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return isNumericComputedName(name); case 79 /* SyntaxKind.Identifier */: return ts.isNumericLiteralName(name.escapedText); @@ -74441,7 +74861,7 @@ var ts; if (!links.resolvedType) { if ((ts.isTypeLiteralNode(node.parent.parent) || ts.isClassLike(node.parent.parent) || ts.isInterfaceDeclaration(node.parent.parent)) && ts.isBinaryExpression(node.expression) && node.expression.operatorToken.kind === 101 /* SyntaxKind.InKeyword */ - && node.parent.kind !== 172 /* SyntaxKind.GetAccessor */ && node.parent.kind !== 173 /* SyntaxKind.SetAccessor */) { + && node.parent.kind !== 174 /* SyntaxKind.GetAccessor */ && node.parent.kind !== 175 /* SyntaxKind.SetAccessor */) { return links.resolvedType = errorType; } links.resolvedType = checkExpression(node.expression); @@ -74514,7 +74934,7 @@ var ts; var spread = emptyObjectType; var contextualType = getApparentTypeOfContextualType(node, /*contextFlags*/ undefined); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ || contextualType.pattern.kind === 205 /* SyntaxKind.ObjectLiteralExpression */); + (contextualType.pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ || contextualType.pattern.kind === 207 /* SyntaxKind.ObjectLiteralExpression */); var inConstContext = isConstContext(node); var checkFlags = inConstContext ? 8 /* CheckFlags.Readonly */ : 0; var isInJavascript = ts.isInJSFile(node) && !ts.isInJsonFile(node); @@ -74538,16 +74958,16 @@ var ts; for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var memberDecl = _c[_b]; var member = getSymbolOfNode(memberDecl); - var computedNameType = memberDecl.name && memberDecl.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? + var computedNameType = memberDecl.name && memberDecl.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : undefined; - if (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ || - memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ || + if (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ || + memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { - var type = memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : + var type = memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : // avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring // for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`. // we don't want to say "could not find 'a'". - memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : + memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode); if (isInJavascript) { var jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl); @@ -74570,8 +74990,8 @@ var ts; if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. - var isOptional = (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 16777216 /* SymbolFlags.Optional */; } @@ -74597,14 +75017,14 @@ var ts; member = prop; allPropertiesTable === null || allPropertiesTable === void 0 ? void 0 : allPropertiesTable.set(prop.escapedName, prop); if (contextualType && checkMode && checkMode & 2 /* CheckMode.Inferential */ && !(checkMode & 4 /* CheckMode.SkipContextSensitive */) && - (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ || memberDecl.kind === 169 /* SyntaxKind.MethodDeclaration */) && isContextSensitive(memberDecl)) { + (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ || memberDecl.kind === 171 /* SyntaxKind.MethodDeclaration */) && isContextSensitive(memberDecl)) { var inferenceContext = getInferenceContext(node); ts.Debug.assert(inferenceContext); // In CheckMode.Inferential we should always have an inference context - var inferenceNode = memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ ? memberDecl.initializer : memberDecl; + var inferenceNode = memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ ? memberDecl.initializer : memberDecl; addIntraExpressionInferenceSite(inferenceContext, inferenceNode, type); } } - else if (memberDecl.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (memberDecl.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { checkExternalEmitHelpers(memberDecl, 2 /* ExternalEmitHelpers.Assign */); } @@ -74640,7 +75060,7 @@ var ts; // an ordinary function declaration(section 6.1) with no parameters. // A set accessor declaration is processed in the same manner // as an ordinary function declaration with a single parameter and a Void return type. - ts.Debug.assert(memberDecl.kind === 172 /* SyntaxKind.GetAccessor */ || memberDecl.kind === 173 /* SyntaxKind.SetAccessor */); + ts.Debug.assert(memberDecl.kind === 174 /* SyntaxKind.GetAccessor */ || memberDecl.kind === 175 /* SyntaxKind.SetAccessor */); checkNodeDeferred(memberDecl); } if (computedNameType && !(computedNameType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */)) { @@ -74667,16 +75087,30 @@ var ts; // If object literal is contextually typed by the implied type of a binding pattern, augment the result // type with those properties for which the binding pattern specifies a default value. // If the object literal is spread into another object literal, skip this step and let the top-level object - // literal handle it instead. - if (contextualTypeHasPattern && node.parent.kind !== 298 /* SyntaxKind.SpreadAssignment */) { - for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { - var prop = _e[_d]; - if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { - if (!(prop.flags & 16777216 /* SymbolFlags.Optional */)) { - error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + // literal handle it instead. Note that this might require full traversal to the root pattern's parent + // as it's the guaranteed to be the common ancestor of the pattern node and the current object node. + // It's not possible to check if the immediate parent node is a spread assignment + // since the type flows in non-obvious ways through conditional expressions, IIFEs and more. + if (contextualTypeHasPattern) { + var rootPatternParent_1 = ts.findAncestor(contextualType.pattern.parent, function (n) { + return n.kind === 257 /* SyntaxKind.VariableDeclaration */ || + n.kind === 223 /* SyntaxKind.BinaryExpression */ || + n.kind === 166 /* SyntaxKind.Parameter */; + }); + var spreadOrOutsideRootObject = ts.findAncestor(node, function (n) { + return n === rootPatternParent_1 || + n.kind === 301 /* SyntaxKind.SpreadAssignment */; + }); + if (spreadOrOutsideRootObject.kind !== 301 /* SyntaxKind.SpreadAssignment */) { + for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { + var prop = _e[_d]; + if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { + if (!(prop.flags & 16777216 /* SymbolFlags.Optional */)) { + error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + propertiesTable.set(prop.escapedName, prop); + propertiesArray.push(prop); } - propertiesTable.set(prop.escapedName, prop); - propertiesArray.push(prop); } } } @@ -74784,6 +75218,7 @@ var ts; */ function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) { var attributes = openingLikeElement.attributes; + var attributesType = getContextualType(attributes, 0 /* ContextFlags.None */); var allAttributesTable = strictNullChecks ? ts.createSymbolTable() : undefined; var attributesTable = ts.createSymbolTable(); var spread = emptyJsxObjectType; @@ -74811,9 +75246,15 @@ var ts; if (attributeDecl.name.escapedText === jsxChildrenPropertyName) { explicitlySpecifyChildrenAttribute = true; } + if (attributesType) { + var prop = getPropertyOfType(attributesType, member.escapedName); + if (prop && prop.declarations && isDeprecatedSymbol(prop)) { + addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText); + } + } } else { - ts.Debug.assert(attributeDecl.kind === 287 /* SyntaxKind.JsxSpreadAttribute */); + ts.Debug.assert(attributeDecl.kind === 290 /* SyntaxKind.JsxSpreadAttribute */); if (attributesTable.size > 0) { spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, /*readonly*/ false); attributesTable = ts.createSymbolTable(); @@ -74840,7 +75281,7 @@ var ts; } } // Handle children attribute - var parent = openingLikeElement.parent.kind === 278 /* SyntaxKind.JsxElement */ ? openingLikeElement.parent : undefined; + var parent = openingLikeElement.parent.kind === 281 /* SyntaxKind.JsxElement */ ? openingLikeElement.parent : undefined; // We have to check that openingElement of the parent is the one we are visiting as this may not be true for selfClosingElement if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) { var childrenTypes = checkJsxChildren(parent, checkMode); @@ -74897,7 +75338,7 @@ var ts; childrenTypes.push(stringType); } } - else if (child.kind === 288 /* SyntaxKind.JsxExpression */ && !child.expression) { + else if (child.kind === 291 /* SyntaxKind.JsxExpression */ && !child.expression) { continue; // empty jsx expressions don't *really* count as present children } else { @@ -75329,9 +75770,9 @@ var ts; function checkPropertyAccessibility(node, isSuper, writing, type, prop, reportError) { if (reportError === void 0) { reportError = true; } var errorNode = !reportError ? undefined : - node.kind === 161 /* SyntaxKind.QualifiedName */ ? node.right : - node.kind === 200 /* SyntaxKind.ImportType */ ? node : - node.kind === 203 /* SyntaxKind.BindingElement */ && node.propertyName ? node.propertyName : node.name; + node.kind === 163 /* SyntaxKind.QualifiedName */ ? node.right : + node.kind === 202 /* SyntaxKind.ImportType */ ? node : + node.kind === 205 /* SyntaxKind.BindingElement */ && node.propertyName ? node.propertyName : node.name; return checkPropertyAccessibilityAtLocation(node, isSuper, writing, type, prop, errorNode); } /** @@ -75362,7 +75803,7 @@ var ts; return false; } } - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { // A method cannot be accessed in a super property access if the method is abstract. // This error could mask a private property access error. But, a member // cannot simultaneously be private and abstract, so this will trigger an @@ -75374,7 +75815,7 @@ var ts; } } // Referencing abstract properties within their own constructors is not allowed - if ((flags & 128 /* ModifierFlags.Abstract */) && symbolHasNonMethodDeclaration(prop) && + if ((flags & 256 /* ModifierFlags.Abstract */) && symbolHasNonMethodDeclaration(prop) && (ts.isThisProperty(location) || ts.isThisInitializedObjectBindingExpression(location) || ts.isObjectBindingPattern(location.parent) && ts.isThisInitializedDeclaration(location.parent.parent))) { var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) { @@ -75468,10 +75909,27 @@ var ts; return isNullableType(type) ? getNonNullableType(type) : type; } function reportObjectPossiblyNullOrUndefinedError(node, facts) { - error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? - ts.Diagnostics.Object_is_possibly_null_or_undefined : - ts.Diagnostics.Object_is_possibly_undefined : - ts.Diagnostics.Object_is_possibly_null); + var nodeText = ts.isEntityNameExpression(node) ? ts.entityNameToString(node) : undefined; + if (node.kind === 104 /* SyntaxKind.NullKeyword */) { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "null"); + return; + } + if (nodeText !== undefined && nodeText.length < 100) { + if (ts.isIdentifier(node) && nodeText === "undefined") { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "undefined"); + return; + } + error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? + ts.Diagnostics._0_is_possibly_null_or_undefined : + ts.Diagnostics._0_is_possibly_undefined : + ts.Diagnostics._0_is_possibly_null, nodeText); + } + else { + error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + } } function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) { error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? @@ -75481,6 +75939,13 @@ var ts; } function checkNonNullTypeWithReporter(type, node, reportError) { if (strictNullChecks && type.flags & 2 /* TypeFlags.Unknown */) { + if (ts.isEntityNameExpression(node)) { + var nodeText = ts.entityNameToString(node); + if (nodeText.length < 100) { + error(node, ts.Diagnostics._0_is_of_type_unknown, nodeText); + return errorType; + } + } error(node, ts.Diagnostics.Object_is_of_type_unknown); return errorType; } @@ -75498,6 +75963,17 @@ var ts; function checkNonNullNonVoidType(type, node) { var nonNullType = checkNonNullType(type, node); if (nonNullType.flags & 16384 /* TypeFlags.Void */) { + if (ts.isEntityNameExpression(node)) { + var nodeText = ts.entityNameToString(node); + if (ts.isIdentifier(node) && nodeText === "undefined") { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, nodeText); + return nonNullType; + } + if (nodeText.length < 100) { + error(node, ts.Diagnostics._0_is_possibly_undefined, nodeText); + return nonNullType; + } + } error(node, ts.Diagnostics.Object_is_possibly_undefined); } return nonNullType; @@ -75516,7 +75992,7 @@ var ts; return checkPropertyAccessExpressionOrQualifiedName(node, node.left, leftType, node.right, checkMode); } function isMethodAccessForCall(node) { - while (node.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (node.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { node = node.parent; } return ts.isCallOrNewExpression(node.parent) && node.parent.expression === node; @@ -75656,7 +76132,7 @@ var ts; } return isErrorType(apparentType) ? errorType : apparentType; } - prop = getPropertyOfType(apparentType, right.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ node.kind === 161 /* SyntaxKind.QualifiedName */); + prop = getPropertyOfType(apparentType, right.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ node.kind === 163 /* SyntaxKind.QualifiedName */); } // In `Foo.Bar.Baz`, 'Foo' is not referenced if 'Bar' is a const enum or a module containing only const enums. // `Foo` is also not referenced in `enum FooCopy { Bar = Foo.Bar }`, because the enum member value gets inlined @@ -75666,7 +76142,7 @@ var ts; // 1. if 'isolatedModules' is enabled, because the const enum value will not be inlined, and // 2. if 'preserveConstEnums' is enabled and the expression is itself an export, e.g. `export = Foo.Bar.Baz`. if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules || - !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* SymbolFlags.EnumMember */ && node.parent.kind === 299 /* SyntaxKind.EnumMember */)) || + !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* SymbolFlags.EnumMember */ && node.parent.kind === 302 /* SyntaxKind.EnumMember */)) || ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) { markAliasReferenced(parentSymbol, node); } @@ -75768,7 +76244,7 @@ var ts; if (declaration && isPropertyWithoutInitializer(declaration)) { if (!ts.isStatic(declaration)) { var flowContainer = getControlFlowContainer(node); - if (flowContainer.kind === 171 /* SyntaxKind.Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { + if (flowContainer.kind === 173 /* SyntaxKind.Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { assumeUninitialized = true; } } @@ -75803,8 +76279,8 @@ var ts; && (compilerOptions.useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) { diagnosticMessage = error(right, ts.Diagnostics.Property_0_is_used_before_its_initialization, declarationName); } - else if (valueDeclaration.kind === 257 /* SyntaxKind.ClassDeclaration */ && - node.parent.kind !== 178 /* SyntaxKind.TypeReference */ && + else if (valueDeclaration.kind === 260 /* SyntaxKind.ClassDeclaration */ && + node.parent.kind !== 180 /* SyntaxKind.TypeReference */ && !(valueDeclaration.flags & 16777216 /* NodeFlags.Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) { diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName); @@ -75816,25 +76292,25 @@ var ts; function isInPropertyInitializerOrClassStaticBlock(node) { return !!ts.findAncestor(node, function (node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 296 /* SyntaxKind.PropertyAssignment */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 298 /* SyntaxKind.SpreadAssignment */: - case 162 /* SyntaxKind.ComputedPropertyName */: - case 233 /* SyntaxKind.TemplateSpan */: - case 288 /* SyntaxKind.JsxExpression */: - case 285 /* SyntaxKind.JsxAttribute */: - case 286 /* SyntaxKind.JsxAttributes */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 291 /* SyntaxKind.HeritageClause */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 301 /* SyntaxKind.SpreadAssignment */: + case 164 /* SyntaxKind.ComputedPropertyName */: + case 236 /* SyntaxKind.TemplateSpan */: + case 291 /* SyntaxKind.JsxExpression */: + case 288 /* SyntaxKind.JsxAttribute */: + case 289 /* SyntaxKind.JsxAttributes */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 294 /* SyntaxKind.HeritageClause */: return false; - case 214 /* SyntaxKind.ArrowFunction */: - case 238 /* SyntaxKind.ExpressionStatement */: + case 216 /* SyntaxKind.ArrowFunction */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.isBlock(node.parent) && ts.isClassStaticBlockDeclaration(node.parent.parent) ? true : "quit"; default: return ts.isExpressionNode(node) ? false : "quit"; @@ -76029,7 +76505,6 @@ var ts; } return false; } - ; var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get"; if (!hasProp(suggestedMethod)) { return undefined; @@ -76109,11 +76584,11 @@ var ts; } function isValidPropertyAccess(node, propertyName) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return isValidPropertyAccessWithType(node, node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, propertyName, getWidenedType(checkExpression(node.expression))); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getWidenedType(checkExpression(node.left))); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getTypeFromTypeNode(node)); } } @@ -76128,7 +76603,7 @@ var ts; * @param property the accessed property's symbol. */ function isValidPropertyAccessForCompletions(node, type, property) { - return isPropertyAccessible(node, node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, + return isPropertyAccessible(node, node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, /* isWrite */ false, type, property); // Previously we validated the 'this' type of methods but this adversely affected performance. See #31377 for more context. } @@ -76168,7 +76643,7 @@ var ts; */ function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -76197,7 +76672,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 243 /* SyntaxKind.ForInStatement */ && + if (node.kind === 246 /* SyntaxKind.ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -76246,13 +76721,13 @@ var ts; // This gets us diagnostics for the type arguments and marks them as referenced. ts.forEach(node.typeArguments, checkSourceElement); } - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { checkExpression(node.template); } else if (ts.isJsxOpeningLikeElement(node)) { checkExpression(node.attributes); } - else if (node.kind !== 165 /* SyntaxKind.Decorator */) { + else if (node.kind !== 167 /* SyntaxKind.Decorator */) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -76316,7 +76791,7 @@ var ts; } } function isSpreadArgument(arg) { - return !!arg && (arg.kind === 225 /* SyntaxKind.SpreadElement */ || arg.kind === 232 /* SyntaxKind.SyntheticExpression */ && arg.isSpread); + return !!arg && (arg.kind === 227 /* SyntaxKind.SpreadElement */ || arg.kind === 234 /* SyntaxKind.SyntheticExpression */ && arg.isSpread); } function getSpreadArgumentIndex(args) { return ts.findIndex(args, isSpreadArgument); @@ -76333,9 +76808,9 @@ var ts; var callIsIncomplete = false; // In incomplete call we want to be lenient when we have too few arguments var effectiveParameterCount = getParameterCount(signature); var effectiveMinimumArguments = getMinArgumentCount(signature); - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { argCount = args.length; - if (node.template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (node.template.kind === 225 /* SyntaxKind.TemplateExpression */) { // If a tagged template expression lacks a tail literal, the call is incomplete. // Specifically, a template only can end in a TemplateTail or a Missing literal. var lastSpan = ts.last(node.template.templateSpans); // we should always have at least one span. @@ -76350,7 +76825,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 165 /* SyntaxKind.Decorator */) { + else if (node.kind === 167 /* SyntaxKind.Decorator */) { argCount = getDecoratorArgumentCount(node, signature); } else if (ts.isJsxOpeningLikeElement(node)) { @@ -76364,7 +76839,7 @@ var ts; } else if (!node.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(node.kind === 209 /* SyntaxKind.NewExpression */); + ts.Debug.assert(node.kind === 211 /* SyntaxKind.NewExpression */); return getMinArgumentCount(signature) === 0; } else { @@ -76467,7 +76942,7 @@ var ts; // example, given a 'function wrap(cb: (x: T) => U): (x: T) => U' and a call expression // 'let f: (x: string) => number = wrap(s => s.length)', we infer from the declared type of 'f' to the // return type of 'wrap'. - if (node.kind !== 165 /* SyntaxKind.Decorator */) { + if (node.kind !== 167 /* SyntaxKind.Decorator */) { var skipBindingPatterns = ts.every(signature.typeParameters, function (p) { return !!getDefaultFromTypeParameter(p); }); var contextualType = getContextualType(node, skipBindingPatterns ? 8 /* ContextFlags.SkipBindingPatterns */ : 0 /* ContextFlags.None */); if (contextualType) { @@ -76531,7 +77006,7 @@ var ts; } for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 227 /* SyntaxKind.OmittedExpression */ && !(checkMode & 32 /* CheckMode.IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) { + if (arg.kind !== 229 /* SyntaxKind.OmittedExpression */ && !(checkMode & 32 /* CheckMode.IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) { var paramType = getTypeAtPosition(signature, i); if (couldContainTypeVariables(paramType)) { var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode); @@ -76557,7 +77032,7 @@ var ts; if (isSpreadArgument(arg)) { // We are inferring from a spread expression in the last argument position, i.e. both the parameter // and the argument are ...x forms. - return getMutableArrayOrTupleType(arg.kind === 232 /* SyntaxKind.SyntheticExpression */ ? arg.type : + return getMutableArrayOrTupleType(arg.kind === 234 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode)); } } @@ -76567,13 +77042,13 @@ var ts; for (var i = index; i < argCount; i++) { var arg = args[i]; if (isSpreadArgument(arg)) { - var spreadType = arg.kind === 232 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpression(arg.expression); + var spreadType = arg.kind === 234 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpression(arg.expression); if (isArrayLikeType(spreadType)) { types.push(spreadType); flags.push(8 /* ElementFlags.Variadic */); } else { - types.push(checkIteratedTypeOrElementType(33 /* IterationUse.Spread */, spreadType, undefinedType, arg.kind === 225 /* SyntaxKind.SpreadElement */ ? arg.expression : arg)); + types.push(checkIteratedTypeOrElementType(33 /* IterationUse.Spread */, spreadType, undefinedType, arg.kind === 227 /* SyntaxKind.SpreadElement */ ? arg.expression : arg)); flags.push(4 /* ElementFlags.Rest */); } } @@ -76584,7 +77059,7 @@ var ts; types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType)); flags.push(1 /* ElementFlags.Required */); } - if (arg.kind === 232 /* SyntaxKind.SyntheticExpression */ && arg.tupleNameSource) { + if (arg.kind === 234 /* SyntaxKind.SyntheticExpression */ && arg.tupleNameSource) { names.push(arg.tupleNameSource); } } @@ -76728,7 +77203,7 @@ var ts; return undefined; } var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 209 /* SyntaxKind.NewExpression */) { + if (thisType && thisType !== voidType && node.kind !== 211 /* SyntaxKind.NewExpression */) { // If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType // If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible. // If the expression is a new expression, then the check is skipped. @@ -76746,7 +77221,7 @@ var ts; var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length; for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 227 /* SyntaxKind.OmittedExpression */) { + if (arg.kind !== 229 /* SyntaxKind.OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = checkExpressionWithContextualType(arg, paramType, /*inferenceContext*/ undefined, checkMode); // If one or more arguments are still excluded (as indicated by CheckMode.SkipContextSensitive), @@ -76791,8 +77266,8 @@ var ts; * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise. */ function getThisArgumentOfCall(node) { - var expression = node.kind === 208 /* SyntaxKind.CallExpression */ ? node.expression : - node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */ ? node.tag : undefined; + var expression = node.kind === 210 /* SyntaxKind.CallExpression */ ? node.expression : + node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */ ? node.tag : undefined; if (expression) { var callee = ts.skipOuterExpressions(expression); if (ts.isAccessExpression(callee)) { @@ -76810,17 +77285,17 @@ var ts; * Returns the effective arguments for an expression that works like a function invocation. */ function getEffectiveCallArguments(node) { - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { var template = node.template; var args_3 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())]; - if (template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (template.kind === 225 /* SyntaxKind.TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args_3.push(span.expression); }); } return args_3; } - if (node.kind === 165 /* SyntaxKind.Decorator */) { + if (node.kind === 167 /* SyntaxKind.Decorator */) { return getEffectiveDecoratorArguments(node); } if (ts.isJsxOpeningLikeElement(node)) { @@ -76831,10 +77306,10 @@ var ts; if (spreadIndex >= 0) { // Create synthetic arguments from spreads of tuple types. var effectiveArgs_1 = args.slice(0, spreadIndex); - var _loop_26 = function (i) { + var _loop_27 = function (i) { var arg = args[i]; // We can call checkExpressionCached because spread expressions never have a contextual type. - var spreadType = arg.kind === 225 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); + var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); if (spreadType && isTupleType(spreadType)) { ts.forEach(getTypeArguments(spreadType), function (t, i) { var _a; @@ -76848,7 +77323,7 @@ var ts; } }; for (var i = spreadIndex; i < args.length; i++) { - _loop_26(i); + _loop_27(i); } return effectiveArgs_1; } @@ -76861,30 +77336,30 @@ var ts; var parent = node.parent; var expr = node.expression; switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: // For a class decorator, the `target` is the type of the class (e.g. the // "static" or "constructor" side of the class). return [ createSyntheticExpression(expr, getTypeOfSymbol(getSymbolOfNode(parent))) ]; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // A parameter declaration decorator will have three arguments (see // `ParameterDecorator` in core.d.ts). var func = parent.parent; return [ - createSyntheticExpression(expr, parent.parent.kind === 171 /* SyntaxKind.Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), + createSyntheticExpression(expr, parent.parent.kind === 173 /* SyntaxKind.Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), createSyntheticExpression(expr, anyType), createSyntheticExpression(expr, numberType) ]; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // A method or accessor declaration decorator will have two or three arguments (see // `PropertyDecorator` and `MethodDecorator` in core.d.ts). If we are emitting decorators // for ES3, we will only pass two arguments. - var hasPropDesc = parent.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && languageVersion !== 0 /* ScriptTarget.ES3 */; + var hasPropDesc = languageVersion !== 0 /* ScriptTarget.ES3 */ && (!ts.isPropertyDeclaration(parent) || ts.hasAccessorModifier(parent)); return [ createSyntheticExpression(expr, getParentTypeOfClassElement(parent)), createSyntheticExpression(expr, getClassElementPropertyKeyType(parent)), @@ -76898,17 +77373,17 @@ var ts; */ function getDecoratorArgumentCount(node, signature) { switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return 1; - case 167 /* SyntaxKind.PropertyDeclaration */: - return 2; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + return ts.hasAccessorModifier(node.parent) ? 3 : 2; + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // For ES3 or decorators with only two parameters we supply only two arguments return languageVersion === 0 /* ScriptTarget.ES3 */ || signature.parameters.length <= 2 ? 2 : 3; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return 3; default: return ts.Debug.fail(); @@ -77050,8 +77525,8 @@ var ts; return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount); } function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags, fallbackError) { - var isTaggedTemplate = node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */; - var isDecorator = node.kind === 165 /* SyntaxKind.Decorator */; + var isTaggedTemplate = node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */; + var isDecorator = node.kind === 167 /* SyntaxKind.Decorator */; var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node); var reportErrors = !candidatesOutArray; var typeArguments; @@ -77114,7 +77589,7 @@ var ts; var result; // If we are in signature help, a trailing comma indicates that we intend to provide another argument, // so we will only accept overloads with arity at least 1 higher than the current number of provided arguments. - var signatureHelpTrailingComma = !!(checkMode & 16 /* CheckMode.IsForSignatureHelp */) && node.kind === 208 /* SyntaxKind.CallExpression */ && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = !!(checkMode & 16 /* CheckMode.IsForSignatureHelp */) && node.kind === 210 /* SyntaxKind.CallExpression */ && node.arguments.hasTrailingComma; // Section 4.12.1: // if the candidate list contains one or more signatures for which the type of each argument // expression is a subtype of each corresponding parameter type, the return type of the first @@ -77177,7 +77652,7 @@ var ts; var min_3 = Number.MAX_VALUE; var minIndex = 0; var i_1 = 0; - var _loop_27 = function (c) { + var _loop_28 = function (c) { var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); }; var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* CheckMode.Normal */, /*reportErrors*/ true, chain_2); if (diags_2) { @@ -77195,7 +77670,7 @@ var ts; }; for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) { var c = candidatesForArgumentError_1[_a]; - _loop_27(c); + _loop_28(c); } var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics); ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures"); @@ -77353,7 +77828,7 @@ var ts; } var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max; var parameters = []; - var _loop_28 = function (i) { + var _loop_29 = function (i) { var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ? i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) : i < s.parameters.length ? s.parameters[i] : undefined; }); @@ -77361,7 +77836,7 @@ var ts; parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); }))); }; for (var i = 0; i < maxNonRestParam; i++) { - _loop_28(i); + _loop_29(i); } var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; }); var flags = 0 /* SignatureFlags.None */; @@ -77603,7 +78078,7 @@ var ts; return resolveErrorCall(node); } var valueDecl = expressionType.symbol && ts.getClassLikeDeclarationOfSymbol(expressionType.symbol); - if (valueDecl && ts.hasSyntacticModifier(valueDecl, 128 /* ModifierFlags.Abstract */)) { + if (valueDecl && ts.hasSyntacticModifier(valueDecl, 256 /* ModifierFlags.Abstract */)) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_an_abstract_class); return resolveErrorCall(node); } @@ -77674,7 +78149,7 @@ var ts; var declaration = signature.declaration; var modifiers = ts.getSelectedEffectiveModifierFlags(declaration, 24 /* ModifierFlags.NonPublicAccessibilityModifier */); // (1) Public constructors and (2) constructor functions are always accessible. - if (!modifiers || declaration.kind !== 171 /* SyntaxKind.Constructor */) { + if (!modifiers || declaration.kind !== 173 /* SyntaxKind.Constructor */) { return true; } var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(declaration.parent.symbol); @@ -77818,16 +78293,16 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; default: return ts.Debug.fail(); @@ -77873,7 +78348,7 @@ var ts; // file would probably be preferable. var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 788968 /* SymbolFlags.Type */); var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 788968 /* SymbolFlags.Type */, node); - var declaration = ts.factory.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + var declaration = ts.factory.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); var parameterSymbol = createSymbol(1 /* SymbolFlags.FunctionScopedVariable */, "props"); parameterSymbol.type = result; return createSignature(declaration, @@ -77922,16 +78397,16 @@ var ts; } function resolveSignature(node, candidatesOutArray, checkMode) { switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return resolveCallExpression(node, candidatesOutArray, checkMode); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return resolveNewExpression(node, candidatesOutArray, checkMode); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return resolveDecorator(node, candidatesOutArray, checkMode); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode); } throw ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable."); @@ -77975,12 +78450,15 @@ var ts; return false; } var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node : - ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer : + (ts.isVariableDeclaration(node) || ts.isPropertyAssignment(node)) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer : undefined; if (func) { - // If the node has a @class tag, treat it like a constructor. + // If the node has a @class or @constructor tag, treat it like a constructor. if (ts.getJSDocClassTag(node)) return true; + // If the node is a property of an object literal. + if (ts.isPropertyAssignment(ts.walkUpParenthesizedExpressions(func.parent))) + return false; // If the symbol of the node has members, treat it like a constructor. var symbol = getSymbolOfNode(func); return !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.members) === null || _a === void 0 ? void 0 : _a.size); @@ -78063,7 +78541,7 @@ var ts; return false; } var parent = node.parent; - while (parent && parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (parent && parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { parent = parent.parent; } if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { @@ -78089,12 +78567,12 @@ var ts; if (node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { return voidType; } - if (node.kind === 209 /* SyntaxKind.NewExpression */) { + if (node.kind === 211 /* SyntaxKind.NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 171 /* SyntaxKind.Constructor */ && - declaration.kind !== 175 /* SyntaxKind.ConstructSignature */ && - declaration.kind !== 180 /* SyntaxKind.ConstructorType */ && + declaration.kind !== 173 /* SyntaxKind.Constructor */ && + declaration.kind !== 177 /* SyntaxKind.ConstructSignature */ && + declaration.kind !== 182 /* SyntaxKind.ConstructorType */ && !ts.isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) { // When resolved signature is a call signature (and not a construct signature) the result type is any @@ -78114,7 +78592,7 @@ var ts; if (returnType.flags & 12288 /* TypeFlags.ESSymbolLike */ && isSymbolOrSymbolForCall(node)) { return getESSymbolLikeTypeForNode(ts.walkUpParenthesizedExpressions(node.parent)); } - if (node.kind === 208 /* SyntaxKind.CallExpression */ && !node.questionDotToken && node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && + if (node.kind === 210 /* SyntaxKind.CallExpression */ && !node.questionDotToken && node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && returnType.flags & 16384 /* TypeFlags.Void */ && getTypePredicateOfSignature(signature)) { if (!ts.isDottedName(node.expression)) { error(node.expression, ts.Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name); @@ -78144,20 +78622,20 @@ var ts; function getDeprecatedSuggestionNode(node) { node = ts.skipParentheses(node); switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: - case 165 /* SyntaxKind.Decorator */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 167 /* SyntaxKind.Decorator */: + case 211 /* SyntaxKind.NewExpression */: return getDeprecatedSuggestionNode(node.expression); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return getDeprecatedSuggestionNode(node.tag); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return getDeprecatedSuggestionNode(node.tagName); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return node.argumentExpression; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.name; - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: var typeReference = node; return ts.isQualifiedName(typeReference.typeName) ? typeReference.typeName.right : typeReference; default: @@ -78228,8 +78706,8 @@ var ts; if (hasDefaultOnly && type && !isErrorType(type)) { var synthType = type; if (!synthType.defaultOnlyType) { - var type_5 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); - synthType.defaultOnlyType = type_5; + var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); + synthType.defaultOnlyType = type_4; } return synthType.defaultOnlyType; } @@ -78272,9 +78750,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 /* SymbolFlags.Function */ - ? 256 /* SyntaxKind.FunctionDeclaration */ + ? 259 /* SyntaxKind.FunctionDeclaration */ : resolvedRequire.flags & 3 /* SymbolFlags.Variable */ - ? 254 /* SyntaxKind.VariableDeclaration */ + ? 257 /* SyntaxKind.VariableDeclaration */ : 0 /* SyntaxKind.Unknown */; if (targetDeclarationKind !== 0 /* SyntaxKind.Unknown */) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -78294,7 +78772,7 @@ var ts; return getReturnTypeOfSignature(signature); } function checkAssertion(node) { - if (node.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (node.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { var file = ts.getSourceFileOfNode(node); if (file && ts.fileExtensionIsOneOf(file.fileName, [".cts" /* Extension.Cts */, ".mts" /* Extension.Mts */])) { grammarErrorOnNode(node, ts.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead); @@ -78310,19 +78788,19 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 223 /* SyntaxKind.TemplateExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return true; - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isValidConstAssertionArgument(node.expression); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var op = node.operator; var arg = node.operand; return op === 40 /* SyntaxKind.MinusToken */ && (arg.kind === 8 /* SyntaxKind.NumericLiteral */ || arg.kind === 9 /* SyntaxKind.BigIntLiteral */) || op === 39 /* SyntaxKind.PlusToken */ && arg.kind === 8 /* SyntaxKind.NumericLiteral */; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = node.expression; var symbol = getTypeOfNode(expr).symbol; if (symbol && symbol.flags & 2097152 /* SymbolFlags.Alias */) { @@ -78364,7 +78842,7 @@ var ts; } function checkExpressionWithTypeArguments(node) { checkGrammarExpressionWithTypeArguments(node); - var exprType = node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ ? checkExpression(node.expression) : + var exprType = node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ ? checkExpression(node.expression) : ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName); var typeArguments = node.typeArguments; @@ -78428,6 +78906,16 @@ var ts; }); } } + function checkSatisfiesExpression(node) { + checkSourceElement(node.type); + var targetType = getTypeFromTypeNode(node.type); + if (isErrorType(targetType)) { + return targetType; + } + var exprType = checkExpression(node.expression); + checkTypeAssignableToAndOptionallyElaborate(exprType, targetType, node.type, node.expression, ts.Diagnostics.Type_0_does_not_satisfy_the_expected_type_1); + return exprType; + } function checkMetaProperty(node) { checkGrammarMetaProperty(node); if (node.keywordToken === 103 /* SyntaxKind.NewKeyword */) { @@ -78455,7 +78943,7 @@ var ts; error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); return errorType; } - else if (container.kind === 171 /* SyntaxKind.Constructor */) { + else if (container.kind === 173 /* SyntaxKind.Constructor */) { var symbol = getSymbolOfNode(container.parent); return getTypeOfSymbol(symbol); } @@ -78507,7 +78995,7 @@ var ts; } function getParameterIdentifierNameAtPosition(signature, pos) { var _a; - if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 317 /* SyntaxKind.JSDocFunctionType */) { + if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 320 /* SyntaxKind.JSDocFunctionType */) { return undefined; } var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -78539,7 +79027,7 @@ var ts; return symbol.valueDeclaration && ts.isParameter(symbol.valueDeclaration) && ts.isIdentifier(symbol.valueDeclaration.name); } function isValidDeclarationForTupleLabel(d) { - return d.kind === 197 /* SyntaxKind.NamedTupleMember */ || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name)); + return d.kind === 199 /* SyntaxKind.NamedTupleMember */ || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name)); } function getNameableDeclarationAtPosition(signature, pos) { var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -78831,7 +79319,7 @@ var ts; var yieldType; var nextType; var fallbackReturnType = voidType; - if (func.body.kind !== 235 /* SyntaxKind.Block */) { // Async or normal arrow function + if (func.body.kind !== 238 /* SyntaxKind.Block */) { // Async or normal arrow function returnType = checkExpressionCached(func.body, checkMode && checkMode & ~8 /* CheckMode.SkipGenericFunctions */); if (isAsync) { // From within an async function you can return either a non-promise value or a promise. Any @@ -78983,7 +79471,7 @@ var ts; return links.isExhaustive !== undefined ? links.isExhaustive : (links.isExhaustive = computeExhaustiveSwitchStatement(node)); } function computeExhaustiveSwitchStatement(node) { - if (node.expression.kind === 216 /* SyntaxKind.TypeOfExpression */) { + if (node.expression.kind === 218 /* SyntaxKind.TypeOfExpression */) { var witnesses = getSwitchClauseTypeOfWitnesses(node); if (!witnesses) { return false; @@ -79049,11 +79537,11 @@ var ts; } function mayReturnNever(func) { switch (func.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; - case 169 /* SyntaxKind.MethodDeclaration */: - return func.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + case 171 /* SyntaxKind.MethodDeclaration */: + return func.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; default: return false; } @@ -79079,7 +79567,7 @@ var ts; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. // also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw - if (func.kind === 168 /* SyntaxKind.MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 235 /* SyntaxKind.Block */ || !functionHasImplicitReturn(func)) { + if (func.kind === 170 /* SyntaxKind.MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 238 /* SyntaxKind.Block */ || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 512 /* NodeFlags.HasExplicitReturn */; @@ -79113,7 +79601,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); checkNodeDeferred(node); if (ts.isFunctionExpression(node)) { checkCollisionsForDeclarationName(node, node.name); @@ -79140,7 +79628,7 @@ var ts; } // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (!hasGrammarError && node.kind === 215 /* SyntaxKind.FunctionExpression */) { checkGrammarForGenerator(node); } contextuallyCheckFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -79191,7 +79679,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var functionFlags = ts.getFunctionFlags(node); var returnType = getReturnTypeFromAnnotation(node); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); @@ -79204,7 +79692,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 235 /* SyntaxKind.Block */) { + if (node.body.kind === 238 /* SyntaxKind.Block */) { checkSourceElement(node.body); } else { @@ -79294,7 +79782,7 @@ var ts; expr.expression.kind === 108 /* SyntaxKind.ThisKeyword */) { // Look for if this is the constructor for the class that `symbol` is a property of. var ctor = ts.getContainingFunction(expr); - if (!(ctor && (ctor.kind === 171 /* SyntaxKind.Constructor */ || isJSConstructor(ctor)))) { + if (!(ctor && (ctor.kind === 173 /* SyntaxKind.Constructor */ || isJSConstructor(ctor)))) { return true; } if (symbol.valueDeclaration) { @@ -79319,7 +79807,7 @@ var ts; var symbol_2 = getNodeLinks(node).resolvedSymbol; if (symbol_2.flags & 2097152 /* SymbolFlags.Alias */) { var declaration = getDeclarationOfAliasSymbol(symbol_2); - return !!declaration && declaration.kind === 268 /* SyntaxKind.NamespaceImport */; + return !!declaration && declaration.kind === 271 /* SyntaxKind.NamespaceImport */; } } } @@ -79419,7 +79907,7 @@ var ts; if (!hasParseDiagnostics(sourceFile)) { var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos); var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); - if (container && container.kind !== 171 /* SyntaxKind.Constructor */ && (ts.getFunctionFlags(container) & 2 /* FunctionFlags.Async */) === 0) { + if (container && container.kind !== 173 /* SyntaxKind.Constructor */ && (ts.getFunctionFlags(container) & 2 /* FunctionFlags.Async */) === 0) { var relatedInfo = ts.createDiagnosticForNode(container, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); ts.addRelatedInfo(diagnostic, relatedInfo); } @@ -79587,6 +80075,9 @@ var ts; } return booleanType; } + function hasEmptyObjectIntersection(type) { + return someType(type, function (t) { return t === unknownEmptyObjectType || !!(t.flags & 2097152 /* TypeFlags.Intersection */) && ts.some(t.types, isEmptyAnonymousObjectType); }); + } function checkInExpression(left, right, leftType, rightType) { if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; @@ -79603,40 +80094,20 @@ var ts; } } else { - leftType = checkNonNullType(leftType, left); - // TypeScript 1.0 spec (April 2014): 4.15.5 - // Require the left operand to be of type Any, the String primitive type, or the Number primitive type. - if (!(allTypesAssignableToKind(leftType, 402653316 /* TypeFlags.StringLike */ | 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */) || - isTypeAssignableToKind(leftType, 4194304 /* TypeFlags.Index */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */ | 262144 /* TypeFlags.TypeParameter */))) { - error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol); + // The type of the lef operand must be assignable to string, number, or symbol. + checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left); + } + // The type of the right operand must be assignable to 'object'. + if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) { + // The {} type is assignable to the object type, yet {} might represent a primitive type. Here we + // detect and error on {} that results from narrowing the unknown type, as well as intersections + // that include {} (we know that the other types in such intersections are assignable to object + // since we already checked for that). + if (hasEmptyObjectIntersection(rightType)) { + error(right, ts.Diagnostics.Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator, typeToString(rightType)); } } - rightType = checkNonNullType(rightType, right); - // TypeScript 1.0 spec (April 2014): 4.15.5 - // The in operator requires the right operand to be - // - // 1. assignable to the non-primitive type, - // 2. an unconstrained type parameter, - // 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the - // the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the - // non-primitive type, or - // 4. a type parameter whose constraint is - // i. an object type, - // ii. the non-primitive type, or - // iii. a union or intersection with at least one constituent assignable to an object or non-primitive type. - // - // The divergent behavior for type parameters and unions containing type parameters is a workaround for type - // parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance - // it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error - // unless *all* instantiations would result in an error. - // // The result is always of the Boolean primitive type. - var rightTypeConstraint = getConstraintOfType(rightType); - if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) || - rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) || - !maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) { - error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive); - } return booleanType; } function checkObjectLiteralAssignment(node, sourceType, rightIsThis) { @@ -79654,7 +80125,7 @@ var ts; if (rightIsThis === void 0) { rightIsThis = false; } var properties = node.properties; var property = properties[propertyIndex]; - if (property.kind === 296 /* SyntaxKind.PropertyAssignment */ || property.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (property.kind === 299 /* SyntaxKind.PropertyAssignment */ || property.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var name = property.name; var exprType = getLiteralTypeFromPropertyName(name); if (isTypeUsableAsPropertyName(exprType)) { @@ -79667,9 +80138,9 @@ var ts; } var elementType = getIndexedAccessType(objectLiteralType, exprType, 32 /* AccessFlags.ExpressionPosition */, name); var type = getFlowTypeOfDestructuring(property, elementType); - return checkDestructuringAssignment(property.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? property : property.initializer, type); + return checkDestructuringAssignment(property.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? property : property.initializer, type); } - else if (property.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (property.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (propertyIndex < properties.length - 1) { error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } @@ -79707,7 +80178,7 @@ var ts; var inBoundsType = compilerOptions.noUncheckedIndexedAccess ? undefined : possiblyOutOfBoundsType; for (var i = 0; i < elements.length; i++) { var type = possiblyOutOfBoundsType; - if (node.elements[i].kind === 225 /* SyntaxKind.SpreadElement */) { + if (node.elements[i].kind === 227 /* SyntaxKind.SpreadElement */) { type = inBoundsType = inBoundsType !== null && inBoundsType !== void 0 ? inBoundsType : (checkIteratedTypeOrElementType(65 /* IterationUse.Destructuring */, sourceType, undefinedType, node) || errorType); } checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, type, checkMode); @@ -79717,8 +80188,8 @@ var ts; function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 227 /* SyntaxKind.OmittedExpression */) { - if (element.kind !== 225 /* SyntaxKind.SpreadElement */) { + if (element.kind !== 229 /* SyntaxKind.OmittedExpression */) { + if (element.kind !== 227 /* SyntaxKind.SpreadElement */) { var indexType = getNumberLiteralType(elementIndex); if (isArrayLikeType(sourceType)) { // We create a synthetic expression so that getIndexedAccessType doesn't get confused @@ -79736,7 +80207,7 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 221 /* SyntaxKind.BinaryExpression */ && restExpression.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (restExpression.kind === 223 /* SyntaxKind.BinaryExpression */ && restExpression.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -79752,7 +80223,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode, rightIsThis) { var target; - if (exprOrAssignment.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { // In strict null checking mode, if a default value of a non-undefined type is specified, remove @@ -79768,7 +80239,7 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 221 /* SyntaxKind.BinaryExpression */ && target.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (target.kind === 223 /* SyntaxKind.BinaryExpression */ && target.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { checkBinaryExpression(target, checkMode); target = target.left; // A default value is specified, so remove undefined from the final type. @@ -79776,20 +80247,20 @@ var ts; sourceType = getTypeWithFacts(sourceType, 524288 /* TypeFacts.NEUndefined */); } } - if (target.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (target.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType, rightIsThis); } - if (target.kind === 204 /* SyntaxKind.ArrayLiteralExpression */) { + if (target.kind === 206 /* SyntaxKind.ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, checkMode); } return checkReferenceAssignment(target, sourceType, checkMode); } function checkReferenceAssignment(target, sourceType, checkMode) { var targetType = checkExpression(target, checkMode); - var error = target.parent.kind === 298 /* SyntaxKind.SpreadAssignment */ ? + var error = target.parent.kind === 301 /* SyntaxKind.SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; - var optionalError = target.parent.kind === 298 /* SyntaxKind.SpreadAssignment */ ? + var optionalError = target.parent.kind === 301 /* SyntaxKind.SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access; if (checkReferenceExpression(target, error, optionalError)) { @@ -79814,36 +80285,36 @@ var ts; case 79 /* SyntaxKind.Identifier */: case 10 /* SyntaxKind.StringLiteral */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 223 /* SyntaxKind.TemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 8 /* SyntaxKind.NumericLiteral */: case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 278 /* SyntaxKind.JsxElement */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 281 /* SyntaxKind.JsxElement */: return true; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: // Unary operators ~, !, +, and - have no side effects. // The rest do. switch (node.operator) { @@ -79855,9 +80326,9 @@ var ts; } return false; // Some forms listed here for clarity - case 217 /* SyntaxKind.VoidExpression */: // Explicit opt-out - case 211 /* SyntaxKind.TypeAssertionExpression */: // Not SEF, but can produce useful type warnings - case 229 /* SyntaxKind.AsExpression */: // Not SEF, but can produce useful type warnings + case 219 /* SyntaxKind.VoidExpression */: // Explicit opt-out + case 213 /* SyntaxKind.TypeAssertionExpression */: // Not SEF, but can produce useful type warnings + case 231 /* SyntaxKind.AsExpression */: // Not SEF, but can produce useful type warnings default: return false; } @@ -79894,7 +80365,7 @@ var ts; } checkGrammarNullishCoalesceWithLogicalExpression(node); var operator = node.operatorToken.kind; - if (operator === 63 /* SyntaxKind.EqualsToken */ && (node.left.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || node.left.kind === 204 /* SyntaxKind.ArrayLiteralExpression */)) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && (node.left.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || node.left.kind === 206 /* SyntaxKind.ArrayLiteralExpression */)) { state.skip = true; setLastResult(state, checkDestructuringAssignment(node.left, checkExpression(node.right, checkMode), checkMode, node.right.kind === 108 /* SyntaxKind.ThisKeyword */)); return state; @@ -79916,11 +80387,11 @@ var ts; if (operator === 55 /* SyntaxKind.AmpersandAmpersandToken */ || operator === 56 /* SyntaxKind.BarBarToken */ || operator === 60 /* SyntaxKind.QuestionQuestionToken */) { if (operator === 55 /* SyntaxKind.AmpersandAmpersandToken */) { var parent = node.parent; - while (parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */ + while (parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || ts.isBinaryExpression(parent) && (parent.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || parent.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */)) { parent = parent.parent; } - checkTestingKnownTruthyCallableOrAwaitableType(node.left, ts.isIfStatement(parent) ? parent.thenStatement : undefined); + checkTestingKnownTruthyCallableOrAwaitableType(node.left, leftType, ts.isIfStatement(parent) ? parent.thenStatement : undefined); } checkTruthinessOfType(leftType, node.left); } @@ -79991,7 +80462,7 @@ var ts; // expression-wide checks and does not use a work stack to fold nested binary expressions into the same callstack frame function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { var operator = operatorToken.kind; - if (operator === 63 /* SyntaxKind.EqualsToken */ && (left.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || left.kind === 204 /* SyntaxKind.ArrayLiteralExpression */)) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && (left.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || left.kind === 206 /* SyntaxKind.ArrayLiteralExpression */)) { return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 108 /* SyntaxKind.ThisKeyword */); } var leftType; @@ -80147,6 +80618,7 @@ var ts; var eqType = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */; error(errorNode, ts.Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true"); } + checkNaNEquality(errorNode, operator, left, right); reportOperatorErrorUnless(function (left, right) { return isTypeEqualityComparableTo(left, right) || isTypeEqualityComparableTo(right, left); }); return booleanType; case 102 /* SyntaxKind.InstanceOfKeyword */: @@ -80342,20 +80814,35 @@ var ts; } } function tryGiveBetterPrimaryError(errNode, maybeMissingAwait, leftStr, rightStr) { - var typeName; switch (operatorToken.kind) { case 36 /* SyntaxKind.EqualsEqualsEqualsToken */: case 34 /* SyntaxKind.EqualsEqualsToken */: - typeName = "false"; - break; case 37 /* SyntaxKind.ExclamationEqualsEqualsToken */: case 35 /* SyntaxKind.ExclamationEqualsToken */: - typeName = "true"; + return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap, leftStr, rightStr); + default: + return undefined; } - if (typeName) { - return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap, typeName, leftStr, rightStr); + } + function checkNaNEquality(errorNode, operator, left, right) { + var isLeftNaN = isGlobalNaN(ts.skipParentheses(left)); + var isRightNaN = isGlobalNaN(ts.skipParentheses(right)); + if (isLeftNaN || isRightNaN) { + var err = error(errorNode, ts.Diagnostics.This_condition_will_always_return_0, ts.tokenToString(operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? 95 /* SyntaxKind.FalseKeyword */ : 110 /* SyntaxKind.TrueKeyword */)); + if (isLeftNaN && isRightNaN) + return; + var operatorString = operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ ? ts.tokenToString(53 /* SyntaxKind.ExclamationToken */) : ""; + var location = isLeftNaN ? right : left; + var expression = ts.skipParentheses(location); + ts.addRelatedInfo(err, ts.createDiagnosticForNode(location, ts.Diagnostics.Did_you_mean_0, "".concat(operatorString, "Number.isNaN(").concat(ts.isEntityNameExpression(expression) ? ts.entityNameToString(expression) : "...", ")"))); } - return undefined; + } + function isGlobalNaN(expr) { + if (ts.isIdentifier(expr) && expr.escapedText === "NaN") { + var globalNaNSymbol = getGlobalNaNSymbol(); + return !!globalNaNSymbol && globalNaNSymbol === getResolvedSymbol(expr); + } + return false; } } function getBaseTypesIfUnrelated(leftType, rightType, isRelated) { @@ -80436,8 +80923,8 @@ var ts; } } function checkConditionalExpression(node, checkMode) { - checkTruthinessExpression(node.condition); - checkTestingKnownTruthyCallableOrAwaitableType(node.condition, node.whenTrue); + var type = checkTruthinessExpression(node.condition); + checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue); var type1 = checkExpression(node.whenTrue, checkMode); var type2 = checkExpression(node.whenFalse, checkMode); return getUnionType([type1, type2], 2 /* UnionReduction.Subtype */); @@ -80466,7 +80953,7 @@ var ts; type.flags & 58982400 /* TypeFlags.InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* TypeFlags.StringLike */)); } function getContextNode(node) { - if (node.kind === 286 /* SyntaxKind.JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) { + if (node.kind === 289 /* SyntaxKind.JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) { return node.parent.parent; // Needs to be the root JsxElement, so it encompasses the attributes _and_ the children (which are essentially part of the attributes) } return node; @@ -80520,8 +81007,8 @@ var ts; } function isTypeAssertion(node) { node = ts.skipParentheses(node, /*excludeJSDocTypeAssertions*/ true); - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */ || - node.kind === 229 /* SyntaxKind.AsExpression */ || + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */ || + node.kind === 231 /* SyntaxKind.AsExpression */ || ts.isJSDocTypeAssertion(node); } function checkDeclarationInitializer(declaration, checkMode, contextualType) { @@ -80530,7 +81017,7 @@ var ts; (contextualType ? checkExpressionWithContextualType(initializer, contextualType, /*inferenceContext*/ undefined, checkMode || 0 /* CheckMode.Normal */) : checkExpressionCached(initializer, checkMode)); - return ts.isParameter(declaration) && declaration.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && + return ts.isParameter(declaration) && declaration.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ? padTupleType(type, declaration.name) : type; } @@ -80540,7 +81027,7 @@ var ts; var elementFlags = type.target.elementFlags.slice(); for (var i = getTypeReferenceArity(type); i < patternElements.length; i++) { var e = patternElements[i]; - if (i < patternElements.length - 1 || !(e.kind === 203 /* SyntaxKind.BindingElement */ && e.dotDotDotToken)) { + if (i < patternElements.length - 1 || !(e.kind === 205 /* SyntaxKind.BindingElement */ && e.dotDotDotToken)) { elementTypes.push(!ts.isOmittedExpression(e) && hasDefaultValue(e) ? getTypeFromBindingElement(e, /*includePatternInType*/ false, /*reportErrors*/ false) : anyType); elementFlags.push(2 /* ElementFlags.Optional */); if (!ts.isOmittedExpression(e) && !hasDefaultValue(e)) { @@ -80608,7 +81095,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } return checkExpressionForMutableLocation(node.initializer, checkMode); @@ -80619,7 +81106,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -80862,11 +81349,11 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 161 /* SyntaxKind.QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || - (node.parent.kind === 181 /* SyntaxKind.TypeQuery */ && node.parent.exprName === node)) || - (node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */); // We allow reexporting const enums + var ok = (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 163 /* SyntaxKind.QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || + (node.parent.kind === 183 /* SyntaxKind.TypeQuery */ && node.parent.exprName === node)) || + (node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */); // We allow reexporting const enums if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query); } @@ -80891,9 +81378,9 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } } @@ -80924,80 +81411,82 @@ var ts; return trueType; case 95 /* SyntaxKind.FalseKeyword */: return falseType; - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return checkTemplateExpression(node); case 13 /* SyntaxKind.RegularExpressionLiteral */: return globalRegExpType; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return checkArrayLiteral(node, checkMode, forceTuple); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return checkObjectLiteral(node, checkMode); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return checkPropertyAccessExpression(node, checkMode); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return checkQualifiedName(node, checkMode); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return checkIndexedAccess(node, checkMode); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (node.expression.kind === 100 /* SyntaxKind.ImportKeyword */) { return checkImportCallExpression(node); } // falls through - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return checkCallExpression(node, checkMode); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return checkParenthesizedExpression(node, checkMode); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return checkClassExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return checkTypeOfExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return checkAssertion(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return checkNonNullAssertion(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return checkExpressionWithTypeArguments(node); - case 231 /* SyntaxKind.MetaProperty */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return checkSatisfiesExpression(node); + case 233 /* SyntaxKind.MetaProperty */: return checkMetaProperty(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return checkDeleteExpression(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return checkVoidExpression(node); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return checkAwaitExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return checkBinaryExpression(node, checkMode); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return checkConditionalExpression(node, checkMode); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return checkSpreadExpression(node, checkMode); - case 227 /* SyntaxKind.OmittedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: return undefinedWideningType; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return checkYieldExpression(node); - case 232 /* SyntaxKind.SyntheticExpression */: + case 234 /* SyntaxKind.SyntheticExpression */: return checkSyntheticExpression(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return checkJsxExpression(node, checkMode); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return checkJsxElement(node, checkMode); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return checkJsxSelfClosingElement(node, checkMode); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return checkJsxFragment(node); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return checkJsxAttributes(node, checkMode); - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return errorType; @@ -81056,10 +81545,10 @@ var ts; checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); if (ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */)) { - if (!(func.kind === 171 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 173 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } - if (func.kind === 171 /* SyntaxKind.Constructor */ && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { + if (func.kind === 173 /* SyntaxKind.Constructor */ && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { error(node.name, ts.Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name); } } @@ -81070,13 +81559,13 @@ var ts; if (func.parameters.indexOf(node) !== 0) { error(node, ts.Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText); } - if (func.kind === 171 /* SyntaxKind.Constructor */ || func.kind === 175 /* SyntaxKind.ConstructSignature */ || func.kind === 180 /* SyntaxKind.ConstructorType */) { + if (func.kind === 173 /* SyntaxKind.Constructor */ || func.kind === 177 /* SyntaxKind.ConstructSignature */ || func.kind === 182 /* SyntaxKind.ConstructorType */) { error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); } - if (func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 216 /* SyntaxKind.ArrowFunction */) { error(node, ts.Diagnostics.An_arrow_function_cannot_have_a_this_parameter); } - if (func.kind === 172 /* SyntaxKind.GetAccessor */ || func.kind === 173 /* SyntaxKind.SetAccessor */) { + if (func.kind === 174 /* SyntaxKind.GetAccessor */ || func.kind === 175 /* SyntaxKind.SetAccessor */) { error(node, ts.Diagnostics.get_and_set_accessors_cannot_declare_this_parameters); } } @@ -81134,13 +81623,13 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 174 /* SyntaxKind.CallSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 179 /* SyntaxKind.FunctionType */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 181 /* SyntaxKind.FunctionType */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: var parent = node.parent; if (node === parent.type) { return parent; @@ -81158,7 +81647,7 @@ var ts; error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ || name.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + else if (name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ || name.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } @@ -81167,13 +81656,13 @@ var ts; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 176 /* SyntaxKind.IndexSignature */) { + if (node.kind === 178 /* SyntaxKind.IndexSignature */) { checkGrammarIndexSignature(node); } // TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled - else if (node.kind === 179 /* SyntaxKind.FunctionType */ || node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 180 /* SyntaxKind.ConstructorType */ || - node.kind === 174 /* SyntaxKind.CallSignature */ || node.kind === 171 /* SyntaxKind.Constructor */ || - node.kind === 175 /* SyntaxKind.ConstructSignature */) { + else if (node.kind === 181 /* SyntaxKind.FunctionType */ || node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 182 /* SyntaxKind.ConstructorType */ || + node.kind === 176 /* SyntaxKind.CallSignature */ || node.kind === 173 /* SyntaxKind.Constructor */ || + node.kind === 177 /* SyntaxKind.ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } var functionFlags = ts.getFunctionFlags(node); @@ -81205,10 +81694,10 @@ var ts; var returnTypeNode = ts.getEffectiveReturnTypeNode(node); if (noImplicitAny && !returnTypeNode) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -81238,7 +81727,7 @@ var ts; checkAsyncFunctionReturnType(node, returnTypeNode); } } - if (node.kind !== 176 /* SyntaxKind.IndexSignature */ && node.kind !== 317 /* SyntaxKind.JSDocFunctionType */) { + if (node.kind !== 178 /* SyntaxKind.IndexSignature */ && node.kind !== 320 /* SyntaxKind.JSDocFunctionType */) { registerForUnusedIdentifiersCheck(node); } } @@ -81250,7 +81739,7 @@ var ts; var privateIdentifiers = new ts.Map(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 171 /* SyntaxKind.Constructor */) { + if (member.kind === 173 /* SyntaxKind.Constructor */) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; if (ts.isParameterPropertyDeclaration(param, member) && !ts.isBindingPattern(param.name)) { @@ -81272,16 +81761,16 @@ var ts; var memberName = name && ts.getPropertyNameForPropertyNameNode(name); if (memberName) { switch (member.kind) { - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: addName(names, name, memberName, 1 /* DeclarationMeaning.GetAccessor */ | privateStaticFlags); break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: addName(names, name, memberName, 2 /* DeclarationMeaning.SetAccessor */ | privateStaticFlags); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: addName(names, name, memberName, 3 /* DeclarationMeaning.GetOrSetAccessor */ | privateStaticFlags); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: addName(names, name, memberName, 8 /* DeclarationMeaning.Method */ | privateStaticFlags); break; } @@ -81353,7 +81842,7 @@ var ts; var names = new ts.Map(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 166 /* SyntaxKind.PropertySignature */) { + if (member.kind === 168 /* SyntaxKind.PropertySignature */) { var memberName = void 0; var name = member.name; switch (name.kind) { @@ -81378,7 +81867,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); // in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration // to prevent this run check only for the first declaration of a given kind @@ -81392,7 +81881,7 @@ var ts; var indexSymbol = getIndexSymbol(getSymbolOfNode(node)); if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) { var indexSignatureMap_1 = new ts.Map(); - var _loop_29 = function (declaration) { + var _loop_30 = function (declaration) { if (declaration.parameters.length === 1 && declaration.parameters[0].type) { forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) { var entry = indexSignatureMap_1.get(getTypeId(type)); @@ -81407,7 +81896,7 @@ var ts; }; for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - _loop_29(declaration); + _loop_30(declaration); } indexSignatureMap_1.forEach(function (entry) { if (entry.declarations.length > 1) { @@ -81426,7 +81915,7 @@ var ts; checkVariableLikeDeclaration(node); setNodeLinksForPrivateIdentifierScope(node); // property signatures already report "initializer not allowed in ambient context" elsewhere - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */) && node.kind === 167 /* SyntaxKind.PropertyDeclaration */ && node.initializer) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */) && node.kind === 169 /* SyntaxKind.PropertyDeclaration */ && node.initializer) { error(node, ts.Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } } @@ -81446,7 +81935,7 @@ var ts; // Grammar checking for modifiers is done inside the function checkGrammarFunctionLikeDeclaration checkFunctionOrMethodDeclaration(node); // method signatures already report "implementation not allowed in ambient context" elsewhere - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */) && node.kind === 169 /* SyntaxKind.MethodDeclaration */ && node.body) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */) && node.kind === 171 /* SyntaxKind.MethodDeclaration */ && node.body) { error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } // Private named methods are only allowed in class declarations @@ -81499,7 +81988,7 @@ var ts; if (ts.isPrivateIdentifierClassElementDeclaration(n)) { return true; } - return n.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + return n.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(n) && !!n.initializer; } @@ -81582,7 +82071,7 @@ var ts; checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { if (!(node.flags & 16777216 /* NodeFlags.Ambient */) && ts.nodeIsPresent(node.body) && (node.flags & 256 /* NodeFlags.HasImplicitReturn */)) { if (!(node.flags & 512 /* NodeFlags.HasExplicitReturn */)) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); @@ -81592,20 +82081,20 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } if (hasBindableName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. var symbol = getSymbolOfNode(node); - var getter = ts.getDeclarationOfKind(symbol, 172 /* SyntaxKind.GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 174 /* SyntaxKind.GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */); if (getter && setter && !(getNodeCheckFlags(getter) & 1 /* NodeCheckFlags.TypeChecked */)) { getNodeLinks(getter).flags |= 1 /* NodeCheckFlags.TypeChecked */; var getterFlags = ts.getEffectiveModifierFlags(getter); var setterFlags = ts.getEffectiveModifierFlags(setter); - if ((getterFlags & 128 /* ModifierFlags.Abstract */) !== (setterFlags & 128 /* ModifierFlags.Abstract */)) { + if ((getterFlags & 256 /* ModifierFlags.Abstract */) !== (setterFlags & 256 /* ModifierFlags.Abstract */)) { error(getter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); error(setter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); } @@ -81622,7 +82111,7 @@ var ts; } } var returnType = getTypeOfAccessors(getSymbolOfNode(node)); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } @@ -81631,7 +82120,7 @@ var ts; checkDecorators(node); } function getEffectiveTypeArgumentAtIndex(node, typeParameters, index) { - if (index < typeParameters.length) { + if (node.typeArguments && index < node.typeArguments.length) { return getTypeFromTypeNode(node.typeArguments[index]); } return getEffectiveTypeArguments(node, typeParameters)[index]; @@ -81668,7 +82157,7 @@ var ts; } function checkTypeReferenceNode(node) { checkGrammarTypeArguments(node, node.typeArguments); - if (node.kind === 178 /* SyntaxKind.TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { grammarErrorAtPos(node, node.typeName.jsdocDotPos, 1, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); } ts.forEach(node.typeArguments, checkSourceElement); @@ -81726,7 +82215,7 @@ var ts; var hasNamedElement = ts.some(elementTypes, ts.isNamedTupleMember); for (var _i = 0, elementTypes_1 = elementTypes; _i < elementTypes_1.length; _i++) { var e = elementTypes_1[_i]; - if (e.kind !== 197 /* SyntaxKind.NamedTupleMember */ && hasNamedElement) { + if (e.kind !== 199 /* SyntaxKind.NamedTupleMember */ && hasNamedElement) { grammarErrorOnNode(e, ts.Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names); break; } @@ -81775,7 +82264,7 @@ var ts; var objectType = type.objectType; var indexType = type.indexType; if (isTypeAssignableTo(indexType, getIndexType(objectType, /*stringsOnly*/ false))) { - if (accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && + if (accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && ts.getObjectFlags(objectType) & 32 /* ObjectFlags.Mapped */ && getMappedTypeModifiers(objectType) & 1 /* MappedTypeModifiers.IncludeReadonly */) { error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); } @@ -81840,7 +82329,7 @@ var ts; ts.forEachChild(node, checkSourceElement); } function checkInferType(node) { - if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 189 /* SyntaxKind.ConditionalType */ && n.parent.extendsType === n; })) { + if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 191 /* SyntaxKind.ConditionalType */ && n.parent.extendsType === n; })) { grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type); } checkSourceElement(node.typeParameter); @@ -81850,7 +82339,7 @@ var ts; if (!links.typeParametersChecked) { links.typeParametersChecked = true; var typeParameter = getDeclaredTypeOfTypeParameter(symbol); - var declarations = ts.getDeclarationsOfKind(symbol, 163 /* SyntaxKind.TypeParameter */); + var declarations = ts.getDeclarationsOfKind(symbol, 165 /* SyntaxKind.TypeParameter */); if (!areTypeParametersIdentical(declarations, [typeParameter], function (decl) { return [decl]; })) { // Report an error on every conflicting declaration. var name = symbolToString(symbol); @@ -81891,10 +82380,10 @@ var ts; if (node.dotDotDotToken && node.questionToken) { grammarErrorOnNode(node, ts.Diagnostics.A_tuple_member_cannot_be_both_optional_and_rest); } - if (node.type.kind === 185 /* SyntaxKind.OptionalType */) { + if (node.type.kind === 187 /* SyntaxKind.OptionalType */) { grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type); } - if (node.type.kind === 186 /* SyntaxKind.RestType */) { + if (node.type.kind === 188 /* SyntaxKind.RestType */) { grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type); } checkSourceElement(node.type); @@ -81907,9 +82396,9 @@ var ts; var flags = ts.getCombinedModifierFlags(n); // children of classes (even ambient classes) should not be marked as ambient or export // because those flags have no useful semantics there. - if (n.parent.kind !== 258 /* SyntaxKind.InterfaceDeclaration */ && - n.parent.kind !== 257 /* SyntaxKind.ClassDeclaration */ && - n.parent.kind !== 226 /* SyntaxKind.ClassExpression */ && + if (n.parent.kind !== 261 /* SyntaxKind.InterfaceDeclaration */ && + n.parent.kind !== 260 /* SyntaxKind.ClassDeclaration */ && + n.parent.kind !== 228 /* SyntaxKind.ClassExpression */ && n.flags & 16777216 /* NodeFlags.Ambient */) { if (!(flags & 2 /* ModifierFlags.Ambient */) && !(ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent))) { // It is nested in an ambient context, which means it is automatically exported @@ -81949,7 +82438,7 @@ var ts; else if (deviation & (8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */)) { error(ts.getNameOfDeclaration(o) || o, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } - else if (deviation & 128 /* ModifierFlags.Abstract */) { + else if (deviation & 256 /* ModifierFlags.Abstract */) { error(ts.getNameOfDeclaration(o), ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract); } }); @@ -81966,7 +82455,7 @@ var ts; }); } } - var flagsToCheck = 1 /* ModifierFlags.Export */ | 2 /* ModifierFlags.Ambient */ | 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | 128 /* ModifierFlags.Abstract */; + var flagsToCheck = 1 /* ModifierFlags.Export */ | 2 /* ModifierFlags.Ambient */ | 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | 256 /* ModifierFlags.Abstract */; var someNodeFlags = 0 /* ModifierFlags.None */; var allNodeFlags = flagsToCheck; var someHaveQuestionToken = false; @@ -82005,7 +82494,7 @@ var ts; // Both are literal property names that are the same. ts.isPropertyNameLiteral(node.name) && ts.isPropertyNameLiteral(subsequentName) && ts.getEscapedTextOfIdentifierOrLiteral(node.name) === ts.getEscapedTextOfIdentifierOrLiteral(subsequentName))) { - var reportError = (node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 168 /* SyntaxKind.MethodSignature */) && + var reportError = (node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 170 /* SyntaxKind.MethodSignature */) && ts.isStatic(node) !== ts.isStatic(subsequentNode); // we can get here in two cases // 1. mixed static and instance class members @@ -82030,7 +82519,7 @@ var ts; else { // Report different errors regarding non-consecutive blocks of declarations depending on whether // the node in question is abstract. - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)) { error(errorNode, ts.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive); } else { @@ -82047,7 +82536,7 @@ var ts; var current = declarations_5[_i]; var node = current; var inAmbientContext = node.flags & 16777216 /* NodeFlags.Ambient */; - var inAmbientContextOrInterface = node.parent && (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || node.parent.kind === 182 /* SyntaxKind.TypeLiteral */) || inAmbientContext; + var inAmbientContextOrInterface = node.parent && (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || node.parent.kind === 184 /* SyntaxKind.TypeLiteral */) || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -82058,10 +82547,10 @@ var ts; // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one previousDeclaration = undefined; } - if ((node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */) && !inAmbientContext) { + if ((node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */) && !inAmbientContext) { hasNonAmbientClass = true; } - if (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 168 /* SyntaxKind.MethodSignature */ || node.kind === 171 /* SyntaxKind.Constructor */) { + if (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 170 /* SyntaxKind.MethodSignature */ || node.kind === 173 /* SyntaxKind.Constructor */) { functionDeclarations.push(node); var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; @@ -82106,12 +82595,12 @@ var ts; }); } if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 /* SymbolFlags.Function */ && declarations) { - var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 257 /* SyntaxKind.ClassDeclaration */; }) + var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 260 /* SyntaxKind.ClassDeclaration */; }) .map(function (d) { return ts.createDiagnosticForNode(d, ts.Diagnostics.Consider_adding_a_declare_modifier_to_this_class); }); ts.forEach(declarations, function (declaration) { - var diagnostic = declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ + var diagnostic = declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ ? ts.Diagnostics.Class_declaration_cannot_implement_overload_list_for_0 - : declaration.kind === 256 /* SyntaxKind.FunctionDeclaration */ + : declaration.kind === 259 /* SyntaxKind.FunctionDeclaration */ ? ts.Diagnostics.Function_with_bodies_can_only_merge_with_classes_that_are_ambient : undefined; if (diagnostic) { @@ -82121,7 +82610,7 @@ var ts; } // Abstract methods can't have an implementation -- in particular, they don't need one. if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && - !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 128 /* ModifierFlags.Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) { + !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 256 /* ModifierFlags.Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } if (hasOverloads) { @@ -82167,9 +82656,9 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var d = _a[_i]; var declarationSpaces = getDeclarationSpaces(d); - var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* ModifierFlags.Export */ | 512 /* ModifierFlags.Default */); + var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* ModifierFlags.Export */ | 1024 /* ModifierFlags.Default */); if (effectiveDeclarationFlags & 1 /* ModifierFlags.Export */) { - if (effectiveDeclarationFlags & 512 /* ModifierFlags.Default */) { + if (effectiveDeclarationFlags & 1024 /* ModifierFlags.Default */) { defaultExportedDeclarationSpaces |= declarationSpaces; } else { @@ -82202,26 +82691,26 @@ var ts; function getDeclarationSpaces(decl) { var d = decl; switch (d.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // A jsdoc typedef and callback are, by definition, type aliases. // falls through - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return 2 /* DeclarationSpaces.ExportType */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* ModuleInstanceState.NonInstantiated */ ? 4 /* DeclarationSpaces.ExportNamespace */ | 1 /* DeclarationSpaces.ExportValue */ : 4 /* DeclarationSpaces.ExportNamespace */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: return 2 /* DeclarationSpaces.ExportType */ | 1 /* DeclarationSpaces.ExportValue */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 2 /* DeclarationSpaces.ExportType */ | 1 /* DeclarationSpaces.ExportValue */ | 4 /* DeclarationSpaces.ExportNamespace */; - case 271 /* SyntaxKind.ExportAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: + case 274 /* SyntaxKind.ExportAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: var node_2 = d; var expression = ts.isExportAssignment(node_2) ? node_2.expression : node_2.right; // Export assigned entity name expressions act as aliases and should fall through, otherwise they export values @@ -82231,19 +82720,19 @@ var ts; d = expression; // The below options all declare an Alias, which is allowed to merge with other values within the importing module. // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 267 /* SyntaxKind.ImportClause */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: var result_12 = 0 /* DeclarationSpaces.None */; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_12 |= getDeclarationSpaces(d); }); return result_12; - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 case 79 /* SyntaxKind.Identifier */: // https://github.com/microsoft/TypeScript/issues/36098 // Identifiers are used as declarations of assignment declarations whose parents may be // SyntaxKind.CallExpression - `Object.defineProperty(thing, "aField", {value: 42});` @@ -82656,20 +83145,20 @@ var ts; var headMessage; var expectedReturnType; switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: headMessage = ts.Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any; expectedReturnType = voidType; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); @@ -82728,15 +83217,15 @@ var ts; function getEntityNameForDecoratorMetadata(node) { if (node) { switch (node.kind) { - case 188 /* SyntaxKind.IntersectionType */: - case 187 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: return getEntityNameForDecoratorMetadataFromTypeList(node.types); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]); - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: return getEntityNameForDecoratorMetadata(node.type); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; } } @@ -82745,13 +83234,13 @@ var ts; var commonEntityName; for (var _i = 0, types_21 = types; _i < types_21.length; _i++) { var typeNode = types_21[_i]; - while (typeNode.kind === 191 /* SyntaxKind.ParenthesizedType */ || typeNode.kind === 197 /* SyntaxKind.NamedTupleMember */) { + while (typeNode.kind === 193 /* SyntaxKind.ParenthesizedType */ || typeNode.kind === 199 /* SyntaxKind.NamedTupleMember */) { typeNode = typeNode.type; // Skip parens if need be } - if (typeNode.kind === 143 /* SyntaxKind.NeverKeyword */) { + if (typeNode.kind === 144 /* SyntaxKind.NeverKeyword */) { continue; // Always elide `never` from the union/intersection if possible } - if (!strictNullChecks && (typeNode.kind === 196 /* SyntaxKind.LiteralType */ && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */ || typeNode.kind === 153 /* SyntaxKind.UndefinedKeyword */)) { + if (!strictNullChecks && (typeNode.kind === 198 /* SyntaxKind.LiteralType */ && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */ || typeNode.kind === 155 /* SyntaxKind.UndefinedKeyword */)) { continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks } var individualEntityName = getEntityNameForDecoratorMetadata(typeNode); @@ -82797,14 +83286,14 @@ var ts; return; } checkExternalEmitHelpers(firstDecorator, 8 /* ExternalEmitHelpers.Decorate */); - if (node.kind === 164 /* SyntaxKind.Parameter */) { + if (node.kind === 166 /* SyntaxKind.Parameter */) { checkExternalEmitHelpers(firstDecorator, 32 /* ExternalEmitHelpers.Param */); } if (compilerOptions.emitDecoratorMetadata) { checkExternalEmitHelpers(firstDecorator, 16 /* ExternalEmitHelpers.Metadata */); // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -82813,23 +83302,23 @@ var ts; } } break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - var otherKind = node.kind === 172 /* SyntaxKind.GetAccessor */ ? 173 /* SyntaxKind.SetAccessor */ : 172 /* SyntaxKind.GetAccessor */; + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + var otherKind = node.kind === 174 /* SyntaxKind.GetAccessor */ ? 175 /* SyntaxKind.SetAccessor */ : 174 /* SyntaxKind.GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind); markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor)); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveReturnTypeNode(node)); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveTypeAnnotationNode(node)); break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); var containingSignature = node.parent; for (var _d = 0, _e = containingSignature.parameters; _d < _e.length; _d++) { @@ -82931,7 +83420,7 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.name; default: return undefined; @@ -82945,7 +83434,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name && node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name && node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -82971,7 +83460,7 @@ var ts; checkFunctionOrConstructorSymbol(symbol); } } - var body = node.kind === 168 /* SyntaxKind.MethodSignature */ ? undefined : node.body; + var body = node.kind === 170 /* SyntaxKind.MethodSignature */ ? undefined : node.body; checkSourceElement(body); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, getReturnTypeFromAnnotation(node)); addLazyDiagnostic(checkFunctionOrMethodDeclarationDiagnostics); @@ -83017,42 +83506,42 @@ var ts; for (var _i = 0, potentiallyUnusedIdentifiers_1 = potentiallyUnusedIdentifiers; _i < potentiallyUnusedIdentifiers_1.length; _i++) { var node = potentiallyUnusedIdentifiers_1[_i]; switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: checkUnusedClassMembers(node, addDiagnostic); checkUnusedTypeParameters(node, addDiagnostic); break; - case 305 /* SyntaxKind.SourceFile */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 308 /* SyntaxKind.SourceFile */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: checkUnusedLocalsAndParameters(node, addDiagnostic); break; - case 171 /* SyntaxKind.Constructor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: if (node.body) { // Don't report unused parameters in overloads checkUnusedLocalsAndParameters(node, addDiagnostic); } checkUnusedTypeParameters(node, addDiagnostic); break; - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: checkUnusedTypeParameters(node, addDiagnostic); break; - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: checkUnusedInferTypeParameter(node, addDiagnostic); break; default: @@ -83072,11 +83561,11 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - if (member.kind === 173 /* SyntaxKind.SetAccessor */ && member.symbol.flags & 32768 /* SymbolFlags.GetAccessor */) { + case 171 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + if (member.kind === 175 /* SyntaxKind.SetAccessor */ && member.symbol.flags & 32768 /* SymbolFlags.GetAccessor */) { // Already would have reported an error on the getter. break; } @@ -83087,7 +83576,7 @@ var ts; addDiagnostic(member, 0 /* UnusedKind.Local */, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol))); } break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; if (!parameter.symbol.isReferenced && ts.hasSyntacticModifier(parameter, 8 /* ModifierFlags.Private */)) { @@ -83095,9 +83584,9 @@ var ts; } } break; - case 176 /* SyntaxKind.IndexSignature */: - case 234 /* SyntaxKind.SemicolonClassElement */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: + case 237 /* SyntaxKind.SemicolonClassElement */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // Can't be private break; default: @@ -83125,7 +83614,7 @@ var ts; continue; var name = ts.idText(typeParameter.name); var parent = typeParameter.parent; - if (parent.kind !== 190 /* SyntaxKind.InferType */ && parent.typeParameters.every(isTypeParameterUnused)) { + if (parent.kind !== 192 /* SyntaxKind.InferType */ && parent.typeParameters.every(isTypeParameterUnused)) { if (ts.tryAddToSet(seenParentsWithEveryUnused, parent)) { var sourceFile = ts.getSourceFileOfNode(parent); var range = ts.isJSDocTemplateTag(parent) @@ -83231,7 +83720,7 @@ var ts; var importDecl = importClause.parent; var nDeclarations = (importClause.name ? 1 : 0) + (importClause.namedBindings ? - (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? 1 : importClause.namedBindings.elements.length) + (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? 1 : importClause.namedBindings.elements.length) : 0); if (nDeclarations === unuseds.length) { addDiagnostic(importDecl, 0 /* UnusedKind.Local */, unuseds.length === 1 @@ -83249,7 +83738,7 @@ var ts; var bindingPattern = _a[0], bindingElements = _a[1]; var kind = tryGetRootParameterDeclaration(bindingPattern.parent) ? 1 /* UnusedKind.Parameter */ : 0 /* UnusedKind.Local */; if (bindingPattern.elements.length === bindingElements.length) { - if (bindingElements.length === 1 && bindingPattern.parent.kind === 254 /* SyntaxKind.VariableDeclaration */ && bindingPattern.parent.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (bindingElements.length === 1 && bindingPattern.parent.kind === 257 /* SyntaxKind.VariableDeclaration */ && bindingPattern.parent.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */) { addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId); } else { @@ -83270,7 +83759,7 @@ var ts; if (declarationList.declarations.length === declarations.length) { addDiagnostic(declarationList, 0 /* UnusedKind.Local */, declarations.length === 1 ? ts.createDiagnosticForNode(ts.first(declarations).name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(ts.first(declarations).name)) - : ts.createDiagnosticForNode(declarationList.parent.kind === 237 /* SyntaxKind.VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); + : ts.createDiagnosticForNode(declarationList.parent.kind === 240 /* SyntaxKind.VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); } else { for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { @@ -83300,22 +83789,22 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return ts.idText(name); - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return bindingNameText(ts.cast(ts.first(name.elements), ts.isBindingElement).name); default: return ts.Debug.assertNever(name); } } function isImportedDeclaration(node) { - return node.kind === 267 /* SyntaxKind.ImportClause */ || node.kind === 270 /* SyntaxKind.ImportSpecifier */ || node.kind === 268 /* SyntaxKind.NamespaceImport */; + return node.kind === 270 /* SyntaxKind.ImportClause */ || node.kind === 273 /* SyntaxKind.ImportSpecifier */ || node.kind === 271 /* SyntaxKind.NamespaceImport */; } function importClauseFromImported(decl) { - return decl.kind === 267 /* SyntaxKind.ImportClause */ ? decl : decl.kind === 268 /* SyntaxKind.NamespaceImport */ ? decl.parent : decl.parent.parent; + return decl.kind === 270 /* SyntaxKind.ImportClause */ ? decl : decl.kind === 271 /* SyntaxKind.NamespaceImport */ ? decl.parent : decl.parent.parent; } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 235 /* SyntaxKind.Block */) { + if (node.kind === 238 /* SyntaxKind.Block */) { checkGrammarStatementInAmbientContext(node); } if (ts.isFunctionOrModuleBlock(node)) { @@ -83350,13 +83839,13 @@ var ts; if ((identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) !== name) { return false; } - if (node.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - node.kind === 166 /* SyntaxKind.PropertySignature */ || - node.kind === 169 /* SyntaxKind.MethodDeclaration */ || - node.kind === 168 /* SyntaxKind.MethodSignature */ || - node.kind === 172 /* SyntaxKind.GetAccessor */ || - node.kind === 173 /* SyntaxKind.SetAccessor */ || - node.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (node.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + node.kind === 168 /* SyntaxKind.PropertySignature */ || + node.kind === 171 /* SyntaxKind.MethodDeclaration */ || + node.kind === 170 /* SyntaxKind.MethodSignature */ || + node.kind === 174 /* SyntaxKind.GetAccessor */ || + node.kind === 175 /* SyntaxKind.SetAccessor */ || + node.kind === 299 /* SyntaxKind.PropertyAssignment */) { // it is ok to have member named '_super', '_this', `Promise`, etc. - member access is always qualified return false; } @@ -83422,7 +83911,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -83437,7 +83926,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048 /* NodeFlags.HasAsyncFunctions */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048 /* NodeFlags.HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -83537,7 +84026,7 @@ var ts; // skip variable declarations that don't have initializers // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern // so we'll always treat binding elements as initialized - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ && !node.initializer) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -83549,17 +84038,17 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* SymbolFlags.BlockScopedVariable */) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* NodeFlags.BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); - var container = varDeclList.parent.kind === 237 /* SyntaxKind.VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); + var container = varDeclList.parent.kind === 240 /* SyntaxKind.VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; // names of block-scoped and function scoped variables can collide only // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) var namesShareScope = container && - (container.kind === 235 /* SyntaxKind.Block */ && ts.isFunctionLike(container.parent) || - container.kind === 262 /* SyntaxKind.ModuleBlock */ || - container.kind === 261 /* SyntaxKind.ModuleDeclaration */ || - container.kind === 305 /* SyntaxKind.SourceFile */); + (container.kind === 238 /* SyntaxKind.Block */ && ts.isFunctionLike(container.parent) || + container.kind === 265 /* SyntaxKind.ModuleBlock */ || + container.kind === 264 /* SyntaxKind.ModuleDeclaration */ || + container.kind === 308 /* SyntaxKind.SourceFile */); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error // otherwise if variable has an initializer - show error that initialization will fail @@ -83590,7 +84079,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); if (ts.hasOnlyExpressionInitializer(node) && node.initializer) { checkExpressionCached(node.initializer); @@ -83612,7 +84101,7 @@ var ts; checkExternalEmitHelpers(node, 4 /* ExternalEmitHelpers.Rest */); } // check computed properties inside property names of binding elements - if (node.propertyName && node.propertyName.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.propertyName && node.propertyName.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.propertyName); } // check private/protected variable access @@ -83634,7 +84123,7 @@ var ts; } // For a binding pattern, check contained binding elements if (ts.isBindingPattern(node.name)) { - if (node.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && languageVersion < 2 /* ScriptTarget.ES2015 */ && compilerOptions.downlevelIteration) { + if (node.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && languageVersion < 2 /* ScriptTarget.ES2015 */ && compilerOptions.downlevelIteration) { checkExternalEmitHelpers(node, 512 /* ExternalEmitHelpers.Read */); } ts.forEach(node.name.elements, checkSourceElement); @@ -83646,7 +84135,7 @@ var ts; } // For a binding pattern, validate the initializer and exit if (ts.isBindingPattern(node.name)) { - var needCheckInitializer = ts.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */; + var needCheckInitializer = ts.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */; var needCheckWidenedType = !ts.some(node.name.elements, ts.not(ts.isOmittedExpression)); if (needCheckInitializer || needCheckWidenedType) { // Don't validate for-in initializer as it is already an error @@ -83674,7 +84163,7 @@ var ts; } // For a commonjs `const x = require`, validate the alias and exit var symbol = getSymbolOfNode(node); - if (symbol.flags & 2097152 /* SymbolFlags.Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 203 /* SyntaxKind.BindingElement */ ? node.parent.parent : node)) { + if (symbol.flags & 2097152 /* SymbolFlags.Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 205 /* SyntaxKind.BindingElement */ ? node.parent.parent : node)) { checkAliasSymbol(node); return; } @@ -83688,7 +84177,7 @@ var ts; ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || ts.isPrototypeAccess(node.name)) && !!((_a = symbol.exports) === null || _a === void 0 ? void 0 : _a.size); - if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */) { + if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */) { checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(initializer), type, node, initializer, /*headMessage*/ undefined); } } @@ -83714,10 +84203,10 @@ var ts; error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name)); } } - if (node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 166 /* SyntaxKind.PropertySignature */) { + if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 168 /* SyntaxKind.PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionsForDeclarationName(node, node.name); @@ -83725,7 +84214,7 @@ var ts; } function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) { var nextDeclarationName = ts.getNameOfDeclaration(nextDeclaration); - var message = nextDeclaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ || nextDeclaration.kind === 166 /* SyntaxKind.PropertySignature */ + var message = nextDeclaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ || nextDeclaration.kind === 168 /* SyntaxKind.PropertySignature */ ? ts.Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2 : ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2; var declName = ts.declarationNameToString(nextDeclarationName); @@ -83735,8 +84224,8 @@ var ts; } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 164 /* SyntaxKind.Parameter */ && right.kind === 254 /* SyntaxKind.VariableDeclaration */) || - (left.kind === 254 /* SyntaxKind.VariableDeclaration */ && right.kind === 164 /* SyntaxKind.Parameter */)) { + if ((left.kind === 166 /* SyntaxKind.Parameter */ && right.kind === 257 /* SyntaxKind.VariableDeclaration */) || + (left.kind === 257 /* SyntaxKind.VariableDeclaration */ && right.kind === 166 /* SyntaxKind.Parameter */)) { // Differences in optionality between parameters and variables are allowed. return true; } @@ -83745,8 +84234,8 @@ var ts; } var interestingFlags = 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | - 256 /* ModifierFlags.Async */ | - 128 /* ModifierFlags.Abstract */ | + 512 /* ModifierFlags.Async */ | + 256 /* ModifierFlags.Abstract */ | 64 /* ModifierFlags.Readonly */ | 32 /* ModifierFlags.Static */; return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags); @@ -83775,15 +84264,15 @@ var ts; function checkIfStatement(node) { // Grammar checking checkGrammarStatementInAmbientContext(node); - checkTruthinessExpression(node.expression); - checkTestingKnownTruthyCallableOrAwaitableType(node.expression, node.thenStatement); + var type = checkTruthinessExpression(node.expression); + checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 236 /* SyntaxKind.EmptyStatement */) { + if (node.thenStatement.kind === 239 /* SyntaxKind.EmptyStatement */) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); } - function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, body) { + function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, condType, body) { if (!strictNullChecks) return; helper(condExpr, body); @@ -83798,7 +84287,7 @@ var ts; : condExpr; if (ts.isModuleExportsAccessExpression(location)) return; - var type = checkTruthinessExpression(location); + var type = location === condExpr ? condType : checkTruthinessExpression(location); var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression); if (!(getTypeFacts(type) & 4194304 /* TypeFacts.Truthy */) || isPropertyExpressionCast) return; @@ -83912,12 +84401,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -83957,14 +84446,14 @@ var ts; // via checkRightHandSideOfForOf. // If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference. // Then check that the RHS is assignable to it. - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node); // There may be a destructuring assignment on the left side - if (varExpr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (varExpr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // iteratedType may be undefined. In this case, we still want to check the structure of // varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like // to short circuit the type relation checking as much as possible, so we pass the unknownType. @@ -83996,7 +84485,7 @@ var ts; // for (let VarDecl in Expr) Statement // VarDecl must be a variable declaration without a type annotation that declares a variable of type Any, // and Expr must be an expression of type Any, an object type, or a type parameter type. - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -84010,7 +84499,7 @@ var ts; // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (varExpr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { @@ -84810,12 +85299,12 @@ var ts; var functionFlags = ts.getFunctionFlags(container); if (strictNullChecks || node.expression || returnType.flags & 131072 /* TypeFlags.Never */) { var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; - if (container.kind === 173 /* SyntaxKind.SetAccessor */) { + if (container.kind === 175 /* SyntaxKind.SetAccessor */) { if (node.expression) { error(node, ts.Diagnostics.Setters_cannot_return_a_value); } } - else if (container.kind === 171 /* SyntaxKind.Constructor */) { + else if (container.kind === 173 /* SyntaxKind.Constructor */) { if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) { error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -84833,7 +85322,7 @@ var ts; } } } - else if (container.kind !== 171 /* SyntaxKind.Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { + else if (container.kind !== 173 /* SyntaxKind.Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { // The function has a return type, but the return statement doesn't have an expression. error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); } @@ -84862,7 +85351,7 @@ var ts; var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 290 /* SyntaxKind.DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 293 /* SyntaxKind.DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -84871,7 +85360,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { addLazyDiagnostic(createLazyCaseClauseDiagnostics(clause)); } ts.forEach(clause.statements, checkSourceElement); @@ -84908,7 +85397,7 @@ var ts; if (ts.isFunctionLike(current)) { return "quit"; } - if (current.kind === 250 /* SyntaxKind.LabeledStatement */ && current.label.escapedText === node.label.escapedText) { + if (current.kind === 253 /* SyntaxKind.LabeledStatement */ && current.label.escapedText === node.label.escapedText) { grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label)); return true; } @@ -85003,11 +85492,11 @@ var ts; return; } var indexInfos = getApplicableIndexInfos(type, propNameType); - var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* SyntaxKind.InterfaceDeclaration */) : undefined; - var propDeclaration = declaration && declaration.kind === 221 /* SyntaxKind.BinaryExpression */ || - name && name.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined; + var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined; + var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ || + name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined; var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined; - var _loop_30 = function (info) { + var _loop_31 = function (info) { var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined; // We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared // in the containing type, or (c) the containing type is an interface and no base interface contains both the property and @@ -85024,15 +85513,15 @@ var ts; }; for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) { var info = indexInfos_9[_i]; - _loop_30(info); + _loop_31(info); } } function checkIndexConstraintForIndexSignature(type, checkInfo) { var declaration = checkInfo.declaration; var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType); - var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* SyntaxKind.InterfaceDeclaration */) : undefined; + var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined; var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined; - var _loop_31 = function (info) { + var _loop_32 = function (info) { if (info === checkInfo) return "continue"; var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined; @@ -85047,7 +85536,7 @@ var ts; }; for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) { var info = indexInfos_10[_i]; - _loop_31(info); + _loop_32(info); } } function checkTypeNameIsReserved(name, message) { @@ -85150,7 +85639,7 @@ var ts; function checkTypeParametersNotReferenced(root, typeParameters, index) { visit(root); function visit(node) { - if (node.kind === 178 /* SyntaxKind.TypeReference */) { + if (node.kind === 180 /* SyntaxKind.TypeReference */) { var type = getTypeFromTypeReference(node); if (type.flags & 262144 /* TypeFlags.TypeParameter */) { for (var i = index; i < typeParameters.length; i++) { @@ -85240,7 +85729,7 @@ var ts; if (firstDecorator && ts.some(node.members, function (p) { return ts.hasStaticModifier(p) && ts.isPrivateIdentifierClassElementDeclaration(p); })) { grammarErrorOnNode(firstDecorator, ts.Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator); } - if (!node.name && !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (!node.name && !ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); } checkClassLikeDeclaration(node); @@ -85307,7 +85796,7 @@ var ts; } else { var constructSignatures = getSignaturesOfType(baseConstructorType, 1 /* SignatureKind.Construct */); - if (constructSignatures.some(function (signature) { return signature.flags & 4 /* SignatureFlags.Abstract */; }) && !ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)) { + if (constructSignatures.some(function (signature) { return signature.flags & 4 /* SignatureFlags.Abstract */; }) && !ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)) { error(node.name || node, ts.Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract); } } @@ -85367,7 +85856,7 @@ var ts; var baseTypes = baseTypeNode && getBaseTypes(type); var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined; var baseStaticType = getBaseConstructorTypeOfClass(type); - var _loop_32 = function (member) { + var _loop_33 = function (member) { if (ts.hasAmbientModifier(member)) { return "continue"; } @@ -85384,7 +85873,7 @@ var ts; }; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - _loop_32(member); + _loop_33(member); } } /** @@ -85472,7 +85961,7 @@ var ts; function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) { // iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible var issuedMemberError = false; - var _loop_33 = function (member) { + var _loop_34 = function (member) { if (ts.isStatic(member)) { return "continue"; } @@ -85491,7 +85980,7 @@ var ts; }; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - _loop_33(member); + _loop_34(member); } if (!issuedMemberError) { // check again with diagnostics to generate a less-specific error @@ -85542,7 +86031,7 @@ var ts; } function getClassOrInterfaceDeclarationsOfSymbol(symbol) { return ts.filter(symbol.declarations, function (d) { - return d.kind === 257 /* SyntaxKind.ClassDeclaration */ || d.kind === 258 /* SyntaxKind.InterfaceDeclaration */; + return d.kind === 260 /* SyntaxKind.ClassDeclaration */ || d.kind === 261 /* SyntaxKind.InterfaceDeclaration */; }); } function checkKindsOfPropertyMemberOverrides(type, baseType) { @@ -85562,7 +86051,7 @@ var ts; var _a, _b, _c, _d; // NOTE: assignability is checked in checkClassDeclaration var baseProperties = getPropertiesOfType(baseType); - var _loop_34 = function (baseProperty) { + var _loop_35 = function (baseProperty) { var base = getTargetSymbol(baseProperty); if (base.flags & 4194304 /* SymbolFlags.Prototype */) { return "continue"; @@ -85583,7 +86072,7 @@ var ts; // It is an error to inherit an abstract member without implementing it or being declared abstract. // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. - if (baseDeclarationFlags & 128 /* ModifierFlags.Abstract */ && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 128 /* ModifierFlags.Abstract */))) { + if (baseDeclarationFlags & 256 /* ModifierFlags.Abstract */ && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 256 /* ModifierFlags.Abstract */))) { // Searches other base types for a declaration that would satisfy the inherited abstract member. // (The class may have more than one base type via declaration merging with an interface with the // same name.) @@ -85597,7 +86086,7 @@ var ts; return "continue-basePropertyCheck"; } } - if (derivedClassDecl.kind === 226 /* SyntaxKind.ClassExpression */) { + if (derivedClassDecl.kind === 228 /* SyntaxKind.ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -85632,11 +86121,11 @@ var ts; error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_1, symbolToString(base), typeToString(baseType), typeToString(type)); } else if (useDefineForClassFields) { - var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !d.initializer; }); + var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !d.initializer; }); if (uninitialized && !(derived.flags & 33554432 /* SymbolFlags.Transient */) - && !(baseDeclarationFlags & 128 /* ModifierFlags.Abstract */) - && !(derivedDeclarationFlags & 128 /* ModifierFlags.Abstract */) + && !(baseDeclarationFlags & 256 /* ModifierFlags.Abstract */) + && !(derivedDeclarationFlags & 256 /* ModifierFlags.Abstract */) && !((_d = derived.declarations) === null || _d === void 0 ? void 0 : _d.some(function (d) { return !!(d.flags & 16777216 /* NodeFlags.Ambient */); }))) { var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol)); var propName = uninitialized.name; @@ -85672,14 +86161,14 @@ var ts; }; basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) { var baseProperty = baseProperties_1[_i]; - var state_10 = _loop_34(baseProperty); - switch (state_10) { + var state_11 = _loop_35(baseProperty); + switch (state_11) { case "continue-basePropertyCheck": continue basePropertyCheck; } } } function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) { - return baseDeclarationFlags & 128 /* ModifierFlags.Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer) + return baseDeclarationFlags & 256 /* ModifierFlags.Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer) || ts.isInterfaceDeclaration(declaration.parent); } function getNonInheritedProperties(type, baseTypes, properties) { @@ -85761,7 +86250,7 @@ var ts; } } function isPropertyWithoutInitializer(node) { - return node.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + return node.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.hasAbstractModifier(node) && !node.exclamationToken && !node.initializer; @@ -85804,7 +86293,7 @@ var ts; var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(symbol); // Only check this symbol once - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 258 /* SyntaxKind.InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.InterfaceDeclaration */); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -85837,7 +86326,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0); checkExportsOnMergedDeclarations(node); checkTypeParameters(node.typeParameters); - if (node.type.kind === 138 /* SyntaxKind.IntrinsicKeyword */) { + if (node.type.kind === 139 /* SyntaxKind.IntrinsicKeyword */) { if (!intrinsicTypeKinds.has(node.name.escapedText) || ts.length(node.typeParameters) !== 1) { error(node.type, ts.Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types); } @@ -85923,7 +86412,7 @@ var ts; return value; function evaluate(expr) { switch (expr.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var value_2 = evaluate(expr.operand); if (typeof value_2 === "number") { switch (expr.operator) { @@ -85933,7 +86422,7 @@ var ts; } } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var left = evaluate(expr.left); var right = evaluate(expr.right); if (typeof left === "number" && typeof right === "number") { @@ -85962,7 +86451,7 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: checkGrammarNumericLiteral(expr); return +expr.text; - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return evaluate(expr.expression); case 79 /* SyntaxKind.Identifier */: var identifier = expr; @@ -85970,13 +86459,13 @@ var ts; return +(identifier.escapedText); } return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText); - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (isConstantMemberAccess(expr)) { var type = getTypeOfExpression(expr.expression); if (type.symbol && type.symbol.flags & 384 /* SymbolFlags.Enum */) { var name = void 0; - if (expr.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (expr.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { name = expr.name.escapedText; } else { @@ -86013,8 +86502,8 @@ var ts; return false; } return node.kind === 79 /* SyntaxKind.Identifier */ || - node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || - node.kind === 207 /* SyntaxKind.ElementAccessExpression */ && isConstantMemberAccess(node.expression) && + node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || + node.kind === 209 /* SyntaxKind.ElementAccessExpression */ && isConstantMemberAccess(node.expression) && ts.isStringLiteralLike(node.argumentExpression); } function checkEnumDeclaration(node) { @@ -86048,7 +86537,7 @@ var ts; var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind !== 263 /* SyntaxKind.EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -86077,8 +86566,8 @@ var ts; if (declarations) { for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { var declaration = declarations_9[_i]; - if ((declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ || - (declaration.kind === 256 /* SyntaxKind.FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ || + (declaration.kind === 259 /* SyntaxKind.FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { return declaration; } @@ -86149,7 +86638,7 @@ var ts; } // if the module merges with a class declaration in the same lexical scope, // we need to track this to ensure the correct emit. - var mergedClass = ts.getDeclarationOfKind(symbol, 257 /* SyntaxKind.ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 260 /* SyntaxKind.ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* NodeCheckFlags.LexicalModuleMergesWithClass */; @@ -86194,23 +86683,23 @@ var ts; function checkModuleAugmentationElement(node, isGlobalAugmentation) { var _a; switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // error each individual name in variable statement instead of marking the entire variable statement for (var _i = 0, _b = node.declarationList.declarations; _i < _b.length; _i++) { var decl = _b[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 203 /* SyntaxKind.BindingElement */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: var name = node.name; if (ts.isBindingPattern(name)) { for (var _c = 0, _d = name.elements; _c < _d.length; _c++) { @@ -86221,12 +86710,12 @@ var ts; break; } // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: if (isGlobalAugmentation) { return; } @@ -86249,12 +86738,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.left; } while (node.kind !== 79 /* SyntaxKind.Identifier */); return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: do { if (ts.isModuleExportsAccessExpression(node.expression) && !ts.isPrivateIdentifier(node.name)) { return node.name; @@ -86274,9 +86763,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 305 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 272 /* SyntaxKind.ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 308 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 275 /* SyntaxKind.ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -86323,8 +86812,8 @@ var ts; var errorNode = ts.isImportOrExportSpecifier(node) ? node.propertyName || node.name : ts.isNamedDeclaration(node) ? node.name : node; - ts.Debug.assert(node.kind !== 274 /* SyntaxKind.NamespaceExport */); - if (node.kind === 275 /* SyntaxKind.ExportSpecifier */) { + ts.Debug.assert(node.kind !== 277 /* SyntaxKind.NamespaceExport */); + if (node.kind === 278 /* SyntaxKind.ExportSpecifier */) { var diag = error(errorNode, ts.Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files); var alreadyExportedSymbol = (_b = (_a = ts.getSourceFileOfNode(node).symbol) === null || _a === void 0 ? void 0 : _a.exports) === null || _b === void 0 ? void 0 : _b.get((node.propertyName || node.name).escapedText); if (alreadyExportedSymbol === target) { @@ -86335,7 +86824,7 @@ var ts; } } else { - ts.Debug.assert(node.kind !== 254 /* SyntaxKind.VariableDeclaration */); + ts.Debug.assert(node.kind !== 257 /* SyntaxKind.VariableDeclaration */); var importDeclaration = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)); var moduleSpecifier = (_e = (importDeclaration && ((_d = ts.tryGetModuleSpecifierFromDeclaration(importDeclaration)) === null || _d === void 0 ? void 0 : _d.text))) !== null && _e !== void 0 ? _e : "..."; var importedIdentifier = ts.unescapeLeadingUnderscores(ts.isIdentifier(errorNode) ? errorNode.escapedText : symbol.escapedName); @@ -86347,7 +86836,7 @@ var ts; (symbol.flags & 788968 /* SymbolFlags.Type */ ? 788968 /* SymbolFlags.Type */ : 0) | (symbol.flags & 1920 /* SymbolFlags.Namespace */ ? 1920 /* SymbolFlags.Namespace */ : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 275 /* SyntaxKind.ExportSpecifier */ ? + var message = node.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -86359,23 +86848,23 @@ var ts; var isType = !(target.flags & 111551 /* SymbolFlags.Value */); if (isType || typeOnlyAlias) { switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { if (compilerOptions.preserveValueImports) { ts.Debug.assertIsDefined(node.name, "An ImportClause with a symbol should have a name"); var message = isType ? ts.Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled : ts.Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled; - var name = ts.idText(node.kind === 270 /* SyntaxKind.ImportSpecifier */ ? node.propertyName || node.name : node.name); + var name = ts.idText(node.kind === 273 /* SyntaxKind.ImportSpecifier */ ? node.propertyName || node.name : node.name); addTypeOnlyDeclarationRelatedInfo(error(node, message, name), isType ? undefined : typeOnlyAlias, name); } - if (isType && node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && ts.hasEffectiveModifier(node, 1 /* ModifierFlags.Export */)) { + if (isType && node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && ts.hasEffectiveModifier(node, 1 /* ModifierFlags.Export */)) { error(node, ts.Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided); } break; } - case 275 /* SyntaxKind.ExportSpecifier */: { + case 278 /* SyntaxKind.ExportSpecifier */: { // Don't allow re-exporting an export that will be elided when `--isolatedModules` is set. // The exception is that `import type { A } from './a'; export { A }` is allowed // because single-file analysis can determine that the export should be dropped. @@ -86434,7 +86923,7 @@ var ts; function checkImportBinding(node) { checkCollisionsForDeclarationName(node, node.name); checkAliasSymbol(node); - if (node.kind === 270 /* SyntaxKind.ImportSpecifier */ && + if (node.kind === 273 /* SyntaxKind.ImportSpecifier */ && ts.idText(node.propertyName || node.name) === "default" && ts.getESModuleInterop(compilerOptions) && moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) { @@ -86484,7 +86973,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { checkImportBinding(importClause.namedBindings); if (moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) && ts.getESModuleInterop(compilerOptions)) { // import * as ns from "foo"; @@ -86513,7 +87002,7 @@ var ts; if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { markExportAsReferenced(node); } - if (node.moduleReference.kind !== 277 /* SyntaxKind.ExternalModuleReference */) { + if (node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */) { var target = resolveAlias(getSymbolOfNode(node)); if (target !== unknownSymbol) { if (target.flags & 111551 /* SymbolFlags.Value */) { @@ -86556,10 +87045,10 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && + var inAmbientExternalModule = node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && !node.moduleSpecifier && node.flags & 16777216 /* NodeFlags.Ambient */; - if (node.parent.kind !== 305 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + if (node.parent.kind !== 308 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -86594,7 +87083,7 @@ var ts; function checkGrammarExportDeclaration(node) { var _a; if (node.isTypeOnly) { - if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 273 /* SyntaxKind.NamedExports */) { + if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 276 /* SyntaxKind.NamedExports */) { return checkGrammarNamedImportsOrExports(node.exportClause); } else { @@ -86604,7 +87093,7 @@ var ts; return false; } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 305 /* SyntaxKind.SourceFile */ || node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */; + var isInAppropriateContext = node.parent.kind === 308 /* SyntaxKind.SourceFile */ || node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -86684,8 +87173,8 @@ var ts; // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors. return; } - var container = node.parent.kind === 305 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 261 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 308 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); } @@ -86817,181 +87306,181 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } - if (kind >= 237 /* SyntaxKind.FirstStatement */ && kind <= 253 /* SyntaxKind.LastStatement */ && node.flowNode && !isReachableFlowNode(node.flowNode)) { + if (kind >= 240 /* SyntaxKind.FirstStatement */ && kind <= 256 /* SyntaxKind.LastStatement */ && node.flowNode && !isReachableFlowNode(node.flowNode)) { errorOrSuggestion(compilerOptions.allowUnreachableCode === false, node, ts.Diagnostics.Unreachable_code_detected); } switch (kind) { - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return checkTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return checkParameter(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return checkPropertyDeclaration(node); - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return checkPropertySignature(node); - case 180 /* SyntaxKind.ConstructorType */: - case 179 /* SyntaxKind.FunctionType */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return checkSignatureDeclaration(node); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return checkMethodDeclaration(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return checkClassStaticBlockDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return checkConstructorDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return checkAccessorDeclaration(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return checkTypeReferenceNode(node); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return checkTypePredicate(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return checkTypeQuery(node); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return checkTypeLiteral(node); - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return checkArrayType(node); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return checkTupleType(node); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return checkUnionOrIntersectionType(node); - case 191 /* SyntaxKind.ParenthesizedType */: - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 187 /* SyntaxKind.OptionalType */: + case 188 /* SyntaxKind.RestType */: return checkSourceElement(node.type); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return checkThisType(node); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return checkTypeOperator(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return checkConditionalType(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return checkInferType(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return checkTemplateLiteralType(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return checkImportType(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return checkNamedTupleMember(node); - case 328 /* SyntaxKind.JSDocAugmentsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: return checkJSDocAugmentsTag(node); - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return checkJSDocImplementsTag(node); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return checkJSDocTypeAliasTag(node); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return checkJSDocTemplateTag(node); - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return checkJSDocTypeTag(node); - case 324 /* SyntaxKind.JSDocLink */: - case 325 /* SyntaxKind.JSDocLinkCode */: - case 326 /* SyntaxKind.JSDocLinkPlain */: + case 327 /* SyntaxKind.JSDocLink */: + case 328 /* SyntaxKind.JSDocLinkCode */: + case 329 /* SyntaxKind.JSDocLinkPlain */: return checkJSDocLinkLikeTag(node); - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return checkJSDocParameterTag(node); - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return checkJSDocPropertyTag(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: checkJSDocFunctionType(node); // falls through - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: checkJSDocTypeIsInJsFile(node); ts.forEachChild(node, checkSourceElement); return; - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: checkJSDocVariadicType(node); return; - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return checkSourceElement(node.type); - case 333 /* SyntaxKind.JSDocPublicTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: + case 336 /* SyntaxKind.JSDocPublicTag */: + case 338 /* SyntaxKind.JSDocProtectedTag */: + case 337 /* SyntaxKind.JSDocPrivateTag */: return checkJSDocAccessibilityModifiers(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return checkIndexedAccessType(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return checkMappedType(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return checkFunctionDeclaration(node); - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: return checkBlock(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return checkVariableStatement(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return checkExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return checkIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return checkDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return checkWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return checkForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return checkForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return checkForOfStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: return checkBreakOrContinueStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return checkReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return checkWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return checkSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return checkLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return checkThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return checkTryStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checkVariableDeclaration(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return checkBindingElement(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return checkClassDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return checkEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return checkModuleDeclaration(node); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return checkImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return checkExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return checkExportAssignment(node); - case 236 /* SyntaxKind.EmptyStatement */: - case 253 /* SyntaxKind.DebuggerStatement */: + case 239 /* SyntaxKind.EmptyStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 276 /* SyntaxKind.MissingDeclaration */: + case 279 /* SyntaxKind.MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -87098,36 +87587,36 @@ var ts; currentNode = node; instantiationCount = 0; switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 165 /* SyntaxKind.Decorator */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 167 /* SyntaxKind.Decorator */: + case 283 /* SyntaxKind.JsxOpeningElement */: // These node kinds are deferred checked when overload resolution fails // To save on work, we ensure the arguments are checked just once, in // a deferred way resolveUntypedCall(node); break; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: checkAccessorDeclaration(node); break; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: checkClassExpressionDeferred(node); break; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: checkTypeParameterDeferred(node); break; - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: checkJsxSelfClosingElementDeferred(node); break; - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: checkJsxElementDeferred(node); break; } @@ -87300,17 +87789,17 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalModule(location)) break; // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: copyLocallyVisibleExportSymbols(getSymbolOfNode(location).exports, meaning & 2623475 /* SymbolFlags.ModuleMember */); break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* SymbolFlags.EnumMember */); break; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: var className = location.name; if (className) { copySymbol(location.symbol, meaning); @@ -87318,8 +87807,8 @@ var ts; // this fall-through is necessary because we would like to handle // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration. // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // If we didn't come from static member of class or interface, // add the type parameters into the symbol table // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol. @@ -87328,7 +87817,7 @@ var ts; copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 788968 /* SymbolFlags.Type */); } break; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -87372,7 +87861,7 @@ var ts; if (meaning) { source.forEach(function (symbol) { // Similar condition as in `resolveNameHelper` - if (!ts.getDeclarationOfKind(symbol, 275 /* SyntaxKind.ExportSpecifier */) && !ts.getDeclarationOfKind(symbol, 274 /* SyntaxKind.NamespaceExport */)) { + if (!ts.getDeclarationOfKind(symbol, 278 /* SyntaxKind.ExportSpecifier */) && !ts.getDeclarationOfKind(symbol, 277 /* SyntaxKind.NamespaceExport */)) { copySymbol(symbol, meaning); } }); @@ -87386,19 +87875,19 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 163 /* SyntaxKind.TypeParameter */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 165 /* SyntaxKind.TypeParameter */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return true; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return node.isTypeOnly; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.isTypeOnly; default: return false; @@ -87406,16 +87895,16 @@ var ts; } // True if the given identifier is part of a type reference function isTypeReferenceIdentifier(node) { - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } - return node.parent.kind === 178 /* SyntaxKind.TypeReference */; + return node.parent.kind === 180 /* SyntaxKind.TypeReference */; } function isHeritageClauseElementIdentifier(node) { - while (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { node = node.parent; } - return node.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } function forEachEnclosingClass(node, callback) { var result; @@ -87443,13 +87932,13 @@ var ts; return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (nodeOnRightSide.parent.kind === 163 /* SyntaxKind.QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } - if (nodeOnRightSide.parent.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 274 /* SyntaxKind.ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } return undefined; @@ -87475,7 +87964,7 @@ var ts; node = parent; parent = parent.parent; } - if (parent && parent.kind === 200 /* SyntaxKind.ImportType */ && parent.qualifier === node) { + if (parent && parent.kind === 202 /* SyntaxKind.ImportType */ && parent.qualifier === node) { return parent; } return undefined; @@ -87485,7 +87974,7 @@ var ts; return getSymbolOfNode(name.parent); } if (ts.isInJSFile(name) && - name.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + name.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && name.parent === name.parent.parent.left) { // Check if this is a special property assignment if (!ts.isPrivateIdentifier(name) && !ts.isJSDocMemberName(name)) { @@ -87495,7 +87984,7 @@ var ts; } } } - if (name.parent.kind === 271 /* SyntaxKind.ExportAssignment */ && ts.isEntityNameExpression(name)) { + if (name.parent.kind === 274 /* SyntaxKind.ExportAssignment */ && ts.isEntityNameExpression(name)) { // Even an entity name expression that doesn't resolve as an entityname may still typecheck as a property access expression var success = resolveEntityName(name, /*all meanings*/ 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */, /*ignoreErrors*/ true); @@ -87505,7 +87994,7 @@ var ts; } else if (ts.isEntityName(name) && isInRightSideOfImportOrExportAssignment(name)) { // Since we already checked for ExportAssignment, this really could only be an Import - var importEqualsDeclaration = ts.getAncestor(name, 265 /* SyntaxKind.ImportEqualsDeclaration */); + var importEqualsDeclaration = ts.getAncestor(name, 268 /* SyntaxKind.ImportEqualsDeclaration */); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(name, /*dontResolveAlias*/ true); } @@ -87523,7 +88012,7 @@ var ts; if (isHeritageClauseElementIdentifier(name)) { var meaning = 0 /* SymbolFlags.None */; // In an interface or class, we're definitely interested in a type. - if (name.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (name.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { meaning = 788968 /* SymbolFlags.Type */; // In a class 'extends' clause we are also looking for a value. if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(name.parent)) { @@ -87539,10 +88028,10 @@ var ts; return entityNameSymbol; } } - if (name.parent.kind === 340 /* SyntaxKind.JSDocParameterTag */) { + if (name.parent.kind === 343 /* SyntaxKind.JSDocParameterTag */) { return ts.getParameterSymbolFromJSDoc(name.parent); } - if (name.parent.kind === 163 /* SyntaxKind.TypeParameter */ && name.parent.parent.kind === 344 /* SyntaxKind.JSDocTemplateTag */) { + if (name.parent.kind === 165 /* SyntaxKind.TypeParameter */ && name.parent.parent.kind === 347 /* SyntaxKind.JSDocTemplateTag */) { ts.Debug.assert(!ts.isInJSFile(name)); // Otherwise `isDeclarationName` would have been true. var typeParameter = ts.getTypeParameterFromJsDoc(name.parent); return typeParameter && typeParameter.symbol; @@ -87566,18 +88055,53 @@ var ts; return resolveJSDocMemberName(name, /*ignoreErrors*/ false, getSymbolOfNode(container)); } } + if (result && isJSDoc_1) { + var container = ts.getJSDocHost(name); + if (container && ts.isEnumMember(container) && container === result.valueDeclaration) { + return resolveEntityName(name, meaning, /*ignoreErrors*/ true, /* dontResolveAlias */ true, ts.getSourceFileOfNode(container)) || result; + } + } return result; } else if (ts.isPrivateIdentifier(name)) { return getSymbolForPrivateIdentifierExpression(name); } - else if (name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || name.kind === 161 /* SyntaxKind.QualifiedName */) { + else if (name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || name.kind === 163 /* SyntaxKind.QualifiedName */) { var links = getNodeLinks(name); if (links.resolvedSymbol) { return links.resolvedSymbol; } - if (name.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (name.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { checkPropertyAccessExpression(name, 0 /* CheckMode.Normal */); + if (!links.resolvedSymbol) { + var expressionType = checkExpressionCached(name.expression); + var infos = getApplicableIndexInfos(expressionType, getLiteralTypeFromPropertyName(name.name)); + if (infos.length && expressionType.members) { + var resolved = resolveStructuredTypeMembers(expressionType); + var symbol = resolved.members.get("__index" /* InternalSymbolName.Index */); + if (infos === getIndexInfosOfType(expressionType)) { + links.resolvedSymbol = symbol; + } + else if (symbol) { + var symbolLinks_1 = getSymbolLinks(symbol); + var declarationList = ts.mapDefined(infos, function (i) { return i.declaration; }); + var nodeListId = ts.map(declarationList, getNodeId).join(","); + if (!symbolLinks_1.filteredIndexSymbolCache) { + symbolLinks_1.filteredIndexSymbolCache = new ts.Map(); + } + if (symbolLinks_1.filteredIndexSymbolCache.has(nodeListId)) { + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + else { + var copy = createSymbol(131072 /* SymbolFlags.Signature */, "__index" /* InternalSymbolName.Index */); + copy.declarations = ts.mapDefined(infos, function (i) { return i.declaration; }); + copy.parent = expressionType.aliasSymbol ? expressionType.aliasSymbol : expressionType.symbol ? expressionType.symbol : getSymbolAtLocation(copy.declarations[0].parent); + symbolLinks_1.filteredIndexSymbolCache.set(nodeListId, copy); + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + } + } + } } else { checkQualifiedName(name, 0 /* CheckMode.Normal */); @@ -87592,11 +88116,11 @@ var ts; } } else if (isTypeReferenceIdentifier(name)) { - var meaning = name.parent.kind === 178 /* SyntaxKind.TypeReference */ ? 788968 /* SymbolFlags.Type */ : 1920 /* SymbolFlags.Namespace */; + var meaning = name.parent.kind === 180 /* SyntaxKind.TypeReference */ ? 788968 /* SymbolFlags.Type */ : 1920 /* SymbolFlags.Namespace */; var symbol = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); return symbol && symbol !== unknownSymbol ? symbol : getUnresolvedSymbolForEntityName(name); } - if (name.parent.kind === 177 /* SyntaxKind.TypePredicate */) { + if (name.parent.kind === 179 /* SyntaxKind.TypePredicate */) { return resolveEntityName(name, /*meaning*/ 1 /* SymbolFlags.FunctionScopedVariable */); } return undefined; @@ -87630,7 +88154,7 @@ var ts; } } function getSymbolAtLocation(node, ignoreErrors) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } var parent = node.parent; @@ -87653,8 +88177,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } - else if (parent.kind === 203 /* SyntaxKind.BindingElement */ && - grandParent.kind === 201 /* SyntaxKind.ObjectBindingPattern */ && + else if (parent.kind === 205 /* SyntaxKind.BindingElement */ && + grandParent.kind === 203 /* SyntaxKind.ObjectBindingPattern */ && node === parent.propertyName) { var typeOfPattern = getTypeOfNode(grandParent); var propertyDeclaration = getPropertyOfType(typeOfPattern, node.escapedText); @@ -87681,8 +88205,8 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: if (!ts.isThisInTypeQuery(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } @@ -87699,14 +88223,14 @@ var ts; return checkExpression(node).symbol; } // falls through - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return getTypeFromThisTypeNode(node).symbol; case 106 /* SyntaxKind.SuperKeyword */: return checkExpression(node).symbol; - case 134 /* SyntaxKind.ConstructorKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 171 /* SyntaxKind.Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 173 /* SyntaxKind.Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; @@ -87717,7 +88241,7 @@ var ts; // 3). Dynamic import call or require in javascript // 4). type A = import("./f/*gotToDefinitionHere*/oo") if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 266 /* SyntaxKind.ImportDeclaration */ || node.parent.kind === 272 /* SyntaxKind.ExportDeclaration */) && node.parent.moduleSpecifier === node) || + ((node.parent.kind === 269 /* SyntaxKind.ImportDeclaration */ || node.parent.kind === 275 /* SyntaxKind.ExportDeclaration */) && node.parent.moduleSpecifier === node) || ((ts.isInJSFile(node) && ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false)) || ts.isImportCall(node.parent)) || (ts.isLiteralTypeNode(node.parent) && ts.isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent)) { return resolveExternalModuleName(node, node, ignoreErrors); @@ -87739,14 +88263,14 @@ var ts; case 38 /* SyntaxKind.EqualsGreaterThanToken */: case 84 /* SyntaxKind.ClassKeyword */: return getSymbolOfNode(node.parent); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal, ignoreErrors) : undefined; case 93 /* SyntaxKind.ExportKeyword */: return ts.isExportAssignment(node.parent) ? ts.Debug.checkDefined(node.parent.symbol) : undefined; case 100 /* SyntaxKind.ImportKeyword */: case 103 /* SyntaxKind.NewKeyword */: return ts.isMetaProperty(node.parent) ? checkMetaPropertyKeyword(node.parent).symbol : undefined; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return checkExpression(node).symbol; default: return undefined; @@ -87762,7 +88286,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (location && location.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 111551 /* SymbolFlags.Value */ | 2097152 /* SymbolFlags.Alias */); } return undefined; @@ -87844,23 +88368,23 @@ var ts; // [ a ] from // [a] = [ some array ...] function getTypeOfAssignmentPattern(expr) { - ts.Debug.assert(expr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || expr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */); + ts.Debug.assert(expr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || expr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */); // If this is from "for of" // for ( { a } of elems) { // } - if (expr.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (expr.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { var iteratedType = checkRightHandSideOfForOf(expr.parent); return checkDestructuringAssignment(expr, iteratedType || errorType); } // If this is from "for" initializer // for ({a } = elems[0];.....) { } - if (expr.parent.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (expr.parent.kind === 223 /* SyntaxKind.BinaryExpression */) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || errorType); } // If this is from nested object binding pattern // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { - if (expr.parent.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (expr.parent.kind === 299 /* SyntaxKind.PropertyAssignment */) { var node_3 = ts.cast(expr.parent.parent, ts.isObjectLiteralExpression); var typeOfParentObjectLiteral = getTypeOfAssignmentPattern(node_3) || errorType; var propertyIndex = ts.indexOfNode(node_3.properties, expr.parent); @@ -87908,7 +88432,7 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 10 /* SyntaxKind.StringLiteral */: return getStringLiteralType(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: var nameType = checkComputedPropertyName(name); return isTypeAssignableToKind(nameType, 12288 /* TypeFlags.ESSymbolLike */) ? nameType : stringType; default: @@ -88026,7 +88550,7 @@ var ts; } var parentSymbol_1 = getParentOfSymbol(symbol); if (parentSymbol_1) { - if (parentSymbol_1.flags & 512 /* SymbolFlags.ValueModule */ && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 305 /* SyntaxKind.SourceFile */) { + if (parentSymbol_1.flags & 512 /* SymbolFlags.ValueModule */ && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 308 /* SyntaxKind.SourceFile */) { var symbolFile = parentSymbol_1.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); // If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined. @@ -88046,7 +88570,7 @@ var ts; } var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier); if (node) { - var symbol = getReferencedValueSymbol(node); + var symbol = getReferencedValueOrAliasSymbol(node); // We should only get the declaration of an alias if there isn't a local value // declaration for the symbol if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol)) { @@ -88058,7 +88582,7 @@ var ts; function isSymbolOfDestructuredElementOfCatchBinding(symbol) { return symbol.valueDeclaration && ts.isBindingElement(symbol.valueDeclaration) - && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 292 /* SyntaxKind.CatchClause */; + && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 295 /* SyntaxKind.CatchClause */; } function isSymbolOfDeclarationWithCollidingName(symbol) { if (symbol.flags & 418 /* SymbolFlags.BlockScoped */ && symbol.valueDeclaration && !ts.isSourceFile(symbol.valueDeclaration)) { @@ -88089,7 +88613,7 @@ var ts; // they will not collide with anything var isDeclaredInLoop = nodeLinks_1.flags & 524288 /* NodeCheckFlags.BlockScopedBindingInLoop */; var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false); - var inLoopBodyBlock = container.kind === 235 /* SyntaxKind.Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + var inLoopBodyBlock = container.kind === 238 /* SyntaxKind.Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -88130,19 +88654,19 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: var symbol = getSymbolOfNode(node); return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportClause = node.exportClause; return !!exportClause && (ts.isNamespaceExport(exportClause) || ts.some(exportClause.elements, isValueAliasDeclaration)); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return node.expression && node.expression.kind === 79 /* SyntaxKind.Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; @@ -88151,7 +88675,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(nodeIn) { var node = ts.getParseTreeNode(nodeIn, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 305 /* SyntaxKind.SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 308 /* SyntaxKind.SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -88261,15 +88785,15 @@ var ts; } function canHaveConstantValue(node) { switch (node.kind) { - case 299 /* SyntaxKind.EnumMember */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 302 /* SyntaxKind.EnumMember */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return true; } return false; } function getConstantValue(node) { - if (node.kind === 299 /* SyntaxKind.EnumMember */) { + if (node.kind === 302 /* SyntaxKind.EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -88362,7 +88886,7 @@ var ts; function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker, addUndefined) { var declaration = ts.getParseTreeNode(declarationIn, ts.isVariableLikeOrAccessor); if (!declaration) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } // Get type of the symbol if this is the valid symbol otherwise get type at location var symbol = getSymbolOfNode(declaration); @@ -88381,7 +88905,7 @@ var ts; function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) { var signatureDeclaration = ts.getParseTreeNode(signatureDeclarationIn, ts.isFunctionLike); if (!signatureDeclaration) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } var signature = getSignatureFromDeclaration(signatureDeclaration); return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, flags | 1024 /* NodeBuilderFlags.MultilineObjectLiterals */, tracker); @@ -88389,7 +88913,7 @@ var ts; function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) { var expr = ts.getParseTreeNode(exprIn, ts.isExpression); if (!expr) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } var type = getWidenedType(getRegularTypeOfExpression(expr)); return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024 /* NodeBuilderFlags.MultilineObjectLiterals */, tracker); @@ -88413,6 +88937,25 @@ var ts; } return resolveName(location, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true); } + /** + * Get either a value-meaning symbol or an alias symbol. + * Unlike `getReferencedValueSymbol`, if the cached resolved symbol is the unknown symbol, + * we call `resolveName` to find a symbol. + * This is because when caching the resolved symbol, we only consider value symbols, but here + * we want to also get an alias symbol if one exists. + */ + function getReferencedValueOrAliasSymbol(reference) { + var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; + if (resolvedSymbol && resolvedSymbol !== unknownSymbol) { + return resolvedSymbol; + } + return resolveName(reference, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, + /*nodeNotFoundMessage*/ undefined, + /*nameArg*/ undefined, + /*isUse*/ true, + /*excludeGlobals*/ undefined, + /*getSpellingSuggestions*/ undefined); + } function getReferencedValueDeclaration(referenceIn) { if (!ts.isGeneratedIdentifier(referenceIn)) { var reference = ts.getParseTreeNode(referenceIn, ts.isIdentifier); @@ -88546,12 +89089,12 @@ var ts; getJsxFragmentFactoryEntity: getJsxFragmentFactoryEntity, getAllAccessorDeclarations: function (accessor) { accessor = ts.getParseTreeNode(accessor, ts.isGetOrSetAccessorDeclaration); // TODO: GH#18217 - var otherKind = accessor.kind === 173 /* SyntaxKind.SetAccessor */ ? 172 /* SyntaxKind.GetAccessor */ : 173 /* SyntaxKind.SetAccessor */; + var otherKind = accessor.kind === 175 /* SyntaxKind.SetAccessor */ ? 174 /* SyntaxKind.GetAccessor */ : 175 /* SyntaxKind.SetAccessor */; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(accessor), otherKind); var firstAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? otherAccessor : accessor; var secondAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? accessor : otherAccessor; - var setAccessor = accessor.kind === 173 /* SyntaxKind.SetAccessor */ ? accessor : otherAccessor; - var getAccessor = accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? accessor : otherAccessor; + var setAccessor = accessor.kind === 175 /* SyntaxKind.SetAccessor */ ? accessor : otherAccessor; + var getAccessor = accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? accessor : otherAccessor; return { firstAccessor: firstAccessor, secondAccessor: secondAccessor, @@ -88567,7 +89110,7 @@ var ts; }, getDeclarationStatementsForSourceFile: function (node, flags, tracker, bundled) { var n = ts.getParseTreeNode(node); - ts.Debug.assert(n && n.kind === 305 /* SyntaxKind.SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile"); + ts.Debug.assert(n && n.kind === 308 /* SyntaxKind.SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile"); var sym = getSymbolOfNode(node); if (!sym) { return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker, bundled); @@ -88604,7 +89147,7 @@ var ts; return false; } function isInHeritageClause(node) { - return node.parent && node.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 291 /* SyntaxKind.HeritageClause */; + return node.parent && node.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 294 /* SyntaxKind.HeritageClause */; } // defined here to avoid outer scope pollution function getTypeReferenceDirectivesForEntityName(node) { @@ -88617,12 +89160,12 @@ var ts; // qualified names can only be used as types\namespaces // identifiers are treated as values only if they appear in type queries var meaning; - if (node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } else { meaning = 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */; - if ((node.kind === 79 /* SyntaxKind.Identifier */ && isInTypeQuery(node)) || (node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && !isInHeritageClause(node))) { + if ((node.kind === 79 /* SyntaxKind.Identifier */ && isInTypeQuery(node)) || (node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && !isInHeritageClause(node))) { meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } } @@ -88671,7 +89214,7 @@ var ts; break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 305 /* SyntaxKind.SourceFile */ && current.flags & 512 /* SymbolFlags.ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 308 /* SyntaxKind.SourceFile */ && current.flags & 512 /* SymbolFlags.ValueModule */) { return false; } // check that at least one declaration of top level symbol originates from type declaration file @@ -88699,12 +89242,12 @@ var ts; } } function getExternalModuleFileFromDeclaration(declaration) { - var specifier = declaration.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); + var specifier = declaration.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, /*moduleNotFoundError*/ undefined); // TODO: GH#18217 if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 305 /* SyntaxKind.SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 308 /* SyntaxKind.SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors @@ -88916,14 +89459,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node, node.parent, node.parent.parent)) { - if (node.kind === 169 /* SyntaxKind.MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { + if (node.kind === 171 /* SyntaxKind.MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } } - else if (node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (ts.hasDecorators(accessors.firstAccessor) && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -88942,26 +89485,26 @@ var ts; var modifier = _a[_i]; if (ts.isDecorator(modifier)) continue; - if (modifier.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { - if (node.kind === 166 /* SyntaxKind.PropertySignature */ || node.kind === 168 /* SyntaxKind.MethodSignature */) { + if (modifier.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { + if (node.kind === 168 /* SyntaxKind.PropertySignature */ || node.kind === 170 /* SyntaxKind.MethodSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 176 /* SyntaxKind.IndexSignature */ && (modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ || !ts.isClassLike(node.parent))) { + if (node.kind === 178 /* SyntaxKind.IndexSignature */ && (modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ || !ts.isClassLike(node.parent))) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } - if (modifier.kind !== 101 /* SyntaxKind.InKeyword */ && modifier.kind !== 144 /* SyntaxKind.OutKeyword */) { - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { + if (modifier.kind !== 101 /* SyntaxKind.InKeyword */ && modifier.kind !== 145 /* SyntaxKind.OutKeyword */) { + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_parameter, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { case 85 /* SyntaxKind.ConstKeyword */: - if (node.kind !== 260 /* SyntaxKind.EnumDeclaration */) { + if (node.kind !== 263 /* SyntaxKind.EnumDeclaration */) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(85 /* SyntaxKind.ConstKeyword */)); } break; - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "override"); @@ -88972,7 +89515,10 @@ var ts; else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "accessor"); + } + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "async"); } flags |= 16384 /* ModifierFlags.Override */; @@ -88991,16 +89537,19 @@ var ts; else if (flags & 32 /* ModifierFlags.Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "accessor"); + } else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { if (modifier.kind === 121 /* SyntaxKind.PrivateKeyword */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } @@ -89020,16 +89569,19 @@ var ts; else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "accessor"); + } + else if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } else if (flags & 16384 /* ModifierFlags.Override */) { @@ -89038,11 +89590,26 @@ var ts; flags |= 32 /* ModifierFlags.Static */; lastStatic = modifier; break; - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "accessor"); + } + else if (flags & 64 /* ModifierFlags.Readonly */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "readonly"); + } + else if (flags & 2 /* ModifierFlags.Ambient */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "declare"); + } + else if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */) { + return grammarErrorOnNode(modifier, ts.Diagnostics.accessor_modifier_can_only_appear_on_a_property_declaration); + } + flags |= 128 /* ModifierFlags.Accessor */; + break; + case 146 /* SyntaxKind.ReadonlyKeyword */: if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 166 /* SyntaxKind.PropertySignature */ && node.kind !== 176 /* SyntaxKind.IndexSignature */ && node.kind !== 164 /* SyntaxKind.Parameter */) { + else if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 168 /* SyntaxKind.PropertySignature */ && node.kind !== 178 /* SyntaxKind.IndexSignature */ && node.kind !== 166 /* SyntaxKind.Parameter */) { // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } @@ -89055,35 +89622,35 @@ var ts; else if (flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "abstract"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } else if (ts.isClassLike(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "export"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1 /* ModifierFlags.Export */; break; case 88 /* SyntaxKind.DefaultKeyword */: - var container = node.parent.kind === 305 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 261 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 308 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } else if (!(flags & 1 /* ModifierFlags.Export */)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "default"); } - flags |= 512 /* ModifierFlags.Default */; + flags |= 1024 /* ModifierFlags.Default */; break; - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: if (flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } else if (flags & 16384 /* ModifierFlags.Override */) { @@ -89092,10 +89659,10 @@ var ts; else if (ts.isClassLike(node.parent) && !ts.isPropertyDeclaration(node)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "declare"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if ((node.parent.flags & 16777216 /* NodeFlags.Ambient */) && node.parent.kind === 262 /* SyntaxKind.ModuleBlock */) { + else if ((node.parent.flags & 16777216 /* NodeFlags.Ambient */) && node.parent.kind === 265 /* SyntaxKind.ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } else if (ts.isPrivateIdentifierClassElementDeclaration(node)) { @@ -89105,18 +89672,18 @@ var ts; lastDeclare = modifier; break; case 126 /* SyntaxKind.AbstractKeyword */: - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 257 /* SyntaxKind.ClassDeclaration */ && - node.kind !== 180 /* SyntaxKind.ConstructorType */) { - if (node.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && - node.kind !== 172 /* SyntaxKind.GetAccessor */ && - node.kind !== 173 /* SyntaxKind.SetAccessor */) { + if (node.kind !== 260 /* SyntaxKind.ClassDeclaration */ && + node.kind !== 182 /* SyntaxKind.ConstructorType */) { + if (node.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && + node.kind !== 174 /* SyntaxKind.GetAccessor */ && + node.kind !== 175 /* SyntaxKind.SetAccessor */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ && ts.hasSyntacticModifier(node.parent, 128 /* ModifierFlags.Abstract */))) { + if (!(node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ && ts.hasSyntacticModifier(node.parent, 256 /* ModifierFlags.Abstract */))) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32 /* ModifierFlags.Static */) { @@ -89125,39 +89692,42 @@ var ts; if (flags & 8 /* ModifierFlags.Private */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract"); } - if (flags & 256 /* ModifierFlags.Async */ && lastAsync) { + if (flags & 512 /* ModifierFlags.Async */ && lastAsync) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); } if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "override"); } + if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "accessor"); + } } if (ts.isNamedDeclaration(node) && node.name.kind === 80 /* SyntaxKind.PrivateIdentifier */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "abstract"); } - flags |= 128 /* ModifierFlags.Abstract */; + flags |= 256 /* ModifierFlags.Abstract */; break; - case 131 /* SyntaxKind.AsyncKeyword */: - if (flags & 256 /* ModifierFlags.Async */) { + case 132 /* SyntaxKind.AsyncKeyword */: + if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } else if (flags & 2 /* ModifierFlags.Ambient */ || node.parent.flags & 16777216 /* NodeFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); } - flags |= 256 /* ModifierFlags.Async */; + flags |= 512 /* ModifierFlags.Async */; lastAsync = modifier; break; case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: var inOutFlag = modifier.kind === 101 /* SyntaxKind.InKeyword */ ? 32768 /* ModifierFlags.In */ : 65536 /* ModifierFlags.Out */; var inOutText = modifier.kind === 101 /* SyntaxKind.InKeyword */ ? "in" : "out"; - if (node.kind !== 163 /* SyntaxKind.TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) { + if (node.kind !== 165 /* SyntaxKind.TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText); } if (flags & inOutFlag) { @@ -89170,28 +89740,28 @@ var ts; break; } } - if (node.kind === 171 /* SyntaxKind.Constructor */) { + if (node.kind === 173 /* SyntaxKind.Constructor */) { if (flags & 32 /* ModifierFlags.Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(lastOverride, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "override"); // TODO: GH#18217 } - if (flags & 256 /* ModifierFlags.Async */) { + if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); } return false; } - else if ((node.kind === 266 /* SyntaxKind.ImportDeclaration */ || node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) && flags & 2 /* ModifierFlags.Ambient */) { + else if ((node.kind === 269 /* SyntaxKind.ImportDeclaration */ || node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) && flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 166 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); } - else if (node.kind === 164 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && node.dotDotDotToken) { + else if (node.kind === 166 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && node.dotDotDotToken) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } - if (flags & 256 /* ModifierFlags.Async */) { + if (flags & 512 /* ModifierFlags.Async */) { return checkGrammarAsyncModifier(node, lastAsync); } return false; @@ -89209,47 +89779,47 @@ var ts; } function shouldReportBadModifier(node) { switch (node.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 164 /* SyntaxKind.Parameter */: - case 163 /* SyntaxKind.TypeParameter */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 166 /* SyntaxKind.Parameter */: + case 165 /* SyntaxKind.TypeParameter */: return false; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - case 179 /* SyntaxKind.FunctionType */: - case 276 /* SyntaxKind.MissingDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: + case 181 /* SyntaxKind.FunctionType */: + case 279 /* SyntaxKind.MissingDeclaration */: return true; default: - if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return false; } switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - return nodeHasAnyModifiersExcept(node, 131 /* SyntaxKind.AsyncKeyword */); - case 257 /* SyntaxKind.ClassDeclaration */: - case 180 /* SyntaxKind.ConstructorType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + return nodeHasAnyModifiersExcept(node, 132 /* SyntaxKind.AsyncKeyword */); + case 260 /* SyntaxKind.ClassDeclaration */: + case 182 /* SyntaxKind.ConstructorType */: return nodeHasAnyModifiersExcept(node, 126 /* SyntaxKind.AbstractKeyword */); - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return nodeHasAnyModifiersExcept(node, 85 /* SyntaxKind.ConstKeyword */); default: ts.Debug.assertNever(node); @@ -89267,10 +89837,10 @@ var ts; } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return false; } return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); @@ -89499,20 +90069,20 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.kind !== 164 /* SyntaxKind.ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 221 /* SyntaxKind.BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { + if (computedPropertyName.expression.kind === 223 /* SyntaxKind.BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } return false; } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - node.kind === 213 /* SyntaxKind.FunctionExpression */ || - node.kind === 169 /* SyntaxKind.MethodDeclaration */); + ts.Debug.assert(node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + node.kind === 215 /* SyntaxKind.FunctionExpression */ || + node.kind === 171 /* SyntaxKind.MethodDeclaration */); if (node.flags & 16777216 /* NodeFlags.Ambient */) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -89531,7 +90101,7 @@ var ts; var seen = new ts.Map(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 298 /* SyntaxKind.SpreadAssignment */) { + if (prop.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (inDestructuring) { // a rest property cannot be destructured any further var expression = ts.skipParentheses(prop.expression); @@ -89542,11 +90112,11 @@ var ts; continue; } var name = prop.name; - if (name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name); } - if (prop.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern); @@ -89558,7 +90128,7 @@ var ts; if (ts.canHaveModifiers(prop) && prop.modifiers) { for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { var mod = _c[_b]; - if (ts.isModifier(mod) && (mod.kind !== 131 /* SyntaxKind.AsyncKeyword */ || prop.kind !== 169 /* SyntaxKind.MethodDeclaration */)) { + if (ts.isModifier(mod) && (mod.kind !== 132 /* SyntaxKind.AsyncKeyword */ || prop.kind !== 171 /* SyntaxKind.MethodDeclaration */)) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } } @@ -89579,8 +90149,8 @@ var ts; // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = void 0; switch (prop.kind) { - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidExclamationToken(prop.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); @@ -89589,13 +90159,13 @@ var ts; } currentKind = 4 /* DeclarationMeaning.PropertyAssignment */; break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: currentKind = 8 /* DeclarationMeaning.Method */; break; - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: currentKind = 1 /* DeclarationMeaning.GetAccessor */; break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: currentKind = 2 /* DeclarationMeaning.SetAccessor */; break; default: @@ -89638,7 +90208,7 @@ var ts; var seen = new ts.Map(); for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 287 /* SyntaxKind.JsxSpreadAttribute */) { + if (attr.kind === 290 /* SyntaxKind.JsxSpreadAttribute */) { continue; } var name = attr.name, initializer = attr.initializer; @@ -89648,7 +90218,7 @@ var ts; else { return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } - if (initializer && initializer.kind === 288 /* SyntaxKind.JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 291 /* SyntaxKind.JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -89683,7 +90253,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.kind === 244 /* SyntaxKind.ForOfStatement */ && forInOrOfStatement.awaitModifier) { + if (forInOrOfStatement.kind === 247 /* SyntaxKind.ForOfStatement */ && forInOrOfStatement.awaitModifier) { if (!(forInOrOfStatement.flags & 32768 /* NodeFlags.AwaitContext */)) { var sourceFile = ts.getSourceFileOfNode(forInOrOfStatement); if (ts.isInTopLevelContext(forInOrOfStatement)) { @@ -89717,7 +90287,7 @@ var ts; if (!hasParseDiagnostics(sourceFile)) { var diagnostic = ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); var func = ts.getContainingFunction(forInOrOfStatement); - if (func && func.kind !== 171 /* SyntaxKind.Constructor */) { + if (func && func.kind !== 173 /* SyntaxKind.Constructor */) { ts.Debug.assert((ts.getFunctionFlags(func) & 2 /* FunctionFlags.Async */) === 0, "Enclosing function should never be an async function."); var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); ts.addRelatedInfo(diagnostic, relatedInfo); @@ -89734,7 +90304,7 @@ var ts; grammarErrorOnNode(forInOrOfStatement.initializer, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async); return false; } - if (forInOrOfStatement.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -89749,20 +90319,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -89772,22 +90342,22 @@ var ts; return false; } function checkGrammarAccessor(accessor) { - if (!(accessor.flags & 16777216 /* NodeFlags.Ambient */) && (accessor.parent.kind !== 182 /* SyntaxKind.TypeLiteral */) && (accessor.parent.kind !== 258 /* SyntaxKind.InterfaceDeclaration */)) { + if (!(accessor.flags & 16777216 /* NodeFlags.Ambient */) && (accessor.parent.kind !== 184 /* SyntaxKind.TypeLiteral */) && (accessor.parent.kind !== 261 /* SyntaxKind.InterfaceDeclaration */)) { if (languageVersion < 1 /* ScriptTarget.ES5 */) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); } if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isPrivateIdentifier(accessor.name)) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } - if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 128 /* ModifierFlags.Abstract */)) { + if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 256 /* ModifierFlags.Abstract */)) { return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } if (accessor.body) { - if (ts.hasSyntacticModifier(accessor, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(accessor, 256 /* ModifierFlags.Abstract */)) { return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); } - if (accessor.parent.kind === 182 /* SyntaxKind.TypeLiteral */ || accessor.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (accessor.parent.kind === 184 /* SyntaxKind.TypeLiteral */ || accessor.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return grammarErrorOnNode(accessor.body, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } } @@ -89795,11 +90365,11 @@ var ts; return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } if (!doesAccessorHaveCorrectParameterCount(accessor)) { - return grammarErrorOnNode(accessor.name, accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? + return grammarErrorOnNode(accessor.name, accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? ts.Diagnostics.A_get_accessor_cannot_have_parameters : ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - if (accessor.kind === 173 /* SyntaxKind.SetAccessor */) { + if (accessor.kind === 175 /* SyntaxKind.SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -89821,17 +90391,17 @@ var ts; * A set accessor has one parameter or a `this` parameter and one more parameter. */ function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? 1 : 2)) { + if (accessor.parameters.length === (accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? 1 : 2)) { return ts.getThisParameter(accessor); } } function checkGrammarTypeOperatorNode(node) { - if (node.operator === 154 /* SyntaxKind.UniqueKeyword */) { - if (node.type.kind !== 151 /* SyntaxKind.SymbolKeyword */) { - return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(151 /* SyntaxKind.SymbolKeyword */)); + if (node.operator === 156 /* SyntaxKind.UniqueKeyword */) { + if (node.type.kind !== 153 /* SyntaxKind.SymbolKeyword */) { + return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(153 /* SyntaxKind.SymbolKeyword */)); } var parent = ts.walkUpParenthesizedTypes(node.parent); if (ts.isInJSFile(parent) && ts.isJSDocTypeExpression(parent)) { @@ -89841,7 +90411,7 @@ var ts; } } switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: var decl = parent; if (decl.name.kind !== 79 /* SyntaxKind.Identifier */) { return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name); @@ -89853,13 +90423,13 @@ var ts; return grammarErrorOnNode(parent.name, ts.Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const); } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (!ts.isStatic(parent) || !ts.hasEffectiveReadonlyModifier(parent)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly); } break; - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (!ts.hasSyntacticModifier(parent, 64 /* ModifierFlags.Readonly */)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly); } @@ -89868,9 +90438,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_are_not_allowed_here); } } - else if (node.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { - if (node.type.kind !== 183 /* SyntaxKind.ArrayType */ && node.type.kind !== 184 /* SyntaxKind.TupleType */) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(151 /* SyntaxKind.SymbolKeyword */)); + else if (node.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { + if (node.type.kind !== 185 /* SyntaxKind.ArrayType */ && node.type.kind !== 186 /* SyntaxKind.TupleType */) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(153 /* SyntaxKind.SymbolKeyword */)); } } } @@ -89883,10 +90453,10 @@ var ts; if (checkGrammarFunctionLikeDeclaration(node)) { return true; } - if (node.kind === 169 /* SyntaxKind.MethodDeclaration */) { - if (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (node.kind === 171 /* SyntaxKind.MethodDeclaration */) { + if (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // We only disallow modifier on a method declaration if it is a property of object-literal-expression - if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 131 /* SyntaxKind.AsyncKeyword */)) { + if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 132 /* SyntaxKind.AsyncKeyword */)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } else if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { @@ -89915,14 +90485,14 @@ var ts; if (node.flags & 16777216 /* NodeFlags.Ambient */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.kind === 169 /* SyntaxKind.MethodDeclaration */ && !node.body) { + else if (node.kind === 171 /* SyntaxKind.MethodDeclaration */ && !node.body) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } - else if (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + else if (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.parent.kind === 182 /* SyntaxKind.TypeLiteral */) { + else if (node.parent.kind === 184 /* SyntaxKind.TypeLiteral */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } @@ -89933,11 +90503,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: if (node.label && current.label.escapedText === node.label.escapedText) { // found matching label - verify that label usage is correct // continue can only target labels that are on iteration statements - var isMisplacedContinueLabel = node.kind === 245 /* SyntaxKind.ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 248 /* SyntaxKind.ContinueStatement */ && !ts.isIterationStatement(current.statement, /*lookInLabeledStatement*/ true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -89945,8 +90515,8 @@ var ts; return false; } break; - case 249 /* SyntaxKind.SwitchStatement */: - if (node.kind === 246 /* SyntaxKind.BreakStatement */ && !node.label) { + case 252 /* SyntaxKind.SwitchStatement */: + if (node.kind === 249 /* SyntaxKind.BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -89961,13 +90531,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 246 /* SyntaxKind.BreakStatement */ + var message = node.kind === 249 /* SyntaxKind.BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 246 /* SyntaxKind.BreakStatement */ + var message = node.kind === 249 /* SyntaxKind.BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -89991,12 +90561,12 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return ts.isStringOrNumericLiteralLike(expr) || - expr.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && + expr.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 8 /* SyntaxKind.NumericLiteral */; } function isBigIntLiteralExpression(expr) { return expr.kind === 9 /* SyntaxKind.BigIntLiteral */ || - expr.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && + expr.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 9 /* SyntaxKind.BigIntLiteral */; } function isSimpleLiteralEnumReference(expr) { @@ -90024,7 +90594,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */ && node.parent.parent.kind !== 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */ && node.parent.parent.kind !== 247 /* SyntaxKind.ForOfStatement */) { if (node.flags & 16777216 /* NodeFlags.Ambient */) { checkAmbientInitializer(node); } @@ -90037,7 +90607,7 @@ var ts; } } } - if (node.exclamationToken && (node.parent.parent.kind !== 237 /* SyntaxKind.VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* NodeFlags.Ambient */)) { + if (node.exclamationToken && (node.parent.parent.kind !== 240 /* SyntaxKind.VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* NodeFlags.Ambient */)) { var message = node.initializer ? ts.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type @@ -90104,15 +90674,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return false; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -90206,8 +90776,14 @@ var ts; if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isPrivateIdentifier(node.name)) { return grammarErrorOnNode(node.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } + if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isAutoAccessorPropertyDeclaration(node)) { + return grammarErrorOnNode(node.name, ts.Diagnostics.Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher); + } + if (ts.isAutoAccessorPropertyDeclaration(node) && checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_accessor_property_cannot_be_declared_optional)) { + return true; + } } - else if (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + else if (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) { return true; } @@ -90253,14 +90829,14 @@ var ts; // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */ || - node.kind === 266 /* SyntaxKind.ImportDeclaration */ || - node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ || - node.kind === 272 /* SyntaxKind.ExportDeclaration */ || - node.kind === 271 /* SyntaxKind.ExportAssignment */ || - node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ || - ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */ | 1 /* ModifierFlags.Export */ | 512 /* ModifierFlags.Default */)) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */ || + node.kind === 269 /* SyntaxKind.ImportDeclaration */ || + node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ || + node.kind === 275 /* SyntaxKind.ExportDeclaration */ || + node.kind === 274 /* SyntaxKind.ExportAssignment */ || + node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ || + ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */ | 1 /* ModifierFlags.Export */ | 1024 /* ModifierFlags.Default */)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier); @@ -90268,7 +90844,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 237 /* SyntaxKind.VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 240 /* SyntaxKind.VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -90291,7 +90867,7 @@ var ts; // to prevent noisiness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 235 /* SyntaxKind.Block */ || node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.parent.kind === 238 /* SyntaxKind.Block */ || node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { var links_2 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_2.hasReportedStatementInAmbientContext) { @@ -90313,10 +90889,10 @@ var ts; if (languageVersion >= 1 /* ScriptTarget.ES5 */) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 196 /* SyntaxKind.LiteralType */)) { + else if (ts.isChildOfNodeWithKind(node, 198 /* SyntaxKind.LiteralType */)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 299 /* SyntaxKind.EnumMember */)) { + else if (ts.isChildOfNodeWithKind(node, 302 /* SyntaxKind.EnumMember */)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -90388,7 +90964,7 @@ var ts; if (node.isTypeOnly && node.name && node.namedBindings) { return grammarErrorOnNode(node, ts.Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both); } - if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 269 /* SyntaxKind.NamedImports */) { + if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 272 /* SyntaxKind.NamedImports */) { return checkGrammarNamedImportsOrExports(node.namedBindings); } return false; @@ -90396,7 +90972,7 @@ var ts; function checkGrammarNamedImportsOrExports(namedBindings) { return !!ts.forEach(namedBindings.elements, function (specifier) { if (specifier.isTypeOnly) { - return grammarErrorOnFirstToken(specifier, specifier.kind === 270 /* SyntaxKind.ImportSpecifier */ + return grammarErrorOnFirstToken(specifier, specifier.kind === 273 /* SyntaxKind.ImportSpecifier */ ? ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement : ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement); } @@ -90410,7 +90986,7 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments); } var nodeArguments = node.arguments; - if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext) { + if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext && moduleKind !== ts.ModuleKind.Node16) { // We are allowed trailing comma after proposal-import-assertions. checkGrammarForDisallowedTrailingComma(nodeArguments); if (nodeArguments.length > 1) { @@ -90519,14 +91095,14 @@ var ts; return !ts.isAccessor(declaration); } function isNotOverload(declaration) { - return (declaration.kind !== 256 /* SyntaxKind.FunctionDeclaration */ && declaration.kind !== 169 /* SyntaxKind.MethodDeclaration */) || + return (declaration.kind !== 259 /* SyntaxKind.FunctionDeclaration */ && declaration.kind !== 171 /* SyntaxKind.MethodDeclaration */) || !!declaration.body; } /** Like 'isDeclarationName', but returns true for LHS of `import { x as y }` or `export { x as y }`. */ function isDeclarationNameOrImportPropertyName(name) { switch (name.parent.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return ts.isIdentifier(name); default: return ts.isDeclarationName(name); @@ -90562,6 +91138,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { + var _a; function visitNode(node, visitor, test, lift) { if (node === undefined || visitor === undefined) { return node; @@ -90628,7 +91205,6 @@ var ts; return nodes; } ts.visitNodes = visitNodes; - /* @internal */ function visitArray(nodes, visitor, test, start, count) { if (nodes === undefined) { return nodes; @@ -90776,12 +91352,10 @@ var ts; return updated; } ts.visitFunctionBody = visitFunctionBody; - /** - * Visits an iteration body, adding any block-scoped variables required by the transformation. - */ - function visitIterationBody(body, visitor, context) { + function visitIterationBody(body, visitor, context, nodeVisitor) { + if (nodeVisitor === void 0) { nodeVisitor = visitNode; } context.startBlockScope(); - var updated = visitNode(body, visitor, ts.isStatement, context.factory.liftToBlock); + var updated = nodeVisitor(body, visitor, ts.isStatement, context.factory.liftToBlock); var declarations = context.endBlockScope(); if (ts.some(declarations)) { if (ts.isBlock(updated)) { @@ -90800,456 +91374,446 @@ var ts; if (node === undefined) { return undefined; } - var kind = node.kind; - // No need to visit nodes with no children. - if ((kind > 0 /* SyntaxKind.FirstToken */ && kind <= 160 /* SyntaxKind.LastToken */) || kind === 192 /* SyntaxKind.ThisType */) { - return node; - } - var factory = context.factory; - switch (kind) { - // Names - case 79 /* SyntaxKind.Identifier */: - ts.Debug.type(node); - return factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration)); - case 161 /* SyntaxKind.QualifiedName */: - ts.Debug.type(node); - return factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier)); - case 162 /* SyntaxKind.ComputedPropertyName */: - ts.Debug.type(node); - return factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Signature elements - case 163 /* SyntaxKind.TypeParameter */: - ts.Debug.type(node); - return factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode)); - case 164 /* SyntaxKind.Parameter */: - ts.Debug.type(node); - return factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 165 /* SyntaxKind.Decorator */: - ts.Debug.type(node); - return factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Type elements - case 166 /* SyntaxKind.PropertySignature */: - ts.Debug.type(node); - return factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 167 /* SyntaxKind.PropertyDeclaration */: - ts.Debug.type(node); - return factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), - // QuestionToken and ExclamationToken is uniqued in Property Declaration and the signature of 'updateProperty' is that too - nodeVisitor(node.questionToken || node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 168 /* SyntaxKind.MethodSignature */: - ts.Debug.type(node); - return factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 169 /* SyntaxKind.MethodDeclaration */: - ts.Debug.type(node); - return factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 171 /* SyntaxKind.Constructor */: - ts.Debug.type(node); - return factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 172 /* SyntaxKind.GetAccessor */: - ts.Debug.type(node); - return factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 173 /* SyntaxKind.SetAccessor */: - ts.Debug.type(node); - return factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - ts.Debug.type(node); - context.startLexicalEnvironment(); - context.suspendLexicalEnvironment(); - return factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 174 /* SyntaxKind.CallSignature */: - ts.Debug.type(node); - return factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 175 /* SyntaxKind.ConstructSignature */: - ts.Debug.type(node); - return factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 176 /* SyntaxKind.IndexSignature */: - ts.Debug.type(node); - return factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - // Types - case 177 /* SyntaxKind.TypePredicate */: - ts.Debug.type(node); - return factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 178 /* SyntaxKind.TypeReference */: - ts.Debug.type(node); - return factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 179 /* SyntaxKind.FunctionType */: - ts.Debug.type(node); - return factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 180 /* SyntaxKind.ConstructorType */: - ts.Debug.type(node); - return factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 181 /* SyntaxKind.TypeQuery */: - ts.Debug.type(node); - return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 182 /* SyntaxKind.TypeLiteral */: - ts.Debug.type(node); - return factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 183 /* SyntaxKind.ArrayType */: - ts.Debug.type(node); - return factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode)); - case 184 /* SyntaxKind.TupleType */: - ts.Debug.type(node); - return factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode)); - case 185 /* SyntaxKind.OptionalType */: - ts.Debug.type(node); - return factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 186 /* SyntaxKind.RestType */: - ts.Debug.type(node); - return factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 187 /* SyntaxKind.UnionType */: - ts.Debug.type(node); - return factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 188 /* SyntaxKind.IntersectionType */: - ts.Debug.type(node); - return factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 189 /* SyntaxKind.ConditionalType */: - ts.Debug.type(node); - return factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode)); - case 190 /* SyntaxKind.InferType */: - ts.Debug.type(node); - return factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); - case 200 /* SyntaxKind.ImportType */: - ts.Debug.type(node); - return factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isNode), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); - case 295 /* SyntaxKind.ImportTypeAssertionContainer */: - ts.Debug.type(node); - return factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isNode), node.multiLine); - case 197 /* SyntaxKind.NamedTupleMember */: - ts.Debug.type(node); - return factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 191 /* SyntaxKind.ParenthesizedType */: - ts.Debug.type(node); - return factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 193 /* SyntaxKind.TypeOperator */: - ts.Debug.type(node); - return factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 194 /* SyntaxKind.IndexedAccessType */: - ts.Debug.type(node); - return factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode)); - case 195 /* SyntaxKind.MappedType */: - ts.Debug.type(node); - return factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 196 /* SyntaxKind.LiteralType */: - ts.Debug.type(node); - return factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression)); - case 198 /* SyntaxKind.TemplateLiteralType */: - ts.Debug.type(node); - return factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan)); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: - ts.Debug.type(node); - return factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - // Binding patterns - case 201 /* SyntaxKind.ObjectBindingPattern */: - ts.Debug.type(node); - return factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); - case 202 /* SyntaxKind.ArrayBindingPattern */: - ts.Debug.type(node); - return factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); - case 203 /* SyntaxKind.BindingElement */: - ts.Debug.type(node); - return factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - // Expression - case 204 /* SyntaxKind.ArrayLiteralExpression */: - ts.Debug.type(node); - return factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - case 205 /* SyntaxKind.ObjectLiteralExpression */: - ts.Debug.type(node); - return factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); - case 206 /* SyntaxKind.PropertyAccessExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName)); - } - ts.Debug.type(node); - return factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName)); - case 207 /* SyntaxKind.ElementAccessExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); - case 208 /* SyntaxKind.CallExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 209 /* SyntaxKind.NewExpression */: - ts.Debug.type(node); - return factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - ts.Debug.type(node); - return factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral)); - case 211 /* SyntaxKind.TypeAssertionExpression */: - ts.Debug.type(node); - return factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 212 /* SyntaxKind.ParenthesizedExpression */: - ts.Debug.type(node); - return factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 213 /* SyntaxKind.FunctionExpression */: - ts.Debug.type(node); - return factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 214 /* SyntaxKind.ArrowFunction */: - ts.Debug.type(node); - return factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 215 /* SyntaxKind.DeleteExpression */: - ts.Debug.type(node); - return factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 216 /* SyntaxKind.TypeOfExpression */: - ts.Debug.type(node); - return factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 217 /* SyntaxKind.VoidExpression */: - ts.Debug.type(node); - return factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 218 /* SyntaxKind.AwaitExpression */: - ts.Debug.type(node); - return factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - ts.Debug.type(node); - return factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - ts.Debug.type(node); - return factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); - case 221 /* SyntaxKind.BinaryExpression */: - ts.Debug.type(node); - return factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression)); - case 222 /* SyntaxKind.ConditionalExpression */: - ts.Debug.type(node); - return factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression)); - case 223 /* SyntaxKind.TemplateExpression */: - ts.Debug.type(node); - return factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); - case 224 /* SyntaxKind.YieldExpression */: - ts.Debug.type(node); - return factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 225 /* SyntaxKind.SpreadElement */: - ts.Debug.type(node); - return factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 226 /* SyntaxKind.ClassExpression */: - ts.Debug.type(node); - return factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - ts.Debug.type(node); - return factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 229 /* SyntaxKind.AsExpression */: - ts.Debug.type(node); - return factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 230 /* SyntaxKind.NonNullExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 231 /* SyntaxKind.MetaProperty */: - ts.Debug.type(node); - return factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - // Misc - case 233 /* SyntaxKind.TemplateSpan */: - ts.Debug.type(node); - return factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - // Element - case 235 /* SyntaxKind.Block */: - ts.Debug.type(node); - return factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 237 /* SyntaxKind.VariableStatement */: - ts.Debug.type(node); - return factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 238 /* SyntaxKind.ExpressionStatement */: - ts.Debug.type(node); - return factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 239 /* SyntaxKind.IfStatement */: - ts.Debug.type(node); - return factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, factory.liftToBlock)); - case 240 /* SyntaxKind.DoStatement */: - ts.Debug.type(node); - return factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 241 /* SyntaxKind.WhileStatement */: - ts.Debug.type(node); - return factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 242 /* SyntaxKind.ForStatement */: - ts.Debug.type(node); - return factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 243 /* SyntaxKind.ForInStatement */: - ts.Debug.type(node); - return factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 244 /* SyntaxKind.ForOfStatement */: - ts.Debug.type(node); - return factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 245 /* SyntaxKind.ContinueStatement */: - ts.Debug.type(node); - return factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); - case 246 /* SyntaxKind.BreakStatement */: - ts.Debug.type(node); - return factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); - case 247 /* SyntaxKind.ReturnStatement */: - ts.Debug.type(node); - return factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 248 /* SyntaxKind.WithStatement */: - ts.Debug.type(node); - return factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock)); - case 249 /* SyntaxKind.SwitchStatement */: - ts.Debug.type(node); - return factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock)); - case 250 /* SyntaxKind.LabeledStatement */: - ts.Debug.type(node); - return factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock)); - case 251 /* SyntaxKind.ThrowStatement */: - ts.Debug.type(node); - return factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 252 /* SyntaxKind.TryStatement */: - ts.Debug.type(node); - return factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock)); - case 254 /* SyntaxKind.VariableDeclaration */: - ts.Debug.type(node); - return factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 255 /* SyntaxKind.VariableDeclarationList */: - ts.Debug.type(node); - return factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); - case 256 /* SyntaxKind.FunctionDeclaration */: - ts.Debug.type(node); - return factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 257 /* SyntaxKind.ClassDeclaration */: - ts.Debug.type(node); - return factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 258 /* SyntaxKind.InterfaceDeclaration */: - ts.Debug.type(node); - return factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 259 /* SyntaxKind.TypeAliasDeclaration */: - ts.Debug.type(node); - return factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 260 /* SyntaxKind.EnumDeclaration */: - ts.Debug.type(node); - return factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); - case 261 /* SyntaxKind.ModuleDeclaration */: - ts.Debug.type(node); - return factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody)); - case 262 /* SyntaxKind.ModuleBlock */: - ts.Debug.type(node); - return factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 263 /* SyntaxKind.CaseBlock */: - ts.Debug.type(node); - return factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - ts.Debug.type(node); - return factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - ts.Debug.type(node); - return factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference)); - case 266 /* SyntaxKind.ImportDeclaration */: - ts.Debug.type(node); - return factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); - case 293 /* SyntaxKind.AssertClause */: - ts.Debug.type(node); - return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine); - case 294 /* SyntaxKind.AssertEntry */: - ts.Debug.type(node); - return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode)); - case 267 /* SyntaxKind.ImportClause */: - ts.Debug.type(node); - return factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings)); - case 268 /* SyntaxKind.NamespaceImport */: - ts.Debug.type(node); - return factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 274 /* SyntaxKind.NamespaceExport */: - ts.Debug.type(node); - return factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 269 /* SyntaxKind.NamedImports */: - ts.Debug.type(node); - return factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); - case 270 /* SyntaxKind.ImportSpecifier */: - ts.Debug.type(node); - return factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 271 /* SyntaxKind.ExportAssignment */: - ts.Debug.type(node); - return factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 272 /* SyntaxKind.ExportDeclaration */: - ts.Debug.type(node); - return factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); - case 273 /* SyntaxKind.NamedExports */: - ts.Debug.type(node); - return factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); - case 275 /* SyntaxKind.ExportSpecifier */: - ts.Debug.type(node); - return factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); - // Module references - case 277 /* SyntaxKind.ExternalModuleReference */: - ts.Debug.type(node); - return factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // JSX - case 278 /* SyntaxKind.JsxElement */: - ts.Debug.type(node); - return factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement)); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - ts.Debug.type(node); - return factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); - case 280 /* SyntaxKind.JsxOpeningElement */: - ts.Debug.type(node); - return factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); - case 281 /* SyntaxKind.JsxClosingElement */: - ts.Debug.type(node); - return factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 282 /* SyntaxKind.JsxFragment */: - ts.Debug.type(node); - return factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment)); - case 285 /* SyntaxKind.JsxAttribute */: - ts.Debug.type(node); - return factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 286 /* SyntaxKind.JsxAttributes */: - ts.Debug.type(node); - return factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); - case 287 /* SyntaxKind.JsxSpreadAttribute */: - ts.Debug.type(node); - return factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 288 /* SyntaxKind.JsxExpression */: - ts.Debug.type(node); - return factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Clauses - case 289 /* SyntaxKind.CaseClause */: - ts.Debug.type(node); - return factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); - case 290 /* SyntaxKind.DefaultClause */: - ts.Debug.type(node); - return factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 291 /* SyntaxKind.HeritageClause */: - ts.Debug.type(node); - return factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 292 /* SyntaxKind.CatchClause */: - ts.Debug.type(node); - return factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock)); - // Property assignments - case 296 /* SyntaxKind.PropertyAssignment */: - ts.Debug.type(node); - return factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - ts.Debug.type(node); - return factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 298 /* SyntaxKind.SpreadAssignment */: - ts.Debug.type(node); - return factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Enum - case 299 /* SyntaxKind.EnumMember */: - ts.Debug.type(node); - return factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - // Top-level nodes - case 305 /* SyntaxKind.SourceFile */: - ts.Debug.type(node); - return factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context)); - // Transformation nodes - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - ts.Debug.type(node); - return factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 351 /* SyntaxKind.CommaListExpression */: - ts.Debug.type(node); - return factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - default: - // No need to visit nodes with no children. - return node; - } + var fn = visitEachChildTable[node.kind]; + return fn === undefined ? node : fn(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor); } ts.visitEachChild = visitEachChild; + // NOTE: Before you can add a new method to `visitEachChildTable`, you must first ensure the `Node` subtype you + // wish to add is defined in the `HasChildren` union in types.ts. + var visitEachChildTable = (_a = {}, + _a[79 /* SyntaxKind.Identifier */] = function visitEachChildOfIdentifier(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration)); + }, + _a[163 /* SyntaxKind.QualifiedName */] = function visitEachChildOfQualifiedName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier)); + }, + _a[164 /* SyntaxKind.ComputedPropertyName */] = function visitEachChildOfComputedPropertyName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Signature elements + _a[165 /* SyntaxKind.TypeParameter */] = function visitEachChildOfTypeParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode)); + }, + _a[166 /* SyntaxKind.Parameter */] = function visitEachChildOfParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[167 /* SyntaxKind.Decorator */] = function visitEachChildOfDecorator(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Type elements + _a[168 /* SyntaxKind.PropertySignature */] = function visitEachChildOfPropertySignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[169 /* SyntaxKind.PropertyDeclaration */] = function visitEachChildOfPropertyDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + var _a; + return context.factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), + // QuestionToken and ExclamationToken are mutually exclusive in PropertyDeclaration + nodeVisitor((_a = node.questionToken) !== null && _a !== void 0 ? _a : node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[170 /* SyntaxKind.MethodSignature */] = function visitEachChildOfMethodSignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[171 /* SyntaxKind.MethodDeclaration */] = function visitEachChildOfMethodDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[173 /* SyntaxKind.Constructor */] = function visitEachChildOfConstructorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[174 /* SyntaxKind.GetAccessor */] = function visitEachChildOfGetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[175 /* SyntaxKind.SetAccessor */] = function visitEachChildOfSetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[172 /* SyntaxKind.ClassStaticBlockDeclaration */] = function visitEachChildOfClassStaticBlockDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + context.startLexicalEnvironment(); + context.suspendLexicalEnvironment(); + return context.factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[176 /* SyntaxKind.CallSignature */] = function visitEachChildOfCallSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[177 /* SyntaxKind.ConstructSignature */] = function visitEachChildOfConstructSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[178 /* SyntaxKind.IndexSignature */] = function visitEachChildOfIndexSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + // Types + _a[179 /* SyntaxKind.TypePredicate */] = function visitEachChildOfTypePredicateNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[180 /* SyntaxKind.TypeReference */] = function visitEachChildOfTypeReferenceNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[181 /* SyntaxKind.FunctionType */] = function visitEachChildOfFunctionTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[182 /* SyntaxKind.ConstructorType */] = function visitEachChildOfConstructorTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[183 /* SyntaxKind.TypeQuery */] = function visitEachChildOfTypeQueryNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[184 /* SyntaxKind.TypeLiteral */] = function visitEachChildOfTypeLiteralNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[185 /* SyntaxKind.ArrayType */] = function visitEachChildOfArrayTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode)); + }, + _a[186 /* SyntaxKind.TupleType */] = function visitEachChildOfTupleTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode)); + }, + _a[187 /* SyntaxKind.OptionalType */] = function visitEachChildOfOptionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[188 /* SyntaxKind.RestType */] = function visitEachChildOfRestTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[189 /* SyntaxKind.UnionType */] = function visitEachChildOfUnionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + }, + _a[190 /* SyntaxKind.IntersectionType */] = function visitEachChildOfIntersectionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + }, + _a[191 /* SyntaxKind.ConditionalType */] = function visitEachChildOfConditionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode)); + }, + _a[192 /* SyntaxKind.InferType */] = function visitEachChildOfInferTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); + }, + _a[202 /* SyntaxKind.ImportType */] = function visitEachChildOfImportTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isImportTypeAssertionContainer), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); + }, + _a[298 /* SyntaxKind.ImportTypeAssertionContainer */] = function visitEachChildOfImportTypeAssertionContainer(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isAssertClause), node.multiLine); + }, + _a[199 /* SyntaxKind.NamedTupleMember */] = function visitEachChildOfNamedTupleMember(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[193 /* SyntaxKind.ParenthesizedType */] = function visitEachChildOfParenthesizedType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[195 /* SyntaxKind.TypeOperator */] = function visitEachChildOfTypeOperatorNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[196 /* SyntaxKind.IndexedAccessType */] = function visitEachChildOfIndexedAccessType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode)); + }, + _a[197 /* SyntaxKind.MappedType */] = function visitEachChildOfMappedType(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[198 /* SyntaxKind.LiteralType */] = function visitEachChildOfLiteralTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression)); + }, + _a[200 /* SyntaxKind.TemplateLiteralType */] = function visitEachChildOfTemplateLiteralType(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan)); + }, + _a[201 /* SyntaxKind.TemplateLiteralTypeSpan */] = function visitEachChildOfTemplateLiteralTypeSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + }, + // Binding patterns + _a[203 /* SyntaxKind.ObjectBindingPattern */] = function visitEachChildOfObjectBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); + }, + _a[204 /* SyntaxKind.ArrayBindingPattern */] = function visitEachChildOfArrayBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); + }, + _a[205 /* SyntaxKind.BindingElement */] = function visitEachChildOfBindingElement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + // Expression + _a[206 /* SyntaxKind.ArrayLiteralExpression */] = function visitEachChildOfArrayLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + }, + _a[207 /* SyntaxKind.ObjectLiteralExpression */] = function visitEachChildOfObjectLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); + }, + _a[208 /* SyntaxKind.PropertyAccessExpression */] = function visitEachChildOfPropertyAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isPropertyAccessChain(node) ? + context.factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName)) : + context.factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName)); + }, + _a[209 /* SyntaxKind.ElementAccessExpression */] = function visitEachChildOfElementAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isElementAccessChain(node) ? + context.factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)) : + context.factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); + }, + _a[210 /* SyntaxKind.CallExpression */] = function visitEachChildOfCallExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isCallChain(node) ? + context.factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)) : + context.factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + }, + _a[211 /* SyntaxKind.NewExpression */] = function visitEachChildOfNewExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + }, + _a[212 /* SyntaxKind.TaggedTemplateExpression */] = function visitEachChildOfTaggedTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral)); + }, + _a[213 /* SyntaxKind.TypeAssertionExpression */] = function visitEachChildOfTypeAssertionExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[214 /* SyntaxKind.ParenthesizedExpression */] = function visitEachChildOfParenthesizedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[215 /* SyntaxKind.FunctionExpression */] = function visitEachChildOfFunctionExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[216 /* SyntaxKind.ArrowFunction */] = function visitEachChildOfArrowFunction(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[217 /* SyntaxKind.DeleteExpression */] = function visitEachChildOfDeleteExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[218 /* SyntaxKind.TypeOfExpression */] = function visitEachChildOfTypeOfExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[219 /* SyntaxKind.VoidExpression */] = function visitEachChildOfVoidExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[220 /* SyntaxKind.AwaitExpression */] = function visitEachChildOfAwaitExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[221 /* SyntaxKind.PrefixUnaryExpression */] = function visitEachChildOfPrefixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); + }, + _a[222 /* SyntaxKind.PostfixUnaryExpression */] = function visitEachChildOfPostfixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); + }, + _a[223 /* SyntaxKind.BinaryExpression */] = function visitEachChildOfBinaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression)); + }, + _a[224 /* SyntaxKind.ConditionalExpression */] = function visitEachChildOfConditionalExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression)); + }, + _a[225 /* SyntaxKind.TemplateExpression */] = function visitEachChildOfTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); + }, + _a[226 /* SyntaxKind.YieldExpression */] = function visitEachChildOfYieldExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[227 /* SyntaxKind.SpreadElement */] = function visitEachChildOfSpreadElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[228 /* SyntaxKind.ClassExpression */] = function visitEachChildOfClassExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + }, + _a[230 /* SyntaxKind.ExpressionWithTypeArguments */] = function visitEachChildOfExpressionWithTypeArguments(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[231 /* SyntaxKind.AsExpression */] = function visitEachChildOfAsExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[235 /* SyntaxKind.SatisfiesExpression */] = function visitEachChildOfSatisfiesExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSatisfiesExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[232 /* SyntaxKind.NonNullExpression */] = function visitEachChildOfNonNullExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return ts.isOptionalChain(node) ? + context.factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression)) : + context.factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[233 /* SyntaxKind.MetaProperty */] = function visitEachChildOfMetaProperty(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + // Misc + _a[236 /* SyntaxKind.TemplateSpan */] = function visitEachChildOfTemplateSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + }, + // Element + _a[238 /* SyntaxKind.Block */] = function visitEachChildOfBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[240 /* SyntaxKind.VariableStatement */] = function visitEachChildOfVariableStatement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList)); + }, + _a[241 /* SyntaxKind.ExpressionStatement */] = function visitEachChildOfExpressionStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[242 /* SyntaxKind.IfStatement */] = function visitEachChildOfIfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, context.factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[243 /* SyntaxKind.DoStatement */] = function visitEachChildOfDoStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context, nodeVisitor), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[244 /* SyntaxKind.WhileStatement */] = function visitEachChildOfWhileStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[245 /* SyntaxKind.ForStatement */] = function visitEachChildOfForStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[246 /* SyntaxKind.ForInStatement */] = function visitEachChildOfForInStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[247 /* SyntaxKind.ForOfStatement */] = function visitEachChildOfForOfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[248 /* SyntaxKind.ContinueStatement */] = function visitEachChildOfContinueStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); + }, + _a[249 /* SyntaxKind.BreakStatement */] = function visitEachChildOfBreakStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); + }, + _a[250 /* SyntaxKind.ReturnStatement */] = function visitEachChildOfReturnStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[251 /* SyntaxKind.WithStatement */] = function visitEachChildOfWithStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[252 /* SyntaxKind.SwitchStatement */] = function visitEachChildOfSwitchStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock)); + }, + _a[253 /* SyntaxKind.LabeledStatement */] = function visitEachChildOfLabeledStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[254 /* SyntaxKind.ThrowStatement */] = function visitEachChildOfThrowStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[255 /* SyntaxKind.TryStatement */] = function visitEachChildOfTryStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock)); + }, + _a[257 /* SyntaxKind.VariableDeclaration */] = function visitEachChildOfVariableDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[258 /* SyntaxKind.VariableDeclarationList */] = function visitEachChildOfVariableDeclarationList(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); + }, + _a[259 /* SyntaxKind.FunctionDeclaration */] = function visitEachChildOfFunctionDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[260 /* SyntaxKind.ClassDeclaration */] = function visitEachChildOfClassDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + }, + _a[261 /* SyntaxKind.InterfaceDeclaration */] = function visitEachChildOfInterfaceDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[262 /* SyntaxKind.TypeAliasDeclaration */] = function visitEachChildOfTypeAliasDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[263 /* SyntaxKind.EnumDeclaration */] = function visitEachChildOfEnumDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); + }, + _a[264 /* SyntaxKind.ModuleDeclaration */] = function visitEachChildOfModuleDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody)); + }, + _a[265 /* SyntaxKind.ModuleBlock */] = function visitEachChildOfModuleBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[266 /* SyntaxKind.CaseBlock */] = function visitEachChildOfCaseBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); + }, + _a[267 /* SyntaxKind.NamespaceExportDeclaration */] = function visitEachChildOfNamespaceExportDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[268 /* SyntaxKind.ImportEqualsDeclaration */] = function visitEachChildOfImportEqualsDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference)); + }, + _a[269 /* SyntaxKind.ImportDeclaration */] = function visitEachChildOfImportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); + }, + _a[296 /* SyntaxKind.AssertClause */] = function visitEachChildOfAssertClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine); + }, + _a[297 /* SyntaxKind.AssertEntry */] = function visitEachChildOfAssertEntry(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpression)); + }, + _a[270 /* SyntaxKind.ImportClause */] = function visitEachChildOfImportClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings)); + }, + _a[271 /* SyntaxKind.NamespaceImport */] = function visitEachChildOfNamespaceImport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[277 /* SyntaxKind.NamespaceExport */] = function visitEachChildOfNamespaceExport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[272 /* SyntaxKind.NamedImports */] = function visitEachChildOfNamedImports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); + }, + _a[273 /* SyntaxKind.ImportSpecifier */] = function visitEachChildOfImportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[274 /* SyntaxKind.ExportAssignment */] = function visitEachChildOfExportAssignment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[275 /* SyntaxKind.ExportDeclaration */] = function visitEachChildOfExportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); + }, + _a[276 /* SyntaxKind.NamedExports */] = function visitEachChildOfNamedExports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); + }, + _a[278 /* SyntaxKind.ExportSpecifier */] = function visitEachChildOfExportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + // Module references + _a[280 /* SyntaxKind.ExternalModuleReference */] = function visitEachChildOfExternalModuleReference(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // JSX + _a[281 /* SyntaxKind.JsxElement */] = function visitEachChildOfJsxElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement)); + }, + _a[282 /* SyntaxKind.JsxSelfClosingElement */] = function visitEachChildOfJsxSelfClosingElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); + }, + _a[283 /* SyntaxKind.JsxOpeningElement */] = function visitEachChildOfJsxOpeningElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); + }, + _a[284 /* SyntaxKind.JsxClosingElement */] = function visitEachChildOfJsxClosingElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression)); + }, + _a[285 /* SyntaxKind.JsxFragment */] = function visitEachChildOfJsxFragment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment)); + }, + _a[288 /* SyntaxKind.JsxAttribute */] = function visitEachChildOfJsxAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); + }, + _a[289 /* SyntaxKind.JsxAttributes */] = function visitEachChildOfJsxAttributes(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); + }, + _a[290 /* SyntaxKind.JsxSpreadAttribute */] = function visitEachChildOfJsxSpreadAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[291 /* SyntaxKind.JsxExpression */] = function visitEachChildOfJsxExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Clauses + _a[292 /* SyntaxKind.CaseClause */] = function visitEachChildOfCaseClause(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[293 /* SyntaxKind.DefaultClause */] = function visitEachChildOfDefaultClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[294 /* SyntaxKind.HeritageClause */] = function visitEachChildOfHeritageClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); + }, + _a[295 /* SyntaxKind.CatchClause */] = function visitEachChildOfCatchClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock)); + }, + // Property assignments + _a[299 /* SyntaxKind.PropertyAssignment */] = function visitEachChildOfPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[300 /* SyntaxKind.ShorthandPropertyAssignment */] = function visitEachChildOfShorthandPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression)); + }, + _a[301 /* SyntaxKind.SpreadAssignment */] = function visitEachChildOfSpreadAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Enum + _a[302 /* SyntaxKind.EnumMember */] = function visitEachChildOfEnumMember(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + // Top-level nodes + _a[308 /* SyntaxKind.SourceFile */] = function visitEachChildOfSourceFile(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context, /*start*/ undefined, /*ensureUseStrict*/ undefined, nodesVisitor)); + }, + // Transformation nodes + _a[353 /* SyntaxKind.PartiallyEmittedExpression */] = function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[354 /* SyntaxKind.CommaListExpression */] = function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + }, + _a); /** * Extracts the single node from a NodeArray. * @@ -91317,7 +91881,7 @@ var ts; exit(); return sourceIndex; } - /* eslint-disable boolean-trivia, no-null/no-null */ + /* eslint-disable local/boolean-trivia, no-null/no-null */ function setSourceContent(sourceIndex, content) { enter(); if (content !== null) { @@ -91330,7 +91894,7 @@ var ts; } exit(); } - /* eslint-enable boolean-trivia, no-null/no-null */ + /* eslint-enable local/boolean-trivia, no-null/no-null */ function addName(name) { enter(); if (!nameToNameIndexMap) @@ -91932,7 +92496,7 @@ var ts; function chainBundle(context, transformSourceFile) { return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -91983,7 +92547,7 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: // import "mod" // import x from "mod" // import * as x from "mod" @@ -91996,13 +92560,13 @@ var ts; hasImportDefault = true; } break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - if (node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + if (node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { // import x = require("mod") externalImports.push(node); } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -92033,13 +92597,13 @@ var ts; addExportedNamesForExportDeclaration(node); } break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; } break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { for (var _b = 0, _c = node.declarationList.declarations; _b < _c.length; _b++) { var decl = _c[_b]; @@ -92047,9 +92611,9 @@ var ts; } } break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - if (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { // export default function() { } if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); @@ -92067,9 +92631,9 @@ var ts; } } break; - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - if (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { // export default class { } if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); @@ -92247,7 +92811,7 @@ var ts; * @param isStatic A value indicating whether the member should be a static or instance member. */ function isInitializedProperty(member) { - return member.kind === 167 /* SyntaxKind.PropertyDeclaration */ + return member.kind === 169 /* SyntaxKind.PropertyDeclaration */ && member.initializer !== undefined; } ts.isInitializedProperty = isInitializedProperty; @@ -92257,7 +92821,7 @@ var ts; * @param member The class element node. */ function isNonStaticMethodOrAccessorWithPrivateName(member) { - return !ts.isStatic(member) && ts.isMethodOrAccessor(member) && ts.isPrivateIdentifier(member.name); + return !ts.isStatic(member) && (ts.isMethodOrAccessor(member) || ts.isAutoAccessorPropertyDeclaration(member)) && ts.isPrivateIdentifier(member.name); } ts.isNonStaticMethodOrAccessorWithPrivateName = isNonStaticMethodOrAccessorWithPrivateName; /** @@ -92311,12 +92875,12 @@ var ts; */ function getAllDecoratorsOfClassElement(member, parent) { switch (member.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return getAllDecoratorsOfAccessors(member, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return getAllDecoratorsOfMethod(member); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return getAllDecoratorsOfProperty(member); default: return undefined; @@ -92977,8 +93541,8 @@ var ts; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; // Enable substitution for property/element access to emit const enum values. - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // These variables contain state that changes as we descend into the tree. var currentSourceFile; var currentNamespace; @@ -92998,14 +93562,14 @@ var ts; var applicableSubstitutions; return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - if (node.kind === 306 /* SyntaxKind.Bundle */) { + if (node.kind === 309 /* SyntaxKind.Bundle */) { return transformBundle(node); } return transformSourceFile(node); } function transformBundle(node) { return factory.createBundle(node.sourceFiles.map(transformSourceFile), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 308 /* SyntaxKind.InputFiles */) { + if (prepend.kind === 311 /* SyntaxKind.InputFiles */) { return ts.createUnparsedSourceFile(prepend, "js"); } return prepend; @@ -93054,15 +93618,15 @@ var ts; */ function onBeforeVisitNode(node) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 263 /* SyntaxKind.CaseBlock */: - case 262 /* SyntaxKind.ModuleBlock */: - case 235 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 266 /* SyntaxKind.CaseBlock */: + case 265 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: currentLexicalScope = node; currentScopeFirstDeclarationsOfName = undefined; break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */)) { break; } @@ -93074,7 +93638,7 @@ var ts; // These nodes should always have names unless they are default-exports; // however, class declaration parsing allows for undefined names, so syntactically invalid // programs may also have an undefined name. - ts.Debug.assert(node.kind === 257 /* SyntaxKind.ClassDeclaration */ || ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)); + ts.Debug.assert(node.kind === 260 /* SyntaxKind.ClassDeclaration */ || ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)); } break; } @@ -93113,10 +93677,10 @@ var ts; */ function sourceElementVisitorWorker(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitElidableStatement(node); default: return visitorWorker(node); @@ -93137,13 +93701,13 @@ var ts; return node; } switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); default: ts.Debug.fail("Unhandled ellided statement"); @@ -93163,11 +93727,11 @@ var ts; * @param node The node to visit. */ function namespaceElementVisitorWorker(node) { - if (node.kind === 272 /* SyntaxKind.ExportDeclaration */ || - node.kind === 266 /* SyntaxKind.ImportDeclaration */ || - node.kind === 267 /* SyntaxKind.ImportClause */ || - (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && - node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */)) { + if (node.kind === 275 /* SyntaxKind.ExportDeclaration */ || + node.kind === 269 /* SyntaxKind.ImportDeclaration */ || + node.kind === 270 /* SyntaxKind.ImportClause */ || + (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && + node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */)) { // do not emit ES6 imports and exports since they are illegal inside a namespace return undefined; } @@ -93191,27 +93755,27 @@ var ts; */ function classElementVisitorWorker(node, parent) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return visitConstructor(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // Property declarations are not TypeScript syntax, but they must be visited // for the decorator transformation. return visitPropertyDeclaration(node, parent); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node, parent); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node, parent); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return ts.visitEachChild(node, visitor, context); - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: return node; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Index signatures are elided return; default: @@ -93223,17 +93787,17 @@ var ts; } function objectLiteralElementVisitorWorker(node, parent) { switch (node.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return visitor(node); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node, parent); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node, parent); @@ -93244,7 +93808,7 @@ var ts; function modifierVisitor(node) { if (ts.isDecorator(node)) return undefined; - if (ts.modifierToFlag(node.kind) & 116958 /* ModifierFlags.TypeScriptModifier */) { + if (ts.modifierToFlag(node.kind) & 117086 /* ModifierFlags.TypeScriptModifier */) { return undefined; } else if (currentNamespace && node.kind === 93 /* SyntaxKind.ExportKeyword */) { @@ -93272,58 +93836,58 @@ var ts; case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: // TypeScript accessibility and readonly modifiers are elided // falls through - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 177 /* SyntaxKind.TypePredicate */: - case 163 /* SyntaxKind.TypeParameter */: - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: + case 187 /* SyntaxKind.OptionalType */: + case 188 /* SyntaxKind.RestType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 179 /* SyntaxKind.TypePredicate */: + case 165 /* SyntaxKind.TypeParameter */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 180 /* SyntaxKind.ConstructorType */: - case 179 /* SyntaxKind.FunctionType */: - case 181 /* SyntaxKind.TypeQuery */: - case 178 /* SyntaxKind.TypeReference */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 189 /* SyntaxKind.ConditionalType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 192 /* SyntaxKind.ThisType */: - case 193 /* SyntaxKind.TypeOperator */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 195 /* SyntaxKind.MappedType */: - case 196 /* SyntaxKind.LiteralType */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 182 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 183 /* SyntaxKind.TypeQuery */: + case 180 /* SyntaxKind.TypeReference */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 191 /* SyntaxKind.ConditionalType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 194 /* SyntaxKind.ThisType */: + case 195 /* SyntaxKind.TypeOperator */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 197 /* SyntaxKind.MappedType */: + case 198 /* SyntaxKind.LiteralType */: // TypeScript type nodes are elided. // falls through - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // TypeScript index signatures are elided. return undefined; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // TypeScript type-only declarations are elided. return factory.createNotEmittedStatement(node); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: // TypeScript namespace export declarations are elided. return undefined; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // TypeScript interfaces are elided, but some comments may be preserved. // See the implementation of `getLeadingComments` in comments.ts for more details. return factory.createNotEmittedStatement(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // This may be a class declaration with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -93333,7 +93897,7 @@ var ts; // - index signatures // - method overload signatures return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: // This may be a class expression with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -93343,34 +93907,34 @@ var ts; // - index signatures // - method overload signatures return visitClassExpression(node); - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: // This may be a heritage clause with TypeScript syntax extensions. // // TypeScript heritage clause extensions include: // - `implements` clause return visitHeritageClause(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // TypeScript supports type arguments on an expression in an `extends` heritage clause. return visitExpressionWithTypeArguments(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return ts.Debug.fail("Class and object literal elements must be visited with their respective visitors"); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: // Typescript function declarations can have modifiers, decorators, and type annotations. return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: // TypeScript function expressions can have modifiers and type annotations. return visitFunctionExpression(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // TypeScript arrow functions can have modifiers and type annotations. return visitArrowFunction(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // This may be a parameter declaration with TypeScript syntax extensions. // // TypeScript parameter declaration syntax extensions include: @@ -93380,40 +93944,42 @@ var ts; // - type annotations // - this parameters return visitParameter(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: // ParenthesizedExpressions are TypeScript if their expression is a // TypeAssertion or AsExpression return visitParenthesizedExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: // TypeScript type assertions are removed, but their subtrees are preserved. return visitAssertionExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return visitSatisfiesExpression(node); + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: // TypeScript non-null expressions are removed, but their subtrees are preserved. return visitNonNullExpression(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: // TypeScript enum declarations do not exist in ES6 and must be rewritten. return visitEnumDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // TypeScript namespace exports for variable statements must be transformed. return visitVariableStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // TypeScript namespace declarations must be transformed. return visitModuleDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // TypeScript namespace or external module import. return visitImportEqualsDeclaration(node); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node); - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: return visitJsxJsxOpeningElement(node); default: // node contains some other TypeScript syntax @@ -93683,10 +94249,10 @@ var ts; */ function shouldAddTypeMetadata(node) { var kind = node.kind; - return kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */; + return kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */; } /** * Determines whether to emit the "design:returntype" metadata based on the node's kind. @@ -93696,7 +94262,7 @@ var ts; * @param node The node to test. */ function shouldAddReturnTypeMetadata(node) { - return node.kind === 169 /* SyntaxKind.MethodDeclaration */; + return node.kind === 171 /* SyntaxKind.MethodDeclaration */; } /** * Determines whether to emit the "design:paramtypes" metadata based on the node's kind. @@ -93707,12 +94273,12 @@ var ts; */ function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.getFirstConstructorWithBody(node) !== undefined; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; } return false; @@ -93802,7 +94368,7 @@ var ts; return !ts.nodeIsMissing(node.body); } function visitPropertyDeclaration(node, parent) { - var isAmbient = node.flags & 16777216 /* NodeFlags.Ambient */ || ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */); + var isAmbient = node.flags & 16777216 /* NodeFlags.Ambient */ || ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */); if (isAmbient && !ts.hasDecorators(node)) { return undefined; } @@ -93910,7 +94476,7 @@ var ts; * @param node The declaration node. */ function shouldEmitAccessorDeclaration(node) { - return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)); + return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)); } function visitGetAccessor(node, parent) { if (!(node.transformFlags & 1 /* TransformFlags.ContainsTypeScript */)) { @@ -94052,6 +94618,10 @@ var ts; var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression); return factory.createPartiallyEmittedExpression(expression, node); } + function visitSatisfiesExpression(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + return factory.createPartiallyEmittedExpression(expression, node); + } function visitCallExpression(node) { return factory.updateCallExpression(node, ts.visitNode(node.expression, visitor, ts.isExpression), /*typeArguments*/ undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression)); @@ -94265,12 +94835,12 @@ var ts; // enums in any other scope are emitted as a `let` declaration. var statement = factory.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), factory.createVariableDeclarationList([ factory.createVariableDeclaration(factory.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)) - ], currentLexicalScope.kind === 305 /* SyntaxKind.SourceFile */ ? 0 /* NodeFlags.None */ : 1 /* NodeFlags.Let */)); + ], currentLexicalScope.kind === 308 /* SyntaxKind.SourceFile */ ? 0 /* NodeFlags.None */ : 1 /* NodeFlags.Let */)); ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { // Adjust the source map emit to match the old emitter. - if (node.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (node.kind === 263 /* SyntaxKind.EnumDeclaration */) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -94395,7 +94965,7 @@ var ts; var statementsLocation; var blockLocation; if (node.body) { - if (node.body.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (node.body.kind === 265 /* SyntaxKind.ModuleBlock */) { saveStateAndInvoke(node.body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = node.body.statements; blockLocation = node.body; @@ -94442,13 +95012,13 @@ var ts; // })(hi = hello.hi || (hello.hi = {})); // })(hello || (hello = {})); // We only want to emit comment on the namespace which contains block body itself, not the containing namespaces. - if (!node.body || node.body.kind !== 262 /* SyntaxKind.ModuleBlock */) { + if (!node.body || node.body.kind !== 265 /* SyntaxKind.ModuleBlock */) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* EmitFlags.NoComments */); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 264 /* SyntaxKind.ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -94495,7 +95065,7 @@ var ts; * @param node The named import bindings node. */ function visitNamedImportBindings(node) { - if (node.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (node.kind === 271 /* SyntaxKind.NamespaceImport */) { // Elide a namespace import if it is not referenced. return shouldEmitAliasDeclaration(node) ? node : undefined; } @@ -94653,7 +95223,7 @@ var ts; */ function isNamedExternalModuleExport(node) { return isExternalModuleExport(node) - && !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */); + && !ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */); } /** * Gets a value indicating whether the node is the default export of an external module. @@ -94662,7 +95232,7 @@ var ts; */ function isDefaultExternalModuleExport(node) { return isExternalModuleExport(node) - && ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */); + && ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */); } function addExportMemberAssignment(statements, node) { var expression = factory.createAssignment(factory.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true), factory.getLocalName(node)); @@ -94707,16 +95277,16 @@ var ts; // We need to enable substitutions for identifiers and shorthand property assignments. This allows us to // substitute the names of exported members of a namespace. context.enableSubstitution(79 /* SyntaxKind.Identifier */); - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // We need to be notified when entering and exiting namespaces. - context.enableEmitNotification(261 /* SyntaxKind.ModuleDeclaration */); + context.enableEmitNotification(264 /* SyntaxKind.ModuleDeclaration */); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 261 /* SyntaxKind.ModuleDeclaration */; + return ts.getOriginalNode(node).kind === 264 /* SyntaxKind.ModuleDeclaration */; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 260 /* SyntaxKind.EnumDeclaration */; + return ts.getOriginalNode(node).kind === 263 /* SyntaxKind.EnumDeclaration */; } /** * Hook for node emit. @@ -94777,9 +95347,9 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); } return node; @@ -94794,9 +95364,9 @@ var ts; // If we are nested within a namespace declaration, we may need to qualifiy // an identifier that is exported from a merged namespace. var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false); - if (container && container.kind !== 305 /* SyntaxKind.SourceFile */) { - var substitute = (applicableSubstitutions & 2 /* TypeScriptSubstitutionFlags.NamespaceExports */ && container.kind === 261 /* SyntaxKind.ModuleDeclaration */) || - (applicableSubstitutions & 8 /* TypeScriptSubstitutionFlags.NonQualifiedEnumMembers */ && container.kind === 260 /* SyntaxKind.EnumDeclaration */); + if (container && container.kind !== 308 /* SyntaxKind.SourceFile */) { + var substitute = (applicableSubstitutions & 2 /* TypeScriptSubstitutionFlags.NamespaceExports */ && container.kind === 264 /* SyntaxKind.ModuleDeclaration */) || + (applicableSubstitutions & 8 /* TypeScriptSubstitutionFlags.NonQualifiedEnumMembers */ && container.kind === 263 /* SyntaxKind.EnumDeclaration */); if (substitute) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(container), node), /*location*/ node); @@ -94835,9 +95405,10 @@ var ts; return ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node) ? resolver.getConstantValue(node) : undefined; } function shouldEmitAliasDeclaration(node) { - return compilerOptions.preserveValueImports - ? resolver.isValueAliasDeclaration(node) - : resolver.isReferencedAliasDeclaration(node); + return ts.isInJSFile(node) || + (compilerOptions.preserveValueImports + ? resolver.isValueAliasDeclaration(node) + : resolver.isReferencedAliasDeclaration(node)); } } ts.transformTypeScript = transformTypeScript; @@ -94885,13 +95456,24 @@ var ts; var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); var useDefineForClassFields = ts.getUseDefineForClassFields(compilerOptions); + // Always transform field initializers using Set semantics when `useDefineForClassFields: false`. + var shouldTransformInitializersUsingSet = !useDefineForClassFields; + // Transform field initializers using Define semantics when `useDefineForClassFields: true` and target < ES2022. + var shouldTransformInitializersUsingDefine = useDefineForClassFields && languageVersion < 9 /* ScriptTarget.ES2022 */; + var shouldTransformInitializers = shouldTransformInitializersUsingSet || shouldTransformInitializersUsingDefine; + // We need to transform private members and class static blocks when target < ES2022. var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < 9 /* ScriptTarget.ES2022 */; + // We need to transform `accessor` fields when target < ESNext + var shouldTransformAutoAccessors = languageVersion < 99 /* ScriptTarget.ESNext */; // We need to transform `this` in a static initializer into a reference to the class - // when targeting < ES2022 since the assignment will be moved outside of the class body. + // when target < ES2022 since the assignment will be moved outside of the class body. var shouldTransformThisInStaticInitializers = languageVersion < 9 /* ScriptTarget.ES2022 */; - // We don't need to transform `super` property access when targeting ES5, ES3 because + // We don't need to transform `super` property access when target <= ES5 because // the es2015 transformation handles those. var shouldTransformSuperInStaticInitializers = shouldTransformThisInStaticInitializers && languageVersion >= 2 /* ScriptTarget.ES2015 */; + var shouldTransformAnything = shouldTransformInitializers || + shouldTransformPrivateElementsOrClassStaticBlocks || + shouldTransformAutoAccessors; var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; var previousOnEmitNode = context.onEmitNode; @@ -94911,98 +95493,149 @@ var ts; var classLexicalEnvironmentStack = []; var classLexicalEnvironmentMap = new ts.Map(); var currentClassLexicalEnvironment; + var currentClassContainer; var currentComputedPropertyNameClassLexicalEnvironment; var currentStaticPropertyDeclarationOrStaticBlock; return ts.chainBundle(context, transformSourceFile); function transformSourceFile(node) { - var options = context.getCompilerOptions(); - if (node.isDeclarationFile - || useDefineForClassFields && ts.getEmitScriptTarget(options) >= 9 /* ScriptTarget.ES2022 */) { + if (node.isDeclarationFile || !shouldTransformAnything) { return node; } var visited = ts.visitEachChild(node, visitor, context); ts.addEmitHelpers(visited, context.readEmitHelpers()); return visited; } - function visitorWorker(node, valueIsDiscarded) { - if (node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */) { - switch (node.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - return visitClassLike(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitPropertyDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: - return visitVariableStatement(node); - case 80 /* SyntaxKind.PrivateIdentifier */: - return visitPrivateIdentifier(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitClassStaticBlockDeclaration(node); - } + function visitor(node) { + if (!(node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */) && + !(node.transformFlags & 134234112 /* TransformFlags.ContainsLexicalThisOrSuper */)) { + return node; } - if (node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */ || - node.transformFlags & 134217728 /* TransformFlags.ContainsLexicalSuper */ && - shouldTransformSuperInStaticInitializers && - currentStaticPropertyDeclarationOrStaticBlock && - currentClassLexicalEnvironment) { - switch (node.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); - case 221 /* SyntaxKind.BinaryExpression */: - return visitBinaryExpression(node, valueIsDiscarded); - case 208 /* SyntaxKind.CallExpression */: - return visitCallExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - return visitTaggedTemplateExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: - return visitPropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: - return visitElementAccessExpression(node); - case 238 /* SyntaxKind.ExpressionStatement */: - return visitExpressionStatement(node); - case 242 /* SyntaxKind.ForStatement */: - return visitForStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: { - var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = undefined; - var result = ts.visitEachChild(node, visitor, context); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; - return result; - } + switch (node.kind) { + case 127 /* SyntaxKind.AccessorKeyword */: + return shouldTransformAutoAccessors ? undefined : node; + case 260 /* SyntaxKind.ClassDeclaration */: + return visitClassDeclaration(node); + case 228 /* SyntaxKind.ClassExpression */: + return visitClassExpression(node); + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + return visitClassStaticBlockDeclaration(node); + case 169 /* SyntaxKind.PropertyDeclaration */: + return visitPropertyDeclaration(node); + case 240 /* SyntaxKind.VariableStatement */: + return visitVariableStatement(node); + case 80 /* SyntaxKind.PrivateIdentifier */: + return visitPrivateIdentifier(node); + case 208 /* SyntaxKind.PropertyAccessExpression */: + return visitPropertyAccessExpression(node); + case 209 /* SyntaxKind.ElementAccessExpression */: + return visitElementAccessExpression(node); + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + return visitPreOrPostfixUnaryExpression(node, /*valueIsDiscarded*/ false); + case 223 /* SyntaxKind.BinaryExpression */: + return visitBinaryExpression(node, /*valueIsDiscarded*/ false); + case 210 /* SyntaxKind.CallExpression */: + return visitCallExpression(node); + case 241 /* SyntaxKind.ExpressionStatement */: + return visitExpressionStatement(node); + case 212 /* SyntaxKind.TaggedTemplateExpression */: + return visitTaggedTemplateExpression(node); + case 245 /* SyntaxKind.ForStatement */: + return visitForStatement(node); + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: { + // If we are descending into a new scope, clear the current static property or block + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, fallbackVisitor, node); } + default: + return fallbackVisitor(node); } + } + function fallbackVisitor(node) { return ts.visitEachChild(node, visitor, context); } + /** + * Visits a node in an expression whose result is discarded. + */ function discardedValueVisitor(node) { - return visitorWorker(node, /*valueIsDiscarded*/ true); - } - function visitor(node) { - return visitorWorker(node, /*valueIsDiscarded*/ false); + switch (node.kind) { + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + return visitPreOrPostfixUnaryExpression(node, /*valueIsDiscarded*/ true); + case 223 /* SyntaxKind.BinaryExpression */: + return visitBinaryExpression(node, /*valueIsDiscarded*/ true); + default: + return visitor(node); + } } + /** + * Visits a node in a {@link HeritageClause}. + */ function heritageClauseVisitor(node) { switch (node.kind) { - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return ts.visitEachChild(node, heritageClauseVisitor, context); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - return visitExpressionWithTypeArguments(node); + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + return visitExpressionWithTypeArgumentsInHeritageClause(node); + default: + return visitor(node); } - return visitor(node); } - function visitorDestructuringTarget(node) { + /** + * Visits the assignment target of a destructuring assignment. + */ + function assignmentTargetVisitor(node) { switch (node.kind) { - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitAssignmentPattern(node); default: return visitor(node); } } + /** + * Visits a member of a class. + */ + function classElementVisitor(node) { + switch (node.kind) { + case 173 /* SyntaxKind.Constructor */: + return visitConstructorDeclaration(node); + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, visitMethodOrAccessorDeclaration, node); + case 169 /* SyntaxKind.PropertyDeclaration */: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, visitPropertyDeclaration, node); + case 164 /* SyntaxKind.ComputedPropertyName */: + return visitComputedPropertyName(node); + case 237 /* SyntaxKind.SemicolonClassElement */: + return node; + default: + return visitor(node); + } + } + /** + * Visits the results of an auto-accessor field transformation in a second pass. + */ + function accessorFieldResultVisitor(node) { + switch (node.kind) { + case 169 /* SyntaxKind.PropertyDeclaration */: + return transformFieldInitializer(node); + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return classElementVisitor(node); + default: + ts.Debug.assertMissingNode(node, "Expected node to either be a PropertyDeclaration, GetAccessorDeclaration, or SetAccessorDeclaration"); + break; + } + } /** * If we visit a private name, this means it is an undeclared private name. * Replace it with an empty identifier to indicate a problem with the code, @@ -95018,17 +95651,15 @@ var ts; } return ts.setOriginalNode(factory.createIdentifier(""), node); } + function isPrivateIdentifierInExpression(node) { + return ts.isPrivateIdentifier(node.left) + && node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */; + } /** * Visits `#id in expr` */ - function visitPrivateIdentifierInInExpression(node) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return node; - } - var privId = node.left; - ts.Debug.assertNode(privId, ts.isPrivateIdentifier); - ts.Debug.assert(node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */); - var info = accessPrivateIdentifier(privId); + function transformPrivateIdentifierInInExpression(node) { + var info = accessPrivateIdentifier(node.left); if (info) { var receiver = ts.visitNode(node.right, visitor, ts.isExpression); return ts.setOriginalNode(context.getEmitHelperFactory().createClassPrivateFieldInHelper(info.brandCheckIdentifier, receiver), node); @@ -95036,31 +95667,6 @@ var ts; // Private name has not been declared. Subsequent transformers will handle this error return ts.visitEachChild(node, visitor, context); } - /** - * Visits the members of a class that has fields. - * - * @param node The node to visit. - */ - function classElementVisitor(node) { - switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - // Constructors for classes using class fields are transformed in - // `visitClassDeclaration` or `visitClassExpression`. - return undefined; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - return visitMethodOrAccessorDeclaration(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitPropertyDeclaration(node); - case 162 /* SyntaxKind.ComputedPropertyName */: - return visitComputedPropertyName(node); - case 234 /* SyntaxKind.SemicolonClassElement */: - return node; - default: - return visitor(node); - } - } function visitVariableStatement(node) { var savedPendingStatements = pendingStatements; pendingStatements = []; @@ -95070,15 +95676,24 @@ var ts; pendingStatements = savedPendingStatements; return statement; } - function visitComputedPropertyName(name) { - var node = ts.visitEachChild(name, visitor, context); + function visitComputedPropertyName(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); if (ts.some(pendingExpressions)) { - var expressions = pendingExpressions; - expressions.push(node.expression); - pendingExpressions = []; - node = factory.updateComputedPropertyName(node, factory.inlineExpressions(expressions)); + if (ts.isParenthesizedExpression(expression)) { + expression = factory.updateParenthesizedExpression(expression, factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression.expression], false))); + } + else { + expression = factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression], false)); + } + pendingExpressions = undefined; } - return node; + return factory.updateComputedPropertyName(node, expression); + } + function visitConstructorDeclaration(node) { + if (currentClassContainer) { + return transformConstructor(node, currentClassContainer); + } + return fallbackVisitor(node); } function visitMethodOrAccessorDeclaration(node) { ts.Debug.assert(!ts.hasDecorators(node)); @@ -95093,13 +95708,20 @@ var ts; } var functionName = getHoistedFunctionName(node); if (functionName) { - getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return ts.isModifier(m) && !ts.isStaticModifier(m); }), node.asteriskToken, functionName, - /* typeParameters */ undefined, ts.visitParameterList(node.parameters, classElementVisitor, context), - /* type */ undefined, ts.visitFunctionBody(node.body, classElementVisitor, context)))); + getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return ts.isModifier(m) && !ts.isStaticModifier(m) && !ts.isAccessorModifier(m); }), node.asteriskToken, functionName, + /* typeParameters */ undefined, ts.visitParameterList(node.parameters, visitor, context), + /* type */ undefined, ts.visitFunctionBody(node.body, visitor, context)))); } // remove method declaration from class return undefined; } + function setCurrentStaticPropertyDeclarationOrStaticBlockAnd(current, visitor, arg) { + var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; + currentStaticPropertyDeclarationOrStaticBlock = current; + var result = visitor(arg); + currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; + return result; + } function getHoistedFunctionName(node) { ts.Debug.assert(ts.isPrivateIdentifier(node.name)); var info = accessPrivateIdentifier(node.name); @@ -95116,49 +95738,104 @@ var ts; } } } - function visitPropertyDeclaration(node) { - ts.Debug.assert(!ts.hasDecorators(node)); - if (ts.isPrivateIdentifier(node.name)) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - if (ts.isStatic(node)) { - // static fields are left as is - return ts.visitEachChild(node, visitor, context); - } - // Initializer is elided as the field is initialized in transformConstructor. - return factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, - /*questionOrExclamationToken*/ undefined, - /*type*/ undefined, - /*initializer*/ undefined); - } - // leave invalid code untransformed + function transformAutoAccessor(node) { + // transforms: + // accessor x = 1; + // into: + // #x = 1; + // get x() { return this.#x; } + // set x(value) { this.#x = value; } + ts.Debug.assertEachNode(node.modifiers, ts.isModifier); + var commentRange = ts.getCommentRange(node); + var sourceMapRange = ts.getSourceMapRange(node); + // Since we're creating two declarations where there was previously one, cache + // the expression for any computed property names. + var name = node.name; + var getterName = name; + var setterName = name; + if (ts.isComputedPropertyName(name) && !ts.isSimpleInlineableExpression(name.expression)) { + var temp = factory.createTempVariable(hoistVariableDeclaration); + ts.setSourceMapRange(temp, name.expression); + var expression = ts.visitNode(name.expression, visitor, ts.isExpression); + var assignment = factory.createAssignment(temp, expression); + ts.setSourceMapRange(assignment, name.expression); + getterName = factory.updateComputedPropertyName(name, factory.inlineExpressions([assignment, temp])); + setterName = factory.updateComputedPropertyName(name, temp); + } + var backingField = ts.createAccessorPropertyBackingField(factory, node, node.modifiers, node.initializer); + ts.setOriginalNode(backingField, node); + ts.setEmitFlags(backingField, 1536 /* EmitFlags.NoComments */); + ts.setSourceMapRange(backingField, sourceMapRange); + var getter = ts.createAccessorPropertyGetRedirector(factory, node, node.modifiers, getterName); + ts.setOriginalNode(getter, node); + ts.setCommentRange(getter, commentRange); + ts.setSourceMapRange(getter, sourceMapRange); + var setter = ts.createAccessorPropertySetRedirector(factory, node, node.modifiers, setterName); + ts.setOriginalNode(setter, node); + ts.setEmitFlags(setter, 1536 /* EmitFlags.NoComments */); + ts.setSourceMapRange(setter, sourceMapRange); + return ts.visitArray([backingField, getter, setter], accessorFieldResultVisitor, ts.isClassElement); + } + function transformPrivateFieldInitializer(node) { + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + // If we are transforming private elements into WeakMap/WeakSet, we should elide the node. var info = accessPrivateIdentifier(node.name); ts.Debug.assert(info, "Undeclared private name for property declaration."); - if (!info.isValid) { - return node; + // Leave invalid code untransformed; otherwise, elide the node as it is transformed elsewhere. + return info.isValid ? undefined : node; + } + if (shouldTransformInitializersUsingSet && !ts.isStatic(node)) { + // If we are transforming initializers using Set semantics we will elide the initializer as it will + // be moved to the constructor to preserve evaluation order next to public instance fields. We don't + // need to do this transformation for private static fields since public static fields can be + // transformed into `static {}` blocks. + return factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, + /*initializer*/ undefined); + } + return ts.visitEachChild(node, visitor, context); + } + function transformPublicFieldInitializer(node) { + if (shouldTransformInitializers) { + // Create a temporary variable to store a computed property name (if necessary). + // If it's not inlineable, then we emit an expression after the class which assigns + // the property name to the temporary variable. + var expr = getPropertyNameExpressionIfNeeded(node.name, /*shouldHoist*/ !!node.initializer || useDefineForClassFields); + if (expr) { + getPendingExpressions().push(expr); } - } - // Create a temporary variable to store a computed property name (if necessary). - // If it's not inlineable, then we emit an expression after the class which assigns - // the property name to the temporary variable. - var expr = getPropertyNameExpressionIfNeeded(node.name, !!node.initializer || useDefineForClassFields); - if (expr && !ts.isSimpleInlineableExpression(expr)) { - getPendingExpressions().push(expr); - } - if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks && !useDefineForClassFields) { - var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); - if (initializerStatement) { - var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); - ts.setOriginalNode(staticBlock, node); - ts.setCommentRange(staticBlock, node); - // Set the comment range for the statement to an empty synthetic range - // and drop synthetic comments from the statement to avoid printing them twice. - ts.setCommentRange(initializerStatement, { pos: -1, end: -1 }); - ts.setSyntheticLeadingComments(initializerStatement, undefined); - ts.setSyntheticTrailingComments(initializerStatement, undefined); - return staticBlock; + if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks) { + var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); + if (initializerStatement) { + var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); + ts.setOriginalNode(staticBlock, node); + ts.setCommentRange(staticBlock, node); + // Set the comment range for the statement to an empty synthetic range + // and drop synthetic comments from the statement to avoid printing them twice. + ts.setCommentRange(initializerStatement, { pos: -1, end: -1 }); + ts.setSyntheticLeadingComments(initializerStatement, undefined); + ts.setSyntheticTrailingComments(initializerStatement, undefined); + return staticBlock; + } } + return undefined; } - return undefined; + return ts.visitEachChild(node, classElementVisitor, context); + } + function transformFieldInitializer(node) { + ts.Debug.assert(!ts.hasDecorators(node), "Decorators should already have been transformed and elided."); + return ts.isPrivateIdentifierClassElementDeclaration(node) ? + transformPrivateFieldInitializer(node) : + transformPublicFieldInitializer(node); + } + function visitPropertyDeclaration(node) { + // If this is an auto-accessor, we defer to `transformAutoAccessor`. That function + // will in turn call `transformFieldInitializer` as needed. + if (shouldTransformAutoAccessors && ts.isAutoAccessorPropertyDeclaration(node)) { + return transformAutoAccessor(node); + } + return transformFieldInitializer(node); } function createPrivateIdentifierAccess(info, receiver) { return createPrivateIdentifierAccessHelper(info, ts.visitNode(receiver, visitor, ts.isExpression)); @@ -95222,9 +95899,11 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitPreOrPostfixUnaryExpression(node, valueIsDiscarded) { - if (node.operator === 45 /* SyntaxKind.PlusPlusToken */ || node.operator === 46 /* SyntaxKind.MinusMinusToken */) { + if (node.operator === 45 /* SyntaxKind.PlusPlusToken */ || + node.operator === 46 /* SyntaxKind.MinusMinusToken */) { var operand = ts.skipParentheses(node.operand); - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(operand)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(operand)) { var info = void 0; if (info = accessPrivateIdentifier(operand.name)) { var receiver = ts.visitNode(operand.expression, visitor, ts.isExpression); @@ -95313,7 +95992,9 @@ var ts; return { readExpression: readExpression, initializeExpression: initializeExpression }; } function visitCallExpression(node) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) { + // obj.#x() // Transform call expressions of private names to properly bind the `this` parameter. var _a = factory.createCallBinding(node.expression, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; if (ts.isCallChain(node)) { @@ -95328,6 +96009,8 @@ var ts; ts.isSuperProperty(node.expression) && currentStaticPropertyDeclarationOrStaticBlock && (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.classConstructor)) { + // super.x() + // super[x]() // converts `super.f(...)` into `Reflect.get(_baseTemp, "f", _classTemp).call(_classTemp, ...)` var invocation = factory.createFunctionCallCall(ts.visitNode(node.expression, visitor, ts.isExpression), currentClassLexicalEnvironment.classConstructor, ts.visitNodes(node.arguments, visitor, ts.isExpression)); ts.setOriginalNode(invocation, node); @@ -95337,7 +96020,8 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitTaggedTemplateExpression(node) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) { // Bind the `this` correctly for tagged template literals when the tag is a private identifier property access. var _a = factory.createCallBinding(node.tag, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; return factory.updateTaggedTemplateExpression(node, factory.createCallExpression(factory.createPropertyAccessExpression(ts.visitNode(target, visitor), "bind"), @@ -95363,11 +96047,8 @@ var ts; classLexicalEnvironmentMap.set(ts.getOriginalNodeId(node), currentClassLexicalEnvironment); } startLexicalEnvironment(); - var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = node; - var statements = ts.visitNodes(node.body.statements, visitor, ts.isStatement); + var statements = setCurrentStaticPropertyDeclarationOrStaticBlockAnd(node, function (statements) { return ts.visitNodes(statements, visitor, ts.isStatement); }, node.body.statements); statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; var iife = factory.createImmediatelyInvokedArrowFunction(statements); ts.setOriginalNode(iife, node); ts.setTextRange(iife, node); @@ -95377,9 +96058,12 @@ var ts; } function visitBinaryExpression(node, valueIsDiscarded) { if (ts.isDestructuringAssignment(node)) { + // ({ x: obj.#x } = ...) + // ({ x: super.x } = ...) + // ({ x: super[x] } = ...) var savedPendingExpressions = pendingExpressions; pendingExpressions = undefined; - node = factory.updateBinaryExpression(node, ts.visitNode(node.left, visitorDestructuringTarget), node.operatorToken, ts.visitNode(node.right, visitor)); + node = factory.updateBinaryExpression(node, ts.visitNode(node.left, assignmentTargetVisitor), node.operatorToken, ts.visitNode(node.right, visitor)); var expr = ts.some(pendingExpressions) ? factory.inlineExpressions(ts.compact(__spreadArray(__spreadArray([], pendingExpressions, true), [node], false))) : node; @@ -95387,7 +96071,9 @@ var ts; return expr; } if (ts.isAssignmentExpression(node)) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.left)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.left)) { + // obj.#x = ... var info = accessPrivateIdentifier(node.left.name); if (info) { return ts.setTextRange(ts.setOriginalNode(createPrivateIdentifierAssignment(info, node.left.expression, node.right, node.operatorToken.kind), node), node); @@ -95397,6 +96083,10 @@ var ts; ts.isSuperProperty(node.left) && currentStaticPropertyDeclarationOrStaticBlock && currentClassLexicalEnvironment) { + // super.x = ... + // super[x] = ... + // super.x += ... + // super.x -= ... var classConstructor = currentClassLexicalEnvironment.classConstructor, superClassReference = currentClassLexicalEnvironment.superClassReference, facts = currentClassLexicalEnvironment.facts; if (facts & 1 /* ClassFacts.ClassWasDecorated */) { return factory.updateBinaryExpression(node, visitInvalidSuperProperty(node.left), node.operatorToken, ts.visitNode(node.right, visitor, ts.isExpression)); @@ -95440,8 +96130,10 @@ var ts; } } } - if (node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */ && ts.isPrivateIdentifier(node.left)) { - return visitPrivateIdentifierInInExpression(node); + if (shouldTransformPrivateElementsOrClassStaticBlocks && + isPrivateIdentifierInExpression(node)) { + // #x in obj + return transformPrivateIdentifierInInExpression(node); } return ts.visitEachChild(node, visitor, context); } @@ -95466,36 +96158,6 @@ var ts; ts.Debug.assertNever(info, "Unknown private element type"); } } - /** - * Set up the environment for a class. - */ - function visitClassLike(node) { - if (!ts.forEach(node.members, doesClassElementNeedTransform)) { - return ts.visitEachChild(node, visitor, context); - } - var savedPendingExpressions = pendingExpressions; - pendingExpressions = undefined; - startClassLexicalEnvironment(); - if (shouldTransformPrivateElementsOrClassStaticBlocks) { - var name = ts.getNameOfDeclaration(node); - if (name && ts.isIdentifier(name)) { - getPrivateIdentifierEnvironment().className = ts.idText(name); - } - var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); - if (ts.some(privateInstanceMethodsAndAccessors)) { - getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); - } - } - var result = ts.isClassDeclaration(node) ? - visitClassDeclaration(node) : - visitClassExpression(node); - endClassLexicalEnvironment(); - pendingExpressions = savedPendingExpressions; - return result; - } - function doesClassElementNeedTransform(node) { - return ts.isPropertyDeclaration(node) || ts.isClassStaticBlockDeclaration(node) || (shouldTransformPrivateElementsOrClassStaticBlocks && node.name && ts.isPrivateIdentifier(node.name)); - } function getPrivateInstanceMethodsAndAccessors(node) { return ts.filter(node.members, ts.isNonStaticMethodOrAccessorWithPrivateName); } @@ -95509,7 +96171,7 @@ var ts; var member = _a[_i]; if (!ts.isStatic(member)) continue; - if (member.name && ts.isPrivateIdentifier(member.name) && shouldTransformPrivateElementsOrClassStaticBlocks) { + if (member.name && (ts.isPrivateIdentifier(member.name) || ts.isAutoAccessorPropertyDeclaration(member)) && shouldTransformPrivateElementsOrClassStaticBlocks) { facts |= 2 /* ClassFacts.NeedsClassConstructorReference */; } if (ts.isPropertyDeclaration(member) || ts.isClassStaticBlockDeclaration(member)) { @@ -95528,7 +96190,7 @@ var ts; } return facts; } - function visitExpressionWithTypeArguments(node) { + function visitExpressionWithTypeArgumentsInHeritageClause(node) { var facts = (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.facts) || 0 /* ClassFacts.None */; if (facts & 4 /* ClassFacts.NeedsClassSuperReference */) { var temp = factory.createTempVariable(hoistVariableDeclaration, /*reserveInNestedScopes*/ true); @@ -95538,7 +96200,22 @@ var ts; } return ts.visitEachChild(node, visitor, context); } - function visitClassDeclaration(node) { + function visitInNewClassLexicalEnvironment(node, visitor) { + var savedCurrentClassContainer = currentClassContainer; + var savedPendingExpressions = pendingExpressions; + currentClassContainer = node; + pendingExpressions = undefined; + startClassLexicalEnvironment(); + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + var name = ts.getNameOfDeclaration(node); + if (name && ts.isIdentifier(name)) { + getPrivateIdentifierEnvironment().className = name; + } + var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); + if (ts.some(privateInstanceMethodsAndAccessors)) { + getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); + } + } var facts = getClassFacts(node); if (facts) { getClassLexicalEnvironment().facts = facts; @@ -95546,6 +96223,16 @@ var ts; if (facts & 8 /* ClassFacts.NeedsSubstitutionForThisInClassStaticField */) { enableSubstitutionForClassStaticThisOrSuperReference(); } + var result = visitor(node, facts); + endClassLexicalEnvironment(); + currentClassContainer = savedCurrentClassContainer; + pendingExpressions = savedPendingExpressions; + return result; + } + function visitClassDeclaration(node) { + return visitInNewClassLexicalEnvironment(node, visitClassDeclarationInNewClassLexicalEnvironment); + } + function visitClassDeclarationInNewClassLexicalEnvironment(node, facts) { // If a class has private static fields, or a static field has a `this` or `super` reference, // then we need to allocate a temp variable to hold on to that reference. var pendingClassReferenceAssignment; @@ -95554,12 +96241,16 @@ var ts; getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); pendingClassReferenceAssignment = factory.createAssignment(temp, factory.getInternalName(node)); } - var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); - var statements = [ - factory.updateClassDeclaration(node, node.modifiers, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)) - ]; + var modifiers = ts.visitNodes(node.modifiers, visitor, ts.isModifierLike); + var heritageClauses = ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classDecl = factory.updateClassDeclaration(node, modifiers, node.name, + /*typeParameters*/ undefined, heritageClauses, members); + var statements = []; + if (prologue) { + statements.push(factory.createExpressionStatement(prologue)); + } + statements.push(classDecl); if (pendingClassReferenceAssignment) { getPendingExpressions().unshift(pendingClassReferenceAssignment); } @@ -95567,25 +96258,23 @@ var ts; if (ts.some(pendingExpressions)) { statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))); } - // Emit static property assignment. Because classDeclaration is lexically evaluated, - // it is safe to emit static property assignment after classDeclaration - // From ES6 specification: - // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using - // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. - var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node); - if (ts.some(staticProperties)) { - addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + if (shouldTransformInitializersUsingSet || shouldTransformPrivateElementsOrClassStaticBlocks) { + // Emit static property assignment. Because classDeclaration is lexically evaluated, + // it is safe to emit static property assignment after classDeclaration + // From ES6 specification: + // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using + // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. + var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node); + if (ts.some(staticProperties)) { + addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + } } return statements; } function visitClassExpression(node) { - var facts = getClassFacts(node); - if (facts) { - getClassLexicalEnvironment().facts = facts; - } - if (facts & 8 /* ClassFacts.NeedsSubstitutionForThisInClassStaticField */) { - enableSubstitutionForClassStaticThisOrSuperReference(); - } + return visitInNewClassLexicalEnvironment(node, visitClassExpressionInNewClassLexicalEnvironment); + } + function visitClassExpressionInNewClassLexicalEnvironment(node, facts) { // If this class expression is a transformation of a decorated class declaration, // then we want to output the pendingExpressions as statements, not as inlined // expressions with the class statement. @@ -95595,8 +96284,6 @@ var ts; // these statements after the class expression variable statement. var isDecoratedClassDeclaration = !!(facts & 1 /* ClassFacts.ClassWasDecorated */); var staticPropertiesOrClassStaticBlocks = ts.getStaticPropertiesAndClassStaticBlock(node); - var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); var isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 16777216 /* NodeCheckFlags.ClassWithConstructorReference */; var temp; function createClassTempVar() { @@ -95609,9 +96296,23 @@ var ts; temp = createClassTempVar(); getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); } - var classExpression = factory.updateClassExpression(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)); - var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(staticPropertiesOrClassStaticBlocks, function (p) { return ts.isClassStaticBlockDeclaration(p) || !!p.initializer || ts.isPrivateIdentifier(p.name); }); + var modifiers = ts.visitNodes(node.modifiers, visitor, ts.isModifierLike); + var heritageClauses = ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classExpression = factory.updateClassExpression(node, modifiers, node.name, + /*typeParameters*/ undefined, heritageClauses, members); + var expressions = []; + if (prologue) { + expressions.push(prologue); + } + // Static initializers are transformed to `static {}` blocks when `useDefineForClassFields: false` + // and not also transforming static blocks. + var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && + ts.some(staticPropertiesOrClassStaticBlocks, function (node) { + return ts.isClassStaticBlockDeclaration(node) || + ts.isPrivateIdentifierClassElementDeclaration(node) || + shouldTransformInitializers && ts.isInitializedProperty(node); + }); if (hasTransformableStatics || ts.some(pendingExpressions)) { if (isDecoratedClassDeclaration) { ts.Debug.assertIsDefined(pendingStatements, "Decorated classes transformed by TypeScript are expected to be within a variable declaration."); @@ -95623,12 +96324,16 @@ var ts; addPropertyOrClassStaticBlockStatements(pendingStatements, staticPropertiesOrClassStaticBlocks, factory.getInternalName(node)); } if (temp) { - return factory.inlineExpressions([factory.createAssignment(temp, classExpression), temp]); + expressions.push(ts.startOnNewLine(factory.createAssignment(temp, classExpression)), ts.startOnNewLine(temp)); + } + else { + expressions.push(classExpression); + if (prologue) { + ts.startOnNewLine(classExpression); + } } - return classExpression; } else { - var expressions = []; temp || (temp = createClassTempVar()); if (isClassWithConstructorReference) { // record an alias as the class name is not in scope for statics. @@ -95645,45 +96350,87 @@ var ts; ts.addRange(expressions, ts.map(pendingExpressions, ts.startOnNewLine)); ts.addRange(expressions, generateInitializedPropertyExpressionsOrClassStaticBlock(staticPropertiesOrClassStaticBlocks, temp)); expressions.push(ts.startOnNewLine(temp)); - return factory.inlineExpressions(expressions); } } - return classExpression; + else { + expressions.push(classExpression); + if (prologue) { + ts.startOnNewLine(classExpression); + } + } + return factory.inlineExpressions(expressions); } function visitClassStaticBlockDeclaration(node) { if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return ts.visitEachChild(node, classElementVisitor, context); + return ts.visitEachChild(node, visitor, context); } // ClassStaticBlockDeclaration for classes are transformed in `visitClassDeclaration` or `visitClassExpression`. return undefined; } - function transformClassMembers(node, isDerivedClass) { - var members = []; + function transformClassMembers(node) { + // Declare private names if (shouldTransformPrivateElementsOrClassStaticBlocks) { - // Declare private names. for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; if (ts.isPrivateIdentifierClassElementDeclaration(member)) { - addPrivateIdentifierToEnvironment(member); + addPrivateIdentifierToEnvironment(member, member.name, addPrivateIdentifierClassElementToEnvironment); } } if (ts.some(getPrivateInstanceMethodsAndAccessors(node))) { createBrandCheckWeakSetForPrivateMethods(); } + if (shouldTransformAutoAccessors) { + for (var _b = 0, _c = node.members; _b < _c.length; _b++) { + var member = _c[_b]; + if (ts.isAutoAccessorPropertyDeclaration(member)) { + var storageName = factory.getGeneratedPrivateNameForNode(member.name, /*prefix*/ undefined, "_accessor_storage"); + addPrivateIdentifierToEnvironment(member, storageName, addPrivateIdentifierPropertyDeclarationToEnvironment); + } + } + } } - var constructor = transformConstructor(node, isDerivedClass); - var visitedMembers = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement); - if (constructor) { - members.push(constructor); + var members = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement); + // Create a synthetic constructor if necessary + var syntheticConstructor; + if (!ts.some(members, ts.isConstructorDeclaration)) { + syntheticConstructor = transformConstructor(/*constructor*/ undefined, node); } + var prologue; + // If there are pending expressions create a class static block in which to evaluate them, but only if + // class static blocks are not also being transformed. This block will be injected at the top of the class + // to ensure that expressions from computed property names are evaluated before any other static + // initializers. + var syntheticStaticBlock; if (!shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(pendingExpressions)) { - members.push(factory.createClassStaticBlockDeclaration(factory.createBlock([ - factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)) - ]))); + var statement = factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)); + if (statement.transformFlags & 134234112 /* TransformFlags.ContainsLexicalThisOrSuper */) { + // If there are `this` or `super` references from computed property names, shift the expression + // into an arrow function to be evaluated in the outer scope so that `this` and `super` are + // properly captured. + var temp = factory.createTempVariable(hoistVariableDeclaration); + var arrow = factory.createArrowFunction( + /*modifiers*/ undefined, + /*typeParameters*/ undefined, + /*parameters*/ [], + /*type*/ undefined, + /*equalsGreaterThanToken*/ undefined, factory.createBlock([statement])); + prologue = factory.createAssignment(temp, arrow); + statement = factory.createExpressionStatement(factory.createCallExpression(temp, /*typeArguments*/ undefined, [])); + } + var block = factory.createBlock([statement]); + syntheticStaticBlock = factory.createClassStaticBlockDeclaration(block); pendingExpressions = undefined; } - ts.addRange(members, visitedMembers); - return ts.setTextRange(factory.createNodeArray(members), /*location*/ node.members); + // If we created a synthetic constructor or class static block, add them to the visited members + // and return a new array. + if (syntheticConstructor || syntheticStaticBlock) { + var membersArray = void 0; + membersArray = ts.append(membersArray, syntheticConstructor); + membersArray = ts.append(membersArray, syntheticStaticBlock); + membersArray = ts.addRange(membersArray, members); + members = ts.setTextRange(factory.createNodeArray(membersArray), /*location*/ node.members); + } + return { members: members, prologue: prologue }; } function createBrandCheckWeakSetForPrivateMethods() { var weakSetName = getPrivateIdentifierEnvironment().weakSetName; @@ -95692,35 +96439,38 @@ var ts; /*typeArguments*/ undefined, []))); } function isClassElementThatRequiresConstructorStatement(member) { - if (ts.isStatic(member) || ts.hasSyntacticModifier(ts.getOriginalNode(member), 128 /* ModifierFlags.Abstract */)) { + if (ts.isStatic(member) || ts.hasAbstractModifier(ts.getOriginalNode(member))) { return false; } - if (useDefineForClassFields) { - // If we are using define semantics and targeting ESNext or higher, - // then we don't need to transform any class properties. - return languageVersion < 9 /* ScriptTarget.ES2022 */; - } - return ts.isInitializedProperty(member) || shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member); + return shouldTransformInitializersUsingDefine && ts.isPropertyDeclaration(member) || + shouldTransformInitializersUsingSet && ts.isInitializedProperty(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && shouldTransformAutoAccessors && ts.isAutoAccessorPropertyDeclaration(member); } - function transformConstructor(node, isDerivedClass) { - var constructor = ts.visitNode(ts.getFirstConstructorWithBody(node), visitor, ts.isConstructorDeclaration); - var elements = node.members.filter(isClassElementThatRequiresConstructorStatement); - if (!ts.some(elements)) { + function transformConstructor(constructor, container) { + constructor = ts.visitNode(constructor, visitor, ts.isConstructorDeclaration); + if (!ts.some(container.members, isClassElementThatRequiresConstructorStatement)) { return constructor; } + var extendsClauseElement = ts.getEffectiveBaseTypeNode(container); + var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); var parameters = ts.visitParameterList(constructor ? constructor.parameters : undefined, visitor, context); - var body = transformConstructorBody(node, constructor, isDerivedClass); + var body = transformConstructorBody(container, constructor, isDerivedClass); if (!body) { - return undefined; + return constructor; + } + if (constructor) { + ts.Debug.assert(parameters); + return factory.updateConstructorDeclaration(constructor, /*modifiers*/ undefined, parameters, body); } return ts.startOnNewLine(ts.setOriginalNode(ts.setTextRange(factory.createConstructorDeclaration( - /*modifiers*/ undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || node), constructor)); + /*modifiers*/ undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || container), constructor)); } function transformConstructorBody(node, constructor, isDerivedClass) { - var _a; + var _a, _b; var properties = ts.getProperties(node, /*requireInitializer*/ false, /*isStatic*/ false); if (!useDefineForClassFields) { - properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name); }); + properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name) || ts.hasAccessorModifier(property); }); } var privateMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); var needsConstructorBody = ts.some(properties) || ts.some(privateMethodsAndAccessors); @@ -95772,8 +96522,8 @@ var ts; statements = statements.filter(function (statement) { return !ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor); }); } else { - for (var _i = 0, _b = constructor.body.statements; _i < _b.length; _i++) { - var statement = _b[_i]; + for (var _i = 0, _c = constructor.body.statements; _i < _c.length; _i++) { + var statement = _c[_i]; if (ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) { parameterPropertyDeclarationCount++; } @@ -95805,9 +96555,14 @@ var ts; ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue)); } statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); + if (statements.length === 0 && !constructor) { + return undefined; + } + var multiLine = (constructor === null || constructor === void 0 ? void 0 : constructor.body) && constructor.body.statements.length >= statements.length ? + (_b = constructor.body.multiLine) !== null && _b !== void 0 ? _b : statements.length > 0 : + statements.length > 0; return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), - /*location*/ constructor ? constructor.body.statements : node.members), - /*multiLine*/ true), + /*location*/ constructor ? constructor.body.statements : node.members), multiLine), /*location*/ constructor ? constructor.body : undefined); function visitBodyStatement(statement) { if (useDefineForClassFields && ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) { @@ -95843,9 +96598,10 @@ var ts; return undefined; } var statement = factory.createExpressionStatement(expression); + ts.setOriginalNode(statement, property); + ts.addEmitFlags(statement, ts.getEmitFlags(property) & 1536 /* EmitFlags.NoComments */); ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)); ts.setCommentRange(statement, property); - ts.setOriginalNode(statement, property); // `setOriginalNode` *copies* the `emitNode` from `property`, so now both // `statement` and `expression` have a copy of the synthesized comments. // Drop the comments from expression to avoid printing them twice. @@ -95868,9 +96624,10 @@ var ts; continue; } ts.startOnNewLine(expression); + ts.setOriginalNode(expression, property); + ts.addEmitFlags(expression, ts.getEmitFlags(property) & 1536 /* EmitFlags.NoComments */); ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)); ts.setCommentRange(expression, property); - ts.setOriginalNode(expression, property); expressions.push(expression); } return expressions; @@ -95897,9 +96654,11 @@ var ts; var _a; // We generate a name here in order to reuse the value cached by the relocated computed name expression (which uses the same generated name) var emitAssignment = !useDefineForClassFields; - var propertyName = ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression) - ? factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) - : property.name; + var propertyName = ts.hasAccessorModifier(property) ? + factory.getGeneratedPrivateNameForNode(property.name) : + ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression) ? + factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) : + property.name; if (ts.hasStaticModifier(property)) { currentStaticPropertyDeclarationOrStaticBlock = property; } @@ -95926,7 +96685,7 @@ var ts; return undefined; } var propertyOriginalNode = ts.getOriginalNode(property); - if (ts.hasSyntacticModifier(propertyOriginalNode, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(propertyOriginalNode, 256 /* ModifierFlags.Abstract */)) { return undefined; } var initializer = property.initializer || emitAssignment ? (_a = ts.visitNode(property.initializer, visitor, ts.isExpression)) !== null && _a !== void 0 ? _a : factory.createVoidZero() @@ -95960,17 +96719,17 @@ var ts; // substitute `this` in a static field initializer context.enableSubstitution(108 /* SyntaxKind.ThisKeyword */); // these push a new lexical environment that is not the class lexical environment - context.enableEmitNotification(256 /* SyntaxKind.FunctionDeclaration */); - context.enableEmitNotification(213 /* SyntaxKind.FunctionExpression */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(259 /* SyntaxKind.FunctionDeclaration */); + context.enableEmitNotification(215 /* SyntaxKind.FunctionExpression */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // these push a new lexical environment that is not the class lexical environment, except // when they have a computed property name - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(167 /* SyntaxKind.PropertyDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(169 /* SyntaxKind.PropertyDeclaration */); // class lexical environments are restored when entering a computed property name - context.enableEmitNotification(162 /* SyntaxKind.ComputedPropertyName */); + context.enableEmitNotification(164 /* SyntaxKind.ComputedPropertyName */); } } /** @@ -96009,13 +96768,13 @@ var ts; } } switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (ts.isArrowFunction(original) || ts.getEmitFlags(node) & 262144 /* EmitFlags.AsyncFunctionBody */) { break; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 171 /* SyntaxKind.Constructor */: { + case 259 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentClassLexicalEnvironment = undefined; @@ -96025,10 +96784,10 @@ var ts; currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; return; } - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentComputedPropertyNameClassLexicalEnvironment = currentClassLexicalEnvironment; @@ -96038,7 +96797,7 @@ var ts; currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; return; } - case 162 /* SyntaxKind.ComputedPropertyName */: { + case 164 /* SyntaxKind.ComputedPropertyName */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; @@ -96152,149 +96911,138 @@ var ts; function getPrivateIdentifierEnvironment() { var lex = getClassLexicalEnvironment(); lex.privateIdentifierEnvironment || (lex.privateIdentifierEnvironment = { - className: "", - identifiers: new ts.Map() + className: undefined, + weakSetName: undefined, + identifiers: undefined, + generatedIdentifiers: undefined, }); return lex.privateIdentifierEnvironment; } function getPendingExpressions() { - return pendingExpressions || (pendingExpressions = []); + return pendingExpressions !== null && pendingExpressions !== void 0 ? pendingExpressions : (pendingExpressions = []); } - function addPrivateIdentifierToEnvironment(node) { - var _a; - var text = ts.getTextOfPropertyName(node.name); - var lex = getClassLexicalEnvironment(); - var classConstructor = lex.classConstructor; - var privateEnv = getPrivateIdentifierEnvironment(); - var weakSetName = privateEnv.weakSetName; - var assignmentExpressions = []; - var privateName = node.name.escapedText; - var previousInfo = privateEnv.identifiers.get(privateName); - var isValid = !isReservedPrivateName(node.name) && previousInfo === undefined; - if (ts.hasStaticModifier(node)) { - ts.Debug.assert(classConstructor, "weakSetName should be set in private identifier environment"); - if (ts.isPropertyDeclaration(node)) { - var variableName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "f" /* PrivateIdentifierKind.Field */, - variableName: variableName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - else if (ts.isMethodDeclaration(node)) { - var functionName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "m" /* PrivateIdentifierKind.Method */, - methodName: functionName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - else if (ts.isGetAccessorDeclaration(node)) { - var getterName = createHoistedVariableForPrivateName(text + "_get", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: getterName, - setterName: undefined, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - } - else if (ts.isSetAccessorDeclaration(node)) { - var setterName = createHoistedVariableForPrivateName(text + "_set", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: undefined, - setterName: setterName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - } - else { - ts.Debug.assertNever(node, "Unknown class element type."); - } + function addPrivateIdentifierClassElementToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + if (ts.isAutoAccessorPropertyDeclaration(node)) { + addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); } else if (ts.isPropertyDeclaration(node)) { - var weakMapName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "f" /* PrivateIdentifierKind.Field */, - brandCheckIdentifier: weakMapName, - isStatic: false, - variableName: undefined, - isValid: isValid, - }); - assignmentExpressions.push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), - /*typeArguments*/ undefined, []))); + addPrivateIdentifierPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); } else if (ts.isMethodDeclaration(node)) { - ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); - privateEnv.identifiers.set(privateName, { - kind: "m" /* PrivateIdentifierKind.Method */, - methodName: createHoistedVariableForPrivateName(text, node), - brandCheckIdentifier: weakSetName, - isStatic: false, + addPrivateIdentifierMethodDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isGetAccessorDeclaration(node)) { + addPrivateIdentifierGetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isSetAccessorDeclaration(node)) { + addPrivateIdentifierSetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + } + function addPrivateIdentifierPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + if (isStatic) { + ts.Debug.assert(lex.classConstructor, "classConstructor should be set in private identifier environment"); + var variableName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { + kind: "f" /* PrivateIdentifierKind.Field */, + brandCheckIdentifier: lex.classConstructor, + variableName: variableName, + isStatic: true, isValid: isValid, }); } - else if (ts.isAccessor(node)) { - ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); - if (ts.isGetAccessor(node)) { - var getterName = createHoistedVariableForPrivateName(text + "_get", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && !previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: getterName, - setterName: undefined, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid: isValid, - }); - } - } - else { - var setterName = createHoistedVariableForPrivateName(text + "_set", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && !previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: undefined, - setterName: setterName, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid: isValid, - }); - } - } + else { + var weakMapName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { + kind: "f" /* PrivateIdentifierKind.Field */, + brandCheckIdentifier: weakMapName, + variableName: undefined, + isStatic: false, + isValid: isValid, + }); + getPendingExpressions().push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), + /*typeArguments*/ undefined, []))); + } + } + function addPrivateIdentifierMethodDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var methodName = createHoistedVariableForPrivateName(name); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "m" /* PrivateIdentifierKind.Method */, + methodName: methodName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + function addPrivateIdentifierGetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic === isStatic && !previousInfo.getterName) { + previousInfo.getterName = getterName; } else { - ts.Debug.assertNever(node, "Unknown class element type."); + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: getterName, + setterName: undefined, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); } - (_a = getPendingExpressions()).push.apply(_a, assignmentExpressions); } - function createHoistedVariableForClass(name, node) { + function addPrivateIdentifierSetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic === isStatic && !previousInfo.setterName) { + previousInfo.setterName = setterName; + } + else { + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: undefined, + setterName: setterName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + } + function addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: getterName, + setterName: setterName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + function addPrivateIdentifierToEnvironment(node, name, addDeclaration) { + var lex = getClassLexicalEnvironment(); + var privateEnv = getPrivateIdentifierEnvironment(); + var previousInfo = getPrivateIdentifier(privateEnv, name); + var isStatic = ts.hasStaticModifier(node); + var isValid = !isReservedPrivateName(name) && previousInfo === undefined; + addDeclaration(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + function createHoistedVariableForClass(name, node, suffix) { var className = getPrivateIdentifierEnvironment().className; - var prefix = className ? "_".concat(className) : ""; - var identifier = factory.createUniqueName("".concat(prefix, "_").concat(name), 16 /* GeneratedIdentifierFlags.Optimistic */); + var prefix = className ? { prefix: "_", node: className, suffix: "_" } : "_"; + var identifier = typeof name === "object" ? factory.getGeneratedNameForNode(name, 16 /* GeneratedIdentifierFlags.Optimistic */ | 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */, prefix, suffix) : + typeof name === "string" ? factory.createUniqueName(name, 16 /* GeneratedIdentifierFlags.Optimistic */, prefix, suffix) : + factory.createTempVariable(/*recordTempVariable*/ undefined, /*reserveInNestedScopes*/ true, prefix, suffix); if (resolver.getNodeCheckFlags(node) & 524288 /* NodeCheckFlags.BlockScopedBindingInLoop */) { addBlockScopedVariable(identifier); } @@ -96303,13 +97051,33 @@ var ts; } return identifier; } - function createHoistedVariableForPrivateName(privateName, node) { - return createHoistedVariableForClass(privateName.substring(1), node.name); - } - function accessPrivateIdentifier(name) { + function createHoistedVariableForPrivateName(name, suffix) { var _a; + var text = ts.tryGetTextOfPropertyName(name); + return createHoistedVariableForClass((_a = text === null || text === void 0 ? void 0 : text.substring(1)) !== null && _a !== void 0 ? _a : name, name, suffix); + } + /** + * Access an already defined {@link PrivateIdentifier} in the current {@link PrivateIdentifierEnvironment}. + * + * @seealso {@link addPrivateIdentifierToEnvironment} + */ + function accessPrivateIdentifier(name) { + if (ts.isGeneratedPrivateIdentifier(name)) { + return accessGeneratedPrivateIdentifier(name); + } + else { + return accessPrivateIdentifierByText(name.escapedText); + } + } + function accessPrivateIdentifierByText(text) { + return accessPrivateIdentifierWorker(getPrivateIdentifierInfo, text); + } + function accessGeneratedPrivateIdentifier(name) { + return accessPrivateIdentifierWorker(getGeneratedPrivateIdentifierInfo, ts.getNodeForGeneratedName(name)); + } + function accessPrivateIdentifierWorker(getPrivateIdentifierInfo, privateIdentifierKey) { if (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.privateIdentifierEnvironment) { - var info = currentClassLexicalEnvironment.privateIdentifierEnvironment.identifiers.get(name.escapedText); + var info = getPrivateIdentifierInfo(currentClassLexicalEnvironment.privateIdentifierEnvironment, privateIdentifierKey); if (info) { return info; } @@ -96319,9 +97087,11 @@ var ts; if (!env) { continue; } - var info = (_a = env.privateIdentifierEnvironment) === null || _a === void 0 ? void 0 : _a.identifiers.get(name.escapedText); - if (info) { - return info; + if (env.privateIdentifierEnvironment) { + var info = getPrivateIdentifierInfo(env.privateIdentifierEnvironment, privateIdentifierKey); + if (info) { + return info; + } } } return undefined; @@ -96378,7 +97148,7 @@ var ts; } } } - return ts.visitNode(node, visitorDestructuringTarget); + return ts.visitNode(node, assignmentTargetVisitor); } function visitObjectAssignmentTarget(node) { if (ts.isObjectBindingOrAssignmentElement(node) && !ts.isShorthandPropertyAssignment(node)) { @@ -96411,10 +97181,10 @@ var ts; var initializer = ts.getInitializerOfBindingOrAssignmentElement(node); return factory.updatePropertyAssignment(node, ts.visitNode(node.name, visitor, ts.isPropertyName), wrapped ? initializer ? factory.createAssignment(wrapped, ts.visitNode(initializer, visitor)) : wrapped : - ts.visitNode(node.initializer, visitorDestructuringTarget, ts.isExpression)); + ts.visitNode(node.initializer, assignmentTargetVisitor, ts.isExpression)); } if (ts.isSpreadAssignment(node)) { - return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, visitorDestructuringTarget, ts.isExpression)); + return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, assignmentTargetVisitor, ts.isExpression)); } ts.Debug.assert(wrapped === undefined, "Should not have generated a wrapped target"); } @@ -96460,7 +97230,31 @@ var ts; /*typeArguments*/ undefined, [receiver]); } function isReservedPrivateName(node) { - return node.escapedText === "#constructor"; + return !ts.isGeneratedPrivateIdentifier(node) && node.escapedText === "#constructor"; + } + function getPrivateIdentifier(privateEnv, name) { + return ts.isGeneratedPrivateIdentifier(name) ? + getGeneratedPrivateIdentifierInfo(privateEnv, ts.getNodeForGeneratedName(name)) : + getPrivateIdentifierInfo(privateEnv, name.escapedText); + } + function setPrivateIdentifier(privateEnv, name, info) { + var _a, _b; + if (ts.isGeneratedPrivateIdentifier(name)) { + (_a = privateEnv.generatedIdentifiers) !== null && _a !== void 0 ? _a : (privateEnv.generatedIdentifiers = new ts.Map()); + privateEnv.generatedIdentifiers.set(ts.getNodeForGeneratedName(name), info); + } + else { + (_b = privateEnv.identifiers) !== null && _b !== void 0 ? _b : (privateEnv.identifiers = new ts.Map()); + privateEnv.identifiers.set(name.escapedText, info); + } + } + function getPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.identifiers) === null || _a === void 0 ? void 0 : _a.get(key); + } + function getGeneratedPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.generatedIdentifiers) === null || _a === void 0 ? void 0 : _a.get(key); } })(ts || (ts = {})); /*@internal*/ @@ -96501,15 +97295,15 @@ var ts; */ function serializeTypeOfNode(node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: return serializeTypeNode(node.type); - case 173 /* SyntaxKind.SetAccessor */: - case 172 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return serializeTypeNode(getAccessorTypeNode(node)); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: return ts.factory.createIdentifier("Function"); default: return ts.factory.createVoidZero(); @@ -96545,7 +97339,7 @@ var ts; return ts.factory.createArrayLiteralExpression(expressions); } function getParametersOfDecoratedDeclaration(node, container) { - if (container && node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (container && node.kind === 174 /* SyntaxKind.GetAccessor */) { var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; if (setAccessor) { return setAccessor.parameters; @@ -96591,66 +97385,66 @@ var ts; node = ts.skipTypeParentheses(node); switch (node.kind) { case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return ts.factory.createVoidZero(); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return ts.factory.createIdentifier("Function"); - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return ts.factory.createIdentifier("Array"); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return node.assertsModifier ? ts.factory.createVoidZero() : ts.factory.createIdentifier("Boolean"); - case 133 /* SyntaxKind.BooleanKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: return ts.factory.createIdentifier("Boolean"); - case 198 /* SyntaxKind.TemplateLiteralType */: - case 150 /* SyntaxKind.StringKeyword */: + case 200 /* SyntaxKind.TemplateLiteralType */: + case 152 /* SyntaxKind.StringKeyword */: return ts.factory.createIdentifier("String"); - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return ts.factory.createIdentifier("Object"); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return serializeLiteralOfLiteralTypeNode(node.literal); - case 147 /* SyntaxKind.NumberKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: return ts.factory.createIdentifier("Number"); - case 158 /* SyntaxKind.BigIntKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: return getGlobalConstructor("BigInt", 7 /* ScriptTarget.ES2020 */); - case 151 /* SyntaxKind.SymbolKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: return getGlobalConstructor("Symbol", 2 /* ScriptTarget.ES2015 */); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return serializeTypeReferenceNode(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return serializeUnionOrIntersectionConstituents(node.types, /*isIntersection*/ true); - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return serializeUnionOrIntersectionConstituents(node.types, /*isIntersection*/ false); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return serializeUnionOrIntersectionConstituents([node.trueType, node.falseType], /*isIntersection*/ false); - case 193 /* SyntaxKind.TypeOperator */: - if (node.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { + case 195 /* SyntaxKind.TypeOperator */: + if (node.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { return serializeTypeNode(node.type); } break; - case 181 /* SyntaxKind.TypeQuery */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 195 /* SyntaxKind.MappedType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 192 /* SyntaxKind.ThisType */: - case 200 /* SyntaxKind.ImportType */: + case 183 /* SyntaxKind.TypeQuery */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 197 /* SyntaxKind.MappedType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 194 /* SyntaxKind.ThisType */: + case 202 /* SyntaxKind.ImportType */: break; // handle JSDoc types from an invalid parse - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 318 /* SyntaxKind.JSDocVariadicType */: - case 319 /* SyntaxKind.JSDocNamepathType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 321 /* SyntaxKind.JSDocVariadicType */: + case 322 /* SyntaxKind.JSDocNamepathType */: break; - case 314 /* SyntaxKind.JSDocNullableType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 316 /* SyntaxKind.JSDocOptionalType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return serializeTypeNode(node.type); default: return ts.Debug.failBadSyntaxKind(node); @@ -96662,7 +97456,7 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return ts.factory.createIdentifier("String"); - case 219 /* SyntaxKind.PrefixUnaryExpression */: { + case 221 /* SyntaxKind.PrefixUnaryExpression */: { var operand = node.operand; switch (operand.kind) { case 8 /* SyntaxKind.NumericLiteral */: @@ -96691,20 +97485,20 @@ var ts; for (var _i = 0, types_22 = types; _i < types_22.length; _i++) { var typeNode = types_22[_i]; typeNode = ts.skipTypeParentheses(typeNode); - if (typeNode.kind === 143 /* SyntaxKind.NeverKeyword */) { + if (typeNode.kind === 144 /* SyntaxKind.NeverKeyword */) { if (isIntersection) return ts.factory.createVoidZero(); // Reduce to `never` in an intersection continue; // Elide `never` in a union } - if (typeNode.kind === 155 /* SyntaxKind.UnknownKeyword */) { + if (typeNode.kind === 157 /* SyntaxKind.UnknownKeyword */) { if (!isIntersection) return ts.factory.createIdentifier("Object"); // Reduce to `unknown` in a union continue; // Elide `unknown` in an intersection } - if (typeNode.kind === 130 /* SyntaxKind.AnyKeyword */) { + if (typeNode.kind === 131 /* SyntaxKind.AnyKeyword */) { return ts.factory.createIdentifier("Object"); // Reduce to `any` in a union or intersection } - if (!strictNullChecks && ((ts.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */) || typeNode.kind === 153 /* SyntaxKind.UndefinedKeyword */)) { + if (!strictNullChecks && ((ts.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */) || typeNode.kind === 155 /* SyntaxKind.UndefinedKeyword */)) { continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks } var serializedConstituent = serializeTypeNode(typeNode); @@ -96852,7 +97646,7 @@ var ts; name.original = undefined; ts.setParent(name, ts.getParseTreeNode(currentLexicalScope)); // ensure the parent is set to a parse tree node. return name; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return serializeQualifiedNameAsExpression(node); } } @@ -96907,24 +97701,24 @@ var ts; return node; } switch (node.kind) { - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are elided. They will be emitted as part of `visitClassDeclaration`. return undefined; - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return visitClassExpression(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return visitConstructorDeclaration(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return visitMethodDeclaration(node); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitSetAccessorDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return visitGetAccessorDeclaration(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return visitPropertyDeclaration(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameterDeclaration(node); default: return ts.visitEachChild(node, visitor, context); @@ -97280,7 +98074,7 @@ var ts; var prefix = getClassMemberPrefix(node, member); var memberName = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ !ts.hasSyntacticModifier(member, 2 /* ModifierFlags.Ambient */)); var descriptor = languageVersion > 0 /* ScriptTarget.ES3 */ - ? member.kind === 167 /* SyntaxKind.PropertyDeclaration */ + ? ts.isPropertyDeclaration(member) && !ts.hasAccessorModifier(member) // We emit `void 0` here to indicate to `__decorate` that it can invoke `Object.defineProperty` directly, but that it // should not invoke `Object.getOwnPropertyDescriptor`. ? factory.createVoidZero() @@ -97543,34 +98337,34 @@ var ts; return node; } switch (node.kind) { - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // ES2017 async modifier should be elided for targets < ES2017 return undefined; - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return visitAwaitExpression(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitMethodDeclaration, node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitFunctionDeclaration, node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitFunctionExpression, node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return doWithContext(1 /* ContextFlags.NonTopLevel */, visitArrowFunction, node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { capturedSuperProperties.add(node.name.escapedText); } return ts.visitEachChild(node, visitor, context); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (capturedSuperProperties && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitDefault, node); default: return ts.visitEachChild(node, visitor, context); @@ -97579,27 +98373,27 @@ var ts; function asyncBodyVisitor(node) { if (ts.isNodeWithPossibleHoistedDeclaration(node)) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatementInAsyncBody(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatementInAsyncBody(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatementInAsyncBody(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatementInAsyncBody(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClauseInAsyncBody(node); - case 235 /* SyntaxKind.Block */: - case 249 /* SyntaxKind.SwitchStatement */: - case 263 /* SyntaxKind.CaseBlock */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 252 /* SyntaxKind.TryStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 250 /* SyntaxKind.LabeledStatement */: + case 238 /* SyntaxKind.Block */: + case 252 /* SyntaxKind.SwitchStatement */: + case 266 /* SyntaxKind.CaseBlock */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 255 /* SyntaxKind.TryStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return ts.visitEachChild(node, asyncBodyVisitor, context); default: return ts.Debug.assertNever(node, "Unhandled node."); @@ -97802,7 +98596,7 @@ var ts; var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 /* ScriptTarget.ES2015 */ ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 214 /* SyntaxKind.ArrowFunction */; + var isArrowFunction = node.kind === 216 /* SyntaxKind.ArrowFunction */; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* NodeCheckFlags.CaptureArguments */) !== 0; // An async function is emit as an outer function that calls an inner // generator function. To preserve lexical bindings, we pass the current @@ -97893,17 +98687,17 @@ var ts; enabledSubstitutions |= 1 /* ES2017SubstitutionFlags.AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(257 /* SyntaxKind.ClassDeclaration */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(260 /* SyntaxKind.ClassDeclaration */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // We need to be notified when entering the generated accessor arrow functions. - context.enableEmitNotification(237 /* SyntaxKind.VariableStatement */); + context.enableEmitNotification(240 /* SyntaxKind.VariableStatement */); } } /** @@ -97951,11 +98745,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); } return node; @@ -97987,11 +98781,11 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { @@ -98148,7 +98942,7 @@ var ts; return visitorWorker(node, /*expressionResultIsUnused*/ true); } function visitorNoAsyncModifier(node) { - if (node.kind === 131 /* SyntaxKind.AsyncKeyword */) { + if (node.kind === 132 /* SyntaxKind.AsyncKeyword */) { return undefined; } return node; @@ -98174,70 +98968,70 @@ var ts; return node; } switch (node.kind) { - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return visitAwaitExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node, expressionResultIsUnused); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node, expressionResultIsUnused); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 246 /* SyntaxKind.ForInStatement */: return doWithHierarchyFacts(visitDefault, node, 0 /* HierarchyFacts.IterationStatementExcludes */, 2 /* HierarchyFacts.IterationStatementIncludes */); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return doWithHierarchyFacts(visitForStatement, node, 0 /* HierarchyFacts.IterationStatementExcludes */, 2 /* HierarchyFacts.IterationStatementIncludes */); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return visitVoidExpression(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return doWithHierarchyFacts(visitConstructorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return doWithHierarchyFacts(visitMethodDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return doWithHierarchyFacts(visitGetAccessorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return doWithHierarchyFacts(visitSetAccessorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return doWithHierarchyFacts(visitFunctionDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return doWithHierarchyFacts(visitFunctionExpression, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return doWithHierarchyFacts(visitArrowFunction, node, 2 /* HierarchyFacts.ArrowFunctionExcludes */, 0 /* HierarchyFacts.ArrowFunctionIncludes */); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameter(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, expressionResultIsUnused); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { capturedSuperProperties.add(node.name.escapedText); } return ts.visitEachChild(node, visitor, context); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (capturedSuperProperties && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return doWithHierarchyFacts(visitDefault, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); default: return ts.visitEachChild(node, visitor, context); @@ -98273,7 +99067,7 @@ var ts; function visitLabeledStatement(node) { if (enclosingFunctionFlags & 2 /* FunctionFlags.Async */) { var statement = ts.unwrapInnermostStatementOfLabel(node); - if (statement.kind === 244 /* SyntaxKind.ForOfStatement */ && statement.awaitModifier) { + if (statement.kind === 247 /* SyntaxKind.ForOfStatement */ && statement.awaitModifier) { return visitForOfStatement(statement, node); } return factory.restoreEnclosingLabel(ts.visitNode(statement, visitor, ts.isStatement, factory.liftToBlock), node); @@ -98285,7 +99079,7 @@ var ts; var objects = []; for (var _i = 0, elements_5 = elements; _i < elements_5.length; _i++) { var e = elements_5[_i]; - if (e.kind === 298 /* SyntaxKind.SpreadAssignment */) { + if (e.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (chunkObject) { objects.push(factory.createObjectLiteralExpression(chunkObject)); chunkObject = undefined; @@ -98294,7 +99088,7 @@ var ts; objects.push(ts.visitNode(target, visitor, ts.isExpression)); } else { - chunkObject = ts.append(chunkObject, e.kind === 296 /* SyntaxKind.PropertyAssignment */ + chunkObject = ts.append(chunkObject, e.kind === 299 /* SyntaxKind.PropertyAssignment */ ? factory.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression)) : ts.visitNode(e, visitor, ts.isObjectLiteralElementLike)); } @@ -98328,7 +99122,7 @@ var ts; // If we translate the above to `__assign({}, k, l)`, the `l` will evaluate before `k` is spread and we // end up with `{ a: 1, b: 2, c: 3 }` var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (objects.length && objects[0].kind !== 207 /* SyntaxKind.ObjectLiteralExpression */) { objects.unshift(factory.createObjectLiteralExpression()); } var expression = objects[0]; @@ -98836,17 +99630,17 @@ var ts; enabledSubstitutions |= 1 /* ESNextSubstitutionFlags.AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(257 /* SyntaxKind.ClassDeclaration */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(260 /* SyntaxKind.ClassDeclaration */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // We need to be notified when entering the generated accessor arrow functions. - context.enableEmitNotification(237 /* SyntaxKind.VariableStatement */); + context.enableEmitNotification(240 /* SyntaxKind.VariableStatement */); } } /** @@ -98894,11 +99688,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); } return node; @@ -98930,11 +99724,11 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { @@ -98966,7 +99760,7 @@ var ts; return node; } switch (node.kind) { - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); default: return ts.visitEachChild(node, visitor, context); @@ -98998,25 +99792,25 @@ var ts; return node; } switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: { + case 210 /* SyntaxKind.CallExpression */: { var updated = visitNonOptionalCallExpression(node, /*captureThisArg*/ false); ts.Debug.assertNotNode(updated, ts.isSyntheticReference); return updated; } - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (ts.isOptionalChain(node)) { var updated = visitOptionalExpression(node, /*captureThisArg*/ false, /*isDelete*/ false); ts.Debug.assertNotNode(updated, ts.isSyntheticReference); return updated; } return ts.visitEachChild(node, visitor, context); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */) { return transformNullishCoalescingExpression(node); } return ts.visitEachChild(node, visitor, context); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return visitDeleteExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -99058,7 +99852,7 @@ var ts; thisArg = expression; } } - expression = node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ + expression = node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? factory.updatePropertyAccessExpression(node, expression, ts.visitNode(node.name, visitor, ts.isIdentifier)) : factory.updateElementAccessExpression(node, expression, ts.visitNode(node.argumentExpression, visitor, ts.isExpression)); return thisArg ? factory.createSyntheticReferenceExpression(expression, thisArg) : expression; @@ -99081,10 +99875,10 @@ var ts; } function visitNonOptionalExpression(node, captureThisArg, isDelete) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); - case 208 /* SyntaxKind.CallExpression */: return visitNonOptionalCallExpression(node, captureThisArg); + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); + case 210 /* SyntaxKind.CallExpression */: return visitNonOptionalCallExpression(node, captureThisArg); default: return ts.visitNode(node, visitor, ts.isExpression); } } @@ -99103,8 +99897,8 @@ var ts; for (var i = 0; i < chain.length; i++) { var segment = chain[i]; switch (segment.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (i === chain.length - 1 && captureThisArg) { if (!ts.isSimpleCopiableExpression(rightExpression)) { thisArg = factory.createTempVariable(hoistVariableDeclaration); @@ -99114,11 +99908,11 @@ var ts; thisArg = rightExpression; } } - rightExpression = segment.kind === 206 /* SyntaxKind.PropertyAccessExpression */ + rightExpression = segment.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? factory.createPropertyAccessExpression(rightExpression, ts.visitNode(segment.name, visitor, ts.isIdentifier)) : factory.createElementAccessExpression(rightExpression, ts.visitNode(segment.argumentExpression, visitor, ts.isExpression)); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (i === 0 && leftThisArg) { if (!ts.isGeneratedIdentifier(leftThisArg)) { leftThisArg = factory.cloneNode(leftThisArg); @@ -99179,7 +99973,7 @@ var ts; return node; } switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var binaryExpression = node; if (ts.isLogicalOrCoalescingAssignmentExpression(binaryExpression)) { return transformLogicalAssignment(binaryExpression); @@ -99348,13 +100142,13 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return visitJsxElement(node, /*isChild*/ false); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ false); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return visitJsxFragment(node, /*isChild*/ false); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -99364,13 +100158,13 @@ var ts; switch (node.kind) { case 11 /* SyntaxKind.JsxText */: return visitJsxText(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return visitJsxExpression(node); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return visitJsxElement(node, /*isChild*/ true); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ true); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return visitJsxFragment(node, /*isChild*/ true); default: return ts.Debug.failBadSyntaxKind(node); @@ -99551,7 +100345,7 @@ var ts; var literal = factory.createStringLiteral(tryDecodeEntities(node.text) || node.text, singleQuote); return ts.setTextRange(literal, node); } - if (node.kind === 288 /* SyntaxKind.JsxExpression */) { + if (node.kind === 291 /* SyntaxKind.JsxExpression */) { if (node.expression === undefined) { return factory.createTrue(); } @@ -99652,7 +100446,7 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 278 /* SyntaxKind.JsxElement */) { + if (node.kind === 281 /* SyntaxKind.JsxElement */) { return getTagName(node.openingElement); } else { @@ -99959,7 +100753,7 @@ var ts; return node; } switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -100184,7 +100978,7 @@ var ts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { return (hierarchyFacts & 8192 /* HierarchyFacts.ConstructorWithCapturedSuper */) !== 0 - && node.kind === 247 /* SyntaxKind.ReturnStatement */ + && node.kind === 250 /* SyntaxKind.ReturnStatement */ && !node.expression; } function isOrMayContainReturnCompletion(node) { @@ -100238,65 +101032,65 @@ var ts; switch (node.kind) { case 124 /* SyntaxKind.StaticKeyword */: return undefined; // elide static keyword - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return visitClassExpression(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameter(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return visitArrowFunction(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); case 79 /* SyntaxKind.Identifier */: return visitIdentifier(node); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return visitVariableDeclarationList(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return visitCaseBlock(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return visitBlock(node, /*isFunctionBody*/ false); - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return visitBreakOrContinueStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*outermostLabeledStatement*/ undefined); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node, /*outermostLabeledStatement*/ undefined); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return visitShorthandPropertyAssignment(node); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return visitComputedPropertyName(node); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, expressionResultIsUnused); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node, expressionResultIsUnused); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node, expressionResultIsUnused); case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 15 /* SyntaxKind.TemplateHead */: @@ -100307,30 +101101,30 @@ var ts; return visitStringLiteral(node); case 8 /* SyntaxKind.NumericLiteral */: return visitNumericLiteral(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return visitTemplateExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return visitSpreadElement(node); case 106 /* SyntaxKind.SuperKeyword */: return visitSuperKeyword(/*isExpressionOfCall*/ false); case 108 /* SyntaxKind.ThisKeyword */: return visitThisKeyword(node); - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return visitMetaProperty(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return visitMethodDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitAccessorDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return visitVoidExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -100420,14 +101214,14 @@ var ts; // it is possible if either // - break/continue is labeled and label is located inside the converted loop // - break/continue is non-labeled and located in non-converted loop/switch statement - var jump = node.kind === 246 /* SyntaxKind.BreakStatement */ ? 2 /* Jump.Break */ : 4 /* Jump.Continue */; + var jump = node.kind === 249 /* SyntaxKind.BreakStatement */ ? 2 /* Jump.Break */ : 4 /* Jump.Continue */; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(ts.idText(node.label))) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; var label = node.label; if (!label) { - if (node.kind === 246 /* SyntaxKind.BreakStatement */) { + if (node.kind === 249 /* SyntaxKind.BreakStatement */) { convertedLoopState.nonLocalJumps |= 2 /* Jump.Break */; labelMarker = "break"; } @@ -100438,7 +101232,7 @@ var ts; } } else { - if (node.kind === 246 /* SyntaxKind.BreakStatement */) { + if (node.kind === 249 /* SyntaxKind.BreakStatement */) { labelMarker = "break-".concat(label.escapedText); setLabeledJump(convertedLoopState, /*isBreak*/ true, ts.idText(label), labelMarker); } @@ -100494,7 +101288,7 @@ var ts; statements.push(statement); // Add an `export default` statement for default exports (for `--target es5 --module es6`) if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - var exportStatement = ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) + var exportStatement = ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) ? factory.createExportDefault(factory.getLocalName(node)) : factory.createExternalModuleExport(factory.getLocalName(node)); ts.setOriginalNode(exportStatement, statement); @@ -100863,11 +101657,11 @@ var ts; */ function isSufficientlyCoveredByReturnStatements(statement) { // A return statement is considered covered. - if (statement.kind === 247 /* SyntaxKind.ReturnStatement */) { + if (statement.kind === 250 /* SyntaxKind.ReturnStatement */) { return true; } // An if-statement with two covered branches is covered. - else if (statement.kind === 239 /* SyntaxKind.IfStatement */) { + else if (statement.kind === 242 /* SyntaxKind.IfStatement */) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && @@ -100875,7 +101669,7 @@ var ts; } } // A block is covered if it has a last statement which is covered. - else if (statement.kind === 235 /* SyntaxKind.Block */) { + else if (statement.kind === 238 /* SyntaxKind.Block */) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -101075,7 +101869,7 @@ var ts; * @param node A node. */ function insertCaptureThisForNodeIfNeeded(statements, node) { - if (hierarchyFacts & 65536 /* HierarchyFacts.CapturedLexicalThis */ && node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (hierarchyFacts & 65536 /* HierarchyFacts.CapturedLexicalThis */ && node.kind !== 216 /* SyntaxKind.ArrowFunction */) { insertCaptureThisForNode(statements, node, factory.createThis()); return true; } @@ -101109,22 +101903,22 @@ var ts; if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */) { var newTarget = void 0; switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return statements; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Methods and accessors cannot be constructors, so 'new.target' will // always return 'undefined'. newTarget = factory.createVoidZero(); break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: // Class constructors can only be called with `new`, so `this.constructor` // should be relatively safe to use. newTarget = factory.createPropertyAccessExpression(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), "constructor"); break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: // Functions can be called or constructed, and may have a `this` due to // being a member or when calling an imported function via `other_1.f()`. newTarget = factory.createConditionalExpression(factory.createLogicalAnd(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), factory.createBinaryExpression(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), 102 /* SyntaxKind.InstanceOfKeyword */, factory.getLocalName(node))), @@ -101159,21 +101953,21 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: statements.push(transformSemicolonClassElementToStatement(member)); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; - case 171 /* SyntaxKind.Constructor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // Constructors are handled in visitClassExpression/visitClassDeclaration break; default: @@ -101372,7 +102166,7 @@ var ts; : enterSubtree(32670 /* HierarchyFacts.FunctionExcludes */, 65 /* HierarchyFacts.FunctionIncludes */); var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */ && !name && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */)) { + if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */ && !name && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */)) { name = factory.getGeneratedNameForNode(node); } exitSubtree(ancestorFacts, 98304 /* HierarchyFacts.FunctionSubtreeExcludes */, 0 /* HierarchyFacts.None */); @@ -101418,7 +102212,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 214 /* SyntaxKind.ArrowFunction */); + ts.Debug.assert(node.kind === 216 /* SyntaxKind.ArrowFunction */); // To align with the old emitter, we use a synthetic end position on the location // for the statement list we synthesize when we down-level an arrow function with // an expression function body. This prevents both comments and source maps from @@ -101725,14 +102519,14 @@ var ts; } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitDoOrWhileStatement(node, outermostLabeledStatement); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, outermostLabeledStatement); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node, outermostLabeledStatement); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, outermostLabeledStatement); } } @@ -101918,7 +102712,7 @@ var ts; var property = properties[i]; if ((property.transformFlags & 1048576 /* TransformFlags.ContainsYield */ && hierarchyFacts & 4 /* HierarchyFacts.AsyncFunctionBody */) - || (hasComputed = ts.Debug.checkDefined(property.name).kind === 162 /* SyntaxKind.ComputedPropertyName */)) { + || (hasComputed = ts.Debug.checkDefined(property.name).kind === 164 /* SyntaxKind.ComputedPropertyName */)) { numInitialProperties = i; break; } @@ -102034,11 +102828,11 @@ var ts; } function convertIterationStatementCore(node, initializerFunction, convertedLoopBody) { switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody); - case 243 /* SyntaxKind.ForInStatement */: return convertForInStatement(node, convertedLoopBody); - case 244 /* SyntaxKind.ForOfStatement */: return convertForOfStatement(node, convertedLoopBody); - case 240 /* SyntaxKind.DoStatement */: return convertDoStatement(node, convertedLoopBody); - case 241 /* SyntaxKind.WhileStatement */: return convertWhileStatement(node, convertedLoopBody); + case 245 /* SyntaxKind.ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody); + case 246 /* SyntaxKind.ForInStatement */: return convertForInStatement(node, convertedLoopBody); + case 247 /* SyntaxKind.ForOfStatement */: return convertForOfStatement(node, convertedLoopBody); + case 243 /* SyntaxKind.DoStatement */: return convertDoStatement(node, convertedLoopBody); + case 244 /* SyntaxKind.WhileStatement */: return convertWhileStatement(node, convertedLoopBody); default: return ts.Debug.failBadSyntaxKind(node, "IterationStatement expected"); } } @@ -102063,11 +102857,11 @@ var ts; function createConvertedLoopState(node) { var loopInitializer; switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: var initializer = node.initializer; - if (initializer && initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (initializer && initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { loopInitializer = initializer; } break; @@ -102483,20 +103277,20 @@ var ts; for (var i = start; i < numProperties; i++) { var property = properties[i]; switch (property.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { expressions.push(transformAccessorsToExpression(receiver, accessors, node, !!node.multiLine)); } break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -102603,7 +103397,7 @@ var ts; var updated; var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { updated = factory.updateGetAccessorDeclaration(node, node.modifiers, node.name, parameters, node.type, body); } else { @@ -103063,13 +103857,13 @@ var ts; if ((enabledSubstitutions & 1 /* ES2015SubstitutionFlags.CapturedThis */) === 0) { enabledSubstitutions |= 1 /* ES2015SubstitutionFlags.CapturedThis */; context.enableSubstitution(108 /* SyntaxKind.ThisKeyword */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(214 /* SyntaxKind.ArrowFunction */); - context.enableEmitNotification(213 /* SyntaxKind.FunctionExpression */); - context.enableEmitNotification(256 /* SyntaxKind.FunctionDeclaration */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(216 /* SyntaxKind.ArrowFunction */); + context.enableEmitNotification(215 /* SyntaxKind.FunctionExpression */); + context.enableEmitNotification(259 /* SyntaxKind.FunctionDeclaration */); } } /** @@ -103110,10 +103904,10 @@ var ts; */ function isNameOfDeclarationWithCollidingName(node) { switch (node.parent.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return node.parent.name === node && resolver.isDeclarationWithCollidingName(node.parent); } @@ -103195,11 +103989,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 238 /* SyntaxKind.ExpressionStatement */) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 241 /* SyntaxKind.ExpressionStatement */) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 208 /* SyntaxKind.CallExpression */) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 210 /* SyntaxKind.CallExpression */) { return false; } var callTarget = statementExpression.expression; @@ -103207,7 +104001,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 225 /* SyntaxKind.SpreadElement */) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 227 /* SyntaxKind.SpreadElement */) { return false; } var expression = callArgument.expression; @@ -103233,15 +104027,15 @@ var ts; if (compilerOptions.jsx === 1 /* JsxEmit.Preserve */ || compilerOptions.jsx === 3 /* JsxEmit.ReactNative */) { previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; - context.enableEmitNotification(280 /* SyntaxKind.JsxOpeningElement */); - context.enableEmitNotification(281 /* SyntaxKind.JsxClosingElement */); - context.enableEmitNotification(279 /* SyntaxKind.JsxSelfClosingElement */); + context.enableEmitNotification(283 /* SyntaxKind.JsxOpeningElement */); + context.enableEmitNotification(284 /* SyntaxKind.JsxClosingElement */); + context.enableEmitNotification(282 /* SyntaxKind.JsxSelfClosingElement */); noSubstitution = []; } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(296 /* SyntaxKind.PropertyAssignment */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(299 /* SyntaxKind.PropertyAssignment */); return ts.chainBundle(context, transformSourceFile); /** * Transforms an ES5 source file to ES3. @@ -103260,9 +104054,9 @@ var ts; */ function onEmitNode(hint, node, emitCallback) { switch (node.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: var tagName = node.tagName; noSubstitution[ts.getOriginalNodeId(tagName)] = true; break; @@ -103597,13 +104391,13 @@ var ts; */ function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return visitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitWhileStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -103616,24 +104410,24 @@ var ts; */ function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitAccessorDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return visitBreakStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return visitContinueStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); default: if (node.transformFlags & 1048576 /* TransformFlags.ContainsYield */) { @@ -103654,23 +104448,23 @@ var ts; */ function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return visitConditionalExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return visitElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -103683,9 +104477,9 @@ var ts; */ function visitGenerator(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); default: return ts.Debug.failBadSyntaxKind(node); @@ -103892,7 +104686,7 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // [source] // a.b = yield; // @@ -103904,7 +104698,7 @@ var ts; // _a.b = %sent%; target = factory.updatePropertyAccessExpression(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // [source] // a[b] = yield; // @@ -104298,35 +105092,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return transformAndEmitBlock(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return transformAndEmitExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return transformAndEmitIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return transformAndEmitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return transformAndEmitWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return transformAndEmitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return transformAndEmitForInStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return transformAndEmitContinueStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return transformAndEmitBreakStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return transformAndEmitReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return transformAndEmitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return transformAndEmitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return transformAndEmitLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return transformAndEmitThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement)); @@ -104756,7 +105550,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 290 /* SyntaxKind.DefaultClause */ && defaultClauseIndex === -1) { + if (clause.kind === 293 /* SyntaxKind.DefaultClause */ && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -104769,7 +105563,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { if (containsYield(clause.expression) && pendingClauses.length > 0) { break; } @@ -105929,12 +106723,12 @@ var ts; var previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. - context.enableSubstitution(210 /* SyntaxKind.TaggedTemplateExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. + context.enableSubstitution(212 /* SyntaxKind.TaggedTemplateExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. context.enableSubstitution(79 /* SyntaxKind.Identifier */); // Substitutes expression identifiers with imported/exported symbols. - context.enableSubstitution(221 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(223 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var currentSourceFile; // The current file. @@ -106262,23 +107056,23 @@ var ts; */ function topLevelVisitor(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return visitor(node); @@ -106291,26 +107085,26 @@ var ts; return node; } switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, valueIsDiscarded); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(node) && currentSourceFile.impliedNodeFormat === undefined) { return visitImportCallExpression(node); } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); } return ts.visitEachChild(node, visitor, context); @@ -106326,24 +107120,24 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var elem = _a[_i]; switch (elem.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (destructuringNeedsFlattening(elem.initializer)) { return true; } break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: if (destructuringNeedsFlattening(elem.name)) { return true; } break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: if (destructuringNeedsFlattening(elem.expression)) { return true; } break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return false; default: ts.Debug.assertNever(elem, "Unhandled object member kind"); } @@ -106929,7 +107723,7 @@ var ts; // // To balance the declaration, add the exports of the elided variable // statement. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 237 /* SyntaxKind.VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240 /* SyntaxKind.VariableStatement */) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -106984,10 +107778,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding, /* liveBinding */ true); @@ -107071,7 +107865,7 @@ var ts; return statements; } if (ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */)) { - var exportName = ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); + var exportName = ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); statements = appendExportStatement(statements, exportName, factory.getLocalName(decl), /*location*/ decl); } if (decl.name) { @@ -107200,7 +107994,7 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; previousOnEmitNode(hint, node, emitCallback); @@ -107262,11 +108056,11 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return substituteTaggedTemplateExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return substituteBinaryExpression(node); } return node; @@ -107310,7 +108104,7 @@ var ts; } else if (!(ts.isGeneratedIdentifier(node) && !(node.autoGenerateFlags & 64 /* GeneratedIdentifierFlags.AllowNameSubstitution */)) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 305 /* SyntaxKind.SourceFile */) { + if (exportContainer && exportContainer.kind === 308 /* SyntaxKind.SourceFile */) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.cloneNode(node)), /*location*/ node); } @@ -107400,10 +108194,10 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(79 /* SyntaxKind.Identifier */); // Substitutes expression identifiers for imported symbols. - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols - context.enableSubstitution(221 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(231 /* SyntaxKind.MetaProperty */); // Substitutes 'import.meta' - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols + context.enableSubstitution(223 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(233 /* SyntaxKind.MetaProperty */); // Substitutes 'import.meta' + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var exportFunctionsMap = []; // The export function associated with a source file. @@ -107593,7 +108387,7 @@ var ts; ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); var exportStarFunction = addExportStarIfNeeded(statements); // TODO: GH#18217 var modifiers = node.transformFlags & 2097152 /* TransformFlags.ContainsAwait */ ? - factory.createModifiersFromModifierFlags(256 /* ModifierFlags.Async */) : + factory.createModifiersFromModifierFlags(512 /* ModifierFlags.Async */) : undefined; var moduleObject = factory.createObjectLiteralExpression([ factory.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), @@ -107627,7 +108421,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 272 /* SyntaxKind.ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 275 /* SyntaxKind.ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -107716,19 +108510,26 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(factory, entry, currentSourceFile); // TODO: GH#18217 switch (entry.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: if (!entry.importClause) { // 'import "..."' case // module is imported only for side-effects, no emit required break; } // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: ts.Debug.assert(importVariableName !== undefined); // save import into the local statements.push(factory.createExpressionStatement(factory.createAssignment(importVariableName, parameterName))); + if (ts.hasSyntacticModifier(entry, 1 /* ModifierFlags.Export */)) { + statements.push(factory.createExpressionStatement(factory.createCallExpression(exportFunction, + /*typeArguments*/ undefined, [ + factory.createStringLiteral(ts.idText(importVariableName)), + parameterName, + ]))); + } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { if (ts.isNamedExports(entry.exportClause)) { @@ -107787,13 +108588,13 @@ var ts; */ function topLevelVisitor(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); default: return topLevelNestedVisitor(node); @@ -107972,7 +108773,7 @@ var ts; function shouldHoistVariableDeclarationList(node) { // hoist only non-block scoped declarations or block scoped declarations parented by source file return (ts.getEmitFlags(node) & 2097152 /* EmitFlags.NoHoisting */) === 0 - && (enclosingBlockScopedContainer.kind === 305 /* SyntaxKind.SourceFile */ + && (enclosingBlockScopedContainer.kind === 308 /* SyntaxKind.SourceFile */ || (ts.getOriginalNode(node).flags & 3 /* NodeFlags.BlockScoped */) === 0); } /** @@ -108036,7 +108837,7 @@ var ts; // // To balance the declaration, we defer the exports of the elided variable // statement until we visit this declaration's `EndOfDeclarationMarker`. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 237 /* SyntaxKind.VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240 /* SyntaxKind.VariableStatement */) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasSyntacticModifier(node.original, 1 /* ModifierFlags.Export */); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -108098,10 +108899,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -108196,7 +108997,7 @@ var ts; } var excludeName; if (ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */)) { - var exportName = ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */) ? factory.createStringLiteral("default") : decl.name; + var exportName = ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */) ? factory.createStringLiteral("default") : decl.name; statements = appendExportStatement(statements, exportName, factory.getLocalName(decl)); excludeName = ts.getTextOfIdentifierOrLiteral(exportName); } @@ -108281,43 +109082,43 @@ var ts; */ function topLevelNestedVisitor(node) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*isTopLevel*/ true); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return visitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitWhileStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return visitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return visitCaseBlock(node); - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return visitCaseClause(node); - case 290 /* SyntaxKind.DefaultClause */: + case 293 /* SyntaxKind.DefaultClause */: return visitDefaultClause(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return visitTryStatement(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return visitBlock(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return visitor(node); @@ -108503,26 +109304,26 @@ var ts; return node; } switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*isTopLevel*/ false); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, valueIsDiscarded); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(node)) { return visitImportCallExpression(node); } break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return visitPrefixOrPostfixUnaryExpression(node, valueIsDiscarded); } return ts.visitEachChild(node, visitor, context); @@ -108602,7 +109403,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 305 /* SyntaxKind.SourceFile */; + return container !== undefined && container.kind === 308 /* SyntaxKind.SourceFile */; } else { return false; @@ -108680,7 +109481,7 @@ var ts; * @param emitCallback A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -108730,7 +109531,7 @@ var ts; */ function substituteUnspecified(node) { switch (node.kind) { - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return substituteShorthandPropertyAssignment(node); } return node; @@ -108767,9 +109568,9 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return substituteBinaryExpression(node); - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return substituteMetaProperty(node); } return node; @@ -108859,7 +109660,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); - if (exportContainer && exportContainer.kind === 305 /* SyntaxKind.SourceFile */) { + if (exportContainer && exportContainer.kind === 308 /* SyntaxKind.SourceFile */) { exportedNames = ts.append(exportedNames, factory.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -108902,7 +109703,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); context.enableSubstitution(79 /* SyntaxKind.Identifier */); var helperNameSubstitutions; var currentSourceFile; @@ -108942,14 +109743,14 @@ var ts; } function visitor(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // Though an error in es2020 modules, in node-flavor es2020 modules, we can helpfully transform this to a synthetic `require` call // To give easy access to a synchronous `require` in node-flavor esm. We do the transform even in scenarios where we error, but `import.meta.url` // is available, just because the output is reasonable for a node-like runtime. return ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.Node16 ? visitImportEqualsDeclaration(node) : undefined; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportDecl = node; return visitExportDeclaration(exportDecl); } @@ -109106,8 +109907,8 @@ var ts; var cjsOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(305 /* SyntaxKind.SourceFile */); - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); + context.enableSubstitution(308 /* SyntaxKind.SourceFile */); + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); var currentSourceFile; return transformSourceFileOrBundle; function onSubstituteNode(hint, node) { @@ -109154,7 +109955,7 @@ var ts; return result; } function transformSourceFileOrBundle(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -109214,7 +110015,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109243,7 +110044,7 @@ var ts; ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109290,7 +110091,7 @@ var ts; return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: ".concat(ts.Debug.formatSyntaxKind(node.kind))); } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109299,8 +110100,8 @@ var ts; } // This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit // The only exception here is if the constructor was marked as private. we are not emitting the constructor parameters at all. - else if (node.kind === 167 /* SyntaxKind.PropertyDeclaration */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 166 /* SyntaxKind.PropertySignature */ || - (node.kind === 164 /* SyntaxKind.Parameter */ && ts.hasSyntacticModifier(node.parent, 8 /* ModifierFlags.Private */))) { + else if (node.kind === 169 /* SyntaxKind.PropertyDeclaration */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 168 /* SyntaxKind.PropertySignature */ || + (node.kind === 166 /* SyntaxKind.Parameter */ && ts.hasSyntacticModifier(node.parent, 8 /* ModifierFlags.Private */))) { // TODO(jfreeman): Deal with computed properties in error reporting. if (ts.isStatic(node)) { return symbolAccessibilityResult.errorModuleName ? @@ -109309,7 +110110,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 166 /* SyntaxKind.Parameter */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109334,7 +110135,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (node.kind === 173 /* SyntaxKind.SetAccessor */) { + if (node.kind === 175 /* SyntaxKind.SetAccessor */) { // Getters can infer the return type from the returned expression, but setters cannot, so the // "_from_external_module_1_but_cannot_be_named" case cannot occur. if (ts.isStatic(node)) { @@ -109373,26 +110174,26 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? @@ -109400,7 +110201,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -109414,7 +110215,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -109439,30 +110240,30 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 175 /* SyntaxKind.ConstructSignature */: - case 180 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node.parent)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? @@ -109470,7 +110271,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109483,15 +110284,15 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 256 /* SyntaxKind.FunctionDeclaration */: - case 179 /* SyntaxKind.FunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 181 /* SyntaxKind.FunctionType */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; - case 173 /* SyntaxKind.SetAccessor */: - case 172 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109505,39 +110306,39 @@ var ts; // Type parameter constraints are named by user so we should always be able to name it var diagnosticMessage; switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1; break; - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node.parent)) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 179 /* SyntaxKind.FunctionType */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 181 /* SyntaxKind.FunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -109603,7 +110404,7 @@ var ts; } function isInternalDeclaration(node, currentSourceFile) { var parseTreeNode = ts.getParseTreeNode(node); - if (parseTreeNode && parseTreeNode.kind === 164 /* SyntaxKind.Parameter */) { + if (parseTreeNode && parseTreeNode.kind === 166 /* SyntaxKind.Parameter */) { var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode); var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined; var text = currentSourceFile.text; @@ -109779,7 +110580,7 @@ var ts; var _a; var primaryDeclaration = (_a = parentSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.getSourceFileOfNode(d) === containingFile; }); var augmentingDeclarations = ts.filter(symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== containingFile; }); - if (augmentingDeclarations) { + if (primaryDeclaration && augmentingDeclarations) { for (var _i = 0, augmentingDeclarations_1 = augmentingDeclarations; _i < augmentingDeclarations_1.length; _i++) { var augmentations = augmentingDeclarations_1[_i]; context.addDiagnostic(ts.addRelatedInfo(ts.createDiagnosticForNode(augmentations, ts.Diagnostics.Declaration_augments_declaration_in_another_file_This_cannot_be_serialized), ts.createDiagnosticForNode(primaryDeclaration, ts.Diagnostics.This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_file))); @@ -109809,10 +110610,10 @@ var ts; return result; } function transformRoot(node) { - if (node.kind === 305 /* SyntaxKind.SourceFile */ && node.isDeclarationFile) { + if (node.kind === 308 /* SyntaxKind.SourceFile */ && node.isDeclarationFile) { return node; } - if (node.kind === 306 /* SyntaxKind.Bundle */) { + if (node.kind === 309 /* SyntaxKind.Bundle */) { isBundledEmit = true; refs = new ts.Map(); libs = new ts.Map(); @@ -109835,14 +110636,14 @@ var ts; resultHasExternalModuleIndicator = false; // unused in external module bundle emit (all external modules are within module blocks, therefore are known to be modules) needsDeclare = false; var statements = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile, /*bundled*/ true)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements); - var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); + var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); return newFile; } needsDeclare = true; var updated = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements); return factory.updateSourceFile(sourceFile, transformAndReplaceLatePaintedStatements(updated), /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); }), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 308 /* SyntaxKind.InputFiles */) { + if (prepend.kind === 311 /* SyntaxKind.InputFiles */) { var sourceFile = ts.createUnparsedSourceFile(prepend, "dts", stripInternal); hasNoDefaultLib_1 = hasNoDefaultLib_1 || !!sourceFile.hasNoDefaultLib; collectReferences(sourceFile, refs); @@ -109983,7 +110784,7 @@ var ts; return name; } else { - if (name.kind === 202 /* SyntaxKind.ArrayBindingPattern */) { + if (name.kind === 204 /* SyntaxKind.ArrayBindingPattern */) { return factory.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement)); } else { @@ -109991,7 +110792,7 @@ var ts; } } function visitBindingElement(elem) { - if (elem.kind === 227 /* SyntaxKind.OmittedExpression */) { + if (elem.kind === 229 /* SyntaxKind.OmittedExpression */) { return elem; } if (elem.propertyName && ts.isIdentifier(elem.propertyName) && ts.isIdentifier(elem.name) && !elem.symbol.isReferenced) { @@ -110033,19 +110834,19 @@ var ts; // Literal const declarations will have an initializer ensured rather than a type return; } - var shouldUseResolverType = node.kind === 164 /* SyntaxKind.Parameter */ && + var shouldUseResolverType = node.kind === 166 /* SyntaxKind.Parameter */ && (resolver.isRequiredInitializedParameter(node) || resolver.isOptionalUninitializedParameterProperty(node)); if (type && !shouldUseResolverType) { return ts.visitNode(type, visitDeclarationSubtree); } if (!ts.getParseTreeNode(node)) { - return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } - if (node.kind === 173 /* SyntaxKind.SetAccessor */) { + if (node.kind === 175 /* SyntaxKind.SetAccessor */) { // Set accessors with no associated type node (from it's param or get accessor return) are `any` since they are never contextually typed right now // (The inferred type here will be void, but the old declaration emitter printed `any`, so this replicates that) - return factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } errorNameNode = node.name; var oldDiag; @@ -110053,12 +110854,12 @@ var ts; oldDiag = getSymbolAccessibilityDiagnostic; getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node); } - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); } - if (node.kind === 164 /* SyntaxKind.Parameter */ - || node.kind === 167 /* SyntaxKind.PropertyDeclaration */ - || node.kind === 166 /* SyntaxKind.PropertySignature */) { + if (node.kind === 166 /* SyntaxKind.Parameter */ + || node.kind === 169 /* SyntaxKind.PropertyDeclaration */ + || node.kind === 168 /* SyntaxKind.PropertySignature */) { if (ts.isPropertySignature(node) || !node.initializer) return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType)); return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType) || resolver.createTypeOfExpression(node.initializer, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); @@ -110069,28 +110870,28 @@ var ts; if (!suppressNewDiagnosticContexts) { getSymbolAccessibilityDiagnostic = oldDiag; } - return returnValue || factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return returnValue || factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } } function isDeclarationAndNotVisible(node) { node = ts.getParseTreeNode(node); switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return !resolver.isDeclarationVisible(node); // The following should be doing their own visibility checks based on filtering their members - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return !getBindingNameVisible(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: return false; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return true; } return false; @@ -110179,7 +110980,7 @@ var ts; function rewriteModuleSpecifier(parent, input) { if (!input) return undefined; // TODO: GH#18217 - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && parent.kind !== 200 /* SyntaxKind.ImportType */); + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && parent.kind !== 202 /* SyntaxKind.ImportType */); if (ts.isStringLiteralLike(input)) { if (isBundledEmit) { var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent); @@ -110199,7 +111000,7 @@ var ts; function transformImportEqualsDeclaration(decl) { if (!resolver.isDeclarationVisible(decl)) return; - if (decl.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + if (decl.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { // Rewrite external module names if necessary var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl); return factory.updateImportEqualsDeclaration(decl, decl.modifiers, decl.isTypeOnly, decl.name, factory.updateExternalModuleReference(decl.moduleReference, rewriteModuleSpecifier(decl, specifier))); @@ -110224,7 +111025,7 @@ var ts; return visibleDefaultBinding && factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, /*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)); } - if (decl.importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (decl.importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { // Namespace import (optionally with visible default) var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined; return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)) : undefined; @@ -110327,7 +111128,7 @@ var ts; // We'd see a TDZ violation at runtime var canProduceDiagnostic = ts.canProduceDiagnostics(input); var oldWithinObjectLiteralType = suppressNewDiagnosticContexts; - var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 182 /* SyntaxKind.TypeLiteral */ || input.kind === 195 /* SyntaxKind.MappedType */) && input.parent.kind !== 259 /* SyntaxKind.TypeAliasDeclaration */); + var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 184 /* SyntaxKind.TypeLiteral */ || input.kind === 197 /* SyntaxKind.MappedType */) && input.parent.kind !== 262 /* SyntaxKind.TypeAliasDeclaration */); // Emit methods which are private as properties with no type information if (ts.isMethodDeclaration(input) || ts.isMethodSignature(input)) { if (ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)) { @@ -110348,28 +111149,28 @@ var ts; } if (isProcessedComponent(input)) { switch (input.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: { + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: { if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) { checkEntityNameVisibility(input.expression, enclosingDeclaration); } var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory.updateExpressionWithTypeArguments(node, node.expression, node.typeArguments)); } - case 178 /* SyntaxKind.TypeReference */: { + case 180 /* SyntaxKind.TypeReference */: { checkEntityNameVisibility(input.typeName, enclosingDeclaration); var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory.updateTypeReferenceNode(node, node.typeName, node.typeArguments)); } - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return cleanup(factory.updateConstructSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); - case 171 /* SyntaxKind.Constructor */: { + case 173 /* SyntaxKind.Constructor */: { // A constructor declaration may not have a type annotation var ctor = factory.createConstructorDeclaration( /*modifiers*/ ensureModifiers(input), updateParamsList(input, input.parameters, 0 /* ModifierFlags.None */), /*body*/ undefined); return cleanup(ctor); } - case 169 /* SyntaxKind.MethodDeclaration */: { + case 171 /* SyntaxKind.MethodDeclaration */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } @@ -110378,7 +111179,7 @@ var ts; /*body*/ undefined); return cleanup(sig); } - case 172 /* SyntaxKind.GetAccessor */: { + case 174 /* SyntaxKind.GetAccessor */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } @@ -110386,36 +111187,36 @@ var ts; return cleanup(factory.updateGetAccessorDeclaration(input, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)), ensureType(input, accessorType), /*body*/ undefined)); } - case 173 /* SyntaxKind.SetAccessor */: { + case 175 /* SyntaxKind.SetAccessor */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updateSetAccessorDeclaration(input, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)), /*body*/ undefined)); } - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updatePropertyDeclaration(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type), ensureNoInitializer(input))); - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updatePropertySignature(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type))); - case 168 /* SyntaxKind.MethodSignature */: { + case 170 /* SyntaxKind.MethodSignature */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updateMethodSignature(input, ensureModifiers(input), input.name, input.questionToken, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 174 /* SyntaxKind.CallSignature */: { + case 176 /* SyntaxKind.CallSignature */: { return cleanup(factory.updateCallSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 176 /* SyntaxKind.IndexSignature */: { - return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */))); + case 178 /* SyntaxKind.IndexSignature */: { + return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */))); } - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { if (ts.isBindingPattern(input.name)) { return recreateBindingPattern(input.name); } @@ -110423,13 +111224,13 @@ var ts; suppressNewDiagnosticContexts = true; // Variable declaration types also suppress new diagnostic contexts, provided the contexts wouldn't be made for binding pattern types return cleanup(factory.updateVariableDeclaration(input, input.name, /*exclamationToken*/ undefined, ensureType(input, input.type), ensureNoInitializer(input))); } - case 163 /* SyntaxKind.TypeParameter */: { + case 165 /* SyntaxKind.TypeParameter */: { if (isPrivateMethodTypeParameter(input) && (input.default || input.constraint)) { return cleanup(factory.updateTypeParameterDeclaration(input, input.modifiers, input.name, /*constraint*/ undefined, /*defaultType*/ undefined)); } return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context)); } - case 189 /* SyntaxKind.ConditionalType */: { + case 191 /* SyntaxKind.ConditionalType */: { // We have to process conditional types in a special way because for visibility purposes we need to push a new enclosingDeclaration // just for the `infer` types in the true branch. It's an implicit declaration scope that only applies to _part_ of the type. var checkType = ts.visitNode(input.checkType, visitDeclarationSubtree); @@ -110441,13 +111242,13 @@ var ts; var falseType = ts.visitNode(input.falseType, visitDeclarationSubtree); return cleanup(factory.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType)); } - case 179 /* SyntaxKind.FunctionType */: { + case 181 /* SyntaxKind.FunctionType */: { return cleanup(factory.updateFunctionTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 180 /* SyntaxKind.ConstructorType */: { + case 182 /* SyntaxKind.ConstructorType */: { return cleanup(factory.updateConstructorTypeNode(input, ensureModifiers(input), ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 200 /* SyntaxKind.ImportType */: { + case 202 /* SyntaxKind.ImportType */: { if (!ts.isLiteralImportTypeNode(input)) return cleanup(input); return cleanup(factory.updateImportTypeNode(input, factory.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.assertions, input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf)); @@ -110479,7 +111280,7 @@ var ts; } } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 169 /* SyntaxKind.MethodDeclaration */ && ts.hasEffectiveModifier(node.parent, 8 /* ModifierFlags.Private */); + return node.parent.kind === 171 /* SyntaxKind.MethodDeclaration */ && ts.hasEffectiveModifier(node.parent, 8 /* ModifierFlags.Private */); } function visitDeclarationStatements(input) { if (!isPreservedDeclarationStatement(input)) { @@ -110489,7 +111290,7 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 272 /* SyntaxKind.ExportDeclaration */: { + case 275 /* SyntaxKind.ExportDeclaration */: { if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; } @@ -110498,7 +111299,7 @@ var ts; // Rewrite external module names if necessary return factory.updateExportDeclaration(input, input.modifiers, input.isTypeOnly, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier), ts.getResolutionModeOverrideForClause(input.assertClause) ? input.assertClause : undefined); } - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { // Always visible if the parent node isn't dropped for being not visible if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; @@ -110516,7 +111317,7 @@ var ts; errorFallbackNode = input; var varDecl = factory.createVariableDeclaration(newId, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); errorFallbackNode = undefined; - var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); preserveJsDoc(statement, input); ts.removeAllComments(input); return [statement, factory.updateExportAssignment(input, input.modifiers, newId)]; @@ -110529,12 +111330,12 @@ var ts; return input; } function stripExportModifiers(statement) { - if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 512 /* ModifierFlags.Default */) || !ts.canHaveModifiers(statement)) { + if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 1024 /* ModifierFlags.Default */) || !ts.canHaveModifiers(statement)) { // `export import` statements should remain as-is, as imports are _not_ implicitly exported in an ambient namespace // Likewise, `export default` classes and the like and just be `default`, so we preserve their `export` modifiers, too return statement; } - var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (257023 /* ModifierFlags.All */ ^ 1 /* ModifierFlags.Export */)); + var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (258047 /* ModifierFlags.All */ ^ 1 /* ModifierFlags.Export */)); return factory.updateModifiers(statement, modifiers); } function transformTopLevelDeclaration(input) { @@ -110545,10 +111346,10 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { return transformImportEqualsDeclaration(input); } - case 266 /* SyntaxKind.ImportDeclaration */: { + case 269 /* SyntaxKind.ImportDeclaration */: { return transformImportDeclaration(input); } } @@ -110569,12 +111370,16 @@ var ts; } var previousNeedsDeclare = needsDeclare; switch (input.kind) { - case 259 /* SyntaxKind.TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all - return cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); - case 258 /* SyntaxKind.InterfaceDeclaration */: { + case 262 /* SyntaxKind.TypeAliasDeclaration */: { + needsDeclare = false; + var clean = cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); + needsDeclare = previousNeedsDeclare; + return clean; + } + case 261 /* SyntaxKind.InterfaceDeclaration */: { return cleanup(factory.updateInterfaceDeclaration(input, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree))); } - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { // Generators lose their generator-ness, excepting their return type var clean = cleanup(factory.updateFunctionDeclaration(input, ensureModifiers(input), /*asteriskToken*/ undefined, input.name, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), @@ -110615,10 +111420,10 @@ var ts; })))); } var namespaceDecl = factory.createModuleDeclaration(ensureModifiers(input), input.name, factory.createModuleBlock(declarations), 16 /* NodeFlags.Namespace */); - if (!ts.hasEffectiveModifier(clean, 512 /* ModifierFlags.Default */)) { + if (!ts.hasEffectiveModifier(clean, 1024 /* ModifierFlags.Default */)) { return [clean, namespaceDecl]; } - var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~513 /* ModifierFlags.ExportDefault */) | 2 /* ModifierFlags.Ambient */); + var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~1025 /* ModifierFlags.ExportDefault */) | 2 /* ModifierFlags.Ambient */); var cleanDeclaration = factory.updateFunctionDeclaration(clean, modifiers, /*asteriskToken*/ undefined, clean.name, clean.typeParameters, clean.parameters, clean.type, /*body*/ undefined); @@ -110636,10 +111441,10 @@ var ts; return clean; } } - case 261 /* SyntaxKind.ModuleDeclaration */: { + case 264 /* SyntaxKind.ModuleDeclaration */: { needsDeclare = false; var inner = input.body; - if (inner && inner.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (inner && inner.kind === 265 /* SyntaxKind.ModuleBlock */) { var oldNeedsScopeFix = needsScopeFixMarker; var oldHasScopeFix = resultHasScopeMarker; resultHasScopeMarker = false; @@ -110680,7 +111485,7 @@ var ts; return cleanup(factory.updateModuleDeclaration(input, mods, input.name, body)); } } - case 257 /* SyntaxKind.ClassDeclaration */: { + case 260 /* SyntaxKind.ClassDeclaration */: { errorNameNode = input.name; errorFallbackNode = input; var modifiers = factory.createNodeArray(ensureModifiers(input)); @@ -110742,7 +111547,7 @@ var ts; typeName: input.name }); }; var varDecl = factory.createVariableDeclaration(newId_1, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(extendsClause_1.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); - var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); var heritageClauses = factory.createNodeArray(ts.map(input.heritageClauses, function (clause) { if (clause.token === 94 /* SyntaxKind.ExtendsKeyword */) { var oldDiag_2 = getSymbolAccessibilityDiagnostic; @@ -110760,10 +111565,10 @@ var ts; return cleanup(factory.updateClassDeclaration(input, modifiers, input.name, typeParameters, heritageClauses, members)); } } - case 237 /* SyntaxKind.VariableStatement */: { + case 240 /* SyntaxKind.VariableStatement */: { return cleanup(transformVariableStatement(input)); } - case 260 /* SyntaxKind.EnumDeclaration */: { + case 263 /* SyntaxKind.EnumDeclaration */: { return cleanup(factory.updateEnumDeclaration(input, factory.createNodeArray(ensureModifiers(input)), input.name, factory.createNodeArray(ts.mapDefined(input.members, function (m) { if (shouldStripInternal(m)) return; @@ -110782,7 +111587,7 @@ var ts; if (canProdiceDiagnostic) { getSymbolAccessibilityDiagnostic = oldDiag; } - if (input.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (input.kind === 264 /* SyntaxKind.ModuleDeclaration */) { needsDeclare = previousNeedsDeclare; } if (node === input) { @@ -110805,7 +111610,7 @@ var ts; return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e); })); } function recreateBindingElement(e) { - if (e.kind === 227 /* SyntaxKind.OmittedExpression */) { + if (e.kind === 229 /* SyntaxKind.OmittedExpression */) { return; } if (e.name) { @@ -110853,9 +111658,9 @@ var ts; return factory.createModifiersFromModifierFlags(newFlags); } function ensureModifierFlags(node) { - var mask = 257023 /* ModifierFlags.All */ ^ (4 /* ModifierFlags.Public */ | 256 /* ModifierFlags.Async */ | 16384 /* ModifierFlags.Override */); // No async and override modifiers in declaration files + var mask = 258047 /* ModifierFlags.All */ ^ (4 /* ModifierFlags.Public */ | 512 /* ModifierFlags.Async */ | 16384 /* ModifierFlags.Override */); // No async and override modifiers in declaration files var additions = (needsDeclare && !isAlwaysType(node)) ? 2 /* ModifierFlags.Ambient */ : 0 /* ModifierFlags.None */; - var parentIsFile = node.parent.kind === 305 /* SyntaxKind.SourceFile */; + var parentIsFile = node.parent.kind === 308 /* SyntaxKind.SourceFile */; if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) { mask ^= 2 /* ModifierFlags.Ambient */; additions = 0 /* ModifierFlags.None */; @@ -110884,7 +111689,7 @@ var ts; } ts.transformDeclarations = transformDeclarations; function isAlwaysType(node) { - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return true; } return false; @@ -110894,22 +111699,22 @@ var ts; return ts.factory.createModifiersFromModifierFlags(maskModifierFlags(node, modifierMask, modifierAdditions)); } function maskModifierFlags(node, modifierMask, modifierAdditions) { - if (modifierMask === void 0) { modifierMask = 257023 /* ModifierFlags.All */ ^ 4 /* ModifierFlags.Public */; } + if (modifierMask === void 0) { modifierMask = 258047 /* ModifierFlags.All */ ^ 4 /* ModifierFlags.Public */; } if (modifierAdditions === void 0) { modifierAdditions = 0 /* ModifierFlags.None */; } var flags = (ts.getEffectiveModifierFlags(node) & modifierMask) | modifierAdditions; - if (flags & 512 /* ModifierFlags.Default */ && !(flags & 1 /* ModifierFlags.Export */)) { + if (flags & 1024 /* ModifierFlags.Default */ && !(flags & 1 /* ModifierFlags.Export */)) { // A non-exported default is a nonsequitor - we usually try to remove all export modifiers // from statements in ambient declarations; but a default export must retain its export modifier to be syntactically valid flags ^= 1 /* ModifierFlags.Export */; } - if (flags & 512 /* ModifierFlags.Default */ && flags & 2 /* ModifierFlags.Ambient */) { + if (flags & 1024 /* ModifierFlags.Default */ && flags & 2 /* ModifierFlags.Ambient */) { flags ^= 2 /* ModifierFlags.Ambient */; // `declare` is never required alongside `default` (and would be an error if printed) } return flags; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 172 /* SyntaxKind.GetAccessor */ + return accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? accessor.type // Getter - return type : accessor.parameters.length > 0 ? accessor.parameters[0].type // Setter parameter type @@ -110918,52 +111723,52 @@ var ts; } function canHaveLiteralInitializer(node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return !ts.hasEffectiveModifier(node, 8 /* ModifierFlags.Private */); - case 164 /* SyntaxKind.Parameter */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; } return false; } function isPreservedDeclarationStatement(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: return true; } return false; } function isProcessedComponent(node) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 254 /* SyntaxKind.VariableDeclaration */: - case 163 /* SyntaxKind.TypeParameter */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 178 /* SyntaxKind.TypeReference */: - case 189 /* SyntaxKind.ConditionalType */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 200 /* SyntaxKind.ImportType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: + case 191 /* SyntaxKind.ConditionalType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 202 /* SyntaxKind.ImportType */: return true; } return false; @@ -111103,7 +111908,7 @@ var ts; * @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files. */ function transformNodes(resolver, host, factory, options, nodes, transformers, allowDtsFiles) { - var enabledSyntaxKindFeatures = new Array(355 /* SyntaxKind.Count */); + var enabledSyntaxKindFeatures = new Array(358 /* SyntaxKind.Count */); var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentStatements; @@ -111185,7 +111990,7 @@ var ts; var transformed = []; for (var _a = 0, nodes_3 = nodes; _a < nodes_3.length; _a++) { var node = nodes_3[_a]; - ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* tracing.Phase.Emit */, "transformNodes", node.kind === 305 /* SyntaxKind.SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); + ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* tracing.Phase.Emit */, "transformNodes", node.kind === 308 /* SyntaxKind.SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); transformed.push((allowDtsFiles ? transformation : transformRoot)(node)); ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop(); } @@ -111591,7 +112396,7 @@ var ts; /*@internal*/ function getOutputPathsFor(sourceFile, host, forceDtsPaths) { var options = host.getCompilerOptions(); - if (sourceFile.kind === 306 /* SyntaxKind.Bundle */) { + if (sourceFile.kind === 309 /* SyntaxKind.Bundle */) { return getOutputPathsForBundle(options, forceDtsPaths); } else { @@ -111960,8 +112765,8 @@ var ts; } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) { var sourceFileOrBundle = transform.transformed[0]; - var bundle = sourceFileOrBundle.kind === 306 /* SyntaxKind.Bundle */ ? sourceFileOrBundle : undefined; - var sourceFile = sourceFileOrBundle.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFileOrBundle : undefined; + var bundle = sourceFileOrBundle.kind === 309 /* SyntaxKind.Bundle */ ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFileOrBundle : undefined; var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; var sourceMapGenerator; if (shouldEmitSourceMaps(mapOptions, sourceFileOrBundle)) { @@ -112011,7 +112816,7 @@ var ts; } function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) { return (mapOptions.sourceMap || mapOptions.inlineSourceMap) - && (sourceFileOrBundle.kind !== 305 /* SyntaxKind.SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Extension.Json */)); + && (sourceFileOrBundle.kind !== 308 /* SyntaxKind.SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Extension.Json */)); } function getSourceRoot(mapOptions) { // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the @@ -112074,8 +112879,8 @@ var ts; } ts.getBuildInfoText = getBuildInfoText; /*@internal*/ - function getBuildInfo(buildInfoText) { - return JSON.parse(buildInfoText); + function getBuildInfo(buildInfoFile, buildInfoText) { + return ts.readJsonOrUndefined(buildInfoFile, buildInfoText); } ts.getBuildInfo = getBuildInfo; /*@internal*/ @@ -112153,17 +112958,16 @@ var ts; var buildInfo; if (host.getBuildInfo) { // If host directly provides buildinfo we can get it directly. This allows host to cache the buildinfo - var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); - if (!hostBuildInfo) - return buildInfoPath; - buildInfo = hostBuildInfo; + buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); } else { var buildInfoText = host.readFile(buildInfoPath); if (!buildInfoText) return buildInfoPath; - buildInfo = getBuildInfo(buildInfoText); + buildInfo = getBuildInfo(buildInfoPath, buildInfoText); } + if (!buildInfo) + return buildInfoPath; if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts)) return buildInfoPath; var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath)); @@ -112289,6 +113093,10 @@ var ts; var nodeIdToGeneratedName; // Map of generated names for specific nodes. var autoGeneratedIdToGeneratedName; // Map of generated names for temp and loop variables. var generatedNames; // Set of names generated by the NameGenerator. + var formattedNameTempFlagsStack; + var formattedNameTempFlags; + var privateNameTempFlagsStack; // Stack of enclosing name generation scopes. + var privateNameTempFlags; // TempFlags for the current name generation scope. var tempFlagsStack; // Stack of enclosing name generation scopes. var tempFlags; // TempFlags for the current name generation scope. var reservedNamesStack; // Stack of TempFlags reserved in enclosing name generation scopes. @@ -112354,9 +113162,9 @@ var ts; break; } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: return printFile(node); - case 306 /* SyntaxKind.Bundle */: return printBundle(node); - case 307 /* SyntaxKind.UnparsedSource */: return printUnparsedSource(node); + case 308 /* SyntaxKind.SourceFile */: return printFile(node); + case 309 /* SyntaxKind.Bundle */: return printBundle(node); + case 310 /* SyntaxKind.UnparsedSource */: return printUnparsedSource(node); } writeNode(hint, node, sourceFile, beginPrint()); return endPrint(); @@ -112547,6 +113355,10 @@ var ts; nodeIdToGeneratedName = []; autoGeneratedIdToGeneratedName = []; generatedNames = new ts.Set(); + formattedNameTempFlagsStack = []; + formattedNameTempFlags = new ts.Map(); + privateNameTempFlagsStack = []; + privateNameTempFlags = 0 /* TempFlags.Auto */; tempFlagsStack = []; tempFlags = 0 /* TempFlags.Auto */; reservedNamesStack = []; @@ -112690,315 +113502,315 @@ var ts; return emitPrivateIdentifier(node); // Parse tree nodes // Names - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return emitQualifiedName(node); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return emitComputedPropertyName(node); // Signature elements - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return emitTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return emitParameter(node); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return emitDecorator(node); // Type members - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return emitPropertySignature(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return emitPropertyDeclaration(node); - case 168 /* SyntaxKind.MethodSignature */: + case 170 /* SyntaxKind.MethodSignature */: return emitMethodSignature(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return emitMethodDeclaration(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return emitClassStaticBlockDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return emitConstructor(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return emitAccessorDeclaration(node); - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: return emitCallSignature(node); - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return emitConstructSignature(node); - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return emitIndexSignature(node); // Types - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return emitTypePredicate(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return emitTypeReference(node); - case 179 /* SyntaxKind.FunctionType */: + case 181 /* SyntaxKind.FunctionType */: return emitFunctionType(node); - case 180 /* SyntaxKind.ConstructorType */: + case 182 /* SyntaxKind.ConstructorType */: return emitConstructorType(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return emitTypeQuery(node); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return emitTypeLiteral(node); - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return emitArrayType(node); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return emitTupleType(node); - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return emitOptionalType(node); // SyntaxKind.RestType is handled below - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return emitUnionType(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return emitIntersectionType(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return emitConditionalType(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return emitInferType(node); - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return emitParenthesizedType(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return emitThisType(); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return emitTypeOperator(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return emitIndexedAccessType(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return emitMappedType(node); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return emitLiteralType(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return emitNamedTupleMember(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return emitTemplateType(node); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: + case 201 /* SyntaxKind.TemplateLiteralTypeSpan */: return emitTemplateTypeSpan(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return emitImportTypeNode(node); // Binding patterns - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return emitBindingElement(node); // Misc - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return emitTemplateSpan(node); - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: return emitSemicolonClassElement(); // Statements - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return emitBlock(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return emitVariableStatement(node); - case 236 /* SyntaxKind.EmptyStatement */: + case 239 /* SyntaxKind.EmptyStatement */: return emitEmptyStatement(/*isEmbeddedStatement*/ false); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return emitExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return emitIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return emitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return emitWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return emitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return emitForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return emitForOfStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return emitContinueStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return emitBreakStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return emitReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return emitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return emitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return emitLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return emitThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return emitTryStatement(node); - case 253 /* SyntaxKind.DebuggerStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: return emitDebuggerStatement(node); // Declarations - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return emitVariableDeclaration(node); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return emitVariableDeclarationList(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return emitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return emitClassDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return emitEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return emitModuleDeclaration(node); - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return emitModuleBlock(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return emitCaseBlock(node); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return emitNamespaceExportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return emitImportDeclaration(node); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return emitImportClause(node); - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return emitNamespaceImport(node); - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: return emitNamespaceExport(node); - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: return emitNamedImports(node); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return emitImportSpecifier(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return emitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return emitExportDeclaration(node); - case 273 /* SyntaxKind.NamedExports */: + case 276 /* SyntaxKind.NamedExports */: return emitNamedExports(node); - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return emitExportSpecifier(node); - case 293 /* SyntaxKind.AssertClause */: + case 296 /* SyntaxKind.AssertClause */: return emitAssertClause(node); - case 294 /* SyntaxKind.AssertEntry */: + case 297 /* SyntaxKind.AssertEntry */: return emitAssertEntry(node); - case 276 /* SyntaxKind.MissingDeclaration */: + case 279 /* SyntaxKind.MissingDeclaration */: return; // Module references - case 277 /* SyntaxKind.ExternalModuleReference */: + case 280 /* SyntaxKind.ExternalModuleReference */: return emitExternalModuleReference(node); // JSX (non-expression) case 11 /* SyntaxKind.JsxText */: return emitJsxText(node); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 283 /* SyntaxKind.JsxOpeningFragment */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 286 /* SyntaxKind.JsxOpeningFragment */: return emitJsxOpeningElementOrFragment(node); - case 281 /* SyntaxKind.JsxClosingElement */: - case 284 /* SyntaxKind.JsxClosingFragment */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 287 /* SyntaxKind.JsxClosingFragment */: return emitJsxClosingElementOrFragment(node); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return emitJsxAttribute(node); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return emitJsxAttributes(node); - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: return emitJsxSpreadAttribute(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return emitJsxExpression(node); // Clauses - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return emitCaseClause(node); - case 290 /* SyntaxKind.DefaultClause */: + case 293 /* SyntaxKind.DefaultClause */: return emitDefaultClause(node); - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return emitHeritageClause(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return emitCatchClause(node); // Property assignments - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return emitPropertyAssignment(node); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return emitSpreadAssignment(node); // Enum - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return emitEnumMember(node); // Unparsed - case 300 /* SyntaxKind.UnparsedPrologue */: + case 303 /* SyntaxKind.UnparsedPrologue */: return writeUnparsedNode(node); - case 307 /* SyntaxKind.UnparsedSource */: - case 301 /* SyntaxKind.UnparsedPrepend */: + case 310 /* SyntaxKind.UnparsedSource */: + case 304 /* SyntaxKind.UnparsedPrepend */: return emitUnparsedSourceOrPrepend(node); - case 302 /* SyntaxKind.UnparsedText */: - case 303 /* SyntaxKind.UnparsedInternalText */: + case 305 /* SyntaxKind.UnparsedText */: + case 306 /* SyntaxKind.UnparsedInternalText */: return emitUnparsedTextLike(node); - case 304 /* SyntaxKind.UnparsedSyntheticReference */: + case 307 /* SyntaxKind.UnparsedSyntheticReference */: return emitUnparsedSyntheticReference(node); // Top-level nodes - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return emitSourceFile(node); - case 306 /* SyntaxKind.Bundle */: + case 309 /* SyntaxKind.Bundle */: return ts.Debug.fail("Bundles should be printed using printBundle"); // SyntaxKind.UnparsedSource (handled above) - case 308 /* SyntaxKind.InputFiles */: + case 311 /* SyntaxKind.InputFiles */: return ts.Debug.fail("InputFiles should not be printed"); // JSDoc nodes (only used in codefixes currently) - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return emitJSDocTypeExpression(node); - case 310 /* SyntaxKind.JSDocNameReference */: + case 313 /* SyntaxKind.JSDocNameReference */: return emitJSDocNameReference(node); - case 312 /* SyntaxKind.JSDocAllType */: + case 315 /* SyntaxKind.JSDocAllType */: return writePunctuation("*"); - case 313 /* SyntaxKind.JSDocUnknownType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return writePunctuation("?"); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return emitJSDocNullableType(node); - case 315 /* SyntaxKind.JSDocNonNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: return emitJSDocNonNullableType(node); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return emitJSDocOptionalType(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return emitJSDocFunctionType(node); - case 186 /* SyntaxKind.RestType */: - case 318 /* SyntaxKind.JSDocVariadicType */: + case 188 /* SyntaxKind.RestType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return emitRestOrJSDocVariadicType(node); - case 319 /* SyntaxKind.JSDocNamepathType */: + case 322 /* SyntaxKind.JSDocNamepathType */: return; - case 320 /* SyntaxKind.JSDoc */: + case 323 /* SyntaxKind.JSDoc */: return emitJSDoc(node); - case 322 /* SyntaxKind.JSDocTypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: return emitJSDocTypeLiteral(node); - case 323 /* SyntaxKind.JSDocSignature */: + case 326 /* SyntaxKind.JSDocSignature */: return emitJSDocSignature(node); - case 327 /* SyntaxKind.JSDocTag */: - case 332 /* SyntaxKind.JSDocClassTag */: - case 337 /* SyntaxKind.JSDocOverrideTag */: + case 330 /* SyntaxKind.JSDocTag */: + case 335 /* SyntaxKind.JSDocClassTag */: + case 340 /* SyntaxKind.JSDocOverrideTag */: return emitJSDocSimpleTag(node); - case 328 /* SyntaxKind.JSDocAugmentsTag */: - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return emitJSDocHeritageTag(node); - case 330 /* SyntaxKind.JSDocAuthorTag */: - case 331 /* SyntaxKind.JSDocDeprecatedTag */: + case 333 /* SyntaxKind.JSDocAuthorTag */: + case 334 /* SyntaxKind.JSDocDeprecatedTag */: return; // SyntaxKind.JSDocClassTag (see JSDocTag, above) - case 333 /* SyntaxKind.JSDocPublicTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 336 /* SyntaxKind.JSDocReadonlyTag */: + case 336 /* SyntaxKind.JSDocPublicTag */: + case 337 /* SyntaxKind.JSDocPrivateTag */: + case 338 /* SyntaxKind.JSDocProtectedTag */: + case 339 /* SyntaxKind.JSDocReadonlyTag */: return; - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return emitJSDocCallbackTag(node); // SyntaxKind.JSDocEnumTag (see below) - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return emitJSDocPropertyLikeTag(node); - case 339 /* SyntaxKind.JSDocEnumTag */: - case 341 /* SyntaxKind.JSDocReturnTag */: - case 342 /* SyntaxKind.JSDocThisTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: + case 345 /* SyntaxKind.JSDocThisTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return emitJSDocSimpleTypedTag(node); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return emitJSDocTemplateTag(node); - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return emitJSDocTypedefTag(node); - case 346 /* SyntaxKind.JSDocSeeTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: return emitJSDocSeeTag(node); // SyntaxKind.JSDocPropertyTag (see JSDocParameterTag, above) // Transformation nodes - case 349 /* SyntaxKind.NotEmittedStatement */: - case 353 /* SyntaxKind.EndOfDeclarationMarker */: - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 352 /* SyntaxKind.NotEmittedStatement */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return; } if (ts.isExpression(node)) { @@ -113030,85 +113842,87 @@ var ts; case 80 /* SyntaxKind.PrivateIdentifier */: return emitPrivateIdentifier(node); // Expressions - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return emitArrayLiteralExpression(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return emitObjectLiteralExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return emitPropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return emitElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return emitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return emitNewExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return emitTypeAssertionExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return emitParenthesizedExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return emitFunctionExpression(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return emitArrowFunction(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return emitDeleteExpression(node); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return emitTypeOfExpression(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return emitVoidExpression(node); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return emitAwaitExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return emitBinaryExpression(node); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return emitConditionalExpression(node); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return emitTemplateExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return emitYieldExpression(node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return emitSpreadElement(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return emitClassExpression(node); - case 227 /* SyntaxKind.OmittedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: return; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: return emitAsExpression(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return emitNonNullExpression(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 231 /* SyntaxKind.MetaProperty */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return emitSatisfiesExpression(node); + case 233 /* SyntaxKind.MetaProperty */: return emitMetaProperty(node); - case 232 /* SyntaxKind.SyntheticExpression */: + case 234 /* SyntaxKind.SyntheticExpression */: return ts.Debug.fail("SyntheticExpression should never be printed."); // JSX - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return emitJsxElement(node); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return emitJsxFragment(node); // Synthesized list - case 348 /* SyntaxKind.SyntaxList */: + case 351 /* SyntaxKind.SyntaxList */: return ts.Debug.fail("SyntaxList should not be printed"); // Transformation nodes - case 349 /* SyntaxKind.NotEmittedStatement */: + case 352 /* SyntaxKind.NotEmittedStatement */: return; - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return emitCommaList(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return; - case 354 /* SyntaxKind.SyntheticReferenceExpression */: + case 357 /* SyntaxKind.SyntheticReferenceExpression */: return ts.Debug.fail("SyntheticReferenceExpression should not be printed"); } } @@ -113156,7 +113970,7 @@ var ts; } function emitHelpers(node) { var helpersEmitted = false; - var bundle = node.kind === 306 /* SyntaxKind.Bundle */ ? node : undefined; + var bundle = node.kind === 309 /* SyntaxKind.Bundle */ ? node : undefined; if (bundle && moduleKind === ts.ModuleKind.None) { return; } @@ -113256,7 +114070,7 @@ var ts; var pos = getTextPosWithWriteLine(); writeUnparsedNode(unparsed); if (bundleFileInfo) { - updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 302 /* SyntaxKind.UnparsedText */ ? + updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 305 /* SyntaxKind.UnparsedText */ ? "text" /* BundleFileSectionKind.Text */ : "internal" /* BundleFileSectionKind.Internal */); } @@ -113293,7 +114107,7 @@ var ts; } function emitTabStop(hint, node, snippet) { // A tab stop should only be attached to an empty node, i.e. a node that doesn't emit any text. - ts.Debug.assert(node.kind === 236 /* SyntaxKind.EmptyStatement */, "A tab stop cannot be attached to a node of kind ".concat(ts.Debug.formatSyntaxKind(node.kind), ".")); + ts.Debug.assert(node.kind === 239 /* SyntaxKind.EmptyStatement */, "A tab stop cannot be attached to a node of kind ".concat(ts.Debug.formatSyntaxKind(node.kind), ".")); ts.Debug.assert(hint !== 5 /* EmitHint.EmbeddedStatement */, "A tab stop cannot be attached to an embedded statement."); nonEscapingWrite("$".concat(snippet.order)); } @@ -113354,7 +114168,7 @@ var ts; emit(node.dotDotDotToken); emitNodeWithWriter(node.name, writeParameter); emit(node.questionToken); - if (node.parent && node.parent.kind === 317 /* SyntaxKind.JSDocFunctionType */ && !node.name) { + if (node.parent && node.parent.kind === 320 /* SyntaxKind.JSDocFunctionType */ && !node.name) { emit(node.type); } else { @@ -113415,7 +114229,7 @@ var ts; } function emitAccessorDeclaration(node) { emitDecoratorsAndModifiers(node, node.modifiers); - writeKeyword(node.kind === 172 /* SyntaxKind.GetAccessor */ ? "get" : "set"); + writeKeyword(node.kind === 174 /* SyntaxKind.GetAccessor */ ? "get" : "set"); writeSpace(); emit(node.name); emitSignatureAndBody(node, emitSignatureHead); @@ -113588,7 +114402,7 @@ var ts; function emitTypeOperator(node) { writeTokenText(node.operator, writeKeyword); writeSpace(); - var parenthesizerRule = node.operator === 145 /* SyntaxKind.ReadonlyKeyword */ ? + var parenthesizerRule = node.operator === 146 /* SyntaxKind.ReadonlyKeyword */ ? parenthesizer.parenthesizeOperandOfReadonlyTypeOperator : parenthesizer.parenthesizeOperandOfTypeOperator; emit(node.type, parenthesizerRule); @@ -113611,7 +114425,7 @@ var ts; } if (node.readonlyToken) { emit(node.readonlyToken); - if (node.readonlyToken.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { + if (node.readonlyToken.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { writeKeyword("readonly"); } writeSpace(); @@ -113857,7 +114671,7 @@ var ts; emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } function emitAwaitExpression(node) { - emitTokenWithComment(132 /* SyntaxKind.AwaitKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(133 /* SyntaxKind.AwaitKeyword */, node.pos, writeKeyword, node); writeSpace(); emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } @@ -113882,7 +114696,7 @@ var ts; // expression a prefix increment whose operand is a plus expression - (++(+x)) // The same is true of minus of course. var operand = node.operand; - return operand.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ + return operand.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && ((node.operator === 39 /* SyntaxKind.PlusToken */ && (operand.operator === 39 /* SyntaxKind.PlusToken */ || operand.operator === 45 /* SyntaxKind.PlusPlusToken */)) || (node.operator === 40 /* SyntaxKind.MinusToken */ && (operand.operator === 40 /* SyntaxKind.MinusToken */ || operand.operator === 46 /* SyntaxKind.MinusMinusToken */))); } @@ -114030,6 +114844,15 @@ var ts; emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess); writeOperator("!"); } + function emitSatisfiesExpression(node) { + emitExpression(node.expression, /*parenthesizerRules*/ undefined); + if (node.type) { + writeSpace(); + writeKeyword("satisfies"); + writeSpace(); + emit(node.type); + } + } function emitMetaProperty(node) { writeToken(node.keywordToken, node.pos, writePunctuation); writePunctuation("."); @@ -114087,7 +114910,7 @@ var ts; if (node.elseStatement) { writeLineOrSpace(node, node.thenStatement, node.elseStatement); emitTokenWithComment(91 /* SyntaxKind.ElseKeyword */, node.thenStatement.end, writeKeyword, node); - if (node.elseStatement.kind === 239 /* SyntaxKind.IfStatement */) { + if (node.elseStatement.kind === 242 /* SyntaxKind.IfStatement */) { writeSpace(); emit(node.elseStatement); } @@ -114150,7 +114973,7 @@ var ts; emitTokenWithComment(20 /* SyntaxKind.OpenParenToken */, openParenPos, writePunctuation, node); emitForBinding(node.initializer); writeSpace(); - emitTokenWithComment(160 /* SyntaxKind.OfKeyword */, node.initializer.end, writeKeyword, node); + emitTokenWithComment(162 /* SyntaxKind.OfKeyword */, node.initializer.end, writeKeyword, node); writeSpace(); emitExpression(node.expression); emitTokenWithComment(21 /* SyntaxKind.CloseParenToken */, node.expression.end, writePunctuation, node); @@ -114158,7 +114981,7 @@ var ts; } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { emit(node); } else { @@ -114195,7 +115018,7 @@ var ts; } pos = writeTokenText(token, writer, pos); if (isSimilarNode && contextNode.end !== pos) { - var isJsxExprContext = contextNode.kind === 288 /* SyntaxKind.JsxExpression */; + var isJsxExprContext = contextNode.kind === 291 /* SyntaxKind.JsxExpression */; emitTrailingCommentsOfPosition(pos, /*prefixSpace*/ !isJsxExprContext, /*forceNoNewline*/ isJsxExprContext); } return pos; @@ -114505,7 +115328,7 @@ var ts; emitTokenWithComment(100 /* SyntaxKind.ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114530,7 +115353,7 @@ var ts; if (node.importClause) { emit(node.importClause); writeSpace(); - emitTokenWithComment(156 /* SyntaxKind.FromKeyword */, node.importClause.end, writeKeyword, node); + emitTokenWithComment(158 /* SyntaxKind.FromKeyword */, node.importClause.end, writeKeyword, node); writeSpace(); } emitExpression(node.moduleSpecifier); @@ -114541,7 +115364,7 @@ var ts; } function emitImportClause(node) { if (node.isTypeOnly) { - emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114554,7 +115377,7 @@ var ts; function emitNamespaceImport(node) { var asPos = emitTokenWithComment(41 /* SyntaxKind.AsteriskToken */, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -114580,10 +115403,11 @@ var ts; writeTrailingSemicolon(); } function emitExportDeclaration(node) { + emitModifiers(node, node.modifiers); var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - nextPos = emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, nextPos, writeKeyword, node); writeSpace(); } if (node.exportClause) { @@ -114595,7 +115419,7 @@ var ts; if (node.moduleSpecifier) { writeSpace(); var fromPos = node.exportClause ? node.exportClause.end : nextPos; - emitTokenWithComment(156 /* SyntaxKind.FromKeyword */, fromPos, writeKeyword, node); + emitTokenWithComment(158 /* SyntaxKind.FromKeyword */, fromPos, writeKeyword, node); writeSpace(); emitExpression(node.moduleSpecifier); } @@ -114605,7 +115429,7 @@ var ts; writeTrailingSemicolon(); } function emitAssertClause(node) { - emitTokenWithComment(129 /* SyntaxKind.AssertKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(130 /* SyntaxKind.AssertKeyword */, node.pos, writeKeyword, node); writeSpace(); var elements = node.elements; emitList(node, elements, 526226 /* ListFormat.ImportClauseEntries */); @@ -114625,9 +115449,9 @@ var ts; function emitNamespaceExportDeclaration(node) { var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, nextPos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(142 /* SyntaxKind.NamespaceKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(143 /* SyntaxKind.NamespaceKeyword */, nextPos, writeKeyword, node); writeSpace(); emit(node.name); writeTrailingSemicolon(); @@ -114635,7 +115459,7 @@ var ts; function emitNamespaceExport(node) { var asPos = emitTokenWithComment(41 /* SyntaxKind.AsteriskToken */, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -114658,7 +115482,7 @@ var ts; if (node.propertyName) { emit(node.propertyName); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, node.propertyName.end, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, node.propertyName.end, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114879,7 +115703,7 @@ var ts; } } if (node.tags) { - if (node.tags.length === 1 && node.tags[0].kind === 343 /* SyntaxKind.JSDocTypeTag */ && !node.comment) { + if (node.tags.length === 1 && node.tags[0].kind === 346 /* SyntaxKind.JSDocTypeTag */ && !node.comment) { writeSpace(); emit(node.tags[0]); } @@ -114924,7 +115748,7 @@ var ts; function emitJSDocTypedefTag(tag) { emitJSDocTagName(tag.tagName); if (tag.typeExpression) { - if (tag.typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */) { + if (tag.typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */) { emitJSDocTypeExpression(tag.typeExpression); } else { @@ -114943,7 +115767,7 @@ var ts; emit(tag.fullName); } emitJSDocComment(tag.comment); - if (tag.typeExpression && tag.typeExpression.kind === 322 /* SyntaxKind.JSDocTypeLiteral */) { + if (tag.typeExpression && tag.typeExpression.kind === 325 /* SyntaxKind.JSDocTypeLiteral */) { emitJSDocTypeLiteral(tag.typeExpression); } } @@ -115876,13 +116700,13 @@ var ts; && (!currentSourceFile || ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile)); } function skipSynthesizedParentheses(node) { - while (node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { + while (node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; } function getTextOfNode(node, includeTrivia) { - if (ts.isGeneratedIdentifier(node)) { + if (ts.isGeneratedIdentifier(node) || ts.isGeneratedPrivateIdentifier(node)) { return generateName(node); } if (ts.isStringLiteral(node) && node.textSourceNode) { @@ -115906,7 +116730,7 @@ var ts; function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) { if (node.kind === 10 /* SyntaxKind.StringLiteral */ && node.textSourceNode) { var textSourceNode = node.textSourceNode; - if (ts.isIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) { + if (ts.isIdentifier(textSourceNode) || ts.isPrivateIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) { var text = ts.isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode(textSourceNode); return jsxAttributeEscape ? "\"".concat(ts.escapeJsxAttributeString(text), "\"") : neverAsciiEscape || (ts.getEmitFlags(node) & 16777216 /* EmitFlags.NoAsciiEscaping */) ? "\"".concat(ts.escapeString(text), "\"") : @@ -115930,7 +116754,11 @@ var ts; return; } tempFlagsStack.push(tempFlags); - tempFlags = 0; + tempFlags = 0 /* TempFlags.Auto */; + privateNameTempFlagsStack.push(privateNameTempFlags); + privateNameTempFlags = 0 /* TempFlags.Auto */; + formattedNameTempFlagsStack.push(formattedNameTempFlags); + formattedNameTempFlags = undefined; reservedNamesStack.push(reservedNames); } /** @@ -115941,6 +116769,8 @@ var ts; return; } tempFlags = tempFlagsStack.pop(); + privateNameTempFlags = privateNameTempFlagsStack.pop(); + formattedNameTempFlags = formattedNameTempFlagsStack.pop(); reservedNames = reservedNamesStack.pop(); } function reserveNameInNestedScopes(name) { @@ -115953,84 +116783,84 @@ var ts; if (!node) return; switch (node.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: ts.forEach(node.statements, generateNames); break; - case 250 /* SyntaxKind.LabeledStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 253 /* SyntaxKind.LabeledStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: generateNames(node.statement); break; - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: generateNames(node.thenStatement); generateNames(node.elseStatement); break; - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: generateNames(node.initializer); generateNames(node.statement); break; - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: generateNames(node.caseBlock); break; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: ts.forEach(node.clauses, generateNames); break; - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: ts.forEach(node.statements, generateNames); break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: generateNames(node.tryBlock); generateNames(node.catchClause); generateNames(node.finallyBlock); break; - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: generateNames(node.variableDeclaration); generateNames(node.block); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: generateNames(node.declarationList); break; - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: ts.forEach(node.declarations, generateNames); break; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: generateNameIfNeeded(node.name); break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: generateNameIfNeeded(node.name); if (ts.getEmitFlags(node) & 524288 /* EmitFlags.ReuseTempVariableScope */) { ts.forEach(node.parameters, generateNames); generateNames(node.body); } break; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: ts.forEach(node.elements, generateNames); break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: generateNames(node.importClause); break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: generateNameIfNeeded(node.name); generateNames(node.namedBindings); break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: generateNameIfNeeded(node.name); break; - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: generateNameIfNeeded(node.name); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: ts.forEach(node.elements, generateNames); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: generateNameIfNeeded(node.propertyName || node.name); break; } @@ -116039,19 +116869,19 @@ var ts; if (!node) return; switch (node.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: generateNameIfNeeded(node.name); break; } } function generateNameIfNeeded(name) { if (name) { - if (ts.isGeneratedIdentifier(name)) { + if (ts.isGeneratedIdentifier(name) || ts.isGeneratedPrivateIdentifier(name)) { generateName(name); } else if (ts.isBindingPattern(name)) { @@ -116066,7 +116896,7 @@ var ts; if ((name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) === 4 /* GeneratedIdentifierFlags.Node */) { // Node names generate unique names based on their original node // and are cached based on that node's id. - return generateNameCached(getNodeForGeneratedName(name), name.autoGenerateFlags); + return generateNameCached(ts.getNodeForGeneratedName(name), ts.isPrivateIdentifier(name), name.autoGenerateFlags, name.autoGeneratePrefix, name.autoGenerateSuffix); } else { // Auto, Loop, and Unique names are cached based on their unique @@ -116075,9 +116905,9 @@ var ts; return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = makeName(name)); } } - function generateNameCached(node, flags) { + function generateNameCached(node, privateName, flags, prefix, suffix) { var nodeId = ts.getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, flags)); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, privateName, flags !== null && flags !== void 0 ? flags : 0 /* GeneratedIdentifierFlags.None */, ts.formatGeneratedNamePart(prefix, generateName), ts.formatGeneratedNamePart(suffix))); } /** * Returns a value indicating whether a name is unique globally, within the current file, @@ -116109,20 +116939,53 @@ var ts; } return true; } + function getTempFlags(formattedNameKey) { + var _a; + switch (formattedNameKey) { + case "": + return tempFlags; + case "#": + return privateNameTempFlags; + default: + return (_a = formattedNameTempFlags === null || formattedNameTempFlags === void 0 ? void 0 : formattedNameTempFlags.get(formattedNameKey)) !== null && _a !== void 0 ? _a : 0 /* TempFlags.Auto */; + } + } + function setTempFlags(formattedNameKey, flags) { + switch (formattedNameKey) { + case "": + tempFlags = flags; + break; + case "#": + privateNameTempFlags = flags; + break; + default: + formattedNameTempFlags !== null && formattedNameTempFlags !== void 0 ? formattedNameTempFlags : (formattedNameTempFlags = new ts.Map()); + formattedNameTempFlags.set(formattedNameKey, flags); + break; + } + } /** * Return the next available name in the pattern _a ... _z, _0, _1, ... * TempFlags._i or TempFlags._n may be used to express a preference for that dedicated name. * Note that names generated by makeTempVariableName and makeUniqueName will never conflict. */ - function makeTempVariableName(flags, reservedInNestedScopes) { + function makeTempVariableName(flags, reservedInNestedScopes, privateName, prefix, suffix) { + if (prefix.length > 0 && prefix.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + prefix = prefix.slice(1); + } + // Generate a key to use to acquire a TempFlags counter based on the fixed portions of the generated name. + var key = ts.formatGeneratedName(privateName, prefix, "", suffix); + var tempFlags = getTempFlags(key); if (flags && !(tempFlags & flags)) { var name = flags === 268435456 /* TempFlags._i */ ? "_i" : "_n"; - if (isUniqueName(name)) { + var fullName = ts.formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { tempFlags |= flags; if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } while (true) { @@ -116133,11 +116996,13 @@ var ts; var name = count < 26 ? "_" + String.fromCharCode(97 /* CharacterCodes.a */ + count) : "_" + (count - 26); - if (isUniqueName(name)) { + var fullName = ts.formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } } @@ -116149,17 +117014,24 @@ var ts; * makeUniqueName are guaranteed to never conflict. * If `optimistic` is set, the first instance will use 'baseName' verbatim instead of 'baseName_1' */ - function makeUniqueName(baseName, checkFn, optimistic, scoped) { + function makeUniqueName(baseName, checkFn, optimistic, scoped, privateName, prefix, suffix) { if (checkFn === void 0) { checkFn = isUniqueName; } + if (baseName.length > 0 && baseName.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + baseName = baseName.slice(1); + } + if (prefix.length > 0 && prefix.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + prefix = prefix.slice(1); + } if (optimistic) { - if (checkFn(baseName)) { + var fullName = ts.formatGeneratedName(privateName, prefix, baseName, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(baseName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(baseName); + generatedNames.add(fullName); } - return baseName; + return fullName; } } // Find the first unique 'name_n', where n is a positive number @@ -116168,21 +117040,21 @@ var ts; } var i = 1; while (true) { - var generatedName = baseName + i; - if (checkFn(generatedName)) { + var fullName = ts.formatGeneratedName(privateName, prefix, baseName + i, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(generatedName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(generatedName); + generatedNames.add(fullName); } - return generatedName; + return fullName; } i++; } } function makeFileLevelOptimisticUniqueName(name) { - return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true); + return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a ModuleDeclaration or EnumDeclaration. @@ -116190,7 +117062,7 @@ var ts; function generateNameForModuleOrEnum(node) { var name = getTextOfNode(node.name); // Use module/enum name itself if it is unique, otherwise make a unique variation - return isUniqueLocalName(name, node) ? name : makeUniqueName(name); + return isUniqueLocalName(name, node) ? name : makeUniqueName(name, isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for an ImportDeclaration or ExportDeclaration. @@ -116199,89 +117071,76 @@ var ts; var expr = ts.getExternalModuleName(node); // TODO: GH#18217 var baseName = ts.isStringLiteral(expr) ? ts.makeIdentifierFromModuleName(expr.text) : "module"; - return makeUniqueName(baseName); + return makeUniqueName(baseName, isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a default export. */ function generateNameForExportDefault() { - return makeUniqueName("default"); + return makeUniqueName("default", isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a class expression. */ function generateNameForClassExpression() { - return makeUniqueName("class"); + return makeUniqueName("class", isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } - function generateNameForMethodOrAccessor(node) { + function generateNameForMethodOrAccessor(node, privateName, prefix, suffix) { if (ts.isIdentifier(node.name)) { - return generateNameCached(node.name); + return generateNameCached(node.name, privateName); } - return makeTempVariableName(0 /* TempFlags.Auto */); + return makeTempVariableName(0 /* TempFlags.Auto */, /*reservedInNestedScopes*/ false, privateName, prefix, suffix); } /** * Generates a unique name from a node. */ - function generateNameForNode(node, flags) { + function generateNameForNode(node, privateName, flags, prefix, suffix) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(flags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 80 /* SyntaxKind.PrivateIdentifier */: + return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(flags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), privateName, prefix, suffix); + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForModuleOrEnum(node); - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForImportOrExportDeclaration(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForExportDefault(); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForClassExpression(); - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return generateNameForMethodOrAccessor(node); - case 162 /* SyntaxKind.ComputedPropertyName */: - return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ true); + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return generateNameForMethodOrAccessor(node, privateName, prefix, suffix); + case 164 /* SyntaxKind.ComputedPropertyName */: + return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ true, privateName, prefix, suffix); default: - return makeTempVariableName(0 /* TempFlags.Auto */); + return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ false, privateName, prefix, suffix); } } /** * Generates a unique identifier for a node. */ function makeName(name) { + var prefix = ts.formatGeneratedNamePart(name.autoGeneratePrefix, generateName); + var suffix = ts.formatGeneratedNamePart(name.autoGenerateSuffix); switch (name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) { case 1 /* GeneratedIdentifierFlags.Auto */: - return makeTempVariableName(0 /* TempFlags.Auto */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + return makeTempVariableName(0 /* TempFlags.Auto */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), ts.isPrivateIdentifier(name), prefix, suffix); case 2 /* GeneratedIdentifierFlags.Loop */: - return makeTempVariableName(268435456 /* TempFlags._i */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + ts.Debug.assertNode(name, ts.isIdentifier); + return makeTempVariableName(268435456 /* TempFlags._i */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), /*privateName*/ false, prefix, suffix); case 3 /* GeneratedIdentifierFlags.Unique */: - return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32 /* GeneratedIdentifierFlags.FileLevel */) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32 /* GeneratedIdentifierFlags.FileLevel */) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), ts.isPrivateIdentifier(name), prefix, suffix); } - return ts.Debug.fail("Unsupported GeneratedIdentifierKind."); - } - /** - * Gets the node from which a name should be generated. - */ - function getNodeForGeneratedName(name) { - var autoGenerateId = name.autoGenerateId; - var node = name; - var original = node.original; - while (original) { - node = original; - // if "node" is a different generated name (having a different - // "autoGenerateId"), use it and stop traversing. - if (ts.isIdentifier(node) - && !!(node.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) - && node.autoGenerateId !== autoGenerateId) { - break; - } - original = node.original; - } - // otherwise, return the original node for the source; - return node; + return ts.Debug.fail("Unsupported GeneratedIdentifierKind: ".concat(ts.Debug.formatEnum(name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */, ts.GeneratedIdentifierFlags, /*isFlags*/ true), ".")); } // Comments function pipelineEmitWithComments(hint, node) { @@ -116327,7 +117186,7 @@ var ts; // Emit leading comments if the position is not synthesized and the node // has not opted out from emitting leading comments. if (!skipLeadingComments) { - emitLeadingComments(pos, /*isEmittedNode*/ node.kind !== 349 /* SyntaxKind.NotEmittedStatement */); + emitLeadingComments(pos, /*isEmittedNode*/ node.kind !== 352 /* SyntaxKind.NotEmittedStatement */); } if (!skipLeadingComments || (pos >= 0 && (emitFlags & 512 /* EmitFlags.NoLeadingComments */) !== 0)) { // Advance the container position if comments get emitted or if they've been disabled explicitly using NoLeadingComments. @@ -116338,7 +117197,7 @@ var ts; containerEnd = end; // To avoid invalid comment emit in a down-level binding pattern, we // keep track of the last declaration list container's end - if (node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { declarationListContainerEnd = end; } } @@ -116357,7 +117216,7 @@ var ts; declarationListContainerEnd = savedDeclarationListContainerEnd; // Emit trailing comments if the position is not synthesized and the node // has not opted out from emitting leading comments and is an emitted node. - if (!skipTrailingComments && node.kind !== 349 /* SyntaxKind.NotEmittedStatement */) { + if (!skipTrailingComments && node.kind !== 352 /* SyntaxKind.NotEmittedStatement */) { emitTrailingComments(end); } } @@ -116638,7 +117497,7 @@ var ts; } else { var source = sourceMapRange.source || sourceMapSource; - if (node.kind !== 349 /* SyntaxKind.NotEmittedStatement */ + if (node.kind !== 352 /* SyntaxKind.NotEmittedStatement */ && (emitFlags & 16 /* EmitFlags.NoLeadingSourceMap */) === 0 && sourceMapRange.pos >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, skipSourceTrivia(source, sourceMapRange.pos)); @@ -116656,7 +117515,7 @@ var ts; if (emitFlags & 64 /* EmitFlags.NoNestedSourceMaps */) { sourceMapsDisabled = false; } - if (node.kind !== 349 /* SyntaxKind.NotEmittedStatement */ + if (node.kind !== 352 /* SyntaxKind.NotEmittedStatement */ && (emitFlags & 32 /* EmitFlags.NoTrailingSourceMap */) === 0 && sourceMapRange.end >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, sourceMapRange.end); @@ -116821,7 +117680,16 @@ var ts; return cachedReadDirectoryResult.get(ts.ensureTrailingDirectorySeparator(rootDirPath)); } function getCachedFileSystemEntriesForBaseDir(path) { - return getCachedFileSystemEntries(ts.getDirectoryPath(path)); + var entries = getCachedFileSystemEntries(ts.getDirectoryPath(path)); + if (!entries) { + return entries; + } + // If we're looking for the base directory, we're definitely going to search the entries + if (!entries.sortedAndCanonicalizedFiles) { + entries.sortedAndCanonicalizedFiles = entries.files.map(getCanonicalFileName).sort(); + entries.sortedAndCanonicalizedDirectories = entries.directories.map(getCanonicalFileName).sort(); + } + return entries; } function getBaseNameOfFileName(fileName) { return ts.getBaseFileName(ts.normalizePath(fileName)); @@ -116864,21 +117732,10 @@ var ts; return undefined; } } - function fileNameEqual(name1, name2) { - return getCanonicalFileName(name1) === getCanonicalFileName(name2); - } function hasEntry(entries, name) { - return ts.some(entries, function (file) { return fileNameEqual(file, name); }); - } - function updateFileSystemEntry(entries, baseName, isValid) { - if (hasEntry(entries, baseName)) { - if (!isValid) { - return ts.filterMutate(entries, function (entry) { return !fileNameEqual(entry, baseName); }); - } - } - else if (isValid) { - return entries.push(baseName); - } + // Case-sensitive comparison since already canonicalized + var index = ts.binarySearch(entries, name, ts.identity, ts.compareStringsCaseSensitive); + return index >= 0; } function writeFile(fileName, data, writeByteOrderMark) { var path = toPath(fileName); @@ -116891,7 +117748,7 @@ var ts; function fileExists(fileName) { var path = toPath(fileName); var result = getCachedFileSystemEntriesForBaseDir(path); - return result && hasEntry(result.files, getBaseNameOfFileName(fileName)) || + return result && hasEntry(result.sortedAndCanonicalizedFiles, getCanonicalFileName(getBaseNameOfFileName(fileName))) || host.fileExists(fileName); } function directoryExists(dirPath) { @@ -116901,9 +117758,14 @@ var ts; function createDirectory(dirPath) { var path = toPath(dirPath); var result = getCachedFileSystemEntriesForBaseDir(path); - var baseFileName = getBaseNameOfFileName(dirPath); if (result) { - updateFileSystemEntry(result.directories, baseFileName, /*isValid*/ true); + var baseName = getBaseNameOfFileName(dirPath); + var canonicalizedBaseName = getCanonicalFileName(baseName); + var canonicalizedDirectories = result.sortedAndCanonicalizedDirectories; + // Case-sensitive comparison since already canonicalized + if (ts.insertSorted(canonicalizedDirectories, canonicalizedBaseName, ts.compareStringsCaseSensitive)) { + result.directories.push(baseName); + } } host.createDirectory(dirPath); } @@ -116972,7 +117834,7 @@ var ts; fileExists: host.fileExists(fileOrDirectoryPath), directoryExists: host.directoryExists(fileOrDirectoryPath) }; - if (fsQueryResult.directoryExists || hasEntry(parentResult.directories, baseName)) { + if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) { // Folder added or removed, clear the cache instead of updating the folder and its structure clearCache(); } @@ -116992,7 +117854,23 @@ var ts; } } function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists) { - updateFileSystemEntry(parentResult.files, baseName, fileExists); + var canonicalizedFiles = parentResult.sortedAndCanonicalizedFiles; + var canonicalizedBaseName = getCanonicalFileName(baseName); + if (fileExists) { + // Case-sensitive comparison since already canonicalized + if (ts.insertSorted(canonicalizedFiles, canonicalizedBaseName, ts.compareStringsCaseSensitive)) { + parentResult.files.push(baseName); + } + } + else { + // Case-sensitive comparison since already canonicalized + var sortedIndex = ts.binarySearch(canonicalizedFiles, canonicalizedBaseName, ts.identity, ts.compareStringsCaseSensitive); + if (sortedIndex >= 0) { + canonicalizedFiles.splice(sortedIndex, 1); + var unsortedIndex = parentResult.files.findIndex(function (entry) { return getCanonicalFileName(entry) === canonicalizedBaseName; }); + parentResult.files.splice(unsortedIndex, 1); + } + } } function clearCache() { cachedReadDirectoryResult.clear(); @@ -117752,7 +118630,6 @@ var ts; return resolutions; } ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache; - ; /** * Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly * provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file. @@ -118057,7 +118934,7 @@ var ts; state.failedLookupLocations = packageJsonLocations; state.affectingLocations = packageJsonLocations; var packageJsonScope = ts.getPackageScopeForPath(fileName, state); - var impliedNodeFormat = (packageJsonScope === null || packageJsonScope === void 0 ? void 0 : packageJsonScope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS; + var impliedNodeFormat = (packageJsonScope === null || packageJsonScope === void 0 ? void 0 : packageJsonScope.contents.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS; return { impliedNodeFormat: impliedNodeFormat, packageJsonLocations: packageJsonLocations, packageJsonScope: packageJsonScope }; } } @@ -119297,22 +120174,22 @@ var ts; // Return directly from the case if the given node doesnt want to visit each child // Otherwise break to visit each child switch (parent.kind) { - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: if (parent.questionToken === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?")); return "skip"; } // falls through - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 257 /* SyntaxKind.VariableDeclaration */: // type annotation if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_annotations_can_only_be_used_in_TypeScript_files)); @@ -119320,65 +120197,68 @@ var ts; } } switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "import type")); return "skip"; } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "export type")); return "skip"; } break; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, ts.isImportSpecifier(node) ? "import...type" : "export...type")); return "skip"; } break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_TypeScript_files)); return "skip"; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: var heritageClause = node; if (heritageClause.token === 117 /* SyntaxKind.ImplementsKeyword */) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: var interfaceKeyword = ts.tokenToString(118 /* SyntaxKind.InterfaceKeyword */); ts.Debug.assertIsDefined(interfaceKeyword); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, interfaceKeyword)); return "skip"; - case 261 /* SyntaxKind.ModuleDeclaration */: - var moduleKeyword = node.flags & 16 /* NodeFlags.Namespace */ ? ts.tokenToString(142 /* SyntaxKind.NamespaceKeyword */) : ts.tokenToString(141 /* SyntaxKind.ModuleKeyword */); + case 264 /* SyntaxKind.ModuleDeclaration */: + var moduleKeyword = node.flags & 16 /* NodeFlags.Namespace */ ? ts.tokenToString(143 /* SyntaxKind.NamespaceKeyword */) : ts.tokenToString(142 /* SyntaxKind.ModuleKeyword */); ts.Debug.assertIsDefined(moduleKeyword); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, moduleKeyword)); return "skip"; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files)); return "skip"; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: var enumKeyword = ts.Debug.checkDefined(ts.tokenToString(92 /* SyntaxKind.EnumKeyword */)); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, enumKeyword)); return "skip"; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Non_null_assertions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_assertion_expressions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files)); + return "skip"; + case 213 /* SyntaxKind.TypeAssertionExpression */: ts.Debug.fail(); // Won't parse these in a JS file anyway, as they are interpreted as JSX. } } @@ -119387,53 +120267,55 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning)); } switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: // Check type parameters if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files)); return "skip"; } // falls through - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // Check modifiers if (nodes === parent.modifiers) { - checkModifiers(parent.modifiers, parent.kind === 237 /* SyntaxKind.VariableStatement */); + checkModifiers(parent.modifiers, parent.kind === 240 /* SyntaxKind.VariableStatement */); return "skip"; } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // Check modifiers of property declaration if (nodes === parent.modifiers) { for (var _i = 0, _a = nodes; _i < _a.length; _i++) { var modifier = _a[_i]; - if (ts.isModifier(modifier) && modifier.kind !== 124 /* SyntaxKind.StaticKeyword */) { + if (ts.isModifier(modifier) + && modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ + && modifier.kind !== 127 /* SyntaxKind.AccessorKeyword */) { diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind))); } } return "skip"; } break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Check modifiers of parameter declaration if (nodes === parent.modifiers && ts.some(nodes, ts.isModifier)) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Parameter_modifiers_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // Check type arguments if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_arguments_can_only_be_used_in_TypeScript_files)); @@ -119455,18 +120337,19 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind))); break; // These are all legal modifiers. case 124 /* SyntaxKind.StaticKeyword */: case 93 /* SyntaxKind.ExportKeyword */: case 88 /* SyntaxKind.DefaultKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: } } } @@ -119788,7 +120671,7 @@ var ts; // It's a _little odd_ that we can't set `impliedNodeFormat` until the program step - but it's the first and only time we have a resolution cache // and a freshly made source file node on hand at the same time, and we need both to set the field. Persisting the resolution cache all the way // to the check and emit steps would be bad - so we much prefer detecting and storing the format information on the source file node upfront. - var result = getImpliedNodeFormatForFileWorker(toPath(fileName), moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options); + var result = getImpliedNodeFormatForFileWorker(ts.getNormalizedAbsolutePath(fileName, currentDirectory), moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options); var languageVersion = ts.getEmitScriptTarget(options); var setExternalModuleIndicator = ts.getSetExternalModuleIndicator(options); return typeof result === "object" ? __assign(__assign({}, result), { languageVersion: languageVersion, setExternalModuleIndicator: setExternalModuleIndicator }) : @@ -120391,10 +121274,12 @@ var ts; if (options.preserveConstEnums === false) { createDiagnosticForOptionName(ts.Diagnostics.Option_preserveConstEnums_cannot_be_disabled_when_isolatedModules_is_enabled, "preserveConstEnums", "isolatedModules"); } - var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !ts.isSourceFileJS(f) && !f.isDeclarationFile && f.scriptKind !== 6 /* ScriptKind.JSON */; }); - if (firstNonExternalModuleSourceFile) { - var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(firstNonExternalModuleSourceFile.fileName))); + for (var _a = 0, files_5 = files; _a < files_5.length; _a++) { + var file = files_5[_a]; + if (!ts.isExternalModule(file) && !ts.isSourceFileJS(file) && !file.isDeclarationFile && file.scriptKind !== 6 /* ScriptKind.JSON */) { + var span = ts.getErrorSpanForNode(file, file); + programDiagnostics.add(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(file.fileName))); + } } } else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 /* ScriptTarget.ES2015 */ && options.module === ts.ModuleKind.None) { @@ -124121,7 +125006,7 @@ var ts; }); // Sort by paths closest to importing file Name directory var sortedPaths = []; - var _loop_35 = function (directory) { + var _loop_36 = function (directory) { var directoryStart = ts.ensureTrailingDirectorySeparator(directory); var pathsInDirectory; allFileNames.forEach(function (_a, fileName) { @@ -124145,9 +125030,9 @@ var ts; }; var out_directory_1; for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) { - var state_11 = _loop_35(directory); + var state_12 = _loop_36(directory); directory = out_directory_1; - if (state_11 === "break") + if (state_12 === "break") break; } if (allFileNames.size) { @@ -124216,7 +125101,7 @@ var ts; } function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) { for (var key in paths) { - var _loop_36 = function (patternText_1) { + var _loop_37 = function (patternText_1) { var pattern = ts.normalizePath(patternText_1); var indexOfStar = pattern.indexOf("*"); // In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly, @@ -124283,9 +125168,9 @@ var ts; }; for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) { var patternText_1 = _a[_i]; - var state_12 = _loop_36(patternText_1); - if (typeof state_12 === "object") - return state_12.value; + var state_13 = _loop_37(patternText_1); + if (typeof state_13 === "object") + return state_13.value; } } function validateEnding(_a) { @@ -124449,7 +125334,7 @@ var ts; var maybeBlockedByTypesVersions = false; var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath); if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) { - var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath)); + var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath)); var importMode = overrideMode || importingSourceFile.impliedNodeFormat; if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) { var conditions = ["node", importMode === ts.ModuleKind.ESNext ? "import" : "require", "types"]; @@ -124811,7 +125696,7 @@ var ts; case ts.ModuleKind.CommonJS: if (file.packageJsonScope) { (result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages( - /*details*/ undefined, file.packageJsonScope.packageJsonContent.type ? + /*details*/ undefined, file.packageJsonScope.contents.packageJsonContent.type ? ts.Diagnostics.File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module : ts.Diagnostics.File_is_CommonJS_module_because_0_does_not_have_field_type, toFileName(ts.last(file.packageJsonLocations), fileNameConvertor))); } @@ -125230,18 +126115,14 @@ var ts; if (host.getBuildInfo) { // host provides buildinfo, get it from there. This allows host to cache it buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath); - if (!buildInfo) - return undefined; } else { var content = host.readFile(buildInfoPath); if (!content) return undefined; - buildInfo = ts.getBuildInfo(content); + buildInfo = ts.getBuildInfo(buildInfoPath, content); } - if (buildInfo.version !== ts.version) - return undefined; - if (!buildInfo.program) + if (!buildInfo || buildInfo.version !== ts.version || !buildInfo.program) return undefined; return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host); } @@ -125463,7 +126344,8 @@ var ts; } // All resolutions are invalid if user provided resolutions var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution); - if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + 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 (hasChangedConfigFileParsingErrors) { if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); @@ -125482,6 +126364,11 @@ var ts; if (host.afterProgramCreate && program !== builderProgram) { host.afterProgramCreate(builderProgram); } + compilerHost.readFile = originalReadFile; + compilerHost.fileExists = originalFileExists; + compilerHost.directoryExists = originalDirectoryExists; + compilerHost.createDirectory = originalCreateDirectory; + compilerHost.writeFile = originalWriteFile; return builderProgram; } function createNewProgram(hasInvalidatedResolution) { @@ -125959,19 +126846,20 @@ var ts; */ UpToDateStatusType[UpToDateStatusType["OutOfDateWithPrepend"] = 3] = "OutOfDateWithPrepend"; UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing"; - UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf"; - UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream"; - UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo"; - UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate"; - UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked"; - UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream"; - UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate"; - UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText"; + UpToDateStatusType[UpToDateStatusType["ErrorReadingFile"] = 5] = "ErrorReadingFile"; + UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 6] = "OutOfDateWithSelf"; + UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 7] = "OutOfDateWithUpstream"; + UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 8] = "OutOfDateBuildInfo"; + UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 9] = "UpstreamOutOfDate"; + UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 10] = "UpstreamBlocked"; + UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 11] = "ComputingUpstream"; + UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 12] = "TsVersionOutputOfDate"; + UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 13] = "UpToDateWithInputFileText"; /** * Projects with no outputs (i.e. "solution" files) */ - UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly"; - UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild"; + UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 14] = "ContainerOnly"; + UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 15] = "ForceBuild"; })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {})); function resolveConfigFileProjectName(project) { if (ts.fileExtensionIs(project, ".json" /* Extension.Json */)) { @@ -126189,6 +127077,7 @@ var ts; if (value) { return isParsedCommandLine(value) ? value : undefined; } + ts.performance.mark("SolutionBuilder::beforeConfigFileParsing"); var diagnostic; var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host; var parsed; @@ -126203,6 +127092,8 @@ var ts; parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop; } configFileCache.set(configFilePath, parsed || diagnostic); + ts.performance.mark("SolutionBuilder::afterConfigFileParsing"); + ts.performance.measure("SolutionBuilder::Config file parsing", "SolutionBuilder::beforeConfigFileParsing", "SolutionBuilder::afterConfigFileParsing"); return parsed; } function resolveProjectName(state, name) { @@ -126402,6 +127293,7 @@ var ts; if (updateOutputFileStampsPending) { updateOutputTimestamps(state, config, projectPath); } + ts.performance.mark("SolutionBuilder::Timestamps only updates"); return doneInvalidatedProject(state, projectPath); } }; @@ -126495,6 +127387,10 @@ var ts; }; function done(cancellationToken, writeFile, customTransformers) { executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers); + if (kind === InvalidatedProjectKind.Build) + ts.performance.mark("SolutionBuilder::Projects built"); + else + ts.performance.mark("SolutionBuilder::Bundles updated"); return doneInvalidatedProject(state, projectPath); } function withProgramOrUndefined(action) { @@ -126673,13 +127569,13 @@ var ts; var emitterDiagnostics = ts.createDiagnosticCollection(); var emittedOutputs = new ts.Map(); var resultFlags = BuildResultFlags.DeclarationOutputUnchanged; - var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo; + var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo || undefined; outputFiles.forEach(function (_a) { var _b, _c; var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo; emittedOutputs.set(toPath(state, name), name); if (buildInfo) { - if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { + if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo === null || existingBuildInfo === void 0 ? void 0 : existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged; } setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags); @@ -126972,8 +127868,7 @@ var ts; return existing.buildInfo || undefined; } var value = state.readFileWithCache(buildInfoPath); - var buildInfo = value ? ts.getBuildInfo(value) : undefined; - ts.Debug.assert(modifiedTime || !buildInfo); + var buildInfo = value ? ts.getBuildInfo(buildInfoPath, value) : undefined; state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime }); return buildInfo; } @@ -127058,7 +127953,14 @@ var ts; missingOutputFileName: buildInfoPath }; } - var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime)); + var buildInfo = getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime); + if (!buildInfo) { + // Error reading buildInfo + return { + type: ts.UpToDateStatusType.ErrorReadingFile, + fileName: buildInfoPath + }; + } if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) { return { type: ts.UpToDateStatusType.TsVersionOutputOfDate, @@ -127243,7 +128145,10 @@ var ts; if (prior !== undefined) { return prior; } + ts.performance.mark("SolutionBuilder::beforeUpToDateCheck"); var actual = getUpToDateStatusWorker(state, project, resolvedPath); + ts.performance.mark("SolutionBuilder::afterUpToDateCheck"); + ts.performance.measure("SolutionBuilder::Up-to-date check", "SolutionBuilder::beforeUpToDateCheck", "SolutionBuilder::afterUpToDateCheck"); state.projectStatus.set(resolvedPath, actual); return actual; } @@ -127381,6 +128286,13 @@ var ts; } } function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { + ts.performance.mark("SolutionBuilder::beforeBuild"); + var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences); + ts.performance.mark("SolutionBuilder::afterBuild"); + ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + return result; + } + function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { var buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ts.ExitStatus.InvalidProject_OutputsSkipped; @@ -127408,6 +128320,13 @@ var ts; : ts.ExitStatus.DiagnosticsPresent_OutputsSkipped; } function clean(state, project, onlyReferences) { + ts.performance.mark("SolutionBuilder::beforeClean"); + var result = cleanWorker(state, project, onlyReferences); + ts.performance.mark("SolutionBuilder::afterClean"); + ts.performance.measure("SolutionBuilder::Clean", "SolutionBuilder::beforeClean", "SolutionBuilder::afterClean"); + return result; + } + function cleanWorker(state, project, onlyReferences) { var buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ts.ExitStatus.InvalidProject_OutputsSkipped; @@ -127481,6 +128400,14 @@ var ts; state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected); } function buildNextInvalidatedProject(state, changeDetected) { + ts.performance.mark("SolutionBuilder::beforeBuild"); + var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected); + ts.performance.mark("SolutionBuilder::afterBuild"); + ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + if (buildOrder) + reportErrorSummary(state, buildOrder); + } + function buildNextInvalidatedProjectWorker(state, changeDetected) { state.timerToBuildInvalidatedProject = undefined; if (state.reportFileChangeDetected) { state.reportFileChangeDetected = false; @@ -127513,7 +128440,7 @@ var ts; } } disableCache(state); - reportErrorSummary(state, buildOrder); + return buildOrder; } function watchConfigFile(state, resolved, resolvedPath, parsed) { if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath)) @@ -127568,6 +128495,7 @@ var ts; function startWatching(state, buildOrder) { if (!state.watchAllProjectsPending) return; + ts.performance.mark("SolutionBuilder::beforeWatcherCreation"); state.watchAllProjectsPending = false; for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) { var resolved = _a[_i]; @@ -127585,6 +128513,8 @@ var ts; watchPackageJsonFiles(state, resolved, resolvedPath, cfg); } } + ts.performance.mark("SolutionBuilder::afterWatcherCreation"); + ts.performance.measure("SolutionBuilder::Watcher creation", "SolutionBuilder::beforeWatcherCreation", "SolutionBuilder::afterWatcherCreation"); } function stopWatching(state) { ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher); @@ -127698,6 +128628,8 @@ var ts; return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_1_is_older_than_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerProjectName)); case ts.UpToDateStatusType.OutputMissing: return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relName(state, configFileName), relName(state, status.missingOutputFileName)); + case ts.UpToDateStatusType.ErrorReadingFile: + return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_there_was_error_reading_file_1, relName(state, configFileName), relName(state, status.fileName)); case ts.UpToDateStatusType.OutOfDateBuildInfo: return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted, relName(state, configFileName), relName(state, status.buildInfoFile)); case ts.UpToDateStatusType.UpToDate: @@ -128405,6 +129337,8 @@ var ts; * interface Y { foo:number; } */ ScriptElementKind["memberVariableElement"] = "property"; + /** class X { [public|private]* accessor foo: number; } */ + ScriptElementKind["memberAccessorVariableElement"] = "accessor"; /** * class X { constructor() { } } * class X { static { } } @@ -128537,37 +129471,37 @@ var ts; })(SemanticMeaning = ts.SemanticMeaning || (ts.SemanticMeaning = {})); function getMeaningFromDeclaration(node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.isInJSFile(node) && ts.getJSDocEnumTag(node) ? 7 /* SemanticMeaning.All */ : 1 /* SemanticMeaning.Value */; - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 292 /* SyntaxKind.CatchClause */: - case 285 /* SyntaxKind.JsxAttribute */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 295 /* SyntaxKind.CatchClause */: + case 288 /* SyntaxKind.JsxAttribute */: return 1 /* SemanticMeaning.Value */; - case 163 /* SyntaxKind.TypeParameter */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: + case 165 /* SyntaxKind.TypeParameter */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: return 2 /* SemanticMeaning.Type */; - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: // If it has no name node, it shares the name with the value declaration below it. return node.name === undefined ? 1 /* SemanticMeaning.Value */ | 2 /* SemanticMeaning.Type */ : 2 /* SemanticMeaning.Type */; - case 299 /* SyntaxKind.EnumMember */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 260 /* SyntaxKind.ClassDeclaration */: return 1 /* SemanticMeaning.Value */ | 2 /* SemanticMeaning.Type */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.isAmbientModule(node)) { return 4 /* SemanticMeaning.Namespace */ | 1 /* SemanticMeaning.Value */; } @@ -128577,16 +129511,16 @@ var ts; else { return 4 /* SemanticMeaning.Namespace */; } - case 260 /* SyntaxKind.EnumDeclaration */: - case 269 /* SyntaxKind.NamedImports */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 272 /* SyntaxKind.NamedImports */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: return 7 /* SemanticMeaning.All */; // An external module can be a Value - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 4 /* SemanticMeaning.Namespace */ | 1 /* SemanticMeaning.Value */; } return 7 /* SemanticMeaning.All */; @@ -128595,7 +129529,7 @@ var ts; function getMeaningFromLocation(node) { node = getAdjustedReferenceLocation(node); var parent = node.parent; - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return 1 /* SemanticMeaning.Value */; } else if (ts.isExportAssignment(parent) @@ -128638,11 +129572,11 @@ var ts; // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - var name = node.kind === 161 /* SyntaxKind.QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined; - return name && name.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ ? 7 /* SemanticMeaning.All */ : 4 /* SemanticMeaning.Namespace */; + var name = node.kind === 163 /* SyntaxKind.QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined; + return name && name.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? 7 /* SemanticMeaning.All */ : 4 /* SemanticMeaning.Namespace */; } function isInRightSideOfInternalImportEqualsDeclaration(node) { - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; @@ -128654,27 +129588,27 @@ var ts; function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 161 /* SyntaxKind.QualifiedName */) { - while (root.parent && root.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + if (root.parent.kind === 163 /* SyntaxKind.QualifiedName */) { + while (root.parent && root.parent.kind === 163 /* SyntaxKind.QualifiedName */) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 178 /* SyntaxKind.TypeReference */ && !isLastClause; + return root.parent.kind === 180 /* SyntaxKind.TypeReference */ && !isLastClause; } function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (root.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && root.parent.parent.kind === 291 /* SyntaxKind.HeritageClause */) { + if (!isLastClause && root.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && root.parent.parent.kind === 294 /* SyntaxKind.HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 257 /* SyntaxKind.ClassDeclaration */ && root.parent.parent.token === 117 /* SyntaxKind.ImplementsKeyword */) || - (decl.kind === 258 /* SyntaxKind.InterfaceDeclaration */ && root.parent.parent.token === 94 /* SyntaxKind.ExtendsKeyword */); + return (decl.kind === 260 /* SyntaxKind.ClassDeclaration */ && root.parent.parent.token === 117 /* SyntaxKind.ImplementsKeyword */) || + (decl.kind === 261 /* SyntaxKind.InterfaceDeclaration */ && root.parent.parent.token === 94 /* SyntaxKind.ExtendsKeyword */); } return false; } @@ -128685,15 +129619,15 @@ var ts; switch (node.kind) { case 108 /* SyntaxKind.ThisKeyword */: return !ts.isExpressionNode(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return true; } switch (node.parent.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return true; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return !node.parent.isTypeOf; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isPartOfTypeNode(node.parent); } return false; @@ -128760,7 +129694,7 @@ var ts; ts.climbPastPropertyOrElementAccess = climbPastPropertyOrElementAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 250 /* SyntaxKind.LabeledStatement */ && referenceNode.label.escapedText === labelName) { + if (referenceNode.kind === 253 /* SyntaxKind.LabeledStatement */ && referenceNode.label.escapedText === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -128821,22 +129755,22 @@ var ts; ts.isNameOfFunctionDeclaration = isNameOfFunctionDeclaration; function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { switch (node.parent.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 299 /* SyntaxKind.EnumMember */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 302 /* SyntaxKind.EnumMember */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.getNameOfDeclaration(node.parent) === node; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return node.parent.argumentExpression === node; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return true; - case 196 /* SyntaxKind.LiteralType */: - return node.parent.parent.kind === 194 /* SyntaxKind.IndexedAccessType */; + case 198 /* SyntaxKind.LiteralType */: + return node.parent.parent.kind === 196 /* SyntaxKind.IndexedAccessType */; default: return false; } @@ -128860,17 +129794,17 @@ var ts; return undefined; } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return node; } } @@ -128878,56 +129812,56 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return ts.isExternalModule(node) ? "module" /* ScriptElementKind.moduleElement */ : "script" /* ScriptElementKind.scriptElement */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return "module" /* ScriptElementKind.moduleElement */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return "class" /* ScriptElementKind.classElement */; - case 258 /* SyntaxKind.InterfaceDeclaration */: return "interface" /* ScriptElementKind.interfaceElement */; - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return "interface" /* ScriptElementKind.interfaceElement */; + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return "type" /* ScriptElementKind.typeElement */; - case 260 /* SyntaxKind.EnumDeclaration */: return "enum" /* ScriptElementKind.enumElement */; - case 254 /* SyntaxKind.VariableDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return "enum" /* ScriptElementKind.enumElement */; + case 257 /* SyntaxKind.VariableDeclaration */: return getKindOfVariableDeclaration(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return "function" /* ScriptElementKind.functionElement */; - case 172 /* SyntaxKind.GetAccessor */: return "getter" /* ScriptElementKind.memberGetAccessorElement */; - case 173 /* SyntaxKind.SetAccessor */: return "setter" /* ScriptElementKind.memberSetAccessorElement */; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: return "getter" /* ScriptElementKind.memberGetAccessorElement */; + case 175 /* SyntaxKind.SetAccessor */: return "setter" /* ScriptElementKind.memberSetAccessorElement */; + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return "method" /* ScriptElementKind.memberFunctionElement */; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: var initializer = node.initializer; return ts.isFunctionLike(initializer) ? "method" /* ScriptElementKind.memberFunctionElement */ : "property" /* ScriptElementKind.memberVariableElement */; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return "property" /* ScriptElementKind.memberVariableElement */; - case 176 /* SyntaxKind.IndexSignature */: return "index" /* ScriptElementKind.indexSignatureElement */; - case 175 /* SyntaxKind.ConstructSignature */: return "construct" /* ScriptElementKind.constructSignatureElement */; - case 174 /* SyntaxKind.CallSignature */: return "call" /* ScriptElementKind.callSignatureElement */; - case 171 /* SyntaxKind.Constructor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: return "index" /* ScriptElementKind.indexSignatureElement */; + case 177 /* SyntaxKind.ConstructSignature */: return "construct" /* ScriptElementKind.constructSignatureElement */; + case 176 /* SyntaxKind.CallSignature */: return "call" /* ScriptElementKind.callSignatureElement */; + case 173 /* SyntaxKind.Constructor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return "constructor" /* ScriptElementKind.constructorImplementationElement */; - case 163 /* SyntaxKind.TypeParameter */: return "type parameter" /* ScriptElementKind.typeParameterElement */; - case 299 /* SyntaxKind.EnumMember */: return "enum member" /* ScriptElementKind.enumMemberElement */; - case 164 /* SyntaxKind.Parameter */: return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) ? "property" /* ScriptElementKind.memberVariableElement */ : "parameter" /* ScriptElementKind.parameterElement */; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: - case 274 /* SyntaxKind.NamespaceExport */: + case 165 /* SyntaxKind.TypeParameter */: return "type parameter" /* ScriptElementKind.typeParameterElement */; + case 302 /* SyntaxKind.EnumMember */: return "enum member" /* ScriptElementKind.enumMemberElement */; + case 166 /* SyntaxKind.Parameter */: return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) ? "property" /* ScriptElementKind.memberVariableElement */ : "parameter" /* ScriptElementKind.parameterElement */; + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: + case 277 /* SyntaxKind.NamespaceExport */: return "alias" /* ScriptElementKind.alias */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var kind = ts.getAssignmentDeclarationKind(node); var right = node.right; switch (kind) { @@ -128956,7 +129890,7 @@ var ts; } case 79 /* SyntaxKind.Identifier */: return ts.isImportClause(node.parent) ? "alias" /* ScriptElementKind.alias */ : "" /* ScriptElementKind.unknown */; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: var scriptKind = getNodeKind(node.expression); // If the expression didn't come back with something (like it does for an identifiers) return scriptKind === "" /* ScriptElementKind.unknown */ ? "const" /* ScriptElementKind.constElement */ : scriptKind; @@ -128979,7 +129913,7 @@ var ts; return true; case 79 /* SyntaxKind.Identifier */: // 'this' as a parameter - return ts.identifierIsThisKeyword(node) && node.parent.kind === 164 /* SyntaxKind.Parameter */; + return ts.identifierIsThisKeyword(node) && node.parent.kind === 166 /* SyntaxKind.Parameter */; default: return false; } @@ -129044,42 +129978,42 @@ var ts; return false; } switch (n.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 182 /* SyntaxKind.TypeLiteral */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - case 263 /* SyntaxKind.CaseBlock */: - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 184 /* SyntaxKind.TypeLiteral */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: + case 266 /* SyntaxKind.CaseBlock */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return nodeEndsWith(n, 19 /* SyntaxKind.CloseBraceToken */, sourceFile); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return isCompletedNode(n.block, sourceFile); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: if (!n.arguments) { return true; } // falls through - case 208 /* SyntaxKind.CallExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 191 /* SyntaxKind.ParenthesizedType */: + case 210 /* SyntaxKind.CallExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 193 /* SyntaxKind.ParenthesizedType */: return nodeEndsWith(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return isCompletedNode(n.type, sourceFile); - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 214 /* SyntaxKind.ArrowFunction */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 216 /* SyntaxKind.ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -129089,65 +130023,65 @@ var ts; // Even though type parameters can be unclosed, we can get away with // having at least a closing paren. return hasChildOfKind(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return !!n.body && isCompletedNode(n.body, sourceFile); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 26 /* SyntaxKind.SemicolonToken */, sourceFile); - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 162 /* SyntaxKind.ComputedPropertyName */: - case 184 /* SyntaxKind.TupleType */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 164 /* SyntaxKind.ComputedPropertyName */: + case 186 /* SyntaxKind.TupleType */: return nodeEndsWith(n, 23 /* SyntaxKind.CloseBracketToken */, sourceFile); - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 23 /* SyntaxKind.CloseBracketToken */, sourceFile); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed return false; - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; return hasChildOfKind(n, 115 /* SyntaxKind.WhileKeyword */, sourceFile) ? nodeEndsWith(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile) : isCompletedNode(n.statement, sourceFile); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 216 /* SyntaxKind.TypeOfExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 224 /* SyntaxKind.YieldExpression */: - case 225 /* SyntaxKind.SpreadElement */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 226 /* SyntaxKind.YieldExpression */: + case 227 /* SyntaxKind.SpreadElement */: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 272 /* SyntaxKind.ExportDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.nodeIsPresent(n.moduleSpecifier); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -129272,13 +130206,13 @@ var ts; function getAdjustedLocationForDeclaration(node, forRename) { if (!forRename) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return getAdjustedLocationForClass(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return getAdjustedLocationForFunction(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return node; } } @@ -129373,11 +130307,11 @@ var ts; node.kind === 98 /* SyntaxKind.FunctionKeyword */ ? ts.isFunctionDeclaration(parent) || ts.isFunctionExpression(node) : node.kind === 118 /* SyntaxKind.InterfaceKeyword */ ? ts.isInterfaceDeclaration(parent) : node.kind === 92 /* SyntaxKind.EnumKeyword */ ? ts.isEnumDeclaration(parent) : - node.kind === 152 /* SyntaxKind.TypeKeyword */ ? ts.isTypeAliasDeclaration(parent) : - node.kind === 142 /* SyntaxKind.NamespaceKeyword */ || node.kind === 141 /* SyntaxKind.ModuleKeyword */ ? ts.isModuleDeclaration(parent) : + node.kind === 154 /* SyntaxKind.TypeKeyword */ ? ts.isTypeAliasDeclaration(parent) : + node.kind === 143 /* SyntaxKind.NamespaceKeyword */ || node.kind === 142 /* SyntaxKind.ModuleKeyword */ ? ts.isModuleDeclaration(parent) : node.kind === 100 /* SyntaxKind.ImportKeyword */ ? ts.isImportEqualsDeclaration(parent) : - node.kind === 136 /* SyntaxKind.GetKeyword */ ? ts.isGetAccessorDeclaration(parent) : - node.kind === 149 /* SyntaxKind.SetKeyword */ && ts.isSetAccessorDeclaration(parent)) { + node.kind === 137 /* SyntaxKind.GetKeyword */ ? ts.isGetAccessorDeclaration(parent) : + node.kind === 151 /* SyntaxKind.SetKeyword */ && ts.isSetAccessorDeclaration(parent)) { var location = getAdjustedLocationForDeclaration(parent, forRename); if (location) { return location; @@ -129391,7 +130325,7 @@ var ts; return decl.name; } } - if (node.kind === 152 /* SyntaxKind.TypeKeyword */) { + if (node.kind === 154 /* SyntaxKind.TypeKeyword */) { // import /**/type [|name|] from ...; // import /**/type { [|name|] } from ...; // import /**/type { propertyName as [|name|] } from ...; @@ -129417,7 +130351,7 @@ var ts; // import * /**/as [|name|] ... // export { propertyName /**/as [|name|] } ... // export * /**/as [|name|] ... - if (node.kind === 127 /* SyntaxKind.AsKeyword */) { + if (node.kind === 128 /* SyntaxKind.AsKeyword */) { if (ts.isImportSpecifier(parent) && parent.propertyName || ts.isExportSpecifier(parent) && parent.propertyName || ts.isNamespaceImport(parent) || @@ -129458,12 +130392,12 @@ var ts; } } // import name = /**/require("[|module|]"); - if (node.kind === 146 /* SyntaxKind.RequireKeyword */ && ts.isExternalModuleReference(parent)) { + if (node.kind === 147 /* SyntaxKind.RequireKeyword */ && ts.isExternalModuleReference(parent)) { return parent.expression; } // import ... /**/from "[|module|]"; // export ... /**/from "[|module|]"; - if (node.kind === 156 /* SyntaxKind.FromKeyword */ && (ts.isImportDeclaration(parent) || ts.isExportDeclaration(parent)) && parent.moduleSpecifier) { + if (node.kind === 158 /* SyntaxKind.FromKeyword */ && (ts.isImportDeclaration(parent) || ts.isExportDeclaration(parent)) && parent.moduleSpecifier) { return parent.moduleSpecifier; } // class ... /**/extends [|name|] ... @@ -129488,7 +130422,7 @@ var ts; } } // ... T extends /**/infer [|U|] ? ... - if (node.kind === 137 /* SyntaxKind.InferKeyword */ && ts.isInferTypeNode(parent)) { + if (node.kind === 138 /* SyntaxKind.InferKeyword */ && ts.isInferTypeNode(parent)) { return parent.typeParameter.name; } // { [ [|K|] /**/in keyof T]: ... } @@ -129496,12 +130430,12 @@ var ts; return parent.name; } // /**/keyof [|T|] - if (node.kind === 140 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 140 /* SyntaxKind.KeyOfKeyword */ && + if (node.kind === 141 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 141 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeReferenceNode(parent.type)) { return parent.type.typeName; } // /**/readonly [|name|][] - if (node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 145 /* SyntaxKind.ReadonlyKeyword */ && + if (node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isArrayTypeNode(parent.type) && ts.isTypeReferenceNode(parent.type.elementType)) { return parent.type.elementType.typeName; } @@ -129519,7 +130453,7 @@ var ts; if (node.kind === 103 /* SyntaxKind.NewKeyword */ && ts.isNewExpression(parent) || node.kind === 114 /* SyntaxKind.VoidKeyword */ && ts.isVoidExpression(parent) || node.kind === 112 /* SyntaxKind.TypeOfKeyword */ && ts.isTypeOfExpression(parent) || - node.kind === 132 /* SyntaxKind.AwaitKeyword */ && ts.isAwaitExpression(parent) || + node.kind === 133 /* SyntaxKind.AwaitKeyword */ && ts.isAwaitExpression(parent) || node.kind === 125 /* SyntaxKind.YieldKeyword */ && ts.isYieldExpression(parent) || node.kind === 89 /* SyntaxKind.DeleteKeyword */ && ts.isDeleteExpression(parent)) { if (parent.expression) { @@ -129532,13 +130466,13 @@ var ts; return ts.skipOuterExpressions(parent.right); } // left /**/as [|name|] - if (node.kind === 127 /* SyntaxKind.AsKeyword */ && ts.isAsExpression(parent) && ts.isTypeReferenceNode(parent.type)) { + if (node.kind === 128 /* SyntaxKind.AsKeyword */ && ts.isAsExpression(parent) && ts.isTypeReferenceNode(parent.type)) { return parent.type.typeName; } // for (... /**/in [|name|]) // for (... /**/of [|name|]) if (node.kind === 101 /* SyntaxKind.InKeyword */ && ts.isForInStatement(parent) || - node.kind === 160 /* SyntaxKind.OfKeyword */ && ts.isForOfStatement(parent)) { + node.kind === 162 /* SyntaxKind.OfKeyword */ && ts.isForOfStatement(parent)) { return ts.skipOuterExpressions(parent.expression); } } @@ -129770,7 +130704,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 305 /* SyntaxKind.SourceFile */ || n.kind === 1 /* SyntaxKind.EndOfFileToken */ || ts.isJSDocCommentContainingNode(n)); + ts.Debug.assert(startNode !== undefined || n.kind === 308 /* SyntaxKind.SourceFile */ || n.kind === 1 /* SyntaxKind.EndOfFileToken */ || ts.isJSDocCommentContainingNode(n)); // Here we know that none of child token nodes embrace the position, // the only known case is when position is at the end of the file. // Try to find the rightmost token in the file without filtering. @@ -129801,7 +130735,7 @@ var ts; for (var i = exclusiveStartPosition - 1; i >= 0; i--) { var child = children[i]; if (isWhiteSpaceOnlyJsxText(child)) { - if (i === 0 && (parentKind === 11 /* SyntaxKind.JsxText */ || parentKind === 279 /* SyntaxKind.JsxSelfClosingElement */)) { + if (i === 0 && (parentKind === 11 /* SyntaxKind.JsxText */ || parentKind === 282 /* SyntaxKind.JsxSelfClosingElement */)) { ts.Debug.fail("`JsxText` tokens should not be the first child of `JsxElement | JsxSelfClosingElement`"); } } @@ -129845,17 +130779,17 @@ var ts; return true; } //
{ |
or
- if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 288 /* SyntaxKind.JsxExpression */) { + if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 291 /* SyntaxKind.JsxExpression */) { return true; } //
{ // | // } < /div> - if (token && token.kind === 19 /* SyntaxKind.CloseBraceToken */ && token.parent.kind === 288 /* SyntaxKind.JsxExpression */) { + if (token && token.kind === 19 /* SyntaxKind.CloseBraceToken */ && token.parent.kind === 291 /* SyntaxKind.JsxExpression */) { return true; } //
|
- if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 281 /* SyntaxKind.JsxClosingElement */) { + if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 284 /* SyntaxKind.JsxClosingElement */) { return true; } return false; @@ -129886,7 +130820,7 @@ var ts; function isInsideJsxElement(sourceFile, position) { function isInsideJsxElementTraversal(node) { while (node) { - if (node.kind >= 279 /* SyntaxKind.JsxSelfClosingElement */ && node.kind <= 288 /* SyntaxKind.JsxExpression */ + if (node.kind >= 282 /* SyntaxKind.JsxSelfClosingElement */ && node.kind <= 291 /* SyntaxKind.JsxExpression */ || node.kind === 11 /* SyntaxKind.JsxText */ || node.kind === 29 /* SyntaxKind.LessThanToken */ || node.kind === 31 /* SyntaxKind.GreaterThanToken */ @@ -129896,7 +130830,7 @@ var ts; || node.kind === 43 /* SyntaxKind.SlashToken */) { node = node.parent; } - else if (node.kind === 278 /* SyntaxKind.JsxElement */) { + else if (node.kind === 281 /* SyntaxKind.JsxElement */) { if (position > node.getStart(sourceFile)) return true; node = node.parent; @@ -130044,7 +130978,7 @@ var ts; // falls through case 112 /* SyntaxKind.TypeOfKeyword */: case 94 /* SyntaxKind.ExtendsKeyword */: - case 140 /* SyntaxKind.KeyOfKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: case 24 /* SyntaxKind.DotToken */: case 51 /* SyntaxKind.BarToken */: case 57 /* SyntaxKind.QuestionToken */: @@ -130065,7 +130999,7 @@ var ts; /** * Returns true if the cursor at position in sourceFile is within a comment. * - * @param tokenAtPosition Must equal `getTokenAtPosition(sourceFile, position) + * @param tokenAtPosition Must equal `getTokenAtPosition(sourceFile, position)` * @param predicate Additional predicate to test on the comment range. */ function isInComment(sourceFile, position, tokenAtPosition) { @@ -130096,7 +131030,7 @@ var ts; result.push("public" /* ScriptElementKindModifier.publicMemberModifier */); if (flags & 32 /* ModifierFlags.Static */ || ts.isClassStaticBlockDeclaration(node)) result.push("static" /* ScriptElementKindModifier.staticModifier */); - if (flags & 128 /* ModifierFlags.Abstract */) + if (flags & 256 /* ModifierFlags.Abstract */) result.push("abstract" /* ScriptElementKindModifier.abstractModifier */); if (flags & 1 /* ModifierFlags.Export */) result.push("export" /* ScriptElementKindModifier.exportedModifier */); @@ -130104,16 +131038,16 @@ var ts; result.push("deprecated" /* ScriptElementKindModifier.deprecatedModifier */); if (node.flags & 16777216 /* NodeFlags.Ambient */) result.push("declare" /* ScriptElementKindModifier.ambientModifier */); - if (node.kind === 271 /* SyntaxKind.ExportAssignment */) + if (node.kind === 274 /* SyntaxKind.ExportAssignment */) result.push("export" /* ScriptElementKindModifier.exportedModifier */); return result.length > 0 ? result.join(",") : "" /* ScriptElementKindModifier.none */; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 210 /* SyntaxKind.CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return node.typeParameters; } return undefined; @@ -130158,18 +131092,18 @@ var ts; } ts.cloneCompilerOptions = cloneCompilerOptions; function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || - node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || + node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // [a,b,c] from: // [a, b, c] = someExpression; - if (node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + if (node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && node.parent.left === node && node.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { return true; } // [a, b, c] from: // for([a, b, c] of expression) - if (node.parent.kind === 244 /* SyntaxKind.ForOfStatement */ && + if (node.parent.kind === 247 /* SyntaxKind.ForOfStatement */ && node.parent.initializer === node) { return true; } @@ -130177,7 +131111,7 @@ var ts; // [x, [a, b, c] ] = someExpression // or // {x, a: {a, b, c} } = someExpression - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ ? node.parent.parent : node.parent)) { return true; } } @@ -130239,32 +131173,32 @@ var ts; } ts.createTextChange = createTextChange; ts.typeKeywords = [ - 130 /* SyntaxKind.AnyKeyword */, - 128 /* SyntaxKind.AssertsKeyword */, - 158 /* SyntaxKind.BigIntKeyword */, - 133 /* SyntaxKind.BooleanKeyword */, + 131 /* SyntaxKind.AnyKeyword */, + 129 /* SyntaxKind.AssertsKeyword */, + 160 /* SyntaxKind.BigIntKeyword */, + 134 /* SyntaxKind.BooleanKeyword */, 95 /* SyntaxKind.FalseKeyword */, - 137 /* SyntaxKind.InferKeyword */, - 140 /* SyntaxKind.KeyOfKeyword */, - 143 /* SyntaxKind.NeverKeyword */, + 138 /* SyntaxKind.InferKeyword */, + 141 /* SyntaxKind.KeyOfKeyword */, + 144 /* SyntaxKind.NeverKeyword */, 104 /* SyntaxKind.NullKeyword */, - 147 /* SyntaxKind.NumberKeyword */, - 148 /* SyntaxKind.ObjectKeyword */, - 145 /* SyntaxKind.ReadonlyKeyword */, - 150 /* SyntaxKind.StringKeyword */, - 151 /* SyntaxKind.SymbolKeyword */, + 148 /* SyntaxKind.NumberKeyword */, + 149 /* SyntaxKind.ObjectKeyword */, + 146 /* SyntaxKind.ReadonlyKeyword */, + 152 /* SyntaxKind.StringKeyword */, + 153 /* SyntaxKind.SymbolKeyword */, 110 /* SyntaxKind.TrueKeyword */, 114 /* SyntaxKind.VoidKeyword */, - 153 /* SyntaxKind.UndefinedKeyword */, - 154 /* SyntaxKind.UniqueKeyword */, - 155 /* SyntaxKind.UnknownKeyword */, + 155 /* SyntaxKind.UndefinedKeyword */, + 156 /* SyntaxKind.UniqueKeyword */, + 157 /* SyntaxKind.UnknownKeyword */, ]; function isTypeKeyword(kind) { return ts.contains(ts.typeKeywords, kind); } ts.isTypeKeyword = isTypeKeyword; function isTypeKeywordToken(node) { - return node.kind === 152 /* SyntaxKind.TypeKeyword */; + return node.kind === 154 /* SyntaxKind.TypeKeyword */; } ts.isTypeKeywordToken = isTypeKeywordToken; function isTypeKeywordTokenOrIdentifier(node) { @@ -130301,7 +131235,7 @@ var ts; } ts.skipConstraint = skipConstraint; function getNameFromPropertyName(name) { - return name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + return name.kind === 164 /* SyntaxKind.ComputedPropertyName */ // treat computed property names where expression is string/numeric literal as just string/numeric literal ? ts.isStringOrNumericLiteralLike(name.expression) ? name.expression.text : undefined : ts.isPrivateIdentifier(name) ? ts.idText(name) : ts.getTextOfIdentifierOrLiteral(name); @@ -130451,7 +131385,7 @@ var ts; ts.findModifier = findModifier; function insertImports(changes, sourceFile, imports, blankLineBetween) { var decl = ts.isArray(imports) ? imports[0] : imports; - var importKindPredicate = decl.kind === 237 /* SyntaxKind.VariableStatement */ ? ts.isRequireVariableStatement : ts.isAnyImportSyntax; + var importKindPredicate = decl.kind === 240 /* SyntaxKind.VariableStatement */ ? ts.isRequireVariableStatement : ts.isAnyImportSyntax; var existingImportStatements = ts.filter(sourceFile.statements, importKindPredicate); var sortedNewImports = ts.isArray(imports) ? ts.stableSort(imports, ts.OrganizeImports.compareImportsOrRequireStatements) : [imports]; if (!existingImportStatements.length) { @@ -131125,15 +132059,15 @@ var ts; function getContextualTypeFromParent(node, checker) { var parent = node.parent; switch (parent.kind) { - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return checker.getContextualType(parent); - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var _a = parent, left = _a.left, operatorToken = _a.operatorToken, right = _a.right; return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node); } - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return parent.expression === node ? getSwitchedType(parent, checker) : undefined; default: return checker.getContextualType(node); @@ -131163,8 +132097,8 @@ var ts; switch (node.kind) { case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return true; default: return false; @@ -131198,38 +132132,38 @@ var ts; } ts.getTypeNodeIfAccessible = getTypeNodeIfAccessible; function syntaxRequiresTrailingCommaOrSemicolonOrASI(kind) { - return kind === 174 /* SyntaxKind.CallSignature */ - || kind === 175 /* SyntaxKind.ConstructSignature */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 168 /* SyntaxKind.MethodSignature */; + return kind === 176 /* SyntaxKind.CallSignature */ + || kind === 177 /* SyntaxKind.ConstructSignature */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 170 /* SyntaxKind.MethodSignature */; } function syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI(kind) { - return kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function syntaxRequiresTrailingModuleBlockOrSemicolonOrASI(kind) { - return kind === 261 /* SyntaxKind.ModuleDeclaration */; + return kind === 264 /* SyntaxKind.ModuleDeclaration */; } function syntaxRequiresTrailingSemicolonOrASI(kind) { - return kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 238 /* SyntaxKind.ExpressionStatement */ - || kind === 240 /* SyntaxKind.DoStatement */ - || kind === 245 /* SyntaxKind.ContinueStatement */ - || kind === 246 /* SyntaxKind.BreakStatement */ - || kind === 247 /* SyntaxKind.ReturnStatement */ - || kind === 251 /* SyntaxKind.ThrowStatement */ - || kind === 253 /* SyntaxKind.DebuggerStatement */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */; + return kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 241 /* SyntaxKind.ExpressionStatement */ + || kind === 243 /* SyntaxKind.DoStatement */ + || kind === 248 /* SyntaxKind.ContinueStatement */ + || kind === 249 /* SyntaxKind.BreakStatement */ + || kind === 250 /* SyntaxKind.ReturnStatement */ + || kind === 254 /* SyntaxKind.ThrowStatement */ + || kind === 256 /* SyntaxKind.DebuggerStatement */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */; } ts.syntaxRequiresTrailingSemicolonOrASI = syntaxRequiresTrailingSemicolonOrASI; ts.syntaxMayBeASICandidate = ts.or(syntaxRequiresTrailingCommaOrSemicolonOrASI, syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI, syntaxRequiresTrailingModuleBlockOrSemicolonOrASI, syntaxRequiresTrailingSemicolonOrASI); @@ -131259,7 +132193,7 @@ var ts; return false; } // See comment in parser’s `parseDoStatement` - if (node.kind === 240 /* SyntaxKind.DoStatement */) { + if (node.kind === 243 /* SyntaxKind.DoStatement */) { return true; } var topNode = ts.findAncestor(node, function (ancestor) { return !ancestor.parent; }); @@ -131863,14 +132797,16 @@ var ts; search: function (importingFile, preferCapitalized, matches, action) { if (importingFile !== usableByFileName) return; - exportInfo.forEach(function (info, key) { + return ts.forEachEntry(exportInfo, function (info, key) { var _a = parseKey(key), symbolName = _a.symbolName, ambientModuleName = _a.ambientModuleName; var name = preferCapitalized && info[0].capitalizedSymbolName || symbolName; if (matches(name, info[0].targetFlags)) { var rehydrated = info.map(rehydrateCachedInfo); var filtered = rehydrated.filter(function (r, i) { return isNotShadowedByDeeperNodeModulesPackage(r, info[i].packageName); }); if (filtered.length) { - action(filtered, name, !!ambientModuleName, key); + var res = action(filtered, name, !!ambientModuleName, key); + if (res !== undefined) + return res; } } }); @@ -132258,11 +133194,11 @@ var ts; angleBracketStack--; } break; - case 130 /* SyntaxKind.AnyKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: if (angleBracketStack > 0 && !syntacticClassifierAbsent) { // If it looks like we're could be in something generic, don't classify this // as a keyword. We may just get overwritten by the syntactic classifier, @@ -132451,10 +133387,11 @@ var ts; return true; } switch (keyword2) { - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - case 134 /* SyntaxKind.ConstructorKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: return true; // Allow things like "public get", "public constructor" and "public static". default: return false; // Any other keyword following "public" is actually an identifier, not a real keyword. @@ -132501,7 +133438,8 @@ var ts; case 33 /* SyntaxKind.GreaterThanEqualsToken */: case 102 /* SyntaxKind.InstanceOfKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: + case 150 /* SyntaxKind.SatisfiesKeyword */: case 34 /* SyntaxKind.EqualsEqualsToken */: case 35 /* SyntaxKind.ExclamationEqualsToken */: case 36 /* SyntaxKind.EqualsEqualsEqualsToken */: @@ -132597,13 +133535,13 @@ var ts; // That means we're calling back into the host around every 1.2k of the file we process. // Lib.d.ts has similar numbers. switch (kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } } @@ -132825,46 +133763,46 @@ var ts; pos = tag.tagName.end; var commentStart = tag.tagName.end; switch (tag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: var param = tag; processJSDocParameterTag(param); commentStart = param.isNameFirst && ((_a = param.typeExpression) === null || _a === void 0 ? void 0 : _a.end) || param.name.end; break; - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: var prop = tag; commentStart = prop.isNameFirst && ((_b = prop.typeExpression) === null || _b === void 0 ? void 0 : _b.end) || prop.name.end; break; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: processJSDocTemplateTag(tag); pos = tag.end; commentStart = tag.typeParameters.end; break; - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: var type = tag; - commentStart = ((_c = type.typeExpression) === null || _c === void 0 ? void 0 : _c.kind) === 309 /* SyntaxKind.JSDocTypeExpression */ && ((_d = type.fullName) === null || _d === void 0 ? void 0 : _d.end) || ((_e = type.typeExpression) === null || _e === void 0 ? void 0 : _e.end) || commentStart; + commentStart = ((_c = type.typeExpression) === null || _c === void 0 ? void 0 : _c.kind) === 312 /* SyntaxKind.JSDocTypeExpression */ && ((_d = type.fullName) === null || _d === void 0 ? void 0 : _d.end) || ((_e = type.typeExpression) === null || _e === void 0 ? void 0 : _e.end) || commentStart; break; - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: commentStart = tag.typeExpression.end; break; - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: processElement(tag.typeExpression); pos = tag.end; commentStart = tag.typeExpression.end; break; - case 342 /* SyntaxKind.JSDocThisTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 345 /* SyntaxKind.JSDocThisTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: commentStart = tag.typeExpression.end; break; - case 341 /* SyntaxKind.JSDocReturnTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: processElement(tag.typeExpression); pos = tag.end; commentStart = ((_f = tag.typeExpression) === null || _f === void 0 ? void 0 : _f.end) || commentStart; break; - case 346 /* SyntaxKind.JSDocSeeTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: commentStart = ((_g = tag.name) === null || _g === void 0 ? void 0 : _g.end) || commentStart; break; - case 328 /* SyntaxKind.JSDocAugmentsTag */: - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: commentStart = tag.class.end; break; } @@ -132911,7 +133849,7 @@ var ts; // defined in `ts.commentPragmas` would be excessive, but we can avoid // some obvious false positives (e.g. in XML-like doc comments) by // checking the element name. - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (!match[3] || !(match[3] in ts.commentPragmas)) { return false; } @@ -133021,22 +133959,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: if (token.parent.tagName === token) { return 19 /* ClassificationType.jsxOpenTagName */; } break; - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: if (token.parent.tagName === token) { return 20 /* ClassificationType.jsxCloseTagName */; } break; - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: if (token.parent.tagName === token) { return 21 /* ClassificationType.jsxSelfClosingTagName */; } break; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: if (token.parent.name === token) { return 22 /* ClassificationType.jsxAttribute */; } @@ -133065,17 +134003,17 @@ var ts; var parent = token.parent; if (tokenKind === 63 /* SyntaxKind.EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (parent.kind === 254 /* SyntaxKind.VariableDeclaration */ || - parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - parent.kind === 164 /* SyntaxKind.Parameter */ || - parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + if (parent.kind === 257 /* SyntaxKind.VariableDeclaration */ || + parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + parent.kind === 166 /* SyntaxKind.Parameter */ || + parent.kind === 288 /* SyntaxKind.JsxAttribute */) { return 5 /* ClassificationType.operator */; } } - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ || - parent.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || - parent.kind === 220 /* SyntaxKind.PostfixUnaryExpression */ || - parent.kind === 222 /* SyntaxKind.ConditionalExpression */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ || + parent.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || + parent.kind === 222 /* SyntaxKind.PostfixUnaryExpression */ || + parent.kind === 224 /* SyntaxKind.ConditionalExpression */) { return 5 /* ClassificationType.operator */; } } @@ -133088,7 +134026,7 @@ var ts; return 25 /* ClassificationType.bigintLiteral */; } else if (tokenKind === 10 /* SyntaxKind.StringLiteral */) { - return token && token.parent.kind === 285 /* SyntaxKind.JsxAttribute */ ? 24 /* ClassificationType.jsxAttributeStringLiteralValue */ : 6 /* ClassificationType.stringLiteral */; + return token && token.parent.kind === 288 /* SyntaxKind.JsxAttribute */ ? 24 /* ClassificationType.jsxAttributeStringLiteralValue */ : 6 /* ClassificationType.stringLiteral */; } else if (tokenKind === 13 /* SyntaxKind.RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. @@ -133104,32 +134042,32 @@ var ts; else if (tokenKind === 79 /* SyntaxKind.Identifier */) { if (token) { switch (token.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: if (token.parent.name === token) { return 11 /* ClassificationType.className */; } return; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: if (token.parent.name === token) { return 15 /* ClassificationType.typeParameterName */; } return; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* ClassificationType.interfaceName */; } return; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (token.parent.name === token) { return 12 /* ClassificationType.enumName */; } return; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (token.parent.name === token) { return 14 /* ClassificationType.moduleName */; } return; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: if (token.parent.name === token) { return ts.isThisIdentifier(token) ? 3 /* ClassificationType.keyword */ : 17 /* ClassificationType.parameterName */; } @@ -133234,13 +134172,13 @@ var ts; var inJSXElement = false; function visit(node) { switch (node.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } if (!node || !ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth()) || node.getFullWidth() === 0) { @@ -133280,7 +134218,7 @@ var ts; if (modifiers & 32 /* ModifierFlags.Static */) { modifierSet |= 1 << 1 /* TokenModifier.static */; } - if (modifiers & 256 /* ModifierFlags.Async */) { + if (modifiers & 512 /* ModifierFlags.Async */) { modifierSet |= 1 << 2 /* TokenModifier.async */; } if (typeIdx !== 0 /* TokenType.class */ && typeIdx !== 2 /* TokenType.interface */) { @@ -133386,25 +134324,25 @@ var ts; return (ts.isQualifiedName(node.parent) && node.parent.right === node) || (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node); } var tokenFromDeclarationMapping = new ts.Map([ - [254 /* SyntaxKind.VariableDeclaration */, 7 /* TokenType.variable */], - [164 /* SyntaxKind.Parameter */, 6 /* TokenType.parameter */], - [167 /* SyntaxKind.PropertyDeclaration */, 9 /* TokenType.property */], - [261 /* SyntaxKind.ModuleDeclaration */, 3 /* TokenType.namespace */], - [260 /* SyntaxKind.EnumDeclaration */, 1 /* TokenType.enum */], - [299 /* SyntaxKind.EnumMember */, 8 /* TokenType.enumMember */], - [257 /* SyntaxKind.ClassDeclaration */, 0 /* TokenType.class */], - [169 /* SyntaxKind.MethodDeclaration */, 11 /* TokenType.member */], - [256 /* SyntaxKind.FunctionDeclaration */, 10 /* TokenType.function */], - [213 /* SyntaxKind.FunctionExpression */, 10 /* TokenType.function */], - [168 /* SyntaxKind.MethodSignature */, 11 /* TokenType.member */], - [172 /* SyntaxKind.GetAccessor */, 9 /* TokenType.property */], - [173 /* SyntaxKind.SetAccessor */, 9 /* TokenType.property */], - [166 /* SyntaxKind.PropertySignature */, 9 /* TokenType.property */], - [258 /* SyntaxKind.InterfaceDeclaration */, 2 /* TokenType.interface */], - [259 /* SyntaxKind.TypeAliasDeclaration */, 5 /* TokenType.type */], - [163 /* SyntaxKind.TypeParameter */, 4 /* TokenType.typeParameter */], - [296 /* SyntaxKind.PropertyAssignment */, 9 /* TokenType.property */], - [297 /* SyntaxKind.ShorthandPropertyAssignment */, 9 /* TokenType.property */] + [257 /* SyntaxKind.VariableDeclaration */, 7 /* TokenType.variable */], + [166 /* SyntaxKind.Parameter */, 6 /* TokenType.parameter */], + [169 /* SyntaxKind.PropertyDeclaration */, 9 /* TokenType.property */], + [264 /* SyntaxKind.ModuleDeclaration */, 3 /* TokenType.namespace */], + [263 /* SyntaxKind.EnumDeclaration */, 1 /* TokenType.enum */], + [302 /* SyntaxKind.EnumMember */, 8 /* TokenType.enumMember */], + [260 /* SyntaxKind.ClassDeclaration */, 0 /* TokenType.class */], + [171 /* SyntaxKind.MethodDeclaration */, 11 /* TokenType.member */], + [259 /* SyntaxKind.FunctionDeclaration */, 10 /* TokenType.function */], + [215 /* SyntaxKind.FunctionExpression */, 10 /* TokenType.function */], + [170 /* SyntaxKind.MethodSignature */, 11 /* TokenType.member */], + [174 /* SyntaxKind.GetAccessor */, 9 /* TokenType.property */], + [175 /* SyntaxKind.SetAccessor */, 9 /* TokenType.property */], + [168 /* SyntaxKind.PropertySignature */, 9 /* TokenType.property */], + [261 /* SyntaxKind.InterfaceDeclaration */, 2 /* TokenType.interface */], + [262 /* SyntaxKind.TypeAliasDeclaration */, 5 /* TokenType.type */], + [165 /* SyntaxKind.TypeParameter */, 4 /* TokenType.typeParameter */], + [299 /* SyntaxKind.PropertyAssignment */, 9 /* TokenType.property */], + [300 /* SyntaxKind.ShorthandPropertyAssignment */, 9 /* TokenType.property */] ]); })(v2020 = classifier.v2020 || (classifier.v2020 = {})); })(classifier = ts.classifier || (ts.classifier = {})); @@ -133538,18 +134476,18 @@ var ts; function getStringLiteralCompletionEntries(sourceFile, node, position, typeChecker, compilerOptions, host, preferences) { var parent = walkUpParentheses(node.parent); switch (parent.kind) { - case 196 /* SyntaxKind.LiteralType */: { + case 198 /* SyntaxKind.LiteralType */: { var grandParent_1 = walkUpParentheses(parent.parent); switch (grandParent_1.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 178 /* SyntaxKind.TypeReference */: { + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: { var typeArgument = ts.findAncestor(parent, function (n) { return n.parent === grandParent_1; }); if (typeArgument) { return { kind: 2 /* StringLiteralCompletionKind.Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(typeArgument)), isNewIdentifier: false }; } return undefined; } - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: // Get all apparent property names // i.e. interface Foo { // foo: string; @@ -133561,9 +134499,9 @@ var ts; return undefined; } return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(objectType)); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return { kind: 0 /* StringLiteralCompletionKind.Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) }; - case 187 /* SyntaxKind.UnionType */: { + case 189 /* SyntaxKind.UnionType */: { if (!ts.isTypeReferenceNode(grandParent_1.parent)) { return undefined; } @@ -133575,7 +134513,7 @@ var ts; return undefined; } } - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (ts.isObjectLiteralExpression(parent.parent) && parent.name === node) { // Get quoted name of properties of the object literal expression // i.e. interface ConfigFiles { @@ -133592,7 +134530,7 @@ var ts; return stringLiteralCompletionsForObjectLiteral(typeChecker, parent.parent); } return fromContextualType(); - case 207 /* SyntaxKind.ElementAccessExpression */: { + case 209 /* SyntaxKind.ElementAccessExpression */: { var _b = parent, expression = _b.expression, argumentExpression = _b.argumentExpression; if (node === ts.skipParentheses(argumentExpression)) { // Get all names of properties on the expression @@ -133605,20 +134543,20 @@ var ts; } return undefined; } - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 285 /* SyntaxKind.JsxAttribute */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 288 /* SyntaxKind.JsxAttribute */: if (!isRequireCallArgument(node) && !ts.isImportCall(parent)) { - var argumentInfo = ts.SignatureHelp.getArgumentInfoForCompletions(parent.kind === 285 /* SyntaxKind.JsxAttribute */ ? parent.parent : node, position, sourceFile); + var argumentInfo = ts.SignatureHelp.getArgumentInfoForCompletions(parent.kind === 288 /* SyntaxKind.JsxAttribute */ ? parent.parent : node, position, sourceFile); // Get string literal completions from specialized signatures of the target // i.e. declare function f(a: 'A'); // f("/*completion position*/") - return argumentInfo ? getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) : fromContextualType(); + return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(); } // falls through (is `require("")` or `require(""` or `import("")`) - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 277 /* SyntaxKind.ExternalModuleReference */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 280 /* SyntaxKind.ExternalModuleReference */: // Get all known external module names or complete a path to a module // i.e. import * as ns from "/*completion position*/"; // var y = import("/*completion position*/"); @@ -133637,9 +134575,9 @@ var ts; } function walkUpParentheses(node) { switch (node.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return ts.walkUpParenthesizedTypes(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return ts.walkUpParenthesizedExpressions(node); default: return node; @@ -133669,7 +134607,7 @@ var ts; isNewIdentifier = isNewIdentifier || !!(type.flags & 4 /* TypeFlags.String */); return getStringLiteralTypes(type, uniques); }); - return { kind: 2 /* StringLiteralCompletionKind.Types */, types: types, isNewIdentifier: isNewIdentifier }; + return ts.length(types) ? { kind: 2 /* StringLiteralCompletionKind.Types */, types: types, isNewIdentifier: isNewIdentifier } : undefined; } function stringLiteralCompletionsFromProperties(type) { return type && { @@ -134187,7 +135125,7 @@ var ts; if (!dependencies) continue; for (var dep in dependencies) { - if (dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, "@types/")) { + if (ts.hasProperty(dependencies, dep) && !ts.startsWith(dep, "@types/")) { result.push(dep); } } @@ -134562,7 +135500,7 @@ var ts; } function keywordFiltersFromSyntaxKind(keywordCompletion) { switch (keywordCompletion) { - case 152 /* SyntaxKind.TypeKeyword */: return 8 /* KeywordCompletionFilters.TypeKeyword */; + case 154 /* SyntaxKind.TypeKeyword */: return 8 /* KeywordCompletionFilters.TypeKeyword */; default: ts.Debug.fail("Unknown mapping from SyntaxKind to KeywordCompletionFilters"); } } @@ -134571,7 +135509,7 @@ var ts; return (location === null || location === void 0 ? void 0 : location.kind) === 79 /* SyntaxKind.Identifier */ ? ts.createTextSpanFromNode(location) : undefined; } function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) { - var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag, importCompletionNode = completionData.importCompletionNode, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports; + var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag, importStatementCompletion = completionData.importStatementCompletion, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports; // Verify if the file is JSX language variant if (ts.getLanguageVariant(sourceFile.scriptKind) === 1 /* LanguageVariant.JSX */) { var completionInfo = getJsxClosingTagCompletion(location, sourceFile); @@ -134585,7 +135523,7 @@ var ts; return undefined; } var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, - /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag); + /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag); if (keywordFilters !== 0 /* KeywordCompletionFilters.None */) { for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) { var keywordEntry = _a[_i]; @@ -134638,12 +135576,12 @@ var ts; // We wanna walk up the tree till we find a JSX closing element var jsxClosingElement = ts.findAncestor(location, function (node) { switch (node.kind) { - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: return true; case 43 /* SyntaxKind.SlashToken */: case 31 /* SyntaxKind.GreaterThanToken */: case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return false; default: return "quit"; @@ -134703,7 +135641,7 @@ var ts; function createCompletionEntryForLiteral(sourceFile, preferences, literal) { return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* ScriptElementKind.string */, kindModifiers: "" /* ScriptElementKindModifier.none */, sortText: Completions.SortText.LocationPriority }; } - function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) { + function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) { var _a, _b; var insertText; var replacementSpan = ts.getReplacementSpanForContextToken(replacementToken); @@ -134759,8 +135697,8 @@ var ts; } if (originIsResolvedExport(origin)) { sourceDisplay = [ts.textPart(origin.moduleSpecifier)]; - if (importCompletionNode) { - (_a = getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, contextToken, origin, useSemicolons, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan); + if (importStatementCompletion) { + (_a = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan); isSnippet = preferences.includeCompletionsWithSnippetText ? true : undefined; } } @@ -134815,7 +135753,7 @@ var ts; } if (originIsExport(origin) || originIsResolvedExport(origin)) { data = originToCompletionEntryData(origin); - hasAction = !importCompletionNode; + hasAction = !importStatementCompletion; } // TODO(drosen): Right now we just permit *all* semantic meanings when calling // 'getSymbolKind' which is permissible given that it is backwards compatible; but @@ -134838,7 +135776,7 @@ var ts; labelDetails: labelDetails, isSnippet: isSnippet, isPackageJsonImport: originIsPackageJsonImport(origin) || undefined, - isImportStatementCompletion: !!importCompletionNode || undefined, + isImportStatementCompletion: !!importStatementCompletion || undefined, data: data, }; } @@ -134917,7 +135855,7 @@ var ts; // Whether the suggested member should be abstract. // e.g. in `abstract class C { abstract | }`, we should offer abstract method signatures at position `|`. var _a = getPresentModifiers(contextToken), presentModifiers = _a.modifiers, modifiersSpan = _a.span; - var isAbstract = !!(presentModifiers & 128 /* ModifierFlags.Abstract */); + var isAbstract = !!(presentModifiers & 256 /* ModifierFlags.Abstract */); var completionNodes = []; ts.codefix.addNewNodeForMemberSymbol(symbol, classLikeDeclaration, sourceFile, { program: program, host: host }, preferences, importAdder, // `addNewNodeForMemberSymbol` calls this callback function for each new member node @@ -134930,7 +135868,7 @@ var ts; function (node) { var requiredModifiers = 0 /* ModifierFlags.None */; if (isAbstract) { - requiredModifiers |= 128 /* ModifierFlags.Abstract */; + requiredModifiers |= 256 /* ModifierFlags.Abstract */; } if (ts.isClassElement(node) && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node) === 1 /* MemberOverrideStatus.NeedsOverride */) { @@ -134991,7 +135929,7 @@ var ts; span = ts.createTextSpanFromNode(contextToken); } if (ts.isPropertyDeclaration(contextToken.parent)) { - modifiers |= ts.modifiersToFlags(contextToken.parent.modifiers) & 125951 /* ModifierFlags.Modifier */; + modifiers |= ts.modifiersToFlags(contextToken.parent.modifiers) & 126975 /* ModifierFlags.Modifier */; span = ts.createTextSpanFromNode(contextToken.parent); } return { modifiers: modifiers, span: span }; @@ -135040,7 +135978,6 @@ var ts; var labelDetails = { detail: signaturePrinter.printNode(4 /* EmitHint.Unspecified */, methodSignature, sourceFile) }; return { isSnippet: isSnippet, insertText: insertText, labelDetails: labelDetails }; } - ; function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences) { var declarations = symbol.getDeclarations(); if (!(declarations && declarations.length)) { @@ -135053,10 +135990,10 @@ var ts; var quotePreference = ts.getQuotePreference(sourceFile, preferences); var builderFlags = 33554432 /* NodeBuilderFlags.OmitThisParameter */ | (quotePreference === 0 /* QuotePreference.Single */ ? 268435456 /* NodeBuilderFlags.UseSingleQuotesForStringLiteralType */ : 0 /* NodeBuilderFlags.None */); switch (declaration.kind) { - case 166 /* SyntaxKind.PropertySignature */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: { + case 168 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: { var effectiveType = type.flags & 1048576 /* TypeFlags.Union */ && type.types.length < 10 ? checker.getUnionType(type.types, 2 /* UnionReduction.Subtype */) : type; @@ -135090,7 +136027,8 @@ var ts; } var parameters = typeNode.parameters.map(function (typedParam) { return ts.factory.createParameterDeclaration( - /*modifiers*/ undefined, typedParam.dotDotDotToken, typedParam.name, typedParam.questionToken, + /*modifiers*/ undefined, typedParam.dotDotDotToken, typedParam.name, + /*questionToken*/ undefined, /*type*/ undefined, typedParam.initializer); }); return ts.factory.createMethodDeclaration( @@ -135210,20 +136148,17 @@ var ts; }; return unresolvedOrigin; } - function getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, contextToken, origin, useSemicolons, options, preferences) { - var _a, _b, _c; - var sourceFile = importCompletionNode.getSourceFile(); - var replacementSpan = ts.createTextSpanFromNode(ts.findAncestor(importCompletionNode, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)) || importCompletionNode, sourceFile); + function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) { + var replacementSpan = importStatementCompletion.replacementSpan; var quotedModuleSpecifier = ts.quote(sourceFile, preferences, origin.moduleSpecifier); var exportKind = origin.isDefaultExport ? 1 /* ExportKind.Default */ : origin.exportName === "export=" /* InternalSymbolName.ExportEquals */ ? 2 /* ExportKind.ExportEquals */ : 0 /* ExportKind.Named */; var tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : ""; var importKind = ts.codefix.getImportKind(sourceFile, exportKind, options, /*forceImportKeyword*/ true); - var isTopLevelTypeOnly = ((_b = (_a = ts.tryCast(importCompletionNode, ts.isImportDeclaration)) === null || _a === void 0 ? void 0 : _a.importClause) === null || _b === void 0 ? void 0 : _b.isTypeOnly) || ((_c = ts.tryCast(importCompletionNode, ts.isImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.isTypeOnly); - var isImportSpecifierTypeOnly = couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken); - var topLevelTypeOnlyText = isTopLevelTypeOnly ? " ".concat(ts.tokenToString(152 /* SyntaxKind.TypeKeyword */), " ") : " "; - var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? "".concat(ts.tokenToString(152 /* SyntaxKind.TypeKeyword */), " ") : ""; + var isImportSpecifierTypeOnly = importStatementCompletion.couldBeTypeOnlyImportSpecifier; + var topLevelTypeOnlyText = importStatementCompletion.isTopLevelTypeOnly ? " ".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : " "; + var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? "".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : ""; var suffix = useSemicolons ? ";" : ""; switch (importKind) { case 3 /* ImportKind.CommonJS */: return { replacementSpan: replacementSpan, insertText: "import".concat(topLevelTypeOnlyText).concat(ts.escapeSnippetText(name)).concat(tabStop, " = require(").concat(quotedModuleSpecifier, ")").concat(suffix) }; @@ -135256,7 +136191,7 @@ var ts; return CompletionSource.TypeOnlyAlias; } } - function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) { + function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) { var _a; var start = ts.timestamp(); var variableDeclaration = getVariableDeclaration(location); @@ -135277,7 +136212,7 @@ var ts; var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess; var originalSortText = (_a = symbolToSortTextMap === null || symbolToSortTextMap === void 0 ? void 0 : symbolToSortTextMap[ts.getSymbolId(symbol)]) !== null && _a !== void 0 ? _a : Completions.SortText.LocationPriority; var sortText = (isDeprecated(symbol, typeChecker) ? Completions.SortText.Deprecated(originalSortText) : originalSortText); - var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, compilerOptions, preferences, kind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag); + var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, compilerOptions, preferences, kind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag); if (!entry) { continue; } @@ -135437,7 +136372,7 @@ var ts; } case "symbol": { var symbol = symbolCompletion.symbol, location = symbolCompletion.location, contextToken_2 = symbolCompletion.contextToken, origin = symbolCompletion.origin, previousToken = symbolCompletion.previousToken; - var _a = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken_2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; + var _a = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken_2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay); // TODO: GH#18217 } case "literal": { @@ -135466,9 +136401,9 @@ var ts; return { name: name, kindModifiers: kindModifiers, kind: kind, displayParts: displayParts, documentation: documentation, tags: tags, codeActions: codeActions, source: source, sourceDisplay: source }; } Completions.createCompletionDetails = createCompletionDetails; - function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source) { + function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken) { if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) { - if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementNode) { + if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementSpan) { // Import statement completion: 'import c|' return { codeActions: undefined, sourceDisplay: [ts.textPart(data.moduleSpecifier)] }; } @@ -135498,7 +136433,7 @@ var ts; var moduleSymbol = origin.moduleSymbol; var targetSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker)); var isJsxOpeningTagName = (contextToken === null || contextToken === void 0 ? void 0 : contextToken.kind) === 29 /* SyntaxKind.LessThanToken */ && ts.isJsxOpeningLikeElement(contextToken.parent); - var _a = ts.codefix.getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), isJsxOpeningTagName), isJsxOpeningTagName, host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences), moduleSpecifier = _a.moduleSpecifier, codeAction = _a.codeAction; + var _a = ts.codefix.getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), isJsxOpeningTagName), isJsxOpeningTagName, host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences, cancellationToken), moduleSpecifier = _a.moduleSpecifier, codeAction = _a.codeAction; ts.Debug.assert(!(data === null || data === void 0 ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier); return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] }; } @@ -135541,11 +136476,11 @@ var ts; return ts.getContextualTypeFromParent(previousToken, checker); case 63 /* SyntaxKind.EqualsToken */: switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checker.getContextualType(parent.initializer); // TODO: GH#18217 - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return checker.getTypeAtLocation(parent.left); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return checker.getContextualTypeForJsxAttribute(parent); default: return undefined; @@ -135576,7 +136511,7 @@ var ts; } function isModuleSymbol(symbol) { var _a; - return !!((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.kind === 305 /* SyntaxKind.SourceFile */; })); + return !!((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.kind === 308 /* SyntaxKind.SourceFile */; })); } function getCompletionData(program, log, sourceFile, compilerOptions, position, preferences, detailsEntryId, host, formatContext, cancellationToken) { var typeChecker = program.getTypeChecker(); @@ -135633,7 +136568,7 @@ var ts; currentToken = ts.getTokenAtPosition(sourceFile, position); if (!currentToken || (!ts.isDeclarationName(currentToken) && - (currentToken.parent.kind !== 347 /* SyntaxKind.JSDocPropertyTag */ || + (currentToken.parent.kind !== 350 /* SyntaxKind.JSDocPropertyTag */ || currentToken.parent.name !== currentToken))) { // Use as type location if inside tag's type expression insideJsDocTagTypeExpression = isCurrentlyEditingNode(typeExpression); @@ -135669,34 +136604,34 @@ var ts; var isStartingCloseTag = false; var isJsxInitializer = false; var isJsxIdentifierExpected = false; - var importCompletionNode; + var importStatementCompletion; var location = ts.getTouchingPropertyName(sourceFile, position); var keywordFilters = 0 /* KeywordCompletionFilters.None */; var isNewIdentifierLocation = false; var flags = 0 /* CompletionInfoFlags.None */; if (contextToken) { - var importStatementCompletion = getImportStatementCompletionInfo(contextToken); - isNewIdentifierLocation = importStatementCompletion.isNewIdentifierLocation; - if (importStatementCompletion.keywordCompletion) { - if (importStatementCompletion.isKeywordOnlyCompletion) { + var importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken); + if (importStatementCompletionInfo.keywordCompletion) { + if (importStatementCompletionInfo.isKeywordOnlyCompletion) { return { kind: 4 /* CompletionDataKind.Keywords */, - keywordCompletions: [keywordToCompletionEntry(importStatementCompletion.keywordCompletion)], - isNewIdentifierLocation: isNewIdentifierLocation, + keywordCompletions: [keywordToCompletionEntry(importStatementCompletionInfo.keywordCompletion)], + isNewIdentifierLocation: importStatementCompletionInfo.isNewIdentifierLocation, }; } - keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletion.keywordCompletion); + keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletionInfo.keywordCompletion); } - if (importStatementCompletion.replacementNode && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) { + if (importStatementCompletionInfo.replacementSpan && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) { // Import statement completions use `insertText`, and also require the `data` property of `CompletionEntryIdentifier` // added in TypeScript 4.3 to be sent back from the client during `getCompletionEntryDetails`. Since this feature // is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients // to opt in with the `includeCompletionsForImportStatements` user preference. - importCompletionNode = importStatementCompletion.replacementNode; flags |= 2 /* CompletionInfoFlags.IsImportStatementCompletion */; + importStatementCompletion = importStatementCompletionInfo; + isNewIdentifierLocation = importStatementCompletionInfo.isNewIdentifierLocation; } // Bail out if this is a known invalid completion location - if (!importCompletionNode && isCompletionListBlocker(contextToken)) { + if (!importStatementCompletionInfo.replacementSpan && isCompletionListBlocker(contextToken)) { log("Returning an empty list because completion was requested in an invalid position."); return keywordFilters ? keywordCompletionData(keywordFilters, isJsOnlyLocation, isNewIdentifierDefinitionLocation()) @@ -135707,7 +136642,7 @@ var ts; isRightOfDot = contextToken.kind === 24 /* SyntaxKind.DotToken */; isRightOfQuestionDot = contextToken.kind === 28 /* SyntaxKind.QuestionDotToken */; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: propertyAccessToConvert = parent; node = propertyAccessToConvert.expression; var leftmostAccessExpression = ts.getLeftmostAccessExpression(propertyAccessToConvert); @@ -135723,16 +136658,16 @@ var ts; return undefined; } break; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: node = parent.left; break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: node = parent.name; break; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: node = parent; break; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: node = parent.getFirstToken(sourceFile); ts.Debug.assert(node.kind === 100 /* SyntaxKind.ImportKeyword */ || node.kind === 103 /* SyntaxKind.NewKeyword */); break; @@ -135742,11 +136677,11 @@ var ts; return undefined; } } - else if (!importCompletionNode && sourceFile.languageVariant === 1 /* LanguageVariant.JSX */) { + else if (!importStatementCompletion) { // // If the tagname is a property access expression, we will then walk up to the top most of property access expression. // Then, try to get a JSX container and its associated attributes type. - if (parent && parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (parent && parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { contextToken = parent; parent = parent.parent; } @@ -135754,46 +136689,46 @@ var ts; if (currentToken.parent === location) { switch (currentToken.kind) { case 31 /* SyntaxKind.GreaterThanToken */: - if (currentToken.parent.kind === 278 /* SyntaxKind.JsxElement */ || currentToken.parent.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (currentToken.parent.kind === 281 /* SyntaxKind.JsxElement */ || currentToken.parent.kind === 283 /* SyntaxKind.JsxOpeningElement */) { location = currentToken; } break; case 43 /* SyntaxKind.SlashToken */: - if (currentToken.parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */) { + if (currentToken.parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */) { location = currentToken; } break; } } switch (parent.kind) { - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: if (contextToken.kind === 43 /* SyntaxKind.SlashToken */) { isStartingCloseTag = true; location = contextToken; } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (!binaryExpressionMayBeOpenTag(parent)) { break; } // falls through - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 278 /* SyntaxKind.JsxElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 281 /* SyntaxKind.JsxElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: isJsxIdentifierExpected = true; if (contextToken.kind === 29 /* SyntaxKind.LessThanToken */) { isRightOfOpenTag = true; location = contextToken; } break; - case 288 /* SyntaxKind.JsxExpression */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 291 /* SyntaxKind.JsxExpression */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: // For `
`, `parent` will be `{true}` and `previousToken` will be `}` if (previousToken.kind === 19 /* SyntaxKind.CloseBraceToken */ && currentToken.kind === 31 /* SyntaxKind.GreaterThanToken */) { isJsxIdentifierExpected = true; } break; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: // For `
`, `parent` will be JsxAttribute and `previousToken` will be its initializer if (parent.initializer === previousToken && previousToken.end < position) { @@ -135885,19 +136820,19 @@ var ts; isTypeOnlyLocation: isTypeOnlyLocation, isJsxIdentifierExpected: isJsxIdentifierExpected, isRightOfOpenTag: isRightOfOpenTag, - importCompletionNode: importCompletionNode, + importStatementCompletion: importStatementCompletion, hasUnresolvedAutoImports: hasUnresolvedAutoImports, flags: flags, }; function isTagWithTypeExpression(tag) { switch (tag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 341 /* SyntaxKind.JSDocReturnTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return true; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return !!tag.constraint; default: return false; @@ -135906,7 +136841,7 @@ var ts; function tryGetTypeExpressionFromTag(tag) { if (isTagWithTypeExpression(tag)) { var typeExpression = ts.isJSDocTemplateTag(tag) ? tag.constraint : tag.typeExpression; - return typeExpression && typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */ ? typeExpression : undefined; + return typeExpression && typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */ ? typeExpression : undefined; } return undefined; } @@ -135949,7 +136884,7 @@ var ts; // If the module is merged with a value, we must get the type of the class and add its propertes (for inherited static methods). if (!isTypeLocation && symbol.declarations && - symbol.declarations.some(function (d) { return d.kind !== 305 /* SyntaxKind.SourceFile */ && d.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && d.kind !== 260 /* SyntaxKind.EnumDeclaration */; })) { + symbol.declarations.some(function (d) { return d.kind !== 308 /* SyntaxKind.SourceFile */ && d.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && d.kind !== 263 /* SyntaxKind.EnumDeclaration */; })) { var type = typeChecker.getTypeOfSymbolAtLocation(symbol, node).getNonOptionalType(); var insertQuestionDot = false; if (type.isNullableType()) { @@ -135995,7 +136930,7 @@ var ts; if (isRightOfQuestionDot && ts.some(type.getCallSignatures())) { isNewIdentifierLocation = true; } - var propertyAccess = node.kind === 200 /* SyntaxKind.ImportType */ ? node : node.parent; + var propertyAccess = node.kind === 202 /* SyntaxKind.ImportType */ ? node : node.parent; if (inCheckedFile) { for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) { var symbol = _a[_i]; @@ -136139,7 +137074,7 @@ var ts; return 1 /* GlobalsSearch.Success */; } function tryGetImportCompletionSymbols() { - if (!importCompletionNode) + if (!importStatementCompletion) return 0 /* GlobalsSearch.Continue */; isNewIdentifierLocation = true; collectAutoImports(); @@ -136202,7 +137137,7 @@ var ts; } } // Need to insert 'this.' before properties of `this` type, so only do that if `includeInsertTextCompletions` - if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 305 /* SyntaxKind.SourceFile */) { + if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 308 /* SyntaxKind.SourceFile */) { var thisType = typeChecker.tryGetThisTypeAt(scopeNode, /*includeGlobalThis*/ false, ts.isClassLike(scopeNode.parent) ? scopeNode : undefined); if (thisType && !isProbablyGlobalType(thisType, sourceFile, typeChecker)) { for (var _i = 0, _a = getPropertiesForCompletion(thisType, typeChecker); _i < _a.length; _i++) { @@ -136222,7 +137157,7 @@ var ts; } function shouldOfferImportCompletions() { // If already typing an import statement, provide completions for it. - if (importCompletionNode) + if (importStatementCompletion) return true; // If current completion is for non-contextual Object literal shortahands, ignore auto-import symbols if (isNonContextualObjectLiteral) @@ -136241,10 +137176,10 @@ var ts; } function isSnippetScope(scopeNode) { switch (scopeNode.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 223 /* SyntaxKind.TemplateExpression */: - case 288 /* SyntaxKind.JsxExpression */: - case 235 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 225 /* SyntaxKind.TemplateExpression */: + case 291 /* SyntaxKind.JsxExpression */: + case 238 /* SyntaxKind.Block */: return true; default: return ts.isStatement(scopeNode); @@ -136252,7 +137187,7 @@ var ts; } function isTypeOnlyCompletion() { return insideJsDocTagTypeExpression - || !!importCompletionNode && ts.isTypeOnlyImportOrExportDeclaration(location.parent) + || !!importStatementCompletion && ts.isTypeOnlyImportOrExportDeclaration(location.parent) || !isContextTokenValueLocation(contextToken) && (ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker) || ts.isPartOfTypeNode(location) @@ -136261,28 +137196,30 @@ var ts; function isContextTokenValueLocation(contextToken) { return contextToken && ((contextToken.kind === 112 /* SyntaxKind.TypeOfKeyword */ && - (contextToken.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isTypeOfExpression(contextToken.parent))) || - (contextToken.kind === 128 /* SyntaxKind.AssertsKeyword */ && contextToken.parent.kind === 177 /* SyntaxKind.TypePredicate */)); + (contextToken.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isTypeOfExpression(contextToken.parent))) || + (contextToken.kind === 129 /* SyntaxKind.AssertsKeyword */ && contextToken.parent.kind === 179 /* SyntaxKind.TypePredicate */)); } function isContextTokenTypeLocation(contextToken) { if (contextToken) { var parentKind = contextToken.parent.kind; switch (contextToken.kind) { case 58 /* SyntaxKind.ColonToken */: - return parentKind === 167 /* SyntaxKind.PropertyDeclaration */ || - parentKind === 166 /* SyntaxKind.PropertySignature */ || - parentKind === 164 /* SyntaxKind.Parameter */ || - parentKind === 254 /* SyntaxKind.VariableDeclaration */ || + return parentKind === 169 /* SyntaxKind.PropertyDeclaration */ || + parentKind === 168 /* SyntaxKind.PropertySignature */ || + parentKind === 166 /* SyntaxKind.Parameter */ || + parentKind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isFunctionLikeKind(parentKind); case 63 /* SyntaxKind.EqualsToken */: - return parentKind === 259 /* SyntaxKind.TypeAliasDeclaration */; - case 127 /* SyntaxKind.AsKeyword */: - return parentKind === 229 /* SyntaxKind.AsExpression */; + return parentKind === 262 /* SyntaxKind.TypeAliasDeclaration */; + case 128 /* SyntaxKind.AsKeyword */: + return parentKind === 231 /* SyntaxKind.AsExpression */; case 29 /* SyntaxKind.LessThanToken */: - return parentKind === 178 /* SyntaxKind.TypeReference */ || - parentKind === 211 /* SyntaxKind.TypeAssertionExpression */; + return parentKind === 180 /* SyntaxKind.TypeReference */ || + parentKind === 213 /* SyntaxKind.TypeAssertionExpression */; case 94 /* SyntaxKind.ExtendsKeyword */: - return parentKind === 163 /* SyntaxKind.TypeParameter */; + return parentKind === 165 /* SyntaxKind.TypeParameter */; + case 150 /* SyntaxKind.SatisfiesKeyword */: + return parentKind === 235 /* SyntaxKind.SatisfiesExpression */; } } return false; @@ -136300,8 +137237,7 @@ var ts; flags |= 1 /* CompletionInfoFlags.MayIncludeAutoImports */; // import { type | -> token text should be blank var isAfterTypeOnlyImportSpecifierModifier = previousToken === contextToken - && importCompletionNode - && couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken); + && importStatementCompletion; var lowerCaseTokenText = isAfterTypeOnlyImportSpecifierModifier ? "" : previousToken && ts.isIdentifier(previousToken) ? previousToken.text.toLowerCase() : ""; @@ -136309,14 +137245,14 @@ var ts; var exportInfo = ts.getExportInfoMap(sourceFile, host, program, preferences, cancellationToken); var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host); var packageJsonFilter = detailsEntryId ? undefined : ts.createPackageJsonImportFilter(sourceFile, preferences, host); - resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importCompletionNode, ts.isValidTypeOnlyAliasUseSite(location), function (context) { + resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importStatementCompletion, ts.isValidTypeOnlyAliasUseSite(location), function (context) { exportInfo.search(sourceFile.path, /*preferCapitalized*/ isRightOfOpenTag, function (symbolName, targetFlags) { if (!ts.isIdentifierText(symbolName, ts.getEmitScriptTarget(host.getCompilationSettings()))) return false; if (!detailsEntryId && ts.isStringANonContextualKeyword(symbolName)) return false; - if (!isTypeOnlyLocation && !importCompletionNode && !(targetFlags & 111551 /* SymbolFlags.Value */)) + if (!isTypeOnlyLocation && !importStatementCompletion && !(targetFlags & 111551 /* SymbolFlags.Value */)) return false; if (isTypeOnlyLocation && !(targetFlags & (1536 /* SymbolFlags.Module */ | 788968 /* SymbolFlags.Type */))) return false; @@ -136397,7 +137333,7 @@ var ts; return; } symbolToOriginInfoMap[symbols.length] = origin; - symbolToSortTextMap[symbolId] = importCompletionNode ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions; + symbolToSortTextMap[symbolId] = importStatementCompletion ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions; symbols.push(symbol); } /* Mutates `symbols` and `symbolToOriginInfoMap`. */ @@ -136473,18 +137409,18 @@ var ts; // - contextToken: GreaterThanToken (before cursor) // - location: JsxSelfClosingElement or JsxOpeningElement // - contextToken.parent === location - if (location === contextToken.parent && (location.kind === 280 /* SyntaxKind.JsxOpeningElement */ || location.kind === 279 /* SyntaxKind.JsxSelfClosingElement */)) { + if (location === contextToken.parent && (location.kind === 283 /* SyntaxKind.JsxOpeningElement */ || location.kind === 282 /* SyntaxKind.JsxSelfClosingElement */)) { return false; } - if (contextToken.parent.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (contextToken.parent.kind === 283 /* SyntaxKind.JsxOpeningElement */) { //
/**/ // - contextToken: GreaterThanToken (before cursor) // - location: JSXElement // - different parents (JSXOpeningElement, JSXElement) - return location.parent.kind !== 280 /* SyntaxKind.JsxOpeningElement */; + return location.parent.kind !== 283 /* SyntaxKind.JsxOpeningElement */; } - if (contextToken.parent.kind === 281 /* SyntaxKind.JsxClosingElement */ || contextToken.parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */) { - return !!contextToken.parent.parent && contextToken.parent.parent.kind === 278 /* SyntaxKind.JsxElement */; + if (contextToken.parent.kind === 284 /* SyntaxKind.JsxClosingElement */ || contextToken.parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */) { + return !!contextToken.parent.parent && contextToken.parent.parent.kind === 281 /* SyntaxKind.JsxElement */; } } return false; @@ -136496,44 +137432,44 @@ var ts; // Previous token may have been a keyword that was converted to an identifier. switch (tokenKind) { case 27 /* SyntaxKind.CommaToken */: - return containingNodeKind === 208 /* SyntaxKind.CallExpression */ // func( a, | - || containingNodeKind === 171 /* SyntaxKind.Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ - || containingNodeKind === 209 /* SyntaxKind.NewExpression */ // new C(a, | - || containingNodeKind === 204 /* SyntaxKind.ArrayLiteralExpression */ // [a, | - || containingNodeKind === 221 /* SyntaxKind.BinaryExpression */ // const x = (a, | - || containingNodeKind === 179 /* SyntaxKind.FunctionType */ // var x: (s: string, list| - || containingNodeKind === 205 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { x, | + return containingNodeKind === 210 /* SyntaxKind.CallExpression */ // func( a, | + || containingNodeKind === 173 /* SyntaxKind.Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ + || containingNodeKind === 211 /* SyntaxKind.NewExpression */ // new C(a, | + || containingNodeKind === 206 /* SyntaxKind.ArrayLiteralExpression */ // [a, | + || containingNodeKind === 223 /* SyntaxKind.BinaryExpression */ // const x = (a, | + || containingNodeKind === 181 /* SyntaxKind.FunctionType */ // var x: (s: string, list| + || containingNodeKind === 207 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { x, | case 20 /* SyntaxKind.OpenParenToken */: - return containingNodeKind === 208 /* SyntaxKind.CallExpression */ // func( | - || containingNodeKind === 171 /* SyntaxKind.Constructor */ // constructor( | - || containingNodeKind === 209 /* SyntaxKind.NewExpression */ // new C(a| - || containingNodeKind === 212 /* SyntaxKind.ParenthesizedExpression */ // const x = (a| - || containingNodeKind === 191 /* SyntaxKind.ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ + return containingNodeKind === 210 /* SyntaxKind.CallExpression */ // func( | + || containingNodeKind === 173 /* SyntaxKind.Constructor */ // constructor( | + || containingNodeKind === 211 /* SyntaxKind.NewExpression */ // new C(a| + || containingNodeKind === 214 /* SyntaxKind.ParenthesizedExpression */ // const x = (a| + || containingNodeKind === 193 /* SyntaxKind.ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ case 22 /* SyntaxKind.OpenBracketToken */: - return containingNodeKind === 204 /* SyntaxKind.ArrayLiteralExpression */ // [ | - || containingNodeKind === 176 /* SyntaxKind.IndexSignature */ // [ | : string ] - || containingNodeKind === 162 /* SyntaxKind.ComputedPropertyName */; // [ | /* this can become an index signature */ - case 141 /* SyntaxKind.ModuleKeyword */: // module | - case 142 /* SyntaxKind.NamespaceKeyword */: // namespace | + return containingNodeKind === 206 /* SyntaxKind.ArrayLiteralExpression */ // [ | + || containingNodeKind === 178 /* SyntaxKind.IndexSignature */ // [ | : string ] + || containingNodeKind === 164 /* SyntaxKind.ComputedPropertyName */; // [ | /* this can become an index signature */ + case 142 /* SyntaxKind.ModuleKeyword */: // module | + case 143 /* SyntaxKind.NamespaceKeyword */: // namespace | case 100 /* SyntaxKind.ImportKeyword */: // import | return true; case 24 /* SyntaxKind.DotToken */: - return containingNodeKind === 261 /* SyntaxKind.ModuleDeclaration */; // module A.| + return containingNodeKind === 264 /* SyntaxKind.ModuleDeclaration */; // module A.| case 18 /* SyntaxKind.OpenBraceToken */: - return containingNodeKind === 257 /* SyntaxKind.ClassDeclaration */ // class A { | - || containingNodeKind === 205 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { | + return containingNodeKind === 260 /* SyntaxKind.ClassDeclaration */ // class A { | + || containingNodeKind === 207 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { | case 63 /* SyntaxKind.EqualsToken */: - return containingNodeKind === 254 /* SyntaxKind.VariableDeclaration */ // const x = a| - || containingNodeKind === 221 /* SyntaxKind.BinaryExpression */; // x = a| + return containingNodeKind === 257 /* SyntaxKind.VariableDeclaration */ // const x = a| + || containingNodeKind === 223 /* SyntaxKind.BinaryExpression */; // x = a| case 15 /* SyntaxKind.TemplateHead */: - return containingNodeKind === 223 /* SyntaxKind.TemplateExpression */; // `aa ${| + return containingNodeKind === 225 /* SyntaxKind.TemplateExpression */; // `aa ${| case 16 /* SyntaxKind.TemplateMiddle */: - return containingNodeKind === 233 /* SyntaxKind.TemplateSpan */; // `aa ${10} dd ${| - case 131 /* SyntaxKind.AsyncKeyword */: - return containingNodeKind === 169 /* SyntaxKind.MethodDeclaration */ // const obj = { async c|() - || containingNodeKind === 297 /* SyntaxKind.ShorthandPropertyAssignment */; // const obj = { async c| + return containingNodeKind === 236 /* SyntaxKind.TemplateSpan */; // `aa ${10} dd ${| + case 132 /* SyntaxKind.AsyncKeyword */: + return containingNodeKind === 171 /* SyntaxKind.MethodDeclaration */ // const obj = { async c|() + || containingNodeKind === 300 /* SyntaxKind.ShorthandPropertyAssignment */; // const obj = { async c| case 41 /* SyntaxKind.AsteriskToken */: - return containingNodeKind === 169 /* SyntaxKind.MethodDeclaration */; // const obj = { * c| + return containingNodeKind === 171 /* SyntaxKind.MethodDeclaration */; // const obj = { * c| } if (isClassMemberCompletionKeyword(tokenKind)) { return true; @@ -136583,7 +137519,7 @@ var ts; completionKind = 0 /* CompletionKind.ObjectPropertyDeclaration */; var typeMembers; var existingMembers; - if (objectLikeContainer.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { var instantiatedType = tryGetObjectLiteralContextualType(objectLikeContainer, typeChecker); // Check completions for Object property value shorthand if (instantiatedType === undefined) { @@ -136608,7 +137544,7 @@ var ts; } } else { - ts.Debug.assert(objectLikeContainer.kind === 201 /* SyntaxKind.ObjectBindingPattern */); + ts.Debug.assert(objectLikeContainer.kind === 203 /* SyntaxKind.ObjectBindingPattern */); // We are *only* completing on properties from the type being destructured. isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); @@ -136619,12 +137555,12 @@ var ts; // through type declaration or inference. // Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed - // type of parameter will flow in from the contextual type of the function - var canGetType = ts.hasInitializer(rootDeclaration) || !!ts.getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */; - if (!canGetType && rootDeclaration.kind === 164 /* SyntaxKind.Parameter */) { + var canGetType = ts.hasInitializer(rootDeclaration) || !!ts.getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */; + if (!canGetType && rootDeclaration.kind === 166 /* SyntaxKind.Parameter */) { if (ts.isExpression(rootDeclaration.parent)) { canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); } - else if (rootDeclaration.parent.kind === 169 /* SyntaxKind.MethodDeclaration */ || rootDeclaration.parent.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (rootDeclaration.parent.kind === 171 /* SyntaxKind.MethodDeclaration */ || rootDeclaration.parent.kind === 175 /* SyntaxKind.SetAccessor */) { canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); } } @@ -136643,7 +137579,7 @@ var ts; var filteredMembers = filterObjectMembersList(typeMembers, ts.Debug.checkDefined(existingMembers)); symbols = ts.concatenate(symbols, filteredMembers); setSortTextToOptionalMember(); - if (objectLikeContainer.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ + if (objectLikeContainer.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && preferences.includeCompletionsWithObjectLiteralMethodSnippets && preferences.includeCompletionsWithInsertText) { transformObjectLiteralMembersSortText(symbolsStartIndex); @@ -136678,10 +137614,10 @@ var ts; keywordFilters = 8 /* KeywordCompletionFilters.TypeKeyword */; } // try to show exported member for imported/re-exported module - var moduleSpecifier = (namedImportsOrExports.kind === 269 /* SyntaxKind.NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier; + var moduleSpecifier = (namedImportsOrExports.kind === 272 /* SyntaxKind.NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier; if (!moduleSpecifier) { isNewIdentifierLocation = true; - return namedImportsOrExports.kind === 269 /* SyntaxKind.NamedImports */ ? 2 /* GlobalsSearch.Fail */ : 0 /* GlobalsSearch.Continue */; + return namedImportsOrExports.kind === 272 /* SyntaxKind.NamedImports */ ? 2 /* GlobalsSearch.Fail */ : 0 /* GlobalsSearch.Continue */; } var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); // TODO: GH#18217 if (!moduleSpecifierSymbol) { @@ -136826,11 +137762,11 @@ var ts; case 30 /* SyntaxKind.LessThanSlashToken */: case 43 /* SyntaxKind.SlashToken */: case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 286 /* SyntaxKind.JsxAttributes */: - case 285 /* SyntaxKind.JsxAttribute */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - if (parent && (parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */ || parent.kind === 280 /* SyntaxKind.JsxOpeningElement */)) { + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 289 /* SyntaxKind.JsxAttributes */: + case 288 /* SyntaxKind.JsxAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + if (parent && (parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || parent.kind === 283 /* SyntaxKind.JsxOpeningElement */)) { if (contextToken.kind === 31 /* SyntaxKind.GreaterThanToken */) { var precedingToken = ts.findPrecedingToken(contextToken.pos, sourceFile, /*startNode*/ undefined); if (!parent.typeArguments || (precedingToken && precedingToken.kind === 43 /* SyntaxKind.SlashToken */)) @@ -136838,7 +137774,7 @@ var ts; } return parent; } - else if (parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + else if (parent.kind === 288 /* SyntaxKind.JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136850,7 +137786,7 @@ var ts; // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 10 /* SyntaxKind.StringLiteral */: - if (parent && ((parent.kind === 285 /* SyntaxKind.JsxAttribute */) || (parent.kind === 287 /* SyntaxKind.JsxSpreadAttribute */))) { + if (parent && ((parent.kind === 288 /* SyntaxKind.JsxAttribute */) || (parent.kind === 290 /* SyntaxKind.JsxSpreadAttribute */))) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136860,8 +137796,8 @@ var ts; break; case 19 /* SyntaxKind.CloseBraceToken */: if (parent && - parent.kind === 288 /* SyntaxKind.JsxExpression */ && - parent.parent && parent.parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + parent.kind === 291 /* SyntaxKind.JsxExpression */ && + parent.parent && parent.parent.kind === 288 /* SyntaxKind.JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136869,7 +137805,7 @@ var ts; // each JsxAttribute can have initializer as JsxExpression return parent.parent.parent.parent; } - if (parent && parent.kind === 287 /* SyntaxKind.JsxSpreadAttribute */) { + if (parent && parent.kind === 290 /* SyntaxKind.JsxSpreadAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136889,54 +137825,54 @@ var ts; var containingNodeKind = parent.kind; switch (contextToken.kind) { case 27 /* SyntaxKind.CommaToken */: - return containingNodeKind === 254 /* SyntaxKind.VariableDeclaration */ || + return containingNodeKind === 257 /* SyntaxKind.VariableDeclaration */ || isVariableDeclarationListButNotTypeArgument(contextToken) || - containingNodeKind === 237 /* SyntaxKind.VariableStatement */ || - containingNodeKind === 260 /* SyntaxKind.EnumDeclaration */ || // enum a { foo, | + containingNodeKind === 240 /* SyntaxKind.VariableStatement */ || + containingNodeKind === 263 /* SyntaxKind.EnumDeclaration */ || // enum a { foo, | isFunctionLikeButNotConstructor(containingNodeKind) || - containingNodeKind === 258 /* SyntaxKind.InterfaceDeclaration */ || // interface A= contextToken.pos); case 24 /* SyntaxKind.DotToken */: - return containingNodeKind === 202 /* SyntaxKind.ArrayBindingPattern */; // var [.| + return containingNodeKind === 204 /* SyntaxKind.ArrayBindingPattern */; // var [.| case 58 /* SyntaxKind.ColonToken */: - return containingNodeKind === 203 /* SyntaxKind.BindingElement */; // var {x :html| + return containingNodeKind === 205 /* SyntaxKind.BindingElement */; // var {x :html| case 22 /* SyntaxKind.OpenBracketToken */: - return containingNodeKind === 202 /* SyntaxKind.ArrayBindingPattern */; // var [x| + return containingNodeKind === 204 /* SyntaxKind.ArrayBindingPattern */; // var [x| case 20 /* SyntaxKind.OpenParenToken */: - return containingNodeKind === 292 /* SyntaxKind.CatchClause */ || + return containingNodeKind === 295 /* SyntaxKind.CatchClause */ || isFunctionLikeButNotConstructor(containingNodeKind); case 18 /* SyntaxKind.OpenBraceToken */: - return containingNodeKind === 260 /* SyntaxKind.EnumDeclaration */; // enum a { | + return containingNodeKind === 263 /* SyntaxKind.EnumDeclaration */; // enum a { | case 29 /* SyntaxKind.LessThanToken */: - return containingNodeKind === 257 /* SyntaxKind.ClassDeclaration */ || // class A< | - containingNodeKind === 226 /* SyntaxKind.ClassExpression */ || // var C = class D< | - containingNodeKind === 258 /* SyntaxKind.InterfaceDeclaration */ || // interface A< | - containingNodeKind === 259 /* SyntaxKind.TypeAliasDeclaration */ || // type List< | + return containingNodeKind === 260 /* SyntaxKind.ClassDeclaration */ || // class A< | + containingNodeKind === 228 /* SyntaxKind.ClassExpression */ || // var C = class D< | + containingNodeKind === 261 /* SyntaxKind.InterfaceDeclaration */ || // interface A< | + containingNodeKind === 262 /* SyntaxKind.TypeAliasDeclaration */ || // type List< | ts.isFunctionLikeKind(containingNodeKind); case 124 /* SyntaxKind.StaticKeyword */: - return containingNodeKind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isClassLike(parent.parent); + return containingNodeKind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isClassLike(parent.parent); case 25 /* SyntaxKind.DotDotDotToken */: - return containingNodeKind === 164 /* SyntaxKind.Parameter */ || - (!!parent.parent && parent.parent.kind === 202 /* SyntaxKind.ArrayBindingPattern */); // var [...z| + return containingNodeKind === 166 /* SyntaxKind.Parameter */ || + (!!parent.parent && parent.parent.kind === 204 /* SyntaxKind.ArrayBindingPattern */); // var [...z| case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - return containingNodeKind === 164 /* SyntaxKind.Parameter */ && !ts.isConstructorDeclaration(parent.parent); - case 127 /* SyntaxKind.AsKeyword */: - return containingNodeKind === 270 /* SyntaxKind.ImportSpecifier */ || - containingNodeKind === 275 /* SyntaxKind.ExportSpecifier */ || - containingNodeKind === 268 /* SyntaxKind.NamespaceImport */; - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: + return containingNodeKind === 166 /* SyntaxKind.Parameter */ && !ts.isConstructorDeclaration(parent.parent); + case 128 /* SyntaxKind.AsKeyword */: + return containingNodeKind === 273 /* SyntaxKind.ImportSpecifier */ || + containingNodeKind === 278 /* SyntaxKind.ExportSpecifier */ || + containingNodeKind === 271 /* SyntaxKind.NamespaceImport */; + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: return !isFromObjectTypeDeclaration(contextToken); case 79 /* SyntaxKind.Identifier */: - if (containingNodeKind === 270 /* SyntaxKind.ImportSpecifier */ && + if (containingNodeKind === 273 /* SyntaxKind.ImportSpecifier */ && contextToken === parent.name && contextToken.text === "type") { // import { type | } @@ -136951,11 +137887,11 @@ var ts; case 100 /* SyntaxKind.ImportKeyword */: case 119 /* SyntaxKind.LetKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: return true; - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: // import { type foo| } - return containingNodeKind !== 270 /* SyntaxKind.ImportSpecifier */; + return containingNodeKind !== 273 /* SyntaxKind.ImportSpecifier */; case 41 /* SyntaxKind.AsteriskToken */: return ts.isFunctionLike(contextToken.parent) && !ts.isMethodDeclaration(contextToken.parent); } @@ -136980,7 +137916,7 @@ var ts; case 126 /* SyntaxKind.AbstractKeyword */: case 84 /* SyntaxKind.ClassKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 92 /* SyntaxKind.EnumKeyword */: case 98 /* SyntaxKind.FunctionKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: @@ -136991,7 +137927,7 @@ var ts; case 124 /* SyntaxKind.StaticKeyword */: case 113 /* SyntaxKind.VarKeyword */: return true; - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: return ts.isPropertyDeclaration(contextToken.parent); } // If we are inside a class declaration, and `constructor` is totally not present, @@ -137000,7 +137936,7 @@ var ts; if (ancestorClassLike && contextToken === previousToken && isPreviousPropertyDeclarationTerminated(contextToken, position)) { return false; // Don't block completions. } - var ancestorPropertyDeclaraion = ts.getAncestor(contextToken.parent, 167 /* SyntaxKind.PropertyDeclaration */); + var ancestorPropertyDeclaraion = ts.getAncestor(contextToken.parent, 169 /* SyntaxKind.PropertyDeclaration */); // If we are inside a class declaration and typing `constructor` after property declaration... if (ancestorPropertyDeclaraion && contextToken !== previousToken @@ -137032,7 +137968,7 @@ var ts; || !ts.positionsAreOnSameLine(contextToken.end, position, sourceFile)); } function isFunctionLikeButNotConstructor(kind) { - return ts.isFunctionLikeKind(kind) && kind !== 171 /* SyntaxKind.Constructor */; + return ts.isFunctionLikeKind(kind) && kind !== 173 /* SyntaxKind.Constructor */; } function isDotOfNumericLiteral(contextToken) { if (contextToken.kind === 8 /* SyntaxKind.NumericLiteral */) { @@ -137042,7 +137978,7 @@ var ts; return false; } function isVariableDeclarationListButNotTypeArgument(node) { - return node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */ + return node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */ && !ts.isPossiblyTypeArgumentPosition(node, sourceFile, typeChecker); } /** @@ -137060,13 +137996,13 @@ var ts; for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 296 /* SyntaxKind.PropertyAssignment */ && - m.kind !== 297 /* SyntaxKind.ShorthandPropertyAssignment */ && - m.kind !== 203 /* SyntaxKind.BindingElement */ && - m.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - m.kind !== 172 /* SyntaxKind.GetAccessor */ && - m.kind !== 173 /* SyntaxKind.SetAccessor */ && - m.kind !== 298 /* SyntaxKind.SpreadAssignment */) { + if (m.kind !== 299 /* SyntaxKind.PropertyAssignment */ && + m.kind !== 300 /* SyntaxKind.ShorthandPropertyAssignment */ && + m.kind !== 205 /* SyntaxKind.BindingElement */ && + m.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + m.kind !== 174 /* SyntaxKind.GetAccessor */ && + m.kind !== 175 /* SyntaxKind.SetAccessor */ && + m.kind !== 301 /* SyntaxKind.SpreadAssignment */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -137157,10 +138093,10 @@ var ts; for (var _i = 0, existingMembers_2 = existingMembers; _i < existingMembers_2.length; _i++) { var m = existingMembers_2[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && - m.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - m.kind !== 172 /* SyntaxKind.GetAccessor */ && - m.kind !== 173 /* SyntaxKind.SetAccessor */) { + if (m.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && + m.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + m.kind !== 174 /* SyntaxKind.GetAccessor */ && + m.kind !== 175 /* SyntaxKind.SetAccessor */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -137202,7 +138138,7 @@ var ts; if (isCurrentlyEditingNode(attr)) { continue; } - if (attr.kind === 285 /* SyntaxKind.JsxAttribute */) { + if (attr.kind === 288 /* SyntaxKind.JsxAttribute */) { seenNames.add(attr.name.escapedText); } else if (ts.isJsxSpreadAttribute(attr)) { @@ -137300,7 +138236,7 @@ var ts; var _keywordCompletions = []; var allKeywordsCompletions = ts.memoize(function () { var res = []; - for (var i = 81 /* SyntaxKind.FirstKeyword */; i <= 160 /* SyntaxKind.LastKeyword */; i++) { + for (var i = 81 /* SyntaxKind.FirstKeyword */; i <= 162 /* SyntaxKind.LastKeyword */; i++) { res.push({ name: ts.tokenToString(i), kind: "keyword" /* ScriptElementKind.keyword */, @@ -137326,12 +138262,12 @@ var ts; return false; case 1 /* KeywordCompletionFilters.All */: return isFunctionLikeBodyKeyword(kind) - || kind === 135 /* SyntaxKind.DeclareKeyword */ - || kind === 141 /* SyntaxKind.ModuleKeyword */ - || kind === 152 /* SyntaxKind.TypeKeyword */ - || kind === 142 /* SyntaxKind.NamespaceKeyword */ + || kind === 136 /* SyntaxKind.DeclareKeyword */ + || kind === 142 /* SyntaxKind.ModuleKeyword */ + || kind === 154 /* SyntaxKind.TypeKeyword */ + || kind === 143 /* SyntaxKind.NamespaceKeyword */ || kind === 126 /* SyntaxKind.AbstractKeyword */ - || ts.isTypeKeyword(kind) && kind !== 153 /* SyntaxKind.UndefinedKeyword */; + || ts.isTypeKeyword(kind) && kind !== 155 /* SyntaxKind.UndefinedKeyword */; case 5 /* KeywordCompletionFilters.FunctionLikeBodyKeywords */: return isFunctionLikeBodyKeyword(kind); case 2 /* KeywordCompletionFilters.ClassElementKeywords */: @@ -137345,7 +138281,7 @@ var ts; case 7 /* KeywordCompletionFilters.TypeKeywords */: return ts.isTypeKeyword(kind); case 8 /* KeywordCompletionFilters.TypeKeyword */: - return kind === 152 /* SyntaxKind.TypeKeyword */; + return kind === 154 /* SyntaxKind.TypeKeyword */; default: return ts.Debug.assertNever(keywordFilter); } @@ -137354,59 +138290,61 @@ var ts; function isTypeScriptOnlyKeyword(kind) { switch (kind) { case 126 /* SyntaxKind.AbstractKeyword */: - case 130 /* SyntaxKind.AnyKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 92 /* SyntaxKind.EnumKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: case 117 /* SyntaxKind.ImplementsKeyword */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 139 /* SyntaxKind.IsKeyword */: - case 140 /* SyntaxKind.KeyOfKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 140 /* SyntaxKind.IsKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: return true; default: return false; } } function isInterfaceOrTypeLiteralCompletionKeyword(kind) { - return kind === 145 /* SyntaxKind.ReadonlyKeyword */; + return kind === 146 /* SyntaxKind.ReadonlyKeyword */; } function isClassMemberCompletionKeyword(kind) { switch (kind) { case 126 /* SyntaxKind.AbstractKeyword */: - case 134 /* SyntaxKind.ConstructorKeyword */: - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: return true; default: return ts.isClassMemberModifier(kind); } } function isFunctionLikeBodyKeyword(kind) { - return kind === 131 /* SyntaxKind.AsyncKeyword */ - || kind === 132 /* SyntaxKind.AwaitKeyword */ - || kind === 127 /* SyntaxKind.AsKeyword */ - || kind === 152 /* SyntaxKind.TypeKeyword */ + return kind === 132 /* SyntaxKind.AsyncKeyword */ + || kind === 133 /* SyntaxKind.AwaitKeyword */ + || kind === 128 /* SyntaxKind.AsKeyword */ + || kind === 150 /* SyntaxKind.SatisfiesKeyword */ + || kind === 154 /* SyntaxKind.TypeKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind); } function keywordForNode(node) { @@ -137431,7 +138369,7 @@ var ts; && contextToken === parent.moduleSpecifier && tokenLine === currentLine) { entries.push({ - name: ts.tokenToString(129 /* SyntaxKind.AssertKeyword */), + name: ts.tokenToString(130 /* SyntaxKind.AssertKeyword */), kind: "keyword" /* ScriptElementKind.keyword */, kindModifiers: "" /* ScriptElementKindModifier.none */, sortText: Completions.SortText.GlobalsOrKeywords, @@ -137497,7 +138435,7 @@ var ts; function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location, position) { // class c { method() { } | method2() { } } switch (location.kind) { - case 348 /* SyntaxKind.SyntaxList */: + case 351 /* SyntaxKind.SyntaxList */: return ts.tryCast(location.parent, ts.isObjectTypeDeclaration); case 1 /* SyntaxKind.EndOfFileToken */: var cls = ts.tryCast(ts.lastOrUndefined(ts.cast(location.parent, ts.isSourceFile).statements), ts.isObjectTypeDeclaration); @@ -137523,7 +138461,7 @@ var ts; if (!contextToken) return undefined; // class C { blah; constructor/**/ } and so on - if (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ + if (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ // class C { blah \n constructor/**/ } || (ts.isIdentifier(contextToken) && ts.isPropertyDeclaration(contextToken.parent) && ts.isClassLike(location))) { return ts.findAncestor(contextToken, ts.isClassLike); @@ -137566,7 +138504,7 @@ var ts; case 26 /* SyntaxKind.SemicolonToken */: case 27 /* SyntaxKind.CommaToken */: case 79 /* SyntaxKind.Identifier */: - if (parent.kind === 166 /* SyntaxKind.PropertySignature */ && ts.isTypeLiteralNode(parent.parent)) { + if (parent.kind === 168 /* SyntaxKind.PropertySignature */ && ts.isTypeLiteralNode(parent.parent)) { return parent.parent; } break; @@ -137583,11 +138521,11 @@ var ts; if (!t) return undefined; switch (node.kind) { - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return checker.getTypeOfPropertyOfContextualType(t, node.symbol.escapedName); - case 188 /* SyntaxKind.IntersectionType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 187 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 189 /* SyntaxKind.UnionType */: return t; } } @@ -137615,7 +138553,7 @@ var ts; ? !!ts.tryGetImportFromModuleSpecifier(contextToken) : contextToken.kind === 43 /* SyntaxKind.SlashToken */ && ts.isJsxClosingElement(contextToken.parent)); case " ": - return !!contextToken && ts.isImportKeyword(contextToken) && contextToken.parent.kind === 305 /* SyntaxKind.SourceFile */; + return !!contextToken && ts.isImportKeyword(contextToken) && contextToken.parent.kind === 308 /* SyntaxKind.SourceFile */; default: return ts.Debug.assertNever(triggerCharacter); } @@ -137662,21 +138600,22 @@ var ts; return undefined; } function getImportStatementCompletionInfo(contextToken) { + var _a, _b, _c; var keywordCompletion; var isKeywordOnlyCompletion = false; var candidate = getCandidate(); return { isKeywordOnlyCompletion: isKeywordOnlyCompletion, keywordCompletion: keywordCompletion, - isNewIdentifierLocation: !!(candidate || keywordCompletion === 152 /* SyntaxKind.TypeKeyword */), - replacementNode: candidate && ts.rangeIsOnSingleLine(candidate, candidate.getSourceFile()) - ? candidate - : undefined + isNewIdentifierLocation: !!(candidate || keywordCompletion === 154 /* SyntaxKind.TypeKeyword */), + isTopLevelTypeOnly: !!((_b = (_a = ts.tryCast(candidate, ts.isImportDeclaration)) === null || _a === void 0 ? void 0 : _a.importClause) === null || _b === void 0 ? void 0 : _b.isTypeOnly) || !!((_c = ts.tryCast(candidate, ts.isImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.isTypeOnly), + couldBeTypeOnlyImportSpecifier: !!candidate && couldBeTypeOnlyImportSpecifier(candidate, contextToken), + replacementSpan: getSingleLineReplacementSpanForImportCompletionNode(candidate), }; function getCandidate() { var parent = contextToken.parent; if (ts.isImportEqualsDeclaration(parent)) { - keywordCompletion = contextToken.kind === 152 /* SyntaxKind.TypeKeyword */ ? undefined : 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = contextToken.kind === 154 /* SyntaxKind.TypeKeyword */ ? undefined : 154 /* SyntaxKind.TypeKeyword */; return isModuleSpecifierMissingOrEmpty(parent.moduleReference) ? parent : undefined; } if (couldBeTypeOnlyImportSpecifier(parent, contextToken) && canCompleteFromNamedBindings(parent.parent)) { @@ -137686,13 +138625,13 @@ var ts; if (!parent.parent.isTypeOnly && (contextToken.kind === 18 /* SyntaxKind.OpenBraceToken */ || contextToken.kind === 100 /* SyntaxKind.ImportKeyword */ || contextToken.kind === 27 /* SyntaxKind.CommaToken */)) { - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; } if (canCompleteFromNamedBindings(parent)) { // At `import { ... } |` or `import * as Foo |`, the only possible completion is `from` if (contextToken.kind === 19 /* SyntaxKind.CloseBraceToken */ || contextToken.kind === 79 /* SyntaxKind.Identifier */) { isKeywordOnlyCompletion = true; - keywordCompletion = 156 /* SyntaxKind.FromKeyword */; + keywordCompletion = 158 /* SyntaxKind.FromKeyword */; } else { return parent.parent.parent; @@ -137702,25 +138641,82 @@ var ts; } if (ts.isImportKeyword(contextToken) && ts.isSourceFile(parent)) { // A lone import keyword with nothing following it does not parse as a statement at all - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; return contextToken; } if (ts.isImportKeyword(contextToken) && ts.isImportDeclaration(parent)) { // `import s| from` - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; return isModuleSpecifierMissingOrEmpty(parent.moduleSpecifier) ? parent : undefined; } return undefined; } } + function getSingleLineReplacementSpanForImportCompletionNode(node) { + var _a, _b, _c; + if (!node) + return undefined; + var top = (_a = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration))) !== null && _a !== void 0 ? _a : node; + var sourceFile = top.getSourceFile(); + if (ts.rangeIsOnSingleLine(top, sourceFile)) { + return ts.createTextSpanFromNode(top, sourceFile); + } + // ImportKeyword was necessarily on one line; ImportSpecifier was necessarily parented in an ImportDeclaration + ts.Debug.assert(top.kind !== 100 /* SyntaxKind.ImportKeyword */ && top.kind !== 273 /* SyntaxKind.ImportSpecifier */); + // Guess which point in the import might actually be a later statement parsed as part of the import + // during parser recovery - either in the middle of named imports, or the module specifier. + var potentialSplitPoint = top.kind === 269 /* SyntaxKind.ImportDeclaration */ + ? (_c = getPotentiallyInvalidImportSpecifier((_b = top.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings)) !== null && _c !== void 0 ? _c : top.moduleSpecifier + : top.moduleReference; + var withoutModuleSpecifier = { + pos: top.getFirstToken().getStart(), + end: potentialSplitPoint.pos, + }; + // The module specifier/reference was previously found to be missing, empty, or + // not a string literal - in this last case, it's likely that statement on a following + // line was parsed as the module specifier of a partially-typed import, e.g. + // import Foo| + // interface Blah {} + // This appears to be a multiline-import, and editors can't replace multiple lines. + // But if everything but the "module specifier" is on one line, by this point we can + // assume that the "module specifier" is actually just another statement, and return + // the single-line range of the import excluding that probable statement. + if (ts.rangeIsOnSingleLine(withoutModuleSpecifier, sourceFile)) { + return ts.createTextSpanFromRange(withoutModuleSpecifier); + } + } + // Tries to identify the first named import that is not really a named import, but rather + // just parser recovery for a situation like: + // import { Foo| + // interface Bar {} + // in which `Foo`, `interface`, and `Bar` are all parsed as import specifiers. The caller + // will also check if this token is on a separate line from the rest of the import. + function getPotentiallyInvalidImportSpecifier(namedBindings) { + var _a; + return ts.find((_a = ts.tryCast(namedBindings, ts.isNamedImports)) === null || _a === void 0 ? void 0 : _a.elements, function (e) { + var _a; + return !e.propertyName && + ts.isStringANonContextualKeyword(e.name.text) && + ((_a = ts.findPrecedingToken(e.name.pos, namedBindings.getSourceFile(), namedBindings)) === null || _a === void 0 ? void 0 : _a.kind) !== 27 /* SyntaxKind.CommaToken */; + }); + } function couldBeTypeOnlyImportSpecifier(importSpecifier, contextToken) { return ts.isImportSpecifier(importSpecifier) && (importSpecifier.isTypeOnly || contextToken === importSpecifier.name && ts.isTypeKeywordTokenOrIdentifier(contextToken)); } function canCompleteFromNamedBindings(namedBindings) { - return isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) - && (ts.isNamespaceImport(namedBindings) || namedBindings.elements.length < 2) - && !namedBindings.parent.name; + if (!isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) || namedBindings.parent.name) { + return false; + } + if (ts.isNamedImports(namedBindings)) { + // We can only complete on named imports if there are no other named imports already, + // but parser recovery sometimes puts later statements in the named imports list, so + // we try to only consider the probably-valid ones. + var invalidNamedImport = getPotentiallyInvalidImportSpecifier(namedBindings); + var validImports = invalidNamedImport ? namedBindings.elements.indexOf(invalidNamedImport) : namedBindings.elements.length; + return validImports < 2; + } + return true; } function isModuleSpecifierMissingOrEmpty(specifier) { var _a; @@ -137739,7 +138735,6 @@ var ts; function isArrowFunctionBody(node) { return node.parent && ts.isArrowFunction(node.parent) && node.parent.body === node; } - ; /** True if symbol is a type or a module containing at least one type. */ function symbolCanBeReferencedAtTypeLocation(symbol, checker, seenModules) { if (seenModules === void 0) { seenModules = new ts.Map(); } @@ -137888,14 +138883,14 @@ var ts; case 115 /* SyntaxKind.WhileKeyword */: case 90 /* SyntaxKind.DoKeyword */: return useParent(node.parent, function (n) { return ts.isIterationStatement(n, /*lookInLabeledStatements*/ true); }, getLoopBreakContinueOccurrences); - case 134 /* SyntaxKind.ConstructorKeyword */: - return getFromAllDeclarations(ts.isConstructorDeclaration, [134 /* SyntaxKind.ConstructorKeyword */]); - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - return getFromAllDeclarations(ts.isAccessor, [136 /* SyntaxKind.GetKeyword */, 149 /* SyntaxKind.SetKeyword */]); - case 132 /* SyntaxKind.AwaitKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: + return getFromAllDeclarations(ts.isConstructorDeclaration, [135 /* SyntaxKind.ConstructorKeyword */]); + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + return getFromAllDeclarations(ts.isAccessor, [137 /* SyntaxKind.GetKeyword */, 151 /* SyntaxKind.SetKeyword */]); + case 133 /* SyntaxKind.AwaitKeyword */: return useParent(node.parent, ts.isAwaitExpression, getAsyncAndAwaitOccurrences); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: return highlightSpans(getAsyncAndAwaitOccurrences(node)); case 125 /* SyntaxKind.YieldKeyword */: return highlightSpans(getYieldOccurrences(node)); @@ -137942,7 +138937,7 @@ var ts; var child = throwStatement; while (child.parent) { var parent = child.parent; - if (ts.isFunctionBlock(parent) || parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (ts.isFunctionBlock(parent) || parent.kind === 308 /* SyntaxKind.SourceFile */) { return parent; } // A throw-statement is only owned by a try-statement if the try-statement has @@ -137974,16 +138969,16 @@ var ts; function getBreakOrContinueOwner(statement) { return ts.findAncestor(statement, function (node) { switch (node.kind) { - case 249 /* SyntaxKind.SwitchStatement */: - if (statement.kind === 245 /* SyntaxKind.ContinueStatement */) { + case 252 /* SyntaxKind.SwitchStatement */: + if (statement.kind === 248 /* SyntaxKind.ContinueStatement */) { return false; } // falls through - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: return !statement.label || isLabeledBy(node, statement.label.escapedText); default: // Don't cross function boundaries. @@ -137999,26 +138994,26 @@ var ts; // Types of node whose children might have modifiers. var container = declaration.parent; switch (container.kind) { - case 262 /* SyntaxKind.ModuleBlock */: - case 305 /* SyntaxKind.SourceFile */: - case 235 /* SyntaxKind.Block */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 265 /* SyntaxKind.ModuleBlock */: + case 308 /* SyntaxKind.SourceFile */: + case 238 /* SyntaxKind.Block */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // Container is either a class declaration or the declaration is a classDeclaration - if (modifierFlag & 128 /* ModifierFlags.Abstract */ && ts.isClassDeclaration(declaration)) { + if (modifierFlag & 256 /* ModifierFlags.Abstract */ && ts.isClassDeclaration(declaration)) { return __spreadArray(__spreadArray([], declaration.members, true), [declaration], false); } else { return container.statements; } - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return __spreadArray(__spreadArray([], container.parameters, true), (ts.isClassLike(container.parent) ? container.parent.members : []), true); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: var nodes = container.members; // If we're an accessibility modifier, we're in an instance member and should search // the constructor's parameter list for instance members as well. @@ -138028,12 +139023,12 @@ var ts; return __spreadArray(__spreadArray([], nodes, true), constructor.parameters, true); } } - else if (modifierFlag & 128 /* ModifierFlags.Abstract */) { + else if (modifierFlag & 256 /* ModifierFlags.Abstract */) { return __spreadArray(__spreadArray([], nodes, true), [container], false); } return nodes; // Syntactically invalid positions that the parser might produce anyway - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return undefined; default: ts.Debug.assertNever(container, "Invalid container kind."); @@ -138054,7 +139049,7 @@ var ts; var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 97 /* SyntaxKind.ForKeyword */, 115 /* SyntaxKind.WhileKeyword */, 90 /* SyntaxKind.DoKeyword */)) { // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 240 /* SyntaxKind.DoStatement */) { + if (loopNode.kind === 243 /* SyntaxKind.DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 115 /* SyntaxKind.WhileKeyword */)) { @@ -138074,13 +139069,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -138153,13 +139148,13 @@ var ts; var keywords = []; if (func.modifiers) { func.modifiers.forEach(function (modifier) { - pushKeywordIf(keywords, modifier, 131 /* SyntaxKind.AsyncKeyword */); + pushKeywordIf(keywords, modifier, 132 /* SyntaxKind.AsyncKeyword */); }); } ts.forEachChild(func, function (child) { traverseWithoutCrossingFunction(child, function (node) { if (ts.isAwaitExpression(node)) { - pushKeywordIf(keywords, node.getFirstToken(), 132 /* SyntaxKind.AwaitKeyword */); + pushKeywordIf(keywords, node.getFirstToken(), 133 /* SyntaxKind.AwaitKeyword */); } }); }); @@ -138543,14 +139538,14 @@ var ts; if (cancellationToken) cancellationToken.throwIfCancellationRequested(); switch (direct.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(direct)) { handleImportCall(direct); break; } if (!isAvailableThroughGlobal) { var parent = direct.parent; - if (exportKind === 2 /* ExportKind.ExportEquals */ && parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (exportKind === 2 /* ExportKind.ExportEquals */ && parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { var name = parent.name; if (name.kind === 79 /* SyntaxKind.Identifier */) { directImports.push(name); @@ -138561,25 +139556,25 @@ var ts; break; case 79 /* SyntaxKind.Identifier */: // for 'const x = require("y"); break; // TODO: GH#23879 - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: handleNamespaceImport(direct, direct.name, ts.hasSyntacticModifier(direct, 1 /* ModifierFlags.Export */), /*alreadyAddedDirect*/ false); break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: directImports.push(direct); var namedBindings = direct.importClause && direct.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings && namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { handleNamespaceImport(direct, namedBindings.name, /*isReExport*/ false, /*alreadyAddedDirect*/ true); } else if (!isAvailableThroughGlobal && ts.isDefaultImport(direct)) { addIndirectUser(getSourceFileLikeForImportDeclaration(direct)); // Add a check for indirect uses to handle synthetic default imports } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (!direct.exportClause) { // This is `export * from "foo"`, so imports of this module may import the export too. handleDirectImports(getContainingModuleSymbol(direct, checker)); } - else if (direct.exportClause.kind === 274 /* SyntaxKind.NamespaceExport */) { + else if (direct.exportClause.kind === 277 /* SyntaxKind.NamespaceExport */) { // `export * as foo from "foo"` add to indirect uses addIndirectUser(getSourceFileLikeForImportDeclaration(direct), /** addTransitiveDependencies */ true); } @@ -138588,7 +139583,7 @@ var ts; directImports.push(direct); } break; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: // Only check for typeof import('xyz') if (direct.isTypeOf && !direct.qualifier && isExported(direct)) { addIndirectUser(direct.getSourceFile(), /** addTransitiveDependencies */ true); @@ -138621,7 +139616,7 @@ var ts; } else if (!isAvailableThroughGlobal) { var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration); - ts.Debug.assert(sourceFileLike.kind === 305 /* SyntaxKind.SourceFile */ || sourceFileLike.kind === 261 /* SyntaxKind.ModuleDeclaration */); + ts.Debug.assert(sourceFileLike.kind === 308 /* SyntaxKind.SourceFile */ || sourceFileLike.kind === 264 /* SyntaxKind.ModuleDeclaration */); if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) { addIndirectUser(sourceFileLike, /** addTransitiveDependencies */ true); } @@ -138677,7 +139672,7 @@ var ts; } return { importSearches: importSearches, singleReferences: singleReferences }; function handleImport(decl) { - if (decl.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (decl.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { if (isExternalModuleImportEquals(decl)) { handleNamespaceImportLike(decl.name); } @@ -138687,7 +139682,7 @@ var ts; handleNamespaceImportLike(decl); return; } - if (decl.kind === 200 /* SyntaxKind.ImportType */) { + if (decl.kind === 202 /* SyntaxKind.ImportType */) { if (decl.qualifier) { var firstIdentifier = ts.getFirstIdentifier(decl.qualifier); if (firstIdentifier.escapedText === ts.symbolName(exportSymbol)) { @@ -138703,7 +139698,7 @@ var ts; if (decl.moduleSpecifier.kind !== 10 /* SyntaxKind.StringLiteral */) { return; } - if (decl.kind === 272 /* SyntaxKind.ExportDeclaration */) { + if (decl.kind === 275 /* SyntaxKind.ExportDeclaration */) { if (decl.exportClause && ts.isNamedExports(decl.exportClause)) { searchForNamedImport(decl.exportClause); } @@ -138712,10 +139707,10 @@ var ts; var _a = decl.importClause || { name: undefined, namedBindings: undefined }, name = _a.name, namedBindings = _a.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: handleNamespaceImportLike(namedBindings.name); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: // 'default' might be accessed as a named import `{ default as foo }`. if (exportKind === 0 /* ExportKind.Named */ || exportKind === 1 /* ExportKind.Default */) { searchForNamedImport(namedBindings); @@ -138765,7 +139760,7 @@ var ts; } } else { - var localSymbol = element.kind === 275 /* SyntaxKind.ExportSpecifier */ && element.propertyName + var localSymbol = element.kind === 278 /* SyntaxKind.ExportSpecifier */ && element.propertyName ? checker.getExportSpecifierLocalTargetSymbol(element) // For re-exporting under a different name, we want to get the re-exported symbol. : checker.getSymbolAtLocation(name); addSearch(name, localSymbol); @@ -138794,7 +139789,7 @@ var ts; for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { var referencingFile = sourceFiles_1[_i]; var searchSourceFile = searchModuleSymbol.valueDeclaration; - if ((searchSourceFile === null || searchSourceFile === void 0 ? void 0 : searchSourceFile.kind) === 305 /* SyntaxKind.SourceFile */) { + if ((searchSourceFile === null || searchSourceFile === void 0 ? void 0 : searchSourceFile.kind) === 308 /* SyntaxKind.SourceFile */) { for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) { var ref = _b[_a]; if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) { @@ -138842,7 +139837,7 @@ var ts; } /** Iterates over all statements at the top level or in module declarations. Returns the first truthy result. */ function forEachPossibleImportOrExportStatement(sourceFileLike, action) { - return ts.forEach(sourceFileLike.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { + return ts.forEach(sourceFileLike.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { return action(statement) || (isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action)); }); } @@ -138857,15 +139852,15 @@ var ts; else { forEachPossibleImportOrExportStatement(sourceFile, function (statement) { switch (statement.kind) { - case 272 /* SyntaxKind.ExportDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: { + case 275 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: { var decl = statement; if (decl.moduleSpecifier && ts.isStringLiteral(decl.moduleSpecifier)) { action(decl, decl.moduleSpecifier); } break; } - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { var decl = statement; if (isExternalModuleImportEquals(decl)) { action(decl, decl.moduleReference.expression); @@ -138890,7 +139885,7 @@ var ts; var parent = node.parent; var grandparent = parent.parent; if (symbol.exportSymbol) { - if (parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { // When accessing an export of a JS module, there's no alias. The symbol will still be flagged as an export even though we're at the use. // So check that we are at the declaration. return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d === parent; })) && ts.isBinaryExpression(grandparent) @@ -138974,6 +139969,8 @@ var ts; // Similarly, skip past the symbol for 'export =' if (importedSymbol.escapedName === "export=") { importedSymbol = getExportEqualsLocalSymbol(importedSymbol, checker); + if (importedSymbol === undefined) + return undefined; } // If the import has a different name than the export, do not continue searching. // If `importedName` is undefined, do continue searching as the export is anonymous. @@ -138989,25 +139986,25 @@ var ts; } // Not meant for use with export specifiers or export assignment. function getExportKindForDeclaration(node) { - return ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) ? 1 /* ExportKind.Default */ : 0 /* ExportKind.Named */; + return ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) ? 1 /* ExportKind.Default */ : 0 /* ExportKind.Named */; } } FindAllReferences.getImportOrExportSymbol = getImportOrExportSymbol; function getExportEqualsLocalSymbol(importedSymbol, checker) { if (importedSymbol.flags & 2097152 /* SymbolFlags.Alias */) { - return ts.Debug.checkDefined(checker.getImmediateAliasedSymbol(importedSymbol)); + return checker.getImmediateAliasedSymbol(importedSymbol); } var decl = ts.Debug.checkDefined(importedSymbol.valueDeclaration); if (ts.isExportAssignment(decl)) { // `export = class {}` - return ts.Debug.checkDefined(decl.expression.symbol); + return decl.expression.symbol; } else if (ts.isBinaryExpression(decl)) { // `module.exports = class {}` - return ts.Debug.checkDefined(decl.right.symbol); + return decl.right.symbol; } else if (ts.isSourceFile(decl)) { // json module - return ts.Debug.checkDefined(decl.symbol); + return decl.symbol; } - return ts.Debug.fail(); + return undefined; } // If a reference is a class expression, the exported node would be its parent. // If a reference is a variable declaration, the exported node would be the variable statement. @@ -139024,16 +140021,16 @@ var ts; function isNodeImport(node) { var parent = node.parent; switch (parent.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return parent.name === node && isExternalModuleImportEquals(parent); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: // For a rename import `{ foo as bar }`, don't search for the imported symbol. Just find local uses of `bar`. return !parent.propertyName; - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: ts.Debug.assert(parent.name === node); return true; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(parent.parent.parent); default: return false; @@ -139074,21 +140071,21 @@ var ts; return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol); } function getSourceFileLikeForImportDeclaration(node) { - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { return node.getSourceFile(); } var parent = node.parent; - if (parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */) { return parent; } - ts.Debug.assert(parent.kind === 262 /* SyntaxKind.ModuleBlock */); + ts.Debug.assert(parent.kind === 265 /* SyntaxKind.ModuleBlock */); return ts.cast(parent.parent, isAmbientModuleDeclaration); } function isAmbientModuleDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && node.name.kind === 10 /* SyntaxKind.StringLiteral */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && node.name.kind === 10 /* SyntaxKind.StringLiteral */; } function isExternalModuleImportEquals(eq) { - return eq.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* SyntaxKind.StringLiteral */; + return eq.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* SyntaxKind.StringLiteral */; } })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); @@ -139182,7 +140179,7 @@ var ts; ((ts.isImportOrExportSpecifier(node.parent) || ts.isBindingElement(node.parent)) && node.parent.propertyName === node) || // Is default export - (node.kind === 88 /* SyntaxKind.DefaultKeyword */ && ts.hasSyntacticModifier(node.parent, 513 /* ModifierFlags.ExportDefault */))) { + (node.kind === 88 /* SyntaxKind.DefaultKeyword */ && ts.hasSyntacticModifier(node.parent, 1025 /* ModifierFlags.ExportDefault */))) { return getContextNode(node.parent); } return undefined; @@ -139191,7 +140188,7 @@ var ts; if (!node) return undefined; switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return !ts.isVariableDeclarationList(node.parent) || node.parent.declarations.length !== 1 ? node : ts.isVariableStatement(node.parent.parent) ? @@ -139199,28 +140196,28 @@ var ts; ts.isForInOrOfStatement(node.parent.parent) ? getContextNode(node.parent.parent) : node.parent; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getContextNode(node.parent.parent); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent; - case 275 /* SyntaxKind.ExportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent; - case 267 /* SyntaxKind.ImportClause */: - case 274 /* SyntaxKind.NamespaceExport */: + case 270 /* SyntaxKind.ImportClause */: + case 277 /* SyntaxKind.NamespaceExport */: return node.parent; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return ts.isExpressionStatement(node.parent) ? node.parent : node; - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return { start: node.initializer, end: node.expression }; - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent) ? getContextNode(ts.findAncestor(node.parent, function (node) { return ts.isBinaryExpression(node) || ts.isForInOrOfStatement(node); @@ -139281,15 +140278,15 @@ var ts; return node.kind === 88 /* SyntaxKind.DefaultKeyword */ || !!ts.getDeclarationFromName(node) || ts.isLiteralComputedPropertyDeclarationName(node) - || (node.kind === 134 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent)); + || (node.kind === 135 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent)); } function getImplementationsAtPosition(program, cancellationToken, sourceFiles, sourceFile, position) { var node = ts.getTouchingPropertyName(sourceFile, position); var referenceEntries; var entries = getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position); - if (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || node.parent.kind === 203 /* SyntaxKind.BindingElement */ - || node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ + if (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || node.parent.kind === 205 /* SyntaxKind.BindingElement */ + || node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ || node.kind === 106 /* SyntaxKind.SuperKeyword */) { referenceEntries = entries && __spreadArray([], entries, true); } @@ -139313,13 +140310,13 @@ var ts; } FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition; function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return undefined; } var checker = program.getTypeChecker(); // If invoked directly on a shorthand property assignment, then return // the declaration of the symbol being assigned (not the symbol being assigned to). - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var result_2 = []; Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_2.push(nodeEntry(node)); }); return result_2; @@ -139495,13 +140492,13 @@ var ts; if (symbol) { return getDefinitionKindAndDisplayParts(symbol, checker, node); } - else if (node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + else if (node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return { kind: "interface" /* ScriptElementKind.interfaceElement */, displayParts: [ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */), ts.textPart("object literal"), ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)] }; } - else if (node.kind === 226 /* SyntaxKind.ClassExpression */) { + else if (node.kind === 228 /* SyntaxKind.ClassExpression */) { return { kind: "local class" /* ScriptElementKind.localClassElement */, displayParts: [ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */), ts.textPart("anonymous local class"), ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)] @@ -139555,7 +140552,7 @@ var ts; var source = ts.getDeclarationFromName(node) || (node.kind === 88 /* SyntaxKind.DefaultKeyword */ ? node.parent : ts.isLiteralComputedPropertyDeclarationName(node) ? node.parent.parent - : node.kind === 134 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent) ? node.parent.parent + : node.kind === 135 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent) ? node.parent.parent : undefined); var commonjsSource = source && ts.isBinaryExpression(source) ? source.left : undefined; return !!(source && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d === source || d === commonjsSource; }))); @@ -139570,47 +140567,47 @@ var ts; if (!!(decl.flags & 16777216 /* NodeFlags.Ambient */)) return true; switch (decl.kind) { - case 221 /* SyntaxKind.BinaryExpression */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: case 88 /* SyntaxKind.DefaultKeyword */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: // default import - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 285 /* SyntaxKind.JsxAttribute */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 274 /* SyntaxKind.NamespaceExport */: - case 164 /* SyntaxKind.Parameter */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 163 /* SyntaxKind.TypeParameter */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: // default import + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 288 /* SyntaxKind.JsxAttribute */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 277 /* SyntaxKind.NamespaceExport */: + case 166 /* SyntaxKind.Parameter */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: return true; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // In `({ x: y } = 0);`, `x` is not a write access. (Won't call this function for `y`.) return !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(decl.parent); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return !!decl.body; - case 254 /* SyntaxKind.VariableDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return !!decl.initializer || ts.isCatchClause(decl.parent); - case 168 /* SyntaxKind.MethodSignature */: - case 166 /* SyntaxKind.PropertySignature */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: + case 170 /* SyntaxKind.MethodSignature */: + case 168 /* SyntaxKind.PropertySignature */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return false; default: return ts.Debug.failBadSyntaxKind(decl); @@ -139836,10 +140833,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; switch (decl.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // Don't include the source file itself. (This may not be ideal behavior, but awkward to include an entire file as a reference.) break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (sourceFilesSet.has(decl.getSourceFile().fileName)) { references.push(nodeEntry(decl.name)); } @@ -139868,9 +140865,9 @@ var ts; } /** As in a `readonly prop: any` or `constructor(readonly prop: any)`, not a `readonly any[]`. */ function isReadonlyTypeOperator(node) { - return node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ + return node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(node.parent) - && node.parent.operator === 145 /* SyntaxKind.ReadonlyKeyword */; + && node.parent.operator === 146 /* SyntaxKind.ReadonlyKeyword */; } /** getReferencedSymbols for special node kinds. */ function getReferencedSymbolsSpecial(node, sourceFiles, cancellationToken) { @@ -139881,12 +140878,12 @@ var ts; } // A modifier readonly (like on a property declaration) is not special; // a readonly type keyword (like `readonly string[]`) is. - if (node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ && !isReadonlyTypeOperator(node)) { + if (node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && !isReadonlyTypeOperator(node)) { return undefined; } // Likewise, when we *are* looking for a special keyword, make sure we // *don’t* include readonly member modifiers. - return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken, node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ ? isReadonlyTypeOperator : undefined); + return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken, node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ ? isReadonlyTypeOperator : undefined); } if (ts.isImportMeta(node.parent) && node.parent.name === node) { return getAllReferencesForImportMeta(sourceFiles, cancellationToken); @@ -139953,8 +140950,8 @@ var ts; } function getSpecialSearchKind(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 134 /* SyntaxKind.ConstructorKeyword */: + case 173 /* SyntaxKind.Constructor */: + case 135 /* SyntaxKind.ConstructorKeyword */: return 1 /* SpecialSearchKind.Constructor */; case 79 /* SyntaxKind.Identifier */: if (ts.isClassLike(node.parent)) { @@ -140202,7 +141199,7 @@ var ts; // If this is the symbol of a named function expression or named class expression, // then named references are limited to its own scope. var declarations = symbol.declarations, flags = symbol.flags, parent = symbol.parent, valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 213 /* SyntaxKind.FunctionExpression */ || valueDeclaration.kind === 226 /* SyntaxKind.ClassExpression */)) { + if (valueDeclaration && (valueDeclaration.kind === 215 /* SyntaxKind.FunctionExpression */ || valueDeclaration.kind === 228 /* SyntaxKind.ClassExpression */)) { return valueDeclaration; } if (!declarations) { @@ -140212,7 +141209,7 @@ var ts; if (flags & (4 /* SymbolFlags.Property */ | 8192 /* SymbolFlags.Method */)) { var privateDeclaration = ts.find(declarations, function (d) { return ts.hasEffectiveModifier(d, 8 /* ModifierFlags.Private */) || ts.isPrivateIdentifierClassElementDeclaration(d); }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 257 /* SyntaxKind.ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 260 /* SyntaxKind.ClassDeclaration */); } // Else this is a public property and could be accessed from anywhere. return undefined; @@ -140241,7 +141238,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (!container || container.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { + if (!container || container.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { // This is a global variable and not an external module, any declaration defined // within this scope is visible outside the file return undefined; @@ -140499,7 +141496,7 @@ var ts; } // Use the parent symbol if the location is commonjs require syntax on javascript files only. if (ts.isInJSFile(referenceLocation) - && referenceLocation.parent.kind === 203 /* SyntaxKind.BindingElement */ + && referenceLocation.parent.kind === 205 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(referenceLocation.parent.parent.parent)) { referenceSymbol = referenceLocation.parent.symbol; // The parent will not have a symbol if it's an ObjectBindingPattern (when destructuring is used). In @@ -140606,7 +141603,7 @@ var ts; } } function addReference(referenceLocation, relatedSymbol, state) { - var _a = "kind" in relatedSymbol ? relatedSymbol : { kind: undefined, symbol: relatedSymbol }, kind = _a.kind, symbol = _a.symbol; // eslint-disable-line no-in-operator + var _a = "kind" in relatedSymbol ? relatedSymbol : { kind: undefined, symbol: relatedSymbol }, kind = _a.kind, symbol = _a.symbol; // eslint-disable-line local/no-in-operator // if rename symbol from default export anonymous function, for example `export default function() {}`, we do not need to add reference if (state.options.use === 2 /* FindReferencesUse.Rename */ && referenceLocation.kind === 88 /* SyntaxKind.DefaultKeyword */) { return; @@ -140672,15 +141669,15 @@ var ts; if (constructorSymbol && constructorSymbol.declarations) { for (var _i = 0, _a = constructorSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - var ctrKeyword = ts.findChildOfKind(decl, 134 /* SyntaxKind.ConstructorKeyword */, sourceFile); - ts.Debug.assert(decl.kind === 171 /* SyntaxKind.Constructor */ && !!ctrKeyword); + var ctrKeyword = ts.findChildOfKind(decl, 135 /* SyntaxKind.ConstructorKeyword */, sourceFile); + ts.Debug.assert(decl.kind === 173 /* SyntaxKind.Constructor */ && !!ctrKeyword); addNode(ctrKeyword); } } if (classSymbol.exports) { classSymbol.exports.forEach(function (member) { var decl = member.valueDeclaration; - if (decl && decl.kind === 169 /* SyntaxKind.MethodDeclaration */) { + if (decl && decl.kind === 171 /* SyntaxKind.MethodDeclaration */) { var body = decl.body; if (body) { forEachDescendantOfKind(body, 108 /* SyntaxKind.ThisKeyword */, function (thisKeyword) { @@ -140704,7 +141701,7 @@ var ts; } for (var _i = 0, _a = constructor.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - ts.Debug.assert(decl.kind === 171 /* SyntaxKind.Constructor */); + ts.Debug.assert(decl.kind === 173 /* SyntaxKind.Constructor */); var body = decl.body; if (body) { forEachDescendantOfKind(body, 106 /* SyntaxKind.SuperKeyword */, function (node) { @@ -140734,7 +141731,7 @@ var ts; if (refNode.kind !== 79 /* SyntaxKind.Identifier */) { return; } - if (refNode.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (refNode.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { // Go ahead and dereference the shorthand assignment by going to its definition getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference); } @@ -140754,7 +141751,7 @@ var ts; } else if (ts.isFunctionLike(typeHavingNode) && typeHavingNode.body) { var body = typeHavingNode.body; - if (body.kind === 235 /* SyntaxKind.Block */) { + if (body.kind === 238 /* SyntaxKind.Block */) { ts.forEachReturnStatement(body, function (returnStatement) { if (returnStatement.expression) addIfImplementation(returnStatement.expression); @@ -140782,13 +141779,13 @@ var ts; */ function isImplementationExpression(node) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isImplementationExpression(node.expression); - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return true; default: return false; @@ -140841,13 +141838,13 @@ var ts; // Whether 'super' occurs in a static context within a class. var staticFlag = 32 /* ModifierFlags.Static */; switch (searchSpaceNode.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; @@ -140868,43 +141865,43 @@ var ts; return [{ definition: { type: 0 /* DefinitionKind.Symbol */, symbol: searchSpaceNode.symbol }, references: references }]; } function isParameterName(node) { - return node.kind === 79 /* SyntaxKind.Identifier */ && node.parent.kind === 164 /* SyntaxKind.Parameter */ && node.parent.name === node; + return node.kind === 79 /* SyntaxKind.Identifier */ && node.parent.kind === 166 /* SyntaxKind.Parameter */ && node.parent.name === node; } function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles, cancellationToken) { var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); // Whether 'this' occurs in a static context within a class. var staticFlag = 32 /* ModifierFlags.Static */; switch (searchSpaceNode.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode)) { staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning object literals break; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (ts.isExternalModule(searchSpaceNode) || isParameterName(thisOrSuperKeyword)) { return undefined; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: break; // Computed properties in classes are not handled here because references to this are illegal, // so there is no point finding references to them. default: return undefined; } - var references = ts.flatMap(searchSpaceNode.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) { + var references = ts.flatMap(searchSpaceNode.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) { cancellationToken.throwIfCancellationRequested(); return getPossibleSymbolReferenceNodes(sourceFile, "this", ts.isSourceFile(searchSpaceNode) ? sourceFile : searchSpaceNode).filter(function (node) { if (!ts.isThis(node)) { @@ -140912,20 +141909,20 @@ var ts; } var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); switch (searchSpaceNode.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return searchSpaceNode.symbol === container.symbol; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol; - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: // Make sure the container belongs to the same class/object literals // and has the appropriate static modifier from the original container. return container.parent && searchSpaceNode.symbol === container.parent.symbol && ts.isStatic(container) === !!staticFlag; - case 305 /* SyntaxKind.SourceFile */: - return container.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node); + case 308 /* SyntaxKind.SourceFile */: + return container.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node); } }); }).map(function (n) { return nodeEntry(n); }); @@ -141036,7 +142033,7 @@ var ts; ts.Debug.assert(paramProps.length === 2 && !!(paramProps[0].flags & 1 /* SymbolFlags.FunctionScopedVariable */) && !!(paramProps[1].flags & 4 /* SymbolFlags.Property */)); // is [parameter, property] return fromRoot(symbol.flags & 1 /* SymbolFlags.FunctionScopedVariable */ ? paramProps[1] : paramProps[0]); } - var exportSpecifier = ts.getDeclarationOfKind(symbol, 275 /* SyntaxKind.ExportSpecifier */); + var exportSpecifier = ts.getDeclarationOfKind(symbol, 278 /* SyntaxKind.ExportSpecifier */); if (!isForRenamePopulateSearchSymbolSet || exportSpecifier && !exportSpecifier.propertyName) { var localSymbol = exportSpecifier && checker.getExportSpecifierLocalTargetSymbol(exportSpecifier); if (localSymbol) { @@ -141081,7 +142078,7 @@ var ts; }); } function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker) { - var bindingElement = ts.getDeclarationOfKind(symbol, 203 /* SyntaxKind.BindingElement */); + var bindingElement = ts.getDeclarationOfKind(symbol, 205 /* SyntaxKind.BindingElement */); if (bindingElement && ts.isObjectBindingElementWithoutPropertyName(bindingElement)) { return ts.getPropertySymbolFromBindingElement(checker, bindingElement); } @@ -141344,16 +142341,16 @@ var ts; return; } switch (node.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - if (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + if (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return (_a = ts.getAssignedName(node.parent)) === null || _a === void 0 ? void 0 : _a.getText(); } return (_b = ts.getNameOfDeclaration(node.parent)) === null || _b === void 0 ? void 0 : _b.getText(); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.isModuleBlock(node.parent) && ts.isIdentifier(node.parent.parent.name)) { return node.parent.parent.name.getText(); } @@ -141568,61 +142565,65 @@ var ts; } switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // do not descend into nodes that cannot contain callable nodes return; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: recordCallSite(node); return; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: // do not descend into the type side of an assertion collect(node.expression); return; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: // do not descend into the type of a variable or parameter declaration collect(node.name); collect(node.initializer); return; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: // do not descend into the type arguments of a call expression recordCallSite(node); collect(node.expression); ts.forEach(node.arguments, collect); return; - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: // do not descend into the type arguments of a new expression recordCallSite(node); collect(node.expression); ts.forEach(node.arguments, collect); return; - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // do not descend into the type arguments of a tagged template expression recordCallSite(node); collect(node.tag); collect(node.template); return; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: // do not descend into the type arguments of a JsxOpeningLikeElement recordCallSite(node); collect(node.tagName); collect(node.attributes); return; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: recordCallSite(node); collect(node.expression); return; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: recordCallSite(node); ts.forEachChild(node, collect); break; + case 235 /* SyntaxKind.SatisfiesExpression */: + // do not descend into the type side of an assertion + collect(node.expression); + return; } if (ts.isPartOfTypeNode(node)) { // do not descend into types @@ -141677,25 +142678,25 @@ var ts; var callSites = []; var collect = createCallSiteCollector(program, callSites); switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: collectCallSitesOfSourceFile(node, collect); break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: collectCallSitesOfModuleDeclaration(node, collect); break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: collectCallSitesOfFunctionLikeDeclaration(program.getTypeChecker(), node, collect); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: collectCallSitesOfClassLikeDeclaration(node, collect); break; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: collectCallSitesOfClassStaticBlockDeclaration(node, collect); break; default: @@ -141966,7 +142967,7 @@ var ts; } var parent = node.parent; var typeChecker = program.getTypeChecker(); - if (node.kind === 159 /* SyntaxKind.OverrideKeyword */ || (ts.isJSDocOverrideTag(node) && ts.rangeContainsPosition(node.tagName, position))) { + if (node.kind === 161 /* SyntaxKind.OverrideKeyword */ || (ts.isIdentifier(node) && ts.isJSDocOverrideTag(parent) && parent.tagName === node)) { return getDefinitionFromOverriddenMember(typeChecker, node) || ts.emptyArray; } // Labels @@ -142042,7 +143043,7 @@ var ts; // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var shorthandSymbol_1 = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); var definitions = (shorthandSymbol_1 === null || shorthandSymbol_1 === void 0 ? void 0 : shorthandSymbol_1.declarations) ? shorthandSymbol_1.declarations.map(function (decl) { return createDefinitionInfo(decl, typeChecker, shorthandSymbol_1, node, /*unverified*/ false, failedAliasResolution); }) : ts.emptyArray; return ts.concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node) || ts.emptyArray); @@ -142248,7 +143249,7 @@ var ts; if (node.parent === declaration) { return true; } - if (declaration.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (declaration.kind === 271 /* SyntaxKind.NamespaceImport */) { return false; } return true; @@ -142290,7 +143291,7 @@ var ts; function getConstructSignatureDefinition() { // Applicable only if we are in a new expression, or we are on a constructor declaration // and in either case the symbol has a construct signature definition, i.e. class - if (symbol.flags & 32 /* SymbolFlags.Class */ && !(symbol.flags & (16 /* SymbolFlags.Function */ | 3 /* SymbolFlags.Variable */)) && (ts.isNewExpressionTarget(node) || node.kind === 134 /* SyntaxKind.ConstructorKeyword */)) { + if (symbol.flags & 32 /* SymbolFlags.Class */ && !(symbol.flags & (16 /* SymbolFlags.Function */ | 3 /* SymbolFlags.Variable */)) && (ts.isNewExpressionTarget(node) || node.kind === 135 /* SyntaxKind.ConstructorKeyword */)) { var cls = ts.find(filteredDeclarations, ts.isClassLike) || ts.Debug.fail("Expected declaration to have at least one class-like declaration"); return getSignatureDefinition(cls.members, /*selectConstructors*/ true); } @@ -142342,22 +143343,22 @@ var ts; return isDefinitionVisible(checker, declaration.parent); // Handle some exceptions here like arrow function, members of class and object literal expression which are technically not visible but we want the definition to be determined by its parent switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: // Private/protected properties/methods are not visible if (ts.hasEffectiveModifier(declaration, 8 /* ModifierFlags.Private */)) return false; // Public properties/methods are visible if its parents are visible, so: // falls through - case 171 /* SyntaxKind.Constructor */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: return isDefinitionVisible(checker, declaration.parent); default: return false; @@ -142395,9 +143396,9 @@ var ts; } function isConstructorLike(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 173 /* SyntaxKind.Constructor */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return true; default: return false; @@ -142503,17 +143504,17 @@ var ts; ts.forEachUnique(declarations, function (declaration) { for (var _i = 0, _a = getCommentHavingNodes(declaration); _i < _a.length; _i++) { var jsdoc = _a[_i]; - var inheritDoc = ts.isJSDoc(jsdoc) && jsdoc.tags && ts.find(jsdoc.tags, function (t) { return t.kind === 327 /* SyntaxKind.JSDocTag */ && (t.tagName.escapedText === "inheritDoc" || t.tagName.escapedText === "inheritdoc"); }); + var inheritDoc = ts.isJSDoc(jsdoc) && jsdoc.tags && ts.find(jsdoc.tags, function (t) { return t.kind === 330 /* SyntaxKind.JSDocTag */ && (t.tagName.escapedText === "inheritDoc" || t.tagName.escapedText === "inheritdoc"); }); // skip comments containing @typedefs since they're not associated with particular declarations // Exceptions: // - @typedefs are themselves declarations with associated comments // - @param or @return indicate that the author thinks of it as a 'local' @typedef that's part of the function documentation if (jsdoc.comment === undefined && !inheritDoc || ts.isJSDoc(jsdoc) - && declaration.kind !== 345 /* SyntaxKind.JSDocTypedefTag */ && declaration.kind !== 338 /* SyntaxKind.JSDocCallbackTag */ + && declaration.kind !== 348 /* SyntaxKind.JSDocTypedefTag */ && declaration.kind !== 341 /* SyntaxKind.JSDocCallbackTag */ && jsdoc.tags - && jsdoc.tags.some(function (t) { return t.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 338 /* SyntaxKind.JSDocCallbackTag */; }) - && !jsdoc.tags.some(function (t) { return t.kind === 340 /* SyntaxKind.JSDocParameterTag */ || t.kind === 341 /* SyntaxKind.JSDocReturnTag */; })) { + && jsdoc.tags.some(function (t) { return t.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 341 /* SyntaxKind.JSDocCallbackTag */; }) + && !jsdoc.tags.some(function (t) { return t.kind === 343 /* SyntaxKind.JSDocParameterTag */ || t.kind === 344 /* SyntaxKind.JSDocReturnTag */; })) { continue; } var newparts = jsdoc.comment ? getDisplayPartsFromComment(jsdoc.comment, checker) : []; @@ -142533,11 +143534,11 @@ var ts; } function getCommentHavingNodes(declaration) { switch (declaration.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return [declaration]; - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return [declaration, declaration.parent]; default: return ts.getJSDocCommentsAndTags(declaration); @@ -142551,8 +143552,8 @@ var ts; // skip comments containing @typedefs since they're not associated with particular declarations // Exceptions: // - @param or @return indicate that the author thinks of it as a 'local' @typedef that's part of the function documentation - if (tags.some(function (t) { return t.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 338 /* SyntaxKind.JSDocCallbackTag */; }) - && !tags.some(function (t) { return t.kind === 340 /* SyntaxKind.JSDocParameterTag */ || t.kind === 341 /* SyntaxKind.JSDocReturnTag */; })) { + if (tags.some(function (t) { return t.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 341 /* SyntaxKind.JSDocCallbackTag */; }) + && !tags.some(function (t) { return t.kind === 343 /* SyntaxKind.JSDocParameterTag */ || t.kind === 344 /* SyntaxKind.JSDocReturnTag */; })) { return; } for (var _i = 0, tags_1 = tags; _i < tags_1.length; _i++) { @@ -142567,17 +143568,17 @@ var ts; if (typeof comment === "string") { return [ts.textPart(comment)]; } - return ts.flatMap(comment, function (node) { return node.kind === 321 /* SyntaxKind.JSDocText */ ? [ts.textPart(node.text)] : ts.buildLinkParts(node, checker); }); + return ts.flatMap(comment, function (node) { return node.kind === 324 /* SyntaxKind.JSDocText */ ? [ts.textPart(node.text)] : ts.buildLinkParts(node, checker); }); } function getCommentDisplayParts(tag, checker) { var comment = tag.comment, kind = tag.kind; var namePart = getTagNameDisplayPart(kind); switch (kind) { - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return withNode(tag.class); - case 328 /* SyntaxKind.JSDocAugmentsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: return withNode(tag.class); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: var templateTag = tag; var displayParts_3 = []; if (templateTag.constraint) { @@ -142599,13 +143600,13 @@ var ts; displayParts_3.push.apply(displayParts_3, __spreadArray([ts.spacePart()], getDisplayPartsFromComment(comment, checker), true)); } return displayParts_3; - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return withNode(tag.typeExpression); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: - case 346 /* SyntaxKind.JSDocSeeTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: var name = tag.name; return name ? withNode(name) : comment === undefined ? undefined @@ -142632,14 +143633,14 @@ var ts; } function getTagNameDisplayPart(kind) { switch (kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return ts.parameterNamePart; - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return ts.propertyNamePart; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return ts.typeParameterNamePart; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return ts.typeAliasNamePart; default: return ts.textPart; @@ -142810,24 +143811,24 @@ var ts; } function getCommentOwnerInfoWorker(commentOwner, options) { switch (commentOwner.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 168 /* SyntaxKind.MethodSignature */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 170 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: var host = commentOwner; return { commentOwner: commentOwner, parameters: host.parameters, hasReturn: hasReturn(host, options) }; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getCommentOwnerInfoWorker(commentOwner.initializer, options); - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return { commentOwner: commentOwner }; - case 237 /* SyntaxKind.VariableStatement */: { + case 240 /* SyntaxKind.VariableStatement */: { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; var host_1 = varDeclarations.length === 1 && varDeclarations[0].initializer @@ -142837,16 +143838,16 @@ var ts; ? { commentOwner: commentOwner, parameters: host_1.parameters, hasReturn: hasReturn(host_1, options) } : { commentOwner: commentOwner }; } - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return "quit"; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // If in walking up the tree, we hit a a nested namespace declaration, // then we must be somewhere within a dotted namespace name; however we don't // want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'. - return commentOwner.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? undefined : { commentOwner: commentOwner }; - case 238 /* SyntaxKind.ExpressionStatement */: + return commentOwner.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? undefined : { commentOwner: commentOwner }; + case 241 /* SyntaxKind.ExpressionStatement */: return getCommentOwnerInfoWorker(commentOwner.expression, options); - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var be = commentOwner; if (ts.getAssignmentDeclarationKind(be) === 0 /* AssignmentDeclarationKind.None */) { return "quit"; @@ -142855,7 +143856,7 @@ var ts; ? { commentOwner: commentOwner, parameters: be.right.parameters, hasReturn: hasReturn(be.right, options) } : { commentOwner: commentOwner }; } - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: var init = commentOwner.initializer; if (init && (ts.isFunctionExpression(init) || ts.isArrowFunction(init))) { return { commentOwner: commentOwner, parameters: init.parameters, hasReturn: hasReturn(init, options) }; @@ -142868,14 +143869,14 @@ var ts; || ts.isFunctionLikeDeclaration(node) && node.body && ts.isBlock(node.body) && !!ts.forEachReturnStatement(node.body, function (n) { return n; })); } function getRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (rightHandSide.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return rightHandSide; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return ts.find(rightHandSide.members, ts.isConstructorDeclaration); } } @@ -142934,9 +143935,9 @@ var ts; } function shouldKeepItem(declaration, checker) { switch (declaration.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: var importer = checker.getSymbolAtLocation(declaration.name); // TODO: GH#18217 var imported = checker.getAliasedSymbol(importer); return importer.escapedName !== imported.escapedName; @@ -142946,7 +143947,7 @@ var ts; } function tryAddSingleDeclarationName(declaration, containers) { var name = ts.getNameOfDeclaration(declaration); - return !!name && (pushLiteral(name, containers) || name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers)); + return !!name && (pushLiteral(name, containers) || name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers)); } // Only added the names of computed properties if they're simple dotted expressions, like: // @@ -142963,7 +143964,7 @@ var ts; // First, if we started with a computed property name, then add all but the last // portion into the container array. var name = ts.getNameOfDeclaration(declaration); - if (name && name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) { + if (name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) { return ts.emptyArray; } // Don't include the last portion. @@ -143180,7 +144181,7 @@ var ts; */ function hasNavigationBarName(node) { return !ts.hasDynamicName(node) || - (node.kind !== 221 /* SyntaxKind.BinaryExpression */ && + (node.kind !== 223 /* SyntaxKind.BinaryExpression */ && ts.isPropertyAccessExpression(node.name.expression) && ts.isIdentifier(node.name.expression.expression) && ts.idText(node.name.expression.expression) === "Symbol"); @@ -143193,7 +144194,7 @@ var ts; return; } switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: // Get parameter properties, and treat them as being on the *same* level as the constructor, not under it. var ctr = node; addNodeWithRecursiveChild(ctr, ctr.body); @@ -143205,25 +144206,25 @@ var ts; } } break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 170 /* SyntaxKind.MethodSignature */: if (hasNavigationBarName(node)) { addNodeWithRecursiveChild(node, node.body); } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (hasNavigationBarName(node)) { addNodeWithRecursiveInitializer(node); } break; - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (hasNavigationBarName(node)) { addLeafNode(node); } break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: var importClause = node; // Handle default import case e.g.: // import d from "mod"; @@ -143235,7 +144236,7 @@ var ts; // import {a, b as B} from "mod"; var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { addLeafNode(namedBindings); } else { @@ -143246,17 +144247,17 @@ var ts; } } break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: addNodeWithRecursiveChild(node, node.name); break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: var expression = node.expression; // Use the expression as the name of the SpreadAssignment, otherwise show as . ts.isIdentifier(expression) ? addLeafNode(node, expression) : addLeafNode(node); break; - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 254 /* SyntaxKind.VariableDeclaration */: { + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: { var child = node; if (ts.isBindingPattern(child.name)) { addChildrenRecursively(child.name); @@ -143266,7 +144267,7 @@ var ts; } break; } - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: var nameNode = node.name; // If we see a function declaration track as a possible ES5 class if (nameNode && ts.isIdentifier(nameNode)) { @@ -143274,11 +144275,11 @@ var ts; } addNodeWithRecursiveChild(node, node.body); break; - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: addNodeWithRecursiveChild(node, node.body); break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: startNode(node); for (var _e = 0, _f = node.members; _e < _f.length; _e++) { var member = _f[_e]; @@ -143288,9 +144289,9 @@ var ts; } endNode(); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: startNode(node); for (var _g = 0, _h = node.members; _g < _h.length; _g++) { var member = _h[_g]; @@ -143298,10 +144299,10 @@ var ts; } endNode(); break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var expression_1 = node.expression; var child = ts.isObjectLiteralExpression(expression_1) || ts.isCallExpression(expression_1) ? expression_1 : ts.isArrowFunction(expression_1) || ts.isFunctionExpression(expression_1) ? expression_1.body : undefined; @@ -143315,16 +144316,16 @@ var ts; } break; } - case 275 /* SyntaxKind.ExportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 176 /* SyntaxKind.IndexSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: addLeafNode(node); break; - case 208 /* SyntaxKind.CallExpression */: - case 221 /* SyntaxKind.BinaryExpression */: { + case 210 /* SyntaxKind.CallExpression */: + case 223 /* SyntaxKind.BinaryExpression */: { var special = ts.getAssignmentDeclarationKind(node); switch (special) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -143564,12 +144565,12 @@ var ts; return false; } switch (a.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return ts.isStatic(a) === ts.isStatic(b); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return areSameModule(a, b) && getFullyQualifiedModuleName(a) === getFullyQualifiedModuleName(b); default: @@ -143591,7 +144592,7 @@ var ts; if (!a.body || !b.body) { return a.body === b.body; } - return a.body.kind === b.body.kind && (a.body.kind !== 261 /* SyntaxKind.ModuleDeclaration */ || areSameModule(a.body, b.body)); + return a.body.kind === b.body.kind && (a.body.kind !== 264 /* SyntaxKind.ModuleDeclaration */ || areSameModule(a.body, b.body)); } /** Merge source into target. Source should be thrown away after this is called. */ function merge(target, source) { @@ -143621,7 +144622,7 @@ var ts; * So `new()` can still come before an `aardvark` method. */ function tryGetName(node) { - if (node.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (node.kind === 264 /* SyntaxKind.ModuleDeclaration */) { return getModuleName(node); } var declName = ts.getNameOfDeclaration(node); @@ -143630,16 +144631,16 @@ var ts; return propertyName && ts.unescapeLeadingUnderscores(propertyName); } switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 226 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: return getFunctionOrClassName(node); default: return undefined; } } function getItemName(node, name) { - if (node.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (node.kind === 264 /* SyntaxKind.ModuleDeclaration */) { return cleanText(getModuleName(node)); } if (name) { @@ -143651,32 +144652,32 @@ var ts; } } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"".concat(ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))), "\"") : ""; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return ts.isExportAssignment(node) && node.isExportEquals ? "export=" /* InternalSymbolName.ExportEquals */ : "default" /* InternalSymbolName.Default */; - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - if (ts.getSyntacticModifierFlags(node) & 512 /* ModifierFlags.Default */) { + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + if (ts.getSyntacticModifierFlags(node) & 1024 /* ModifierFlags.Default */) { return "default"; } // We may get a string with newlines or other whitespace in the case of an object dereference // (eg: "app\n.onactivated"), so we should remove the whitespace for readability in the // navigation bar. return getFunctionOrClassName(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "constructor"; - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return "new()"; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: return "()"; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return "[]"; default: return ""; @@ -143709,19 +144710,19 @@ var ts; } // Some nodes are otherwise important enough to always include in the primary navigation menu. switch (navigationBarNodeKind(item)) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 305 /* SyntaxKind.SourceFile */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return true; - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return isTopLevelFunctionDeclaration(item); default: return false; @@ -143731,10 +144732,10 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 262 /* SyntaxKind.ModuleBlock */: - case 305 /* SyntaxKind.SourceFile */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 265 /* SyntaxKind.ModuleBlock */: + case 308 /* SyntaxKind.SourceFile */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: return true; default: return false; @@ -143796,7 +144797,7 @@ var ts; function getFullyQualifiedModuleName(moduleDeclaration) { // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = [ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)]; - while (moduleDeclaration.body && moduleDeclaration.body.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 264 /* SyntaxKind.ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)); } @@ -143810,13 +144811,13 @@ var ts; return decl.body && ts.isModuleDeclaration(decl.body) ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { - return !member.name || member.name.kind === 162 /* SyntaxKind.ComputedPropertyName */; + return !member.name || member.name.kind === 164 /* SyntaxKind.ComputedPropertyName */; } function getNodeSpan(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); } function getModifiers(node) { - if (node.parent && node.parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (node.parent && node.parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { node = node.parent; } return ts.getNodeModifiers(node); @@ -143839,7 +144840,7 @@ var ts; return nodeText(parent.name); } // Default exports are named "default" - else if (ts.getSyntacticModifierFlags(node) & 512 /* ModifierFlags.Default */) { + else if (ts.getSyntacticModifierFlags(node) & 1024 /* ModifierFlags.Default */) { return "default"; } else if (ts.isClassLike(node)) { @@ -143874,9 +144875,9 @@ var ts; } function isFunctionOrClassExpression(node) { switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: return true; default: return false; @@ -144277,11 +145278,11 @@ var ts; function getModuleSpecifierExpression(declaration) { var _a; switch (declaration.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return (_a = ts.tryCast(declaration.moduleReference, ts.isExternalModuleReference)) === null || _a === void 0 ? void 0 : _a.expression; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return declaration.moduleSpecifier; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return declaration.declarationList.declarations[0].initializer.arguments[0]; } } @@ -144320,19 +145321,19 @@ var ts; function getImportKindOrder(s1) { var _a; switch (s1.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: if (!s1.importClause) return 0; if (s1.importClause.isTypeOnly) return 1; - if (((_a = s1.importClause.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 268 /* SyntaxKind.NamespaceImport */) + if (((_a = s1.importClause.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 271 /* SyntaxKind.NamespaceImport */) return 2; if (s1.importClause.name) return 3; return 4; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return 5; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return 6; } } @@ -144521,7 +145522,7 @@ var ts; } function getOutliningSpanForNode(n, sourceFile) { switch (n.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionLike(n.parent)) { return functionSpan(n.parent, n, sourceFile); } @@ -144529,16 +145530,16 @@ var ts; // If the latter, we want to collapse the block, but consider its hint span // to be the entire span of the parent. switch (n.parent.kind) { - case 240 /* SyntaxKind.DoStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 243 /* SyntaxKind.DoStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 295 /* SyntaxKind.CatchClause */: return spanForNode(n.parent); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // Could be the try-block, or the finally-block. var tryStatement = n.parent; if (tryStatement.tryBlock === n) { @@ -144555,42 +145556,42 @@ var ts; // the span of the block, independent of any parent span. return createOutliningSpan(ts.createTextSpanFromNode(n, sourceFile), "code" /* OutliningSpanKind.Code */); } - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return spanForNode(n.parent); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 263 /* SyntaxKind.CaseBlock */: - case 182 /* SyntaxKind.TypeLiteral */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 266 /* SyntaxKind.CaseBlock */: + case 184 /* SyntaxKind.TypeLiteral */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return spanForNode(n); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return spanForNode(n, /*autoCollapse*/ false, /*useFullStart*/ !ts.isTupleTypeNode(n.parent), 22 /* SyntaxKind.OpenBracketToken */); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: return spanForNodeArray(n.statements); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return spanForObjectOrArrayLiteral(n); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return spanForObjectOrArrayLiteral(n, 22 /* SyntaxKind.OpenBracketToken */); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return spanForJSXElement(n); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return spanForJSXFragment(n); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: return spanForJSXAttributes(n.attributes); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return spanForTemplateLiteral(n); - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return spanForNode(n, /*autoCollapse*/ false, /*useFullStart*/ !ts.isBindingElement(n.parent), 22 /* SyntaxKind.OpenBracketToken */); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return spanForArrowFunction(n); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return spanForCallExpression(n); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return spanForParenthesizedExpression(n); } function spanForCallExpression(node) { @@ -144663,7 +145664,7 @@ var ts; function functionSpan(node, body, sourceFile) { var openToken = tryGetFunctionOpenToken(node, body, sourceFile); var closeToken = ts.findChildOfKind(body, 19 /* SyntaxKind.CloseBraceToken */, sourceFile); - return openToken && closeToken && spanBetweenTokens(openToken, closeToken, node, sourceFile, /*autoCollapse*/ node.kind !== 214 /* SyntaxKind.ArrowFunction */); + return openToken && closeToken && spanBetweenTokens(openToken, closeToken, node, sourceFile, /*autoCollapse*/ node.kind !== 216 /* SyntaxKind.ArrowFunction */); } function spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart) { if (autoCollapse === void 0) { autoCollapse = false; } @@ -145207,10 +146208,10 @@ var ts; */ function tryConsumeDeclare() { var token = ts.scanner.getToken(); - if (token === 135 /* SyntaxKind.DeclareKeyword */) { + if (token === 136 /* SyntaxKind.DeclareKeyword */) { // declare module "mod" token = nextToken(); - if (token === 141 /* SyntaxKind.ModuleKeyword */) { + if (token === 142 /* SyntaxKind.ModuleKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { recordAmbientExternalModule(); @@ -145244,10 +146245,10 @@ var ts; return true; } else { - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); - return token !== 156 /* SyntaxKind.FromKeyword */ && (token === 41 /* SyntaxKind.AsteriskToken */ || + return token !== 158 /* SyntaxKind.FromKeyword */ && (token === 41 /* SyntaxKind.AsteriskToken */ || token === 18 /* SyntaxKind.OpenBraceToken */ || token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)); @@ -145258,7 +146259,7 @@ var ts; } if (token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import d from "mod"; @@ -145289,7 +146290,7 @@ var ts; } if (token === 19 /* SyntaxKind.CloseBraceToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import {a as A} from "mod"; @@ -145301,11 +146302,11 @@ var ts; } else if (token === 41 /* SyntaxKind.AsteriskToken */) { token = nextToken(); - if (token === 127 /* SyntaxKind.AsKeyword */) { + if (token === 128 /* SyntaxKind.AsKeyword */) { token = nextToken(); if (token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import * as NS from "mod" @@ -145326,7 +146327,7 @@ var ts; if (token === 93 /* SyntaxKind.ExportKeyword */) { markAsExternalModuleIfTopLevel(); token = nextToken(); - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); return token === 41 /* SyntaxKind.AsteriskToken */ || @@ -145345,7 +146346,7 @@ var ts; } if (token === 19 /* SyntaxKind.CloseBraceToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // export {a as A} from "mod"; @@ -145357,7 +146358,7 @@ var ts; } else if (token === 41 /* SyntaxKind.AsteriskToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // export * from "mod" @@ -145367,7 +146368,7 @@ var ts; } else if (token === 100 /* SyntaxKind.ImportKeyword */) { token = nextToken(); - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); return token === 79 /* SyntaxKind.Identifier */ || @@ -145393,7 +146394,7 @@ var ts; function tryConsumeRequireCall(skipCurrentToken, allowTemplateLiterals) { if (allowTemplateLiterals === void 0) { allowTemplateLiterals = false; } var token = skipCurrentToken ? nextToken() : ts.scanner.getToken(); - if (token === 146 /* SyntaxKind.RequireKeyword */) { + if (token === 147 /* SyntaxKind.RequireKeyword */) { token = nextToken(); if (token === 20 /* SyntaxKind.OpenParenToken */) { token = nextToken(); @@ -145605,7 +146606,7 @@ var ts; return getRenameInfoError(wouldRenameNodeModules); } var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); - var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) + var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) ? ts.stripQuotes(ts.getTextOfIdentifierOrLiteral(node)) : undefined; var displayName = specifierName || typeChecker.symbolToString(symbol); @@ -145750,6 +146751,10 @@ var ts; pushSelectionCommentRange(comment.pos, comment.end); } if (positionShouldSnapToNode(sourceFile, pos, node)) { + if (ts.isFunctionBody(node) + && ts.isFunctionLikeDeclaration(parentNode) && !ts.positionsAreOnSameLine(node.getStart(sourceFile), node.getEnd(), sourceFile)) { + pushSelectionRange(node.getStart(sourceFile), node.getEnd()); + } // 1. Blocks are effectively redundant with SyntaxLists. // 2. TemplateSpans, along with the SyntaxLists containing them, are a somewhat unintuitive grouping // of things that should be considered independently. @@ -145887,14 +146892,14 @@ var ts; ts.Debug.assertEqual(closeBraceToken.kind, 19 /* SyntaxKind.CloseBraceToken */); // Group `-/+readonly` and `-/+?` var groupedWithPlusMinusTokens = groupChildren(children, function (child) { - return child === node.readonlyToken || child.kind === 145 /* SyntaxKind.ReadonlyKeyword */ || + return child === node.readonlyToken || child.kind === 146 /* SyntaxKind.ReadonlyKeyword */ || child === node.questionToken || child.kind === 57 /* SyntaxKind.QuestionToken */; }); // Group type parameter with surrounding brackets var groupedWithBrackets = groupChildren(groupedWithPlusMinusTokens, function (_a) { var kind = _a.kind; return kind === 22 /* SyntaxKind.OpenBracketToken */ || - kind === 163 /* SyntaxKind.TypeParameter */ || + kind === 165 /* SyntaxKind.TypeParameter */ || kind === 23 /* SyntaxKind.CloseBracketToken */; }); return [ @@ -145912,7 +146917,7 @@ var ts; var children = groupChildren(node.getChildren(), function (child) { return child === node.name || ts.contains(node.modifiers, child); }); - var firstJSDocChild = ((_a = children[0]) === null || _a === void 0 ? void 0 : _a.kind) === 320 /* SyntaxKind.JSDoc */ ? children[0] : undefined; + var firstJSDocChild = ((_a = children[0]) === null || _a === void 0 ? void 0 : _a.kind) === 323 /* SyntaxKind.JSDoc */ ? children[0] : undefined; var withJSDocSeparated = firstJSDocChild ? children.slice(1) : children; var splittedChildren = splitChildren(withJSDocSeparated, function (_a) { var kind = _a.kind; @@ -146011,22 +147016,22 @@ var ts; return kind === 18 /* SyntaxKind.OpenBraceToken */ || kind === 22 /* SyntaxKind.OpenBracketToken */ || kind === 20 /* SyntaxKind.OpenParenToken */ - || kind === 280 /* SyntaxKind.JsxOpeningElement */; + || kind === 283 /* SyntaxKind.JsxOpeningElement */; } function isListCloser(token) { var kind = token && token.kind; return kind === 19 /* SyntaxKind.CloseBraceToken */ || kind === 23 /* SyntaxKind.CloseBracketToken */ || kind === 21 /* SyntaxKind.CloseParenToken */ - || kind === 281 /* SyntaxKind.JsxClosingElement */; + || kind === 284 /* SyntaxKind.JsxClosingElement */; } function getEndPos(sourceFile, node) { switch (node.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 342 /* SyntaxKind.JSDocThisTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 345 /* SyntaxKind.JSDocThisTag */: return sourceFile.getLineEndOfPosition(node.getStart()); default: return node.getEnd(); @@ -146236,10 +147241,10 @@ var ts; } return undefined; } - else if (ts.isTemplateHead(node) && parent.parent.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + else if (ts.isTemplateHead(node) && parent.parent.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { var templateExpression = parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 223 /* SyntaxKind.TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 225 /* SyntaxKind.TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position, sourceFile) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } @@ -146311,17 +147316,17 @@ var ts; return undefined; var parent = startingToken.parent; switch (parent.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: var info = getArgumentOrParameterListInfo(startingToken, position, sourceFile); if (!info) return undefined; var argumentIndex = info.argumentIndex, argumentCount = info.argumentCount, argumentsSpan = info.argumentsSpan; var contextualType = ts.isMethodDeclaration(parent) ? checker.getContextualTypeForObjectLiteralElement(parent) : checker.getContextualType(parent); return contextualType && { contextualType: contextualType, argumentIndex: argumentIndex, argumentCount: argumentCount, argumentsSpan: argumentsSpan }; - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var highestBinary = getHighestBinary(parent); var contextualType_1 = checker.getContextualType(highestBinary); var argumentIndex_1 = startingToken.kind === 20 /* SyntaxKind.OpenParenToken */ ? 0 : countBinaryExpressionParameters(parent) - 1; @@ -146392,11 +147397,11 @@ var ts; // not enough to put us in the substitution expression; we should consider ourselves part of // the *next* span's expression by offsetting the index (argIndex = (spanIndex + 1) + 1). // - /* eslint-disable no-double-space */ + /* eslint-disable local/no-double-space */ // Example: f `# abcd $#{# 1 + 1# }# efghi ${ #"#hello"# } # ` // ^ ^ ^ ^ ^ ^ ^ ^ ^ // Case: 1 1 3 2 1 3 2 2 1 - /* eslint-enable no-double-space */ + /* eslint-enable local/no-double-space */ ts.Debug.assert(position >= node.getStart(), "Assumed 'position' could not occur before node."); if (ts.isTemplateLiteralToken(node)) { if (ts.isInsideTemplateLiteral(node, position, sourceFile)) { @@ -146445,7 +147450,7 @@ var ts; // | | // This is because a Missing node has no width. However, what we actually want is to include trivia // leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail. - if (template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (template.kind === 225 /* SyntaxKind.TemplateExpression */) { var lastSpan = ts.last(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); @@ -146650,14 +147655,14 @@ var ts; return; } switch (node.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } if (!ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth())) { @@ -146801,7 +147806,7 @@ var ts; } function isHintableLiteral(node) { switch (node.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: { + case 221 /* SyntaxKind.PrefixUnaryExpression */: { var operand = node.operand; return ts.isLiteralExpression(operand) || ts.isIdentifier(operand) && ts.isInfinityOrNaNString(operand.escapedText); } @@ -146809,7 +147814,7 @@ var ts; case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return true; case 79 /* SyntaxKind.Identifier */: { var name = node.escapedText; @@ -147130,11 +148135,11 @@ var ts; function containsTopLevelCommonjs(sourceFile) { return sourceFile.statements.some(function (statement) { switch (statement.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return statement.declarationList.declarations.some(function (decl) { return !!decl.initializer && ts.isRequireCall(propertyAccessLeftHandSide(decl.initializer), /*checkArgumentIsStringLiteralLike*/ true); }); - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; if (!ts.isBinaryExpression(expression)) return ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true); @@ -147151,12 +148156,12 @@ var ts; } function importNameForConvertToDefaultImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var importClause = node.importClause, moduleSpecifier = node.moduleSpecifier; - return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ && ts.isStringLiteral(moduleSpecifier) + return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ && ts.isStringLiteral(moduleSpecifier) ? importClause.namedBindings.name : undefined; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.name; default: return undefined; @@ -147232,20 +148237,20 @@ var ts; // should be kept up to date with getTransformationBody in convertToAsyncFunction.ts function isFixablePromiseArgument(arg, checker) { switch (arg.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: var functionFlags = ts.getFunctionFlags(arg); if (functionFlags & 1 /* FunctionFlags.Generator */) { return false; } // falls through - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: visitedNestedConvertibleFunctions.set(getKeyFromNode(arg), true); // falls through case 104 /* SyntaxKind.NullKeyword */: return true; case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: { + case 208 /* SyntaxKind.PropertyAccessExpression */: { var symbol = checker.getSymbolAtLocation(arg); if (!symbol) { return false; @@ -147262,24 +148267,24 @@ var ts; } function canBeConvertedToClass(node, checker) { var _a, _b, _c, _d; - if (node.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (node.kind === 215 /* SyntaxKind.FunctionExpression */) { if (ts.isVariableDeclaration(node.parent) && ((_a = node.symbol.members) === null || _a === void 0 ? void 0 : _a.size)) { return true; } var symbol = checker.getSymbolOfExpando(node, /*allowDeclaration*/ false); return !!(symbol && (((_b = symbol.exports) === null || _b === void 0 ? void 0 : _b.size) || ((_c = symbol.members) === null || _c === void 0 ? void 0 : _c.size))); } - if (node.kind === 256 /* SyntaxKind.FunctionDeclaration */) { + if (node.kind === 259 /* SyntaxKind.FunctionDeclaration */) { return !!((_d = node.symbol.members) === null || _d === void 0 ? void 0 : _d.size); } return false; } function canBeConvertedToAsync(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: return false; @@ -147301,7 +148306,7 @@ var ts; } var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol); if (flags & 32 /* SymbolFlags.Class */) { - return ts.getDeclarationOfKind(symbol, 226 /* SyntaxKind.ClassExpression */) ? + return ts.getDeclarationOfKind(symbol, 228 /* SyntaxKind.ClassExpression */) ? "local class" /* ScriptElementKind.localClassElement */ : "class" /* ScriptElementKind.classElement */; } if (flags & 384 /* SymbolFlags.Enum */) @@ -147364,6 +148369,8 @@ var ts; return "method" /* ScriptElementKind.memberFunctionElement */; if (flags & 16384 /* SymbolFlags.Constructor */) return "constructor" /* ScriptElementKind.constructorImplementationElement */; + if (flags & 131072 /* SymbolFlags.Signature */) + return "index" /* ScriptElementKind.indexSignatureElement */; if (flags & 4 /* SymbolFlags.Property */) { if (flags & 33554432 /* SymbolFlags.Transient */ && symbol.checkFlags & 6 /* CheckFlags.Synthetic */) { // If union property is result of union of non method (property/accessors/variables), it is labeled as property @@ -147447,12 +148454,15 @@ var ts; var declaration = ts.find(symbol.declarations, function (declaration) { return declaration.name === location; }); if (declaration) { switch (declaration.kind) { - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: symbolKind = "getter" /* ScriptElementKind.memberGetAccessorElement */; break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: symbolKind = "setter" /* ScriptElementKind.memberSetAccessorElement */; break; + case 169 /* SyntaxKind.PropertyDeclaration */: + symbolKind = "accessor" /* ScriptElementKind.memberAccessorVariableElement */; + break; default: ts.Debug.assertNever(declaration); } @@ -147463,7 +148473,7 @@ var ts; } var signature = void 0; type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); - if (location.parent && location.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var right = location.parent.name; // Either the location is on the right of a property access, or on the left and the right is missing if (right === location || (right && right.getFullWidth() === 0)) { @@ -147483,7 +148493,7 @@ var ts; } if (callExpressionLike) { signature = typeChecker.getResolvedSignature(callExpressionLike); // TODO: GH#18217 - var useConstructSignatures = callExpressionLike.kind === 209 /* SyntaxKind.NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 106 /* SyntaxKind.SuperKeyword */); + var useConstructSignatures = callExpressionLike.kind === 211 /* SyntaxKind.NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 106 /* SyntaxKind.SuperKeyword */); var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (signature && !ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { // Get the first signature if there is one -- allSignatures may contain @@ -147547,29 +148557,29 @@ var ts; } } else if ((ts.isNameOfFunctionDeclaration(location) && !(symbolFlags & 98304 /* SymbolFlags.Accessor */)) || // name of function declaration - (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ && location.parent.kind === 171 /* SyntaxKind.Constructor */)) { // At constructor keyword of constructor declaration + (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ && location.parent.kind === 173 /* SyntaxKind.Constructor */)) { // At constructor keyword of constructor declaration // get the signature from the declaration and write it var functionDeclaration_1 = location.parent; // Use function declaration to write the signatures only if the symbol corresponding to this declaration var locationIsSymbolDeclaration = symbol.declarations && ts.find(symbol.declarations, function (declaration) { - return declaration === (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1); + return declaration === (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1); }); if (locationIsSymbolDeclaration) { - var allSignatures = functionDeclaration_1.kind === 171 /* SyntaxKind.Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); + var allSignatures = functionDeclaration_1.kind === 173 /* SyntaxKind.Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration_1)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration_1); // TODO: GH#18217 } else { signature = allSignatures[0]; } - if (functionDeclaration_1.kind === 171 /* SyntaxKind.Constructor */) { + if (functionDeclaration_1.kind === 173 /* SyntaxKind.Constructor */) { // show (constructor) Type(...) signature symbolKind = "constructor" /* ScriptElementKind.constructorImplementationElement */; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { // (function/method) symbol(..signature) - addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 174 /* SyntaxKind.CallSignature */ && + addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 176 /* SyntaxKind.CallSignature */ && !(type.symbol.flags & 2048 /* SymbolFlags.TypeLiteral */ || type.symbol.flags & 4096 /* SymbolFlags.ObjectLiteral */) ? type.symbol : symbol, symbolKind); } if (signature) { @@ -147582,7 +148592,7 @@ var ts; } if (symbolFlags & 32 /* SymbolFlags.Class */ && !hasAddedSymbolInfo && !isThisExpression) { addAliasPrefixIfNecessary(); - if (ts.getDeclarationOfKind(symbol, 226 /* SyntaxKind.ClassExpression */)) { + if (ts.getDeclarationOfKind(symbol, 228 /* SyntaxKind.ClassExpression */)) { // Special case for class expressions because we would like to indicate that // the class name is local to the class body (similar to function expression) // (local class) class @@ -147605,7 +148615,7 @@ var ts; } if ((symbolFlags & 524288 /* SymbolFlags.TypeAlias */) && (semanticMeaning & 2 /* SemanticMeaning.Type */)) { prefixNextMeaning(); - displayParts.push(ts.keywordPart(152 /* SyntaxKind.TypeKeyword */)); + displayParts.push(ts.keywordPart(154 /* SyntaxKind.TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); @@ -147626,9 +148636,9 @@ var ts; } if (symbolFlags & 1536 /* SymbolFlags.Module */ && !isThisExpression) { prefixNextMeaning(); - var declaration = ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.ModuleDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 264 /* SyntaxKind.ModuleDeclaration */); var isNamespace = declaration && declaration.name && declaration.name.kind === 79 /* SyntaxKind.Identifier */; - displayParts.push(ts.keywordPart(isNamespace ? 142 /* SyntaxKind.NamespaceKeyword */ : 141 /* SyntaxKind.ModuleKeyword */)); + displayParts.push(ts.keywordPart(isNamespace ? 143 /* SyntaxKind.NamespaceKeyword */ : 142 /* SyntaxKind.ModuleKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } @@ -147647,7 +148657,7 @@ var ts; } else { // Method/function type parameter - var decl = ts.getDeclarationOfKind(symbol, 163 /* SyntaxKind.TypeParameter */); + var decl = ts.getDeclarationOfKind(symbol, 165 /* SyntaxKind.TypeParameter */); if (decl === undefined) return ts.Debug.fail(); var declaration = decl.parent; @@ -147655,21 +148665,21 @@ var ts; if (ts.isFunctionLikeKind(declaration.kind)) { addInPrefix(); var signature = typeChecker.getSignatureFromDeclaration(declaration); // TODO: GH#18217 - if (declaration.kind === 175 /* SyntaxKind.ConstructSignature */) { + if (declaration.kind === 177 /* SyntaxKind.ConstructSignature */) { displayParts.push(ts.keywordPart(103 /* SyntaxKind.NewKeyword */)); displayParts.push(ts.spacePart()); } - else if (declaration.kind !== 174 /* SyntaxKind.CallSignature */ && declaration.name) { + else if (declaration.kind !== 176 /* SyntaxKind.CallSignature */ && declaration.name) { addFullSymbolName(declaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* TypeFormatFlags.WriteTypeArgumentsOfSignature */)); } - else if (declaration.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + else if (declaration.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { // Type alias type parameter // For example // type list = T[]; // Both T will go through same code path addInPrefix(); - displayParts.push(ts.keywordPart(152 /* SyntaxKind.TypeKeyword */)); + displayParts.push(ts.keywordPart(154 /* SyntaxKind.TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(declaration.symbol); writeTypeParametersOfSymbol(declaration.symbol, sourceFile); @@ -147681,7 +148691,7 @@ var ts; symbolKind = "enum member" /* ScriptElementKind.enumMemberElement */; addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]; - if ((declaration === null || declaration === void 0 ? void 0 : declaration.kind) === 299 /* SyntaxKind.EnumMember */) { + if ((declaration === null || declaration === void 0 ? void 0 : declaration.kind) === 302 /* SyntaxKind.EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -147717,17 +148727,17 @@ var ts; } if (symbol.declarations) { switch (symbol.declarations[0].kind) { - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(142 /* SyntaxKind.NamespaceKeyword */)); + displayParts.push(ts.keywordPart(143 /* SyntaxKind.NamespaceKeyword */)); break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(symbol.declarations[0].isExportEquals ? 63 /* SyntaxKind.EqualsToken */ : 88 /* SyntaxKind.DefaultKeyword */)); break; - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); break; default: @@ -147737,13 +148747,13 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (declaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); displayParts.push(ts.operatorPart(63 /* SyntaxKind.EqualsToken */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(146 /* SyntaxKind.RequireKeyword */)); + displayParts.push(ts.keywordPart(147 /* SyntaxKind.RequireKeyword */)); displayParts.push(ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */)); displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), ts.SymbolDisplayPartKind.stringLiteral)); displayParts.push(ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)); @@ -147773,16 +148783,18 @@ var ts; } // For properties, variables and local vars: show the type if (symbolKind === "property" /* ScriptElementKind.memberVariableElement */ || + symbolKind === "accessor" /* ScriptElementKind.memberAccessorVariableElement */ || symbolKind === "getter" /* ScriptElementKind.memberGetAccessorElement */ || symbolKind === "setter" /* ScriptElementKind.memberSetAccessorElement */ || symbolKind === "JSX attribute" /* ScriptElementKind.jsxAttribute */ || symbolFlags & 3 /* SymbolFlags.Variable */ || symbolKind === "local var" /* ScriptElementKind.localVariableElement */ || + symbolKind === "index" /* ScriptElementKind.indexSignatureElement */ || isThisExpression) { displayParts.push(ts.punctuationPart(58 /* SyntaxKind.ColonToken */)); displayParts.push(ts.spacePart()); // If the type is type parameter, format it specially - if (type.symbol && type.symbol.flags & 262144 /* SymbolFlags.TypeParameter */) { + if (type.symbol && type.symbol.flags & 262144 /* SymbolFlags.TypeParameter */ && symbolKind !== "index" /* ScriptElementKind.indexSignatureElement */) { var typeParameterParts = ts.mapToDisplayParts(function (writer) { var param = typeChecker.typeParameterToDeclaration(type, enclosingDeclaration, symbolDisplayNodeBuilderFlags); getPrinter().writeNode(4 /* EmitHint.Unspecified */, param, ts.getSourceFileOfNode(ts.getParseTreeNode(enclosingDeclaration)), writer); @@ -147826,10 +148838,10 @@ var ts; // For some special property access expressions like `exports.foo = foo` or `module.exports.foo = foo` // there documentation comments might be attached to the right hand side symbol of their declarations. // The pattern of such special property access is that the parent symbol is the symbol of the file. - if (symbol.parent && symbol.declarations && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 305 /* SyntaxKind.SourceFile */; })) { + if (symbol.parent && symbol.declarations && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 308 /* SyntaxKind.SourceFile */; })) { for (var _i = 0, _b = symbol.declarations; _i < _b.length; _i++) { var declaration = _b[_i]; - if (!declaration.parent || declaration.parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (!declaration.parent || declaration.parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { continue; } var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); @@ -147890,10 +148902,34 @@ var ts; displayParts.push(ts.spacePart()); } function addFullSymbolName(symbolToDisplay, enclosingDeclaration) { + var indexInfos; if (alias && symbolToDisplay === symbol) { symbolToDisplay = alias; } - var fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay, enclosingDeclaration || sourceFile, /*meaning*/ undefined, 1 /* SymbolFormatFlags.WriteTypeParametersOrArguments */ | 2 /* SymbolFormatFlags.UseOnlyExternalAliasing */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + if (symbolKind === "index" /* ScriptElementKind.indexSignatureElement */) { + indexInfos = typeChecker.getIndexInfosOfIndexSymbol(symbolToDisplay); + } + var fullSymbolDisplayParts = []; + if (symbolToDisplay.flags & 131072 /* SymbolFlags.Signature */ && indexInfos) { + if (symbolToDisplay.parent) { + fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay.parent); + } + fullSymbolDisplayParts.push(ts.punctuationPart(22 /* SyntaxKind.OpenBracketToken */)); + //Needed to handle more than one type of index + indexInfos.forEach(function (info, i) { + //Needed to handle template literals + fullSymbolDisplayParts.push.apply(fullSymbolDisplayParts, ts.typeToDisplayParts(typeChecker, info.keyType)); + if (i !== indexInfos.length - 1) { + fullSymbolDisplayParts.push(ts.spacePart()); + fullSymbolDisplayParts.push(ts.punctuationPart(51 /* SyntaxKind.BarToken */)); + fullSymbolDisplayParts.push(ts.spacePart()); + } + }); + fullSymbolDisplayParts.push(ts.punctuationPart(23 /* SyntaxKind.CloseBracketToken */)); + } + else { + fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay, enclosingDeclaration || sourceFile, /*meaning*/ undefined, 1 /* SymbolFormatFlags.WriteTypeParametersOrArguments */ | 2 /* SymbolFormatFlags.UseOnlyExternalAliasing */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + } ts.addRange(displayParts, fullSymbolDisplayParts); if (symbol.flags & 16777216 /* SymbolFlags.Optional */) { displayParts.push(ts.punctuationPart(57 /* SyntaxKind.QuestionToken */)); @@ -147959,16 +148995,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (declaration.kind === 215 /* SyntaxKind.FunctionExpression */) { return true; } - if (declaration.kind !== 254 /* SyntaxKind.VariableDeclaration */ && declaration.kind !== 256 /* SyntaxKind.FunctionDeclaration */) { + if (declaration.kind !== 257 /* SyntaxKind.VariableDeclaration */ && declaration.kind !== 259 /* SyntaxKind.FunctionDeclaration */) { return false; } // If the parent is not sourceFile or module block it is local variable for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { // Reached source file or module block - if (parent.kind === 305 /* SyntaxKind.SourceFile */ || parent.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ || parent.kind === 265 /* SyntaxKind.ModuleBlock */) { return false; } } @@ -148273,10 +149309,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 285 /* SyntaxKind.JsxAttribute */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 288 /* SyntaxKind.JsxAttribute */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: // May parse an identifier like `module-layout`; that will be scanned as a keyword at first, but we should parse the whole thing to get an identifier. return ts.isKeyword(node.kind) || node.kind === 79 /* SyntaxKind.Identifier */; } @@ -148469,7 +149505,7 @@ var ts; (function (formatting) { function getAllRules() { var allTokens = []; - for (var token = 0 /* SyntaxKind.FirstToken */; token <= 160 /* SyntaxKind.LastToken */; token++) { + for (var token = 0 /* SyntaxKind.FirstToken */; token <= 162 /* SyntaxKind.LastToken */; token++) { if (token !== 1 /* SyntaxKind.EndOfFileToken */) { allTokens.push(token); } @@ -148484,9 +149520,9 @@ var ts; var anyToken = { tokens: allTokens, isSpecific: false }; var anyTokenIncludingMultilineComments = tokenRangeFrom(__spreadArray(__spreadArray([], allTokens, true), [3 /* SyntaxKind.MultiLineCommentTrivia */], false)); var anyTokenIncludingEOF = tokenRangeFrom(__spreadArray(__spreadArray([], allTokens, true), [1 /* SyntaxKind.EndOfFileToken */], false)); - var keywords = tokenRangeFromRange(81 /* SyntaxKind.FirstKeyword */, 160 /* SyntaxKind.LastKeyword */); + var keywords = tokenRangeFromRange(81 /* SyntaxKind.FirstKeyword */, 162 /* SyntaxKind.LastKeyword */); var binaryOperators = tokenRangeFromRange(29 /* SyntaxKind.FirstBinaryOperator */, 78 /* SyntaxKind.LastBinaryOperator */); - var binaryKeywordOperators = [101 /* SyntaxKind.InKeyword */, 102 /* SyntaxKind.InstanceOfKeyword */, 160 /* SyntaxKind.OfKeyword */, 127 /* SyntaxKind.AsKeyword */, 139 /* SyntaxKind.IsKeyword */]; + var binaryKeywordOperators = [101 /* SyntaxKind.InKeyword */, 102 /* SyntaxKind.InstanceOfKeyword */, 162 /* SyntaxKind.OfKeyword */, 128 /* SyntaxKind.AsKeyword */, 140 /* SyntaxKind.IsKeyword */]; var unaryPrefixOperators = [45 /* SyntaxKind.PlusPlusToken */, 46 /* SyntaxKind.MinusMinusToken */, 54 /* SyntaxKind.TildeToken */, 53 /* SyntaxKind.ExclamationToken */]; var unaryPrefixExpressions = [ 8 /* SyntaxKind.NumericLiteral */, 9 /* SyntaxKind.BigIntLiteral */, 79 /* SyntaxKind.Identifier */, 20 /* SyntaxKind.OpenParenToken */, @@ -148517,7 +149553,7 @@ var ts; rule("SpaceAfterQuestionMarkInConditionalOperator", 57 /* SyntaxKind.QuestionToken */, anyToken, [isNonJsxSameLineTokenContext, isConditionalOperatorContext], 4 /* RuleAction.InsertSpace */), // in other cases there should be no space between '?' and next token rule("NoSpaceAfterQuestionMark", 57 /* SyntaxKind.QuestionToken */, anyToken, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), - rule("NoSpaceBeforeDot", anyToken, [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceBeforeDot", anyToken, [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], [isNonJsxSameLineTokenContext, isNotPropertyAccessOnIntegerLiteral], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceAfterDot", [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], anyToken, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceBetweenImportParenInImportType", 100 /* SyntaxKind.ImportKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext, isImportTypeContext], 16 /* RuleAction.DeleteSpace */), // Special handling of unary operators. @@ -148560,11 +149596,11 @@ var ts; // Though, we do extra check on the context to make sure we are dealing with get/set node. Example: // get x() {} // set x(val) {} - rule("SpaceAfterGetSetInMember", [136 /* SyntaxKind.GetKeyword */, 149 /* SyntaxKind.SetKeyword */], 79 /* SyntaxKind.Identifier */, [isFunctionDeclContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceAfterGetSetInMember", [137 /* SyntaxKind.GetKeyword */, 151 /* SyntaxKind.SetKeyword */], 79 /* SyntaxKind.Identifier */, [isFunctionDeclContext], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBetweenYieldKeywordAndStar", 125 /* SyntaxKind.YieldKeyword */, 41 /* SyntaxKind.AsteriskToken */, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 16 /* RuleAction.DeleteSpace */), rule("SpaceBetweenYieldOrYieldStarAndOperand", [125 /* SyntaxKind.YieldKeyword */, 41 /* SyntaxKind.AsteriskToken */], anyToken, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBetweenReturnAndSemicolon", 105 /* SyntaxKind.ReturnKeyword */, 26 /* SyntaxKind.SemicolonToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), - rule("SpaceAfterCertainKeywords", [113 /* SyntaxKind.VarKeyword */, 109 /* SyntaxKind.ThrowKeyword */, 103 /* SyntaxKind.NewKeyword */, 89 /* SyntaxKind.DeleteKeyword */, 105 /* SyntaxKind.ReturnKeyword */, 112 /* SyntaxKind.TypeOfKeyword */, 132 /* SyntaxKind.AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceAfterCertainKeywords", [113 /* SyntaxKind.VarKeyword */, 109 /* SyntaxKind.ThrowKeyword */, 103 /* SyntaxKind.NewKeyword */, 89 /* SyntaxKind.DeleteKeyword */, 105 /* SyntaxKind.ReturnKeyword */, 112 /* SyntaxKind.TypeOfKeyword */, 133 /* SyntaxKind.AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), rule("SpaceAfterLetConstInVariableDeclaration", [119 /* SyntaxKind.LetKeyword */, 85 /* SyntaxKind.ConstKeyword */], anyToken, [isNonJsxSameLineTokenContext, isStartOfVariableDeclarationList], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBeforeOpenParenInFuncCall", anyToken, 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext, isFunctionCallOrNewContext, isPreviousTokenNotComma], 16 /* RuleAction.DeleteSpace */), // Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options. @@ -148572,8 +149608,8 @@ var ts; rule("SpaceAfterBinaryKeywordOperator", binaryKeywordOperators, anyToken, [isNonJsxSameLineTokenContext, isBinaryOpContext], 4 /* RuleAction.InsertSpace */), rule("SpaceAfterVoidOperator", 114 /* SyntaxKind.VoidKeyword */, anyToken, [isNonJsxSameLineTokenContext, isVoidOpContext], 4 /* RuleAction.InsertSpace */), // Async-await - rule("SpaceBetweenAsyncAndOpenParen", 131 /* SyntaxKind.AsyncKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("SpaceBetweenAsyncAndFunctionKeyword", 131 /* SyntaxKind.AsyncKeyword */, [98 /* SyntaxKind.FunctionKeyword */, 79 /* SyntaxKind.Identifier */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenAsyncAndOpenParen", 132 /* SyntaxKind.AsyncKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenAsyncAndFunctionKeyword", 132 /* SyntaxKind.AsyncKeyword */, [98 /* SyntaxKind.FunctionKeyword */, 79 /* SyntaxKind.Identifier */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Template string rule("NoSpaceBetweenTagAndTemplateString", [79 /* SyntaxKind.Identifier */, 21 /* SyntaxKind.CloseParenToken */], [14 /* SyntaxKind.NoSubstitutionTemplateLiteral */, 15 /* SyntaxKind.TemplateHead */], [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // JSX opening elements @@ -148584,34 +149620,35 @@ var ts; rule("NoSpaceAfterEqualInJsxAttribute", 63 /* SyntaxKind.EqualsToken */, anyToken, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // TypeScript-specific rules // Use of module as a function call. e.g.: import m2 = module("m2"); - rule("NoSpaceAfterModuleImport", [141 /* SyntaxKind.ModuleKeyword */, 146 /* SyntaxKind.RequireKeyword */], 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceAfterModuleImport", [142 /* SyntaxKind.ModuleKeyword */, 147 /* SyntaxKind.RequireKeyword */], 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // Add a space around certain TypeScript keywords rule("SpaceAfterCertainTypeScriptKeywords", [ 126 /* SyntaxKind.AbstractKeyword */, + 127 /* SyntaxKind.AccessorKeyword */, 84 /* SyntaxKind.ClassKeyword */, - 135 /* SyntaxKind.DeclareKeyword */, + 136 /* SyntaxKind.DeclareKeyword */, 88 /* SyntaxKind.DefaultKeyword */, 92 /* SyntaxKind.EnumKeyword */, 93 /* SyntaxKind.ExportKeyword */, 94 /* SyntaxKind.ExtendsKeyword */, - 136 /* SyntaxKind.GetKeyword */, + 137 /* SyntaxKind.GetKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 100 /* SyntaxKind.ImportKeyword */, 118 /* SyntaxKind.InterfaceKeyword */, - 141 /* SyntaxKind.ModuleKeyword */, - 142 /* SyntaxKind.NamespaceKeyword */, + 142 /* SyntaxKind.ModuleKeyword */, + 143 /* SyntaxKind.NamespaceKeyword */, 121 /* SyntaxKind.PrivateKeyword */, 123 /* SyntaxKind.PublicKeyword */, 122 /* SyntaxKind.ProtectedKeyword */, - 145 /* SyntaxKind.ReadonlyKeyword */, - 149 /* SyntaxKind.SetKeyword */, + 146 /* SyntaxKind.ReadonlyKeyword */, + 151 /* SyntaxKind.SetKeyword */, 124 /* SyntaxKind.StaticKeyword */, - 152 /* SyntaxKind.TypeKeyword */, - 156 /* SyntaxKind.FromKeyword */, - 140 /* SyntaxKind.KeyOfKeyword */, - 137 /* SyntaxKind.InferKeyword */, + 154 /* SyntaxKind.TypeKeyword */, + 158 /* SyntaxKind.FromKeyword */, + 141 /* SyntaxKind.KeyOfKeyword */, + 138 /* SyntaxKind.InferKeyword */, ], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [94 /* SyntaxKind.ExtendsKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 156 /* SyntaxKind.FromKeyword */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [94 /* SyntaxKind.ExtendsKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 158 /* SyntaxKind.FromKeyword */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { rule("SpaceAfterModuleName", 10 /* SyntaxKind.StringLiteral */, 18 /* SyntaxKind.OpenBraceToken */, [isModuleDeclContext], 4 /* RuleAction.InsertSpace */), // Lambda expressions @@ -148642,8 +149679,8 @@ var ts; 123 /* SyntaxKind.PublicKeyword */, 121 /* SyntaxKind.PrivateKeyword */, 122 /* SyntaxKind.ProtectedKeyword */, - 136 /* SyntaxKind.GetKeyword */, - 149 /* SyntaxKind.SetKeyword */, + 137 /* SyntaxKind.GetKeyword */, + 151 /* SyntaxKind.SetKeyword */, 22 /* SyntaxKind.OpenBracketToken */, 41 /* SyntaxKind.AsteriskToken */, ], [isEndOfDecoratorContextOnSameLine], 4 /* RuleAction.InsertSpace */), @@ -148654,8 +149691,8 @@ var ts; // These rules are applied after high priority var userConfigurableRules = [ // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses - rule("SpaceAfterConstructor", 134 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("NoSpaceAfterConstructor", 134 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("SpaceAfterConstructor", 135 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("NoSpaceAfterConstructor", 135 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("SpaceAfterComma", 27 /* SyntaxKind.CommaToken */, anyToken, [isOptionEnabled("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNextTokenNotCloseBracket, isNextTokenNotCloseParen], 4 /* RuleAction.InsertSpace */), rule("NoSpaceAfterComma", 27 /* SyntaxKind.CommaToken */, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext], 16 /* RuleAction.DeleteSpace */), // Insert space after function keyword for anonymous functions @@ -148729,11 +149766,11 @@ var ts; rule("SpaceBeforeOpenBraceInTypeScriptDeclWithBlock", typeScriptOpenBraceLeftTokenRange, 18 /* SyntaxKind.OpenBraceToken */, [isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForFunctions"), isTypeScriptDeclWithBlockContext, isNotFormatOnEnter, isSameLineTokenOrBeforeBlockContext], 4 /* RuleAction.InsertSpace */, 1 /* RuleFlags.CanDeleteNewLines */), rule("NoSpaceBeforeComma", anyToken, 27 /* SyntaxKind.CommaToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // No space before and after indexer `x[]` - rule("NoSpaceBeforeOpenBracket", anyTokenExcept(131 /* SyntaxKind.AsyncKeyword */, 82 /* SyntaxKind.CaseKeyword */), 22 /* SyntaxKind.OpenBracketToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceBeforeOpenBracket", anyTokenExcept(132 /* SyntaxKind.AsyncKeyword */, 82 /* SyntaxKind.CaseKeyword */), 22 /* SyntaxKind.OpenBracketToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceAfterCloseBracket", 23 /* SyntaxKind.CloseBracketToken */, anyToken, [isNonJsxSameLineTokenContext, isNotBeforeBlockInFunctionDeclarationContext], 16 /* RuleAction.DeleteSpace */), rule("SpaceAfterSemicolon", 26 /* SyntaxKind.SemicolonToken */, anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Remove extra space between for and await - rule("SpaceBetweenForAndAwaitKeyword", 97 /* SyntaxKind.ForKeyword */, 132 /* SyntaxKind.AwaitKeyword */, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenForAndAwaitKeyword", 97 /* SyntaxKind.ForKeyword */, 133 /* SyntaxKind.AwaitKeyword */, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Add a space between statements. All keywords except (do,else,case) has open/close parens after them. // So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any] rule("SpaceBetweenStatements", [21 /* SyntaxKind.CloseParenToken */, 90 /* SyntaxKind.DoKeyword */, 91 /* SyntaxKind.ElseKeyword */, 82 /* SyntaxKind.CaseKeyword */], anyToken, [isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNotForContext], 4 /* RuleAction.InsertSpace */), @@ -148782,69 +149819,70 @@ var ts; return function (context) { return context.options && context.options[optionName] === optionValue; }; } function isOptionEnabled(optionName) { - return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !!context.options[optionName]; }; + return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !!context.options[optionName]; }; } function isOptionDisabled(optionName) { - return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !context.options[optionName]; }; + return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !context.options[optionName]; }; } function isOptionDisabledOrUndefined(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName]; }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName]; }; } function isOptionDisabledOrUndefinedOrTokensOnSameLine(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); }; } function isOptionEnabledOrUndefined(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName]; }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !!context.options[optionName]; }; } function isForContext(context) { - return context.contextNode.kind === 242 /* SyntaxKind.ForStatement */; + return context.contextNode.kind === 245 /* SyntaxKind.ForStatement */; } function isNotForContext(context) { return !isForContext(context); } function isBinaryOpContext(context) { switch (context.contextNode.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return context.contextNode.operatorToken.kind !== 27 /* SyntaxKind.CommaToken */; - case 222 /* SyntaxKind.ConditionalExpression */: - case 189 /* SyntaxKind.ConditionalType */: - case 229 /* SyntaxKind.AsExpression */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 177 /* SyntaxKind.TypePredicate */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 191 /* SyntaxKind.ConditionalType */: + case 231 /* SyntaxKind.AsExpression */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 179 /* SyntaxKind.TypePredicate */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 235 /* SyntaxKind.SatisfiesExpression */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: // equals in type X = ... // falls through - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // equal in import a = module('a'); // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // equal in export = 1 // falls through - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: // equal in let a = 0 // falls through - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: // equal in p = 0 // falls through - case 164 /* SyntaxKind.Parameter */: - case 299 /* SyntaxKind.EnumMember */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 302 /* SyntaxKind.EnumMember */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return context.currentTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */ || context.nextTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */; // "in" keyword in for (let x in []) { } - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: // "in" keyword in [P in keyof T]: T[P] // falls through - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return context.currentTokenSpan.kind === 101 /* SyntaxKind.InKeyword */ || context.nextTokenSpan.kind === 101 /* SyntaxKind.InKeyword */ || context.currentTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */ || context.nextTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 244 /* SyntaxKind.ForOfStatement */: - return context.currentTokenSpan.kind === 160 /* SyntaxKind.OfKeyword */ || context.nextTokenSpan.kind === 160 /* SyntaxKind.OfKeyword */; + case 247 /* SyntaxKind.ForOfStatement */: + return context.currentTokenSpan.kind === 162 /* SyntaxKind.OfKeyword */ || context.nextTokenSpan.kind === 162 /* SyntaxKind.OfKeyword */; } return false; } @@ -148856,22 +149894,22 @@ var ts; } function isTypeAnnotationContext(context) { var contextKind = context.contextNode.kind; - return contextKind === 167 /* SyntaxKind.PropertyDeclaration */ || - contextKind === 166 /* SyntaxKind.PropertySignature */ || - contextKind === 164 /* SyntaxKind.Parameter */ || - contextKind === 254 /* SyntaxKind.VariableDeclaration */ || + return contextKind === 169 /* SyntaxKind.PropertyDeclaration */ || + contextKind === 168 /* SyntaxKind.PropertySignature */ || + contextKind === 166 /* SyntaxKind.Parameter */ || + contextKind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isFunctionLikeKind(contextKind); } function isConditionalOperatorContext(context) { - return context.contextNode.kind === 222 /* SyntaxKind.ConditionalExpression */ || - context.contextNode.kind === 189 /* SyntaxKind.ConditionalType */; + return context.contextNode.kind === 224 /* SyntaxKind.ConditionalExpression */ || + context.contextNode.kind === 191 /* SyntaxKind.ConditionalType */; } function isSameLineTokenOrBeforeBlockContext(context) { return context.TokensAreOnSameLine() || isBeforeBlockContext(context); } function isBraceWrappedContext(context) { - return context.contextNode.kind === 201 /* SyntaxKind.ObjectBindingPattern */ || - context.contextNode.kind === 195 /* SyntaxKind.MappedType */ || + return context.contextNode.kind === 203 /* SyntaxKind.ObjectBindingPattern */ || + context.contextNode.kind === 197 /* SyntaxKind.MappedType */ || isSingleLineBlockContext(context); } // This check is done before an open brace in a control construct, a function, or a typescript block declaration @@ -148897,34 +149935,34 @@ var ts; return true; } switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 265 /* SyntaxKind.ModuleBlock */: return true; } return false; } function isFunctionDeclContext(context) { switch (context.contextNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: // case SyntaxKind.MemberFunctionDeclaration: // falls through - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // case SyntaxKind.MethodSignature: // falls through - case 174 /* SyntaxKind.CallSignature */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 214 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 216 /* SyntaxKind.ArrowFunction */: // case SyntaxKind.ConstructorDeclaration: // case SyntaxKind.SimpleArrowFunctionExpression: // case SyntaxKind.ParenthesizedArrowFunctionExpression: // falls through - case 258 /* SyntaxKind.InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one + case 261 /* SyntaxKind.InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one return true; } return false; @@ -148933,40 +149971,40 @@ var ts; return !isFunctionDeclContext(context); } function isFunctionDeclarationOrFunctionExpressionContext(context) { - return context.contextNode.kind === 256 /* SyntaxKind.FunctionDeclaration */ || context.contextNode.kind === 213 /* SyntaxKind.FunctionExpression */; + return context.contextNode.kind === 259 /* SyntaxKind.FunctionDeclaration */ || context.contextNode.kind === 215 /* SyntaxKind.FunctionExpression */; } function isTypeScriptDeclWithBlockContext(context) { return nodeIsTypeScriptDeclWithBlockContext(context.contextNode); } function nodeIsTypeScriptDeclWithBlockContext(node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 273 /* SyntaxKind.NamedExports */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 269 /* SyntaxKind.NamedImports */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 276 /* SyntaxKind.NamedExports */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 272 /* SyntaxKind.NamedImports */: return true; } return false; } function isAfterCodeBlockContext(context) { switch (context.currentTokenParent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 292 /* SyntaxKind.CatchClause */: - case 262 /* SyntaxKind.ModuleBlock */: - case 249 /* SyntaxKind.SwitchStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 295 /* SyntaxKind.CatchClause */: + case 265 /* SyntaxKind.ModuleBlock */: + case 252 /* SyntaxKind.SwitchStatement */: return true; - case 235 /* SyntaxKind.Block */: { + case 238 /* SyntaxKind.Block */: { var blockParent = context.currentTokenParent.parent; // In a codefix scenario, we can't rely on parents being set. So just always return true. - if (!blockParent || blockParent.kind !== 214 /* SyntaxKind.ArrowFunction */ && blockParent.kind !== 213 /* SyntaxKind.FunctionExpression */) { + if (!blockParent || blockParent.kind !== 216 /* SyntaxKind.ArrowFunction */ && blockParent.kind !== 215 /* SyntaxKind.FunctionExpression */) { return true; } } @@ -148975,32 +150013,32 @@ var ts; } function isControlDeclContext(context) { switch (context.contextNode.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 248 /* SyntaxKind.WithStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 251 /* SyntaxKind.WithStatement */: // TODO // case SyntaxKind.ElseClause: // falls through - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return true; default: return false; } } function isObjectContext(context) { - return context.contextNode.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return context.contextNode.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } function isFunctionCallContext(context) { - return context.contextNode.kind === 208 /* SyntaxKind.CallExpression */; + return context.contextNode.kind === 210 /* SyntaxKind.CallExpression */; } function isNewContext(context) { - return context.contextNode.kind === 209 /* SyntaxKind.NewExpression */; + return context.contextNode.kind === 211 /* SyntaxKind.NewExpression */; } function isFunctionCallOrNewContext(context) { return isFunctionCallContext(context) || isNewContext(context); @@ -149015,10 +150053,10 @@ var ts; return context.nextTokenSpan.kind !== 21 /* SyntaxKind.CloseParenToken */; } function isArrowFunctionContext(context) { - return context.contextNode.kind === 214 /* SyntaxKind.ArrowFunction */; + return context.contextNode.kind === 216 /* SyntaxKind.ArrowFunction */; } function isImportTypeContext(context) { - return context.contextNode.kind === 200 /* SyntaxKind.ImportType */; + return context.contextNode.kind === 202 /* SyntaxKind.ImportType */; } function isNonJsxSameLineTokenContext(context) { return context.TokensAreOnSameLine() && context.contextNode.kind !== 11 /* SyntaxKind.JsxText */; @@ -149027,19 +150065,19 @@ var ts; return context.contextNode.kind !== 11 /* SyntaxKind.JsxText */; } function isNonJsxElementOrFragmentContext(context) { - return context.contextNode.kind !== 278 /* SyntaxKind.JsxElement */ && context.contextNode.kind !== 282 /* SyntaxKind.JsxFragment */; + return context.contextNode.kind !== 281 /* SyntaxKind.JsxElement */ && context.contextNode.kind !== 285 /* SyntaxKind.JsxFragment */; } function isJsxExpressionContext(context) { - return context.contextNode.kind === 288 /* SyntaxKind.JsxExpression */ || context.contextNode.kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return context.contextNode.kind === 291 /* SyntaxKind.JsxExpression */ || context.contextNode.kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } function isNextTokenParentJsxAttribute(context) { - return context.nextTokenParent.kind === 285 /* SyntaxKind.JsxAttribute */; + return context.nextTokenParent.kind === 288 /* SyntaxKind.JsxAttribute */; } function isJsxAttributeContext(context) { - return context.contextNode.kind === 285 /* SyntaxKind.JsxAttribute */; + return context.contextNode.kind === 288 /* SyntaxKind.JsxAttribute */; } function isJsxSelfClosingElementContext(context) { - return context.contextNode.kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return context.contextNode.kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } function isNotBeforeBlockInFunctionDeclarationContext(context) { return !isFunctionDeclContext(context) && !isBeforeBlockContext(context); @@ -149054,45 +150092,45 @@ var ts; while (ts.isExpressionNode(node)) { node = node.parent; } - return node.kind === 165 /* SyntaxKind.Decorator */; + return node.kind === 167 /* SyntaxKind.Decorator */; } function isStartOfVariableDeclarationList(context) { - return context.currentTokenParent.kind === 255 /* SyntaxKind.VariableDeclarationList */ && + return context.currentTokenParent.kind === 258 /* SyntaxKind.VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; } function isNotFormatOnEnter(context) { return context.formattingRequestKind !== 2 /* FormattingRequestKind.FormatOnEnter */; } function isModuleDeclContext(context) { - return context.contextNode.kind === 261 /* SyntaxKind.ModuleDeclaration */; + return context.contextNode.kind === 264 /* SyntaxKind.ModuleDeclaration */; } function isObjectTypeContext(context) { - return context.contextNode.kind === 182 /* SyntaxKind.TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; + return context.contextNode.kind === 184 /* SyntaxKind.TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; } function isConstructorSignatureContext(context) { - return context.contextNode.kind === 175 /* SyntaxKind.ConstructSignature */; + return context.contextNode.kind === 177 /* SyntaxKind.ConstructSignature */; } function isTypeArgumentOrParameterOrAssertion(token, parent) { if (token.kind !== 29 /* SyntaxKind.LessThanToken */ && token.kind !== 31 /* SyntaxKind.GreaterThanToken */) { return false; } switch (parent.kind) { - case 178 /* SyntaxKind.TypeReference */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return true; default: return false; @@ -149103,28 +150141,28 @@ var ts; isTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); } function isTypeAssertionContext(context) { - return context.contextNode.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return context.contextNode.kind === 213 /* SyntaxKind.TypeAssertionExpression */; } function isVoidOpContext(context) { - return context.currentTokenSpan.kind === 114 /* SyntaxKind.VoidKeyword */ && context.currentTokenParent.kind === 217 /* SyntaxKind.VoidExpression */; + return context.currentTokenSpan.kind === 114 /* SyntaxKind.VoidKeyword */ && context.currentTokenParent.kind === 219 /* SyntaxKind.VoidExpression */; } function isYieldOrYieldStarWithOperand(context) { - return context.contextNode.kind === 224 /* SyntaxKind.YieldExpression */ && context.contextNode.expression !== undefined; + return context.contextNode.kind === 226 /* SyntaxKind.YieldExpression */ && context.contextNode.expression !== undefined; } function isNonNullAssertionContext(context) { - return context.contextNode.kind === 230 /* SyntaxKind.NonNullExpression */; + return context.contextNode.kind === 232 /* SyntaxKind.NonNullExpression */; } function isNotStatementConditionContext(context) { return !isStatementConditionContext(context); } function isStatementConditionContext(context) { switch (context.contextNode.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return true; default: return false; @@ -149149,12 +150187,12 @@ var ts; return nextTokenKind === 19 /* SyntaxKind.CloseBraceToken */ || nextTokenKind === 1 /* SyntaxKind.EndOfFileToken */; } - if (nextTokenKind === 234 /* SyntaxKind.SemicolonClassElement */ || + if (nextTokenKind === 237 /* SyntaxKind.SemicolonClassElement */ || nextTokenKind === 26 /* SyntaxKind.SemicolonToken */) { return false; } - if (context.contextNode.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - context.contextNode.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + if (context.contextNode.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + context.contextNode.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { // Can’t remove semicolon after `foo`; it would parse as a method declaration: // // interface I { @@ -149168,9 +150206,9 @@ var ts; if (ts.isPropertyDeclaration(context.currentTokenParent)) { return !context.currentTokenParent.initializer; } - return context.currentTokenParent.kind !== 242 /* SyntaxKind.ForStatement */ - && context.currentTokenParent.kind !== 236 /* SyntaxKind.EmptyStatement */ - && context.currentTokenParent.kind !== 234 /* SyntaxKind.SemicolonClassElement */ + return context.currentTokenParent.kind !== 245 /* SyntaxKind.ForStatement */ + && context.currentTokenParent.kind !== 239 /* SyntaxKind.EmptyStatement */ + && context.currentTokenParent.kind !== 237 /* SyntaxKind.SemicolonClassElement */ && nextTokenKind !== 22 /* SyntaxKind.OpenBracketToken */ && nextTokenKind !== 20 /* SyntaxKind.OpenParenToken */ && nextTokenKind !== 39 /* SyntaxKind.PlusToken */ @@ -149178,7 +150216,7 @@ var ts; && nextTokenKind !== 43 /* SyntaxKind.SlashToken */ && nextTokenKind !== 13 /* SyntaxKind.RegularExpressionLiteral */ && nextTokenKind !== 27 /* SyntaxKind.CommaToken */ - && nextTokenKind !== 223 /* SyntaxKind.TemplateExpression */ + && nextTokenKind !== 225 /* SyntaxKind.TemplateExpression */ && nextTokenKind !== 15 /* SyntaxKind.TemplateHead */ && nextTokenKind !== 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */ && nextTokenKind !== 24 /* SyntaxKind.DotToken */; @@ -149186,6 +150224,11 @@ var ts; function isSemicolonInsertionContext(context) { return ts.positionIsASICandidate(context.currentTokenSpan.end, context.currentTokenParent, context.sourceFile); } + function isNotPropertyAccessOnIntegerLiteral(context) { + return !ts.isPropertyAccessExpression(context.contextNode) + || !ts.isNumericLiteral(context.contextNode.expression) + || context.contextNode.expression.getText().indexOf(".") !== -1; + } })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); /* @internal */ @@ -149269,12 +150312,12 @@ var ts; return map; } function getRuleBucketIndex(row, column) { - ts.Debug.assert(row <= 160 /* SyntaxKind.LastKeyword */ && column <= 160 /* SyntaxKind.LastKeyword */, "Must compute formatting context from tokens"); + ts.Debug.assert(row <= 162 /* SyntaxKind.LastKeyword */ && column <= 162 /* SyntaxKind.LastKeyword */, "Must compute formatting context from tokens"); return (row * mapRowLength) + column; } var maskBitSize = 5; var mask = 31; // MaskBitSize bits - var mapRowLength = 160 /* SyntaxKind.LastToken */ + 1; + var mapRowLength = 162 /* SyntaxKind.LastToken */ + 1; var RulesPosition; (function (RulesPosition) { RulesPosition[RulesPosition["StopRulesSpecific"] = 0] = "StopRulesSpecific"; @@ -149462,17 +150505,17 @@ var ts; // i.e. parent is class declaration with the list of members and node is one of members. function isListElement(parent, node) { switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var body = parent.body; - return !!body && body.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.rangeContainsRange(body.statements, node); - case 305 /* SyntaxKind.SourceFile */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + return !!body && body.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.rangeContainsRange(body.statements, node); + case 308 /* SyntaxKind.SourceFile */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -149735,19 +150778,19 @@ var ts; return modifier.kind; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: return 84 /* SyntaxKind.ClassKeyword */; - case 258 /* SyntaxKind.InterfaceDeclaration */: return 118 /* SyntaxKind.InterfaceKeyword */; - case 256 /* SyntaxKind.FunctionDeclaration */: return 98 /* SyntaxKind.FunctionKeyword */; - case 260 /* SyntaxKind.EnumDeclaration */: return 260 /* SyntaxKind.EnumDeclaration */; - case 172 /* SyntaxKind.GetAccessor */: return 136 /* SyntaxKind.GetKeyword */; - case 173 /* SyntaxKind.SetAccessor */: return 149 /* SyntaxKind.SetKeyword */; - case 169 /* SyntaxKind.MethodDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return 84 /* SyntaxKind.ClassKeyword */; + case 261 /* SyntaxKind.InterfaceDeclaration */: return 118 /* SyntaxKind.InterfaceKeyword */; + case 259 /* SyntaxKind.FunctionDeclaration */: return 98 /* SyntaxKind.FunctionKeyword */; + case 263 /* SyntaxKind.EnumDeclaration */: return 263 /* SyntaxKind.EnumDeclaration */; + case 174 /* SyntaxKind.GetAccessor */: return 137 /* SyntaxKind.GetKeyword */; + case 175 /* SyntaxKind.SetAccessor */: return 151 /* SyntaxKind.SetKeyword */; + case 171 /* SyntaxKind.MethodDeclaration */: if (node.asteriskToken) { return 41 /* SyntaxKind.AsteriskToken */; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: var name = ts.getNameOfDeclaration(node); if (name) { return name.kind; @@ -149804,15 +150847,15 @@ var ts; case 43 /* SyntaxKind.SlashToken */: case 31 /* SyntaxKind.GreaterThanToken */: switch (container.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return false; } break; case 22 /* SyntaxKind.OpenBracketToken */: case 23 /* SyntaxKind.CloseBracketToken */: - if (container.kind !== 195 /* SyntaxKind.MappedType */) { + if (container.kind !== 197 /* SyntaxKind.MappedType */) { return false; } break; @@ -149916,11 +150959,11 @@ var ts; return inheritedIndentation; } } - var effectiveParentStartLine = child.kind === 165 /* SyntaxKind.Decorator */ ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 167 /* SyntaxKind.Decorator */ ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; - if (isFirstListItem && parent.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && inheritedIndentation === -1 /* Constants.Unknown */) { + if (isFirstListItem && parent.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && inheritedIndentation === -1 /* Constants.Unknown */) { inheritedIndentation = childIndentation.indentation; } return inheritedIndentation; @@ -150378,18 +151421,18 @@ var ts; formatting.getRangeOfEnclosingComment = getRangeOfEnclosingComment; function getOpenTokenForList(node, list) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 214 /* SyntaxKind.ArrowFunction */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: if (node.typeParameters === list) { return 29 /* SyntaxKind.LessThanToken */; } @@ -150397,8 +151440,8 @@ var ts; return 20 /* SyntaxKind.OpenParenToken */; } break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: if (node.typeArguments === list) { return 29 /* SyntaxKind.LessThanToken */; } @@ -150406,24 +151449,24 @@ var ts; return 20 /* SyntaxKind.OpenParenToken */; } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: if (node.typeParameters === list) { return 29 /* SyntaxKind.LessThanToken */; } break; - case 178 /* SyntaxKind.TypeReference */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 181 /* SyntaxKind.TypeQuery */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 200 /* SyntaxKind.ImportType */: + case 180 /* SyntaxKind.TypeReference */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 183 /* SyntaxKind.TypeQuery */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 202 /* SyntaxKind.ImportType */: if (node.typeArguments === list) { return 29 /* SyntaxKind.LessThanToken */; } break; - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return 18 /* SyntaxKind.OpenBraceToken */; } return 0 /* SyntaxKind.Unknown */; @@ -150559,11 +151602,11 @@ var ts; // y: undefined, // } // ``` - var isObjectLiteral = currentToken.kind === 18 /* SyntaxKind.OpenBraceToken */ && currentToken.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + var isObjectLiteral = currentToken.kind === 18 /* SyntaxKind.OpenBraceToken */ && currentToken.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; if (options.indentStyle === ts.IndentStyle.Block || isObjectLiteral) { return getBlockIndent(sourceFile, position, options); } - if (precedingToken.kind === 27 /* SyntaxKind.CommaToken */ && precedingToken.parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (precedingToken.kind === 27 /* SyntaxKind.CommaToken */ && precedingToken.parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1 /* Value.Unknown */) { @@ -150573,7 +151616,7 @@ var ts; var containerList = getListByPosition(position, precedingToken.parent, sourceFile); // use list position if the preceding token is before any list items if (containerList && !ts.rangeContainsRange(containerList, precedingToken)) { - var useTheSameBaseIndentation = [213 /* SyntaxKind.FunctionExpression */, 214 /* SyntaxKind.ArrowFunction */].indexOf(currentToken.parent.kind) !== -1; + var useTheSameBaseIndentation = [215 /* SyntaxKind.FunctionExpression */, 216 /* SyntaxKind.ArrowFunction */].indexOf(currentToken.parent.kind) !== -1; var indentSize = useTheSameBaseIndentation ? 0 : options.indentSize; return getActualIndentationForListStartLine(containerList, sourceFile, options) + indentSize; // TODO: GH#18217 } @@ -150738,7 +151781,7 @@ var ts; // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually // - parent and child are not on the same line var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && - (parent.kind === 305 /* SyntaxKind.SourceFile */ || !parentAndChildShareLine); + (parent.kind === 308 /* SyntaxKind.SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Value.Unknown */; } @@ -150786,7 +151829,7 @@ var ts; } SmartIndenter.isArgumentAndStartLineOverlapsExpressionBeingCalled = isArgumentAndStartLineOverlapsExpressionBeingCalled; function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 239 /* SyntaxKind.IfStatement */ && parent.elseStatement === child) { + if (parent.kind === 242 /* SyntaxKind.IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 91 /* SyntaxKind.ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -150867,42 +151910,42 @@ var ts; } function getListByRange(start, end, node, sourceFile) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return getList(node.typeArguments); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return getList(node.properties); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getList(node.elements); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return getList(node.members); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 171 /* SyntaxKind.Constructor */: - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 173 /* SyntaxKind.Constructor */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return getList(node.typeParameters) || getList(node.parameters); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return getList(node.parameters); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return getList(node.typeParameters); - case 209 /* SyntaxKind.NewExpression */: - case 208 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: return getList(node.typeArguments) || getList(node.arguments); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return getList(node.declarations); - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return getList(node.elements); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return getList(node.elements); } function getList(list) { @@ -150925,7 +151968,7 @@ var ts; return findColumnForFirstNonWhitespaceCharacterInLine(sourceFile.getLineAndCharacterOfPosition(list.pos), sourceFile, options); } function getActualIndentationForListItem(node, sourceFile, options, listIndentsChild) { - if (node.parent && node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.parent && node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */) { // VariableDeclarationList has no wrapping tokens return -1 /* Value.Unknown */; } @@ -150998,96 +152041,96 @@ var ts; function nodeWillIndentChild(settings, parent, child, sourceFile, indentByDefault) { var childKind = child ? child.kind : 0 /* SyntaxKind.Unknown */; switch (parent.kind) { - case 238 /* SyntaxKind.ExpressionStatement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 182 /* SyntaxKind.TypeLiteral */: - case 195 /* SyntaxKind.MappedType */: - case 184 /* SyntaxKind.TupleType */: - case 263 /* SyntaxKind.CaseBlock */: - case 290 /* SyntaxKind.DefaultClause */: - case 289 /* SyntaxKind.CaseClause */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 237 /* SyntaxKind.VariableStatement */: - case 271 /* SyntaxKind.ExportAssignment */: - case 247 /* SyntaxKind.ReturnStatement */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 283 /* SyntaxKind.JsxOpeningFragment */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 288 /* SyntaxKind.JsxExpression */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 164 /* SyntaxKind.Parameter */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 273 /* SyntaxKind.NamedExports */: - case 269 /* SyntaxKind.NamedImports */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 184 /* SyntaxKind.TypeLiteral */: + case 197 /* SyntaxKind.MappedType */: + case 186 /* SyntaxKind.TupleType */: + case 266 /* SyntaxKind.CaseBlock */: + case 293 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 240 /* SyntaxKind.VariableStatement */: + case 274 /* SyntaxKind.ExportAssignment */: + case 250 /* SyntaxKind.ReturnStatement */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 286 /* SyntaxKind.JsxOpeningFragment */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 291 /* SyntaxKind.JsxExpression */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 166 /* SyntaxKind.Parameter */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 276 /* SyntaxKind.NamedExports */: + case 272 /* SyntaxKind.NamedImports */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: - if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 205 /* SyntaxKind.ObjectLiteralExpression */) { // TODO: GH#18217 + case 257 /* SyntaxKind.VariableDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: + if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // TODO: GH#18217 return rangeIsOnOneLine(sourceFile, child); } - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ && sourceFile && child && childKind === 278 /* SyntaxKind.JsxElement */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ && sourceFile && child && childKind === 281 /* SyntaxKind.JsxElement */) { var parentStartLine = sourceFile.getLineAndCharacterOfPosition(ts.skipTrivia(sourceFile.text, parent.pos)).line; var childStartLine = sourceFile.getLineAndCharacterOfPosition(ts.skipTrivia(sourceFile.text, child.pos)).line; return parentStartLine !== childStartLine; } - if (parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { return true; } break; - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return childKind !== 235 /* SyntaxKind.Block */; - case 214 /* SyntaxKind.ArrowFunction */: - if (sourceFile && childKind === 212 /* SyntaxKind.ParenthesizedExpression */) { + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return childKind !== 238 /* SyntaxKind.Block */; + case 216 /* SyntaxKind.ArrowFunction */: + if (sourceFile && childKind === 214 /* SyntaxKind.ParenthesizedExpression */) { return rangeIsOnOneLine(sourceFile, child); } - return childKind !== 235 /* SyntaxKind.Block */; - case 272 /* SyntaxKind.ExportDeclaration */: - return childKind !== 273 /* SyntaxKind.NamedExports */; - case 266 /* SyntaxKind.ImportDeclaration */: - return childKind !== 267 /* SyntaxKind.ImportClause */ || - (!!child.namedBindings && child.namedBindings.kind !== 269 /* SyntaxKind.NamedImports */); - case 278 /* SyntaxKind.JsxElement */: - return childKind !== 281 /* SyntaxKind.JsxClosingElement */; - case 282 /* SyntaxKind.JsxFragment */: - return childKind !== 284 /* SyntaxKind.JsxClosingFragment */; - case 188 /* SyntaxKind.IntersectionType */: - case 187 /* SyntaxKind.UnionType */: - if (childKind === 182 /* SyntaxKind.TypeLiteral */ || childKind === 184 /* SyntaxKind.TupleType */) { + return childKind !== 238 /* SyntaxKind.Block */; + case 275 /* SyntaxKind.ExportDeclaration */: + return childKind !== 276 /* SyntaxKind.NamedExports */; + case 269 /* SyntaxKind.ImportDeclaration */: + return childKind !== 270 /* SyntaxKind.ImportClause */ || + (!!child.namedBindings && child.namedBindings.kind !== 272 /* SyntaxKind.NamedImports */); + case 281 /* SyntaxKind.JsxElement */: + return childKind !== 284 /* SyntaxKind.JsxClosingElement */; + case 285 /* SyntaxKind.JsxFragment */: + return childKind !== 287 /* SyntaxKind.JsxClosingFragment */; + case 190 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + if (childKind === 184 /* SyntaxKind.TypeLiteral */ || childKind === 186 /* SyntaxKind.TupleType */) { return false; } break; @@ -151098,11 +152141,11 @@ var ts; SmartIndenter.nodeWillIndentChild = nodeWillIndentChild; function isControlFlowEndingStatement(kind, parent) { switch (kind) { - case 247 /* SyntaxKind.ReturnStatement */: - case 251 /* SyntaxKind.ThrowStatement */: - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: - return parent.kind !== 235 /* SyntaxKind.Block */; + case 250 /* SyntaxKind.ReturnStatement */: + case 254 /* SyntaxKind.ThrowStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + return parent.kind !== 238 /* SyntaxKind.Block */; default: return false; } @@ -151319,7 +152362,7 @@ var ts; * Checks if 'candidate' argument is a legal separator in the list that contains 'node' as an element */ function isSeparator(node, candidate) { - return !!candidate && !!node.parent && (candidate.kind === 27 /* SyntaxKind.CommaToken */ || (candidate.kind === 26 /* SyntaxKind.SemicolonToken */ && node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */)); + return !!candidate && !!node.parent && (candidate.kind === 27 /* SyntaxKind.CommaToken */ || (candidate.kind === 26 /* SyntaxKind.SemicolonToken */ && node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */)); } function isThisTypeAnnotatable(containingFunction) { return ts.isFunctionExpression(containingFunction) || ts.isFunctionDeclaration(containingFunction); @@ -151551,7 +152594,7 @@ var ts; } } else { - endNode = (_a = (node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? node.exclamationToken : node.questionToken)) !== null && _a !== void 0 ? _a : node.name; + endNode = (_a = (node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? node.exclamationToken : node.questionToken)) !== null && _a !== void 0 ? _a : node.name; } this.insertNodeAt(sourceFile, endNode.end, type, { prefix: ": " }); return true; @@ -151717,18 +152760,18 @@ var ts; }; ChangeTracker.prototype.getInsertNodeAfterOptionsWorker = function (node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return { prefix: this.newLineCharacter, suffix: this.newLineCharacter }; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: case 10 /* SyntaxKind.StringLiteral */: case 79 /* SyntaxKind.Identifier */: return { prefix: ", " }; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return { suffix: "," + this.newLineCharacter }; case 93 /* SyntaxKind.ExportKeyword */: return { prefix: " " }; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return {}; default: ts.Debug.assert(ts.isStatement(node) || ts.isClassOrTypeElement(node)); // Else we haven't handled this kind of node yet -- add it @@ -151737,7 +152780,7 @@ var ts; }; ChangeTracker.prototype.insertName = function (sourceFile, node, name) { ts.Debug.assert(!node.name); - if (node.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind === 216 /* SyntaxKind.ArrowFunction */) { var arrow = ts.findChildOfKind(node, 38 /* SyntaxKind.EqualsGreaterThanToken */, sourceFile); var lparen = ts.findChildOfKind(node, 20 /* SyntaxKind.OpenParenToken */, sourceFile); if (lparen) { @@ -151751,14 +152794,14 @@ var ts; // Replacing full range of arrow to get rid of the leading space -- replace ` =>` with `)` this.replaceRange(sourceFile, arrow, ts.factory.createToken(21 /* SyntaxKind.CloseParenToken */)); } - if (node.body.kind !== 235 /* SyntaxKind.Block */) { + if (node.body.kind !== 238 /* SyntaxKind.Block */) { // `() => 0` => `function f() { return 0; }` this.insertNodesAt(sourceFile, node.body.getStart(sourceFile), [ts.factory.createToken(18 /* SyntaxKind.OpenBraceToken */), ts.factory.createToken(105 /* SyntaxKind.ReturnKeyword */)], { joiner: " ", suffix: " " }); this.insertNodesAt(sourceFile, node.body.end, [ts.factory.createToken(26 /* SyntaxKind.SemicolonToken */), ts.factory.createToken(19 /* SyntaxKind.CloseBraceToken */)], { joiner: " " }); } } else { - var pos = ts.findChildOfKind(node, node.kind === 213 /* SyntaxKind.FunctionExpression */ ? 98 /* SyntaxKind.FunctionKeyword */ : 84 /* SyntaxKind.ClassKeyword */, sourceFile).end; + var pos = ts.findChildOfKind(node, node.kind === 215 /* SyntaxKind.FunctionExpression */ ? 98 /* SyntaxKind.FunctionKeyword */ : 84 /* SyntaxKind.ClassKeyword */, sourceFile).end; this.insertNodeAt(sourceFile, pos, ts.factory.createIdentifier(name), { prefix: " " }); } }; @@ -151935,10 +152978,10 @@ var ts; }()); textChanges_3.ChangeTracker = ChangeTracker; function updateJSDocHost(parent) { - if (parent.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (parent.kind !== 216 /* SyntaxKind.ArrowFunction */) { return parent; } - var jsDocNode = parent.parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ ? + var jsDocNode = parent.parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ ? parent.parent : parent.parent.parent; jsDocNode.jsDoc = parent.jsDoc; @@ -151950,16 +152993,16 @@ var ts; return undefined; } switch (oldTag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: { + case 343 /* SyntaxKind.JSDocParameterTag */: { var oldParam = oldTag; var newParam = newTag; return ts.isIdentifier(oldParam.name) && ts.isIdentifier(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText ? ts.factory.createJSDocParameterTag(/*tagName*/ undefined, newParam.name, /*isBracketed*/ false, newParam.typeExpression, newParam.isNameFirst, oldParam.comment) : undefined; } - case 341 /* SyntaxKind.JSDocReturnTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: return ts.factory.createJSDocReturnTag(/*tagName*/ undefined, newTag.typeExpression, oldTag.comment); - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return ts.factory.createJSDocTypeTag(/*tagName*/ undefined, newTag.typeExpression, oldTag.comment); } } @@ -152353,14 +153396,14 @@ var ts; } textChanges_3.isValidLocationToAddComment = isValidLocationToAddComment; function needSemicolonBetween(a, b) { - return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ || ts.isStatementButNotDeclaration(a) && ts.isStatementButNotDeclaration(b); // TODO: only if b would start with a `(` or `[` } var deleteDeclaration; (function (deleteDeclaration_1) { function deleteDeclaration(changes, deletedNodesInLists, sourceFile, node) { switch (node.kind) { - case 164 /* SyntaxKind.Parameter */: { + case 166 /* SyntaxKind.Parameter */: { var oldFunction = node.parent; if (ts.isArrowFunction(oldFunction) && oldFunction.parameters.length === 1 && @@ -152375,17 +153418,17 @@ var ts; } break; } - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: var isFirstImport = sourceFile.imports.length && node === ts.first(sourceFile.imports).parent || node === ts.find(sourceFile.statements, ts.isAnyImportSyntax); // For first import, leave header comment in place, otherwise only delete JSDoc comments deleteNode(changes, sourceFile, node, { leadingTriviaOption: isFirstImport ? LeadingTriviaOption.Exclude : ts.hasJSDocNodes(node) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine, }); break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: var pattern = node.parent; - var preserveComma = pattern.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && node !== ts.last(pattern.elements); + var preserveComma = pattern.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && node !== ts.last(pattern.elements); if (preserveComma) { deleteNode(changes, sourceFile, node); } @@ -152393,13 +153436,13 @@ var ts; deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node); break; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: var namedImports = node.parent; if (namedImports.elements.length === 1) { deleteImportBinding(changes, sourceFile, namedImports); @@ -152408,7 +153451,7 @@ var ts; deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: deleteImportBinding(changes, sourceFile, node); break; case 26 /* SyntaxKind.SemicolonToken */: @@ -152417,8 +153460,8 @@ var ts; case 98 /* SyntaxKind.FunctionKeyword */: deleteNode(changes, sourceFile, node, { leadingTriviaOption: LeadingTriviaOption.Exclude }); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: deleteNode(changes, sourceFile, node, { leadingTriviaOption: ts.hasJSDocNodes(node) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine }); break; default: @@ -152469,13 +153512,13 @@ var ts; // Delete the entire import declaration // |import * as ns from './file'| // |import { a } from './file'| - var importDecl = ts.getAncestor(node, 266 /* SyntaxKind.ImportDeclaration */); + var importDecl = ts.getAncestor(node, 269 /* SyntaxKind.ImportDeclaration */); deleteNode(changes, sourceFile, importDecl); } } function deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node) { var parent = node.parent; - if (parent.kind === 292 /* SyntaxKind.CatchClause */) { + if (parent.kind === 295 /* SyntaxKind.CatchClause */) { // TODO: There's currently no unused diagnostic for this, could be a suggestion changes.deleteNodeRange(sourceFile, ts.findChildOfKind(parent, 20 /* SyntaxKind.OpenParenToken */, sourceFile), ts.findChildOfKind(parent, 21 /* SyntaxKind.CloseParenToken */, sourceFile)); return; @@ -152486,14 +153529,14 @@ var ts; } var gp = parent.parent; switch (gp.kind) { - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: changes.replaceNode(sourceFile, node, ts.factory.createObjectLiteralExpression()); break; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: deleteNode(changes, sourceFile, parent); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: deleteNode(changes, sourceFile, gp, { leadingTriviaOption: ts.hasJSDocNodes(gp) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine }); break; default: @@ -152680,8 +153723,8 @@ var ts; }); function makeChange(changeTracker, sourceFile, assertion) { var replacement = ts.isAsExpression(assertion) - ? ts.factory.createAsExpression(assertion.expression, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)) - : ts.factory.createTypeAssertion(ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */), assertion.expression); + ? ts.factory.createAsExpression(assertion.expression, ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)) + : ts.factory.createTypeAssertion(ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */), assertion.expression); changeTracker.replaceNode(sourceFile, assertion.expression, replacement); } function getAssertion(sourceFile, pos) { @@ -152765,7 +153808,7 @@ var ts; } } fixedDeclarations === null || fixedDeclarations === void 0 ? void 0 : fixedDeclarations.add(ts.getNodeId(insertionSite)); - var cloneWithModifier = ts.factory.updateModifiers(ts.getSynthesizedDeepClone(insertionSite, /*includeTrivia*/ true), ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(ts.getSyntacticModifierFlags(insertionSite) | 256 /* ModifierFlags.Async */))); + var cloneWithModifier = ts.factory.updateModifiers(ts.getSynthesizedDeepClone(insertionSite, /*includeTrivia*/ true), ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(ts.getSyntacticModifierFlags(insertionSite) | 512 /* ModifierFlags.Async */))); changeTracker.replaceNode(sourceFile, insertionSite, cloneWithModifier); } function getFixableErrorSpanDeclaration(sourceFile, span) { @@ -152811,7 +153854,7 @@ var ts; ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type.code, ts.Diagnostics.Operator_0_cannot_be_applied_to_type_1.code, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2.code, - ts.Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap.code, + ts.Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap.code, ts.Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined.code, ts.Diagnostics.Type_0_is_not_an_array_type.code, ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type.code, @@ -152909,7 +153952,7 @@ var ts; } var declaration = ts.tryCast(symbol.valueDeclaration, ts.isVariableDeclaration); var variableName = declaration && ts.tryCast(declaration.name, ts.isIdentifier); - var variableStatement = ts.getAncestor(declaration, 237 /* SyntaxKind.VariableStatement */); + var variableStatement = ts.getAncestor(declaration, 240 /* SyntaxKind.VariableStatement */); if (!declaration || !variableStatement || declaration.type || !declaration.initializer || @@ -152987,10 +154030,10 @@ var ts; function isInsideAwaitableBody(node) { return node.kind & 32768 /* NodeFlags.AwaitContext */ || !!ts.findAncestor(node, function (ancestor) { return ancestor.parent && ts.isArrowFunction(ancestor.parent) && ancestor.parent.body === ancestor || - ts.isBlock(ancestor) && (ancestor.parent.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - ancestor.parent.kind === 213 /* SyntaxKind.FunctionExpression */ || - ancestor.parent.kind === 214 /* SyntaxKind.ArrowFunction */ || - ancestor.parent.kind === 169 /* SyntaxKind.MethodDeclaration */); + ts.isBlock(ancestor) && (ancestor.parent.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + ancestor.parent.kind === 215 /* SyntaxKind.FunctionExpression */ || + ancestor.parent.kind === 216 /* SyntaxKind.ArrowFunction */ || + ancestor.parent.kind === 171 /* SyntaxKind.MethodDeclaration */); }); } function makeChange(changeTracker, errorCode, sourceFile, checker, insertionSite, fixedDeclarations) { @@ -153109,10 +154152,10 @@ var ts; function isPossiblyPartOfDestructuring(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return true; default: return false; @@ -153127,7 +154170,7 @@ var ts; function isPossiblyPartOfCommaSeperatedInitializer(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: case 27 /* SyntaxKind.CommaToken */: return true; default: @@ -153176,9 +154219,9 @@ var ts; return; } var declaration = token.parent; - if (declaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + if (declaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ && (!fixedNodes || ts.tryAddToSet(fixedNodes, declaration))) { - changeTracker.insertModifierBefore(sourceFile, 135 /* SyntaxKind.DeclareKeyword */, declaration); + changeTracker.insertModifierBefore(sourceFile, 136 /* SyntaxKind.DeclareKeyword */, declaration); } } })(codefix = ts.codefix || (ts.codefix = {})); @@ -153332,7 +154375,7 @@ var ts; var add = toAdd_1[_i]; var d = add.valueDeclaration; if (d && (ts.isPropertySignature(d) || ts.isPropertyDeclaration(d)) && d.type) { - var t = ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], d.type.kind === 187 /* SyntaxKind.UnionType */ ? d.type.types : [d.type], true), [ + var t = ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], d.type.kind === 189 /* SyntaxKind.UnionType */ ? d.type.types : [d.type], true), [ ts.factory.createTypeReferenceNode("undefined") ], false)); changes.replaceNode(d.getSourceFile(), d.type, t); @@ -153412,26 +154455,26 @@ var ts; } function isDeclarationWithType(node) { return ts.isFunctionLikeDeclaration(node) || - node.kind === 254 /* SyntaxKind.VariableDeclaration */ || - node.kind === 166 /* SyntaxKind.PropertySignature */ || - node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + node.kind === 257 /* SyntaxKind.VariableDeclaration */ || + node.kind === 168 /* SyntaxKind.PropertySignature */ || + node.kind === 169 /* SyntaxKind.PropertyDeclaration */; } function transformJSDocType(node) { switch (node.kind) { - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return ts.factory.createTypeReferenceNode("any", ts.emptyArray); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return transformJSDocOptionalType(node); - case 315 /* SyntaxKind.JSDocNonNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: return transformJSDocType(node.type); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return transformJSDocNullableType(node); - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return transformJSDocVariadicType(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return transformJSDocFunctionType(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return transformJSDocTypeReference(node); default: var visited = ts.visitEachChild(node, transformJSDocType, ts.nullTransformationContext); @@ -153452,11 +154495,11 @@ var ts; var _a; // TODO: This does not properly handle `function(new:C, string)` per https://github.com/google/closure-compiler/wiki/Types-in-the-Closure-Type-System#the-javascript-type-language // however we do handle it correctly in `serializeTypeForDeclaration` in checker.ts - return ts.factory.createFunctionTypeNode(ts.emptyArray, node.parameters.map(transformJSDocParameter), (_a = node.type) !== null && _a !== void 0 ? _a : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + return ts.factory.createFunctionTypeNode(ts.emptyArray, node.parameters.map(transformJSDocParameter), (_a = node.type) !== null && _a !== void 0 ? _a : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } function transformJSDocParameter(node) { var index = node.parent.parameters.indexOf(node); - var isRest = node.type.kind === 318 /* SyntaxKind.JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217 + var isRest = node.type.kind === 321 /* SyntaxKind.JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217 var name = node.name || (isRest ? "rest" : "arg" + index); var dotdotdot = isRest ? ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */) : node.dotDotDotToken; return ts.factory.createParameterDeclaration(node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer); @@ -153495,8 +154538,8 @@ var ts; function transformJSDocIndexSignature(node) { var index = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, - /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */ ? "n" : "s", - /*questionToken*/ undefined, ts.factory.createTypeReferenceNode(node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */ ? "number" : "string", []), + /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */ ? "n" : "s", + /*questionToken*/ undefined, ts.factory.createTypeReferenceNode(node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */ ? "number" : "string", []), /*initializer*/ undefined); var indexSignature = ts.factory.createTypeLiteralNode([ts.factory.createIndexSignature(/*modifiers*/ undefined, [index], node.typeArguments[1])]); ts.setEmitFlags(indexSignature, 1 /* EmitFlags.SingleLine */); @@ -153531,8 +154574,8 @@ var ts; return undefined; } var ctorDeclaration = ctorSymbol.valueDeclaration; - if (ts.isFunctionDeclaration(ctorDeclaration)) { - changes.replaceNode(sourceFile, ctorDeclaration, createClassFromFunctionDeclaration(ctorDeclaration)); + if (ts.isFunctionDeclaration(ctorDeclaration) || ts.isFunctionExpression(ctorDeclaration)) { + changes.replaceNode(sourceFile, ctorDeclaration, createClassFromFunction(ctorDeclaration)); } else if (ts.isVariableDeclaration(ctorDeclaration)) { var classDeclaration = createClassFromVariableDeclaration(ctorDeclaration); @@ -153636,7 +154679,7 @@ var ts; return; } // delete the entire statement if this expression is the sole expression to take care of the semicolon at the end - var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ + var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ ? assignmentBinaryExpression.parent : assignmentBinaryExpression; changes.delete(sourceFile, nodeToDelete); if (!assignmentExpr) { @@ -153688,7 +154731,7 @@ var ts; return createArrowFunctionExpressionMember(members, expression, name); } function createFunctionExpressionMember(members, functionExpression, name) { - var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 131 /* SyntaxKind.AsyncKeyword */)); + var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 132 /* SyntaxKind.AsyncKeyword */)); var method = ts.factory.createMethodDeclaration(fullModifiers, /*asteriskToken*/ undefined, name, /*questionToken*/ undefined, /*typeParameters*/ undefined, functionExpression.parameters, /*type*/ undefined, functionExpression.body); ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile); @@ -153699,14 +154742,14 @@ var ts; var arrowFunctionBody = arrowFunction.body; var bodyBlock; // case 1: () => { return [1,2,3] } - if (arrowFunctionBody.kind === 235 /* SyntaxKind.Block */) { + if (arrowFunctionBody.kind === 238 /* SyntaxKind.Block */) { bodyBlock = arrowFunctionBody; } // case 2: () => [1,2,3] else { bodyBlock = ts.factory.createBlock([ts.factory.createReturnStatement(arrowFunctionBody)]); } - var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 131 /* SyntaxKind.AsyncKeyword */)); + var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 132 /* SyntaxKind.AsyncKeyword */)); var method = ts.factory.createMethodDeclaration(fullModifiers, /*asteriskToken*/ undefined, name, /*questionToken*/ undefined, /*typeParameters*/ undefined, arrowFunction.parameters, /*type*/ undefined, bodyBlock); ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile); @@ -153729,7 +154772,7 @@ var ts; // Don't call copyComments here because we'll already leave them in place return cls; } - function createClassFromFunctionDeclaration(node) { + function createClassFromFunction(node) { var memberElements = createClassElementsFromSymbol(ctorSymbol); if (node.body) { memberElements.unshift(ts.factory.createConstructorDeclaration(/*modifiers*/ undefined, node.parameters, node.body)); @@ -153819,7 +154862,7 @@ var ts; return; } var pos = ts.skipTrivia(sourceFile.text, ts.moveRangePastModifiers(functionToConvert).pos); - changes.insertModifierAt(sourceFile, pos, 131 /* SyntaxKind.AsyncKeyword */, { suffix: " " }); + changes.insertModifierAt(sourceFile, pos, 132 /* SyntaxKind.AsyncKeyword */, { suffix: " " }); var _loop_12 = function (returnStatement) { ts.forEachChild(returnStatement, function visit(node) { if (ts.isCallExpression(node)) { @@ -154225,7 +155268,7 @@ var ts; case 104 /* SyntaxKind.NullKeyword */: // do not produce a transformed statement for a null argument break; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: case 79 /* SyntaxKind.Identifier */: // identifier includes undefined if (!inputArgName) { // undefined was argument passed to promise handler @@ -154247,8 +155290,8 @@ var ts; continuationArgName.types.push(transformer.checker.getAwaitedType(returnType) || returnType); } return varDeclOrAssignment; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: { + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: { var funcBody = func.body; var returnType_1 = (_a = getLastCallSignature(transformer.checker.getTypeAtLocation(func), transformer.checker)) === null || _a === void 0 ? void 0 : _a.getReturnType(); // Arrow functions with block bodies { } will enter this control flow @@ -154417,7 +155460,7 @@ var ts; name = getMapEntryOrDefault(funcNode.name); } // return undefined argName when arg is null or undefined - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (!name || "identifier" in name && name.identifier.text === "undefined") { return undefined; } @@ -154526,10 +155569,10 @@ var ts; } var importNode = ts.importFromModuleSpecifier(moduleSpecifier); switch (importNode.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: changes.replaceNode(importingFile, importNode, ts.makeImport(importNode.name, /*namedImports*/ undefined, moduleSpecifier, quotePreference)); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isRequireCall(importNode, /*checkArgumentIsStringLiteralLike*/ false)) { changes.replaceNode(importingFile, importNode, ts.factory.createPropertyAccessExpression(ts.getSynthesizedDeepClone(importNode), "default")); } @@ -154596,20 +155639,20 @@ var ts; } function convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports, useSitesToUnqualify, quotePreference) { switch (statement.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target, quotePreference); return false; - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; switch (expression.kind) { - case 208 /* SyntaxKind.CallExpression */: { + case 210 /* SyntaxKind.CallExpression */: { if (ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true)) { // For side-effecting require() call, just make a side-effecting import. changes.replaceNode(sourceFile, statement, ts.makeImport(/*name*/ undefined, /*namedImports*/ undefined, expression.arguments[0], quotePreference)); } return false; } - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var operatorToken = expression.operatorToken; return operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && convertAssignment(sourceFile, checker, expression, changes, exports, useSitesToUnqualify); } @@ -154658,8 +155701,8 @@ var ts; /** Converts `const name = require("moduleSpecifier").propertyName` */ function convertPropertyAccessImport(name, propertyName, moduleSpecifier, identifiers, quotePreference) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: { // `const [a, b] = require("c").d` --> `import { d } from "c"; const [a, b] = d;` var tmp = makeUniqueName(propertyName, identifiers); return convertedImports([ @@ -154710,16 +155753,16 @@ var ts; function tryChangeModuleExportsObject(object, useSitesToUnqualify) { var statements = ts.mapAllOrFail(object.properties, function (prop) { switch (prop.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // TODO: Maybe we should handle this? See fourslash test `refactorConvertToEs6Module_export_object_shorthand.ts`. // falls through - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return undefined; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return !ts.isIdentifier(prop.name) ? undefined : convertExportsDotXEquals_replaceNode(prop.name.text, prop.initializer, useSitesToUnqualify); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return !ts.isIdentifier(prop.name) ? undefined : functionExpressionToDeclaration(prop.name.text, [ts.factory.createToken(93 /* SyntaxKind.ExportKeyword */)], prop, useSitesToUnqualify); default: ts.Debug.assertNever(prop, "Convert to ES6 got invalid prop kind ".concat(prop.kind)); @@ -154783,7 +155826,7 @@ var ts; function convertExportsDotXEquals_replaceNode(name, exported, useSitesToUnqualify) { var modifiers = [ts.factory.createToken(93 /* SyntaxKind.ExportKeyword */)]; switch (exported.kind) { - case 213 /* SyntaxKind.FunctionExpression */: { + case 215 /* SyntaxKind.FunctionExpression */: { var expressionName = exported.name; if (expressionName && expressionName.text !== name) { // `exports.f = function g() {}` -> `export const f = function g() {}` @@ -154791,10 +155834,10 @@ var ts; } } // falls through - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // `exports.f = function() {}` --> `export function f() {}` return functionExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: // `exports.C = class {}` --> `export class C {}` return classExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify); default: @@ -154814,7 +155857,7 @@ var ts; : ts.getSynthesizedDeepCloneWithReplacements(nodeOrNodes, /*includeTrivia*/ true, replaceNode); function replaceNode(original) { // We are replacing `mod.SomeExport` wih `SomeExport`, so we only need to look at PropertyAccessExpressions - if (original.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (original.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var replacement = useSitesToUnqualify.get(original); // Remove entry from `useSitesToUnqualify` so the refactor knows it's taken care of by the parent statement we're replacing useSitesToUnqualify.delete(original); @@ -154829,7 +155872,7 @@ var ts; */ function convertSingleImport(name, moduleSpecifier, checker, identifiers, target, quotePreference) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: { var importSpecifiers = ts.mapAllOrFail(name.elements, function (e) { return e.dotDotDotToken || e.initializer || e.propertyName && !ts.isIdentifier(e.propertyName) || !ts.isIdentifier(e.name) ? undefined @@ -154840,7 +155883,7 @@ var ts; } } // falls through -- object destructuring has an interesting pattern and must be a variable declaration - case 202 /* SyntaxKind.ArrayBindingPattern */: { + case 204 /* SyntaxKind.ArrayBindingPattern */: { /* import x from "x"; const [a, b, c] = x; @@ -154933,11 +155976,11 @@ var ts; function isFreeIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return parent.name !== node; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return parent.propertyName !== node; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return parent.propertyName !== node; default: return true; @@ -155048,7 +156091,7 @@ var ts; var exportDeclaration = exportClause.parent; var typeExportSpecifiers = getTypeExportSpecifiers(exportSpecifier, context); if (typeExportSpecifiers.length === exportClause.elements.length) { - changes.insertModifierBefore(context.sourceFile, 152 /* SyntaxKind.TypeKeyword */, exportClause); + changes.insertModifierBefore(context.sourceFile, 154 /* SyntaxKind.TypeKeyword */, exportClause); } else { var valueExportDeclaration = ts.factory.updateExportDeclaration(exportDeclaration, exportDeclaration.modifiers, @@ -155284,27 +156327,29 @@ var ts; errorCodes: errorCodes, getCodeActions: function (context) { var errorCode = context.errorCode, preferences = context.preferences, sourceFile = context.sourceFile, span = context.span, program = context.program; - var info = getFixesInfo(context, errorCode, span.start, /*useAutoImportProvider*/ true); + var info = getFixInfos(context, errorCode, span.start, /*useAutoImportProvider*/ true); if (!info) return undefined; - var fixes = info.fixes, symbolName = info.symbolName, errorIdentifierText = info.errorIdentifierText; var quotePreference = ts.getQuotePreference(sourceFile, preferences); - return fixes.map(function (fix) { return codeActionForFix(context, sourceFile, symbolName, fix, - /*includeSymbolNameInDescription*/ symbolName !== errorIdentifierText, quotePreference, program.getCompilerOptions()); }); + return info.map(function (_a) { + var fix = _a.fix, symbolName = _a.symbolName, errorIdentifierText = _a.errorIdentifierText; + return codeActionForFix(context, sourceFile, symbolName, fix, + /*includeSymbolNameInDescription*/ symbolName !== errorIdentifierText, quotePreference, program.getCompilerOptions()); + }); }, fixIds: [importFixId], getAllCodeActions: function (context) { - var sourceFile = context.sourceFile, program = context.program, preferences = context.preferences, host = context.host; - var importAdder = createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ true, preferences, host); + var sourceFile = context.sourceFile, program = context.program, preferences = context.preferences, host = context.host, cancellationToken = context.cancellationToken; + var importAdder = createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ true, preferences, host, cancellationToken); codefix.eachDiagnostic(context, errorCodes, function (diag) { return importAdder.addImportFromDiagnostic(diag, context); }); return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, importAdder.writeFixes)); }, }); - function createImportAdder(sourceFile, program, preferences, host) { - return createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ false, preferences, host); + function createImportAdder(sourceFile, program, preferences, host, cancellationToken) { + return createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ false, preferences, host, cancellationToken); } codefix.createImportAdder = createImportAdder; - function createImportAdderWorker(sourceFile, program, useAutoImportProvider, preferences, host) { + function createImportAdderWorker(sourceFile, program, useAutoImportProvider, preferences, host, cancellationToken) { var compilerOptions = program.getCompilerOptions(); // Namespace fixes don't conflict, so just build a list. var addToNamespace = []; @@ -155315,27 +156360,26 @@ var ts; var newImports = new ts.Map(); return { addImportFromDiagnostic: addImportFromDiagnostic, addImportFromExportedSymbol: addImportFromExportedSymbol, writeFixes: writeFixes, hasFixes: hasFixes }; function addImportFromDiagnostic(diagnostic, context) { - var info = getFixesInfo(context, diagnostic.code, diagnostic.start, useAutoImportProvider); - if (!info || !info.fixes.length) + var info = getFixInfos(context, diagnostic.code, diagnostic.start, useAutoImportProvider); + if (!info || !info.length) return; - addImport(info); + addImport(ts.first(info)); } function addImportFromExportedSymbol(exportedSymbol, isValidTypeOnlyUseSite) { var moduleSymbol = ts.Debug.checkDefined(exportedSymbol.parent); var symbolName = ts.getNameForExportedSymbol(exportedSymbol, ts.getEmitScriptTarget(compilerOptions)); var checker = program.getTypeChecker(); var symbol = checker.getMergedSymbol(ts.skipAlias(exportedSymbol, checker)); - var exportInfo = getAllReExportingModules(sourceFile, symbol, moduleSymbol, symbolName, /*isJsxTagName*/ false, host, program, preferences, useAutoImportProvider); + var exportInfo = getAllExportInfoForSymbol(sourceFile, symbol, symbolName, /*isJsxTagName*/ false, program, host, preferences, cancellationToken); var useRequire = shouldUseRequire(sourceFile, program); - var fix = getImportFixForSymbol(sourceFile, exportInfo, moduleSymbol, program, /*useNamespaceInfo*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences); + var fix = getImportFixForSymbol(sourceFile, ts.Debug.checkDefined(exportInfo), moduleSymbol, program, /*useNamespaceInfo*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences); if (fix) { - addImport({ fixes: [fix], symbolName: symbolName, errorIdentifierText: undefined }); + addImport({ fix: fix, symbolName: symbolName, errorIdentifierText: undefined }); } } function addImport(info) { var _a, _b; - var fixes = info.fixes, symbolName = info.symbolName; - var fix = ts.first(fixes); + var fix = info.fix, symbolName = info.symbolName; switch (fix.kind) { case 0 /* ImportFixKind.UseNamespace */: addToNamespace.push(fix); @@ -155502,11 +156546,12 @@ var ts; AddAsTypeOnly[AddAsTypeOnly["Required"] = 2] = "Required"; AddAsTypeOnly[AddAsTypeOnly["NotAllowed"] = 4] = "NotAllowed"; })(AddAsTypeOnly || (AddAsTypeOnly = {})); - function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, isJsxTagName, host, program, formatContext, position, preferences) { + function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) { var compilerOptions = program.getCompilerOptions(); var exportInfos = ts.pathIsBareSpecifier(ts.stripQuotes(moduleSymbol.name)) - ? [getSymbolExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)] - : getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, isJsxTagName, host, program, preferences, /*useAutoImportProvider*/ true); + ? [getSingleExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)] + : getAllExportInfoForSymbol(sourceFile, targetSymbol, symbolName, isJsxTagName, program, host, preferences, cancellationToken); + ts.Debug.assertIsDefined(exportInfos); var useRequire = shouldUseRequire(sourceFile, program); var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(ts.getTokenAtPosition(sourceFile, position)); var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, { symbolName: symbolName, position: position }, isValidTypeOnlyUseSite, useRequire, host, preferences)); @@ -155519,7 +156564,7 @@ var ts; codefix.getImportCompletionAction = getImportCompletionAction; function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, host, formatContext, preferences) { var compilerOptions = program.getCompilerOptions(); - var symbolName = getSymbolName(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions); + var symbolName = ts.single(getSymbolNamesToImport(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions)); var fix = getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program); var includeSymbolNameInDescription = symbolName !== symbolToken.text; return fix && codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix, includeSymbolNameInDescription, 1 /* QuotePreference.Double */, compilerOptions)); @@ -155534,7 +156579,16 @@ var ts; var description = _a.description, changes = _a.changes, commands = _a.commands; return { description: description, changes: changes, commands: commands }; } - function getSymbolExportInfoForSymbol(symbol, moduleSymbol, program, host) { + function getAllExportInfoForSymbol(importingFile, symbol, symbolName, preferCapitalized, program, host, preferences, cancellationToken) { + var getChecker = createGetChecker(program, host); + return ts.getExportInfoMap(importingFile, host, program, preferences, cancellationToken) + .search(importingFile.path, preferCapitalized, function (name) { return name === symbolName; }, function (info) { + if (ts.skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol) { + return info; + } + }); + } + function getSingleExportInfoForSymbol(symbol, moduleSymbol, program, host) { var _a, _b; var compilerOptions = program.getCompilerOptions(); var mainProgramInfo = getInfoWithChecker(program.getTypeChecker(), /*isFromPackageJson*/ false); @@ -155554,35 +156608,6 @@ var ts; } } } - function getAllReExportingModules(importingFile, targetSymbol, exportingModuleSymbol, symbolName, isJsxTagName, host, program, preferences, useAutoImportProvider) { - var result = []; - var compilerOptions = program.getCompilerOptions(); - var getModuleSpecifierResolutionHost = ts.memoizeOne(function (isFromPackageJson) { - return ts.createModuleSpecifierResolutionHost(isFromPackageJson ? host.getPackageJsonAutoImportProvider() : program, host); - }); - ts.forEachExternalModuleToImportFrom(program, host, preferences, useAutoImportProvider, function (moduleSymbol, moduleFile, program, isFromPackageJson) { - var checker = program.getTypeChecker(); - // Don't import from a re-export when looking "up" like to `./index` or `../index`. - if (moduleFile && moduleSymbol !== exportingModuleSymbol && ts.startsWith(importingFile.fileName, ts.getDirectoryPath(moduleFile.fileName))) { - return; - } - var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions); - if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions), isJsxTagName) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) { - result.push({ symbol: defaultInfo.symbol, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: defaultInfo.exportKind, targetFlags: ts.skipAlias(defaultInfo.symbol, checker).flags, isFromPackageJson: isFromPackageJson }); - } - for (var _i = 0, _a = checker.getExportsAndPropertiesOfModule(moduleSymbol); _i < _a.length; _i++) { - var exported = _a[_i]; - if (exported.name === symbolName && checker.getMergedSymbol(ts.skipAlias(exported, checker)) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) { - result.push({ symbol: exported, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: 0 /* ExportKind.Named */, targetFlags: ts.skipAlias(exported, checker).flags, isFromPackageJson: isFromPackageJson }); - } - } - }); - return result; - function isImportable(program, moduleFile, isFromPackageJson) { - var _a; - return !moduleFile || ts.isImportableFile(program, importingFile, moduleFile, preferences, /*packageJsonFilter*/ undefined, getModuleSpecifierResolutionHost(isFromPackageJson), (_a = host.getModuleSpecifierCache) === null || _a === void 0 ? void 0 : _a.call(host)); - } - } function getImportFixes(exportInfos, useNamespaceInfo, /** undefined only for missing JSX namespace */ isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap, fromCacheOnly) { @@ -155633,11 +156658,11 @@ var ts; function getTargetModuleFromNamespaceLikeImport(declaration, checker) { var _a; switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checker.resolveExternalModuleName(declaration.initializer.arguments[0]); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return checker.getAliasedSymbol(declaration.symbol); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var namespaceImport = ts.tryCast((_a = declaration.importClause) === null || _a === void 0 ? void 0 : _a.namedBindings, ts.isNamespaceImport); return namespaceImport && checker.getAliasedSymbol(namespaceImport.symbol); default: @@ -155647,11 +156672,11 @@ var ts; function getNamespaceLikeImportText(declaration) { var _a, _b, _c; switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return (_a = ts.tryCast(declaration.name, ts.isIdentifier)) === null || _a === void 0 ? void 0 : _a.text; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return declaration.name.text; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return (_c = ts.tryCast((_b = declaration.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings, ts.isNamespaceImport)) === null || _c === void 0 ? void 0 : _c.name.text; default: return ts.Debug.assertNever(declaration); @@ -155678,12 +156703,12 @@ var ts; function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker, compilerOptions) { return ts.firstDefined(existingImports, function (_a) { var declaration = _a.declaration, importKind = _a.importKind, symbol = _a.symbol, targetFlags = _a.targetFlags; - if (importKind === 3 /* ImportKind.CommonJS */ || importKind === 2 /* ImportKind.Namespace */ || declaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (importKind === 3 /* ImportKind.CommonJS */ || importKind === 2 /* ImportKind.Namespace */ || declaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { // These kinds of imports are not combinable with anything return undefined; } - if (declaration.kind === 254 /* SyntaxKind.VariableDeclaration */) { - return (importKind === 0 /* ImportKind.Named */ || importKind === 1 /* ImportKind.Default */) && declaration.name.kind === 201 /* SyntaxKind.ObjectBindingPattern */ + if (declaration.kind === 257 /* SyntaxKind.VariableDeclaration */) { + return (importKind === 0 /* ImportKind.Named */ || importKind === 1 /* ImportKind.Default */) && declaration.name.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? { kind: 2 /* ImportFixKind.AddToExisting */, importClauseOrBindingPattern: declaration.name, importKind: importKind, moduleSpecifier: declaration.initializer.arguments[0].text, addAsTypeOnly: 4 /* AddAsTypeOnly.NotAllowed */ } : undefined; } @@ -155704,7 +156729,7 @@ var ts; )) return undefined; if (importKind === 0 /* ImportKind.Named */ && - (namedBindings === null || namedBindings === void 0 ? void 0 : namedBindings.kind) === 268 /* SyntaxKind.NamespaceImport */ // Cannot add a named import to a declaration that has a namespace import + (namedBindings === null || namedBindings === void 0 ? void 0 : namedBindings.kind) === 271 /* SyntaxKind.NamespaceImport */ // Cannot add a named import to a declaration that has a namespace import ) return undefined; return { @@ -155727,7 +156752,7 @@ var ts; (importMap || (importMap = ts.createMultiMap())).add(ts.getSymbolId(moduleSymbol), i.parent); } } - else if (i.kind === 266 /* SyntaxKind.ImportDeclaration */ || i.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + else if (i.kind === 269 /* SyntaxKind.ImportDeclaration */ || i.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { var moduleSymbol = checker.getSymbolAtLocation(moduleSpecifier); if (moduleSymbol) { (importMap || (importMap = ts.createMultiMap())).add(ts.getSymbolId(moduleSymbol), i); @@ -155776,11 +156801,14 @@ var ts; // 5. Literally nothing to go on return true; } + function createGetChecker(program, host) { + return ts.memoizeOne(function (isFromPackageJson) { return isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker(); }); + } function getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfo, host, preferences, fromCacheOnly) { var isJs = ts.isSourceFileJS(sourceFile); var compilerOptions = program.getCompilerOptions(); var moduleSpecifierResolutionHost = ts.createModuleSpecifierResolutionHost(program, host); - var getChecker = ts.memoizeOne(function (isFromPackageJson) { return isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker(); }); + var getChecker = createGetChecker(program, host); var rejectNodeModulesRelativePaths = ts.moduleResolutionUsesNodeModules(ts.getEmitModuleResolutionKind(compilerOptions)); var getModuleSpecifiers = fromCacheOnly ? function (moduleSymbol) { return ({ moduleSpecifiers: ts.moduleSpecifiers.tryGetModuleSpecifiersFromCache(moduleSymbol, sourceFile, moduleSpecifierResolutionHost, preferences), computedWithoutCache: false }); } @@ -155824,7 +156852,7 @@ var ts; return { kind: 3 /* ImportFixKind.AddNew */, moduleSpecifier: moduleSpecifier, importKind: importKind, addAsTypeOnly: addAsTypeOnly, useRequire: useRequire }; } } - function getFixesInfo(context, errorCode, pos, useAutoImportProvider) { + function getFixInfos(context, errorCode, pos, useAutoImportProvider) { var symbolToken = ts.getTokenAtPosition(context.sourceFile, pos); var info; if (errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) { @@ -155834,19 +156862,23 @@ var ts; return undefined; } else if (errorCode === ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code) { - var symbolName_1 = getSymbolName(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions()); + var symbolName_1 = ts.single(getSymbolNamesToImport(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions())); var fix = getTypeOnlyPromotionFix(context.sourceFile, symbolToken, symbolName_1, context.program); - return fix && { fixes: [fix], symbolName: symbolName_1, errorIdentifierText: symbolToken.text }; + return fix && [{ fix: fix, symbolName: symbolName_1, errorIdentifierText: symbolToken.text }]; } else { info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider); } var packageJsonImportFilter = ts.createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host); - return info && __assign(__assign({}, info), { fixes: sortFixes(info.fixes, context.sourceFile, context.program, packageJsonImportFilter, context.host) }); + return info && sortFixInfo(info, context.sourceFile, context.program, packageJsonImportFilter, context.host); } - function sortFixes(fixes, sourceFile, program, packageJsonImportFilter, host) { + function sortFixInfo(fixes, sourceFile, program, packageJsonImportFilter, host) { var _toPath = function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), ts.hostGetCanonicalFileName(host)); }; - return ts.sort(fixes, function (a, b) { return ts.compareValues(a.kind, b.kind) || compareModuleSpecifiers(a, b, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath); }); + return ts.sort(fixes, function (a, b) { + return ts.compareBooleans(!!a.isJsxNamespaceFix, !!b.isJsxNamespaceFix) || + ts.compareValues(a.fix.kind, b.fix.kind) || + compareModuleSpecifiers(a.fix, b.fix, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath); + }); } function getBestFix(fixes, sourceFile, program, packageJsonImportFilter, host) { if (!ts.some(fixes)) @@ -155897,7 +156929,6 @@ var ts; return 0 /* Comparison.EqualTo */; } function getFixesInfoForUMDImport(_a, token) { - var _b; var sourceFile = _a.sourceFile, program = _a.program, host = _a.host, preferences = _a.preferences; var checker = program.getTypeChecker(); var umdSymbol = getUmdSymbol(token, checker); @@ -155909,7 +156940,7 @@ var ts; var useRequire = shouldUseRequire(sourceFile, program); var position = ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined; var fixes = getImportFixes(exportInfo, position ? { position: position, symbolName: symbolName } : undefined, /*isValidTypeOnlyUseSite*/ false, useRequire, program, sourceFile, host, preferences).fixes; - return { fixes: fixes, symbolName: symbolName, errorIdentifierText: (_b = ts.tryCast(token, ts.isIdentifier)) === null || _b === void 0 ? void 0 : _b.text }; + return fixes.map(function (fix) { var _a; return ({ fix: fix, symbolName: symbolName, errorIdentifierText: (_a = ts.tryCast(token, ts.isIdentifier)) === null || _a === void 0 ? void 0 : _a.text }); }); } function getUmdSymbol(token, checker) { // try the identifier to see if it is the umd symbol @@ -155970,19 +157001,20 @@ var ts; var sourceFile = _a.sourceFile, program = _a.program, cancellationToken = _a.cancellationToken, host = _a.host, preferences = _a.preferences; var checker = program.getTypeChecker(); var compilerOptions = program.getCompilerOptions(); - var symbolName = getSymbolName(sourceFile, checker, symbolToken, compilerOptions); - // "default" is a keyword and not a legal identifier for the import, but appears as an identifier. - if (symbolName === "default" /* InternalSymbolName.Default */) { - return undefined; - } - var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken); - var useRequire = shouldUseRequire(sourceFile, program); - var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences); - var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) { - var _ = _a[0], exportInfos = _a[1]; - return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes; - })); - return { fixes: fixes, symbolName: symbolName, errorIdentifierText: symbolToken.text }; + return ts.flatMap(getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions), function (symbolName) { + // "default" is a keyword and not a legal identifier for the import, but appears as an identifier. + if (symbolName === "default" /* InternalSymbolName.Default */) { + return undefined; + } + var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken); + var useRequire = shouldUseRequire(sourceFile, program); + var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences); + var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) { + var _ = _a[0], exportInfos = _a[1]; + return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes; + })); + return fixes.map(function (fix) { return ({ fix: fix, symbolName: symbolName, errorIdentifierText: symbolToken.text, isJsxNamespaceFix: symbolName !== symbolToken.text }); }); + }); } function getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program) { var checker = program.getTypeChecker(); @@ -155994,15 +157026,16 @@ var ts; return undefined; return { kind: 4 /* ImportFixKind.PromoteTypeOnly */, typeOnlyAliasDeclaration: typeOnlyAliasDeclaration }; } - function getSymbolName(sourceFile, checker, symbolToken, compilerOptions) { + function getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions) { var parent = symbolToken.parent; if ((ts.isJsxOpeningLikeElement(parent) || ts.isJsxClosingElement(parent)) && parent.tagName === symbolToken && ts.jsxModeNeedsExplicitImport(compilerOptions.jsx)) { var jsxNamespace = checker.getJsxNamespace(sourceFile); if (needsJsxNamespaceFix(jsxNamespace, symbolToken, checker)) { - return jsxNamespace; + var needsComponentNameFix = !ts.isIntrinsicJsxName(symbolToken.text) && !checker.resolveName(symbolToken.text, symbolToken, 111551 /* SymbolFlags.Value */, /*excludeGlobals*/ false); + return needsComponentNameFix ? [symbolToken.text, jsxNamespace] : [jsxNamespace]; } } - return symbolToken.text; + return [symbolToken.text]; } function needsJsxNamespaceFix(jsxNamespace, symbolToken, checker) { if (ts.isIntrinsicJsxName(symbolToken.text)) @@ -156111,7 +157144,7 @@ var ts; case 4 /* ImportFixKind.PromoteTypeOnly */: { var typeOnlyAliasDeclaration = fix.typeOnlyAliasDeclaration; var promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration, compilerOptions, sourceFile); - return promotedDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ + return promotedDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ ? [ts.Diagnostics.Remove_type_from_import_of_0_from_1, symbolName, getModuleSpecifierText(promotedDeclaration.parent.parent)] : [ts.Diagnostics.Remove_type_from_import_declaration_from_0, getModuleSpecifierText(promotedDeclaration)]; } @@ -156121,7 +157154,7 @@ var ts; } function getModuleSpecifierText(promotedDeclaration) { var _a, _b; - return promotedDeclaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ + return promotedDeclaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? ((_b = ts.tryCast((_a = ts.tryCast(promotedDeclaration.moduleReference, ts.isExternalModuleReference)) === null || _a === void 0 ? void 0 : _a.expression, ts.isStringLiteralLike)) === null || _b === void 0 ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText() : ts.cast(promotedDeclaration.parent.moduleSpecifier, ts.isStringLiteral).text; } @@ -156129,7 +157162,7 @@ var ts; // See comment in `doAddExistingFix` on constant with the same name. var convertExistingToTypeOnly = compilerOptions.preserveValueImports && compilerOptions.isolatedModules; switch (aliasDeclaration.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: if (aliasDeclaration.isTypeOnly) { if (aliasDeclaration.parent.elements.length > 1 && ts.OrganizeImports.importSpecifiersAreSorted(aliasDeclaration.parent.elements)) { changes.delete(sourceFile, aliasDeclaration); @@ -156147,13 +157180,13 @@ var ts; promoteImportClause(aliasDeclaration.parent.parent); return aliasDeclaration.parent.parent; } - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: promoteImportClause(aliasDeclaration); return aliasDeclaration; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: promoteImportClause(aliasDeclaration.parent); return aliasDeclaration.parent; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: changes.deleteRange(sourceFile, aliasDeclaration.getChildAt(1)); return aliasDeclaration; default: @@ -156165,7 +157198,7 @@ var ts; var namedImports = ts.tryCast(importClause.namedBindings, ts.isNamedImports); if (namedImports && namedImports.elements.length > 1) { if (ts.OrganizeImports.importSpecifiersAreSorted(namedImports.elements) && - aliasDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ && + aliasDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ && namedImports.elements.indexOf(aliasDeclaration) !== 0) { // The import specifier being promoted will be the only non-type-only, // import in the NamedImports, so it should be moved to the front. @@ -156175,7 +157208,7 @@ var ts; for (var _i = 0, _a = namedImports.elements; _i < _a.length; _i++) { var element = _a[_i]; if (element !== aliasDeclaration && !element.isTypeOnly) { - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, element); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, element); } } } @@ -156184,7 +157217,7 @@ var ts; } function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImports, compilerOptions) { var _a; - if (clause.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (clause.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (defaultImport) { addElementToBindingPattern(clause, defaultImport.name, "default"); } @@ -156245,7 +157278,7 @@ var ts; if (convertExistingToTypeOnly && existingSpecifiers) { for (var _d = 0, existingSpecifiers_1 = existingSpecifiers; _d < existingSpecifiers_1.length; _d++) { var specifier = existingSpecifiers_1[_d]; - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, specifier); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, specifier); } } } @@ -156420,7 +157453,7 @@ var ts; var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; }); if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined) return; - var declaration = findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); + var declaration = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); if (declaration === undefined) return; if (ts.isIdentifier(declaration) && ts.isTypeParameterDeclaration(declaration.parent)) { @@ -156454,14 +157487,6 @@ var ts; } } } - function findAncestorMatchingSpan(sourceFile, span) { - var end = ts.textSpanEnd(span); - var token = ts.getTokenAtPosition(sourceFile, span.start); - while (token.end < end) { - token = token.parent; - } - return token; - } function tryGetConstraintFromDiagnosticMessage(messageText) { var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/`extends (.*)`/) || [], _ = _a[0], constraint = _a[1]; return constraint; @@ -156605,7 +157630,7 @@ var ts; accessibilityModifier ? accessibilityModifier.end : lastDecorator ? ts.skipTrivia(sourceFile.text, lastDecorator.end) : classElement.getStart(sourceFile); var options = accessibilityModifier || staticModifier || abstractModifier ? { prefix: " " } : { suffix: " " }; - changeTracker.insertModifierAt(sourceFile, modifierPos, 159 /* SyntaxKind.OverrideKeyword */, options); + changeTracker.insertModifierAt(sourceFile, modifierPos, 161 /* SyntaxKind.OverrideKeyword */, options); } function doRemoveOverrideModifierChange(changeTracker, sourceFile, pos) { var classElement = findContainerClassElementLike(sourceFile, pos); @@ -156619,13 +157644,13 @@ var ts; } function isClassElementLikeHasJSDoc(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return ts.isParameterPropertyDeclaration(node, node.parent); default: return false; @@ -156757,7 +157782,7 @@ var ts; }); function getNamedTupleMember(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); - return ts.findAncestor(token, function (t) { return t.kind === 197 /* SyntaxKind.NamedTupleMember */; }); + return ts.findAncestor(token, function (t) { return t.kind === 199 /* SyntaxKind.NamedTupleMember */; }); } function doChange(changes, sourceFile, namedTupleMember) { if (!namedTupleMember) { @@ -156766,11 +157791,11 @@ var ts; var unwrappedType = namedTupleMember.type; var sawOptional = false; var sawRest = false; - while (unwrappedType.kind === 185 /* SyntaxKind.OptionalType */ || unwrappedType.kind === 186 /* SyntaxKind.RestType */ || unwrappedType.kind === 191 /* SyntaxKind.ParenthesizedType */) { - if (unwrappedType.kind === 185 /* SyntaxKind.OptionalType */) { + while (unwrappedType.kind === 187 /* SyntaxKind.OptionalType */ || unwrappedType.kind === 188 /* SyntaxKind.RestType */ || unwrappedType.kind === 193 /* SyntaxKind.ParenthesizedType */) { + if (unwrappedType.kind === 187 /* SyntaxKind.OptionalType */) { sawOptional = true; } - else if (unwrappedType.kind === 186 /* SyntaxKind.RestType */) { + else if (unwrappedType.kind === 188 /* SyntaxKind.RestType */) { sawRest = true; } unwrappedType = unwrappedType.type; @@ -157041,7 +158066,7 @@ var ts; if (isFunctionType) { var sig = checker.getSignatureFromDeclaration(declaration); if (sig) { - if (ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Async */)) { + if (ts.hasSyntacticModifier(declaration, 512 /* ModifierFlags.Async */)) { exprType = checker.createPromiseType(exprType); } var newSig = checker.createSignature(declaration, sig.typeParameters, sig.thisParameter, sig.parameters, exprType, @@ -157085,19 +158110,19 @@ var ts; } function getVariableLikeInitializer(declaration) { switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: return declaration.initializer; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return declaration.initializer && (ts.isJsxExpression(declaration.initializer) ? declaration.initializer.expression : undefined); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 166 /* SyntaxKind.PropertySignature */: - case 299 /* SyntaxKind.EnumMember */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 168 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return undefined; } } @@ -157151,6 +158176,15 @@ var ts; ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code, ts.Diagnostics.Cannot_find_name_0.code ]; + var InfoKind; + (function (InfoKind) { + InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration"; + InfoKind[InfoKind["Enum"] = 1] = "Enum"; + InfoKind[InfoKind["Function"] = 2] = "Function"; + InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral"; + InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes"; + InfoKind[InfoKind["Signature"] = 5] = "Signature"; + })(InfoKind || (InfoKind = {})); codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { @@ -157159,19 +158193,19 @@ var ts; if (!info) { return undefined; } - if (info.kind === 3 /* InfoKind.ObjectLiteral */) { + if (info.kind === InfoKind.ObjectLiteral) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addObjectLiteralProperties(t, context, info); }); return [codefix.createCodeFixAction(fixMissingProperties, changes, ts.Diagnostics.Add_missing_properties, fixMissingProperties, ts.Diagnostics.Add_all_missing_properties)]; } - if (info.kind === 4 /* InfoKind.JsxAttributes */) { + if (info.kind === InfoKind.JsxAttributes) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addJsxAttributes(t, context, info); }); return [codefix.createCodeFixAction(fixMissingAttributes, changes, ts.Diagnostics.Add_missing_attributes, fixMissingAttributes, ts.Diagnostics.Add_all_missing_attributes)]; } - if (info.kind === 2 /* InfoKind.Function */) { + if (info.kind === InfoKind.Function || info.kind === InfoKind.Signature) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addFunctionDeclaration(t, context, info); }); return [codefix.createCodeFixAction(fixMissingFunctionDeclaration, changes, [ts.Diagnostics.Add_missing_function_declaration_0, info.token.text], fixMissingFunctionDeclaration, ts.Diagnostics.Add_all_missing_function_declarations)]; } - if (info.kind === 1 /* InfoKind.Enum */) { + if (info.kind === InfoKind.Enum) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addEnumMemberDeclaration(t, context.program.getTypeChecker(), info); }); return [codefix.createCodeFixAction(fixMissingMember, changes, [ts.Diagnostics.Add_missing_enum_member_0, info.token.text], fixMissingMember, ts.Diagnostics.Add_all_missing_members)]; } @@ -157189,20 +158223,20 @@ var ts; if (!info || !ts.addToSeen(seen, ts.getNodeId(info.parentDeclaration) + "#" + info.token.text)) { return; } - if (fixId === fixMissingFunctionDeclaration && info.kind === 2 /* InfoKind.Function */) { + if (fixId === fixMissingFunctionDeclaration && (info.kind === InfoKind.Function || info.kind === InfoKind.Signature)) { addFunctionDeclaration(changes, context, info); } - else if (fixId === fixMissingProperties && info.kind === 3 /* InfoKind.ObjectLiteral */) { + else if (fixId === fixMissingProperties && info.kind === InfoKind.ObjectLiteral) { addObjectLiteralProperties(changes, context, info); } - else if (fixId === fixMissingAttributes && info.kind === 4 /* InfoKind.JsxAttributes */) { + else if (fixId === fixMissingAttributes && info.kind === InfoKind.JsxAttributes) { addJsxAttributes(changes, context, info); } else { - if (info.kind === 1 /* InfoKind.Enum */) { + if (info.kind === InfoKind.Enum) { addEnumMemberDeclaration(changes, checker, info); } - if (info.kind === 0 /* InfoKind.TypeLikeDeclaration */) { + if (info.kind === InfoKind.TypeLikeDeclaration) { var parentDeclaration = info.parentDeclaration, token_1 = info.token; var infos = ts.getOrUpdate(typeDeclToMembers, parentDeclaration, function () { return []; }); if (!infos.some(function (i) { return i.token.text === token_1.text; })) { @@ -157246,14 +158280,6 @@ var ts; })); }, }); - var InfoKind; - (function (InfoKind) { - InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration"; - InfoKind[InfoKind["Enum"] = 1] = "Enum"; - InfoKind[InfoKind["Function"] = 2] = "Function"; - InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral"; - InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes"; - })(InfoKind || (InfoKind = {})); function getInfo(sourceFile, tokenPos, errorCode, checker, program) { // The identifier of the missing property. eg: // this.missing = 1; @@ -157275,7 +158301,7 @@ var ts; var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent), checker.getParameterType(signature, argIndex), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false)); if (!ts.length(properties)) return undefined; - return { kind: 3 /* InfoKind.ObjectLiteral */, token: param.name, properties: properties, parentDeclaration: parent }; + return { kind: InfoKind.ObjectLiteral, token: param.name, properties: properties, parentDeclaration: parent }; } if (!ts.isMemberName(token)) return undefined; @@ -157283,17 +158309,26 @@ var ts; var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent.initializer), checker.getTypeAtLocation(token), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false)); if (!ts.length(properties)) return undefined; - return { kind: 3 /* InfoKind.ObjectLiteral */, token: token, properties: properties, parentDeclaration: parent.initializer }; + return { kind: InfoKind.ObjectLiteral, token: token, properties: properties, parentDeclaration: parent.initializer }; } if (ts.isIdentifier(token) && ts.isJsxOpeningLikeElement(token.parent)) { var target = ts.getEmitScriptTarget(program.getCompilerOptions()); var attributes = getUnmatchedAttributes(checker, target, token.parent); if (!ts.length(attributes)) return undefined; - return { kind: 4 /* InfoKind.JsxAttributes */, token: token, attributes: attributes, parentDeclaration: token.parent }; + return { kind: InfoKind.JsxAttributes, token: token, attributes: attributes, parentDeclaration: token.parent }; } - if (ts.isIdentifier(token) && ts.isCallExpression(parent) && parent.expression === token) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* ModifierFlags.None */, parentDeclaration: sourceFile }; + if (ts.isIdentifier(token)) { + var type = checker.getContextualType(token); + if (type && ts.getObjectFlags(type) & 16 /* ObjectFlags.Anonymous */) { + var signature = ts.firstOrUndefined(checker.getSignaturesOfType(type, 0 /* SignatureKind.Call */)); + if (signature === undefined) + return undefined; + return { kind: InfoKind.Signature, token: token, signature: signature, sourceFile: sourceFile, parentDeclaration: findScope(token) }; + } + if (ts.isCallExpression(parent) && parent.expression === token) { + return { kind: InfoKind.Function, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* ModifierFlags.None */, parentDeclaration: findScope(token) }; + } } if (!ts.isPropertyAccessExpression(parent)) return undefined; @@ -157305,13 +158340,13 @@ var ts; var moduleDeclaration = ts.find(symbol.declarations, ts.isModuleDeclaration); var moduleDeclarationSourceFile = moduleDeclaration === null || moduleDeclaration === void 0 ? void 0 : moduleDeclaration.getSourceFile(); if (moduleDeclaration && moduleDeclarationSourceFile && !isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent.parent, sourceFile: sourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleDeclaration }; + return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: sourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleDeclaration }; } var moduleSourceFile = ts.find(symbol.declarations, ts.isSourceFile); if (sourceFile.commonJsModuleIndicator) return undefined; if (moduleSourceFile && !isSourceFileFromLibrary(program, moduleSourceFile)) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleSourceFile }; + return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleSourceFile }; } } var classDeclaration = ts.find(symbol.declarations, ts.isClassLike); @@ -157329,11 +158364,11 @@ var ts; (makeStatic ? 32 /* ModifierFlags.Static */ : 0 /* ModifierFlags.None */) | (ts.startsWithUnderscore(token.text) ? 8 /* ModifierFlags.Private */ : 0 /* ModifierFlags.None */); var isJSFile = ts.isSourceFileJS(declSourceFile); var call = ts.tryCast(parent.parent, ts.isCallExpression); - return { kind: 0 /* InfoKind.TypeLikeDeclaration */, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile }; + 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())) { - return { kind: 1 /* InfoKind.Enum */, token: token, parentDeclaration: enumDeclaration }; + return { kind: InfoKind.Enum, token: token, parentDeclaration: enumDeclaration }; } return undefined; } @@ -157360,7 +158395,7 @@ var ts; function addMissingMemberInJs(changeTracker, sourceFile, classDeclaration, token, makeStatic) { var tokenName = token.text; if (makeStatic) { - if (classDeclaration.kind === 226 /* SyntaxKind.ClassExpression */) { + if (classDeclaration.kind === 228 /* SyntaxKind.ClassExpression */) { return; } var className = classDeclaration.name.getText(); @@ -157411,7 +158446,7 @@ var ts; } function getTypeNode(checker, node, token) { var typeNode; - if (token.parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (token.parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */) { var binaryExpression = token.parent.parent; var otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left; var widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression))); @@ -157421,7 +158456,7 @@ var ts; var contextualType = checker.getContextualType(token.parent); typeNode = contextualType ? checker.typeToTypeNode(contextualType, /*enclosingDeclaration*/ undefined, 1 /* NodeBuilderFlags.NoTruncation */) : undefined; } - return typeNode || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return typeNode || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } function addPropertyDeclaration(changeTracker, sourceFile, node, tokenName, typeNode, modifierFlags) { var modifiers = modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; @@ -157449,7 +158484,7 @@ var ts; } function createAddIndexSignatureAction(context, sourceFile, node, tokenName, typeNode) { // Index signatures cannot have the static modifier. - var stringTypeNode = ts.factory.createKeywordTypeNode(150 /* SyntaxKind.StringKeyword */); + var stringTypeNode = ts.factory.createKeywordTypeNode(152 /* SyntaxKind.StringKeyword */); var indexingParameter = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "x", @@ -157480,7 +158515,7 @@ var ts; } function addMethodDeclaration(context, changes, callExpression, name, modifierFlags, parentDeclaration, sourceFile) { var importAdder = codefix.createImportAdder(sourceFile, context.program, context.preferences, context.host); - var kind = ts.isClassLike(parentDeclaration) ? 169 /* SyntaxKind.MethodDeclaration */ : 168 /* SyntaxKind.MethodSignature */; + var kind = ts.isClassLike(parentDeclaration) ? 171 /* SyntaxKind.MethodDeclaration */ : 170 /* SyntaxKind.MethodSignature */; var signatureDeclaration = codefix.createSignatureDeclarationFromCallExpression(kind, context, importAdder, callExpression, name, modifierFlags, parentDeclaration); var containingMethodDeclaration = tryGetContainingMethodDeclaration(parentDeclaration, callExpression); if (containingMethodDeclaration) { @@ -157509,9 +158544,17 @@ var ts; }); } function addFunctionDeclaration(changes, context, info) { + var quotePreference = ts.getQuotePreference(context.sourceFile, context.preferences); var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host); - var functionDeclaration = codefix.createSignatureDeclarationFromCallExpression(256 /* SyntaxKind.FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration); - changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration); + var functionDeclaration = info.kind === InfoKind.Function + ? codefix.createSignatureDeclarationFromCallExpression(259 /* SyntaxKind.FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration) + : codefix.createSignatureDeclarationFromSignature(259 /* SyntaxKind.FunctionDeclaration */, context, quotePreference, info.signature, codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), info.token, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ undefined, importAdder); + if (functionDeclaration === undefined) { + ts.Debug.fail("fixMissingFunctionDeclaration codefix got unexpected error."); + } + ts.isReturnStatement(info.parentDeclaration) + ? changes.insertNodeBefore(info.sourceFile, info.parentDeclaration, functionDeclaration, /*blankLineBetween*/ true) + : changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration); importAdder.writeFixes(changes); } function addJsxAttributes(changes, context, info) { @@ -157607,7 +158650,7 @@ var ts; var signature = checker.getSignaturesOfType(type, 0 /* SignatureKind.Call */); if (signature === undefined) return createUndefined(); - var func = codefix.createSignatureDeclarationFromSignature(213 /* SyntaxKind.FunctionExpression */, context, quotePreference, signature[0], codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), /*name*/ undefined, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ enclosingDeclaration, importAdder); + var func = codefix.createSignatureDeclarationFromSignature(215 /* SyntaxKind.FunctionExpression */, context, quotePreference, signature[0], codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), /*name*/ undefined, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ enclosingDeclaration, importAdder); return func !== null && func !== void 0 ? func : createUndefined(); } if (ts.getObjectFlags(type) & 1 /* ObjectFlags.Class */) { @@ -157661,14 +158704,21 @@ var ts; return declaration && declaration.parent === node ? declaration : undefined; } function createPropertyNameFromSymbol(symbol, target, quotePreference, checker) { - if (ts.isTransientSymbol(symbol) && symbol.nameType && symbol.nameType.flags & 8192 /* TypeFlags.UniqueESSymbol */) { - var expression = checker.symbolToExpression(symbol.nameType.symbol, 111551 /* SymbolFlags.Value */, symbol.valueDeclaration, 1048576 /* NodeBuilderFlags.AllowUniqueESSymbolType */); - if (expression) { - return ts.factory.createComputedPropertyName(expression); - } + if (ts.isTransientSymbol(symbol)) { + var prop = checker.symbolToNode(symbol, 111551 /* SymbolFlags.Value */, /*enclosingDeclaration*/ undefined, 1073741824 /* NodeBuilderFlags.WriteComputedProps */); + if (prop && ts.isComputedPropertyName(prop)) + return prop; } return ts.createPropertyNameNodeForIdentifierOrLiteral(symbol.name, target, quotePreference === 0 /* QuotePreference.Single */); } + function findScope(node) { + if (ts.findAncestor(node, ts.isJsxExpression)) { + var returnStatement = ts.findAncestor(node.parent, ts.isReturnStatement); + if (returnStatement) + return returnStatement; + } + return ts.getSourceFileOfNode(node); + } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); /* @internal */ @@ -157819,7 +158869,7 @@ var ts; // See `codeFixClassExtendAbstractProtectedProperty.ts` in https://github.com/Microsoft/TypeScript/pull/11547/files // (now named `codeFixClassExtendAbstractPrivateProperty.ts`) var flags = ts.getSyntacticModifierFlags(ts.first(symbol.getDeclarations())); - return !(flags & 8 /* ModifierFlags.Private */) && !!(flags & 128 /* ModifierFlags.Abstract */); + return !(flags & 8 /* ModifierFlags.Private */) && !!(flags & 256 /* ModifierFlags.Abstract */); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -157982,6 +159032,63 @@ var ts; })(ts || (ts = {})); /* @internal */ var ts; +(function (ts) { + var codefix; + (function (codefix) { + var fixId = "fixNaNEquality"; + var errorCodes = [ + ts.Diagnostics.This_condition_will_always_return_0.code, + ]; + codefix.registerCodeFix({ + errorCodes: errorCodes, + getCodeActions: function (context) { + var sourceFile = context.sourceFile, span = context.span, program = context.program; + var info = getInfo(program, sourceFile, span); + if (info === undefined) + return; + var suggestion = info.suggestion, expression = info.expression, arg = info.arg; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, arg, expression); }); + return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Use_0, suggestion], fixId, ts.Diagnostics.Use_Number_isNaN_in_all_conditions)]; + }, + fixIds: [fixId], + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(context.program, diag.file, ts.createTextSpan(diag.start, diag.length)); + if (info) { + doChange(changes, diag.file, info.arg, info.expression); + } + }); + } + }); + function getInfo(program, sourceFile, span) { + var diag = ts.find(program.getSemanticDiagnostics(sourceFile), function (diag) { return diag.start === span.start && diag.length === span.length; }); + if (diag === undefined || diag.relatedInformation === undefined) + return; + var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.Did_you_mean_0.code; }); + if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined) + return; + var token = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); + if (token === undefined) + return; + if (ts.isExpression(token) && ts.isBinaryExpression(token.parent)) { + return { suggestion: getSuggestion(related.messageText), expression: token.parent, arg: token }; + } + return undefined; + } + function doChange(changes, sourceFile, arg, expression) { + var callExpression = ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("Number"), ts.factory.createIdentifier("isNaN")), /*typeArguments*/ undefined, [arg]); + var operator = expression.operatorToken.kind; + changes.replaceNode(sourceFile, expression, operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ + ? ts.factory.createPrefixUnaryExpression(53 /* SyntaxKind.ExclamationToken */, callExpression) : callExpression); + } + function getSuggestion(messageText) { + var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/\'(.*)\'/) || [], _ = _a[0], suggestion = _a[1]; + return suggestion; + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var codefix; (function (codefix) { @@ -158299,7 +159406,7 @@ var ts; var importDeclaration = getImportDeclaration(context.sourceFile, context.program, context.span.start); if (!importDeclaration) return; - var namespaceChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return importDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ && doNamespaceImportChange(t, context.sourceFile, importDeclaration, context.program); }); + var namespaceChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return importDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ && doNamespaceImportChange(t, context.sourceFile, importDeclaration, context.program); }); var typeOnlyChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return doTypeOnlyImportChange(t, context.sourceFile, importDeclaration, context.program); }); var actions; if (namespaceChanges.length) { @@ -158314,7 +159421,7 @@ var ts; }); function getImportDeclaration(sourceFile, program, start) { var identifier = ts.tryCast(ts.getTokenAtPosition(sourceFile, start), ts.isIdentifier); - if (!identifier || identifier.parent.kind !== 178 /* SyntaxKind.TypeReference */) + if (!identifier || identifier.parent.kind !== 180 /* SyntaxKind.TypeReference */) return; var checker = program.getTypeChecker(); var symbol = checker.getSymbolAtLocation(identifier); @@ -158326,11 +159433,11 @@ var ts; // new type-only import declaration, but honestly I doubt anyone will ever use this // codefix at all, so it's probably not worth the lines of code. function doTypeOnlyImportChange(changes, sourceFile, importDeclaration, program) { - if (importDeclaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, importDeclaration.name); + if (importDeclaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, importDeclaration.name); return; } - var importClause = importDeclaration.kind === 267 /* SyntaxKind.ImportClause */ ? importDeclaration : importDeclaration.parent.parent; + var importClause = importDeclaration.kind === 270 /* SyntaxKind.ImportClause */ ? importDeclaration : importDeclaration.parent.parent; if (importClause.name && importClause.namedBindings) { // Cannot convert an import with a default import and named bindings to type-only // (it's a grammar error). @@ -158347,7 +159454,7 @@ var ts; // Don't convert it to type-only. return; } - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, importClause); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, importClause); } function doNamespaceImportChange(changes, sourceFile, importDeclaration, program) { ts.refactor.doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, importDeclaration.parent); @@ -158425,7 +159532,7 @@ var ts; ]; } var result = []; - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return changeInferToUnknown(t, sourceFile, token); }); var name = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name.text; result.push(codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Replace_infer_0_with_unknown, name], fixIdInfer, ts.Diagnostics.Replace_all_unused_infer_with_unknown)); @@ -158467,7 +159574,7 @@ var ts; break; } case fixIdDelete: { - if (token.kind === 137 /* SyntaxKind.InferKeyword */ || isImport(token)) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */ || isImport(token)) { break; // Can't delete } else if (ts.isJSDocTemplateTag(token)) { @@ -158496,7 +159603,7 @@ var ts; break; } case fixIdInfer: - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { changeInferToUnknown(changes, sourceFile, token); } break; @@ -158507,7 +159614,7 @@ var ts; }, }); function changeInferToUnknown(changes, sourceFile, token) { - changes.replaceNode(sourceFile, token.parent, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)); + changes.replaceNode(sourceFile, token.parent, ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)); } function createDeleteFix(changes, diag) { return codefix.createCodeFixAction(fixName, changes, diag, fixIdDelete, ts.Diagnostics.Delete_all_unused_declarations); @@ -158517,7 +159624,7 @@ var ts; } function isImport(token) { return token.kind === 100 /* SyntaxKind.ImportKeyword */ - || token.kind === 79 /* SyntaxKind.Identifier */ && (token.parent.kind === 270 /* SyntaxKind.ImportSpecifier */ || token.parent.kind === 267 /* SyntaxKind.ImportClause */); + || token.kind === 79 /* SyntaxKind.Identifier */ && (token.parent.kind === 273 /* SyntaxKind.ImportSpecifier */ || token.parent.kind === 270 /* SyntaxKind.ImportClause */); } /** Sometimes the diagnostic span is an entire ImportDeclaration, so we should remove the whole thing. */ function tryGetFullImport(token) { @@ -158527,7 +159634,7 @@ var ts; return ts.isVariableDeclarationList(token.parent) && ts.first(token.parent.getChildren(sourceFile)) === token; } function deleteEntireVariableStatement(changes, sourceFile, node) { - changes.delete(sourceFile, node.parent.kind === 237 /* SyntaxKind.VariableStatement */ ? node.parent : node); + changes.delete(sourceFile, node.parent.kind === 240 /* SyntaxKind.VariableStatement */ ? node.parent : node); } function deleteDestructuringElements(changes, sourceFile, node) { ts.forEach(node.elements, function (n) { return changes.delete(sourceFile, n); }); @@ -158536,7 +159643,7 @@ var ts; // Don't offer to prefix a property. if (errorCode === ts.Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code) return; - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { token = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name; } if (ts.isIdentifier(token) && canPrefix(token)) { @@ -158552,14 +159659,14 @@ var ts; } function canPrefix(token) { switch (token.parent.kind) { - case 164 /* SyntaxKind.Parameter */: - case 163 /* SyntaxKind.TypeParameter */: + case 166 /* SyntaxKind.Parameter */: + case 165 /* SyntaxKind.TypeParameter */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var varDecl = token.parent; switch (varDecl.parent.parent.kind) { - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return true; } } @@ -158614,8 +159721,8 @@ var ts; function mayDeleteParameter(checker, sourceFile, parameter, sourceFiles, program, cancellationToken, isFixAll) { var parent = parameter.parent; switch (parent.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: var index = parent.parameters.indexOf(parameter); var referent = ts.isMethodDeclaration(parent) ? parent.name : parent; var entries = ts.FindAllReferences.Core.getReferencedSymbolsForNode(parent.pos, referent, program, sourceFiles, cancellationToken); @@ -158645,20 +159752,20 @@ var ts; } } return true; - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { if (parent.name && isCallbackLike(checker, sourceFile, parent.name)) { return isLastParameter(parent, parameter, isFixAll); } return true; } - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: // Can't remove a non-last parameter in a callback. Can remove a parameter in code-fix-all if future parameters are also unused. return isLastParameter(parent, parameter, isFixAll); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Setter must have a parameter return false; - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Getter cannot have parameters return true; default: @@ -158719,7 +159826,7 @@ var ts; var container = (ts.isBlock(statement.parent) ? statement.parent : statement).parent; if (!ts.isBlock(statement.parent) || statement === ts.first(statement.parent.statements)) { switch (container.kind) { - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: if (container.elseStatement) { if (ts.isBlock(statement.parent)) { break; @@ -158730,8 +159837,8 @@ var ts; return; } // falls through - case 241 /* SyntaxKind.WhileStatement */: - case 242 /* SyntaxKind.ForStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: changes.delete(sourceFile, container); return; } @@ -158804,7 +159911,7 @@ var ts; var typeNode = info.typeNode, type = info.type; var original = typeNode.getText(sourceFile); var actions = [fix(type, fixIdPlain, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript)]; - if (typeNode.kind === 314 /* SyntaxKind.JSDocNullableType */) { + if (typeNode.kind === 317 /* SyntaxKind.JSDocNullableType */) { // for nullable types, suggest the flow-compatible `T | null | undefined` // in addition to the jsdoc/closure-compatible `T | null` actions.push(fix(checker.getNullableType(type, 32768 /* TypeFlags.Undefined */), fixIdNullable, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types)); @@ -158824,7 +159931,7 @@ var ts; if (!info) return; var typeNode = info.typeNode, type = info.type; - var fixedType = typeNode.kind === 314 /* SyntaxKind.JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* TypeFlags.Undefined */) : type; + var fixedType = typeNode.kind === 317 /* SyntaxKind.JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* TypeFlags.Undefined */) : type; doChange(changes, sourceFile, typeNode, fixedType, checker); }); } @@ -158841,22 +159948,22 @@ var ts; // NOTE: Some locations are not handled yet: // MappedTypeNode.typeParameters and SignatureDeclaration.typeParameters, as well as CallExpression.typeArguments switch (node.kind) { - case 229 /* SyntaxKind.AsExpression */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 176 /* SyntaxKind.IndexSignature */: - case 195 /* SyntaxKind.MappedType */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 173 /* SyntaxKind.SetAccessor */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 231 /* SyntaxKind.AsExpression */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 178 /* SyntaxKind.IndexSignature */: + case 197 /* SyntaxKind.MappedType */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 175 /* SyntaxKind.SetAccessor */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; default: return false; @@ -158959,14 +160066,14 @@ var ts; } var insertBefore; switch (containingFunction.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: insertBefore = containingFunction.name; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: insertBefore = ts.findChildOfKind(containingFunction, 98 /* SyntaxKind.FunctionKeyword */, sourceFile); break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: var kind = containingFunction.typeParameters ? 29 /* SyntaxKind.LessThanToken */ : 20 /* SyntaxKind.OpenParenToken */; insertBefore = ts.findChildOfKind(containingFunction, kind, sourceFile) || ts.first(containingFunction.parameters); break; @@ -158986,7 +160093,7 @@ var ts; changes.replaceNode(sourceFile, returnType, ts.factory.createTypeReferenceNode("Promise", ts.factory.createNodeArray([returnType]))); } } - changes.insertModifierBefore(sourceFile, 131 /* SyntaxKind.AsyncKeyword */, insertBefore); + changes.insertModifierBefore(sourceFile, 132 /* SyntaxKind.AsyncKeyword */, insertBefore); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -159302,7 +160409,7 @@ var ts; function annotate(changes, importAdder, sourceFile, declaration, type, program, host) { var typeNode = ts.getTypeNodeIfAccessible(type, declaration, program, host); if (typeNode) { - if (ts.isInJSFile(sourceFile) && declaration.kind !== 166 /* SyntaxKind.PropertySignature */) { + if (ts.isInJSFile(sourceFile) && declaration.kind !== 168 /* SyntaxKind.PropertySignature */) { var parent = ts.isVariableDeclaration(declaration) ? ts.tryCast(declaration.parent.parent, ts.isVariableStatement) : declaration; if (!parent) { return; @@ -159389,19 +160496,19 @@ var ts; function getFunctionReferences(containingFunction, sourceFile, program, cancellationToken) { var searchToken; switch (containingFunction.kind) { - case 171 /* SyntaxKind.Constructor */: - searchToken = ts.findChildOfKind(containingFunction, 134 /* SyntaxKind.ConstructorKeyword */, sourceFile); + case 173 /* SyntaxKind.Constructor */: + searchToken = ts.findChildOfKind(containingFunction, 135 /* SyntaxKind.ConstructorKeyword */, sourceFile); break; - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: var parent = containingFunction.parent; searchToken = (ts.isVariableDeclaration(parent) || ts.isPropertyDeclaration(parent)) && ts.isIdentifier(parent.name) ? parent.name : containingFunction.name; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: searchToken = containingFunction.name; break; } @@ -159543,24 +160650,24 @@ var ts; node = node.parent; } switch (node.parent.kind) { - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: inferTypeFromExpressionStatement(node, usage); break; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: usage.isNumber = true; break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: inferTypeFromPrefixUnaryExpression(node.parent, usage); break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: inferTypeFromBinaryExpression(node, node.parent, usage); break; - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: inferTypeFromSwitchStatementLabel(node.parent, usage); break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: if (node.parent.expression === node) { inferTypeFromCallExpression(node.parent, usage); } @@ -159568,20 +160675,20 @@ var ts; inferTypeFromContextualType(node, usage); } break; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: inferTypeFromPropertyAccessExpression(node.parent, usage); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: inferTypeFromPropertyElementExpression(node.parent, node, usage); break; - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: inferTypeFromPropertyAssignment(node.parent, usage); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: inferTypeFromPropertyDeclaration(node.parent, usage); break; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var _a = node.parent, name = _a.name, initializer = _a.initializer; if (node === name) { if (initializer) { // This can happen for `let x = null;` which still has an implicit-any error. @@ -159703,7 +160810,7 @@ var ts; case 56 /* SyntaxKind.BarBarToken */: case 60 /* SyntaxKind.QuestionQuestionToken */: if (node === parent.left && - (node.parent.parent.kind === 254 /* SyntaxKind.VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) { + (node.parent.parent.kind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) { // var x = x || {}; // TODO: use getFalsyflagsOfType addCandidateType(usage, checker.getTypeAtLocation(parent.right)); @@ -159731,7 +160838,7 @@ var ts; } } calculateUsageOfNode(parent, call.return_); - if (parent.kind === 208 /* SyntaxKind.CallExpression */) { + if (parent.kind === 210 /* SyntaxKind.CallExpression */) { (usage.calls || (usage.calls = [])).push(call); } else { @@ -160185,25 +161292,44 @@ var ts; * @param body If defined, this will be the body of the member node passed to `addClassElement`. Otherwise, the body will default to a stub. */ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional, isAmbient) { + var _a; if (preserveOptional === void 0) { preserveOptional = 3 /* PreserveOptionalFlags.All */; } if (isAmbient === void 0) { isAmbient = false; } var declarations = symbol.getDeclarations(); - if (!(declarations && declarations.length)) { - return undefined; - } + var declaration = declarations === null || declarations === void 0 ? void 0 : declarations[0]; var checker = context.program.getTypeChecker(); var scriptTarget = ts.getEmitScriptTarget(context.program.getCompilerOptions()); - var declaration = declarations[0]; - var name = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false); - var visibilityModifier = createVisibilityModifier(ts.getEffectiveModifierFlags(declaration)); - var modifiers = visibilityModifier ? ts.factory.createNodeArray([visibilityModifier]) : undefined; + /** + * (#49811) + * Note that there are cases in which the symbol declaration is not present. For example, in the code below both + * `MappedIndirect.ax` and `MappedIndirect.ay` have no declaration node attached (due to their mapped-type + * parent): + * + * ```ts + * type Base = { ax: number; ay: string }; + * type BaseKeys = keyof Base; + * type MappedIndirect = { [K in BaseKeys]: boolean }; + * ``` + * + * In such cases, we assume the declaration to be a `PropertySignature`. + */ + var kind = (_a = declaration === null || declaration === void 0 ? void 0 : declaration.kind) !== null && _a !== void 0 ? _a : 168 /* SyntaxKind.PropertySignature */; + var declarationName = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false); + var effectiveModifierFlags = declaration ? ts.getEffectiveModifierFlags(declaration) : 0 /* ModifierFlags.None */; + var modifierFlags = effectiveModifierFlags & 4 /* ModifierFlags.Public */ ? 4 /* ModifierFlags.Public */ : + effectiveModifierFlags & 16 /* ModifierFlags.Protected */ ? 16 /* ModifierFlags.Protected */ : + 0 /* ModifierFlags.None */; + if (declaration && ts.isAutoAccessorPropertyDeclaration(declaration)) { + modifierFlags |= 128 /* ModifierFlags.Accessor */; + } + var modifiers = modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration)); var optional = !!(symbol.flags & 16777216 /* SymbolFlags.Optional */); var ambient = !!(enclosingDeclaration.flags & 16777216 /* NodeFlags.Ambient */) || isAmbient; var quotePreference = ts.getQuotePreference(sourceFile, preferences); - switch (declaration.kind) { - case 166 /* SyntaxKind.PropertySignature */: - case 167 /* SyntaxKind.PropertyDeclaration */: + switch (kind) { + case 168 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: var flags = quotePreference === 0 /* QuotePreference.Single */ ? 268435456 /* NodeBuilderFlags.UseSingleQuotesForStringLiteralType */ : undefined; var typeNode = checker.typeToTypeNode(type, enclosingDeclaration, flags, getNoopSymbolTrackerWithResolver(context)); if (importAdder) { @@ -160213,11 +161339,12 @@ var ts; importSymbols(importAdder, importableReference.symbols); } } - addClassElement(ts.factory.createPropertyDeclaration(modifiers, name, optional && (preserveOptional & 2 /* PreserveOptionalFlags.Property */) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, typeNode, + addClassElement(ts.factory.createPropertyDeclaration(modifiers, declaration ? createName(declarationName) : symbol.getName(), optional && (preserveOptional & 2 /* PreserveOptionalFlags.Property */) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, typeNode, /*initializer*/ undefined)); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: { + ts.Debug.assertIsDefined(declarations); var typeNode_1 = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context)); var allAccessors = ts.getAllAccessorDeclarations(declarations, declaration); var orderedAccessors = allAccessors.secondAccessor @@ -160233,19 +161360,19 @@ var ts; for (var _i = 0, orderedAccessors_1 = orderedAccessors; _i < orderedAccessors_1.length; _i++) { var accessor = orderedAccessors_1[_i]; if (ts.isGetAccessorDeclaration(accessor)) { - addClassElement(ts.factory.createGetAccessorDeclaration(modifiers, name, ts.emptyArray, typeNode_1, ambient ? undefined : body || createStubbedMethodBody(quotePreference))); + addClassElement(ts.factory.createGetAccessorDeclaration(modifiers, createName(declarationName), ts.emptyArray, createTypeNode(typeNode_1), createBody(body, quotePreference, ambient))); } else { ts.Debug.assertNode(accessor, ts.isSetAccessorDeclaration, "The counterpart to a getter should be a setter"); var parameter = ts.getSetAccessorValueParameter(accessor); var parameterName = parameter && ts.isIdentifier(parameter.name) ? ts.idText(parameter.name) : undefined; - addClassElement(ts.factory.createSetAccessorDeclaration(modifiers, name, createDummyParameters(1, [parameterName], [typeNode_1], 1, /*inJs*/ false), ambient ? undefined : body || createStubbedMethodBody(quotePreference))); + addClassElement(ts.factory.createSetAccessorDeclaration(modifiers, createName(declarationName), createDummyParameters(1, [parameterName], [createTypeNode(typeNode_1)], 1, /*inJs*/ false), createBody(body, quotePreference, ambient))); } } break; } - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: // The signature for the implementation appears as an entry in `signatures` iff // there is only one signature. // If there are overloads and an implementation signature, it appears as an @@ -160253,6 +161380,7 @@ var ts; // If there is more than one overload but no implementation signature // (eg: an abstract method or interface declaration), there is a 1-1 // correspondence of declarations and signatures. + ts.Debug.assertIsDefined(declarations); var signatures = type.isUnion() ? ts.flatMap(type.types, function (t) { return t.getCallSignatures(); }) : type.getCallSignatures(); if (!ts.some(signatures)) { break; @@ -160260,31 +161388,41 @@ var ts; if (declarations.length === 1) { ts.Debug.assert(signatures.length === 1, "One declaration implies one signature"); var signature = signatures[0]; - outputMethod(quotePreference, signature, modifiers, name, ambient ? undefined : body || createStubbedMethodBody(quotePreference)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName), createBody(body, quotePreference, ambient)); break; } - for (var _a = 0, signatures_1 = signatures; _a < signatures_1.length; _a++) { - var signature = signatures_1[_a]; + for (var _b = 0, signatures_1 = signatures; _b < signatures_1.length; _b++) { + var signature = signatures_1[_b]; // Ensure nodes are fresh so they can have different positions when going through formatting. - outputMethod(quotePreference, signature, ts.getSynthesizedDeepClones(modifiers, /*includeTrivia*/ false), ts.getSynthesizedDeepClone(name, /*includeTrivia*/ false)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName)); } if (!ambient) { if (declarations.length > signatures.length) { var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]); - outputMethod(quotePreference, signature, modifiers, name, body || createStubbedMethodBody(quotePreference)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName), createBody(body, quotePreference)); } else { ts.Debug.assert(declarations.length === signatures.length, "Declarations and signatures should match count"); - addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), modifiers, quotePreference, body)); + addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, createName(declarationName), optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), modifiers, quotePreference, body)); } } break; } function outputMethod(quotePreference, signature, modifiers, name, body) { - var method = createSignatureDeclarationFromSignature(169 /* SyntaxKind.MethodDeclaration */, context, quotePreference, signature, body, name, modifiers, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), enclosingDeclaration, importAdder); + var method = createSignatureDeclarationFromSignature(171 /* SyntaxKind.MethodDeclaration */, context, quotePreference, signature, body, name, modifiers, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), enclosingDeclaration, importAdder); if (method) addClassElement(method); } + function createName(node) { + return ts.getSynthesizedDeepClone(node, /*includeTrivia*/ false); + } + function createBody(block, quotePreference, ambient) { + return ambient ? undefined : + ts.getSynthesizedDeepClone(block, /*includeTrivia*/ false) || createStubbedMethodBody(quotePreference); + } + function createTypeNode(typeNode) { + return ts.getSynthesizedDeepClone(typeNode, /*includeTrivia*/ false); + } } codefix.addNewNodeForMemberSymbol = addNewNodeForMemberSymbol; function createSignatureDeclarationFromSignature(kind, context, quotePreference, signature, body, name, modifiers, optional, enclosingDeclaration, importAdder) { @@ -160358,6 +161496,9 @@ var ts; if (ts.isMethodDeclaration(signatureDeclaration)) { return ts.factory.updateMethodDeclaration(signatureDeclaration, modifiers, asteriskToken, name !== null && name !== void 0 ? name : ts.factory.createIdentifier(""), questionToken, typeParameters, parameters, type, body); } + if (ts.isFunctionDeclaration(signatureDeclaration)) { + return ts.factory.updateFunctionDeclaration(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, ts.tryCast(name, ts.isIdentifier), typeParameters, parameters, type, body !== null && body !== void 0 ? body : signatureDeclaration.body); + } return undefined; } codefix.createSignatureDeclarationFromSignature = createSignatureDeclarationFromSignature; @@ -160386,13 +161527,13 @@ var ts; ? undefined : checker.typeToTypeNode(contextualType, contextNode, /*flags*/ undefined, tracker); switch (kind) { - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return ts.factory.createMethodDeclaration(modifiers, asteriskToken, name, /*questionToken*/ undefined, typeParameters, parameters, type, createStubbedMethodBody(quotePreference)); - case 168 /* SyntaxKind.MethodSignature */: + case 170 /* SyntaxKind.MethodSignature */: return ts.factory.createMethodSignature(modifiers, name, - /*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */) : type); - case 256 /* SyntaxKind.FunctionDeclaration */: + /*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */) : type); + case 259 /* SyntaxKind.FunctionDeclaration */: return ts.factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference)); default: ts.Debug.fail("Unexpected kind"); @@ -160529,7 +161670,7 @@ var ts; /*dotDotDotToken*/ undefined, /*name*/ parameterName + (parameterNameCount || ""), /*questionToken*/ minArgumentCount !== undefined && i >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, - /*type*/ inJs ? undefined : (types === null || types === void 0 ? void 0 : types[i]) || ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */), + /*type*/ inJs ? undefined : (types === null || types === void 0 ? void 0 : types[i]) || ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */), /*initializer*/ undefined); parameters.push(newParameter); } @@ -160559,7 +161700,7 @@ var ts; if (someSigHasRestParameter) { var restParameter = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */), maxArgsParameterSymbolNames[maxNonRestArgs] || "rest", - /*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)), + /*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)), /*initializer*/ undefined); parameters.push(restParameter); } @@ -160587,15 +161728,6 @@ var ts; /*multiline*/ true); } codefix.createStubbedBody = createStubbedBody; - function createVisibilityModifier(flags) { - if (flags & 4 /* ModifierFlags.Public */) { - return ts.factory.createToken(123 /* SyntaxKind.PublicKeyword */); - } - else if (flags & 16 /* ModifierFlags.Protected */) { - return ts.factory.createToken(122 /* SyntaxKind.ProtectedKeyword */); - } - return undefined; - } function setJsonCompilerOptionValues(changeTracker, configFile, options) { var tsconfigObjectLiteral = ts.getTsConfigObjectLiteralExpression(configFile); if (!tsconfigObjectLiteral) @@ -160674,6 +161806,15 @@ var ts; symbols.forEach(function (s) { return importAdder.addImportFromExportedSymbol(s, /*isValidTypeOnlyUseSite*/ true); }); } codefix.importSymbols = importSymbols; + function findAncestorMatchingSpan(sourceFile, span) { + var end = ts.textSpanEnd(span); + var token = ts.getTokenAtPosition(sourceFile, span.start); + while (token.end < end) { + token = token.parent; + } + return token; + } + codefix.findAncestorMatchingSpan = findAncestorMatchingSpan; })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); /* @internal */ @@ -160696,13 +161837,13 @@ var ts; if (ts.isClassLike(container)) { var modifierFlags = ts.getEffectiveModifierFlags(declaration); if (ts.isSourceFileJS(file)) { - var modifiers = ts.createModifiers(modifierFlags); + var modifiers = ts.factory.createModifiersFromModifierFlags(modifierFlags); accessorModifiers = modifiers; fieldModifiers = modifiers; } else { - accessorModifiers = ts.createModifiers(prepareModifierFlagsForAccessor(modifierFlags)); - fieldModifiers = ts.createModifiers(prepareModifierFlagsForField(modifierFlags)); + accessorModifiers = ts.factory.createModifiersFromModifierFlags(prepareModifierFlagsForAccessor(modifierFlags)); + fieldModifiers = ts.factory.createModifiersFromModifierFlags(prepareModifierFlagsForField(modifierFlags)); } if (ts.canHaveDecorators(declaration)) { fieldModifiers = ts.concatenate(ts.getDecorators(declaration), fieldModifiers); @@ -160771,7 +161912,7 @@ var ts; error: ts.getLocaleSpecificMessage(ts.Diagnostics.Name_is_not_valid) }; } - if (((ts.getEffectiveModifierFlags(declaration) & 125951 /* ModifierFlags.Modifier */) | meaning) !== meaning) { + if (((ts.getEffectiveModifierFlags(declaration) & 126975 /* ModifierFlags.Modifier */) | meaning) !== meaning) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_property_with_modifier) }; @@ -160784,7 +161925,7 @@ var ts; isStatic: ts.hasStaticModifier(declaration), isReadonly: ts.hasEffectiveReadonlyModifier(declaration), type: getDeclarationType(declaration, program), - container: declaration.kind === 164 /* SyntaxKind.Parameter */ ? declaration.parent.parent : declaration.parent, + container: declaration.kind === 166 /* SyntaxKind.Parameter */ ? declaration.parent.parent : declaration.parent, originalName: declaration.name.text, declaration: declaration, fieldName: fieldName, @@ -160858,7 +161999,7 @@ var ts; var type = typeChecker.getTypeFromTypeNode(typeNode); if (!typeChecker.isTypeAssignableTo(typeChecker.getUndefinedType(), type)) { var types = ts.isUnionTypeNode(typeNode) ? typeNode.types : [typeNode]; - return ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], types, true), [ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)], false)); + return ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], types, true), [ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)], false)); } } return typeNode; @@ -160916,7 +162057,7 @@ var ts; }); function getActionsForUsageOfInvalidImport(context) { var sourceFile = context.sourceFile; - var targetKind = ts.Diagnostics.This_expression_is_not_callable.code === context.errorCode ? 208 /* SyntaxKind.CallExpression */ : 209 /* SyntaxKind.NewExpression */; + var targetKind = ts.Diagnostics.This_expression_is_not_callable.code === context.errorCode ? 210 /* SyntaxKind.CallExpression */ : 211 /* SyntaxKind.NewExpression */; var node = ts.findAncestor(ts.getTokenAtPosition(sourceFile, context.span.start), function (a) { return a.kind === targetKind; }); if (!node) { return []; @@ -161042,7 +162183,7 @@ var ts; return codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Add_undefined_type_to_property_0, info.prop.name.getText()], fixIdAddUndefinedType, ts.Diagnostics.Add_undefined_type_to_all_uninitialized_properties); } function addUndefinedType(changeTracker, sourceFile, info) { - var undefinedTypeNode = ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */); + var undefinedTypeNode = ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */); var types = ts.isUnionTypeNode(info.type) ? info.type.types.concat(undefinedTypeNode) : [info.type, undefinedTypeNode]; var unionTypeNode = ts.factory.createUnionTypeNode(types); if (info.isJs) { @@ -161088,7 +162229,7 @@ var ts; } else if (type.isClass()) { var classDeclaration = ts.getClassLikeDeclarationOfSymbol(type.symbol); - if (!classDeclaration || ts.hasSyntacticModifier(classDeclaration, 128 /* ModifierFlags.Abstract */)) + if (!classDeclaration || ts.hasSyntacticModifier(classDeclaration, 256 /* ModifierFlags.Abstract */)) return undefined; var constructorDeclaration = ts.getFirstConstructorWithBody(classDeclaration); if (constructorDeclaration && constructorDeclaration.parameters.length) @@ -161265,7 +162406,7 @@ var ts; function getImportTypeNode(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); ts.Debug.assert(token.kind === 100 /* SyntaxKind.ImportKeyword */, "This token should be an ImportKeyword"); - ts.Debug.assert(token.parent.kind === 200 /* SyntaxKind.ImportType */, "Token parent should be an ImportType"); + ts.Debug.assert(token.parent.kind === 202 /* SyntaxKind.ImportType */, "Token parent should be an ImportType"); return token.parent; } function doChange(changes, sourceFile, importType) { @@ -161394,7 +162535,7 @@ var ts; var otherMembers = members.filter(function (member) { return !ts.isIndexSignatureDeclaration(member); }); var parameter = ts.first(indexSignature.parameters); var mappedTypeParameter = ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.cast(parameter.name, ts.isIdentifier), parameter.type); - var mappedIntersectionType = ts.factory.createMappedTypeNode(ts.hasEffectiveReadonlyModifier(indexSignature) ? ts.factory.createModifier(145 /* SyntaxKind.ReadonlyKeyword */) : undefined, mappedTypeParameter, + var mappedIntersectionType = ts.factory.createMappedTypeNode(ts.hasEffectiveReadonlyModifier(indexSignature) ? ts.factory.createModifier(146 /* SyntaxKind.ReadonlyKeyword */) : undefined, mappedTypeParameter, /*nameType*/ undefined, indexSignature.questionToken, indexSignature.type, /*members*/ undefined); var intersectionType = ts.factory.createIntersectionTypeNode(__spreadArray(__spreadArray(__spreadArray([], ts.getAllSuperTypeNodes(container), true), [ @@ -161452,7 +162593,7 @@ var ts; }, }); function makeChange(changeTracker, sourceFile, span) { - var awaitKeyword = ts.tryCast(ts.getTokenAtPosition(sourceFile, span.start), function (node) { return node.kind === 132 /* SyntaxKind.AwaitKeyword */; }); + var awaitKeyword = ts.tryCast(ts.getTokenAtPosition(sourceFile, span.start), function (node) { return node.kind === 133 /* SyntaxKind.AwaitKeyword */; }); var awaitExpression = awaitKeyword && ts.tryCast(awaitKeyword.parent, ts.isAwaitExpression); if (!awaitExpression) { return; @@ -161519,28 +162660,45 @@ var ts; errorCodes: errorCodes, getCodeActions: function getCodeActionsToConvertConstToLet(context) { var sourceFile = context.sourceFile, span = context.span, program = context.program; - var range = getConstTokenRange(sourceFile, span.start, program); - if (range === undefined) + var info = getInfo(sourceFile, span.start, program); + if (info === undefined) return; - var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, range); }); - return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Convert_const_to_let, fixId, ts.Diagnostics.Convert_const_to_let)]; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, info.token); }); + return [codefix.createCodeFixActionMaybeFixAll(fixId, changes, ts.Diagnostics.Convert_const_to_let, fixId, ts.Diagnostics.Convert_all_const_to_let)]; + }, + getAllCodeActions: function (context) { + var program = context.program; + var seen = new ts.Map(); + return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, function (changes) { + codefix.eachDiagnostic(context, errorCodes, function (diag) { + var info = getInfo(diag.file, diag.start, program); + if (info) { + if (ts.addToSeen(seen, ts.getSymbolId(info.symbol))) { + return doChange(changes, diag.file, info.token); + } + } + return undefined; + }); + })); }, fixIds: [fixId] }); - function getConstTokenRange(sourceFile, pos, program) { + function getInfo(sourceFile, pos, program) { var _a; var checker = program.getTypeChecker(); var symbol = checker.getSymbolAtLocation(ts.getTokenAtPosition(sourceFile, pos)); + if (symbol === undefined) + return; var declaration = ts.tryCast((_a = symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.parent, ts.isVariableDeclarationList); if (declaration === undefined) return; var constToken = ts.findChildOfKind(declaration, 85 /* SyntaxKind.ConstKeyword */, sourceFile); if (constToken === undefined) return; - return ts.createRange(constToken.pos, constToken.end); + return { symbol: symbol, token: constToken }; } - function doChange(changes, sourceFile, range) { - changes.replaceRangeWithText(sourceFile, range, "let"); + function doChange(changes, sourceFile, token) { + changes.replaceNode(sourceFile, token, ts.factory.createToken(119 /* SyntaxKind.LetKeyword */)); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -161715,7 +162873,6 @@ var ts; return { edits: edits, renameFilename: undefined, renameLocation: undefined }; }, }); - ; function getInfo(context, considerPartialSpans) { if (considerPartialSpans === void 0) { considerPartialSpans = true; } var file = context.file, program = context.program; @@ -161727,8 +162884,8 @@ var ts; } var checker = program.getTypeChecker(); var exportingModuleSymbol = getExportingModuleSymbol(exportNode, checker); - var flags = ts.getSyntacticModifierFlags(exportNode) || ((ts.isExportAssignment(exportNode) && !exportNode.isExportEquals) ? 513 /* ModifierFlags.ExportDefault */ : 0 /* ModifierFlags.None */); - var wasDefault = !!(flags & 512 /* ModifierFlags.Default */); + var flags = ts.getSyntacticModifierFlags(exportNode) || ((ts.isExportAssignment(exportNode) && !exportNode.isExportEquals) ? 1025 /* ModifierFlags.ExportDefault */ : 0 /* ModifierFlags.None */); + var wasDefault = !!(flags & 1024 /* ModifierFlags.Default */); // If source file already has a default export, don't offer refactor. if (!(flags & 1 /* ModifierFlags.Export */) || !wasDefault && exportingModuleSymbol.exports.has("default" /* InternalSymbolName.Default */)) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.This_file_already_has_a_default_export) }; @@ -161738,19 +162895,19 @@ var ts; : { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_named_export) }; }; switch (exportNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: { var node = exportNode; if (!node.name) return undefined; return noSymbolError(node.name) || { exportNode: node, exportName: node.name, wasDefault: wasDefault, exportingModuleSymbol: exportingModuleSymbol }; } - case 237 /* SyntaxKind.VariableStatement */: { + case 240 /* SyntaxKind.VariableStatement */: { var vs = exportNode; // Must be `export const x = something;`. if (!(vs.declarationList.flags & 2 /* NodeFlags.Const */) || vs.declarationList.declarations.length !== 1) { @@ -161763,7 +162920,7 @@ var ts; return noSymbolError(decl.name) || { exportNode: vs, exportName: decl.name, wasDefault: wasDefault, exportingModuleSymbol: exportingModuleSymbol }; } - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var node = exportNode; if (node.isExportEquals) return undefined; @@ -161793,12 +162950,12 @@ var ts; else { var exportKeyword = ts.Debug.checkDefined(ts.findModifier(exportNode, 93 /* SyntaxKind.ExportKeyword */), "Should find an export keyword in modifier list"); switch (exportNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: changes.insertNodeAfter(exportingSourceFile, exportKeyword, ts.factory.createToken(88 /* SyntaxKind.DefaultKeyword */)); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // If 'x' isn't used in this file and doesn't have type definition, `export const x = 0;` --> `export default 0;` var decl = ts.first(exportNode.declarationList.declarations); if (!ts.FindAllReferences.Core.isSymbolReferencedInFile(exportName, checker, exportingSourceFile) && !decl.type) { @@ -161807,9 +162964,9 @@ var ts; break; } // falls through - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // `export type T = number;` -> `type T = number; export default T;` changes.deleteModifier(exportingSourceFile, exportKeyword); changes.insertNodeAfter(exportingSourceFile, exportNode, ts.factory.createExportDefault(ts.factory.createIdentifier(exportName.text))); @@ -161838,18 +162995,18 @@ var ts; function changeDefaultToNamedImport(importingSourceFile, ref, changes, exportName) { var parent = ref.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // `a.default` --> `a.foo` changes.replaceNode(importingSourceFile, ref, ts.factory.createIdentifier(exportName)); break; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: { + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: { var spec = parent; // `default as foo` --> `foo`, `default as bar` --> `foo as bar` changes.replaceNode(importingSourceFile, spec, makeImportSpecifier(exportName, spec.name.text)); break; } - case 267 /* SyntaxKind.ImportClause */: { + case 270 /* SyntaxKind.ImportClause */: { var clause = parent; ts.Debug.assert(clause.name === ref, "Import clause name should match provided ref"); var spec = makeImportSpecifier(exportName, ref.text); @@ -161858,7 +163015,7 @@ var ts; // `import foo from "./a";` --> `import { foo } from "./a";` changes.replaceNode(importingSourceFile, ref, ts.factory.createNamedImports([spec])); } - else if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + else if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { // `import foo, * as a from "./a";` --> `import * as a from ".a/"; import { foo } from "./a";` changes.deleteRange(importingSourceFile, { pos: ref.getStart(importingSourceFile), end: namedBindings.getStart(importingSourceFile) }); var quotePreference = ts.isStringLiteral(clause.parent.moduleSpecifier) ? ts.quotePreferenceFromString(clause.parent.moduleSpecifier, importingSourceFile) : 1 /* QuotePreference.Double */; @@ -161872,7 +163029,7 @@ var ts; } break; } - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: var importTypeNode = parent; changes.replaceNode(importingSourceFile, parent, ts.factory.createImportTypeNode(importTypeNode.argument, importTypeNode.assertions, ts.factory.createIdentifier(exportName), importTypeNode.typeArguments, importTypeNode.isTypeOf)); break; @@ -161883,11 +163040,11 @@ var ts; function changeNamedToDefaultImport(importingSourceFile, ref, changes) { var parent = ref.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // `a.foo` --> `a.default` changes.replaceNode(importingSourceFile, ref, ts.factory.createIdentifier("default")); break; - case 270 /* SyntaxKind.ImportSpecifier */: { + case 273 /* SyntaxKind.ImportSpecifier */: { // `import { foo } from "./a";` --> `import foo from "./a";` // `import { foo as bar } from "./a";` --> `import bar from "./a";` var defaultImport = ts.factory.createIdentifier(parent.name.text); @@ -161900,7 +163057,7 @@ var ts; } break; } - case 275 /* SyntaxKind.ExportSpecifier */: { + case 278 /* SyntaxKind.ExportSpecifier */: { // `export { foo } from "./a";` --> `export { default as foo } from "./a";` // `export { foo as bar } from "./a";` --> `export { default as bar } from "./a";` // `export { foo as default } from "./a";` --> `export { default } from "./a";` @@ -162001,7 +163158,7 @@ var ts; if (!importClause.namedBindings) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_namespace_import_or_named_imports) }; } - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { return { convertTo: 0 /* ImportKind.Named */, import: importClause.namedBindings }; } var shouldUseDefault = getShouldUseDefault(context.program, importClause); @@ -162192,7 +163349,6 @@ var ts; }); return { edits: edits, renameFilename: undefined, renameLocation: undefined }; } - ; function isValidExpression(node) { return ts.isBinaryExpression(node) || ts.isConditionalExpression(node); } @@ -162240,7 +163396,6 @@ var ts; if (expression.operatorToken.kind !== 55 /* SyntaxKind.AmpersandAmpersandToken */) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_logical_AND_access_chains) }; } - ; var finalExpression = getFinalExpressionInChain(expression.right); if (!finalExpression) return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_convertible_access_expression) }; @@ -162450,27 +163605,27 @@ var ts; var lastDeclaration = signatureDecls[signatureDecls.length - 1]; var updated = lastDeclaration; switch (lastDeclaration.kind) { - case 168 /* SyntaxKind.MethodSignature */: { + case 170 /* SyntaxKind.MethodSignature */: { updated = ts.factory.updateMethodSignature(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.name, lastDeclaration.questionToken, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 169 /* SyntaxKind.MethodDeclaration */: { + case 171 /* SyntaxKind.MethodDeclaration */: { updated = ts.factory.updateMethodDeclaration(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.asteriskToken, lastDeclaration.name, lastDeclaration.questionToken, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type, lastDeclaration.body); break; } - case 174 /* SyntaxKind.CallSignature */: { + case 176 /* SyntaxKind.CallSignature */: { updated = ts.factory.updateCallSignature(lastDeclaration, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 171 /* SyntaxKind.Constructor */: { + case 173 /* SyntaxKind.Constructor */: { updated = ts.factory.updateConstructorDeclaration(lastDeclaration, lastDeclaration.modifiers, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.body); break; } - case 175 /* SyntaxKind.ConstructSignature */: { + case 177 /* SyntaxKind.ConstructSignature */: { updated = ts.factory.updateConstructSignature(lastDeclaration, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { updated = ts.factory.updateFunctionDeclaration(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.asteriskToken, lastDeclaration.name, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type, lastDeclaration.body); break; } @@ -162501,7 +163656,7 @@ var ts; } function convertParameterToNamedTupleMember(p) { ts.Debug.assert(ts.isIdentifier(p.name)); // This is checked during refactoring applicability checking - var result = ts.setTextRange(ts.factory.createNamedTupleMember(p.dotDotDotToken, p.name, p.questionToken, p.type || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)), p); + var result = ts.setTextRange(ts.factory.createNamedTupleMember(p.dotDotDotToken, p.name, p.questionToken, p.type || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)), p); var parameterDocComment = p.symbol && p.symbol.getDocumentationComment(checker); if (parameterDocComment) { var newComment = ts.displayPartsToString(parameterDocComment); @@ -162521,12 +163676,12 @@ var ts; } function isConvertableSignatureDeclaration(d) { switch (d.kind) { - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 174 /* SyntaxKind.CallSignature */: - case 171 /* SyntaxKind.Constructor */: - case 175 /* SyntaxKind.ConstructSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 176 /* SyntaxKind.CallSignature */: + case 173 /* SyntaxKind.Constructor */: + case 177 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: return true; } return false; @@ -162921,20 +164076,20 @@ var ts; function checkForStaticContext(nodeToCheck, containingClass) { var current = nodeToCheck; while (current !== containingClass) { - if (current.kind === 167 /* SyntaxKind.PropertyDeclaration */) { + if (current.kind === 169 /* SyntaxKind.PropertyDeclaration */) { if (ts.isStatic(current)) { rangeFacts |= RangeFacts.InStaticRegion; } break; } - else if (current.kind === 164 /* SyntaxKind.Parameter */) { + else if (current.kind === 166 /* SyntaxKind.Parameter */) { var ctorOrMethod = ts.getContainingFunction(current); - if (ctorOrMethod.kind === 171 /* SyntaxKind.Constructor */) { + if (ctorOrMethod.kind === 173 /* SyntaxKind.Constructor */) { rangeFacts |= RangeFacts.InStaticRegion; } break; } - else if (current.kind === 169 /* SyntaxKind.MethodDeclaration */) { + else if (current.kind === 171 /* SyntaxKind.MethodDeclaration */) { if (ts.isStatic(current)) { rangeFacts |= RangeFacts.InStaticRegion; } @@ -162972,9 +164127,9 @@ var ts; visit(nodeToCheck); if (rangeFacts & RangeFacts.UsesThis) { var container = ts.getThisContainer(nodeToCheck, /** includeArrowFunctions */ false); - if (container.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) || - container.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (container.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) || + container.kind === 215 /* SyntaxKind.FunctionExpression */) { rangeFacts |= RangeFacts.UsesThisInFunction; } } @@ -162985,7 +164140,7 @@ var ts; return true; } if (ts.isDeclaration(node)) { - var declaringNode = (node.kind === 254 /* SyntaxKind.VariableDeclaration */) ? node.parent.parent : node; + var declaringNode = (node.kind === 257 /* SyntaxKind.VariableDeclaration */) ? node.parent.parent : node; if (ts.hasSyntacticModifier(declaringNode, 1 /* ModifierFlags.Export */)) { // TODO: GH#18217 Silly to use `errors ||` since it's definitely not defined (see top of `visit`) // Also, if we're only pushing one error, just use `let error: Diagnostic | undefined`! @@ -162997,16 +164152,16 @@ var ts; } // Some things can't be extracted in certain situations switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractImport)); return true; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractExportedEntity)); return true; case 106 /* SyntaxKind.SuperKeyword */: // For a super *constructor call*, we have to be extracting the entire class, // but a super *method call* simply implies a 'this' reference - if (node.parent.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.parent.kind === 210 /* SyntaxKind.CallExpression */) { // Super constructor call var containingClass_1 = ts.getContainingClass(node); if (containingClass_1 === undefined || containingClass_1.pos < span.start || containingClass_1.end >= (span.start + span.length)) { @@ -163019,7 +164174,7 @@ var ts; thisNode = node; } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // check if arrow function uses this ts.forEachChild(node, function check(n) { if (ts.isThis(n)) { @@ -163034,39 +164189,39 @@ var ts; } }); // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.isSourceFile(node.parent) && node.parent.externalModuleIndicator === undefined) { // You cannot extract global declarations (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.functionWillNotBeVisibleInTheNewScope)); } // falls through - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // do not dive into functions or classes return false; } var savedPermittedJumps = permittedJumps; switch (node.kind) { - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: permittedJumps &= ~4 /* PermittedJumps.Return */; break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // forbid all jumps inside try blocks permittedJumps = 0 /* PermittedJumps.None */; break; - case 235 /* SyntaxKind.Block */: - if (node.parent && node.parent.kind === 252 /* SyntaxKind.TryStatement */ && node.parent.finallyBlock === node) { + case 238 /* SyntaxKind.Block */: + if (node.parent && node.parent.kind === 255 /* SyntaxKind.TryStatement */ && node.parent.finallyBlock === node) { // allow unconditional returns from finally blocks permittedJumps = 4 /* PermittedJumps.Return */; } break; - case 290 /* SyntaxKind.DefaultClause */: - case 289 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: // allow unlabeled break inside case clauses permittedJumps |= 1 /* PermittedJumps.Break */; break; @@ -163078,20 +164233,20 @@ var ts; break; } switch (node.kind) { - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 108 /* SyntaxKind.ThisKeyword */: rangeFacts |= RangeFacts.UsesThis; thisNode = node; break; - case 250 /* SyntaxKind.LabeledStatement */: { + case 253 /* SyntaxKind.LabeledStatement */: { var label = node.label; (seenLabels || (seenLabels = [])).push(label.escapedText); ts.forEachChild(node, visit); seenLabels.pop(); break; } - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: { + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: { var label = node.label; if (label) { if (!ts.contains(seenLabels, label.escapedText)) { @@ -163100,20 +164255,20 @@ var ts; } } else { - if (!(permittedJumps & (node.kind === 246 /* SyntaxKind.BreakStatement */ ? 1 /* PermittedJumps.Break */ : 2 /* PermittedJumps.Continue */))) { + if (!(permittedJumps & (node.kind === 249 /* SyntaxKind.BreakStatement */ ? 1 /* PermittedJumps.Break */ : 2 /* PermittedJumps.Continue */))) { // attempt to break or continue in a forbidden context (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractRangeContainingConditionalBreakOrContinueStatements)); } } break; } - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: rangeFacts |= RangeFacts.IsAsyncFunction; break; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: rangeFacts |= RangeFacts.IsGenerator; break; - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: if (permittedJumps & 4 /* PermittedJumps.Return */) { rangeFacts |= RangeFacts.HasReturn; } @@ -163183,7 +164338,7 @@ var ts; while (true) { current = current.parent; // A function parameter's initializer is actually in the outer scope, not the function declaration - if (current.kind === 164 /* SyntaxKind.Parameter */) { + if (current.kind === 166 /* SyntaxKind.Parameter */) { // Skip all the way to the outer scope of the function that declared this parameter current = ts.findAncestor(current, function (parent) { return ts.isFunctionLikeDeclaration(parent); }).parent; } @@ -163194,7 +164349,7 @@ var ts; // * Module/namespace or source file if (isScope(current)) { scopes.push(current); - if (current.kind === 305 /* SyntaxKind.SourceFile */) { + if (current.kind === 308 /* SyntaxKind.SourceFile */) { return scopes; } } @@ -163284,32 +164439,32 @@ var ts; } function getDescriptionForFunctionLikeDeclaration(scope) { switch (scope.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "constructor"; - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return scope.name ? "function '".concat(scope.name.text, "'") : ts.ANONYMOUS; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return "arrow function"; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return "method '".concat(scope.name.getText(), "'"); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return "'get ".concat(scope.name.getText(), "'"); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return "'set ".concat(scope.name.getText(), "'"); default: throw ts.Debug.assertNever(scope, "Unexpected scope kind ".concat(scope.kind)); } } function getDescriptionForClassLikeDeclaration(scope) { - return scope.kind === 257 /* SyntaxKind.ClassDeclaration */ + return scope.kind === 260 /* SyntaxKind.ClassDeclaration */ ? scope.name ? "class '".concat(scope.name.text, "'") : "anonymous class declaration" : scope.name ? "class expression '".concat(scope.name.text, "'") : "anonymous class expression"; } function getDescriptionForModuleLikeDeclaration(scope) { - return scope.kind === 262 /* SyntaxKind.ModuleBlock */ + return scope.kind === 265 /* SyntaxKind.ModuleBlock */ ? "namespace '".concat(scope.parent.name.getText(), "'") : scope.externalModuleIndicator ? 0 /* SpecialScope.Module */ : 1 /* SpecialScope.Global */; } @@ -163382,7 +164537,7 @@ var ts; modifiers.push(ts.factory.createModifier(124 /* SyntaxKind.StaticKeyword */)); } if (range.facts & RangeFacts.IsAsyncFunction) { - modifiers.push(ts.factory.createModifier(131 /* SyntaxKind.AsyncKeyword */)); + modifiers.push(ts.factory.createModifier(132 /* SyntaxKind.AsyncKeyword */)); } newFunction = ts.factory.createMethodDeclaration(modifiers.length ? modifiers : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, /*questionToken*/ undefined, typeParameters, parameters, returnType, body); @@ -163396,7 +164551,7 @@ var ts; /*questionToken*/ undefined, checker.typeToTypeNode(checker.getTypeAtLocation(range.thisNode), scope, 1 /* NodeBuilderFlags.NoTruncation */), /*initializer*/ undefined)); } - newFunction = ts.factory.createFunctionDeclaration(range.facts & RangeFacts.IsAsyncFunction ? [ts.factory.createToken(131 /* SyntaxKind.AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body); + newFunction = ts.factory.createFunctionDeclaration(range.facts & RangeFacts.IsAsyncFunction ? [ts.factory.createToken(132 /* SyntaxKind.AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body); } var changeTracker = ts.textChanges.ChangeTracker.fromContext(context); var minInsertionPos = (isReadonlyArray(range.range) ? ts.last(range.range) : range.range).end; @@ -163544,9 +164699,9 @@ var ts; while (ts.isParenthesizedTypeNode(withoutParens)) { withoutParens = withoutParens.type; } - return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 153 /* SyntaxKind.UndefinedKeyword */; }) + return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 155 /* SyntaxKind.UndefinedKeyword */; }) ? clone - : ts.factory.createUnionTypeNode([clone, ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)]); + : ts.factory.createUnionTypeNode([clone, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)]); } } /** @@ -163577,7 +164732,7 @@ var ts; if (rangeFacts & RangeFacts.InStaticRegion) { modifiers.push(ts.factory.createModifier(124 /* SyntaxKind.StaticKeyword */)); } - modifiers.push(ts.factory.createModifier(145 /* SyntaxKind.ReadonlyKeyword */)); + modifiers.push(ts.factory.createModifier(146 /* SyntaxKind.ReadonlyKeyword */)); var newVariable = ts.factory.createPropertyDeclaration(modifiers, localNameText, /*questionToken*/ undefined, variableType, initializer); var localReference = ts.factory.createPropertyAccessExpression(rangeFacts & RangeFacts.InStaticRegion @@ -163608,7 +164763,7 @@ var ts; var localReference = ts.factory.createIdentifier(localNameText); changeTracker.replaceNode(context.file, node, localReference); } - else if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) { + else if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) { // If the parent is an expression statement and the target scope is the immediately enclosing one, // replace the statement with the declaration. var newVariableStatement = ts.factory.createVariableStatement( @@ -163627,7 +164782,7 @@ var ts; changeTracker.insertNodeBefore(context.file, nodeToInsertBefore, newVariableStatement, /*blankLineBetween*/ false); } // Consume - if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */) { + if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */) { // If the parent is an expression statement, delete it. changeTracker.delete(context.file, node.parent); } @@ -164273,30 +165428,30 @@ var ts; function isExtractableExpression(node) { var parent = node.parent; switch (parent.kind) { - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return false; } switch (node.kind) { case 10 /* SyntaxKind.StringLiteral */: - return parent.kind !== 266 /* SyntaxKind.ImportDeclaration */ && - parent.kind !== 270 /* SyntaxKind.ImportSpecifier */; - case 225 /* SyntaxKind.SpreadElement */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 203 /* SyntaxKind.BindingElement */: + return parent.kind !== 269 /* SyntaxKind.ImportDeclaration */ && + parent.kind !== 273 /* SyntaxKind.ImportSpecifier */; + case 227 /* SyntaxKind.SpreadElement */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 205 /* SyntaxKind.BindingElement */: return false; case 79 /* SyntaxKind.Identifier */: - return parent.kind !== 203 /* SyntaxKind.BindingElement */ && - parent.kind !== 270 /* SyntaxKind.ImportSpecifier */ && - parent.kind !== 275 /* SyntaxKind.ExportSpecifier */; + return parent.kind !== 205 /* SyntaxKind.BindingElement */ && + parent.kind !== 273 /* SyntaxKind.ImportSpecifier */ && + parent.kind !== 278 /* SyntaxKind.ExportSpecifier */; } return true; } function isBlockLike(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 305 /* SyntaxKind.SourceFile */: - case 262 /* SyntaxKind.ModuleBlock */: - case 289 /* SyntaxKind.CaseClause */: + case 238 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 265 /* SyntaxKind.ModuleBlock */: + case 292 /* SyntaxKind.CaseClause */: return true; default: return false; @@ -164584,7 +165739,6 @@ var ts; (function (ts) { var refactor; (function (refactor) { - ; /** * Checks if some refactor info has refactor error info. */ @@ -164689,15 +165843,14 @@ var ts; // Imports will be copied to the new file anyway, and may still be needed in the old file. // Prologue directives will be copied to the new file and should be left in the old file. return !isPureImport(statement) && !ts.isPrologueDirective(statement); - ; } function isPureImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return true; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return !ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return node.declarationList.declarations.every(function (d) { return !!d.initializer && ts.isRequireCall(d.initializer, /*checkArgumentIsStringLiteralLike*/ true); }); default: return false; @@ -164793,12 +165946,12 @@ var ts; } function getNamespaceLikeImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? + case 269 /* SyntaxKind.ImportDeclaration */: + return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? node.importClause.namedBindings.name : undefined; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.name; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.tryCast(node.name, ts.isIdentifier); default: return ts.Debug.assertNever(node, "Unexpected node kind ".concat(node.kind)); @@ -164829,21 +165982,21 @@ var ts; var newNamespaceId = ts.factory.createIdentifier(newNamespaceName); var newModuleString = ts.factory.createStringLiteral(newModuleSpecifier); switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, /*name*/ undefined, ts.factory.createNamespaceImport(newNamespaceId)), newModuleString, /*assertClause*/ undefined); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.factory.createImportEqualsDeclaration(/*modifiers*/ undefined, /*isTypeOnly*/ false, newNamespaceId, ts.factory.createExternalModuleReference(newModuleString)); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.factory.createVariableDeclaration(newNamespaceId, /*exclamationToken*/ undefined, /*type*/ undefined, createRequireCall(newModuleString)); default: return ts.Debug.assertNever(node, "Unexpected node kind ".concat(node.kind)); } } function moduleSpecifierFromImport(i) { - return (i.kind === 266 /* SyntaxKind.ImportDeclaration */ ? i.moduleSpecifier - : i.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ ? i.moduleReference.expression + return (i.kind === 269 /* SyntaxKind.ImportDeclaration */ ? i.moduleSpecifier + : i.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? i.moduleReference.expression : i.initializer.arguments[0]); } function forEachImportInStatement(statement, cb) { @@ -164913,15 +166066,15 @@ var ts; } function deleteUnusedImports(sourceFile, importDecl, changes, isUnused) { switch (importDecl.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: deleteUnusedImportsInDeclaration(sourceFile, importDecl, changes, isUnused); break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: if (isUnused(importDecl.name)) { changes.delete(sourceFile, importDecl); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: deleteUnusedImportsInVariableDeclaration(sourceFile, importDecl, changes, isUnused); break; default: @@ -164934,7 +166087,7 @@ var ts; var _a = importDecl.importClause, name = _a.name, namedBindings = _a.namedBindings; var defaultUnused = !name || isUnused(name); var namedBindingsUnused = !namedBindings || - (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); })); + (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); })); if (defaultUnused && namedBindingsUnused) { changes.delete(sourceFile, importDecl); } @@ -164946,7 +166099,7 @@ var ts; if (namedBindingsUnused) { changes.replaceNode(sourceFile, importDecl.importClause, ts.factory.updateImportClause(importDecl.importClause, importDecl.importClause.isTypeOnly, name, /*namedBindings*/ undefined)); } - else if (namedBindings.kind === 269 /* SyntaxKind.NamedImports */) { + else if (namedBindings.kind === 272 /* SyntaxKind.NamedImports */) { for (var _i = 0, _b = namedBindings.elements; _i < _b.length; _i++) { var element = _b[_i]; if (isUnused(element.name)) @@ -164964,9 +166117,9 @@ var ts; changes.delete(sourceFile, name); } break; - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: break; - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: if (name.elements.every(function (e) { return ts.isIdentifier(e.name) && isUnused(e.name); })) { changes.delete(sourceFile, ts.isVariableDeclarationList(varDecl.parent) && varDecl.parent.declarations.length === 1 ? varDecl.parent.parent : varDecl); } @@ -165008,7 +166161,7 @@ var ts; if (markSeenTop(top)) { addExportToChanges(oldFile, top, name, changes, useEsModuleSyntax); } - if (ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */)) { oldFileDefault = name; } else { @@ -165096,14 +166249,14 @@ var ts; // Below should all be utilities function isInImport(decl) { switch (decl.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return isVariableDeclarationInImport(decl); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return ts.isVariableDeclaration(decl.parent.parent) && isVariableDeclarationInImport(decl.parent.parent); default: return false; @@ -165115,7 +166268,7 @@ var ts; } function filterImport(i, moduleSpecifier, keep) { switch (i.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: { + case 269 /* SyntaxKind.ImportDeclaration */: { var clause = i.importClause; if (!clause) return undefined; @@ -165125,9 +166278,9 @@ var ts; ? ts.factory.createImportDeclaration(/*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, defaultImport, namedBindings), moduleSpecifier, /*assertClause*/ undefined) : undefined; } - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return keep(i.name) ? i : undefined; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var name = filterBindingName(i.name, keep); return name ? makeVariableStatement(name, i.type, createRequireCall(moduleSpecifier), i.parent.flags) : undefined; } @@ -165136,7 +166289,7 @@ var ts; } } function filterNamedBindings(namedBindings, keep) { - if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { return keep(namedBindings.name) ? namedBindings : undefined; } else { @@ -165148,9 +166301,9 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return keep(name) ? name : undefined; - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return name; - case 201 /* SyntaxKind.ObjectBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: { // We can't handle nested destructurings or property names well here, so just copy them all. var newElements = name.elements.filter(function (prop) { return prop.propertyName || !ts.isIdentifier(prop.name) || keep(prop.name); }); return newElements.length ? ts.factory.createObjectBindingPattern(newElements) : undefined; @@ -165207,13 +166360,13 @@ var ts; } function isNonVariableTopLevelDeclaration(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return true; default: return false; @@ -165221,17 +166374,17 @@ var ts; } function forEachTopLevelDeclaration(statement, cb) { switch (statement.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return cb(statement); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.firstDefined(statement.declarationList.declarations, function (decl) { return forEachTopLevelDeclarationInBindingName(decl.name, cb); }); - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; return ts.isBinaryExpression(expression) && ts.getAssignmentDeclarationKind(expression) === 1 /* AssignmentDeclarationKind.ExportsProperty */ ? cb(statement) @@ -165243,8 +166396,8 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return cb(ts.cast(name.parent, function (x) { return ts.isVariableDeclaration(x) || ts.isBindingElement(x); })); - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return ts.firstDefined(name.elements, function (em) { return ts.isOmittedExpression(em) ? undefined : forEachTopLevelDeclarationInBindingName(em.name, cb); }); default: return ts.Debug.assertNever(name, "Unexpected name kind ".concat(name.kind)); @@ -165255,9 +166408,9 @@ var ts; } function getTopLevelDeclarationStatement(d) { switch (d.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return d.parent.parent; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getTopLevelDeclarationStatement(ts.cast(d.parent.parent, function (p) { return ts.isVariableDeclaration(p) || ts.isBindingElement(p); })); default: return d; @@ -165289,24 +166442,24 @@ var ts; function addEs6Export(d) { var modifiers = ts.canHaveModifiers(d) ? ts.concatenate([ts.factory.createModifier(93 /* SyntaxKind.ExportKeyword */)], ts.getModifiers(d)) : undefined; switch (d.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return ts.factory.updateFunctionDeclaration(d, modifiers, d.asteriskToken, d.name, d.typeParameters, d.parameters, d.type, d.body); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var decorators = ts.canHaveDecorators(d) ? ts.getDecorators(d) : undefined; return ts.factory.updateClassDeclaration(d, ts.concatenate(decorators, modifiers), d.name, d.typeParameters, d.heritageClauses, d.members); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.factory.updateVariableStatement(d, modifiers, d.declarationList); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.factory.updateModuleDeclaration(d, modifiers, d.name, d.body); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.factory.updateEnumDeclaration(d, modifiers, d.name, d.members); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return ts.factory.updateTypeAliasDeclaration(d, modifiers, d.name, d.typeParameters, d.type); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.factory.updateInterfaceDeclaration(d, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.factory.updateImportEqualsDeclaration(d, modifiers, d.isTypeOnly, d.name, d.moduleReference); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.Debug.fail(); // Shouldn't try to add 'export' keyword to `exports.x = ...` default: return ts.Debug.assertNever(d, "Unexpected declaration kind ".concat(d.kind)); @@ -165317,18 +166470,18 @@ var ts; } function getNamesToExportInCommonJS(decl) { switch (decl.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return [decl.name.text]; // TODO: GH#18217 - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.mapDefined(decl.declarationList.declarations, function (d) { return ts.isIdentifier(d.name) ? d.name.text : undefined; }); - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.emptyArray; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.Debug.fail("Can't export an ExpressionStatement"); // Shouldn't try to add 'export' keyword to `exports.x = ...` default: return ts.Debug.assertNever(decl, "Unexpected decl kind ".concat(decl.kind)); @@ -165669,15 +166822,15 @@ var ts; var parent = functionReference.parent; switch (parent.kind) { // foo(...) or super(...) or new Foo(...) - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: var callOrNewExpression = ts.tryCast(parent, ts.isCallOrNewExpression); if (callOrNewExpression && callOrNewExpression.expression === functionReference) { return callOrNewExpression; } break; // x.foo(...) - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression); if (propertyAccessExpression && propertyAccessExpression.parent && propertyAccessExpression.name === functionReference) { var callOrNewExpression_1 = ts.tryCast(propertyAccessExpression.parent, ts.isCallOrNewExpression); @@ -165687,7 +166840,7 @@ var ts; } break; // x["foo"](...) - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression); if (elementAccessExpression && elementAccessExpression.parent && elementAccessExpression.argumentExpression === functionReference) { var callOrNewExpression_2 = ts.tryCast(elementAccessExpression.parent, ts.isCallOrNewExpression); @@ -165706,14 +166859,14 @@ var ts; var parent = reference.parent; switch (parent.kind) { // `C.foo` - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression); if (propertyAccessExpression && propertyAccessExpression.expression === reference) { return propertyAccessExpression; } break; // `C["foo"]` - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression); if (elementAccessExpression && elementAccessExpression.expression === reference) { return elementAccessExpression; @@ -165759,16 +166912,16 @@ var ts; if (!isValidParameterNodeArray(functionDeclaration.parameters, checker)) return false; switch (functionDeclaration.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return hasNameOrDefault(functionDeclaration) && isSingleImplementation(functionDeclaration, checker); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: if (ts.isObjectLiteralExpression(functionDeclaration.parent)) { var contextualSymbol = getSymbolForContextualType(functionDeclaration.name, checker); // don't offer the refactor when there are multiple signatures since we won't know which ones the user wants to change return ((_a = contextualSymbol === null || contextualSymbol === void 0 ? void 0 : contextualSymbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 && isSingleImplementation(functionDeclaration, checker); } return isSingleImplementation(functionDeclaration, checker); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: if (ts.isClassDeclaration(functionDeclaration.parent)) { return hasNameOrDefault(functionDeclaration.parent) && isSingleImplementation(functionDeclaration, checker); } @@ -165776,8 +166929,8 @@ var ts; return isValidVariableDeclaration(functionDeclaration.parent.parent) && isSingleImplementation(functionDeclaration, checker); } - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return isValidVariableDeclaration(functionDeclaration.parent); } return false; @@ -165925,7 +167078,7 @@ var ts; } function getClassNames(constructorDeclaration) { switch (constructorDeclaration.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var classDeclaration = constructorDeclaration.parent; if (classDeclaration.name) return [classDeclaration.name]; @@ -165933,7 +167086,7 @@ var ts; // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault` var defaultModifier = ts.Debug.checkDefined(ts.findModifier(classDeclaration, 88 /* SyntaxKind.DefaultKeyword */), "Nameless class declaration should be a default export"); return [defaultModifier]; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: var classExpression = constructorDeclaration.parent; var variableDeclaration = constructorDeclaration.parent.parent; var className = classExpression.name; @@ -165944,25 +167097,25 @@ var ts; } function getFunctionNames(functionDeclaration) { switch (functionDeclaration.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (functionDeclaration.name) return [functionDeclaration.name]; // If the function declaration doesn't have a name, it should have a default modifier. // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault` var defaultModifier = ts.Debug.checkDefined(ts.findModifier(functionDeclaration, 88 /* SyntaxKind.DefaultKeyword */), "Nameless function declaration should be a default export"); return [defaultModifier]; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return [functionDeclaration.name]; - case 171 /* SyntaxKind.Constructor */: - var ctrKeyword = ts.Debug.checkDefined(ts.findChildOfKind(functionDeclaration, 134 /* SyntaxKind.ConstructorKeyword */, functionDeclaration.getSourceFile()), "Constructor declaration should have constructor keyword"); - if (functionDeclaration.parent.kind === 226 /* SyntaxKind.ClassExpression */) { + case 173 /* SyntaxKind.Constructor */: + var ctrKeyword = ts.Debug.checkDefined(ts.findChildOfKind(functionDeclaration, 135 /* SyntaxKind.ConstructorKeyword */, functionDeclaration.getSourceFile()), "Constructor declaration should have constructor keyword"); + if (functionDeclaration.parent.kind === 228 /* SyntaxKind.ClassExpression */) { var variableDeclaration = functionDeclaration.parent.parent; return [variableDeclaration.name, ctrKeyword]; } return [ctrKeyword]; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return [functionDeclaration.parent.name]; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (functionDeclaration.name) return [functionDeclaration.name, functionDeclaration.parent.name]; return [functionDeclaration.parent.name]; @@ -166053,11 +167206,11 @@ var ts; function getParentBinaryExpression(expr) { var container = ts.findAncestor(expr.parent, function (n) { switch (n.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return false; - case 223 /* SyntaxKind.TemplateExpression */: - case 221 /* SyntaxKind.BinaryExpression */: + case 225 /* SyntaxKind.TemplateExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return !(ts.isBinaryExpression(n.parent) && isNotEqualsOperator(n.parent)); default: return "quit"; @@ -166505,10 +167658,10 @@ var ts; } function isConvertibleDeclaration(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: return true; default: return false; @@ -166553,7 +167706,7 @@ var ts; this.kind = kind; } NodeObject.prototype.assertHasRealPosition = function (message) { - // eslint-disable-next-line debug-assert + // eslint-disable-next-line local/debug-assert ts.Debug.assert(!ts.positionIsSynthesized(this.pos) && !ts.positionIsSynthesized(this.end), message || "Node must have a real position for this operation"); }; NodeObject.prototype.getSourceFile = function () { @@ -166610,8 +167763,8 @@ var ts; if (!children.length) { return undefined; } - var child = ts.find(children, function (kid) { return kid.kind < 309 /* SyntaxKind.FirstJSDocNode */ || kid.kind > 347 /* SyntaxKind.LastJSDocNode */; }); - return child.kind < 161 /* SyntaxKind.FirstNode */ ? + var child = ts.find(children, function (kid) { return kid.kind < 312 /* SyntaxKind.FirstJSDocNode */ || kid.kind > 350 /* SyntaxKind.LastJSDocNode */; }); + return child.kind < 163 /* SyntaxKind.FirstNode */ ? child : child.getFirstToken(sourceFile); }; @@ -166622,7 +167775,7 @@ var ts; if (!child) { return undefined; } - return child.kind < 161 /* SyntaxKind.FirstNode */ ? child : child.getLastToken(sourceFile); + return child.kind < 163 /* SyntaxKind.FirstNode */ ? child : child.getLastToken(sourceFile); }; NodeObject.prototype.forEachChild = function (cbNode, cbNodeArray) { return ts.forEachChild(this, cbNode, cbNodeArray); @@ -166682,7 +167835,7 @@ var ts; } } function createSyntaxList(nodes, parent) { - var list = createNode(348 /* SyntaxKind.SyntaxList */, nodes.pos, nodes.end, parent); + var list = createNode(351 /* SyntaxKind.SyntaxList */, nodes.pos, nodes.end, parent); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { @@ -167031,7 +168184,7 @@ var ts; var _a; if (!seenSymbols_1.has(symbol)) { seenSymbols_1.add(symbol); - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) { return symbol.getContextualJsDocTags(declaration, checker); } return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 ? symbol.getJsDocTags() : undefined; @@ -167058,7 +168211,7 @@ var ts; var inheritedDocs = findBaseOfDeclaration(checker, declaration, function (symbol) { if (!seenSymbols_2.has(symbol)) { seenSymbols_2.add(symbol); - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) { return symbol.getContextualDocumentationComment(declaration, checker); } return symbol.getDocumentationComment(checker); @@ -167077,7 +168230,7 @@ var ts; } function findBaseOfDeclaration(checker, declaration, cb) { var _a; - var classOrInterfaceDeclaration = ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.kind) === 171 /* SyntaxKind.Constructor */ ? declaration.parent.parent : declaration.parent; + var classOrInterfaceDeclaration = ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.kind) === 173 /* SyntaxKind.Constructor */ ? declaration.parent.parent : declaration.parent; if (!classOrInterfaceDeclaration) return; var isStaticMember = ts.hasStaticModifier(declaration); @@ -167092,7 +168245,7 @@ var ts; __extends(SourceFileObject, _super); function SourceFileObject(kind, pos, end) { var _this = _super.call(this, kind, pos, end) || this; - _this.kind = 305 /* SyntaxKind.SourceFile */; + _this.kind = 308 /* SyntaxKind.SourceFile */; return _this; } SourceFileObject.prototype.update = function (newText, textChangeRange) { @@ -167151,10 +168304,10 @@ var ts; } function visit(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -167174,31 +168327,31 @@ var ts; } ts.forEachChild(node, visit); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 182 /* SyntaxKind.TypeLiteral */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 184 /* SyntaxKind.TypeLiteral */: addDeclaration(node); ts.forEachChild(node, visit); break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Only consider parameter properties if (!ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */)) { break; } // falls through - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: { + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: { var decl = node; if (ts.isBindingPattern(decl.name)) { ts.forEachChild(decl.name, visit); @@ -167209,12 +168362,12 @@ var ts; } } // falls through - case 299 /* SyntaxKind.EnumMember */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: addDeclaration(node); break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; var exportDeclaration = node; @@ -167227,7 +168380,7 @@ var ts; } } break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -167239,7 +168392,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -167248,7 +168401,7 @@ var ts; } } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.getAssignmentDeclarationKind(node) !== 0 /* AssignmentDeclarationKind.None */) { addDeclaration(node); } @@ -167660,6 +168813,10 @@ var ts; getCurrentDirectory: compilerHost.getCurrentDirectory, onUnRecoverableConfigFileDiagnostic: ts.noop, }; + // The call to isProgramUptoDate below may refer back to documentRegistryBucketKey; + // calculate this early so it's not undefined if downleveled to a var (or, if emitted + // 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)) { return; @@ -167669,7 +168826,6 @@ var ts; // instance. If we cancel midway through, we may end up in an inconsistent state where // the program points to old source files that have been invalidated because of // incremental parsing. - var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); var options = { rootNames: rootFileNames, options: newSettings, @@ -167965,16 +169121,16 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return !ts.isLabelName(node) && !ts.isTagName(node) && !ts.isConstTypeReference(node.parent); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: // Don't return quickInfo if inside the comment in `a/**/.b` return !ts.isInComment(sourceFile, position); case 108 /* SyntaxKind.ThisKeyword */: - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 106 /* SyntaxKind.SuperKeyword */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return true; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return ts.isImportMeta(node); default: return false; @@ -168081,15 +169237,15 @@ var ts; return undefined; } switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: case 10 /* SyntaxKind.StringLiteral */: case 95 /* SyntaxKind.FalseKeyword */: case 110 /* SyntaxKind.TrueKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 106 /* SyntaxKind.SuperKeyword */: case 108 /* SyntaxKind.ThisKeyword */: - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 79 /* SyntaxKind.Identifier */: break; // Cant create the text span @@ -168106,7 +169262,7 @@ var ts; // If this is name of a module declarations, check if this is right side of dotted module name // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of // Then this name is name from dotted module - if (nodeForStartPos.parent.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -168855,7 +170011,7 @@ var ts; */ function literalIsName(node) { return ts.isDeclarationName(node) || - node.parent.kind === 277 /* SyntaxKind.ExternalModuleReference */ || + node.parent.kind === 280 /* SyntaxKind.ExternalModuleReference */ || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node); } @@ -168873,13 +170029,13 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 8 /* SyntaxKind.NumericLiteral */: - if (node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { return ts.isObjectLiteralElement(node.parent.parent) ? node.parent.parent : undefined; } // falls through case 79 /* SyntaxKind.Identifier */: return ts.isObjectLiteralElement(node.parent) && - (node.parent.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || node.parent.parent.kind === 286 /* SyntaxKind.JsxAttributes */) && + (node.parent.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || node.parent.parent.kind === 289 /* SyntaxKind.JsxAttributes */) && node.parent.name === node ? node.parent : undefined; } return undefined; @@ -168921,7 +170077,7 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && + node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && node.parent.argumentExpression === node; } /** @@ -169014,114 +170170,114 @@ var ts; if (node) { var parent = node.parent; switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 254 /* SyntaxKind.VariableDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return spanInVariableDeclaration(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return spanInParameterDeclaration(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return spanInFunctionDeclaration(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // falls through - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return spanInBlock(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return spanInBlock(node.block); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: // Span on while(...) return textSpanEndingAtNextToken(node, node.expression); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 253 /* SyntaxKind.DebuggerStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: // set on if(..) span return textSpanEndingAtNextToken(node, node.expression); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: // span in statement return spanInNode(node.statement); - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return spanInForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: // span of for (a in ...) return textSpanEndingAtNextToken(node, node.expression); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: // span in initializer return spanInInitializerOfForLike(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: // span on switch(...) return textSpanEndingAtNextToken(node, node.expression); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 203 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 205 /* SyntaxKind.BindingElement */: // span on complete node return textSpan(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: // span in statement return spanInNode(node.statement); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return spanInNodeArray(parent.modifiers, node, ts.isDecorator); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return spanInBindingPattern(node); // No breakpoint in interface, type alias - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return undefined; // Tokens: case 26 /* SyntaxKind.SemicolonToken */: @@ -169151,7 +170307,7 @@ var ts; case 83 /* SyntaxKind.CatchKeyword */: case 96 /* SyntaxKind.FinallyKeyword */: return spanInNextNode(node); - case 160 /* SyntaxKind.OfKeyword */: + case 162 /* SyntaxKind.OfKeyword */: return spanInOfKeyword(node); default: // Destructuring pattern in destructuring assignment @@ -169164,13 +170320,13 @@ var ts; // `a` or `...c` or `d: x` from // `[a, b, ...c]` or `{ a, b }` or `{ d: x }` from destructuring pattern if ((node.kind === 79 /* SyntaxKind.Identifier */ || - node.kind === 225 /* SyntaxKind.SpreadElement */ || - node.kind === 296 /* SyntaxKind.PropertyAssignment */ || - node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) && + node.kind === 227 /* SyntaxKind.SpreadElement */ || + node.kind === 299 /* SyntaxKind.PropertyAssignment */ || + node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(parent)) { return textSpan(node); } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */) { var _a = node, left = _a.left, operatorToken = _a.operatorToken; // Set breakpoint in destructuring pattern if its destructuring assignment // [a, b, c] or {a, b, c} of @@ -169192,22 +170348,22 @@ var ts; } if (ts.isExpressionNode(node)) { switch (parent.kind) { - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // Set span as if on while keyword return spanInPreviousNode(node); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Set breakpoint on the decorator emit return spanInNode(node.parent); - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return textSpan(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (node.parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { // If this is a comma expression, the breakpoint is possible in this expression return textSpan(node); } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: if (node.parent.body === node) { // If this is body of arrow function, it is allowed to have the breakpoint return textSpan(node); @@ -169216,21 +170372,21 @@ var ts; } } switch (node.parent.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // If this is name of property assignment, set breakpoint in the initializer if (node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); } break; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: // Breakpoint in type assertion goes to its operand if (node.parent.type === node) { return spanInNextNode(node.parent.type); } break; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: { + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: { // initializer of variable/parameter declaration go to previous node var _b = node.parent, initializer = _b.initializer, type = _b.type; if (initializer === node || type === node || ts.isAssignmentOperator(node.kind)) { @@ -169238,7 +170394,7 @@ var ts; } break; } - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var left = node.parent.left; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(left) && node !== left) { // If initializer of destructuring assignment move to previous token @@ -169268,7 +170424,7 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (variableDeclaration.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { return spanInNode(variableDeclaration.parent.parent); } var parent = variableDeclaration.parent; @@ -169280,7 +170436,7 @@ var ts; // or its declaration from 'for of' if ((ts.hasOnlyExpressionInitializer(variableDeclaration) && variableDeclaration.initializer) || ts.hasSyntacticModifier(variableDeclaration, 1 /* ModifierFlags.Export */) || - parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { return textSpanFromVariableDeclaration(variableDeclaration); } if (ts.isVariableDeclarationList(variableDeclaration.parent) && @@ -169321,7 +170477,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasSyntacticModifier(functionDeclaration, 1 /* ModifierFlags.Export */) || - (functionDeclaration.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ && functionDeclaration.kind !== 171 /* SyntaxKind.Constructor */); + (functionDeclaration.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ && functionDeclaration.kind !== 173 /* SyntaxKind.Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -169344,26 +170500,26 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // Set on parent if on same line otherwise on first statement // falls through - case 241 /* SyntaxKind.WhileStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } // Default action is to set on first statement return spanInNode(block.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { - if (forLikeStatement.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (forLikeStatement.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { // Declaration list - set breakpoint in first declaration var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -169388,21 +170544,21 @@ var ts; } function spanInBindingPattern(bindingPattern) { // Set breakpoint in first binding element - var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 227 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 229 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } // Empty binding pattern of binding element, set breakpoint on binding element - if (bindingPattern.parent.kind === 203 /* SyntaxKind.BindingElement */) { + if (bindingPattern.parent.kind === 205 /* SyntaxKind.BindingElement */) { return textSpan(bindingPattern.parent); } // Variable declaration is used as the span return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { - ts.Debug.assert(node.kind !== 202 /* SyntaxKind.ArrayBindingPattern */ && node.kind !== 201 /* SyntaxKind.ObjectBindingPattern */); - var elements = node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ ? node.elements : node.properties; - var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 227 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); + ts.Debug.assert(node.kind !== 204 /* SyntaxKind.ArrayBindingPattern */ && node.kind !== 203 /* SyntaxKind.ObjectBindingPattern */); + var elements = node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ ? node.elements : node.properties; + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 229 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } @@ -169410,18 +170566,18 @@ var ts; // just nested element in another destructuring assignment // set breakpoint on assignment when parent is destructuring assignment // Otherwise set breakpoint for this element - return textSpan(node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ ? node.parent : node); + return textSpan(node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ ? node.parent : node); } // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -169429,25 +170585,25 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: // If this is not an instantiated module block, no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // falls through - case 260 /* SyntaxKind.EnumDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // Span on close brace token return textSpan(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } // falls through - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -169455,7 +170611,7 @@ var ts; return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -169471,7 +170627,7 @@ var ts; } function spanInCloseBracketToken(node) { switch (node.parent.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -169486,12 +170642,12 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 240 /* SyntaxKind.DoStatement */ || // Go to while keyword and do action instead - node.parent.kind === 208 /* SyntaxKind.CallExpression */ || - node.parent.kind === 209 /* SyntaxKind.NewExpression */) { + if (node.parent.kind === 243 /* SyntaxKind.DoStatement */ || // Go to while keyword and do action instead + node.parent.kind === 210 /* SyntaxKind.CallExpression */ || + node.parent.kind === 211 /* SyntaxKind.NewExpression */) { return spanInPreviousNode(node); } - if (node.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (node.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { return spanInNextNode(node); } // Default to parent node @@ -169500,21 +170656,21 @@ var ts; function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return spanInPreviousNode(node); // Default to parent node default: @@ -169524,20 +170680,20 @@ var ts; function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration if (ts.isFunctionLike(node.parent) || - node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ || - node.parent.kind === 164 /* SyntaxKind.Parameter */) { + node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ || + node.parent.kind === 166 /* SyntaxKind.Parameter */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (node.parent.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 240 /* SyntaxKind.DoStatement */) { + if (node.parent.kind === 243 /* SyntaxKind.DoStatement */) { // Set span on while expression return textSpanEndingAtNextToken(node, node.parent.expression); } @@ -169545,7 +170701,7 @@ var ts; return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { // Set using next token return spanInNextNode(node); } @@ -169594,7 +170750,7 @@ var debugObjectHost = (function () { return this; })(); // We need to use 'null' to interface with the managed side. -/* eslint-disable no-in-operator */ +/* eslint-disable local/no-in-operator */ /* @internal */ var ts; (function (ts) { @@ -170394,7 +171550,7 @@ var ts; }()); ts.TypeScriptServicesFactory = TypeScriptServicesFactory; })(ts || (ts = {})); -/* eslint-enable no-in-operator */ +/* eslint-enable local/no-in-operator */ // We polyfill `globalThis` here so re can reliably patch the global scope // in the contexts we want to in the same way across script and module formats /* eslint-enable no-var */ @@ -171164,7 +172320,7 @@ var ts; if (typeof value === "number") { return ts.factory.createNumericLiteral(value); } - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (typeof value === "object" && "base10Value" in value) { // PseudoBigInt return ts.factory.createBigIntLiteral(value); } @@ -171192,7 +172348,7 @@ var ts; } else { type = operatorOrType; - operator = 140 /* SyntaxKind.KeyOfKeyword */; + operator = 141 /* SyntaxKind.KeyOfKeyword */; } return ts.factory.createTypeOperatorNode(operator, type); }, factoryDeprecation); @@ -171370,7 +172526,7 @@ var ts; ts.createNode = ts.Debug.deprecate(function createNode(kind, pos, end) { if (pos === void 0) { pos = 0; } if (end === void 0) { end = 0; } - return ts.setTextRangePosEnd(kind === 305 /* SyntaxKind.SourceFile */ ? ts.parseBaseNodeFactory.createBaseSourceFileNode(kind) : + return ts.setTextRangePosEnd(kind === 308 /* SyntaxKind.SourceFile */ ? ts.parseBaseNodeFactory.createBaseSourceFileNode(kind) : kind === 79 /* SyntaxKind.Identifier */ ? ts.parseBaseNodeFactory.createBaseIdentifierNode(kind) : kind === 80 /* SyntaxKind.PrivateIdentifier */ ? ts.parseBaseNodeFactory.createBasePrivateIdentifierNode(kind) : !ts.isNodeKind(kind) ? ts.parseBaseNodeFactory.createBaseTokenNode(kind) : @@ -171400,7 +172556,7 @@ var ts; (function (ts) { /** @deprecated Use `isTypeAssertionExpression` instead. */ ts.isTypeAssertion = ts.Debug.deprecate(function isTypeAssertion(node) { - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */; }, { since: "4.0", warnAfter: "4.1", diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts index 9309fde2dff..93f7c9ed812 100644 --- a/lib/typescriptServices.d.ts +++ b/lib/typescriptServices.d.ts @@ -14,7 +14,7 @@ and limitations under the License. ***************************************************************************** */ declare namespace ts { - const versionMajorMinor = "4.8"; + const versionMajorMinor = "4.9"; /** The version of the TypeScript compiler release */ const version: string; /** @@ -232,237 +232,240 @@ declare namespace ts { StaticKeyword = 124, YieldKeyword = 125, AbstractKeyword = 126, - AsKeyword = 127, - AssertsKeyword = 128, - AssertKeyword = 129, - AnyKeyword = 130, - AsyncKeyword = 131, - AwaitKeyword = 132, - BooleanKeyword = 133, - ConstructorKeyword = 134, - DeclareKeyword = 135, - GetKeyword = 136, - InferKeyword = 137, - IntrinsicKeyword = 138, - IsKeyword = 139, - KeyOfKeyword = 140, - ModuleKeyword = 141, - NamespaceKeyword = 142, - NeverKeyword = 143, - OutKeyword = 144, - ReadonlyKeyword = 145, - RequireKeyword = 146, - NumberKeyword = 147, - ObjectKeyword = 148, - SetKeyword = 149, - StringKeyword = 150, - SymbolKeyword = 151, - TypeKeyword = 152, - UndefinedKeyword = 153, - UniqueKeyword = 154, - UnknownKeyword = 155, - FromKeyword = 156, - GlobalKeyword = 157, - BigIntKeyword = 158, - OverrideKeyword = 159, - OfKeyword = 160, - QualifiedName = 161, - ComputedPropertyName = 162, - TypeParameter = 163, - Parameter = 164, - Decorator = 165, - PropertySignature = 166, - PropertyDeclaration = 167, - MethodSignature = 168, - MethodDeclaration = 169, - ClassStaticBlockDeclaration = 170, - Constructor = 171, - GetAccessor = 172, - SetAccessor = 173, - CallSignature = 174, - ConstructSignature = 175, - IndexSignature = 176, - TypePredicate = 177, - TypeReference = 178, - FunctionType = 179, - ConstructorType = 180, - TypeQuery = 181, - TypeLiteral = 182, - ArrayType = 183, - TupleType = 184, - OptionalType = 185, - RestType = 186, - UnionType = 187, - IntersectionType = 188, - ConditionalType = 189, - InferType = 190, - ParenthesizedType = 191, - ThisType = 192, - TypeOperator = 193, - IndexedAccessType = 194, - MappedType = 195, - LiteralType = 196, - NamedTupleMember = 197, - TemplateLiteralType = 198, - TemplateLiteralTypeSpan = 199, - ImportType = 200, - ObjectBindingPattern = 201, - ArrayBindingPattern = 202, - BindingElement = 203, - ArrayLiteralExpression = 204, - ObjectLiteralExpression = 205, - PropertyAccessExpression = 206, - ElementAccessExpression = 207, - CallExpression = 208, - NewExpression = 209, - TaggedTemplateExpression = 210, - TypeAssertionExpression = 211, - ParenthesizedExpression = 212, - FunctionExpression = 213, - ArrowFunction = 214, - DeleteExpression = 215, - TypeOfExpression = 216, - VoidExpression = 217, - AwaitExpression = 218, - PrefixUnaryExpression = 219, - PostfixUnaryExpression = 220, - BinaryExpression = 221, - ConditionalExpression = 222, - TemplateExpression = 223, - YieldExpression = 224, - SpreadElement = 225, - ClassExpression = 226, - OmittedExpression = 227, - ExpressionWithTypeArguments = 228, - AsExpression = 229, - NonNullExpression = 230, - MetaProperty = 231, - SyntheticExpression = 232, - TemplateSpan = 233, - SemicolonClassElement = 234, - Block = 235, - EmptyStatement = 236, - VariableStatement = 237, - ExpressionStatement = 238, - IfStatement = 239, - DoStatement = 240, - WhileStatement = 241, - ForStatement = 242, - ForInStatement = 243, - ForOfStatement = 244, - ContinueStatement = 245, - BreakStatement = 246, - ReturnStatement = 247, - WithStatement = 248, - SwitchStatement = 249, - LabeledStatement = 250, - ThrowStatement = 251, - TryStatement = 252, - DebuggerStatement = 253, - VariableDeclaration = 254, - VariableDeclarationList = 255, - FunctionDeclaration = 256, - ClassDeclaration = 257, - InterfaceDeclaration = 258, - TypeAliasDeclaration = 259, - EnumDeclaration = 260, - ModuleDeclaration = 261, - ModuleBlock = 262, - CaseBlock = 263, - NamespaceExportDeclaration = 264, - ImportEqualsDeclaration = 265, - ImportDeclaration = 266, - ImportClause = 267, - NamespaceImport = 268, - NamedImports = 269, - ImportSpecifier = 270, - ExportAssignment = 271, - ExportDeclaration = 272, - NamedExports = 273, - NamespaceExport = 274, - ExportSpecifier = 275, - MissingDeclaration = 276, - ExternalModuleReference = 277, - JsxElement = 278, - JsxSelfClosingElement = 279, - JsxOpeningElement = 280, - JsxClosingElement = 281, - JsxFragment = 282, - JsxOpeningFragment = 283, - JsxClosingFragment = 284, - JsxAttribute = 285, - JsxAttributes = 286, - JsxSpreadAttribute = 287, - JsxExpression = 288, - CaseClause = 289, - DefaultClause = 290, - HeritageClause = 291, - CatchClause = 292, - AssertClause = 293, - AssertEntry = 294, - ImportTypeAssertionContainer = 295, - PropertyAssignment = 296, - ShorthandPropertyAssignment = 297, - SpreadAssignment = 298, - EnumMember = 299, - UnparsedPrologue = 300, - UnparsedPrepend = 301, - UnparsedText = 302, - UnparsedInternalText = 303, - UnparsedSyntheticReference = 304, - SourceFile = 305, - Bundle = 306, - UnparsedSource = 307, - InputFiles = 308, - JSDocTypeExpression = 309, - JSDocNameReference = 310, - JSDocMemberName = 311, - JSDocAllType = 312, - JSDocUnknownType = 313, - JSDocNullableType = 314, - JSDocNonNullableType = 315, - JSDocOptionalType = 316, - JSDocFunctionType = 317, - JSDocVariadicType = 318, - JSDocNamepathType = 319, - JSDoc = 320, + AccessorKeyword = 127, + AsKeyword = 128, + AssertsKeyword = 129, + AssertKeyword = 130, + AnyKeyword = 131, + AsyncKeyword = 132, + AwaitKeyword = 133, + BooleanKeyword = 134, + ConstructorKeyword = 135, + DeclareKeyword = 136, + GetKeyword = 137, + InferKeyword = 138, + IntrinsicKeyword = 139, + IsKeyword = 140, + KeyOfKeyword = 141, + ModuleKeyword = 142, + NamespaceKeyword = 143, + NeverKeyword = 144, + OutKeyword = 145, + ReadonlyKeyword = 146, + RequireKeyword = 147, + NumberKeyword = 148, + ObjectKeyword = 149, + SatisfiesKeyword = 150, + SetKeyword = 151, + StringKeyword = 152, + SymbolKeyword = 153, + TypeKeyword = 154, + UndefinedKeyword = 155, + UniqueKeyword = 156, + UnknownKeyword = 157, + FromKeyword = 158, + GlobalKeyword = 159, + BigIntKeyword = 160, + OverrideKeyword = 161, + OfKeyword = 162, + QualifiedName = 163, + ComputedPropertyName = 164, + TypeParameter = 165, + Parameter = 166, + Decorator = 167, + PropertySignature = 168, + PropertyDeclaration = 169, + MethodSignature = 170, + MethodDeclaration = 171, + ClassStaticBlockDeclaration = 172, + Constructor = 173, + GetAccessor = 174, + SetAccessor = 175, + CallSignature = 176, + ConstructSignature = 177, + IndexSignature = 178, + TypePredicate = 179, + TypeReference = 180, + FunctionType = 181, + ConstructorType = 182, + TypeQuery = 183, + TypeLiteral = 184, + ArrayType = 185, + TupleType = 186, + OptionalType = 187, + RestType = 188, + UnionType = 189, + IntersectionType = 190, + ConditionalType = 191, + InferType = 192, + ParenthesizedType = 193, + ThisType = 194, + TypeOperator = 195, + IndexedAccessType = 196, + MappedType = 197, + LiteralType = 198, + NamedTupleMember = 199, + TemplateLiteralType = 200, + TemplateLiteralTypeSpan = 201, + ImportType = 202, + ObjectBindingPattern = 203, + ArrayBindingPattern = 204, + BindingElement = 205, + ArrayLiteralExpression = 206, + ObjectLiteralExpression = 207, + PropertyAccessExpression = 208, + ElementAccessExpression = 209, + CallExpression = 210, + NewExpression = 211, + TaggedTemplateExpression = 212, + TypeAssertionExpression = 213, + ParenthesizedExpression = 214, + FunctionExpression = 215, + ArrowFunction = 216, + DeleteExpression = 217, + TypeOfExpression = 218, + VoidExpression = 219, + AwaitExpression = 220, + PrefixUnaryExpression = 221, + PostfixUnaryExpression = 222, + BinaryExpression = 223, + ConditionalExpression = 224, + TemplateExpression = 225, + YieldExpression = 226, + SpreadElement = 227, + ClassExpression = 228, + OmittedExpression = 229, + ExpressionWithTypeArguments = 230, + AsExpression = 231, + NonNullExpression = 232, + MetaProperty = 233, + SyntheticExpression = 234, + SatisfiesExpression = 235, + TemplateSpan = 236, + SemicolonClassElement = 237, + Block = 238, + EmptyStatement = 239, + VariableStatement = 240, + ExpressionStatement = 241, + IfStatement = 242, + DoStatement = 243, + WhileStatement = 244, + ForStatement = 245, + ForInStatement = 246, + ForOfStatement = 247, + ContinueStatement = 248, + BreakStatement = 249, + ReturnStatement = 250, + WithStatement = 251, + SwitchStatement = 252, + LabeledStatement = 253, + ThrowStatement = 254, + TryStatement = 255, + DebuggerStatement = 256, + VariableDeclaration = 257, + VariableDeclarationList = 258, + FunctionDeclaration = 259, + ClassDeclaration = 260, + InterfaceDeclaration = 261, + TypeAliasDeclaration = 262, + EnumDeclaration = 263, + ModuleDeclaration = 264, + ModuleBlock = 265, + CaseBlock = 266, + NamespaceExportDeclaration = 267, + ImportEqualsDeclaration = 268, + ImportDeclaration = 269, + ImportClause = 270, + NamespaceImport = 271, + NamedImports = 272, + ImportSpecifier = 273, + ExportAssignment = 274, + ExportDeclaration = 275, + NamedExports = 276, + NamespaceExport = 277, + ExportSpecifier = 278, + MissingDeclaration = 279, + ExternalModuleReference = 280, + JsxElement = 281, + JsxSelfClosingElement = 282, + JsxOpeningElement = 283, + JsxClosingElement = 284, + JsxFragment = 285, + JsxOpeningFragment = 286, + JsxClosingFragment = 287, + JsxAttribute = 288, + JsxAttributes = 289, + JsxSpreadAttribute = 290, + JsxExpression = 291, + CaseClause = 292, + DefaultClause = 293, + HeritageClause = 294, + CatchClause = 295, + AssertClause = 296, + AssertEntry = 297, + ImportTypeAssertionContainer = 298, + PropertyAssignment = 299, + ShorthandPropertyAssignment = 300, + SpreadAssignment = 301, + EnumMember = 302, + UnparsedPrologue = 303, + UnparsedPrepend = 304, + UnparsedText = 305, + UnparsedInternalText = 306, + UnparsedSyntheticReference = 307, + SourceFile = 308, + Bundle = 309, + UnparsedSource = 310, + InputFiles = 311, + JSDocTypeExpression = 312, + JSDocNameReference = 313, + JSDocMemberName = 314, + JSDocAllType = 315, + JSDocUnknownType = 316, + JSDocNullableType = 317, + JSDocNonNullableType = 318, + JSDocOptionalType = 319, + JSDocFunctionType = 320, + JSDocVariadicType = 321, + JSDocNamepathType = 322, + JSDoc = 323, /** @deprecated Use SyntaxKind.JSDoc */ - JSDocComment = 320, - JSDocText = 321, - JSDocTypeLiteral = 322, - JSDocSignature = 323, - JSDocLink = 324, - JSDocLinkCode = 325, - JSDocLinkPlain = 326, - JSDocTag = 327, - JSDocAugmentsTag = 328, - JSDocImplementsTag = 329, - JSDocAuthorTag = 330, - JSDocDeprecatedTag = 331, - JSDocClassTag = 332, - JSDocPublicTag = 333, - JSDocPrivateTag = 334, - JSDocProtectedTag = 335, - JSDocReadonlyTag = 336, - JSDocOverrideTag = 337, - JSDocCallbackTag = 338, - JSDocEnumTag = 339, - JSDocParameterTag = 340, - JSDocReturnTag = 341, - JSDocThisTag = 342, - JSDocTypeTag = 343, - JSDocTemplateTag = 344, - JSDocTypedefTag = 345, - JSDocSeeTag = 346, - JSDocPropertyTag = 347, - SyntaxList = 348, - NotEmittedStatement = 349, - PartiallyEmittedExpression = 350, - CommaListExpression = 351, - MergeDeclarationMarker = 352, - EndOfDeclarationMarker = 353, - SyntheticReferenceExpression = 354, - Count = 355, + JSDocComment = 323, + JSDocText = 324, + JSDocTypeLiteral = 325, + JSDocSignature = 326, + JSDocLink = 327, + JSDocLinkCode = 328, + JSDocLinkPlain = 329, + JSDocTag = 330, + JSDocAugmentsTag = 331, + JSDocImplementsTag = 332, + JSDocAuthorTag = 333, + JSDocDeprecatedTag = 334, + JSDocClassTag = 335, + JSDocPublicTag = 336, + JSDocPrivateTag = 337, + JSDocProtectedTag = 338, + JSDocReadonlyTag = 339, + JSDocOverrideTag = 340, + JSDocCallbackTag = 341, + JSDocEnumTag = 342, + JSDocParameterTag = 343, + JSDocReturnTag = 344, + JSDocThisTag = 345, + JSDocTypeTag = 346, + JSDocTemplateTag = 347, + JSDocTypedefTag = 348, + JSDocSeeTag = 349, + JSDocPropertyTag = 350, + SyntaxList = 351, + NotEmittedStatement = 352, + PartiallyEmittedExpression = 353, + CommaListExpression = 354, + MergeDeclarationMarker = 355, + EndOfDeclarationMarker = 356, + SyntheticReferenceExpression = 357, + Count = 358, FirstAssignment = 63, LastAssignment = 78, FirstCompoundAssignment = 64, @@ -470,15 +473,15 @@ declare namespace ts { FirstReservedWord = 81, LastReservedWord = 116, FirstKeyword = 81, - LastKeyword = 160, + LastKeyword = 162, FirstFutureReservedWord = 117, LastFutureReservedWord = 125, - FirstTypeNode = 177, - LastTypeNode = 200, + FirstTypeNode = 179, + LastTypeNode = 202, FirstPunctuation = 18, LastPunctuation = 78, FirstToken = 0, - LastToken = 160, + LastToken = 162, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -487,20 +490,20 @@ declare namespace ts { LastTemplateToken = 17, FirstBinaryOperator = 29, LastBinaryOperator = 78, - FirstStatement = 237, - LastStatement = 253, - FirstNode = 161, - FirstJSDocNode = 309, - LastJSDocNode = 347, - FirstJSDocTagNode = 327, - LastJSDocTagNode = 347, + FirstStatement = 240, + LastStatement = 256, + FirstNode = 163, + FirstJSDocNode = 312, + LastJSDocNode = 350, + FirstJSDocTagNode = 330, + LastJSDocTagNode = 350, } export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; export type PseudoLiteralSyntaxKind = SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail; export type PunctuationSyntaxKind = SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.QuestionDotToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionQuestionToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.BacktickToken | SyntaxKind.HashToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken; - export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; - export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword; + export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SatisfiesKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; + export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword; export type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword; export type TokenSyntaxKind = SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | TriviaSyntaxKind | LiteralSyntaxKind | PseudoLiteralSyntaxKind | PunctuationSyntaxKind | SyntaxKind.Identifier | KeywordSyntaxKind; export type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken; @@ -545,9 +548,10 @@ declare namespace ts { Protected = 16, Static = 32, Readonly = 64, - Abstract = 128, - Async = 256, - Default = 512, + Accessor = 128, + Abstract = 256, + Async = 512, + Default = 1024, Const = 2048, HasComputedJSDocModifiers = 4096, Deprecated = 8192, @@ -559,10 +563,10 @@ declare namespace ts { AccessibilityModifier = 28, ParameterPropertyModifier = 16476, NonPublicAccessibilityModifier = 24, - TypeScriptModifier = 116958, - ExportDefault = 513, - All = 257023, - Modifier = 125951 + TypeScriptModifier = 117086, + ExportDefault = 1025, + All = 258047, + Modifier = 126975 } export enum JsxFlags { None = 0, @@ -618,6 +622,7 @@ declare namespace ts { export interface ModifierToken extends KeywordToken { } export type AbstractKeyword = ModifierToken; + export type AccessorKeyword = ModifierToken; export type AsyncKeyword = ModifierToken; export type ConstKeyword = ModifierToken; export type DeclareKeyword = ModifierToken; @@ -633,11 +638,11 @@ declare namespace ts { export type StaticKeyword = ModifierToken; /** @deprecated Use `ReadonlyKeyword` instead. */ export type ReadonlyToken = ReadonlyKeyword; - export type Modifier = AbstractKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword | DefaultKeyword | ExportKeyword | InKeyword | PrivateKeyword | ProtectedKeyword | PublicKeyword | OutKeyword | OverrideKeyword | ReadonlyKeyword | StaticKeyword; + export type Modifier = AbstractKeyword | AccessorKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword | DefaultKeyword | ExportKeyword | InKeyword | PrivateKeyword | ProtectedKeyword | PublicKeyword | OutKeyword | OverrideKeyword | ReadonlyKeyword | StaticKeyword; export type ModifierLike = Modifier | Decorator; export type AccessibilityModifier = PublicKeyword | PrivateKeyword | ProtectedKeyword; export type ParameterPropertyModifier = AccessibilityModifier | ReadonlyKeyword; - export type ClassMemberModifier = AccessibilityModifier | ReadonlyKeyword | StaticKeyword; + export type ClassMemberModifier = AccessibilityModifier | ReadonlyKeyword | StaticKeyword | AccessorKeyword; export type ModifiersArray = NodeArray; export enum GeneratedIdentifierFlags { None = 0, @@ -764,6 +769,9 @@ declare namespace ts { readonly type?: TypeNode; readonly initializer?: Expression; } + export interface AutoAccessorPropertyDeclaration extends PropertyDeclaration { + _autoAccessorBrand: any; + } export interface ObjectLiteralElement extends NamedDeclaration { _objectLiteralBrand: any; readonly name?: PropertyName; @@ -1340,6 +1348,11 @@ declare namespace ts { readonly type: TypeNode; readonly expression: UnaryExpression; } + export interface SatisfiesExpression extends Expression { + readonly kind: SyntaxKind.SatisfiesExpression; + readonly expression: Expression; + readonly type: TypeNode; + } export type AssertionExpression = TypeAssertion | AsExpression; export interface NonNullExpression extends LeftHandSideExpression { readonly kind: SyntaxKind.NonNullExpression; @@ -2316,6 +2329,7 @@ declare namespace ts { getPrivateIdentifierPropertyOfType(leftType: Type, name: string, location: Node): Symbol | undefined; getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo | undefined; getIndexInfosOfType(type: Type): readonly IndexInfo[]; + getIndexInfosOfIndexSymbol: (indexSymbol: Symbol) => IndexInfo[]; getSignaturesOfType(type: Type, kind: SignatureKind): readonly Signature[]; getIndexTypeOfType(type: Type, kind: IndexKind): Type | undefined; getBaseTypes(type: InterfaceType): BaseType[]; @@ -2562,6 +2576,7 @@ declare namespace ts { MethodExcludes = 103359, GetAccessorExcludes = 46015, SetAccessorExcludes = 78783, + AccessorExcludes = 13247, TypeParameterExcludes = 526824, TypeAliasExcludes = 788968, AliasExcludes = 2097152, @@ -2832,7 +2847,7 @@ declare namespace ts { export interface SubstitutionType extends InstantiableType { objectFlags: ObjectFlags; baseType: Type; - substitute: Type; + constraint: Type; } export enum SignatureKind { Call = 0, @@ -3387,7 +3402,7 @@ declare namespace ts { createNumericLiteral(value: string | number, numericLiteralFlags?: TokenFlags): NumericLiteral; createBigIntLiteral(value: string | PseudoBigInt): BigIntLiteral; createStringLiteral(text: string, isSingleQuote?: boolean): StringLiteral; - createStringLiteralFromNode(sourceNode: PropertyNameLiteral, isSingleQuote?: boolean): StringLiteral; + createStringLiteralFromNode(sourceNode: PropertyNameLiteral | PrivateIdentifier, isSingleQuote?: boolean): StringLiteral; createRegularExpressionLiteral(text: string): RegularExpressionLiteral; createIdentifier(text: string): Identifier; /** @@ -3412,6 +3427,8 @@ declare namespace ts { /** Create a unique name generated for a node. */ getGeneratedNameForNode(node: Node | undefined, flags?: GeneratedIdentifierFlags): Identifier; createPrivateIdentifier(text: string): PrivateIdentifier; + createUniquePrivateName(text?: string): PrivateIdentifier; + getGeneratedPrivateNameForNode(node: Node): PrivateIdentifier; createToken(token: SyntaxKind.SuperKeyword): SuperExpression; createToken(token: SyntaxKind.ThisKeyword): ThisExpression; createToken(token: SyntaxKind.NullKeyword): NullLiteral; @@ -3587,6 +3604,8 @@ declare namespace ts { updateNonNullChain(node: NonNullChain, expression: Expression): NonNullChain; createMetaProperty(keywordToken: MetaProperty["keywordToken"], name: Identifier): MetaProperty; updateMetaProperty(node: MetaProperty, name: Identifier): MetaProperty; + createSatisfiesExpression(expression: Expression, type: TypeNode): SatisfiesExpression; + updateSatisfiesExpression(node: SatisfiesExpression, expression: Expression, type: TypeNode): SatisfiesExpression; createTemplateSpan(expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; updateTemplateSpan(node: TemplateSpan, expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; createSemicolonClassElement(): SemicolonClassElement; @@ -3948,7 +3967,7 @@ declare namespace ts { (nodes: NodeArray, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray; (nodes: NodeArray | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray | undefined; } - export type VisitResult = T | T[] | undefined; + export type VisitResult = T | readonly T[] | undefined; export interface Printer { /** * Print a node and its subtree as-is, without any emit transformations. @@ -4515,6 +4534,7 @@ declare namespace ts { function isClassElement(node: Node): node is ClassElement; function isClassLike(node: Node): node is ClassLikeDeclaration; function isAccessor(node: Node): node is AccessorDeclaration; + function isAutoAccessorPropertyDeclaration(node: Node): node is AutoAccessorPropertyDeclaration; function isModifierLike(node: Node): node is ModifierLike; function isTypeElement(node: Node): node is TypeElement; function isClassOrTypeElement(node: Node): node is ClassElement | TypeElement; @@ -4716,6 +4736,7 @@ declare namespace ts { function isOmittedExpression(node: Node): node is OmittedExpression; function isExpressionWithTypeArguments(node: Node): node is ExpressionWithTypeArguments; function isAsExpression(node: Node): node is AsExpression; + function isSatisfiesExpression(node: Node): node is SatisfiesExpression; function isNonNullExpression(node: Node): node is NonNullExpression; function isMetaProperty(node: Node): node is MetaProperty; function isSyntheticExpression(node: Node): node is SyntheticExpression; @@ -6526,7 +6547,7 @@ declare namespace ts { isGlobalCompletion: boolean; isMemberCompletion: boolean; /** - * In the absence of `CompletionEntry["replacementSpan"], the editor may choose whether to use + * In the absence of `CompletionEntry["replacementSpan"]`, the editor may choose whether to use * this span or its default one. If `CompletionEntry["replacementSpan"]` is defined, that span * must be used to commit that completion entry. */ @@ -6739,6 +6760,8 @@ declare namespace ts { * interface Y { foo:number; } */ memberVariableElement = "property", + /** class X { [public|private]* accessor foo: number; } */ + memberAccessorVariableElement = "accessor", /** * class X { constructor() { } } * class X { static { } } @@ -7018,7 +7041,7 @@ declare namespace ts { (text: string, isSingleQuote?: boolean | undefined, hasExtendedUnicodeEscape?: boolean | undefined): StringLiteral; }; /** @deprecated Use `factory.createStringLiteralFromNode` or the factory supplied by your transformation context instead. */ - const createStringLiteralFromNode: (sourceNode: PropertyNameLiteral, isSingleQuote?: boolean | undefined) => StringLiteral; + const createStringLiteralFromNode: (sourceNode: PrivateIdentifier | PropertyNameLiteral, isSingleQuote?: boolean | undefined) => StringLiteral; /** @deprecated Use `factory.createRegularExpressionLiteral` or the factory supplied by your transformation context instead. */ const createRegularExpressionLiteral: (text: string) => RegularExpressionLiteral; /** @deprecated Use `factory.createLoopVariable` or the factory supplied by your transformation context instead. */ diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index 61b1259b561..73fab2d45c9 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -91,210 +91,15 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); -/* @internal */ -var ts; -(function (ts) { - function createMapData() { - var sentinel = {}; - sentinel.prev = sentinel; - return { head: sentinel, tail: sentinel, size: 0 }; - } - function createMapEntry(key, value) { - return { key: key, value: value, next: undefined, prev: undefined }; - } - function sameValueZero(x, y) { - // Treats -0 === 0 and NaN === NaN - return x === y || x !== x && y !== y; - } - function getPrev(entry) { - var prev = entry.prev; - // Entries without a 'prev' have been removed from the map. - // An entry whose 'prev' points to itself is the head of the list and is invalid here. - if (!prev || prev === entry) - throw new Error("Illegal state"); - return prev; - } - function getNext(entry) { - while (entry) { - // Entries without a 'prev' have been removed from the map. Their 'next' - // pointer should point to the previous entry prior to deletion and - // that entry should be skipped to resume iteration. - var skipNext = !entry.prev; - entry = entry.next; - if (skipNext) { - continue; - } - return entry; - } - } - function getEntry(data, key) { - // We walk backwards from 'tail' to prioritize recently added entries. - // We skip 'head' because it is an empty entry used to track iteration start. - for (var entry = data.tail; entry !== data.head; entry = getPrev(entry)) { - if (sameValueZero(entry.key, key)) { - return entry; - } - } - } - function addOrUpdateEntry(data, key, value) { - var existing = getEntry(data, key); - if (existing) { - existing.value = value; - return; - } - var entry = createMapEntry(key, value); - entry.prev = data.tail; - data.tail.next = entry; - data.tail = entry; - data.size++; - return entry; - } - function deleteEntry(data, key) { - // We walk backwards from 'tail' to prioritize recently added entries. - // We skip 'head' because it is an empty entry used to track iteration start. - for (var entry = data.tail; entry !== data.head; entry = getPrev(entry)) { - // all entries in the map should have a 'prev' pointer. - if (entry.prev === undefined) - throw new Error("Illegal state"); - if (sameValueZero(entry.key, key)) { - if (entry.next) { - entry.next.prev = entry.prev; - } - else { - // an entry in the map without a 'next' pointer must be the 'tail'. - if (data.tail !== entry) - throw new Error("Illegal state"); - data.tail = entry.prev; - } - entry.prev.next = entry.next; - entry.next = entry.prev; - entry.prev = undefined; - data.size--; - return entry; - } - } - } - function clearEntries(data) { - var node = data.tail; - while (node !== data.head) { - var prev = getPrev(node); - node.next = data.head; - node.prev = undefined; - node = prev; - } - data.head.next = undefined; - data.tail = data.head; - data.size = 0; - } - function forEachEntry(data, action) { - var entry = data.head; - while (entry) { - entry = getNext(entry); - if (entry) { - action(entry.value, entry.key); - } - } - } - function forEachIteration(iterator, action) { - if (iterator) { - for (var step = iterator.next(); !step.done; step = iterator.next()) { - action(step.value); - } - } - } - function createIteratorData(data, selector) { - return { current: data.head, selector: selector }; - } - function iteratorNext(data) { - // Navigate to the next entry. - data.current = getNext(data.current); - if (data.current) { - return { value: data.selector(data.current.key, data.current.value), done: false }; - } - else { - return { value: undefined, done: true }; - } - } - /* @internal */ - var ShimCollections; - (function (ShimCollections) { - function createMapShim(getIterator) { - var MapIterator = /** @class */ (function () { - function MapIterator(data, selector) { - this._data = createIteratorData(data, selector); - } - MapIterator.prototype.next = function () { return iteratorNext(this._data); }; - return MapIterator; - }()); - return /** @class */ (function () { - function Map(iterable) { - var _this = this; - this._mapData = createMapData(); - forEachIteration(getIterator(iterable), function (_a) { - var key = _a[0], value = _a[1]; - return _this.set(key, value); - }); - } - Object.defineProperty(Map.prototype, "size", { - get: function () { return this._mapData.size; }, - enumerable: false, - configurable: true - }); - Map.prototype.get = function (key) { var _a; return (_a = getEntry(this._mapData, key)) === null || _a === void 0 ? void 0 : _a.value; }; - Map.prototype.set = function (key, value) { return addOrUpdateEntry(this._mapData, key, value), this; }; - Map.prototype.has = function (key) { return !!getEntry(this._mapData, key); }; - Map.prototype.delete = function (key) { return !!deleteEntry(this._mapData, key); }; - Map.prototype.clear = function () { clearEntries(this._mapData); }; - Map.prototype.keys = function () { return new MapIterator(this._mapData, function (key, _value) { return key; }); }; - Map.prototype.values = function () { return new MapIterator(this._mapData, function (_key, value) { return value; }); }; - Map.prototype.entries = function () { return new MapIterator(this._mapData, function (key, value) { return [key, value]; }); }; - Map.prototype.forEach = function (action) { forEachEntry(this._mapData, action); }; - return Map; - }()); - } - ShimCollections.createMapShim = createMapShim; - function createSetShim(getIterator) { - var SetIterator = /** @class */ (function () { - function SetIterator(data, selector) { - this._data = createIteratorData(data, selector); - } - SetIterator.prototype.next = function () { return iteratorNext(this._data); }; - return SetIterator; - }()); - return /** @class */ (function () { - function Set(iterable) { - var _this = this; - this._mapData = createMapData(); - forEachIteration(getIterator(iterable), function (value) { return _this.add(value); }); - } - Object.defineProperty(Set.prototype, "size", { - get: function () { return this._mapData.size; }, - enumerable: false, - configurable: true - }); - Set.prototype.add = function (value) { return addOrUpdateEntry(this._mapData, value, value), this; }; - Set.prototype.has = function (value) { return !!getEntry(this._mapData, value); }; - Set.prototype.delete = function (value) { return !!deleteEntry(this._mapData, value); }; - Set.prototype.clear = function () { clearEntries(this._mapData); }; - Set.prototype.keys = function () { return new SetIterator(this._mapData, function (key, _value) { return key; }); }; - Set.prototype.values = function () { return new SetIterator(this._mapData, function (_key, value) { return value; }); }; - Set.prototype.entries = function () { return new SetIterator(this._mapData, function (key, value) { return [key, value]; }); }; - Set.prototype.forEach = function (action) { forEachEntry(this._mapData, action); }; - return Set; - }()); - } - ShimCollections.createSetShim = createSetShim; - })(ShimCollections = ts.ShimCollections || (ts.ShimCollections = {})); -})(ts || (ts = {})); var ts; (function (ts) { // WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values. // If changing the text in this section, be sure to test `configurePrerelease` too. - ts.versionMajorMinor = "4.8"; + ts.versionMajorMinor = "4.9"; // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types - ts.version = "4.8.3"; + ts.version = "".concat(ts.versionMajorMinor, ".0-beta"); /* @internal */ var Comparison; (function (Comparison) { @@ -315,8 +120,12 @@ var ts; function tryGetNativeMap() { // Internet Explorer's Map doesn't support iteration, so don't use it. var gMap = globals === null || globals === void 0 ? void 0 : globals.Map; - // eslint-disable-next-line no-in-operator - return typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; + // eslint-disable-next-line local/no-in-operator + var constructor = typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; + if (!constructor) { + throw new Error("No compatible Map implementation found."); + } + return constructor; } NativeCollections.tryGetNativeMap = tryGetNativeMap; /** @@ -325,24 +134,19 @@ var ts; function tryGetNativeSet() { // Internet Explorer's Set doesn't support iteration, so don't use it. var gSet = globals === null || globals === void 0 ? void 0 : globals.Set; - // eslint-disable-next-line no-in-operator - return typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; + // eslint-disable-next-line local/no-in-operator + var constructor = typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; + if (!constructor) { + throw new Error("No compatible Set implementation found."); + } + return constructor; } NativeCollections.tryGetNativeSet = tryGetNativeSet; })(NativeCollections || (NativeCollections = {})); /* @internal */ - ts.Map = getCollectionImplementation("Map", "tryGetNativeMap", "createMapShim"); + ts.Map = NativeCollections.tryGetNativeMap(); /* @internal */ - ts.Set = getCollectionImplementation("Set", "tryGetNativeSet", "createSetShim"); - /* @internal */ - function getCollectionImplementation(name, nativeFactory, shimFactory) { - var _a; - // NOTE: ts.ShimCollections will be defined for typescriptServices.js but not for tsc.js, so we must test for it. - var constructor = (_a = NativeCollections[nativeFactory]()) !== null && _a !== void 0 ? _a : ts.ShimCollections === null || ts.ShimCollections === void 0 ? void 0 : ts.ShimCollections[shimFactory](ts.getIterator); - if (constructor) - return constructor; - throw new Error("TypeScript requires an environment that provides a compatible native ".concat(name, " implementation.")); - } + ts.Set = NativeCollections.tryGetNativeSet(); })(ts || (ts = {})); /* @internal */ var ts; @@ -1058,15 +862,18 @@ var ts; function insertSorted(array, insert, compare, allowDuplicates) { if (array.length === 0) { array.push(insert); - return; + return true; } var insertIndex = binarySearch(array, insert, identity, compare); if (insertIndex < 0) { array.splice(~insertIndex, 0, insert); + return true; } - else if (allowDuplicates) { + if (allowDuplicates) { array.splice(insertIndex, 0, insert); + return true; } + return false; } ts.insertSorted = insertSorted; function sortAndDeduplicate(array, comparer, equalityComparer) { @@ -1346,6 +1153,13 @@ var ts; : undefined; } ts.singleOrUndefined = singleOrUndefined; + /** + * Returns the only element of an array if it contains only one element; throws otherwise. + */ + function single(array) { + return ts.Debug.checkDefined(singleOrUndefined(array)); + } + ts.single = single; function singleOrMany(array) { return array && array.length === 1 ? array[0] @@ -2869,7 +2683,7 @@ var ts; if (typeof func !== "function") { return ""; } - else if (func.hasOwnProperty("name")) { + else if (ts.hasProperty(func, "name")) { return func.name; } else { @@ -3019,7 +2833,7 @@ var ts; Debug.formatControlFlowGraph = formatControlFlowGraph; var flowNodeProto; function attachFlowNodeDebugInfoWorker(flowNode) { - if (!("__debugFlowFlags" in flowNode)) { // eslint-disable-line no-in-operator + if (!("__debugFlowFlags" in flowNode)) { // eslint-disable-line local/no-in-operator Object.defineProperties(flowNode, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { @@ -3065,7 +2879,7 @@ var ts; Debug.attachFlowNodeDebugInfo = attachFlowNodeDebugInfo; var nodeArrayProto; function attachNodeArrayDebugInfoWorker(array) { - if (!("__tsDebuggerDisplay" in array)) { // eslint-disable-line no-in-operator + if (!("__tsDebuggerDisplay" in array)) { // eslint-disable-line local/no-in-operator Object.defineProperties(array, { __tsDebuggerDisplay: { value: function (defaultValue) { @@ -3194,7 +3008,7 @@ var ts; ]; for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) { var ctor = nodeConstructors_1[_i]; - if (!ctor.prototype.hasOwnProperty("__debugKind")) { + if (!ts.hasProperty(ctor.prototype, "__debugKind")) { Object.defineProperties(ctor.prototype, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { @@ -3747,6 +3561,8 @@ var ts; typeof performance.mark === "function" && typeof performance.measure === "function" && typeof performance.now === "function" && + typeof performance.clearMarks === "function" && + typeof performance.clearMeasures === "function" && typeof PerformanceObserver === "function"; } function tryGetWebPerformanceHooks() { @@ -3791,7 +3607,9 @@ var ts; if (end === "__performance.measure-fix__") { nodePerformance_1.clearMarks("__performance.measure-fix__"); } - } + }, + clearMarks: function (name) { return nodePerformance_1.clearMarks(name); }, + clearMeasures: function (name) { return nodePerformance_1.clearMeasures(name); }, }; } return { @@ -3924,6 +3742,30 @@ var ts; durations.forEach(function (duration, measureName) { return cb(measureName, duration); }); } performance.forEachMeasure = forEachMeasure; + function forEachMark(cb) { + marks.forEach(function (_time, markName) { return cb(markName); }); + } + performance.forEachMark = forEachMark; + function clearMeasures(name) { + if (name !== undefined) + durations.delete(name); + else + durations.clear(); + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMeasures(name); + } + performance.clearMeasures = clearMeasures; + function clearMarks(name) { + if (name !== undefined) { + counts.delete(name); + marks.delete(name); + } + else { + counts.clear(); + marks.clear(); + } + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMarks(name); + } + performance.clearMarks = clearMarks; /** * Indicates whether the performance API is enabled. */ @@ -4021,7 +3863,6 @@ var ts; var typeCatalog = []; // NB: id is index + 1 var legendPath; var legend = []; - ; /** Starts tracing for the given project. */ function startTracing(tracingMode, traceDir, configFilePath) { ts.Debug.assert(!ts.tracing, "Tracing already started"); @@ -4226,7 +4067,7 @@ var ts; var substitutionType = type; substitutionProperties = { substitutionBaseType: (_o = substitutionType.baseType) === null || _o === void 0 ? void 0 : _o.id, - substituteType: (_p = substitutionType.substitute) === null || _p === void 0 ? void 0 : _p.id, + constraintType: (_p = substitutionType.constraint) === null || _p === void 0 ? void 0 : _p.id, }; } var reverseMappedProperties = {}; @@ -4426,257 +4267,260 @@ var ts; SyntaxKind[SyntaxKind["YieldKeyword"] = 125] = "YieldKeyword"; // Contextual keywords SyntaxKind[SyntaxKind["AbstractKeyword"] = 126] = "AbstractKeyword"; - SyntaxKind[SyntaxKind["AsKeyword"] = 127] = "AsKeyword"; - SyntaxKind[SyntaxKind["AssertsKeyword"] = 128] = "AssertsKeyword"; - SyntaxKind[SyntaxKind["AssertKeyword"] = 129] = "AssertKeyword"; - SyntaxKind[SyntaxKind["AnyKeyword"] = 130] = "AnyKeyword"; - SyntaxKind[SyntaxKind["AsyncKeyword"] = 131] = "AsyncKeyword"; - SyntaxKind[SyntaxKind["AwaitKeyword"] = 132] = "AwaitKeyword"; - SyntaxKind[SyntaxKind["BooleanKeyword"] = 133] = "BooleanKeyword"; - SyntaxKind[SyntaxKind["ConstructorKeyword"] = 134] = "ConstructorKeyword"; - SyntaxKind[SyntaxKind["DeclareKeyword"] = 135] = "DeclareKeyword"; - SyntaxKind[SyntaxKind["GetKeyword"] = 136] = "GetKeyword"; - SyntaxKind[SyntaxKind["InferKeyword"] = 137] = "InferKeyword"; - SyntaxKind[SyntaxKind["IntrinsicKeyword"] = 138] = "IntrinsicKeyword"; - SyntaxKind[SyntaxKind["IsKeyword"] = 139] = "IsKeyword"; - SyntaxKind[SyntaxKind["KeyOfKeyword"] = 140] = "KeyOfKeyword"; - SyntaxKind[SyntaxKind["ModuleKeyword"] = 141] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["NamespaceKeyword"] = 142] = "NamespaceKeyword"; - SyntaxKind[SyntaxKind["NeverKeyword"] = 143] = "NeverKeyword"; - SyntaxKind[SyntaxKind["OutKeyword"] = 144] = "OutKeyword"; - SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 145] = "ReadonlyKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 146] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 147] = "NumberKeyword"; - SyntaxKind[SyntaxKind["ObjectKeyword"] = 148] = "ObjectKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 149] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 150] = "StringKeyword"; - SyntaxKind[SyntaxKind["SymbolKeyword"] = 151] = "SymbolKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 152] = "TypeKeyword"; - SyntaxKind[SyntaxKind["UndefinedKeyword"] = 153] = "UndefinedKeyword"; - SyntaxKind[SyntaxKind["UniqueKeyword"] = 154] = "UniqueKeyword"; - SyntaxKind[SyntaxKind["UnknownKeyword"] = 155] = "UnknownKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 156] = "FromKeyword"; - SyntaxKind[SyntaxKind["GlobalKeyword"] = 157] = "GlobalKeyword"; - SyntaxKind[SyntaxKind["BigIntKeyword"] = 158] = "BigIntKeyword"; - SyntaxKind[SyntaxKind["OverrideKeyword"] = 159] = "OverrideKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 160] = "OfKeyword"; + SyntaxKind[SyntaxKind["AccessorKeyword"] = 127] = "AccessorKeyword"; + SyntaxKind[SyntaxKind["AsKeyword"] = 128] = "AsKeyword"; + SyntaxKind[SyntaxKind["AssertsKeyword"] = 129] = "AssertsKeyword"; + SyntaxKind[SyntaxKind["AssertKeyword"] = 130] = "AssertKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 131] = "AnyKeyword"; + SyntaxKind[SyntaxKind["AsyncKeyword"] = 132] = "AsyncKeyword"; + SyntaxKind[SyntaxKind["AwaitKeyword"] = 133] = "AwaitKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 134] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 135] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 136] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 137] = "GetKeyword"; + SyntaxKind[SyntaxKind["InferKeyword"] = 138] = "InferKeyword"; + SyntaxKind[SyntaxKind["IntrinsicKeyword"] = 139] = "IntrinsicKeyword"; + SyntaxKind[SyntaxKind["IsKeyword"] = 140] = "IsKeyword"; + SyntaxKind[SyntaxKind["KeyOfKeyword"] = 141] = "KeyOfKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 142] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["NamespaceKeyword"] = 143] = "NamespaceKeyword"; + SyntaxKind[SyntaxKind["NeverKeyword"] = 144] = "NeverKeyword"; + SyntaxKind[SyntaxKind["OutKeyword"] = 145] = "OutKeyword"; + SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 146] = "ReadonlyKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 147] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 148] = "NumberKeyword"; + SyntaxKind[SyntaxKind["ObjectKeyword"] = 149] = "ObjectKeyword"; + SyntaxKind[SyntaxKind["SatisfiesKeyword"] = 150] = "SatisfiesKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 151] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 152] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 153] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 154] = "TypeKeyword"; + SyntaxKind[SyntaxKind["UndefinedKeyword"] = 155] = "UndefinedKeyword"; + SyntaxKind[SyntaxKind["UniqueKeyword"] = 156] = "UniqueKeyword"; + SyntaxKind[SyntaxKind["UnknownKeyword"] = 157] = "UnknownKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 158] = "FromKeyword"; + SyntaxKind[SyntaxKind["GlobalKeyword"] = 159] = "GlobalKeyword"; + SyntaxKind[SyntaxKind["BigIntKeyword"] = 160] = "BigIntKeyword"; + SyntaxKind[SyntaxKind["OverrideKeyword"] = 161] = "OverrideKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 162] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 161] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 162] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 163] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 164] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 163] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 164] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 165] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 165] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 166] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 167] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 166] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 167] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 168] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 169] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["ClassStaticBlockDeclaration"] = 170] = "ClassStaticBlockDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 171] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 172] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 173] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 174] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 175] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 176] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 168] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 169] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 170] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 171] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["ClassStaticBlockDeclaration"] = 172] = "ClassStaticBlockDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 173] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 174] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 175] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 176] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 177] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 178] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypePredicate"] = 177] = "TypePredicate"; - SyntaxKind[SyntaxKind["TypeReference"] = 178] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 179] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 180] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 181] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 182] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 183] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 184] = "TupleType"; - SyntaxKind[SyntaxKind["OptionalType"] = 185] = "OptionalType"; - SyntaxKind[SyntaxKind["RestType"] = 186] = "RestType"; - SyntaxKind[SyntaxKind["UnionType"] = 187] = "UnionType"; - SyntaxKind[SyntaxKind["IntersectionType"] = 188] = "IntersectionType"; - SyntaxKind[SyntaxKind["ConditionalType"] = 189] = "ConditionalType"; - SyntaxKind[SyntaxKind["InferType"] = 190] = "InferType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 191] = "ParenthesizedType"; - SyntaxKind[SyntaxKind["ThisType"] = 192] = "ThisType"; - SyntaxKind[SyntaxKind["TypeOperator"] = 193] = "TypeOperator"; - SyntaxKind[SyntaxKind["IndexedAccessType"] = 194] = "IndexedAccessType"; - SyntaxKind[SyntaxKind["MappedType"] = 195] = "MappedType"; - SyntaxKind[SyntaxKind["LiteralType"] = 196] = "LiteralType"; - SyntaxKind[SyntaxKind["NamedTupleMember"] = 197] = "NamedTupleMember"; - SyntaxKind[SyntaxKind["TemplateLiteralType"] = 198] = "TemplateLiteralType"; - SyntaxKind[SyntaxKind["TemplateLiteralTypeSpan"] = 199] = "TemplateLiteralTypeSpan"; - SyntaxKind[SyntaxKind["ImportType"] = 200] = "ImportType"; + SyntaxKind[SyntaxKind["TypePredicate"] = 179] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 180] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 181] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 182] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 183] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 184] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 185] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 186] = "TupleType"; + SyntaxKind[SyntaxKind["OptionalType"] = 187] = "OptionalType"; + SyntaxKind[SyntaxKind["RestType"] = 188] = "RestType"; + SyntaxKind[SyntaxKind["UnionType"] = 189] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 190] = "IntersectionType"; + SyntaxKind[SyntaxKind["ConditionalType"] = 191] = "ConditionalType"; + SyntaxKind[SyntaxKind["InferType"] = 192] = "InferType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 193] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ThisType"] = 194] = "ThisType"; + SyntaxKind[SyntaxKind["TypeOperator"] = 195] = "TypeOperator"; + SyntaxKind[SyntaxKind["IndexedAccessType"] = 196] = "IndexedAccessType"; + SyntaxKind[SyntaxKind["MappedType"] = 197] = "MappedType"; + SyntaxKind[SyntaxKind["LiteralType"] = 198] = "LiteralType"; + SyntaxKind[SyntaxKind["NamedTupleMember"] = 199] = "NamedTupleMember"; + SyntaxKind[SyntaxKind["TemplateLiteralType"] = 200] = "TemplateLiteralType"; + SyntaxKind[SyntaxKind["TemplateLiteralTypeSpan"] = 201] = "TemplateLiteralTypeSpan"; + SyntaxKind[SyntaxKind["ImportType"] = 202] = "ImportType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 201] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 202] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 203] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 203] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 204] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 205] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 204] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 205] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 206] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 207] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 208] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 209] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 210] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 211] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 212] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 213] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 214] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 215] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 216] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 217] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 218] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 219] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 220] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 221] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 222] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 223] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 224] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElement"] = 225] = "SpreadElement"; - SyntaxKind[SyntaxKind["ClassExpression"] = 226] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 227] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 228] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 229] = "AsExpression"; - SyntaxKind[SyntaxKind["NonNullExpression"] = 230] = "NonNullExpression"; - SyntaxKind[SyntaxKind["MetaProperty"] = 231] = "MetaProperty"; - SyntaxKind[SyntaxKind["SyntheticExpression"] = 232] = "SyntheticExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 206] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 207] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 208] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 209] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 210] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 211] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 212] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 213] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 214] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 215] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 216] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 217] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 218] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 219] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 220] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 221] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 222] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 223] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 224] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 225] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 226] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElement"] = 227] = "SpreadElement"; + SyntaxKind[SyntaxKind["ClassExpression"] = 228] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 229] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 230] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 231] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 232] = "NonNullExpression"; + SyntaxKind[SyntaxKind["MetaProperty"] = 233] = "MetaProperty"; + SyntaxKind[SyntaxKind["SyntheticExpression"] = 234] = "SyntheticExpression"; + SyntaxKind[SyntaxKind["SatisfiesExpression"] = 235] = "SatisfiesExpression"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 233] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 234] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 236] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 237] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 235] = "Block"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 236] = "EmptyStatement"; - SyntaxKind[SyntaxKind["VariableStatement"] = 237] = "VariableStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 238] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 239] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 240] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 241] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 242] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 243] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 244] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 245] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 246] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 247] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 248] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 249] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 250] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 251] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 252] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 253] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 254] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 255] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 256] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 257] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 258] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 259] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 260] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 261] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 262] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 263] = "CaseBlock"; - SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 264] = "NamespaceExportDeclaration"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 265] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 266] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 267] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 268] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 269] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 270] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 271] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 272] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 273] = "NamedExports"; - SyntaxKind[SyntaxKind["NamespaceExport"] = 274] = "NamespaceExport"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 275] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 276] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 238] = "Block"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 239] = "EmptyStatement"; + SyntaxKind[SyntaxKind["VariableStatement"] = 240] = "VariableStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 241] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 242] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 243] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 244] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 245] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 246] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 247] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 248] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 249] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 250] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 251] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 252] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 253] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 254] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 255] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 256] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 257] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 258] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 259] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 260] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 261] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 262] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 263] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 264] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 265] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 266] = "CaseBlock"; + SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 267] = "NamespaceExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 268] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 269] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 270] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 271] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 272] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 273] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 274] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 275] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 276] = "NamedExports"; + SyntaxKind[SyntaxKind["NamespaceExport"] = 277] = "NamespaceExport"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 278] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 279] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 277] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 280] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 278] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 279] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 280] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 281] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxFragment"] = 282] = "JsxFragment"; - SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 283] = "JsxOpeningFragment"; - SyntaxKind[SyntaxKind["JsxClosingFragment"] = 284] = "JsxClosingFragment"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 285] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxAttributes"] = 286] = "JsxAttributes"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 287] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 288] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 281] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 282] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 283] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 284] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxFragment"] = 285] = "JsxFragment"; + SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 286] = "JsxOpeningFragment"; + SyntaxKind[SyntaxKind["JsxClosingFragment"] = 287] = "JsxClosingFragment"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 288] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxAttributes"] = 289] = "JsxAttributes"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 290] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 291] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 289] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 290] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 291] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 292] = "CatchClause"; - SyntaxKind[SyntaxKind["AssertClause"] = 293] = "AssertClause"; - SyntaxKind[SyntaxKind["AssertEntry"] = 294] = "AssertEntry"; - SyntaxKind[SyntaxKind["ImportTypeAssertionContainer"] = 295] = "ImportTypeAssertionContainer"; + SyntaxKind[SyntaxKind["CaseClause"] = 292] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 293] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 294] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 295] = "CatchClause"; + SyntaxKind[SyntaxKind["AssertClause"] = 296] = "AssertClause"; + SyntaxKind[SyntaxKind["AssertEntry"] = 297] = "AssertEntry"; + SyntaxKind[SyntaxKind["ImportTypeAssertionContainer"] = 298] = "ImportTypeAssertionContainer"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 296] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 297] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 298] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 299] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 300] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 301] = "SpreadAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 299] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 302] = "EnumMember"; // Unparsed - SyntaxKind[SyntaxKind["UnparsedPrologue"] = 300] = "UnparsedPrologue"; - SyntaxKind[SyntaxKind["UnparsedPrepend"] = 301] = "UnparsedPrepend"; - SyntaxKind[SyntaxKind["UnparsedText"] = 302] = "UnparsedText"; - SyntaxKind[SyntaxKind["UnparsedInternalText"] = 303] = "UnparsedInternalText"; - SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 304] = "UnparsedSyntheticReference"; + SyntaxKind[SyntaxKind["UnparsedPrologue"] = 303] = "UnparsedPrologue"; + SyntaxKind[SyntaxKind["UnparsedPrepend"] = 304] = "UnparsedPrepend"; + SyntaxKind[SyntaxKind["UnparsedText"] = 305] = "UnparsedText"; + SyntaxKind[SyntaxKind["UnparsedInternalText"] = 306] = "UnparsedInternalText"; + SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 307] = "UnparsedSyntheticReference"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 305] = "SourceFile"; - SyntaxKind[SyntaxKind["Bundle"] = 306] = "Bundle"; - SyntaxKind[SyntaxKind["UnparsedSource"] = 307] = "UnparsedSource"; - SyntaxKind[SyntaxKind["InputFiles"] = 308] = "InputFiles"; + SyntaxKind[SyntaxKind["SourceFile"] = 308] = "SourceFile"; + SyntaxKind[SyntaxKind["Bundle"] = 309] = "Bundle"; + SyntaxKind[SyntaxKind["UnparsedSource"] = 310] = "UnparsedSource"; + SyntaxKind[SyntaxKind["InputFiles"] = 311] = "InputFiles"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 309] = "JSDocTypeExpression"; - SyntaxKind[SyntaxKind["JSDocNameReference"] = 310] = "JSDocNameReference"; - SyntaxKind[SyntaxKind["JSDocMemberName"] = 311] = "JSDocMemberName"; - SyntaxKind[SyntaxKind["JSDocAllType"] = 312] = "JSDocAllType"; - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 313] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 314] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 315] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 316] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 317] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 318] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocNamepathType"] = 319] = "JSDocNamepathType"; - SyntaxKind[SyntaxKind["JSDoc"] = 320] = "JSDoc"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 312] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocNameReference"] = 313] = "JSDocNameReference"; + SyntaxKind[SyntaxKind["JSDocMemberName"] = 314] = "JSDocMemberName"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 315] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 316] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 317] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 318] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 319] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 320] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 321] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocNamepathType"] = 322] = "JSDocNamepathType"; + SyntaxKind[SyntaxKind["JSDoc"] = 323] = "JSDoc"; /** @deprecated Use SyntaxKind.JSDoc */ - SyntaxKind[SyntaxKind["JSDocComment"] = 320] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocText"] = 321] = "JSDocText"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 322] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocSignature"] = 323] = "JSDocSignature"; - SyntaxKind[SyntaxKind["JSDocLink"] = 324] = "JSDocLink"; - SyntaxKind[SyntaxKind["JSDocLinkCode"] = 325] = "JSDocLinkCode"; - SyntaxKind[SyntaxKind["JSDocLinkPlain"] = 326] = "JSDocLinkPlain"; - SyntaxKind[SyntaxKind["JSDocTag"] = 327] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 328] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocImplementsTag"] = 329] = "JSDocImplementsTag"; - SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 330] = "JSDocAuthorTag"; - SyntaxKind[SyntaxKind["JSDocDeprecatedTag"] = 331] = "JSDocDeprecatedTag"; - SyntaxKind[SyntaxKind["JSDocClassTag"] = 332] = "JSDocClassTag"; - SyntaxKind[SyntaxKind["JSDocPublicTag"] = 333] = "JSDocPublicTag"; - SyntaxKind[SyntaxKind["JSDocPrivateTag"] = 334] = "JSDocPrivateTag"; - SyntaxKind[SyntaxKind["JSDocProtectedTag"] = 335] = "JSDocProtectedTag"; - SyntaxKind[SyntaxKind["JSDocReadonlyTag"] = 336] = "JSDocReadonlyTag"; - SyntaxKind[SyntaxKind["JSDocOverrideTag"] = 337] = "JSDocOverrideTag"; - SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 338] = "JSDocCallbackTag"; - SyntaxKind[SyntaxKind["JSDocEnumTag"] = 339] = "JSDocEnumTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 340] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 341] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocThisTag"] = 342] = "JSDocThisTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 343] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 344] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 345] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocSeeTag"] = 346] = "JSDocSeeTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 347] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocComment"] = 323] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocText"] = 324] = "JSDocText"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 325] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocSignature"] = 326] = "JSDocSignature"; + SyntaxKind[SyntaxKind["JSDocLink"] = 327] = "JSDocLink"; + SyntaxKind[SyntaxKind["JSDocLinkCode"] = 328] = "JSDocLinkCode"; + SyntaxKind[SyntaxKind["JSDocLinkPlain"] = 329] = "JSDocLinkPlain"; + SyntaxKind[SyntaxKind["JSDocTag"] = 330] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 331] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocImplementsTag"] = 332] = "JSDocImplementsTag"; + SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 333] = "JSDocAuthorTag"; + SyntaxKind[SyntaxKind["JSDocDeprecatedTag"] = 334] = "JSDocDeprecatedTag"; + SyntaxKind[SyntaxKind["JSDocClassTag"] = 335] = "JSDocClassTag"; + SyntaxKind[SyntaxKind["JSDocPublicTag"] = 336] = "JSDocPublicTag"; + SyntaxKind[SyntaxKind["JSDocPrivateTag"] = 337] = "JSDocPrivateTag"; + SyntaxKind[SyntaxKind["JSDocProtectedTag"] = 338] = "JSDocProtectedTag"; + SyntaxKind[SyntaxKind["JSDocReadonlyTag"] = 339] = "JSDocReadonlyTag"; + SyntaxKind[SyntaxKind["JSDocOverrideTag"] = 340] = "JSDocOverrideTag"; + SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 341] = "JSDocCallbackTag"; + SyntaxKind[SyntaxKind["JSDocEnumTag"] = 342] = "JSDocEnumTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 343] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 344] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocThisTag"] = 345] = "JSDocThisTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 346] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 347] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 348] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocSeeTag"] = 349] = "JSDocSeeTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 350] = "JSDocPropertyTag"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 348] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 351] = "SyntaxList"; // Transformation nodes - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 349] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 350] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["CommaListExpression"] = 351] = "CommaListExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 352] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 353] = "EndOfDeclarationMarker"; - SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 354] = "SyntheticReferenceExpression"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 352] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 353] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["CommaListExpression"] = 354] = "CommaListExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 355] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 356] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 357] = "SyntheticReferenceExpression"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 355] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 358] = "Count"; // Markers SyntaxKind[SyntaxKind["FirstAssignment"] = 63] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 78] = "LastAssignment"; @@ -4685,15 +4529,15 @@ var ts; SyntaxKind[SyntaxKind["FirstReservedWord"] = 81] = "FirstReservedWord"; SyntaxKind[SyntaxKind["LastReservedWord"] = 116] = "LastReservedWord"; SyntaxKind[SyntaxKind["FirstKeyword"] = 81] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 160] = "LastKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 162] = "LastKeyword"; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 117] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 125] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 177] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 200] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 179] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 202] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 18] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 78] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 160] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 162] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; @@ -4702,15 +4546,15 @@ var ts; SyntaxKind[SyntaxKind["LastTemplateToken"] = 17] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 29] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 78] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstStatement"] = 237] = "FirstStatement"; - SyntaxKind[SyntaxKind["LastStatement"] = 253] = "LastStatement"; - SyntaxKind[SyntaxKind["FirstNode"] = 161] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 309] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 347] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 327] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 347] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstStatement"] = 240] = "FirstStatement"; + SyntaxKind[SyntaxKind["LastStatement"] = 256] = "LastStatement"; + SyntaxKind[SyntaxKind["FirstNode"] = 163] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 312] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 350] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 330] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 350] = "LastJSDocTagNode"; /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 126] = "FirstContextualKeyword"; - /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 160] = "LastContextualKeyword"; + /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 162] = "LastContextualKeyword"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); var NodeFlags; (function (NodeFlags) { @@ -4775,9 +4619,10 @@ var ts; ModifierFlags[ModifierFlags["Protected"] = 16] = "Protected"; ModifierFlags[ModifierFlags["Static"] = 32] = "Static"; ModifierFlags[ModifierFlags["Readonly"] = 64] = "Readonly"; - ModifierFlags[ModifierFlags["Abstract"] = 128] = "Abstract"; - ModifierFlags[ModifierFlags["Async"] = 256] = "Async"; - ModifierFlags[ModifierFlags["Default"] = 512] = "Default"; + ModifierFlags[ModifierFlags["Accessor"] = 128] = "Accessor"; + ModifierFlags[ModifierFlags["Abstract"] = 256] = "Abstract"; + ModifierFlags[ModifierFlags["Async"] = 512] = "Async"; + ModifierFlags[ModifierFlags["Default"] = 1024] = "Default"; ModifierFlags[ModifierFlags["Const"] = 2048] = "Const"; ModifierFlags[ModifierFlags["HasComputedJSDocModifiers"] = 4096] = "HasComputedJSDocModifiers"; ModifierFlags[ModifierFlags["Deprecated"] = 8192] = "Deprecated"; @@ -4790,10 +4635,10 @@ var ts; // Accessibility modifiers and 'readonly' can be attached to a parameter in a constructor to make it a property. ModifierFlags[ModifierFlags["ParameterPropertyModifier"] = 16476] = "ParameterPropertyModifier"; ModifierFlags[ModifierFlags["NonPublicAccessibilityModifier"] = 24] = "NonPublicAccessibilityModifier"; - ModifierFlags[ModifierFlags["TypeScriptModifier"] = 116958] = "TypeScriptModifier"; - ModifierFlags[ModifierFlags["ExportDefault"] = 513] = "ExportDefault"; - ModifierFlags[ModifierFlags["All"] = 257023] = "All"; - ModifierFlags[ModifierFlags["Modifier"] = 125951] = "Modifier"; + ModifierFlags[ModifierFlags["TypeScriptModifier"] = 117086] = "TypeScriptModifier"; + ModifierFlags[ModifierFlags["ExportDefault"] = 1025] = "ExportDefault"; + ModifierFlags[ModifierFlags["All"] = 258047] = "All"; + ModifierFlags[ModifierFlags["Modifier"] = 126975] = "Modifier"; })(ModifierFlags = ts.ModifierFlags || (ts.ModifierFlags = {})); var JsxFlags; (function (JsxFlags) { @@ -4989,6 +4834,7 @@ var ts; NodeBuilderFlags[NodeBuilderFlags["AllowEmptyTuple"] = 524288] = "AllowEmptyTuple"; NodeBuilderFlags[NodeBuilderFlags["AllowUniqueESSymbolType"] = 1048576] = "AllowUniqueESSymbolType"; NodeBuilderFlags[NodeBuilderFlags["AllowEmptyIndexInfoType"] = 2097152] = "AllowEmptyIndexInfoType"; + /* @internal */ NodeBuilderFlags[NodeBuilderFlags["WriteComputedProps"] = 1073741824] = "WriteComputedProps"; // Errors (cont.) NodeBuilderFlags[NodeBuilderFlags["AllowNodeModulesRelativePaths"] = 67108864] = "AllowNodeModulesRelativePaths"; /* @internal */ NodeBuilderFlags[NodeBuilderFlags["DoNotIncludeSymbolChain"] = 134217728] = "DoNotIncludeSymbolChain"; @@ -5049,8 +4895,10 @@ var ts; SymbolFormatFlags[SymbolFormatFlags["AllowAnyNodeKind"] = 4] = "AllowAnyNodeKind"; // Prefer aliases which are not directly visible SymbolFormatFlags[SymbolFormatFlags["UseAliasDefinedOutsideCurrentScope"] = 8] = "UseAliasDefinedOutsideCurrentScope"; + // { [E.A]: 1 } + /* @internal */ SymbolFormatFlags[SymbolFormatFlags["WriteComputedProps"] = 16] = "WriteComputedProps"; // Skip building an accessible symbol chain - /* @internal */ SymbolFormatFlags[SymbolFormatFlags["DoNotIncludeSymbolChain"] = 16] = "DoNotIncludeSymbolChain"; + /* @internal */ SymbolFormatFlags[SymbolFormatFlags["DoNotIncludeSymbolChain"] = 32] = "DoNotIncludeSymbolChain"; })(SymbolFormatFlags = ts.SymbolFormatFlags || (ts.SymbolFormatFlags = {})); /* @internal */ var SymbolAccessibility; @@ -5164,6 +5012,7 @@ var ts; SymbolFlags[SymbolFlags["MethodExcludes"] = 103359] = "MethodExcludes"; SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 46015] = "GetAccessorExcludes"; SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 78783] = "SetAccessorExcludes"; + SymbolFlags[SymbolFlags["AccessorExcludes"] = 13247] = "AccessorExcludes"; SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 526824] = "TypeParameterExcludes"; SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 788968] = "TypeAliasExcludes"; SymbolFlags[SymbolFlags["AliasExcludes"] = 2097152] = "AliasExcludes"; @@ -6290,7 +6139,6 @@ var ts; var pollingChunkSize = createPollingIntervalBasedLevels(defaultChunkLevels); /* @internal */ ts.unchangedPollThresholds = createPollingIntervalBasedLevels(defaultChunkLevels); - /* @internal */ function setCustomPollingValues(system) { if (!system.getEnvironmentVariable) { return; @@ -6333,7 +6181,6 @@ var ts; createPollingIntervalBasedLevels(customLevels ? __assign(__assign({}, defaultLevels), customLevels) : defaultLevels); } } - ts.setCustomPollingValues = setCustomPollingValues; function pollWatchedFileQueue(host, queue, pollIndex, chunkSize, callbackOnWatchFileStat) { var definedValueCopyToIndex = pollIndex; // Max visit would be all elements of the queue @@ -6379,7 +6226,6 @@ var ts; } } } - /* @internal */ function createDynamicPriorityPollingWatchFile(host) { var watchedFiles = []; var changedFilesInLastPoll = []; @@ -6488,7 +6334,6 @@ var ts; pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === PollingInterval.Low ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval)); } } - ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile; function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) { // One file can have multiple watchers var fileWatcherCallbacks = ts.createMultiMap(); @@ -6567,42 +6412,38 @@ var ts; pollScheduled = host.setTimeout(pollQueue, PollingInterval.High); } } - /* @internal */ - function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) { - var cache = new ts.Map(); - var callbacksCache = ts.createMultiMap(); + function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) { var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); - return function (fileName, callback, pollingInterval, options) { - var path = toCanonicalFileName(fileName); - var existing = cache.get(path); - if (existing) { - existing.refCount++; + var path = toCanonicalFileName(name); + var existing = cache.get(path); + if (existing) { + existing.callbacks.push(callback); + } + else { + cache.set(path, { + watcher: createWatcher(( + // Cant infer types correctly so lets satisfy checker + function (param1, param2, param3) { var _a; return (_a = cache.get(path)) === null || _a === void 0 ? void 0 : _a.callbacks.slice().forEach(function (cb) { return cb(param1, param2, param3); }); })), + callbacks: [callback] + }); + } + return { + close: function () { + var watcher = cache.get(path); + // Watcher is not expected to be undefined, but if it is normally its because + // exception was thrown somewhere else and watch state is not what it should be + if (!watcher) + return; + if (!ts.orderedRemoveItem(watcher.callbacks, callback) || watcher.callbacks.length) + return; + cache.delete(path); + ts.closeFileWatcherOf(watcher); } - else { - cache.set(path, { - watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options), - refCount: 1 - }); - } - callbacksCache.add(path, callback); - return { - close: function () { - var watcher = ts.Debug.checkDefined(cache.get(path)); - callbacksCache.remove(path, callback); - watcher.refCount--; - if (watcher.refCount) - return; - cache.delete(path); - ts.closeFileWatcherOf(watcher); - } - }; }; } - ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName; /** * Returns true if file status changed */ - /*@internal*/ function onWatchedFileStat(watchedFile, modifiedTime) { var oldTime = watchedFile.mtime.getTime(); var newTime = modifiedTime.getTime(); @@ -6614,7 +6455,6 @@ var ts; } return false; } - ts.onWatchedFileStat = onWatchedFileStat; /*@internal*/ function getFileWatcherEventKind(oldTime, newTime) { return oldTime === 0 @@ -6642,7 +6482,6 @@ var ts; * that means if this is recursive watcher, watch the children directories as well * (eg on OS that dont support recursive watch using fs.watch use fs.watchFile) */ - /*@internal*/ function createDirectoryWatcherSupportingRecursive(_a) { var watchDirectory = _a.watchDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, fileSystemEntryExists = _a.fileSystemEntryExists, realpath = _a.realpath, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout; var cache = new ts.Map(); @@ -6851,18 +6690,15 @@ var ts; return ts.stringContains(toCanonicalFilePath(path), searchPath); } } - ts.createDirectoryWatcherSupportingRecursive = createDirectoryWatcherSupportingRecursive; /*@internal*/ var FileSystemEntryKind; (function (FileSystemEntryKind) { FileSystemEntryKind[FileSystemEntryKind["File"] = 0] = "File"; FileSystemEntryKind[FileSystemEntryKind["Directory"] = 1] = "Directory"; })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {})); - /*@internal*/ function createFileWatcherCallback(callback) { return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); }; } - ts.createFileWatcherCallback = createFileWatcherCallback; function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) { return function (eventName, _relativeFileName, modifiedTime) { if (eventName === "rename") { @@ -6896,7 +6732,10 @@ var ts; } /*@internal*/ function createSystemWatchFunctions(_a) { - var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog; + var pollingWatchFileWorker = _a.pollingWatchFileWorker, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog; + var pollingWatches = new ts.Map(); + var fsWatches = new ts.Map(); + var fsWatchesRecursive = new ts.Map(); var dynamicPollingWatchFile; var fixedChunkSizePollingWatchFile; var nonPollingWatchFile; @@ -6960,7 +6799,7 @@ var ts; // Use notifications from FS to watch with falling back to fs.watchFile generateWatchFileOptions(ts.WatchFileKind.UseFsEventsOnParentDirectory, ts.PollingWatchKind.PriorityInterval, options) : // Default to do not use fixed polling interval - { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.FixedPollingInterval }; + { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.UseFsEvents }; } } function generateWatchFileOptions(watchFile, fallbackPolling, options) { @@ -7031,7 +6870,13 @@ var ts; }; } } + function pollingWatchFile(fileName, callback, pollingInterval, options) { + return createSingleWatcherPerName(pollingWatches, useCaseSensitiveFileNames, fileName, callback, function (cb) { return pollingWatchFileWorker(fileName, cb, pollingInterval, options); }); + } function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { + return createSingleWatcherPerName(recursive ? fsWatchesRecursive : fsWatches, useCaseSensitiveFileNames, fileOrDirectory, callback, function (cb) { return fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, cb, recursive, fallbackPollingInterval, fallbackOptions); }); + } + function fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { var lastDirectoryPartWithDirectorySeparator; var lastDirectoryPart; if (inodeWatching) { @@ -7210,7 +7055,7 @@ var ts; var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin"); var getCurrentDirectory = ts.memoize(function () { return process.cwd(); }); var _b = createSystemWatchFunctions({ - pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames), + pollingWatchFileWorker: fsWatchFileWorker, getModifiedTime: getModifiedTime, setTimeout: setTimeout, clearTimeout: clearTimeout, @@ -8030,12 +7875,9 @@ var ts; * Normalize path separators, converting `\` into `/`. */ function normalizeSlashes(path) { - var index = path.indexOf("\\"); - if (index === -1) { - return path; - } - backslashRegExp.lastIndex = index; // prime regex with known position - return path.replace(backslashRegExp, ts.directorySeparator); + return path.indexOf("\\") !== -1 + ? path.replace(backslashRegExp, ts.directorySeparator) + : path; } ts.normalizeSlashes = normalizeSlashes; /** @@ -8618,6 +8460,8 @@ var ts; A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled: diag(1272, ts.DiagnosticCategory.Error, "A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_w_1272", "A type referenced in a decorated signature must be imported with 'import type' or a namespace import when 'isolatedModules' and 'emitDecoratorMetadata' are enabled."), _0_modifier_cannot_appear_on_a_type_parameter: diag(1273, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_type_parameter_1273", "'{0}' modifier cannot appear on a type parameter"), _0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias: diag(1274, ts.DiagnosticCategory.Error, "_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias_1274", "'{0}' modifier can only appear on a type parameter of a class, interface or type alias"), + accessor_modifier_can_only_appear_on_a_property_declaration: diag(1275, ts.DiagnosticCategory.Error, "accessor_modifier_can_only_appear_on_a_property_declaration_1275", "'accessor' modifier can only appear on a property declaration."), + An_accessor_property_cannot_be_declared_optional: diag(1276, ts.DiagnosticCategory.Error, "An_accessor_property_cannot_be_declared_optional_1276", "An 'accessor' property cannot be declared optional."), with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."), await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."), The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, ts.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."), @@ -8668,7 +8512,7 @@ var ts; An_enum_member_name_must_be_followed_by_a_or: diag(1357, ts.DiagnosticCategory.Error, "An_enum_member_name_must_be_followed_by_a_or_1357", "An enum member name must be followed by a ',', '=', or '}'."), Tagged_template_expressions_are_not_permitted_in_an_optional_chain: diag(1358, ts.DiagnosticCategory.Error, "Tagged_template_expressions_are_not_permitted_in_an_optional_chain_1358", "Tagged template expressions are not permitted in an optional chain."), Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here: diag(1359, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here_1359", "Identifier expected. '{0}' is a reserved word that cannot be used here."), - Class_constructor_may_not_be_a_generator: diag(1360, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1360", "Class constructor may not be a generator."), + Type_0_does_not_satisfy_the_expected_type_1: diag(1360, ts.DiagnosticCategory.Error, "Type_0_does_not_satisfy_the_expected_type_1_1360", "Type '{0}' does not satisfy the expected type '{1}'."), _0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type: diag(1361, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type_1361", "'{0}' cannot be used as a value because it was imported using 'import type'."), _0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type: diag(1362, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type_1362", "'{0}' cannot be used as a value because it was exported using 'export type'."), A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both: diag(1363, ts.DiagnosticCategory.Error, "A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both_1363", "A type-only import can specify a default import or named bindings, but not both."), @@ -8676,6 +8520,7 @@ var ts; Convert_all_re_exported_types_to_type_only_exports: diag(1365, ts.DiagnosticCategory.Message, "Convert_all_re_exported_types_to_type_only_exports_1365", "Convert all re-exported types to type-only exports"), Split_into_two_separate_import_declarations: diag(1366, ts.DiagnosticCategory.Message, "Split_into_two_separate_import_declarations_1366", "Split into two separate import declarations"), Split_all_invalid_type_only_imports: diag(1367, ts.DiagnosticCategory.Message, "Split_all_invalid_type_only_imports_1367", "Split all invalid type-only imports"), + Class_constructor_may_not_be_a_generator: diag(1368, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1368", "Class constructor may not be a generator."), Did_you_mean_0: diag(1369, ts.DiagnosticCategory.Message, "Did_you_mean_0_1369", "Did you mean '{0}'?"), This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error: diag(1371, ts.DiagnosticCategory.Error, "This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set__1371", "This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'."), Convert_to_type_only_import: diag(1373, ts.DiagnosticCategory.Message, "Convert_to_type_only_import_1373", "Convert to type-only import"), @@ -8849,14 +8694,12 @@ var ts; The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."), The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."), The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."), - The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360", "The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."), - The_right_hand_side_of_an_in_expression_must_not_be_a_primitive: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361", "The right-hand side of an 'in' expression must not be a primitive."), The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."), Operator_0_cannot_be_applied_to_types_1_and_2: diag(2365, ts.DiagnosticCategory.Error, "Operator_0_cannot_be_applied_to_types_1_and_2_2365", "Operator '{0}' cannot be applied to types '{1}' and '{2}'."), Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: diag(2366, ts.DiagnosticCategory.Error, "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", "Function lacks ending return statement and return type does not include 'undefined'."), - This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367", "This condition will always return '{0}' since the types '{1}' and '{2}' have no overlap."), + This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367", "This comparison appears to be unintentional because the types '{0}' and '{1}' have no overlap."), Type_parameter_name_cannot_be_0: diag(2368, ts.DiagnosticCategory.Error, "Type_parameter_name_cannot_be_0_2368", "Type parameter name cannot be '{0}'."), A_parameter_property_is_only_allowed_in_a_constructor_implementation: diag(2369, ts.DiagnosticCategory.Error, "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", "A parameter property is only allowed in a constructor implementation."), A_rest_parameter_must_be_of_an_array_type: diag(2370, ts.DiagnosticCategory.Error, "A_rest_parameter_must_be_of_an_array_type_2370", "A rest parameter must be of an array type."), @@ -9099,6 +8942,7 @@ var ts; Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."), Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation: diag(2636, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation_2636", "Type '{0}' is not assignable to type '{1}' as implied by variance annotation."), Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types: diag(2637, ts.DiagnosticCategory.Error, "Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_t_2637", "Variance annotations are only supported in type aliases for object, function, constructor, and mapped types."), + Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator: diag(2638, ts.DiagnosticCategory.Error, "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638", "Type '{0}' may represent a primitive value, which is not permitted as the right operand of the 'in' operator."), Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."), A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."), Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."), @@ -9279,6 +9123,7 @@ var ts; _0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation: diag(2842, ts.DiagnosticCategory.Error, "_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842", "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"), We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here: diag(2843, ts.DiagnosticCategory.Error, "We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843", "We can only write a type for '{0}' by adding a type for the entire parameter here."), Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, ts.DiagnosticCategory.Error, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."), + This_condition_will_always_return_0: diag(2845, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."), Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."), Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."), Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."), @@ -9736,6 +9581,7 @@ var ts; Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved: diag(6398, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."), Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes were not emitted"), Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs to update timestamps of output files that are older than input files"), + Project_0_is_out_of_date_because_there_was_error_reading_file_1: diag(6401, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401", "Project '{0}' is out of date because there was error reading file '{1}'"), The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"), The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."), The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."), @@ -9978,6 +9824,7 @@ var ts; The_tag_was_first_specified_here: diag(8034, ts.DiagnosticCategory.Error, "The_tag_was_first_specified_here_8034", "The tag was first specified here."), You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder: diag(8035, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder_8035", "You cannot rename elements that are defined in a 'node_modules' folder."), You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder: diag(8036, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder_8036", "You cannot rename elements that are defined in another 'node_modules' folder."), + Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files: diag(8037, ts.DiagnosticCategory.Error, "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037", "Type satisfaction expressions can only be used in TypeScript files."), Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."), Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."), JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17000, ts.DiagnosticCategory.Error, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."), @@ -10149,6 +9996,7 @@ var ts; Set_the_module_option_in_your_configuration_file_to_0: diag(95099, ts.DiagnosticCategory.Message, "Set_the_module_option_in_your_configuration_file_to_0_95099", "Set the 'module' option in your configuration file to '{0}'"), Convert_invalid_character_to_its_html_entity_code: diag(95100, ts.DiagnosticCategory.Message, "Convert_invalid_character_to_its_html_entity_code_95100", "Convert invalid character to its html entity code"), Convert_all_invalid_characters_to_HTML_entity_code: diag(95101, ts.DiagnosticCategory.Message, "Convert_all_invalid_characters_to_HTML_entity_code_95101", "Convert all invalid characters to HTML entity code"), + Convert_all_const_to_let: diag(95102, ts.DiagnosticCategory.Message, "Convert_all_const_to_let_95102", "Convert all 'const' to 'let'"), Convert_function_expression_0_to_arrow_function: diag(95105, ts.DiagnosticCategory.Message, "Convert_function_expression_0_to_arrow_function_95105", "Convert function expression '{0}' to arrow function"), Convert_function_declaration_0_to_arrow_function: diag(95106, ts.DiagnosticCategory.Message, "Convert_function_declaration_0_to_arrow_function_95106", "Convert function declaration '{0}' to arrow function"), Fix_all_implicit_this_errors: diag(95107, ts.DiagnosticCategory.Message, "Fix_all_implicit_this_errors_95107", "Fix all implicit-'this' errors"), @@ -10218,6 +10066,8 @@ var ts; Delete_unused_param_tag_0: diag(95171, ts.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"), Delete_all_unused_param_tags: diag(95172, ts.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"), Rename_param_tag_name_0_to_1: diag(95173, ts.DiagnosticCategory.Message, "Rename_param_tag_name_0_to_1_95173", "Rename '@param' tag name '{0}' to '{1}'"), + Use_0: diag(95174, ts.DiagnosticCategory.Message, "Use_0_95174", "Use `{0}`."), + Use_Number_isNaN_in_all_conditions: diag(95175, ts.DiagnosticCategory.Message, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."), No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."), Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."), JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, ts.DiagnosticCategory.Error, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"), @@ -10251,6 +10101,12 @@ var ts; _0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation: diag(18042, ts.DiagnosticCategory.Error, "_0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation_18042", "'{0}' is a type and cannot be imported in JavaScript files. Use '{1}' in a JSDoc type annotation."), Types_cannot_appear_in_export_declarations_in_JavaScript_files: diag(18043, ts.DiagnosticCategory.Error, "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043", "Types cannot appear in export declarations in JavaScript files."), _0_is_automatically_exported_here: diag(18044, ts.DiagnosticCategory.Message, "_0_is_automatically_exported_here_18044", "'{0}' is automatically exported here."), + Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher: diag(18045, ts.DiagnosticCategory.Error, "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045", "Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher."), + _0_is_of_type_unknown: diag(18046, ts.DiagnosticCategory.Error, "_0_is_of_type_unknown_18046", "'{0}' is of type 'unknown'."), + _0_is_possibly_null: diag(18047, ts.DiagnosticCategory.Error, "_0_is_possibly_null_18047", "'{0}' is possibly 'null'."), + _0_is_possibly_undefined: diag(18048, ts.DiagnosticCategory.Error, "_0_is_possibly_undefined_18048", "'{0}' is possibly 'undefined'."), + _0_is_possibly_null_or_undefined: diag(18049, ts.DiagnosticCategory.Error, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."), + The_value_0_cannot_be_used_here: diag(18050, ts.DiagnosticCategory.Error, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."), }; })(ts || (ts = {})); var ts; @@ -10269,12 +10125,13 @@ var ts; /** @internal */ ts.textToKeywordObj = (_a = { abstract: 126 /* SyntaxKind.AbstractKeyword */, - any: 130 /* SyntaxKind.AnyKeyword */, - as: 127 /* SyntaxKind.AsKeyword */, - asserts: 128 /* SyntaxKind.AssertsKeyword */, - assert: 129 /* SyntaxKind.AssertKeyword */, - bigint: 158 /* SyntaxKind.BigIntKeyword */, - boolean: 133 /* SyntaxKind.BooleanKeyword */, + accessor: 127 /* SyntaxKind.AccessorKeyword */, + any: 131 /* SyntaxKind.AnyKeyword */, + as: 128 /* SyntaxKind.AsKeyword */, + asserts: 129 /* SyntaxKind.AssertsKeyword */, + assert: 130 /* SyntaxKind.AssertKeyword */, + bigint: 160 /* SyntaxKind.BigIntKeyword */, + boolean: 134 /* SyntaxKind.BooleanKeyword */, break: 81 /* SyntaxKind.BreakKeyword */, case: 82 /* SyntaxKind.CaseKeyword */, catch: 83 /* SyntaxKind.CatchKeyword */, @@ -10282,9 +10139,9 @@ var ts; continue: 86 /* SyntaxKind.ContinueKeyword */, const: 85 /* SyntaxKind.ConstKeyword */ }, - _a["" + "constructor"] = 134 /* SyntaxKind.ConstructorKeyword */, + _a["" + "constructor"] = 135 /* SyntaxKind.ConstructorKeyword */, _a.debugger = 87 /* SyntaxKind.DebuggerKeyword */, - _a.declare = 135 /* SyntaxKind.DeclareKeyword */, + _a.declare = 136 /* SyntaxKind.DeclareKeyword */, _a.default = 88 /* SyntaxKind.DefaultKeyword */, _a.delete = 89 /* SyntaxKind.DeleteKeyword */, _a.do = 90 /* SyntaxKind.DoKeyword */, @@ -10295,60 +10152,61 @@ var ts; _a.false = 95 /* SyntaxKind.FalseKeyword */, _a.finally = 96 /* SyntaxKind.FinallyKeyword */, _a.for = 97 /* SyntaxKind.ForKeyword */, - _a.from = 156 /* SyntaxKind.FromKeyword */, + _a.from = 158 /* SyntaxKind.FromKeyword */, _a.function = 98 /* SyntaxKind.FunctionKeyword */, - _a.get = 136 /* SyntaxKind.GetKeyword */, + _a.get = 137 /* SyntaxKind.GetKeyword */, _a.if = 99 /* SyntaxKind.IfKeyword */, _a.implements = 117 /* SyntaxKind.ImplementsKeyword */, _a.import = 100 /* SyntaxKind.ImportKeyword */, _a.in = 101 /* SyntaxKind.InKeyword */, - _a.infer = 137 /* SyntaxKind.InferKeyword */, + _a.infer = 138 /* SyntaxKind.InferKeyword */, _a.instanceof = 102 /* SyntaxKind.InstanceOfKeyword */, _a.interface = 118 /* SyntaxKind.InterfaceKeyword */, - _a.intrinsic = 138 /* SyntaxKind.IntrinsicKeyword */, - _a.is = 139 /* SyntaxKind.IsKeyword */, - _a.keyof = 140 /* SyntaxKind.KeyOfKeyword */, + _a.intrinsic = 139 /* SyntaxKind.IntrinsicKeyword */, + _a.is = 140 /* SyntaxKind.IsKeyword */, + _a.keyof = 141 /* SyntaxKind.KeyOfKeyword */, _a.let = 119 /* SyntaxKind.LetKeyword */, - _a.module = 141 /* SyntaxKind.ModuleKeyword */, - _a.namespace = 142 /* SyntaxKind.NamespaceKeyword */, - _a.never = 143 /* SyntaxKind.NeverKeyword */, + _a.module = 142 /* SyntaxKind.ModuleKeyword */, + _a.namespace = 143 /* SyntaxKind.NamespaceKeyword */, + _a.never = 144 /* SyntaxKind.NeverKeyword */, _a.new = 103 /* SyntaxKind.NewKeyword */, _a.null = 104 /* SyntaxKind.NullKeyword */, - _a.number = 147 /* SyntaxKind.NumberKeyword */, - _a.object = 148 /* SyntaxKind.ObjectKeyword */, + _a.number = 148 /* SyntaxKind.NumberKeyword */, + _a.object = 149 /* SyntaxKind.ObjectKeyword */, _a.package = 120 /* SyntaxKind.PackageKeyword */, _a.private = 121 /* SyntaxKind.PrivateKeyword */, _a.protected = 122 /* SyntaxKind.ProtectedKeyword */, _a.public = 123 /* SyntaxKind.PublicKeyword */, - _a.override = 159 /* SyntaxKind.OverrideKeyword */, - _a.out = 144 /* SyntaxKind.OutKeyword */, - _a.readonly = 145 /* SyntaxKind.ReadonlyKeyword */, - _a.require = 146 /* SyntaxKind.RequireKeyword */, - _a.global = 157 /* SyntaxKind.GlobalKeyword */, + _a.override = 161 /* SyntaxKind.OverrideKeyword */, + _a.out = 145 /* SyntaxKind.OutKeyword */, + _a.readonly = 146 /* SyntaxKind.ReadonlyKeyword */, + _a.require = 147 /* SyntaxKind.RequireKeyword */, + _a.global = 159 /* SyntaxKind.GlobalKeyword */, _a.return = 105 /* SyntaxKind.ReturnKeyword */, - _a.set = 149 /* SyntaxKind.SetKeyword */, + _a.satisfies = 150 /* SyntaxKind.SatisfiesKeyword */, + _a.set = 151 /* SyntaxKind.SetKeyword */, _a.static = 124 /* SyntaxKind.StaticKeyword */, - _a.string = 150 /* SyntaxKind.StringKeyword */, + _a.string = 152 /* SyntaxKind.StringKeyword */, _a.super = 106 /* SyntaxKind.SuperKeyword */, _a.switch = 107 /* SyntaxKind.SwitchKeyword */, - _a.symbol = 151 /* SyntaxKind.SymbolKeyword */, + _a.symbol = 153 /* SyntaxKind.SymbolKeyword */, _a.this = 108 /* SyntaxKind.ThisKeyword */, _a.throw = 109 /* SyntaxKind.ThrowKeyword */, _a.true = 110 /* SyntaxKind.TrueKeyword */, _a.try = 111 /* SyntaxKind.TryKeyword */, - _a.type = 152 /* SyntaxKind.TypeKeyword */, + _a.type = 154 /* SyntaxKind.TypeKeyword */, _a.typeof = 112 /* SyntaxKind.TypeOfKeyword */, - _a.undefined = 153 /* SyntaxKind.UndefinedKeyword */, - _a.unique = 154 /* SyntaxKind.UniqueKeyword */, - _a.unknown = 155 /* SyntaxKind.UnknownKeyword */, + _a.undefined = 155 /* SyntaxKind.UndefinedKeyword */, + _a.unique = 156 /* SyntaxKind.UniqueKeyword */, + _a.unknown = 157 /* SyntaxKind.UnknownKeyword */, _a.var = 113 /* SyntaxKind.VarKeyword */, _a.void = 114 /* SyntaxKind.VoidKeyword */, _a.while = 115 /* SyntaxKind.WhileKeyword */, _a.with = 116 /* SyntaxKind.WithKeyword */, _a.yield = 125 /* SyntaxKind.YieldKeyword */, - _a.async = 131 /* SyntaxKind.AsyncKeyword */, - _a.await = 132 /* SyntaxKind.AwaitKeyword */, - _a.of = 160 /* SyntaxKind.OfKeyword */, + _a.async = 132 /* SyntaxKind.AsyncKeyword */, + _a.await = 133 /* SyntaxKind.AwaitKeyword */, + _a.of = 162 /* SyntaxKind.OfKeyword */, _a); var textToKeyword = new ts.Map(ts.getEntries(ts.textToKeywordObj)); var textToToken = new ts.Map(ts.getEntries(__assign(__assign({}, ts.textToKeywordObj), { "{": 18 /* SyntaxKind.OpenBraceToken */, "}": 19 /* SyntaxKind.CloseBraceToken */, "(": 20 /* SyntaxKind.OpenParenToken */, ")": 21 /* SyntaxKind.CloseParenToken */, "[": 22 /* SyntaxKind.OpenBracketToken */, "]": 23 /* SyntaxKind.CloseBracketToken */, ".": 24 /* SyntaxKind.DotToken */, "...": 25 /* SyntaxKind.DotDotDotToken */, ";": 26 /* SyntaxKind.SemicolonToken */, ",": 27 /* SyntaxKind.CommaToken */, "<": 29 /* SyntaxKind.LessThanToken */, ">": 31 /* SyntaxKind.GreaterThanToken */, "<=": 32 /* SyntaxKind.LessThanEqualsToken */, ">=": 33 /* SyntaxKind.GreaterThanEqualsToken */, "==": 34 /* SyntaxKind.EqualsEqualsToken */, "!=": 35 /* SyntaxKind.ExclamationEqualsToken */, "===": 36 /* SyntaxKind.EqualsEqualsEqualsToken */, "!==": 37 /* SyntaxKind.ExclamationEqualsEqualsToken */, "=>": 38 /* SyntaxKind.EqualsGreaterThanToken */, "+": 39 /* SyntaxKind.PlusToken */, "-": 40 /* SyntaxKind.MinusToken */, "**": 42 /* SyntaxKind.AsteriskAsteriskToken */, "*": 41 /* SyntaxKind.AsteriskToken */, "/": 43 /* SyntaxKind.SlashToken */, "%": 44 /* SyntaxKind.PercentToken */, "++": 45 /* SyntaxKind.PlusPlusToken */, "--": 46 /* SyntaxKind.MinusMinusToken */, "<<": 47 /* SyntaxKind.LessThanLessThanToken */, ">": 48 /* SyntaxKind.GreaterThanGreaterThanToken */, ">>>": 49 /* SyntaxKind.GreaterThanGreaterThanGreaterThanToken */, "&": 50 /* SyntaxKind.AmpersandToken */, "|": 51 /* SyntaxKind.BarToken */, "^": 52 /* SyntaxKind.CaretToken */, "!": 53 /* SyntaxKind.ExclamationToken */, "~": 54 /* SyntaxKind.TildeToken */, "&&": 55 /* SyntaxKind.AmpersandAmpersandToken */, "||": 56 /* SyntaxKind.BarBarToken */, "?": 57 /* SyntaxKind.QuestionToken */, "??": 60 /* SyntaxKind.QuestionQuestionToken */, "?.": 28 /* SyntaxKind.QuestionDotToken */, ":": 58 /* SyntaxKind.ColonToken */, "=": 63 /* SyntaxKind.EqualsToken */, "+=": 64 /* SyntaxKind.PlusEqualsToken */, "-=": 65 /* SyntaxKind.MinusEqualsToken */, "*=": 66 /* SyntaxKind.AsteriskEqualsToken */, "**=": 67 /* SyntaxKind.AsteriskAsteriskEqualsToken */, "/=": 68 /* SyntaxKind.SlashEqualsToken */, "%=": 69 /* SyntaxKind.PercentEqualsToken */, "<<=": 70 /* SyntaxKind.LessThanLessThanEqualsToken */, ">>=": 71 /* SyntaxKind.GreaterThanGreaterThanEqualsToken */, ">>>=": 72 /* SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 73 /* SyntaxKind.AmpersandEqualsToken */, "|=": 74 /* SyntaxKind.BarEqualsToken */, "^=": 78 /* SyntaxKind.CaretEqualsToken */, "||=": 75 /* SyntaxKind.BarBarEqualsToken */, "&&=": 76 /* SyntaxKind.AmpersandAmpersandEqualsToken */, "??=": 77 /* SyntaxKind.QuestionQuestionEqualsToken */, "@": 59 /* SyntaxKind.AtToken */, "#": 62 /* SyntaxKind.HashToken */, "`": 61 /* SyntaxKind.BacktickToken */ }))); @@ -10471,7 +10329,7 @@ var ts; ts.stringToToken = stringToToken; /* @internal */ function computeLineStarts(text) { - var result = new Array(); + var result = []; var pos = 0; var lineStart = 0; while (pos < text.length) { @@ -12032,12 +11890,36 @@ var ts; pos++; return token = 0 /* SyntaxKind.Unknown */; } - if (isIdentifierStart(codePointAt(text, pos + 1), languageVersion)) { + var charAfterHash = codePointAt(text, pos + 1); + if (charAfterHash === 92 /* CharacterCodes.backslash */) { pos++; - scanIdentifier(codePointAt(text, pos), languageVersion); + var extendedCookedChar_1 = peekExtendedUnicodeEscape(); + if (extendedCookedChar_1 >= 0 && isIdentifierStart(extendedCookedChar_1, languageVersion)) { + pos += 3; + tokenFlags |= 8 /* TokenFlags.ExtendedUnicodeEscape */; + tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts(); + return token = 80 /* SyntaxKind.PrivateIdentifier */; + } + var cookedChar_1 = peekUnicodeEscape(); + if (cookedChar_1 >= 0 && isIdentifierStart(cookedChar_1, languageVersion)) { + pos += 6; + tokenFlags |= 1024 /* TokenFlags.UnicodeEscape */; + tokenValue = "#" + String.fromCharCode(cookedChar_1) + scanIdentifierParts(); + return token = 80 /* SyntaxKind.PrivateIdentifier */; + } + pos--; + } + if (isIdentifierStart(charAfterHash, languageVersion)) { + pos++; + // We're relying on scanIdentifier's behavior and adjusting the token kind after the fact. + // Notably absent from this block is the fact that calling a function named "scanIdentifier", + // but identifiers don't include '#', and that function doesn't deal with it at all. + // This works because 'scanIdentifier' tries to reuse source characters and builds up substrings; + // however, it starts at the 'tokenPos' which includes the '#', and will "accidentally" prepend the '#' for us. + scanIdentifier(charAfterHash, languageVersion); } else { - tokenValue = String.fromCharCode(codePointAt(text, pos)); + tokenValue = "#"; error(ts.Diagnostics.Invalid_character, pos++, charSize(ch)); } return token = 80 /* SyntaxKind.PrivateIdentifier */; @@ -12788,9 +12670,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 163 /* SyntaxKind.TypeParameter */) { + if (d && d.kind === 165 /* SyntaxKind.TypeParameter */) { for (var current = d; current; current = current.parent) { - if (isFunctionLike(current) || isClassLike(current) || current.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (isFunctionLike(current) || isClassLike(current) || current.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return current; } } @@ -12798,7 +12680,7 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node, parent) { - return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) && parent.kind === 171 /* SyntaxKind.Constructor */; + return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) && parent.kind === 173 /* SyntaxKind.Constructor */; } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; function isEmptyBindingPattern(node) { @@ -12828,14 +12710,14 @@ var ts; node = walkUpBindingElementsAndPatterns(node); } var flags = getFlags(node); - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node && node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { flags |= getFlags(node); node = node.parent; } - if (node && node.kind === 237 /* SyntaxKind.VariableStatement */) { + if (node && node.kind === 240 /* SyntaxKind.VariableStatement */) { flags |= getFlags(node); } return flags; @@ -13008,30 +12890,30 @@ var ts; } // Covers remaining cases (returning undefined if none match). switch (hostNode.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: if (hostNode.declarationList && hostNode.declarationList.declarations[0]) { return getDeclarationIdentifier(hostNode.declarationList.declarations[0]); } break; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: var expr = hostNode.expression; - if (expr.kind === 221 /* SyntaxKind.BinaryExpression */ && expr.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (expr.kind === 223 /* SyntaxKind.BinaryExpression */ && expr.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { expr = expr.left; } switch (expr.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return expr.name; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var arg = expr.argumentExpression; if (ts.isIdentifier(arg)) { return arg; } } break; - case 212 /* SyntaxKind.ParenthesizedExpression */: { + case 214 /* SyntaxKind.ParenthesizedExpression */: { return getDeclarationIdentifier(hostNode.expression); } - case 250 /* SyntaxKind.LabeledStatement */: { + case 253 /* SyntaxKind.LabeledStatement */: { if (isDeclaration(hostNode.statement) || isExpression(hostNode.statement)) { return getDeclarationIdentifier(hostNode.statement); } @@ -13068,16 +12950,16 @@ var ts; switch (declaration.kind) { case 79 /* SyntaxKind.Identifier */: return declaration; - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: { + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: { var name = declaration.name; - if (name.kind === 161 /* SyntaxKind.QualifiedName */) { + if (name.kind === 163 /* SyntaxKind.QualifiedName */) { return name.right; } break; } - case 208 /* SyntaxKind.CallExpression */: - case 221 /* SyntaxKind.BinaryExpression */: { + case 210 /* SyntaxKind.CallExpression */: + case 223 /* SyntaxKind.BinaryExpression */: { var expr_1 = declaration; switch (ts.getAssignmentDeclarationKind(expr_1)) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -13093,15 +12975,15 @@ var ts; return undefined; } } - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return getNameOfJSDocTypedef(declaration); - case 339 /* SyntaxKind.JSDocEnumTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return nameForNamelessJSDocTypedef(declaration); - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var expression = declaration.expression; return ts.isIdentifier(expression) ? expression : undefined; } - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = declaration; if (ts.isBindableStaticElementAccessExpression(expr)) { return expr.argumentExpression; @@ -13145,7 +13027,7 @@ var ts; } ts.getDecorators = getDecorators; function getModifiers(node) { - if (ts.hasSyntacticModifier(node, 125951 /* ModifierFlags.Modifier */)) { + if (ts.hasSyntacticModifier(node, 126975 /* ModifierFlags.Modifier */)) { return ts.filter(node.modifiers, isModifier); } } @@ -13406,12 +13288,12 @@ var ts; /** Gets the text of a jsdoc comment, flattening links to their text. */ function getTextOfJSDocComment(comment) { return typeof comment === "string" ? comment - : comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 321 /* SyntaxKind.JSDocText */ ? c.text : formatJSDocLink(c); }).join(""); + : comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 324 /* SyntaxKind.JSDocText */ ? c.text : formatJSDocLink(c); }).join(""); } ts.getTextOfJSDocComment = getTextOfJSDocComment; function formatJSDocLink(link) { - var kind = link.kind === 324 /* SyntaxKind.JSDocLink */ ? "link" - : link.kind === 325 /* SyntaxKind.JSDocLinkCode */ ? "linkcode" + var kind = link.kind === 327 /* SyntaxKind.JSDocLink */ ? "link" + : link.kind === 328 /* SyntaxKind.JSDocLinkCode */ ? "linkcode" : "linkplain"; var name = link.name ? ts.entityNameToString(link.name) : ""; var space = link.name && link.text.startsWith("://") ? "" : " "; @@ -13432,7 +13314,7 @@ var ts; return ts.emptyArray; } if (ts.isJSDocTypeAlias(node)) { - ts.Debug.assert(node.parent.kind === 320 /* SyntaxKind.JSDoc */); + ts.Debug.assert(node.parent.kind === 323 /* SyntaxKind.JSDoc */); return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; }); } if (node.typeParameters) { @@ -13467,7 +13349,7 @@ var ts; ts.isMemberName = isMemberName; /* @internal */ function isGetOrSetAccessorDeclaration(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */ || node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */ || node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetOrSetAccessorDeclaration = isGetOrSetAccessorDeclaration; function isPropertyAccessChain(node) { @@ -13485,10 +13367,10 @@ var ts; function isOptionalChain(node) { var kind = node.kind; return !!(node.flags & 32 /* NodeFlags.OptionalChain */) && - (kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 207 /* SyntaxKind.ElementAccessExpression */ - || kind === 208 /* SyntaxKind.CallExpression */ - || kind === 230 /* SyntaxKind.NonNullExpression */); + (kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 209 /* SyntaxKind.ElementAccessExpression */ + || kind === 210 /* SyntaxKind.CallExpression */ + || kind === 232 /* SyntaxKind.NonNullExpression */); } ts.isOptionalChain = isOptionalChain; /* @internal */ @@ -13523,7 +13405,7 @@ var ts; } ts.isOutermostOptionalChain = isOutermostOptionalChain; function isNullishCoalesce(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */; } ts.isNullishCoalesce = isNullishCoalesce; function isConstTypeReference(node) { @@ -13540,17 +13422,17 @@ var ts; } ts.isNonNullChain = isNonNullChain; function isBreakOrContinueStatement(node) { - return node.kind === 246 /* SyntaxKind.BreakStatement */ || node.kind === 245 /* SyntaxKind.ContinueStatement */; + return node.kind === 249 /* SyntaxKind.BreakStatement */ || node.kind === 248 /* SyntaxKind.ContinueStatement */; } ts.isBreakOrContinueStatement = isBreakOrContinueStatement; function isNamedExportBindings(node) { - return node.kind === 274 /* SyntaxKind.NamespaceExport */ || node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 277 /* SyntaxKind.NamespaceExport */ || node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedExportBindings = isNamedExportBindings; function isUnparsedTextLike(node) { switch (node.kind) { - case 302 /* SyntaxKind.UnparsedText */: - case 303 /* SyntaxKind.UnparsedInternalText */: + case 305 /* SyntaxKind.UnparsedText */: + case 306 /* SyntaxKind.UnparsedInternalText */: return true; default: return false; @@ -13559,12 +13441,12 @@ var ts; ts.isUnparsedTextLike = isUnparsedTextLike; function isUnparsedNode(node) { return isUnparsedTextLike(node) || - node.kind === 300 /* SyntaxKind.UnparsedPrologue */ || - node.kind === 304 /* SyntaxKind.UnparsedSyntheticReference */; + node.kind === 303 /* SyntaxKind.UnparsedPrologue */ || + node.kind === 307 /* SyntaxKind.UnparsedSyntheticReference */; } ts.isUnparsedNode = isUnparsedNode; function isJSDocPropertyLikeTag(node) { - return node.kind === 347 /* SyntaxKind.JSDocPropertyTag */ || node.kind === 340 /* SyntaxKind.JSDocParameterTag */; + return node.kind === 350 /* SyntaxKind.JSDocPropertyTag */ || node.kind === 343 /* SyntaxKind.JSDocParameterTag */; } ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; // #endregion @@ -13580,7 +13462,7 @@ var ts; ts.isNode = isNode; /* @internal */ function isNodeKind(kind) { - return kind >= 161 /* SyntaxKind.FirstNode */; + return kind >= 163 /* SyntaxKind.FirstNode */; } ts.isNodeKind = isNodeKind; /** @@ -13589,7 +13471,7 @@ var ts; * Literals are considered tokens, except TemplateLiteral, but does include TemplateHead/Middle/Tail. */ function isTokenKind(kind) { - return kind >= 0 /* SyntaxKind.FirstToken */ && kind <= 160 /* SyntaxKind.LastToken */; + return kind >= 0 /* SyntaxKind.FirstToken */ && kind <= 162 /* SyntaxKind.LastToken */; } ts.isTokenKind = isTokenKind; /** @@ -13604,7 +13486,7 @@ var ts; // Node Arrays /* @internal */ function isNodeArray(array) { - return array.hasOwnProperty("pos") && array.hasOwnProperty("end"); + return ts.hasProperty(array, "pos") && ts.hasProperty(array, "end"); } ts.isNodeArray = isNodeArray; // Literals @@ -13620,11 +13502,11 @@ var ts; /** @internal */ function isLiteralExpressionOfObject(node) { switch (node.kind) { - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: return true; } return false; @@ -13652,13 +13534,13 @@ var ts; ts.isImportOrExportSpecifier = isImportOrExportSpecifier; function isTypeOnlyImportOrExportDeclaration(node) { switch (node.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return node.isTypeOnly || node.parent.parent.isTypeOnly; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.isTypeOnly; - case 267 /* SyntaxKind.ImportClause */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 270 /* SyntaxKind.ImportClause */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.isTypeOnly; default: return false; @@ -13679,6 +13561,11 @@ var ts; return ts.isIdentifier(node) && (node.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) > 0 /* GeneratedIdentifierFlags.None */; } ts.isGeneratedIdentifier = isGeneratedIdentifier; + /* @internal */ + function isGeneratedPrivateIdentifier(node) { + return ts.isPrivateIdentifier(node) && (node.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) > 0 /* GeneratedIdentifierFlags.None */; + } + ts.isGeneratedPrivateIdentifier = isGeneratedPrivateIdentifier; // Private Identifiers /*@internal*/ function isPrivateIdentifierClassElementDeclaration(node) { @@ -13695,19 +13582,20 @@ var ts; function isModifierKind(token) { switch (token) { case 126 /* SyntaxKind.AbstractKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 88 /* SyntaxKind.DefaultKeyword */: case 93 /* SyntaxKind.ExportKeyword */: case 101 /* SyntaxKind.InKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 144 /* SyntaxKind.OutKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 145 /* SyntaxKind.OutKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: return true; } return false; @@ -13720,7 +13608,10 @@ var ts; ts.isParameterPropertyModifier = isParameterPropertyModifier; /* @internal */ function isClassMemberModifier(idToken) { - return isParameterPropertyModifier(idToken) || idToken === 124 /* SyntaxKind.StaticKeyword */ || idToken === 159 /* SyntaxKind.OverrideKeyword */; + return isParameterPropertyModifier(idToken) || + idToken === 124 /* SyntaxKind.StaticKeyword */ || + idToken === 161 /* SyntaxKind.OverrideKeyword */ || + idToken === 127 /* SyntaxKind.AccessorKeyword */; } ts.isClassMemberModifier = isClassMemberModifier; function isModifier(node) { @@ -13729,7 +13620,7 @@ var ts; ts.isModifier = isModifier; function isEntityName(node) { var kind = node.kind; - return kind === 161 /* SyntaxKind.QualifiedName */ + return kind === 163 /* SyntaxKind.QualifiedName */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isEntityName = isEntityName; @@ -13739,14 +13630,14 @@ var ts; || kind === 80 /* SyntaxKind.PrivateIdentifier */ || kind === 10 /* SyntaxKind.StringLiteral */ || kind === 8 /* SyntaxKind.NumericLiteral */ - || kind === 162 /* SyntaxKind.ComputedPropertyName */; + || kind === 164 /* SyntaxKind.ComputedPropertyName */; } ts.isPropertyName = isPropertyName; function isBindingName(node) { var kind = node.kind; return kind === 79 /* SyntaxKind.Identifier */ - || kind === 201 /* SyntaxKind.ObjectBindingPattern */ - || kind === 202 /* SyntaxKind.ArrayBindingPattern */; + || kind === 203 /* SyntaxKind.ObjectBindingPattern */ + || kind === 204 /* SyntaxKind.ArrayBindingPattern */; } ts.isBindingName = isBindingName; // Functions @@ -13771,13 +13662,13 @@ var ts; ts.isBooleanLiteral = isBooleanLiteral; function isFunctionLikeDeclarationKind(kind) { switch (kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: return false; @@ -13786,14 +13677,14 @@ var ts; /* @internal */ function isFunctionLikeKind(kind) { switch (kind) { - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return true; default: return isFunctionLikeDeclarationKind(kind); @@ -13808,36 +13699,53 @@ var ts; // Classes function isClassElement(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 234 /* SyntaxKind.SemicolonClassElement */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 237 /* SyntaxKind.SemicolonClassElement */; } ts.isClassElement = isClassElement; function isClassLike(node) { - return node && (node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */); + return node && (node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */); } ts.isClassLike = isClassLike; function isAccessor(node) { - return node && (node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */); + return node && (node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */); } ts.isAccessor = isAccessor; + function isAutoAccessorPropertyDeclaration(node) { + return ts.isPropertyDeclaration(node) && ts.hasAccessorModifier(node); + } + ts.isAutoAccessorPropertyDeclaration = isAutoAccessorPropertyDeclaration; /* @internal */ function isMethodOrAccessor(node) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; default: return false; } } ts.isMethodOrAccessor = isMethodOrAccessor; + /* @internal */ + function isNamedClassElement(node) { + switch (node.kind) { + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + return true; + default: + return false; + } + } + ts.isNamedClassElement = isNamedClassElement; // Type members function isModifierLike(node) { return isModifier(node) || ts.isDecorator(node); @@ -13845,13 +13753,13 @@ var ts; ts.isModifierLike = isModifierLike; function isTypeElement(node) { var kind = node.kind; - return kind === 175 /* SyntaxKind.ConstructSignature */ - || kind === 174 /* SyntaxKind.CallSignature */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 177 /* SyntaxKind.ConstructSignature */ + || kind === 176 /* SyntaxKind.CallSignature */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.isTypeElement = isTypeElement; function isClassOrTypeElement(node) { @@ -13860,12 +13768,12 @@ var ts; ts.isClassOrTypeElement = isClassOrTypeElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 298 /* SyntaxKind.SpreadAssignment */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 301 /* SyntaxKind.SpreadAssignment */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; // Type @@ -13880,8 +13788,8 @@ var ts; ts.isTypeNode = isTypeNode; function isFunctionOrConstructorTypeNode(node) { switch (node.kind) { - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return true; } return false; @@ -13892,8 +13800,8 @@ var ts; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 202 /* SyntaxKind.ArrayBindingPattern */ - || kind === 201 /* SyntaxKind.ObjectBindingPattern */; + return kind === 204 /* SyntaxKind.ArrayBindingPattern */ + || kind === 203 /* SyntaxKind.ObjectBindingPattern */; } return false; } @@ -13901,15 +13809,15 @@ var ts; /* @internal */ function isAssignmentPattern(node) { var kind = node.kind; - return kind === 204 /* SyntaxKind.ArrayLiteralExpression */ - || kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return kind === 206 /* SyntaxKind.ArrayLiteralExpression */ + || kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isAssignmentPattern = isAssignmentPattern; /* @internal */ function isArrayBindingElement(node) { var kind = node.kind; - return kind === 203 /* SyntaxKind.BindingElement */ - || kind === 227 /* SyntaxKind.OmittedExpression */; + return kind === 205 /* SyntaxKind.BindingElement */ + || kind === 229 /* SyntaxKind.OmittedExpression */; } ts.isArrayBindingElement = isArrayBindingElement; /** @@ -13918,9 +13826,9 @@ var ts; /* @internal */ function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: return true; } return false; @@ -13941,8 +13849,8 @@ var ts; /* @internal */ function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return true; } return false; @@ -13951,10 +13859,10 @@ var ts; /* @internal */ function isObjectBindingOrAssignmentElement(node) { switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: // AssignmentProperty - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: // AssignmentProperty - case 298 /* SyntaxKind.SpreadAssignment */: // AssignmentRestProperty + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: // AssignmentProperty + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // AssignmentProperty + case 301 /* SyntaxKind.SpreadAssignment */: // AssignmentRestProperty return true; } return false; @@ -13966,8 +13874,8 @@ var ts; /* @internal */ function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return true; } return false; @@ -13976,26 +13884,26 @@ var ts; /* @internal */ function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) { var kind = node.kind; - return kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 161 /* SyntaxKind.QualifiedName */ - || kind === 200 /* SyntaxKind.ImportType */; + return kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 163 /* SyntaxKind.QualifiedName */ + || kind === 202 /* SyntaxKind.ImportType */; } ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode; // Expression function isPropertyAccessOrQualifiedName(node) { var kind = node.kind; - return kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 161 /* SyntaxKind.QualifiedName */; + return kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 163 /* SyntaxKind.QualifiedName */; } ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName; function isCallLikeExpression(node) { switch (node.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 165 /* SyntaxKind.Decorator */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 167 /* SyntaxKind.Decorator */: return true; default: return false; @@ -14003,12 +13911,12 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function isCallOrNewExpression(node) { - return node.kind === 208 /* SyntaxKind.CallExpression */ || node.kind === 209 /* SyntaxKind.NewExpression */; + return node.kind === 210 /* SyntaxKind.CallExpression */ || node.kind === 211 /* SyntaxKind.NewExpression */; } ts.isCallOrNewExpression = isCallOrNewExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 223 /* SyntaxKind.TemplateExpression */ + return kind === 225 /* SyntaxKind.TemplateExpression */ || kind === 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */; } ts.isTemplateLiteral = isTemplateLiteral; @@ -14019,19 +13927,19 @@ var ts; ts.isLeftHandSideExpression = isLeftHandSideExpression; function isLeftHandSideExpressionKind(kind) { switch (kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: // technically this is only an Expression if it's in a `#field in expr` BinaryExpression case 13 /* SyntaxKind.RegularExpressionLiteral */: @@ -14039,15 +13947,15 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 108 /* SyntaxKind.ThisKeyword */: case 110 /* SyntaxKind.TrueKeyword */: case 106 /* SyntaxKind.SuperKeyword */: - case 230 /* SyntaxKind.NonNullExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 231 /* SyntaxKind.MetaProperty */: + case 232 /* SyntaxKind.NonNullExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 233 /* SyntaxKind.MetaProperty */: case 100 /* SyntaxKind.ImportKeyword */: // technically this is only an Expression if it's in a CallExpression return true; default: @@ -14061,13 +13969,13 @@ var ts; ts.isUnaryExpression = isUnaryExpression; function isUnaryExpressionKind(kind) { switch (kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return true; default: return isLeftHandSideExpressionKind(kind); @@ -14076,9 +13984,9 @@ var ts; /* @internal */ function isUnaryExpressionWithWrite(expr) { switch (expr.kind) { - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return true; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 45 /* SyntaxKind.PlusPlusToken */ || expr.operator === 46 /* SyntaxKind.MinusMinusToken */; default: @@ -14097,15 +14005,16 @@ var ts; ts.isExpression = isExpression; function isExpressionKind(kind) { switch (kind) { - case 222 /* SyntaxKind.ConditionalExpression */: - case 224 /* SyntaxKind.YieldExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 221 /* SyntaxKind.BinaryExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 229 /* SyntaxKind.AsExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 351 /* SyntaxKind.CommaListExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 226 /* SyntaxKind.YieldExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 223 /* SyntaxKind.BinaryExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 231 /* SyntaxKind.AsExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 354 /* SyntaxKind.CommaListExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return true; default: return isUnaryExpressionKind(kind); @@ -14113,8 +14022,8 @@ var ts; } function isAssertionExpression(node) { var kind = node.kind; - return kind === 211 /* SyntaxKind.TypeAssertionExpression */ - || kind === 229 /* SyntaxKind.AsExpression */; + return kind === 213 /* SyntaxKind.TypeAssertionExpression */ + || kind === 231 /* SyntaxKind.AsExpression */; } ts.isAssertionExpression = isAssertionExpression; /* @internal */ @@ -14125,13 +14034,13 @@ var ts; ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return true; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -14160,7 +14069,7 @@ var ts; ts.isExternalModuleIndicator = isExternalModuleIndicator; /* @internal */ function isForInOrOfStatement(node) { - return node.kind === 243 /* SyntaxKind.ForInStatement */ || node.kind === 244 /* SyntaxKind.ForOfStatement */; + return node.kind === 246 /* SyntaxKind.ForInStatement */ || node.kind === 247 /* SyntaxKind.ForOfStatement */; } ts.isForInOrOfStatement = isForInOrOfStatement; // Element @@ -14184,115 +14093,115 @@ var ts; /* @internal */ function isModuleBody(node) { var kind = node.kind; - return kind === 262 /* SyntaxKind.ModuleBlock */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ + return kind === 265 /* SyntaxKind.ModuleBlock */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isModuleBody = isModuleBody; /* @internal */ function isNamespaceBody(node) { var kind = node.kind; - return kind === 262 /* SyntaxKind.ModuleBlock */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */; + return kind === 265 /* SyntaxKind.ModuleBlock */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isNamespaceBody = isNamespaceBody; /* @internal */ function isJSDocNamespaceBody(node) { var kind = node.kind; return kind === 79 /* SyntaxKind.Identifier */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */; + || kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isJSDocNamespaceBody = isJSDocNamespaceBody; /* @internal */ function isNamedImportBindings(node) { var kind = node.kind; - return kind === 269 /* SyntaxKind.NamedImports */ - || kind === 268 /* SyntaxKind.NamespaceImport */; + return kind === 272 /* SyntaxKind.NamedImports */ + || kind === 271 /* SyntaxKind.NamespaceImport */; } ts.isNamedImportBindings = isNamedImportBindings; /* @internal */ function isModuleOrEnumDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */ || node.kind === 260 /* SyntaxKind.EnumDeclaration */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */ || node.kind === 263 /* SyntaxKind.EnumDeclaration */; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 203 /* SyntaxKind.BindingElement */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 299 /* SyntaxKind.EnumMember */ - || kind === 275 /* SyntaxKind.ExportSpecifier */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 267 /* SyntaxKind.ImportClause */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 270 /* SyntaxKind.ImportSpecifier */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 285 /* SyntaxKind.JsxAttribute */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 268 /* SyntaxKind.NamespaceImport */ - || kind === 274 /* SyntaxKind.NamespaceExport */ - || kind === 164 /* SyntaxKind.Parameter */ - || kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 163 /* SyntaxKind.TypeParameter */ - || kind === 254 /* SyntaxKind.VariableDeclaration */ - || kind === 345 /* SyntaxKind.JSDocTypedefTag */ - || kind === 338 /* SyntaxKind.JSDocCallbackTag */ - || kind === 347 /* SyntaxKind.JSDocPropertyTag */; + return kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 205 /* SyntaxKind.BindingElement */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 302 /* SyntaxKind.EnumMember */ + || kind === 278 /* SyntaxKind.ExportSpecifier */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 270 /* SyntaxKind.ImportClause */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 273 /* SyntaxKind.ImportSpecifier */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 288 /* SyntaxKind.JsxAttribute */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 271 /* SyntaxKind.NamespaceImport */ + || kind === 277 /* SyntaxKind.NamespaceExport */ + || kind === 166 /* SyntaxKind.Parameter */ + || kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 165 /* SyntaxKind.TypeParameter */ + || kind === 257 /* SyntaxKind.VariableDeclaration */ + || kind === 348 /* SyntaxKind.JSDocTypedefTag */ + || kind === 341 /* SyntaxKind.JSDocCallbackTag */ + || kind === 350 /* SyntaxKind.JSDocPropertyTag */; } function isDeclarationStatementKind(kind) { - return kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 246 /* SyntaxKind.BreakStatement */ - || kind === 245 /* SyntaxKind.ContinueStatement */ - || kind === 253 /* SyntaxKind.DebuggerStatement */ - || kind === 240 /* SyntaxKind.DoStatement */ - || kind === 238 /* SyntaxKind.ExpressionStatement */ - || kind === 236 /* SyntaxKind.EmptyStatement */ - || kind === 243 /* SyntaxKind.ForInStatement */ - || kind === 244 /* SyntaxKind.ForOfStatement */ - || kind === 242 /* SyntaxKind.ForStatement */ - || kind === 239 /* SyntaxKind.IfStatement */ - || kind === 250 /* SyntaxKind.LabeledStatement */ - || kind === 247 /* SyntaxKind.ReturnStatement */ - || kind === 249 /* SyntaxKind.SwitchStatement */ - || kind === 251 /* SyntaxKind.ThrowStatement */ - || kind === 252 /* SyntaxKind.TryStatement */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 241 /* SyntaxKind.WhileStatement */ - || kind === 248 /* SyntaxKind.WithStatement */ - || kind === 349 /* SyntaxKind.NotEmittedStatement */ - || kind === 353 /* SyntaxKind.EndOfDeclarationMarker */ - || kind === 352 /* SyntaxKind.MergeDeclarationMarker */; + return kind === 249 /* SyntaxKind.BreakStatement */ + || kind === 248 /* SyntaxKind.ContinueStatement */ + || kind === 256 /* SyntaxKind.DebuggerStatement */ + || kind === 243 /* SyntaxKind.DoStatement */ + || kind === 241 /* SyntaxKind.ExpressionStatement */ + || kind === 239 /* SyntaxKind.EmptyStatement */ + || kind === 246 /* SyntaxKind.ForInStatement */ + || kind === 247 /* SyntaxKind.ForOfStatement */ + || kind === 245 /* SyntaxKind.ForStatement */ + || kind === 242 /* SyntaxKind.IfStatement */ + || kind === 253 /* SyntaxKind.LabeledStatement */ + || kind === 250 /* SyntaxKind.ReturnStatement */ + || kind === 252 /* SyntaxKind.SwitchStatement */ + || kind === 254 /* SyntaxKind.ThrowStatement */ + || kind === 255 /* SyntaxKind.TryStatement */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 244 /* SyntaxKind.WhileStatement */ + || kind === 251 /* SyntaxKind.WithStatement */ + || kind === 352 /* SyntaxKind.NotEmittedStatement */ + || kind === 356 /* SyntaxKind.EndOfDeclarationMarker */ + || kind === 355 /* SyntaxKind.MergeDeclarationMarker */; } /* @internal */ function isDeclaration(node) { - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { - return (node.parent && node.parent.kind !== 344 /* SyntaxKind.JSDocTemplateTag */) || ts.isInJSFile(node); + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { + return (node.parent && node.parent.kind !== 347 /* SyntaxKind.JSDocTemplateTag */) || ts.isInJSFile(node); } return isDeclarationKind(node.kind); } @@ -14319,10 +14228,10 @@ var ts; } ts.isStatement = isStatement; function isBlockStatement(node) { - if (node.kind !== 235 /* SyntaxKind.Block */) + if (node.kind !== 238 /* SyntaxKind.Block */) return false; if (node.parent !== undefined) { - if (node.parent.kind === 252 /* SyntaxKind.TryStatement */ || node.parent.kind === 292 /* SyntaxKind.CatchClause */) { + if (node.parent.kind === 255 /* SyntaxKind.TryStatement */ || node.parent.kind === 295 /* SyntaxKind.CatchClause */) { return false; } } @@ -14336,15 +14245,15 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 235 /* SyntaxKind.Block */; + || kind === 238 /* SyntaxKind.Block */; } ts.isStatementOrBlock = isStatementOrBlock; // Module references /* @internal */ function isModuleReference(node) { var kind = node.kind; - return kind === 277 /* SyntaxKind.ExternalModuleReference */ - || kind === 161 /* SyntaxKind.QualifiedName */ + return kind === 280 /* SyntaxKind.ExternalModuleReference */ + || kind === 163 /* SyntaxKind.QualifiedName */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isModuleReference = isModuleReference; @@ -14354,58 +14263,58 @@ var ts; var kind = node.kind; return kind === 108 /* SyntaxKind.ThisKeyword */ || kind === 79 /* SyntaxKind.Identifier */ - || kind === 206 /* SyntaxKind.PropertyAccessExpression */; + || kind === 208 /* SyntaxKind.PropertyAccessExpression */; } ts.isJsxTagNameExpression = isJsxTagNameExpression; /* @internal */ function isJsxChild(node) { var kind = node.kind; - return kind === 278 /* SyntaxKind.JsxElement */ - || kind === 288 /* SyntaxKind.JsxExpression */ - || kind === 279 /* SyntaxKind.JsxSelfClosingElement */ + return kind === 281 /* SyntaxKind.JsxElement */ + || kind === 291 /* SyntaxKind.JsxExpression */ + || kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || kind === 11 /* SyntaxKind.JsxText */ - || kind === 282 /* SyntaxKind.JsxFragment */; + || kind === 285 /* SyntaxKind.JsxFragment */; } ts.isJsxChild = isJsxChild; /* @internal */ function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 285 /* SyntaxKind.JsxAttribute */ - || kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return kind === 288 /* SyntaxKind.JsxAttribute */ + || kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } ts.isJsxAttributeLike = isJsxAttributeLike; /* @internal */ function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 10 /* SyntaxKind.StringLiteral */ - || kind === 288 /* SyntaxKind.JsxExpression */; + || kind === 291 /* SyntaxKind.JsxExpression */; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isJsxOpeningLikeElement(node) { var kind = node.kind; - return kind === 280 /* SyntaxKind.JsxOpeningElement */ - || kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return kind === 283 /* SyntaxKind.JsxOpeningElement */ + || kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; // Clauses function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 289 /* SyntaxKind.CaseClause */ - || kind === 290 /* SyntaxKind.DefaultClause */; + return kind === 292 /* SyntaxKind.CaseClause */ + || kind === 293 /* SyntaxKind.DefaultClause */; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; // JSDoc /** True if node is of some JSDoc syntax kind. */ /* @internal */ function isJSDocNode(node) { - return node.kind >= 309 /* SyntaxKind.FirstJSDocNode */ && node.kind <= 347 /* SyntaxKind.LastJSDocNode */; + return node.kind >= 312 /* SyntaxKind.FirstJSDocNode */ && node.kind <= 350 /* SyntaxKind.LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; /** True if node is of a kind that may contain comment text. */ function isJSDocCommentContainingNode(node) { - return node.kind === 320 /* SyntaxKind.JSDoc */ - || node.kind === 319 /* SyntaxKind.JSDocNamepathType */ - || node.kind === 321 /* SyntaxKind.JSDocText */ + return node.kind === 323 /* SyntaxKind.JSDoc */ + || node.kind === 322 /* SyntaxKind.JSDocNamepathType */ + || node.kind === 324 /* SyntaxKind.JSDocText */ || isJSDocLinkLike(node) || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) @@ -14415,15 +14324,15 @@ var ts; // TODO: determine what this does before making it public. /* @internal */ function isJSDocTag(node) { - return node.kind >= 327 /* SyntaxKind.FirstJSDocTagNode */ && node.kind <= 347 /* SyntaxKind.LastJSDocTagNode */; + return node.kind >= 330 /* SyntaxKind.FirstJSDocTagNode */ && node.kind <= 350 /* SyntaxKind.LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function isSetAccessor(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */; } ts.isSetAccessor = isSetAccessor; function isGetAccessor(node) { - return node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetAccessor = isGetAccessor; /** True if has jsdoc nodes attached to it. */ @@ -14449,12 +14358,12 @@ var ts; /** True if has initializer node attached to it. */ function hasOnlyExpressionInitializer(node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 299 /* SyntaxKind.EnumMember */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 302 /* SyntaxKind.EnumMember */: return true; default: return false; @@ -14462,12 +14371,12 @@ var ts; } ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer; function isObjectLiteralElement(node) { - return node.kind === 285 /* SyntaxKind.JsxAttribute */ || node.kind === 287 /* SyntaxKind.JsxSpreadAttribute */ || isObjectLiteralElementLike(node); + return node.kind === 288 /* SyntaxKind.JsxAttribute */ || node.kind === 290 /* SyntaxKind.JsxSpreadAttribute */ || isObjectLiteralElementLike(node); } ts.isObjectLiteralElement = isObjectLiteralElement; /* @internal */ function isTypeReferenceType(node) { - return node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } ts.isTypeReferenceType = isTypeReferenceType; var MAX_SMI_X86 = 1073741823; @@ -14500,7 +14409,7 @@ var ts; } ts.isStringLiteralLike = isStringLiteralLike; function isJSDocLinkLike(node) { - return node.kind === 324 /* SyntaxKind.JSDocLink */ || node.kind === 325 /* SyntaxKind.JSDocLinkCode */ || node.kind === 326 /* SyntaxKind.JSDocLinkPlain */; + return node.kind === 327 /* SyntaxKind.JSDocLink */ || node.kind === 328 /* SyntaxKind.JSDocLinkCode */ || node.kind === 329 /* SyntaxKind.JSDocLinkPlain */; } ts.isJSDocLinkLike = isJSDocLinkLike; function hasRestParameter(s) { @@ -14510,7 +14419,7 @@ var ts; ts.hasRestParameter = hasRestParameter; function isRestParameter(node) { var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type; - return node.dotDotDotToken !== undefined || !!type && type.kind === 318 /* SyntaxKind.JSDocVariadicType */; + return node.dotDotDotToken !== undefined || !!type && type.kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isRestParameter = isRestParameter; // #endregion @@ -14768,7 +14677,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 305 /* SyntaxKind.SourceFile */) { + while (node && node.kind !== 308 /* SyntaxKind.SourceFile */) { node = node.parent; } return node; @@ -14784,11 +14693,11 @@ var ts; ts.isPlainJsFile = isPlainJsFile; function isStatementWithLocals(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return true; } return false; @@ -14984,7 +14893,7 @@ var ts; // the syntax list itself considers them as normal trivia. Therefore if we simply skip // trivia for the list, we may have skipped the JSDocComment as well. So we should process its // first child to determine the actual position of its first token. - if (node.kind === 348 /* SyntaxKind.SyntaxList */ && node._children.length > 0) { + if (node.kind === 351 /* SyntaxKind.SyntaxList */ && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, @@ -15049,7 +14958,6 @@ var ts; return emitNode && emitNode.flags || 0; } ts.getEmitFlags = getEmitFlags; - ; function getScriptTargetFeatures() { return { es2015: { @@ -15222,7 +15130,7 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { @@ -15254,11 +15162,11 @@ var ts; ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { // The only kind of module that can be missing a body is a shorthand ambient module. - return !!node && node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && (!node.body); + return !!node && node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ || - node.kind === 261 /* SyntaxKind.ModuleDeclaration */ || + return node.kind === 308 /* SyntaxKind.SourceFile */ || + node.kind === 264 /* SyntaxKind.ModuleDeclaration */ || ts.isFunctionLikeOrClassStaticBlockDeclaration(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -15275,9 +15183,9 @@ var ts; // - defined in the top level scope and source file is an external module // - defined inside ambient module declaration located in the top level scope and source file not an external module switch (node.parent.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return ts.isExternalModule(node.parent); - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -15332,26 +15240,30 @@ var ts; return false; } ts.isEffectiveStrictModeSourceFile = isEffectiveStrictModeSourceFile; + function isAmbientPropertyDeclaration(node) { + return !!(node.flags & 16777216 /* NodeFlags.Ambient */) || hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */); + } + ts.isAmbientPropertyDeclaration = isAmbientPropertyDeclaration; function isBlockScope(node, parentNode) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 263 /* SyntaxKind.CaseBlock */: - case 292 /* SyntaxKind.CatchClause */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 266 /* SyntaxKind.CaseBlock */: + case 295 /* SyntaxKind.CatchClause */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block return !ts.isFunctionLikeOrClassStaticBlockDeclaration(parentNode); @@ -15361,9 +15273,9 @@ var ts; ts.isBlockScope = isBlockScope; function isDeclarationWithTypeParameters(node) { switch (node.kind) { - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 323 /* SyntaxKind.JSDocSignature */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 326 /* SyntaxKind.JSDocSignature */: return true; default: ts.assertType(node); @@ -15373,25 +15285,25 @@ var ts; ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters; function isDeclarationWithTypeParameterChildren(node) { switch (node.kind) { - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: ts.assertType(node); @@ -15401,8 +15313,8 @@ var ts; ts.isDeclarationWithTypeParameterChildren = isDeclarationWithTypeParameterChildren; function isAnyImportSyntax(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return true; default: return false; @@ -15415,15 +15327,15 @@ var ts; ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire; function isLateVisibilityPaintedStatement(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return true; default: return false; @@ -15464,19 +15376,19 @@ var ts; } ts.getNameFromIndexInfo = getNameFromIndexInfo; function isComputedNonLiteralName(name) { - return name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression); + return name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression); } ts.isComputedNonLiteralName = isComputedNonLiteralName; function tryGetTextOfPropertyName(name) { switch (name.kind) { case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: - return name.escapedText; + return name.autoGenerateFlags ? undefined : name.escapedText; case 10 /* SyntaxKind.StringLiteral */: case 8 /* SyntaxKind.NumericLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return ts.escapeLeadingUnderscores(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: if (isStringOrNumericLiteralLike(name.expression)) return ts.escapeLeadingUnderscores(name.expression.text); return undefined; @@ -15496,16 +15408,16 @@ var ts; case 80 /* SyntaxKind.PrivateIdentifier */: case 79 /* SyntaxKind.Identifier */: return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (ts.isIdentifier(name.name) || ts.isPrivateIdentifier(name.name)) { return entityNameToString(name.expression) + "." + entityNameToString(name.name); } else { return ts.Debug.assertNever(name.name); } - case 311 /* SyntaxKind.JSDocMemberName */: + case 314 /* SyntaxKind.JSDocMemberName */: return entityNameToString(name.left) + entityNameToString(name.right); default: return ts.Debug.assertNever(name); @@ -15595,7 +15507,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 235 /* SyntaxKind.Block */) { + if (node.body && node.body.kind === 238 /* SyntaxKind.Block */) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -15609,7 +15521,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file @@ -15618,29 +15530,29 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 268 /* SyntaxKind.NamespaceImport */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 271 /* SyntaxKind.NamespaceImport */: errorNode = node.name; break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return getErrorSpanForArrowFunction(sourceFile, node); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: var start = ts.skipTrivia(sourceFile.text, node.pos); var end = node.statements.length > 0 ? node.statements[0].pos : node.end; return ts.createTextSpanFromBounds(start, end); @@ -15692,11 +15604,11 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 208 /* SyntaxKind.CallExpression */ && n.expression.kind === 106 /* SyntaxKind.SuperKeyword */; + return n.kind === 210 /* SyntaxKind.CallExpression */ && n.expression.kind === 106 /* SyntaxKind.SuperKeyword */; } ts.isSuperCall = isSuperCall; function isImportCall(n) { - return n.kind === 208 /* SyntaxKind.CallExpression */ && n.expression.kind === 100 /* SyntaxKind.ImportKeyword */; + return n.kind === 210 /* SyntaxKind.CallExpression */ && n.expression.kind === 100 /* SyntaxKind.ImportKeyword */; } ts.isImportCall = isImportCall; function isImportMeta(n) { @@ -15710,7 +15622,7 @@ var ts; } ts.isLiteralImportTypeNode = isLiteralImportTypeNode; function isPrologueDirective(node) { - return node.kind === 238 /* SyntaxKind.ExpressionStatement */ + return node.kind === 241 /* SyntaxKind.ExpressionStatement */ && node.expression.kind === 10 /* SyntaxKind.StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; @@ -15738,13 +15650,13 @@ var ts; } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; function getJSDocCommentRanges(node, text) { - var commentRanges = (node.kind === 164 /* SyntaxKind.Parameter */ || - node.kind === 163 /* SyntaxKind.TypeParameter */ || - node.kind === 213 /* SyntaxKind.FunctionExpression */ || - node.kind === 214 /* SyntaxKind.ArrowFunction */ || - node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ || - node.kind === 254 /* SyntaxKind.VariableDeclaration */ || - node.kind === 275 /* SyntaxKind.ExportSpecifier */) ? + var commentRanges = (node.kind === 166 /* SyntaxKind.Parameter */ || + node.kind === 165 /* SyntaxKind.TypeParameter */ || + node.kind === 215 /* SyntaxKind.FunctionExpression */ || + node.kind === 216 /* SyntaxKind.ArrowFunction */ || + node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || + node.kind === 257 /* SyntaxKind.VariableDeclaration */ || + node.kind === 278 /* SyntaxKind.ExportSpecifier */) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : ts.getLeadingCommentRanges(text, node.pos); // True if the comment starts with '/**' but not if it is '/**/' @@ -15760,48 +15672,48 @@ var ts; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; var defaultLibReferenceRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (177 /* SyntaxKind.FirstTypeNode */ <= node.kind && node.kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (179 /* SyntaxKind.FirstTypeNode */ <= node.kind && node.kind <= 202 /* SyntaxKind.LastTypeNode */) { return true; } switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return true; case 114 /* SyntaxKind.VoidKeyword */: - return node.parent.kind !== 217 /* SyntaxKind.VoidExpression */; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + return node.parent.kind !== 219 /* SyntaxKind.VoidExpression */; + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node); - case 163 /* SyntaxKind.TypeParameter */: - return node.parent.kind === 195 /* SyntaxKind.MappedType */ || node.parent.kind === 190 /* SyntaxKind.InferType */; + case 165 /* SyntaxKind.TypeParameter */: + return node.parent.kind === 197 /* SyntaxKind.MappedType */ || node.parent.kind === 192 /* SyntaxKind.InferType */; // Identifiers and qualified names may be type nodes, depending on their context. Climb // above them to find the lowest container case 79 /* SyntaxKind.Identifier */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 161 /* SyntaxKind.QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 163 /* SyntaxKind.QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } // At this point, node is either a qualified name or an identifier - ts.Debug.assert(node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 161 /* SyntaxKind.QualifiedName */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + ts.Debug.assert(node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 163 /* SyntaxKind.QualifiedName */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); // falls through - case 161 /* SyntaxKind.QualifiedName */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: case 108 /* SyntaxKind.ThisKeyword */: { var parent = node.parent; - if (parent.kind === 181 /* SyntaxKind.TypeQuery */) { + if (parent.kind === 183 /* SyntaxKind.TypeQuery */) { return false; } - if (parent.kind === 200 /* SyntaxKind.ImportType */) { + if (parent.kind === 202 /* SyntaxKind.ImportType */) { return !parent.isTypeOf; } // Do not recursively call isPartOfTypeNode on the parent. In the example: @@ -15810,40 +15722,40 @@ var ts; // // Calling isPartOfTypeNode would consider the qualified name A.B a type node. // Only C and A.B.C are type nodes. - if (177 /* SyntaxKind.FirstTypeNode */ <= parent.kind && parent.kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (179 /* SyntaxKind.FirstTypeNode */ <= parent.kind && parent.kind <= 202 /* SyntaxKind.LastTypeNode */) { return true; } switch (parent.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isHeritageClause(parent.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(parent); - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return node === parent.constraint; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return node === parent.constraint; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 164 /* SyntaxKind.Parameter */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: return node === parent.type; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return node === parent.type; - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return node === parent.type; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return node === parent.type; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return ts.contains(parent.typeArguments, node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -15868,23 +15780,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitor(node); - case 263 /* SyntaxKind.CaseBlock */: - case 235 /* SyntaxKind.Block */: - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 250 /* SyntaxKind.LabeledStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 266 /* SyntaxKind.CaseBlock */: + case 238 /* SyntaxKind.Block */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 253 /* SyntaxKind.LabeledStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 295 /* SyntaxKind.CatchClause */: return ts.forEachChild(node, traverse); } } @@ -15894,23 +15806,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } return; - case 260 /* SyntaxKind.EnumDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // These are not allowed inside a generator now, but eventually they may be allowed // as local types. Regardless, skip them to avoid the work. return; default: if (ts.isFunctionLike(node)) { - if (node.name && node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name && node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // Note that we will not include methods/accessors of a class because they would require // first descending into the class. This is by design. traverse(node.name.expression); @@ -15933,10 +15845,10 @@ var ts; * @param node The type node. */ function getRestParameterElementType(node) { - if (node && node.kind === 183 /* SyntaxKind.ArrayType */) { + if (node && node.kind === 185 /* SyntaxKind.ArrayType */) { return node.elementType; } - else if (node && node.kind === 178 /* SyntaxKind.TypeReference */) { + else if (node && node.kind === 180 /* SyntaxKind.TypeReference */) { return ts.singleOrUndefined(node.typeArguments); } else { @@ -15946,12 +15858,12 @@ var ts; ts.getRestParameterElementType = getRestParameterElementType; function getMembersOfDeclaration(node) { switch (node.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 182 /* SyntaxKind.TypeLiteral */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 184 /* SyntaxKind.TypeLiteral */: return node.members; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return node.properties; } } @@ -15959,14 +15871,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 299 /* SyntaxKind.EnumMember */: - case 164 /* SyntaxKind.Parameter */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 302 /* SyntaxKind.EnumMember */: + case 166 /* SyntaxKind.Parameter */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; } } @@ -15978,8 +15890,8 @@ var ts; } ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor; function isVariableDeclarationInVariableStatement(node) { - return node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */ - && node.parent.parent.kind === 237 /* SyntaxKind.VariableStatement */; + return node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */ + && node.parent.parent.kind === 240 /* SyntaxKind.VariableStatement */; } ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement; function isCommonJsExportedExpression(node) { @@ -16003,13 +15915,13 @@ var ts; ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return true; } return false; @@ -16020,7 +15932,7 @@ var ts; if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 250 /* SyntaxKind.LabeledStatement */) { + if (node.statement.kind !== 253 /* SyntaxKind.LabeledStatement */) { return node.statement; } node = node.statement; @@ -16028,17 +15940,17 @@ var ts; } ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel; function isFunctionBlock(node) { - return node && node.kind === 235 /* SyntaxKind.Block */ && ts.isFunctionLike(node.parent); + return node && node.kind === 238 /* SyntaxKind.Block */ && ts.isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 169 /* SyntaxKind.MethodDeclaration */ && node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return node && node.kind === 171 /* SyntaxKind.MethodDeclaration */ && node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethodOrAccessor(node) { - return (node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */) && - (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || - node.parent.kind === 226 /* SyntaxKind.ClassExpression */); + return (node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */) && + (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || + node.parent.kind === 228 /* SyntaxKind.ClassExpression */); } ts.isObjectLiteralOrClassExpressionMethodOrAccessor = isObjectLiteralOrClassExpressionMethodOrAccessor; function isIdentifierTypePredicate(predicate) { @@ -16051,7 +15963,7 @@ var ts; ts.isThisTypePredicate = isThisTypePredicate; function getPropertyAssignment(objectLiteral, key, key2) { return objectLiteral.properties.filter(function (property) { - if (property.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (property.kind === 299 /* SyntaxKind.PropertyAssignment */) { var propName = tryGetTextOfPropertyName(property.name); return key === propName || (!!key2 && key2 === propName); } @@ -16113,14 +16025,14 @@ var ts; } ts.getContainingFunctionOrClassStaticBlock = getContainingFunctionOrClassStaticBlock; function getThisContainer(node, includeArrowFunctions) { - ts.Debug.assert(node.kind !== 305 /* SyntaxKind.SourceFile */); + ts.Debug.assert(node.kind !== 308 /* SyntaxKind.SourceFile */); while (true) { node = node.parent; if (!node) { return ts.Debug.fail(); // If we never pass in a SourceFile, this should be unreachable, since we'll stop when we reach that. } switch (node.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'this' container. // A computed property name in a class needs to be a this container @@ -16135,9 +16047,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 164 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { + if (node.parent.kind === 166 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -16148,27 +16060,27 @@ var ts; node = node.parent; } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: if (!includeArrowFunctions) { continue; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 305 /* SyntaxKind.SourceFile */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 308 /* SyntaxKind.SourceFile */: return node; } } @@ -16181,17 +16093,17 @@ var ts; switch (node.kind) { // Arrow functions use the same scope, but may do so in a "delayed" manner // For example, `const getThis = () => this` may be before a super() call in a derived constructor - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: switch (node.parent.kind) { - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Object properties can have computed names; only method-like bodies start a new scope return true; default: @@ -16215,9 +16127,9 @@ var ts; var container = getThisContainer(node, /*includeArrowFunctions*/ false); if (container) { switch (container.kind) { - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return container; } } @@ -16239,28 +16151,28 @@ var ts; return node; } switch (node.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: node = node.parent; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (!stopOnFunctions) { continue; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return node; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 164 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { + if (node.parent.kind === 166 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -16276,14 +16188,14 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 213 /* SyntaxKind.FunctionExpression */ || func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 215 /* SyntaxKind.FunctionExpression */ || func.kind === 216 /* SyntaxKind.ArrowFunction */) { var prev = func; var parent = func.parent; - while (parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { prev = parent; parent = parent.parent; } - if (parent.kind === 208 /* SyntaxKind.CallExpression */ && parent.expression === prev) { + if (parent.kind === 210 /* SyntaxKind.CallExpression */ && parent.expression === prev) { return parent; } } @@ -16299,7 +16211,7 @@ var ts; */ function isSuperProperty(node) { var kind = node.kind; - return (kind === 206 /* SyntaxKind.PropertyAccessExpression */ || kind === 207 /* SyntaxKind.ElementAccessExpression */) + return (kind === 208 /* SyntaxKind.PropertyAccessExpression */ || kind === 209 /* SyntaxKind.ElementAccessExpression */) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */; } ts.isSuperProperty = isSuperProperty; @@ -16308,7 +16220,7 @@ var ts; */ function isThisProperty(node) { var kind = node.kind; - return (kind === 206 /* SyntaxKind.PropertyAccessExpression */ || kind === 207 /* SyntaxKind.ElementAccessExpression */) + return (kind === 208 /* SyntaxKind.PropertyAccessExpression */ || kind === 209 /* SyntaxKind.ElementAccessExpression */) && node.expression.kind === 108 /* SyntaxKind.ThisKeyword */; } ts.isThisProperty = isThisProperty; @@ -16327,15 +16239,15 @@ var ts; ts.isThisInitializedObjectBindingExpression = isThisInitializedObjectBindingExpression; function getEntityNameFromTypeNode(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return isEntityNameExpression(node.expression) ? node.expression : undefined; // TODO(rbuckton): These aren't valid TypeNodes, but we treat them as such because of `isPartOfTypeNode`, which returns `true` for things that aren't `TypeNode`s. case 79 /* SyntaxKind.Identifier */: - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return node; } return undefined; @@ -16343,10 +16255,10 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { switch (node.kind) { - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return node.tag; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return node.tagName; default: return node.expression; @@ -16359,25 +16271,25 @@ var ts; return false; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // classes are valid targets return true; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return parent.kind === 257 /* SyntaxKind.ClassDeclaration */; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + return parent.kind === 260 /* SyntaxKind.ClassDeclaration */; + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. return node.body !== undefined - && parent.kind === 257 /* SyntaxKind.ClassDeclaration */; - case 164 /* SyntaxKind.Parameter */: + && parent.kind === 260 /* SyntaxKind.ClassDeclaration */; + case 166 /* SyntaxKind.Parameter */: // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; return parent.body !== undefined - && (parent.kind === 171 /* SyntaxKind.Constructor */ - || parent.kind === 169 /* SyntaxKind.MethodDeclaration */ - || parent.kind === 173 /* SyntaxKind.SetAccessor */) - && grandparent.kind === 257 /* SyntaxKind.ClassDeclaration */; + && (parent.kind === 173 /* SyntaxKind.Constructor */ + || parent.kind === 171 /* SyntaxKind.MethodDeclaration */ + || parent.kind === 175 /* SyntaxKind.SetAccessor */) + && grandparent.kind === 260 /* SyntaxKind.ClassDeclaration */; } return false; } @@ -16393,11 +16305,11 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node, parent) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return ts.some(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); }); // TODO: GH#18217 - case 169 /* SyntaxKind.MethodDeclaration */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: return ts.some(node.parameters, function (p) { return nodeIsDecorated(p, node, parent); }); // TODO: GH#18217 default: return false; @@ -16413,9 +16325,9 @@ var ts; ts.classOrConstructorParameterIsDecorated = classOrConstructorParameterIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 280 /* SyntaxKind.JsxOpeningElement */ || - parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */ || - parent.kind === 281 /* SyntaxKind.JsxClosingElement */) { + if (parent.kind === 283 /* SyntaxKind.JsxOpeningElement */ || + parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || + parent.kind === 284 /* SyntaxKind.JsxClosingElement */) { return parent.tagName === node; } return false; @@ -16428,53 +16340,54 @@ var ts; case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 229 /* SyntaxKind.AsExpression */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 221 /* SyntaxKind.BinaryExpression */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 223 /* SyntaxKind.TemplateExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: - case 224 /* SyntaxKind.YieldExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 231 /* SyntaxKind.MetaProperty */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 225 /* SyntaxKind.TemplateExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: + case 226 /* SyntaxKind.YieldExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 233 /* SyntaxKind.MetaProperty */: return true; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return !ts.isHeritageClause(node.parent); - case 161 /* SyntaxKind.QualifiedName */: - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + case 163 /* SyntaxKind.QualifiedName */: + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); - case 311 /* SyntaxKind.JSDocMemberName */: + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); + case 314 /* SyntaxKind.JSDocMemberName */: while (ts.isJSDocMemberName(node.parent)) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); case 80 /* SyntaxKind.PrivateIdentifier */: return ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 101 /* SyntaxKind.InKeyword */; case 79 /* SyntaxKind.Identifier */: - if (node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) { + if (node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) { return true; } // falls through @@ -16492,60 +16405,62 @@ var ts; function isInExpressionContext(node) { var parent = node.parent; switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 299 /* SyntaxKind.EnumMember */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 205 /* SyntaxKind.BindingElement */: return parent.initializer === node; - case 238 /* SyntaxKind.ExpressionStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 247 /* SyntaxKind.ReturnStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 289 /* SyntaxKind.CaseClause */: - case 251 /* SyntaxKind.ThrowStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 292 /* SyntaxKind.CaseClause */: + case 254 /* SyntaxKind.ThrowStatement */: return parent.expression === node; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) || forInStatement.expression === node; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return node === parent.expression; - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return node === parent.expression; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return node === parent.expression; - case 165 /* SyntaxKind.Decorator */: - case 288 /* SyntaxKind.JsxExpression */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 167 /* SyntaxKind.Decorator */: + case 291 /* SyntaxKind.JsxExpression */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + case 301 /* SyntaxKind.SpreadAssignment */: return true; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return parent.expression === node && !isPartOfTypeNode(parent); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return parent.objectAssignmentInitializer === node; + case 235 /* SyntaxKind.SatisfiesExpression */: + return node === parent.expression; default: return isExpressionNode(parent); } } ts.isInExpressionContext = isInExpressionContext; function isPartOfTypeQuery(node) { - while (node.kind === 161 /* SyntaxKind.QualifiedName */ || node.kind === 79 /* SyntaxKind.Identifier */) { + while (node.kind === 163 /* SyntaxKind.QualifiedName */ || node.kind === 79 /* SyntaxKind.Identifier */) { node = node.parent; } - return node.kind === 181 /* SyntaxKind.TypeQuery */; + return node.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isPartOfTypeQuery = isPartOfTypeQuery; function isNamespaceReexportDeclaration(node) { @@ -16553,7 +16468,7 @@ var ts; } ts.isNamespaceReexportDeclaration = isNamespaceReexportDeclaration; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -16566,7 +16481,7 @@ var ts; } ts.getExternalModuleRequireArgument = getExternalModuleRequireArgument; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind !== 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJS(file) { @@ -16598,11 +16513,11 @@ var ts; ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && node.typeArguments && node.typeArguments.length === 2 && - (node.typeArguments[0].kind === 150 /* SyntaxKind.StringKeyword */ || node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */); + (node.typeArguments[0].kind === 152 /* SyntaxKind.StringKeyword */ || node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */); } ts.isJSDocIndexSignature = isJSDocIndexSignature; function isRequireCall(callExpression, requireStringLiteralLikeArgument) { - if (callExpression.kind !== 208 /* SyntaxKind.CallExpression */) { + if (callExpression.kind !== 210 /* SyntaxKind.CallExpression */) { return false; } var _a = callExpression, expression = _a.expression, args = _a.arguments; @@ -16711,11 +16626,11 @@ var ts; function getExpandoInitializer(initializer, isPrototypeAssignment) { if (ts.isCallExpression(initializer)) { var e = skipParentheses(initializer.expression); - return e.kind === 213 /* SyntaxKind.FunctionExpression */ || e.kind === 214 /* SyntaxKind.ArrowFunction */ ? initializer : undefined; + return e.kind === 215 /* SyntaxKind.FunctionExpression */ || e.kind === 216 /* SyntaxKind.ArrowFunction */ ? initializer : undefined; } - if (initializer.kind === 213 /* SyntaxKind.FunctionExpression */ || - initializer.kind === 226 /* SyntaxKind.ClassExpression */ || - initializer.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (initializer.kind === 215 /* SyntaxKind.FunctionExpression */ || + initializer.kind === 228 /* SyntaxKind.ClassExpression */ || + initializer.kind === 216 /* SyntaxKind.ArrowFunction */) { return initializer; } if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) { @@ -16961,7 +16876,7 @@ var ts; ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment; function isSpecialPropertyDeclaration(expr) { return isInJSFile(expr) && - expr.parent && expr.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && + expr.parent && expr.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && (!ts.isElementAccessExpression(expr) || isLiteralLikeElementAccess(expr)) && !!ts.getJSDocTypeTag(expr.parent); } @@ -16982,17 +16897,17 @@ var ts; return false; } var decl = symbol.valueDeclaration; - return decl.kind === 256 /* SyntaxKind.FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); + return decl.kind === 259 /* SyntaxKind.FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); } ts.isFunctionSymbol = isFunctionSymbol; function tryGetModuleSpecifierFromDeclaration(node) { var _a, _b; switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return (_a = ts.findAncestor(node.initializer, function (node) { return isRequireCall(node, /*requireStringLiteralLikeArgument*/ true); })) === null || _a === void 0 ? void 0 : _a.arguments[0]; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike); default: ts.Debug.assertNever(node); @@ -17005,14 +16920,14 @@ var ts; ts.importFromModuleSpecifier = importFromModuleSpecifier; function tryGetImportFromModuleSpecifier(node) { switch (node.parent.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.parent; - case 277 /* SyntaxKind.ExternalModuleReference */: + case 280 /* SyntaxKind.ExternalModuleReference */: return node.parent.parent; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return isImportCall(node.parent) || isRequireCall(node.parent, /*checkArg*/ false) ? node.parent : undefined; - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: ts.Debug.assert(ts.isStringLiteral(node)); return ts.tryCast(node.parent.parent, ts.isImportTypeNode); default: @@ -17022,16 +16937,16 @@ var ts; ts.tryGetImportFromModuleSpecifier = tryGetImportFromModuleSpecifier; function getExternalModuleName(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.moduleSpecifier; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */ ? node.moduleReference.expression : undefined; - case 200 /* SyntaxKind.ImportType */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + return node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */ ? node.moduleReference.expression : undefined; + case 202 /* SyntaxKind.ImportType */: return isLiteralImportTypeNode(node) ? node.argument.literal : undefined; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return node.arguments[0]; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return node.name.kind === 10 /* SyntaxKind.StringLiteral */ ? node.name : undefined; default: return ts.Debug.assertNever(node); @@ -17040,11 +16955,11 @@ var ts; ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.exportClause && ts.tryCast(node.exportClause, ts.isNamespaceExport); default: return ts.Debug.assertNever(node); @@ -17052,7 +16967,7 @@ var ts; } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 266 /* SyntaxKind.ImportDeclaration */ && !!node.importClause && !!node.importClause.name; + return node.kind === 269 /* SyntaxKind.ImportDeclaration */ && !!node.importClause && !!node.importClause.name; } ts.isDefaultImport = isDefaultImport; function forEachImportClauseDeclaration(node, action) { @@ -17073,13 +16988,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 164 /* SyntaxKind.Parameter */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return node.questionToken !== undefined; } } @@ -17093,7 +17008,7 @@ var ts; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function isJSDocTypeAlias(node) { - return node.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || node.kind === 338 /* SyntaxKind.JSDocCallbackTag */ || node.kind === 339 /* SyntaxKind.JSDocEnumTag */; + return node.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || node.kind === 341 /* SyntaxKind.JSDocCallbackTag */ || node.kind === 342 /* SyntaxKind.JSDocEnumTag */; } ts.isJSDocTypeAlias = isJSDocTypeAlias; function isTypeAlias(node) { @@ -17118,12 +17033,12 @@ var ts; } function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: var v = getSingleVariableOfVariableStatement(node); return v && v.initializer; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return node.initializer; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return node.initializer; } } @@ -17135,7 +17050,7 @@ var ts; function getNestedModuleDeclaration(node) { return ts.isModuleDeclaration(node) && node.body && - node.body.kind === 261 /* SyntaxKind.ModuleDeclaration */ + node.body.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? node.body : undefined; } @@ -17150,11 +17065,11 @@ var ts; if (ts.hasJSDocNodes(node)) { result = ts.addRange(result, filterOwnedJSDocTags(hostNode, ts.last(node.jsDoc))); } - if (node.kind === 164 /* SyntaxKind.Parameter */) { + if (node.kind === 166 /* SyntaxKind.Parameter */) { result = ts.addRange(result, (noCache ? ts.getJSDocParameterTagsNoCache : ts.getJSDocParameterTags)(node)); break; } - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { result = ts.addRange(result, (noCache ? ts.getJSDocTypeParameterTagsNoCache : ts.getJSDocTypeParameterTags)(node)); break; } @@ -17183,11 +17098,11 @@ var ts; } function getNextJSDocCommentLocation(node) { var parent = node.parent; - if (parent.kind === 296 /* SyntaxKind.PropertyAssignment */ || - parent.kind === 271 /* SyntaxKind.ExportAssignment */ || - parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - parent.kind === 247 /* SyntaxKind.ReturnStatement */ || + if (parent.kind === 299 /* SyntaxKind.PropertyAssignment */ || + parent.kind === 274 /* SyntaxKind.ExportAssignment */ || + parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + parent.kind === 250 /* SyntaxKind.ReturnStatement */ || getNestedModuleDeclaration(parent) || ts.isBinaryExpression(node) && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { return parent; @@ -17297,34 +17212,34 @@ var ts; var parent = node.parent; while (true) { switch (parent.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 63 /* SyntaxKind.EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* AssignmentKind.Definite */ : 2 /* AssignmentKind.Compound */ : 0 /* AssignmentKind.None */; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: var unaryOperator = parent.operator; return unaryOperator === 45 /* SyntaxKind.PlusPlusToken */ || unaryOperator === 46 /* SyntaxKind.MinusMinusToken */ ? 2 /* AssignmentKind.Compound */ : 0 /* AssignmentKind.None */; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return parent.initializer === node ? 1 /* AssignmentKind.Definite */ : 0 /* AssignmentKind.None */; - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 232 /* SyntaxKind.NonNullExpression */: node = parent; break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: node = parent.parent; break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: if (parent.name !== node) { return 0 /* AssignmentKind.None */; } node = parent.parent; break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (parent.name === node) { return 0 /* AssignmentKind.None */; } @@ -17351,22 +17266,22 @@ var ts; */ function isNodeWithPossibleHoistedDeclaration(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 237 /* SyntaxKind.VariableStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 263 /* SyntaxKind.CaseBlock */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 250 /* SyntaxKind.LabeledStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 238 /* SyntaxKind.Block */: + case 240 /* SyntaxKind.VariableStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 266 /* SyntaxKind.CaseBlock */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 253 /* SyntaxKind.LabeledStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 295 /* SyntaxKind.CatchClause */: return true; } return false; @@ -17383,11 +17298,11 @@ var ts; return node; } function walkUpParenthesizedTypes(node) { - return walkUp(node, 191 /* SyntaxKind.ParenthesizedType */); + return walkUp(node, 193 /* SyntaxKind.ParenthesizedType */); } ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes; function walkUpParenthesizedExpressions(node) { - return walkUp(node, 212 /* SyntaxKind.ParenthesizedExpression */); + return walkUp(node, 214 /* SyntaxKind.ParenthesizedExpression */); } ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions; /** @@ -17397,7 +17312,7 @@ var ts; */ function walkUpParenthesizedTypesAndGetParentAndChild(node) { var child; - while (node && node.kind === 191 /* SyntaxKind.ParenthesizedType */) { + while (node && node.kind === 193 /* SyntaxKind.ParenthesizedType */) { child = node; node = node.parent; } @@ -17419,11 +17334,11 @@ var ts; ts.skipParentheses = skipParentheses; // a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped function isDeleteTarget(node) { - if (node.kind !== 206 /* SyntaxKind.PropertyAccessExpression */ && node.kind !== 207 /* SyntaxKind.ElementAccessExpression */) { + if (node.kind !== 208 /* SyntaxKind.PropertyAccessExpression */ && node.kind !== 209 /* SyntaxKind.ElementAccessExpression */) { return false; } node = walkUpParenthesizedExpressions(node.parent); - return node && node.kind === 215 /* SyntaxKind.DeleteExpression */; + return node && node.kind === 217 /* SyntaxKind.DeleteExpression */; } ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { @@ -17476,7 +17391,7 @@ var ts; ts.getDeclarationFromName = getDeclarationFromName; function isLiteralComputedPropertyDeclarationName(node) { return isStringOrNumericLiteralLike(node) && - node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */ && + node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */ && ts.isDeclaration(node.parent.parent); } ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; @@ -17484,29 +17399,29 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 299 /* SyntaxKind.EnumMember */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 302 /* SyntaxKind.EnumMember */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: // Name on right hand side of dot in a type query or type reference return parent.right === node; - case 203 /* SyntaxKind.BindingElement */: - case 270 /* SyntaxKind.ImportSpecifier */: + case 205 /* SyntaxKind.BindingElement */: + case 273 /* SyntaxKind.ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 275 /* SyntaxKind.ExportSpecifier */: - case 285 /* SyntaxKind.JsxAttribute */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 288 /* SyntaxKind.JsxAttribute */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: // Any name in an export specifier or JSX Attribute or Jsx Element return true; } @@ -17529,14 +17444,14 @@ var ts; // const x = require("...").y // const { x } = require("...").y function isAliasSymbolDeclaration(node) { - if (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ || - node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ || - node.kind === 267 /* SyntaxKind.ImportClause */ && !!node.name || - node.kind === 268 /* SyntaxKind.NamespaceImport */ || - node.kind === 274 /* SyntaxKind.NamespaceExport */ || - node.kind === 270 /* SyntaxKind.ImportSpecifier */ || - node.kind === 275 /* SyntaxKind.ExportSpecifier */ || - node.kind === 271 /* SyntaxKind.ExportAssignment */ && exportAssignmentIsAlias(node)) { + if (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ || + node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ || + node.kind === 270 /* SyntaxKind.ImportClause */ && !!node.name || + node.kind === 271 /* SyntaxKind.NamespaceImport */ || + node.kind === 277 /* SyntaxKind.NamespaceExport */ || + node.kind === 273 /* SyntaxKind.ImportSpecifier */ || + node.kind === 278 /* SyntaxKind.ExportSpecifier */ || + node.kind === 274 /* SyntaxKind.ExportAssignment */ && exportAssignmentIsAlias(node)) { return true; } return isInJSFile(node) && (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */ && exportAssignmentIsAlias(node) || @@ -17549,18 +17464,18 @@ var ts; ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getAliasDeclarationFromName(node) { switch (node.parent.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 271 /* SyntaxKind.ExportAssignment */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 274 /* SyntaxKind.NamespaceExport */: + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 274 /* SyntaxKind.ExportAssignment */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 277 /* SyntaxKind.NamespaceExport */: return node.parent; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.parent; - } while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */); + } while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */); return getAliasDeclarationFromName(node); } } @@ -17579,7 +17494,7 @@ var ts; } ts.getExportAssignmentExpression = getExportAssignmentExpression; function getPropertyAssignmentAliasLikeExpression(node) { - return node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? node.name : node.kind === 296 /* SyntaxKind.PropertyAssignment */ ? node.initializer : + return node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? node.name : node.kind === 299 /* SyntaxKind.PropertyAssignment */ ? node.initializer : node.parent.right; } ts.getPropertyAssignmentAliasLikeExpression = getPropertyAssignmentAliasLikeExpression; @@ -17645,11 +17560,11 @@ var ts; } ts.getAncestor = getAncestor; function isKeyword(token) { - return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 160 /* SyntaxKind.LastKeyword */; + return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 162 /* SyntaxKind.LastKeyword */; } ts.isKeyword = isKeyword; function isContextualKeyword(token) { - return 126 /* SyntaxKind.FirstContextualKeyword */ <= token && token <= 160 /* SyntaxKind.LastContextualKeyword */; + return 126 /* SyntaxKind.FirstContextualKeyword */ <= token && token <= 162 /* SyntaxKind.LastContextualKeyword */; } ts.isContextualKeyword = isContextualKeyword; function isNonContextualKeyword(token) { @@ -17693,15 +17608,15 @@ var ts; } var flags = 0 /* FunctionFlags.Normal */; switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: if (node.asteriskToken) { flags |= 1 /* FunctionFlags.Generator */; } // falls through - case 214 /* SyntaxKind.ArrowFunction */: - if (hasSyntacticModifier(node, 256 /* ModifierFlags.Async */)) { + case 216 /* SyntaxKind.ArrowFunction */: + if (hasSyntacticModifier(node, 512 /* ModifierFlags.Async */)) { flags |= 2 /* FunctionFlags.Async */; } break; @@ -17714,13 +17629,13 @@ var ts; ts.getFunctionFlags = getFunctionFlags; function isAsyncFunction(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: return node.body !== undefined && node.asteriskToken === undefined - && hasSyntacticModifier(node, 256 /* ModifierFlags.Async */); + && hasSyntacticModifier(node, 512 /* ModifierFlags.Async */); } return false; } @@ -17747,7 +17662,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - if (!(name.kind === 162 /* SyntaxKind.ComputedPropertyName */ || name.kind === 207 /* SyntaxKind.ElementAccessExpression */)) { + if (!(name.kind === 164 /* SyntaxKind.ComputedPropertyName */ || name.kind === 209 /* SyntaxKind.ElementAccessExpression */)) { return false; } var expr = ts.isElementAccessExpression(name) ? skipParentheses(name.argumentExpression) : name.expression; @@ -17763,7 +17678,7 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 8 /* SyntaxKind.NumericLiteral */: return ts.escapeLeadingUnderscores(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: var nameExpression = name.expression; if (isStringOrNumericLiteralLike(nameExpression)) { return ts.escapeLeadingUnderscores(nameExpression.text); @@ -17829,11 +17744,11 @@ var ts; ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 164 /* SyntaxKind.Parameter */; + return root.kind === 166 /* SyntaxKind.Parameter */; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 203 /* SyntaxKind.BindingElement */) { + while (node.kind === 205 /* SyntaxKind.BindingElement */) { node = node.parent.parent; } return node; @@ -17841,15 +17756,15 @@ var ts; ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 305 /* SyntaxKind.SourceFile */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 308 /* SyntaxKind.SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(range) { @@ -17868,23 +17783,23 @@ var ts; })(Associativity = ts.Associativity || (ts.Associativity = {})); function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 209 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 211 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return hasArguments ? 0 /* Associativity.Left */ : 1 /* Associativity.Right */; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 224 /* SyntaxKind.YieldExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 226 /* SyntaxKind.YieldExpression */: return 1 /* Associativity.Right */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (operator) { case 42 /* SyntaxKind.AsteriskAsteriskToken */: case 63 /* SyntaxKind.EqualsToken */: @@ -17911,15 +17826,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 209 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 211 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (expression.kind === 223 /* SyntaxKind.BinaryExpression */) { return expression.operatorToken.kind; } - else if (expression.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || expression.kind === 220 /* SyntaxKind.PostfixUnaryExpression */) { + else if (expression.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || expression.kind === 222 /* SyntaxKind.PostfixUnaryExpression */) { return expression.operator; } else { @@ -18098,15 +18013,15 @@ var ts; })(OperatorPrecedence = ts.OperatorPrecedence || (ts.OperatorPrecedence = {})); function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { switch (nodeKind) { - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return 0 /* OperatorPrecedence.Comma */; - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return 1 /* OperatorPrecedence.Spread */; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return 2 /* OperatorPrecedence.Yield */; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return 4 /* OperatorPrecedence.Conditional */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (operatorKind) { case 27 /* SyntaxKind.CommaToken */: return 0 /* OperatorPrecedence.Comma */; @@ -18131,26 +18046,27 @@ var ts; return getBinaryOperatorPrecedence(operatorKind); } // TODO: Should prefix `++` and `--` be moved to the `Update` precedence? - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 218 /* SyntaxKind.AwaitExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return 16 /* OperatorPrecedence.Unary */; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return 17 /* OperatorPrecedence.Update */; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return 18 /* OperatorPrecedence.LeftHandSide */; - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return hasArguments ? 19 /* OperatorPrecedence.Member */ : 18 /* OperatorPrecedence.LeftHandSide */; - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 231 /* SyntaxKind.MetaProperty */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 233 /* SyntaxKind.MetaProperty */: return 19 /* OperatorPrecedence.Member */; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return 11 /* OperatorPrecedence.Relational */; case 108 /* SyntaxKind.ThisKeyword */: case 106 /* SyntaxKind.SuperKeyword */: @@ -18162,19 +18078,19 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 226 /* SyntaxKind.ClassExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: case 13 /* SyntaxKind.RegularExpressionLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 225 /* SyntaxKind.TemplateExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: return 20 /* OperatorPrecedence.Primary */; default: return -1 /* OperatorPrecedence.Invalid */; @@ -18206,7 +18122,8 @@ var ts; case 33 /* SyntaxKind.GreaterThanEqualsToken */: case 102 /* SyntaxKind.InstanceOfKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: + case 150 /* SyntaxKind.SatisfiesKeyword */: return 11 /* OperatorPrecedence.Relational */; case 47 /* SyntaxKind.LessThanLessThanToken */: case 48 /* SyntaxKind.GreaterThanGreaterThanToken */: @@ -18230,7 +18147,7 @@ var ts; function getSemanticJsxChildren(children) { return ts.filter(children, function (i) { switch (i.kind) { - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return !!i.expression; case 11 /* SyntaxKind.JsxText */: return !i.containsOnlyTriviaWhiteSpaces; @@ -18286,7 +18203,7 @@ var ts; } diagnostics = nonFileDiagnostics; } - ts.insertSorted(diagnostics, diagnostic, compareDiagnostics); + ts.insertSorted(diagnostics, diagnostic, compareDiagnosticsSkipRelatedInformation); } function getGlobalDiagnostics() { hasReadNonFileDiagnostics = true; @@ -18822,7 +18739,7 @@ var ts; while (ts.isQualifiedName(node.parent) && node.parent.left === node) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */; + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isThisInTypeQuery = isThisInTypeQuery; function identifierIsThisKeyword(id) { @@ -18837,10 +18754,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 172 /* SyntaxKind.GetAccessor */) { + if (accessor.kind === 174 /* SyntaxKind.GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (accessor.kind === 175 /* SyntaxKind.SetAccessor */) { setAccessor = accessor; } else { @@ -18860,10 +18777,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 172 /* SyntaxKind.GetAccessor */ && !getAccessor) { + if (member.kind === 174 /* SyntaxKind.GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 173 /* SyntaxKind.SetAccessor */ && !setAccessor) { + if (member.kind === 175 /* SyntaxKind.SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -18912,7 +18829,7 @@ var ts; ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations; /** template tags are only available when a typedef isn't already using them */ function isNonTypeAliasTemplate(tag) { - return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 320 /* SyntaxKind.JSDoc */ && tag.parent.tags.some(isJSDocTypeAlias)); + return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 323 /* SyntaxKind.JSDoc */ && tag.parent.tags.some(isJSDocTypeAlias)); } /** * Gets the effective type annotation of the value parameter of a set accessor. If the node @@ -19145,13 +19062,17 @@ var ts; } ts.hasOverrideModifier = hasOverrideModifier; function hasAbstractModifier(node) { - return hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */); + return hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */); } ts.hasAbstractModifier = hasAbstractModifier; function hasAmbientModifier(node) { return hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */); } ts.hasAmbientModifier = hasAmbientModifier; + function hasAccessorModifier(node) { + return hasSyntacticModifier(node, 128 /* ModifierFlags.Accessor */); + } + ts.hasAccessorModifier = hasAccessorModifier; function hasEffectiveReadonlyModifier(node) { return hasEffectiveModifier(node, 64 /* ModifierFlags.Readonly */); } @@ -19169,7 +19090,7 @@ var ts; } ts.getSelectedSyntacticModifierFlags = getSelectedSyntacticModifierFlags; function getModifierFlagsWorker(node, includeJSDoc, alwaysIncludeJSDoc) { - if (node.kind >= 0 /* SyntaxKind.FirstToken */ && node.kind <= 160 /* SyntaxKind.LastToken */) { + if (node.kind >= 0 /* SyntaxKind.FirstToken */ && node.kind <= 162 /* SyntaxKind.LastToken */) { return 0 /* ModifierFlags.None */; } if (!(node.modifierFlagsCache & 536870912 /* ModifierFlags.HasComputedFlags */)) { @@ -19261,25 +19182,22 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: return 4 /* ModifierFlags.Public */; case 122 /* SyntaxKind.ProtectedKeyword */: return 16 /* ModifierFlags.Protected */; case 121 /* SyntaxKind.PrivateKeyword */: return 8 /* ModifierFlags.Private */; - case 126 /* SyntaxKind.AbstractKeyword */: return 128 /* ModifierFlags.Abstract */; + case 126 /* SyntaxKind.AbstractKeyword */: return 256 /* ModifierFlags.Abstract */; + case 127 /* SyntaxKind.AccessorKeyword */: return 128 /* ModifierFlags.Accessor */; case 93 /* SyntaxKind.ExportKeyword */: return 1 /* ModifierFlags.Export */; - case 135 /* SyntaxKind.DeclareKeyword */: return 2 /* ModifierFlags.Ambient */; + case 136 /* SyntaxKind.DeclareKeyword */: return 2 /* ModifierFlags.Ambient */; case 85 /* SyntaxKind.ConstKeyword */: return 2048 /* ModifierFlags.Const */; - case 88 /* SyntaxKind.DefaultKeyword */: return 512 /* ModifierFlags.Default */; - case 131 /* SyntaxKind.AsyncKeyword */: return 256 /* ModifierFlags.Async */; - case 145 /* SyntaxKind.ReadonlyKeyword */: return 64 /* ModifierFlags.Readonly */; - case 159 /* SyntaxKind.OverrideKeyword */: return 16384 /* ModifierFlags.Override */; + case 88 /* SyntaxKind.DefaultKeyword */: return 1024 /* ModifierFlags.Default */; + case 132 /* SyntaxKind.AsyncKeyword */: return 512 /* ModifierFlags.Async */; + case 146 /* SyntaxKind.ReadonlyKeyword */: return 64 /* ModifierFlags.Readonly */; + case 161 /* SyntaxKind.OverrideKeyword */: return 16384 /* ModifierFlags.Override */; case 101 /* SyntaxKind.InKeyword */: return 32768 /* ModifierFlags.In */; - case 144 /* SyntaxKind.OutKeyword */: return 65536 /* ModifierFlags.Out */; - case 165 /* SyntaxKind.Decorator */: return 131072 /* ModifierFlags.Decorator */; + case 145 /* SyntaxKind.OutKeyword */: return 65536 /* ModifierFlags.Out */; + case 167 /* SyntaxKind.Decorator */: return 131072 /* ModifierFlags.Decorator */; } return 0 /* ModifierFlags.None */; } ts.modifierToFlag = modifierToFlag; - function createModifiers(modifierFlags) { - return modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; - } - ts.createModifiers = createModifiers; function isLogicalOperator(token) { return token === 56 /* SyntaxKind.BarBarToken */ || token === 55 /* SyntaxKind.AmpersandAmpersandToken */ @@ -19329,8 +19247,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { var kind = node.left.kind; - return kind === 205 /* SyntaxKind.ObjectLiteralExpression */ - || kind === 204 /* SyntaxKind.ArrayLiteralExpression */; + return kind === 207 /* SyntaxKind.ObjectLiteralExpression */ + || kind === 206 /* SyntaxKind.ArrayLiteralExpression */; } return false; } @@ -19347,12 +19265,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.left; } while (node.kind !== 79 /* SyntaxKind.Identifier */); return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: do { node = node.expression; } while (node.kind !== 79 /* SyntaxKind.Identifier */); @@ -19364,9 +19282,9 @@ var ts; return node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 108 /* SyntaxKind.ThisKeyword */ || node.kind === 106 /* SyntaxKind.SuperKeyword */ - || node.kind === 231 /* SyntaxKind.MetaProperty */ - || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && isDottedName(node.expression) - || node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ && isDottedName(node.expression); + || node.kind === 233 /* SyntaxKind.MetaProperty */ + || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isDottedName(node.expression) + || node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ && isDottedName(node.expression); } ts.isDottedName = isDottedName; function isPropertyAccessEntityNameExpression(node) { @@ -19397,8 +19315,8 @@ var ts; } ts.isPrototypeAccess = isPrototypeAccess; function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 161 /* SyntaxKind.QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 163 /* SyntaxKind.QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isRightSideOfAccessExpression(node) { @@ -19413,12 +19331,12 @@ var ts; } ts.isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName = isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName; function isEmptyObjectLiteral(expression) { - return expression.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + return expression.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && expression.properties.length === 0; } ts.isEmptyObjectLiteral = isEmptyObjectLiteral; function isEmptyArrayLiteral(expression) { - return expression.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && + return expression.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && expression.elements.length === 0; } ts.isEmptyArrayLiteral = isEmptyArrayLiteral; @@ -19434,7 +19352,7 @@ var ts; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; function isExportDefaultSymbol(symbol) { - return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 512 /* ModifierFlags.Default */); + return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 1024 /* ModifierFlags.Default */); } /** Return ".ts", ".d.ts", or ".tsx", if that is the extension. */ function tryExtractTSExtension(fileName) { @@ -19579,21 +19497,17 @@ var ts; return getStringFromExpandedCharCodes(expandedCharCodes); } ts.base64decode = base64decode; + function readJsonOrUndefined(path, hostOrText) { + var jsonText = ts.isString(hostOrText) ? hostOrText : hostOrText.readFile(path); + if (!jsonText) + return undefined; + // gracefully handle if readFile fails or returns not JSON + var result = ts.parseConfigFileTextToJson(path, jsonText); + return !result.error ? result.config : undefined; + } + ts.readJsonOrUndefined = readJsonOrUndefined; function readJson(path, host) { - try { - var jsonText = host.readFile(path); - if (!jsonText) - return {}; - var result = ts.parseConfigFileTextToJson(path, jsonText); - if (result.error) { - return {}; - } - return result.config; - } - catch (e) { - // gracefully handle if readFile fails or returns not JSON - return {}; - } + return readJsonOrUndefined(path, host) || {}; } ts.readJson = readJson; function directoryProbablyExists(directoryName, host) { @@ -19752,8 +19666,8 @@ var ts; var parseNode = ts.getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return parseNode === parseNode.parent.name; } } @@ -19769,7 +19683,7 @@ var ts; } function isWatchSet(options) { // Firefox has Object.prototype.watch - return options.watch && options.hasOwnProperty("watch"); + return options.watch && ts.hasProperty(options, "watch"); } ts.isWatchSet = isWatchSet; function closeFileWatcher(watcher) { @@ -19833,35 +19747,35 @@ var ts; if (!parent) return 0 /* AccessKind.Read */; switch (parent.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return accessKind(parent); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var operator = parent.operator; return operator === 45 /* SyntaxKind.PlusPlusToken */ || operator === 46 /* SyntaxKind.MinusMinusToken */ ? writeOrReadWrite() : 0 /* AccessKind.Read */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var _a = parent, left = _a.left, operatorToken = _a.operatorToken; return left === node && isAssignmentOperator(operatorToken.kind) ? operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ ? 1 /* AccessKind.Write */ : writeOrReadWrite() : 0 /* AccessKind.Read */; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return parent.name !== node ? 0 /* AccessKind.Read */ : accessKind(parent); - case 296 /* SyntaxKind.PropertyAssignment */: { + case 299 /* SyntaxKind.PropertyAssignment */: { var parentAccess = accessKind(parent.parent); // In `({ x: varname }) = { x: 1 }`, the left `x` is a read, the right `x` is a write. return node === parent.name ? reverseAccessKind(parentAccess) : parentAccess; } - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // Assume it's the local variable being accessed, since we don't check public properties for --noUnusedLocals. return node === parent.objectAssignmentInitializer ? 0 /* AccessKind.Read */ : accessKind(parent.parent); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return accessKind(parent); default: return 0 /* AccessKind.Read */; } function writeOrReadWrite() { // If grandparent is not an ExpressionStatement, this is used as an expression in addition to having a side effect. - return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 238 /* SyntaxKind.ExpressionStatement */ ? 1 /* AccessKind.Write */ : 2 /* AccessKind.ReadWrite */; + return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 241 /* SyntaxKind.ExpressionStatement */ ? 1 /* AccessKind.Write */ : 2 /* AccessKind.ReadWrite */; } } function reverseAccessKind(a) { @@ -19943,7 +19857,7 @@ var ts; function isAbstractConstructorSymbol(symbol) { if (symbol.flags & 32 /* SymbolFlags.Class */) { var declaration = getClassLikeDeclarationOfSymbol(symbol); - return !!declaration && hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */); + return !!declaration && hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */); } return false; } @@ -20005,37 +19919,37 @@ var ts; } ts.isObjectTypeDeclaration = isObjectTypeDeclaration; function isTypeNodeKind(kind) { - return (kind >= 177 /* SyntaxKind.FirstTypeNode */ && kind <= 200 /* SyntaxKind.LastTypeNode */) - || kind === 130 /* SyntaxKind.AnyKeyword */ - || kind === 155 /* SyntaxKind.UnknownKeyword */ - || kind === 147 /* SyntaxKind.NumberKeyword */ - || kind === 158 /* SyntaxKind.BigIntKeyword */ - || kind === 148 /* SyntaxKind.ObjectKeyword */ - || kind === 133 /* SyntaxKind.BooleanKeyword */ - || kind === 150 /* SyntaxKind.StringKeyword */ - || kind === 151 /* SyntaxKind.SymbolKeyword */ + return (kind >= 179 /* SyntaxKind.FirstTypeNode */ && kind <= 202 /* SyntaxKind.LastTypeNode */) + || kind === 131 /* SyntaxKind.AnyKeyword */ + || kind === 157 /* SyntaxKind.UnknownKeyword */ + || kind === 148 /* SyntaxKind.NumberKeyword */ + || kind === 160 /* SyntaxKind.BigIntKeyword */ + || kind === 149 /* SyntaxKind.ObjectKeyword */ + || kind === 134 /* SyntaxKind.BooleanKeyword */ + || kind === 152 /* SyntaxKind.StringKeyword */ + || kind === 153 /* SyntaxKind.SymbolKeyword */ || kind === 114 /* SyntaxKind.VoidKeyword */ - || kind === 153 /* SyntaxKind.UndefinedKeyword */ - || kind === 143 /* SyntaxKind.NeverKeyword */ - || kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ - || kind === 312 /* SyntaxKind.JSDocAllType */ - || kind === 313 /* SyntaxKind.JSDocUnknownType */ - || kind === 314 /* SyntaxKind.JSDocNullableType */ - || kind === 315 /* SyntaxKind.JSDocNonNullableType */ - || kind === 316 /* SyntaxKind.JSDocOptionalType */ - || kind === 317 /* SyntaxKind.JSDocFunctionType */ - || kind === 318 /* SyntaxKind.JSDocVariadicType */; + || kind === 155 /* SyntaxKind.UndefinedKeyword */ + || kind === 144 /* SyntaxKind.NeverKeyword */ + || kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ + || kind === 315 /* SyntaxKind.JSDocAllType */ + || kind === 316 /* SyntaxKind.JSDocUnknownType */ + || kind === 317 /* SyntaxKind.JSDocNullableType */ + || kind === 318 /* SyntaxKind.JSDocNonNullableType */ + || kind === 319 /* SyntaxKind.JSDocOptionalType */ + || kind === 320 /* SyntaxKind.JSDocFunctionType */ + || kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isTypeNodeKind = isTypeNodeKind; function isAccessExpression(node) { - return node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 207 /* SyntaxKind.ElementAccessExpression */; + return node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 209 /* SyntaxKind.ElementAccessExpression */; } ts.isAccessExpression = isAccessExpression; function getNameOfAccessExpression(node) { - if (node.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { return node.name; } - ts.Debug.assert(node.kind === 207 /* SyntaxKind.ElementAccessExpression */); + ts.Debug.assert(node.kind === 209 /* SyntaxKind.ElementAccessExpression */); return node.argumentExpression; } ts.getNameOfAccessExpression = getNameOfAccessExpression; @@ -20050,7 +19964,7 @@ var ts; } ts.isBundleFileTextLike = isBundleFileTextLike; function isNamedImportsOrExports(node) { - return node.kind === 269 /* SyntaxKind.NamedImports */ || node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 272 /* SyntaxKind.NamedImports */ || node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedImportsOrExports = isNamedImportsOrExports; function getLeftmostAccessExpression(expr) { @@ -20065,13 +19979,13 @@ var ts; return walkAccessExpression(name.parent); } function walkAccessExpression(access) { - if (access.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (access.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var res = action(access.name); if (res !== undefined) { return res; } } - else if (access.kind === 207 /* SyntaxKind.ElementAccessExpression */) { + else if (access.kind === 209 /* SyntaxKind.ElementAccessExpression */) { if (ts.isIdentifier(access.argumentExpression) || ts.isStringLiteralLike(access.argumentExpression)) { var res = action(access.argumentExpression); if (res !== undefined) { @@ -20098,28 +20012,29 @@ var ts; function getLeftmostExpression(node, stopAtCallExpressions) { while (true) { switch (node.kind) { - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: node = node.operand; continue; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: node = node.left; continue; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: node = node.condition; continue; - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: node = node.tag; continue; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (stopAtCallExpressions) { return node; } // falls through - case 229 /* SyntaxKind.AsExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: node = node.expression; continue; } @@ -21355,17 +21270,17 @@ var ts; return ts.isIdentifier(useSite) && ts.isShorthandPropertyAssignment(useSite.parent) && useSite.parent.name === useSite; } function isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(node) { - while (node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { node = node.parent; } - if (node.kind !== 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.kind !== 164 /* SyntaxKind.ComputedPropertyName */) { return false; } - if (hasSyntacticModifier(node.parent, 128 /* ModifierFlags.Abstract */)) { + if (hasSyntacticModifier(node.parent, 256 /* ModifierFlags.Abstract */)) { return true; } var containerKind = node.parent.parent.kind; - return containerKind === 258 /* SyntaxKind.InterfaceDeclaration */ || containerKind === 182 /* SyntaxKind.TypeLiteral */; + return containerKind === 261 /* SyntaxKind.InterfaceDeclaration */ || containerKind === 184 /* SyntaxKind.TypeLiteral */; } /** Returns true for an identifier in 1) an `implements` clause, and 2) an `extends` clause of an interface. */ function isIdentifierInNonEmittingHeritageClause(node) { @@ -21373,16 +21288,16 @@ var ts; return false; var heritageClause = ts.findAncestor(node.parent, function (parent) { switch (parent.kind) { - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return true; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return false; default: return "quit"; } }); - return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 /* SyntaxKind.ImplementsKeyword */ || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 258 /* SyntaxKind.InterfaceDeclaration */; + return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 /* SyntaxKind.ImplementsKeyword */ || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 261 /* SyntaxKind.InterfaceDeclaration */; } function isIdentifierTypeReference(node) { return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName); @@ -21543,22 +21458,22 @@ var ts; if (!node.parent) return undefined; switch (node.kind) { - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: var parent_1 = node.parent; - return parent_1.kind === 190 /* SyntaxKind.InferType */ ? undefined : parent_1.typeParameters; - case 164 /* SyntaxKind.Parameter */: + return parent_1.kind === 192 /* SyntaxKind.InferType */ ? undefined : parent_1.typeParameters; + case 166 /* SyntaxKind.Parameter */: return node.parent.parameters; - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: + case 201 /* SyntaxKind.TemplateLiteralTypeSpan */: return node.parent.templateSpans; - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return node.parent.templateSpans; - case 165 /* SyntaxKind.Decorator */: { + case 167 /* SyntaxKind.Decorator */: { var parent_2 = node.parent; return ts.canHaveDecorators(parent_2) ? parent_2.modifiers : ts.canHaveIllegalDecorators(parent_2) ? parent_2.illegalDecorators : undefined; } - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return node.parent.heritageClauses; } var parent = node.parent; @@ -21566,45 +21481,45 @@ var ts; return ts.isJSDocTypeLiteral(node.parent) ? undefined : node.parent.tags; } switch (parent.kind) { - case 182 /* SyntaxKind.TypeLiteral */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.isTypeElement(node) ? parent.members : undefined; - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return parent.types; - case 184 /* SyntaxKind.TupleType */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 351 /* SyntaxKind.CommaListExpression */: - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 186 /* SyntaxKind.TupleType */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 354 /* SyntaxKind.CommaListExpression */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return parent.elements; - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 286 /* SyntaxKind.JsxAttributes */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 289 /* SyntaxKind.JsxAttributes */: return parent.properties; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return ts.isTypeNode(node) ? parent.typeArguments : parent.expression === node ? undefined : parent.arguments; - case 278 /* SyntaxKind.JsxElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 281 /* SyntaxKind.JsxElement */: + case 285 /* SyntaxKind.JsxFragment */: return ts.isJsxChild(node) ? parent.children : undefined; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return ts.isTypeNode(node) ? parent.typeArguments : undefined; - case 235 /* SyntaxKind.Block */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 265 /* SyntaxKind.ModuleBlock */: return parent.statements; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return parent.clauses; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.isClassElement(node) ? parent.members : undefined; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.isEnumMember(node) ? parent.members : undefined; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return parent.statements; } } @@ -21616,7 +21531,7 @@ var ts; if (ts.some(node.parameters, function (p) { return !getEffectiveTypeAnnotationNode(p); })) { return true; } - if (node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind !== 216 /* SyntaxKind.ArrowFunction */) { // If the first parameter is not an explicit 'this' parameter, then the function has // an implicit 'this' parameter which is subject to contextual typing. var parameter = ts.firstOrUndefined(node.parameters); @@ -21634,7 +21549,7 @@ var ts; } ts.isInfinityOrNaNString = isInfinityOrNaNString; function isCatchClauseVariableDeclaration(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function isParameterOrCatchClauseVariable(symbol) { @@ -21643,7 +21558,7 @@ var ts; } ts.isParameterOrCatchClauseVariable = isParameterOrCatchClauseVariable; function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 213 /* SyntaxKind.FunctionExpression */ || node.kind === 214 /* SyntaxKind.ArrowFunction */; + return node.kind === 215 /* SyntaxKind.FunctionExpression */ || node.kind === 216 /* SyntaxKind.ArrowFunction */; } ts.isFunctionExpressionOrArrowFunction = isFunctionExpressionOrArrowFunction; function escapeSnippetText(text) { @@ -21740,7 +21655,7 @@ var ts; ts.getNodeModulePathParts = getNodeModulePathParts; function getParameterTypeNode(parameter) { var _a; - return parameter.kind === 340 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; + return parameter.kind === 343 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; } ts.getParameterTypeNode = getParameterTypeNode; })(ts || (ts = {})); @@ -21865,10 +21780,10 @@ var ts; // // If `a ** d` is on the left of operator `**`, we need to parenthesize to preserve // the intended order of operations: `(a ** b) ** c` - var binaryOperatorPrecedence = ts.getOperatorPrecedence(221 /* SyntaxKind.BinaryExpression */, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(221 /* SyntaxKind.BinaryExpression */, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(223 /* SyntaxKind.BinaryExpression */, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(223 /* SyntaxKind.BinaryExpression */, binaryOperator); var emittedOperand = ts.skipPartiallyEmittedExpressions(operand); - if (!isLeftSideOfBinary && operand.kind === 214 /* SyntaxKind.ArrowFunction */ && binaryOperatorPrecedence > 3 /* OperatorPrecedence.Assignment */) { + if (!isLeftSideOfBinary && operand.kind === 216 /* SyntaxKind.ArrowFunction */ && binaryOperatorPrecedence > 3 /* OperatorPrecedence.Assignment */) { // We need to parenthesize arrow functions on the right side to avoid it being // parsed as parenthesized expression: `a && (() => {})` return true; @@ -21880,7 +21795,7 @@ var ts; // and is a yield expression, then we do not need parentheses. if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 /* Associativity.Right */ - && operand.kind === 224 /* SyntaxKind.YieldExpression */) { + && operand.kind === 226 /* SyntaxKind.YieldExpression */) { return false; } return true; @@ -21949,13 +21864,15 @@ var ts; // (a|b)|c -> a|(b|c) -> a|b|c // (a&b)&c -> a&(b&c) -> a&b&c // (a^b)^c -> a^(b^c) -> a^b^c + // (a,b),c -> a,(b,c) -> a,b,c // // While addition is associative in mathematics, JavaScript's `+` is not // guaranteed to be associative as it is overloaded with string concatenation. return binaryOperator === 41 /* SyntaxKind.AsteriskToken */ || binaryOperator === 51 /* SyntaxKind.BarToken */ || binaryOperator === 50 /* SyntaxKind.AmpersandToken */ - || binaryOperator === 52 /* SyntaxKind.CaretToken */; + || binaryOperator === 52 /* SyntaxKind.CaretToken */ + || binaryOperator === 27 /* SyntaxKind.CommaToken */; } /** * This function determines whether an expression consists of a homogeneous set of @@ -21968,7 +21885,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 39 /* SyntaxKind.PlusToken */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 39 /* SyntaxKind.PlusToken */) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -21994,7 +21911,7 @@ var ts; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = ts.skipPartiallyEmittedExpressions(operand); // If the resulting expression is already parenthesized, we do not need to do any further processing. - if (skipped.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (skipped.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) @@ -22011,7 +21928,7 @@ var ts; return ts.isCommaSequence(expression) ? factory.createParenthesizedExpression(expression) : expression; } function parenthesizeConditionOfConditionalExpression(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(222 /* SyntaxKind.ConditionalExpression */, 57 /* SyntaxKind.QuestionToken */); + var conditionalPrecedence = ts.getOperatorPrecedence(224 /* SyntaxKind.ConditionalExpression */, 57 /* SyntaxKind.QuestionToken */); var emittedCondition = ts.skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) !== 1 /* Comparison.GreaterThan */) { @@ -22044,8 +21961,8 @@ var ts; var needsParens = ts.isCommaSequence(check); if (!needsParens) { switch (ts.getLeftmostExpression(check, /*stopAtCallExpression*/ false).kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: needsParens = true; } } @@ -22058,9 +21975,9 @@ var ts; function parenthesizeExpressionOfNew(expression) { var leftmostExpr = ts.getLeftmostExpression(expression, /*stopAtCallExpressions*/ true); switch (leftmostExpr.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return factory.createParenthesizedExpression(expression); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return !leftmostExpr.arguments ? factory.createParenthesizedExpression(expression) : expression; // TODO(rbuckton): Verify this assertion holds @@ -22080,7 +21997,7 @@ var ts; // var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 209 /* SyntaxKind.NewExpression */ || emittedExpression.arguments) + && (emittedExpression.kind !== 211 /* SyntaxKind.NewExpression */ || emittedExpression.arguments) && (optionalChain || !ts.isOptionalChain(emittedExpression))) { // TODO(rbuckton): Verify whether this assertion holds. return expression; @@ -22103,7 +22020,7 @@ var ts; function parenthesizeExpressionForDisallowedComma(expression) { var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(221 /* SyntaxKind.BinaryExpression */, 27 /* SyntaxKind.CommaToken */); + var commaPrecedence = ts.getOperatorPrecedence(223 /* SyntaxKind.BinaryExpression */, 27 /* SyntaxKind.CommaToken */); // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return expressionPrecedence > commaPrecedence ? expression : ts.setTextRange(factory.createParenthesizedExpression(expression), expression); } @@ -22112,21 +22029,21 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = ts.skipPartiallyEmittedExpressions(callee).kind; - if (kind === 213 /* SyntaxKind.FunctionExpression */ || kind === 214 /* SyntaxKind.ArrowFunction */) { + if (kind === 215 /* SyntaxKind.FunctionExpression */ || kind === 216 /* SyntaxKind.ArrowFunction */) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. var updated = factory.updateCallExpression(emittedExpression, ts.setTextRange(factory.createParenthesizedExpression(callee), callee), emittedExpression.typeArguments, emittedExpression.arguments); return factory.restoreOuterExpressions(expression, updated, 8 /* OuterExpressionKinds.PartiallyEmittedExpressions */); } } var leftmostExpressionKind = ts.getLeftmostExpression(emittedExpression, /*stopAtCallExpressions*/ false).kind; - if (leftmostExpressionKind === 205 /* SyntaxKind.ObjectLiteralExpression */ || leftmostExpressionKind === 213 /* SyntaxKind.FunctionExpression */) { + if (leftmostExpressionKind === 207 /* SyntaxKind.ObjectLiteralExpression */ || leftmostExpressionKind === 215 /* SyntaxKind.FunctionExpression */) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return ts.setTextRange(factory.createParenthesizedExpression(expression), expression); } return expression; } function parenthesizeConciseBodyOfArrowFunction(body) { - if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 205 /* SyntaxKind.ObjectLiteralExpression */)) { + if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 207 /* SyntaxKind.ObjectLiteralExpression */)) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return ts.setTextRange(factory.createParenthesizedExpression(body), body); } @@ -22144,16 +22061,16 @@ var ts; // - The true and false branch types (the second and third `Type` non-terminals, above) allow any type function parenthesizeCheckTypeOfConditionalType(checkType) { switch (checkType.kind) { - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 189 /* SyntaxKind.ConditionalType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 191 /* SyntaxKind.ConditionalType */: return factory.createParenthesizedType(checkType); } return checkType; } function parenthesizeExtendsTypeOfConditionalType(extendsType) { switch (extendsType.kind) { - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return factory.createParenthesizedType(extendsType); } return extendsType; @@ -22165,8 +22082,8 @@ var ts; // - A union type constituent has the same precedence as the check type of a conditional type function parenthesizeConstituentTypeOfUnionType(type) { switch (type.kind) { - case 187 /* SyntaxKind.UnionType */: // Not strictly necessary, but a union containing a union should have been flattened - case 188 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests + case 189 /* SyntaxKind.UnionType */: // Not strictly necessary, but a union containing a union should have been flattened + case 190 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests return factory.createParenthesizedType(type); } return parenthesizeCheckTypeOfConditionalType(type); @@ -22181,8 +22098,8 @@ var ts; // - An intersection type constituent does not allow function, constructor, conditional, or union types (they must be parenthesized) function parenthesizeConstituentTypeOfIntersectionType(type) { switch (type.kind) { - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but an intersection containing an intersection should have been flattened + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but an intersection containing an intersection should have been flattened return factory.createParenthesizedType(type); } return parenthesizeConstituentTypeOfUnionType(type); @@ -22199,14 +22116,14 @@ var ts; // function parenthesizeOperandOfTypeOperator(type) { switch (type.kind) { - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return factory.createParenthesizedType(type); } return parenthesizeConstituentTypeOfIntersectionType(type); } function parenthesizeOperandOfReadonlyTypeOperator(type) { switch (type.kind) { - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return factory.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); @@ -22226,9 +22143,9 @@ var ts; // function parenthesizeNonArrayTypeOfPostfixType(type) { switch (type.kind) { - case 190 /* SyntaxKind.InferType */: - case 193 /* SyntaxKind.TypeOperator */: - case 181 /* SyntaxKind.TypeQuery */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests + case 192 /* SyntaxKind.InferType */: + case 195 /* SyntaxKind.TypeOperator */: + case 183 /* SyntaxKind.TypeQuery */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests return factory.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); @@ -22422,11 +22339,11 @@ var ts; } function convertToAssignmentPattern(node) { switch (node.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return convertToArrayAssignmentPattern(node); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return convertToObjectAssignmentPattern(node); } } @@ -22520,6 +22437,8 @@ var ts; createUniqueName: createUniqueName, getGeneratedNameForNode: getGeneratedNameForNode, createPrivateIdentifier: createPrivateIdentifier, + createUniquePrivateName: createUniquePrivateName, + getGeneratedPrivateNameForNode: getGeneratedPrivateNameForNode, createToken: createToken, createSuper: createSuper, createThis: createThis, @@ -22682,6 +22601,8 @@ var ts; updateAsExpression: updateAsExpression, createNonNullExpression: createNonNullExpression, updateNonNullExpression: updateNonNullExpression, + createSatisfiesExpression: createSatisfiesExpression, + updateSatisfiesExpression: updateSatisfiesExpression, createNonNullChain: createNonNullChain, updateNonNullChain: updateNonNullChain, createMetaProperty: createMetaProperty, @@ -22779,18 +22700,18 @@ var ts; createExternalModuleReference: createExternalModuleReference, updateExternalModuleReference: updateExternalModuleReference, // lazily load factory members for JSDoc types with similar structure - get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(312 /* SyntaxKind.JSDocAllType */); }, - get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(313 /* SyntaxKind.JSDocUnknownType */); }, - get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(315 /* SyntaxKind.JSDocNonNullableType */); }, - get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(315 /* SyntaxKind.JSDocNonNullableType */); }, - get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(314 /* SyntaxKind.JSDocNullableType */); }, - get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(314 /* SyntaxKind.JSDocNullableType */); }, - get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(316 /* SyntaxKind.JSDocOptionalType */); }, - get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(316 /* SyntaxKind.JSDocOptionalType */); }, - get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(318 /* SyntaxKind.JSDocVariadicType */); }, - get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(318 /* SyntaxKind.JSDocVariadicType */); }, - get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(319 /* SyntaxKind.JSDocNamepathType */); }, - get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(319 /* SyntaxKind.JSDocNamepathType */); }, + get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(315 /* SyntaxKind.JSDocAllType */); }, + get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(316 /* SyntaxKind.JSDocUnknownType */); }, + get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(318 /* SyntaxKind.JSDocNonNullableType */); }, + get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(318 /* SyntaxKind.JSDocNonNullableType */); }, + get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(317 /* SyntaxKind.JSDocNullableType */); }, + get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(317 /* SyntaxKind.JSDocNullableType */); }, + get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(319 /* SyntaxKind.JSDocOptionalType */); }, + get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(319 /* SyntaxKind.JSDocOptionalType */); }, + get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(321 /* SyntaxKind.JSDocVariadicType */); }, + get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(321 /* SyntaxKind.JSDocVariadicType */); }, + get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(322 /* SyntaxKind.JSDocNamepathType */); }, + get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(322 /* SyntaxKind.JSDocNamepathType */); }, createJSDocFunctionType: createJSDocFunctionType, updateJSDocFunctionType: updateJSDocFunctionType, createJSDocTypeLiteral: createJSDocTypeLiteral, @@ -22826,30 +22747,30 @@ var ts; createJSDocLinkPlain: createJSDocLinkPlain, updateJSDocLinkPlain: updateJSDocLinkPlain, // lazily load factory members for JSDoc tags with similar structure - get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(343 /* SyntaxKind.JSDocTypeTag */); }, - get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(343 /* SyntaxKind.JSDocTypeTag */); }, - get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(341 /* SyntaxKind.JSDocReturnTag */); }, - get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(341 /* SyntaxKind.JSDocReturnTag */); }, - get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(342 /* SyntaxKind.JSDocThisTag */); }, - get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(342 /* SyntaxKind.JSDocThisTag */); }, - get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(339 /* SyntaxKind.JSDocEnumTag */); }, - get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(339 /* SyntaxKind.JSDocEnumTag */); }, - get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(330 /* SyntaxKind.JSDocAuthorTag */); }, - get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(330 /* SyntaxKind.JSDocAuthorTag */); }, - get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(332 /* SyntaxKind.JSDocClassTag */); }, - get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(332 /* SyntaxKind.JSDocClassTag */); }, - get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(333 /* SyntaxKind.JSDocPublicTag */); }, - get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(333 /* SyntaxKind.JSDocPublicTag */); }, - get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(334 /* SyntaxKind.JSDocPrivateTag */); }, - get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(334 /* SyntaxKind.JSDocPrivateTag */); }, - get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(335 /* SyntaxKind.JSDocProtectedTag */); }, - get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(335 /* SyntaxKind.JSDocProtectedTag */); }, - get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(336 /* SyntaxKind.JSDocReadonlyTag */); }, - get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(336 /* SyntaxKind.JSDocReadonlyTag */); }, - get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(337 /* SyntaxKind.JSDocOverrideTag */); }, - get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(337 /* SyntaxKind.JSDocOverrideTag */); }, - get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(331 /* SyntaxKind.JSDocDeprecatedTag */); }, - get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(331 /* SyntaxKind.JSDocDeprecatedTag */); }, + get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(346 /* SyntaxKind.JSDocTypeTag */); }, + get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(346 /* SyntaxKind.JSDocTypeTag */); }, + get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(344 /* SyntaxKind.JSDocReturnTag */); }, + get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(344 /* SyntaxKind.JSDocReturnTag */); }, + get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(345 /* SyntaxKind.JSDocThisTag */); }, + get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(345 /* SyntaxKind.JSDocThisTag */); }, + get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(342 /* SyntaxKind.JSDocEnumTag */); }, + get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(342 /* SyntaxKind.JSDocEnumTag */); }, + get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(333 /* SyntaxKind.JSDocAuthorTag */); }, + get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(333 /* SyntaxKind.JSDocAuthorTag */); }, + get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(335 /* SyntaxKind.JSDocClassTag */); }, + get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(335 /* SyntaxKind.JSDocClassTag */); }, + get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(336 /* SyntaxKind.JSDocPublicTag */); }, + get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(336 /* SyntaxKind.JSDocPublicTag */); }, + get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(337 /* SyntaxKind.JSDocPrivateTag */); }, + get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(337 /* SyntaxKind.JSDocPrivateTag */); }, + get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(338 /* SyntaxKind.JSDocProtectedTag */); }, + get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(338 /* SyntaxKind.JSDocProtectedTag */); }, + get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(339 /* SyntaxKind.JSDocReadonlyTag */); }, + get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(339 /* SyntaxKind.JSDocReadonlyTag */); }, + get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(340 /* SyntaxKind.JSDocOverrideTag */); }, + get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(340 /* SyntaxKind.JSDocOverrideTag */); }, + get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(334 /* SyntaxKind.JSDocDeprecatedTag */); }, + get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(334 /* SyntaxKind.JSDocDeprecatedTag */); }, createJSDocUnknownTag: createJSDocUnknownTag, updateJSDocUnknownTag: updateJSDocUnknownTag, createJSDocText: createJSDocText, @@ -23052,11 +22973,11 @@ var ts; // don't propagate child flags. if (name) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: if (ts.isIdentifier(name)) { node.transformFlags |= propagateIdentifierNameFlags(name); break; @@ -23205,10 +23126,12 @@ var ts; node.escapedText = ts.escapeLeadingUnderscores(text); return node; } - function createBaseGeneratedIdentifier(text, autoGenerateFlags) { + function createBaseGeneratedIdentifier(text, autoGenerateFlags, prefix, suffix) { var node = createBaseIdentifier(text, /*originalKeywordKind*/ undefined); node.autoGenerateFlags = autoGenerateFlags; node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; nextAutoGenerateId++; return node; } @@ -23219,7 +23142,7 @@ var ts; // NOTE: we do not use `setChildren` here because typeArguments in an identifier do not contribute to transformations node.typeArguments = createNodeArray(typeArguments); } - if (node.originalKeywordKind === 132 /* SyntaxKind.AwaitKeyword */) { + if (node.originalKeywordKind === 133 /* SyntaxKind.AwaitKeyword */) { node.transformFlags |= 67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; } return node; @@ -23231,11 +23154,11 @@ var ts; : node; } // @api - function createTempVariable(recordTempVariable, reservedInNestedScopes) { + function createTempVariable(recordTempVariable, reservedInNestedScopes, prefix, suffix) { var flags = 1 /* GeneratedIdentifierFlags.Auto */; if (reservedInNestedScopes) flags |= 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */; - var name = createBaseGeneratedIdentifier("", flags); + var name = createBaseGeneratedIdentifier("", flags, prefix, suffix); if (recordTempVariable) { recordTempVariable(name); } @@ -23247,34 +23170,69 @@ var ts; var flags = 2 /* GeneratedIdentifierFlags.Loop */; if (reservedInNestedScopes) flags |= 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */; - return createBaseGeneratedIdentifier("", flags); + return createBaseGeneratedIdentifier("", flags, /*prefix*/ undefined, /*suffix*/ undefined); } /** Create a unique name based on the supplied text. */ // @api - function createUniqueName(text, flags) { + function createUniqueName(text, flags, prefix, suffix) { if (flags === void 0) { flags = 0 /* GeneratedIdentifierFlags.None */; } ts.Debug.assert(!(flags & 7 /* GeneratedIdentifierFlags.KindMask */), "Argument out of range: flags"); ts.Debug.assert((flags & (16 /* GeneratedIdentifierFlags.Optimistic */ | 32 /* GeneratedIdentifierFlags.FileLevel */)) !== 32 /* GeneratedIdentifierFlags.FileLevel */, "GeneratedIdentifierFlags.FileLevel cannot be set without also setting GeneratedIdentifierFlags.Optimistic"); - return createBaseGeneratedIdentifier(text, 3 /* GeneratedIdentifierFlags.Unique */ | flags); + return createBaseGeneratedIdentifier(text, 3 /* GeneratedIdentifierFlags.Unique */ | flags, prefix, suffix); } /** Create a unique name generated for a node. */ // @api - function getGeneratedNameForNode(node, flags) { + function getGeneratedNameForNode(node, flags, prefix, suffix) { if (flags === void 0) { flags = 0; } ts.Debug.assert(!(flags & 7 /* GeneratedIdentifierFlags.KindMask */), "Argument out of range: flags"); - var name = createBaseGeneratedIdentifier(node && ts.isIdentifier(node) ? ts.idText(node) : "", 4 /* GeneratedIdentifierFlags.Node */ | flags); + var text = !node ? "" : + ts.isMemberName(node) ? ts.formatGeneratedName(/*privateName*/ false, prefix, node, suffix, ts.idText) : + "generated@".concat(ts.getNodeId(node)); + if (prefix || suffix) + flags |= 16 /* GeneratedIdentifierFlags.Optimistic */; + var name = createBaseGeneratedIdentifier(text, 4 /* GeneratedIdentifierFlags.Node */ | flags, prefix, suffix); name.original = node; return name; } + function createBasePrivateIdentifier(text) { + var node = baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */); + node.escapedText = ts.escapeLeadingUnderscores(text); + node.transformFlags |= 16777216 /* TransformFlags.ContainsClassFields */; + return node; + } // @api function createPrivateIdentifier(text) { if (!ts.startsWith(text, "#")) ts.Debug.fail("First character of private identifier must be #: " + text); - var node = baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */); - node.escapedText = ts.escapeLeadingUnderscores(text); - node.transformFlags |= 16777216 /* TransformFlags.ContainsClassFields */; + return createBasePrivateIdentifier(text); + } + function createBaseGeneratedPrivateIdentifier(text, autoGenerateFlags, prefix, suffix) { + var node = createBasePrivateIdentifier(text); + node.autoGenerateFlags = autoGenerateFlags; + node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; + nextAutoGenerateId++; return node; } + /** Create a unique name based on the supplied text. */ + // @api + function createUniquePrivateName(text, prefix, suffix) { + if (text && !ts.startsWith(text, "#")) + ts.Debug.fail("First character of private identifier must be #: " + text); + var autoGenerateFlags = 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */ | + (text ? 3 /* GeneratedIdentifierFlags.Unique */ : 1 /* GeneratedIdentifierFlags.Auto */); + return createBaseGeneratedPrivateIdentifier(text !== null && text !== void 0 ? text : "", autoGenerateFlags, prefix, suffix); + } + // @api + function getGeneratedPrivateNameForNode(node, prefix, suffix) { + var text = ts.isMemberName(node) ? ts.formatGeneratedName(/*privateName*/ true, prefix, node, suffix, ts.idText) : + "#generated@".concat(ts.getNodeId(node)); + var flags = prefix || suffix ? 16 /* GeneratedIdentifierFlags.Optimistic */ : 0 /* GeneratedIdentifierFlags.None */; + var name = createBaseGeneratedPrivateIdentifier(text, 4 /* GeneratedIdentifierFlags.Node */ | flags, prefix, suffix); + name.original = node; + return name; + } // // Punctuation // @@ -23282,14 +23240,14 @@ var ts; return baseFactory.createBaseTokenNode(kind); } function createToken(token) { - ts.Debug.assert(token >= 0 /* SyntaxKind.FirstToken */ && token <= 160 /* SyntaxKind.LastToken */, "Invalid token"); + ts.Debug.assert(token >= 0 /* SyntaxKind.FirstToken */ && token <= 162 /* SyntaxKind.LastToken */, "Invalid token"); ts.Debug.assert(token <= 14 /* SyntaxKind.FirstTemplateToken */ || token >= 17 /* SyntaxKind.LastTemplateToken */, "Invalid token. Use 'createTemplateLiteralLikeNode' to create template literals."); ts.Debug.assert(token <= 8 /* SyntaxKind.FirstLiteralToken */ || token >= 14 /* SyntaxKind.LastLiteralToken */, "Invalid token. Use 'createLiteralLikeNode' to create literals."); ts.Debug.assert(token !== 79 /* SyntaxKind.Identifier */, "Invalid token. Use 'createIdentifier' to create identifiers"); var node = createBaseToken(token); var transformFlags = 0 /* TransformFlags.None */; switch (token) { - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // 'async' modifier is ES2017 (async functions) or ES2018 (async generators) transformFlags = 256 /* TransformFlags.ContainsES2017 */ | @@ -23298,24 +23256,24 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 130 /* SyntaxKind.AnyKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 145 /* SyntaxKind.OutKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: // `undefined` is an Identifier in the expression case. + case 157 /* SyntaxKind.UnknownKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: // `undefined` is an Identifier in the expression case. transformFlags = 1 /* TransformFlags.ContainsTypeScript */; break; case 106 /* SyntaxKind.SuperKeyword */: @@ -23324,6 +23282,9 @@ var ts; case 124 /* SyntaxKind.StaticKeyword */: transformFlags = 1024 /* TransformFlags.ContainsES2015 */; break; + case 127 /* SyntaxKind.AccessorKeyword */: + transformFlags = 16777216 /* TransformFlags.ContainsClassFields */; + break; case 108 /* SyntaxKind.ThisKeyword */: // 'this' indicates a lexical 'this' transformFlags = 16384 /* TransformFlags.ContainsLexicalThis */; @@ -23370,8 +23331,8 @@ var ts; if (flags & 1 /* ModifierFlags.Export */) result.push(createModifier(93 /* SyntaxKind.ExportKeyword */)); if (flags & 2 /* ModifierFlags.Ambient */) - result.push(createModifier(135 /* SyntaxKind.DeclareKeyword */)); - if (flags & 512 /* ModifierFlags.Default */) + result.push(createModifier(136 /* SyntaxKind.DeclareKeyword */)); + if (flags & 1024 /* ModifierFlags.Default */) result.push(createModifier(88 /* SyntaxKind.DefaultKeyword */)); if (flags & 2048 /* ModifierFlags.Const */) result.push(createModifier(85 /* SyntaxKind.ConstKeyword */)); @@ -23381,20 +23342,22 @@ var ts; result.push(createModifier(121 /* SyntaxKind.PrivateKeyword */)); if (flags & 16 /* ModifierFlags.Protected */) result.push(createModifier(122 /* SyntaxKind.ProtectedKeyword */)); - if (flags & 128 /* ModifierFlags.Abstract */) + if (flags & 256 /* ModifierFlags.Abstract */) result.push(createModifier(126 /* SyntaxKind.AbstractKeyword */)); if (flags & 32 /* ModifierFlags.Static */) result.push(createModifier(124 /* SyntaxKind.StaticKeyword */)); if (flags & 16384 /* ModifierFlags.Override */) - result.push(createModifier(159 /* SyntaxKind.OverrideKeyword */)); + result.push(createModifier(161 /* SyntaxKind.OverrideKeyword */)); if (flags & 64 /* ModifierFlags.Readonly */) - result.push(createModifier(145 /* SyntaxKind.ReadonlyKeyword */)); - if (flags & 256 /* ModifierFlags.Async */) - result.push(createModifier(131 /* SyntaxKind.AsyncKeyword */)); + result.push(createModifier(146 /* SyntaxKind.ReadonlyKeyword */)); + if (flags & 128 /* ModifierFlags.Accessor */) + result.push(createModifier(127 /* SyntaxKind.AccessorKeyword */)); + if (flags & 512 /* ModifierFlags.Async */) + result.push(createModifier(132 /* SyntaxKind.AsyncKeyword */)); if (flags & 32768 /* ModifierFlags.In */) result.push(createModifier(101 /* SyntaxKind.InKeyword */)); if (flags & 65536 /* ModifierFlags.Out */) - result.push(createModifier(144 /* SyntaxKind.OutKeyword */)); + result.push(createModifier(145 /* SyntaxKind.OutKeyword */)); return result.length ? result : undefined; } // @@ -23402,7 +23365,7 @@ var ts; // // @api function createQualifiedName(left, right) { - var node = createBaseNode(161 /* SyntaxKind.QualifiedName */); + var node = createBaseNode(163 /* SyntaxKind.QualifiedName */); node.left = left; node.right = asName(right); node.transformFlags |= @@ -23419,7 +23382,7 @@ var ts; } // @api function createComputedPropertyName(expression) { - var node = createBaseNode(162 /* SyntaxKind.ComputedPropertyName */); + var node = createBaseNode(164 /* SyntaxKind.ComputedPropertyName */); node.expression = parenthesizerRules().parenthesizeExpressionOfComputedPropertyName(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -23438,7 +23401,7 @@ var ts; // // @api function createTypeParameterDeclaration(modifiers, name, constraint, defaultType) { - var node = createBaseNamedDeclaration(163 /* SyntaxKind.TypeParameter */, modifiers, name); + var node = createBaseNamedDeclaration(165 /* SyntaxKind.TypeParameter */, modifiers, name); node.constraint = constraint; node.default = defaultType; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23455,7 +23418,7 @@ var ts; } // @api function createParameterDeclaration(modifiers, dotDotDotToken, name, questionToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(164 /* SyntaxKind.Parameter */, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); + var node = createBaseVariableLikeDeclaration(166 /* SyntaxKind.Parameter */, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.dotDotDotToken = dotDotDotToken; node.questionToken = questionToken; if (ts.isThisIdentifier(node.name)) { @@ -23487,7 +23450,7 @@ var ts; } // @api function createDecorator(expression) { - var node = createBaseNode(165 /* SyntaxKind.Decorator */); + var node = createBaseNode(167 /* SyntaxKind.Decorator */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.transformFlags |= propagateChildFlags(node.expression) | @@ -23507,7 +23470,7 @@ var ts; // // @api function createPropertySignature(modifiers, name, questionToken, type) { - var node = createBaseNamedDeclaration(166 /* SyntaxKind.PropertySignature */, modifiers, name); + var node = createBaseNamedDeclaration(168 /* SyntaxKind.PropertySignature */, modifiers, name); node.type = type; node.questionToken = questionToken; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23533,7 +23496,7 @@ var ts; } // @api function createPropertyDeclaration(modifiers, name, questionOrExclamationToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(167 /* SyntaxKind.PropertyDeclaration */, modifiers, name, type, initializer); + var node = createBaseVariableLikeDeclaration(169 /* SyntaxKind.PropertyDeclaration */, modifiers, name, type, initializer); node.questionToken = questionOrExclamationToken && ts.isQuestionToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.exclamationToken = questionOrExclamationToken && ts.isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.transformFlags |= @@ -23561,7 +23524,7 @@ var ts; } // @api function createMethodSignature(modifiers, name, questionToken, typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(168 /* SyntaxKind.MethodSignature */, modifiers, name, typeParameters, parameters, type); + var node = createBaseSignatureDeclaration(170 /* SyntaxKind.MethodSignature */, modifiers, name, typeParameters, parameters, type); node.questionToken = questionToken; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23579,7 +23542,7 @@ var ts; } // @api function createMethodDeclaration(modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(169 /* SyntaxKind.MethodDeclaration */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(171 /* SyntaxKind.MethodDeclaration */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; node.questionToken = questionToken; node.transformFlags |= @@ -23589,7 +23552,7 @@ var ts; if (questionToken) { node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; } - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -23625,7 +23588,7 @@ var ts; } // @api function createClassStaticBlockDeclaration(body) { - var node = createBaseGenericNamedDeclaration(170 /* SyntaxKind.ClassStaticBlockDeclaration */, + var node = createBaseGenericNamedDeclaration(172 /* SyntaxKind.ClassStaticBlockDeclaration */, /*modifiers*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined); @@ -23651,7 +23614,7 @@ var ts; } // @api function createConstructorDeclaration(modifiers, parameters, body) { - var node = createBaseFunctionLikeDeclaration(171 /* SyntaxKind.Constructor */, modifiers, + var node = createBaseFunctionLikeDeclaration(173 /* SyntaxKind.Constructor */, modifiers, /*name*/ undefined, /*typeParameters*/ undefined, parameters, /*type*/ undefined, body); @@ -23680,7 +23643,7 @@ var ts; } // @api function createGetAccessorDeclaration(modifiers, name, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(172 /* SyntaxKind.GetAccessor */, modifiers, name, + var node = createBaseFunctionLikeDeclaration(174 /* SyntaxKind.GetAccessor */, modifiers, name, /*typeParameters*/ undefined, parameters, type, body); // The following properties are used only to report grammar errors node.typeParameters = undefined; @@ -23704,7 +23667,7 @@ var ts; } // @api function createSetAccessorDeclaration(modifiers, name, parameters, body) { - var node = createBaseFunctionLikeDeclaration(173 /* SyntaxKind.SetAccessor */, modifiers, name, + var node = createBaseFunctionLikeDeclaration(175 /* SyntaxKind.SetAccessor */, modifiers, name, /*typeParameters*/ undefined, parameters, /*type*/ undefined, body); // The following properties are used only to report grammar errors @@ -23730,7 +23693,7 @@ var ts; } // @api function createCallSignature(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(174 /* SyntaxKind.CallSignature */, + var node = createBaseSignatureDeclaration(176 /* SyntaxKind.CallSignature */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23746,7 +23709,7 @@ var ts; } // @api function createConstructSignature(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(175 /* SyntaxKind.ConstructSignature */, + var node = createBaseSignatureDeclaration(177 /* SyntaxKind.ConstructSignature */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23762,7 +23725,7 @@ var ts; } // @api function createIndexSignature(modifiers, parameters, type) { - var node = createBaseSignatureDeclaration(176 /* SyntaxKind.IndexSignature */, modifiers, + var node = createBaseSignatureDeclaration(178 /* SyntaxKind.IndexSignature */, modifiers, /*name*/ undefined, /*typeParameters*/ undefined, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23778,7 +23741,7 @@ var ts; } // @api function createTemplateLiteralTypeSpan(type, literal) { - var node = createBaseNode(199 /* SyntaxKind.TemplateLiteralTypeSpan */); + var node = createBaseNode(201 /* SyntaxKind.TemplateLiteralTypeSpan */); node.type = type; node.literal = literal; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23800,7 +23763,7 @@ var ts; } // @api function createTypePredicateNode(assertsModifier, parameterName, type) { - var node = createBaseNode(177 /* SyntaxKind.TypePredicate */); + var node = createBaseNode(179 /* SyntaxKind.TypePredicate */); node.assertsModifier = assertsModifier; node.parameterName = asName(parameterName); node.type = type; @@ -23817,7 +23780,7 @@ var ts; } // @api function createTypeReferenceNode(typeName, typeArguments) { - var node = createBaseNode(178 /* SyntaxKind.TypeReference */); + var node = createBaseNode(180 /* SyntaxKind.TypeReference */); node.typeName = asName(typeName); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(createNodeArray(typeArguments)); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23832,7 +23795,7 @@ var ts; } // @api function createFunctionTypeNode(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(179 /* SyntaxKind.FunctionType */, + var node = createBaseSignatureDeclaration(181 /* SyntaxKind.FunctionType */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23865,7 +23828,7 @@ var ts; ts.Debug.fail("Incorrect number of arguments specified."); } function createConstructorTypeNode1(modifiers, typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(180 /* SyntaxKind.ConstructorType */, modifiers, + var node = createBaseSignatureDeclaration(182 /* SyntaxKind.ConstructorType */, modifiers, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23898,7 +23861,7 @@ var ts; } // @api function createTypeQueryNode(exprName, typeArguments) { - var node = createBaseNode(181 /* SyntaxKind.TypeQuery */); + var node = createBaseNode(183 /* SyntaxKind.TypeQuery */); node.exprName = exprName; node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23913,7 +23876,7 @@ var ts; } // @api function createTypeLiteralNode(members) { - var node = createBaseNode(182 /* SyntaxKind.TypeLiteral */); + var node = createBaseNode(184 /* SyntaxKind.TypeLiteral */); node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23926,7 +23889,7 @@ var ts; } // @api function createArrayTypeNode(elementType) { - var node = createBaseNode(183 /* SyntaxKind.ArrayType */); + var node = createBaseNode(185 /* SyntaxKind.ArrayType */); node.elementType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(elementType); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23939,7 +23902,7 @@ var ts; } // @api function createTupleTypeNode(elements) { - var node = createBaseNode(184 /* SyntaxKind.TupleType */); + var node = createBaseNode(186 /* SyntaxKind.TupleType */); node.elements = createNodeArray(parenthesizerRules().parenthesizeElementTypesOfTupleType(elements)); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23952,7 +23915,7 @@ var ts; } // @api function createNamedTupleMember(dotDotDotToken, name, questionToken, type) { - var node = createBaseNode(197 /* SyntaxKind.NamedTupleMember */); + var node = createBaseNode(199 /* SyntaxKind.NamedTupleMember */); node.dotDotDotToken = dotDotDotToken; node.name = name; node.questionToken = questionToken; @@ -23971,7 +23934,7 @@ var ts; } // @api function createOptionalTypeNode(type) { - var node = createBaseNode(185 /* SyntaxKind.OptionalType */); + var node = createBaseNode(187 /* SyntaxKind.OptionalType */); node.type = parenthesizerRules().parenthesizeTypeOfOptionalType(type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23984,7 +23947,7 @@ var ts; } // @api function createRestTypeNode(type) { - var node = createBaseNode(186 /* SyntaxKind.RestType */); + var node = createBaseNode(188 /* SyntaxKind.RestType */); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -24008,7 +23971,7 @@ var ts; } // @api function createUnionTypeNode(types) { - return createUnionOrIntersectionTypeNode(187 /* SyntaxKind.UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); + return createUnionOrIntersectionTypeNode(189 /* SyntaxKind.UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); } // @api function updateUnionTypeNode(node, types) { @@ -24016,7 +23979,7 @@ var ts; } // @api function createIntersectionTypeNode(types) { - return createUnionOrIntersectionTypeNode(188 /* SyntaxKind.IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); + return createUnionOrIntersectionTypeNode(190 /* SyntaxKind.IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); } // @api function updateIntersectionTypeNode(node, types) { @@ -24024,7 +23987,7 @@ var ts; } // @api function createConditionalTypeNode(checkType, extendsType, trueType, falseType) { - var node = createBaseNode(189 /* SyntaxKind.ConditionalType */); + var node = createBaseNode(191 /* SyntaxKind.ConditionalType */); node.checkType = parenthesizerRules().parenthesizeCheckTypeOfConditionalType(checkType); node.extendsType = parenthesizerRules().parenthesizeExtendsTypeOfConditionalType(extendsType); node.trueType = trueType; @@ -24043,7 +24006,7 @@ var ts; } // @api function createInferTypeNode(typeParameter) { - var node = createBaseNode(190 /* SyntaxKind.InferType */); + var node = createBaseNode(192 /* SyntaxKind.InferType */); node.typeParameter = typeParameter; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -24056,7 +24019,7 @@ var ts; } // @api function createTemplateLiteralType(head, templateSpans) { - var node = createBaseNode(198 /* SyntaxKind.TemplateLiteralType */); + var node = createBaseNode(200 /* SyntaxKind.TemplateLiteralType */); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -24072,7 +24035,7 @@ var ts; // @api function createImportTypeNode(argument, assertions, qualifier, typeArguments, isTypeOf) { if (isTypeOf === void 0) { isTypeOf = false; } - var node = createBaseNode(200 /* SyntaxKind.ImportType */); + var node = createBaseNode(202 /* SyntaxKind.ImportType */); node.argument = argument; node.assertions = assertions; node.qualifier = qualifier; @@ -24094,7 +24057,7 @@ var ts; } // @api function createParenthesizedType(type) { - var node = createBaseNode(191 /* SyntaxKind.ParenthesizedType */); + var node = createBaseNode(193 /* SyntaxKind.ParenthesizedType */); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -24107,15 +24070,15 @@ var ts; } // @api function createThisTypeNode() { - var node = createBaseNode(192 /* SyntaxKind.ThisType */); + var node = createBaseNode(194 /* SyntaxKind.ThisType */); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; } // @api function createTypeOperatorNode(operator, type) { - var node = createBaseNode(193 /* SyntaxKind.TypeOperator */); + var node = createBaseNode(195 /* SyntaxKind.TypeOperator */); node.operator = operator; - node.type = operator === 145 /* SyntaxKind.ReadonlyKeyword */ ? + node.type = operator === 146 /* SyntaxKind.ReadonlyKeyword */ ? parenthesizerRules().parenthesizeOperandOfReadonlyTypeOperator(type) : parenthesizerRules().parenthesizeOperandOfTypeOperator(type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -24129,7 +24092,7 @@ var ts; } // @api function createIndexedAccessTypeNode(objectType, indexType) { - var node = createBaseNode(194 /* SyntaxKind.IndexedAccessType */); + var node = createBaseNode(196 /* SyntaxKind.IndexedAccessType */); node.objectType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(objectType); node.indexType = indexType; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -24144,7 +24107,7 @@ var ts; } // @api function createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members) { - var node = createBaseNode(195 /* SyntaxKind.MappedType */); + var node = createBaseNode(197 /* SyntaxKind.MappedType */); node.readonlyToken = readonlyToken; node.typeParameter = typeParameter; node.nameType = nameType; @@ -24167,7 +24130,7 @@ var ts; } // @api function createLiteralTypeNode(literal) { - var node = createBaseNode(196 /* SyntaxKind.LiteralType */); + var node = createBaseNode(198 /* SyntaxKind.LiteralType */); node.literal = literal; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -24183,7 +24146,7 @@ var ts; // // @api function createObjectBindingPattern(elements) { - var node = createBaseNode(201 /* SyntaxKind.ObjectBindingPattern */); + var node = createBaseNode(203 /* SyntaxKind.ObjectBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | @@ -24204,7 +24167,7 @@ var ts; } // @api function createArrayBindingPattern(elements) { - var node = createBaseNode(202 /* SyntaxKind.ArrayBindingPattern */); + var node = createBaseNode(204 /* SyntaxKind.ArrayBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | @@ -24220,7 +24183,7 @@ var ts; } // @api function createBindingElement(dotDotDotToken, propertyName, name, initializer) { - var node = createBaseBindingLikeDeclaration(203 /* SyntaxKind.BindingElement */, + var node = createBaseBindingLikeDeclaration(205 /* SyntaxKind.BindingElement */, /*modifiers*/ undefined, name, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.propertyName = asName(propertyName); node.dotDotDotToken = dotDotDotToken; @@ -24255,7 +24218,7 @@ var ts; } // @api function createArrayLiteralExpression(elements, multiLine) { - var node = createBaseExpression(204 /* SyntaxKind.ArrayLiteralExpression */); + var node = createBaseExpression(206 /* SyntaxKind.ArrayLiteralExpression */); // Ensure we add a trailing comma for something like `[NumericLiteral(1), NumericLiteral(2), OmittedExpresion]` so that // we end up with `[1, 2, ,]` instead of `[1, 2, ]` otherwise the `OmittedExpression` will just end up being treated like // a trailing comma. @@ -24274,7 +24237,7 @@ var ts; } // @api function createObjectLiteralExpression(properties, multiLine) { - var node = createBaseExpression(205 /* SyntaxKind.ObjectLiteralExpression */); + var node = createBaseExpression(207 /* SyntaxKind.ObjectLiteralExpression */); node.properties = createNodeArray(properties); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.properties); @@ -24288,7 +24251,7 @@ var ts; } // @api function createPropertyAccessExpression(expression, name) { - var node = createBaseExpression(206 /* SyntaxKind.PropertyAccessExpression */); + var node = createBaseExpression(208 /* SyntaxKind.PropertyAccessExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.name = asName(name); node.transformFlags = @@ -24317,7 +24280,7 @@ var ts; } // @api function createPropertyAccessChain(expression, questionDotToken, name) { - var node = createBaseExpression(206 /* SyntaxKind.PropertyAccessExpression */); + var node = createBaseExpression(208 /* SyntaxKind.PropertyAccessExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24344,7 +24307,7 @@ var ts; } // @api function createElementAccessExpression(expression, index) { - var node = createBaseExpression(207 /* SyntaxKind.ElementAccessExpression */); + var node = createBaseExpression(209 /* SyntaxKind.ElementAccessExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.argumentExpression = asExpression(index); node.transformFlags |= @@ -24371,7 +24334,7 @@ var ts; } // @api function createElementAccessChain(expression, questionDotToken, index) { - var node = createBaseExpression(207 /* SyntaxKind.ElementAccessExpression */); + var node = createBaseExpression(209 /* SyntaxKind.ElementAccessExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24396,7 +24359,7 @@ var ts; } // @api function createCallExpression(expression, typeArguments, argumentsArray) { - var node = createBaseExpression(208 /* SyntaxKind.CallExpression */); + var node = createBaseExpression(210 /* SyntaxKind.CallExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.typeArguments = asNodeArray(typeArguments); node.arguments = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(createNodeArray(argumentsArray)); @@ -24428,7 +24391,7 @@ var ts; } // @api function createCallChain(expression, questionDotToken, typeArguments, argumentsArray) { - var node = createBaseExpression(208 /* SyntaxKind.CallExpression */); + var node = createBaseExpression(210 /* SyntaxKind.CallExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24460,7 +24423,7 @@ var ts; } // @api function createNewExpression(expression, typeArguments, argumentsArray) { - var node = createBaseExpression(209 /* SyntaxKind.NewExpression */); + var node = createBaseExpression(211 /* SyntaxKind.NewExpression */); node.expression = parenthesizerRules().parenthesizeExpressionOfNew(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = argumentsArray ? parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(argumentsArray) : undefined; @@ -24484,7 +24447,7 @@ var ts; } // @api function createTaggedTemplateExpression(tag, typeArguments, template) { - var node = createBaseExpression(210 /* SyntaxKind.TaggedTemplateExpression */); + var node = createBaseExpression(212 /* SyntaxKind.TaggedTemplateExpression */); node.tag = parenthesizerRules().parenthesizeLeftSideOfAccess(tag, /*optionalChain*/ false); node.typeArguments = asNodeArray(typeArguments); node.template = template; @@ -24511,7 +24474,7 @@ var ts; } // @api function createTypeAssertion(type, expression) { - var node = createBaseExpression(211 /* SyntaxKind.TypeAssertionExpression */); + var node = createBaseExpression(213 /* SyntaxKind.TypeAssertionExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.type = type; node.transformFlags |= @@ -24529,7 +24492,7 @@ var ts; } // @api function createParenthesizedExpression(expression) { - var node = createBaseExpression(212 /* SyntaxKind.ParenthesizedExpression */); + var node = createBaseExpression(214 /* SyntaxKind.ParenthesizedExpression */); node.expression = expression; node.transformFlags = propagateChildFlags(node.expression); return node; @@ -24542,13 +24505,13 @@ var ts; } // @api function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(213 /* SyntaxKind.FunctionExpression */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(215 /* SyntaxKind.FunctionExpression */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; node.transformFlags |= propagateChildFlags(node.asteriskToken); if (node.typeParameters) { node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; } - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (node.asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -24575,13 +24538,13 @@ var ts; } // @api function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { - var node = createBaseFunctionLikeDeclaration(214 /* SyntaxKind.ArrowFunction */, modifiers, + var node = createBaseFunctionLikeDeclaration(216 /* SyntaxKind.ArrowFunction */, modifiers, /*name*/ undefined, typeParameters, parameters, type, parenthesizerRules().parenthesizeConciseBodyOfArrowFunction(body)); node.equalsGreaterThanToken = equalsGreaterThanToken !== null && equalsGreaterThanToken !== void 0 ? equalsGreaterThanToken : createToken(38 /* SyntaxKind.EqualsGreaterThanToken */); node.transformFlags |= propagateChildFlags(node.equalsGreaterThanToken) | 1024 /* TransformFlags.ContainsES2015 */; - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { node.transformFlags |= 256 /* TransformFlags.ContainsES2017 */ | 16384 /* TransformFlags.ContainsLexicalThis */; } return node; @@ -24599,7 +24562,7 @@ var ts; } // @api function createDeleteExpression(expression) { - var node = createBaseExpression(215 /* SyntaxKind.DeleteExpression */); + var node = createBaseExpression(217 /* SyntaxKind.DeleteExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24612,7 +24575,7 @@ var ts; } // @api function createTypeOfExpression(expression) { - var node = createBaseExpression(216 /* SyntaxKind.TypeOfExpression */); + var node = createBaseExpression(218 /* SyntaxKind.TypeOfExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24625,7 +24588,7 @@ var ts; } // @api function createVoidExpression(expression) { - var node = createBaseExpression(217 /* SyntaxKind.VoidExpression */); + var node = createBaseExpression(219 /* SyntaxKind.VoidExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24638,7 +24601,7 @@ var ts; } // @api function createAwaitExpression(expression) { - var node = createBaseExpression(218 /* SyntaxKind.AwaitExpression */); + var node = createBaseExpression(220 /* SyntaxKind.AwaitExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24655,7 +24618,7 @@ var ts; } // @api function createPrefixUnaryExpression(operator, operand) { - var node = createBaseExpression(219 /* SyntaxKind.PrefixUnaryExpression */); + var node = createBaseExpression(221 /* SyntaxKind.PrefixUnaryExpression */); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPrefixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -24677,7 +24640,7 @@ var ts; } // @api function createPostfixUnaryExpression(operand, operator) { - var node = createBaseExpression(220 /* SyntaxKind.PostfixUnaryExpression */); + var node = createBaseExpression(222 /* SyntaxKind.PostfixUnaryExpression */); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPostfixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -24698,7 +24661,7 @@ var ts; } // @api function createBinaryExpression(left, operator, right) { - var node = createBaseExpression(221 /* SyntaxKind.BinaryExpression */); + var node = createBaseExpression(223 /* SyntaxKind.BinaryExpression */); var operatorToken = asToken(operator); var operatorKind = operatorToken.kind; node.left = parenthesizerRules().parenthesizeLeftSideOfBinary(operatorKind, left); @@ -24770,7 +24733,7 @@ var ts; } // @api function createConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse) { - var node = createBaseExpression(222 /* SyntaxKind.ConditionalExpression */); + var node = createBaseExpression(224 /* SyntaxKind.ConditionalExpression */); node.condition = parenthesizerRules().parenthesizeConditionOfConditionalExpression(condition); node.questionToken = questionToken !== null && questionToken !== void 0 ? questionToken : createToken(57 /* SyntaxKind.QuestionToken */); node.whenTrue = parenthesizerRules().parenthesizeBranchOfConditionalExpression(whenTrue); @@ -24796,7 +24759,7 @@ var ts; } // @api function createTemplateExpression(head, templateSpans) { - var node = createBaseExpression(223 /* SyntaxKind.TemplateExpression */); + var node = createBaseExpression(225 /* SyntaxKind.TemplateExpression */); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags |= @@ -24866,7 +24829,7 @@ var ts; // @api function createYieldExpression(asteriskToken, expression) { ts.Debug.assert(!asteriskToken || !!expression, "A `YieldExpression` with an asteriskToken must have an expression."); - var node = createBaseExpression(224 /* SyntaxKind.YieldExpression */); + var node = createBaseExpression(226 /* SyntaxKind.YieldExpression */); node.expression = expression && parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.asteriskToken = asteriskToken; node.transformFlags |= @@ -24886,7 +24849,7 @@ var ts; } // @api function createSpreadElement(expression) { - var node = createBaseExpression(225 /* SyntaxKind.SpreadElement */); + var node = createBaseExpression(227 /* SyntaxKind.SpreadElement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24902,7 +24865,7 @@ var ts; } // @api function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseClassLikeDeclaration(226 /* SyntaxKind.ClassExpression */, modifiers, name, typeParameters, heritageClauses, members); + var node = createBaseClassLikeDeclaration(228 /* SyntaxKind.ClassExpression */, modifiers, name, typeParameters, heritageClauses, members); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; return node; } @@ -24918,11 +24881,11 @@ var ts; } // @api function createOmittedExpression() { - return createBaseExpression(227 /* SyntaxKind.OmittedExpression */); + return createBaseExpression(229 /* SyntaxKind.OmittedExpression */); } // @api function createExpressionWithTypeArguments(expression, typeArguments) { - var node = createBaseNode(228 /* SyntaxKind.ExpressionWithTypeArguments */); + var node = createBaseNode(230 /* SyntaxKind.ExpressionWithTypeArguments */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags |= @@ -24940,7 +24903,7 @@ var ts; } // @api function createAsExpression(expression, type) { - var node = createBaseExpression(229 /* SyntaxKind.AsExpression */); + var node = createBaseExpression(231 /* SyntaxKind.AsExpression */); node.expression = expression; node.type = type; node.transformFlags |= @@ -24958,7 +24921,7 @@ var ts; } // @api function createNonNullExpression(expression) { - var node = createBaseExpression(230 /* SyntaxKind.NonNullExpression */); + var node = createBaseExpression(232 /* SyntaxKind.NonNullExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24975,8 +24938,26 @@ var ts; : node; } // @api + function createSatisfiesExpression(expression, type) { + var node = createBaseExpression(235 /* SyntaxKind.SatisfiesExpression */); + node.expression = expression; + node.type = type; + node.transformFlags |= + propagateChildFlags(node.expression) | + propagateChildFlags(node.type) | + 1 /* TransformFlags.ContainsTypeScript */; + return node; + } + // @api + function updateSatisfiesExpression(node, expression, type) { + return node.expression !== expression + || node.type !== type + ? update(createSatisfiesExpression(expression, type), node) + : node; + } + // @api function createNonNullChain(expression) { - var node = createBaseExpression(230 /* SyntaxKind.NonNullExpression */); + var node = createBaseExpression(232 /* SyntaxKind.NonNullExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.transformFlags |= @@ -24993,7 +24974,7 @@ var ts; } // @api function createMetaProperty(keywordToken, name) { - var node = createBaseExpression(231 /* SyntaxKind.MetaProperty */); + var node = createBaseExpression(233 /* SyntaxKind.MetaProperty */); node.keywordToken = keywordToken; node.name = name; node.transformFlags |= propagateChildFlags(node.name); @@ -25020,7 +25001,7 @@ var ts; // // @api function createTemplateSpan(expression, literal) { - var node = createBaseNode(233 /* SyntaxKind.TemplateSpan */); + var node = createBaseNode(236 /* SyntaxKind.TemplateSpan */); node.expression = expression; node.literal = literal; node.transformFlags |= @@ -25038,7 +25019,7 @@ var ts; } // @api function createSemicolonClassElement() { - var node = createBaseNode(234 /* SyntaxKind.SemicolonClassElement */); + var node = createBaseNode(237 /* SyntaxKind.SemicolonClassElement */); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; return node; } @@ -25047,7 +25028,7 @@ var ts; // // @api function createBlock(statements, multiLine) { - var node = createBaseNode(235 /* SyntaxKind.Block */); + var node = createBaseNode(238 /* SyntaxKind.Block */); node.statements = createNodeArray(statements); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.statements); @@ -25061,7 +25042,7 @@ var ts; } // @api function createVariableStatement(modifiers, declarationList) { - var node = createBaseDeclaration(237 /* SyntaxKind.VariableStatement */); + var node = createBaseDeclaration(240 /* SyntaxKind.VariableStatement */); node.modifiers = asNodeArray(modifiers); node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; node.transformFlags |= @@ -25081,11 +25062,11 @@ var ts; } // @api function createEmptyStatement() { - return createBaseNode(236 /* SyntaxKind.EmptyStatement */); + return createBaseNode(239 /* SyntaxKind.EmptyStatement */); } // @api function createExpressionStatement(expression) { - var node = createBaseNode(238 /* SyntaxKind.ExpressionStatement */); + var node = createBaseNode(241 /* SyntaxKind.ExpressionStatement */); node.expression = parenthesizerRules().parenthesizeExpressionOfExpressionStatement(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -25098,7 +25079,7 @@ var ts; } // @api function createIfStatement(expression, thenStatement, elseStatement) { - var node = createBaseNode(239 /* SyntaxKind.IfStatement */); + var node = createBaseNode(242 /* SyntaxKind.IfStatement */); node.expression = expression; node.thenStatement = asEmbeddedStatement(thenStatement); node.elseStatement = asEmbeddedStatement(elseStatement); @@ -25118,7 +25099,7 @@ var ts; } // @api function createDoStatement(statement, expression) { - var node = createBaseNode(240 /* SyntaxKind.DoStatement */); + var node = createBaseNode(243 /* SyntaxKind.DoStatement */); node.statement = asEmbeddedStatement(statement); node.expression = expression; node.transformFlags |= @@ -25135,7 +25116,7 @@ var ts; } // @api function createWhileStatement(expression, statement) { - var node = createBaseNode(241 /* SyntaxKind.WhileStatement */); + var node = createBaseNode(244 /* SyntaxKind.WhileStatement */); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -25152,7 +25133,7 @@ var ts; } // @api function createForStatement(initializer, condition, incrementor, statement) { - var node = createBaseNode(242 /* SyntaxKind.ForStatement */); + var node = createBaseNode(245 /* SyntaxKind.ForStatement */); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -25175,7 +25156,7 @@ var ts; } // @api function createForInStatement(initializer, expression, statement) { - var node = createBaseNode(243 /* SyntaxKind.ForInStatement */); + var node = createBaseNode(246 /* SyntaxKind.ForInStatement */); node.initializer = initializer; node.expression = expression; node.statement = asEmbeddedStatement(statement); @@ -25195,7 +25176,7 @@ var ts; } // @api function createForOfStatement(awaitModifier, initializer, expression, statement) { - var node = createBaseNode(244 /* SyntaxKind.ForOfStatement */); + var node = createBaseNode(247 /* SyntaxKind.ForOfStatement */); node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); @@ -25221,7 +25202,7 @@ var ts; } // @api function createContinueStatement(label) { - var node = createBaseNode(245 /* SyntaxKind.ContinueStatement */); + var node = createBaseNode(248 /* SyntaxKind.ContinueStatement */); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | @@ -25236,7 +25217,7 @@ var ts; } // @api function createBreakStatement(label) { - var node = createBaseNode(246 /* SyntaxKind.BreakStatement */); + var node = createBaseNode(249 /* SyntaxKind.BreakStatement */); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | @@ -25251,7 +25232,7 @@ var ts; } // @api function createReturnStatement(expression) { - var node = createBaseNode(247 /* SyntaxKind.ReturnStatement */); + var node = createBaseNode(250 /* SyntaxKind.ReturnStatement */); node.expression = expression; // return in an ES2018 async generator must be awaited node.transformFlags |= @@ -25268,7 +25249,7 @@ var ts; } // @api function createWithStatement(expression, statement) { - var node = createBaseNode(248 /* SyntaxKind.WithStatement */); + var node = createBaseNode(251 /* SyntaxKind.WithStatement */); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -25285,7 +25266,7 @@ var ts; } // @api function createSwitchStatement(expression, caseBlock) { - var node = createBaseNode(249 /* SyntaxKind.SwitchStatement */); + var node = createBaseNode(252 /* SyntaxKind.SwitchStatement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.caseBlock = caseBlock; node.transformFlags |= @@ -25302,7 +25283,7 @@ var ts; } // @api function createLabeledStatement(label, statement) { - var node = createBaseNode(250 /* SyntaxKind.LabeledStatement */); + var node = createBaseNode(253 /* SyntaxKind.LabeledStatement */); node.label = asName(label); node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -25319,7 +25300,7 @@ var ts; } // @api function createThrowStatement(expression) { - var node = createBaseNode(251 /* SyntaxKind.ThrowStatement */); + var node = createBaseNode(254 /* SyntaxKind.ThrowStatement */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -25332,7 +25313,7 @@ var ts; } // @api function createTryStatement(tryBlock, catchClause, finallyBlock) { - var node = createBaseNode(252 /* SyntaxKind.TryStatement */); + var node = createBaseNode(255 /* SyntaxKind.TryStatement */); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -25352,11 +25333,11 @@ var ts; } // @api function createDebuggerStatement() { - return createBaseNode(253 /* SyntaxKind.DebuggerStatement */); + return createBaseNode(256 /* SyntaxKind.DebuggerStatement */); } // @api function createVariableDeclaration(name, exclamationToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(254 /* SyntaxKind.VariableDeclaration */, + var node = createBaseVariableLikeDeclaration(257 /* SyntaxKind.VariableDeclaration */, /*modifiers*/ undefined, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.exclamationToken = exclamationToken; node.transformFlags |= propagateChildFlags(node.exclamationToken); @@ -25377,7 +25358,7 @@ var ts; // @api function createVariableDeclarationList(declarations, flags) { if (flags === void 0) { flags = 0 /* NodeFlags.None */; } - var node = createBaseNode(255 /* SyntaxKind.VariableDeclarationList */); + var node = createBaseNode(258 /* SyntaxKind.VariableDeclarationList */); node.flags |= flags & 3 /* NodeFlags.BlockScoped */; node.declarations = createNodeArray(declarations); node.transformFlags |= @@ -25398,7 +25379,7 @@ var ts; } // @api function createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(256 /* SyntaxKind.FunctionDeclaration */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(259 /* SyntaxKind.FunctionDeclaration */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; if (!node.body || ts.modifiersToFlags(node.modifiers) & 2 /* ModifierFlags.Ambient */) { node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -25407,7 +25388,7 @@ var ts; node.transformFlags |= propagateChildFlags(node.asteriskToken) | 4194304 /* TransformFlags.ContainsHoistedDeclarationOrCompletion */; - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (node.asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -25444,7 +25425,7 @@ var ts; } // @api function createClassDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseClassLikeDeclaration(257 /* SyntaxKind.ClassDeclaration */, modifiers, name, typeParameters, heritageClauses, members); + var node = createBaseClassLikeDeclaration(260 /* SyntaxKind.ClassDeclaration */, modifiers, name, typeParameters, heritageClauses, members); if (ts.modifiersToFlags(node.modifiers) & 2 /* ModifierFlags.Ambient */) { node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; } @@ -25468,7 +25449,7 @@ var ts; } // @api function createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseInterfaceOrClassLikeDeclaration(258 /* SyntaxKind.InterfaceDeclaration */, modifiers, name, typeParameters, heritageClauses); + var node = createBaseInterfaceOrClassLikeDeclaration(261 /* SyntaxKind.InterfaceDeclaration */, modifiers, name, typeParameters, heritageClauses); node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25493,7 +25474,7 @@ var ts; } // @api function createTypeAliasDeclaration(modifiers, name, typeParameters, type) { - var node = createBaseGenericNamedDeclaration(259 /* SyntaxKind.TypeAliasDeclaration */, modifiers, name, typeParameters); + var node = createBaseGenericNamedDeclaration(262 /* SyntaxKind.TypeAliasDeclaration */, modifiers, name, typeParameters); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25517,7 +25498,7 @@ var ts; } // @api function createEnumDeclaration(modifiers, name, members) { - var node = createBaseNamedDeclaration(260 /* SyntaxKind.EnumDeclaration */, modifiers, name); + var node = createBaseNamedDeclaration(263 /* SyntaxKind.EnumDeclaration */, modifiers, name); node.members = createNodeArray(members); node.transformFlags |= propagateChildrenFlags(node.members) | @@ -25544,7 +25525,7 @@ var ts; // @api function createModuleDeclaration(modifiers, name, body, flags) { if (flags === void 0) { flags = 0 /* NodeFlags.None */; } - var node = createBaseDeclaration(261 /* SyntaxKind.ModuleDeclaration */); + var node = createBaseDeclaration(264 /* SyntaxKind.ModuleDeclaration */); node.modifiers = asNodeArray(modifiers); node.flags |= flags & (16 /* NodeFlags.Namespace */ | 4 /* NodeFlags.NestedNamespace */ | 1024 /* NodeFlags.GlobalAugmentation */); node.name = name; @@ -25580,7 +25561,7 @@ var ts; } // @api function createModuleBlock(statements) { - var node = createBaseNode(262 /* SyntaxKind.ModuleBlock */); + var node = createBaseNode(265 /* SyntaxKind.ModuleBlock */); node.statements = createNodeArray(statements); node.transformFlags |= propagateChildrenFlags(node.statements); return node; @@ -25593,7 +25574,7 @@ var ts; } // @api function createCaseBlock(clauses) { - var node = createBaseNode(263 /* SyntaxKind.CaseBlock */); + var node = createBaseNode(266 /* SyntaxKind.CaseBlock */); node.clauses = createNodeArray(clauses); node.transformFlags |= propagateChildrenFlags(node.clauses); return node; @@ -25606,7 +25587,7 @@ var ts; } // @api function createNamespaceExportDeclaration(name) { - var node = createBaseNamedDeclaration(264 /* SyntaxKind.NamespaceExportDeclaration */, + var node = createBaseNamedDeclaration(267 /* SyntaxKind.NamespaceExportDeclaration */, /*modifiers*/ undefined, name); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25629,7 +25610,7 @@ var ts; } // @api function createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference) { - var node = createBaseNamedDeclaration(265 /* SyntaxKind.ImportEqualsDeclaration */, modifiers, name); + var node = createBaseNamedDeclaration(268 /* SyntaxKind.ImportEqualsDeclaration */, modifiers, name); node.isTypeOnly = isTypeOnly; node.moduleReference = moduleReference; node.transformFlags |= propagateChildFlags(node.moduleReference); @@ -25657,7 +25638,7 @@ var ts; } // @api function createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause) { - var node = createBaseDeclaration(266 /* SyntaxKind.ImportDeclaration */); + var node = createBaseDeclaration(269 /* SyntaxKind.ImportDeclaration */); node.modifiers = asNodeArray(modifiers); node.importClause = importClause; node.moduleSpecifier = moduleSpecifier; @@ -25687,7 +25668,7 @@ var ts; } // @api function createImportClause(isTypeOnly, name, namedBindings) { - var node = createBaseNode(267 /* SyntaxKind.ImportClause */); + var node = createBaseNode(270 /* SyntaxKind.ImportClause */); node.isTypeOnly = isTypeOnly; node.name = name; node.namedBindings = namedBindings; @@ -25710,7 +25691,7 @@ var ts; } // @api function createAssertClause(elements, multiLine) { - var node = createBaseNode(293 /* SyntaxKind.AssertClause */); + var node = createBaseNode(296 /* SyntaxKind.AssertClause */); node.elements = createNodeArray(elements); node.multiLine = multiLine; node.transformFlags |= 4 /* TransformFlags.ContainsESNext */; @@ -25725,7 +25706,7 @@ var ts; } // @api function createAssertEntry(name, value) { - var node = createBaseNode(294 /* SyntaxKind.AssertEntry */); + var node = createBaseNode(297 /* SyntaxKind.AssertEntry */); node.name = name; node.value = value; node.transformFlags |= 4 /* TransformFlags.ContainsESNext */; @@ -25740,7 +25721,7 @@ var ts; } // @api function createImportTypeAssertionContainer(clause, multiLine) { - var node = createBaseNode(295 /* SyntaxKind.ImportTypeAssertionContainer */); + var node = createBaseNode(298 /* SyntaxKind.ImportTypeAssertionContainer */); node.assertClause = clause; node.multiLine = multiLine; return node; @@ -25754,7 +25735,7 @@ var ts; } // @api function createNamespaceImport(name) { - var node = createBaseNode(268 /* SyntaxKind.NamespaceImport */); + var node = createBaseNode(271 /* SyntaxKind.NamespaceImport */); node.name = name; node.transformFlags |= propagateChildFlags(node.name); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25768,7 +25749,7 @@ var ts; } // @api function createNamespaceExport(name) { - var node = createBaseNode(274 /* SyntaxKind.NamespaceExport */); + var node = createBaseNode(277 /* SyntaxKind.NamespaceExport */); node.name = name; node.transformFlags |= propagateChildFlags(node.name) | @@ -25784,7 +25765,7 @@ var ts; } // @api function createNamedImports(elements) { - var node = createBaseNode(269 /* SyntaxKind.NamedImports */); + var node = createBaseNode(272 /* SyntaxKind.NamedImports */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25798,7 +25779,7 @@ var ts; } // @api function createImportSpecifier(isTypeOnly, propertyName, name) { - var node = createBaseNode(270 /* SyntaxKind.ImportSpecifier */); + var node = createBaseNode(273 /* SyntaxKind.ImportSpecifier */); node.isTypeOnly = isTypeOnly; node.propertyName = propertyName; node.name = name; @@ -25818,7 +25799,7 @@ var ts; } // @api function createExportAssignment(modifiers, isExportEquals, expression) { - var node = createBaseDeclaration(271 /* SyntaxKind.ExportAssignment */); + var node = createBaseDeclaration(274 /* SyntaxKind.ExportAssignment */); node.modifiers = asNodeArray(modifiers); node.isExportEquals = isExportEquals; node.expression = isExportEquals @@ -25845,7 +25826,7 @@ var ts; } // @api function createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause) { - var node = createBaseDeclaration(272 /* SyntaxKind.ExportDeclaration */); + var node = createBaseDeclaration(275 /* SyntaxKind.ExportDeclaration */); node.modifiers = asNodeArray(modifiers); node.isTypeOnly = isTypeOnly; node.exportClause = exportClause; @@ -25878,7 +25859,7 @@ var ts; } // @api function createNamedExports(elements) { - var node = createBaseNode(273 /* SyntaxKind.NamedExports */); + var node = createBaseNode(276 /* SyntaxKind.NamedExports */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25892,7 +25873,7 @@ var ts; } // @api function createExportSpecifier(isTypeOnly, propertyName, name) { - var node = createBaseNode(275 /* SyntaxKind.ExportSpecifier */); + var node = createBaseNode(278 /* SyntaxKind.ExportSpecifier */); node.isTypeOnly = isTypeOnly; node.propertyName = asName(propertyName); node.name = asName(name); @@ -25912,7 +25893,7 @@ var ts; } // @api function createMissingDeclaration() { - var node = createBaseDeclaration(276 /* SyntaxKind.MissingDeclaration */); + var node = createBaseDeclaration(279 /* SyntaxKind.MissingDeclaration */); return node; } // @@ -25920,7 +25901,7 @@ var ts; // // @api function createExternalModuleReference(expression) { - var node = createBaseNode(277 /* SyntaxKind.ExternalModuleReference */); + var node = createBaseNode(280 /* SyntaxKind.ExternalModuleReference */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25978,7 +25959,7 @@ var ts; } // @api function createJSDocFunctionType(parameters, type) { - var node = createBaseSignatureDeclaration(317 /* SyntaxKind.JSDocFunctionType */, + var node = createBaseSignatureDeclaration(320 /* SyntaxKind.JSDocFunctionType */, /*modifiers*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined, parameters, type); @@ -25994,7 +25975,7 @@ var ts; // @api function createJSDocTypeLiteral(propertyTags, isArrayType) { if (isArrayType === void 0) { isArrayType = false; } - var node = createBaseNode(322 /* SyntaxKind.JSDocTypeLiteral */); + var node = createBaseNode(325 /* SyntaxKind.JSDocTypeLiteral */); node.jsDocPropertyTags = asNodeArray(propertyTags); node.isArrayType = isArrayType; return node; @@ -26008,7 +25989,7 @@ var ts; } // @api function createJSDocTypeExpression(type) { - var node = createBaseNode(309 /* SyntaxKind.JSDocTypeExpression */); + var node = createBaseNode(312 /* SyntaxKind.JSDocTypeExpression */); node.type = type; return node; } @@ -26020,7 +26001,7 @@ var ts; } // @api function createJSDocSignature(typeParameters, parameters, type) { - var node = createBaseNode(323 /* SyntaxKind.JSDocSignature */); + var node = createBaseNode(326 /* SyntaxKind.JSDocSignature */); node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; @@ -26049,7 +26030,7 @@ var ts; } // @api function createJSDocTemplateTag(tagName, constraint, typeParameters, comment) { - var node = createBaseJSDocTag(344 /* SyntaxKind.JSDocTemplateTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); + var node = createBaseJSDocTag(347 /* SyntaxKind.JSDocTemplateTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); node.constraint = constraint; node.typeParameters = createNodeArray(typeParameters); return node; @@ -26066,7 +26047,7 @@ var ts; } // @api function createJSDocTypedefTag(tagName, typeExpression, fullName, comment) { - var node = createBaseJSDocTag(345 /* SyntaxKind.JSDocTypedefTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); + var node = createBaseJSDocTag(348 /* SyntaxKind.JSDocTypedefTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = ts.getJSDocTypeAliasName(fullName); @@ -26084,7 +26065,7 @@ var ts; } // @api function createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - var node = createBaseJSDocTag(340 /* SyntaxKind.JSDocParameterTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); + var node = createBaseJSDocTag(343 /* SyntaxKind.JSDocParameterTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -26105,7 +26086,7 @@ var ts; } // @api function createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - var node = createBaseJSDocTag(347 /* SyntaxKind.JSDocPropertyTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); + var node = createBaseJSDocTag(350 /* SyntaxKind.JSDocPropertyTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -26126,7 +26107,7 @@ var ts; } // @api function createJSDocCallbackTag(tagName, typeExpression, fullName, comment) { - var node = createBaseJSDocTag(338 /* SyntaxKind.JSDocCallbackTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); + var node = createBaseJSDocTag(341 /* SyntaxKind.JSDocCallbackTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = ts.getJSDocTypeAliasName(fullName); @@ -26144,7 +26125,7 @@ var ts; } // @api function createJSDocAugmentsTag(tagName, className, comment) { - var node = createBaseJSDocTag(328 /* SyntaxKind.JSDocAugmentsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); + var node = createBaseJSDocTag(331 /* SyntaxKind.JSDocAugmentsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); node.class = className; return node; } @@ -26159,13 +26140,13 @@ var ts; } // @api function createJSDocImplementsTag(tagName, className, comment) { - var node = createBaseJSDocTag(329 /* SyntaxKind.JSDocImplementsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); + var node = createBaseJSDocTag(332 /* SyntaxKind.JSDocImplementsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); node.class = className; return node; } // @api function createJSDocSeeTag(tagName, name, comment) { - var node = createBaseJSDocTag(346 /* SyntaxKind.JSDocSeeTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); + var node = createBaseJSDocTag(349 /* SyntaxKind.JSDocSeeTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); node.name = name; return node; } @@ -26179,7 +26160,7 @@ var ts; } // @api function createJSDocNameReference(name) { - var node = createBaseNode(310 /* SyntaxKind.JSDocNameReference */); + var node = createBaseNode(313 /* SyntaxKind.JSDocNameReference */); node.name = name; return node; } @@ -26191,7 +26172,7 @@ var ts; } // @api function createJSDocMemberName(left, right) { - var node = createBaseNode(311 /* SyntaxKind.JSDocMemberName */); + var node = createBaseNode(314 /* SyntaxKind.JSDocMemberName */); node.left = left; node.right = right; node.transformFlags |= @@ -26208,7 +26189,7 @@ var ts; } // @api function createJSDocLink(name, text) { - var node = createBaseNode(324 /* SyntaxKind.JSDocLink */); + var node = createBaseNode(327 /* SyntaxKind.JSDocLink */); node.name = name; node.text = text; return node; @@ -26221,7 +26202,7 @@ var ts; } // @api function createJSDocLinkCode(name, text) { - var node = createBaseNode(325 /* SyntaxKind.JSDocLinkCode */); + var node = createBaseNode(328 /* SyntaxKind.JSDocLinkCode */); node.name = name; node.text = text; return node; @@ -26234,7 +26215,7 @@ var ts; } // @api function createJSDocLinkPlain(name, text) { - var node = createBaseNode(326 /* SyntaxKind.JSDocLinkPlain */); + var node = createBaseNode(329 /* SyntaxKind.JSDocLinkPlain */); node.name = name; node.text = text; return node; @@ -26306,7 +26287,7 @@ var ts; } // @api function createJSDocUnknownTag(tagName, comment) { - var node = createBaseJSDocTag(327 /* SyntaxKind.JSDocTag */, tagName, comment); + var node = createBaseJSDocTag(330 /* SyntaxKind.JSDocTag */, tagName, comment); return node; } // @api @@ -26318,7 +26299,7 @@ var ts; } // @api function createJSDocText(text) { - var node = createBaseNode(321 /* SyntaxKind.JSDocText */); + var node = createBaseNode(324 /* SyntaxKind.JSDocText */); node.text = text; return node; } @@ -26330,7 +26311,7 @@ var ts; } // @api function createJSDocComment(comment, tags) { - var node = createBaseNode(320 /* SyntaxKind.JSDoc */); + var node = createBaseNode(323 /* SyntaxKind.JSDoc */); node.comment = comment; node.tags = asNodeArray(tags); return node; @@ -26347,7 +26328,7 @@ var ts; // // @api function createJsxElement(openingElement, children, closingElement) { - var node = createBaseNode(278 /* SyntaxKind.JsxElement */); + var node = createBaseNode(281 /* SyntaxKind.JsxElement */); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -26368,7 +26349,7 @@ var ts; } // @api function createJsxSelfClosingElement(tagName, typeArguments, attributes) { - var node = createBaseNode(279 /* SyntaxKind.JsxSelfClosingElement */); + var node = createBaseNode(282 /* SyntaxKind.JsxSelfClosingElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -26392,7 +26373,7 @@ var ts; } // @api function createJsxOpeningElement(tagName, typeArguments, attributes) { - var node = createBaseNode(280 /* SyntaxKind.JsxOpeningElement */); + var node = createBaseNode(283 /* SyntaxKind.JsxOpeningElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -26416,7 +26397,7 @@ var ts; } // @api function createJsxClosingElement(tagName) { - var node = createBaseNode(281 /* SyntaxKind.JsxClosingElement */); + var node = createBaseNode(284 /* SyntaxKind.JsxClosingElement */); node.tagName = tagName; node.transformFlags |= propagateChildFlags(node.tagName) | @@ -26431,7 +26412,7 @@ var ts; } // @api function createJsxFragment(openingFragment, children, closingFragment) { - var node = createBaseNode(282 /* SyntaxKind.JsxFragment */); + var node = createBaseNode(285 /* SyntaxKind.JsxFragment */); node.openingFragment = openingFragment; node.children = createNodeArray(children); node.closingFragment = closingFragment; @@ -26467,19 +26448,19 @@ var ts; } // @api function createJsxOpeningFragment() { - var node = createBaseNode(283 /* SyntaxKind.JsxOpeningFragment */); + var node = createBaseNode(286 /* SyntaxKind.JsxOpeningFragment */); node.transformFlags |= 2 /* TransformFlags.ContainsJsx */; return node; } // @api function createJsxJsxClosingFragment() { - var node = createBaseNode(284 /* SyntaxKind.JsxClosingFragment */); + var node = createBaseNode(287 /* SyntaxKind.JsxClosingFragment */); node.transformFlags |= 2 /* TransformFlags.ContainsJsx */; return node; } // @api function createJsxAttribute(name, initializer) { - var node = createBaseNode(285 /* SyntaxKind.JsxAttribute */); + var node = createBaseNode(288 /* SyntaxKind.JsxAttribute */); node.name = name; node.initializer = initializer; node.transformFlags |= @@ -26497,7 +26478,7 @@ var ts; } // @api function createJsxAttributes(properties) { - var node = createBaseNode(286 /* SyntaxKind.JsxAttributes */); + var node = createBaseNode(289 /* SyntaxKind.JsxAttributes */); node.properties = createNodeArray(properties); node.transformFlags |= propagateChildrenFlags(node.properties) | @@ -26512,7 +26493,7 @@ var ts; } // @api function createJsxSpreadAttribute(expression) { - var node = createBaseNode(287 /* SyntaxKind.JsxSpreadAttribute */); + var node = createBaseNode(290 /* SyntaxKind.JsxSpreadAttribute */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression) | @@ -26527,7 +26508,7 @@ var ts; } // @api function createJsxExpression(dotDotDotToken, expression) { - var node = createBaseNode(288 /* SyntaxKind.JsxExpression */); + var node = createBaseNode(291 /* SyntaxKind.JsxExpression */); node.dotDotDotToken = dotDotDotToken; node.expression = expression; node.transformFlags |= @@ -26547,7 +26528,7 @@ var ts; // // @api function createCaseClause(expression, statements) { - var node = createBaseNode(289 /* SyntaxKind.CaseClause */); + var node = createBaseNode(292 /* SyntaxKind.CaseClause */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.statements = createNodeArray(statements); node.transformFlags |= @@ -26564,7 +26545,7 @@ var ts; } // @api function createDefaultClause(statements) { - var node = createBaseNode(290 /* SyntaxKind.DefaultClause */); + var node = createBaseNode(293 /* SyntaxKind.DefaultClause */); node.statements = createNodeArray(statements); node.transformFlags = propagateChildrenFlags(node.statements); return node; @@ -26577,7 +26558,7 @@ var ts; } // @api function createHeritageClause(token, types) { - var node = createBaseNode(291 /* SyntaxKind.HeritageClause */); + var node = createBaseNode(294 /* SyntaxKind.HeritageClause */); node.token = token; node.types = createNodeArray(types); node.transformFlags |= propagateChildrenFlags(node.types); @@ -26601,7 +26582,7 @@ var ts; } // @api function createCatchClause(variableDeclaration, block) { - var node = createBaseNode(292 /* SyntaxKind.CatchClause */); + var node = createBaseNode(295 /* SyntaxKind.CatchClause */); if (typeof variableDeclaration === "string" || variableDeclaration && !ts.isVariableDeclaration(variableDeclaration)) { variableDeclaration = createVariableDeclaration(variableDeclaration, /*exclamationToken*/ undefined, @@ -26629,7 +26610,7 @@ var ts; // // @api function createPropertyAssignment(name, initializer) { - var node = createBaseNamedDeclaration(296 /* SyntaxKind.PropertyAssignment */, + var node = createBaseNamedDeclaration(299 /* SyntaxKind.PropertyAssignment */, /*modifiers*/ undefined, name); node.initializer = parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= @@ -26661,7 +26642,7 @@ var ts; } // @api function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - var node = createBaseNamedDeclaration(297 /* SyntaxKind.ShorthandPropertyAssignment */, + var node = createBaseNamedDeclaration(300 /* SyntaxKind.ShorthandPropertyAssignment */, /*modifiers*/ undefined, name); node.objectAssignmentInitializer = objectAssignmentInitializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(objectAssignmentInitializer); node.transformFlags |= @@ -26695,7 +26676,7 @@ var ts; } // @api function createSpreadAssignment(expression) { - var node = createBaseNode(298 /* SyntaxKind.SpreadAssignment */); + var node = createBaseNode(301 /* SyntaxKind.SpreadAssignment */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -26714,7 +26695,7 @@ var ts; // // @api function createEnumMember(name, initializer) { - var node = createBaseNode(299 /* SyntaxKind.EnumMember */); + var node = createBaseNode(302 /* SyntaxKind.EnumMember */); node.name = asName(name); node.initializer = initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= @@ -26735,7 +26716,7 @@ var ts; // // @api function createSourceFile(statements, endOfFileToken, flags) { - var node = baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */); + var node = baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */); node.statements = createNodeArray(statements); node.endOfFileToken = endOfFileToken; node.flags |= flags; @@ -26752,7 +26733,7 @@ var ts; return node; } function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) { - var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */)); + var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */)); for (var p in source) { if (p === "emitNode" || ts.hasProperty(node, p) || !ts.hasProperty(source, p)) continue; @@ -26791,7 +26772,7 @@ var ts; // @api function createBundle(sourceFiles, prepends) { if (prepends === void 0) { prepends = ts.emptyArray; } - var node = createBaseNode(306 /* SyntaxKind.Bundle */); + var node = createBaseNode(309 /* SyntaxKind.Bundle */); node.prepends = prepends; node.sourceFiles = sourceFiles; return node; @@ -26806,7 +26787,7 @@ var ts; } // @api function createUnparsedSource(prologues, syntheticReferences, texts) { - var node = createBaseNode(307 /* SyntaxKind.UnparsedSource */); + var node = createBaseNode(310 /* SyntaxKind.UnparsedSource */); node.prologues = prologues; node.syntheticReferences = syntheticReferences; node.texts = texts; @@ -26824,28 +26805,28 @@ var ts; } // @api function createUnparsedPrologue(data) { - return createBaseUnparsedNode(300 /* SyntaxKind.UnparsedPrologue */, data); + return createBaseUnparsedNode(303 /* SyntaxKind.UnparsedPrologue */, data); } // @api function createUnparsedPrepend(data, texts) { - var node = createBaseUnparsedNode(301 /* SyntaxKind.UnparsedPrepend */, data); + var node = createBaseUnparsedNode(304 /* SyntaxKind.UnparsedPrepend */, data); node.texts = texts; return node; } // @api function createUnparsedTextLike(data, internal) { - return createBaseUnparsedNode(internal ? 303 /* SyntaxKind.UnparsedInternalText */ : 302 /* SyntaxKind.UnparsedText */, data); + return createBaseUnparsedNode(internal ? 306 /* SyntaxKind.UnparsedInternalText */ : 305 /* SyntaxKind.UnparsedText */, data); } // @api function createUnparsedSyntheticReference(section) { - var node = createBaseNode(304 /* SyntaxKind.UnparsedSyntheticReference */); + var node = createBaseNode(307 /* SyntaxKind.UnparsedSyntheticReference */); node.data = section.data; node.section = section; return node; } // @api function createInputFiles() { - var node = createBaseNode(308 /* SyntaxKind.InputFiles */); + var node = createBaseNode(311 /* SyntaxKind.InputFiles */); node.javascriptText = ""; node.declarationText = ""; return node; @@ -26856,7 +26837,7 @@ var ts; // @api function createSyntheticExpression(type, isSpread, tupleNameSource) { if (isSpread === void 0) { isSpread = false; } - var node = createBaseNode(232 /* SyntaxKind.SyntheticExpression */); + var node = createBaseNode(234 /* SyntaxKind.SyntheticExpression */); node.type = type; node.isSpread = isSpread; node.tupleNameSource = tupleNameSource; @@ -26864,7 +26845,7 @@ var ts; } // @api function createSyntaxList(children) { - var node = createBaseNode(348 /* SyntaxKind.SyntaxList */); + var node = createBaseNode(351 /* SyntaxKind.SyntaxList */); node._children = children; return node; } @@ -26879,7 +26860,7 @@ var ts; */ // @api function createNotEmittedStatement(original) { - var node = createBaseNode(349 /* SyntaxKind.NotEmittedStatement */); + var node = createBaseNode(352 /* SyntaxKind.NotEmittedStatement */); node.original = original; ts.setTextRange(node, original); return node; @@ -26893,7 +26874,7 @@ var ts; */ // @api function createPartiallyEmittedExpression(expression, original) { - var node = createBaseNode(350 /* SyntaxKind.PartiallyEmittedExpression */); + var node = createBaseNode(353 /* SyntaxKind.PartiallyEmittedExpression */); node.expression = expression; node.original = original; node.transformFlags |= @@ -26921,7 +26902,7 @@ var ts; } // @api function createCommaListExpression(elements) { - var node = createBaseNode(351 /* SyntaxKind.CommaListExpression */); + var node = createBaseNode(354 /* SyntaxKind.CommaListExpression */); node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)); node.transformFlags |= propagateChildrenFlags(node.elements); return node; @@ -26938,7 +26919,7 @@ var ts; */ // @api function createEndOfDeclarationMarker(original) { - var node = createBaseNode(353 /* SyntaxKind.EndOfDeclarationMarker */); + var node = createBaseNode(356 /* SyntaxKind.EndOfDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -26949,14 +26930,14 @@ var ts; */ // @api function createMergeDeclarationMarker(original) { - var node = createBaseNode(352 /* SyntaxKind.MergeDeclarationMarker */); + var node = createBaseNode(355 /* SyntaxKind.MergeDeclarationMarker */); node.emitNode = {}; node.original = original; return node; } // @api function createSyntheticReferenceExpression(expression, thisArg) { - var node = createBaseNode(354 /* SyntaxKind.SyntheticReferenceExpression */); + var node = createBaseNode(357 /* SyntaxKind.SyntheticReferenceExpression */); node.expression = expression; node.thisArg = thisArg; node.transformFlags |= @@ -26978,7 +26959,7 @@ var ts; if (node === undefined) { return node; } - var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */) : + var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */) : ts.isIdentifier(node) ? baseFactory.createBaseIdentifierNode(79 /* SyntaxKind.Identifier */) : ts.isPrivateIdentifier(node) ? baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */) : !ts.isNodeKind(node.kind) ? baseFactory.createBaseTokenNode(node.kind) : @@ -26987,7 +26968,7 @@ var ts; clone.transformFlags = node.transformFlags; setOriginalNode(clone, node); for (var key in node) { - if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { + if (ts.hasProperty(clone, key) || !ts.hasProperty(node, key)) { continue; } clone[key] = node[key]; @@ -27095,11 +27076,12 @@ var ts; } function updateOuterExpression(outerExpression, expression) { switch (outerExpression.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: return updateParenthesizedExpression(outerExpression, expression); - case 211 /* SyntaxKind.TypeAssertionExpression */: return updateTypeAssertion(outerExpression, outerExpression.type, expression); - case 229 /* SyntaxKind.AsExpression */: return updateAsExpression(outerExpression, expression, outerExpression.type); - case 230 /* SyntaxKind.NonNullExpression */: return updateNonNullExpression(outerExpression, expression); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: return updatePartiallyEmittedExpression(outerExpression, expression); + case 214 /* SyntaxKind.ParenthesizedExpression */: return updateParenthesizedExpression(outerExpression, expression); + case 213 /* SyntaxKind.TypeAssertionExpression */: return updateTypeAssertion(outerExpression, outerExpression.type, expression); + case 231 /* SyntaxKind.AsExpression */: return updateAsExpression(outerExpression, expression, outerExpression.type); + case 235 /* SyntaxKind.SatisfiesExpression */: return updateSatisfiesExpression(outerExpression, expression, outerExpression.type); + case 232 /* SyntaxKind.NonNullExpression */: return updateNonNullExpression(outerExpression, expression); + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return updatePartiallyEmittedExpression(outerExpression, expression); } } /** @@ -27153,13 +27135,13 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: return false; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return target.properties.length > 0; default: return true; @@ -27585,24 +27567,24 @@ var ts; } function getDefaultTagNameForKind(kind) { switch (kind) { - case 343 /* SyntaxKind.JSDocTypeTag */: return "type"; - case 341 /* SyntaxKind.JSDocReturnTag */: return "returns"; - case 342 /* SyntaxKind.JSDocThisTag */: return "this"; - case 339 /* SyntaxKind.JSDocEnumTag */: return "enum"; - case 330 /* SyntaxKind.JSDocAuthorTag */: return "author"; - case 332 /* SyntaxKind.JSDocClassTag */: return "class"; - case 333 /* SyntaxKind.JSDocPublicTag */: return "public"; - case 334 /* SyntaxKind.JSDocPrivateTag */: return "private"; - case 335 /* SyntaxKind.JSDocProtectedTag */: return "protected"; - case 336 /* SyntaxKind.JSDocReadonlyTag */: return "readonly"; - case 337 /* SyntaxKind.JSDocOverrideTag */: return "override"; - case 344 /* SyntaxKind.JSDocTemplateTag */: return "template"; - case 345 /* SyntaxKind.JSDocTypedefTag */: return "typedef"; - case 340 /* SyntaxKind.JSDocParameterTag */: return "param"; - case 347 /* SyntaxKind.JSDocPropertyTag */: return "prop"; - case 338 /* SyntaxKind.JSDocCallbackTag */: return "callback"; - case 328 /* SyntaxKind.JSDocAugmentsTag */: return "augments"; - case 329 /* SyntaxKind.JSDocImplementsTag */: return "implements"; + case 346 /* SyntaxKind.JSDocTypeTag */: return "type"; + case 344 /* SyntaxKind.JSDocReturnTag */: return "returns"; + case 345 /* SyntaxKind.JSDocThisTag */: return "this"; + case 342 /* SyntaxKind.JSDocEnumTag */: return "enum"; + case 333 /* SyntaxKind.JSDocAuthorTag */: return "author"; + case 335 /* SyntaxKind.JSDocClassTag */: return "class"; + case 336 /* SyntaxKind.JSDocPublicTag */: return "public"; + case 337 /* SyntaxKind.JSDocPrivateTag */: return "private"; + case 338 /* SyntaxKind.JSDocProtectedTag */: return "protected"; + case 339 /* SyntaxKind.JSDocReadonlyTag */: return "readonly"; + case 340 /* SyntaxKind.JSDocOverrideTag */: return "override"; + case 347 /* SyntaxKind.JSDocTemplateTag */: return "template"; + case 348 /* SyntaxKind.JSDocTypedefTag */: return "typedef"; + case 343 /* SyntaxKind.JSDocParameterTag */: return "param"; + case 350 /* SyntaxKind.JSDocPropertyTag */: return "prop"; + case 341 /* SyntaxKind.JSDocCallbackTag */: return "callback"; + case 331 /* SyntaxKind.JSDocAugmentsTag */: return "augments"; + case 332 /* SyntaxKind.JSDocImplementsTag */: return "implements"; default: return ts.Debug.fail("Unsupported kind: ".concat(ts.Debug.formatSyntaxKind(kind))); } @@ -27682,69 +27664,70 @@ var ts; */ /* @internal */ function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 177 /* SyntaxKind.FirstTypeNode */ && kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (kind >= 179 /* SyntaxKind.FirstTypeNode */ && kind <= 202 /* SyntaxKind.LastTypeNode */) { return -2 /* TransformFlags.TypeExcludes */; } switch (kind) { - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return -2147450880 /* TransformFlags.ArrayLiteralOrCallOrNewExcludes */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return -1941676032 /* TransformFlags.ModuleExcludes */; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return -2147483648 /* TransformFlags.ParameterExcludes */; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return -2072174592 /* TransformFlags.ArrowFunctionExcludes */; - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return -1937940480 /* TransformFlags.FunctionExcludes */; - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return -2146893824 /* TransformFlags.VariableDeclarationListExcludes */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return -2147344384 /* TransformFlags.ClassExcludes */; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return -1937948672 /* TransformFlags.ConstructorExcludes */; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return -2013249536 /* TransformFlags.PropertyExcludes */; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return -2005057536 /* TransformFlags.MethodOrAccessorExcludes */; - case 130 /* SyntaxKind.AnyKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 163 /* SyntaxKind.TypeParameter */: - case 166 /* SyntaxKind.PropertySignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: + case 168 /* SyntaxKind.PropertySignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return -2 /* TransformFlags.TypeExcludes */; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return -2147278848 /* TransformFlags.ObjectLiteralExcludes */; - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return -2147418112 /* TransformFlags.CatchClauseExcludes */; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return -2147450880 /* TransformFlags.BindingPatternExcludes */; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: case 106 /* SyntaxKind.SuperKeyword */: return -2147483648 /* TransformFlags.OuterExpressionExcludes */; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return -2147483648 /* TransformFlags.PropertyAccessExcludes */; default: return -2147483648 /* TransformFlags.NodeExcludes */; @@ -27944,9 +27927,10 @@ var ts; }; var buildInfo_1; var getAndCacheBuildInfo_1 = function (getText) { + var _a; if (buildInfo_1 === undefined) { var result = getText(); - buildInfo_1 = result !== undefined ? ts.getBuildInfo(result) : false; + buildInfo_1 = result !== undefined ? (_a = ts.getBuildInfo(node.buildInfoPath, result)) !== null && _a !== void 0 ? _a : false : false; } return buildInfo_1 || undefined; }; @@ -28000,7 +27984,7 @@ var ts; } ts.setOriginalNode = setOriginalNode; function mergeEmitNode(sourceEmitNode, destEmitNode) { - var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine; + var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine, snippetElement = sourceEmitNode.snippetElement; if (!destEmitNode) destEmitNode = {}; // We are using `.slice()` here in case `destEmitNode.leadingComments` is pushed to later. @@ -28026,6 +28010,8 @@ var ts; } if (startsOnNewLine !== undefined) destEmitNode.startsOnNewLine = startsOnNewLine; + if (snippetElement !== undefined) + destEmitNode.snippetElement = snippetElement; return destEmitNode; } function mergeTokenSourceMapRanges(sourceRanges, destRanges) { @@ -28051,7 +28037,7 @@ var ts; // To avoid holding onto transformation artifacts, we keep track of any // parse tree node we are annotating. This allows us to clean them up after // all transformations have completed. - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = (_a = ts.getSourceFileOfNode(ts.getParseTreeNode(ts.getSourceFileOfNode(node)))) !== null && _a !== void 0 ? _a : ts.Debug.fail("Could not determine parsed source file."); @@ -29129,22 +29115,22 @@ var ts; ts.isExportModifier = isExportModifier; /* @internal */ function isAsyncModifier(node) { - return node.kind === 131 /* SyntaxKind.AsyncKeyword */; + return node.kind === 132 /* SyntaxKind.AsyncKeyword */; } ts.isAsyncModifier = isAsyncModifier; /* @internal */ function isAssertsKeyword(node) { - return node.kind === 128 /* SyntaxKind.AssertsKeyword */; + return node.kind === 129 /* SyntaxKind.AssertsKeyword */; } ts.isAssertsKeyword = isAssertsKeyword; /* @internal */ function isAwaitKeyword(node) { - return node.kind === 132 /* SyntaxKind.AwaitKeyword */; + return node.kind === 133 /* SyntaxKind.AwaitKeyword */; } ts.isAwaitKeyword = isAwaitKeyword; /* @internal */ function isReadonlyKeyword(node) { - return node.kind === 145 /* SyntaxKind.ReadonlyKeyword */; + return node.kind === 146 /* SyntaxKind.ReadonlyKeyword */; } ts.isReadonlyKeyword = isReadonlyKeyword; /* @internal */ @@ -29159,9 +29145,14 @@ var ts; ts.isAbstractModifier = isAbstractModifier; /* @internal */ function isOverrideModifier(node) { - return node.kind === 159 /* SyntaxKind.OverrideKeyword */; + return node.kind === 161 /* SyntaxKind.OverrideKeyword */; } ts.isOverrideModifier = isOverrideModifier; + /* @internal */ + function isAccessorModifier(node) { + return node.kind === 127 /* SyntaxKind.AccessorKeyword */; + } + ts.isAccessorModifier = isAccessorModifier; /*@internal*/ function isSuperKeyword(node) { return node.kind === 106 /* SyntaxKind.SuperKeyword */; @@ -29174,605 +29165,609 @@ var ts; ts.isImportKeyword = isImportKeyword; // Names function isQualifiedName(node) { - return node.kind === 161 /* SyntaxKind.QualifiedName */; + return node.kind === 163 /* SyntaxKind.QualifiedName */; } ts.isQualifiedName = isQualifiedName; function isComputedPropertyName(node) { - return node.kind === 162 /* SyntaxKind.ComputedPropertyName */; + return node.kind === 164 /* SyntaxKind.ComputedPropertyName */; } ts.isComputedPropertyName = isComputedPropertyName; // Signature elements function isTypeParameterDeclaration(node) { - return node.kind === 163 /* SyntaxKind.TypeParameter */; + return node.kind === 165 /* SyntaxKind.TypeParameter */; } ts.isTypeParameterDeclaration = isTypeParameterDeclaration; // TODO(rbuckton): Rename to 'isParameterDeclaration' function isParameter(node) { - return node.kind === 164 /* SyntaxKind.Parameter */; + return node.kind === 166 /* SyntaxKind.Parameter */; } ts.isParameter = isParameter; function isDecorator(node) { - return node.kind === 165 /* SyntaxKind.Decorator */; + return node.kind === 167 /* SyntaxKind.Decorator */; } ts.isDecorator = isDecorator; // TypeMember function isPropertySignature(node) { - return node.kind === 166 /* SyntaxKind.PropertySignature */; + return node.kind === 168 /* SyntaxKind.PropertySignature */; } ts.isPropertySignature = isPropertySignature; function isPropertyDeclaration(node) { - return node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + return node.kind === 169 /* SyntaxKind.PropertyDeclaration */; } ts.isPropertyDeclaration = isPropertyDeclaration; function isMethodSignature(node) { - return node.kind === 168 /* SyntaxKind.MethodSignature */; + return node.kind === 170 /* SyntaxKind.MethodSignature */; } ts.isMethodSignature = isMethodSignature; function isMethodDeclaration(node) { - return node.kind === 169 /* SyntaxKind.MethodDeclaration */; + return node.kind === 171 /* SyntaxKind.MethodDeclaration */; } ts.isMethodDeclaration = isMethodDeclaration; function isClassStaticBlockDeclaration(node) { - return node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + return node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; } ts.isClassStaticBlockDeclaration = isClassStaticBlockDeclaration; function isConstructorDeclaration(node) { - return node.kind === 171 /* SyntaxKind.Constructor */; + return node.kind === 173 /* SyntaxKind.Constructor */; } ts.isConstructorDeclaration = isConstructorDeclaration; function isGetAccessorDeclaration(node) { - return node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetAccessorDeclaration = isGetAccessorDeclaration; function isSetAccessorDeclaration(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */; } ts.isSetAccessorDeclaration = isSetAccessorDeclaration; function isCallSignatureDeclaration(node) { - return node.kind === 174 /* SyntaxKind.CallSignature */; + return node.kind === 176 /* SyntaxKind.CallSignature */; } ts.isCallSignatureDeclaration = isCallSignatureDeclaration; function isConstructSignatureDeclaration(node) { - return node.kind === 175 /* SyntaxKind.ConstructSignature */; + return node.kind === 177 /* SyntaxKind.ConstructSignature */; } ts.isConstructSignatureDeclaration = isConstructSignatureDeclaration; function isIndexSignatureDeclaration(node) { - return node.kind === 176 /* SyntaxKind.IndexSignature */; + return node.kind === 178 /* SyntaxKind.IndexSignature */; } ts.isIndexSignatureDeclaration = isIndexSignatureDeclaration; // Type function isTypePredicateNode(node) { - return node.kind === 177 /* SyntaxKind.TypePredicate */; + return node.kind === 179 /* SyntaxKind.TypePredicate */; } ts.isTypePredicateNode = isTypePredicateNode; function isTypeReferenceNode(node) { - return node.kind === 178 /* SyntaxKind.TypeReference */; + return node.kind === 180 /* SyntaxKind.TypeReference */; } ts.isTypeReferenceNode = isTypeReferenceNode; function isFunctionTypeNode(node) { - return node.kind === 179 /* SyntaxKind.FunctionType */; + return node.kind === 181 /* SyntaxKind.FunctionType */; } ts.isFunctionTypeNode = isFunctionTypeNode; function isConstructorTypeNode(node) { - return node.kind === 180 /* SyntaxKind.ConstructorType */; + return node.kind === 182 /* SyntaxKind.ConstructorType */; } ts.isConstructorTypeNode = isConstructorTypeNode; function isTypeQueryNode(node) { - return node.kind === 181 /* SyntaxKind.TypeQuery */; + return node.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isTypeQueryNode = isTypeQueryNode; function isTypeLiteralNode(node) { - return node.kind === 182 /* SyntaxKind.TypeLiteral */; + return node.kind === 184 /* SyntaxKind.TypeLiteral */; } ts.isTypeLiteralNode = isTypeLiteralNode; function isArrayTypeNode(node) { - return node.kind === 183 /* SyntaxKind.ArrayType */; + return node.kind === 185 /* SyntaxKind.ArrayType */; } ts.isArrayTypeNode = isArrayTypeNode; function isTupleTypeNode(node) { - return node.kind === 184 /* SyntaxKind.TupleType */; + return node.kind === 186 /* SyntaxKind.TupleType */; } ts.isTupleTypeNode = isTupleTypeNode; function isNamedTupleMember(node) { - return node.kind === 197 /* SyntaxKind.NamedTupleMember */; + return node.kind === 199 /* SyntaxKind.NamedTupleMember */; } ts.isNamedTupleMember = isNamedTupleMember; function isOptionalTypeNode(node) { - return node.kind === 185 /* SyntaxKind.OptionalType */; + return node.kind === 187 /* SyntaxKind.OptionalType */; } ts.isOptionalTypeNode = isOptionalTypeNode; function isRestTypeNode(node) { - return node.kind === 186 /* SyntaxKind.RestType */; + return node.kind === 188 /* SyntaxKind.RestType */; } ts.isRestTypeNode = isRestTypeNode; function isUnionTypeNode(node) { - return node.kind === 187 /* SyntaxKind.UnionType */; + return node.kind === 189 /* SyntaxKind.UnionType */; } ts.isUnionTypeNode = isUnionTypeNode; function isIntersectionTypeNode(node) { - return node.kind === 188 /* SyntaxKind.IntersectionType */; + return node.kind === 190 /* SyntaxKind.IntersectionType */; } ts.isIntersectionTypeNode = isIntersectionTypeNode; function isConditionalTypeNode(node) { - return node.kind === 189 /* SyntaxKind.ConditionalType */; + return node.kind === 191 /* SyntaxKind.ConditionalType */; } ts.isConditionalTypeNode = isConditionalTypeNode; function isInferTypeNode(node) { - return node.kind === 190 /* SyntaxKind.InferType */; + return node.kind === 192 /* SyntaxKind.InferType */; } ts.isInferTypeNode = isInferTypeNode; function isParenthesizedTypeNode(node) { - return node.kind === 191 /* SyntaxKind.ParenthesizedType */; + return node.kind === 193 /* SyntaxKind.ParenthesizedType */; } ts.isParenthesizedTypeNode = isParenthesizedTypeNode; function isThisTypeNode(node) { - return node.kind === 192 /* SyntaxKind.ThisType */; + return node.kind === 194 /* SyntaxKind.ThisType */; } ts.isThisTypeNode = isThisTypeNode; function isTypeOperatorNode(node) { - return node.kind === 193 /* SyntaxKind.TypeOperator */; + return node.kind === 195 /* SyntaxKind.TypeOperator */; } ts.isTypeOperatorNode = isTypeOperatorNode; function isIndexedAccessTypeNode(node) { - return node.kind === 194 /* SyntaxKind.IndexedAccessType */; + return node.kind === 196 /* SyntaxKind.IndexedAccessType */; } ts.isIndexedAccessTypeNode = isIndexedAccessTypeNode; function isMappedTypeNode(node) { - return node.kind === 195 /* SyntaxKind.MappedType */; + return node.kind === 197 /* SyntaxKind.MappedType */; } ts.isMappedTypeNode = isMappedTypeNode; function isLiteralTypeNode(node) { - return node.kind === 196 /* SyntaxKind.LiteralType */; + return node.kind === 198 /* SyntaxKind.LiteralType */; } ts.isLiteralTypeNode = isLiteralTypeNode; function isImportTypeNode(node) { - return node.kind === 200 /* SyntaxKind.ImportType */; + return node.kind === 202 /* SyntaxKind.ImportType */; } ts.isImportTypeNode = isImportTypeNode; function isTemplateLiteralTypeSpan(node) { - return node.kind === 199 /* SyntaxKind.TemplateLiteralTypeSpan */; + return node.kind === 201 /* SyntaxKind.TemplateLiteralTypeSpan */; } ts.isTemplateLiteralTypeSpan = isTemplateLiteralTypeSpan; function isTemplateLiteralTypeNode(node) { - return node.kind === 198 /* SyntaxKind.TemplateLiteralType */; + return node.kind === 200 /* SyntaxKind.TemplateLiteralType */; } ts.isTemplateLiteralTypeNode = isTemplateLiteralTypeNode; // Binding patterns function isObjectBindingPattern(node) { - return node.kind === 201 /* SyntaxKind.ObjectBindingPattern */; + return node.kind === 203 /* SyntaxKind.ObjectBindingPattern */; } ts.isObjectBindingPattern = isObjectBindingPattern; function isArrayBindingPattern(node) { - return node.kind === 202 /* SyntaxKind.ArrayBindingPattern */; + return node.kind === 204 /* SyntaxKind.ArrayBindingPattern */; } ts.isArrayBindingPattern = isArrayBindingPattern; function isBindingElement(node) { - return node.kind === 203 /* SyntaxKind.BindingElement */; + return node.kind === 205 /* SyntaxKind.BindingElement */; } ts.isBindingElement = isBindingElement; // Expression function isArrayLiteralExpression(node) { - return node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */; + return node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 206 /* SyntaxKind.PropertyAccessExpression */; + return node.kind === 208 /* SyntaxKind.PropertyAccessExpression */; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 207 /* SyntaxKind.ElementAccessExpression */; + return node.kind === 209 /* SyntaxKind.ElementAccessExpression */; } ts.isElementAccessExpression = isElementAccessExpression; function isCallExpression(node) { - return node.kind === 208 /* SyntaxKind.CallExpression */; + return node.kind === 210 /* SyntaxKind.CallExpression */; } ts.isCallExpression = isCallExpression; function isNewExpression(node) { - return node.kind === 209 /* SyntaxKind.NewExpression */; + return node.kind === 211 /* SyntaxKind.NewExpression */; } ts.isNewExpression = isNewExpression; function isTaggedTemplateExpression(node) { - return node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */; + return node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */; } ts.isTaggedTemplateExpression = isTaggedTemplateExpression; function isTypeAssertionExpression(node) { - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */; } ts.isTypeAssertionExpression = isTypeAssertionExpression; function isParenthesizedExpression(node) { - return node.kind === 212 /* SyntaxKind.ParenthesizedExpression */; + return node.kind === 214 /* SyntaxKind.ParenthesizedExpression */; } ts.isParenthesizedExpression = isParenthesizedExpression; function isFunctionExpression(node) { - return node.kind === 213 /* SyntaxKind.FunctionExpression */; + return node.kind === 215 /* SyntaxKind.FunctionExpression */; } ts.isFunctionExpression = isFunctionExpression; function isArrowFunction(node) { - return node.kind === 214 /* SyntaxKind.ArrowFunction */; + return node.kind === 216 /* SyntaxKind.ArrowFunction */; } ts.isArrowFunction = isArrowFunction; function isDeleteExpression(node) { - return node.kind === 215 /* SyntaxKind.DeleteExpression */; + return node.kind === 217 /* SyntaxKind.DeleteExpression */; } ts.isDeleteExpression = isDeleteExpression; function isTypeOfExpression(node) { - return node.kind === 216 /* SyntaxKind.TypeOfExpression */; + return node.kind === 218 /* SyntaxKind.TypeOfExpression */; } ts.isTypeOfExpression = isTypeOfExpression; function isVoidExpression(node) { - return node.kind === 217 /* SyntaxKind.VoidExpression */; + return node.kind === 219 /* SyntaxKind.VoidExpression */; } ts.isVoidExpression = isVoidExpression; function isAwaitExpression(node) { - return node.kind === 218 /* SyntaxKind.AwaitExpression */; + return node.kind === 220 /* SyntaxKind.AwaitExpression */; } ts.isAwaitExpression = isAwaitExpression; function isPrefixUnaryExpression(node) { - return node.kind === 219 /* SyntaxKind.PrefixUnaryExpression */; + return node.kind === 221 /* SyntaxKind.PrefixUnaryExpression */; } ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function isPostfixUnaryExpression(node) { - return node.kind === 220 /* SyntaxKind.PostfixUnaryExpression */; + return node.kind === 222 /* SyntaxKind.PostfixUnaryExpression */; } ts.isPostfixUnaryExpression = isPostfixUnaryExpression; function isBinaryExpression(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 222 /* SyntaxKind.ConditionalExpression */; + return node.kind === 224 /* SyntaxKind.ConditionalExpression */; } ts.isConditionalExpression = isConditionalExpression; function isTemplateExpression(node) { - return node.kind === 223 /* SyntaxKind.TemplateExpression */; + return node.kind === 225 /* SyntaxKind.TemplateExpression */; } ts.isTemplateExpression = isTemplateExpression; function isYieldExpression(node) { - return node.kind === 224 /* SyntaxKind.YieldExpression */; + return node.kind === 226 /* SyntaxKind.YieldExpression */; } ts.isYieldExpression = isYieldExpression; function isSpreadElement(node) { - return node.kind === 225 /* SyntaxKind.SpreadElement */; + return node.kind === 227 /* SyntaxKind.SpreadElement */; } ts.isSpreadElement = isSpreadElement; function isClassExpression(node) { - return node.kind === 226 /* SyntaxKind.ClassExpression */; + return node.kind === 228 /* SyntaxKind.ClassExpression */; } ts.isClassExpression = isClassExpression; function isOmittedExpression(node) { - return node.kind === 227 /* SyntaxKind.OmittedExpression */; + return node.kind === 229 /* SyntaxKind.OmittedExpression */; } ts.isOmittedExpression = isOmittedExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isAsExpression(node) { - return node.kind === 229 /* SyntaxKind.AsExpression */; + return node.kind === 231 /* SyntaxKind.AsExpression */; } ts.isAsExpression = isAsExpression; + function isSatisfiesExpression(node) { + return node.kind === 235 /* SyntaxKind.SatisfiesExpression */; + } + ts.isSatisfiesExpression = isSatisfiesExpression; function isNonNullExpression(node) { - return node.kind === 230 /* SyntaxKind.NonNullExpression */; + return node.kind === 232 /* SyntaxKind.NonNullExpression */; } ts.isNonNullExpression = isNonNullExpression; function isMetaProperty(node) { - return node.kind === 231 /* SyntaxKind.MetaProperty */; + return node.kind === 233 /* SyntaxKind.MetaProperty */; } ts.isMetaProperty = isMetaProperty; function isSyntheticExpression(node) { - return node.kind === 232 /* SyntaxKind.SyntheticExpression */; + return node.kind === 234 /* SyntaxKind.SyntheticExpression */; } ts.isSyntheticExpression = isSyntheticExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 350 /* SyntaxKind.PartiallyEmittedExpression */; + return node.kind === 353 /* SyntaxKind.PartiallyEmittedExpression */; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isCommaListExpression(node) { - return node.kind === 351 /* SyntaxKind.CommaListExpression */; + return node.kind === 354 /* SyntaxKind.CommaListExpression */; } ts.isCommaListExpression = isCommaListExpression; // Misc function isTemplateSpan(node) { - return node.kind === 233 /* SyntaxKind.TemplateSpan */; + return node.kind === 236 /* SyntaxKind.TemplateSpan */; } ts.isTemplateSpan = isTemplateSpan; function isSemicolonClassElement(node) { - return node.kind === 234 /* SyntaxKind.SemicolonClassElement */; + return node.kind === 237 /* SyntaxKind.SemicolonClassElement */; } ts.isSemicolonClassElement = isSemicolonClassElement; // Elements function isBlock(node) { - return node.kind === 235 /* SyntaxKind.Block */; + return node.kind === 238 /* SyntaxKind.Block */; } ts.isBlock = isBlock; function isVariableStatement(node) { - return node.kind === 237 /* SyntaxKind.VariableStatement */; + return node.kind === 240 /* SyntaxKind.VariableStatement */; } ts.isVariableStatement = isVariableStatement; function isEmptyStatement(node) { - return node.kind === 236 /* SyntaxKind.EmptyStatement */; + return node.kind === 239 /* SyntaxKind.EmptyStatement */; } ts.isEmptyStatement = isEmptyStatement; function isExpressionStatement(node) { - return node.kind === 238 /* SyntaxKind.ExpressionStatement */; + return node.kind === 241 /* SyntaxKind.ExpressionStatement */; } ts.isExpressionStatement = isExpressionStatement; function isIfStatement(node) { - return node.kind === 239 /* SyntaxKind.IfStatement */; + return node.kind === 242 /* SyntaxKind.IfStatement */; } ts.isIfStatement = isIfStatement; function isDoStatement(node) { - return node.kind === 240 /* SyntaxKind.DoStatement */; + return node.kind === 243 /* SyntaxKind.DoStatement */; } ts.isDoStatement = isDoStatement; function isWhileStatement(node) { - return node.kind === 241 /* SyntaxKind.WhileStatement */; + return node.kind === 244 /* SyntaxKind.WhileStatement */; } ts.isWhileStatement = isWhileStatement; function isForStatement(node) { - return node.kind === 242 /* SyntaxKind.ForStatement */; + return node.kind === 245 /* SyntaxKind.ForStatement */; } ts.isForStatement = isForStatement; function isForInStatement(node) { - return node.kind === 243 /* SyntaxKind.ForInStatement */; + return node.kind === 246 /* SyntaxKind.ForInStatement */; } ts.isForInStatement = isForInStatement; function isForOfStatement(node) { - return node.kind === 244 /* SyntaxKind.ForOfStatement */; + return node.kind === 247 /* SyntaxKind.ForOfStatement */; } ts.isForOfStatement = isForOfStatement; function isContinueStatement(node) { - return node.kind === 245 /* SyntaxKind.ContinueStatement */; + return node.kind === 248 /* SyntaxKind.ContinueStatement */; } ts.isContinueStatement = isContinueStatement; function isBreakStatement(node) { - return node.kind === 246 /* SyntaxKind.BreakStatement */; + return node.kind === 249 /* SyntaxKind.BreakStatement */; } ts.isBreakStatement = isBreakStatement; function isReturnStatement(node) { - return node.kind === 247 /* SyntaxKind.ReturnStatement */; + return node.kind === 250 /* SyntaxKind.ReturnStatement */; } ts.isReturnStatement = isReturnStatement; function isWithStatement(node) { - return node.kind === 248 /* SyntaxKind.WithStatement */; + return node.kind === 251 /* SyntaxKind.WithStatement */; } ts.isWithStatement = isWithStatement; function isSwitchStatement(node) { - return node.kind === 249 /* SyntaxKind.SwitchStatement */; + return node.kind === 252 /* SyntaxKind.SwitchStatement */; } ts.isSwitchStatement = isSwitchStatement; function isLabeledStatement(node) { - return node.kind === 250 /* SyntaxKind.LabeledStatement */; + return node.kind === 253 /* SyntaxKind.LabeledStatement */; } ts.isLabeledStatement = isLabeledStatement; function isThrowStatement(node) { - return node.kind === 251 /* SyntaxKind.ThrowStatement */; + return node.kind === 254 /* SyntaxKind.ThrowStatement */; } ts.isThrowStatement = isThrowStatement; function isTryStatement(node) { - return node.kind === 252 /* SyntaxKind.TryStatement */; + return node.kind === 255 /* SyntaxKind.TryStatement */; } ts.isTryStatement = isTryStatement; function isDebuggerStatement(node) { - return node.kind === 253 /* SyntaxKind.DebuggerStatement */; + return node.kind === 256 /* SyntaxKind.DebuggerStatement */; } ts.isDebuggerStatement = isDebuggerStatement; function isVariableDeclaration(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 255 /* SyntaxKind.VariableDeclarationList */; + return node.kind === 258 /* SyntaxKind.VariableDeclarationList */; } ts.isVariableDeclarationList = isVariableDeclarationList; function isFunctionDeclaration(node) { - return node.kind === 256 /* SyntaxKind.FunctionDeclaration */; + return node.kind === 259 /* SyntaxKind.FunctionDeclaration */; } ts.isFunctionDeclaration = isFunctionDeclaration; function isClassDeclaration(node) { - return node.kind === 257 /* SyntaxKind.ClassDeclaration */; + return node.kind === 260 /* SyntaxKind.ClassDeclaration */; } ts.isClassDeclaration = isClassDeclaration; function isInterfaceDeclaration(node) { - return node.kind === 258 /* SyntaxKind.InterfaceDeclaration */; + return node.kind === 261 /* SyntaxKind.InterfaceDeclaration */; } ts.isInterfaceDeclaration = isInterfaceDeclaration; function isTypeAliasDeclaration(node) { - return node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */; + return node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */; } ts.isTypeAliasDeclaration = isTypeAliasDeclaration; function isEnumDeclaration(node) { - return node.kind === 260 /* SyntaxKind.EnumDeclaration */; + return node.kind === 263 /* SyntaxKind.EnumDeclaration */; } ts.isEnumDeclaration = isEnumDeclaration; function isModuleDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isModuleDeclaration = isModuleDeclaration; function isModuleBlock(node) { - return node.kind === 262 /* SyntaxKind.ModuleBlock */; + return node.kind === 265 /* SyntaxKind.ModuleBlock */; } ts.isModuleBlock = isModuleBlock; function isCaseBlock(node) { - return node.kind === 263 /* SyntaxKind.CaseBlock */; + return node.kind === 266 /* SyntaxKind.CaseBlock */; } ts.isCaseBlock = isCaseBlock; function isNamespaceExportDeclaration(node) { - return node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration; function isImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportDeclaration(node) { - return node.kind === 266 /* SyntaxKind.ImportDeclaration */; + return node.kind === 269 /* SyntaxKind.ImportDeclaration */; } ts.isImportDeclaration = isImportDeclaration; function isImportClause(node) { - return node.kind === 267 /* SyntaxKind.ImportClause */; + return node.kind === 270 /* SyntaxKind.ImportClause */; } ts.isImportClause = isImportClause; function isImportTypeAssertionContainer(node) { - return node.kind === 295 /* SyntaxKind.ImportTypeAssertionContainer */; + return node.kind === 298 /* SyntaxKind.ImportTypeAssertionContainer */; } ts.isImportTypeAssertionContainer = isImportTypeAssertionContainer; function isAssertClause(node) { - return node.kind === 293 /* SyntaxKind.AssertClause */; + return node.kind === 296 /* SyntaxKind.AssertClause */; } ts.isAssertClause = isAssertClause; function isAssertEntry(node) { - return node.kind === 294 /* SyntaxKind.AssertEntry */; + return node.kind === 297 /* SyntaxKind.AssertEntry */; } ts.isAssertEntry = isAssertEntry; function isNamespaceImport(node) { - return node.kind === 268 /* SyntaxKind.NamespaceImport */; + return node.kind === 271 /* SyntaxKind.NamespaceImport */; } ts.isNamespaceImport = isNamespaceImport; function isNamespaceExport(node) { - return node.kind === 274 /* SyntaxKind.NamespaceExport */; + return node.kind === 277 /* SyntaxKind.NamespaceExport */; } ts.isNamespaceExport = isNamespaceExport; function isNamedImports(node) { - return node.kind === 269 /* SyntaxKind.NamedImports */; + return node.kind === 272 /* SyntaxKind.NamedImports */; } ts.isNamedImports = isNamedImports; function isImportSpecifier(node) { - return node.kind === 270 /* SyntaxKind.ImportSpecifier */; + return node.kind === 273 /* SyntaxKind.ImportSpecifier */; } ts.isImportSpecifier = isImportSpecifier; function isExportAssignment(node) { - return node.kind === 271 /* SyntaxKind.ExportAssignment */; + return node.kind === 274 /* SyntaxKind.ExportAssignment */; } ts.isExportAssignment = isExportAssignment; function isExportDeclaration(node) { - return node.kind === 272 /* SyntaxKind.ExportDeclaration */; + return node.kind === 275 /* SyntaxKind.ExportDeclaration */; } ts.isExportDeclaration = isExportDeclaration; function isNamedExports(node) { - return node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 275 /* SyntaxKind.ExportSpecifier */; + return node.kind === 278 /* SyntaxKind.ExportSpecifier */; } ts.isExportSpecifier = isExportSpecifier; function isMissingDeclaration(node) { - return node.kind === 276 /* SyntaxKind.MissingDeclaration */; + return node.kind === 279 /* SyntaxKind.MissingDeclaration */; } ts.isMissingDeclaration = isMissingDeclaration; function isNotEmittedStatement(node) { - return node.kind === 349 /* SyntaxKind.NotEmittedStatement */; + return node.kind === 352 /* SyntaxKind.NotEmittedStatement */; } ts.isNotEmittedStatement = isNotEmittedStatement; /* @internal */ function isSyntheticReference(node) { - return node.kind === 354 /* SyntaxKind.SyntheticReferenceExpression */; + return node.kind === 357 /* SyntaxKind.SyntheticReferenceExpression */; } ts.isSyntheticReference = isSyntheticReference; /* @internal */ function isMergeDeclarationMarker(node) { - return node.kind === 352 /* SyntaxKind.MergeDeclarationMarker */; + return node.kind === 355 /* SyntaxKind.MergeDeclarationMarker */; } ts.isMergeDeclarationMarker = isMergeDeclarationMarker; /* @internal */ function isEndOfDeclarationMarker(node) { - return node.kind === 353 /* SyntaxKind.EndOfDeclarationMarker */; + return node.kind === 356 /* SyntaxKind.EndOfDeclarationMarker */; } ts.isEndOfDeclarationMarker = isEndOfDeclarationMarker; // Module References function isExternalModuleReference(node) { - return node.kind === 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 280 /* SyntaxKind.ExternalModuleReference */; } ts.isExternalModuleReference = isExternalModuleReference; // JSX function isJsxElement(node) { - return node.kind === 278 /* SyntaxKind.JsxElement */; + return node.kind === 281 /* SyntaxKind.JsxElement */; } ts.isJsxElement = isJsxElement; function isJsxSelfClosingElement(node) { - return node.kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return node.kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } ts.isJsxSelfClosingElement = isJsxSelfClosingElement; function isJsxOpeningElement(node) { - return node.kind === 280 /* SyntaxKind.JsxOpeningElement */; + return node.kind === 283 /* SyntaxKind.JsxOpeningElement */; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 281 /* SyntaxKind.JsxClosingElement */; + return node.kind === 284 /* SyntaxKind.JsxClosingElement */; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxFragment(node) { - return node.kind === 282 /* SyntaxKind.JsxFragment */; + return node.kind === 285 /* SyntaxKind.JsxFragment */; } ts.isJsxFragment = isJsxFragment; function isJsxOpeningFragment(node) { - return node.kind === 283 /* SyntaxKind.JsxOpeningFragment */; + return node.kind === 286 /* SyntaxKind.JsxOpeningFragment */; } ts.isJsxOpeningFragment = isJsxOpeningFragment; function isJsxClosingFragment(node) { - return node.kind === 284 /* SyntaxKind.JsxClosingFragment */; + return node.kind === 287 /* SyntaxKind.JsxClosingFragment */; } ts.isJsxClosingFragment = isJsxClosingFragment; function isJsxAttribute(node) { - return node.kind === 285 /* SyntaxKind.JsxAttribute */; + return node.kind === 288 /* SyntaxKind.JsxAttribute */; } ts.isJsxAttribute = isJsxAttribute; function isJsxAttributes(node) { - return node.kind === 286 /* SyntaxKind.JsxAttributes */; + return node.kind === 289 /* SyntaxKind.JsxAttributes */; } ts.isJsxAttributes = isJsxAttributes; function isJsxSpreadAttribute(node) { - return node.kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return node.kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxExpression(node) { - return node.kind === 288 /* SyntaxKind.JsxExpression */; + return node.kind === 291 /* SyntaxKind.JsxExpression */; } ts.isJsxExpression = isJsxExpression; // Clauses function isCaseClause(node) { - return node.kind === 289 /* SyntaxKind.CaseClause */; + return node.kind === 292 /* SyntaxKind.CaseClause */; } ts.isCaseClause = isCaseClause; function isDefaultClause(node) { - return node.kind === 290 /* SyntaxKind.DefaultClause */; + return node.kind === 293 /* SyntaxKind.DefaultClause */; } ts.isDefaultClause = isDefaultClause; function isHeritageClause(node) { - return node.kind === 291 /* SyntaxKind.HeritageClause */; + return node.kind === 294 /* SyntaxKind.HeritageClause */; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClause = isCatchClause; // Property assignments function isPropertyAssignment(node) { - return node.kind === 296 /* SyntaxKind.PropertyAssignment */; + return node.kind === 299 /* SyntaxKind.PropertyAssignment */; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */; + return node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isSpreadAssignment(node) { - return node.kind === 298 /* SyntaxKind.SpreadAssignment */; + return node.kind === 301 /* SyntaxKind.SpreadAssignment */; } ts.isSpreadAssignment = isSpreadAssignment; // Enum function isEnumMember(node) { - return node.kind === 299 /* SyntaxKind.EnumMember */; + return node.kind === 302 /* SyntaxKind.EnumMember */; } ts.isEnumMember = isEnumMember; // Unparsed // TODO(rbuckton): isUnparsedPrologue function isUnparsedPrepend(node) { - return node.kind === 301 /* SyntaxKind.UnparsedPrepend */; + return node.kind === 304 /* SyntaxKind.UnparsedPrepend */; } ts.isUnparsedPrepend = isUnparsedPrepend; // TODO(rbuckton): isUnparsedText @@ -29780,176 +29775,176 @@ var ts; // TODO(rbuckton): isUnparsedSyntheticReference // Top-level nodes function isSourceFile(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */; + return node.kind === 308 /* SyntaxKind.SourceFile */; } ts.isSourceFile = isSourceFile; function isBundle(node) { - return node.kind === 306 /* SyntaxKind.Bundle */; + return node.kind === 309 /* SyntaxKind.Bundle */; } ts.isBundle = isBundle; function isUnparsedSource(node) { - return node.kind === 307 /* SyntaxKind.UnparsedSource */; + return node.kind === 310 /* SyntaxKind.UnparsedSource */; } ts.isUnparsedSource = isUnparsedSource; // TODO(rbuckton): isInputFiles // JSDoc Elements function isJSDocTypeExpression(node) { - return node.kind === 309 /* SyntaxKind.JSDocTypeExpression */; + return node.kind === 312 /* SyntaxKind.JSDocTypeExpression */; } ts.isJSDocTypeExpression = isJSDocTypeExpression; function isJSDocNameReference(node) { - return node.kind === 310 /* SyntaxKind.JSDocNameReference */; + return node.kind === 313 /* SyntaxKind.JSDocNameReference */; } ts.isJSDocNameReference = isJSDocNameReference; function isJSDocMemberName(node) { - return node.kind === 311 /* SyntaxKind.JSDocMemberName */; + return node.kind === 314 /* SyntaxKind.JSDocMemberName */; } ts.isJSDocMemberName = isJSDocMemberName; function isJSDocLink(node) { - return node.kind === 324 /* SyntaxKind.JSDocLink */; + return node.kind === 327 /* SyntaxKind.JSDocLink */; } ts.isJSDocLink = isJSDocLink; function isJSDocLinkCode(node) { - return node.kind === 325 /* SyntaxKind.JSDocLinkCode */; + return node.kind === 328 /* SyntaxKind.JSDocLinkCode */; } ts.isJSDocLinkCode = isJSDocLinkCode; function isJSDocLinkPlain(node) { - return node.kind === 326 /* SyntaxKind.JSDocLinkPlain */; + return node.kind === 329 /* SyntaxKind.JSDocLinkPlain */; } ts.isJSDocLinkPlain = isJSDocLinkPlain; function isJSDocAllType(node) { - return node.kind === 312 /* SyntaxKind.JSDocAllType */; + return node.kind === 315 /* SyntaxKind.JSDocAllType */; } ts.isJSDocAllType = isJSDocAllType; function isJSDocUnknownType(node) { - return node.kind === 313 /* SyntaxKind.JSDocUnknownType */; + return node.kind === 316 /* SyntaxKind.JSDocUnknownType */; } ts.isJSDocUnknownType = isJSDocUnknownType; function isJSDocNullableType(node) { - return node.kind === 314 /* SyntaxKind.JSDocNullableType */; + return node.kind === 317 /* SyntaxKind.JSDocNullableType */; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 315 /* SyntaxKind.JSDocNonNullableType */; + return node.kind === 318 /* SyntaxKind.JSDocNonNullableType */; } ts.isJSDocNonNullableType = isJSDocNonNullableType; function isJSDocOptionalType(node) { - return node.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return node.kind === 319 /* SyntaxKind.JSDocOptionalType */; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 317 /* SyntaxKind.JSDocFunctionType */; + return node.kind === 320 /* SyntaxKind.JSDocFunctionType */; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 318 /* SyntaxKind.JSDocVariadicType */; + return node.kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isJSDocVariadicType = isJSDocVariadicType; function isJSDocNamepathType(node) { - return node.kind === 319 /* SyntaxKind.JSDocNamepathType */; + return node.kind === 322 /* SyntaxKind.JSDocNamepathType */; } ts.isJSDocNamepathType = isJSDocNamepathType; function isJSDoc(node) { - return node.kind === 320 /* SyntaxKind.JSDoc */; + return node.kind === 323 /* SyntaxKind.JSDoc */; } ts.isJSDoc = isJSDoc; function isJSDocTypeLiteral(node) { - return node.kind === 322 /* SyntaxKind.JSDocTypeLiteral */; + return node.kind === 325 /* SyntaxKind.JSDocTypeLiteral */; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; function isJSDocSignature(node) { - return node.kind === 323 /* SyntaxKind.JSDocSignature */; + return node.kind === 326 /* SyntaxKind.JSDocSignature */; } ts.isJSDocSignature = isJSDocSignature; // JSDoc Tags function isJSDocAugmentsTag(node) { - return node.kind === 328 /* SyntaxKind.JSDocAugmentsTag */; + return node.kind === 331 /* SyntaxKind.JSDocAugmentsTag */; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocAuthorTag(node) { - return node.kind === 330 /* SyntaxKind.JSDocAuthorTag */; + return node.kind === 333 /* SyntaxKind.JSDocAuthorTag */; } ts.isJSDocAuthorTag = isJSDocAuthorTag; function isJSDocClassTag(node) { - return node.kind === 332 /* SyntaxKind.JSDocClassTag */; + return node.kind === 335 /* SyntaxKind.JSDocClassTag */; } ts.isJSDocClassTag = isJSDocClassTag; function isJSDocCallbackTag(node) { - return node.kind === 338 /* SyntaxKind.JSDocCallbackTag */; + return node.kind === 341 /* SyntaxKind.JSDocCallbackTag */; } ts.isJSDocCallbackTag = isJSDocCallbackTag; function isJSDocPublicTag(node) { - return node.kind === 333 /* SyntaxKind.JSDocPublicTag */; + return node.kind === 336 /* SyntaxKind.JSDocPublicTag */; } ts.isJSDocPublicTag = isJSDocPublicTag; function isJSDocPrivateTag(node) { - return node.kind === 334 /* SyntaxKind.JSDocPrivateTag */; + return node.kind === 337 /* SyntaxKind.JSDocPrivateTag */; } ts.isJSDocPrivateTag = isJSDocPrivateTag; function isJSDocProtectedTag(node) { - return node.kind === 335 /* SyntaxKind.JSDocProtectedTag */; + return node.kind === 338 /* SyntaxKind.JSDocProtectedTag */; } ts.isJSDocProtectedTag = isJSDocProtectedTag; function isJSDocReadonlyTag(node) { - return node.kind === 336 /* SyntaxKind.JSDocReadonlyTag */; + return node.kind === 339 /* SyntaxKind.JSDocReadonlyTag */; } ts.isJSDocReadonlyTag = isJSDocReadonlyTag; function isJSDocOverrideTag(node) { - return node.kind === 337 /* SyntaxKind.JSDocOverrideTag */; + return node.kind === 340 /* SyntaxKind.JSDocOverrideTag */; } ts.isJSDocOverrideTag = isJSDocOverrideTag; function isJSDocDeprecatedTag(node) { - return node.kind === 331 /* SyntaxKind.JSDocDeprecatedTag */; + return node.kind === 334 /* SyntaxKind.JSDocDeprecatedTag */; } ts.isJSDocDeprecatedTag = isJSDocDeprecatedTag; function isJSDocSeeTag(node) { - return node.kind === 346 /* SyntaxKind.JSDocSeeTag */; + return node.kind === 349 /* SyntaxKind.JSDocSeeTag */; } ts.isJSDocSeeTag = isJSDocSeeTag; function isJSDocEnumTag(node) { - return node.kind === 339 /* SyntaxKind.JSDocEnumTag */; + return node.kind === 342 /* SyntaxKind.JSDocEnumTag */; } ts.isJSDocEnumTag = isJSDocEnumTag; function isJSDocParameterTag(node) { - return node.kind === 340 /* SyntaxKind.JSDocParameterTag */; + return node.kind === 343 /* SyntaxKind.JSDocParameterTag */; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 341 /* SyntaxKind.JSDocReturnTag */; + return node.kind === 344 /* SyntaxKind.JSDocReturnTag */; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocThisTag(node) { - return node.kind === 342 /* SyntaxKind.JSDocThisTag */; + return node.kind === 345 /* SyntaxKind.JSDocThisTag */; } ts.isJSDocThisTag = isJSDocThisTag; function isJSDocTypeTag(node) { - return node.kind === 343 /* SyntaxKind.JSDocTypeTag */; + return node.kind === 346 /* SyntaxKind.JSDocTypeTag */; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 344 /* SyntaxKind.JSDocTemplateTag */; + return node.kind === 347 /* SyntaxKind.JSDocTemplateTag */; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 345 /* SyntaxKind.JSDocTypedefTag */; + return node.kind === 348 /* SyntaxKind.JSDocTypedefTag */; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocUnknownTag(node) { - return node.kind === 327 /* SyntaxKind.JSDocTag */; + return node.kind === 330 /* SyntaxKind.JSDocTag */; } ts.isJSDocUnknownTag = isJSDocUnknownTag; function isJSDocPropertyTag(node) { - return node.kind === 347 /* SyntaxKind.JSDocPropertyTag */; + return node.kind === 350 /* SyntaxKind.JSDocPropertyTag */; } ts.isJSDocPropertyTag = isJSDocPropertyTag; function isJSDocImplementsTag(node) { - return node.kind === 329 /* SyntaxKind.JSDocImplementsTag */; + return node.kind === 332 /* SyntaxKind.JSDocImplementsTag */; } ts.isJSDocImplementsTag = isJSDocImplementsTag; // Synthesized list /* @internal */ function isSyntaxList(n) { - return n.kind === 348 /* SyntaxKind.SyntaxList */; + return n.kind === 351 /* SyntaxKind.SyntaxList */; } ts.isSyntaxList = isSyntaxList; })(ts || (ts = {})); @@ -30148,14 +30143,14 @@ var ts; ts.Debug.failBadSyntaxKind(property.name, "Private identifiers are not allowed in object literals."); } switch (property.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return createExpressionForAccessorDeclaration(factory, node.properties, property, receiver, !!node.multiLine); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return createExpressionForPropertyAssignment(factory, property, receiver); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return createExpressionForShorthandPropertyAssignment(factory, property, receiver); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return createExpressionForMethodDeclaration(factory, property, receiver); } } @@ -30263,8 +30258,8 @@ var ts; } ts.startsWithUseStrict = startsWithUseStrict; function isCommaSequence(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ || - node.kind === 351 /* SyntaxKind.CommaListExpression */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ || + node.kind === 354 /* SyntaxKind.CommaListExpression */; } ts.isCommaSequence = isCommaSequence; function isJSDocTypeAssertion(node) { @@ -30282,17 +30277,18 @@ var ts; function isOuterExpression(node, kinds) { if (kinds === void 0) { kinds = 15 /* OuterExpressionKinds.All */; } switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: if (kinds & 16 /* OuterExpressionKinds.ExcludeJSDocTypeAssertion */ && isJSDocTypeAssertion(node)) { return false; } return (kinds & 1 /* OuterExpressionKinds.Parentheses */) !== 0; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return (kinds & 2 /* OuterExpressionKinds.TypeAssertions */) !== 0; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return (kinds & 4 /* OuterExpressionKinds.NonNullAssertions */) !== 0; - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return (kinds & 8 /* OuterExpressionKinds.PartiallyEmittedExpressions */) !== 0; } return false; @@ -30413,10 +30409,10 @@ var ts; var name = namespaceDeclaration.name; return ts.isGeneratedIdentifier(name) ? name : factory.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name)); } - if (node.kind === 266 /* SyntaxKind.ImportDeclaration */ && node.importClause) { + if (node.kind === 269 /* SyntaxKind.ImportDeclaration */ && node.importClause) { return factory.getGeneratedNameForNode(node); } - if (node.kind === 272 /* SyntaxKind.ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 275 /* SyntaxKind.ExportDeclaration */ && node.moduleSpecifier) { return factory.getGeneratedNameForNode(node); } return undefined; @@ -30535,7 +30531,7 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // `b` in `({ a: b } = ...)` // `b` in `({ a: b = 1 } = ...)` // `{b}` in `({ a: {b} } = ...)` @@ -30547,11 +30543,11 @@ var ts; // `b[0]` in `({ a: b[0] } = ...)` // `b[0]` in `({ a: b[0] = 1 } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // `a` in `({ a } = ...)` // `a` in `({ a = 1 } = ...)` return bindingElement.name; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: // `a` in `({ ...a } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } @@ -30583,12 +30579,12 @@ var ts; */ function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: // `...` in `let [...a] = ...` return bindingElement.dotDotDotToken; - case 225 /* SyntaxKind.SpreadElement */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 227 /* SyntaxKind.SpreadElement */: + case 301 /* SyntaxKind.SpreadAssignment */: // `...` in `[...a] = ...` return bindingElement; } @@ -30606,7 +30602,7 @@ var ts; ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; function tryGetPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: // `a` in `let { a: b } = ...` // `[a]` in `let { [a]: b } = ...` // `"a"` in `let { "a": b } = ...` @@ -30621,7 +30617,7 @@ var ts; : propertyName; } break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // `a` in `({ a: b } = ...)` // `[a]` in `({ [a]: b } = ...)` // `"a"` in `({ "a": b } = ...)` @@ -30636,7 +30632,7 @@ var ts; : propertyName; } break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: // `a` in `({ ...a } = ...)` if (bindingElement.name && ts.isPrivateIdentifier(bindingElement.name)) { return ts.Debug.failBadSyntaxKind(bindingElement.name); @@ -30659,13 +30655,13 @@ var ts; */ function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: // `a` in `{a}` // `a` in `[a]` return name.elements; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: // `a` in `{a}` return name.properties; } @@ -30686,46 +30682,46 @@ var ts; ts.getJSDocTypeAliasName = getJSDocTypeAliasName; function canHaveIllegalType(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.canHaveIllegalType = canHaveIllegalType; function canHaveIllegalTypeParameters(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.canHaveIllegalTypeParameters = canHaveIllegalTypeParameters; function canHaveIllegalDecorators(node) { var kind = node.kind; - return kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */; + return kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */; } ts.canHaveIllegalDecorators = canHaveIllegalDecorators; function canHaveIllegalModifiers(node) { var kind = node.kind; - return kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 179 /* SyntaxKind.FunctionType */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 181 /* SyntaxKind.FunctionType */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } ts.canHaveIllegalModifiers = canHaveIllegalModifiers; ts.isTypeNodeOrTypeParameterDeclaration = ts.or(ts.isTypeNode, ts.isTypeParameterDeclaration); @@ -30999,6 +30995,83 @@ var ts; return ts.setTextRange(factory.createNodeArray([], nodes.hasTrailingComma), nodes); } ts.elideNodes = elideNodes; + /** + * Gets the node from which a name should be generated. + */ + function getNodeForGeneratedName(name) { + if (name.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) { + var autoGenerateId = name.autoGenerateId; + var node = name; + var original = node.original; + while (original) { + node = original; + // if "node" is a different generated name (having a different "autoGenerateId"), use it and stop traversing. + if (ts.isMemberName(node) + && !!(node.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) + && node.autoGenerateId !== autoGenerateId) { + break; + } + original = node.original; + } + // otherwise, return the original node for the source + return node; + } + return name; + } + ts.getNodeForGeneratedName = getNodeForGeneratedName; + function formatGeneratedNamePart(part, generateName) { + return typeof part === "object" ? formatGeneratedName(/*privateName*/ false, part.prefix, part.node, part.suffix, generateName) : + typeof part === "string" ? part.length > 0 && part.charCodeAt(0) === 35 /* CharacterCodes.hash */ ? part.slice(1) : part : + ""; + } + ts.formatGeneratedNamePart = formatGeneratedNamePart; + function formatIdentifier(name, generateName) { + return typeof name === "string" ? name : + formatIdentifierWorker(name, ts.Debug.checkDefined(generateName)); + } + function formatIdentifierWorker(node, generateName) { + return ts.isGeneratedPrivateIdentifier(node) ? generateName(node).slice(1) : + ts.isGeneratedIdentifier(node) ? generateName(node) : + ts.isPrivateIdentifier(node) ? node.escapedText.slice(1) : + ts.idText(node); + } + function formatGeneratedName(privateName, prefix, baseName, suffix, generateName) { + prefix = formatGeneratedNamePart(prefix, generateName); + suffix = formatGeneratedNamePart(suffix, generateName); + baseName = formatIdentifier(baseName, generateName); + return "".concat(privateName ? "#" : "").concat(prefix).concat(baseName).concat(suffix); + } + ts.formatGeneratedName = formatGeneratedName; + /** + * Creates a private backing field for an `accessor` {@link PropertyDeclaration}. + */ + function createAccessorPropertyBackingField(factory, node, modifiers, initializer) { + return factory.updatePropertyDeclaration(node, modifiers, factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage"), + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, initializer); + } + ts.createAccessorPropertyBackingField = createAccessorPropertyBackingField; + /** + * Creates a {@link GetAccessorDeclaration} that reads from a private backing field. + */ + function createAccessorPropertyGetRedirector(factory, node, modifiers, name) { + return factory.createGetAccessorDeclaration(modifiers, name, [], + /*type*/ undefined, factory.createBlock([ + factory.createReturnStatement(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage"))) + ])); + } + ts.createAccessorPropertyGetRedirector = createAccessorPropertyGetRedirector; + /** + * Creates a {@link SetAccessorDeclaration} that writes to a private backing field. + */ + function createAccessorPropertySetRedirector(factory, node, modifiers, name) { + return factory.createSetAccessorDeclaration(modifiers, name, [factory.createParameterDeclaration( + /*modifiers*/ undefined, + /*dotdotDotToken*/ undefined, "value")], factory.createBlock([ + factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage")), factory.createIdentifier("value"))) + ])); + } + ts.createAccessorPropertySetRedirector = createAccessorPropertySetRedirector; })(ts || (ts = {})); var ts; (function (ts) { @@ -31008,47 +31081,48 @@ var ts; ts.setTextRange = setTextRange; function canHaveModifiers(node) { var kind = node.kind; - return kind === 163 /* SyntaxKind.TypeParameter */ - || kind === 164 /* SyntaxKind.Parameter */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 180 /* SyntaxKind.ConstructorType */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */ - || kind === 272 /* SyntaxKind.ExportDeclaration */; + return kind === 165 /* SyntaxKind.TypeParameter */ + || kind === 166 /* SyntaxKind.Parameter */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 182 /* SyntaxKind.ConstructorType */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */ + || kind === 275 /* SyntaxKind.ExportDeclaration */; } ts.canHaveModifiers = canHaveModifiers; function canHaveDecorators(node) { var kind = node.kind; - return kind === 164 /* SyntaxKind.Parameter */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 257 /* SyntaxKind.ClassDeclaration */; + return kind === 166 /* SyntaxKind.Parameter */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 260 /* SyntaxKind.ClassDeclaration */; } ts.canHaveDecorators = canHaveDecorators; })(ts || (ts = {})); var ts; (function (ts) { + var _a; var SignatureFlags; (function (SignatureFlags) { SignatureFlags[SignatureFlags["None"] = 0] = "None"; @@ -31136,6 +31210,718 @@ var ts; function isImportMeta(node) { return ts.isMetaProperty(node) && node.keywordToken === 100 /* SyntaxKind.ImportKeyword */ && node.name.escapedText === "meta"; } + var forEachChildTable = (_a = {}, + _a[163 /* SyntaxKind.QualifiedName */] = function forEachChildInQualifiedName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + }, + _a[165 /* SyntaxKind.TypeParameter */] = function forEachChildInTypeParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.default) || + visitNode(cbNode, node.expression); + }, + _a[300 /* SyntaxKind.ShorthandPropertyAssignment */] = function forEachChildInShorthandPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.equalsToken) || + visitNode(cbNode, node.objectAssignmentInitializer); + }, + _a[301 /* SyntaxKind.SpreadAssignment */] = function forEachChildInSpreadAssignment(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[166 /* SyntaxKind.Parameter */] = function forEachChildInParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[169 /* SyntaxKind.PropertyDeclaration */] = function forEachChildInPropertyDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[168 /* SyntaxKind.PropertySignature */] = function forEachChildInPropertySignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[299 /* SyntaxKind.PropertyAssignment */] = function forEachChildInPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.initializer); + }, + _a[257 /* SyntaxKind.VariableDeclaration */] = function forEachChildInVariableDeclaration(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[205 /* SyntaxKind.BindingElement */] = function forEachChildInBindingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[178 /* SyntaxKind.IndexSignature */] = function forEachChildInIndexSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[182 /* SyntaxKind.ConstructorType */] = function forEachChildInConstructorType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[181 /* SyntaxKind.FunctionType */] = function forEachChildInFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[176 /* SyntaxKind.CallSignature */] = forEachChildInCallOrConstructSignature, + _a[177 /* SyntaxKind.ConstructSignature */] = forEachChildInCallOrConstructSignature, + _a[171 /* SyntaxKind.MethodDeclaration */] = function forEachChildInMethodDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[170 /* SyntaxKind.MethodSignature */] = function forEachChildInMethodSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[173 /* SyntaxKind.Constructor */] = function forEachChildInConstructor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[174 /* SyntaxKind.GetAccessor */] = function forEachChildInGetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[175 /* SyntaxKind.SetAccessor */] = function forEachChildInSetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[259 /* SyntaxKind.FunctionDeclaration */] = function forEachChildInFunctionDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[215 /* SyntaxKind.FunctionExpression */] = function forEachChildInFunctionExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[216 /* SyntaxKind.ArrowFunction */] = function forEachChildInArrowFunction(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.equalsGreaterThanToken) || + visitNode(cbNode, node.body); + }, + _a[172 /* SyntaxKind.ClassStaticBlockDeclaration */] = function forEachChildInClassStaticBlockDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.body); + }, + _a[180 /* SyntaxKind.TypeReference */] = function forEachChildInTypeReference(node, cbNode, cbNodes) { + return visitNode(cbNode, node.typeName) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[179 /* SyntaxKind.TypePredicate */] = function forEachChildInTypePredicate(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertsModifier) || + visitNode(cbNode, node.parameterName) || + visitNode(cbNode, node.type); + }, + _a[183 /* SyntaxKind.TypeQuery */] = function forEachChildInTypeQuery(node, cbNode, cbNodes) { + return visitNode(cbNode, node.exprName) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[184 /* SyntaxKind.TypeLiteral */] = function forEachChildInTypeLiteral(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.members); + }, + _a[185 /* SyntaxKind.ArrayType */] = function forEachChildInArrayType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.elementType); + }, + _a[186 /* SyntaxKind.TupleType */] = function forEachChildInTupleType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[189 /* SyntaxKind.UnionType */] = forEachChildInUnionOrIntersectionType, + _a[190 /* SyntaxKind.IntersectionType */] = forEachChildInUnionOrIntersectionType, + _a[191 /* SyntaxKind.ConditionalType */] = function forEachChildInConditionalType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.checkType) || + visitNode(cbNode, node.extendsType) || + visitNode(cbNode, node.trueType) || + visitNode(cbNode, node.falseType); + }, + _a[192 /* SyntaxKind.InferType */] = function forEachChildInInferType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.typeParameter); + }, + _a[202 /* SyntaxKind.ImportType */] = function forEachChildInImportType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.argument) || + visitNode(cbNode, node.assertions) || + visitNode(cbNode, node.qualifier) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[298 /* SyntaxKind.ImportTypeAssertionContainer */] = function forEachChildInImportTypeAssertionContainer(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertClause); + }, + _a[193 /* SyntaxKind.ParenthesizedType */] = forEachChildInParenthesizedTypeOrTypeOperator, + _a[195 /* SyntaxKind.TypeOperator */] = forEachChildInParenthesizedTypeOrTypeOperator, + _a[196 /* SyntaxKind.IndexedAccessType */] = function forEachChildInIndexedAccessType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.objectType) || + visitNode(cbNode, node.indexType); + }, + _a[197 /* SyntaxKind.MappedType */] = function forEachChildInMappedType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.readonlyToken) || + visitNode(cbNode, node.typeParameter) || + visitNode(cbNode, node.nameType) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[198 /* SyntaxKind.LiteralType */] = function forEachChildInLiteralType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.literal); + }, + _a[199 /* SyntaxKind.NamedTupleMember */] = function forEachChildInNamedTupleMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type); + }, + _a[203 /* SyntaxKind.ObjectBindingPattern */] = forEachChildInObjectOrArrayBindingPattern, + _a[204 /* SyntaxKind.ArrayBindingPattern */] = forEachChildInObjectOrArrayBindingPattern, + _a[206 /* SyntaxKind.ArrayLiteralExpression */] = function forEachChildInArrayLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[207 /* SyntaxKind.ObjectLiteralExpression */] = function forEachChildInObjectLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, + _a[208 /* SyntaxKind.PropertyAccessExpression */] = function forEachChildInPropertyAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNode(cbNode, node.name); + }, + _a[209 /* SyntaxKind.ElementAccessExpression */] = function forEachChildInElementAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNode(cbNode, node.argumentExpression); + }, + _a[210 /* SyntaxKind.CallExpression */] = forEachChildInCallOrNewExpression, + _a[211 /* SyntaxKind.NewExpression */] = forEachChildInCallOrNewExpression, + _a[212 /* SyntaxKind.TaggedTemplateExpression */] = function forEachChildInTaggedTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tag) || + visitNode(cbNode, node.questionDotToken) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNode(cbNode, node.template); + }, + _a[213 /* SyntaxKind.TypeAssertionExpression */] = function forEachChildInTypeAssertionExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.expression); + }, + _a[214 /* SyntaxKind.ParenthesizedExpression */] = function forEachChildInParenthesizedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[217 /* SyntaxKind.DeleteExpression */] = function forEachChildInDeleteExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[218 /* SyntaxKind.TypeOfExpression */] = function forEachChildInTypeOfExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[219 /* SyntaxKind.VoidExpression */] = function forEachChildInVoidExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[221 /* SyntaxKind.PrefixUnaryExpression */] = function forEachChildInPrefixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, + _a[226 /* SyntaxKind.YieldExpression */] = function forEachChildInYieldExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + }, + _a[220 /* SyntaxKind.AwaitExpression */] = function forEachChildInAwaitExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[222 /* SyntaxKind.PostfixUnaryExpression */] = function forEachChildInPostfixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, + _a[223 /* SyntaxKind.BinaryExpression */] = function forEachChildInBinaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.operatorToken) || + visitNode(cbNode, node.right); + }, + _a[231 /* SyntaxKind.AsExpression */] = function forEachChildInAsExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.type); + }, + _a[232 /* SyntaxKind.NonNullExpression */] = function forEachChildInNonNullExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[235 /* SyntaxKind.SatisfiesExpression */] = function forEachChildInSatisfiesExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); + }, + _a[233 /* SyntaxKind.MetaProperty */] = function forEachChildInMetaProperty(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[224 /* SyntaxKind.ConditionalExpression */] = function forEachChildInConditionalExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.condition) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.whenTrue) || + visitNode(cbNode, node.colonToken) || + visitNode(cbNode, node.whenFalse); + }, + _a[227 /* SyntaxKind.SpreadElement */] = function forEachChildInSpreadElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[238 /* SyntaxKind.Block */] = forEachChildInBlock, + _a[265 /* SyntaxKind.ModuleBlock */] = forEachChildInBlock, + _a[308 /* SyntaxKind.SourceFile */] = function forEachChildInSourceFile(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements) || + visitNode(cbNode, node.endOfFileToken); + }, + _a[240 /* SyntaxKind.VariableStatement */] = function forEachChildInVariableStatement(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.declarationList); + }, + _a[258 /* SyntaxKind.VariableDeclarationList */] = function forEachChildInVariableDeclarationList(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.declarations); + }, + _a[241 /* SyntaxKind.ExpressionStatement */] = function forEachChildInExpressionStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[242 /* SyntaxKind.IfStatement */] = function forEachChildInIfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.thenStatement) || + visitNode(cbNode, node.elseStatement); + }, + _a[243 /* SyntaxKind.DoStatement */] = function forEachChildInDoStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.statement) || + visitNode(cbNode, node.expression); + }, + _a[244 /* SyntaxKind.WhileStatement */] = function forEachChildInWhileStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[245 /* SyntaxKind.ForStatement */] = function forEachChildInForStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.incrementor) || + visitNode(cbNode, node.statement); + }, + _a[246 /* SyntaxKind.ForInStatement */] = function forEachChildInForInStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[247 /* SyntaxKind.ForOfStatement */] = function forEachChildInForOfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.awaitModifier) || + visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[248 /* SyntaxKind.ContinueStatement */] = forEachChildInContinueOrBreakStatement, + _a[249 /* SyntaxKind.BreakStatement */] = forEachChildInContinueOrBreakStatement, + _a[250 /* SyntaxKind.ReturnStatement */] = function forEachChildInReturnStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[251 /* SyntaxKind.WithStatement */] = function forEachChildInWithStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[252 /* SyntaxKind.SwitchStatement */] = function forEachChildInSwitchStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.caseBlock); + }, + _a[266 /* SyntaxKind.CaseBlock */] = function forEachChildInCaseBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.clauses); + }, + _a[292 /* SyntaxKind.CaseClause */] = function forEachChildInCaseClause(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNodes(cbNode, cbNodes, node.statements); + }, + _a[293 /* SyntaxKind.DefaultClause */] = function forEachChildInDefaultClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + }, + _a[253 /* SyntaxKind.LabeledStatement */] = function forEachChildInLabeledStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + }, + _a[254 /* SyntaxKind.ThrowStatement */] = function forEachChildInThrowStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[255 /* SyntaxKind.TryStatement */] = function forEachChildInTryStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tryBlock) || + visitNode(cbNode, node.catchClause) || + visitNode(cbNode, node.finallyBlock); + }, + _a[295 /* SyntaxKind.CatchClause */] = function forEachChildInCatchClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.variableDeclaration) || + visitNode(cbNode, node.block); + }, + _a[167 /* SyntaxKind.Decorator */] = function forEachChildInDecorator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[260 /* SyntaxKind.ClassDeclaration */] = forEachChildInClassDeclarationOrExpression, + _a[228 /* SyntaxKind.ClassExpression */] = forEachChildInClassDeclarationOrExpression, + _a[261 /* SyntaxKind.InterfaceDeclaration */] = function forEachChildInInterfaceDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[262 /* SyntaxKind.TypeAliasDeclaration */] = function forEachChildInTypeAliasDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNode(cbNode, node.type); + }, + _a[263 /* SyntaxKind.EnumDeclaration */] = function forEachChildInEnumDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[302 /* SyntaxKind.EnumMember */] = function forEachChildInEnumMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[264 /* SyntaxKind.ModuleDeclaration */] = function forEachChildInModuleDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); + }, + _a[268 /* SyntaxKind.ImportEqualsDeclaration */] = function forEachChildInImportEqualsDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.moduleReference); + }, + _a[269 /* SyntaxKind.ImportDeclaration */] = function forEachChildInImportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.importClause) || + visitNode(cbNode, node.moduleSpecifier) || + visitNode(cbNode, node.assertClause); + }, + _a[270 /* SyntaxKind.ImportClause */] = function forEachChildInImportClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.namedBindings); + }, + _a[296 /* SyntaxKind.AssertClause */] = function forEachChildInAssertClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[297 /* SyntaxKind.AssertEntry */] = function forEachChildInAssertEntry(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.value); + }, + _a[267 /* SyntaxKind.NamespaceExportDeclaration */] = function forEachChildInNamespaceExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNode(cbNode, node.name); + }, + _a[271 /* SyntaxKind.NamespaceImport */] = function forEachChildInNamespaceImport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[277 /* SyntaxKind.NamespaceExport */] = function forEachChildInNamespaceExport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[272 /* SyntaxKind.NamedImports */] = forEachChildInNamedImportsOrExports, + _a[276 /* SyntaxKind.NamedExports */] = forEachChildInNamedImportsOrExports, + _a[275 /* SyntaxKind.ExportDeclaration */] = function forEachChildInExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.exportClause) || + visitNode(cbNode, node.moduleSpecifier) || + visitNode(cbNode, node.assertClause); + }, + _a[273 /* SyntaxKind.ImportSpecifier */] = forEachChildInImportOrExportSpecifier, + _a[278 /* SyntaxKind.ExportSpecifier */] = forEachChildInImportOrExportSpecifier, + _a[274 /* SyntaxKind.ExportAssignment */] = function forEachChildInExportAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.expression); + }, + _a[225 /* SyntaxKind.TemplateExpression */] = function forEachChildInTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || + visitNodes(cbNode, cbNodes, node.templateSpans); + }, + _a[236 /* SyntaxKind.TemplateSpan */] = function forEachChildInTemplateSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.literal); + }, + _a[200 /* SyntaxKind.TemplateLiteralType */] = function forEachChildInTemplateLiteralType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || + visitNodes(cbNode, cbNodes, node.templateSpans); + }, + _a[201 /* SyntaxKind.TemplateLiteralTypeSpan */] = function forEachChildInTemplateLiteralTypeSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.literal); + }, + _a[164 /* SyntaxKind.ComputedPropertyName */] = function forEachChildInComputedPropertyName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[294 /* SyntaxKind.HeritageClause */] = function forEachChildInHeritageClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + }, + _a[230 /* SyntaxKind.ExpressionWithTypeArguments */] = function forEachChildInExpressionWithTypeArguments(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[280 /* SyntaxKind.ExternalModuleReference */] = function forEachChildInExternalModuleReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[279 /* SyntaxKind.MissingDeclaration */] = function forEachChildInMissingDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers); + }, + _a[354 /* SyntaxKind.CommaListExpression */] = function forEachChildInCommaListExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[281 /* SyntaxKind.JsxElement */] = function forEachChildInJsxElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingElement) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingElement); + }, + _a[285 /* SyntaxKind.JsxFragment */] = function forEachChildInJsxFragment(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingFragment) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingFragment); + }, + _a[282 /* SyntaxKind.JsxSelfClosingElement */] = forEachChildInJsxOpeningOrSelfClosingElement, + _a[283 /* SyntaxKind.JsxOpeningElement */] = forEachChildInJsxOpeningOrSelfClosingElement, + _a[289 /* SyntaxKind.JsxAttributes */] = function forEachChildInJsxAttributes(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, + _a[288 /* SyntaxKind.JsxAttribute */] = function forEachChildInJsxAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[290 /* SyntaxKind.JsxSpreadAttribute */] = function forEachChildInJsxSpreadAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[291 /* SyntaxKind.JsxExpression */] = function forEachChildInJsxExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.expression); + }, + _a[284 /* SyntaxKind.JsxClosingElement */] = function forEachChildInJsxClosingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tagName); + }, + _a[187 /* SyntaxKind.OptionalType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[188 /* SyntaxKind.RestType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[312 /* SyntaxKind.JSDocTypeExpression */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[318 /* SyntaxKind.JSDocNonNullableType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[317 /* SyntaxKind.JSDocNullableType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[319 /* SyntaxKind.JSDocOptionalType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[321 /* SyntaxKind.JSDocVariadicType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[320 /* SyntaxKind.JSDocFunctionType */] = function forEachChildInJSDocFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[323 /* SyntaxKind.JSDoc */] = function forEachChildInJSDoc(node, cbNode, cbNodes) { + return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) + || visitNodes(cbNode, cbNodes, node.tags); + }, + _a[349 /* SyntaxKind.JSDocSeeTag */] = function forEachChildInJSDocSeeTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.name) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[313 /* SyntaxKind.JSDocNameReference */] = function forEachChildInJSDocNameReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[314 /* SyntaxKind.JSDocMemberName */] = function forEachChildInJSDocMemberName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + }, + _a[343 /* SyntaxKind.JSDocParameterTag */] = forEachChildInJSDocParameterOrPropertyTag, + _a[350 /* SyntaxKind.JSDocPropertyTag */] = forEachChildInJSDocParameterOrPropertyTag, + _a[333 /* SyntaxKind.JSDocAuthorTag */] = function forEachChildInJSDocAuthorTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[332 /* SyntaxKind.JSDocImplementsTag */] = function forEachChildInJSDocImplementsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.class) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[331 /* SyntaxKind.JSDocAugmentsTag */] = function forEachChildInJSDocAugmentsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.class) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[347 /* SyntaxKind.JSDocTemplateTag */] = function forEachChildInJSDocTemplateTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.constraint) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[348 /* SyntaxKind.JSDocTypedefTag */] = function forEachChildInJSDocTypedefTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (node.typeExpression && + node.typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */ + ? visitNode(cbNode, node.typeExpression) || + visitNode(cbNode, node.fullName) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) + : visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); + }, + _a[341 /* SyntaxKind.JSDocCallbackTag */] = function forEachChildInJSDocCallbackTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[344 /* SyntaxKind.JSDocReturnTag */] = forEachChildInJSDocReturnTag, + _a[346 /* SyntaxKind.JSDocTypeTag */] = forEachChildInJSDocReturnTag, + _a[345 /* SyntaxKind.JSDocThisTag */] = forEachChildInJSDocReturnTag, + _a[342 /* SyntaxKind.JSDocEnumTag */] = forEachChildInJSDocReturnTag, + _a[326 /* SyntaxKind.JSDocSignature */] = function forEachChildInJSDocSignature(node, cbNode, _cbNodes) { + return ts.forEach(node.typeParameters, cbNode) || + ts.forEach(node.parameters, cbNode) || + visitNode(cbNode, node.type); + }, + _a[327 /* SyntaxKind.JSDocLink */] = forEachChildInJSDocLinkCodeOrPlain, + _a[328 /* SyntaxKind.JSDocLinkCode */] = forEachChildInJSDocLinkCodeOrPlain, + _a[329 /* SyntaxKind.JSDocLinkPlain */] = forEachChildInJSDocLinkCodeOrPlain, + _a[325 /* SyntaxKind.JSDocTypeLiteral */] = function forEachChildInJSDocTypeLiteral(node, cbNode, _cbNodes) { + return ts.forEach(node.jsDocPropertyTags, cbNode); + }, + _a[330 /* SyntaxKind.JSDocTag */] = forEachChildInJSDocTag, + _a[335 /* SyntaxKind.JSDocClassTag */] = forEachChildInJSDocTag, + _a[336 /* SyntaxKind.JSDocPublicTag */] = forEachChildInJSDocTag, + _a[337 /* SyntaxKind.JSDocPrivateTag */] = forEachChildInJSDocTag, + _a[338 /* SyntaxKind.JSDocProtectedTag */] = forEachChildInJSDocTag, + _a[339 /* SyntaxKind.JSDocReadonlyTag */] = forEachChildInJSDocTag, + _a[334 /* SyntaxKind.JSDocDeprecatedTag */] = forEachChildInJSDocTag, + _a[340 /* SyntaxKind.JSDocOverrideTag */] = forEachChildInJSDocTag, + _a[353 /* SyntaxKind.PartiallyEmittedExpression */] = forEachChildInPartiallyEmittedExpression, + _a); + // shared + function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + } + function forEachChildInUnionOrIntersectionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + } + function forEachChildInParenthesizedTypeOrTypeOperator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInObjectOrArrayBindingPattern(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInCallOrNewExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + // TODO: should we separate these branches out? + visitNode(cbNode, node.questionDotToken) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNodes(cbNode, cbNodes, node.arguments); + } + function forEachChildInBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + } + function forEachChildInContinueOrBreakStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label); + } + function forEachChildInClassDeclarationOrExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); + } + function forEachChildInNamedImportsOrExports(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInImportOrExportSpecifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name); + } + function forEachChildInJsxOpeningOrSelfClosingElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNode(cbNode, node.attributes); + } + function forEachChildInOptionalRestOrJSDocParameterModifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInJSDocParameterOrPropertyTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (node.isNameFirst + ? visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression) + : visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name)) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocReturnTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocLinkCodeOrPlain(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + } + function forEachChildInJSDocTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) + || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInPartiallyEmittedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + } /** * Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes * stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise, @@ -31150,562 +31936,11 @@ var ts; * that they appear in the source code. The language service depends on this property to locate nodes by position. */ function forEachChild(node, cbNode, cbNodes) { - if (!node || node.kind <= 160 /* SyntaxKind.LastToken */) { + if (node === undefined || node.kind <= 162 /* SyntaxKind.LastToken */) { return; } - switch (node.kind) { - case 161 /* SyntaxKind.QualifiedName */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); - case 163 /* SyntaxKind.TypeParameter */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.constraint) || - visitNode(cbNode, node.default) || - visitNode(cbNode, node.expression); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.equalsToken) || - visitNode(cbNode, node.objectAssignmentInitializer); - case 298 /* SyntaxKind.SpreadAssignment */: - return visitNode(cbNode, node.expression); - case 164 /* SyntaxKind.Parameter */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 166 /* SyntaxKind.PropertySignature */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 296 /* SyntaxKind.PropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.initializer); - case 254 /* SyntaxKind.VariableDeclaration */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 203 /* SyntaxKind.BindingElement */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 176 /* SyntaxKind.IndexSignature */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 180 /* SyntaxKind.ConstructorType */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 179 /* SyntaxKind.FunctionType */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - return visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 169 /* SyntaxKind.MethodDeclaration */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 168 /* SyntaxKind.MethodSignature */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 171 /* SyntaxKind.Constructor */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 172 /* SyntaxKind.GetAccessor */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 173 /* SyntaxKind.SetAccessor */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 256 /* SyntaxKind.FunctionDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 213 /* SyntaxKind.FunctionExpression */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 214 /* SyntaxKind.ArrowFunction */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.equalsGreaterThanToken) || - visitNode(cbNode, node.body); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.body); - case 178 /* SyntaxKind.TypeReference */: - return visitNode(cbNode, node.typeName) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 177 /* SyntaxKind.TypePredicate */: - return visitNode(cbNode, node.assertsModifier) || - visitNode(cbNode, node.parameterName) || - visitNode(cbNode, node.type); - case 181 /* SyntaxKind.TypeQuery */: - return visitNode(cbNode, node.exprName) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 182 /* SyntaxKind.TypeLiteral */: - return visitNodes(cbNode, cbNodes, node.members); - case 183 /* SyntaxKind.ArrayType */: - return visitNode(cbNode, node.elementType); - case 184 /* SyntaxKind.TupleType */: - return visitNodes(cbNode, cbNodes, node.elements); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - return visitNodes(cbNode, cbNodes, node.types); - case 189 /* SyntaxKind.ConditionalType */: - return visitNode(cbNode, node.checkType) || - visitNode(cbNode, node.extendsType) || - visitNode(cbNode, node.trueType) || - visitNode(cbNode, node.falseType); - case 190 /* SyntaxKind.InferType */: - return visitNode(cbNode, node.typeParameter); - case 200 /* SyntaxKind.ImportType */: - return visitNode(cbNode, node.argument) || - visitNode(cbNode, node.assertions) || - visitNode(cbNode, node.qualifier) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 295 /* SyntaxKind.ImportTypeAssertionContainer */: - return visitNode(cbNode, node.assertClause); - case 191 /* SyntaxKind.ParenthesizedType */: - case 193 /* SyntaxKind.TypeOperator */: - return visitNode(cbNode, node.type); - case 194 /* SyntaxKind.IndexedAccessType */: - return visitNode(cbNode, node.objectType) || - visitNode(cbNode, node.indexType); - case 195 /* SyntaxKind.MappedType */: - return visitNode(cbNode, node.readonlyToken) || - visitNode(cbNode, node.typeParameter) || - visitNode(cbNode, node.nameType) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNodes(cbNode, cbNodes, node.members); - case 196 /* SyntaxKind.LiteralType */: - return visitNode(cbNode, node.literal); - case 197 /* SyntaxKind.NamedTupleMember */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - return visitNodes(cbNode, cbNodes, node.elements); - case 204 /* SyntaxKind.ArrayLiteralExpression */: - return visitNodes(cbNode, cbNodes, node.elements); - case 205 /* SyntaxKind.ObjectLiteralExpression */: - return visitNodes(cbNode, cbNodes, node.properties); - case 206 /* SyntaxKind.PropertyAccessExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNode(cbNode, node.name); - case 207 /* SyntaxKind.ElementAccessExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNode(cbNode, node.argumentExpression); - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNodes(cbNode, cbNodes, node.arguments); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - return visitNode(cbNode, node.tag) || - visitNode(cbNode, node.questionDotToken) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNode(cbNode, node.template); - case 211 /* SyntaxKind.TypeAssertionExpression */: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.expression); - case 212 /* SyntaxKind.ParenthesizedExpression */: - return visitNode(cbNode, node.expression); - case 215 /* SyntaxKind.DeleteExpression */: - return visitNode(cbNode, node.expression); - case 216 /* SyntaxKind.TypeOfExpression */: - return visitNode(cbNode, node.expression); - case 217 /* SyntaxKind.VoidExpression */: - return visitNode(cbNode, node.expression); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - return visitNode(cbNode, node.operand); - case 224 /* SyntaxKind.YieldExpression */: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); - case 218 /* SyntaxKind.AwaitExpression */: - return visitNode(cbNode, node.expression); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - return visitNode(cbNode, node.operand); - case 221 /* SyntaxKind.BinaryExpression */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.operatorToken) || - visitNode(cbNode, node.right); - case 229 /* SyntaxKind.AsExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.type); - case 230 /* SyntaxKind.NonNullExpression */: - return visitNode(cbNode, node.expression); - case 231 /* SyntaxKind.MetaProperty */: - return visitNode(cbNode, node.name); - case 222 /* SyntaxKind.ConditionalExpression */: - return visitNode(cbNode, node.condition) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.whenTrue) || - visitNode(cbNode, node.colonToken) || - visitNode(cbNode, node.whenFalse); - case 225 /* SyntaxKind.SpreadElement */: - return visitNode(cbNode, node.expression); - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - return visitNodes(cbNode, cbNodes, node.statements); - case 305 /* SyntaxKind.SourceFile */: - return visitNodes(cbNode, cbNodes, node.statements) || - visitNode(cbNode, node.endOfFileToken); - case 237 /* SyntaxKind.VariableStatement */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.declarationList); - case 255 /* SyntaxKind.VariableDeclarationList */: - return visitNodes(cbNode, cbNodes, node.declarations); - case 238 /* SyntaxKind.ExpressionStatement */: - return visitNode(cbNode, node.expression); - case 239 /* SyntaxKind.IfStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.thenStatement) || - visitNode(cbNode, node.elseStatement); - case 240 /* SyntaxKind.DoStatement */: - return visitNode(cbNode, node.statement) || - visitNode(cbNode, node.expression); - case 241 /* SyntaxKind.WhileStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 242 /* SyntaxKind.ForStatement */: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.condition) || - visitNode(cbNode, node.incrementor) || - visitNode(cbNode, node.statement); - case 243 /* SyntaxKind.ForInStatement */: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 244 /* SyntaxKind.ForOfStatement */: - return visitNode(cbNode, node.awaitModifier) || - visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: - return visitNode(cbNode, node.label); - case 247 /* SyntaxKind.ReturnStatement */: - return visitNode(cbNode, node.expression); - case 248 /* SyntaxKind.WithStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 249 /* SyntaxKind.SwitchStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.caseBlock); - case 263 /* SyntaxKind.CaseBlock */: - return visitNodes(cbNode, cbNodes, node.clauses); - case 289 /* SyntaxKind.CaseClause */: - return visitNode(cbNode, node.expression) || - visitNodes(cbNode, cbNodes, node.statements); - case 290 /* SyntaxKind.DefaultClause */: - return visitNodes(cbNode, cbNodes, node.statements); - case 250 /* SyntaxKind.LabeledStatement */: - return visitNode(cbNode, node.label) || - visitNode(cbNode, node.statement); - case 251 /* SyntaxKind.ThrowStatement */: - return visitNode(cbNode, node.expression); - case 252 /* SyntaxKind.TryStatement */: - return visitNode(cbNode, node.tryBlock) || - visitNode(cbNode, node.catchClause) || - visitNode(cbNode, node.finallyBlock); - case 292 /* SyntaxKind.CatchClause */: - return visitNode(cbNode, node.variableDeclaration) || - visitNode(cbNode, node.block); - case 165 /* SyntaxKind.Decorator */: - return visitNode(cbNode, node.expression); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.heritageClauses) || - visitNodes(cbNode, cbNodes, node.members); - case 258 /* SyntaxKind.InterfaceDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.heritageClauses) || - visitNodes(cbNode, cbNodes, node.members); - case 259 /* SyntaxKind.TypeAliasDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNode(cbNode, node.type); - case 260 /* SyntaxKind.EnumDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.members); - case 299 /* SyntaxKind.EnumMember */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 261 /* SyntaxKind.ModuleDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.body); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.moduleReference); - case 266 /* SyntaxKind.ImportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.importClause) || - visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); - case 267 /* SyntaxKind.ImportClause */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.namedBindings); - case 293 /* SyntaxKind.AssertClause */: - return visitNodes(cbNode, cbNodes, node.elements); - case 294 /* SyntaxKind.AssertEntry */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.value); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNode(cbNode, node.name); - case 268 /* SyntaxKind.NamespaceImport */: - return visitNode(cbNode, node.name); - case 274 /* SyntaxKind.NamespaceExport */: - return visitNode(cbNode, node.name); - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: - return visitNodes(cbNode, cbNodes, node.elements); - case 272 /* SyntaxKind.ExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.exportClause) || - visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: - return visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name); - case 271 /* SyntaxKind.ExportAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.expression); - case 223 /* SyntaxKind.TemplateExpression */: - return visitNode(cbNode, node.head) || - visitNodes(cbNode, cbNodes, node.templateSpans); - case 233 /* SyntaxKind.TemplateSpan */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.literal); - case 198 /* SyntaxKind.TemplateLiteralType */: - return visitNode(cbNode, node.head) || - visitNodes(cbNode, cbNodes, node.templateSpans); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.literal); - case 162 /* SyntaxKind.ComputedPropertyName */: - return visitNode(cbNode, node.expression); - case 291 /* SyntaxKind.HeritageClause */: - return visitNodes(cbNode, cbNodes, node.types); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - return visitNode(cbNode, node.expression) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 277 /* SyntaxKind.ExternalModuleReference */: - return visitNode(cbNode, node.expression); - case 276 /* SyntaxKind.MissingDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers); - case 351 /* SyntaxKind.CommaListExpression */: - return visitNodes(cbNode, cbNodes, node.elements); - case 278 /* SyntaxKind.JsxElement */: - return visitNode(cbNode, node.openingElement) || - visitNodes(cbNode, cbNodes, node.children) || - visitNode(cbNode, node.closingElement); - case 282 /* SyntaxKind.JsxFragment */: - return visitNode(cbNode, node.openingFragment) || - visitNodes(cbNode, cbNodes, node.children) || - visitNode(cbNode, node.closingFragment); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - return visitNode(cbNode, node.tagName) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNode(cbNode, node.attributes); - case 286 /* SyntaxKind.JsxAttributes */: - return visitNodes(cbNode, cbNodes, node.properties); - case 285 /* SyntaxKind.JsxAttribute */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 287 /* SyntaxKind.JsxSpreadAttribute */: - return visitNode(cbNode, node.expression); - case 288 /* SyntaxKind.JsxExpression */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.expression); - case 281 /* SyntaxKind.JsxClosingElement */: - return visitNode(cbNode, node.tagName); - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 316 /* SyntaxKind.JSDocOptionalType */: - case 318 /* SyntaxKind.JSDocVariadicType */: - return visitNode(cbNode, node.type); - case 317 /* SyntaxKind.JSDocFunctionType */: - return visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 320 /* SyntaxKind.JSDoc */: - return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - || visitNodes(cbNode, cbNodes, node.tags); - case 346 /* SyntaxKind.JSDocSeeTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.name) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 310 /* SyntaxKind.JSDocNameReference */: - return visitNode(cbNode, node.name); - case 311 /* SyntaxKind.JSDocMemberName */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - return visitNode(cbNode, node.tagName) || - (node.isNameFirst - ? visitNode(cbNode, node.name) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - : visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.name) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); - case 330 /* SyntaxKind.JSDocAuthorTag */: - return visitNode(cbNode, node.tagName) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 329 /* SyntaxKind.JSDocImplementsTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.class) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 328 /* SyntaxKind.JSDocAugmentsTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.class) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 344 /* SyntaxKind.JSDocTemplateTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.constraint) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 345 /* SyntaxKind.JSDocTypedefTag */: - return visitNode(cbNode, node.tagName) || - (node.typeExpression && - node.typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */ - ? visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.fullName) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - : visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); - case 338 /* SyntaxKind.JSDocCallbackTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 341 /* SyntaxKind.JSDocReturnTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: - case 342 /* SyntaxKind.JSDocThisTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 323 /* SyntaxKind.JSDocSignature */: - return ts.forEach(node.typeParameters, cbNode) || - ts.forEach(node.parameters, cbNode) || - visitNode(cbNode, node.type); - case 324 /* SyntaxKind.JSDocLink */: - case 325 /* SyntaxKind.JSDocLinkCode */: - case 326 /* SyntaxKind.JSDocLinkPlain */: - return visitNode(cbNode, node.name); - case 322 /* SyntaxKind.JSDocTypeLiteral */: - return ts.forEach(node.jsDocPropertyTags, cbNode); - case 327 /* SyntaxKind.JSDocTag */: - case 332 /* SyntaxKind.JSDocClassTag */: - case 333 /* SyntaxKind.JSDocPublicTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 336 /* SyntaxKind.JSDocReadonlyTag */: - case 331 /* SyntaxKind.JSDocDeprecatedTag */: - return visitNode(cbNode, node.tagName) - || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - return visitNode(cbNode, node.expression); - } + var fn = forEachChildTable[node.kind]; + return fn === undefined ? undefined : fn(node, cbNode, cbNodes); } ts.forEachChild = forEachChild; /** @internal */ @@ -31752,7 +31987,7 @@ var ts; continue; return res; } - if (current.kind >= 161 /* SyntaxKind.FirstNode */) { + if (current.kind >= 163 /* SyntaxKind.FirstNode */) { // add children in reverse order to the queue, so popping gives the first child for (var _i = 0, _a = gatherPossibleChildren(current); _i < _a.length; _i++) { var child = _a[_i]; @@ -32577,7 +32812,7 @@ var ts; } // If we have a 'await' keyword, and we're in the [Await] context, then 'await' is // considered a keyword and is not an identifier. - if (token() === 132 /* SyntaxKind.AwaitKeyword */ && inAwaitContext()) { + if (token() === 133 /* SyntaxKind.AwaitKeyword */ && inAwaitContext()) { return false; } return token() > 116 /* SyntaxKind.LastReservedWord */; @@ -32823,7 +33058,7 @@ var ts; ts.isTemplateLiteralKind(kind) ? factory.createTemplateLiteralLikeNode(kind, "", "", /*templateFlags*/ undefined) : kind === 8 /* SyntaxKind.NumericLiteral */ ? factory.createNumericLiteral("", /*numericLiteralFlags*/ undefined) : kind === 10 /* SyntaxKind.StringLiteral */ ? factory.createStringLiteral("", /*isSingleQuote*/ undefined) : - kind === 276 /* SyntaxKind.MissingDeclaration */ ? factory.createMissingDeclaration() : + kind === 279 /* SyntaxKind.MissingDeclaration */ ? factory.createMissingDeclaration() : factory.createToken(kind); return finishNode(result, pos); } @@ -32922,7 +33157,7 @@ var ts; } function parsePrivateIdentifier() { var pos = getNodePos(); - var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenText())); + var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenValue())); nextToken(); return finishNode(node, pos); } @@ -32946,15 +33181,16 @@ var ts; if (token() === 88 /* SyntaxKind.DefaultKeyword */) { return lookAhead(nextTokenCanFollowDefaultKeyword); } - if (token() === 152 /* SyntaxKind.TypeKeyword */) { + if (token() === 154 /* SyntaxKind.TypeKeyword */) { return lookAhead(nextTokenCanFollowExportModifier); } return canFollowExportModifier(); case 88 /* SyntaxKind.DefaultKeyword */: return nextTokenCanFollowDefaultKeyword(); + case 127 /* SyntaxKind.AccessorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: nextToken(); return canFollowModifier(); default: @@ -32963,7 +33199,7 @@ var ts; } function canFollowExportModifier() { return token() !== 41 /* SyntaxKind.AsteriskToken */ - && token() !== 127 /* SyntaxKind.AsKeyword */ + && token() !== 128 /* SyntaxKind.AsKeyword */ && token() !== 18 /* SyntaxKind.OpenBraceToken */ && canFollowModifier(); } @@ -32986,7 +33222,7 @@ var ts; return token() === 84 /* SyntaxKind.ClassKeyword */ || token() === 98 /* SyntaxKind.FunctionKeyword */ || token() === 118 /* SyntaxKind.InterfaceKeyword */ || (token() === 126 /* SyntaxKind.AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine)) || - (token() === 131 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); + (token() === 132 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); } // True if positioned at the start of a list element function isListElement(parsingContext, inErrorRecovery) { @@ -33366,20 +33602,20 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 176 /* SyntaxKind.IndexSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 234 /* SyntaxKind.SemicolonClassElement */: + case 173 /* SyntaxKind.Constructor */: + case 178 /* SyntaxKind.IndexSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 237 /* SyntaxKind.SemicolonClassElement */: return true; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // Method declarations are not necessarily reusable. An object-literal // may have a method calls "constructor(...)" and we must reparse that // into an actual .ConstructorDeclaration. var methodDeclaration = node; var nameIsConstructor = methodDeclaration.name.kind === 79 /* SyntaxKind.Identifier */ && - methodDeclaration.name.originalKeywordKind === 134 /* SyntaxKind.ConstructorKeyword */; + methodDeclaration.name.originalKeywordKind === 135 /* SyntaxKind.ConstructorKeyword */; return !nameIsConstructor; } } @@ -33388,8 +33624,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: return true; } } @@ -33398,58 +33634,58 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 235 /* SyntaxKind.Block */: - case 239 /* SyntaxKind.IfStatement */: - case 238 /* SyntaxKind.ExpressionStatement */: - case 251 /* SyntaxKind.ThrowStatement */: - case 247 /* SyntaxKind.ReturnStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 236 /* SyntaxKind.EmptyStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 250 /* SyntaxKind.LabeledStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 253 /* SyntaxKind.DebuggerStatement */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 238 /* SyntaxKind.Block */: + case 242 /* SyntaxKind.IfStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 254 /* SyntaxKind.ThrowStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 239 /* SyntaxKind.EmptyStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 253 /* SyntaxKind.LabeledStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 299 /* SyntaxKind.EnumMember */; + return node.kind === 302 /* SyntaxKind.EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 166 /* SyntaxKind.PropertySignature */: - case 174 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 168 /* SyntaxKind.PropertySignature */: + case 176 /* SyntaxKind.CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 254 /* SyntaxKind.VariableDeclaration */) { + if (node.kind !== 257 /* SyntaxKind.VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -33470,7 +33706,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 164 /* SyntaxKind.Parameter */) { + if (node.kind !== 166 /* SyntaxKind.Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -33763,14 +33999,14 @@ var ts; // If true, we should abort parsing an error function. function typeHasArrowFunctionBlockingParseError(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return ts.nodeIsMissing(node.typeName); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: { + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: { var _a = node, parameters = _a.parameters, type = _a.type; return isMissingList(parameters) || typeHasArrowFunctionBlockingParseError(type); } - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return typeHasArrowFunctionBlockingParseError(node.type); default: return false; @@ -33849,7 +34085,7 @@ var ts; function parseJSDocType() { scanner.setInJSDocType(true); var pos = getNodePos(); - if (parseOptional(141 /* SyntaxKind.ModuleKeyword */)) { + if (parseOptional(142 /* SyntaxKind.ModuleKeyword */)) { // TODO(rbuckton): We never set the type for a JSDocNamepathType. What should we put here? var moduleTag = factory.createJSDocNamepathType(/*type*/ undefined); terminate: while (true) { @@ -34065,14 +34301,14 @@ var ts; function parseSignatureMember(kind) { var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); - if (kind === 175 /* SyntaxKind.ConstructSignature */) { + if (kind === 177 /* SyntaxKind.ConstructSignature */) { parseExpected(103 /* SyntaxKind.NewKeyword */); } var typeParameters = parseTypeParameters(); var parameters = parseParameters(4 /* SignatureFlags.Type */); var type = parseReturnType(58 /* SyntaxKind.ColonToken */, /*isType*/ true); parseTypeMemberSemicolon(); - var node = kind === 174 /* SyntaxKind.CallSignature */ + var node = kind === 176 /* SyntaxKind.CallSignature */ ? factory.createCallSignature(typeParameters, parameters, type) : factory.createConstructSignature(typeParameters, parameters, type); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -34166,8 +34402,8 @@ var ts; // Return true if we have the start of a signature member if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || - token() === 136 /* SyntaxKind.GetKeyword */ || - token() === 149 /* SyntaxKind.SetKeyword */) { + token() === 137 /* SyntaxKind.GetKeyword */ || + token() === 151 /* SyntaxKind.SetKeyword */) { return true; } var idToken = false; @@ -34199,19 +34435,19 @@ var ts; } function parseTypeMember() { if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */) { - return parseSignatureMember(174 /* SyntaxKind.CallSignature */); + return parseSignatureMember(176 /* SyntaxKind.CallSignature */); } if (token() === 103 /* SyntaxKind.NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) { - return parseSignatureMember(175 /* SyntaxKind.ConstructSignature */); + return parseSignatureMember(177 /* SyntaxKind.ConstructSignature */); } var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); var modifiers = parseModifiers(); - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 172 /* SyntaxKind.GetAccessor */, 4 /* SignatureFlags.Type */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 174 /* SyntaxKind.GetAccessor */, 4 /* SignatureFlags.Type */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 173 /* SyntaxKind.SetAccessor */, 4 /* SignatureFlags.Type */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 175 /* SyntaxKind.SetAccessor */, 4 /* SignatureFlags.Type */); } if (isIndexSignature()) { return parseIndexSignatureDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers); @@ -34252,9 +34488,9 @@ var ts; function isStartOfMappedType() { nextToken(); if (token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { - return nextToken() === 145 /* SyntaxKind.ReadonlyKeyword */; + return nextToken() === 146 /* SyntaxKind.ReadonlyKeyword */; } - if (token() === 145 /* SyntaxKind.ReadonlyKeyword */) { + if (token() === 146 /* SyntaxKind.ReadonlyKeyword */) { nextToken(); } return token() === 22 /* SyntaxKind.OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 101 /* SyntaxKind.InKeyword */; @@ -34270,15 +34506,15 @@ var ts; var pos = getNodePos(); parseExpected(18 /* SyntaxKind.OpenBraceToken */); var readonlyToken; - if (token() === 145 /* SyntaxKind.ReadonlyKeyword */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { + if (token() === 146 /* SyntaxKind.ReadonlyKeyword */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { readonlyToken = parseTokenNode(); - if (readonlyToken.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { - parseExpected(145 /* SyntaxKind.ReadonlyKeyword */); + if (readonlyToken.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { + parseExpected(146 /* SyntaxKind.ReadonlyKeyword */); } } parseExpected(22 /* SyntaxKind.OpenBracketToken */); var typeParameter = parseMappedTypeParameter(); - var nameType = parseOptional(127 /* SyntaxKind.AsKeyword */) ? parseType() : undefined; + var nameType = parseOptional(128 /* SyntaxKind.AsKeyword */) ? parseType() : undefined; parseExpected(23 /* SyntaxKind.CloseBracketToken */); var questionToken; if (token() === 57 /* SyntaxKind.QuestionToken */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { @@ -34392,7 +34628,7 @@ var ts; var openBracePosition = scanner.getTokenPos(); parseExpected(18 /* SyntaxKind.OpenBraceToken */); var multiLine = scanner.hasPrecedingLineBreak(); - parseExpected(129 /* SyntaxKind.AssertKeyword */); + parseExpected(130 /* SyntaxKind.AssertKeyword */); parseExpected(58 /* SyntaxKind.ColonToken */); var clause = parseAssertClause(/*skipAssertKeyword*/ true); if (!parseExpected(19 /* SyntaxKind.CloseBraceToken */)) { @@ -34425,16 +34661,16 @@ var ts; } function parseNonArrayType() { switch (token()) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: // If these are followed by a dot, then parse these out as a dotted type reference instead. return tryParse(parseKeywordAndNoDot) || parseTypeReference(); case 66 /* SyntaxKind.AsteriskEqualsToken */: @@ -34467,7 +34703,7 @@ var ts; return parseTokenNode(); case 108 /* SyntaxKind.ThisKeyword */: { var thisKeyword = parseThisTypeNode(); - if (token() === 139 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 140 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { return parseThisTypePredicate(thisKeyword); } else { @@ -34484,7 +34720,7 @@ var ts; return parseParenthesizedType(); case 100 /* SyntaxKind.ImportKeyword */: return parseImportType(); - case 128 /* SyntaxKind.AssertsKeyword */: + case 129 /* SyntaxKind.AssertsKeyword */: return lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine) ? parseAssertsTypePredicate() : parseTypeReference(); case 15 /* SyntaxKind.TemplateHead */: return parseTemplateType(); @@ -34494,21 +34730,21 @@ var ts; } function isStartOfType(inStartOfParameter) { switch (token()) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 108 /* SyntaxKind.ThisKeyword */: case 112 /* SyntaxKind.TypeOfKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: case 18 /* SyntaxKind.OpenBraceToken */: case 22 /* SyntaxKind.OpenBracketToken */: case 29 /* SyntaxKind.LessThanToken */: @@ -34520,14 +34756,14 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 41 /* SyntaxKind.AsteriskToken */: case 57 /* SyntaxKind.QuestionToken */: case 53 /* SyntaxKind.ExclamationToken */: case 25 /* SyntaxKind.DotDotDotToken */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: case 100 /* SyntaxKind.ImportKeyword */: - case 128 /* SyntaxKind.AssertsKeyword */: + case 129 /* SyntaxKind.AssertsKeyword */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 15 /* SyntaxKind.TemplateHead */: return true; @@ -34604,17 +34840,17 @@ var ts; } function parseInferType() { var pos = getNodePos(); - parseExpected(137 /* SyntaxKind.InferKeyword */); + parseExpected(138 /* SyntaxKind.InferKeyword */); return finishNode(factory.createInferTypeNode(parseTypeParameterOfInferType()), pos); } function parseTypeOperatorOrHigher() { var operator = token(); switch (operator) { - case 140 /* SyntaxKind.KeyOfKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: return parseTypeOperator(operator); - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: return parseInferType(); } return allowConditionalTypesAnd(parsePostfixTypeOrHigher); @@ -34734,16 +34970,16 @@ var ts; } function parseTypePredicatePrefix() { var id = parseIdentifier(); - if (token() === 139 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 140 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { nextToken(); return id; } } function parseAssertsTypePredicate() { var pos = getNodePos(); - var assertsModifier = parseExpectedToken(128 /* SyntaxKind.AssertsKeyword */); + var assertsModifier = parseExpectedToken(129 /* SyntaxKind.AssertsKeyword */); var parameterName = token() === 108 /* SyntaxKind.ThisKeyword */ ? parseThisTypeNode() : parseIdentifier(); - var type = parseOptional(139 /* SyntaxKind.IsKeyword */) ? parseType() : undefined; + var type = parseOptional(140 /* SyntaxKind.IsKeyword */) ? parseType() : undefined; return finishNode(factory.createTypePredicateNode(assertsModifier, parameterName, type), pos); } function parseType() { @@ -34813,7 +35049,7 @@ var ts; case 45 /* SyntaxKind.PlusPlusToken */: case 46 /* SyntaxKind.MinusMinusToken */: case 29 /* SyntaxKind.LessThanToken */: - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: case 125 /* SyntaxKind.YieldKeyword */: case 80 /* SyntaxKind.PrivateIdentifier */: // Yield/await always starts an expression. Either it is an identifier (in which case @@ -35001,7 +35237,7 @@ var ts; // Unknown -> There *might* be a parenthesized arrow function here. // Speculatively look ahead to be sure, and rollback if not. function isParenthesizedArrowFunctionExpression() { - if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || token() === 132 /* SyntaxKind.AsyncKeyword */) { return lookAhead(isParenthesizedArrowFunctionExpressionWorker); } if (token() === 38 /* SyntaxKind.EqualsGreaterThanToken */) { @@ -35014,7 +35250,7 @@ var ts; return 0 /* Tristate.False */; } function isParenthesizedArrowFunctionExpressionWorker() { - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { nextToken(); if (scanner.hasPrecedingLineBreak()) { return 0 /* Tristate.False */; @@ -35058,8 +35294,8 @@ var ts; // Check for "(xxx yyy", where xxx is a modifier and yyy is an identifier. This // isn't actually allowed, but we want to treat it as a lambda so we can provide // a good error message. - if (ts.isModifierKind(second) && second !== 131 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) { - if (nextToken() === 127 /* SyntaxKind.AsKeyword */) { + if (ts.isModifierKind(second) && second !== 132 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) { + if (nextToken() === 128 /* SyntaxKind.AsKeyword */) { // https://github.com/microsoft/TypeScript/issues/44466 return 0 /* Tristate.False */; } @@ -35141,7 +35377,7 @@ var ts; } function tryParseAsyncSimpleArrowFunctionExpression(allowReturnTypeInArrowFunction) { // We do a check here so that we won't be doing unnecessarily call to "lookAhead" - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* Tristate.True */) { var pos = getNodePos(); var asyncModifier = parseModifiersForArrowFunction(); @@ -35155,7 +35391,7 @@ var ts; // AsyncArrowFunctionExpression: // 1) async[no LineTerminator here]AsyncArrowBindingIdentifier[?Yield][no LineTerminator here]=>AsyncConciseBody[?In] // 2) CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In] - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { nextToken(); // If the "async" is followed by "=>" token then it is not a beginning of an async arrow-function // but instead a simple arrow-function which will be parsed inside "parseAssignmentExpressionOrHigher" @@ -35221,7 +35457,7 @@ var ts; // // So we need just a bit of lookahead to ensure that it can only be a signature. var unwrappedType = type; - while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 191 /* SyntaxKind.ParenthesizedType */) { + while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 193 /* SyntaxKind.ParenthesizedType */) { unwrappedType = unwrappedType.type; // Skip parens if need be } var hasJSDocFunctionType = unwrappedType && ts.isJSDocFunctionType(unwrappedType); @@ -35316,7 +35552,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand, pos); } function isInOrOfKeyword(t) { - return t === 101 /* SyntaxKind.InKeyword */ || t === 160 /* SyntaxKind.OfKeyword */; + return t === 101 /* SyntaxKind.InKeyword */ || t === 162 /* SyntaxKind.OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand, pos) { while (true) { @@ -35354,7 +35590,7 @@ var ts; if (token() === 101 /* SyntaxKind.InKeyword */ && inDisallowInContext()) { break; } - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */ || token() === 150 /* SyntaxKind.SatisfiesKeyword */) { // Make sure we *do* perform ASI for constructs like this: // var x = foo // as (Bar) @@ -35364,8 +35600,10 @@ var ts; break; } else { + var keywordKind = token(); nextToken(); - leftOperand = makeAsExpression(leftOperand, parseType()); + leftOperand = keywordKind === 150 /* SyntaxKind.SatisfiesKeyword */ ? makeSatisfiesExpression(leftOperand, parseType()) : + makeAsExpression(leftOperand, parseType()); } } else { @@ -35380,6 +35618,9 @@ var ts; } return ts.getBinaryOperatorPrecedence(token()) > 0; } + function makeSatisfiesExpression(left, right) { + return finishNode(factory.createSatisfiesExpression(left, right), left.pos); + } function makeBinaryExpression(left, operatorToken, right, pos) { return finishNode(factory.createBinaryExpression(left, operatorToken, right), pos); } @@ -35403,7 +35644,7 @@ var ts; return finishNode(factory.createVoidExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos); } function isAwaitExpression() { - if (token() === 132 /* SyntaxKind.AwaitKeyword */) { + if (token() === 133 /* SyntaxKind.AwaitKeyword */) { if (inAwaitContext()) { return true; } @@ -35456,7 +35697,7 @@ var ts; if (token() === 42 /* SyntaxKind.AsteriskAsteriskToken */) { var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); var end = simpleUnaryExpression.end; - if (simpleUnaryExpression.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (simpleUnaryExpression.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { parseErrorAt(pos, end, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { @@ -35497,7 +35738,7 @@ var ts; // UnaryExpression (modified): // < type > UnaryExpression return parseTypeAssertion(); - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: if (isAwaitExpression()) { return parseAwaitExpression(); } @@ -35527,7 +35768,7 @@ var ts; case 89 /* SyntaxKind.DeleteKeyword */: case 112 /* SyntaxKind.TypeOfKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: return false; case 29 /* SyntaxKind.LessThanToken */: // If we are not in JSX context, we are parsing TypeAssertion which is an UnaryExpression @@ -35710,11 +35951,11 @@ var ts; var pos = getNodePos(); var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); var result; - if (opening.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (opening.kind === 283 /* SyntaxKind.JsxOpeningElement */) { var children = parseJsxChildren(opening); var closingElement = void 0; var lastChild = children[children.length - 1]; - if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 278 /* SyntaxKind.JsxElement */ + if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 281 /* SyntaxKind.JsxElement */ && !tagNamesAreEquivalent(lastChild.openingElement.tagName, lastChild.closingElement.tagName) && tagNamesAreEquivalent(opening.tagName, lastChild.closingElement.tagName)) { // when an unclosed JsxOpeningElement incorrectly parses its parent's JsxClosingElement, @@ -35740,11 +35981,11 @@ var ts; } result = finishNode(factory.createJsxElement(opening, children, closingElement), pos); } - else if (opening.kind === 283 /* SyntaxKind.JsxOpeningFragment */) { + else if (opening.kind === 286 /* SyntaxKind.JsxOpeningFragment */) { result = finishNode(factory.createJsxFragment(opening, parseJsxChildren(opening), parseJsxClosingFragment(inExpressionContext)), pos); } else { - ts.Debug.assert(opening.kind === 279 /* SyntaxKind.JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 282 /* SyntaxKind.JsxSelfClosingElement */); // Nothing else to do for self-closing elements result = opening; } @@ -35814,7 +36055,7 @@ var ts; break; list.push(child); if (ts.isJsxOpeningElement(openingTag) - && (child === null || child === void 0 ? void 0 : child.kind) === 278 /* SyntaxKind.JsxElement */ + && (child === null || child === void 0 ? void 0 : child.kind) === 281 /* SyntaxKind.JsxElement */ && !tagNamesAreEquivalent(child.openingElement.tagName, child.closingElement.tagName) && tagNamesAreEquivalent(openingTag.tagName, child.closingElement.tagName)) { // stop after parsing a mismatched child like
...(
) in order to reattach the
higher @@ -36059,7 +36300,7 @@ var ts; } if (isTemplateStartOfTaggedTemplate()) { // Absorb type arguments into TemplateExpression when preceding expression is ExpressionWithTypeArguments - expression = !questionDotToken && expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ ? + expression = !questionDotToken && expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ ? parseTaggedTemplateRest(pos, expression.expression, questionDotToken, expression.typeArguments) : parseTaggedTemplateRest(pos, expression, questionDotToken, /*typeArguments*/ undefined); continue; @@ -36106,7 +36347,7 @@ var ts; } if (typeArguments || token() === 20 /* SyntaxKind.OpenParenToken */) { // Absorb type arguments into CallExpression when preceding expression is ExpressionWithTypeArguments - if (!questionDotToken && expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (!questionDotToken && expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -36192,7 +36433,7 @@ var ts; return parseArrayLiteralExpression(); case 18 /* SyntaxKind.OpenBraceToken */: return parseObjectLiteralExpression(); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // Async arrow functions are parsed earlier in parseAssignmentExpressionOrHigher. // If we encounter `async [no LineTerminator here] function` then this is an async // function; otherwise, its an identifier. @@ -36259,11 +36500,11 @@ var ts; } var decorators = parseDecorators(); var modifiers = parseModifiers(); - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 174 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 175 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); } var asteriskToken = parseOptionalToken(41 /* SyntaxKind.AsteriskToken */); var tokenIsIdentifier = isIdentifier(); @@ -36351,7 +36592,7 @@ var ts; var expression = parseMemberExpressionRest(expressionPos, parsePrimaryExpression(), /*allowOptionalChain*/ false); var typeArguments; // Absorb type arguments into NewExpression when preceding expression is ExpressionWithTypeArguments - if (expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -36455,7 +36696,7 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(97 /* SyntaxKind.ForKeyword */); - var awaitToken = parseOptionalToken(132 /* SyntaxKind.AwaitKeyword */); + var awaitToken = parseOptionalToken(133 /* SyntaxKind.AwaitKeyword */); parseExpected(20 /* SyntaxKind.OpenParenToken */); var initializer; if (token() !== 26 /* SyntaxKind.SemicolonToken */) { @@ -36467,7 +36708,7 @@ var ts; } } var node; - if (awaitToken ? parseExpected(160 /* SyntaxKind.OfKeyword */) : parseOptional(160 /* SyntaxKind.OfKeyword */)) { + if (awaitToken ? parseExpected(162 /* SyntaxKind.OfKeyword */) : parseOptional(162 /* SyntaxKind.OfKeyword */)) { var expression = allowInAnd(function () { return parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true); }); parseExpected(21 /* SyntaxKind.CloseParenToken */); node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement()); @@ -36494,10 +36735,10 @@ var ts; function parseBreakOrContinueStatement(kind) { var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(kind === 246 /* SyntaxKind.BreakStatement */ ? 81 /* SyntaxKind.BreakKeyword */ : 86 /* SyntaxKind.ContinueKeyword */); + parseExpected(kind === 249 /* SyntaxKind.BreakStatement */ ? 81 /* SyntaxKind.BreakKeyword */ : 86 /* SyntaxKind.ContinueKeyword */); var label = canParseSemicolon() ? undefined : parseIdentifier(); parseSemicolon(); - var node = kind === 246 /* SyntaxKind.BreakStatement */ + var node = kind === 249 /* SyntaxKind.BreakStatement */ ? factory.createBreakStatement(label) : factory.createContinueStatement(label); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -36688,25 +36929,26 @@ var ts; // // could be legal, it would add complexity for very little gain. case 118 /* SyntaxKind.InterfaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: return nextTokenIsIdentifierOnSameLine(); - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); case 126 /* SyntaxKind.AbstractKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: nextToken(); // ASI takes effect for this modifier. if (scanner.hasPrecedingLineBreak()) { return false; } continue; - case 157 /* SyntaxKind.GlobalKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: nextToken(); return token() === 18 /* SyntaxKind.OpenBraceToken */ || token() === 79 /* SyntaxKind.Identifier */ || token() === 93 /* SyntaxKind.ExportKeyword */; case 100 /* SyntaxKind.ImportKeyword */: @@ -36715,12 +36957,12 @@ var ts; token() === 18 /* SyntaxKind.OpenBraceToken */ || ts.tokenIsIdentifierOrKeyword(token()); case 93 /* SyntaxKind.ExportKeyword */: var currentToken_1 = nextToken(); - if (currentToken_1 === 152 /* SyntaxKind.TypeKeyword */) { + if (currentToken_1 === 154 /* SyntaxKind.TypeKeyword */) { currentToken_1 = lookAhead(nextToken); } if (currentToken_1 === 63 /* SyntaxKind.EqualsToken */ || currentToken_1 === 41 /* SyntaxKind.AsteriskToken */ || currentToken_1 === 18 /* SyntaxKind.OpenBraceToken */ || currentToken_1 === 88 /* SyntaxKind.DefaultKeyword */ || - currentToken_1 === 127 /* SyntaxKind.AsKeyword */) { + currentToken_1 === 128 /* SyntaxKind.AsKeyword */) { return true; } continue; @@ -36768,20 +37010,21 @@ var ts; case 85 /* SyntaxKind.ConstKeyword */: case 93 /* SyntaxKind.ExportKeyword */: return isStartOfDeclaration(); - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: // When these don't start a declaration, they're an identifier in an expression statement return true; + case 127 /* SyntaxKind.AccessorKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: // When these don't start a declaration, they may be the start of a class member if an identifier // immediately follows. Otherwise they're an identifier in an expression statement. return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); @@ -36824,9 +37067,9 @@ var ts; case 97 /* SyntaxKind.ForKeyword */: return parseForOrForInOrForOfStatement(); case 86 /* SyntaxKind.ContinueKeyword */: - return parseBreakOrContinueStatement(245 /* SyntaxKind.ContinueStatement */); + return parseBreakOrContinueStatement(248 /* SyntaxKind.ContinueStatement */); case 81 /* SyntaxKind.BreakKeyword */: - return parseBreakOrContinueStatement(246 /* SyntaxKind.BreakStatement */); + return parseBreakOrContinueStatement(249 /* SyntaxKind.BreakStatement */); case 105 /* SyntaxKind.ReturnKeyword */: return parseReturnStatement(); case 116 /* SyntaxKind.WithKeyword */: @@ -36845,12 +37088,12 @@ var ts; return parseDebuggerStatement(); case 59 /* SyntaxKind.AtToken */: return parseDeclaration(); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 85 /* SyntaxKind.ConstKeyword */: case 92 /* SyntaxKind.EnumKeyword */: case 93 /* SyntaxKind.ExportKeyword */: @@ -36859,9 +37102,10 @@ var ts; case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -36870,7 +37114,7 @@ var ts; return parseExpressionOrLabeledStatement(); } function isDeclareModifier(modifier) { - return modifier.kind === 135 /* SyntaxKind.DeclareKeyword */; + return modifier.kind === 136 /* SyntaxKind.DeclareKeyword */; } function parseDeclaration() { // `parseListElement` attempted to get the reused node at this position, @@ -36916,13 +37160,13 @@ var ts; return parseClassDeclaration(pos, hasJSDoc, decorators, modifiers); case 118 /* SyntaxKind.InterfaceKeyword */: return parseInterfaceDeclaration(pos, hasJSDoc, decorators, modifiers); - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: return parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers); case 92 /* SyntaxKind.EnumKeyword */: return parseEnumDeclaration(pos, hasJSDoc, decorators, modifiers); - case 157 /* SyntaxKind.GlobalKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: return parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers); case 100 /* SyntaxKind.ImportKeyword */: return parseImportDeclarationOrImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers); @@ -36932,7 +37176,7 @@ var ts; case 88 /* SyntaxKind.DefaultKeyword */: case 63 /* SyntaxKind.EqualsToken */: return parseExportAssignment(pos, hasJSDoc, decorators, modifiers); - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: return parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers); default: return parseExportDeclaration(pos, hasJSDoc, decorators, modifiers); @@ -36941,7 +37185,7 @@ var ts; if (decorators || modifiers) { // We reached this point because we encountered decorators and/or modifiers and assumed a declaration // would follow. For recovery and error reporting purposes, return an incomplete declaration. - var missing = createMissingNode(276 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var missing = createMissingNode(279 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); ts.setTextRangePos(missing, pos); missing.illegalDecorators = decorators; missing.modifiers = modifiers; @@ -37067,7 +37311,7 @@ var ts; // this context. // The checker will then give an error that there is an empty declaration list. var declarations; - if (token() === 160 /* SyntaxKind.OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 162 /* SyntaxKind.OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { declarations = createMissingList(); } else { @@ -37095,9 +37339,9 @@ var ts; parseExpected(98 /* SyntaxKind.FunctionKeyword */); var asteriskToken = parseOptionalToken(41 /* SyntaxKind.AsteriskToken */); // We don't parse the name here in await context, instead we will report a grammar error in the checker. - var name = modifierFlags & 512 /* ModifierFlags.Default */ ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); + var name = modifierFlags & 1024 /* ModifierFlags.Default */ ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); var isGenerator = asteriskToken ? 1 /* SignatureFlags.Yield */ : 0 /* SignatureFlags.None */; - var isAsync = modifierFlags & 256 /* ModifierFlags.Async */ ? 2 /* SignatureFlags.Await */ : 0 /* SignatureFlags.None */; + var isAsync = modifierFlags & 512 /* ModifierFlags.Async */ ? 2 /* SignatureFlags.Await */ : 0 /* SignatureFlags.None */; var typeParameters = parseTypeParameters(); if (modifierFlags & 1 /* ModifierFlags.Export */) setAwaitContext(/*value*/ true); @@ -37110,8 +37354,8 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseConstructorName() { - if (token() === 134 /* SyntaxKind.ConstructorKeyword */) { - return parseExpected(134 /* SyntaxKind.ConstructorKeyword */); + if (token() === 135 /* SyntaxKind.ConstructorKeyword */) { + return parseExpected(135 /* SyntaxKind.ConstructorKeyword */); } if (token() === 10 /* SyntaxKind.StringLiteral */ && lookAhead(nextToken) === 20 /* SyntaxKind.OpenParenToken */) { return tryParse(function () { @@ -37173,7 +37417,7 @@ var ts; var parameters = parseParameters(0 /* SignatureFlags.None */); var type = parseReturnType(58 /* SyntaxKind.ColonToken */, /*isType*/ false); var body = parseFunctionBlockOrSemicolon(flags); - var node = kind === 172 /* SyntaxKind.GetAccessor */ + var node = kind === 174 /* SyntaxKind.GetAccessor */ ? factory.createGetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, type, body) : factory.createSetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, body); // Keep track of `typeParameters` (for both) and `type` (for setters) if they were parsed those indicate grammar errors @@ -37217,7 +37461,7 @@ var ts; // If we were able to get any potential identifier... if (idToken !== undefined) { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. - if (!ts.isKeyword(idToken) || idToken === 149 /* SyntaxKind.SetKeyword */ || idToken === 136 /* SyntaxKind.GetKeyword */) { + if (!ts.isKeyword(idToken) || idToken === 151 /* SyntaxKind.SetKeyword */ || idToken === 137 /* SyntaxKind.GetKeyword */) { return true; } // If it *is* a keyword, but not an accessor, check a little farther along @@ -37260,7 +37504,7 @@ var ts; return body; } function parseDecoratorExpression() { - if (inAwaitContext() && token() === 132 /* SyntaxKind.AwaitKeyword */) { + if (inAwaitContext() && token() === 133 /* SyntaxKind.AwaitKeyword */) { // `@await` is is disallowed in an [Await] context, but can cause parsing to go off the rails // This simply parses the missing identifier and moves on. var pos = getNodePos(); @@ -37338,10 +37582,10 @@ var ts; } function parseModifiersForArrowFunction() { var modifiers; - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { var pos = getNodePos(); nextToken(); - var modifier = finishNode(factory.createToken(131 /* SyntaxKind.AsyncKeyword */), pos); + var modifier = finishNode(factory.createToken(132 /* SyntaxKind.AsyncKeyword */), pos); modifiers = createNodeArray([modifier], pos); } return modifiers; @@ -37358,13 +37602,13 @@ var ts; if (token() === 124 /* SyntaxKind.StaticKeyword */ && lookAhead(nextTokenIsOpenBrace)) { return parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers); } - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 174 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 175 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); } - if (token() === 134 /* SyntaxKind.ConstructorKeyword */ || token() === 10 /* SyntaxKind.StringLiteral */) { + if (token() === 135 /* SyntaxKind.ConstructorKeyword */ || token() === 10 /* SyntaxKind.StringLiteral */) { var constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers); if (constructorDeclaration) { return constructorDeclaration; @@ -37401,10 +37645,10 @@ var ts; return ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined, 226 /* SyntaxKind.ClassExpression */); + return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined, 228 /* SyntaxKind.ClassExpression */); } function parseClassDeclaration(pos, hasJSDoc, decorators, modifiers) { - return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 257 /* SyntaxKind.ClassDeclaration */); + return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 260 /* SyntaxKind.ClassDeclaration */); } function parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, kind) { var savedAwaitContext = inAwaitContext(); @@ -37426,7 +37670,7 @@ var ts; members = createMissingList(); } setAwaitContext(savedAwaitContext); - var node = kind === 257 /* SyntaxKind.ClassDeclaration */ + var node = kind === 260 /* SyntaxKind.ClassDeclaration */ ? factory.createClassDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members) : factory.createClassExpression(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -37463,7 +37707,7 @@ var ts; function parseExpressionWithTypeArguments() { var pos = getNodePos(); var expression = parseLeftHandSideExpressionOrHigher(); - if (expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { return expression; } var typeArguments = tryParseTypeArguments(); @@ -37490,11 +37734,11 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers) { - parseExpected(152 /* SyntaxKind.TypeKeyword */); + parseExpected(154 /* SyntaxKind.TypeKeyword */); var name = parseIdentifier(); var typeParameters = parseTypeParameters(); parseExpected(63 /* SyntaxKind.EqualsToken */); - var type = token() === 138 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); + var type = token() === 139 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); parseSemicolon(); var node = factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type); node.illegalDecorators = decorators; @@ -37553,7 +37797,7 @@ var ts; function parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { var flags = 0; var name; - if (token() === 157 /* SyntaxKind.GlobalKeyword */) { + if (token() === 159 /* SyntaxKind.GlobalKeyword */) { // parse 'global' as name of global scope augmentation name = parseIdentifier(); flags |= 1024 /* NodeFlags.GlobalAugmentation */; @@ -37575,15 +37819,15 @@ var ts; } function parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { var flags = 0; - if (token() === 157 /* SyntaxKind.GlobalKeyword */) { + if (token() === 159 /* SyntaxKind.GlobalKeyword */) { // global augmentation return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); } - else if (parseOptional(142 /* SyntaxKind.NamespaceKeyword */)) { + else if (parseOptional(143 /* SyntaxKind.NamespaceKeyword */)) { flags |= 16 /* NodeFlags.Namespace */; } else { - parseExpected(141 /* SyntaxKind.ModuleKeyword */); + parseExpected(142 /* SyntaxKind.ModuleKeyword */); if (token() === 10 /* SyntaxKind.StringLiteral */) { return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); } @@ -37591,7 +37835,7 @@ var ts; return parseModuleOrNamespaceDeclaration(pos, hasJSDoc, decorators, modifiers, flags); } function isExternalModuleReference() { - return token() === 146 /* SyntaxKind.RequireKeyword */ && + return token() === 147 /* SyntaxKind.RequireKeyword */ && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { @@ -37604,8 +37848,8 @@ var ts; return nextToken() === 43 /* SyntaxKind.SlashToken */; } function parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers) { - parseExpected(127 /* SyntaxKind.AsKeyword */); - parseExpected(142 /* SyntaxKind.NamespaceKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); + parseExpected(143 /* SyntaxKind.NamespaceKeyword */); var name = parseIdentifier(); parseSemicolon(); var node = factory.createNamespaceExportDeclaration(name); @@ -37623,7 +37867,7 @@ var ts; identifier = parseIdentifier(); } var isTypeOnly = false; - if (token() !== 156 /* SyntaxKind.FromKeyword */ && + if (token() !== 158 /* SyntaxKind.FromKeyword */ && (identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) === "type" && (isIdentifier() || tokenAfterImportDefinitelyProducesImportDeclaration())) { isTypeOnly = true; @@ -37641,11 +37885,11 @@ var ts; token() === 18 /* SyntaxKind.OpenBraceToken */ // import { ) { importClause = parseImportClause(identifier, afterImportPos, isTypeOnly); - parseExpected(156 /* SyntaxKind.FromKeyword */); + parseExpected(158 /* SyntaxKind.FromKeyword */); } var moduleSpecifier = parseModuleSpecifier(); var assertClause; - if (token() === 129 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 130 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -37663,7 +37907,7 @@ var ts; function parseAssertClause(skipAssertKeyword) { var pos = getNodePos(); if (!skipAssertKeyword) { - parseExpected(129 /* SyntaxKind.AssertKeyword */); + parseExpected(130 /* SyntaxKind.AssertKeyword */); } var openBracePosition = scanner.getTokenPos(); if (parseExpected(18 /* SyntaxKind.OpenBraceToken */)) { @@ -37688,7 +37932,7 @@ var ts; function tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration() { // In `import id ___`, the current token decides whether to produce // an ImportDeclaration or ImportEqualsDeclaration. - return token() === 27 /* SyntaxKind.CommaToken */ || token() === 156 /* SyntaxKind.FromKeyword */; + return token() === 27 /* SyntaxKind.CommaToken */ || token() === 158 /* SyntaxKind.FromKeyword */; } function parseImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers, identifier, isTypeOnly) { parseExpected(63 /* SyntaxKind.EqualsToken */); @@ -37711,7 +37955,7 @@ var ts; var namedBindings; if (!identifier || parseOptional(27 /* SyntaxKind.CommaToken */)) { - namedBindings = token() === 41 /* SyntaxKind.AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(269 /* SyntaxKind.NamedImports */); + namedBindings = token() === 41 /* SyntaxKind.AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(272 /* SyntaxKind.NamedImports */); } return finishNode(factory.createImportClause(isTypeOnly, identifier, namedBindings), pos); } @@ -37722,7 +37966,7 @@ var ts; } function parseExternalModuleReference() { var pos = getNodePos(); - parseExpected(146 /* SyntaxKind.RequireKeyword */); + parseExpected(147 /* SyntaxKind.RequireKeyword */); parseExpected(20 /* SyntaxKind.OpenParenToken */); var expression = parseModuleSpecifier(); parseExpected(21 /* SyntaxKind.CloseParenToken */); @@ -37746,7 +37990,7 @@ var ts; // * as ImportedBinding var pos = getNodePos(); parseExpected(41 /* SyntaxKind.AsteriskToken */); - parseExpected(127 /* SyntaxKind.AsKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); var name = parseIdentifier(); return finishNode(factory.createNamespaceImport(name), pos); } @@ -37759,17 +38003,17 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - var node = kind === 269 /* SyntaxKind.NamedImports */ + var node = kind === 272 /* SyntaxKind.NamedImports */ ? factory.createNamedImports(parseBracketedList(23 /* ParsingContext.ImportOrExportSpecifiers */, parseImportSpecifier, 18 /* SyntaxKind.OpenBraceToken */, 19 /* SyntaxKind.CloseBraceToken */)) : factory.createNamedExports(parseBracketedList(23 /* ParsingContext.ImportOrExportSpecifiers */, parseExportSpecifier, 18 /* SyntaxKind.OpenBraceToken */, 19 /* SyntaxKind.CloseBraceToken */)); return finishNode(node, pos); } function parseExportSpecifier() { var hasJSDoc = hasPrecedingJSDocComment(); - return withJSDoc(parseImportOrExportSpecifier(275 /* SyntaxKind.ExportSpecifier */), hasJSDoc); + return withJSDoc(parseImportOrExportSpecifier(278 /* SyntaxKind.ExportSpecifier */), hasJSDoc); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(270 /* SyntaxKind.ImportSpecifier */); + return parseImportOrExportSpecifier(273 /* SyntaxKind.ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var pos = getNodePos(); @@ -37794,10 +38038,10 @@ var ts; // import { type as } from "mod"; - isTypeOnly: true, name: as // import { type as as } from "mod"; - isTypeOnly: false, name: as, propertyName: type // import { type as as as } from "mod"; - isTypeOnly: true, name: as, propertyName: as - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */) { // { type as ...? } var firstAs = parseIdentifierName(); - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */) { // { type as as ...? } var secondAs = parseIdentifierName(); if (ts.tokenIsIdentifierOrKeyword(token())) { @@ -37832,15 +38076,15 @@ var ts; name = parseNameWithKeywordCheck(); } } - if (canParseAsKeyword && token() === 127 /* SyntaxKind.AsKeyword */) { + if (canParseAsKeyword && token() === 128 /* SyntaxKind.AsKeyword */) { propertyName = name; - parseExpected(127 /* SyntaxKind.AsKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); name = parseNameWithKeywordCheck(); } - if (kind === 270 /* SyntaxKind.ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 273 /* SyntaxKind.ImportSpecifier */ && checkIdentifierIsKeyword) { parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected); } - var node = kind === 270 /* SyntaxKind.ImportSpecifier */ + var node = kind === 273 /* SyntaxKind.ImportSpecifier */ ? factory.createImportSpecifier(isTypeOnly, propertyName, name) : factory.createExportSpecifier(isTypeOnly, propertyName, name); return finishNode(node, pos); @@ -37860,26 +38104,26 @@ var ts; var exportClause; var moduleSpecifier; var assertClause; - var isTypeOnly = parseOptional(152 /* SyntaxKind.TypeKeyword */); + var isTypeOnly = parseOptional(154 /* SyntaxKind.TypeKeyword */); var namespaceExportPos = getNodePos(); if (parseOptional(41 /* SyntaxKind.AsteriskToken */)) { - if (parseOptional(127 /* SyntaxKind.AsKeyword */)) { + if (parseOptional(128 /* SyntaxKind.AsKeyword */)) { exportClause = parseNamespaceExport(namespaceExportPos); } - parseExpected(156 /* SyntaxKind.FromKeyword */); + parseExpected(158 /* SyntaxKind.FromKeyword */); moduleSpecifier = parseModuleSpecifier(); } else { - exportClause = parseNamedImportsOrExports(273 /* SyntaxKind.NamedExports */); + exportClause = parseNamedImportsOrExports(276 /* SyntaxKind.NamedExports */); // It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios, // the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`) // If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect. - if (token() === 156 /* SyntaxKind.FromKeyword */ || (token() === 10 /* SyntaxKind.StringLiteral */ && !scanner.hasPrecedingLineBreak())) { - parseExpected(156 /* SyntaxKind.FromKeyword */); + if (token() === 158 /* SyntaxKind.FromKeyword */ || (token() === 10 /* SyntaxKind.StringLiteral */ && !scanner.hasPrecedingLineBreak())) { + parseExpected(158 /* SyntaxKind.FromKeyword */); moduleSpecifier = parseModuleSpecifier(); } } - if (moduleSpecifier && token() === 129 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (moduleSpecifier && token() === 130 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -38492,9 +38736,9 @@ var ts; } function isObjectOrObjectArrayTypeReference(node) { switch (node.kind) { - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return true; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return isObjectOrObjectArrayTypeReference(node.elementType); default: return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && !node.typeArguments; @@ -38526,12 +38770,12 @@ var ts; var child = void 0; var children = void 0; while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) { - if (child.kind === 340 /* SyntaxKind.JSDocParameterTag */ || child.kind === 347 /* SyntaxKind.JSDocPropertyTag */) { + if (child.kind === 343 /* SyntaxKind.JSDocParameterTag */ || child.kind === 350 /* SyntaxKind.JSDocPropertyTag */) { children = ts.append(children, child); } } if (children) { - var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 183 /* SyntaxKind.ArrayType */), pos); + var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 185 /* SyntaxKind.ArrayType */), pos); return finishNode(factory.createJSDocTypeExpression(literal), pos); } } @@ -38649,7 +38893,7 @@ var ts; var hasChildren = false; while (child = tryParse(function () { return parseChildPropertyTag(indent); })) { hasChildren = true; - if (child.kind === 343 /* SyntaxKind.JSDocTypeTag */) { + if (child.kind === 346 /* SyntaxKind.JSDocTypeTag */) { if (childTypeTag) { var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); if (lastError) { @@ -38666,7 +38910,7 @@ var ts; } } if (hasChildren) { - var isArrayType = typeExpression && typeExpression.type.kind === 183 /* SyntaxKind.ArrayType */; + var isArrayType = typeExpression && typeExpression.type.kind === 185 /* SyntaxKind.ArrayType */; var jsdocTypeLiteral = factory.createJSDocTypeLiteral(jsDocPropertyTags, isArrayType); typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ? childTypeTag.typeExpression : @@ -38718,7 +38962,7 @@ var ts; var returnTag = tryParse(function () { if (parseOptionalJsdoc(59 /* SyntaxKind.AtToken */)) { var tag = parseTag(indent); - if (tag && tag.kind === 341 /* SyntaxKind.JSDocReturnTag */) { + if (tag && tag.kind === 344 /* SyntaxKind.JSDocReturnTag */) { return tag; } } @@ -38753,7 +38997,7 @@ var ts; case 59 /* SyntaxKind.AtToken */: if (canParseTag) { var child = tryParseChildTag(target, indent); - if (child && (child.kind === 340 /* SyntaxKind.JSDocParameterTag */ || child.kind === 347 /* SyntaxKind.JSDocPropertyTag */) && + if (child && (child.kind === 343 /* SyntaxKind.JSDocParameterTag */ || child.kind === 350 /* SyntaxKind.JSDocPropertyTag */) && target !== 4 /* PropertyLikeParse.CallbackParameter */ && name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; @@ -39723,6 +39967,7 @@ var ts; ["es2019.object", "lib.es2019.object.d.ts"], ["es2019.string", "lib.es2019.string.d.ts"], ["es2019.symbol", "lib.es2019.symbol.d.ts"], + ["es2019.intl", "lib.es2019.intl.d.ts"], ["es2020.bigint", "lib.es2020.bigint.d.ts"], ["es2020.date", "lib.es2020.date.d.ts"], ["es2020.promise", "lib.es2020.promise.d.ts"], @@ -39843,6 +40088,7 @@ var ts; shortName: "h", type: "boolean", showInSimplifiedHelpView: true, + isCommandLineOnly: true, category: ts.Diagnostics.Command_line_Options, description: ts.Diagnostics.Print_this_message, defaultValueDescription: false, @@ -39851,6 +40097,8 @@ var ts; name: "help", shortName: "?", type: "boolean", + isCommandLineOnly: true, + category: ts.Diagnostics.Command_line_Options, defaultValueDescription: false, }, { @@ -41582,7 +41830,7 @@ var ts; var _a; var rootExpression = (_a = sourceFile.statements[0]) === null || _a === void 0 ? void 0 : _a.expression; var knownRootOptions = reportOptionsErrors ? getTsconfigRootOptionsMap() : undefined; - if (rootExpression && rootExpression.kind !== 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (rootExpression && rootExpression.kind !== 207 /* SyntaxKind.ObjectLiteralExpression */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, rootExpression, ts.Diagnostics.The_root_value_of_a_0_file_must_be_an_object, ts.getBaseFileName(sourceFile.fileName) === "jsconfig.json" ? "jsconfig.json" : "tsconfig.json")); // Last-ditch error recovery. Somewhat useful because the JSON parser will recover from some parse errors by // synthesizing a top-level array literal expression. There's a reasonable chance the first element of that @@ -41622,7 +41870,7 @@ var ts; function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) { var result = returnValue ? {} : undefined; var _loop_4 = function (element) { - if (element.kind !== 296 /* SyntaxKind.PropertyAssignment */) { + if (element.kind !== 299 /* SyntaxKind.PropertyAssignment */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); return "continue"; } @@ -41716,13 +41964,13 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: reportInvalidOptionValue(option && option.type !== "number"); return validateValue(Number(valueExpression.text)); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: if (valueExpression.operator !== 40 /* SyntaxKind.MinusToken */ || valueExpression.operand.kind !== 8 /* SyntaxKind.NumericLiteral */) { break; // not valid JSON syntax } reportInvalidOptionValue(option && option.type !== "number"); return validateValue(-Number(valueExpression.operand.text)); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: reportInvalidOptionValue(option && option.type !== "object"); var objectLiteralExpression = valueExpression; // Currently having element option declaration in the tsconfig with type "object" @@ -41739,7 +41987,7 @@ var ts; return validateValue(convertObjectLiteralExpressionToJson(objectLiteralExpression, /* knownOptions*/ undefined, /*extraKeyDiagnosticMessage */ undefined, /*parentOption*/ undefined)); } - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: reportInvalidOptionValue(option && option.type !== "list"); return validateValue(convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element)); } @@ -42923,7 +43171,7 @@ var ts; function convertCompilerOptionsForTelemetry(opts) { var out = {}; for (var key in opts) { - if (opts.hasOwnProperty(key)) { + if (ts.hasProperty(opts, key)) { var type = getOptionFromName(key); if (type !== undefined) { // Ignore unknown options out[key] = getOptionValueWithEmptyStrings(opts[key], type); @@ -42989,7 +43237,7 @@ var ts; function withPackageId(packageInfo, r) { var packageId; if (r && packageInfo) { - var packageJsonContent = packageInfo.packageJsonContent; + var packageJsonContent = packageInfo.contents.packageJsonContent; if (typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string") { packageId = { name: packageJsonContent.name, @@ -44308,16 +44556,16 @@ var ts; function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson) { if (considerPackageJson === void 0) { considerPackageJson = true; } var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : undefined; - var packageJsonContent = packageInfo && packageInfo.packageJsonContent; - var versionPaths = packageInfo && packageInfo.versionPaths; + var packageJsonContent = packageInfo && packageInfo.contents.packageJsonContent; + var versionPaths = packageInfo && packageInfo.contents.versionPaths; return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths)); } /* @internal */ function getEntrypointsFromPackageJsonInfo(packageJsonInfo, options, host, cache, resolveJs) { - if (!resolveJs && packageJsonInfo.resolvedEntrypoints !== undefined) { + if (!resolveJs && packageJsonInfo.contents.resolvedEntrypoints !== undefined) { // Cached value excludes resolutions to JS files - those could be // cached separately, but they're used rarely. - return packageJsonInfo.resolvedEntrypoints; + return packageJsonInfo.contents.resolvedEntrypoints; } var entrypoints; var extensions = resolveJs ? Extensions.JavaScript : Extensions.TypeScript; @@ -44326,13 +44574,13 @@ var ts; requireState.conditions = ["node", "require", "types"]; requireState.requestContainingDirectory = packageJsonInfo.packageDirectory; var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory, - /*onlyRecordFailures*/ false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths); + /*onlyRecordFailures*/ false, requireState, packageJsonInfo.contents.packageJsonContent, packageJsonInfo.contents.versionPaths); entrypoints = ts.append(entrypoints, requireResolution === null || requireResolution === void 0 ? void 0 : requireResolution.path); - if (features & NodeResolutionFeatures.Exports && packageJsonInfo.packageJsonContent.exports) { + if (features & NodeResolutionFeatures.Exports && packageJsonInfo.contents.packageJsonContent.exports) { for (var _i = 0, _a = [["node", "import", "types"], ["node", "require", "types"]]; _i < _a.length; _i++) { var conditions = _a[_i]; var exportState = __assign(__assign({}, requireState), { failedLookupLocations: [], conditions: conditions }); - var exportResolutions = loadEntrypointsFromExportMap(packageJsonInfo, packageJsonInfo.packageJsonContent.exports, exportState, extensions); + var exportResolutions = loadEntrypointsFromExportMap(packageJsonInfo, packageJsonInfo.contents.packageJsonContent.exports, exportState, extensions); if (exportResolutions) { for (var _b = 0, exportResolutions_1 = exportResolutions; _b < exportResolutions_1.length; _b++) { var resolution = exportResolutions_1[_b]; @@ -44341,7 +44589,7 @@ var ts; } } } - return packageJsonInfo.resolvedEntrypoints = entrypoints || false; + return packageJsonInfo.contents.resolvedEntrypoints = entrypoints || false; } ts.getEntrypointsFromPackageJsonInfo = getEntrypointsFromPackageJsonInfo; function loadEntrypointsFromExportMap(scope, exports, state, extensions) { @@ -44445,7 +44693,9 @@ var ts; if (traceEnabled) trace(host, ts.Diagnostics.File_0_exists_according_to_earlier_cached_lookups, packageJsonPath); state.affectingLocations.push(packageJsonPath); - return existing; + return existing.packageDirectory === packageDirectory ? + existing : + { packageDirectory: packageDirectory, contents: existing.contents }; } else { if (existing && traceEnabled) @@ -44461,7 +44711,7 @@ var ts; trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); } var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state); - var result = { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined }; + var result = { packageDirectory: packageDirectory, contents: { packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined } }; (_b = state.packageJsonInfoCache) === null || _b === void 0 ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result); state.affectingLocations.push(packageJsonPath); return result; @@ -44586,17 +44836,16 @@ var ts; } function loadModuleFromSelfNameReference(extensions, moduleName, directory, state, cache, redirectedReference) { var _a, _b; - var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames; - var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames)); + var directoryPath = ts.getNormalizedAbsolutePath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)); var scope = getPackageScopeForPath(directoryPath, state); - if (!scope || !scope.packageJsonContent.exports) { + if (!scope || !scope.contents.packageJsonContent.exports) { return undefined; } - if (typeof scope.packageJsonContent.name !== "string") { + if (typeof scope.contents.packageJsonContent.name !== "string") { return undefined; } var parts = ts.getPathComponents(moduleName); // unrooted paths should have `""` as their 0th entry - var nameParts = ts.getPathComponents(scope.packageJsonContent.name); + var nameParts = ts.getPathComponents(scope.contents.packageJsonContent.name); if (!ts.every(nameParts, function (p, i) { return parts[i] === p; })) { return undefined; } @@ -44604,30 +44853,30 @@ var ts; return loadModuleFromExports(scope, extensions, !ts.length(trailingParts) ? "." : ".".concat(ts.directorySeparator).concat(trailingParts.join(ts.directorySeparator)), state, cache, redirectedReference); } function loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference) { - if (!scope.packageJsonContent.exports) { + if (!scope.contents.packageJsonContent.exports) { return undefined; } if (subpath === ".") { var mainExport = void 0; - if (typeof scope.packageJsonContent.exports === "string" || Array.isArray(scope.packageJsonContent.exports) || (typeof scope.packageJsonContent.exports === "object" && noKeyStartsWithDot(scope.packageJsonContent.exports))) { - mainExport = scope.packageJsonContent.exports; + if (typeof scope.contents.packageJsonContent.exports === "string" || Array.isArray(scope.contents.packageJsonContent.exports) || (typeof scope.contents.packageJsonContent.exports === "object" && noKeyStartsWithDot(scope.contents.packageJsonContent.exports))) { + mainExport = scope.contents.packageJsonContent.exports; } - else if (ts.hasProperty(scope.packageJsonContent.exports, ".")) { - mainExport = scope.packageJsonContent.exports["."]; + else if (ts.hasProperty(scope.contents.packageJsonContent.exports, ".")) { + mainExport = scope.contents.packageJsonContent.exports["."]; } if (mainExport) { var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, subpath, scope, /*isImports*/ false); return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false); } } - else if (allKeysStartWithDot(scope.packageJsonContent.exports)) { - if (typeof scope.packageJsonContent.exports !== "object") { + else if (allKeysStartWithDot(scope.contents.packageJsonContent.exports)) { + if (typeof scope.contents.packageJsonContent.exports !== "object") { if (state.traceEnabled) { trace(state.host, ts.Diagnostics.Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1, subpath, scope.packageDirectory); } return toSearchResult(/*value*/ undefined); } - var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, subpath, scope.packageJsonContent.exports, scope, /*isImports*/ false); + var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, subpath, scope.contents.packageJsonContent.exports, scope, /*isImports*/ false); if (result) { return result; } @@ -44645,8 +44894,7 @@ var ts; } return toSearchResult(/*value*/ undefined); } - var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames; - var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames)); + var directoryPath = ts.getNormalizedAbsolutePath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)); var scope = getPackageScopeForPath(directoryPath, state); if (!scope) { if (state.traceEnabled) { @@ -44654,13 +44902,13 @@ var ts; } return toSearchResult(/*value*/ undefined); } - if (!scope.packageJsonContent.imports) { + if (!scope.contents.packageJsonContent.imports) { if (state.traceEnabled) { trace(state.host, ts.Diagnostics.package_json_scope_0_has_no_imports_defined, scope.packageDirectory); } return toSearchResult(/*value*/ undefined); } - var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, scope.packageJsonContent.imports, scope, /*isImports*/ true); + var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, scope.contents.packageJsonContent.imports, scope, /*isImports*/ true); if (result) { return result; } @@ -45005,7 +45253,7 @@ var ts; if (fromFile) { return noPackageId(fromFile); } - var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.packageJsonContent, packageInfo.versionPaths); + var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.contents.packageJsonContent, packageInfo.contents.versionPaths); return withPackageId(packageInfo, fromDirectory); } } @@ -45013,14 +45261,14 @@ var ts; 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.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { + 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.packageJsonContent, packageInfo && packageInfo.versionPaths); + loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths); if (!pathAndExtension && packageInfo // eslint-disable-next-line no-null/no-null - && (packageInfo.packageJsonContent.exports === undefined || packageInfo.packageJsonContent.exports === null) + && (packageInfo.contents.packageJsonContent.exports === undefined || packageInfo.contents.packageJsonContent.exports === null) && state.features & NodeResolutionFeatures.EsmMode) { // EsmMode disables index lookup in `loadNodeModuleFromDirectoryWorker` generally, however non-relative package resolutions still assume // a default `index.js` entrypoint if no `main` or `exports` are present @@ -45032,12 +45280,12 @@ var ts; 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. packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state); - if (packageInfo && packageInfo.versionPaths) { + 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.versionPaths.version, ts.version, rest); + 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.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); + var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); if (fromPaths) { return fromPaths.value; } @@ -45250,26 +45498,26 @@ var ts; // A module is uninstantiated if it contains only switch (node.kind) { // 1. interface declarations, type alias declarations - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return 0 /* ModuleInstanceState.NonInstantiated */; // 2. const enum declarations - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (ts.isEnumConst(node)) { return 2 /* ModuleInstanceState.ConstEnumOnly */; } break; // 3. non-exported import declarations - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: if (!(ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */))) { return 0 /* ModuleInstanceState.NonInstantiated */; } break; // 4. Export alias declarations pointing at only uninstantiated modules or things uninstantiated modules contain - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportDeclaration = node; - if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 273 /* SyntaxKind.NamedExports */) { + if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 276 /* SyntaxKind.NamedExports */) { var state = 0 /* ModuleInstanceState.NonInstantiated */; for (var _i = 0, _a = exportDeclaration.exportClause.elements; _i < _a.length; _i++) { var specifier = _a[_i]; @@ -45285,7 +45533,7 @@ var ts; } break; // 5. other uninstantiated module declarations. - case 262 /* SyntaxKind.ModuleBlock */: { + case 265 /* SyntaxKind.ModuleBlock */: { var state_1 = 0 /* ModuleInstanceState.NonInstantiated */; ts.forEachChild(node, function (n) { var childState = getModuleInstanceStateCached(n, visited); @@ -45307,7 +45555,7 @@ var ts; }); return state_1; } - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return getModuleInstanceState(node, visited); case 79 /* SyntaxKind.Identifier */: // Only jsdoc typedef definition can exist in jsdoc namespace, and it should @@ -45508,7 +45756,7 @@ var ts; // Should not be called on a declaration with a computed property name, // unless it is a well known Symbol. function getDeclarationName(node) { - if (node.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (node.kind === 274 /* SyntaxKind.ExportAssignment */) { return node.isExportEquals ? "export=" /* InternalSymbolName.ExportEquals */ : "default" /* InternalSymbolName.Default */; } var name = ts.getNameOfDeclaration(node); @@ -45517,7 +45765,7 @@ var ts; var moduleName = ts.getTextOfIdentifierOrLiteral(name); return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"".concat(moduleName, "\"")); } - if (name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { var nameExpression = name.expression; // treat computed property names where expression is string/numeric literal as just string/numeric literal if (ts.isStringOrNumericLiteralLike(nameExpression)) { @@ -45543,36 +45791,36 @@ var ts; return ts.isPropertyNameLiteral(name) ? ts.getEscapedTextOfIdentifierOrLiteral(name) : undefined; } switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "__constructor" /* InternalSymbolName.Constructor */; - case 179 /* SyntaxKind.FunctionType */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: return "__call" /* InternalSymbolName.Call */; - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return "__new" /* InternalSymbolName.New */; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return "__index" /* InternalSymbolName.Index */; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return "__export" /* InternalSymbolName.ExportStar */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // json file should behave as // module.exports = ... return "export=" /* InternalSymbolName.ExportEquals */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */) { // module.exports = ... return "export=" /* InternalSymbolName.ExportEquals */; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return (ts.isJSDocConstructSignature(node) ? "__new" /* InternalSymbolName.New */ : "__call" /* InternalSymbolName.Call */); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Parameters with names are handled at the top of this function. Parameters // without names can only come from JSDocFunctionTypes. - ts.Debug.assert(node.parent.kind === 317 /* SyntaxKind.JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); }); + ts.Debug.assert(node.parent.kind === 320 /* SyntaxKind.JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); }); var functionType = node.parent; var index = functionType.parameters.indexOf(node); return "arg" + index; @@ -45591,7 +45839,7 @@ var ts; */ function declareSymbol(symbolTable, parent, node, includes, excludes, isReplaceableByMethod, isComputedName) { ts.Debug.assert(isComputedName || !ts.hasDynamicName(node)); - var isDefaultExport = ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) || ts.isExportSpecifier(node) && node.name.escapedText === "default"; + var isDefaultExport = ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) || ts.isExportSpecifier(node) && node.name.escapedText === "default"; // The exported symbol for an export default function/class node is always named "default" var name = isComputedName ? "__computed" /* InternalSymbolName.Computed */ : isDefaultExport && parent ? "default" /* InternalSymbolName.Default */ @@ -45674,7 +45922,7 @@ var ts; // 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default // 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers) if (symbol.declarations && symbol.declarations.length && - (node.kind === 271 /* SyntaxKind.ExportAssignment */ && !node.isExportEquals)) { + (node.kind === 274 /* SyntaxKind.ExportAssignment */ && !node.isExportEquals)) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; messageNeedsName_1 = false; multipleDefaultExports_1 = true; @@ -45713,7 +45961,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = !!(ts.getCombinedModifierFlags(node) & 1 /* ModifierFlags.Export */) || jsdocTreatAsExported(node); if (symbolFlags & 2097152 /* SymbolFlags.Alias */) { - if (node.kind === 275 /* SyntaxKind.ExportSpecifier */ || (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 278 /* SyntaxKind.ExportSpecifier */ || (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -45738,7 +45986,7 @@ var ts; if (ts.isJSDocTypeAlias(node)) ts.Debug.assert(ts.isInJSFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file. if (!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 64 /* NodeFlags.ExportContext */)) { - if (!container.locals || (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) && !getDeclarationName(node))) { + if (!container.locals || (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) && !getDeclarationName(node))) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); // No local symbol for an unnamed default! } var exportKind = symbolFlags & 111551 /* SymbolFlags.Value */ ? 1048576 /* SymbolFlags.ExportValue */ : 0; @@ -45802,7 +46050,7 @@ var ts; // for it. We must clear this so we don't accidentally move any stale data forward from // a previous compilation. if (containerFlags & 1 /* ContainerFlags.IsContainer */) { - if (node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind !== 216 /* SyntaxKind.ArrowFunction */) { thisParentContainer = container; } container = blockScopeContainer = node; @@ -45824,10 +46072,10 @@ var ts; var saveActiveLabelList = activeLabelList; var saveHasExplicitReturn = hasExplicitReturn; var isImmediatelyInvoked = (containerFlags & 16 /* ContainerFlags.IsFunctionExpression */ && - !ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Async */) && + !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Async */) && !node.asteriskToken && !!ts.getImmediatelyInvokedFunctionExpression(node)) || - node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; // A non-async, non-generator IIFE is considered part of the containing control flow. Return statements behave // similarly to break statements that exit to a label just past the statement body. if (!isImmediatelyInvoked) { @@ -45838,7 +46086,7 @@ var ts; } // We create a return control flow graph for IIFEs and constructors. For constructors // we use the return control flow graph in strict property initialization checks. - currentReturnTarget = isImmediatelyInvoked || node.kind === 171 /* SyntaxKind.Constructor */ || (ts.isInJSFile(node) && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */)) ? createBranchLabel() : undefined; + currentReturnTarget = isImmediatelyInvoked || node.kind === 173 /* SyntaxKind.Constructor */ || (ts.isInJSFile(node) && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */)) ? createBranchLabel() : undefined; currentExceptionTarget = undefined; currentBreakTarget = undefined; currentContinueTarget = undefined; @@ -45853,14 +46101,14 @@ var ts; node.flags |= 512 /* NodeFlags.HasExplicitReturn */; node.endFlowNode = currentFlow; } - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { node.flags |= emitFlags; node.endFlowNode = currentFlow; } if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); currentFlow = finishFlowLabel(currentReturnTarget); - if (node.kind === 171 /* SyntaxKind.Constructor */ || node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ || (ts.isInJSFile(node) && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */))) { + if (node.kind === 173 /* SyntaxKind.Constructor */ || node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ || (ts.isInJSFile(node) && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */))) { node.returnFlowNode = currentFlow; } } @@ -45887,8 +46135,8 @@ var ts; blockScopeContainer = savedBlockScopeContainer; } function bindEachFunctionsFirst(nodes) { - bindEach(nodes, function (n) { return n.kind === 256 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); - bindEach(nodes, function (n) { return n.kind !== 256 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind === 259 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind !== 259 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); } function bindEach(nodes, bindFunction) { if (bindFunction === void 0) { bindFunction = bind; } @@ -45911,59 +46159,59 @@ var ts; inAssignmentPattern = saveInAssignmentPattern; return; } - if (node.kind >= 237 /* SyntaxKind.FirstStatement */ && node.kind <= 253 /* SyntaxKind.LastStatement */ && !options.allowUnreachableCode) { + if (node.kind >= 240 /* SyntaxKind.FirstStatement */ && node.kind <= 256 /* SyntaxKind.LastStatement */ && !options.allowUnreachableCode) { node.flowNode = currentFlow; } switch (node.kind) { - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: bindWhileStatement(node); break; - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: bindDoStatement(node); break; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: bindForStatement(node); break; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: bindForInOrForOfStatement(node); break; - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: bindIfStatement(node); break; - case 247 /* SyntaxKind.ReturnStatement */: - case 251 /* SyntaxKind.ThrowStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 254 /* SyntaxKind.ThrowStatement */: bindReturnOrThrow(node); break; - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: bindTryStatement(node); break; - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: bindSwitchStatement(node); break; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: bindCaseBlock(node); break; - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: bindCaseClause(node); break; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: bindExpressionStatement(node); break; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: bindLabeledStatement(node); break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: bindPrefixUnaryExpressionFlow(node); break; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: bindPostfixUnaryExpressionFlow(node); break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { // Carry over whether we are in an assignment pattern to // binary expressions that could actually be an initializer @@ -45973,47 +46221,50 @@ var ts; } bindBinaryExpressionFlow(node); break; - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: bindDeleteExpressionFlow(node); break; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: bindConditionalExpressionFlow(node); break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: bindVariableDeclarationFlow(node); break; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: bindAccessExpressionFlow(node); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: bindCallExpressionFlow(node); break; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: bindNonNullExpressionFlow(node); break; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: bindJSDocTypeAlias(node); break; // In source files and blocks, bind functions first to match hoisting that occurs at runtime - case 305 /* SyntaxKind.SourceFile */: { + case 308 /* SyntaxKind.SourceFile */: { bindEachFunctionsFirst(node.statements); bind(node.endOfFileToken); break; } - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: bindEachFunctionsFirst(node.statements); break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: bindBindingElementFlow(node); break; - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 225 /* SyntaxKind.SpreadElement */: + case 166 /* SyntaxKind.Parameter */: + bindParameterFlow(node); + break; + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 227 /* SyntaxKind.SpreadElement */: // Carry over whether we are in an assignment pattern of Object and Array literals // as well as their children that are valid assignment targets. inAssignmentPattern = saveInAssignmentPattern; @@ -46030,19 +46281,19 @@ var ts; case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: case 108 /* SyntaxKind.ThisKeyword */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return containsNarrowableReference(expr); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return hasNarrowableArgument(expr); - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return isNarrowingExpression(expr.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isNarrowingBinaryExpression(expr); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 53 /* SyntaxKind.ExclamationToken */ && isNarrowingExpression(expr.operand); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return isNarrowingExpression(expr.expression); } return false; @@ -46066,7 +46317,7 @@ var ts; } } } - if (expr.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + if (expr.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && containsNarrowableReference(expr.expression.expression)) { return true; } @@ -46099,9 +46350,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isNarrowableOperand(expr.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (expr.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: return isNarrowableOperand(expr.left); @@ -46177,26 +46428,26 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: return parent.expression === node; - case 242 /* SyntaxKind.ForStatement */: - case 222 /* SyntaxKind.ConditionalExpression */: + case 245 /* SyntaxKind.ForStatement */: + case 224 /* SyntaxKind.ConditionalExpression */: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (node.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { node = node.expression; } - else if (node.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && node.operator === 53 /* SyntaxKind.ExclamationToken */) { + else if (node.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && node.operator === 53 /* SyntaxKind.ExclamationToken */) { node = node.operand; } else { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ || node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */); } @@ -46242,7 +46493,7 @@ var ts; } function setContinueTarget(node, target) { var label = activeLabelList; - while (label && node.parent.kind === 250 /* SyntaxKind.LabeledStatement */) { + while (label && node.parent.kind === 253 /* SyntaxKind.LabeledStatement */) { label.continueTarget = target; label = label.next; node = node.parent; @@ -46293,12 +46544,12 @@ var ts; bind(node.expression); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; - if (node.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.kind === 247 /* SyntaxKind.ForOfStatement */) { bind(node.awaitModifier); } addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -46320,7 +46571,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 247 /* SyntaxKind.ReturnStatement */) { + if (node.kind === 250 /* SyntaxKind.ReturnStatement */) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -46337,7 +46588,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 246 /* SyntaxKind.BreakStatement */ ? breakTarget : continueTarget; + var flowLabel = node.kind === 249 /* SyntaxKind.BreakStatement */ ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -46442,7 +46693,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 290 /* SyntaxKind.DefaultClause */; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 293 /* SyntaxKind.DefaultClause */; }); // We mark a switch statement as possibly exhaustive if it has no default clause and if all // case clauses have unreachable end points (e.g. they all return). Note, we no longer need // this property in control flow analysis, it's there only for backwards compatibility. @@ -46490,7 +46741,7 @@ var ts; function maybeBindExpressionFlowIfCall(node) { // A top level or comma expression call expression with a dotted function name and at least one argument // is potentially an assertion and is therefore included in the control flow. - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { var call = node; if (call.expression.kind !== 106 /* SyntaxKind.SuperKeyword */ && ts.isDottedName(call.expression)) { currentFlow = createFlowCall(currentFlow, call); @@ -46516,7 +46767,7 @@ var ts; currentFlow = finishFlowLabel(postStatementLabel); } function bindDestructuringTargetFlow(node) { - if (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { bindAssignmentTargetFlow(node.left); } else { @@ -46527,10 +46778,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowMutation(16 /* FlowFlags.Assignment */, currentFlow, node); } - else if (node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */) { + else if (node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 225 /* SyntaxKind.SpreadElement */) { + if (e.kind === 227 /* SyntaxKind.SpreadElement */) { bindAssignmentTargetFlow(e.expression); } else { @@ -46538,16 +46789,16 @@ var ts; } } } - else if (node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + else if (node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (p.kind === 299 /* SyntaxKind.PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + else if (p.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (p.kind === 301 /* SyntaxKind.SpreadAssignment */) { bindAssignmentTargetFlow(p.expression); } } @@ -46684,7 +46935,7 @@ var ts; var operator = node.operatorToken.kind; if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 63 /* SyntaxKind.EqualsToken */ && node.left.kind === 207 /* SyntaxKind.ElementAccessExpression */) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && node.left.kind === 209 /* SyntaxKind.ElementAccessExpression */) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowMutation(256 /* FlowFlags.ArrayMutation */, currentFlow, node); @@ -46712,7 +46963,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { bindAssignmentTargetFlow(node.expression); } } @@ -46750,24 +47001,42 @@ var ts; } } function bindBindingElementFlow(node) { - if (ts.isBindingPattern(node.name)) { - // When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per: - // - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization - // - `BindingElement: BindingPattern Initializer?` - // - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization - // - `BindingElement: BindingPattern Initializer?` - bind(node.dotDotDotToken); - bind(node.propertyName); - bind(node.initializer); - bind(node.name); + // When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per: + // - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization + // - `BindingElement: BindingPattern Initializer?` + // - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization + // - `BindingElement: BindingPattern Initializer?` + bind(node.dotDotDotToken); + bind(node.propertyName); + bindInitializer(node.initializer); + bind(node.name); + } + function bindParameterFlow(node) { + bindEach(node.modifiers); + bind(node.dotDotDotToken); + bind(node.questionToken); + bind(node.type); + bindInitializer(node.initializer); + bind(node.name); + } + // a BindingElement/Parameter does not have side effects if initializers are not evaluated and used. (see GH#49759) + function bindInitializer(node) { + if (!node) { + return; } - else { - bindEachChild(node); + var entryFlow = currentFlow; + bind(node); + if (entryFlow === unreachableFlow || entryFlow === currentFlow) { + return; } + var exitFlow = createBranchLabel(); + addAntecedent(exitFlow, entryFlow); + addAntecedent(exitFlow, currentFlow); + currentFlow = finishFlowLabel(exitFlow); } function bindJSDocTypeAlias(node) { bind(node.tagName); - if (node.kind !== 339 /* SyntaxKind.JSDocEnumTag */ && node.fullName) { + if (node.kind !== 342 /* SyntaxKind.JSDocEnumTag */ && node.fullName) { // don't bind the type name yet; that's delayed until delayedBindJSDocTypedefTag ts.setParent(node.fullName, node); ts.setParentRecursive(node.fullName, /*incremental*/ false); @@ -46779,7 +47048,7 @@ var ts; function bindJSDocClassTag(node) { bindEachChild(node); var host = ts.getHostSignatureFromJSDoc(node); - if (host && host.kind !== 169 /* SyntaxKind.MethodDeclaration */) { + if (host && host.kind !== 171 /* SyntaxKind.MethodDeclaration */) { addDeclarationToSymbol(host.symbol, host, 32 /* SymbolFlags.Class */); } } @@ -46792,15 +47061,15 @@ var ts; } function bindOptionalChainRest(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: bind(node.questionDotToken); bind(node.name); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: bind(node.questionDotToken); bind(node.argumentExpression); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: bind(node.questionDotToken); bindEach(node.typeArguments); bindEach(node.arguments); @@ -46865,7 +47134,7 @@ var ts; // an immediately invoked function expression (IIFE). Initialize the flowNode property to // the current control flow (which includes evaluation of the IIFE arguments). var expr = ts.skipParentheses(node.expression); - if (expr.kind === 213 /* SyntaxKind.FunctionExpression */ || expr.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (expr.kind === 215 /* SyntaxKind.FunctionExpression */ || expr.kind === 216 /* SyntaxKind.ArrowFunction */) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -46877,7 +47146,7 @@ var ts; } } } - if (node.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var propertyAccess = node.expression; if (ts.isIdentifier(propertyAccess.name) && isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowMutation(256 /* FlowFlags.ArrayMutation */, currentFlow, node); @@ -46886,55 +47155,55 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 286 /* SyntaxKind.JsxAttributes */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 289 /* SyntaxKind.JsxAttributes */: return 1 /* ContainerFlags.IsContainer */; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return 1 /* ContainerFlags.IsContainer */ | 64 /* ContainerFlags.IsInterface */; - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 195 /* SyntaxKind.MappedType */: - case 176 /* SyntaxKind.IndexSignature */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 197 /* SyntaxKind.MappedType */: + case 178 /* SyntaxKind.IndexSignature */: return 1 /* ContainerFlags.IsContainer */ | 32 /* ContainerFlags.HasLocals */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: if (ts.isObjectLiteralOrClassExpressionMethodOrAccessor(node)) { return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */ | 128 /* ContainerFlags.IsObjectLiteralOrClassExpressionMethodOrAccessor */; } // falls through - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 179 /* SyntaxKind.FunctionType */: - case 175 /* SyntaxKind.ConstructSignature */: - case 180 /* SyntaxKind.ConstructorType */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 181 /* SyntaxKind.FunctionType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */ | 16 /* ContainerFlags.IsFunctionExpression */; - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return 4 /* ContainerFlags.IsControlFlowContainer */; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return node.initializer ? 4 /* ContainerFlags.IsControlFlowContainer */ : 0; - case 292 /* SyntaxKind.CatchClause */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 263 /* SyntaxKind.CaseBlock */: + case 295 /* SyntaxKind.CatchClause */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 266 /* SyntaxKind.CaseBlock */: return 2 /* ContainerFlags.IsBlockScopedContainer */; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: // do not treat blocks directly inside a function as a block-scoped-container. // Locals that reside in this block should go to the function locals. Otherwise 'x' // would not appear to be a redeclaration of a block scoped local in the following @@ -46967,46 +47236,46 @@ var ts; // members are declared (for example, a member of a class will go into a specific // symbol table depending on if it is static or not). We defer to specialized // handlers to take care of declaring these child members. - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 286 /* SyntaxKind.JsxAttributes */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 289 /* SyntaxKind.JsxAttributes */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the // object / type / interface declaring them). An exception is type parameters, // which are in scope without qualification (similar to 'locals'). return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 195 /* SyntaxKind.MappedType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 197 /* SyntaxKind.MappedType */: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, // they're only accessed 'lexically' (i.e. from code that exists underneath @@ -47114,10 +47383,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (ts.isExternalOrCommonJsModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -47214,7 +47483,7 @@ var ts; node.originalKeywordKind <= 125 /* SyntaxKind.LastFutureReservedWord */) { file.bindDiagnostics.push(createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); } - else if (node.originalKeywordKind === 132 /* SyntaxKind.AwaitKeyword */) { + else if (node.originalKeywordKind === 133 /* SyntaxKind.AwaitKeyword */) { if (ts.isExternalModule(file) && ts.isInTopLevelContext(node)) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module, ts.declarationNameToString(node))); } @@ -47316,8 +47585,8 @@ var ts; function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { // Report error if function is not top level function declaration - if (blockScopeContainer.kind !== 305 /* SyntaxKind.SourceFile */ && - blockScopeContainer.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && + if (blockScopeContainer.kind !== 308 /* SyntaxKind.SourceFile */ && + blockScopeContainer.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isFunctionLikeOrClassStaticBlockDeclaration(blockScopeContainer)) { // We check first if the name is inside class declaration or class expression; if so give explicit message // otherwise report generic error message. @@ -47414,7 +47683,7 @@ var ts; // the current 'container' node when it changes. This helps us know which symbol table // a local should go into for example. Since terminal nodes are known not to have // children, as an optimization we don't process those. - if (node.kind > 160 /* SyntaxKind.LastToken */) { + if (node.kind > 162 /* SyntaxKind.LastToken */) { var saveParent = parent; parent = node; var containerFlags = getContainerFlags(node); @@ -47490,23 +47759,23 @@ var ts; } // falls through case 108 /* SyntaxKind.ThisKeyword */: - if (currentFlow && (ts.isExpression(node) || parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkContextualIdentifier(node); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: if (currentFlow && ts.isPartOfTypeQuery(node)) { node.flowNode = currentFlow; } break; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: case 106 /* SyntaxKind.SuperKeyword */: node.flowNode = currentFlow; break; case 80 /* SyntaxKind.PrivateIdentifier */: return checkPrivateIdentifier(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = node; if (currentFlow && isNarrowableReference(expr)) { expr.flowNode = currentFlow; @@ -47521,7 +47790,7 @@ var ts; declareSymbol(file.locals, /*parent*/ undefined, expr.expression, 1 /* SymbolFlags.FunctionScopedVariable */ | 134217728 /* SymbolFlags.ModuleExports */, 111550 /* SymbolFlags.FunctionScopedVariableExcludes */); } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var specialKind = ts.getAssignmentDeclarationKind(node); switch (specialKind) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -47557,78 +47826,78 @@ var ts; ts.Debug.fail("Unknown binary expression special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return checkStrictModeCatchClause(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return checkStrictModeDeleteExpression(node); case 8 /* SyntaxKind.NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return checkStrictModeWithStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return checkStrictModeLabeledStatement(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: seenThisKeyword = true; return; - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: break; // Binding the children will handle everything - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return bindTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return bindParameter(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return bindVariableDeclarationOrBindingElement(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: node.flowNode = currentFlow; return bindVariableDeclarationOrBindingElement(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return bindPropertyWorker(node); - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* SymbolFlags.Property */, 0 /* SymbolFlags.PropertyExcludes */); - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* SymbolFlags.EnumMember */, 900095 /* SymbolFlags.EnumMemberExcludes */); - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* SymbolFlags.Signature */, 0 /* SymbolFlags.None */); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: // If this is an ObjectLiteralExpression method, then it sits in the same space // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes // so that it will conflict with any other object literal members with the same // name. return bindPropertyOrMethodOrAccessor(node, 8192 /* SymbolFlags.Method */ | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), ts.isObjectLiteralMethod(node) ? 0 /* SymbolFlags.PropertyExcludes */ : 103359 /* SymbolFlags.MethodExcludes */); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return bindFunctionDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* SymbolFlags.Constructor */, /*symbolExcludes:*/ 0 /* SymbolFlags.None */); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* SymbolFlags.GetAccessor */, 46015 /* SymbolFlags.GetAccessorExcludes */); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SymbolFlags.SetAccessor */, 78783 /* SymbolFlags.SetAccessorExcludes */); - case 179 /* SyntaxKind.FunctionType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 323 /* SyntaxKind.JSDocSignature */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 326 /* SyntaxKind.JSDocSignature */: + case 182 /* SyntaxKind.ConstructorType */: return bindFunctionOrConstructorType(node); - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 195 /* SyntaxKind.MappedType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 197 /* SyntaxKind.MappedType */: return bindAnonymousTypeWorker(node); - case 332 /* SyntaxKind.JSDocClassTag */: + case 335 /* SyntaxKind.JSDocClassTag */: return bindJSDocClassTag(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return bindFunctionExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: var assignmentKind = ts.getAssignmentDeclarationKind(node); switch (assignmentKind) { case 7 /* AssignmentDeclarationKind.ObjectDefinePropertyValue */: @@ -47647,70 +47916,73 @@ var ts; } break; // Members of classes, interfaces, and modules - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return bindClassLikeDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* SymbolFlags.Interface */, 788872 /* SymbolFlags.InterfaceExcludes */); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* SymbolFlags.TypeAlias */, 788968 /* SymbolFlags.TypeAliasExcludes */); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return bindEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return bindModuleDeclaration(node); // Jsx-attributes - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return bindJsxAttributes(node); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return bindJsxAttribute(node, 4 /* SymbolFlags.Property */, 0 /* SymbolFlags.PropertyExcludes */); // Imports and exports - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 2097152 /* SymbolFlags.Alias */, 2097152 /* SymbolFlags.AliasExcludes */); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return bindNamespaceExportDeclaration(node); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return bindImportClause(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return bindExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return bindExportAssignment(node); - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (!ts.isFunctionLikeOrClassStaticBlockDeclaration(node.parent)) { return; } // falls through - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return updateStrictModeStatementList(node.statements); - case 340 /* SyntaxKind.JSDocParameterTag */: - if (node.parent.kind === 323 /* SyntaxKind.JSDocSignature */) { + case 343 /* SyntaxKind.JSDocParameterTag */: + if (node.parent.kind === 326 /* SyntaxKind.JSDocSignature */) { return bindParameter(node); } - if (node.parent.kind !== 322 /* SyntaxKind.JSDocTypeLiteral */) { + if (node.parent.kind !== 325 /* SyntaxKind.JSDocTypeLiteral */) { break; } // falls through - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: var propTag = node; - var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */ ? + var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */ ? 4 /* SymbolFlags.Property */ | 16777216 /* SymbolFlags.Optional */ : 4 /* SymbolFlags.Property */; return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* SymbolFlags.PropertyExcludes */); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return (delayedTypeAliases || (delayedTypeAliases = [])).push(node); } } function bindPropertyWorker(node) { - return bindPropertyOrMethodOrAccessor(node, 4 /* SymbolFlags.Property */ | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), 0 /* SymbolFlags.PropertyExcludes */); + var isAutoAccessor = ts.isAutoAccessorPropertyDeclaration(node); + var includes = isAutoAccessor ? 98304 /* SymbolFlags.Accessor */ : 4 /* SymbolFlags.Property */; + var excludes = isAutoAccessor ? 13247 /* SymbolFlags.AccessorExcludes */ : 0 /* SymbolFlags.PropertyExcludes */; + return bindPropertyOrMethodOrAccessor(node, includes | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), excludes); } function bindAnonymousTypeWorker(node) { return bindAnonymousDeclaration(node, 2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */); @@ -47870,8 +48142,8 @@ var ts; } var thisContainer = ts.getThisContainer(node, /*includeArrowFunctions*/ false); switch (thisContainer.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: var constructorSymbol = thisContainer.symbol; // For `f.prototype.m = function() { this.x = 0; }`, `this.x = 0` should modify `f`'s members, not the function expression. if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { @@ -47893,12 +48165,12 @@ var ts; addDeclarationToSymbol(constructorSymbol, constructorSymbol.valueDeclaration, 32 /* SymbolFlags.Class */); } break; - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // this.foo assignment in a JavaScript class // Bind this property to the containing class var containingClass = thisContainer.parent; @@ -47910,7 +48182,7 @@ var ts; declareSymbol(symbolTable, containingClass.symbol, node, 4 /* SymbolFlags.Property */ | 67108864 /* SymbolFlags.Assignment */, 0 /* SymbolFlags.None */, /*isReplaceableByMethod*/ true); } break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // this.property = assignment in a source file -- declare symbol in exports for a module, in locals for a script if (ts.hasDynamicName(node)) { break; @@ -47939,7 +48211,7 @@ var ts; if (node.expression.kind === 108 /* SyntaxKind.ThisKeyword */) { bindThisPropertyAssignment(node); } - else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 308 /* SyntaxKind.SourceFile */) { if (ts.isPrototypeAccess(node.expression)) { bindPrototypePropertyAssignment(node, node.parent); } @@ -47979,7 +48251,7 @@ var ts; } function bindObjectDefinePropertyAssignment(node) { var namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0]); - var isToplevel = node.parent.parent.kind === 305 /* SyntaxKind.SourceFile */; + var isToplevel = node.parent.parent.kind === 308 /* SyntaxKind.SourceFile */; namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, node.arguments[0], isToplevel, /*isPrototypeProperty*/ false, /*containerIsClass*/ false); bindPotentiallyNewExpandoMemberToNamespace(node, namespaceSymbol, /*isPrototypeProperty*/ false); } @@ -48088,8 +48360,8 @@ var ts; } function isTopLevelNamespaceAssignment(propertyAccess) { return ts.isBinaryExpression(propertyAccess.parent) - ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 305 /* SyntaxKind.SourceFile */ - : propertyAccess.parent.parent.kind === 305 /* SyntaxKind.SourceFile */; + ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 308 /* SyntaxKind.SourceFile */ + : propertyAccess.parent.parent.kind === 308 /* SyntaxKind.SourceFile */; } function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty, containerIsClass) { var namespaceSymbol = lookupSymbolForPropertyAccess(name, container) || lookupSymbolForPropertyAccess(name, blockScopeContainer); @@ -48168,7 +48440,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 257 /* SyntaxKind.ClassDeclaration */) { + if (node.kind === 260 /* SyntaxKind.ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* SymbolFlags.Class */, 899503 /* SymbolFlags.ClassExcludes */); } else { @@ -48210,7 +48482,7 @@ var ts; checkStrictModeEvalOrArguments(node, node.name); } if (!ts.isBindingPattern(node.name)) { - var possibleVariableDecl = node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? node : node.parent.parent; + var possibleVariableDecl = node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? node : node.parent.parent; if (ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !ts.getJSDocTypeTag(node) && @@ -48238,7 +48510,7 @@ var ts; } } function bindParameter(node) { - if (node.kind === 340 /* SyntaxKind.JSDocParameterTag */ && container.kind !== 323 /* SyntaxKind.JSDocSignature */) { + if (node.kind === 343 /* SyntaxKind.JSDocParameterTag */ && container.kind !== 326 /* SyntaxKind.JSDocSignature */) { return; } if (inStrictMode && !(node.flags & 16777216 /* NodeFlags.Ambient */)) { @@ -48315,7 +48587,7 @@ var ts; declareSymbolAndAddToSymbolTable(node, 262144 /* SymbolFlags.TypeParameter */, 526824 /* SymbolFlags.TypeParameterExcludes */); } } - else if (node.parent.kind === 190 /* SyntaxKind.InferType */) { + else if (node.parent.kind === 192 /* SyntaxKind.InferType */) { var container_2 = getInferTypeContainer(node.parent); if (container_2) { if (!container_2.locals) { @@ -48343,11 +48615,11 @@ var ts; if (currentFlow === unreachableFlow) { var reportError = // report error on all statements except empty ones - (ts.isStatementButNotDeclaration(node) && node.kind !== 236 /* SyntaxKind.EmptyStatement */) || + (ts.isStatementButNotDeclaration(node) && node.kind !== 239 /* SyntaxKind.EmptyStatement */) || // report error on class declarations - node.kind === 257 /* SyntaxKind.ClassDeclaration */ || + node.kind === 260 /* SyntaxKind.ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)); + (node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)); if (reportError) { currentFlow = reportedUnreachableFlow; if (!options.allowUnreachableCode) { @@ -48391,12 +48663,12 @@ var ts; } function isPurelyTypeDeclaration(s) { switch (s.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return getModuleInstanceState(s) !== 1 /* ModuleInstanceState.Instantiated */; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.hasSyntacticModifier(s, 2048 /* ModifierFlags.Const */); default: return false; @@ -48597,7 +48869,7 @@ var ts; // (their type resolved directly to the member deeply referenced) // So to get the intervening symbols, we need to check if there's a type // query node on any of the symbol's declarations and get symbols there - if (d.type && d.type.kind === 181 /* SyntaxKind.TypeQuery */) { + if (d.type && d.type.kind === 183 /* SyntaxKind.TypeQuery */) { var query = d.type; var entity = getResolvedSymbol(getFirstIdentifier(query.exprName)); visitSymbol(entity); @@ -49008,6 +49280,7 @@ var ts; getTypeOfPropertyOfType: function (type, name) { return getTypeOfPropertyOfType(type, ts.escapeLeadingUnderscores(name)); }, getIndexInfoOfType: function (type, kind) { return getIndexInfoOfType(type, kind === 0 /* IndexKind.String */ ? stringType : numberType); }, getIndexInfosOfType: getIndexInfosOfType, + getIndexInfosOfIndexSymbol: getIndexInfosOfIndexSymbol, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: function (type, kind) { return getIndexTypeOfType(type, kind === 0 /* IndexKind.String */ ? stringType : numberType); }, getIndexType: function (type) { return getIndexType(type); }, @@ -49033,6 +49306,7 @@ var ts; signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration, symbolToEntityName: nodeBuilder.symbolToEntityName, symbolToExpression: nodeBuilder.symbolToExpression, + symbolToNode: nodeBuilder.symbolToNode, symbolToTypeParameterDeclarations: nodeBuilder.symbolToTypeParameterDeclarations, symbolToParameterDeclaration: nodeBuilder.symbolToParameterDeclaration, typeParameterToDeclaration: nodeBuilder.typeParameterToDeclaration, @@ -49281,6 +49555,7 @@ var ts; isPropertyAccessible: isPropertyAccessible, getTypeOnlyAliasDeclaration: getTypeOnlyAliasDeclaration, getMemberOverrideModifierStatus: getMemberOverrideModifierStatus, + isTypeParameterPossiblyReferenced: isTypeParameterPossiblyReferenced, }; function runWithInferenceBlockedFromSourceNode(node, fn) { var containingCall = ts.findAncestor(node, ts.isCallLikeExpression); @@ -49338,6 +49613,7 @@ var ts; var wildcardType = createIntrinsicType(1 /* TypeFlags.Any */, "any"); var errorType = createIntrinsicType(1 /* TypeFlags.Any */, "error"); var unresolvedType = createIntrinsicType(1 /* TypeFlags.Any */, "unresolved"); + var nonInferrableAnyType = createIntrinsicType(1 /* TypeFlags.Any */, "any", 65536 /* ObjectFlags.ContainsWideningType */); var intrinsicMarkerType = createIntrinsicType(1 /* TypeFlags.Any */, "intrinsic"); var unknownType = createIntrinsicType(2 /* TypeFlags.Unknown */, "unknown"); var nonNullUnknownType = createIntrinsicType(2 /* TypeFlags.Unknown */, "unknown"); @@ -49399,7 +49675,8 @@ var ts; var emptyTypeLiteralSymbol = createSymbol(2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */); emptyTypeLiteralSymbol.members = ts.createSymbolTable(); var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); - var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType; + var unknownEmptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); + var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType; var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); emptyGenericType.instantiations = new ts.Map(); var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); @@ -49513,6 +49790,8 @@ var ts; var deferredGlobalOmitSymbol; var deferredGlobalAwaitedSymbol; var deferredGlobalBigIntType; + var deferredGlobalNaNSymbol; + var deferredGlobalRecordSymbol; var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name var flowLoopStart = 0; var flowLoopCount = 0; @@ -49702,10 +49981,10 @@ var ts; } // Issue errors globally var file = ts.getSourceFileOfNode(location); - addErrorOrSuggestion(isError, "message" in message ? ts.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForFileFromMessageChain(file, message)); // eslint-disable-line no-in-operator + addErrorOrSuggestion(isError, "message" in message ? ts.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForFileFromMessageChain(file, message)); // eslint-disable-line local/no-in-operator return; } - addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line no-in-operator + addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line local/no-in-operator } function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, arg0, arg1, arg2, arg3) { var diagnostic = error(location, message, arg0, arg1, arg2, arg3); @@ -49934,7 +50213,7 @@ var ts; if (unidirectional === void 0) { unidirectional = false; } source.forEach(function (sourceSymbol, id) { var targetSymbol = target.get(id); - target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol); + target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol)); }); } function mergeModuleAugmentation(moduleName) { @@ -50022,7 +50301,7 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = new NodeLinks()); } function isGlobalSourceFile(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -50081,17 +50360,17 @@ var ts; } if (declaration.pos <= usage.pos && !(ts.isPropertyDeclaration(declaration) && ts.isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) { // declaration is before usage - if (declaration.kind === 203 /* SyntaxKind.BindingElement */) { + if (declaration.kind === 205 /* SyntaxKind.BindingElement */) { // still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2]) - var errorBindingElement = ts.getAncestor(usage, 203 /* SyntaxKind.BindingElement */); + var errorBindingElement = ts.getAncestor(usage, 205 /* SyntaxKind.BindingElement */); if (errorBindingElement) { return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) || declaration.pos < errorBindingElement.pos; } // or it might be illegal if usage happens before parent variable is declared (eg var [a] = a) - return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 254 /* SyntaxKind.VariableDeclaration */), usage); + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 257 /* SyntaxKind.VariableDeclaration */), usage); } - else if (declaration.kind === 254 /* SyntaxKind.VariableDeclaration */) { + else if (declaration.kind === 257 /* SyntaxKind.VariableDeclaration */) { // still might be illegal if usage is in the initializer of the variable declaration (eg var a = a) return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } @@ -50121,12 +50400,12 @@ var ts; // or if usage is in a type context: // 1. inside a type query (typeof in type position) // 2. inside a jsdoc comment - if (usage.parent.kind === 275 /* SyntaxKind.ExportSpecifier */ || (usage.parent.kind === 271 /* SyntaxKind.ExportAssignment */ && usage.parent.isExportEquals)) { + if (usage.parent.kind === 278 /* SyntaxKind.ExportSpecifier */ || (usage.parent.kind === 274 /* SyntaxKind.ExportAssignment */ && usage.parent.isExportEquals)) { // export specifiers do not use the variable, they only make it available for use return true; } // When resolving symbols for exports, the `usage` location passed in can be the export site directly - if (usage.kind === 271 /* SyntaxKind.ExportAssignment */ && usage.isExportEquals) { + if (usage.kind === 274 /* SyntaxKind.ExportAssignment */ && usage.isExportEquals) { return true; } if (!!(usage.flags & 8388608 /* NodeFlags.JSDoc */) || isInTypeQuery(usage) || usageInTypeDeclaration()) { @@ -50148,9 +50427,9 @@ var ts; } function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { switch (declaration.parent.parent.kind) { - case 237 /* SyntaxKind.VariableStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 240 /* SyntaxKind.VariableStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: // variable statement/for/for-of statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) if (isSameScopeDescendentOf(usage, declaration, declContainer)) { @@ -50178,7 +50457,7 @@ var ts; var initializerOfProperty = propertyDeclaration.initializer === current; if (initializerOfProperty) { if (ts.isStatic(current.parent)) { - if (declaration.kind === 169 /* SyntaxKind.MethodDeclaration */) { + if (declaration.kind === 171 /* SyntaxKind.MethodDeclaration */) { return true; } if (ts.isPropertyDeclaration(declaration) && ts.getContainingClass(usage) === ts.getContainingClass(declaration)) { @@ -50193,7 +50472,7 @@ var ts; } } else { - var isDeclarationInstanceProperty = declaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(declaration); + var isDeclarationInstanceProperty = declaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(declaration); if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) { return true; } @@ -50216,19 +50495,19 @@ var ts; return "quit"; } switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return true; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // even when stopping at any property declaration, they need to come from the same class return stopAtAnyPropertyDeclaration && (ts.isPropertyDeclaration(declaration) && node.parent === declaration.parent || ts.isParameterPropertyDeclaration(declaration, declaration.parent) && node.parent === declaration.parent.parent) ? "quit" : true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: switch (node.parent.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 175 /* SyntaxKind.SetAccessor */: return true; default: return false; @@ -50268,18 +50547,18 @@ var ts; } function requiresScopeChangeWorker(node) { switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: // do not descend into these return false; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 299 /* SyntaxKind.PropertyAssignment */: return requiresScopeChangeWorker(node.name); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // static properties in classes introduce temporary variables if (ts.hasStaticModifier(node)) { return target < 99 /* ScriptTarget.ESNext */ || !useDefineForClassFields; @@ -50308,12 +50587,13 @@ var ts; * the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with * the given name can be found. * + * @param nameNotFoundMessage If defined, we will report errors found during resolve. * @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters. */ - function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions) { + function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions) { if (excludeGlobals === void 0) { excludeGlobals = false; } - if (getSpellingSuggstions === void 0) { getSpellingSuggstions = true; } - return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions, getSymbol); + if (getSpellingSuggestions === void 0) { getSpellingSuggestions = true; } + return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol); } function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) { var _a, _b, _c; @@ -50344,14 +50624,14 @@ var ts; // - parameters are only in the scope of function body // This restriction does not apply to JSDoc comment types because they are parented // at a higher level than type parameters would normally be - if (meaning & result.flags & 788968 /* SymbolFlags.Type */ && lastLocation.kind !== 320 /* SyntaxKind.JSDoc */) { + if (meaning & result.flags & 788968 /* SymbolFlags.Type */ && lastLocation.kind !== 323 /* SyntaxKind.JSDoc */) { useResult = result.flags & 262144 /* SymbolFlags.TypeParameter */ // type parameters are visible in parameter list, return type and type parameter list ? lastLocation === location.type || - lastLocation.kind === 164 /* SyntaxKind.Parameter */ || - lastLocation.kind === 340 /* SyntaxKind.JSDocParameterTag */ || - lastLocation.kind === 341 /* SyntaxKind.JSDocReturnTag */ || - lastLocation.kind === 163 /* SyntaxKind.TypeParameter */ + lastLocation.kind === 166 /* SyntaxKind.Parameter */ || + lastLocation.kind === 343 /* SyntaxKind.JSDocParameterTag */ || + lastLocation.kind === 344 /* SyntaxKind.JSDocReturnTag */ || + lastLocation.kind === 165 /* SyntaxKind.TypeParameter */ // local types not visible outside the function body : false; } @@ -50366,13 +50646,13 @@ var ts; // however it is detected separately when checking initializers of parameters // to make sure that they reference no variables declared after them. useResult = - lastLocation.kind === 164 /* SyntaxKind.Parameter */ || + lastLocation.kind === 166 /* SyntaxKind.Parameter */ || (lastLocation === location.type && !!ts.findAncestor(result.valueDeclaration, ts.isParameter)); } } } - else if (location.kind === 189 /* SyntaxKind.ConditionalType */) { + else if (location.kind === 191 /* SyntaxKind.ConditionalType */) { // A type parameter declared using 'infer T' in a conditional type is visible only in // the true branch of the conditional type. useResult = lastLocation === location.trueType; @@ -50387,14 +50667,14 @@ var ts; } withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation); switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var moduleExports = ((_a = getSymbolOfNode(location)) === null || _a === void 0 ? void 0 : _a.exports) || emptySymbols; - if (location.kind === 305 /* SyntaxKind.SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 16777216 /* NodeFlags.Ambient */ && !ts.isGlobalScopeAugmentation(location))) { + if (location.kind === 308 /* SyntaxKind.SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 16777216 /* NodeFlags.Ambient */ && !ts.isGlobalScopeAugmentation(location))) { // It's an external module. First see if the module has an export default and if the local // name of that export default matches. if (result = moduleExports.get("default" /* InternalSymbolName.Default */)) { @@ -50418,7 +50698,7 @@ var ts; var moduleExport = moduleExports.get(name); if (moduleExport && moduleExport.flags === 2097152 /* SymbolFlags.Alias */ && - (ts.getDeclarationOfKind(moduleExport, 275 /* SyntaxKind.ExportSpecifier */) || ts.getDeclarationOfKind(moduleExport, 274 /* SyntaxKind.NamespaceExport */))) { + (ts.getDeclarationOfKind(moduleExport, 278 /* SyntaxKind.ExportSpecifier */) || ts.getDeclarationOfKind(moduleExport, 277 /* SyntaxKind.NamespaceExport */))) { break; } } @@ -50432,12 +50712,12 @@ var ts; } } break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (result = lookup(((_c = getSymbolOfNode(location)) === null || _c === void 0 ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* SymbolFlags.EnumMember */)) { break loop; } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // TypeScript 1.0 spec (April 2014): 8.4.1 // Initializer expressions for instance member variables are evaluated in the scope // of the class constructor body but are not permitted to reference parameters or @@ -50455,9 +50735,9 @@ var ts; } } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // The below is used to lookup type parameters within a class or interface, as they are added to the class/interface locals // These can never be latebound, so the symbol's raw members are sufficient. `getMembersOfNode` cannot be used, as it would // trigger resolving late-bound names, which we may already be in the process of doing while we're here! @@ -50471,12 +50751,14 @@ var ts; // TypeScript 1.0 spec (April 2014): 3.4.1 // The scope of a type parameter extends over the entire declaration with which the type // parameter list is associated, with the exception of static member declarations in classes. - error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + if (nameNotFoundMessage) { + error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + } return undefined; } break loop; } - if (location.kind === 226 /* SyntaxKind.ClassExpression */ && meaning & 32 /* SymbolFlags.Class */) { + if (location.kind === 228 /* SyntaxKind.ClassExpression */ && meaning & 32 /* SymbolFlags.Class */) { var className = location.name; if (className && name === className.escapedText) { result = location.symbol; @@ -50484,7 +50766,7 @@ var ts; } } break; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // The type parameters of a class are not in scope in the base class expression. if (lastLocation === location.expression && location.parent.token === 94 /* SyntaxKind.ExtendsKeyword */) { var container = location.parent.parent; @@ -50504,34 +50786,36 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968 /* SymbolFlags.Type */)) { - error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + if (nameNotFoundMessage) { + error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + } return undefined; } } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // when targeting ES6 or higher there is no 'arguments' in an arrow function // for lower compile targets the resolved symbol is used to emit an error if (ts.getEmitScriptTarget(compilerOptions) >= 2 /* ScriptTarget.ES2015 */) { break; } // falls through - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (meaning & 3 /* SymbolFlags.Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (meaning & 3 /* SymbolFlags.Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -50544,7 +50828,7 @@ var ts; } } break; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -50553,7 +50837,7 @@ var ts; // method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter. // } // - if (location.parent && location.parent.kind === 164 /* SyntaxKind.Parameter */) { + if (location.parent && location.parent.kind === 166 /* SyntaxKind.Parameter */) { location = location.parent; } // @@ -50568,20 +50852,20 @@ var ts; // declare function y(x: T): any; // @param(1 as T) // <-- T should resolve to the type alias outside of class C // class C {} - if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 257 /* SyntaxKind.ClassDeclaration */)) { + if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 260 /* SyntaxKind.ClassDeclaration */)) { location = location.parent; } break; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: // js type aliases do not resolve names from their host, so skip past it var root = ts.getJSDocRoot(location); if (root) { location = root.parent; } break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts.isBindingPattern(lastLocation))) { if (!associatedDeclarationForContainingInitializerOrBindingName) { @@ -50589,7 +50873,7 @@ var ts; } } break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts.isBindingPattern(lastLocation))) { if (ts.isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) { @@ -50597,7 +50881,7 @@ var ts; } } break; - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: if (meaning & 262144 /* SymbolFlags.TypeParameter */) { var parameterName = location.typeParameter.name; if (parameterName && name === parameterName.escapedText) { @@ -50623,7 +50907,7 @@ var ts; } if (!result) { if (lastLocation) { - ts.Debug.assert(lastLocation.kind === 305 /* SyntaxKind.SourceFile */); + ts.Debug.assert(lastLocation.kind === 308 /* SyntaxKind.SourceFile */); if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) { return lastLocation.symbol; } @@ -50705,7 +50989,7 @@ var ts; } return undefined; } - else if (checkAndReportErrorForInvalidInitializer()) { + else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) { return undefined; } // Perform extra checks only if error reporting was requested @@ -50753,7 +51037,7 @@ var ts; if (result && errorLocation && meaning & 111551 /* SymbolFlags.Value */ && result.flags & 2097152 /* SymbolFlags.Alias */ && !(result.flags & 111551 /* SymbolFlags.Value */) && !ts.isValidTypeOnlyAliasUseSite(errorLocation)) { var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result); if (typeOnlyDeclaration) { - var message = typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */ + var message = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type; var unescapedName = ts.unescapeLeadingUnderscores(name); @@ -50767,31 +51051,31 @@ var ts; function addTypeOnlyDeclarationRelatedInfo(diagnostic, typeOnlyDeclaration, unescapedName) { if (!typeOnlyDeclaration) return diagnostic; - return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName)); + return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName)); } function getIsDeferredContext(location, lastLocation) { - if (location.kind !== 214 /* SyntaxKind.ArrowFunction */ && location.kind !== 213 /* SyntaxKind.FunctionExpression */) { + if (location.kind !== 216 /* SyntaxKind.ArrowFunction */ && location.kind !== 215 /* SyntaxKind.FunctionExpression */) { // initializers in instance property declaration of class like entities are executed in constructor and thus deferred return ts.isTypeQueryNode(location) || ((ts.isFunctionLikeDeclaration(location) || - (location.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred + (location.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred } if (lastLocation && lastLocation === location.name) { return false; } // generator functions and async functions are not inlined in control flow when immediately invoked - if (location.asteriskToken || ts.hasSyntacticModifier(location, 256 /* ModifierFlags.Async */)) { + if (location.asteriskToken || ts.hasSyntacticModifier(location, 512 /* ModifierFlags.Async */)) { return true; } return !ts.getImmediatelyInvokedFunctionExpression(location); } function isSelfReferenceLocation(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: // For `namespace N { N; }` + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // For `namespace N { N; }` return true; default: return false; @@ -50804,7 +51088,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - if (decl.kind === 163 /* SyntaxKind.TypeParameter */) { + if (decl.kind === 165 /* SyntaxKind.TypeParameter */) { var parent = ts.isJSDocTemplateTag(decl.parent) ? ts.getJSDocHost(decl.parent) : decl.parent; if (parent === container) { return !(ts.isJSDocTemplateTag(decl.parent) && ts.find(decl.parent.parent.tags, ts.isJSDocTypeAlias)); @@ -50861,9 +51145,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: if (ts.isEntityNameExpression(node.expression)) { return node.expression; } @@ -50907,7 +51191,7 @@ var ts; return name === "any" || name === "string" || name === "number" || name === "boolean" || name === "never" || name === "unknown"; } function checkAndReportErrorForExportingPrimitiveType(errorLocation, name) { - if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) { + if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) { error(errorLocation, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, name); return true; } @@ -50998,7 +51282,7 @@ var ts; return; } // Block-scoped variables cannot be used before their definition - var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 260 /* SyntaxKind.EnumDeclaration */); }); + var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 263 /* SyntaxKind.EnumDeclaration */); }); if (declaration === undefined) return ts.Debug.fail("checkResolvedBlockScopedVariable could not find block-scoped declaration"); if (!(declaration.flags & 16777216 /* NodeFlags.Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { @@ -51035,13 +51319,13 @@ var ts; } function getAnyImportSyntax(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return node.parent; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent; default: return undefined; @@ -51066,24 +51350,24 @@ var ts; * const { x } = require ... */ function isAliasSymbolDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || node.kind === 267 /* SyntaxKind.ImportClause */ && !!node.name - || node.kind === 268 /* SyntaxKind.NamespaceImport */ - || node.kind === 274 /* SyntaxKind.NamespaceExport */ - || node.kind === 270 /* SyntaxKind.ImportSpecifier */ - || node.kind === 275 /* SyntaxKind.ExportSpecifier */ - || node.kind === 271 /* SyntaxKind.ExportAssignment */ && ts.exportAssignmentIsAlias(node) + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || node.kind === 270 /* SyntaxKind.ImportClause */ && !!node.name + || node.kind === 271 /* SyntaxKind.NamespaceImport */ + || node.kind === 277 /* SyntaxKind.NamespaceExport */ + || node.kind === 273 /* SyntaxKind.ImportSpecifier */ + || node.kind === 278 /* SyntaxKind.ExportSpecifier */ + || node.kind === 274 /* SyntaxKind.ExportAssignment */ && ts.exportAssignmentIsAlias(node) || ts.isBinaryExpression(node) && ts.getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */ && ts.exportAssignmentIsAlias(node) || ts.isAccessExpression(node) && ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && isAliasableOrJsExpression(node.parent.right) - || node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || node.kind === 296 /* SyntaxKind.PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) - || node.kind === 254 /* SyntaxKind.VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) - || node.kind === 203 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); + || node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || node.kind === 299 /* SyntaxKind.PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) + || node.kind === 257 /* SyntaxKind.VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) + || node.kind === 205 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); } function isAliasableOrJsExpression(e) { return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e); @@ -51096,7 +51380,7 @@ var ts; ? resolveSymbol(getPropertyOfType(resolveExternalModuleTypeByLiteral(name), commonJSPropertyAccess.name.escapedText)) : undefined; } - if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { var immediate = resolveExternalModuleName(node, ts.getExternalModuleRequireArgument(node) || ts.getExternalModuleImportEqualsDeclarationExpression(node)); var resolved_4 = resolveExternalModuleSymbol(immediate); markSymbolOfAliasDeclarationIfTypeOnly(node, immediate, resolved_4, /*overwriteEmpty*/ false); @@ -51109,7 +51393,7 @@ var ts; function checkAndReportErrorForResolvingImportAliasToTypeOnlySymbol(node, resolved) { if (markSymbolOfAliasDeclarationIfTypeOnly(node, /*immediateTarget*/ undefined, resolved, /*overwriteEmpty*/ false) && !node.isTypeOnly) { var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(getSymbolOfNode(node)); - var isExport = typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */; + var isExport = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */; var message = isExport ? ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type : ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type; @@ -51128,7 +51412,7 @@ var ts; return resolved; } function isSyntacticDefault(node) { - return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) || ts.isExportSpecifier(node)); + return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) || ts.isExportSpecifier(node)); } function getUsageModeForExpression(usage) { return ts.isStringLiteralLike(usage) ? ts.getModeForUsageLocation(ts.getSourceFileOfNode(usage), usage) : undefined; @@ -51228,11 +51512,11 @@ var ts; } function getModuleSpecifierForImportOrExport(node) { switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; - case 268 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier; - case 270 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier; - case 275 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier; + case 270 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier; + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier; + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier; + case 278 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier; default: return ts.Debug.assertNever(node); } } @@ -51501,31 +51785,31 @@ var ts; function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { if (dontRecursivelyResolve === void 0) { dontRecursivelyResolve = false; } switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return getTargetOfImportClause(node, dontRecursivelyResolve); - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return getTargetOfNamespaceImport(node, dontRecursivelyResolve); - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: return getTargetOfNamespaceExport(node, dontRecursivelyResolve); - case 270 /* SyntaxKind.ImportSpecifier */: - case 203 /* SyntaxKind.BindingElement */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 205 /* SyntaxKind.BindingElement */: return getTargetOfImportSpecifier(node, dontRecursivelyResolve); - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return getTargetOfExportSpecifier(node, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, dontRecursivelyResolve); - case 271 /* SyntaxKind.ExportAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: + case 274 /* SyntaxKind.ExportAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: return getTargetOfExportAssignment(node, dontRecursivelyResolve); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return resolveEntityName(node.name, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ true, dontRecursivelyResolve); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getTargetOfAliasLikeExpression(node.initializer, dontRecursivelyResolve); - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return getTargetOfAccessExpression(node, dontRecursivelyResolve); default: return ts.Debug.fail(); @@ -51677,18 +51961,18 @@ var ts; entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 79 /* SyntaxKind.Identifier */ || entityName.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + if (entityName.kind === 79 /* SyntaxKind.Identifier */ || entityName.parent.kind === 163 /* SyntaxKind.QualifiedName */) { return resolveEntityName(entityName, 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */); return resolveEntityName(entityName, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } } function getFullyQualifiedName(symbol, containingLocation) { - return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, /*meaning*/ undefined, 16 /* SymbolFormatFlags.DoNotIncludeSymbolChain */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, /*meaning*/ undefined, 32 /* SymbolFormatFlags.DoNotIncludeSymbolChain */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); } function getContainingQualifiedNameNode(node) { while (ts.isQualifiedName(node.parent)) { @@ -51729,9 +52013,9 @@ var ts; return getMergedSymbol(symbolFromJSPrototype); } } - else if (name.kind === 161 /* SyntaxKind.QualifiedName */ || name.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { - var left = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.left : name.expression; - var right = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.right : name.name; + else if (name.kind === 163 /* SyntaxKind.QualifiedName */ || name.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { + var left = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.left : name.expression; + var right = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, namespaceMeaning, ignoreErrors, /*dontResolveAlias*/ false, location); if (!namespace || ts.nodeIsMissing(right)) { return undefined; @@ -51789,7 +52073,7 @@ var ts; throw ts.Debug.assertNever(name, "Unknown entity name kind."); } ts.Debug.assert((ts.getCheckFlags(symbol) & 1 /* CheckFlags.Instantiated */) === 0, "Should never get an instantiated symbol here."); - if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 /* SymbolFlags.Alias */ || name.parent.kind === 271 /* SyntaxKind.ExportAssignment */)) { + if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 /* SymbolFlags.Alias */ || name.parent.kind === 274 /* SyntaxKind.ExportAssignment */)) { markSymbolOfAliasDeclarationIfTypeOnly(ts.getAliasDeclarationFromName(name), symbol, /*finalTarget*/ undefined, /*overwriteEmpty*/ true); } return (symbol.flags & meaning) || dontResolveAlias ? symbol : resolveAlias(symbol); @@ -51939,7 +52223,7 @@ var ts; if (ext === ".ts" /* Extension.Ts */ || ext === ".js" /* Extension.Js */ || ext === ".tsx" /* Extension.Tsx */ || ext === ".jsx" /* Extension.Jsx */) { var scope = currentSourceFile.packageJsonScope; var targetExt = ext === ".ts" /* Extension.Ts */ ? ".mts" /* Extension.Mts */ : ext === ".js" /* Extension.Js */ ? ".mjs" /* Extension.Mjs */ : undefined; - if (scope && !scope.packageJsonContent.type) { + if (scope && !scope.contents.packageJsonContent.type) { if (targetExt) { diagnosticDetails = ts.chainDiagnosticMessages( /*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1, targetExt, ts.combinePaths(scope.packageDirectory, "package.json")); @@ -52112,7 +52396,7 @@ var ts; var _a; var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); if (!dontResolveAlias && symbol) { - if (!suppressInteropError && !(symbol.flags & (1536 /* SymbolFlags.Module */ | 3 /* SymbolFlags.Variable */)) && !ts.getDeclarationOfKind(symbol, 305 /* SyntaxKind.SourceFile */)) { + if (!suppressInteropError && !(symbol.flags & (1536 /* SymbolFlags.Module */ | 3 /* SymbolFlags.Variable */)) && !ts.getDeclarationOfKind(symbol, 308 /* SyntaxKind.SourceFile */)) { var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop"; @@ -52478,7 +52762,7 @@ var ts; var members = node.members; for (var _i = 0, members_3 = members; _i < members_3.length; _i++) { var member = members_3[_i]; - if (member.kind === 171 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 173 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } @@ -52586,12 +52870,12 @@ var ts; } } switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var sym = getSymbolOfNode(location); // `sym` may not have exports if this module declaration is backed by the symbol for a `const` that's being rewritten // into a namespace - in such cases, it's best to just let the namespace appear empty (the const members couldn't have referred @@ -52600,9 +52884,9 @@ var ts; return { value: result }; } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // Type parameters are bound into `members` lists so they can merge across declarations // This is troublesome, since in all other respects, they behave like locals :cries: // TODO: the below is shared with similar code in `resolveName` - in fact, rephrasing all this symbol @@ -52697,7 +52981,7 @@ var ts; && (isLocalNameLookup ? !ts.some(symbolFromSymbolTable.declarations, ts.isNamespaceReexportDeclaration) : true) // While exports are generally considered to be in scope, export-specifier declared symbols are _not_ // See similar comment in `resolveName` for details - && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 275 /* SyntaxKind.ExportSpecifier */))) { + && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */))) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); var candidate = getCandidateListForSymbol(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification); if (candidate) { @@ -52741,7 +53025,7 @@ var ts; return true; } // Qualify if the symbol from symbol table has same meaning as expected - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 275 /* SyntaxKind.ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -52756,10 +53040,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: continue; default: return false; @@ -52889,10 +53173,10 @@ var ts; return node && getSymbolOfNode(node); } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasNonGlobalAugmentationExternalModuleSymbol(declaration) { - return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -52960,14 +53244,14 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 181 /* SyntaxKind.TypeQuery */ || - entityName.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) || - entityName.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (entityName.parent.kind === 183 /* SyntaxKind.TypeQuery */ || + entityName.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) || + entityName.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // Typeof value meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } - else if (entityName.kind === 161 /* SyntaxKind.QualifiedName */ || entityName.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - entityName.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + else if (entityName.kind === 163 /* SyntaxKind.QualifiedName */ || entityName.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + entityName.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1920 /* SymbolFlags.Namespace */; @@ -53003,15 +53287,18 @@ var ts; if (flags & 8 /* SymbolFormatFlags.UseAliasDefinedOutsideCurrentScope */) { nodeFlags |= 16384 /* NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope */; } - if (flags & 16 /* SymbolFormatFlags.DoNotIncludeSymbolChain */) { + if (flags & 32 /* SymbolFormatFlags.DoNotIncludeSymbolChain */) { nodeFlags |= 134217728 /* NodeBuilderFlags.DoNotIncludeSymbolChain */; } - var builder = flags & 4 /* SymbolFormatFlags.AllowAnyNodeKind */ ? nodeBuilder.symbolToExpression : nodeBuilder.symbolToEntityName; + if (flags & 16 /* SymbolFormatFlags.WriteComputedProps */) { + nodeFlags |= 1073741824 /* NodeBuilderFlags.WriteComputedProps */; + } + var builder = flags & 4 /* SymbolFormatFlags.AllowAnyNodeKind */ ? nodeBuilder.symbolToNode : nodeBuilder.symbolToEntityName; return writer ? symbolToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(symbolToStringWorker); function symbolToStringWorker(writer) { var entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags); // TODO: GH#18217 // add neverAsciiEscape for GH#39027 - var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 305 /* SyntaxKind.SourceFile */ ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true }); + var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 308 /* SyntaxKind.SourceFile */ ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true }); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); printer.writeNode(4 /* EmitHint.Unspecified */, entity, /*sourceFile*/ sourceFile, writer); return writer; @@ -53023,10 +53310,10 @@ var ts; function signatureToStringWorker(writer) { var sigOutput; if (flags & 262144 /* TypeFormatFlags.WriteArrowStyleSignature */) { - sigOutput = kind === 1 /* SignatureKind.Construct */ ? 180 /* SyntaxKind.ConstructorType */ : 179 /* SyntaxKind.FunctionType */; + sigOutput = kind === 1 /* SignatureKind.Construct */ ? 182 /* SyntaxKind.ConstructorType */ : 181 /* SyntaxKind.FunctionType */; } else { - sigOutput = kind === 1 /* SignatureKind.Construct */ ? 175 /* SyntaxKind.ConstructSignature */ : 174 /* SyntaxKind.CallSignature */; + sigOutput = kind === 1 /* SignatureKind.Construct */ ? 177 /* SyntaxKind.ConstructSignature */ : 176 /* SyntaxKind.CallSignature */; } var sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */); var printer = ts.createPrinter({ removeComments: true, omitTrailingSemicolon: true }); @@ -53106,7 +53393,25 @@ var ts; symbolTableToDeclarationStatements: function (symbolTable, enclosingDeclaration, flags, tracker, bundled) { return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolTableToDeclarationStatements(symbolTable, context, bundled); }); }, + symbolToNode: function (symbol, meaning, enclosingDeclaration, flags, tracker) { + return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolToNode(symbol, context, meaning); }); + }, }; + function symbolToNode(symbol, context, meaning) { + if (context.flags & 1073741824 /* NodeBuilderFlags.WriteComputedProps */) { + if (symbol.valueDeclaration) { + var name = ts.getNameOfDeclaration(symbol.valueDeclaration); + if (name && ts.isComputedPropertyName(name)) + return name; + } + var nameType = getSymbolLinks(symbol).nameType; + if (nameType && nameType.flags & (1024 /* TypeFlags.EnumLiteral */ | 8192 /* TypeFlags.UniqueESSymbol */)) { + context.enclosingDeclaration = nameType.symbol.valueDeclaration; + return ts.factory.createComputedPropertyName(symbolToExpression(nameType.symbol, context, meaning)); + } + } + return symbolToExpression(symbol, context, meaning); + } function withContext(enclosingDeclaration, flags, tracker, cb) { var _a, _b; ts.Debug.assert(enclosingDeclaration === undefined || (enclosingDeclaration.flags & 8 /* NodeFlags.Synthesized */) === 0); @@ -53191,7 +53496,7 @@ var ts; return undefined; // TODO: GH#18217 } context.approximateLength += 3; - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } if (!(context.flags & 536870912 /* NodeBuilderFlags.NoTypeReduction */)) { type = getReducedType(type); @@ -53201,29 +53506,29 @@ var ts; return ts.factory.createTypeReferenceNode(symbolToEntityNameNode(type.aliasSymbol), mapToTypeNodes(type.aliasTypeArguments, context)); } if (type === unresolvedType) { - return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */), 3 /* SyntaxKind.MultiLineCommentTrivia */, "unresolved"); + return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */), 3 /* SyntaxKind.MultiLineCommentTrivia */, "unresolved"); } context.approximateLength += 3; - return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 138 /* SyntaxKind.IntrinsicKeyword */ : 130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 139 /* SyntaxKind.IntrinsicKeyword */ : 131 /* SyntaxKind.AnyKeyword */); } if (type.flags & 2 /* TypeFlags.Unknown */) { - return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */); + return ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */); } if (type.flags & 4 /* TypeFlags.String */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(150 /* SyntaxKind.StringKeyword */); + return ts.factory.createKeywordTypeNode(152 /* SyntaxKind.StringKeyword */); } if (type.flags & 8 /* TypeFlags.Number */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(147 /* SyntaxKind.NumberKeyword */); + return ts.factory.createKeywordTypeNode(148 /* SyntaxKind.NumberKeyword */); } if (type.flags & 64 /* TypeFlags.BigInt */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(158 /* SyntaxKind.BigIntKeyword */); + return ts.factory.createKeywordTypeNode(160 /* SyntaxKind.BigIntKeyword */); } if (type.flags & 16 /* TypeFlags.Boolean */ && !type.aliasSymbol) { context.approximateLength += 7; - return ts.factory.createKeywordTypeNode(133 /* SyntaxKind.BooleanKeyword */); + return ts.factory.createKeywordTypeNode(134 /* SyntaxKind.BooleanKeyword */); } if (type.flags & 1024 /* TypeFlags.EnumLiteral */ && !(type.flags & 1048576 /* TypeFlags.Union */)) { var parentSymbol = getParentOfSymbol(type.symbol); @@ -53277,7 +53582,7 @@ var ts; } } context.approximateLength += 13; - return ts.factory.createTypeOperatorNode(154 /* SyntaxKind.UniqueKeyword */, ts.factory.createKeywordTypeNode(151 /* SyntaxKind.SymbolKeyword */)); + return ts.factory.createTypeOperatorNode(156 /* SyntaxKind.UniqueKeyword */, ts.factory.createKeywordTypeNode(153 /* SyntaxKind.SymbolKeyword */)); } if (type.flags & 16384 /* TypeFlags.Void */) { context.approximateLength += 4; @@ -53285,7 +53590,7 @@ var ts; } if (type.flags & 32768 /* TypeFlags.Undefined */) { context.approximateLength += 9; - return ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */); + return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */); } if (type.flags & 65536 /* TypeFlags.Null */) { context.approximateLength += 4; @@ -53293,15 +53598,15 @@ var ts; } if (type.flags & 131072 /* TypeFlags.Never */) { context.approximateLength += 5; - return ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */); + return ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */); } if (type.flags & 4096 /* TypeFlags.ESSymbol */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(151 /* SyntaxKind.SymbolKeyword */); + return ts.factory.createKeywordTypeNode(153 /* SyntaxKind.SymbolKeyword */); } if (type.flags & 67108864 /* TypeFlags.NonPrimitive */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(148 /* SyntaxKind.ObjectKeyword */); + return ts.factory.createKeywordTypeNode(149 /* SyntaxKind.ObjectKeyword */); } if (ts.isThisTypeParameter(type)) { if (context.flags & 4194304 /* NodeBuilderFlags.InObjectTypeLiteral */) { @@ -53390,7 +53695,7 @@ var ts; var indexedType = type.type; context.approximateLength += 6; var indexTypeNode = typeToTypeNodeHelper(indexedType, context); - return ts.factory.createTypeOperatorNode(140 /* SyntaxKind.KeyOfKeyword */, indexTypeNode); + return ts.factory.createTypeOperatorNode(141 /* SyntaxKind.KeyOfKeyword */, indexTypeNode); } if (type.flags & 134217728 /* TypeFlags.TemplateLiteral */) { var texts_1 = type.texts; @@ -53442,7 +53747,7 @@ var ts; // On the other hand, // checkType extends infer T extends checkType ? T extends extendsType ? trueType : falseType : never; // may also work with `infer ... extends ...` in, but would produce declarations only compatible with the latest TS. - return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)), ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)); + return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)), ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)); } var saveInferTypeParameters = context.inferTypeParameters; context.inferTypeParameters = type.root.inferTypeParameters; @@ -53484,7 +53789,7 @@ var ts; var name = typeParameterToName(newParam, context); newTypeVariable = ts.factory.createTypeReferenceNode(name); } - appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(140 /* SyntaxKind.KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)); + appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(141 /* SyntaxKind.KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)); } else { appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type), context); @@ -53500,7 +53805,7 @@ var ts; // wrap it with a conditional like `SomeModifiersType extends infer U ? {..the mapped type...} : never` to ensure the resulting // type stays homomorphic var originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode(type.declaration.typeParameter.constraint.type)) || unknownType, type.mapper); - return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 /* TypeFlags.Unknown */ ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)); + return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 /* TypeFlags.Unknown */ ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)); } return result; } @@ -53548,7 +53853,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* SymbolFlags.Function */) && (symbol.parent || // is exported function symbol ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 305 /* SyntaxKind.SourceFile */ || declaration.parent.kind === 262 /* SyntaxKind.ModuleBlock */; + return declaration.parent.kind === 308 /* SyntaxKind.SourceFile */ || declaration.parent.kind === 265 /* SyntaxKind.ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -53637,12 +53942,12 @@ var ts; } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { var signature = resolved.callSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 179 /* SyntaxKind.FunctionType */, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 181 /* SyntaxKind.FunctionType */, context); return signatureNode; } if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { var signature = resolved.constructSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 180 /* SyntaxKind.ConstructorType */, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 182 /* SyntaxKind.ConstructorType */, context); return signatureNode; } } @@ -53685,7 +53990,7 @@ var ts; } var elementType = typeToTypeNodeHelper(typeArguments[0], context); var arrayType = ts.factory.createArrayTypeNode(elementType); - return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, arrayType); + return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, arrayType); } else if (type.target.objectFlags & 8 /* ObjectFlags.Tuple */) { typeArguments = ts.sameMap(typeArguments, function (t, i) { return removeMissingType(t, !!(type.target.elementFlags[i] & 2 /* ElementFlags.Optional */)); }); @@ -53710,12 +54015,12 @@ var ts; } } var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode(tupleConstituentNodes), 1 /* EmitFlags.SingleLine */); - return type.target.readonly ? ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; } } if (context.encounteredError || (context.flags & 524288 /* NodeBuilderFlags.AllowEmptyTuple */)) { var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode([]), 1 /* EmitFlags.SingleLine */); - return type.target.readonly ? ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; } context.encounteredError = true; return undefined; // TODO: GH#18217 @@ -53822,13 +54127,13 @@ var ts; var typeElements = []; for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 174 /* SyntaxKind.CallSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 176 /* SyntaxKind.CallSignature */, context)); } for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; if (signature.flags & 4 /* SignatureFlags.Abstract */) continue; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 175 /* SyntaxKind.ConstructSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 177 /* SyntaxKind.ConstructSignature */, context)); } for (var _d = 0, _e = resolvedType.indexInfos; _d < _e.length; _d++) { var info = _e[_d]; @@ -53865,7 +54170,7 @@ var ts; if (!(context.flags & 1 /* NodeBuilderFlags.NoTruncation */)) { return ts.factory.createTypeReferenceNode(ts.factory.createIdentifier("..."), /*typeArguments*/ undefined); } - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } function shouldUsePlaceholderForProperty(propertySymbol, context) { var _a; @@ -53915,7 +54220,7 @@ var ts; var signatures = getSignaturesOfType(filterType(propertyType, function (t) { return !(t.flags & 32768 /* TypeFlags.Undefined */); }), 0 /* SignatureKind.Call */); for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) { var signature = signatures_1[_i]; - var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 168 /* SyntaxKind.MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); + var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 170 /* SyntaxKind.MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); typeElements.push(preserveCommentsOn(methodDeclaration)); } } @@ -53929,12 +54234,12 @@ var ts; context.reverseMappedStack || (context.reverseMappedStack = []); context.reverseMappedStack.push(propertySymbol); } - propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); if (propertyIsReverseMapped) { context.reverseMappedStack.pop(); } } - var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(145 /* SyntaxKind.ReadonlyKeyword */)] : undefined; + var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(146 /* SyntaxKind.ReadonlyKeyword */)] : undefined; if (modifiers) { context.approximateLength += 9; } @@ -53943,8 +54248,8 @@ var ts; } function preserveCommentsOn(node) { var _a; - if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 347 /* SyntaxKind.JSDocPropertyTag */; })) { - var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 347 /* SyntaxKind.JSDocPropertyTag */; }); + if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 350 /* SyntaxKind.JSDocPropertyTag */; })) { + var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 350 /* SyntaxKind.JSDocPropertyTag */; }); var commentText = ts.getTextOfJSDocComment(d.comment); if (commentText) { ts.setSyntheticLeadingComments(node, [{ kind: 3 /* SyntaxKind.MultiLineCommentTrivia */, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]); @@ -54043,7 +54348,7 @@ var ts; context.encounteredError = true; } context.approximateLength += (name.length + 4); - return ts.factory.createIndexSignature(indexInfo.isReadonly ? [ts.factory.createToken(145 /* SyntaxKind.ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); + return ts.factory.createIndexSignature(indexInfo.isReadonly ? [ts.factory.createToken(146 /* SyntaxKind.ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); } function signatureToSignatureDeclarationHelper(signature, kind, context, options) { var _a, _b, _c, _d; @@ -54061,7 +54366,7 @@ var ts; } var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0]; // If the expanded parameter list had a variadic in a non-trailing position, don't expand it - var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* CheckFlags.RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 171 /* SyntaxKind.Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); + var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* CheckFlags.RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 173 /* SyntaxKind.Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); var thisParameter = context.flags & 33554432 /* NodeBuilderFlags.OmitThisParameter */ ? undefined : tryGetThisParameterDeclaration(signature, context); if (thisParameter) { parameters.unshift(thisParameter); @@ -54070,7 +54375,7 @@ var ts; var typePredicate = getTypePredicateOfSignature(signature); if (typePredicate) { var assertsModifier = typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? - ts.factory.createToken(128 /* SyntaxKind.AssertsKeyword */) : + ts.factory.createToken(129 /* SyntaxKind.AssertsKeyword */) : undefined; var parameterName = typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.setEmitFlags(ts.factory.createIdentifier(typePredicate.parameterName), 16777216 /* EmitFlags.NoAsciiEscaping */) : @@ -54084,28 +54389,28 @@ var ts; returnTypeNode = serializeReturnTypeForSignature(context, returnType, signature, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); } else if (!suppressAny) { - returnTypeNode = ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + returnTypeNode = ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } } var modifiers = options === null || options === void 0 ? void 0 : options.modifiers; - if ((kind === 180 /* SyntaxKind.ConstructorType */) && signature.flags & 4 /* SignatureFlags.Abstract */) { + if ((kind === 182 /* SyntaxKind.ConstructorType */) && signature.flags & 4 /* SignatureFlags.Abstract */) { var flags = ts.modifiersToFlags(modifiers); - modifiers = ts.factory.createModifiersFromModifierFlags(flags | 128 /* ModifierFlags.Abstract */); + modifiers = ts.factory.createModifiersFromModifierFlags(flags | 256 /* ModifierFlags.Abstract */); } - var node = kind === 174 /* SyntaxKind.CallSignature */ ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : - kind === 175 /* SyntaxKind.ConstructSignature */ ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : - kind === 168 /* SyntaxKind.MethodSignature */ ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : - kind === 169 /* SyntaxKind.MethodDeclaration */ ? ts.factory.createMethodDeclaration(modifiers, /*asteriskToken*/ undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), /*questionToken*/ undefined, typeParameters, parameters, returnTypeNode, /*body*/ undefined) : - kind === 171 /* SyntaxKind.Constructor */ ? ts.factory.createConstructorDeclaration(modifiers, parameters, /*body*/ undefined) : - kind === 172 /* SyntaxKind.GetAccessor */ ? ts.factory.createGetAccessorDeclaration(modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, /*body*/ undefined) : - kind === 173 /* SyntaxKind.SetAccessor */ ? ts.factory.createSetAccessorDeclaration(modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, /*body*/ undefined) : - kind === 176 /* SyntaxKind.IndexSignature */ ? ts.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : - kind === 317 /* SyntaxKind.JSDocFunctionType */ ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : - kind === 179 /* SyntaxKind.FunctionType */ ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : - kind === 180 /* SyntaxKind.ConstructorType */ ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : - kind === 256 /* SyntaxKind.FunctionDeclaration */ ? ts.factory.createFunctionDeclaration(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, /*body*/ undefined) : - kind === 213 /* SyntaxKind.FunctionExpression */ ? ts.factory.createFunctionExpression(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) : - kind === 214 /* SyntaxKind.ArrowFunction */ ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, /*equalsGreaterThanToken*/ undefined, ts.factory.createBlock([])) : + var node = kind === 176 /* SyntaxKind.CallSignature */ ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : + kind === 177 /* SyntaxKind.ConstructSignature */ ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : + kind === 170 /* SyntaxKind.MethodSignature */ ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : + kind === 171 /* SyntaxKind.MethodDeclaration */ ? ts.factory.createMethodDeclaration(modifiers, /*asteriskToken*/ undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), /*questionToken*/ undefined, typeParameters, parameters, returnTypeNode, /*body*/ undefined) : + kind === 173 /* SyntaxKind.Constructor */ ? ts.factory.createConstructorDeclaration(modifiers, parameters, /*body*/ undefined) : + kind === 174 /* SyntaxKind.GetAccessor */ ? ts.factory.createGetAccessorDeclaration(modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, /*body*/ undefined) : + kind === 175 /* SyntaxKind.SetAccessor */ ? ts.factory.createSetAccessorDeclaration(modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, /*body*/ undefined) : + kind === 178 /* SyntaxKind.IndexSignature */ ? ts.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : + kind === 320 /* SyntaxKind.JSDocFunctionType */ ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : + kind === 181 /* SyntaxKind.FunctionType */ ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : + kind === 182 /* SyntaxKind.ConstructorType */ ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : + kind === 259 /* SyntaxKind.FunctionDeclaration */ ? ts.factory.createFunctionDeclaration(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, /*body*/ undefined) : + kind === 215 /* SyntaxKind.FunctionExpression */ ? ts.factory.createFunctionExpression(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) : + kind === 216 /* SyntaxKind.ArrowFunction */ ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, /*equalsGreaterThanToken*/ undefined, ts.factory.createBlock([])) : ts.Debug.assertNever(kind); if (typeArguments) { node.typeArguments = ts.factory.createNodeArray(typeArguments); @@ -54142,9 +54447,9 @@ var ts; return typeParameterToDeclarationWithConstraint(type, context, constraintNode); } function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) { - var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 164 /* SyntaxKind.Parameter */); + var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 166 /* SyntaxKind.Parameter */); if (!parameterDeclaration && !ts.isTransientSymbol(parameterSymbol)) { - parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 340 /* SyntaxKind.JSDocParameterTag */); + parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 343 /* SyntaxKind.JSDocParameterTag */); } var parameterType = getTypeOfSymbol(parameterSymbol); if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) { @@ -54156,7 +54461,7 @@ var ts; var dotDotDotToken = isRest ? ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */) : undefined; var name = parameterDeclaration ? parameterDeclaration.name ? parameterDeclaration.name.kind === 79 /* SyntaxKind.Identifier */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name), 16777216 /* EmitFlags.NoAsciiEscaping */) : - parameterDeclaration.name.kind === 161 /* SyntaxKind.QualifiedName */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216 /* EmitFlags.NoAsciiEscaping */) : + parameterDeclaration.name.kind === 163 /* SyntaxKind.QualifiedName */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216 /* EmitFlags.NoAsciiEscaping */) : cloneBindingName(parameterDeclaration.name) : ts.symbolName(parameterSymbol) : ts.symbolName(parameterSymbol); @@ -54167,22 +54472,15 @@ var ts; context.approximateLength += ts.symbolName(parameterSymbol).length + 3; return parameterNode; function cloneBindingName(node) { - return elideInitializerAndPropertyRenamingAndSetEmitFlags(node); - function elideInitializerAndPropertyRenamingAndSetEmitFlags(node) { + return elideInitializerAndSetEmitFlags(node); + function elideInitializerAndSetEmitFlags(node) { if (context.tracker.trackSymbol && ts.isComputedPropertyName(node) && isLateBindableName(node)) { trackComputedName(node.expression, context.enclosingDeclaration, context); } - var visited = ts.visitEachChild(node, elideInitializerAndPropertyRenamingAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndPropertyRenamingAndSetEmitFlags); + var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndSetEmitFlags); if (ts.isBindingElement(visited)) { - if (visited.propertyName && ts.isIdentifier(visited.propertyName) && ts.isIdentifier(visited.name)) { - visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, - /* propertyName*/ undefined, visited.propertyName, - /*initializer*/ undefined); - } - else { - visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name, - /*initializer*/ undefined); - } + visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name, + /*initializer*/ undefined); } if (!ts.nodeIsSynthesized(visited)) { visited = ts.factory.cloneNode(visited); @@ -54327,11 +54625,11 @@ var ts; } function getSpecifierForModuleSymbol(symbol, context, overrideImportMode) { var _a; - var file = ts.getDeclarationOfKind(symbol, 305 /* SyntaxKind.SourceFile */); + var file = ts.getDeclarationOfKind(symbol, 308 /* SyntaxKind.SourceFile */); if (!file) { var equivalentFileSymbol = ts.firstDefined(symbol.declarations, function (d) { return getFileSymbolIfFileSymbolExportEqualsContainer(d, symbol); }); if (equivalentFileSymbol) { - file = ts.getDeclarationOfKind(equivalentFileSymbol, 305 /* SyntaxKind.SourceFile */); + file = ts.getDeclarationOfKind(equivalentFileSymbol, 308 /* SyntaxKind.SourceFile */); } } if (file && file.moduleName !== undefined) { @@ -54799,17 +55097,17 @@ var ts; return transformed === existing ? ts.setTextRange(ts.factory.cloneNode(existing), existing) : transformed; function visitExistingNodeTreeSymbols(node) { // We don't _actually_ support jsdoc namepath types, emit `any` instead - if (ts.isJSDocAllType(node) || node.kind === 319 /* SyntaxKind.JSDocNamepathType */) { - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + if (ts.isJSDocAllType(node) || node.kind === 322 /* SyntaxKind.JSDocNamepathType */) { + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } if (ts.isJSDocUnknownType(node)) { - return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */); + return ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */); } if (ts.isJSDocNullableType(node)) { return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createLiteralTypeNode(ts.factory.createNull())]); } if (ts.isJSDocOptionalType(node)) { - return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)]); + return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)]); } if (ts.isJSDocNonNullableType(node)) { return ts.visitNode(node.type, visitExistingNodeTreeSymbols); @@ -54823,11 +55121,11 @@ var ts; var typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode(node), name.escapedText); var overrideTypeNode = typeViaParent && t.typeExpression && getTypeFromTypeNode(t.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : undefined; return ts.factory.createPropertySignature( - /*modifiers*/ undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*modifiers*/ undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); })); } if (ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "") { - return ts.setOriginalNode(ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */), node); + return ts.setOriginalNode(ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */), node); } if ((ts.isExpressionWithTypeArguments(node) || ts.isTypeReferenceNode(node)) && ts.isJSDocIndexSignature(node)) { return ts.factory.createTypeLiteralNode([ts.factory.createIndexSignature( @@ -54842,12 +55140,12 @@ var ts; return ts.factory.createConstructorTypeNode( /*modifiers*/ undefined, ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.mapDefined(node.parameters, function (p, i) { return p.name && ts.isIdentifier(p.name) && p.name.escapedText === "new" ? (newTypeNode_1 = p.type, undefined) : ts.factory.createParameterDeclaration( /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), - /*initializer*/ undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*initializer*/ undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } else { return ts.factory.createFunctionTypeNode(ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.map(node.parameters, function (p, i) { return ts.factory.createParameterDeclaration( /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), - /*initializer*/ undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*initializer*/ undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } } if (ts.isTypeReferenceNode(node) && ts.isInJSDoc(node) && (!existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(node, getTypeFromTypeNode(node)) || getIntendedTypeFromJSDocTypeReference(node) || unknownSymbol === resolveTypeReferenceName(node, 788968 /* SymbolFlags.Type */, /*ignoreErrors*/ true))) { @@ -54915,8 +55213,8 @@ var ts; } } function symbolTableToDeclarationStatements(symbolTable, context, bundled) { - var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 169 /* SyntaxKind.MethodDeclaration */, /*useAcessors*/ true); - var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 168 /* SyntaxKind.MethodSignature */, /*useAcessors*/ false); + var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 171 /* SyntaxKind.MethodDeclaration */, /*useAcessors*/ true); + var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 170 /* SyntaxKind.MethodSignature */, /*useAcessors*/ false); // TODO: Use `setOriginalNode` on original declaration names where possible so these declarations see some kind of // declaration mapping // We save the enclosing declaration off here so it's not adjusted by well-meaning declaration @@ -55154,7 +55452,7 @@ var ts; if (needsPostExportDefault || needsExportDeclaration) { isPrivate = true; } - var modifierFlags = (!isPrivate ? 1 /* ModifierFlags.Export */ : 0) | (isDefault && !needsPostExportDefault ? 512 /* ModifierFlags.Default */ : 0); + var modifierFlags = (!isPrivate ? 1 /* ModifierFlags.Export */ : 0) | (isDefault && !needsPostExportDefault ? 1024 /* ModifierFlags.Default */ : 0); var isConstMergedWithNS = symbol.flags & 1536 /* SymbolFlags.Module */ && symbol.flags & (2 /* SymbolFlags.BlockScopedVariable */ | 1 /* SymbolFlags.FunctionScopedVariable */ | 4 /* SymbolFlags.Property */) && symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */; @@ -55338,8 +55636,8 @@ var ts; // Classes, namespaces, variables, enums, and functions all need `declare` modifiers to be valid in a declaration file top-level scope newModifierFlags |= 2 /* ModifierFlags.Ambient */; } - if ((additionalModifierFlags & 512 /* ModifierFlags.Default */) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) { - newModifierFlags |= 512 /* ModifierFlags.Default */; + if ((additionalModifierFlags & 1024 /* ModifierFlags.Default */) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) { + newModifierFlags |= 1024 /* ModifierFlags.Default */; } if (newModifierFlags) { node = ts.factory.updateModifiers(node, newModifierFlags | ts.getEffectiveModifierFlags(node)); @@ -55373,8 +55671,8 @@ var ts; var baseTypes = getBaseTypes(interfaceType); var baseType = ts.length(baseTypes) ? getIntersectionType(baseTypes) : undefined; var members = ts.flatMap(getPropertiesOfType(interfaceType), function (p) { return serializePropertySymbolForInterface(p, baseType); }); - var callSignatures = serializeSignatures(0 /* SignatureKind.Call */, interfaceType, baseType, 174 /* SyntaxKind.CallSignature */); - var constructSignatures = serializeSignatures(1 /* SignatureKind.Construct */, interfaceType, baseType, 175 /* SyntaxKind.ConstructSignature */); + var callSignatures = serializeSignatures(0 /* SignatureKind.Call */, interfaceType, baseType, 176 /* SyntaxKind.CallSignature */); + var constructSignatures = serializeSignatures(1 /* SignatureKind.Construct */, interfaceType, baseType, 177 /* SyntaxKind.ConstructSignature */); var indexSignatures = serializeIndexSignatures(interfaceType, baseType); var heritageClauses = !ts.length(baseTypes) ? undefined : [ts.factory.createHeritageClause(94 /* SyntaxKind.ExtendsKeyword */, ts.mapDefined(baseTypes, function (b) { return trySerializeAsTypeReference(b, 111551 /* SymbolFlags.Value */); }))]; addResult(ts.factory.createInterfaceDeclaration( @@ -55439,7 +55737,7 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var sig = signatures_2[_i]; // Each overload becomes a separate function declaration, in order - var decl = signatureToSignatureDeclarationHelper(sig, 256 /* SyntaxKind.FunctionDeclaration */, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); + var decl = signatureToSignatureDeclarationHelper(sig, 259 /* SyntaxKind.FunctionDeclaration */, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); addResult(ts.setTextRange(decl, getSignatureTextRangeLocation(sig)), modifierFlags); } // Module symbol emit will take care of module-y members, provided it has exports @@ -55597,7 +55895,7 @@ var ts; !ts.some(getSignaturesOfType(staticType, 1 /* SignatureKind.Construct */)); var constructors = isNonConstructableClassLikeInJsFile ? [ts.factory.createConstructorDeclaration(ts.factory.createModifiersFromModifierFlags(8 /* ModifierFlags.Private */), [], /*body*/ undefined)] : - serializeSignatures(1 /* SignatureKind.Construct */, staticType, staticBaseType, 171 /* SyntaxKind.Constructor */); + serializeSignatures(1 /* SignatureKind.Construct */, staticType, staticBaseType, 173 /* SyntaxKind.Constructor */); var indexSignatures = serializeIndexSignatures(classType, baseTypes[0]); context.enclosingDeclaration = oldEnclosing; addResult(ts.setTextRange(ts.factory.createClassDeclaration( @@ -55646,8 +55944,8 @@ var ts; var targetName = getInternalSymbolName(target, verbatimTargetName); includePrivateSymbol(target); // the target may be within the same scope - attempt to serialize it first switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 254 /* SyntaxKind.VariableDeclaration */) { + case 205 /* SyntaxKind.BindingElement */: + if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 257 /* SyntaxKind.VariableDeclaration */) { // const { SomeClass } = require('./lib'); var specifier_1 = getSpecifierForModuleSymbol(target.parent || target, context); // './lib' var propertyName = node.propertyName; @@ -55660,13 +55958,13 @@ var ts; // We don't know how to serialize this (nested?) binding element ts.Debug.failBadSyntaxKind(((_c = node.parent) === null || _c === void 0 ? void 0 : _c.parent) || node, "Unhandled binding element grandparent kind in declaration serialization"); break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 221 /* SyntaxKind.BinaryExpression */) { + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 223 /* SyntaxKind.BinaryExpression */) { // module.exports = { SomeClass } serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), targetName); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: // commonjs require: const x = require('y') if (ts.isPropertyAccessExpression(node.initializer)) { // const x = require('y').z @@ -55684,7 +55982,7 @@ var ts; break; } // else fall through and treat commonjs require just like import= - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // This _specifically_ only exists to handle json declarations - where we make aliases, but since // we emit no declarations for the json document, must not refer to it in the declarations if (target.escapedName === "export=" /* InternalSymbolName.ExportEquals */ && ts.some(target.declarations, ts.isJsonSourceFile)) { @@ -55700,13 +55998,13 @@ var ts; ? symbolToName(target, context, 67108863 /* SymbolFlags.All */, /*expectsIdentifier*/ false) : ts.factory.createExternalModuleReference(ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)))), isLocalImport ? modifierFlags : 0 /* ModifierFlags.None */); break; - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: // export as namespace foo // TODO: Not part of a file's local or export symbol tables // Is bound into file.symbol.globalExports instead, which we don't currently traverse addResult(ts.factory.createNamespaceExportDeclaration(ts.idText(node.name)), 0 /* ModifierFlags.None */); break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, ts.factory.createIdentifier(localName), /*namedBindings*/ undefined), // We use `target.parent || target` below as `target.parent` is unset when the target is a module which has been export assigned @@ -55715,17 +56013,17 @@ var ts; ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, /*importClause*/ undefined, ts.factory.createNamespaceImport(ts.factory.createIdentifier(localName))), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: addResult(ts.factory.createExportDeclaration( /*modifiers*/ undefined, /*isTypeOnly*/ false, ts.factory.createNamespaceExport(ts.factory.createIdentifier(localName)), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context))), 0 /* ModifierFlags.None */); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause( /*isTypeOnly*/ false, @@ -55735,7 +56033,7 @@ var ts; ])), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: // does not use localName because the symbol name in this case refers to the name in the exports table, // which we must exactly preserve var specifier = node.parent.parent.moduleSpecifier; @@ -55743,12 +56041,12 @@ var ts; // another file serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), specifier ? verbatimTargetName : targetName, specifier && ts.isStringLiteralLike(specifier) ? ts.factory.createStringLiteral(specifier.text) : undefined); break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: serializeMaybeAliasAssignment(symbol); break; - case 221 /* SyntaxKind.BinaryExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // Could be best encoded as though an export specifier or as though an export assignment // If name is default or export=, do an export assignment // Otherwise do an export specifier @@ -55892,7 +56190,7 @@ var ts; && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName)))) { return []; } - var flag = (modifierFlags & ~256 /* ModifierFlags.Async */) | (isStatic ? 32 /* ModifierFlags.Static */ : 0); + var flag = (modifierFlags & ~512 /* ModifierFlags.Async */) | (isStatic ? 32 /* ModifierFlags.Static */ : 0); var name = getPropertyNameNodeForSymbol(p, context); var firstPropertyLikeDecl = (_a = p.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.or(ts.isPropertyDeclaration, ts.isAccessor, ts.isVariableDeclaration, ts.isPropertySignature, ts.isBinaryExpression, ts.isPropertyAccessExpression)); if (p.flags & 98304 /* SymbolFlags.Accessor */ && useAccessors) { @@ -55914,7 +56212,7 @@ var ts; // This is an else/if as accessors and properties can't merge in TS, but might in JS // If this happens, we assume the accessor takes priority, as it imposes more constraints else if (p.flags & (4 /* SymbolFlags.Property */ | 3 /* SymbolFlags.Variable */ | 98304 /* SymbolFlags.Accessor */)) { - return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* ModifierFlags.Readonly */ : 0) | flag), name, p.flags & 16777216 /* SymbolFlags.Optional */ ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), + return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* ModifierFlags.Readonly */ : 0) | flag), name, p.flags & 16777216 /* SymbolFlags.Optional */ ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), // TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357 // interface members can't have initializers, however class members _can_ /*initializer*/ undefined), ((_d = p.declarations) === null || _d === void 0 ? void 0 : _d.find(ts.or(ts.isPropertyDeclaration, ts.isVariableDeclaration))) || firstPropertyLikeDecl); @@ -56104,7 +56402,7 @@ var ts; if (flags === void 0) { flags = 16384 /* TypeFormatFlags.UseAliasDefinedOutsideCurrentScope */; } return writer ? typePredicateToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(typePredicateToStringWorker); function typePredicateToStringWorker(writer) { - var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createToken(128 /* SyntaxKind.AssertsKeyword */) : undefined, typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */) // TODO: GH#18217 + var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createToken(129 /* SyntaxKind.AssertsKeyword */) : undefined, typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */) // TODO: GH#18217 ); var printer = ts.createPrinter({ removeComments: true }); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); @@ -56151,7 +56449,7 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* SymbolFlags.TypeLiteral */ && type.symbol.declarations) { var node = ts.walkUpParenthesizedTypes(type.symbol.declarations[0].parent); - if (node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + if (node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -56159,11 +56457,11 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && + node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isExternalModuleAugmentation(node.parent.parent); } function isDefaultBindingContext(location) { - return location.kind === 305 /* SyntaxKind.SourceFile */ || ts.isAmbientModule(location); + return location.kind === 308 /* SyntaxKind.SourceFile */ || ts.isAmbientModule(location); } function getNameOfSymbolFromNameType(symbol, context) { var nameType = getSymbolLinks(symbol).nameType; @@ -56222,17 +56520,17 @@ var ts; if (!declaration) { declaration = symbol.declarations[0]; // Declaration may be nameless, but we'll try anyway } - if (declaration.parent && declaration.parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (declaration.parent && declaration.parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { return ts.declarationNameToString(declaration.parent.name); } switch (declaration.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (context && !context.encounteredError && !(context.flags & 131072 /* NodeBuilderFlags.AllowAnonymousIdentifier */)) { context.encounteredError = true; } - return declaration.kind === 226 /* SyntaxKind.ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; + return declaration.kind === 228 /* SyntaxKind.ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; } } var name = getNameOfSymbolFromNameType(symbol, context); @@ -56249,28 +56547,28 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: // Top-level jsdoc type aliases are considered exported // First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent)); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return isDeclarationVisible(node.parent.parent); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { // If the binding pattern is empty, this variable declaration is not visible return false; } // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // external module augmentation is always visible if (ts.isExternalModuleAugmentation(node)) { return true; @@ -56278,55 +56576,55 @@ var ts; var parent = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedModifierFlags(node) & 1 /* ModifierFlags.Export */) && - !(node.kind !== 265 /* SyntaxKind.ImportEqualsDeclaration */ && parent.kind !== 305 /* SyntaxKind.SourceFile */ && parent.flags & 16777216 /* NodeFlags.Ambient */)) { + !(node.kind !== 268 /* SyntaxKind.ImportEqualsDeclaration */ && parent.kind !== 308 /* SyntaxKind.SourceFile */ && parent.flags & 16777216 /* NodeFlags.Ambient */)) { return isGlobalSourceFile(parent); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible return isDeclarationVisible(parent); - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.hasEffectiveModifier(node, 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */)) { // Private/protected properties/methods are not visible return false; } // Public properties/methods are visible if its parents are visible, so: // falls through - case 171 /* SyntaxKind.Constructor */: - case 175 /* SyntaxKind.ConstructSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 164 /* SyntaxKind.Parameter */: - case 262 /* SyntaxKind.ModuleBlock */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 178 /* SyntaxKind.TypeReference */: - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 173 /* SyntaxKind.Constructor */: + case 177 /* SyntaxKind.ConstructSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 166 /* SyntaxKind.Parameter */: + case 265 /* SyntaxKind.ModuleBlock */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 180 /* SyntaxKind.TypeReference */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: return false; // Type parameters are always visible - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: // Source file and namespace export are always visible // falls through - case 305 /* SyntaxKind.SourceFile */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return true; // Export assignments do not create name bindings outside the module - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return false; default: return false; @@ -56335,10 +56633,10 @@ var ts; } function collectLinkedAliases(node, setVisibility) { var exportSymbol; - if (node.parent && node.parent.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (node.parent && node.parent.kind === 274 /* SyntaxKind.ExportAssignment */) { exportSymbol = resolveName(node, node.escapedText, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false); } - else if (node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) { + else if (node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) { exportSymbol = getTargetOfExportSpecifier(node.parent, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */); } var result; @@ -56445,12 +56743,12 @@ var ts; function getDeclarationContainer(node) { return ts.findAncestor(ts.getRootDeclaration(node), function (node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 255 /* SyntaxKind.VariableDeclarationList */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 269 /* SyntaxKind.NamedImports */: - case 268 /* SyntaxKind.NamespaceImport */: - case 267 /* SyntaxKind.ImportClause */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 258 /* SyntaxKind.VariableDeclarationList */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 272 /* SyntaxKind.NamedImports */: + case 271 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: return false; default: return true; @@ -56580,23 +56878,23 @@ var ts; function getParentElementAccess(node) { var ancestor = node.parent.parent; switch (ancestor.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: return getSyntheticElementAccess(ancestor); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getSyntheticElementAccess(node.parent); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ancestor.initializer; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return ancestor.right; } } function getDestructuringPropertyName(node) { var parent = node.parent; - if (node.kind === 203 /* SyntaxKind.BindingElement */ && parent.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (node.kind === 205 /* SyntaxKind.BindingElement */ && parent.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { return getLiteralPropertyNameText(node.propertyName || node.name); } - if (node.kind === 296 /* SyntaxKind.PropertyAssignment */ || node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.kind === 299 /* SyntaxKind.PropertyAssignment */ || node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return getLiteralPropertyNameText(node.name); } return "" + parent.elements.indexOf(node); @@ -56626,7 +56924,7 @@ var ts; parentType = getTypeWithFacts(parentType, 524288 /* TypeFacts.NEUndefined */); } var type; - if (pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (declaration.dotDotDotToken) { parentType = getReducedType(parentType); if (parentType.flags & 2 /* TypeFlags.Unknown */ || !isValidSpreadType(parentType)) { @@ -56697,7 +56995,7 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node, /*excludeJSDocTypeAssertions*/ true); - return expr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && expr.elements.length === 0; + return expr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && expr.elements.length === 0; } function addOptionality(type, isProperty, isOptional) { if (isProperty === void 0) { isProperty = false; } @@ -56708,11 +57006,11 @@ var ts; function getTypeForVariableLikeDeclaration(declaration, includeOptionality, checkMode) { // A variable declared in a for..in statement is of type string, or of type keyof T when the // right hand expression is of a type parameter type. - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression, /*checkMode*/ checkMode))); return indexType.flags & (262144 /* TypeFlags.TypeParameter */ | 4194304 /* TypeFlags.Index */) ? getExtractStringType(indexType) : stringType; } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { // checkRightHandSideOfForOf will return undefined if the for-of expression type was // missing properties/signatures required to get its iteratedType (like // [Symbol.iterator] or next). This may be because we accessed properties from anyType, @@ -56723,7 +57021,7 @@ var ts; if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } - var isProperty = ts.isPropertyDeclaration(declaration) || ts.isPropertySignature(declaration); + var isProperty = ts.isPropertyDeclaration(declaration) && !ts.hasAccessorModifier(declaration) || ts.isPropertySignature(declaration); var isOptional = includeOptionality && (isProperty && !!declaration.questionToken || ts.isParameter(declaration) && (!!declaration.questionToken || isJSDocOptionalParameter(declaration)) || isOptionalJSDocPropertyLikeTag(declaration)); @@ -56750,8 +57048,8 @@ var ts; if (ts.isParameter(declaration)) { var func = declaration.parent; // For a parameter of a set accessor, use the type of the get accessor if one is present - if (func.kind === 173 /* SyntaxKind.SetAccessor */ && hasBindableName(func)) { - var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 172 /* SyntaxKind.GetAccessor */); + if (func.kind === 175 /* SyntaxKind.SetAccessor */ && hasBindableName(func)) { + var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 174 /* SyntaxKind.GetAccessor */); if (getter) { var getterSignature = getSignatureFromDeclaration(getter); var thisParameter = getAccessorThisParameter(func); @@ -56763,11 +57061,9 @@ var ts; return getReturnTypeOfSignature(getterSignature); } } - if (ts.isInJSFile(declaration)) { - var type_1 = getParameterTypeOfTypeTag(func, declaration); - if (type_1) - return type_1; - } + var parameterTypeOfTypeTag = getParameterTypeOfTypeTag(func, declaration); + if (parameterTypeOfTypeTag) + return parameterTypeOfTypeTag; // Use contextual parameter type if one is available var type = declaration.symbol.escapedName === "this" /* InternalSymbolName.This */ ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration); if (type) { @@ -56828,7 +57124,7 @@ var ts; links.isConstructorDeclaredProperty = !!getDeclaringConstructor(symbol) && ts.every(symbol.declarations, function (declaration) { return ts.isBinaryExpression(declaration) && isPossiblyAliasedThisProperty(declaration) && - (declaration.left.kind !== 207 /* SyntaxKind.ElementAccessExpression */ || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && + (declaration.left.kind !== 209 /* SyntaxKind.ElementAccessExpression */ || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && !getAnnotatedTypeForAssignmentDeclaration(/*declaredType*/ undefined, declaration, symbol, declaration); }); } @@ -56850,11 +57146,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; var container = ts.getThisContainer(declaration, /*includeArrowFunctions*/ false); - if (container && (container.kind === 171 /* SyntaxKind.Constructor */ || isJSConstructor(container))) { + if (container && (container.kind === 173 /* SyntaxKind.Constructor */ || isJSConstructor(container))) { return container; } } - ; } /** Create a synthetic property access flow node after the last statement of the file */ function getFlowTypeFromCommonJSExport(symbol) { @@ -57147,9 +57442,9 @@ var ts; var thisContainer = ts.getThisContainer(expression, /*includeArrowFunctions*/ false); // Properties defined in a constructor (or base constructor, or javascript constructor function) don't get undefined added. // Function expressions that are assigned to the prototype count as methods. - return thisContainer.kind === 171 /* SyntaxKind.Constructor */ || - thisContainer.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - (thisContainer.kind === 213 /* SyntaxKind.FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); + return thisContainer.kind === 173 /* SyntaxKind.Constructor */ || + thisContainer.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + (thisContainer.kind === 215 /* SyntaxKind.FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); } function getConstructorDefinedThisAssignmentTypes(types, declarations) { ts.Debug.assert(types.length === declarations.length); @@ -57177,7 +57472,11 @@ var ts; if (reportErrors && !declarationBelongsToPrivateAmbientMember(element)) { reportImplicitAny(element, anyType); } - return anyType; + // When we're including the pattern in the type (an indication we're obtaining a contextual type), we + // use a non-inferrable any type. Inference will never directly infer this type, but it is possible + // to infer a type that contains it, e.g. for a binding pattern like [foo] or { foo }. In such cases, + // widening of the binding pattern type substitutes a regular any for the non-inferrable any. + return includePatternInType ? nonInferrableAnyType : anyType; } // Return the type implied by an object binding pattern function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) { @@ -57215,7 +57514,7 @@ var ts; function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) { var elements = pattern.elements; var lastElement = ts.lastOrUndefined(elements); - var restElement = lastElement && lastElement.kind === 203 /* SyntaxKind.BindingElement */ && lastElement.dotDotDotToken ? lastElement : undefined; + var restElement = lastElement && lastElement.kind === 205 /* SyntaxKind.BindingElement */ && lastElement.dotDotDotToken ? lastElement : undefined; if (elements.length === 0 || elements.length === 1 && restElement) { return languageVersion >= 2 /* ScriptTarget.ES2015 */ ? createIterableType(anyType) : anyArrayType; } @@ -57240,7 +57539,7 @@ var ts; function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { if (includePatternInType === void 0) { includePatternInType = false; } if (reportErrors === void 0) { reportErrors = false; } - return pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ + return pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -57288,7 +57587,7 @@ var ts; } function declarationBelongsToPrivateAmbientMember(declaration) { var root = ts.getRootDeclaration(declaration); - var memberDeclaration = root.kind === 164 /* SyntaxKind.Parameter */ ? root.parent : root; + var memberDeclaration = root.kind === 166 /* SyntaxKind.Parameter */ ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function tryGetTypeFromEffectiveTypeNode(node) { @@ -57343,9 +57642,9 @@ var ts; if (typeNode === undefined) { return useUnknownInCatchVariables ? unknownType : anyType; } - var type_2 = getTypeOfNode(typeNode); + var type_1 = getTypeOfNode(typeNode); // an errorType will make `checkTryStatement` issue an error - return isTypeAny(type_2) || type_2 === unknownType ? type_2 : errorType; + return isTypeAny(type_1) || type_1 === unknownType ? type_1 : errorType; } // Handle export default expressions if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) { @@ -57368,7 +57667,7 @@ var ts; return reportCircularityError(symbol); } var type; - if (declaration.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (declaration.kind === 274 /* SyntaxKind.ExportAssignment */) { type = widenTypeForVariableLikeDeclaration(tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionCached(declaration.expression), declaration); } else if (ts.isBinaryExpression(declaration) || @@ -57436,13 +57735,17 @@ var ts; } function getAnnotatedAccessorTypeNode(accessor) { if (accessor) { - if (accessor.kind === 172 /* SyntaxKind.GetAccessor */) { - var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); - return getterTypeAnnotation; - } - else { - var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation; + switch (accessor.kind) { + case 174 /* SyntaxKind.GetAccessor */: + var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); + return getterTypeAnnotation; + case 175 /* SyntaxKind.SetAccessor */: + var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); + return setterTypeAnnotation; + case 169 /* SyntaxKind.PropertyDeclaration */: + ts.Debug.assert(ts.hasAccessorModifier(accessor)); + var accessorTypeAnnotation = ts.getEffectiveTypeAnnotationNode(accessor); + return accessorTypeAnnotation; } } return undefined; @@ -57464,14 +57767,17 @@ var ts; if (!pushTypeResolution(symbol, 0 /* TypeSystemPropertyName.Type */)) { return errorType; } - var getter = ts.getDeclarationOfKind(symbol, 172 /* SyntaxKind.GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 174 /* SyntaxKind.GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */); + var accessor = ts.tryCast(ts.getDeclarationOfKind(symbol, 169 /* SyntaxKind.PropertyDeclaration */), ts.isAutoAccessorPropertyDeclaration); // We try to resolve a getter type annotation, a setter type annotation, or a getter function // body return type inference, in that order. var type = getter && ts.isInJSFile(getter) && getTypeForDeclarationFromJSDocComment(getter) || getAnnotatedAccessorType(getter) || getAnnotatedAccessorType(setter) || - getter && getter.body && getReturnTypeFromBody(getter); + getAnnotatedAccessorType(accessor) || + getter && getter.body && getReturnTypeFromBody(getter) || + accessor && accessor.initializer && getWidenedTypeForVariableLikeDeclaration(accessor, /*includeOptionality*/ true); if (!type) { if (setter && !isPrivateWithinAmbient(setter)) { errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol)); @@ -57479,6 +57785,9 @@ var ts; else if (getter && !isPrivateWithinAmbient(getter)) { errorOrSuggestion(noImplicitAny, getter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol)); } + else if (accessor && !isPrivateWithinAmbient(accessor)) { + errorOrSuggestion(noImplicitAny, accessor, ts.Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), "any"); + } type = anyType; } if (!popTypeResolution()) { @@ -57488,6 +57797,9 @@ var ts; else if (getAnnotatedAccessorTypeNode(setter)) { error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); } + else if (getAnnotatedAccessorTypeNode(accessor)) { + error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } else if (getter && noImplicitAny) { error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } @@ -57498,12 +57810,13 @@ var ts; return links.type; } function getWriteTypeOfAccessors(symbol) { + var _a; var links = getSymbolLinks(symbol); if (!links.writeType) { if (!pushTypeResolution(symbol, 8 /* TypeSystemPropertyName.WriteType */)) { return errorType; } - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var setter = (_a = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */)) !== null && _a !== void 0 ? _a : ts.tryCast(ts.getDeclarationOfKind(symbol, 169 /* SyntaxKind.PropertyDeclaration */), ts.isAutoAccessorPropertyDeclaration); var writeType = getAnnotatedAccessorType(setter); if (!popTypeResolution()) { if (getAnnotatedAccessorTypeNode(setter)) { @@ -57543,9 +57856,9 @@ var ts; if (symbol.flags & 1536 /* SymbolFlags.Module */ && ts.isShorthandAmbientModuleSymbol(symbol)) { return anyType; } - else if (declaration && (declaration.kind === 221 /* SyntaxKind.BinaryExpression */ || + else if (declaration && (declaration.kind === 223 /* SyntaxKind.BinaryExpression */ || ts.isAccessExpression(declaration) && - declaration.parent.kind === 221 /* SyntaxKind.BinaryExpression */)) { + declaration.parent.kind === 223 /* SyntaxKind.BinaryExpression */)) { return getWidenedTypeForAssignmentDeclaration(symbol); } else if (symbol.flags & 512 /* SymbolFlags.ValueModule */ && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) { @@ -57555,11 +57868,11 @@ var ts; return errorType; } var exportEquals = getMergedSymbol(symbol.exports.get("export=" /* InternalSymbolName.ExportEquals */)); - var type_3 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule); + var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule); if (!popTypeResolution()) { return reportCircularityError(symbol); } - return type_3; + return type_2; } } var type = createObjectType(16 /* ObjectFlags.Anonymous */, symbol); @@ -57610,7 +57923,7 @@ var ts; return errorType; } // Check if variable has initializer that circularly references the variable itself - if (noImplicitAny && (declaration.kind !== 164 /* SyntaxKind.Parameter */ || declaration.initializer)) { + if (noImplicitAny && (declaration.kind !== 166 /* SyntaxKind.Parameter */ || declaration.initializer)) { error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); } // Circularities could also result from parameters in function expressions that end up @@ -57742,46 +58055,46 @@ var ts; return undefined; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 195 /* SyntaxKind.MappedType */: - case 189 /* SyntaxKind.ConditionalType */: { + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 197 /* SyntaxKind.MappedType */: + case 191 /* SyntaxKind.ConditionalType */: { var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); - if (node.kind === 195 /* SyntaxKind.MappedType */) { + if (node.kind === 197 /* SyntaxKind.MappedType */) { return ts.append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter))); } - else if (node.kind === 189 /* SyntaxKind.ConditionalType */) { + else if (node.kind === 191 /* SyntaxKind.ConditionalType */) { return ts.concatenate(outerTypeParameters, getInferTypeParameters(node)); } var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node)); var thisType = includeThisTypes && - (node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */ || node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || isJSConstructor(node)) && + (node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */ || node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || isJSConstructor(node)) && getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters; } - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: var paramSymbol = ts.getParameterSymbolFromJSDoc(node); if (paramSymbol) { node = paramSymbol.valueDeclaration; } break; - case 320 /* SyntaxKind.JSDoc */: { + case 323 /* SyntaxKind.JSDoc */: { var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); return node.tags ? appendTypeParameters(outerTypeParameters, ts.flatMap(node.tags, function (t) { return ts.isJSDocTemplateTag(t) ? t.typeParameters : undefined; })) @@ -57792,7 +58105,7 @@ var ts; } // The outer type parameters are those defined by enclosing generic classes, methods, or functions. function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 /* SymbolFlags.Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 258 /* SyntaxKind.InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* SymbolFlags.Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.InterfaceDeclaration */); ts.Debug.assert(!!declaration, "Class was missing valueDeclaration -OR- non-class had no interface declarations"); return getOuterTypeParameters(declaration); } @@ -57805,9 +58118,9 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - node.kind === 257 /* SyntaxKind.ClassDeclaration */ || - node.kind === 226 /* SyntaxKind.ClassExpression */ || + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + node.kind === 260 /* SyntaxKind.ClassDeclaration */ || + node.kind === 228 /* SyntaxKind.ClassExpression */ || isJSConstructor(node) || ts.isTypeAlias(node)) { var declaration = node; @@ -57959,7 +58272,7 @@ var ts; if (!popTypeResolution() && type.symbol.declarations) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ || declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ || declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { reportCircularBaseType(declaration, type); } } @@ -58055,7 +58368,7 @@ var ts; if (type.symbol.declarations) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getReducedType(getTypeFromTypeNode(node)); @@ -58095,7 +58408,7 @@ var ts; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { if (declaration.flags & 128 /* NodeFlags.ContainsThis */) { return false; } @@ -58174,7 +58487,7 @@ var ts; } else { type = errorType; - if (declaration.kind === 339 /* SyntaxKind.JSDocEnumTag */) { + if (declaration.kind === 342 /* SyntaxKind.JSDocEnumTag */) { error(declaration.typeExpression.type, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } else { @@ -58189,7 +58502,7 @@ var ts; if (ts.isStringLiteralLike(expr)) { return true; } - else if (expr.kind === 221 /* SyntaxKind.BinaryExpression */) { + else if (expr.kind === 223 /* SyntaxKind.BinaryExpression */) { return isStringConcatExpression(expr.left) && isStringConcatExpression(expr.right); } return false; @@ -58204,12 +58517,12 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return true; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 8 /* SyntaxKind.NumericLiteral */; case 79 /* SyntaxKind.Identifier */: return ts.nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isStringConcatExpression(expr); default: return false; @@ -58224,7 +58537,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind === 263 /* SyntaxKind.EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (member.initializer && ts.isStringLiteralLike(member.initializer)) { @@ -58253,7 +58566,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind === 263 /* SyntaxKind.EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; var value = getEnumMemberValue(member); @@ -58326,22 +58639,22 @@ var ts; */ function isThislessType(node) { switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 196 /* SyntaxKind.LiteralType */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 198 /* SyntaxKind.LiteralType */: return true; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return isThislessType(node.elementType); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return !node.typeArguments || node.typeArguments.every(isThislessType); } return false; @@ -58367,7 +58680,7 @@ var ts; function isThislessFunctionLikeDeclaration(node) { var returnType = ts.getEffectiveReturnTypeNode(node); var typeParameters = ts.getEffectiveTypeParameterDeclarations(node); - return (node.kind === 171 /* SyntaxKind.Constructor */ || (!!returnType && isThislessType(returnType))) && + return (node.kind === 173 /* SyntaxKind.Constructor */ || (!!returnType && isThislessType(returnType))) && node.parameters.every(isThislessVariableLikeDeclaration) && typeParameters.every(isThislessTypeParameter); } @@ -58383,14 +58696,14 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return isThislessVariableLikeDeclaration(declaration); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return isThislessFunctionLikeDeclaration(declaration); } } @@ -58601,8 +58914,10 @@ var ts; if (members) { for (var _b = 0, members_5 = members; _b < members_5.length; _b++) { var member = members_5[_b]; - if (isStatic_1 === ts.hasStaticModifier(member) && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic_1 === ts.hasStaticModifier(member)) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -58617,8 +58932,10 @@ var ts; || ts.isBinaryExpression(member) && isPossiblyAliasedThisProperty(member, assignmentKind) || assignmentKind === 9 /* AssignmentDeclarationKind.ObjectDefinePrototypeProperty */ || assignmentKind === 6 /* AssignmentDeclarationKind.Prototype */; // A straight `Prototype` assignment probably can never have a computed name - if (isStatic_1 === !isInstanceMember && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic_1 === !isInstanceMember) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -58805,7 +59122,7 @@ var ts; var baseConstructorType = getBaseConstructorTypeOfClass(classType); var baseSignatures = getSignaturesOfType(baseConstructorType, 1 /* SignatureKind.Construct */); var declaration = ts.getClassLikeDeclarationOfSymbol(classType.symbol); - var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */); + var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */); if (baseSignatures.length === 0) { return [createSignature(undefined, classType.localTypeParameters, undefined, ts.emptyArray, classType, /*resolvedTypePredicate*/ undefined, 0, isAbstract ? 4 /* SignatureFlags.Abstract */ : 0 /* SignatureFlags.None */)]; } @@ -59278,6 +59595,12 @@ var ts; return mapType(type, getLowerBoundOfKeyType); } if (type.flags & 2097152 /* TypeFlags.Intersection */) { + // Similarly to getTypeFromIntersectionTypeNode, we preserve the special string & {}, number & {}, + // and bigint & {} intersections that are used to prevent subtype reduction in union types. + var types = type.types; + if (types.length === 2 && !!(types[0].flags & (4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) && types[1] === emptyTypeLiteralType) { + return type; + } return getIntersectionType(ts.sameMap(type.types, getLowerBoundOfKeyType)); } return type; @@ -59421,8 +59744,8 @@ var ts; } function isMappedTypeWithKeyofConstraintDeclaration(type) { var constraintDeclaration = getConstraintDeclarationForMappedType(type); // TODO: GH#18217 - return constraintDeclaration.kind === 193 /* SyntaxKind.TypeOperator */ && - constraintDeclaration.operator === 140 /* SyntaxKind.KeyOfKeyword */; + return constraintDeclaration.kind === 195 /* SyntaxKind.TypeOperator */ && + constraintDeclaration.operator === 141 /* SyntaxKind.KeyOfKeyword */; } function getModifiersTypeFromMappedType(type) { if (!type.modifiersType) { @@ -59782,10 +60105,10 @@ var ts; var baseTypes = []; var different = false; for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var type_4 = types_7[_i]; - var baseType = getBaseConstraint(type_4); + var type_3 = types_7[_i]; + var baseType = getBaseConstraint(type_3); if (baseType) { - if (baseType !== type_4) { + if (baseType !== type_3) { different = true; } baseTypes.push(baseType); @@ -59829,7 +60152,7 @@ var ts; return constraint && getBaseConstraint(constraint); } if (t.flags & 33554432 /* TypeFlags.Substitution */) { - return getBaseConstraint(t.substitute); + return getBaseConstraint(getSubstitutionIntersection(t)); } return t; } @@ -59956,7 +60279,7 @@ var ts; var isInstantiation = (getTargetSymbol(prop) || prop) === (getTargetSymbol(singleProp) || singleProp); // If the symbols are instances of one another with identical types - consider the symbols // equivalent and just use the first one, which thus allows us to avoid eliding private - // members when intersecting a (this-)instantiations of a class with it's raw base or another instance + // members when intersecting a (this-)instantiations of a class with its raw base or another instance if (isInstantiation && compareProperties(singleProp, prop, function (a, b) { return a === b ? -1 /* Ternary.True */ : 0 /* Ternary.False */; }) === -1 /* Ternary.True */) { // If we merged instantiations of a generic type, we replicate the symbol parent resetting behavior we used // to do when we recorded multiple distinct symbols so that we still get, eg, `Array.length` printed @@ -60004,7 +60327,11 @@ var ts; } } } - if (!singleProp || isUnion && (propSet || checkFlags & 48 /* CheckFlags.Partial */) && checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */)) { + if (!singleProp || + isUnion && + (propSet || checkFlags & 48 /* CheckFlags.Partial */) && + checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */) && + !(propSet && getCommonDeclarationsOfSymbols(ts.arrayFrom(propSet.values())))) { // No property was found, or, in a union, a property has a private or protected declaration in one // constituent, but is missing or has a different declaration in another constituent. return undefined; @@ -60106,6 +60433,33 @@ var ts; } return property; } + function getCommonDeclarationsOfSymbols(symbols) { + var commonDeclarations; + var _loop_14 = function (symbol) { + if (!symbol.declarations) { + return { value: undefined }; + } + if (!commonDeclarations) { + commonDeclarations = new ts.Set(symbol.declarations); + return "continue"; + } + commonDeclarations.forEach(function (declaration) { + if (!ts.contains(symbol.declarations, declaration)) { + commonDeclarations.delete(declaration); + } + }); + if (commonDeclarations.size === 0) { + return { value: undefined }; + } + }; + for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) { + var symbol = symbols_3[_i]; + var state_4 = _loop_14(symbol); + if (typeof state_4 === "object") + return state_4.value; + } + return commonDeclarations; + } function getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment) { var property = getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment); // We need to filter out partial properties in union types @@ -60309,10 +60663,10 @@ var ts; function isJSDocOptionalParameter(node) { return ts.isInJSFile(node) && ( // node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType - node.type && node.type.kind === 316 /* SyntaxKind.JSDocOptionalType */ + node.type && node.type.kind === 319 /* SyntaxKind.JSDocOptionalType */ || ts.getJSDocParameterTags(node).some(function (_a) { var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */; })); } function tryFindAmbientModule(moduleName, withAugmentations) { @@ -60345,14 +60699,14 @@ var ts; return false; } function isOptionalPropertyDeclaration(node) { - return ts.isPropertyDeclaration(node) && node.questionToken; + return ts.isPropertyDeclaration(node) && !ts.hasAccessorModifier(node) && node.questionToken; } function isOptionalJSDocPropertyLikeTag(node) { if (!ts.isJSDocPropertyLikeTag(node)) { return false; } var isBracketed = node.isBracketed, typeExpression = node.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */; } function createTypePredicate(kind, parameterName, parameterIndex, type) { return { kind: kind, parameterName: parameterName, parameterIndex: parameterIndex, type: type }; @@ -60434,7 +60788,7 @@ var ts; else { parameters.push(paramSymbol); } - if (type && type.kind === 196 /* SyntaxKind.LiteralType */) { + if (type && type.kind === 198 /* SyntaxKind.LiteralType */) { flags |= 2 /* SignatureFlags.HasLiteralTypes */; } // Record a new minimum argument count if this is not an optional parameter @@ -60447,24 +60801,24 @@ var ts; } } // If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation - if ((declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) && + if ((declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) && hasBindableName(declaration) && (!hasThisParameter || !thisParameter)) { - var otherKind = declaration.kind === 172 /* SyntaxKind.GetAccessor */ ? 173 /* SyntaxKind.SetAccessor */ : 172 /* SyntaxKind.GetAccessor */; + var otherKind = declaration.kind === 174 /* SyntaxKind.GetAccessor */ ? 175 /* SyntaxKind.SetAccessor */ : 174 /* SyntaxKind.GetAccessor */; var other = ts.getDeclarationOfKind(getSymbolOfNode(declaration), otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); } } - var classType = declaration.kind === 171 /* SyntaxKind.Constructor */ ? + var classType = declaration.kind === 173 /* SyntaxKind.Constructor */ ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration); if (ts.hasRestParameter(declaration) || ts.isInJSFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters)) { flags |= 1 /* SignatureFlags.HasRestParameter */; } - if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */) || - ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 128 /* ModifierFlags.Abstract */)) { + if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */) || + ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 256 /* ModifierFlags.Abstract */)) { flags |= 4 /* SignatureFlags.Abstract */; } links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, @@ -60543,16 +60897,16 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node.escapedText === argumentsSymbol.escapedName && getReferencedValueSymbol(node) === argumentsSymbol; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && traverse(node.name); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return traverse(node.expression); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return traverse(node.initializer); default: return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && !!ts.forEachChild(node, traverse); @@ -60576,7 +60930,12 @@ var ts; continue; } } - result.push(getSignatureFromDeclaration(decl)); + // If this is a function or method declaration, get the signature from the @type tag for the sake of optional parameters. + // Exclude contextually-typed kinds because we already apply the @type tag to the context, plus applying it here to the initializer would supress checks that the two are compatible. + result.push((!ts.isFunctionExpressionOrArrowFunction(decl) && + !ts.isObjectLiteralMethod(decl) && + getSignatureOfTypeTag(decl)) || + getSignatureFromDeclaration(decl)); } return result; } @@ -60607,7 +60966,7 @@ var ts; else { var type = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration); var jsdocPredicate = void 0; - if (!type && ts.isInJSFile(signature.declaration)) { + if (!type) { var jsdocSignature = getSignatureOfTypeTag(signature.declaration); if (jsdocSignature && signature !== jsdocSignature) { jsdocPredicate = getTypePredicateOfSignature(jsdocSignature); @@ -60624,7 +60983,7 @@ var ts; function createTypePredicateFromTypePredicateNode(node, signature) { var parameterName = node.parameterName; var type = node.type && getTypeFromTypeNode(node.type); - return parameterName.kind === 192 /* SyntaxKind.ThisType */ ? + return parameterName.kind === 194 /* SyntaxKind.ThisType */ ? createTypePredicate(node.assertsModifier ? 2 /* TypePredicateKind.AssertsThis */ : 0 /* TypePredicateKind.This */, /*parameterName*/ undefined, /*parameterIndex*/ undefined, type) : createTypePredicate(node.assertsModifier ? 3 /* TypePredicateKind.AssertsIdentifier */ : 1 /* TypePredicateKind.Identifier */, parameterName.escapedText, ts.findIndex(signature.parameters, function (p) { return p.escapedName === parameterName.escapedText; }), type); } @@ -60670,7 +61029,7 @@ var ts; return signature.resolvedReturnType; } function getReturnTypeFromAnnotation(declaration) { - if (declaration.kind === 171 /* SyntaxKind.Constructor */) { + if (declaration.kind === 173 /* SyntaxKind.Constructor */) { return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)); } if (ts.isJSDocConstructSignature(declaration)) { @@ -60680,12 +61039,12 @@ var ts; if (typeNode) { return getTypeFromTypeNode(typeNode); } - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ && hasBindableName(declaration)) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ && hasBindableName(declaration)) { var jsDocType = ts.isInJSFile(declaration) && getTypeForDeclarationFromJSDocComment(declaration); if (jsDocType) { return jsDocType; } - var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 173 /* SyntaxKind.SetAccessor */); + var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 175 /* SyntaxKind.SetAccessor */); var setterType = getAnnotatedAccessorType(setter); if (setterType) { return setterType; @@ -60788,7 +61147,7 @@ var ts; if (!signature.isolatedSignatureType) { var kind = (_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind; // If declaration is undefined, it is likely to be the signature of the default constructor. - var isConstructor = kind === undefined || kind === 171 /* SyntaxKind.Constructor */ || kind === 175 /* SyntaxKind.ConstructSignature */ || kind === 180 /* SyntaxKind.ConstructorType */; + var isConstructor = kind === undefined || kind === 173 /* SyntaxKind.Constructor */ || kind === 177 /* SyntaxKind.ConstructSignature */ || kind === 182 /* SyntaxKind.ConstructorType */; var type = createObjectType(16 /* ObjectFlags.Anonymous */); type.members = emptySymbols; type.properties = ts.emptyArray; @@ -60815,7 +61174,7 @@ var ts; function getIndexInfosOfIndexSymbol(indexSymbol) { if (indexSymbol.declarations) { var indexInfos_4 = []; - var _loop_14 = function (declaration) { + var _loop_15 = function (declaration) { if (declaration.parameters.length === 1) { var parameter = declaration.parameters[0]; if (parameter.type) { @@ -60829,7 +61188,7 @@ var ts; }; for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - _loop_14(declaration); + _loop_15(declaration); } return indexInfos_4; } @@ -60846,14 +61205,14 @@ var ts; var _a; var inferences; if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) { - var _loop_15 = function (declaration) { - if (declaration.parent.kind === 190 /* SyntaxKind.InferType */) { + var _loop_16 = function (declaration) { + if (declaration.parent.kind === 192 /* SyntaxKind.InferType */) { // When an 'infer T' declaration is immediately contained in a type reference node // (such as 'Foo'), T's constraint is inferred from the constraint of the // corresponding type parameter in 'Foo'. When multiple 'infer T' declarations are // present, we form an intersection of the inferred constraint types. var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1]; - if (grandParent.kind === 178 /* SyntaxKind.TypeReference */ && !omitTypeReferences) { + if (grandParent.kind === 180 /* SyntaxKind.TypeReference */ && !omitTypeReferences) { var typeReference_1 = grandParent; var typeParameters_1 = getTypeParametersForTypeReference(typeReference_1); if (typeParameters_1) { @@ -60880,27 +61239,27 @@ var ts; } // When an 'infer T' declaration is immediately contained in a rest parameter declaration, a rest type // or a named rest tuple element, we infer an 'unknown[]' constraint. - else if (grandParent.kind === 164 /* SyntaxKind.Parameter */ && grandParent.dotDotDotToken || - grandParent.kind === 186 /* SyntaxKind.RestType */ || - grandParent.kind === 197 /* SyntaxKind.NamedTupleMember */ && grandParent.dotDotDotToken) { + else if (grandParent.kind === 166 /* SyntaxKind.Parameter */ && grandParent.dotDotDotToken || + grandParent.kind === 188 /* SyntaxKind.RestType */ || + grandParent.kind === 199 /* SyntaxKind.NamedTupleMember */ && grandParent.dotDotDotToken) { inferences = ts.append(inferences, createArrayType(unknownType)); } // When an 'infer T' declaration is immediately contained in a string template type, we infer a 'string' // constraint. - else if (grandParent.kind === 199 /* SyntaxKind.TemplateLiteralTypeSpan */) { + else if (grandParent.kind === 201 /* SyntaxKind.TemplateLiteralTypeSpan */) { inferences = ts.append(inferences, stringType); } // When an 'infer T' declaration is in the constraint position of a mapped type, we infer a 'keyof any' // constraint. - else if (grandParent.kind === 163 /* SyntaxKind.TypeParameter */ && grandParent.parent.kind === 195 /* SyntaxKind.MappedType */) { + else if (grandParent.kind === 165 /* SyntaxKind.TypeParameter */ && grandParent.parent.kind === 197 /* SyntaxKind.MappedType */) { inferences = ts.append(inferences, keyofConstraintType); } // When an 'infer T' declaration is the template of a mapped type, and that mapped type is the extends // clause of a conditional whose check type is also a mapped type, give it a constraint equal to the template // of the check type's mapped type - else if (grandParent.kind === 195 /* SyntaxKind.MappedType */ && grandParent.type && - ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 189 /* SyntaxKind.ConditionalType */ && - grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 195 /* SyntaxKind.MappedType */ && + else if (grandParent.kind === 197 /* SyntaxKind.MappedType */ && grandParent.type && + ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 191 /* SyntaxKind.ConditionalType */ && + grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 197 /* SyntaxKind.MappedType */ && grandParent.parent.checkType.type) { var checkMappedType_1 = grandParent.parent.checkType; var nodeType = getTypeFromTypeNode(checkMappedType_1.type); @@ -60910,7 +61269,7 @@ var ts; }; for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) { var declaration = _b[_i]; - _loop_15(declaration); + _loop_16(declaration); } } return inferences && getIntersectionType(inferences); @@ -60932,7 +61291,7 @@ var ts; if (type.flags & 1 /* TypeFlags.Any */ && !isErrorType(type)) { // Allow errorType to propegate to keep downstream errors suppressed // use keyofConstraintType as the base constraint for mapped type key constraints (unknown isn;t assignable to that, but `any` was), // use unknown otherwise - type = constraintDeclaration.parent.parent.kind === 195 /* SyntaxKind.MappedType */ ? keyofConstraintType : unknownType; + type = constraintDeclaration.parent.parent.kind === 197 /* SyntaxKind.MappedType */ ? keyofConstraintType : unknownType; } typeParameter.constraint = type; } @@ -60941,7 +61300,7 @@ var ts; return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - var tp = ts.getDeclarationOfKind(typeParameter.symbol, 163 /* SyntaxKind.TypeParameter */); + var tp = ts.getDeclarationOfKind(typeParameter.symbol, 165 /* SyntaxKind.TypeParameter */); var host = ts.isJSDocTemplateTag(tp.parent) ? ts.getEffectiveContainerForJSDocTemplateTag(tp.parent) : tp.parent; return host && getSymbolOfNode(host); } @@ -61027,8 +61386,8 @@ var ts; } var node = type.node; var typeArguments = !node ? ts.emptyArray : - node.kind === 178 /* SyntaxKind.TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : - node.kind === 183 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : + node.kind === 180 /* SyntaxKind.TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : + node.kind === 185 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); if (popTypeResolution()) { type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments; @@ -61070,7 +61429,7 @@ var ts; return errorType; } } - if (node.kind === 178 /* SyntaxKind.TypeReference */ && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) { return createDeferredTypeReference(type, node, /*mapper*/ undefined); } // In a type reference, the outer type parameters of the referenced class or interface are automatically @@ -61141,9 +61500,9 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // We only support expressions that are simple qualified names. For other // expressions this produces undefined. var expr = node.expression; @@ -61158,13 +61517,13 @@ var ts; return symbol.parent ? "".concat(getSymbolPath(symbol.parent), ".").concat(symbol.escapedName) : symbol.escapedName; } function getUnresolvedSymbolForEntityName(name) { - var identifier = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.right : - name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ ? name.name : + var identifier = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.right : + name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? name.name : name; var text = identifier.escapedText; if (text) { - var parentSymbol = name.kind === 161 /* SyntaxKind.QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) : - name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) : + var parentSymbol = name.kind === 163 /* SyntaxKind.QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) : + name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) : undefined; var path = parentSymbol ? "".concat(getSymbolPath(parentSymbol), ".").concat(text) : text; var result = unresolvedSymbols.get(path); @@ -61225,7 +61584,7 @@ var ts; var valueType = getTypeOfSymbol(symbol); var typeType = valueType; if (symbol.valueDeclaration) { - var isImportTypeWithQualifier = node.kind === 200 /* SyntaxKind.ImportType */ && node.qualifier; + var isImportTypeWithQualifier = node.kind === 202 /* SyntaxKind.ImportType */ && node.qualifier; // valueType might not have a symbol, eg, {import('./b').STRING_LITERAL} if (valueType.symbol && valueType.symbol !== symbol && isImportTypeWithQualifier) { typeType = getTypeReferenceType(node, valueType.symbol); @@ -61235,23 +61594,27 @@ var ts; } return links.resolvedJSDocType; } - function getSubstitutionType(baseType, substitute) { - if (substitute.flags & 3 /* TypeFlags.AnyOrUnknown */ || substitute === baseType) { + function getSubstitutionType(baseType, constraint) { + if (constraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || constraint === baseType || + !isGenericType(baseType) && !isGenericType(constraint)) { return baseType; } - var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(substitute)); + var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(constraint)); var cached = substitutionTypes.get(id); if (cached) { return cached; } var result = createType(33554432 /* TypeFlags.Substitution */); result.baseType = baseType; - result.substitute = substitute; + result.constraint = constraint; substitutionTypes.set(id, result); return result; } + function getSubstitutionIntersection(substitutionType) { + return getIntersectionType([substitutionType.constraint, substitutionType.baseType]); + } function isUnaryTupleTypeNode(node) { - return node.kind === 184 /* SyntaxKind.TupleType */ && node.elements.length === 1; + return node.kind === 186 /* SyntaxKind.TupleType */ && node.elements.length === 1; } function getImpliedConstraint(type, checkNode, extendsNode) { return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(type, checkNode.elements[0], extendsNode.elements[0]) : @@ -61261,16 +61624,16 @@ var ts; function getConditionalFlowTypeOfType(type, node) { var constraints; var covariant = true; - while (node && !ts.isStatement(node) && node.kind !== 320 /* SyntaxKind.JSDoc */) { + while (node && !ts.isStatement(node) && node.kind !== 323 /* SyntaxKind.JSDoc */) { var parent = node.parent; // only consider variance flipped by parameter locations - `keyof` types would usually be considered variance inverting, but // often get used in indexed accesses where they behave sortof invariantly, but our checking is lax - if (parent.kind === 164 /* SyntaxKind.Parameter */) { + if (parent.kind === 166 /* SyntaxKind.Parameter */) { covariant = !covariant; } // Always substitute on type parameters, regardless of variance, since even // in contravariant positions, they may rely on substituted constraints to be valid - if ((covariant || type.flags & 8650752 /* TypeFlags.TypeVariable */) && parent.kind === 189 /* SyntaxKind.ConditionalType */ && node === parent.trueType) { + if ((covariant || type.flags & 8650752 /* TypeFlags.TypeVariable */) && parent.kind === 191 /* SyntaxKind.ConditionalType */ && node === parent.trueType) { var constraint = getImpliedConstraint(type, parent.checkType, parent.extendsType); if (constraint) { constraints = ts.append(constraints, constraint); @@ -61278,7 +61641,7 @@ var ts; } // Given a homomorphic mapped type { [K in keyof T]: XXX }, where T is constrained to an array or tuple type, in the // template type XXX, K has an added constraint of number | `${number}`. - else if (type.flags & 262144 /* TypeFlags.TypeParameter */ && parent.kind === 195 /* SyntaxKind.MappedType */ && node === parent.type) { + else if (type.flags & 262144 /* TypeFlags.TypeParameter */ && parent.kind === 197 /* SyntaxKind.MappedType */ && node === parent.type) { var mappedType = getTypeFromTypeNode(parent); if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) { var typeParameter = getHomomorphicTypeVariable(mappedType); @@ -61292,10 +61655,10 @@ var ts; } node = parent; } - return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type; + return constraints ? getSubstitutionType(type, getIntersectionType(constraints)) : type; } function isJSDocTypeReference(node) { - return !!(node.flags & 8388608 /* NodeFlags.JSDoc */) && (node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 200 /* SyntaxKind.ImportType */); + return !!(node.flags & 8388608 /* NodeFlags.JSDoc */) && (node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 202 /* SyntaxKind.ImportType */); } function checkNoTypeArguments(node, symbol) { if (node.typeArguments) { @@ -61410,9 +61773,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return declaration; } } @@ -61563,6 +61926,13 @@ var ts; function getGlobalBigIntType() { return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType; } + function getGlobalNaNSymbol() { + return (deferredGlobalNaNSymbol || (deferredGlobalNaNSymbol = getGlobalValueSymbol("NaN", /*reportErrors*/ false))); + } + function getGlobalRecordSymbol() { + deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol); + return deferredGlobalRecordSymbol === unknownSymbol ? undefined : deferredGlobalRecordSymbol; + } /** * Instantiates a global type that is generic with some element type, and returns that instantiation. */ @@ -61580,11 +61950,11 @@ var ts; } function getTupleElementFlags(node) { switch (node.kind) { - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return 2 /* ElementFlags.Optional */; - case 186 /* SyntaxKind.RestType */: + case 188 /* SyntaxKind.RestType */: return getRestTypeElementFlags(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return node.questionToken ? 2 /* ElementFlags.Optional */ : node.dotDotDotToken ? getRestTypeElementFlags(node) : 1 /* ElementFlags.Required */; @@ -61602,14 +61972,14 @@ var ts; return readonly ? globalReadonlyArrayType : globalArrayType; } var elementFlags = ts.map(node.elements, getTupleElementFlags); - var missingName = ts.some(node.elements, function (e) { return e.kind !== 197 /* SyntaxKind.NamedTupleMember */; }); + var missingName = ts.some(node.elements, function (e) { return e.kind !== 199 /* SyntaxKind.NamedTupleMember */; }); return getTupleTargetType(elementFlags, readonly, /*associatedNames*/ missingName ? undefined : node.elements); } // Return true if the given type reference node is directly aliased or if it needs to be deferred // because it is possibly contained in a circular chain of eagerly resolved types. function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) { - return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 183 /* SyntaxKind.ArrayType */ ? mayResolveTypeAlias(node.elementType) : - node.kind === 184 /* SyntaxKind.TupleType */ ? ts.some(node.elements, mayResolveTypeAlias) : + return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 185 /* SyntaxKind.ArrayType */ ? mayResolveTypeAlias(node.elementType) : + node.kind === 186 /* SyntaxKind.TupleType */ ? ts.some(node.elements, mayResolveTypeAlias) : hasDefaultTypeArguments || ts.some(node.typeArguments, mayResolveTypeAlias)); } // Return true when the given node is transitively contained in type constructs that eagerly @@ -61618,18 +61988,18 @@ var ts; function isResolvedByTypeAlias(node) { var parent = node.parent; switch (parent.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: - case 178 /* SyntaxKind.TypeReference */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 189 /* SyntaxKind.ConditionalType */: - case 193 /* SyntaxKind.TypeOperator */: - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: + case 180 /* SyntaxKind.TypeReference */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 191 /* SyntaxKind.ConditionalType */: + case 195 /* SyntaxKind.TypeOperator */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return isResolvedByTypeAlias(parent); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; } return false; @@ -61638,28 +62008,28 @@ var ts; // of a type alias. function mayResolveTypeAlias(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return isJSDocTypeReference(node) || !!(resolveTypeReferenceName(node, 788968 /* SymbolFlags.Type */).flags & 524288 /* SymbolFlags.TypeAlias */); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return true; - case 193 /* SyntaxKind.TypeOperator */: - return node.operator !== 154 /* SyntaxKind.UniqueKeyword */ && mayResolveTypeAlias(node.type); - case 191 /* SyntaxKind.ParenthesizedType */: - case 185 /* SyntaxKind.OptionalType */: - case 197 /* SyntaxKind.NamedTupleMember */: - case 316 /* SyntaxKind.JSDocOptionalType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 195 /* SyntaxKind.TypeOperator */: + return node.operator !== 156 /* SyntaxKind.UniqueKeyword */ && mayResolveTypeAlias(node.type); + case 193 /* SyntaxKind.ParenthesizedType */: + case 187 /* SyntaxKind.OptionalType */: + case 199 /* SyntaxKind.NamedTupleMember */: + case 319 /* SyntaxKind.JSDocOptionalType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return mayResolveTypeAlias(node.type); - case 186 /* SyntaxKind.RestType */: - return node.type.kind !== 183 /* SyntaxKind.ArrayType */ || mayResolveTypeAlias(node.type.elementType); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 188 /* SyntaxKind.RestType */: + return node.type.kind !== 185 /* SyntaxKind.ArrayType */ || mayResolveTypeAlias(node.type.elementType); + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return ts.some(node.types, mayResolveTypeAlias); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return mayResolveTypeAlias(node.objectType) || mayResolveTypeAlias(node.indexType); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return mayResolveTypeAlias(node.checkType) || mayResolveTypeAlias(node.extendsType) || mayResolveTypeAlias(node.trueType) || mayResolveTypeAlias(node.falseType); } @@ -61672,19 +62042,19 @@ var ts; if (target === emptyGenericType) { links.resolvedType = emptyObjectType; } - else if (!(node.kind === 184 /* SyntaxKind.TupleType */ && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8 /* ElementFlags.Variadic */); })) && isDeferredTypeReferenceNode(node)) { - links.resolvedType = node.kind === 184 /* SyntaxKind.TupleType */ && node.elements.length === 0 ? target : + else if (!(node.kind === 186 /* SyntaxKind.TupleType */ && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8 /* ElementFlags.Variadic */); })) && isDeferredTypeReferenceNode(node)) { + links.resolvedType = node.kind === 186 /* SyntaxKind.TupleType */ && node.elements.length === 0 ? target : createDeferredTypeReference(target, node, /*mapper*/ undefined); } else { - var elementTypes = node.kind === 183 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); + var elementTypes = node.kind === 185 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); links.resolvedType = createNormalizedTypeReference(target, elementTypes); } } return links.resolvedType; } function isReadonlyTypeOperator(node) { - return ts.isTypeOperatorNode(node) && node.operator === 145 /* SyntaxKind.ReadonlyKeyword */; + return ts.isTypeOperatorNode(node) && node.operator === 146 /* SyntaxKind.ReadonlyKeyword */; } function createTupleType(elementTypes, elementFlags, readonly, namedMemberDeclarations) { if (readonly === void 0) { readonly = false; } @@ -61799,7 +62169,7 @@ var ts; var lastRequiredIndex = -1; var firstRestIndex = -1; var lastOptionalOrRestIndex = -1; - var _loop_16 = function (i) { + var _loop_17 = function (i) { var type = elementTypes[i]; var flags = target.elementFlags[i]; if (flags & 8 /* ElementFlags.Variadic */) { @@ -61829,9 +62199,9 @@ var ts; } }; for (var i = 0; i < elementTypes.length; i++) { - var state_4 = _loop_16(i); - if (typeof state_4 === "object") - return state_4.value; + var state_5 = _loop_17(i); + if (typeof state_5 === "object") + return state_5.value; } // Turn optional elements preceding the last required element into required elements for (var i = 0; i < lastRequiredIndex; i++) { @@ -61859,7 +62229,7 @@ var ts; if (flags & (2 /* ElementFlags.Optional */ | 4 /* ElementFlags.Rest */)) { lastOptionalOrRestIndex = expandedFlags.length; } - expandedTypes.push(type); + expandedTypes.push(flags & 2 /* ElementFlags.Optional */ ? addOptionality(type, /*isProperty*/ true) : type); expandedFlags.push(flags); if (expandedDeclarations && declaration) { expandedDeclarations.push(declaration); @@ -62025,7 +62395,7 @@ var ts; var templates = ts.filter(types, isPatternLiteralType); if (templates.length) { var i = types.length; - var _loop_17 = function () { + var _loop_18 = function () { i--; var t = types[i]; if (t.flags & 128 /* TypeFlags.StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) { @@ -62033,7 +62403,7 @@ var ts; } }; while (i > 0) { - _loop_17(); + _loop_18(); } } } @@ -62110,14 +62480,14 @@ var ts; var namedUnions = []; addNamedUnions(namedUnions, types); var reducedTypes = []; - var _loop_18 = function (t) { + var _loop_19 = function (t) { if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) { reducedTypes.push(t); } }; for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) { var t = typeSet_1[_i]; - _loop_18(t); + _loop_19(t); } if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) { return namedUnions[0]; @@ -62607,7 +62977,7 @@ var ts; type.flags & 16777216 /* TypeFlags.Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* TypeFlags.UnionOrIntersection */ | 134217728 /* TypeFlags.TemplateLiteral */) ? ts.every(type.types, isDistributive) : type.flags & 8388608 /* TypeFlags.IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : - type.flags & 33554432 /* TypeFlags.Substitution */ ? isDistributive(type.substitute) : + type.flags & 33554432 /* TypeFlags.Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* TypeFlags.StringMapping */ ? isDistributive(type.type) : false; } @@ -62688,15 +63058,15 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { switch (node.operator) { - case 140 /* SyntaxKind.KeyOfKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: links.resolvedType = getIndexType(getTypeFromTypeNode(node.type)); break; - case 154 /* SyntaxKind.UniqueKeyword */: - links.resolvedType = node.type.kind === 151 /* SyntaxKind.SymbolKeyword */ + case 156 /* SyntaxKind.UniqueKeyword */: + links.resolvedType = node.type.kind === 153 /* SyntaxKind.SymbolKeyword */ ? getESSymbolLikeTypeForNode(ts.walkUpParenthesizedTypes(node.parent)) : errorType; break; - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: links.resolvedType = getTypeFromTypeNode(node.type); break; default: @@ -62888,7 +63258,7 @@ var ts; } function getPropertyTypeForIndexType(originalObjectType, objectType, indexType, fullIndexType, accessNode, accessFlags) { var _a; - var accessExpression = accessNode && accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ ? accessNode : undefined; var propName = accessNode && ts.isPrivateIdentifier(accessNode) ? undefined : getPropertyNameFromIndex(indexType, accessNode); if (propName !== undefined) { if (accessFlags & 256 /* AccessFlags.Contextual */) { @@ -63059,9 +63429,9 @@ var ts; } } function getIndexNodeForAccessExpression(accessNode) { - return accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ ? accessNode.argumentExpression : - accessNode.kind === 194 /* SyntaxKind.IndexedAccessType */ ? accessNode.indexType : - accessNode.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? accessNode.expression : + return accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ ? accessNode.argumentExpression : + accessNode.kind === 196 /* SyntaxKind.IndexedAccessType */ ? accessNode.indexType : + accessNode.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? accessNode.expression : accessNode; } function isPatternLiteralPlaceholderType(type) { @@ -63090,7 +63460,7 @@ var ts; if (type.flags & 33554432 /* TypeFlags.Substitution */) { if (!(type.objectFlags & 2097152 /* ObjectFlags.IsGenericTypeComputed */)) { type.objectFlags |= 2097152 /* ObjectFlags.IsGenericTypeComputed */ | - getGenericObjectFlags(type.substitute) | getGenericObjectFlags(type.baseType); + getGenericObjectFlags(type.baseType) | getGenericObjectFlags(type.constraint); } return type.objectFlags & 12582912 /* ObjectFlags.IsGenericType */; } @@ -63241,7 +63611,7 @@ var ts; // for a generic T and a non-generic K, we eagerly resolve T[K] if it originates in an expression. This is to // preserve backwards compatibility. For example, an element access 'this["foo"]' has always been resolved // eagerly using the constraint type of 'this' at the given location. - if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 194 /* SyntaxKind.IndexedAccessType */ ? + if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 196 /* SyntaxKind.IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) { if (objectType.flags & 3 /* TypeFlags.AnyOrUnknown */) { @@ -63293,11 +63663,7 @@ var ts; var objectType = getTypeFromTypeNode(node.objectType); var indexType = getTypeFromTypeNode(node.indexType); var potentialAlias = getAliasSymbolForTypeNode(node); - var resolved = getIndexedAccessType(objectType, indexType, 0 /* AccessFlags.None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); - links.resolvedType = resolved.flags & 8388608 /* TypeFlags.IndexedAccess */ && - resolved.objectType === objectType && - resolved.indexType === indexType ? - getConditionalFlowTypeOfType(resolved, node) : resolved; + links.resolvedType = getIndexedAccessType(objectType, indexType, 0 /* AccessFlags.None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); } return links.resolvedType; } @@ -63351,7 +63717,7 @@ var ts; var result; var extraTypes; var tailCount = 0; - var _loop_19 = function () { + var _loop_20 = function () { if (tailCount === 1000) { error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite); result = errorType; @@ -63472,10 +63838,10 @@ var ts; // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive // cases we increment the tail recursion counter and stop after 1000 iterations. while (true) { - var state_5 = _loop_19(); - if (typeof state_5 === "object") - return state_5.value; - if (state_5 === "break") + var state_6 = _loop_20(); + if (typeof state_6 === "object") + return state_6.value; + if (state_6 === "break") break; } return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result; @@ -63668,7 +64034,7 @@ var ts; } function getAliasSymbolForTypeNode(node) { var host = node.parent; - while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { + while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { host = host.parent; } return ts.isTypeAlias(host) ? getSymbolOfNode(host) : undefined; @@ -63913,7 +64279,7 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */)) { if (!ts.isStatic(container) && (!ts.isConstructorDeclaration(container) || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; @@ -63948,17 +64314,17 @@ var ts; } function getArrayElementTypeNode(node) { switch (node.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return getArrayElementTypeNode(node.type); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: if (node.elements.length === 1) { node = node.elements[0]; - if (node.kind === 186 /* SyntaxKind.RestType */ || node.kind === 197 /* SyntaxKind.NamedTupleMember */ && node.dotDotDotToken) { + if (node.kind === 188 /* SyntaxKind.RestType */ || node.kind === 199 /* SyntaxKind.NamedTupleMember */ && node.dotDotDotToken) { return getArrayElementTypeNode(node.type); } } break; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return node.elementType; } return undefined; @@ -63974,99 +64340,99 @@ var ts; } function getTypeFromTypeNodeWorker(node) { switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: + case 131 /* SyntaxKind.AnyKeyword */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return anyType; - case 155 /* SyntaxKind.UnknownKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: return unknownType; - case 150 /* SyntaxKind.StringKeyword */: + case 152 /* SyntaxKind.StringKeyword */: return stringType; - case 147 /* SyntaxKind.NumberKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: return numberType; - case 158 /* SyntaxKind.BigIntKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: return bigintType; - case 133 /* SyntaxKind.BooleanKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: return booleanType; - case 151 /* SyntaxKind.SymbolKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: return esSymbolType; case 114 /* SyntaxKind.VoidKeyword */: return voidType; - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: return undefinedType; case 104 /* SyntaxKind.NullKeyword */: // TODO(rbuckton): `NullKeyword` is no longer a `TypeNode`, but we defensively allow it here because of incorrect casts in the Language Service. return nullType; - case 143 /* SyntaxKind.NeverKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return neverType; - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return node.flags & 262144 /* NodeFlags.JavaScriptFile */ && !noImplicitAny ? anyType : nonPrimitiveType; - case 138 /* SyntaxKind.IntrinsicKeyword */: + case 139 /* SyntaxKind.IntrinsicKeyword */: return intrinsicMarkerType; - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 108 /* SyntaxKind.ThisKeyword */: // TODO(rbuckton): `ThisKeyword` is no longer a `TypeNode`, but we defensively allow it here because of incorrect casts in the Language Service and because of `isPartOfTypeNode`. return getTypeFromThisTypeNode(node); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return getTypeFromLiteralTypeNode(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return getTypeFromTypeReference(node); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return node.assertsModifier ? voidType : booleanType; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return getTypeFromTypeQueryNode(node); - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return getTypeFromArrayOrTupleTypeNode(node); - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return getTypeFromOptionalTypeNode(node); - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return getTypeFromUnionTypeNode(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return getTypeFromJSDocNullableTypeNode(node); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return addOptionality(getTypeFromTypeNode(node.type)); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return getTypeFromNamedTupleTypeNode(node); - case 191 /* SyntaxKind.ParenthesizedType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return getTypeFromTypeNode(node.type); - case 186 /* SyntaxKind.RestType */: + case 188 /* SyntaxKind.RestType */: return getTypeFromRestTypeNode(node); - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 323 /* SyntaxKind.JSDocSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 326 /* SyntaxKind.JSDocSignature */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return getTypeFromTypeOperatorNode(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return getTypeFromIndexedAccessTypeNode(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return getTypeFromMappedTypeNode(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return getTypeFromConditionalTypeNode(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return getTypeFromInferTypeNode(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return getTypeFromTemplateTypeNode(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return getTypeFromImportTypeNode(node); // This function assumes that an identifier, qualified name, or property access expression is a type expression // Callers should first ensure this by calling `isPartOfTypeNode` // TODO(rbuckton): These aren't valid TypeNodes, but we treat them as such because of `isPartOfTypeNode`, which returns `true` for things that aren't `TypeNode`s. case 79 /* SyntaxKind.Identifier */: - case 161 /* SyntaxKind.QualifiedName */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var symbol = getSymbolAtLocation(node); return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType; default: @@ -64173,8 +64539,8 @@ var ts; return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* TypeMapKind.Merged */, mapper, makeUnaryTypeMapper(source, target)); } function getRestrictiveTypeParameter(tp) { - return tp.constraint === unknownType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), - tp.restrictiveInstantiation.constraint = unknownType, + return !tp.constraint && !getConstraintDeclaration(tp) || tp.constraint === noConstraintType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), + tp.restrictiveInstantiation.constraint = noConstraintType, tp.restrictiveInstantiation); } function cloneTypeParameter(typeParameter) { @@ -64288,17 +64654,18 @@ var ts; return type; } function maybeTypeParameterReference(node) { - return !(node.parent.kind === 178 /* SyntaxKind.TypeReference */ && node.parent.typeArguments && node === node.parent.typeName || - node.parent.kind === 200 /* SyntaxKind.ImportType */ && node.parent.typeArguments && node === node.parent.qualifier); + return !(node.parent.kind === 180 /* SyntaxKind.TypeReference */ && node.parent.typeArguments && node === node.parent.typeName || + node.parent.kind === 202 /* SyntaxKind.ImportType */ && node.parent.typeArguments && node === node.parent.qualifier); } function isTypeParameterPossiblyReferenced(tp, node) { - // If the type parameter doesn't have exactly one declaration, if there are invening statement blocks + // If the type parameter doesn't have exactly one declaration, if there are intervening statement blocks // between the node and the type parameter declaration, if the node contains actual references to the - // type parameter, or if the node contains type queries, we consider the type parameter possibly referenced. + // type parameter, or if the node contains type queries that we can't prove couldn't contain references to the type parameter, + // we consider the type parameter possibly referenced. if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) { var container = tp.symbol.declarations[0].parent; for (var n = node; n !== container; n = n.parent) { - if (!n || n.kind === 235 /* SyntaxKind.Block */ || n.kind === 189 /* SyntaxKind.ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) { + if (!n || n.kind === 238 /* SyntaxKind.Block */ || n.kind === 191 /* SyntaxKind.ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) { return true; } } @@ -64307,15 +64674,36 @@ var ts; return true; function containsReference(node) { switch (node.kind) { - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return !!tp.isThisType; case 79 /* SyntaxKind.Identifier */: return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) && getTypeFromTypeNodeWorker(node) === tp; // use worker because we're looking for === equality - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: + var entityName = node.exprName; + var firstIdentifier = ts.getFirstIdentifier(entityName); + var firstIdentifierSymbol = getResolvedSymbol(firstIdentifier); + var tpDeclaration = tp.symbol.declarations[0]; // There is exactly one declaration, otherwise `containsReference` is not called + var tpScope_1; + if (tpDeclaration.kind === 165 /* SyntaxKind.TypeParameter */) { // Type parameter is a regular type parameter, e.g. foo + tpScope_1 = tpDeclaration.parent; + } + else if (tp.isThisType) { + // Type parameter is the this type, and its declaration is the class declaration. + tpScope_1 = tpDeclaration; + } + else { + // Type parameter's declaration was unrecognized. + // This could happen if the type parameter comes from e.g. a JSDoc annotation, so we default to returning true. + return true; + } + if (firstIdentifierSymbol.declarations) { + return ts.some(firstIdentifierSymbol.declarations, function (idDecl) { return ts.isNodeDescendantOf(idDecl, tpScope_1); }) || + ts.some(node.typeArguments, containsReference); + } return true; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return !node.type && !!node.body || ts.some(node.typeParameters, containsReference) || ts.some(node.parameters, containsReference) || @@ -64537,17 +64925,18 @@ var ts; return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments); } if (flags & 33554432 /* TypeFlags.Substitution */) { - var maybeVariable = instantiateType(type.baseType, mapper); - if (maybeVariable.flags & 8650752 /* TypeFlags.TypeVariable */) { - return getSubstitutionType(maybeVariable, instantiateType(type.substitute, mapper)); + var newBaseType = instantiateType(type.baseType, mapper); + var newConstraint = instantiateType(type.constraint, mapper); + // A substitution type originates in the true branch of a conditional type and can be resolved + // to just the base type in the same cases as the conditional type resolves to its true branch + // (because the base type is then known to satisfy the constraint). + if (newBaseType.flags & 8650752 /* TypeFlags.TypeVariable */ && isGenericType(newConstraint)) { + return getSubstitutionType(newBaseType, newConstraint); } - else { - var sub = instantiateType(type.substitute, mapper); - if (sub.flags & 3 /* TypeFlags.AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) { - return maybeVariable; - } - return sub; + if (newConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(newBaseType), getRestrictiveInstantiation(newConstraint))) { + return newBaseType; } + return newBaseType.flags & 8650752 /* TypeFlags.TypeVariable */ ? getSubstitutionType(newBaseType, newConstraint) : getIntersectionType([newConstraint, newBaseType]); } return type; } @@ -64596,35 +64985,35 @@ var ts; // Returns true if the given expression contains (at any level of nesting) a function or arrow expression // that is subject to contextual typing. function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type return isContextSensitiveFunctionLikeDeclaration(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return ts.some(node.properties, isContextSensitive); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return ts.some(node.elements, isContextSensitive); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ || node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */) && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return isContextSensitive(node.initializer); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isContextSensitive(node.expression); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return ts.some(node.properties, isContextSensitive) || ts.isJsxOpeningElement(node.parent) && ts.some(node.parent.parent.children, isContextSensitive); - case 285 /* SyntaxKind.JsxAttribute */: { + case 288 /* SyntaxKind.JsxAttribute */: { // If there is no initializer, JSX attribute has a boolean value of true which is not context sensitive. var initializer = node.initializer; return !!initializer && isContextSensitive(initializer); } - case 288 /* SyntaxKind.JsxExpression */: { + case 291 /* SyntaxKind.JsxExpression */: { // It is possible to that node.expression is undefined (e.g
) var expression = node.expression; return !!expression && isContextSensitive(expression); @@ -64633,15 +65022,14 @@ var ts; return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return (!ts.isFunctionDeclaration(node) || ts.isInJSFile(node) && !!getTypeForDeclarationFromJSDocComment(node)) && - (ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node)); + return ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node); } function hasContextSensitiveReturnExpression(node) { // TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value. - return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 235 /* SyntaxKind.Block */ && isContextSensitive(node.body); + return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 238 /* SyntaxKind.Block */ && isContextSensitive(node.body); } function isContextSensitiveFunctionOrObjectLiteralMethod(func) { - return (ts.isInJSFile(func) && ts.isFunctionDeclaration(func) || ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && + return (ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func); } function getTypeWithoutSignatures(type) { @@ -64742,23 +65130,23 @@ var ts; return true; } switch (node.kind) { - case 288 /* SyntaxKind.JsxExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 291 /* SyntaxKind.JsxExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (node.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: case 27 /* SyntaxKind.CommaToken */: return elaborateError(node.right, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); } break; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return elaborateJsxComponents(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return elaborateArrowFunction(node, source, target, relation, containingMessageChain, errorOutputContainer); } return false; @@ -64967,7 +65355,7 @@ var ts; } function getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic) { switch (child.kind) { - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: // child is of the type of the expression return { errorNode: child, innerExpression: child.expression, nameType: nameType }; case 11 /* SyntaxKind.JsxText */: @@ -64976,9 +65364,9 @@ var ts; } // child is a string return { errorNode: child, innerExpression: undefined, nameType: nameType, errorMessage: getInvalidTextDiagnostic() }; - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: // child is of type JSX.Element return { errorNode: child, innerExpression: child, nameType: nameType }; default: @@ -65126,11 +65514,11 @@ var ts; } _b = prop.kind; switch (_b) { - case 173 /* SyntaxKind.SetAccessor */: return [3 /*break*/, 2]; - case 172 /* SyntaxKind.GetAccessor */: return [3 /*break*/, 2]; - case 169 /* SyntaxKind.MethodDeclaration */: return [3 /*break*/, 2]; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: return [3 /*break*/, 2]; - case 296 /* SyntaxKind.PropertyAssignment */: return [3 /*break*/, 4]; + case 175 /* SyntaxKind.SetAccessor */: return [3 /*break*/, 2]; + case 174 /* SyntaxKind.GetAccessor */: return [3 /*break*/, 2]; + case 171 /* SyntaxKind.MethodDeclaration */: return [3 /*break*/, 2]; + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return [3 /*break*/, 2]; + case 299 /* SyntaxKind.PropertyAssignment */: return [3 /*break*/, 4]; } return [3 /*break*/, 6]; case 2: return [4 /*yield*/, { errorNode: prop.name, innerExpression: undefined, nameType: type }]; @@ -65203,8 +65591,8 @@ var ts; void instantiateType(sourceRestType || targetRestType, reportUnreliableMarkers); } var kind = target.declaration ? target.declaration.kind : 0 /* SyntaxKind.Unknown */; - var strictVariance = !(checkMode & 3 /* SignatureCheckMode.Callback */) && strictFunctionTypes && kind !== 169 /* SyntaxKind.MethodDeclaration */ && - kind !== 168 /* SyntaxKind.MethodSignature */ && kind !== 171 /* SyntaxKind.Constructor */; + var strictVariance = !(checkMode & 3 /* SignatureCheckMode.Callback */) && strictFunctionTypes && kind !== 171 /* SyntaxKind.MethodDeclaration */ && + kind !== 170 /* SyntaxKind.MethodSignature */ && kind !== 173 /* SyntaxKind.Constructor */; var result = -1 /* Ternary.True */; var sourceThisType = getThisTypeOfSignature(source); if (sourceThisType && sourceThisType !== voidType) { @@ -65501,7 +65889,7 @@ var ts; var t = isFreshLiteralType(type) ? type.regularType : ts.getObjectFlags(type) & 4 /* ObjectFlags.Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 /* TypeFlags.UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : - type.flags & 33554432 /* TypeFlags.Substitution */ ? writing ? type.baseType : type.substitute : + type.flags & 33554432 /* TypeFlags.Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 /* TypeFlags.Simplifiable */ ? getSimplifiedType(type, writing) : type; if (t === type) @@ -65908,7 +66296,8 @@ var ts; return 0 /* Ternary.False */; } } - var isPerformingCommonPropertyChecks = relation !== comparableRelation && !(intersectionState & 2 /* IntersectionState.Target */) && + var isPerformingCommonPropertyChecks = (relation !== comparableRelation || !(source.flags & 1048576 /* TypeFlags.Union */) && isLiteralType(source)) && + !(intersectionState & 2 /* IntersectionState.Target */) && source.flags & (131068 /* TypeFlags.Primitive */ | 524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && source !== globalObjectType && target.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && isWeakType(target) && (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source)); @@ -66067,7 +66456,7 @@ var ts; reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target); checkTypes = reducedTarget.flags & 1048576 /* TypeFlags.Union */ ? reducedTarget.types : [reducedTarget]; } - var _loop_20 = function (prop) { + var _loop_21 = function (prop) { if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) { if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) { if (reportErrors) { @@ -66130,9 +66519,9 @@ var ts; }; for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) { var prop = _b[_i]; - var state_6 = _loop_20(prop); - if (typeof state_6 === "object") - return state_6.value; + var state_7 = _loop_21(prop); + if (typeof state_7 === "object") + return state_7.value; } return false; } @@ -66160,11 +66549,15 @@ var ts; // parameter 'T extends 1 | 2', the intersection 'T & 1' should be reduced to '1' such that it doesn't // appear to be comparable to '2'. if (relation === comparableRelation && target.flags & 131068 /* TypeFlags.Primitive */) { - var constraints = ts.sameMap(source.types, getBaseConstraintOrType); + var constraints = ts.sameMap(source.types, function (t) { return t.flags & 465829888 /* TypeFlags.Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t; }); if (constraints !== source.types) { source = getIntersectionType(constraints); + if (source.flags & 131072 /* TypeFlags.Never */) { + return 0 /* Ternary.False */; + } if (!(source.flags & 2097152 /* TypeFlags.Intersection */)) { - return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false); + return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false) || + isRelatedTo(target, source, 1 /* RecursionFlags.Source */, /*reportErrors*/ false); } } } @@ -66482,7 +66875,7 @@ var ts; // the type param can be compared with itself in the target (with the influence of its constraint to match other parts) // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)` var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */)); - if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself + if (constraint && !(constraint.flags & 131072 /* TypeFlags.Never */) && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState); } @@ -66534,7 +66927,11 @@ var ts; } } if (sourceFlags & 33554432 /* TypeFlags.Substitution */) { - return isRelatedTo(source.substitute, target.substitute, 3 /* RecursionFlags.Both */, /*reportErrors*/ false); + if (result = isRelatedTo(source.baseType, target.baseType, 3 /* RecursionFlags.Both */, /*reportErrors*/ false)) { + if (result &= isRelatedTo(source.constraint, target.constraint, 3 /* RecursionFlags.Both */, /*reportErrors*/ false)) { + return result; + } + } } if (!(sourceFlags & 524288 /* TypeFlags.Object */)) { return 0 /* Ternary.False */; @@ -67115,11 +67512,11 @@ var ts; // constituents of 'target'. If any combination does not have a match then 'source' is not relatable. var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes); var matchingTypes = []; - var _loop_21 = function (combination) { + var _loop_22 = function (combination) { var hasMatch = false; outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) { var type = _d[_c]; - var _loop_22 = function (i) { + var _loop_23 = function (i) { var sourceProperty = sourcePropertiesFiltered[i]; var targetProperty = getPropertyOfType(type, sourceProperty.escapedName); if (!targetProperty) @@ -67135,8 +67532,8 @@ var ts; } }; for (var i = 0; i < sourcePropertiesFiltered.length; i++) { - var state_8 = _loop_22(i); - switch (state_8) { + var state_9 = _loop_23(i); + switch (state_9) { case "continue-outer": continue outer; } } @@ -67149,9 +67546,9 @@ var ts; }; for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) { var combination = discriminantCombinations_1[_a]; - var state_7 = _loop_21(combination); - if (typeof state_7 === "object") - return state_7.value; + var state_8 = _loop_22(combination); + if (typeof state_8 === "object") + return state_8.value; } // Compare the remaining non-discriminant properties of each match. var result = -1 /* Ternary.True */; @@ -67286,7 +67683,7 @@ var ts; shouldSkipElaboration = true; // Retain top-level error for interface implementing issues, otherwise omit it } if (props.length === 1) { - var propName = symbolToString(unmatchedProperty); + var propName = symbolToString(unmatchedProperty, /*enclosingDeclaration*/ undefined, 0 /* SymbolFlags.None */, 4 /* SymbolFormatFlags.AllowAnyNodeKind */ | 16 /* SymbolFormatFlags.WriteComputedProps */); reportError.apply(void 0, __spreadArray([ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName], getTypeNamesForErrorDisplay(source, target), false)); if (ts.length(unmatchedProperty.declarations)) { associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName)); @@ -67535,7 +67932,7 @@ var ts; var targetSignature = ts.first(targetSignatures); result = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors, incompatibleReporter(sourceSignature, targetSignature)); if (!result && reportErrors && kind === 1 /* SignatureKind.Construct */ && (sourceObjectFlags & targetObjectFlags) && - (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 171 /* SyntaxKind.Constructor */ || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 171 /* SyntaxKind.Constructor */)) { + (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 173 /* SyntaxKind.Constructor */ || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 173 /* SyntaxKind.Constructor */)) { var constructSignatureToString = function (signature) { return signatureToString(signature, /*enclosingDeclaration*/ undefined, 262144 /* TypeFormatFlags.WriteArrowStyleSignature */, kind); }; @@ -67856,7 +68253,7 @@ var ts; ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* tracing.Phase.CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) }); links.variances = ts.emptyArray; var variances = []; - var _loop_23 = function (tp) { + var _loop_24 = function (tp) { var modifiers = getVarianceModifiers(tp); var variance = modifiers & 65536 /* ModifierFlags.Out */ ? modifiers & 32768 /* ModifierFlags.In */ ? 0 /* VarianceFlags.Invariant */ : 1 /* VarianceFlags.Covariant */ : @@ -67894,7 +68291,7 @@ var ts; }; for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) { var tp = typeParameters_2[_i]; - _loop_23(tp); + _loop_24(tp); } links.variances = variances; ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) }); @@ -68300,7 +68697,7 @@ var ts; var baseTypeNode = getBaseTypeNodeOfClass(target); // A base type expression may circularly reference the class itself (e.g. as an argument to function call), so we only // check for base types specified as simple qualified names. - if (baseTypeNode && baseTypeNode.expression.kind !== 79 /* SyntaxKind.Identifier */ && baseTypeNode.expression.kind !== 206 /* SyntaxKind.PropertyAccessExpression */) { + if (baseTypeNode && baseTypeNode.expression.kind !== 79 /* SyntaxKind.Identifier */ && baseTypeNode.expression.kind !== 208 /* SyntaxKind.PropertyAccessExpression */) { return undefined; } } @@ -68391,7 +68788,7 @@ var ts; if (!isLiteralOfContextualType(type, contextualType)) { type = getWidenedUniqueESSymbolType(getWidenedLiteralType(type)); } - return type; + return getRegularTypeOfLiteralType(type); } function getWidenedLiteralLikeTypeForContextualReturnTypeIfNeeded(type, contextualSignatureReturnType, isAsync) { if (type && isUnitType(type)) { @@ -68486,7 +68883,8 @@ var ts; function getOptionalType(type, isProperty) { if (isProperty === void 0) { isProperty = false; } ts.Debug.assert(strictNullChecks); - return type.flags & 32768 /* TypeFlags.Undefined */ ? type : getUnionType([type, isProperty ? missingType : undefinedType]); + var missingOrUndefined = isProperty ? missingType : undefinedType; + return type.flags & 32768 /* TypeFlags.Undefined */ || type.flags & 1048576 /* TypeFlags.Union */ && type.types[0] === missingOrUndefined ? type : getUnionType([type, missingOrUndefined]); } function getGlobalNonNullableTypeInstantiation(type) { if (!deferredGlobalNonNullableTypeAlias) { @@ -68775,12 +69173,12 @@ var ts; } var diagnostic; switch (declaration.kind) { - case 221 /* SyntaxKind.BinaryExpression */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 223 /* SyntaxKind.BinaryExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: diagnostic = noImplicitAny ? ts.Diagnostics.Member_0_implicitly_has_an_1_type : ts.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: var param = declaration; if (ts.isIdentifier(param.name) && (ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) && @@ -68796,23 +69194,23 @@ var ts; noImplicitAny ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage : noImplicitAny ? ts.Diagnostics.Parameter_0_implicitly_has_an_1_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; if (!noImplicitAny) { // Don't issue a suggestion for binding elements since the codefix doesn't yet support them. return; } break; - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: error(declaration, ts.Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (noImplicitAny && !declaration.name) { if (wideningKind === 3 /* WideningKind.GeneratorYield */) { error(declaration, ts.Diagnostics.Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation, typeAsString); @@ -68826,7 +69224,7 @@ var ts; wideningKind === 3 /* WideningKind.GeneratorYield */ ? ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type : ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; break; - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: if (noImplicitAny) { error(declaration, ts.Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type); } @@ -68943,7 +69341,7 @@ var ts; if (context.intraExpressionInferenceSites) { for (var _i = 0, _a = context.intraExpressionInferenceSites; _i < _a.length; _i++) { var _b = _a[_i], node = _b.node, type = _b.type; - var contextualType = node.kind === 169 /* SyntaxKind.MethodDeclaration */ ? + var contextualType = node.kind === 171 /* SyntaxKind.MethodDeclaration */ ? getContextualTypeForObjectLiteralMethod(node, 2 /* ContextFlags.NoConstraints */) : getContextualType(node, 2 /* ContextFlags.NoConstraints */); if (contextualType) { @@ -69006,8 +69404,8 @@ var ts; } function isNonGenericTopLevelType(type) { if (type.aliasSymbol && !type.aliasTypeArguments) { - var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 259 /* SyntaxKind.TypeAliasDeclaration */); - return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 305 /* SyntaxKind.SourceFile */ ? true : n.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? false : "quit"; })); + var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 262 /* SyntaxKind.TypeAliasDeclaration */); + return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 308 /* SyntaxKind.SourceFile */ ? true : n.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? false : "quit"; })); } return false; } @@ -69465,7 +69863,10 @@ var ts; // // This flag is infectious; if we produce Box (where never is silentNeverType), Box is // also non-inferrable. - if (ts.getObjectFlags(source) & 262144 /* ObjectFlags.NonInferrableType */) { + // + // As a special case, also ignore nonInferrableAnyType, which is a special form of the any type + // used as a stand-in for binding elements when they are being inferred. + if (ts.getObjectFlags(source) & 262144 /* ObjectFlags.NonInferrableType */ || source === nonInferrableAnyType) { return; } if (!inference.isFixed) { @@ -69538,7 +69939,7 @@ var ts; } else if (source.flags & 33554432 /* TypeFlags.Substitution */) { inferFromTypes(source.baseType, target); - inferWithPriority(source.substitute, target, 4 /* InferencePriority.SubstituteSource */); // Make substitute inference at a lower priority + inferWithPriority(getSubstitutionIntersection(source), target, 4 /* InferencePriority.SubstituteSource */); // Make substitute inference at a lower priority } else if (target.flags & 16777216 /* TypeFlags.Conditional */) { invokeOnce(source, target, inferToConditionalType); @@ -69848,7 +70249,7 @@ var ts; // upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might // succeed. That would be a pointless and confusing outcome. if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) { - var _loop_24 = function (i) { + var _loop_25 = function (i) { var source_1 = matches ? matches[i] : neverType; var target_3 = types[i]; // If we are inferring from a string literal type to a type variable whose constraint includes one of the @@ -69898,7 +70299,7 @@ var ts; inferFromTypes(source_1, target_3); }; for (var i = 0; i < types.length; i++) { - _loop_24(i); + _loop_25(i); } } } @@ -70020,7 +70421,7 @@ var ts; var saveBivariant = bivariant; var kind = target.declaration ? target.declaration.kind : 0 /* SyntaxKind.Unknown */; // Once we descend into a bivariant signature we remain bivariant for all nested inferences - bivariant = bivariant || kind === 169 /* SyntaxKind.MethodDeclaration */ || kind === 168 /* SyntaxKind.MethodSignature */ || kind === 171 /* SyntaxKind.Constructor */; + bivariant = bivariant || kind === 171 /* SyntaxKind.MethodDeclaration */ || kind === 170 /* SyntaxKind.MethodSignature */ || kind === 173 /* SyntaxKind.Constructor */; applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes); bivariant = saveBivariant; applyToReturnTypes(source, target, inferFromTypes); @@ -70219,7 +70620,7 @@ var ts; } // falls through default: - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer; } else { @@ -70240,7 +70641,7 @@ var ts; // TypeScript 1.0 spec (April 2014): 3.6.3 // A type query consists of the keyword typeof followed by an expression. // The expression is restricted to a single identifier or a sequence of identifiers separated by periods - return !!ts.findAncestor(node, function (n) { return n.kind === 181 /* SyntaxKind.TypeQuery */ ? true : n.kind === 79 /* SyntaxKind.Identifier */ || n.kind === 161 /* SyntaxKind.QualifiedName */ ? false : "quit"; }); + return !!ts.findAncestor(node, function (n) { return n.kind === 183 /* SyntaxKind.TypeQuery */ ? true : n.kind === 79 /* SyntaxKind.Identifier */ || n.kind === 163 /* SyntaxKind.QualifiedName */ ? false : "quit"; }); } // Return the flow cache key for a "dotted name" (i.e. a sequence of identifiers // separated by dots). The key consists of the id of the symbol referenced by the @@ -70256,26 +70657,26 @@ var ts; // falls through case 108 /* SyntaxKind.ThisKeyword */: return "0|".concat(flowContainer ? getNodeId(flowContainer) : "-1", "|").concat(getTypeId(declaredType), "|").concat(getTypeId(initialType)); - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: var left = getFlowCacheKey(node.left, declaredType, initialType, flowContainer); return left && left + "." + node.right.escapedText; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var propName = getAccessedPropertyName(node); if (propName !== undefined) { var key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); return key && key + "." + propName; } break; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: // Handle pseudo-references originating in getNarrowedTypeOfSymbol. return "".concat(getNodeId(node), "#").concat(getTypeId(declaredType)); } @@ -70283,16 +70684,16 @@ var ts; } function isMatchingReference(source, target) { switch (target.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return isMatchingReference(source, target.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (ts.isAssignmentExpression(target) && isMatchingReference(source, target.left)) || (ts.isBinaryExpression(target) && target.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && isMatchingReference(source, target.right)); } switch (source.kind) { - case 231 /* SyntaxKind.MetaProperty */: - return target.kind === 231 /* SyntaxKind.MetaProperty */ + case 233 /* SyntaxKind.MetaProperty */: + return target.kind === 233 /* SyntaxKind.MetaProperty */ && source.keywordToken === target.keywordToken && source.name.escapedText === target.name.escapedText; case 79 /* SyntaxKind.Identifier */: @@ -70300,26 +70701,26 @@ var ts; return ts.isThisInTypeQuery(source) ? target.kind === 108 /* SyntaxKind.ThisKeyword */ : target.kind === 79 /* SyntaxKind.Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 254 /* SyntaxKind.VariableDeclaration */ || target.kind === 203 /* SyntaxKind.BindingElement */) && + (target.kind === 257 /* SyntaxKind.VariableDeclaration */ || target.kind === 205 /* SyntaxKind.BindingElement */) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 108 /* SyntaxKind.ThisKeyword */: return target.kind === 108 /* SyntaxKind.ThisKeyword */; case 106 /* SyntaxKind.SuperKeyword */: return target.kind === 106 /* SyntaxKind.SuperKeyword */; - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isMatchingReference(source.expression, target); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var sourcePropertyName = getAccessedPropertyName(source); var targetPropertyName = ts.isAccessExpression(target) ? getAccessedPropertyName(target) : undefined; return sourcePropertyName !== undefined && targetPropertyName !== undefined && targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return ts.isAccessExpression(target) && source.right.escapedText === getAccessedPropertyName(target) && isMatchingReference(source.left, target.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (ts.isBinaryExpression(source) && source.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && isMatchingReference(source.right, target)); } return false; @@ -70362,7 +70763,7 @@ var ts; return name; } } - if (ts.hasOnlyExpressionInitializer(declaration)) { + if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) { var initializer = ts.getEffectiveInitializer(declaration); return initializer && tryGetNameFromType(getTypeOfExpression(initializer)); } @@ -70422,7 +70823,7 @@ var ts; function mapTypesByKeyProperty(types, name) { var map = new ts.Map(); var count = 0; - var _loop_25 = function (type) { + var _loop_26 = function (type) { if (type.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */)) { var discriminant = getTypeOfPropertyOfType(type, name); if (discriminant) { @@ -70448,9 +70849,9 @@ var ts; }; for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { var type = types_15[_i]; - var state_9 = _loop_25(type); - if (typeof state_9 === "object") - return state_9.value; + var state_10 = _loop_26(type); + if (typeof state_10 === "object") + return state_10.value; } return count >= 10 && count * 2 >= types.length ? map : undefined; } @@ -70491,7 +70892,7 @@ var ts; } function getMatchingUnionConstituentForObjectLiteral(unionType, node) { var keyPropertyName = getKeyPropertyName(unionType); - var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 296 /* SyntaxKind.PropertyAssignment */ && + var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 299 /* SyntaxKind.PropertyAssignment */ && p.symbol.escapedName === keyPropertyName && isPossiblyDiscriminantValue(p.initializer); }); var propType = propNode && getContextFreeTypeOfExpression(propNode.initializer); return propType && getConstituentTypeForKeyType(unionType, propType); @@ -70508,7 +70909,7 @@ var ts; } } } - if (expression.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + if (expression.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isOrContainsMatchingReference(reference, expression.expression.expression)) { return true; } @@ -70708,15 +71109,15 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(65 /* IterationUse.Destructuring */, type, undefinedType, /*errorNode*/ undefined) || errorType); } function getAssignedTypeOfBinaryExpression(node) { - var isDestructuringDefaultAssignment = node.parent.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || - node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); + var isDestructuringDefaultAssignment = node.parent.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || + node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } function isDestructuringAssignmentTarget(parent) { - return parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.parent.left === parent || - parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */ && parent.parent.initializer === parent; + return parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.parent.left === parent || + parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */ && parent.parent.initializer === parent; } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element)); @@ -70733,21 +71134,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return stringType; - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return checkRightHandSideOfForOf(parent) || errorType; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return getAssignedTypeOfBinaryExpression(parent); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return undefinedType; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return getAssignedTypeOfSpreadExpression(parent); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return errorType; @@ -70755,7 +71156,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ ? + var type = pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) : @@ -70773,30 +71174,30 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (node.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { return stringType; } - if (node.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { return checkRightHandSideOfForOf(node.parent.parent) || errorType; } return errorType; } function getInitialType(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function isEmptyArrayAssignment(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.initializer && + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 203 /* SyntaxKind.BindingElement */ && node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + node.kind !== 205 /* SyntaxKind.BindingElement */ && node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getReferenceCandidate(node.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (node.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: case 75 /* SyntaxKind.BarBarEqualsToken */: @@ -70811,13 +71212,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */ || - parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.left === node || - parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && parent.right === node ? + return parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || + parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.left === node || + parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { return getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); } return neverType; @@ -70836,13 +71237,13 @@ var ts; // Get the type names from all cases in a switch on `typeof`. The default clause and/or duplicate type names are // represented as undefined. Return undefined if one or more case clause expressions are not string literals. function getSwitchClauseTypeOfWitnesses(switchStatement) { - if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 289 /* SyntaxKind.CaseClause */ && !ts.isStringLiteralLike(clause.expression); })) { + if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 292 /* SyntaxKind.CaseClause */ && !ts.isStringLiteralLike(clause.expression); })) { return undefined; } var witnesses = []; for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) { var clause = _a[_i]; - var text = clause.kind === 289 /* SyntaxKind.CaseClause */ ? clause.expression.text : undefined; + var text = clause.kind === 292 /* SyntaxKind.CaseClause */ ? clause.expression.text : undefined; witnesses.push(text && !ts.contains(witnesses, text) ? text : undefined); } return witnesses; @@ -71029,12 +71430,12 @@ var ts; var root = getReferenceRoot(node); var parent = root.parent; var isLengthPushOrUnshift = ts.isPropertyAccessExpression(parent) && (parent.name.escapedText === "length" || - parent.parent.kind === 208 /* SyntaxKind.CallExpression */ + parent.parent.kind === 210 /* SyntaxKind.CallExpression */ && ts.isIdentifier(parent.name) && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && + var isElementAssignment = parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && parent.expression === root && - parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -71062,7 +71463,7 @@ var ts; if (isDeclarationWithExplicitTypeAnnotation(declaration)) { return getTypeOfSymbol(symbol); } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { var statement = declaration.parent.parent; var expressionType = getTypeOfDottedName(statement.expression, /*diagnostic*/ undefined); if (expressionType) { @@ -71090,7 +71491,7 @@ var ts; return getExplicitThisType(node); case 106 /* SyntaxKind.SuperKeyword */: return checkSuperExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: { + case 208 /* SyntaxKind.PropertyAccessExpression */: { var type = getTypeOfDottedName(node.expression, diagnostic); if (type) { var name = node.name; @@ -71108,7 +71509,7 @@ var ts; } return undefined; } - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getTypeOfDottedName(node.expression, diagnostic); } } @@ -71122,7 +71523,7 @@ var ts; // circularities in control flow analysis, we use getTypeOfDottedName when resolving the call // target expression of an assertion. var funcType = void 0; - if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */) { + if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */) { funcType = getTypeOfDottedName(node.expression, /*diagnostic*/ undefined); } else if (node.expression.kind !== 106 /* SyntaxKind.SuperKeyword */) { @@ -71166,7 +71567,7 @@ var ts; } function isFalseExpression(expr) { var node = ts.skipParentheses(expr, /*excludeJSDocTypeAssertions*/ true); - return node.kind === 95 /* SyntaxKind.FalseKeyword */ || node.kind === 221 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ && (isFalseExpression(node.left) || isFalseExpression(node.right)) || + return node.kind === 95 /* SyntaxKind.FalseKeyword */ || node.kind === 223 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ && (isFalseExpression(node.left) || isFalseExpression(node.right)) || node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ && isFalseExpression(node.left) && isFalseExpression(node.right)); } function isReachableFlowNodeWorker(flow, noCacheCheck) { @@ -71287,8 +71688,8 @@ var ts; var symbol = getResolvedSymbol(node); return isConstVariable(symbol) || ts.isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol); } - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // The resolvedSymbol property is initialized by checkPropertyAccess or checkElementAccess before we get here. return isConstantReference(node.expression) && isReadonlySymbol(getNodeLinks(node).resolvedSymbol || unknownSymbol); } @@ -71315,7 +71716,7 @@ var ts; // on empty arrays are possible without implicit any errors and new element types can be inferred without // type mismatch errors. var resultType = ts.getObjectFlags(evolvedType) & 256 /* ObjectFlags.EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType); - if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 230 /* SyntaxKind.NonNullExpression */ && !(resultType.flags & 131072 /* TypeFlags.Never */) && getTypeWithFacts(resultType, 2097152 /* TypeFacts.NEUndefinedOrNull */).flags & 131072 /* TypeFlags.Never */) { + if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 232 /* SyntaxKind.NonNullExpression */ && !(resultType.flags & 131072 /* TypeFlags.Never */) && getTypeWithFacts(resultType, 2097152 /* TypeFacts.NEUndefinedOrNull */).flags & 131072 /* TypeFlags.Never */) { return declaredType; } // The non-null unknown type should never escape control flow analysis. @@ -71400,8 +71801,8 @@ var ts; // Check if we should continue with the control flow of the containing function. var container = flow.node; if (container && container !== flowContainer && - reference.kind !== 206 /* SyntaxKind.PropertyAccessExpression */ && - reference.kind !== 207 /* SyntaxKind.ElementAccessExpression */ && + reference.kind !== 208 /* SyntaxKind.PropertyAccessExpression */ && + reference.kind !== 209 /* SyntaxKind.ElementAccessExpression */ && reference.kind !== 108 /* SyntaxKind.ThisKeyword */) { flow = container.flowNode; continue; @@ -71426,7 +71827,7 @@ var ts; } function getInitialOrAssignedType(flow) { var node = flow.node; - return getNarrowableTypeForReference(node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */ ? + return getNarrowableTypeForReference(node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */ ? getInitialType(node) : getAssignedType(node), reference); } @@ -71466,14 +71867,14 @@ var ts; // in which case we continue control flow analysis back to the function's declaration if (ts.isVariableDeclaration(node) && (ts.isInJSFile(node) || ts.isVarConst(node))) { var init = ts.getDeclaredExpandoInitializer(node); - if (init && (init.kind === 213 /* SyntaxKind.FunctionExpression */ || init.kind === 214 /* SyntaxKind.ArrowFunction */)) { + if (init && (init.kind === 215 /* SyntaxKind.FunctionExpression */ || init.kind === 216 /* SyntaxKind.ArrowFunction */)) { return getTypeAtFlowNode(flow.antecedent); } } return declaredType; } // for (const _ in ref) acts as a nonnull on ref - if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) { + if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) { return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)))); } // Assignment doesn't affect reference @@ -71484,7 +71885,7 @@ var ts; if (node.kind === 95 /* SyntaxKind.FalseKeyword */) { return unreachableNeverType; } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */) { if (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */) { return narrowTypeByAssertion(narrowTypeByAssertion(type, node.left), node.right); } @@ -71515,7 +71916,7 @@ var ts; function getTypeAtFlowArrayMutation(flow) { if (declaredType === autoType || declaredType === autoArrayType) { var node = flow.node; - var expr = node.kind === 208 /* SyntaxKind.CallExpression */ ? + var expr = node.kind === 210 /* SyntaxKind.CallExpression */ ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -71523,7 +71924,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (ts.getObjectFlags(type) & 256 /* ObjectFlags.EvolvingArray */) { var evolvedType_1 = type; - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -71571,7 +71972,7 @@ var ts; if (isMatchingReference(reference, expr)) { type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } - else if (expr.kind === 216 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { + else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } else { @@ -71579,7 +71980,7 @@ var ts; if (optionalChainContainsReference(expr, reference)) { type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & (32768 /* TypeFlags.Undefined */ | 131072 /* TypeFlags.Never */)); }); } - else if (expr.kind === 216 /* SyntaxKind.TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { + else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & 131072 /* TypeFlags.Never */ || t.flags & 128 /* TypeFlags.StringLiteral */ && t.value === "undefined"); }); } } @@ -71807,7 +72208,7 @@ var ts; var narrowedPropType = narrowType(propType); return filterType(type, function (t) { var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName); - return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType); + return !(discriminantType.flags & 131072 /* TypeFlags.Never */) && !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType); }); } function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) { @@ -71849,18 +72250,26 @@ var ts; } function isTypePresencePossible(type, propName, assumeTrue) { var prop = getPropertyOfType(type, propName); - if (prop) { - return prop.flags & 16777216 /* SymbolFlags.Optional */ ? true : assumeTrue; - } - return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue; + return prop ? + !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue : + !!getApplicableIndexInfoForName(type, propName) || !assumeTrue; } - function narrowByInKeyword(type, name, assumeTrue) { - if (type.flags & 1048576 /* TypeFlags.Union */ - || type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type)) - || ts.isThisTypeParameter(type) - || type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) { + function narrowByInKeyword(type, nameType, assumeTrue) { + var name = getPropertyNameFromType(nameType); + var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); }); + if (isKnownProperty) { + // If the check is for a known property (i.e. a property declared in some constituent of + // the target type), we filter the target type by presence of absence of the property. return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); }); } + if (assumeTrue) { + // If the check is for an unknown property, we intersect the target type with `Record`, + // where X is the name of the property. + var recordSymbol = getGlobalRecordSymbol(); + if (recordSymbol) { + return getIntersectionType([type, getTypeAliasInstantiation(recordSymbol, [nameType, unknownType])]); + } + } return type; } function narrowTypeByBinaryExpression(type, expr, assumeTrue) { @@ -71877,10 +72286,10 @@ var ts; var operator = expr.operatorToken.kind; var left = getReferenceCandidate(expr.left); var right = getReferenceCandidate(expr.right); - if (left.kind === 216 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(right)) { + if (left.kind === 218 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(right)) { return narrowTypeByTypeof(type, left, operator, right, assumeTrue); } - if (right.kind === 216 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(left)) { + if (right.kind === 218 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(left)) { return narrowTypeByTypeof(type, right, operator, left, assumeTrue); } if (isMatchingReference(reference, left)) { @@ -71919,15 +72328,14 @@ var ts; return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue); } var target = getReferenceCandidate(expr.right); - var leftType = getTypeOfNode(expr.left); - if (leftType.flags & 128 /* TypeFlags.StringLiteral */) { - var name = ts.escapeLeadingUnderscores(leftType.value); + var leftType = getTypeOfExpression(expr.left); + if (leftType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */) { if (containsMissingType(type) && ts.isAccessExpression(reference) && isMatchingReference(reference.expression, target) && - getAccessedPropertyName(reference) === name) { + getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) { return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */); } if (isMatchingReference(reference, target)) { - return narrowByInKeyword(type, name, assumeTrue); + return narrowByInKeyword(type, leftType, assumeTrue); } } break; @@ -71989,24 +72397,11 @@ var ts; assumeTrue = !assumeTrue; } var valueType = getTypeOfExpression(value); - if (((type.flags & 2 /* TypeFlags.Unknown */) || isEmptyAnonymousObjectType(type) && !(valueType.flags & 98304 /* TypeFlags.Nullable */)) && - assumeTrue && - (operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */)) { - if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */)) { - return valueType; - } - if (valueType.flags & 524288 /* TypeFlags.Object */) { - return nonPrimitiveType; - } - if (type.flags & 2 /* TypeFlags.Unknown */) { - return type; - } - } + var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */; if (valueType.flags & 98304 /* TypeFlags.Nullable */) { if (!strictNullChecks) { return type; } - var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */; var facts = doubleEquals ? assumeTrue ? 262144 /* TypeFacts.EQUndefinedOrNull */ : 2097152 /* TypeFacts.NEUndefinedOrNull */ : valueType.flags & 65536 /* TypeFlags.Null */ ? @@ -72015,10 +72410,16 @@ var ts; return getAdjustedTypeWithFacts(type, facts); } if (assumeTrue) { - var filterFn = operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? - function (t) { return areTypesComparable(t, valueType) || isCoercibleUnderDoubleEquals(t, valueType); } : - function (t) { return areTypesComparable(t, valueType); }; - return replacePrimitivesWithLiterals(filterType(type, filterFn), valueType); + if (!doubleEquals && (type.flags & 2 /* TypeFlags.Unknown */ || someType(type, isEmptyAnonymousObjectType))) { + if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) { + return valueType; + } + if (valueType.flags & 524288 /* TypeFlags.Object */) { + return nonPrimitiveType; + } + } + var filteredType = filterType(type, function (t) { return areTypesComparable(t, valueType) || doubleEquals && isCoercibleUnderDoubleEquals(t, valueType); }); + return replacePrimitivesWithLiterals(filteredType, valueType); } if (isUnitType(valueType)) { return filterType(type, function (t) { return !(isUnitLikeType(t) && areTypesComparable(t, valueType)); }); @@ -72032,11 +72433,18 @@ var ts; } var target = getReferenceCandidate(typeOfExpr.expression); if (!isMatchingReference(reference, target)) { + var propertyAccess = getDiscriminantPropertyAccess(typeOfExpr.expression, type); + if (propertyAccess) { + return narrowTypeByDiscriminant(type, propertyAccess, function (t) { return narrowTypeByLiteralExpression(t, literal, assumeTrue); }); + } if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) { return getAdjustedTypeWithFacts(type, 2097152 /* TypeFacts.NEUndefinedOrNull */); } return type; } + return narrowTypeByLiteralExpression(type, literal, assumeTrue); + } + function narrowTypeByLiteralExpression(type, literal, assumeTrue) { return assumeTrue ? narrowTypeByTypeName(type, literal.text) : getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768 /* TypeFacts.TypeofNEHostObject */); @@ -72122,7 +72530,7 @@ var ts; return type; } // Equal start and end denotes implicit fallthrough; undefined marks explicit default clause. - var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 290 /* SyntaxKind.DefaultClause */; }); + var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 293 /* SyntaxKind.DefaultClause */; }); var hasDefaultClause = clauseStart === clauseEnd || (defaultIndex >= clauseStart && defaultIndex < clauseEnd); if (hasDefaultClause) { // In the default clause we filter constituents down to those that are not-equal to all handled cases. @@ -72326,17 +72734,17 @@ var ts; // falls through case 108 /* SyntaxKind.ThisKeyword */: case 106 /* SyntaxKind.SuperKeyword */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return narrowTypeByCallExpression(type, expr, assumeTrue); - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return narrowType(type, expr.expression, assumeTrue); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: if (expr.operator === 53 /* SyntaxKind.ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -72385,9 +72793,9 @@ var ts; function getControlFlowContainer(node) { return ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 262 /* SyntaxKind.ModuleBlock */ || - node.kind === 305 /* SyntaxKind.SourceFile */ || - node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + node.kind === 265 /* SyntaxKind.ModuleBlock */ || + node.kind === 308 /* SyntaxKind.SourceFile */ || + node.kind === 169 /* SyntaxKind.PropertyDeclaration */; }); } // Check if a parameter or catch variable is assigned anywhere @@ -72430,7 +72838,7 @@ var ts; function removeOptionalityFromDeclaredType(declaredType, declaration) { if (pushTypeResolution(declaration.symbol, 2 /* TypeSystemPropertyName.DeclaredType */)) { var annotationIncludesUndefined = strictNullChecks && - declaration.kind === 164 /* SyntaxKind.Parameter */ && + declaration.kind === 166 /* SyntaxKind.Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* TypeFacts.IsUndefined */ && !(getTypeFacts(checkExpression(declaration.initializer)) & 16777216 /* TypeFacts.IsUndefined */); @@ -72447,10 +72855,10 @@ var ts; // In an element access obj[x], we consider obj to be in a constraint position, except when obj is of // a generic type without a nullable constraint and x is a generic type. This is because when both obj // and x are of generic types T and K, we want the resulting type to be T[K]. - return parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - parent.kind === 161 /* SyntaxKind.QualifiedName */ || - parent.kind === 208 /* SyntaxKind.CallExpression */ && parent.expression === node || - parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && parent.expression === node && + return parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + parent.kind === 163 /* SyntaxKind.QualifiedName */ || + parent.kind === 210 /* SyntaxKind.CallExpression */ && parent.expression === node || + parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && parent.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression))); } function isGenericTypeWithUnionConstraint(type) { @@ -72549,15 +72957,16 @@ var ts; // destructuring from the narrowed parent type. if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) { var parent = declaration.parent.parent; - if (parent.kind === 254 /* SyntaxKind.VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* NodeFlags.Const */ || parent.kind === 164 /* SyntaxKind.Parameter */) { + if (parent.kind === 257 /* SyntaxKind.VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* NodeFlags.Const */ || parent.kind === 166 /* SyntaxKind.Parameter */) { var links = getNodeLinks(parent); if (!(links.flags & 268435456 /* NodeCheckFlags.InCheckIdentifier */)) { links.flags |= 268435456 /* NodeCheckFlags.InCheckIdentifier */; var parentType = getTypeForBindingElementParent(parent, 0 /* CheckMode.Normal */); + var parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType); links.flags &= ~268435456 /* NodeCheckFlags.InCheckIdentifier */; - if (parentType && parentType.flags & 1048576 /* TypeFlags.Union */ && !(parent.kind === 164 /* SyntaxKind.Parameter */ && isSymbolAssigned(symbol))) { + if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* TypeFlags.Union */ && !(parent.kind === 166 /* SyntaxKind.Parameter */ && isSymbolAssigned(symbol))) { var pattern = declaration.parent; - var narrowedType = getFlowTypeOfReference(pattern, parentType, parentType, /*flowContainer*/ undefined, location.flowNode); + var narrowedType = getFlowTypeOfReference(pattern, parentTypeConstraint, parentTypeConstraint, /*flowContainer*/ undefined, location.flowNode); if (narrowedType.flags & 131072 /* TypeFlags.Never */) { return neverType; } @@ -72624,10 +73033,10 @@ var ts; } var container = ts.getContainingFunction(node); if (languageVersion < 2 /* ScriptTarget.ES2015 */) { - if (container.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (container.kind === 216 /* SyntaxKind.ArrowFunction */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } - else if (ts.hasSyntacticModifier(container, 256 /* ModifierFlags.Async */)) { + else if (ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); } } @@ -72647,7 +73056,7 @@ var ts; // Due to the emit for class decorators, any reference to the class from inside of the class body // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind // behavior of class names in ES6. - if (declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ + if (declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ && ts.nodeIsDecorated(declaration)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -72659,12 +73068,12 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration.kind === 226 /* SyntaxKind.ClassExpression */) { + else if (declaration.kind === 228 /* SyntaxKind.ClassExpression */) { // When we emit a class expression with static members that contain a reference // to the constructor in the initializer, we will need to substitute that // binding with an alias as the class name is not in scope. var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); - while (container.kind !== 305 /* SyntaxKind.SourceFile */) { + while (container.kind !== 308 /* SyntaxKind.SourceFile */) { if (container.parent === declaration) { if (ts.isPropertyDeclaration(container) && ts.isStatic(container) || ts.isClassStaticBlockDeclaration(container)) { getNodeLinks(declaration).flags |= 16777216 /* NodeCheckFlags.ClassWithConstructorReference */; @@ -72722,7 +73131,7 @@ var ts; // The declaration container is the innermost function that encloses the declaration of the variable // or parameter. The flow container is the innermost function starting with which we analyze the control // flow graph to determine the control flow based type. - var isParameter = ts.getRootDeclaration(declaration).kind === 164 /* SyntaxKind.Parameter */; + var isParameter = ts.getRootDeclaration(declaration).kind === 166 /* SyntaxKind.Parameter */; var declarationContainer = getControlFlowContainer(declaration); var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; @@ -72731,8 +73140,8 @@ var ts; // When the control flow originates in a function expression or arrow function and we are referencing // a const variable or parameter from an outer function, we extend the origin of the control flow // analysis to include the immediately enclosing function. - while (flowContainer !== declarationContainer && (flowContainer.kind === 213 /* SyntaxKind.FunctionExpression */ || - flowContainer.kind === 214 /* SyntaxKind.ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 215 /* SyntaxKind.FunctionExpression */ || + flowContainer.kind === 216 /* SyntaxKind.ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter && !isSymbolAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } @@ -72741,9 +73150,9 @@ var ts; // declaration container are the same). var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || ts.isBindingElement(declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* TypeFlags.AnyOrUnknown */ | 16384 /* TypeFlags.Void */)) !== 0 || - isInTypeQuery(node) || node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) || - node.parent.kind === 230 /* SyntaxKind.NonNullExpression */ || - declaration.kind === 254 /* SyntaxKind.VariableDeclaration */ && declaration.exclamationToken || + isInTypeQuery(node) || node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) || + node.parent.kind === 232 /* SyntaxKind.NonNullExpression */ || + declaration.kind === 257 /* SyntaxKind.VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* NodeFlags.Ambient */; var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) : type === autoType || type === autoArrayType ? undefinedType : @@ -72801,7 +73210,7 @@ var ts; (symbol.flags & (2 /* SymbolFlags.BlockScopedVariable */ | 32 /* SymbolFlags.Class */)) === 0 || !symbol.valueDeclaration || ts.isSourceFile(symbol.valueDeclaration) || - symbol.valueDeclaration.parent.kind === 292 /* SyntaxKind.CatchClause */) { + symbol.valueDeclaration.parent.kind === 295 /* SyntaxKind.CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -72816,7 +73225,7 @@ var ts; // mark iteration statement as containing block-scoped binding captured in some function var capturesBlockScopeBindingInLoopBody = true; if (ts.isForStatement(container)) { - var varDeclList = ts.getAncestor(symbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); + var varDeclList = ts.getAncestor(symbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); if (varDeclList && varDeclList.parent === container) { var part = getPartOfForStatementContainingNode(node.parent, container); if (part) { @@ -72837,7 +73246,7 @@ var ts; // mark variables that are declared in loop initializer and reassigned inside the body of ForStatement. // if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back. if (ts.isForStatement(container)) { - var varDeclList = ts.getAncestor(symbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); + var varDeclList = ts.getAncestor(symbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); if (varDeclList && varDeclList.parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 4194304 /* NodeCheckFlags.NeedsLoopOutParameter */; } @@ -72856,7 +73265,7 @@ var ts; function isAssignedInBodyOfForStatement(node, container) { // skip parenthesized nodes var current = node; - while (current.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (current.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { current = current.parent; } // check if node is used as LHS in some assignment expression @@ -72864,7 +73273,7 @@ var ts; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || current.parent.kind === 220 /* SyntaxKind.PostfixUnaryExpression */)) { + else if ((current.parent.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || current.parent.kind === 222 /* SyntaxKind.PostfixUnaryExpression */)) { var expr = current.parent; isAssigned = expr.operator === 45 /* SyntaxKind.PlusPlusToken */ || expr.operator === 46 /* SyntaxKind.MinusMinusToken */; } @@ -72877,7 +73286,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* NodeCheckFlags.LexicalThis */; - if (container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || container.kind === 171 /* SyntaxKind.Constructor */) { + if (container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || container.kind === 173 /* SyntaxKind.Constructor */) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* NodeCheckFlags.CaptureThis */; } @@ -72924,31 +73333,31 @@ var ts; // tell whether 'this' needs to be captured. var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var capturedByArrowFunction = false; - if (container.kind === 171 /* SyntaxKind.Constructor */) { + if (container.kind === 173 /* SyntaxKind.Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (container.kind === 216 /* SyntaxKind.ArrowFunction */) { container = ts.getThisContainer(container, /* includeArrowFunctions */ false); capturedByArrowFunction = true; } checkThisInStaticClassFieldInitializerInDecoratedClass(node, container); switch (container.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks } break; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -73036,7 +73445,7 @@ var ts; } function getClassNameFromPrototypeMethod(container) { // Check if it's the RHS of a x.prototype.y = function [name]() { .... } - if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && + if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && ts.isBinaryExpression(container.parent) && ts.getAssignmentDeclarationKind(container.parent) === 3 /* AssignmentDeclarationKind.PrototypeProperty */) { // Get the 'x' of 'x.prototype.y = container' @@ -73046,16 +73455,16 @@ var ts; .expression; // x } // x.prototype = { method() { } } - else if (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && - container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + else if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && + container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && ts.isBinaryExpression(container.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent) === 6 /* AssignmentDeclarationKind.Prototype */) { return container.parent.parent.left.expression; } // x.prototype = { method: function() { } } - else if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && - container.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ && - container.parent.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + else if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && + container.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ && + container.parent.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && ts.isBinaryExpression(container.parent.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent.parent) === 6 /* AssignmentDeclarationKind.Prototype */) { return container.parent.parent.parent.left.expression; @@ -73063,7 +73472,7 @@ var ts; // Object.defineProperty(x, "method", { value: function() { } }); // Object.defineProperty(x, "method", { set: (x: () => void) => void }); // Object.defineProperty(x, "method", { get: () => function() { }) }); - else if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && + else if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && ts.isPropertyAssignment(container.parent) && ts.isIdentifier(container.parent.name) && (container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") && @@ -73088,7 +73497,7 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 317 /* SyntaxKind.JSDocFunctionType */) { + if (jsdocType && jsdocType.kind === 320 /* SyntaxKind.JSDocFunctionType */) { var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && @@ -73102,16 +73511,16 @@ var ts; } } function isInConstructorArgumentInitializer(node, constructorDecl) { - return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 164 /* SyntaxKind.Parameter */ && n.parent === constructorDecl; }); + return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 166 /* SyntaxKind.Parameter */ && n.parent === constructorDecl; }); } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 208 /* SyntaxKind.CallExpression */ && node.parent.expression === node; + var isCallExpression = node.parent.kind === 210 /* SyntaxKind.CallExpression */ && node.parent.expression === node; var immediateContainer = ts.getSuperContainer(node, /*stopOnFunctions*/ true); var container = immediateContainer; var needToCaptureLexicalThis = false; // adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting if (!isCallExpression) { - while (container && container.kind === 214 /* SyntaxKind.ArrowFunction */) { + while (container && container.kind === 216 /* SyntaxKind.ArrowFunction */) { container = ts.getSuperContainer(container, /*stopOnFunctions*/ true); needToCaptureLexicalThis = languageVersion < 2 /* ScriptTarget.ES2015 */; } @@ -73124,14 +73533,14 @@ var ts; // class B { // [super.foo()]() {} // } - var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 162 /* SyntaxKind.ComputedPropertyName */; }); - if (current && current.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 164 /* SyntaxKind.ComputedPropertyName */; }); + if (current && current.kind === 164 /* SyntaxKind.ComputedPropertyName */) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } - else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -73139,7 +73548,7 @@ var ts; } return errorType; } - if (!isCallExpression && immediateContainer.kind === 171 /* SyntaxKind.Constructor */) { + if (!isCallExpression && immediateContainer.kind === 173 /* SyntaxKind.Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); } if (ts.isStatic(container) || isCallExpression) { @@ -73220,7 +73629,7 @@ var ts; // as a call expression cannot be used as the target of a destructuring assignment while a property access can. // // For element access expressions (`super[x]`), we emit a generic helper that forwards the element access in both situations. - if (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && ts.hasSyntacticModifier(container, 256 /* ModifierFlags.Async */)) { + if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) { if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */; } @@ -73234,7 +73643,7 @@ var ts; // in this case they should also use correct lexical this captureLexicalThis(node.parent, container); } - if (container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return errorType; @@ -73255,7 +73664,7 @@ var ts; if (!baseClassType) { return errorType; } - if (container.kind === 171 /* SyntaxKind.Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 173 /* SyntaxKind.Constructor */ && isInConstructorArgumentInitializer(node, container)) { // issue custom error message for super property access in constructor arguments (to be aligned with old compiler) error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return errorType; @@ -73270,7 +73679,7 @@ var ts; if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes - return container.kind === 171 /* SyntaxKind.Constructor */; + return container.kind === 173 /* SyntaxKind.Constructor */; } else { // TS 1.0 SPEC (April 2014) @@ -73278,23 +73687,23 @@ var ts; // - In a constructor, instance member function, instance member accessor, or instance member variable initializer where this references a derived class instance // - In a static member function or static member accessor // topmost container must be something that is directly nested in the class declaration\object literal expression - if (ts.isClassLike(container.parent) || container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (ts.isClassLike(container.parent) || container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { if (ts.isStatic(container)) { - return container.kind === 169 /* SyntaxKind.MethodDeclaration */ || - container.kind === 168 /* SyntaxKind.MethodSignature */ || - container.kind === 172 /* SyntaxKind.GetAccessor */ || - container.kind === 173 /* SyntaxKind.SetAccessor */ || - container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - container.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + return container.kind === 171 /* SyntaxKind.MethodDeclaration */ || + container.kind === 170 /* SyntaxKind.MethodSignature */ || + container.kind === 174 /* SyntaxKind.GetAccessor */ || + container.kind === 175 /* SyntaxKind.SetAccessor */ || + container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + container.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; } else { - return container.kind === 169 /* SyntaxKind.MethodDeclaration */ || - container.kind === 168 /* SyntaxKind.MethodSignature */ || - container.kind === 172 /* SyntaxKind.GetAccessor */ || - container.kind === 173 /* SyntaxKind.SetAccessor */ || - container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - container.kind === 166 /* SyntaxKind.PropertySignature */ || - container.kind === 171 /* SyntaxKind.Constructor */; + return container.kind === 171 /* SyntaxKind.MethodDeclaration */ || + container.kind === 170 /* SyntaxKind.MethodSignature */ || + container.kind === 174 /* SyntaxKind.GetAccessor */ || + container.kind === 175 /* SyntaxKind.SetAccessor */ || + container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + container.kind === 168 /* SyntaxKind.PropertySignature */ || + container.kind === 173 /* SyntaxKind.Constructor */; } } } @@ -73302,10 +73711,10 @@ var ts; } } function getContainingObjectLiteral(func) { - return (func.kind === 169 /* SyntaxKind.MethodDeclaration */ || - func.kind === 172 /* SyntaxKind.GetAccessor */ || - func.kind === 173 /* SyntaxKind.SetAccessor */) && func.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ ? func.parent : - func.kind === 213 /* SyntaxKind.FunctionExpression */ && func.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ ? func.parent.parent : + return (func.kind === 171 /* SyntaxKind.MethodDeclaration */ || + func.kind === 174 /* SyntaxKind.GetAccessor */ || + func.kind === 175 /* SyntaxKind.SetAccessor */) && func.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ ? func.parent : + func.kind === 215 /* SyntaxKind.FunctionExpression */ && func.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ ? func.parent.parent : undefined; } function getThisTypeArgument(type) { @@ -73317,7 +73726,7 @@ var ts; }); } function getContextualThisParameterType(func) { - if (func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 216 /* SyntaxKind.ArrowFunction */) { return undefined; } if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { @@ -73344,7 +73753,7 @@ var ts; if (thisType) { return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral))); } - if (literal.parent.kind !== 296 /* SyntaxKind.PropertyAssignment */) { + if (literal.parent.kind !== 299 /* SyntaxKind.PropertyAssignment */) { break; } literal = literal.parent.parent; @@ -73358,7 +73767,7 @@ var ts; // In an assignment of the form 'obj.xxx = function(...)' or 'obj[xxx] = function(...)', the // contextual type for 'this' is 'obj'. var parent = ts.walkUpParenthesizedExpressions(func.parent); - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { var target = parent.left; if (ts.isAccessExpression(target)) { var expression = target.expression; @@ -73411,11 +73820,11 @@ var ts; return getTypeFromTypeNode(typeNode); } switch (declaration.kind) { - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return getContextuallyTypedParameterType(declaration); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getContextualTypeForBindingElement(declaration, contextFlags); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (ts.isStatic(declaration)) { return getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags); } @@ -73426,10 +73835,10 @@ var ts; var parent = declaration.parent.parent; var name = declaration.propertyName || declaration.name; var parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || - parent.kind !== 203 /* SyntaxKind.BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* CheckMode.RestBindingElement */ : 0 /* CheckMode.Normal */); + parent.kind !== 205 /* SyntaxKind.BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* CheckMode.RestBindingElement */ : 0 /* CheckMode.Normal */); if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name)) return undefined; - if (parent.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */) { + if (parent.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */) { var index = ts.indexOfNode(declaration.parent.elements, declaration); if (index < 0) return undefined; @@ -73586,7 +73995,7 @@ var ts; getTypeAtPosition(signature, argIndex); } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (template.parent.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -73705,9 +74114,11 @@ var ts; case 1 /* AssignmentDeclarationKind.ExportsProperty */: case 6 /* AssignmentDeclarationKind.Prototype */: case 3 /* AssignmentDeclarationKind.PrototypeProperty */: - var valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; - // falls through case 2 /* AssignmentDeclarationKind.ModuleExports */: + var valueDeclaration = void 0; + if (kind !== 2 /* AssignmentDeclarationKind.ModuleExports */) { + valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; + } valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration); var annotated = valueDeclaration && ts.getEffectiveTypeAnnotationNode(valueDeclaration); return annotated ? getTypeFromTypeNode(annotated) : undefined; @@ -73884,21 +74295,21 @@ var ts; case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 79 /* SyntaxKind.Identifier */: - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: return true; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isPossiblyDiscriminantValue(node.expression); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return !node.expression || isPossiblyDiscriminantValue(node.expression); } return false; } function discriminateContextualTypeByObjectMembers(node, contextualType) { - return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 296 /* SyntaxKind.PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); + return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 299 /* SyntaxKind.PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); } function discriminateContextualTypeByJSXAttributes(node, contextualType) { - return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 285 /* SyntaxKind.JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); + return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 288 /* SyntaxKind.JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); } // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily // be "pushed" onto a node using the contextualType property. @@ -73981,60 +74392,62 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 205 /* SyntaxKind.BindingElement */: return getContextualTypeForInitializerExpression(node, contextFlags); - case 214 /* SyntaxKind.ArrowFunction */: - case 247 /* SyntaxKind.ReturnStatement */: + case 216 /* SyntaxKind.ArrowFunction */: + case 250 /* SyntaxKind.ReturnStatement */: return getContextualTypeForReturnExpression(node, contextFlags); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return getContextualTypeForYieldOperand(parent, contextFlags); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return getContextualTypeForAwaitOperand(parent, contextFlags); - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return getContextualTypeForArgument(parent, node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return ts.isConstTypeReference(parent.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(parent.type); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return getContextualTypeForBinaryOperand(node, contextFlags); - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent, contextFlags); - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return getContextualType(parent.parent, contextFlags); - case 204 /* SyntaxKind.ArrayLiteralExpression */: { + case 206 /* SyntaxKind.ArrayLiteralExpression */: { var arrayLiteral = parent; var type = getApparentTypeOfContextualType(arrayLiteral, contextFlags); return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node)); } - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return getContextualTypeForConditionalOperand(node, contextFlags); - case 233 /* SyntaxKind.TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 223 /* SyntaxKind.TemplateExpression */); + case 236 /* SyntaxKind.TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 225 /* SyntaxKind.TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 212 /* SyntaxKind.ParenthesizedExpression */: { + case 214 /* SyntaxKind.ParenthesizedExpression */: { // Like in `checkParenthesizedExpression`, an `/** @type {xyz} */` comment before a parenthesized expression acts as a type cast. var tag = ts.isInJSFile(parent) ? ts.getJSDocTypeTag(parent) : undefined; return !tag ? getContextualType(parent, contextFlags) : ts.isJSDocTypeTag(tag) && ts.isConstTypeReference(tag.typeExpression.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(tag.typeExpression.type); } - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return getContextualType(parent, contextFlags); - case 271 /* SyntaxKind.ExportAssignment */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return getTypeFromTypeNode(parent.type); + case 274 /* SyntaxKind.ExportAssignment */: return tryGetTypeFromEffectiveTypeNode(parent); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return getContextualTypeForJsxExpression(parent, contextFlags); - case 285 /* SyntaxKind.JsxAttribute */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent, contextFlags); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return getContextualJsxElementAttributesType(parent, contextFlags); } return undefined; @@ -74160,9 +74573,16 @@ var ts; if (!isErrorType(intrinsicClassAttribs)) { var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); var hostClassType = getReturnTypeOfSignature(sig); - apparentAttributesType = intersectTypes(typeParams - ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context))) - : intrinsicClassAttribs, apparentAttributesType); + var libraryManagedAttributeType = void 0; + if (typeParams) { + // apply JSX.IntrinsicClassElements + var inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context)); + libraryManagedAttributeType = instantiateType(intrinsicClassAttribs, createTypeMapper(typeParams, inferredArgs)); + } + // or JSX.IntrinsicClassElements has no generics. + else + libraryManagedAttributeType = intrinsicClassAttribs; + apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType); } var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); if (!isErrorType(intrinsicAttribs)) { @@ -74285,7 +74705,7 @@ var ts; // all identical ignoring their return type, the result is same signature but with return type as // union type of return types from these signatures function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var typeTagSignature = getSignatureOfTypeTag(node); if (typeTagSignature) { return typeTagSignature; @@ -74333,8 +74753,8 @@ var ts; return node.isSpread ? getIndexedAccessType(node.type, numberType) : node.type; } function hasDefaultValue(node) { - return (node.kind === 203 /* SyntaxKind.BindingElement */ && !!node.initializer) || - (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */); + return (node.kind === 205 /* SyntaxKind.BindingElement */ && !!node.initializer) || + (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */); } function checkArrayLiteral(node, checkMode, forceTuple) { var elements = node.elements; @@ -74347,7 +74767,7 @@ var ts; var hasOmittedExpression = false; for (var i = 0; i < elementCount; i++) { var e = elements[i]; - if (e.kind === 225 /* SyntaxKind.SpreadElement */) { + if (e.kind === 227 /* SyntaxKind.SpreadElement */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { checkExternalEmitHelpers(e, compilerOptions.downlevelIteration ? 1536 /* ExternalEmitHelpers.SpreadIncludes */ : 1024 /* ExternalEmitHelpers.SpreadArray */); } @@ -74380,7 +74800,7 @@ var ts; elementFlags.push(4 /* ElementFlags.Rest */); } } - else if (exactOptionalPropertyTypes && e.kind === 227 /* SyntaxKind.OmittedExpression */) { + else if (exactOptionalPropertyTypes && e.kind === 229 /* SyntaxKind.OmittedExpression */) { hasOmittedExpression = true; elementTypes.push(missingType); elementFlags.push(2 /* ElementFlags.Optional */); @@ -74420,7 +74840,7 @@ var ts; } function isNumericName(name) { switch (name.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return isNumericComputedName(name); case 79 /* SyntaxKind.Identifier */: return ts.isNumericLiteralName(name.escapedText); @@ -74441,7 +74861,7 @@ var ts; if (!links.resolvedType) { if ((ts.isTypeLiteralNode(node.parent.parent) || ts.isClassLike(node.parent.parent) || ts.isInterfaceDeclaration(node.parent.parent)) && ts.isBinaryExpression(node.expression) && node.expression.operatorToken.kind === 101 /* SyntaxKind.InKeyword */ - && node.parent.kind !== 172 /* SyntaxKind.GetAccessor */ && node.parent.kind !== 173 /* SyntaxKind.SetAccessor */) { + && node.parent.kind !== 174 /* SyntaxKind.GetAccessor */ && node.parent.kind !== 175 /* SyntaxKind.SetAccessor */) { return links.resolvedType = errorType; } links.resolvedType = checkExpression(node.expression); @@ -74514,7 +74934,7 @@ var ts; var spread = emptyObjectType; var contextualType = getApparentTypeOfContextualType(node, /*contextFlags*/ undefined); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ || contextualType.pattern.kind === 205 /* SyntaxKind.ObjectLiteralExpression */); + (contextualType.pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ || contextualType.pattern.kind === 207 /* SyntaxKind.ObjectLiteralExpression */); var inConstContext = isConstContext(node); var checkFlags = inConstContext ? 8 /* CheckFlags.Readonly */ : 0; var isInJavascript = ts.isInJSFile(node) && !ts.isInJsonFile(node); @@ -74538,16 +74958,16 @@ var ts; for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var memberDecl = _c[_b]; var member = getSymbolOfNode(memberDecl); - var computedNameType = memberDecl.name && memberDecl.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? + var computedNameType = memberDecl.name && memberDecl.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : undefined; - if (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ || - memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ || + if (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ || + memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { - var type = memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : + var type = memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : // avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring // for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`. // we don't want to say "could not find 'a'". - memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : + memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode); if (isInJavascript) { var jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl); @@ -74570,8 +74990,8 @@ var ts; if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. - var isOptional = (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 16777216 /* SymbolFlags.Optional */; } @@ -74597,14 +75017,14 @@ var ts; member = prop; allPropertiesTable === null || allPropertiesTable === void 0 ? void 0 : allPropertiesTable.set(prop.escapedName, prop); if (contextualType && checkMode && checkMode & 2 /* CheckMode.Inferential */ && !(checkMode & 4 /* CheckMode.SkipContextSensitive */) && - (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ || memberDecl.kind === 169 /* SyntaxKind.MethodDeclaration */) && isContextSensitive(memberDecl)) { + (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ || memberDecl.kind === 171 /* SyntaxKind.MethodDeclaration */) && isContextSensitive(memberDecl)) { var inferenceContext = getInferenceContext(node); ts.Debug.assert(inferenceContext); // In CheckMode.Inferential we should always have an inference context - var inferenceNode = memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ ? memberDecl.initializer : memberDecl; + var inferenceNode = memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ ? memberDecl.initializer : memberDecl; addIntraExpressionInferenceSite(inferenceContext, inferenceNode, type); } } - else if (memberDecl.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (memberDecl.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { checkExternalEmitHelpers(memberDecl, 2 /* ExternalEmitHelpers.Assign */); } @@ -74640,7 +75060,7 @@ var ts; // an ordinary function declaration(section 6.1) with no parameters. // A set accessor declaration is processed in the same manner // as an ordinary function declaration with a single parameter and a Void return type. - ts.Debug.assert(memberDecl.kind === 172 /* SyntaxKind.GetAccessor */ || memberDecl.kind === 173 /* SyntaxKind.SetAccessor */); + ts.Debug.assert(memberDecl.kind === 174 /* SyntaxKind.GetAccessor */ || memberDecl.kind === 175 /* SyntaxKind.SetAccessor */); checkNodeDeferred(memberDecl); } if (computedNameType && !(computedNameType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */)) { @@ -74667,16 +75087,30 @@ var ts; // If object literal is contextually typed by the implied type of a binding pattern, augment the result // type with those properties for which the binding pattern specifies a default value. // If the object literal is spread into another object literal, skip this step and let the top-level object - // literal handle it instead. - if (contextualTypeHasPattern && node.parent.kind !== 298 /* SyntaxKind.SpreadAssignment */) { - for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { - var prop = _e[_d]; - if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { - if (!(prop.flags & 16777216 /* SymbolFlags.Optional */)) { - error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + // literal handle it instead. Note that this might require full traversal to the root pattern's parent + // as it's the guaranteed to be the common ancestor of the pattern node and the current object node. + // It's not possible to check if the immediate parent node is a spread assignment + // since the type flows in non-obvious ways through conditional expressions, IIFEs and more. + if (contextualTypeHasPattern) { + var rootPatternParent_1 = ts.findAncestor(contextualType.pattern.parent, function (n) { + return n.kind === 257 /* SyntaxKind.VariableDeclaration */ || + n.kind === 223 /* SyntaxKind.BinaryExpression */ || + n.kind === 166 /* SyntaxKind.Parameter */; + }); + var spreadOrOutsideRootObject = ts.findAncestor(node, function (n) { + return n === rootPatternParent_1 || + n.kind === 301 /* SyntaxKind.SpreadAssignment */; + }); + if (spreadOrOutsideRootObject.kind !== 301 /* SyntaxKind.SpreadAssignment */) { + for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { + var prop = _e[_d]; + if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { + if (!(prop.flags & 16777216 /* SymbolFlags.Optional */)) { + error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + propertiesTable.set(prop.escapedName, prop); + propertiesArray.push(prop); } - propertiesTable.set(prop.escapedName, prop); - propertiesArray.push(prop); } } } @@ -74784,6 +75218,7 @@ var ts; */ function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) { var attributes = openingLikeElement.attributes; + var attributesType = getContextualType(attributes, 0 /* ContextFlags.None */); var allAttributesTable = strictNullChecks ? ts.createSymbolTable() : undefined; var attributesTable = ts.createSymbolTable(); var spread = emptyJsxObjectType; @@ -74811,9 +75246,15 @@ var ts; if (attributeDecl.name.escapedText === jsxChildrenPropertyName) { explicitlySpecifyChildrenAttribute = true; } + if (attributesType) { + var prop = getPropertyOfType(attributesType, member.escapedName); + if (prop && prop.declarations && isDeprecatedSymbol(prop)) { + addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText); + } + } } else { - ts.Debug.assert(attributeDecl.kind === 287 /* SyntaxKind.JsxSpreadAttribute */); + ts.Debug.assert(attributeDecl.kind === 290 /* SyntaxKind.JsxSpreadAttribute */); if (attributesTable.size > 0) { spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, /*readonly*/ false); attributesTable = ts.createSymbolTable(); @@ -74840,7 +75281,7 @@ var ts; } } // Handle children attribute - var parent = openingLikeElement.parent.kind === 278 /* SyntaxKind.JsxElement */ ? openingLikeElement.parent : undefined; + var parent = openingLikeElement.parent.kind === 281 /* SyntaxKind.JsxElement */ ? openingLikeElement.parent : undefined; // We have to check that openingElement of the parent is the one we are visiting as this may not be true for selfClosingElement if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) { var childrenTypes = checkJsxChildren(parent, checkMode); @@ -74897,7 +75338,7 @@ var ts; childrenTypes.push(stringType); } } - else if (child.kind === 288 /* SyntaxKind.JsxExpression */ && !child.expression) { + else if (child.kind === 291 /* SyntaxKind.JsxExpression */ && !child.expression) { continue; // empty jsx expressions don't *really* count as present children } else { @@ -75329,9 +75770,9 @@ var ts; function checkPropertyAccessibility(node, isSuper, writing, type, prop, reportError) { if (reportError === void 0) { reportError = true; } var errorNode = !reportError ? undefined : - node.kind === 161 /* SyntaxKind.QualifiedName */ ? node.right : - node.kind === 200 /* SyntaxKind.ImportType */ ? node : - node.kind === 203 /* SyntaxKind.BindingElement */ && node.propertyName ? node.propertyName : node.name; + node.kind === 163 /* SyntaxKind.QualifiedName */ ? node.right : + node.kind === 202 /* SyntaxKind.ImportType */ ? node : + node.kind === 205 /* SyntaxKind.BindingElement */ && node.propertyName ? node.propertyName : node.name; return checkPropertyAccessibilityAtLocation(node, isSuper, writing, type, prop, errorNode); } /** @@ -75362,7 +75803,7 @@ var ts; return false; } } - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { // A method cannot be accessed in a super property access if the method is abstract. // This error could mask a private property access error. But, a member // cannot simultaneously be private and abstract, so this will trigger an @@ -75374,7 +75815,7 @@ var ts; } } // Referencing abstract properties within their own constructors is not allowed - if ((flags & 128 /* ModifierFlags.Abstract */) && symbolHasNonMethodDeclaration(prop) && + if ((flags & 256 /* ModifierFlags.Abstract */) && symbolHasNonMethodDeclaration(prop) && (ts.isThisProperty(location) || ts.isThisInitializedObjectBindingExpression(location) || ts.isObjectBindingPattern(location.parent) && ts.isThisInitializedDeclaration(location.parent.parent))) { var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) { @@ -75468,10 +75909,27 @@ var ts; return isNullableType(type) ? getNonNullableType(type) : type; } function reportObjectPossiblyNullOrUndefinedError(node, facts) { - error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? - ts.Diagnostics.Object_is_possibly_null_or_undefined : - ts.Diagnostics.Object_is_possibly_undefined : - ts.Diagnostics.Object_is_possibly_null); + var nodeText = ts.isEntityNameExpression(node) ? ts.entityNameToString(node) : undefined; + if (node.kind === 104 /* SyntaxKind.NullKeyword */) { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "null"); + return; + } + if (nodeText !== undefined && nodeText.length < 100) { + if (ts.isIdentifier(node) && nodeText === "undefined") { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "undefined"); + return; + } + error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? + ts.Diagnostics._0_is_possibly_null_or_undefined : + ts.Diagnostics._0_is_possibly_undefined : + ts.Diagnostics._0_is_possibly_null, nodeText); + } + else { + error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + } } function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) { error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? @@ -75481,6 +75939,13 @@ var ts; } function checkNonNullTypeWithReporter(type, node, reportError) { if (strictNullChecks && type.flags & 2 /* TypeFlags.Unknown */) { + if (ts.isEntityNameExpression(node)) { + var nodeText = ts.entityNameToString(node); + if (nodeText.length < 100) { + error(node, ts.Diagnostics._0_is_of_type_unknown, nodeText); + return errorType; + } + } error(node, ts.Diagnostics.Object_is_of_type_unknown); return errorType; } @@ -75498,6 +75963,17 @@ var ts; function checkNonNullNonVoidType(type, node) { var nonNullType = checkNonNullType(type, node); if (nonNullType.flags & 16384 /* TypeFlags.Void */) { + if (ts.isEntityNameExpression(node)) { + var nodeText = ts.entityNameToString(node); + if (ts.isIdentifier(node) && nodeText === "undefined") { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, nodeText); + return nonNullType; + } + if (nodeText.length < 100) { + error(node, ts.Diagnostics._0_is_possibly_undefined, nodeText); + return nonNullType; + } + } error(node, ts.Diagnostics.Object_is_possibly_undefined); } return nonNullType; @@ -75516,7 +75992,7 @@ var ts; return checkPropertyAccessExpressionOrQualifiedName(node, node.left, leftType, node.right, checkMode); } function isMethodAccessForCall(node) { - while (node.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (node.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { node = node.parent; } return ts.isCallOrNewExpression(node.parent) && node.parent.expression === node; @@ -75656,7 +76132,7 @@ var ts; } return isErrorType(apparentType) ? errorType : apparentType; } - prop = getPropertyOfType(apparentType, right.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ node.kind === 161 /* SyntaxKind.QualifiedName */); + prop = getPropertyOfType(apparentType, right.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ node.kind === 163 /* SyntaxKind.QualifiedName */); } // In `Foo.Bar.Baz`, 'Foo' is not referenced if 'Bar' is a const enum or a module containing only const enums. // `Foo` is also not referenced in `enum FooCopy { Bar = Foo.Bar }`, because the enum member value gets inlined @@ -75666,7 +76142,7 @@ var ts; // 1. if 'isolatedModules' is enabled, because the const enum value will not be inlined, and // 2. if 'preserveConstEnums' is enabled and the expression is itself an export, e.g. `export = Foo.Bar.Baz`. if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules || - !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* SymbolFlags.EnumMember */ && node.parent.kind === 299 /* SyntaxKind.EnumMember */)) || + !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* SymbolFlags.EnumMember */ && node.parent.kind === 302 /* SyntaxKind.EnumMember */)) || ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) { markAliasReferenced(parentSymbol, node); } @@ -75768,7 +76244,7 @@ var ts; if (declaration && isPropertyWithoutInitializer(declaration)) { if (!ts.isStatic(declaration)) { var flowContainer = getControlFlowContainer(node); - if (flowContainer.kind === 171 /* SyntaxKind.Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { + if (flowContainer.kind === 173 /* SyntaxKind.Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { assumeUninitialized = true; } } @@ -75803,8 +76279,8 @@ var ts; && (compilerOptions.useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) { diagnosticMessage = error(right, ts.Diagnostics.Property_0_is_used_before_its_initialization, declarationName); } - else if (valueDeclaration.kind === 257 /* SyntaxKind.ClassDeclaration */ && - node.parent.kind !== 178 /* SyntaxKind.TypeReference */ && + else if (valueDeclaration.kind === 260 /* SyntaxKind.ClassDeclaration */ && + node.parent.kind !== 180 /* SyntaxKind.TypeReference */ && !(valueDeclaration.flags & 16777216 /* NodeFlags.Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) { diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName); @@ -75816,25 +76292,25 @@ var ts; function isInPropertyInitializerOrClassStaticBlock(node) { return !!ts.findAncestor(node, function (node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 296 /* SyntaxKind.PropertyAssignment */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 298 /* SyntaxKind.SpreadAssignment */: - case 162 /* SyntaxKind.ComputedPropertyName */: - case 233 /* SyntaxKind.TemplateSpan */: - case 288 /* SyntaxKind.JsxExpression */: - case 285 /* SyntaxKind.JsxAttribute */: - case 286 /* SyntaxKind.JsxAttributes */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 291 /* SyntaxKind.HeritageClause */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 301 /* SyntaxKind.SpreadAssignment */: + case 164 /* SyntaxKind.ComputedPropertyName */: + case 236 /* SyntaxKind.TemplateSpan */: + case 291 /* SyntaxKind.JsxExpression */: + case 288 /* SyntaxKind.JsxAttribute */: + case 289 /* SyntaxKind.JsxAttributes */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 294 /* SyntaxKind.HeritageClause */: return false; - case 214 /* SyntaxKind.ArrowFunction */: - case 238 /* SyntaxKind.ExpressionStatement */: + case 216 /* SyntaxKind.ArrowFunction */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.isBlock(node.parent) && ts.isClassStaticBlockDeclaration(node.parent.parent) ? true : "quit"; default: return ts.isExpressionNode(node) ? false : "quit"; @@ -76029,7 +76505,6 @@ var ts; } return false; } - ; var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get"; if (!hasProp(suggestedMethod)) { return undefined; @@ -76109,11 +76584,11 @@ var ts; } function isValidPropertyAccess(node, propertyName) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return isValidPropertyAccessWithType(node, node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, propertyName, getWidenedType(checkExpression(node.expression))); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getWidenedType(checkExpression(node.left))); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getTypeFromTypeNode(node)); } } @@ -76128,7 +76603,7 @@ var ts; * @param property the accessed property's symbol. */ function isValidPropertyAccessForCompletions(node, type, property) { - return isPropertyAccessible(node, node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, + return isPropertyAccessible(node, node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, /* isWrite */ false, type, property); // Previously we validated the 'this' type of methods but this adversely affected performance. See #31377 for more context. } @@ -76168,7 +76643,7 @@ var ts; */ function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -76197,7 +76672,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 243 /* SyntaxKind.ForInStatement */ && + if (node.kind === 246 /* SyntaxKind.ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -76246,13 +76721,13 @@ var ts; // This gets us diagnostics for the type arguments and marks them as referenced. ts.forEach(node.typeArguments, checkSourceElement); } - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { checkExpression(node.template); } else if (ts.isJsxOpeningLikeElement(node)) { checkExpression(node.attributes); } - else if (node.kind !== 165 /* SyntaxKind.Decorator */) { + else if (node.kind !== 167 /* SyntaxKind.Decorator */) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -76316,7 +76791,7 @@ var ts; } } function isSpreadArgument(arg) { - return !!arg && (arg.kind === 225 /* SyntaxKind.SpreadElement */ || arg.kind === 232 /* SyntaxKind.SyntheticExpression */ && arg.isSpread); + return !!arg && (arg.kind === 227 /* SyntaxKind.SpreadElement */ || arg.kind === 234 /* SyntaxKind.SyntheticExpression */ && arg.isSpread); } function getSpreadArgumentIndex(args) { return ts.findIndex(args, isSpreadArgument); @@ -76333,9 +76808,9 @@ var ts; var callIsIncomplete = false; // In incomplete call we want to be lenient when we have too few arguments var effectiveParameterCount = getParameterCount(signature); var effectiveMinimumArguments = getMinArgumentCount(signature); - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { argCount = args.length; - if (node.template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (node.template.kind === 225 /* SyntaxKind.TemplateExpression */) { // If a tagged template expression lacks a tail literal, the call is incomplete. // Specifically, a template only can end in a TemplateTail or a Missing literal. var lastSpan = ts.last(node.template.templateSpans); // we should always have at least one span. @@ -76350,7 +76825,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 165 /* SyntaxKind.Decorator */) { + else if (node.kind === 167 /* SyntaxKind.Decorator */) { argCount = getDecoratorArgumentCount(node, signature); } else if (ts.isJsxOpeningLikeElement(node)) { @@ -76364,7 +76839,7 @@ var ts; } else if (!node.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(node.kind === 209 /* SyntaxKind.NewExpression */); + ts.Debug.assert(node.kind === 211 /* SyntaxKind.NewExpression */); return getMinArgumentCount(signature) === 0; } else { @@ -76467,7 +76942,7 @@ var ts; // example, given a 'function wrap(cb: (x: T) => U): (x: T) => U' and a call expression // 'let f: (x: string) => number = wrap(s => s.length)', we infer from the declared type of 'f' to the // return type of 'wrap'. - if (node.kind !== 165 /* SyntaxKind.Decorator */) { + if (node.kind !== 167 /* SyntaxKind.Decorator */) { var skipBindingPatterns = ts.every(signature.typeParameters, function (p) { return !!getDefaultFromTypeParameter(p); }); var contextualType = getContextualType(node, skipBindingPatterns ? 8 /* ContextFlags.SkipBindingPatterns */ : 0 /* ContextFlags.None */); if (contextualType) { @@ -76531,7 +77006,7 @@ var ts; } for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 227 /* SyntaxKind.OmittedExpression */ && !(checkMode & 32 /* CheckMode.IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) { + if (arg.kind !== 229 /* SyntaxKind.OmittedExpression */ && !(checkMode & 32 /* CheckMode.IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) { var paramType = getTypeAtPosition(signature, i); if (couldContainTypeVariables(paramType)) { var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode); @@ -76557,7 +77032,7 @@ var ts; if (isSpreadArgument(arg)) { // We are inferring from a spread expression in the last argument position, i.e. both the parameter // and the argument are ...x forms. - return getMutableArrayOrTupleType(arg.kind === 232 /* SyntaxKind.SyntheticExpression */ ? arg.type : + return getMutableArrayOrTupleType(arg.kind === 234 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode)); } } @@ -76567,13 +77042,13 @@ var ts; for (var i = index; i < argCount; i++) { var arg = args[i]; if (isSpreadArgument(arg)) { - var spreadType = arg.kind === 232 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpression(arg.expression); + var spreadType = arg.kind === 234 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpression(arg.expression); if (isArrayLikeType(spreadType)) { types.push(spreadType); flags.push(8 /* ElementFlags.Variadic */); } else { - types.push(checkIteratedTypeOrElementType(33 /* IterationUse.Spread */, spreadType, undefinedType, arg.kind === 225 /* SyntaxKind.SpreadElement */ ? arg.expression : arg)); + types.push(checkIteratedTypeOrElementType(33 /* IterationUse.Spread */, spreadType, undefinedType, arg.kind === 227 /* SyntaxKind.SpreadElement */ ? arg.expression : arg)); flags.push(4 /* ElementFlags.Rest */); } } @@ -76584,7 +77059,7 @@ var ts; types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType)); flags.push(1 /* ElementFlags.Required */); } - if (arg.kind === 232 /* SyntaxKind.SyntheticExpression */ && arg.tupleNameSource) { + if (arg.kind === 234 /* SyntaxKind.SyntheticExpression */ && arg.tupleNameSource) { names.push(arg.tupleNameSource); } } @@ -76728,7 +77203,7 @@ var ts; return undefined; } var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 209 /* SyntaxKind.NewExpression */) { + if (thisType && thisType !== voidType && node.kind !== 211 /* SyntaxKind.NewExpression */) { // If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType // If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible. // If the expression is a new expression, then the check is skipped. @@ -76746,7 +77221,7 @@ var ts; var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length; for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 227 /* SyntaxKind.OmittedExpression */) { + if (arg.kind !== 229 /* SyntaxKind.OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = checkExpressionWithContextualType(arg, paramType, /*inferenceContext*/ undefined, checkMode); // If one or more arguments are still excluded (as indicated by CheckMode.SkipContextSensitive), @@ -76791,8 +77266,8 @@ var ts; * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise. */ function getThisArgumentOfCall(node) { - var expression = node.kind === 208 /* SyntaxKind.CallExpression */ ? node.expression : - node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */ ? node.tag : undefined; + var expression = node.kind === 210 /* SyntaxKind.CallExpression */ ? node.expression : + node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */ ? node.tag : undefined; if (expression) { var callee = ts.skipOuterExpressions(expression); if (ts.isAccessExpression(callee)) { @@ -76810,17 +77285,17 @@ var ts; * Returns the effective arguments for an expression that works like a function invocation. */ function getEffectiveCallArguments(node) { - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { var template = node.template; var args_3 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())]; - if (template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (template.kind === 225 /* SyntaxKind.TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args_3.push(span.expression); }); } return args_3; } - if (node.kind === 165 /* SyntaxKind.Decorator */) { + if (node.kind === 167 /* SyntaxKind.Decorator */) { return getEffectiveDecoratorArguments(node); } if (ts.isJsxOpeningLikeElement(node)) { @@ -76831,10 +77306,10 @@ var ts; if (spreadIndex >= 0) { // Create synthetic arguments from spreads of tuple types. var effectiveArgs_1 = args.slice(0, spreadIndex); - var _loop_26 = function (i) { + var _loop_27 = function (i) { var arg = args[i]; // We can call checkExpressionCached because spread expressions never have a contextual type. - var spreadType = arg.kind === 225 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); + var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); if (spreadType && isTupleType(spreadType)) { ts.forEach(getTypeArguments(spreadType), function (t, i) { var _a; @@ -76848,7 +77323,7 @@ var ts; } }; for (var i = spreadIndex; i < args.length; i++) { - _loop_26(i); + _loop_27(i); } return effectiveArgs_1; } @@ -76861,30 +77336,30 @@ var ts; var parent = node.parent; var expr = node.expression; switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: // For a class decorator, the `target` is the type of the class (e.g. the // "static" or "constructor" side of the class). return [ createSyntheticExpression(expr, getTypeOfSymbol(getSymbolOfNode(parent))) ]; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // A parameter declaration decorator will have three arguments (see // `ParameterDecorator` in core.d.ts). var func = parent.parent; return [ - createSyntheticExpression(expr, parent.parent.kind === 171 /* SyntaxKind.Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), + createSyntheticExpression(expr, parent.parent.kind === 173 /* SyntaxKind.Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), createSyntheticExpression(expr, anyType), createSyntheticExpression(expr, numberType) ]; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // A method or accessor declaration decorator will have two or three arguments (see // `PropertyDecorator` and `MethodDecorator` in core.d.ts). If we are emitting decorators // for ES3, we will only pass two arguments. - var hasPropDesc = parent.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && languageVersion !== 0 /* ScriptTarget.ES3 */; + var hasPropDesc = languageVersion !== 0 /* ScriptTarget.ES3 */ && (!ts.isPropertyDeclaration(parent) || ts.hasAccessorModifier(parent)); return [ createSyntheticExpression(expr, getParentTypeOfClassElement(parent)), createSyntheticExpression(expr, getClassElementPropertyKeyType(parent)), @@ -76898,17 +77373,17 @@ var ts; */ function getDecoratorArgumentCount(node, signature) { switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return 1; - case 167 /* SyntaxKind.PropertyDeclaration */: - return 2; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + return ts.hasAccessorModifier(node.parent) ? 3 : 2; + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // For ES3 or decorators with only two parameters we supply only two arguments return languageVersion === 0 /* ScriptTarget.ES3 */ || signature.parameters.length <= 2 ? 2 : 3; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return 3; default: return ts.Debug.fail(); @@ -77050,8 +77525,8 @@ var ts; return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount); } function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags, fallbackError) { - var isTaggedTemplate = node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */; - var isDecorator = node.kind === 165 /* SyntaxKind.Decorator */; + var isTaggedTemplate = node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */; + var isDecorator = node.kind === 167 /* SyntaxKind.Decorator */; var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node); var reportErrors = !candidatesOutArray; var typeArguments; @@ -77114,7 +77589,7 @@ var ts; var result; // If we are in signature help, a trailing comma indicates that we intend to provide another argument, // so we will only accept overloads with arity at least 1 higher than the current number of provided arguments. - var signatureHelpTrailingComma = !!(checkMode & 16 /* CheckMode.IsForSignatureHelp */) && node.kind === 208 /* SyntaxKind.CallExpression */ && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = !!(checkMode & 16 /* CheckMode.IsForSignatureHelp */) && node.kind === 210 /* SyntaxKind.CallExpression */ && node.arguments.hasTrailingComma; // Section 4.12.1: // if the candidate list contains one or more signatures for which the type of each argument // expression is a subtype of each corresponding parameter type, the return type of the first @@ -77177,7 +77652,7 @@ var ts; var min_3 = Number.MAX_VALUE; var minIndex = 0; var i_1 = 0; - var _loop_27 = function (c) { + var _loop_28 = function (c) { var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); }; var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* CheckMode.Normal */, /*reportErrors*/ true, chain_2); if (diags_2) { @@ -77195,7 +77670,7 @@ var ts; }; for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) { var c = candidatesForArgumentError_1[_a]; - _loop_27(c); + _loop_28(c); } var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics); ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures"); @@ -77353,7 +77828,7 @@ var ts; } var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max; var parameters = []; - var _loop_28 = function (i) { + var _loop_29 = function (i) { var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ? i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) : i < s.parameters.length ? s.parameters[i] : undefined; }); @@ -77361,7 +77836,7 @@ var ts; parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); }))); }; for (var i = 0; i < maxNonRestParam; i++) { - _loop_28(i); + _loop_29(i); } var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; }); var flags = 0 /* SignatureFlags.None */; @@ -77603,7 +78078,7 @@ var ts; return resolveErrorCall(node); } var valueDecl = expressionType.symbol && ts.getClassLikeDeclarationOfSymbol(expressionType.symbol); - if (valueDecl && ts.hasSyntacticModifier(valueDecl, 128 /* ModifierFlags.Abstract */)) { + if (valueDecl && ts.hasSyntacticModifier(valueDecl, 256 /* ModifierFlags.Abstract */)) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_an_abstract_class); return resolveErrorCall(node); } @@ -77674,7 +78149,7 @@ var ts; var declaration = signature.declaration; var modifiers = ts.getSelectedEffectiveModifierFlags(declaration, 24 /* ModifierFlags.NonPublicAccessibilityModifier */); // (1) Public constructors and (2) constructor functions are always accessible. - if (!modifiers || declaration.kind !== 171 /* SyntaxKind.Constructor */) { + if (!modifiers || declaration.kind !== 173 /* SyntaxKind.Constructor */) { return true; } var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(declaration.parent.symbol); @@ -77818,16 +78293,16 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; default: return ts.Debug.fail(); @@ -77873,7 +78348,7 @@ var ts; // file would probably be preferable. var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 788968 /* SymbolFlags.Type */); var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 788968 /* SymbolFlags.Type */, node); - var declaration = ts.factory.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + var declaration = ts.factory.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); var parameterSymbol = createSymbol(1 /* SymbolFlags.FunctionScopedVariable */, "props"); parameterSymbol.type = result; return createSignature(declaration, @@ -77922,16 +78397,16 @@ var ts; } function resolveSignature(node, candidatesOutArray, checkMode) { switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return resolveCallExpression(node, candidatesOutArray, checkMode); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return resolveNewExpression(node, candidatesOutArray, checkMode); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return resolveDecorator(node, candidatesOutArray, checkMode); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode); } throw ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable."); @@ -77975,12 +78450,15 @@ var ts; return false; } var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node : - ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer : + (ts.isVariableDeclaration(node) || ts.isPropertyAssignment(node)) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer : undefined; if (func) { - // If the node has a @class tag, treat it like a constructor. + // If the node has a @class or @constructor tag, treat it like a constructor. if (ts.getJSDocClassTag(node)) return true; + // If the node is a property of an object literal. + if (ts.isPropertyAssignment(ts.walkUpParenthesizedExpressions(func.parent))) + return false; // If the symbol of the node has members, treat it like a constructor. var symbol = getSymbolOfNode(func); return !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.members) === null || _a === void 0 ? void 0 : _a.size); @@ -78063,7 +78541,7 @@ var ts; return false; } var parent = node.parent; - while (parent && parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (parent && parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { parent = parent.parent; } if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { @@ -78089,12 +78567,12 @@ var ts; if (node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { return voidType; } - if (node.kind === 209 /* SyntaxKind.NewExpression */) { + if (node.kind === 211 /* SyntaxKind.NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 171 /* SyntaxKind.Constructor */ && - declaration.kind !== 175 /* SyntaxKind.ConstructSignature */ && - declaration.kind !== 180 /* SyntaxKind.ConstructorType */ && + declaration.kind !== 173 /* SyntaxKind.Constructor */ && + declaration.kind !== 177 /* SyntaxKind.ConstructSignature */ && + declaration.kind !== 182 /* SyntaxKind.ConstructorType */ && !ts.isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) { // When resolved signature is a call signature (and not a construct signature) the result type is any @@ -78114,7 +78592,7 @@ var ts; if (returnType.flags & 12288 /* TypeFlags.ESSymbolLike */ && isSymbolOrSymbolForCall(node)) { return getESSymbolLikeTypeForNode(ts.walkUpParenthesizedExpressions(node.parent)); } - if (node.kind === 208 /* SyntaxKind.CallExpression */ && !node.questionDotToken && node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && + if (node.kind === 210 /* SyntaxKind.CallExpression */ && !node.questionDotToken && node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && returnType.flags & 16384 /* TypeFlags.Void */ && getTypePredicateOfSignature(signature)) { if (!ts.isDottedName(node.expression)) { error(node.expression, ts.Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name); @@ -78144,20 +78622,20 @@ var ts; function getDeprecatedSuggestionNode(node) { node = ts.skipParentheses(node); switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: - case 165 /* SyntaxKind.Decorator */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 167 /* SyntaxKind.Decorator */: + case 211 /* SyntaxKind.NewExpression */: return getDeprecatedSuggestionNode(node.expression); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return getDeprecatedSuggestionNode(node.tag); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return getDeprecatedSuggestionNode(node.tagName); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return node.argumentExpression; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.name; - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: var typeReference = node; return ts.isQualifiedName(typeReference.typeName) ? typeReference.typeName.right : typeReference; default: @@ -78228,8 +78706,8 @@ var ts; if (hasDefaultOnly && type && !isErrorType(type)) { var synthType = type; if (!synthType.defaultOnlyType) { - var type_5 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); - synthType.defaultOnlyType = type_5; + var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); + synthType.defaultOnlyType = type_4; } return synthType.defaultOnlyType; } @@ -78272,9 +78750,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 /* SymbolFlags.Function */ - ? 256 /* SyntaxKind.FunctionDeclaration */ + ? 259 /* SyntaxKind.FunctionDeclaration */ : resolvedRequire.flags & 3 /* SymbolFlags.Variable */ - ? 254 /* SyntaxKind.VariableDeclaration */ + ? 257 /* SyntaxKind.VariableDeclaration */ : 0 /* SyntaxKind.Unknown */; if (targetDeclarationKind !== 0 /* SyntaxKind.Unknown */) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -78294,7 +78772,7 @@ var ts; return getReturnTypeOfSignature(signature); } function checkAssertion(node) { - if (node.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (node.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { var file = ts.getSourceFileOfNode(node); if (file && ts.fileExtensionIsOneOf(file.fileName, [".cts" /* Extension.Cts */, ".mts" /* Extension.Mts */])) { grammarErrorOnNode(node, ts.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead); @@ -78310,19 +78788,19 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 223 /* SyntaxKind.TemplateExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return true; - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isValidConstAssertionArgument(node.expression); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var op = node.operator; var arg = node.operand; return op === 40 /* SyntaxKind.MinusToken */ && (arg.kind === 8 /* SyntaxKind.NumericLiteral */ || arg.kind === 9 /* SyntaxKind.BigIntLiteral */) || op === 39 /* SyntaxKind.PlusToken */ && arg.kind === 8 /* SyntaxKind.NumericLiteral */; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = node.expression; var symbol = getTypeOfNode(expr).symbol; if (symbol && symbol.flags & 2097152 /* SymbolFlags.Alias */) { @@ -78364,7 +78842,7 @@ var ts; } function checkExpressionWithTypeArguments(node) { checkGrammarExpressionWithTypeArguments(node); - var exprType = node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ ? checkExpression(node.expression) : + var exprType = node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ ? checkExpression(node.expression) : ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName); var typeArguments = node.typeArguments; @@ -78428,6 +78906,16 @@ var ts; }); } } + function checkSatisfiesExpression(node) { + checkSourceElement(node.type); + var targetType = getTypeFromTypeNode(node.type); + if (isErrorType(targetType)) { + return targetType; + } + var exprType = checkExpression(node.expression); + checkTypeAssignableToAndOptionallyElaborate(exprType, targetType, node.type, node.expression, ts.Diagnostics.Type_0_does_not_satisfy_the_expected_type_1); + return exprType; + } function checkMetaProperty(node) { checkGrammarMetaProperty(node); if (node.keywordToken === 103 /* SyntaxKind.NewKeyword */) { @@ -78455,7 +78943,7 @@ var ts; error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); return errorType; } - else if (container.kind === 171 /* SyntaxKind.Constructor */) { + else if (container.kind === 173 /* SyntaxKind.Constructor */) { var symbol = getSymbolOfNode(container.parent); return getTypeOfSymbol(symbol); } @@ -78507,7 +78995,7 @@ var ts; } function getParameterIdentifierNameAtPosition(signature, pos) { var _a; - if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 317 /* SyntaxKind.JSDocFunctionType */) { + if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 320 /* SyntaxKind.JSDocFunctionType */) { return undefined; } var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -78539,7 +79027,7 @@ var ts; return symbol.valueDeclaration && ts.isParameter(symbol.valueDeclaration) && ts.isIdentifier(symbol.valueDeclaration.name); } function isValidDeclarationForTupleLabel(d) { - return d.kind === 197 /* SyntaxKind.NamedTupleMember */ || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name)); + return d.kind === 199 /* SyntaxKind.NamedTupleMember */ || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name)); } function getNameableDeclarationAtPosition(signature, pos) { var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -78831,7 +79319,7 @@ var ts; var yieldType; var nextType; var fallbackReturnType = voidType; - if (func.body.kind !== 235 /* SyntaxKind.Block */) { // Async or normal arrow function + if (func.body.kind !== 238 /* SyntaxKind.Block */) { // Async or normal arrow function returnType = checkExpressionCached(func.body, checkMode && checkMode & ~8 /* CheckMode.SkipGenericFunctions */); if (isAsync) { // From within an async function you can return either a non-promise value or a promise. Any @@ -78983,7 +79471,7 @@ var ts; return links.isExhaustive !== undefined ? links.isExhaustive : (links.isExhaustive = computeExhaustiveSwitchStatement(node)); } function computeExhaustiveSwitchStatement(node) { - if (node.expression.kind === 216 /* SyntaxKind.TypeOfExpression */) { + if (node.expression.kind === 218 /* SyntaxKind.TypeOfExpression */) { var witnesses = getSwitchClauseTypeOfWitnesses(node); if (!witnesses) { return false; @@ -79049,11 +79537,11 @@ var ts; } function mayReturnNever(func) { switch (func.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; - case 169 /* SyntaxKind.MethodDeclaration */: - return func.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + case 171 /* SyntaxKind.MethodDeclaration */: + return func.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; default: return false; } @@ -79079,7 +79567,7 @@ var ts; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. // also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw - if (func.kind === 168 /* SyntaxKind.MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 235 /* SyntaxKind.Block */ || !functionHasImplicitReturn(func)) { + if (func.kind === 170 /* SyntaxKind.MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 238 /* SyntaxKind.Block */ || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 512 /* NodeFlags.HasExplicitReturn */; @@ -79113,7 +79601,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); checkNodeDeferred(node); if (ts.isFunctionExpression(node)) { checkCollisionsForDeclarationName(node, node.name); @@ -79140,7 +79628,7 @@ var ts; } // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (!hasGrammarError && node.kind === 215 /* SyntaxKind.FunctionExpression */) { checkGrammarForGenerator(node); } contextuallyCheckFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -79191,7 +79679,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var functionFlags = ts.getFunctionFlags(node); var returnType = getReturnTypeFromAnnotation(node); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); @@ -79204,7 +79692,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 235 /* SyntaxKind.Block */) { + if (node.body.kind === 238 /* SyntaxKind.Block */) { checkSourceElement(node.body); } else { @@ -79294,7 +79782,7 @@ var ts; expr.expression.kind === 108 /* SyntaxKind.ThisKeyword */) { // Look for if this is the constructor for the class that `symbol` is a property of. var ctor = ts.getContainingFunction(expr); - if (!(ctor && (ctor.kind === 171 /* SyntaxKind.Constructor */ || isJSConstructor(ctor)))) { + if (!(ctor && (ctor.kind === 173 /* SyntaxKind.Constructor */ || isJSConstructor(ctor)))) { return true; } if (symbol.valueDeclaration) { @@ -79319,7 +79807,7 @@ var ts; var symbol_2 = getNodeLinks(node).resolvedSymbol; if (symbol_2.flags & 2097152 /* SymbolFlags.Alias */) { var declaration = getDeclarationOfAliasSymbol(symbol_2); - return !!declaration && declaration.kind === 268 /* SyntaxKind.NamespaceImport */; + return !!declaration && declaration.kind === 271 /* SyntaxKind.NamespaceImport */; } } } @@ -79419,7 +79907,7 @@ var ts; if (!hasParseDiagnostics(sourceFile)) { var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos); var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); - if (container && container.kind !== 171 /* SyntaxKind.Constructor */ && (ts.getFunctionFlags(container) & 2 /* FunctionFlags.Async */) === 0) { + if (container && container.kind !== 173 /* SyntaxKind.Constructor */ && (ts.getFunctionFlags(container) & 2 /* FunctionFlags.Async */) === 0) { var relatedInfo = ts.createDiagnosticForNode(container, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); ts.addRelatedInfo(diagnostic, relatedInfo); } @@ -79587,6 +80075,9 @@ var ts; } return booleanType; } + function hasEmptyObjectIntersection(type) { + return someType(type, function (t) { return t === unknownEmptyObjectType || !!(t.flags & 2097152 /* TypeFlags.Intersection */) && ts.some(t.types, isEmptyAnonymousObjectType); }); + } function checkInExpression(left, right, leftType, rightType) { if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; @@ -79603,40 +80094,20 @@ var ts; } } else { - leftType = checkNonNullType(leftType, left); - // TypeScript 1.0 spec (April 2014): 4.15.5 - // Require the left operand to be of type Any, the String primitive type, or the Number primitive type. - if (!(allTypesAssignableToKind(leftType, 402653316 /* TypeFlags.StringLike */ | 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */) || - isTypeAssignableToKind(leftType, 4194304 /* TypeFlags.Index */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */ | 262144 /* TypeFlags.TypeParameter */))) { - error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol); + // The type of the lef operand must be assignable to string, number, or symbol. + checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left); + } + // The type of the right operand must be assignable to 'object'. + if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) { + // The {} type is assignable to the object type, yet {} might represent a primitive type. Here we + // detect and error on {} that results from narrowing the unknown type, as well as intersections + // that include {} (we know that the other types in such intersections are assignable to object + // since we already checked for that). + if (hasEmptyObjectIntersection(rightType)) { + error(right, ts.Diagnostics.Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator, typeToString(rightType)); } } - rightType = checkNonNullType(rightType, right); - // TypeScript 1.0 spec (April 2014): 4.15.5 - // The in operator requires the right operand to be - // - // 1. assignable to the non-primitive type, - // 2. an unconstrained type parameter, - // 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the - // the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the - // non-primitive type, or - // 4. a type parameter whose constraint is - // i. an object type, - // ii. the non-primitive type, or - // iii. a union or intersection with at least one constituent assignable to an object or non-primitive type. - // - // The divergent behavior for type parameters and unions containing type parameters is a workaround for type - // parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance - // it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error - // unless *all* instantiations would result in an error. - // // The result is always of the Boolean primitive type. - var rightTypeConstraint = getConstraintOfType(rightType); - if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) || - rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) || - !maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) { - error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive); - } return booleanType; } function checkObjectLiteralAssignment(node, sourceType, rightIsThis) { @@ -79654,7 +80125,7 @@ var ts; if (rightIsThis === void 0) { rightIsThis = false; } var properties = node.properties; var property = properties[propertyIndex]; - if (property.kind === 296 /* SyntaxKind.PropertyAssignment */ || property.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (property.kind === 299 /* SyntaxKind.PropertyAssignment */ || property.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var name = property.name; var exprType = getLiteralTypeFromPropertyName(name); if (isTypeUsableAsPropertyName(exprType)) { @@ -79667,9 +80138,9 @@ var ts; } var elementType = getIndexedAccessType(objectLiteralType, exprType, 32 /* AccessFlags.ExpressionPosition */, name); var type = getFlowTypeOfDestructuring(property, elementType); - return checkDestructuringAssignment(property.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? property : property.initializer, type); + return checkDestructuringAssignment(property.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? property : property.initializer, type); } - else if (property.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (property.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (propertyIndex < properties.length - 1) { error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } @@ -79707,7 +80178,7 @@ var ts; var inBoundsType = compilerOptions.noUncheckedIndexedAccess ? undefined : possiblyOutOfBoundsType; for (var i = 0; i < elements.length; i++) { var type = possiblyOutOfBoundsType; - if (node.elements[i].kind === 225 /* SyntaxKind.SpreadElement */) { + if (node.elements[i].kind === 227 /* SyntaxKind.SpreadElement */) { type = inBoundsType = inBoundsType !== null && inBoundsType !== void 0 ? inBoundsType : (checkIteratedTypeOrElementType(65 /* IterationUse.Destructuring */, sourceType, undefinedType, node) || errorType); } checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, type, checkMode); @@ -79717,8 +80188,8 @@ var ts; function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 227 /* SyntaxKind.OmittedExpression */) { - if (element.kind !== 225 /* SyntaxKind.SpreadElement */) { + if (element.kind !== 229 /* SyntaxKind.OmittedExpression */) { + if (element.kind !== 227 /* SyntaxKind.SpreadElement */) { var indexType = getNumberLiteralType(elementIndex); if (isArrayLikeType(sourceType)) { // We create a synthetic expression so that getIndexedAccessType doesn't get confused @@ -79736,7 +80207,7 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 221 /* SyntaxKind.BinaryExpression */ && restExpression.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (restExpression.kind === 223 /* SyntaxKind.BinaryExpression */ && restExpression.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -79752,7 +80223,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode, rightIsThis) { var target; - if (exprOrAssignment.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { // In strict null checking mode, if a default value of a non-undefined type is specified, remove @@ -79768,7 +80239,7 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 221 /* SyntaxKind.BinaryExpression */ && target.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (target.kind === 223 /* SyntaxKind.BinaryExpression */ && target.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { checkBinaryExpression(target, checkMode); target = target.left; // A default value is specified, so remove undefined from the final type. @@ -79776,20 +80247,20 @@ var ts; sourceType = getTypeWithFacts(sourceType, 524288 /* TypeFacts.NEUndefined */); } } - if (target.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (target.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType, rightIsThis); } - if (target.kind === 204 /* SyntaxKind.ArrayLiteralExpression */) { + if (target.kind === 206 /* SyntaxKind.ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, checkMode); } return checkReferenceAssignment(target, sourceType, checkMode); } function checkReferenceAssignment(target, sourceType, checkMode) { var targetType = checkExpression(target, checkMode); - var error = target.parent.kind === 298 /* SyntaxKind.SpreadAssignment */ ? + var error = target.parent.kind === 301 /* SyntaxKind.SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; - var optionalError = target.parent.kind === 298 /* SyntaxKind.SpreadAssignment */ ? + var optionalError = target.parent.kind === 301 /* SyntaxKind.SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access; if (checkReferenceExpression(target, error, optionalError)) { @@ -79814,36 +80285,36 @@ var ts; case 79 /* SyntaxKind.Identifier */: case 10 /* SyntaxKind.StringLiteral */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 223 /* SyntaxKind.TemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 8 /* SyntaxKind.NumericLiteral */: case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 278 /* SyntaxKind.JsxElement */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 281 /* SyntaxKind.JsxElement */: return true; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: // Unary operators ~, !, +, and - have no side effects. // The rest do. switch (node.operator) { @@ -79855,9 +80326,9 @@ var ts; } return false; // Some forms listed here for clarity - case 217 /* SyntaxKind.VoidExpression */: // Explicit opt-out - case 211 /* SyntaxKind.TypeAssertionExpression */: // Not SEF, but can produce useful type warnings - case 229 /* SyntaxKind.AsExpression */: // Not SEF, but can produce useful type warnings + case 219 /* SyntaxKind.VoidExpression */: // Explicit opt-out + case 213 /* SyntaxKind.TypeAssertionExpression */: // Not SEF, but can produce useful type warnings + case 231 /* SyntaxKind.AsExpression */: // Not SEF, but can produce useful type warnings default: return false; } @@ -79894,7 +80365,7 @@ var ts; } checkGrammarNullishCoalesceWithLogicalExpression(node); var operator = node.operatorToken.kind; - if (operator === 63 /* SyntaxKind.EqualsToken */ && (node.left.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || node.left.kind === 204 /* SyntaxKind.ArrayLiteralExpression */)) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && (node.left.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || node.left.kind === 206 /* SyntaxKind.ArrayLiteralExpression */)) { state.skip = true; setLastResult(state, checkDestructuringAssignment(node.left, checkExpression(node.right, checkMode), checkMode, node.right.kind === 108 /* SyntaxKind.ThisKeyword */)); return state; @@ -79916,11 +80387,11 @@ var ts; if (operator === 55 /* SyntaxKind.AmpersandAmpersandToken */ || operator === 56 /* SyntaxKind.BarBarToken */ || operator === 60 /* SyntaxKind.QuestionQuestionToken */) { if (operator === 55 /* SyntaxKind.AmpersandAmpersandToken */) { var parent = node.parent; - while (parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */ + while (parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || ts.isBinaryExpression(parent) && (parent.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || parent.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */)) { parent = parent.parent; } - checkTestingKnownTruthyCallableOrAwaitableType(node.left, ts.isIfStatement(parent) ? parent.thenStatement : undefined); + checkTestingKnownTruthyCallableOrAwaitableType(node.left, leftType, ts.isIfStatement(parent) ? parent.thenStatement : undefined); } checkTruthinessOfType(leftType, node.left); } @@ -79991,7 +80462,7 @@ var ts; // expression-wide checks and does not use a work stack to fold nested binary expressions into the same callstack frame function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { var operator = operatorToken.kind; - if (operator === 63 /* SyntaxKind.EqualsToken */ && (left.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || left.kind === 204 /* SyntaxKind.ArrayLiteralExpression */)) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && (left.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || left.kind === 206 /* SyntaxKind.ArrayLiteralExpression */)) { return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 108 /* SyntaxKind.ThisKeyword */); } var leftType; @@ -80147,6 +80618,7 @@ var ts; var eqType = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */; error(errorNode, ts.Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true"); } + checkNaNEquality(errorNode, operator, left, right); reportOperatorErrorUnless(function (left, right) { return isTypeEqualityComparableTo(left, right) || isTypeEqualityComparableTo(right, left); }); return booleanType; case 102 /* SyntaxKind.InstanceOfKeyword */: @@ -80342,20 +80814,35 @@ var ts; } } function tryGiveBetterPrimaryError(errNode, maybeMissingAwait, leftStr, rightStr) { - var typeName; switch (operatorToken.kind) { case 36 /* SyntaxKind.EqualsEqualsEqualsToken */: case 34 /* SyntaxKind.EqualsEqualsToken */: - typeName = "false"; - break; case 37 /* SyntaxKind.ExclamationEqualsEqualsToken */: case 35 /* SyntaxKind.ExclamationEqualsToken */: - typeName = "true"; + return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap, leftStr, rightStr); + default: + return undefined; } - if (typeName) { - return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap, typeName, leftStr, rightStr); + } + function checkNaNEquality(errorNode, operator, left, right) { + var isLeftNaN = isGlobalNaN(ts.skipParentheses(left)); + var isRightNaN = isGlobalNaN(ts.skipParentheses(right)); + if (isLeftNaN || isRightNaN) { + var err = error(errorNode, ts.Diagnostics.This_condition_will_always_return_0, ts.tokenToString(operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? 95 /* SyntaxKind.FalseKeyword */ : 110 /* SyntaxKind.TrueKeyword */)); + if (isLeftNaN && isRightNaN) + return; + var operatorString = operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ ? ts.tokenToString(53 /* SyntaxKind.ExclamationToken */) : ""; + var location = isLeftNaN ? right : left; + var expression = ts.skipParentheses(location); + ts.addRelatedInfo(err, ts.createDiagnosticForNode(location, ts.Diagnostics.Did_you_mean_0, "".concat(operatorString, "Number.isNaN(").concat(ts.isEntityNameExpression(expression) ? ts.entityNameToString(expression) : "...", ")"))); } - return undefined; + } + function isGlobalNaN(expr) { + if (ts.isIdentifier(expr) && expr.escapedText === "NaN") { + var globalNaNSymbol = getGlobalNaNSymbol(); + return !!globalNaNSymbol && globalNaNSymbol === getResolvedSymbol(expr); + } + return false; } } function getBaseTypesIfUnrelated(leftType, rightType, isRelated) { @@ -80436,8 +80923,8 @@ var ts; } } function checkConditionalExpression(node, checkMode) { - checkTruthinessExpression(node.condition); - checkTestingKnownTruthyCallableOrAwaitableType(node.condition, node.whenTrue); + var type = checkTruthinessExpression(node.condition); + checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue); var type1 = checkExpression(node.whenTrue, checkMode); var type2 = checkExpression(node.whenFalse, checkMode); return getUnionType([type1, type2], 2 /* UnionReduction.Subtype */); @@ -80466,7 +80953,7 @@ var ts; type.flags & 58982400 /* TypeFlags.InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* TypeFlags.StringLike */)); } function getContextNode(node) { - if (node.kind === 286 /* SyntaxKind.JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) { + if (node.kind === 289 /* SyntaxKind.JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) { return node.parent.parent; // Needs to be the root JsxElement, so it encompasses the attributes _and_ the children (which are essentially part of the attributes) } return node; @@ -80520,8 +81007,8 @@ var ts; } function isTypeAssertion(node) { node = ts.skipParentheses(node, /*excludeJSDocTypeAssertions*/ true); - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */ || - node.kind === 229 /* SyntaxKind.AsExpression */ || + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */ || + node.kind === 231 /* SyntaxKind.AsExpression */ || ts.isJSDocTypeAssertion(node); } function checkDeclarationInitializer(declaration, checkMode, contextualType) { @@ -80530,7 +81017,7 @@ var ts; (contextualType ? checkExpressionWithContextualType(initializer, contextualType, /*inferenceContext*/ undefined, checkMode || 0 /* CheckMode.Normal */) : checkExpressionCached(initializer, checkMode)); - return ts.isParameter(declaration) && declaration.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && + return ts.isParameter(declaration) && declaration.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ? padTupleType(type, declaration.name) : type; } @@ -80540,7 +81027,7 @@ var ts; var elementFlags = type.target.elementFlags.slice(); for (var i = getTypeReferenceArity(type); i < patternElements.length; i++) { var e = patternElements[i]; - if (i < patternElements.length - 1 || !(e.kind === 203 /* SyntaxKind.BindingElement */ && e.dotDotDotToken)) { + if (i < patternElements.length - 1 || !(e.kind === 205 /* SyntaxKind.BindingElement */ && e.dotDotDotToken)) { elementTypes.push(!ts.isOmittedExpression(e) && hasDefaultValue(e) ? getTypeFromBindingElement(e, /*includePatternInType*/ false, /*reportErrors*/ false) : anyType); elementFlags.push(2 /* ElementFlags.Optional */); if (!ts.isOmittedExpression(e) && !hasDefaultValue(e)) { @@ -80608,7 +81095,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } return checkExpressionForMutableLocation(node.initializer, checkMode); @@ -80619,7 +81106,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -80862,11 +81349,11 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 161 /* SyntaxKind.QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || - (node.parent.kind === 181 /* SyntaxKind.TypeQuery */ && node.parent.exprName === node)) || - (node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */); // We allow reexporting const enums + var ok = (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 163 /* SyntaxKind.QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || + (node.parent.kind === 183 /* SyntaxKind.TypeQuery */ && node.parent.exprName === node)) || + (node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */); // We allow reexporting const enums if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query); } @@ -80891,9 +81378,9 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } } @@ -80924,80 +81411,82 @@ var ts; return trueType; case 95 /* SyntaxKind.FalseKeyword */: return falseType; - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return checkTemplateExpression(node); case 13 /* SyntaxKind.RegularExpressionLiteral */: return globalRegExpType; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return checkArrayLiteral(node, checkMode, forceTuple); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return checkObjectLiteral(node, checkMode); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return checkPropertyAccessExpression(node, checkMode); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return checkQualifiedName(node, checkMode); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return checkIndexedAccess(node, checkMode); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (node.expression.kind === 100 /* SyntaxKind.ImportKeyword */) { return checkImportCallExpression(node); } // falls through - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return checkCallExpression(node, checkMode); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return checkParenthesizedExpression(node, checkMode); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return checkClassExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return checkTypeOfExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return checkAssertion(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return checkNonNullAssertion(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return checkExpressionWithTypeArguments(node); - case 231 /* SyntaxKind.MetaProperty */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return checkSatisfiesExpression(node); + case 233 /* SyntaxKind.MetaProperty */: return checkMetaProperty(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return checkDeleteExpression(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return checkVoidExpression(node); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return checkAwaitExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return checkBinaryExpression(node, checkMode); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return checkConditionalExpression(node, checkMode); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return checkSpreadExpression(node, checkMode); - case 227 /* SyntaxKind.OmittedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: return undefinedWideningType; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return checkYieldExpression(node); - case 232 /* SyntaxKind.SyntheticExpression */: + case 234 /* SyntaxKind.SyntheticExpression */: return checkSyntheticExpression(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return checkJsxExpression(node, checkMode); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return checkJsxElement(node, checkMode); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return checkJsxSelfClosingElement(node, checkMode); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return checkJsxFragment(node); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return checkJsxAttributes(node, checkMode); - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return errorType; @@ -81056,10 +81545,10 @@ var ts; checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); if (ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */)) { - if (!(func.kind === 171 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 173 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } - if (func.kind === 171 /* SyntaxKind.Constructor */ && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { + if (func.kind === 173 /* SyntaxKind.Constructor */ && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { error(node.name, ts.Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name); } } @@ -81070,13 +81559,13 @@ var ts; if (func.parameters.indexOf(node) !== 0) { error(node, ts.Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText); } - if (func.kind === 171 /* SyntaxKind.Constructor */ || func.kind === 175 /* SyntaxKind.ConstructSignature */ || func.kind === 180 /* SyntaxKind.ConstructorType */) { + if (func.kind === 173 /* SyntaxKind.Constructor */ || func.kind === 177 /* SyntaxKind.ConstructSignature */ || func.kind === 182 /* SyntaxKind.ConstructorType */) { error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); } - if (func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 216 /* SyntaxKind.ArrowFunction */) { error(node, ts.Diagnostics.An_arrow_function_cannot_have_a_this_parameter); } - if (func.kind === 172 /* SyntaxKind.GetAccessor */ || func.kind === 173 /* SyntaxKind.SetAccessor */) { + if (func.kind === 174 /* SyntaxKind.GetAccessor */ || func.kind === 175 /* SyntaxKind.SetAccessor */) { error(node, ts.Diagnostics.get_and_set_accessors_cannot_declare_this_parameters); } } @@ -81134,13 +81623,13 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 174 /* SyntaxKind.CallSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 179 /* SyntaxKind.FunctionType */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 181 /* SyntaxKind.FunctionType */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: var parent = node.parent; if (node === parent.type) { return parent; @@ -81158,7 +81647,7 @@ var ts; error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ || name.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + else if (name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ || name.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } @@ -81167,13 +81656,13 @@ var ts; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 176 /* SyntaxKind.IndexSignature */) { + if (node.kind === 178 /* SyntaxKind.IndexSignature */) { checkGrammarIndexSignature(node); } // TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled - else if (node.kind === 179 /* SyntaxKind.FunctionType */ || node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 180 /* SyntaxKind.ConstructorType */ || - node.kind === 174 /* SyntaxKind.CallSignature */ || node.kind === 171 /* SyntaxKind.Constructor */ || - node.kind === 175 /* SyntaxKind.ConstructSignature */) { + else if (node.kind === 181 /* SyntaxKind.FunctionType */ || node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 182 /* SyntaxKind.ConstructorType */ || + node.kind === 176 /* SyntaxKind.CallSignature */ || node.kind === 173 /* SyntaxKind.Constructor */ || + node.kind === 177 /* SyntaxKind.ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } var functionFlags = ts.getFunctionFlags(node); @@ -81205,10 +81694,10 @@ var ts; var returnTypeNode = ts.getEffectiveReturnTypeNode(node); if (noImplicitAny && !returnTypeNode) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -81238,7 +81727,7 @@ var ts; checkAsyncFunctionReturnType(node, returnTypeNode); } } - if (node.kind !== 176 /* SyntaxKind.IndexSignature */ && node.kind !== 317 /* SyntaxKind.JSDocFunctionType */) { + if (node.kind !== 178 /* SyntaxKind.IndexSignature */ && node.kind !== 320 /* SyntaxKind.JSDocFunctionType */) { registerForUnusedIdentifiersCheck(node); } } @@ -81250,7 +81739,7 @@ var ts; var privateIdentifiers = new ts.Map(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 171 /* SyntaxKind.Constructor */) { + if (member.kind === 173 /* SyntaxKind.Constructor */) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; if (ts.isParameterPropertyDeclaration(param, member) && !ts.isBindingPattern(param.name)) { @@ -81272,16 +81761,16 @@ var ts; var memberName = name && ts.getPropertyNameForPropertyNameNode(name); if (memberName) { switch (member.kind) { - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: addName(names, name, memberName, 1 /* DeclarationMeaning.GetAccessor */ | privateStaticFlags); break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: addName(names, name, memberName, 2 /* DeclarationMeaning.SetAccessor */ | privateStaticFlags); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: addName(names, name, memberName, 3 /* DeclarationMeaning.GetOrSetAccessor */ | privateStaticFlags); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: addName(names, name, memberName, 8 /* DeclarationMeaning.Method */ | privateStaticFlags); break; } @@ -81353,7 +81842,7 @@ var ts; var names = new ts.Map(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 166 /* SyntaxKind.PropertySignature */) { + if (member.kind === 168 /* SyntaxKind.PropertySignature */) { var memberName = void 0; var name = member.name; switch (name.kind) { @@ -81378,7 +81867,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); // in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration // to prevent this run check only for the first declaration of a given kind @@ -81392,7 +81881,7 @@ var ts; var indexSymbol = getIndexSymbol(getSymbolOfNode(node)); if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) { var indexSignatureMap_1 = new ts.Map(); - var _loop_29 = function (declaration) { + var _loop_30 = function (declaration) { if (declaration.parameters.length === 1 && declaration.parameters[0].type) { forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) { var entry = indexSignatureMap_1.get(getTypeId(type)); @@ -81407,7 +81896,7 @@ var ts; }; for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - _loop_29(declaration); + _loop_30(declaration); } indexSignatureMap_1.forEach(function (entry) { if (entry.declarations.length > 1) { @@ -81426,7 +81915,7 @@ var ts; checkVariableLikeDeclaration(node); setNodeLinksForPrivateIdentifierScope(node); // property signatures already report "initializer not allowed in ambient context" elsewhere - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */) && node.kind === 167 /* SyntaxKind.PropertyDeclaration */ && node.initializer) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */) && node.kind === 169 /* SyntaxKind.PropertyDeclaration */ && node.initializer) { error(node, ts.Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } } @@ -81446,7 +81935,7 @@ var ts; // Grammar checking for modifiers is done inside the function checkGrammarFunctionLikeDeclaration checkFunctionOrMethodDeclaration(node); // method signatures already report "implementation not allowed in ambient context" elsewhere - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */) && node.kind === 169 /* SyntaxKind.MethodDeclaration */ && node.body) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */) && node.kind === 171 /* SyntaxKind.MethodDeclaration */ && node.body) { error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } // Private named methods are only allowed in class declarations @@ -81499,7 +81988,7 @@ var ts; if (ts.isPrivateIdentifierClassElementDeclaration(n)) { return true; } - return n.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + return n.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(n) && !!n.initializer; } @@ -81582,7 +82071,7 @@ var ts; checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { if (!(node.flags & 16777216 /* NodeFlags.Ambient */) && ts.nodeIsPresent(node.body) && (node.flags & 256 /* NodeFlags.HasImplicitReturn */)) { if (!(node.flags & 512 /* NodeFlags.HasExplicitReturn */)) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); @@ -81592,20 +82081,20 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } if (hasBindableName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. var symbol = getSymbolOfNode(node); - var getter = ts.getDeclarationOfKind(symbol, 172 /* SyntaxKind.GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 174 /* SyntaxKind.GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */); if (getter && setter && !(getNodeCheckFlags(getter) & 1 /* NodeCheckFlags.TypeChecked */)) { getNodeLinks(getter).flags |= 1 /* NodeCheckFlags.TypeChecked */; var getterFlags = ts.getEffectiveModifierFlags(getter); var setterFlags = ts.getEffectiveModifierFlags(setter); - if ((getterFlags & 128 /* ModifierFlags.Abstract */) !== (setterFlags & 128 /* ModifierFlags.Abstract */)) { + if ((getterFlags & 256 /* ModifierFlags.Abstract */) !== (setterFlags & 256 /* ModifierFlags.Abstract */)) { error(getter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); error(setter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); } @@ -81622,7 +82111,7 @@ var ts; } } var returnType = getTypeOfAccessors(getSymbolOfNode(node)); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } @@ -81631,7 +82120,7 @@ var ts; checkDecorators(node); } function getEffectiveTypeArgumentAtIndex(node, typeParameters, index) { - if (index < typeParameters.length) { + if (node.typeArguments && index < node.typeArguments.length) { return getTypeFromTypeNode(node.typeArguments[index]); } return getEffectiveTypeArguments(node, typeParameters)[index]; @@ -81668,7 +82157,7 @@ var ts; } function checkTypeReferenceNode(node) { checkGrammarTypeArguments(node, node.typeArguments); - if (node.kind === 178 /* SyntaxKind.TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { grammarErrorAtPos(node, node.typeName.jsdocDotPos, 1, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); } ts.forEach(node.typeArguments, checkSourceElement); @@ -81726,7 +82215,7 @@ var ts; var hasNamedElement = ts.some(elementTypes, ts.isNamedTupleMember); for (var _i = 0, elementTypes_1 = elementTypes; _i < elementTypes_1.length; _i++) { var e = elementTypes_1[_i]; - if (e.kind !== 197 /* SyntaxKind.NamedTupleMember */ && hasNamedElement) { + if (e.kind !== 199 /* SyntaxKind.NamedTupleMember */ && hasNamedElement) { grammarErrorOnNode(e, ts.Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names); break; } @@ -81775,7 +82264,7 @@ var ts; var objectType = type.objectType; var indexType = type.indexType; if (isTypeAssignableTo(indexType, getIndexType(objectType, /*stringsOnly*/ false))) { - if (accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && + if (accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && ts.getObjectFlags(objectType) & 32 /* ObjectFlags.Mapped */ && getMappedTypeModifiers(objectType) & 1 /* MappedTypeModifiers.IncludeReadonly */) { error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); } @@ -81840,7 +82329,7 @@ var ts; ts.forEachChild(node, checkSourceElement); } function checkInferType(node) { - if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 189 /* SyntaxKind.ConditionalType */ && n.parent.extendsType === n; })) { + if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 191 /* SyntaxKind.ConditionalType */ && n.parent.extendsType === n; })) { grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type); } checkSourceElement(node.typeParameter); @@ -81850,7 +82339,7 @@ var ts; if (!links.typeParametersChecked) { links.typeParametersChecked = true; var typeParameter = getDeclaredTypeOfTypeParameter(symbol); - var declarations = ts.getDeclarationsOfKind(symbol, 163 /* SyntaxKind.TypeParameter */); + var declarations = ts.getDeclarationsOfKind(symbol, 165 /* SyntaxKind.TypeParameter */); if (!areTypeParametersIdentical(declarations, [typeParameter], function (decl) { return [decl]; })) { // Report an error on every conflicting declaration. var name = symbolToString(symbol); @@ -81891,10 +82380,10 @@ var ts; if (node.dotDotDotToken && node.questionToken) { grammarErrorOnNode(node, ts.Diagnostics.A_tuple_member_cannot_be_both_optional_and_rest); } - if (node.type.kind === 185 /* SyntaxKind.OptionalType */) { + if (node.type.kind === 187 /* SyntaxKind.OptionalType */) { grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type); } - if (node.type.kind === 186 /* SyntaxKind.RestType */) { + if (node.type.kind === 188 /* SyntaxKind.RestType */) { grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type); } checkSourceElement(node.type); @@ -81907,9 +82396,9 @@ var ts; var flags = ts.getCombinedModifierFlags(n); // children of classes (even ambient classes) should not be marked as ambient or export // because those flags have no useful semantics there. - if (n.parent.kind !== 258 /* SyntaxKind.InterfaceDeclaration */ && - n.parent.kind !== 257 /* SyntaxKind.ClassDeclaration */ && - n.parent.kind !== 226 /* SyntaxKind.ClassExpression */ && + if (n.parent.kind !== 261 /* SyntaxKind.InterfaceDeclaration */ && + n.parent.kind !== 260 /* SyntaxKind.ClassDeclaration */ && + n.parent.kind !== 228 /* SyntaxKind.ClassExpression */ && n.flags & 16777216 /* NodeFlags.Ambient */) { if (!(flags & 2 /* ModifierFlags.Ambient */) && !(ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent))) { // It is nested in an ambient context, which means it is automatically exported @@ -81949,7 +82438,7 @@ var ts; else if (deviation & (8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */)) { error(ts.getNameOfDeclaration(o) || o, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } - else if (deviation & 128 /* ModifierFlags.Abstract */) { + else if (deviation & 256 /* ModifierFlags.Abstract */) { error(ts.getNameOfDeclaration(o), ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract); } }); @@ -81966,7 +82455,7 @@ var ts; }); } } - var flagsToCheck = 1 /* ModifierFlags.Export */ | 2 /* ModifierFlags.Ambient */ | 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | 128 /* ModifierFlags.Abstract */; + var flagsToCheck = 1 /* ModifierFlags.Export */ | 2 /* ModifierFlags.Ambient */ | 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | 256 /* ModifierFlags.Abstract */; var someNodeFlags = 0 /* ModifierFlags.None */; var allNodeFlags = flagsToCheck; var someHaveQuestionToken = false; @@ -82005,7 +82494,7 @@ var ts; // Both are literal property names that are the same. ts.isPropertyNameLiteral(node.name) && ts.isPropertyNameLiteral(subsequentName) && ts.getEscapedTextOfIdentifierOrLiteral(node.name) === ts.getEscapedTextOfIdentifierOrLiteral(subsequentName))) { - var reportError = (node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 168 /* SyntaxKind.MethodSignature */) && + var reportError = (node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 170 /* SyntaxKind.MethodSignature */) && ts.isStatic(node) !== ts.isStatic(subsequentNode); // we can get here in two cases // 1. mixed static and instance class members @@ -82030,7 +82519,7 @@ var ts; else { // Report different errors regarding non-consecutive blocks of declarations depending on whether // the node in question is abstract. - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)) { error(errorNode, ts.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive); } else { @@ -82047,7 +82536,7 @@ var ts; var current = declarations_5[_i]; var node = current; var inAmbientContext = node.flags & 16777216 /* NodeFlags.Ambient */; - var inAmbientContextOrInterface = node.parent && (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || node.parent.kind === 182 /* SyntaxKind.TypeLiteral */) || inAmbientContext; + var inAmbientContextOrInterface = node.parent && (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || node.parent.kind === 184 /* SyntaxKind.TypeLiteral */) || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -82058,10 +82547,10 @@ var ts; // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one previousDeclaration = undefined; } - if ((node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */) && !inAmbientContext) { + if ((node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */) && !inAmbientContext) { hasNonAmbientClass = true; } - if (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 168 /* SyntaxKind.MethodSignature */ || node.kind === 171 /* SyntaxKind.Constructor */) { + if (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 170 /* SyntaxKind.MethodSignature */ || node.kind === 173 /* SyntaxKind.Constructor */) { functionDeclarations.push(node); var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; @@ -82106,12 +82595,12 @@ var ts; }); } if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 /* SymbolFlags.Function */ && declarations) { - var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 257 /* SyntaxKind.ClassDeclaration */; }) + var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 260 /* SyntaxKind.ClassDeclaration */; }) .map(function (d) { return ts.createDiagnosticForNode(d, ts.Diagnostics.Consider_adding_a_declare_modifier_to_this_class); }); ts.forEach(declarations, function (declaration) { - var diagnostic = declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ + var diagnostic = declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ ? ts.Diagnostics.Class_declaration_cannot_implement_overload_list_for_0 - : declaration.kind === 256 /* SyntaxKind.FunctionDeclaration */ + : declaration.kind === 259 /* SyntaxKind.FunctionDeclaration */ ? ts.Diagnostics.Function_with_bodies_can_only_merge_with_classes_that_are_ambient : undefined; if (diagnostic) { @@ -82121,7 +82610,7 @@ var ts; } // Abstract methods can't have an implementation -- in particular, they don't need one. if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && - !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 128 /* ModifierFlags.Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) { + !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 256 /* ModifierFlags.Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } if (hasOverloads) { @@ -82167,9 +82656,9 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var d = _a[_i]; var declarationSpaces = getDeclarationSpaces(d); - var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* ModifierFlags.Export */ | 512 /* ModifierFlags.Default */); + var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* ModifierFlags.Export */ | 1024 /* ModifierFlags.Default */); if (effectiveDeclarationFlags & 1 /* ModifierFlags.Export */) { - if (effectiveDeclarationFlags & 512 /* ModifierFlags.Default */) { + if (effectiveDeclarationFlags & 1024 /* ModifierFlags.Default */) { defaultExportedDeclarationSpaces |= declarationSpaces; } else { @@ -82202,26 +82691,26 @@ var ts; function getDeclarationSpaces(decl) { var d = decl; switch (d.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // A jsdoc typedef and callback are, by definition, type aliases. // falls through - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return 2 /* DeclarationSpaces.ExportType */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* ModuleInstanceState.NonInstantiated */ ? 4 /* DeclarationSpaces.ExportNamespace */ | 1 /* DeclarationSpaces.ExportValue */ : 4 /* DeclarationSpaces.ExportNamespace */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: return 2 /* DeclarationSpaces.ExportType */ | 1 /* DeclarationSpaces.ExportValue */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 2 /* DeclarationSpaces.ExportType */ | 1 /* DeclarationSpaces.ExportValue */ | 4 /* DeclarationSpaces.ExportNamespace */; - case 271 /* SyntaxKind.ExportAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: + case 274 /* SyntaxKind.ExportAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: var node_2 = d; var expression = ts.isExportAssignment(node_2) ? node_2.expression : node_2.right; // Export assigned entity name expressions act as aliases and should fall through, otherwise they export values @@ -82231,19 +82720,19 @@ var ts; d = expression; // The below options all declare an Alias, which is allowed to merge with other values within the importing module. // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 267 /* SyntaxKind.ImportClause */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: var result_12 = 0 /* DeclarationSpaces.None */; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_12 |= getDeclarationSpaces(d); }); return result_12; - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 case 79 /* SyntaxKind.Identifier */: // https://github.com/microsoft/TypeScript/issues/36098 // Identifiers are used as declarations of assignment declarations whose parents may be // SyntaxKind.CallExpression - `Object.defineProperty(thing, "aField", {value: 42});` @@ -82656,20 +83145,20 @@ var ts; var headMessage; var expectedReturnType; switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: headMessage = ts.Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any; expectedReturnType = voidType; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); @@ -82728,15 +83217,15 @@ var ts; function getEntityNameForDecoratorMetadata(node) { if (node) { switch (node.kind) { - case 188 /* SyntaxKind.IntersectionType */: - case 187 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: return getEntityNameForDecoratorMetadataFromTypeList(node.types); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]); - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: return getEntityNameForDecoratorMetadata(node.type); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; } } @@ -82745,13 +83234,13 @@ var ts; var commonEntityName; for (var _i = 0, types_21 = types; _i < types_21.length; _i++) { var typeNode = types_21[_i]; - while (typeNode.kind === 191 /* SyntaxKind.ParenthesizedType */ || typeNode.kind === 197 /* SyntaxKind.NamedTupleMember */) { + while (typeNode.kind === 193 /* SyntaxKind.ParenthesizedType */ || typeNode.kind === 199 /* SyntaxKind.NamedTupleMember */) { typeNode = typeNode.type; // Skip parens if need be } - if (typeNode.kind === 143 /* SyntaxKind.NeverKeyword */) { + if (typeNode.kind === 144 /* SyntaxKind.NeverKeyword */) { continue; // Always elide `never` from the union/intersection if possible } - if (!strictNullChecks && (typeNode.kind === 196 /* SyntaxKind.LiteralType */ && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */ || typeNode.kind === 153 /* SyntaxKind.UndefinedKeyword */)) { + if (!strictNullChecks && (typeNode.kind === 198 /* SyntaxKind.LiteralType */ && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */ || typeNode.kind === 155 /* SyntaxKind.UndefinedKeyword */)) { continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks } var individualEntityName = getEntityNameForDecoratorMetadata(typeNode); @@ -82797,14 +83286,14 @@ var ts; return; } checkExternalEmitHelpers(firstDecorator, 8 /* ExternalEmitHelpers.Decorate */); - if (node.kind === 164 /* SyntaxKind.Parameter */) { + if (node.kind === 166 /* SyntaxKind.Parameter */) { checkExternalEmitHelpers(firstDecorator, 32 /* ExternalEmitHelpers.Param */); } if (compilerOptions.emitDecoratorMetadata) { checkExternalEmitHelpers(firstDecorator, 16 /* ExternalEmitHelpers.Metadata */); // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -82813,23 +83302,23 @@ var ts; } } break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - var otherKind = node.kind === 172 /* SyntaxKind.GetAccessor */ ? 173 /* SyntaxKind.SetAccessor */ : 172 /* SyntaxKind.GetAccessor */; + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + var otherKind = node.kind === 174 /* SyntaxKind.GetAccessor */ ? 175 /* SyntaxKind.SetAccessor */ : 174 /* SyntaxKind.GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind); markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor)); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveReturnTypeNode(node)); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveTypeAnnotationNode(node)); break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); var containingSignature = node.parent; for (var _d = 0, _e = containingSignature.parameters; _d < _e.length; _d++) { @@ -82931,7 +83420,7 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.name; default: return undefined; @@ -82945,7 +83434,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name && node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name && node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -82971,7 +83460,7 @@ var ts; checkFunctionOrConstructorSymbol(symbol); } } - var body = node.kind === 168 /* SyntaxKind.MethodSignature */ ? undefined : node.body; + var body = node.kind === 170 /* SyntaxKind.MethodSignature */ ? undefined : node.body; checkSourceElement(body); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, getReturnTypeFromAnnotation(node)); addLazyDiagnostic(checkFunctionOrMethodDeclarationDiagnostics); @@ -83017,42 +83506,42 @@ var ts; for (var _i = 0, potentiallyUnusedIdentifiers_1 = potentiallyUnusedIdentifiers; _i < potentiallyUnusedIdentifiers_1.length; _i++) { var node = potentiallyUnusedIdentifiers_1[_i]; switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: checkUnusedClassMembers(node, addDiagnostic); checkUnusedTypeParameters(node, addDiagnostic); break; - case 305 /* SyntaxKind.SourceFile */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 308 /* SyntaxKind.SourceFile */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: checkUnusedLocalsAndParameters(node, addDiagnostic); break; - case 171 /* SyntaxKind.Constructor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: if (node.body) { // Don't report unused parameters in overloads checkUnusedLocalsAndParameters(node, addDiagnostic); } checkUnusedTypeParameters(node, addDiagnostic); break; - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: checkUnusedTypeParameters(node, addDiagnostic); break; - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: checkUnusedInferTypeParameter(node, addDiagnostic); break; default: @@ -83072,11 +83561,11 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - if (member.kind === 173 /* SyntaxKind.SetAccessor */ && member.symbol.flags & 32768 /* SymbolFlags.GetAccessor */) { + case 171 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + if (member.kind === 175 /* SyntaxKind.SetAccessor */ && member.symbol.flags & 32768 /* SymbolFlags.GetAccessor */) { // Already would have reported an error on the getter. break; } @@ -83087,7 +83576,7 @@ var ts; addDiagnostic(member, 0 /* UnusedKind.Local */, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol))); } break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; if (!parameter.symbol.isReferenced && ts.hasSyntacticModifier(parameter, 8 /* ModifierFlags.Private */)) { @@ -83095,9 +83584,9 @@ var ts; } } break; - case 176 /* SyntaxKind.IndexSignature */: - case 234 /* SyntaxKind.SemicolonClassElement */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: + case 237 /* SyntaxKind.SemicolonClassElement */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // Can't be private break; default: @@ -83125,7 +83614,7 @@ var ts; continue; var name = ts.idText(typeParameter.name); var parent = typeParameter.parent; - if (parent.kind !== 190 /* SyntaxKind.InferType */ && parent.typeParameters.every(isTypeParameterUnused)) { + if (parent.kind !== 192 /* SyntaxKind.InferType */ && parent.typeParameters.every(isTypeParameterUnused)) { if (ts.tryAddToSet(seenParentsWithEveryUnused, parent)) { var sourceFile = ts.getSourceFileOfNode(parent); var range = ts.isJSDocTemplateTag(parent) @@ -83231,7 +83720,7 @@ var ts; var importDecl = importClause.parent; var nDeclarations = (importClause.name ? 1 : 0) + (importClause.namedBindings ? - (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? 1 : importClause.namedBindings.elements.length) + (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? 1 : importClause.namedBindings.elements.length) : 0); if (nDeclarations === unuseds.length) { addDiagnostic(importDecl, 0 /* UnusedKind.Local */, unuseds.length === 1 @@ -83249,7 +83738,7 @@ var ts; var bindingPattern = _a[0], bindingElements = _a[1]; var kind = tryGetRootParameterDeclaration(bindingPattern.parent) ? 1 /* UnusedKind.Parameter */ : 0 /* UnusedKind.Local */; if (bindingPattern.elements.length === bindingElements.length) { - if (bindingElements.length === 1 && bindingPattern.parent.kind === 254 /* SyntaxKind.VariableDeclaration */ && bindingPattern.parent.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (bindingElements.length === 1 && bindingPattern.parent.kind === 257 /* SyntaxKind.VariableDeclaration */ && bindingPattern.parent.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */) { addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId); } else { @@ -83270,7 +83759,7 @@ var ts; if (declarationList.declarations.length === declarations.length) { addDiagnostic(declarationList, 0 /* UnusedKind.Local */, declarations.length === 1 ? ts.createDiagnosticForNode(ts.first(declarations).name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(ts.first(declarations).name)) - : ts.createDiagnosticForNode(declarationList.parent.kind === 237 /* SyntaxKind.VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); + : ts.createDiagnosticForNode(declarationList.parent.kind === 240 /* SyntaxKind.VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); } else { for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { @@ -83300,22 +83789,22 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return ts.idText(name); - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return bindingNameText(ts.cast(ts.first(name.elements), ts.isBindingElement).name); default: return ts.Debug.assertNever(name); } } function isImportedDeclaration(node) { - return node.kind === 267 /* SyntaxKind.ImportClause */ || node.kind === 270 /* SyntaxKind.ImportSpecifier */ || node.kind === 268 /* SyntaxKind.NamespaceImport */; + return node.kind === 270 /* SyntaxKind.ImportClause */ || node.kind === 273 /* SyntaxKind.ImportSpecifier */ || node.kind === 271 /* SyntaxKind.NamespaceImport */; } function importClauseFromImported(decl) { - return decl.kind === 267 /* SyntaxKind.ImportClause */ ? decl : decl.kind === 268 /* SyntaxKind.NamespaceImport */ ? decl.parent : decl.parent.parent; + return decl.kind === 270 /* SyntaxKind.ImportClause */ ? decl : decl.kind === 271 /* SyntaxKind.NamespaceImport */ ? decl.parent : decl.parent.parent; } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 235 /* SyntaxKind.Block */) { + if (node.kind === 238 /* SyntaxKind.Block */) { checkGrammarStatementInAmbientContext(node); } if (ts.isFunctionOrModuleBlock(node)) { @@ -83350,13 +83839,13 @@ var ts; if ((identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) !== name) { return false; } - if (node.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - node.kind === 166 /* SyntaxKind.PropertySignature */ || - node.kind === 169 /* SyntaxKind.MethodDeclaration */ || - node.kind === 168 /* SyntaxKind.MethodSignature */ || - node.kind === 172 /* SyntaxKind.GetAccessor */ || - node.kind === 173 /* SyntaxKind.SetAccessor */ || - node.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (node.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + node.kind === 168 /* SyntaxKind.PropertySignature */ || + node.kind === 171 /* SyntaxKind.MethodDeclaration */ || + node.kind === 170 /* SyntaxKind.MethodSignature */ || + node.kind === 174 /* SyntaxKind.GetAccessor */ || + node.kind === 175 /* SyntaxKind.SetAccessor */ || + node.kind === 299 /* SyntaxKind.PropertyAssignment */) { // it is ok to have member named '_super', '_this', `Promise`, etc. - member access is always qualified return false; } @@ -83422,7 +83911,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -83437,7 +83926,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048 /* NodeFlags.HasAsyncFunctions */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048 /* NodeFlags.HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -83537,7 +84026,7 @@ var ts; // skip variable declarations that don't have initializers // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern // so we'll always treat binding elements as initialized - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ && !node.initializer) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -83549,17 +84038,17 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* SymbolFlags.BlockScopedVariable */) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* NodeFlags.BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); - var container = varDeclList.parent.kind === 237 /* SyntaxKind.VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); + var container = varDeclList.parent.kind === 240 /* SyntaxKind.VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; // names of block-scoped and function scoped variables can collide only // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) var namesShareScope = container && - (container.kind === 235 /* SyntaxKind.Block */ && ts.isFunctionLike(container.parent) || - container.kind === 262 /* SyntaxKind.ModuleBlock */ || - container.kind === 261 /* SyntaxKind.ModuleDeclaration */ || - container.kind === 305 /* SyntaxKind.SourceFile */); + (container.kind === 238 /* SyntaxKind.Block */ && ts.isFunctionLike(container.parent) || + container.kind === 265 /* SyntaxKind.ModuleBlock */ || + container.kind === 264 /* SyntaxKind.ModuleDeclaration */ || + container.kind === 308 /* SyntaxKind.SourceFile */); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error // otherwise if variable has an initializer - show error that initialization will fail @@ -83590,7 +84079,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); if (ts.hasOnlyExpressionInitializer(node) && node.initializer) { checkExpressionCached(node.initializer); @@ -83612,7 +84101,7 @@ var ts; checkExternalEmitHelpers(node, 4 /* ExternalEmitHelpers.Rest */); } // check computed properties inside property names of binding elements - if (node.propertyName && node.propertyName.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.propertyName && node.propertyName.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.propertyName); } // check private/protected variable access @@ -83634,7 +84123,7 @@ var ts; } // For a binding pattern, check contained binding elements if (ts.isBindingPattern(node.name)) { - if (node.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && languageVersion < 2 /* ScriptTarget.ES2015 */ && compilerOptions.downlevelIteration) { + if (node.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && languageVersion < 2 /* ScriptTarget.ES2015 */ && compilerOptions.downlevelIteration) { checkExternalEmitHelpers(node, 512 /* ExternalEmitHelpers.Read */); } ts.forEach(node.name.elements, checkSourceElement); @@ -83646,7 +84135,7 @@ var ts; } // For a binding pattern, validate the initializer and exit if (ts.isBindingPattern(node.name)) { - var needCheckInitializer = ts.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */; + var needCheckInitializer = ts.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */; var needCheckWidenedType = !ts.some(node.name.elements, ts.not(ts.isOmittedExpression)); if (needCheckInitializer || needCheckWidenedType) { // Don't validate for-in initializer as it is already an error @@ -83674,7 +84163,7 @@ var ts; } // For a commonjs `const x = require`, validate the alias and exit var symbol = getSymbolOfNode(node); - if (symbol.flags & 2097152 /* SymbolFlags.Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 203 /* SyntaxKind.BindingElement */ ? node.parent.parent : node)) { + if (symbol.flags & 2097152 /* SymbolFlags.Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 205 /* SyntaxKind.BindingElement */ ? node.parent.parent : node)) { checkAliasSymbol(node); return; } @@ -83688,7 +84177,7 @@ var ts; ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || ts.isPrototypeAccess(node.name)) && !!((_a = symbol.exports) === null || _a === void 0 ? void 0 : _a.size); - if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */) { + if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */) { checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(initializer), type, node, initializer, /*headMessage*/ undefined); } } @@ -83714,10 +84203,10 @@ var ts; error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name)); } } - if (node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 166 /* SyntaxKind.PropertySignature */) { + if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 168 /* SyntaxKind.PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionsForDeclarationName(node, node.name); @@ -83725,7 +84214,7 @@ var ts; } function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) { var nextDeclarationName = ts.getNameOfDeclaration(nextDeclaration); - var message = nextDeclaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ || nextDeclaration.kind === 166 /* SyntaxKind.PropertySignature */ + var message = nextDeclaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ || nextDeclaration.kind === 168 /* SyntaxKind.PropertySignature */ ? ts.Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2 : ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2; var declName = ts.declarationNameToString(nextDeclarationName); @@ -83735,8 +84224,8 @@ var ts; } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 164 /* SyntaxKind.Parameter */ && right.kind === 254 /* SyntaxKind.VariableDeclaration */) || - (left.kind === 254 /* SyntaxKind.VariableDeclaration */ && right.kind === 164 /* SyntaxKind.Parameter */)) { + if ((left.kind === 166 /* SyntaxKind.Parameter */ && right.kind === 257 /* SyntaxKind.VariableDeclaration */) || + (left.kind === 257 /* SyntaxKind.VariableDeclaration */ && right.kind === 166 /* SyntaxKind.Parameter */)) { // Differences in optionality between parameters and variables are allowed. return true; } @@ -83745,8 +84234,8 @@ var ts; } var interestingFlags = 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | - 256 /* ModifierFlags.Async */ | - 128 /* ModifierFlags.Abstract */ | + 512 /* ModifierFlags.Async */ | + 256 /* ModifierFlags.Abstract */ | 64 /* ModifierFlags.Readonly */ | 32 /* ModifierFlags.Static */; return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags); @@ -83775,15 +84264,15 @@ var ts; function checkIfStatement(node) { // Grammar checking checkGrammarStatementInAmbientContext(node); - checkTruthinessExpression(node.expression); - checkTestingKnownTruthyCallableOrAwaitableType(node.expression, node.thenStatement); + var type = checkTruthinessExpression(node.expression); + checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 236 /* SyntaxKind.EmptyStatement */) { + if (node.thenStatement.kind === 239 /* SyntaxKind.EmptyStatement */) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); } - function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, body) { + function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, condType, body) { if (!strictNullChecks) return; helper(condExpr, body); @@ -83798,7 +84287,7 @@ var ts; : condExpr; if (ts.isModuleExportsAccessExpression(location)) return; - var type = checkTruthinessExpression(location); + var type = location === condExpr ? condType : checkTruthinessExpression(location); var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression); if (!(getTypeFacts(type) & 4194304 /* TypeFacts.Truthy */) || isPropertyExpressionCast) return; @@ -83912,12 +84401,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -83957,14 +84446,14 @@ var ts; // via checkRightHandSideOfForOf. // If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference. // Then check that the RHS is assignable to it. - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node); // There may be a destructuring assignment on the left side - if (varExpr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (varExpr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // iteratedType may be undefined. In this case, we still want to check the structure of // varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like // to short circuit the type relation checking as much as possible, so we pass the unknownType. @@ -83996,7 +84485,7 @@ var ts; // for (let VarDecl in Expr) Statement // VarDecl must be a variable declaration without a type annotation that declares a variable of type Any, // and Expr must be an expression of type Any, an object type, or a type parameter type. - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -84010,7 +84499,7 @@ var ts; // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (varExpr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { @@ -84810,12 +85299,12 @@ var ts; var functionFlags = ts.getFunctionFlags(container); if (strictNullChecks || node.expression || returnType.flags & 131072 /* TypeFlags.Never */) { var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; - if (container.kind === 173 /* SyntaxKind.SetAccessor */) { + if (container.kind === 175 /* SyntaxKind.SetAccessor */) { if (node.expression) { error(node, ts.Diagnostics.Setters_cannot_return_a_value); } } - else if (container.kind === 171 /* SyntaxKind.Constructor */) { + else if (container.kind === 173 /* SyntaxKind.Constructor */) { if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) { error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -84833,7 +85322,7 @@ var ts; } } } - else if (container.kind !== 171 /* SyntaxKind.Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { + else if (container.kind !== 173 /* SyntaxKind.Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { // The function has a return type, but the return statement doesn't have an expression. error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); } @@ -84862,7 +85351,7 @@ var ts; var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 290 /* SyntaxKind.DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 293 /* SyntaxKind.DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -84871,7 +85360,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { addLazyDiagnostic(createLazyCaseClauseDiagnostics(clause)); } ts.forEach(clause.statements, checkSourceElement); @@ -84908,7 +85397,7 @@ var ts; if (ts.isFunctionLike(current)) { return "quit"; } - if (current.kind === 250 /* SyntaxKind.LabeledStatement */ && current.label.escapedText === node.label.escapedText) { + if (current.kind === 253 /* SyntaxKind.LabeledStatement */ && current.label.escapedText === node.label.escapedText) { grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label)); return true; } @@ -85003,11 +85492,11 @@ var ts; return; } var indexInfos = getApplicableIndexInfos(type, propNameType); - var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* SyntaxKind.InterfaceDeclaration */) : undefined; - var propDeclaration = declaration && declaration.kind === 221 /* SyntaxKind.BinaryExpression */ || - name && name.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined; + var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined; + var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ || + name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined; var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined; - var _loop_30 = function (info) { + var _loop_31 = function (info) { var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined; // We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared // in the containing type, or (c) the containing type is an interface and no base interface contains both the property and @@ -85024,15 +85513,15 @@ var ts; }; for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) { var info = indexInfos_9[_i]; - _loop_30(info); + _loop_31(info); } } function checkIndexConstraintForIndexSignature(type, checkInfo) { var declaration = checkInfo.declaration; var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType); - var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* SyntaxKind.InterfaceDeclaration */) : undefined; + var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined; var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined; - var _loop_31 = function (info) { + var _loop_32 = function (info) { if (info === checkInfo) return "continue"; var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined; @@ -85047,7 +85536,7 @@ var ts; }; for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) { var info = indexInfos_10[_i]; - _loop_31(info); + _loop_32(info); } } function checkTypeNameIsReserved(name, message) { @@ -85150,7 +85639,7 @@ var ts; function checkTypeParametersNotReferenced(root, typeParameters, index) { visit(root); function visit(node) { - if (node.kind === 178 /* SyntaxKind.TypeReference */) { + if (node.kind === 180 /* SyntaxKind.TypeReference */) { var type = getTypeFromTypeReference(node); if (type.flags & 262144 /* TypeFlags.TypeParameter */) { for (var i = index; i < typeParameters.length; i++) { @@ -85240,7 +85729,7 @@ var ts; if (firstDecorator && ts.some(node.members, function (p) { return ts.hasStaticModifier(p) && ts.isPrivateIdentifierClassElementDeclaration(p); })) { grammarErrorOnNode(firstDecorator, ts.Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator); } - if (!node.name && !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (!node.name && !ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); } checkClassLikeDeclaration(node); @@ -85307,7 +85796,7 @@ var ts; } else { var constructSignatures = getSignaturesOfType(baseConstructorType, 1 /* SignatureKind.Construct */); - if (constructSignatures.some(function (signature) { return signature.flags & 4 /* SignatureFlags.Abstract */; }) && !ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)) { + if (constructSignatures.some(function (signature) { return signature.flags & 4 /* SignatureFlags.Abstract */; }) && !ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)) { error(node.name || node, ts.Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract); } } @@ -85367,7 +85856,7 @@ var ts; var baseTypes = baseTypeNode && getBaseTypes(type); var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined; var baseStaticType = getBaseConstructorTypeOfClass(type); - var _loop_32 = function (member) { + var _loop_33 = function (member) { if (ts.hasAmbientModifier(member)) { return "continue"; } @@ -85384,7 +85873,7 @@ var ts; }; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - _loop_32(member); + _loop_33(member); } } /** @@ -85472,7 +85961,7 @@ var ts; function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) { // iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible var issuedMemberError = false; - var _loop_33 = function (member) { + var _loop_34 = function (member) { if (ts.isStatic(member)) { return "continue"; } @@ -85491,7 +85980,7 @@ var ts; }; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - _loop_33(member); + _loop_34(member); } if (!issuedMemberError) { // check again with diagnostics to generate a less-specific error @@ -85542,7 +86031,7 @@ var ts; } function getClassOrInterfaceDeclarationsOfSymbol(symbol) { return ts.filter(symbol.declarations, function (d) { - return d.kind === 257 /* SyntaxKind.ClassDeclaration */ || d.kind === 258 /* SyntaxKind.InterfaceDeclaration */; + return d.kind === 260 /* SyntaxKind.ClassDeclaration */ || d.kind === 261 /* SyntaxKind.InterfaceDeclaration */; }); } function checkKindsOfPropertyMemberOverrides(type, baseType) { @@ -85562,7 +86051,7 @@ var ts; var _a, _b, _c, _d; // NOTE: assignability is checked in checkClassDeclaration var baseProperties = getPropertiesOfType(baseType); - var _loop_34 = function (baseProperty) { + var _loop_35 = function (baseProperty) { var base = getTargetSymbol(baseProperty); if (base.flags & 4194304 /* SymbolFlags.Prototype */) { return "continue"; @@ -85583,7 +86072,7 @@ var ts; // It is an error to inherit an abstract member without implementing it or being declared abstract. // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. - if (baseDeclarationFlags & 128 /* ModifierFlags.Abstract */ && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 128 /* ModifierFlags.Abstract */))) { + if (baseDeclarationFlags & 256 /* ModifierFlags.Abstract */ && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 256 /* ModifierFlags.Abstract */))) { // Searches other base types for a declaration that would satisfy the inherited abstract member. // (The class may have more than one base type via declaration merging with an interface with the // same name.) @@ -85597,7 +86086,7 @@ var ts; return "continue-basePropertyCheck"; } } - if (derivedClassDecl.kind === 226 /* SyntaxKind.ClassExpression */) { + if (derivedClassDecl.kind === 228 /* SyntaxKind.ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -85632,11 +86121,11 @@ var ts; error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_1, symbolToString(base), typeToString(baseType), typeToString(type)); } else if (useDefineForClassFields) { - var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !d.initializer; }); + var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !d.initializer; }); if (uninitialized && !(derived.flags & 33554432 /* SymbolFlags.Transient */) - && !(baseDeclarationFlags & 128 /* ModifierFlags.Abstract */) - && !(derivedDeclarationFlags & 128 /* ModifierFlags.Abstract */) + && !(baseDeclarationFlags & 256 /* ModifierFlags.Abstract */) + && !(derivedDeclarationFlags & 256 /* ModifierFlags.Abstract */) && !((_d = derived.declarations) === null || _d === void 0 ? void 0 : _d.some(function (d) { return !!(d.flags & 16777216 /* NodeFlags.Ambient */); }))) { var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol)); var propName = uninitialized.name; @@ -85672,14 +86161,14 @@ var ts; }; basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) { var baseProperty = baseProperties_1[_i]; - var state_10 = _loop_34(baseProperty); - switch (state_10) { + var state_11 = _loop_35(baseProperty); + switch (state_11) { case "continue-basePropertyCheck": continue basePropertyCheck; } } } function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) { - return baseDeclarationFlags & 128 /* ModifierFlags.Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer) + return baseDeclarationFlags & 256 /* ModifierFlags.Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer) || ts.isInterfaceDeclaration(declaration.parent); } function getNonInheritedProperties(type, baseTypes, properties) { @@ -85761,7 +86250,7 @@ var ts; } } function isPropertyWithoutInitializer(node) { - return node.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + return node.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.hasAbstractModifier(node) && !node.exclamationToken && !node.initializer; @@ -85804,7 +86293,7 @@ var ts; var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(symbol); // Only check this symbol once - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 258 /* SyntaxKind.InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.InterfaceDeclaration */); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -85837,7 +86326,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0); checkExportsOnMergedDeclarations(node); checkTypeParameters(node.typeParameters); - if (node.type.kind === 138 /* SyntaxKind.IntrinsicKeyword */) { + if (node.type.kind === 139 /* SyntaxKind.IntrinsicKeyword */) { if (!intrinsicTypeKinds.has(node.name.escapedText) || ts.length(node.typeParameters) !== 1) { error(node.type, ts.Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types); } @@ -85923,7 +86412,7 @@ var ts; return value; function evaluate(expr) { switch (expr.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var value_2 = evaluate(expr.operand); if (typeof value_2 === "number") { switch (expr.operator) { @@ -85933,7 +86422,7 @@ var ts; } } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var left = evaluate(expr.left); var right = evaluate(expr.right); if (typeof left === "number" && typeof right === "number") { @@ -85962,7 +86451,7 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: checkGrammarNumericLiteral(expr); return +expr.text; - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return evaluate(expr.expression); case 79 /* SyntaxKind.Identifier */: var identifier = expr; @@ -85970,13 +86459,13 @@ var ts; return +(identifier.escapedText); } return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText); - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (isConstantMemberAccess(expr)) { var type = getTypeOfExpression(expr.expression); if (type.symbol && type.symbol.flags & 384 /* SymbolFlags.Enum */) { var name = void 0; - if (expr.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (expr.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { name = expr.name.escapedText; } else { @@ -86013,8 +86502,8 @@ var ts; return false; } return node.kind === 79 /* SyntaxKind.Identifier */ || - node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || - node.kind === 207 /* SyntaxKind.ElementAccessExpression */ && isConstantMemberAccess(node.expression) && + node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || + node.kind === 209 /* SyntaxKind.ElementAccessExpression */ && isConstantMemberAccess(node.expression) && ts.isStringLiteralLike(node.argumentExpression); } function checkEnumDeclaration(node) { @@ -86048,7 +86537,7 @@ var ts; var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind !== 263 /* SyntaxKind.EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -86077,8 +86566,8 @@ var ts; if (declarations) { for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { var declaration = declarations_9[_i]; - if ((declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ || - (declaration.kind === 256 /* SyntaxKind.FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ || + (declaration.kind === 259 /* SyntaxKind.FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { return declaration; } @@ -86149,7 +86638,7 @@ var ts; } // if the module merges with a class declaration in the same lexical scope, // we need to track this to ensure the correct emit. - var mergedClass = ts.getDeclarationOfKind(symbol, 257 /* SyntaxKind.ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 260 /* SyntaxKind.ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* NodeCheckFlags.LexicalModuleMergesWithClass */; @@ -86194,23 +86683,23 @@ var ts; function checkModuleAugmentationElement(node, isGlobalAugmentation) { var _a; switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // error each individual name in variable statement instead of marking the entire variable statement for (var _i = 0, _b = node.declarationList.declarations; _i < _b.length; _i++) { var decl = _b[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 203 /* SyntaxKind.BindingElement */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: var name = node.name; if (ts.isBindingPattern(name)) { for (var _c = 0, _d = name.elements; _c < _d.length; _c++) { @@ -86221,12 +86710,12 @@ var ts; break; } // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: if (isGlobalAugmentation) { return; } @@ -86249,12 +86738,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.left; } while (node.kind !== 79 /* SyntaxKind.Identifier */); return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: do { if (ts.isModuleExportsAccessExpression(node.expression) && !ts.isPrivateIdentifier(node.name)) { return node.name; @@ -86274,9 +86763,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 305 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 272 /* SyntaxKind.ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 308 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 275 /* SyntaxKind.ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -86323,8 +86812,8 @@ var ts; var errorNode = ts.isImportOrExportSpecifier(node) ? node.propertyName || node.name : ts.isNamedDeclaration(node) ? node.name : node; - ts.Debug.assert(node.kind !== 274 /* SyntaxKind.NamespaceExport */); - if (node.kind === 275 /* SyntaxKind.ExportSpecifier */) { + ts.Debug.assert(node.kind !== 277 /* SyntaxKind.NamespaceExport */); + if (node.kind === 278 /* SyntaxKind.ExportSpecifier */) { var diag = error(errorNode, ts.Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files); var alreadyExportedSymbol = (_b = (_a = ts.getSourceFileOfNode(node).symbol) === null || _a === void 0 ? void 0 : _a.exports) === null || _b === void 0 ? void 0 : _b.get((node.propertyName || node.name).escapedText); if (alreadyExportedSymbol === target) { @@ -86335,7 +86824,7 @@ var ts; } } else { - ts.Debug.assert(node.kind !== 254 /* SyntaxKind.VariableDeclaration */); + ts.Debug.assert(node.kind !== 257 /* SyntaxKind.VariableDeclaration */); var importDeclaration = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)); var moduleSpecifier = (_e = (importDeclaration && ((_d = ts.tryGetModuleSpecifierFromDeclaration(importDeclaration)) === null || _d === void 0 ? void 0 : _d.text))) !== null && _e !== void 0 ? _e : "..."; var importedIdentifier = ts.unescapeLeadingUnderscores(ts.isIdentifier(errorNode) ? errorNode.escapedText : symbol.escapedName); @@ -86347,7 +86836,7 @@ var ts; (symbol.flags & 788968 /* SymbolFlags.Type */ ? 788968 /* SymbolFlags.Type */ : 0) | (symbol.flags & 1920 /* SymbolFlags.Namespace */ ? 1920 /* SymbolFlags.Namespace */ : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 275 /* SyntaxKind.ExportSpecifier */ ? + var message = node.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -86359,23 +86848,23 @@ var ts; var isType = !(target.flags & 111551 /* SymbolFlags.Value */); if (isType || typeOnlyAlias) { switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { if (compilerOptions.preserveValueImports) { ts.Debug.assertIsDefined(node.name, "An ImportClause with a symbol should have a name"); var message = isType ? ts.Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled : ts.Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled; - var name = ts.idText(node.kind === 270 /* SyntaxKind.ImportSpecifier */ ? node.propertyName || node.name : node.name); + var name = ts.idText(node.kind === 273 /* SyntaxKind.ImportSpecifier */ ? node.propertyName || node.name : node.name); addTypeOnlyDeclarationRelatedInfo(error(node, message, name), isType ? undefined : typeOnlyAlias, name); } - if (isType && node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && ts.hasEffectiveModifier(node, 1 /* ModifierFlags.Export */)) { + if (isType && node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && ts.hasEffectiveModifier(node, 1 /* ModifierFlags.Export */)) { error(node, ts.Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided); } break; } - case 275 /* SyntaxKind.ExportSpecifier */: { + case 278 /* SyntaxKind.ExportSpecifier */: { // Don't allow re-exporting an export that will be elided when `--isolatedModules` is set. // The exception is that `import type { A } from './a'; export { A }` is allowed // because single-file analysis can determine that the export should be dropped. @@ -86434,7 +86923,7 @@ var ts; function checkImportBinding(node) { checkCollisionsForDeclarationName(node, node.name); checkAliasSymbol(node); - if (node.kind === 270 /* SyntaxKind.ImportSpecifier */ && + if (node.kind === 273 /* SyntaxKind.ImportSpecifier */ && ts.idText(node.propertyName || node.name) === "default" && ts.getESModuleInterop(compilerOptions) && moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) { @@ -86484,7 +86973,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { checkImportBinding(importClause.namedBindings); if (moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) && ts.getESModuleInterop(compilerOptions)) { // import * as ns from "foo"; @@ -86513,7 +87002,7 @@ var ts; if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { markExportAsReferenced(node); } - if (node.moduleReference.kind !== 277 /* SyntaxKind.ExternalModuleReference */) { + if (node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */) { var target = resolveAlias(getSymbolOfNode(node)); if (target !== unknownSymbol) { if (target.flags & 111551 /* SymbolFlags.Value */) { @@ -86556,10 +87045,10 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && + var inAmbientExternalModule = node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && !node.moduleSpecifier && node.flags & 16777216 /* NodeFlags.Ambient */; - if (node.parent.kind !== 305 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + if (node.parent.kind !== 308 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -86594,7 +87083,7 @@ var ts; function checkGrammarExportDeclaration(node) { var _a; if (node.isTypeOnly) { - if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 273 /* SyntaxKind.NamedExports */) { + if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 276 /* SyntaxKind.NamedExports */) { return checkGrammarNamedImportsOrExports(node.exportClause); } else { @@ -86604,7 +87093,7 @@ var ts; return false; } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 305 /* SyntaxKind.SourceFile */ || node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */; + var isInAppropriateContext = node.parent.kind === 308 /* SyntaxKind.SourceFile */ || node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -86684,8 +87173,8 @@ var ts; // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors. return; } - var container = node.parent.kind === 305 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 261 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 308 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); } @@ -86817,181 +87306,181 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } - if (kind >= 237 /* SyntaxKind.FirstStatement */ && kind <= 253 /* SyntaxKind.LastStatement */ && node.flowNode && !isReachableFlowNode(node.flowNode)) { + if (kind >= 240 /* SyntaxKind.FirstStatement */ && kind <= 256 /* SyntaxKind.LastStatement */ && node.flowNode && !isReachableFlowNode(node.flowNode)) { errorOrSuggestion(compilerOptions.allowUnreachableCode === false, node, ts.Diagnostics.Unreachable_code_detected); } switch (kind) { - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return checkTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return checkParameter(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return checkPropertyDeclaration(node); - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return checkPropertySignature(node); - case 180 /* SyntaxKind.ConstructorType */: - case 179 /* SyntaxKind.FunctionType */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return checkSignatureDeclaration(node); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return checkMethodDeclaration(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return checkClassStaticBlockDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return checkConstructorDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return checkAccessorDeclaration(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return checkTypeReferenceNode(node); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return checkTypePredicate(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return checkTypeQuery(node); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return checkTypeLiteral(node); - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return checkArrayType(node); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return checkTupleType(node); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return checkUnionOrIntersectionType(node); - case 191 /* SyntaxKind.ParenthesizedType */: - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 187 /* SyntaxKind.OptionalType */: + case 188 /* SyntaxKind.RestType */: return checkSourceElement(node.type); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return checkThisType(node); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return checkTypeOperator(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return checkConditionalType(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return checkInferType(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return checkTemplateLiteralType(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return checkImportType(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return checkNamedTupleMember(node); - case 328 /* SyntaxKind.JSDocAugmentsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: return checkJSDocAugmentsTag(node); - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return checkJSDocImplementsTag(node); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return checkJSDocTypeAliasTag(node); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return checkJSDocTemplateTag(node); - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return checkJSDocTypeTag(node); - case 324 /* SyntaxKind.JSDocLink */: - case 325 /* SyntaxKind.JSDocLinkCode */: - case 326 /* SyntaxKind.JSDocLinkPlain */: + case 327 /* SyntaxKind.JSDocLink */: + case 328 /* SyntaxKind.JSDocLinkCode */: + case 329 /* SyntaxKind.JSDocLinkPlain */: return checkJSDocLinkLikeTag(node); - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return checkJSDocParameterTag(node); - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return checkJSDocPropertyTag(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: checkJSDocFunctionType(node); // falls through - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: checkJSDocTypeIsInJsFile(node); ts.forEachChild(node, checkSourceElement); return; - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: checkJSDocVariadicType(node); return; - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return checkSourceElement(node.type); - case 333 /* SyntaxKind.JSDocPublicTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: + case 336 /* SyntaxKind.JSDocPublicTag */: + case 338 /* SyntaxKind.JSDocProtectedTag */: + case 337 /* SyntaxKind.JSDocPrivateTag */: return checkJSDocAccessibilityModifiers(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return checkIndexedAccessType(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return checkMappedType(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return checkFunctionDeclaration(node); - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: return checkBlock(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return checkVariableStatement(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return checkExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return checkIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return checkDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return checkWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return checkForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return checkForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return checkForOfStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: return checkBreakOrContinueStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return checkReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return checkWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return checkSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return checkLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return checkThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return checkTryStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checkVariableDeclaration(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return checkBindingElement(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return checkClassDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return checkEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return checkModuleDeclaration(node); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return checkImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return checkExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return checkExportAssignment(node); - case 236 /* SyntaxKind.EmptyStatement */: - case 253 /* SyntaxKind.DebuggerStatement */: + case 239 /* SyntaxKind.EmptyStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 276 /* SyntaxKind.MissingDeclaration */: + case 279 /* SyntaxKind.MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -87098,36 +87587,36 @@ var ts; currentNode = node; instantiationCount = 0; switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 165 /* SyntaxKind.Decorator */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 167 /* SyntaxKind.Decorator */: + case 283 /* SyntaxKind.JsxOpeningElement */: // These node kinds are deferred checked when overload resolution fails // To save on work, we ensure the arguments are checked just once, in // a deferred way resolveUntypedCall(node); break; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: checkAccessorDeclaration(node); break; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: checkClassExpressionDeferred(node); break; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: checkTypeParameterDeferred(node); break; - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: checkJsxSelfClosingElementDeferred(node); break; - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: checkJsxElementDeferred(node); break; } @@ -87300,17 +87789,17 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalModule(location)) break; // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: copyLocallyVisibleExportSymbols(getSymbolOfNode(location).exports, meaning & 2623475 /* SymbolFlags.ModuleMember */); break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* SymbolFlags.EnumMember */); break; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: var className = location.name; if (className) { copySymbol(location.symbol, meaning); @@ -87318,8 +87807,8 @@ var ts; // this fall-through is necessary because we would like to handle // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration. // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // If we didn't come from static member of class or interface, // add the type parameters into the symbol table // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol. @@ -87328,7 +87817,7 @@ var ts; copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 788968 /* SymbolFlags.Type */); } break; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -87372,7 +87861,7 @@ var ts; if (meaning) { source.forEach(function (symbol) { // Similar condition as in `resolveNameHelper` - if (!ts.getDeclarationOfKind(symbol, 275 /* SyntaxKind.ExportSpecifier */) && !ts.getDeclarationOfKind(symbol, 274 /* SyntaxKind.NamespaceExport */)) { + if (!ts.getDeclarationOfKind(symbol, 278 /* SyntaxKind.ExportSpecifier */) && !ts.getDeclarationOfKind(symbol, 277 /* SyntaxKind.NamespaceExport */)) { copySymbol(symbol, meaning); } }); @@ -87386,19 +87875,19 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 163 /* SyntaxKind.TypeParameter */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 165 /* SyntaxKind.TypeParameter */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return true; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return node.isTypeOnly; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.isTypeOnly; default: return false; @@ -87406,16 +87895,16 @@ var ts; } // True if the given identifier is part of a type reference function isTypeReferenceIdentifier(node) { - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } - return node.parent.kind === 178 /* SyntaxKind.TypeReference */; + return node.parent.kind === 180 /* SyntaxKind.TypeReference */; } function isHeritageClauseElementIdentifier(node) { - while (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { node = node.parent; } - return node.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } function forEachEnclosingClass(node, callback) { var result; @@ -87443,13 +87932,13 @@ var ts; return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (nodeOnRightSide.parent.kind === 163 /* SyntaxKind.QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } - if (nodeOnRightSide.parent.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 274 /* SyntaxKind.ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } return undefined; @@ -87475,7 +87964,7 @@ var ts; node = parent; parent = parent.parent; } - if (parent && parent.kind === 200 /* SyntaxKind.ImportType */ && parent.qualifier === node) { + if (parent && parent.kind === 202 /* SyntaxKind.ImportType */ && parent.qualifier === node) { return parent; } return undefined; @@ -87485,7 +87974,7 @@ var ts; return getSymbolOfNode(name.parent); } if (ts.isInJSFile(name) && - name.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + name.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && name.parent === name.parent.parent.left) { // Check if this is a special property assignment if (!ts.isPrivateIdentifier(name) && !ts.isJSDocMemberName(name)) { @@ -87495,7 +87984,7 @@ var ts; } } } - if (name.parent.kind === 271 /* SyntaxKind.ExportAssignment */ && ts.isEntityNameExpression(name)) { + if (name.parent.kind === 274 /* SyntaxKind.ExportAssignment */ && ts.isEntityNameExpression(name)) { // Even an entity name expression that doesn't resolve as an entityname may still typecheck as a property access expression var success = resolveEntityName(name, /*all meanings*/ 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */, /*ignoreErrors*/ true); @@ -87505,7 +87994,7 @@ var ts; } else if (ts.isEntityName(name) && isInRightSideOfImportOrExportAssignment(name)) { // Since we already checked for ExportAssignment, this really could only be an Import - var importEqualsDeclaration = ts.getAncestor(name, 265 /* SyntaxKind.ImportEqualsDeclaration */); + var importEqualsDeclaration = ts.getAncestor(name, 268 /* SyntaxKind.ImportEqualsDeclaration */); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(name, /*dontResolveAlias*/ true); } @@ -87523,7 +88012,7 @@ var ts; if (isHeritageClauseElementIdentifier(name)) { var meaning = 0 /* SymbolFlags.None */; // In an interface or class, we're definitely interested in a type. - if (name.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (name.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { meaning = 788968 /* SymbolFlags.Type */; // In a class 'extends' clause we are also looking for a value. if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(name.parent)) { @@ -87539,10 +88028,10 @@ var ts; return entityNameSymbol; } } - if (name.parent.kind === 340 /* SyntaxKind.JSDocParameterTag */) { + if (name.parent.kind === 343 /* SyntaxKind.JSDocParameterTag */) { return ts.getParameterSymbolFromJSDoc(name.parent); } - if (name.parent.kind === 163 /* SyntaxKind.TypeParameter */ && name.parent.parent.kind === 344 /* SyntaxKind.JSDocTemplateTag */) { + if (name.parent.kind === 165 /* SyntaxKind.TypeParameter */ && name.parent.parent.kind === 347 /* SyntaxKind.JSDocTemplateTag */) { ts.Debug.assert(!ts.isInJSFile(name)); // Otherwise `isDeclarationName` would have been true. var typeParameter = ts.getTypeParameterFromJsDoc(name.parent); return typeParameter && typeParameter.symbol; @@ -87566,18 +88055,53 @@ var ts; return resolveJSDocMemberName(name, /*ignoreErrors*/ false, getSymbolOfNode(container)); } } + if (result && isJSDoc_1) { + var container = ts.getJSDocHost(name); + if (container && ts.isEnumMember(container) && container === result.valueDeclaration) { + return resolveEntityName(name, meaning, /*ignoreErrors*/ true, /* dontResolveAlias */ true, ts.getSourceFileOfNode(container)) || result; + } + } return result; } else if (ts.isPrivateIdentifier(name)) { return getSymbolForPrivateIdentifierExpression(name); } - else if (name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || name.kind === 161 /* SyntaxKind.QualifiedName */) { + else if (name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || name.kind === 163 /* SyntaxKind.QualifiedName */) { var links = getNodeLinks(name); if (links.resolvedSymbol) { return links.resolvedSymbol; } - if (name.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (name.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { checkPropertyAccessExpression(name, 0 /* CheckMode.Normal */); + if (!links.resolvedSymbol) { + var expressionType = checkExpressionCached(name.expression); + var infos = getApplicableIndexInfos(expressionType, getLiteralTypeFromPropertyName(name.name)); + if (infos.length && expressionType.members) { + var resolved = resolveStructuredTypeMembers(expressionType); + var symbol = resolved.members.get("__index" /* InternalSymbolName.Index */); + if (infos === getIndexInfosOfType(expressionType)) { + links.resolvedSymbol = symbol; + } + else if (symbol) { + var symbolLinks_1 = getSymbolLinks(symbol); + var declarationList = ts.mapDefined(infos, function (i) { return i.declaration; }); + var nodeListId = ts.map(declarationList, getNodeId).join(","); + if (!symbolLinks_1.filteredIndexSymbolCache) { + symbolLinks_1.filteredIndexSymbolCache = new ts.Map(); + } + if (symbolLinks_1.filteredIndexSymbolCache.has(nodeListId)) { + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + else { + var copy = createSymbol(131072 /* SymbolFlags.Signature */, "__index" /* InternalSymbolName.Index */); + copy.declarations = ts.mapDefined(infos, function (i) { return i.declaration; }); + copy.parent = expressionType.aliasSymbol ? expressionType.aliasSymbol : expressionType.symbol ? expressionType.symbol : getSymbolAtLocation(copy.declarations[0].parent); + symbolLinks_1.filteredIndexSymbolCache.set(nodeListId, copy); + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + } + } + } } else { checkQualifiedName(name, 0 /* CheckMode.Normal */); @@ -87592,11 +88116,11 @@ var ts; } } else if (isTypeReferenceIdentifier(name)) { - var meaning = name.parent.kind === 178 /* SyntaxKind.TypeReference */ ? 788968 /* SymbolFlags.Type */ : 1920 /* SymbolFlags.Namespace */; + var meaning = name.parent.kind === 180 /* SyntaxKind.TypeReference */ ? 788968 /* SymbolFlags.Type */ : 1920 /* SymbolFlags.Namespace */; var symbol = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); return symbol && symbol !== unknownSymbol ? symbol : getUnresolvedSymbolForEntityName(name); } - if (name.parent.kind === 177 /* SyntaxKind.TypePredicate */) { + if (name.parent.kind === 179 /* SyntaxKind.TypePredicate */) { return resolveEntityName(name, /*meaning*/ 1 /* SymbolFlags.FunctionScopedVariable */); } return undefined; @@ -87630,7 +88154,7 @@ var ts; } } function getSymbolAtLocation(node, ignoreErrors) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } var parent = node.parent; @@ -87653,8 +88177,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } - else if (parent.kind === 203 /* SyntaxKind.BindingElement */ && - grandParent.kind === 201 /* SyntaxKind.ObjectBindingPattern */ && + else if (parent.kind === 205 /* SyntaxKind.BindingElement */ && + grandParent.kind === 203 /* SyntaxKind.ObjectBindingPattern */ && node === parent.propertyName) { var typeOfPattern = getTypeOfNode(grandParent); var propertyDeclaration = getPropertyOfType(typeOfPattern, node.escapedText); @@ -87681,8 +88205,8 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: if (!ts.isThisInTypeQuery(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } @@ -87699,14 +88223,14 @@ var ts; return checkExpression(node).symbol; } // falls through - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return getTypeFromThisTypeNode(node).symbol; case 106 /* SyntaxKind.SuperKeyword */: return checkExpression(node).symbol; - case 134 /* SyntaxKind.ConstructorKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 171 /* SyntaxKind.Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 173 /* SyntaxKind.Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; @@ -87717,7 +88241,7 @@ var ts; // 3). Dynamic import call or require in javascript // 4). type A = import("./f/*gotToDefinitionHere*/oo") if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 266 /* SyntaxKind.ImportDeclaration */ || node.parent.kind === 272 /* SyntaxKind.ExportDeclaration */) && node.parent.moduleSpecifier === node) || + ((node.parent.kind === 269 /* SyntaxKind.ImportDeclaration */ || node.parent.kind === 275 /* SyntaxKind.ExportDeclaration */) && node.parent.moduleSpecifier === node) || ((ts.isInJSFile(node) && ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false)) || ts.isImportCall(node.parent)) || (ts.isLiteralTypeNode(node.parent) && ts.isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent)) { return resolveExternalModuleName(node, node, ignoreErrors); @@ -87739,14 +88263,14 @@ var ts; case 38 /* SyntaxKind.EqualsGreaterThanToken */: case 84 /* SyntaxKind.ClassKeyword */: return getSymbolOfNode(node.parent); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal, ignoreErrors) : undefined; case 93 /* SyntaxKind.ExportKeyword */: return ts.isExportAssignment(node.parent) ? ts.Debug.checkDefined(node.parent.symbol) : undefined; case 100 /* SyntaxKind.ImportKeyword */: case 103 /* SyntaxKind.NewKeyword */: return ts.isMetaProperty(node.parent) ? checkMetaPropertyKeyword(node.parent).symbol : undefined; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return checkExpression(node).symbol; default: return undefined; @@ -87762,7 +88286,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (location && location.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 111551 /* SymbolFlags.Value */ | 2097152 /* SymbolFlags.Alias */); } return undefined; @@ -87844,23 +88368,23 @@ var ts; // [ a ] from // [a] = [ some array ...] function getTypeOfAssignmentPattern(expr) { - ts.Debug.assert(expr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || expr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */); + ts.Debug.assert(expr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || expr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */); // If this is from "for of" // for ( { a } of elems) { // } - if (expr.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (expr.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { var iteratedType = checkRightHandSideOfForOf(expr.parent); return checkDestructuringAssignment(expr, iteratedType || errorType); } // If this is from "for" initializer // for ({a } = elems[0];.....) { } - if (expr.parent.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (expr.parent.kind === 223 /* SyntaxKind.BinaryExpression */) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || errorType); } // If this is from nested object binding pattern // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { - if (expr.parent.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (expr.parent.kind === 299 /* SyntaxKind.PropertyAssignment */) { var node_3 = ts.cast(expr.parent.parent, ts.isObjectLiteralExpression); var typeOfParentObjectLiteral = getTypeOfAssignmentPattern(node_3) || errorType; var propertyIndex = ts.indexOfNode(node_3.properties, expr.parent); @@ -87908,7 +88432,7 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 10 /* SyntaxKind.StringLiteral */: return getStringLiteralType(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: var nameType = checkComputedPropertyName(name); return isTypeAssignableToKind(nameType, 12288 /* TypeFlags.ESSymbolLike */) ? nameType : stringType; default: @@ -88026,7 +88550,7 @@ var ts; } var parentSymbol_1 = getParentOfSymbol(symbol); if (parentSymbol_1) { - if (parentSymbol_1.flags & 512 /* SymbolFlags.ValueModule */ && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 305 /* SyntaxKind.SourceFile */) { + if (parentSymbol_1.flags & 512 /* SymbolFlags.ValueModule */ && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 308 /* SyntaxKind.SourceFile */) { var symbolFile = parentSymbol_1.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); // If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined. @@ -88046,7 +88570,7 @@ var ts; } var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier); if (node) { - var symbol = getReferencedValueSymbol(node); + var symbol = getReferencedValueOrAliasSymbol(node); // We should only get the declaration of an alias if there isn't a local value // declaration for the symbol if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol)) { @@ -88058,7 +88582,7 @@ var ts; function isSymbolOfDestructuredElementOfCatchBinding(symbol) { return symbol.valueDeclaration && ts.isBindingElement(symbol.valueDeclaration) - && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 292 /* SyntaxKind.CatchClause */; + && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 295 /* SyntaxKind.CatchClause */; } function isSymbolOfDeclarationWithCollidingName(symbol) { if (symbol.flags & 418 /* SymbolFlags.BlockScoped */ && symbol.valueDeclaration && !ts.isSourceFile(symbol.valueDeclaration)) { @@ -88089,7 +88613,7 @@ var ts; // they will not collide with anything var isDeclaredInLoop = nodeLinks_1.flags & 524288 /* NodeCheckFlags.BlockScopedBindingInLoop */; var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false); - var inLoopBodyBlock = container.kind === 235 /* SyntaxKind.Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + var inLoopBodyBlock = container.kind === 238 /* SyntaxKind.Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -88130,19 +88654,19 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: var symbol = getSymbolOfNode(node); return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportClause = node.exportClause; return !!exportClause && (ts.isNamespaceExport(exportClause) || ts.some(exportClause.elements, isValueAliasDeclaration)); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return node.expression && node.expression.kind === 79 /* SyntaxKind.Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; @@ -88151,7 +88675,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(nodeIn) { var node = ts.getParseTreeNode(nodeIn, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 305 /* SyntaxKind.SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 308 /* SyntaxKind.SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -88261,15 +88785,15 @@ var ts; } function canHaveConstantValue(node) { switch (node.kind) { - case 299 /* SyntaxKind.EnumMember */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 302 /* SyntaxKind.EnumMember */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return true; } return false; } function getConstantValue(node) { - if (node.kind === 299 /* SyntaxKind.EnumMember */) { + if (node.kind === 302 /* SyntaxKind.EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -88362,7 +88886,7 @@ var ts; function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker, addUndefined) { var declaration = ts.getParseTreeNode(declarationIn, ts.isVariableLikeOrAccessor); if (!declaration) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } // Get type of the symbol if this is the valid symbol otherwise get type at location var symbol = getSymbolOfNode(declaration); @@ -88381,7 +88905,7 @@ var ts; function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) { var signatureDeclaration = ts.getParseTreeNode(signatureDeclarationIn, ts.isFunctionLike); if (!signatureDeclaration) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } var signature = getSignatureFromDeclaration(signatureDeclaration); return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, flags | 1024 /* NodeBuilderFlags.MultilineObjectLiterals */, tracker); @@ -88389,7 +88913,7 @@ var ts; function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) { var expr = ts.getParseTreeNode(exprIn, ts.isExpression); if (!expr) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } var type = getWidenedType(getRegularTypeOfExpression(expr)); return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024 /* NodeBuilderFlags.MultilineObjectLiterals */, tracker); @@ -88413,6 +88937,25 @@ var ts; } return resolveName(location, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true); } + /** + * Get either a value-meaning symbol or an alias symbol. + * Unlike `getReferencedValueSymbol`, if the cached resolved symbol is the unknown symbol, + * we call `resolveName` to find a symbol. + * This is because when caching the resolved symbol, we only consider value symbols, but here + * we want to also get an alias symbol if one exists. + */ + function getReferencedValueOrAliasSymbol(reference) { + var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; + if (resolvedSymbol && resolvedSymbol !== unknownSymbol) { + return resolvedSymbol; + } + return resolveName(reference, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, + /*nodeNotFoundMessage*/ undefined, + /*nameArg*/ undefined, + /*isUse*/ true, + /*excludeGlobals*/ undefined, + /*getSpellingSuggestions*/ undefined); + } function getReferencedValueDeclaration(referenceIn) { if (!ts.isGeneratedIdentifier(referenceIn)) { var reference = ts.getParseTreeNode(referenceIn, ts.isIdentifier); @@ -88546,12 +89089,12 @@ var ts; getJsxFragmentFactoryEntity: getJsxFragmentFactoryEntity, getAllAccessorDeclarations: function (accessor) { accessor = ts.getParseTreeNode(accessor, ts.isGetOrSetAccessorDeclaration); // TODO: GH#18217 - var otherKind = accessor.kind === 173 /* SyntaxKind.SetAccessor */ ? 172 /* SyntaxKind.GetAccessor */ : 173 /* SyntaxKind.SetAccessor */; + var otherKind = accessor.kind === 175 /* SyntaxKind.SetAccessor */ ? 174 /* SyntaxKind.GetAccessor */ : 175 /* SyntaxKind.SetAccessor */; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(accessor), otherKind); var firstAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? otherAccessor : accessor; var secondAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? accessor : otherAccessor; - var setAccessor = accessor.kind === 173 /* SyntaxKind.SetAccessor */ ? accessor : otherAccessor; - var getAccessor = accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? accessor : otherAccessor; + var setAccessor = accessor.kind === 175 /* SyntaxKind.SetAccessor */ ? accessor : otherAccessor; + var getAccessor = accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? accessor : otherAccessor; return { firstAccessor: firstAccessor, secondAccessor: secondAccessor, @@ -88567,7 +89110,7 @@ var ts; }, getDeclarationStatementsForSourceFile: function (node, flags, tracker, bundled) { var n = ts.getParseTreeNode(node); - ts.Debug.assert(n && n.kind === 305 /* SyntaxKind.SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile"); + ts.Debug.assert(n && n.kind === 308 /* SyntaxKind.SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile"); var sym = getSymbolOfNode(node); if (!sym) { return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker, bundled); @@ -88604,7 +89147,7 @@ var ts; return false; } function isInHeritageClause(node) { - return node.parent && node.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 291 /* SyntaxKind.HeritageClause */; + return node.parent && node.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 294 /* SyntaxKind.HeritageClause */; } // defined here to avoid outer scope pollution function getTypeReferenceDirectivesForEntityName(node) { @@ -88617,12 +89160,12 @@ var ts; // qualified names can only be used as types\namespaces // identifiers are treated as values only if they appear in type queries var meaning; - if (node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } else { meaning = 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */; - if ((node.kind === 79 /* SyntaxKind.Identifier */ && isInTypeQuery(node)) || (node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && !isInHeritageClause(node))) { + if ((node.kind === 79 /* SyntaxKind.Identifier */ && isInTypeQuery(node)) || (node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && !isInHeritageClause(node))) { meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } } @@ -88671,7 +89214,7 @@ var ts; break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 305 /* SyntaxKind.SourceFile */ && current.flags & 512 /* SymbolFlags.ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 308 /* SyntaxKind.SourceFile */ && current.flags & 512 /* SymbolFlags.ValueModule */) { return false; } // check that at least one declaration of top level symbol originates from type declaration file @@ -88699,12 +89242,12 @@ var ts; } } function getExternalModuleFileFromDeclaration(declaration) { - var specifier = declaration.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); + var specifier = declaration.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, /*moduleNotFoundError*/ undefined); // TODO: GH#18217 if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 305 /* SyntaxKind.SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 308 /* SyntaxKind.SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors @@ -88916,14 +89459,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node, node.parent, node.parent.parent)) { - if (node.kind === 169 /* SyntaxKind.MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { + if (node.kind === 171 /* SyntaxKind.MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } } - else if (node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (ts.hasDecorators(accessors.firstAccessor) && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -88942,26 +89485,26 @@ var ts; var modifier = _a[_i]; if (ts.isDecorator(modifier)) continue; - if (modifier.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { - if (node.kind === 166 /* SyntaxKind.PropertySignature */ || node.kind === 168 /* SyntaxKind.MethodSignature */) { + if (modifier.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { + if (node.kind === 168 /* SyntaxKind.PropertySignature */ || node.kind === 170 /* SyntaxKind.MethodSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 176 /* SyntaxKind.IndexSignature */ && (modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ || !ts.isClassLike(node.parent))) { + if (node.kind === 178 /* SyntaxKind.IndexSignature */ && (modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ || !ts.isClassLike(node.parent))) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } - if (modifier.kind !== 101 /* SyntaxKind.InKeyword */ && modifier.kind !== 144 /* SyntaxKind.OutKeyword */) { - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { + if (modifier.kind !== 101 /* SyntaxKind.InKeyword */ && modifier.kind !== 145 /* SyntaxKind.OutKeyword */) { + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_parameter, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { case 85 /* SyntaxKind.ConstKeyword */: - if (node.kind !== 260 /* SyntaxKind.EnumDeclaration */) { + if (node.kind !== 263 /* SyntaxKind.EnumDeclaration */) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(85 /* SyntaxKind.ConstKeyword */)); } break; - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "override"); @@ -88972,7 +89515,10 @@ var ts; else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "accessor"); + } + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "async"); } flags |= 16384 /* ModifierFlags.Override */; @@ -88991,16 +89537,19 @@ var ts; else if (flags & 32 /* ModifierFlags.Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "accessor"); + } else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { if (modifier.kind === 121 /* SyntaxKind.PrivateKeyword */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } @@ -89020,16 +89569,19 @@ var ts; else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "accessor"); + } + else if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } else if (flags & 16384 /* ModifierFlags.Override */) { @@ -89038,11 +89590,26 @@ var ts; flags |= 32 /* ModifierFlags.Static */; lastStatic = modifier; break; - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "accessor"); + } + else if (flags & 64 /* ModifierFlags.Readonly */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "readonly"); + } + else if (flags & 2 /* ModifierFlags.Ambient */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "declare"); + } + else if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */) { + return grammarErrorOnNode(modifier, ts.Diagnostics.accessor_modifier_can_only_appear_on_a_property_declaration); + } + flags |= 128 /* ModifierFlags.Accessor */; + break; + case 146 /* SyntaxKind.ReadonlyKeyword */: if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 166 /* SyntaxKind.PropertySignature */ && node.kind !== 176 /* SyntaxKind.IndexSignature */ && node.kind !== 164 /* SyntaxKind.Parameter */) { + else if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 168 /* SyntaxKind.PropertySignature */ && node.kind !== 178 /* SyntaxKind.IndexSignature */ && node.kind !== 166 /* SyntaxKind.Parameter */) { // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } @@ -89055,35 +89622,35 @@ var ts; else if (flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "abstract"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } else if (ts.isClassLike(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "export"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1 /* ModifierFlags.Export */; break; case 88 /* SyntaxKind.DefaultKeyword */: - var container = node.parent.kind === 305 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 261 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 308 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } else if (!(flags & 1 /* ModifierFlags.Export */)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "default"); } - flags |= 512 /* ModifierFlags.Default */; + flags |= 1024 /* ModifierFlags.Default */; break; - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: if (flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } else if (flags & 16384 /* ModifierFlags.Override */) { @@ -89092,10 +89659,10 @@ var ts; else if (ts.isClassLike(node.parent) && !ts.isPropertyDeclaration(node)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "declare"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if ((node.parent.flags & 16777216 /* NodeFlags.Ambient */) && node.parent.kind === 262 /* SyntaxKind.ModuleBlock */) { + else if ((node.parent.flags & 16777216 /* NodeFlags.Ambient */) && node.parent.kind === 265 /* SyntaxKind.ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } else if (ts.isPrivateIdentifierClassElementDeclaration(node)) { @@ -89105,18 +89672,18 @@ var ts; lastDeclare = modifier; break; case 126 /* SyntaxKind.AbstractKeyword */: - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 257 /* SyntaxKind.ClassDeclaration */ && - node.kind !== 180 /* SyntaxKind.ConstructorType */) { - if (node.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && - node.kind !== 172 /* SyntaxKind.GetAccessor */ && - node.kind !== 173 /* SyntaxKind.SetAccessor */) { + if (node.kind !== 260 /* SyntaxKind.ClassDeclaration */ && + node.kind !== 182 /* SyntaxKind.ConstructorType */) { + if (node.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && + node.kind !== 174 /* SyntaxKind.GetAccessor */ && + node.kind !== 175 /* SyntaxKind.SetAccessor */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ && ts.hasSyntacticModifier(node.parent, 128 /* ModifierFlags.Abstract */))) { + if (!(node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ && ts.hasSyntacticModifier(node.parent, 256 /* ModifierFlags.Abstract */))) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32 /* ModifierFlags.Static */) { @@ -89125,39 +89692,42 @@ var ts; if (flags & 8 /* ModifierFlags.Private */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract"); } - if (flags & 256 /* ModifierFlags.Async */ && lastAsync) { + if (flags & 512 /* ModifierFlags.Async */ && lastAsync) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); } if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "override"); } + if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "accessor"); + } } if (ts.isNamedDeclaration(node) && node.name.kind === 80 /* SyntaxKind.PrivateIdentifier */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "abstract"); } - flags |= 128 /* ModifierFlags.Abstract */; + flags |= 256 /* ModifierFlags.Abstract */; break; - case 131 /* SyntaxKind.AsyncKeyword */: - if (flags & 256 /* ModifierFlags.Async */) { + case 132 /* SyntaxKind.AsyncKeyword */: + if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } else if (flags & 2 /* ModifierFlags.Ambient */ || node.parent.flags & 16777216 /* NodeFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); } - flags |= 256 /* ModifierFlags.Async */; + flags |= 512 /* ModifierFlags.Async */; lastAsync = modifier; break; case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: var inOutFlag = modifier.kind === 101 /* SyntaxKind.InKeyword */ ? 32768 /* ModifierFlags.In */ : 65536 /* ModifierFlags.Out */; var inOutText = modifier.kind === 101 /* SyntaxKind.InKeyword */ ? "in" : "out"; - if (node.kind !== 163 /* SyntaxKind.TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) { + if (node.kind !== 165 /* SyntaxKind.TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText); } if (flags & inOutFlag) { @@ -89170,28 +89740,28 @@ var ts; break; } } - if (node.kind === 171 /* SyntaxKind.Constructor */) { + if (node.kind === 173 /* SyntaxKind.Constructor */) { if (flags & 32 /* ModifierFlags.Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(lastOverride, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "override"); // TODO: GH#18217 } - if (flags & 256 /* ModifierFlags.Async */) { + if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); } return false; } - else if ((node.kind === 266 /* SyntaxKind.ImportDeclaration */ || node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) && flags & 2 /* ModifierFlags.Ambient */) { + else if ((node.kind === 269 /* SyntaxKind.ImportDeclaration */ || node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) && flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 166 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); } - else if (node.kind === 164 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && node.dotDotDotToken) { + else if (node.kind === 166 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && node.dotDotDotToken) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } - if (flags & 256 /* ModifierFlags.Async */) { + if (flags & 512 /* ModifierFlags.Async */) { return checkGrammarAsyncModifier(node, lastAsync); } return false; @@ -89209,47 +89779,47 @@ var ts; } function shouldReportBadModifier(node) { switch (node.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 164 /* SyntaxKind.Parameter */: - case 163 /* SyntaxKind.TypeParameter */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 166 /* SyntaxKind.Parameter */: + case 165 /* SyntaxKind.TypeParameter */: return false; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - case 179 /* SyntaxKind.FunctionType */: - case 276 /* SyntaxKind.MissingDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: + case 181 /* SyntaxKind.FunctionType */: + case 279 /* SyntaxKind.MissingDeclaration */: return true; default: - if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return false; } switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - return nodeHasAnyModifiersExcept(node, 131 /* SyntaxKind.AsyncKeyword */); - case 257 /* SyntaxKind.ClassDeclaration */: - case 180 /* SyntaxKind.ConstructorType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + return nodeHasAnyModifiersExcept(node, 132 /* SyntaxKind.AsyncKeyword */); + case 260 /* SyntaxKind.ClassDeclaration */: + case 182 /* SyntaxKind.ConstructorType */: return nodeHasAnyModifiersExcept(node, 126 /* SyntaxKind.AbstractKeyword */); - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return nodeHasAnyModifiersExcept(node, 85 /* SyntaxKind.ConstKeyword */); default: ts.Debug.assertNever(node); @@ -89267,10 +89837,10 @@ var ts; } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return false; } return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); @@ -89499,20 +90069,20 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.kind !== 164 /* SyntaxKind.ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 221 /* SyntaxKind.BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { + if (computedPropertyName.expression.kind === 223 /* SyntaxKind.BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } return false; } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - node.kind === 213 /* SyntaxKind.FunctionExpression */ || - node.kind === 169 /* SyntaxKind.MethodDeclaration */); + ts.Debug.assert(node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + node.kind === 215 /* SyntaxKind.FunctionExpression */ || + node.kind === 171 /* SyntaxKind.MethodDeclaration */); if (node.flags & 16777216 /* NodeFlags.Ambient */) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -89531,7 +90101,7 @@ var ts; var seen = new ts.Map(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 298 /* SyntaxKind.SpreadAssignment */) { + if (prop.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (inDestructuring) { // a rest property cannot be destructured any further var expression = ts.skipParentheses(prop.expression); @@ -89542,11 +90112,11 @@ var ts; continue; } var name = prop.name; - if (name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name); } - if (prop.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern); @@ -89558,7 +90128,7 @@ var ts; if (ts.canHaveModifiers(prop) && prop.modifiers) { for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { var mod = _c[_b]; - if (ts.isModifier(mod) && (mod.kind !== 131 /* SyntaxKind.AsyncKeyword */ || prop.kind !== 169 /* SyntaxKind.MethodDeclaration */)) { + if (ts.isModifier(mod) && (mod.kind !== 132 /* SyntaxKind.AsyncKeyword */ || prop.kind !== 171 /* SyntaxKind.MethodDeclaration */)) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } } @@ -89579,8 +90149,8 @@ var ts; // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = void 0; switch (prop.kind) { - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidExclamationToken(prop.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); @@ -89589,13 +90159,13 @@ var ts; } currentKind = 4 /* DeclarationMeaning.PropertyAssignment */; break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: currentKind = 8 /* DeclarationMeaning.Method */; break; - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: currentKind = 1 /* DeclarationMeaning.GetAccessor */; break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: currentKind = 2 /* DeclarationMeaning.SetAccessor */; break; default: @@ -89638,7 +90208,7 @@ var ts; var seen = new ts.Map(); for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 287 /* SyntaxKind.JsxSpreadAttribute */) { + if (attr.kind === 290 /* SyntaxKind.JsxSpreadAttribute */) { continue; } var name = attr.name, initializer = attr.initializer; @@ -89648,7 +90218,7 @@ var ts; else { return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } - if (initializer && initializer.kind === 288 /* SyntaxKind.JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 291 /* SyntaxKind.JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -89683,7 +90253,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.kind === 244 /* SyntaxKind.ForOfStatement */ && forInOrOfStatement.awaitModifier) { + if (forInOrOfStatement.kind === 247 /* SyntaxKind.ForOfStatement */ && forInOrOfStatement.awaitModifier) { if (!(forInOrOfStatement.flags & 32768 /* NodeFlags.AwaitContext */)) { var sourceFile = ts.getSourceFileOfNode(forInOrOfStatement); if (ts.isInTopLevelContext(forInOrOfStatement)) { @@ -89717,7 +90287,7 @@ var ts; if (!hasParseDiagnostics(sourceFile)) { var diagnostic = ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); var func = ts.getContainingFunction(forInOrOfStatement); - if (func && func.kind !== 171 /* SyntaxKind.Constructor */) { + if (func && func.kind !== 173 /* SyntaxKind.Constructor */) { ts.Debug.assert((ts.getFunctionFlags(func) & 2 /* FunctionFlags.Async */) === 0, "Enclosing function should never be an async function."); var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); ts.addRelatedInfo(diagnostic, relatedInfo); @@ -89734,7 +90304,7 @@ var ts; grammarErrorOnNode(forInOrOfStatement.initializer, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async); return false; } - if (forInOrOfStatement.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -89749,20 +90319,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -89772,22 +90342,22 @@ var ts; return false; } function checkGrammarAccessor(accessor) { - if (!(accessor.flags & 16777216 /* NodeFlags.Ambient */) && (accessor.parent.kind !== 182 /* SyntaxKind.TypeLiteral */) && (accessor.parent.kind !== 258 /* SyntaxKind.InterfaceDeclaration */)) { + if (!(accessor.flags & 16777216 /* NodeFlags.Ambient */) && (accessor.parent.kind !== 184 /* SyntaxKind.TypeLiteral */) && (accessor.parent.kind !== 261 /* SyntaxKind.InterfaceDeclaration */)) { if (languageVersion < 1 /* ScriptTarget.ES5 */) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); } if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isPrivateIdentifier(accessor.name)) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } - if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 128 /* ModifierFlags.Abstract */)) { + if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 256 /* ModifierFlags.Abstract */)) { return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } if (accessor.body) { - if (ts.hasSyntacticModifier(accessor, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(accessor, 256 /* ModifierFlags.Abstract */)) { return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); } - if (accessor.parent.kind === 182 /* SyntaxKind.TypeLiteral */ || accessor.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (accessor.parent.kind === 184 /* SyntaxKind.TypeLiteral */ || accessor.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return grammarErrorOnNode(accessor.body, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } } @@ -89795,11 +90365,11 @@ var ts; return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } if (!doesAccessorHaveCorrectParameterCount(accessor)) { - return grammarErrorOnNode(accessor.name, accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? + return grammarErrorOnNode(accessor.name, accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? ts.Diagnostics.A_get_accessor_cannot_have_parameters : ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - if (accessor.kind === 173 /* SyntaxKind.SetAccessor */) { + if (accessor.kind === 175 /* SyntaxKind.SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -89821,17 +90391,17 @@ var ts; * A set accessor has one parameter or a `this` parameter and one more parameter. */ function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? 1 : 2)) { + if (accessor.parameters.length === (accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? 1 : 2)) { return ts.getThisParameter(accessor); } } function checkGrammarTypeOperatorNode(node) { - if (node.operator === 154 /* SyntaxKind.UniqueKeyword */) { - if (node.type.kind !== 151 /* SyntaxKind.SymbolKeyword */) { - return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(151 /* SyntaxKind.SymbolKeyword */)); + if (node.operator === 156 /* SyntaxKind.UniqueKeyword */) { + if (node.type.kind !== 153 /* SyntaxKind.SymbolKeyword */) { + return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(153 /* SyntaxKind.SymbolKeyword */)); } var parent = ts.walkUpParenthesizedTypes(node.parent); if (ts.isInJSFile(parent) && ts.isJSDocTypeExpression(parent)) { @@ -89841,7 +90411,7 @@ var ts; } } switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: var decl = parent; if (decl.name.kind !== 79 /* SyntaxKind.Identifier */) { return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name); @@ -89853,13 +90423,13 @@ var ts; return grammarErrorOnNode(parent.name, ts.Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const); } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (!ts.isStatic(parent) || !ts.hasEffectiveReadonlyModifier(parent)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly); } break; - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (!ts.hasSyntacticModifier(parent, 64 /* ModifierFlags.Readonly */)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly); } @@ -89868,9 +90438,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_are_not_allowed_here); } } - else if (node.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { - if (node.type.kind !== 183 /* SyntaxKind.ArrayType */ && node.type.kind !== 184 /* SyntaxKind.TupleType */) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(151 /* SyntaxKind.SymbolKeyword */)); + else if (node.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { + if (node.type.kind !== 185 /* SyntaxKind.ArrayType */ && node.type.kind !== 186 /* SyntaxKind.TupleType */) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(153 /* SyntaxKind.SymbolKeyword */)); } } } @@ -89883,10 +90453,10 @@ var ts; if (checkGrammarFunctionLikeDeclaration(node)) { return true; } - if (node.kind === 169 /* SyntaxKind.MethodDeclaration */) { - if (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (node.kind === 171 /* SyntaxKind.MethodDeclaration */) { + if (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // We only disallow modifier on a method declaration if it is a property of object-literal-expression - if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 131 /* SyntaxKind.AsyncKeyword */)) { + if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 132 /* SyntaxKind.AsyncKeyword */)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } else if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { @@ -89915,14 +90485,14 @@ var ts; if (node.flags & 16777216 /* NodeFlags.Ambient */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.kind === 169 /* SyntaxKind.MethodDeclaration */ && !node.body) { + else if (node.kind === 171 /* SyntaxKind.MethodDeclaration */ && !node.body) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } - else if (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + else if (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.parent.kind === 182 /* SyntaxKind.TypeLiteral */) { + else if (node.parent.kind === 184 /* SyntaxKind.TypeLiteral */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } @@ -89933,11 +90503,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: if (node.label && current.label.escapedText === node.label.escapedText) { // found matching label - verify that label usage is correct // continue can only target labels that are on iteration statements - var isMisplacedContinueLabel = node.kind === 245 /* SyntaxKind.ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 248 /* SyntaxKind.ContinueStatement */ && !ts.isIterationStatement(current.statement, /*lookInLabeledStatement*/ true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -89945,8 +90515,8 @@ var ts; return false; } break; - case 249 /* SyntaxKind.SwitchStatement */: - if (node.kind === 246 /* SyntaxKind.BreakStatement */ && !node.label) { + case 252 /* SyntaxKind.SwitchStatement */: + if (node.kind === 249 /* SyntaxKind.BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -89961,13 +90531,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 246 /* SyntaxKind.BreakStatement */ + var message = node.kind === 249 /* SyntaxKind.BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 246 /* SyntaxKind.BreakStatement */ + var message = node.kind === 249 /* SyntaxKind.BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -89991,12 +90561,12 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return ts.isStringOrNumericLiteralLike(expr) || - expr.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && + expr.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 8 /* SyntaxKind.NumericLiteral */; } function isBigIntLiteralExpression(expr) { return expr.kind === 9 /* SyntaxKind.BigIntLiteral */ || - expr.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && + expr.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 9 /* SyntaxKind.BigIntLiteral */; } function isSimpleLiteralEnumReference(expr) { @@ -90024,7 +90594,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */ && node.parent.parent.kind !== 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */ && node.parent.parent.kind !== 247 /* SyntaxKind.ForOfStatement */) { if (node.flags & 16777216 /* NodeFlags.Ambient */) { checkAmbientInitializer(node); } @@ -90037,7 +90607,7 @@ var ts; } } } - if (node.exclamationToken && (node.parent.parent.kind !== 237 /* SyntaxKind.VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* NodeFlags.Ambient */)) { + if (node.exclamationToken && (node.parent.parent.kind !== 240 /* SyntaxKind.VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* NodeFlags.Ambient */)) { var message = node.initializer ? ts.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type @@ -90104,15 +90674,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return false; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -90206,8 +90776,14 @@ var ts; if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isPrivateIdentifier(node.name)) { return grammarErrorOnNode(node.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } + if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isAutoAccessorPropertyDeclaration(node)) { + return grammarErrorOnNode(node.name, ts.Diagnostics.Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher); + } + if (ts.isAutoAccessorPropertyDeclaration(node) && checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_accessor_property_cannot_be_declared_optional)) { + return true; + } } - else if (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + else if (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) { return true; } @@ -90253,14 +90829,14 @@ var ts; // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */ || - node.kind === 266 /* SyntaxKind.ImportDeclaration */ || - node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ || - node.kind === 272 /* SyntaxKind.ExportDeclaration */ || - node.kind === 271 /* SyntaxKind.ExportAssignment */ || - node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ || - ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */ | 1 /* ModifierFlags.Export */ | 512 /* ModifierFlags.Default */)) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */ || + node.kind === 269 /* SyntaxKind.ImportDeclaration */ || + node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ || + node.kind === 275 /* SyntaxKind.ExportDeclaration */ || + node.kind === 274 /* SyntaxKind.ExportAssignment */ || + node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ || + ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */ | 1 /* ModifierFlags.Export */ | 1024 /* ModifierFlags.Default */)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier); @@ -90268,7 +90844,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 237 /* SyntaxKind.VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 240 /* SyntaxKind.VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -90291,7 +90867,7 @@ var ts; // to prevent noisiness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 235 /* SyntaxKind.Block */ || node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.parent.kind === 238 /* SyntaxKind.Block */ || node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { var links_2 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_2.hasReportedStatementInAmbientContext) { @@ -90313,10 +90889,10 @@ var ts; if (languageVersion >= 1 /* ScriptTarget.ES5 */) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 196 /* SyntaxKind.LiteralType */)) { + else if (ts.isChildOfNodeWithKind(node, 198 /* SyntaxKind.LiteralType */)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 299 /* SyntaxKind.EnumMember */)) { + else if (ts.isChildOfNodeWithKind(node, 302 /* SyntaxKind.EnumMember */)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -90388,7 +90964,7 @@ var ts; if (node.isTypeOnly && node.name && node.namedBindings) { return grammarErrorOnNode(node, ts.Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both); } - if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 269 /* SyntaxKind.NamedImports */) { + if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 272 /* SyntaxKind.NamedImports */) { return checkGrammarNamedImportsOrExports(node.namedBindings); } return false; @@ -90396,7 +90972,7 @@ var ts; function checkGrammarNamedImportsOrExports(namedBindings) { return !!ts.forEach(namedBindings.elements, function (specifier) { if (specifier.isTypeOnly) { - return grammarErrorOnFirstToken(specifier, specifier.kind === 270 /* SyntaxKind.ImportSpecifier */ + return grammarErrorOnFirstToken(specifier, specifier.kind === 273 /* SyntaxKind.ImportSpecifier */ ? ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement : ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement); } @@ -90410,7 +90986,7 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments); } var nodeArguments = node.arguments; - if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext) { + if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext && moduleKind !== ts.ModuleKind.Node16) { // We are allowed trailing comma after proposal-import-assertions. checkGrammarForDisallowedTrailingComma(nodeArguments); if (nodeArguments.length > 1) { @@ -90519,14 +91095,14 @@ var ts; return !ts.isAccessor(declaration); } function isNotOverload(declaration) { - return (declaration.kind !== 256 /* SyntaxKind.FunctionDeclaration */ && declaration.kind !== 169 /* SyntaxKind.MethodDeclaration */) || + return (declaration.kind !== 259 /* SyntaxKind.FunctionDeclaration */ && declaration.kind !== 171 /* SyntaxKind.MethodDeclaration */) || !!declaration.body; } /** Like 'isDeclarationName', but returns true for LHS of `import { x as y }` or `export { x as y }`. */ function isDeclarationNameOrImportPropertyName(name) { switch (name.parent.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return ts.isIdentifier(name); default: return ts.isDeclarationName(name); @@ -90562,6 +91138,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { + var _a; function visitNode(node, visitor, test, lift) { if (node === undefined || visitor === undefined) { return node; @@ -90628,7 +91205,6 @@ var ts; return nodes; } ts.visitNodes = visitNodes; - /* @internal */ function visitArray(nodes, visitor, test, start, count) { if (nodes === undefined) { return nodes; @@ -90776,12 +91352,10 @@ var ts; return updated; } ts.visitFunctionBody = visitFunctionBody; - /** - * Visits an iteration body, adding any block-scoped variables required by the transformation. - */ - function visitIterationBody(body, visitor, context) { + function visitIterationBody(body, visitor, context, nodeVisitor) { + if (nodeVisitor === void 0) { nodeVisitor = visitNode; } context.startBlockScope(); - var updated = visitNode(body, visitor, ts.isStatement, context.factory.liftToBlock); + var updated = nodeVisitor(body, visitor, ts.isStatement, context.factory.liftToBlock); var declarations = context.endBlockScope(); if (ts.some(declarations)) { if (ts.isBlock(updated)) { @@ -90800,456 +91374,446 @@ var ts; if (node === undefined) { return undefined; } - var kind = node.kind; - // No need to visit nodes with no children. - if ((kind > 0 /* SyntaxKind.FirstToken */ && kind <= 160 /* SyntaxKind.LastToken */) || kind === 192 /* SyntaxKind.ThisType */) { - return node; - } - var factory = context.factory; - switch (kind) { - // Names - case 79 /* SyntaxKind.Identifier */: - ts.Debug.type(node); - return factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration)); - case 161 /* SyntaxKind.QualifiedName */: - ts.Debug.type(node); - return factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier)); - case 162 /* SyntaxKind.ComputedPropertyName */: - ts.Debug.type(node); - return factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Signature elements - case 163 /* SyntaxKind.TypeParameter */: - ts.Debug.type(node); - return factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode)); - case 164 /* SyntaxKind.Parameter */: - ts.Debug.type(node); - return factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 165 /* SyntaxKind.Decorator */: - ts.Debug.type(node); - return factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Type elements - case 166 /* SyntaxKind.PropertySignature */: - ts.Debug.type(node); - return factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 167 /* SyntaxKind.PropertyDeclaration */: - ts.Debug.type(node); - return factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), - // QuestionToken and ExclamationToken is uniqued in Property Declaration and the signature of 'updateProperty' is that too - nodeVisitor(node.questionToken || node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 168 /* SyntaxKind.MethodSignature */: - ts.Debug.type(node); - return factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 169 /* SyntaxKind.MethodDeclaration */: - ts.Debug.type(node); - return factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 171 /* SyntaxKind.Constructor */: - ts.Debug.type(node); - return factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 172 /* SyntaxKind.GetAccessor */: - ts.Debug.type(node); - return factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 173 /* SyntaxKind.SetAccessor */: - ts.Debug.type(node); - return factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - ts.Debug.type(node); - context.startLexicalEnvironment(); - context.suspendLexicalEnvironment(); - return factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 174 /* SyntaxKind.CallSignature */: - ts.Debug.type(node); - return factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 175 /* SyntaxKind.ConstructSignature */: - ts.Debug.type(node); - return factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 176 /* SyntaxKind.IndexSignature */: - ts.Debug.type(node); - return factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - // Types - case 177 /* SyntaxKind.TypePredicate */: - ts.Debug.type(node); - return factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 178 /* SyntaxKind.TypeReference */: - ts.Debug.type(node); - return factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 179 /* SyntaxKind.FunctionType */: - ts.Debug.type(node); - return factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 180 /* SyntaxKind.ConstructorType */: - ts.Debug.type(node); - return factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 181 /* SyntaxKind.TypeQuery */: - ts.Debug.type(node); - return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 182 /* SyntaxKind.TypeLiteral */: - ts.Debug.type(node); - return factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 183 /* SyntaxKind.ArrayType */: - ts.Debug.type(node); - return factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode)); - case 184 /* SyntaxKind.TupleType */: - ts.Debug.type(node); - return factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode)); - case 185 /* SyntaxKind.OptionalType */: - ts.Debug.type(node); - return factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 186 /* SyntaxKind.RestType */: - ts.Debug.type(node); - return factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 187 /* SyntaxKind.UnionType */: - ts.Debug.type(node); - return factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 188 /* SyntaxKind.IntersectionType */: - ts.Debug.type(node); - return factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 189 /* SyntaxKind.ConditionalType */: - ts.Debug.type(node); - return factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode)); - case 190 /* SyntaxKind.InferType */: - ts.Debug.type(node); - return factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); - case 200 /* SyntaxKind.ImportType */: - ts.Debug.type(node); - return factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isNode), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); - case 295 /* SyntaxKind.ImportTypeAssertionContainer */: - ts.Debug.type(node); - return factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isNode), node.multiLine); - case 197 /* SyntaxKind.NamedTupleMember */: - ts.Debug.type(node); - return factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 191 /* SyntaxKind.ParenthesizedType */: - ts.Debug.type(node); - return factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 193 /* SyntaxKind.TypeOperator */: - ts.Debug.type(node); - return factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 194 /* SyntaxKind.IndexedAccessType */: - ts.Debug.type(node); - return factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode)); - case 195 /* SyntaxKind.MappedType */: - ts.Debug.type(node); - return factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 196 /* SyntaxKind.LiteralType */: - ts.Debug.type(node); - return factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression)); - case 198 /* SyntaxKind.TemplateLiteralType */: - ts.Debug.type(node); - return factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan)); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: - ts.Debug.type(node); - return factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - // Binding patterns - case 201 /* SyntaxKind.ObjectBindingPattern */: - ts.Debug.type(node); - return factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); - case 202 /* SyntaxKind.ArrayBindingPattern */: - ts.Debug.type(node); - return factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); - case 203 /* SyntaxKind.BindingElement */: - ts.Debug.type(node); - return factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - // Expression - case 204 /* SyntaxKind.ArrayLiteralExpression */: - ts.Debug.type(node); - return factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - case 205 /* SyntaxKind.ObjectLiteralExpression */: - ts.Debug.type(node); - return factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); - case 206 /* SyntaxKind.PropertyAccessExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName)); - } - ts.Debug.type(node); - return factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName)); - case 207 /* SyntaxKind.ElementAccessExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); - case 208 /* SyntaxKind.CallExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 209 /* SyntaxKind.NewExpression */: - ts.Debug.type(node); - return factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - ts.Debug.type(node); - return factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral)); - case 211 /* SyntaxKind.TypeAssertionExpression */: - ts.Debug.type(node); - return factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 212 /* SyntaxKind.ParenthesizedExpression */: - ts.Debug.type(node); - return factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 213 /* SyntaxKind.FunctionExpression */: - ts.Debug.type(node); - return factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 214 /* SyntaxKind.ArrowFunction */: - ts.Debug.type(node); - return factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 215 /* SyntaxKind.DeleteExpression */: - ts.Debug.type(node); - return factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 216 /* SyntaxKind.TypeOfExpression */: - ts.Debug.type(node); - return factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 217 /* SyntaxKind.VoidExpression */: - ts.Debug.type(node); - return factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 218 /* SyntaxKind.AwaitExpression */: - ts.Debug.type(node); - return factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - ts.Debug.type(node); - return factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - ts.Debug.type(node); - return factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); - case 221 /* SyntaxKind.BinaryExpression */: - ts.Debug.type(node); - return factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression)); - case 222 /* SyntaxKind.ConditionalExpression */: - ts.Debug.type(node); - return factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression)); - case 223 /* SyntaxKind.TemplateExpression */: - ts.Debug.type(node); - return factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); - case 224 /* SyntaxKind.YieldExpression */: - ts.Debug.type(node); - return factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 225 /* SyntaxKind.SpreadElement */: - ts.Debug.type(node); - return factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 226 /* SyntaxKind.ClassExpression */: - ts.Debug.type(node); - return factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - ts.Debug.type(node); - return factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 229 /* SyntaxKind.AsExpression */: - ts.Debug.type(node); - return factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 230 /* SyntaxKind.NonNullExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 231 /* SyntaxKind.MetaProperty */: - ts.Debug.type(node); - return factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - // Misc - case 233 /* SyntaxKind.TemplateSpan */: - ts.Debug.type(node); - return factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - // Element - case 235 /* SyntaxKind.Block */: - ts.Debug.type(node); - return factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 237 /* SyntaxKind.VariableStatement */: - ts.Debug.type(node); - return factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 238 /* SyntaxKind.ExpressionStatement */: - ts.Debug.type(node); - return factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 239 /* SyntaxKind.IfStatement */: - ts.Debug.type(node); - return factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, factory.liftToBlock)); - case 240 /* SyntaxKind.DoStatement */: - ts.Debug.type(node); - return factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 241 /* SyntaxKind.WhileStatement */: - ts.Debug.type(node); - return factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 242 /* SyntaxKind.ForStatement */: - ts.Debug.type(node); - return factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 243 /* SyntaxKind.ForInStatement */: - ts.Debug.type(node); - return factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 244 /* SyntaxKind.ForOfStatement */: - ts.Debug.type(node); - return factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 245 /* SyntaxKind.ContinueStatement */: - ts.Debug.type(node); - return factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); - case 246 /* SyntaxKind.BreakStatement */: - ts.Debug.type(node); - return factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); - case 247 /* SyntaxKind.ReturnStatement */: - ts.Debug.type(node); - return factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 248 /* SyntaxKind.WithStatement */: - ts.Debug.type(node); - return factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock)); - case 249 /* SyntaxKind.SwitchStatement */: - ts.Debug.type(node); - return factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock)); - case 250 /* SyntaxKind.LabeledStatement */: - ts.Debug.type(node); - return factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock)); - case 251 /* SyntaxKind.ThrowStatement */: - ts.Debug.type(node); - return factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 252 /* SyntaxKind.TryStatement */: - ts.Debug.type(node); - return factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock)); - case 254 /* SyntaxKind.VariableDeclaration */: - ts.Debug.type(node); - return factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 255 /* SyntaxKind.VariableDeclarationList */: - ts.Debug.type(node); - return factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); - case 256 /* SyntaxKind.FunctionDeclaration */: - ts.Debug.type(node); - return factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 257 /* SyntaxKind.ClassDeclaration */: - ts.Debug.type(node); - return factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 258 /* SyntaxKind.InterfaceDeclaration */: - ts.Debug.type(node); - return factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 259 /* SyntaxKind.TypeAliasDeclaration */: - ts.Debug.type(node); - return factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 260 /* SyntaxKind.EnumDeclaration */: - ts.Debug.type(node); - return factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); - case 261 /* SyntaxKind.ModuleDeclaration */: - ts.Debug.type(node); - return factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody)); - case 262 /* SyntaxKind.ModuleBlock */: - ts.Debug.type(node); - return factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 263 /* SyntaxKind.CaseBlock */: - ts.Debug.type(node); - return factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - ts.Debug.type(node); - return factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - ts.Debug.type(node); - return factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference)); - case 266 /* SyntaxKind.ImportDeclaration */: - ts.Debug.type(node); - return factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); - case 293 /* SyntaxKind.AssertClause */: - ts.Debug.type(node); - return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine); - case 294 /* SyntaxKind.AssertEntry */: - ts.Debug.type(node); - return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode)); - case 267 /* SyntaxKind.ImportClause */: - ts.Debug.type(node); - return factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings)); - case 268 /* SyntaxKind.NamespaceImport */: - ts.Debug.type(node); - return factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 274 /* SyntaxKind.NamespaceExport */: - ts.Debug.type(node); - return factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 269 /* SyntaxKind.NamedImports */: - ts.Debug.type(node); - return factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); - case 270 /* SyntaxKind.ImportSpecifier */: - ts.Debug.type(node); - return factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 271 /* SyntaxKind.ExportAssignment */: - ts.Debug.type(node); - return factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 272 /* SyntaxKind.ExportDeclaration */: - ts.Debug.type(node); - return factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); - case 273 /* SyntaxKind.NamedExports */: - ts.Debug.type(node); - return factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); - case 275 /* SyntaxKind.ExportSpecifier */: - ts.Debug.type(node); - return factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); - // Module references - case 277 /* SyntaxKind.ExternalModuleReference */: - ts.Debug.type(node); - return factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // JSX - case 278 /* SyntaxKind.JsxElement */: - ts.Debug.type(node); - return factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement)); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - ts.Debug.type(node); - return factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); - case 280 /* SyntaxKind.JsxOpeningElement */: - ts.Debug.type(node); - return factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); - case 281 /* SyntaxKind.JsxClosingElement */: - ts.Debug.type(node); - return factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 282 /* SyntaxKind.JsxFragment */: - ts.Debug.type(node); - return factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment)); - case 285 /* SyntaxKind.JsxAttribute */: - ts.Debug.type(node); - return factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 286 /* SyntaxKind.JsxAttributes */: - ts.Debug.type(node); - return factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); - case 287 /* SyntaxKind.JsxSpreadAttribute */: - ts.Debug.type(node); - return factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 288 /* SyntaxKind.JsxExpression */: - ts.Debug.type(node); - return factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Clauses - case 289 /* SyntaxKind.CaseClause */: - ts.Debug.type(node); - return factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); - case 290 /* SyntaxKind.DefaultClause */: - ts.Debug.type(node); - return factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 291 /* SyntaxKind.HeritageClause */: - ts.Debug.type(node); - return factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 292 /* SyntaxKind.CatchClause */: - ts.Debug.type(node); - return factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock)); - // Property assignments - case 296 /* SyntaxKind.PropertyAssignment */: - ts.Debug.type(node); - return factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - ts.Debug.type(node); - return factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 298 /* SyntaxKind.SpreadAssignment */: - ts.Debug.type(node); - return factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Enum - case 299 /* SyntaxKind.EnumMember */: - ts.Debug.type(node); - return factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - // Top-level nodes - case 305 /* SyntaxKind.SourceFile */: - ts.Debug.type(node); - return factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context)); - // Transformation nodes - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - ts.Debug.type(node); - return factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 351 /* SyntaxKind.CommaListExpression */: - ts.Debug.type(node); - return factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - default: - // No need to visit nodes with no children. - return node; - } + var fn = visitEachChildTable[node.kind]; + return fn === undefined ? node : fn(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor); } ts.visitEachChild = visitEachChild; + // NOTE: Before you can add a new method to `visitEachChildTable`, you must first ensure the `Node` subtype you + // wish to add is defined in the `HasChildren` union in types.ts. + var visitEachChildTable = (_a = {}, + _a[79 /* SyntaxKind.Identifier */] = function visitEachChildOfIdentifier(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration)); + }, + _a[163 /* SyntaxKind.QualifiedName */] = function visitEachChildOfQualifiedName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier)); + }, + _a[164 /* SyntaxKind.ComputedPropertyName */] = function visitEachChildOfComputedPropertyName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Signature elements + _a[165 /* SyntaxKind.TypeParameter */] = function visitEachChildOfTypeParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode)); + }, + _a[166 /* SyntaxKind.Parameter */] = function visitEachChildOfParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[167 /* SyntaxKind.Decorator */] = function visitEachChildOfDecorator(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Type elements + _a[168 /* SyntaxKind.PropertySignature */] = function visitEachChildOfPropertySignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[169 /* SyntaxKind.PropertyDeclaration */] = function visitEachChildOfPropertyDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + var _a; + return context.factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), + // QuestionToken and ExclamationToken are mutually exclusive in PropertyDeclaration + nodeVisitor((_a = node.questionToken) !== null && _a !== void 0 ? _a : node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[170 /* SyntaxKind.MethodSignature */] = function visitEachChildOfMethodSignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[171 /* SyntaxKind.MethodDeclaration */] = function visitEachChildOfMethodDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[173 /* SyntaxKind.Constructor */] = function visitEachChildOfConstructorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[174 /* SyntaxKind.GetAccessor */] = function visitEachChildOfGetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[175 /* SyntaxKind.SetAccessor */] = function visitEachChildOfSetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[172 /* SyntaxKind.ClassStaticBlockDeclaration */] = function visitEachChildOfClassStaticBlockDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + context.startLexicalEnvironment(); + context.suspendLexicalEnvironment(); + return context.factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[176 /* SyntaxKind.CallSignature */] = function visitEachChildOfCallSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[177 /* SyntaxKind.ConstructSignature */] = function visitEachChildOfConstructSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[178 /* SyntaxKind.IndexSignature */] = function visitEachChildOfIndexSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + // Types + _a[179 /* SyntaxKind.TypePredicate */] = function visitEachChildOfTypePredicateNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[180 /* SyntaxKind.TypeReference */] = function visitEachChildOfTypeReferenceNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[181 /* SyntaxKind.FunctionType */] = function visitEachChildOfFunctionTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[182 /* SyntaxKind.ConstructorType */] = function visitEachChildOfConstructorTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[183 /* SyntaxKind.TypeQuery */] = function visitEachChildOfTypeQueryNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[184 /* SyntaxKind.TypeLiteral */] = function visitEachChildOfTypeLiteralNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[185 /* SyntaxKind.ArrayType */] = function visitEachChildOfArrayTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode)); + }, + _a[186 /* SyntaxKind.TupleType */] = function visitEachChildOfTupleTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode)); + }, + _a[187 /* SyntaxKind.OptionalType */] = function visitEachChildOfOptionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[188 /* SyntaxKind.RestType */] = function visitEachChildOfRestTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[189 /* SyntaxKind.UnionType */] = function visitEachChildOfUnionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + }, + _a[190 /* SyntaxKind.IntersectionType */] = function visitEachChildOfIntersectionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + }, + _a[191 /* SyntaxKind.ConditionalType */] = function visitEachChildOfConditionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode)); + }, + _a[192 /* SyntaxKind.InferType */] = function visitEachChildOfInferTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); + }, + _a[202 /* SyntaxKind.ImportType */] = function visitEachChildOfImportTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isImportTypeAssertionContainer), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); + }, + _a[298 /* SyntaxKind.ImportTypeAssertionContainer */] = function visitEachChildOfImportTypeAssertionContainer(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isAssertClause), node.multiLine); + }, + _a[199 /* SyntaxKind.NamedTupleMember */] = function visitEachChildOfNamedTupleMember(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[193 /* SyntaxKind.ParenthesizedType */] = function visitEachChildOfParenthesizedType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[195 /* SyntaxKind.TypeOperator */] = function visitEachChildOfTypeOperatorNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[196 /* SyntaxKind.IndexedAccessType */] = function visitEachChildOfIndexedAccessType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode)); + }, + _a[197 /* SyntaxKind.MappedType */] = function visitEachChildOfMappedType(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[198 /* SyntaxKind.LiteralType */] = function visitEachChildOfLiteralTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression)); + }, + _a[200 /* SyntaxKind.TemplateLiteralType */] = function visitEachChildOfTemplateLiteralType(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan)); + }, + _a[201 /* SyntaxKind.TemplateLiteralTypeSpan */] = function visitEachChildOfTemplateLiteralTypeSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + }, + // Binding patterns + _a[203 /* SyntaxKind.ObjectBindingPattern */] = function visitEachChildOfObjectBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); + }, + _a[204 /* SyntaxKind.ArrayBindingPattern */] = function visitEachChildOfArrayBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); + }, + _a[205 /* SyntaxKind.BindingElement */] = function visitEachChildOfBindingElement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + // Expression + _a[206 /* SyntaxKind.ArrayLiteralExpression */] = function visitEachChildOfArrayLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + }, + _a[207 /* SyntaxKind.ObjectLiteralExpression */] = function visitEachChildOfObjectLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); + }, + _a[208 /* SyntaxKind.PropertyAccessExpression */] = function visitEachChildOfPropertyAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isPropertyAccessChain(node) ? + context.factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName)) : + context.factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName)); + }, + _a[209 /* SyntaxKind.ElementAccessExpression */] = function visitEachChildOfElementAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isElementAccessChain(node) ? + context.factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)) : + context.factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); + }, + _a[210 /* SyntaxKind.CallExpression */] = function visitEachChildOfCallExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isCallChain(node) ? + context.factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)) : + context.factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + }, + _a[211 /* SyntaxKind.NewExpression */] = function visitEachChildOfNewExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + }, + _a[212 /* SyntaxKind.TaggedTemplateExpression */] = function visitEachChildOfTaggedTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral)); + }, + _a[213 /* SyntaxKind.TypeAssertionExpression */] = function visitEachChildOfTypeAssertionExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[214 /* SyntaxKind.ParenthesizedExpression */] = function visitEachChildOfParenthesizedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[215 /* SyntaxKind.FunctionExpression */] = function visitEachChildOfFunctionExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[216 /* SyntaxKind.ArrowFunction */] = function visitEachChildOfArrowFunction(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[217 /* SyntaxKind.DeleteExpression */] = function visitEachChildOfDeleteExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[218 /* SyntaxKind.TypeOfExpression */] = function visitEachChildOfTypeOfExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[219 /* SyntaxKind.VoidExpression */] = function visitEachChildOfVoidExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[220 /* SyntaxKind.AwaitExpression */] = function visitEachChildOfAwaitExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[221 /* SyntaxKind.PrefixUnaryExpression */] = function visitEachChildOfPrefixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); + }, + _a[222 /* SyntaxKind.PostfixUnaryExpression */] = function visitEachChildOfPostfixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); + }, + _a[223 /* SyntaxKind.BinaryExpression */] = function visitEachChildOfBinaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression)); + }, + _a[224 /* SyntaxKind.ConditionalExpression */] = function visitEachChildOfConditionalExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression)); + }, + _a[225 /* SyntaxKind.TemplateExpression */] = function visitEachChildOfTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); + }, + _a[226 /* SyntaxKind.YieldExpression */] = function visitEachChildOfYieldExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[227 /* SyntaxKind.SpreadElement */] = function visitEachChildOfSpreadElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[228 /* SyntaxKind.ClassExpression */] = function visitEachChildOfClassExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + }, + _a[230 /* SyntaxKind.ExpressionWithTypeArguments */] = function visitEachChildOfExpressionWithTypeArguments(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[231 /* SyntaxKind.AsExpression */] = function visitEachChildOfAsExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[235 /* SyntaxKind.SatisfiesExpression */] = function visitEachChildOfSatisfiesExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSatisfiesExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[232 /* SyntaxKind.NonNullExpression */] = function visitEachChildOfNonNullExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return ts.isOptionalChain(node) ? + context.factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression)) : + context.factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[233 /* SyntaxKind.MetaProperty */] = function visitEachChildOfMetaProperty(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + // Misc + _a[236 /* SyntaxKind.TemplateSpan */] = function visitEachChildOfTemplateSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + }, + // Element + _a[238 /* SyntaxKind.Block */] = function visitEachChildOfBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[240 /* SyntaxKind.VariableStatement */] = function visitEachChildOfVariableStatement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList)); + }, + _a[241 /* SyntaxKind.ExpressionStatement */] = function visitEachChildOfExpressionStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[242 /* SyntaxKind.IfStatement */] = function visitEachChildOfIfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, context.factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[243 /* SyntaxKind.DoStatement */] = function visitEachChildOfDoStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context, nodeVisitor), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[244 /* SyntaxKind.WhileStatement */] = function visitEachChildOfWhileStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[245 /* SyntaxKind.ForStatement */] = function visitEachChildOfForStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[246 /* SyntaxKind.ForInStatement */] = function visitEachChildOfForInStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[247 /* SyntaxKind.ForOfStatement */] = function visitEachChildOfForOfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[248 /* SyntaxKind.ContinueStatement */] = function visitEachChildOfContinueStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); + }, + _a[249 /* SyntaxKind.BreakStatement */] = function visitEachChildOfBreakStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); + }, + _a[250 /* SyntaxKind.ReturnStatement */] = function visitEachChildOfReturnStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[251 /* SyntaxKind.WithStatement */] = function visitEachChildOfWithStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[252 /* SyntaxKind.SwitchStatement */] = function visitEachChildOfSwitchStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock)); + }, + _a[253 /* SyntaxKind.LabeledStatement */] = function visitEachChildOfLabeledStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[254 /* SyntaxKind.ThrowStatement */] = function visitEachChildOfThrowStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[255 /* SyntaxKind.TryStatement */] = function visitEachChildOfTryStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock)); + }, + _a[257 /* SyntaxKind.VariableDeclaration */] = function visitEachChildOfVariableDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[258 /* SyntaxKind.VariableDeclarationList */] = function visitEachChildOfVariableDeclarationList(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); + }, + _a[259 /* SyntaxKind.FunctionDeclaration */] = function visitEachChildOfFunctionDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[260 /* SyntaxKind.ClassDeclaration */] = function visitEachChildOfClassDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + }, + _a[261 /* SyntaxKind.InterfaceDeclaration */] = function visitEachChildOfInterfaceDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[262 /* SyntaxKind.TypeAliasDeclaration */] = function visitEachChildOfTypeAliasDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[263 /* SyntaxKind.EnumDeclaration */] = function visitEachChildOfEnumDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); + }, + _a[264 /* SyntaxKind.ModuleDeclaration */] = function visitEachChildOfModuleDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody)); + }, + _a[265 /* SyntaxKind.ModuleBlock */] = function visitEachChildOfModuleBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[266 /* SyntaxKind.CaseBlock */] = function visitEachChildOfCaseBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); + }, + _a[267 /* SyntaxKind.NamespaceExportDeclaration */] = function visitEachChildOfNamespaceExportDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[268 /* SyntaxKind.ImportEqualsDeclaration */] = function visitEachChildOfImportEqualsDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference)); + }, + _a[269 /* SyntaxKind.ImportDeclaration */] = function visitEachChildOfImportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); + }, + _a[296 /* SyntaxKind.AssertClause */] = function visitEachChildOfAssertClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine); + }, + _a[297 /* SyntaxKind.AssertEntry */] = function visitEachChildOfAssertEntry(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpression)); + }, + _a[270 /* SyntaxKind.ImportClause */] = function visitEachChildOfImportClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings)); + }, + _a[271 /* SyntaxKind.NamespaceImport */] = function visitEachChildOfNamespaceImport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[277 /* SyntaxKind.NamespaceExport */] = function visitEachChildOfNamespaceExport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[272 /* SyntaxKind.NamedImports */] = function visitEachChildOfNamedImports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); + }, + _a[273 /* SyntaxKind.ImportSpecifier */] = function visitEachChildOfImportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[274 /* SyntaxKind.ExportAssignment */] = function visitEachChildOfExportAssignment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[275 /* SyntaxKind.ExportDeclaration */] = function visitEachChildOfExportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); + }, + _a[276 /* SyntaxKind.NamedExports */] = function visitEachChildOfNamedExports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); + }, + _a[278 /* SyntaxKind.ExportSpecifier */] = function visitEachChildOfExportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + // Module references + _a[280 /* SyntaxKind.ExternalModuleReference */] = function visitEachChildOfExternalModuleReference(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // JSX + _a[281 /* SyntaxKind.JsxElement */] = function visitEachChildOfJsxElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement)); + }, + _a[282 /* SyntaxKind.JsxSelfClosingElement */] = function visitEachChildOfJsxSelfClosingElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); + }, + _a[283 /* SyntaxKind.JsxOpeningElement */] = function visitEachChildOfJsxOpeningElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); + }, + _a[284 /* SyntaxKind.JsxClosingElement */] = function visitEachChildOfJsxClosingElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression)); + }, + _a[285 /* SyntaxKind.JsxFragment */] = function visitEachChildOfJsxFragment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment)); + }, + _a[288 /* SyntaxKind.JsxAttribute */] = function visitEachChildOfJsxAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); + }, + _a[289 /* SyntaxKind.JsxAttributes */] = function visitEachChildOfJsxAttributes(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); + }, + _a[290 /* SyntaxKind.JsxSpreadAttribute */] = function visitEachChildOfJsxSpreadAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[291 /* SyntaxKind.JsxExpression */] = function visitEachChildOfJsxExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Clauses + _a[292 /* SyntaxKind.CaseClause */] = function visitEachChildOfCaseClause(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[293 /* SyntaxKind.DefaultClause */] = function visitEachChildOfDefaultClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[294 /* SyntaxKind.HeritageClause */] = function visitEachChildOfHeritageClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); + }, + _a[295 /* SyntaxKind.CatchClause */] = function visitEachChildOfCatchClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock)); + }, + // Property assignments + _a[299 /* SyntaxKind.PropertyAssignment */] = function visitEachChildOfPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[300 /* SyntaxKind.ShorthandPropertyAssignment */] = function visitEachChildOfShorthandPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression)); + }, + _a[301 /* SyntaxKind.SpreadAssignment */] = function visitEachChildOfSpreadAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Enum + _a[302 /* SyntaxKind.EnumMember */] = function visitEachChildOfEnumMember(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + // Top-level nodes + _a[308 /* SyntaxKind.SourceFile */] = function visitEachChildOfSourceFile(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context, /*start*/ undefined, /*ensureUseStrict*/ undefined, nodesVisitor)); + }, + // Transformation nodes + _a[353 /* SyntaxKind.PartiallyEmittedExpression */] = function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[354 /* SyntaxKind.CommaListExpression */] = function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + }, + _a); /** * Extracts the single node from a NodeArray. * @@ -91317,7 +91881,7 @@ var ts; exit(); return sourceIndex; } - /* eslint-disable boolean-trivia, no-null/no-null */ + /* eslint-disable local/boolean-trivia, no-null/no-null */ function setSourceContent(sourceIndex, content) { enter(); if (content !== null) { @@ -91330,7 +91894,7 @@ var ts; } exit(); } - /* eslint-enable boolean-trivia, no-null/no-null */ + /* eslint-enable local/boolean-trivia, no-null/no-null */ function addName(name) { enter(); if (!nameToNameIndexMap) @@ -91932,7 +92496,7 @@ var ts; function chainBundle(context, transformSourceFile) { return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -91983,7 +92547,7 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: // import "mod" // import x from "mod" // import * as x from "mod" @@ -91996,13 +92560,13 @@ var ts; hasImportDefault = true; } break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - if (node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + if (node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { // import x = require("mod") externalImports.push(node); } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -92033,13 +92597,13 @@ var ts; addExportedNamesForExportDeclaration(node); } break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; } break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { for (var _b = 0, _c = node.declarationList.declarations; _b < _c.length; _b++) { var decl = _c[_b]; @@ -92047,9 +92611,9 @@ var ts; } } break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - if (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { // export default function() { } if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); @@ -92067,9 +92631,9 @@ var ts; } } break; - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - if (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { // export default class { } if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); @@ -92247,7 +92811,7 @@ var ts; * @param isStatic A value indicating whether the member should be a static or instance member. */ function isInitializedProperty(member) { - return member.kind === 167 /* SyntaxKind.PropertyDeclaration */ + return member.kind === 169 /* SyntaxKind.PropertyDeclaration */ && member.initializer !== undefined; } ts.isInitializedProperty = isInitializedProperty; @@ -92257,7 +92821,7 @@ var ts; * @param member The class element node. */ function isNonStaticMethodOrAccessorWithPrivateName(member) { - return !ts.isStatic(member) && ts.isMethodOrAccessor(member) && ts.isPrivateIdentifier(member.name); + return !ts.isStatic(member) && (ts.isMethodOrAccessor(member) || ts.isAutoAccessorPropertyDeclaration(member)) && ts.isPrivateIdentifier(member.name); } ts.isNonStaticMethodOrAccessorWithPrivateName = isNonStaticMethodOrAccessorWithPrivateName; /** @@ -92311,12 +92875,12 @@ var ts; */ function getAllDecoratorsOfClassElement(member, parent) { switch (member.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return getAllDecoratorsOfAccessors(member, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return getAllDecoratorsOfMethod(member); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return getAllDecoratorsOfProperty(member); default: return undefined; @@ -92977,8 +93541,8 @@ var ts; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; // Enable substitution for property/element access to emit const enum values. - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // These variables contain state that changes as we descend into the tree. var currentSourceFile; var currentNamespace; @@ -92998,14 +93562,14 @@ var ts; var applicableSubstitutions; return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - if (node.kind === 306 /* SyntaxKind.Bundle */) { + if (node.kind === 309 /* SyntaxKind.Bundle */) { return transformBundle(node); } return transformSourceFile(node); } function transformBundle(node) { return factory.createBundle(node.sourceFiles.map(transformSourceFile), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 308 /* SyntaxKind.InputFiles */) { + if (prepend.kind === 311 /* SyntaxKind.InputFiles */) { return ts.createUnparsedSourceFile(prepend, "js"); } return prepend; @@ -93054,15 +93618,15 @@ var ts; */ function onBeforeVisitNode(node) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 263 /* SyntaxKind.CaseBlock */: - case 262 /* SyntaxKind.ModuleBlock */: - case 235 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 266 /* SyntaxKind.CaseBlock */: + case 265 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: currentLexicalScope = node; currentScopeFirstDeclarationsOfName = undefined; break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */)) { break; } @@ -93074,7 +93638,7 @@ var ts; // These nodes should always have names unless they are default-exports; // however, class declaration parsing allows for undefined names, so syntactically invalid // programs may also have an undefined name. - ts.Debug.assert(node.kind === 257 /* SyntaxKind.ClassDeclaration */ || ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)); + ts.Debug.assert(node.kind === 260 /* SyntaxKind.ClassDeclaration */ || ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)); } break; } @@ -93113,10 +93677,10 @@ var ts; */ function sourceElementVisitorWorker(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitElidableStatement(node); default: return visitorWorker(node); @@ -93137,13 +93701,13 @@ var ts; return node; } switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); default: ts.Debug.fail("Unhandled ellided statement"); @@ -93163,11 +93727,11 @@ var ts; * @param node The node to visit. */ function namespaceElementVisitorWorker(node) { - if (node.kind === 272 /* SyntaxKind.ExportDeclaration */ || - node.kind === 266 /* SyntaxKind.ImportDeclaration */ || - node.kind === 267 /* SyntaxKind.ImportClause */ || - (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && - node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */)) { + if (node.kind === 275 /* SyntaxKind.ExportDeclaration */ || + node.kind === 269 /* SyntaxKind.ImportDeclaration */ || + node.kind === 270 /* SyntaxKind.ImportClause */ || + (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && + node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */)) { // do not emit ES6 imports and exports since they are illegal inside a namespace return undefined; } @@ -93191,27 +93755,27 @@ var ts; */ function classElementVisitorWorker(node, parent) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return visitConstructor(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // Property declarations are not TypeScript syntax, but they must be visited // for the decorator transformation. return visitPropertyDeclaration(node, parent); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node, parent); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node, parent); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return ts.visitEachChild(node, visitor, context); - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: return node; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Index signatures are elided return; default: @@ -93223,17 +93787,17 @@ var ts; } function objectLiteralElementVisitorWorker(node, parent) { switch (node.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return visitor(node); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node, parent); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node, parent); @@ -93244,7 +93808,7 @@ var ts; function modifierVisitor(node) { if (ts.isDecorator(node)) return undefined; - if (ts.modifierToFlag(node.kind) & 116958 /* ModifierFlags.TypeScriptModifier */) { + if (ts.modifierToFlag(node.kind) & 117086 /* ModifierFlags.TypeScriptModifier */) { return undefined; } else if (currentNamespace && node.kind === 93 /* SyntaxKind.ExportKeyword */) { @@ -93272,58 +93836,58 @@ var ts; case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: // TypeScript accessibility and readonly modifiers are elided // falls through - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 177 /* SyntaxKind.TypePredicate */: - case 163 /* SyntaxKind.TypeParameter */: - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: + case 187 /* SyntaxKind.OptionalType */: + case 188 /* SyntaxKind.RestType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 179 /* SyntaxKind.TypePredicate */: + case 165 /* SyntaxKind.TypeParameter */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 180 /* SyntaxKind.ConstructorType */: - case 179 /* SyntaxKind.FunctionType */: - case 181 /* SyntaxKind.TypeQuery */: - case 178 /* SyntaxKind.TypeReference */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 189 /* SyntaxKind.ConditionalType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 192 /* SyntaxKind.ThisType */: - case 193 /* SyntaxKind.TypeOperator */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 195 /* SyntaxKind.MappedType */: - case 196 /* SyntaxKind.LiteralType */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 182 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 183 /* SyntaxKind.TypeQuery */: + case 180 /* SyntaxKind.TypeReference */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 191 /* SyntaxKind.ConditionalType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 194 /* SyntaxKind.ThisType */: + case 195 /* SyntaxKind.TypeOperator */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 197 /* SyntaxKind.MappedType */: + case 198 /* SyntaxKind.LiteralType */: // TypeScript type nodes are elided. // falls through - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // TypeScript index signatures are elided. return undefined; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // TypeScript type-only declarations are elided. return factory.createNotEmittedStatement(node); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: // TypeScript namespace export declarations are elided. return undefined; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // TypeScript interfaces are elided, but some comments may be preserved. // See the implementation of `getLeadingComments` in comments.ts for more details. return factory.createNotEmittedStatement(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // This may be a class declaration with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -93333,7 +93897,7 @@ var ts; // - index signatures // - method overload signatures return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: // This may be a class expression with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -93343,34 +93907,34 @@ var ts; // - index signatures // - method overload signatures return visitClassExpression(node); - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: // This may be a heritage clause with TypeScript syntax extensions. // // TypeScript heritage clause extensions include: // - `implements` clause return visitHeritageClause(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // TypeScript supports type arguments on an expression in an `extends` heritage clause. return visitExpressionWithTypeArguments(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return ts.Debug.fail("Class and object literal elements must be visited with their respective visitors"); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: // Typescript function declarations can have modifiers, decorators, and type annotations. return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: // TypeScript function expressions can have modifiers and type annotations. return visitFunctionExpression(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // TypeScript arrow functions can have modifiers and type annotations. return visitArrowFunction(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // This may be a parameter declaration with TypeScript syntax extensions. // // TypeScript parameter declaration syntax extensions include: @@ -93380,40 +93944,42 @@ var ts; // - type annotations // - this parameters return visitParameter(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: // ParenthesizedExpressions are TypeScript if their expression is a // TypeAssertion or AsExpression return visitParenthesizedExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: // TypeScript type assertions are removed, but their subtrees are preserved. return visitAssertionExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return visitSatisfiesExpression(node); + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: // TypeScript non-null expressions are removed, but their subtrees are preserved. return visitNonNullExpression(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: // TypeScript enum declarations do not exist in ES6 and must be rewritten. return visitEnumDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // TypeScript namespace exports for variable statements must be transformed. return visitVariableStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // TypeScript namespace declarations must be transformed. return visitModuleDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // TypeScript namespace or external module import. return visitImportEqualsDeclaration(node); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node); - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: return visitJsxJsxOpeningElement(node); default: // node contains some other TypeScript syntax @@ -93683,10 +94249,10 @@ var ts; */ function shouldAddTypeMetadata(node) { var kind = node.kind; - return kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */; + return kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */; } /** * Determines whether to emit the "design:returntype" metadata based on the node's kind. @@ -93696,7 +94262,7 @@ var ts; * @param node The node to test. */ function shouldAddReturnTypeMetadata(node) { - return node.kind === 169 /* SyntaxKind.MethodDeclaration */; + return node.kind === 171 /* SyntaxKind.MethodDeclaration */; } /** * Determines whether to emit the "design:paramtypes" metadata based on the node's kind. @@ -93707,12 +94273,12 @@ var ts; */ function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.getFirstConstructorWithBody(node) !== undefined; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; } return false; @@ -93802,7 +94368,7 @@ var ts; return !ts.nodeIsMissing(node.body); } function visitPropertyDeclaration(node, parent) { - var isAmbient = node.flags & 16777216 /* NodeFlags.Ambient */ || ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */); + var isAmbient = node.flags & 16777216 /* NodeFlags.Ambient */ || ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */); if (isAmbient && !ts.hasDecorators(node)) { return undefined; } @@ -93910,7 +94476,7 @@ var ts; * @param node The declaration node. */ function shouldEmitAccessorDeclaration(node) { - return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)); + return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)); } function visitGetAccessor(node, parent) { if (!(node.transformFlags & 1 /* TransformFlags.ContainsTypeScript */)) { @@ -94052,6 +94618,10 @@ var ts; var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression); return factory.createPartiallyEmittedExpression(expression, node); } + function visitSatisfiesExpression(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + return factory.createPartiallyEmittedExpression(expression, node); + } function visitCallExpression(node) { return factory.updateCallExpression(node, ts.visitNode(node.expression, visitor, ts.isExpression), /*typeArguments*/ undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression)); @@ -94265,12 +94835,12 @@ var ts; // enums in any other scope are emitted as a `let` declaration. var statement = factory.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), factory.createVariableDeclarationList([ factory.createVariableDeclaration(factory.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)) - ], currentLexicalScope.kind === 305 /* SyntaxKind.SourceFile */ ? 0 /* NodeFlags.None */ : 1 /* NodeFlags.Let */)); + ], currentLexicalScope.kind === 308 /* SyntaxKind.SourceFile */ ? 0 /* NodeFlags.None */ : 1 /* NodeFlags.Let */)); ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { // Adjust the source map emit to match the old emitter. - if (node.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (node.kind === 263 /* SyntaxKind.EnumDeclaration */) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -94395,7 +94965,7 @@ var ts; var statementsLocation; var blockLocation; if (node.body) { - if (node.body.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (node.body.kind === 265 /* SyntaxKind.ModuleBlock */) { saveStateAndInvoke(node.body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = node.body.statements; blockLocation = node.body; @@ -94442,13 +95012,13 @@ var ts; // })(hi = hello.hi || (hello.hi = {})); // })(hello || (hello = {})); // We only want to emit comment on the namespace which contains block body itself, not the containing namespaces. - if (!node.body || node.body.kind !== 262 /* SyntaxKind.ModuleBlock */) { + if (!node.body || node.body.kind !== 265 /* SyntaxKind.ModuleBlock */) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* EmitFlags.NoComments */); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 264 /* SyntaxKind.ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -94495,7 +95065,7 @@ var ts; * @param node The named import bindings node. */ function visitNamedImportBindings(node) { - if (node.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (node.kind === 271 /* SyntaxKind.NamespaceImport */) { // Elide a namespace import if it is not referenced. return shouldEmitAliasDeclaration(node) ? node : undefined; } @@ -94653,7 +95223,7 @@ var ts; */ function isNamedExternalModuleExport(node) { return isExternalModuleExport(node) - && !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */); + && !ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */); } /** * Gets a value indicating whether the node is the default export of an external module. @@ -94662,7 +95232,7 @@ var ts; */ function isDefaultExternalModuleExport(node) { return isExternalModuleExport(node) - && ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */); + && ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */); } function addExportMemberAssignment(statements, node) { var expression = factory.createAssignment(factory.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true), factory.getLocalName(node)); @@ -94707,16 +95277,16 @@ var ts; // We need to enable substitutions for identifiers and shorthand property assignments. This allows us to // substitute the names of exported members of a namespace. context.enableSubstitution(79 /* SyntaxKind.Identifier */); - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // We need to be notified when entering and exiting namespaces. - context.enableEmitNotification(261 /* SyntaxKind.ModuleDeclaration */); + context.enableEmitNotification(264 /* SyntaxKind.ModuleDeclaration */); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 261 /* SyntaxKind.ModuleDeclaration */; + return ts.getOriginalNode(node).kind === 264 /* SyntaxKind.ModuleDeclaration */; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 260 /* SyntaxKind.EnumDeclaration */; + return ts.getOriginalNode(node).kind === 263 /* SyntaxKind.EnumDeclaration */; } /** * Hook for node emit. @@ -94777,9 +95347,9 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); } return node; @@ -94794,9 +95364,9 @@ var ts; // If we are nested within a namespace declaration, we may need to qualifiy // an identifier that is exported from a merged namespace. var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false); - if (container && container.kind !== 305 /* SyntaxKind.SourceFile */) { - var substitute = (applicableSubstitutions & 2 /* TypeScriptSubstitutionFlags.NamespaceExports */ && container.kind === 261 /* SyntaxKind.ModuleDeclaration */) || - (applicableSubstitutions & 8 /* TypeScriptSubstitutionFlags.NonQualifiedEnumMembers */ && container.kind === 260 /* SyntaxKind.EnumDeclaration */); + if (container && container.kind !== 308 /* SyntaxKind.SourceFile */) { + var substitute = (applicableSubstitutions & 2 /* TypeScriptSubstitutionFlags.NamespaceExports */ && container.kind === 264 /* SyntaxKind.ModuleDeclaration */) || + (applicableSubstitutions & 8 /* TypeScriptSubstitutionFlags.NonQualifiedEnumMembers */ && container.kind === 263 /* SyntaxKind.EnumDeclaration */); if (substitute) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(container), node), /*location*/ node); @@ -94835,9 +95405,10 @@ var ts; return ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node) ? resolver.getConstantValue(node) : undefined; } function shouldEmitAliasDeclaration(node) { - return compilerOptions.preserveValueImports - ? resolver.isValueAliasDeclaration(node) - : resolver.isReferencedAliasDeclaration(node); + return ts.isInJSFile(node) || + (compilerOptions.preserveValueImports + ? resolver.isValueAliasDeclaration(node) + : resolver.isReferencedAliasDeclaration(node)); } } ts.transformTypeScript = transformTypeScript; @@ -94885,13 +95456,24 @@ var ts; var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); var useDefineForClassFields = ts.getUseDefineForClassFields(compilerOptions); + // Always transform field initializers using Set semantics when `useDefineForClassFields: false`. + var shouldTransformInitializersUsingSet = !useDefineForClassFields; + // Transform field initializers using Define semantics when `useDefineForClassFields: true` and target < ES2022. + var shouldTransformInitializersUsingDefine = useDefineForClassFields && languageVersion < 9 /* ScriptTarget.ES2022 */; + var shouldTransformInitializers = shouldTransformInitializersUsingSet || shouldTransformInitializersUsingDefine; + // We need to transform private members and class static blocks when target < ES2022. var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < 9 /* ScriptTarget.ES2022 */; + // We need to transform `accessor` fields when target < ESNext + var shouldTransformAutoAccessors = languageVersion < 99 /* ScriptTarget.ESNext */; // We need to transform `this` in a static initializer into a reference to the class - // when targeting < ES2022 since the assignment will be moved outside of the class body. + // when target < ES2022 since the assignment will be moved outside of the class body. var shouldTransformThisInStaticInitializers = languageVersion < 9 /* ScriptTarget.ES2022 */; - // We don't need to transform `super` property access when targeting ES5, ES3 because + // We don't need to transform `super` property access when target <= ES5 because // the es2015 transformation handles those. var shouldTransformSuperInStaticInitializers = shouldTransformThisInStaticInitializers && languageVersion >= 2 /* ScriptTarget.ES2015 */; + var shouldTransformAnything = shouldTransformInitializers || + shouldTransformPrivateElementsOrClassStaticBlocks || + shouldTransformAutoAccessors; var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; var previousOnEmitNode = context.onEmitNode; @@ -94911,98 +95493,149 @@ var ts; var classLexicalEnvironmentStack = []; var classLexicalEnvironmentMap = new ts.Map(); var currentClassLexicalEnvironment; + var currentClassContainer; var currentComputedPropertyNameClassLexicalEnvironment; var currentStaticPropertyDeclarationOrStaticBlock; return ts.chainBundle(context, transformSourceFile); function transformSourceFile(node) { - var options = context.getCompilerOptions(); - if (node.isDeclarationFile - || useDefineForClassFields && ts.getEmitScriptTarget(options) >= 9 /* ScriptTarget.ES2022 */) { + if (node.isDeclarationFile || !shouldTransformAnything) { return node; } var visited = ts.visitEachChild(node, visitor, context); ts.addEmitHelpers(visited, context.readEmitHelpers()); return visited; } - function visitorWorker(node, valueIsDiscarded) { - if (node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */) { - switch (node.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - return visitClassLike(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitPropertyDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: - return visitVariableStatement(node); - case 80 /* SyntaxKind.PrivateIdentifier */: - return visitPrivateIdentifier(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitClassStaticBlockDeclaration(node); - } + function visitor(node) { + if (!(node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */) && + !(node.transformFlags & 134234112 /* TransformFlags.ContainsLexicalThisOrSuper */)) { + return node; } - if (node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */ || - node.transformFlags & 134217728 /* TransformFlags.ContainsLexicalSuper */ && - shouldTransformSuperInStaticInitializers && - currentStaticPropertyDeclarationOrStaticBlock && - currentClassLexicalEnvironment) { - switch (node.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); - case 221 /* SyntaxKind.BinaryExpression */: - return visitBinaryExpression(node, valueIsDiscarded); - case 208 /* SyntaxKind.CallExpression */: - return visitCallExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - return visitTaggedTemplateExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: - return visitPropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: - return visitElementAccessExpression(node); - case 238 /* SyntaxKind.ExpressionStatement */: - return visitExpressionStatement(node); - case 242 /* SyntaxKind.ForStatement */: - return visitForStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: { - var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = undefined; - var result = ts.visitEachChild(node, visitor, context); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; - return result; - } + switch (node.kind) { + case 127 /* SyntaxKind.AccessorKeyword */: + return shouldTransformAutoAccessors ? undefined : node; + case 260 /* SyntaxKind.ClassDeclaration */: + return visitClassDeclaration(node); + case 228 /* SyntaxKind.ClassExpression */: + return visitClassExpression(node); + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + return visitClassStaticBlockDeclaration(node); + case 169 /* SyntaxKind.PropertyDeclaration */: + return visitPropertyDeclaration(node); + case 240 /* SyntaxKind.VariableStatement */: + return visitVariableStatement(node); + case 80 /* SyntaxKind.PrivateIdentifier */: + return visitPrivateIdentifier(node); + case 208 /* SyntaxKind.PropertyAccessExpression */: + return visitPropertyAccessExpression(node); + case 209 /* SyntaxKind.ElementAccessExpression */: + return visitElementAccessExpression(node); + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + return visitPreOrPostfixUnaryExpression(node, /*valueIsDiscarded*/ false); + case 223 /* SyntaxKind.BinaryExpression */: + return visitBinaryExpression(node, /*valueIsDiscarded*/ false); + case 210 /* SyntaxKind.CallExpression */: + return visitCallExpression(node); + case 241 /* SyntaxKind.ExpressionStatement */: + return visitExpressionStatement(node); + case 212 /* SyntaxKind.TaggedTemplateExpression */: + return visitTaggedTemplateExpression(node); + case 245 /* SyntaxKind.ForStatement */: + return visitForStatement(node); + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: { + // If we are descending into a new scope, clear the current static property or block + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, fallbackVisitor, node); } + default: + return fallbackVisitor(node); } + } + function fallbackVisitor(node) { return ts.visitEachChild(node, visitor, context); } + /** + * Visits a node in an expression whose result is discarded. + */ function discardedValueVisitor(node) { - return visitorWorker(node, /*valueIsDiscarded*/ true); - } - function visitor(node) { - return visitorWorker(node, /*valueIsDiscarded*/ false); + switch (node.kind) { + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + return visitPreOrPostfixUnaryExpression(node, /*valueIsDiscarded*/ true); + case 223 /* SyntaxKind.BinaryExpression */: + return visitBinaryExpression(node, /*valueIsDiscarded*/ true); + default: + return visitor(node); + } } + /** + * Visits a node in a {@link HeritageClause}. + */ function heritageClauseVisitor(node) { switch (node.kind) { - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return ts.visitEachChild(node, heritageClauseVisitor, context); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - return visitExpressionWithTypeArguments(node); + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + return visitExpressionWithTypeArgumentsInHeritageClause(node); + default: + return visitor(node); } - return visitor(node); } - function visitorDestructuringTarget(node) { + /** + * Visits the assignment target of a destructuring assignment. + */ + function assignmentTargetVisitor(node) { switch (node.kind) { - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitAssignmentPattern(node); default: return visitor(node); } } + /** + * Visits a member of a class. + */ + function classElementVisitor(node) { + switch (node.kind) { + case 173 /* SyntaxKind.Constructor */: + return visitConstructorDeclaration(node); + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, visitMethodOrAccessorDeclaration, node); + case 169 /* SyntaxKind.PropertyDeclaration */: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, visitPropertyDeclaration, node); + case 164 /* SyntaxKind.ComputedPropertyName */: + return visitComputedPropertyName(node); + case 237 /* SyntaxKind.SemicolonClassElement */: + return node; + default: + return visitor(node); + } + } + /** + * Visits the results of an auto-accessor field transformation in a second pass. + */ + function accessorFieldResultVisitor(node) { + switch (node.kind) { + case 169 /* SyntaxKind.PropertyDeclaration */: + return transformFieldInitializer(node); + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return classElementVisitor(node); + default: + ts.Debug.assertMissingNode(node, "Expected node to either be a PropertyDeclaration, GetAccessorDeclaration, or SetAccessorDeclaration"); + break; + } + } /** * If we visit a private name, this means it is an undeclared private name. * Replace it with an empty identifier to indicate a problem with the code, @@ -95018,17 +95651,15 @@ var ts; } return ts.setOriginalNode(factory.createIdentifier(""), node); } + function isPrivateIdentifierInExpression(node) { + return ts.isPrivateIdentifier(node.left) + && node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */; + } /** * Visits `#id in expr` */ - function visitPrivateIdentifierInInExpression(node) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return node; - } - var privId = node.left; - ts.Debug.assertNode(privId, ts.isPrivateIdentifier); - ts.Debug.assert(node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */); - var info = accessPrivateIdentifier(privId); + function transformPrivateIdentifierInInExpression(node) { + var info = accessPrivateIdentifier(node.left); if (info) { var receiver = ts.visitNode(node.right, visitor, ts.isExpression); return ts.setOriginalNode(context.getEmitHelperFactory().createClassPrivateFieldInHelper(info.brandCheckIdentifier, receiver), node); @@ -95036,31 +95667,6 @@ var ts; // Private name has not been declared. Subsequent transformers will handle this error return ts.visitEachChild(node, visitor, context); } - /** - * Visits the members of a class that has fields. - * - * @param node The node to visit. - */ - function classElementVisitor(node) { - switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - // Constructors for classes using class fields are transformed in - // `visitClassDeclaration` or `visitClassExpression`. - return undefined; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - return visitMethodOrAccessorDeclaration(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitPropertyDeclaration(node); - case 162 /* SyntaxKind.ComputedPropertyName */: - return visitComputedPropertyName(node); - case 234 /* SyntaxKind.SemicolonClassElement */: - return node; - default: - return visitor(node); - } - } function visitVariableStatement(node) { var savedPendingStatements = pendingStatements; pendingStatements = []; @@ -95070,15 +95676,24 @@ var ts; pendingStatements = savedPendingStatements; return statement; } - function visitComputedPropertyName(name) { - var node = ts.visitEachChild(name, visitor, context); + function visitComputedPropertyName(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); if (ts.some(pendingExpressions)) { - var expressions = pendingExpressions; - expressions.push(node.expression); - pendingExpressions = []; - node = factory.updateComputedPropertyName(node, factory.inlineExpressions(expressions)); + if (ts.isParenthesizedExpression(expression)) { + expression = factory.updateParenthesizedExpression(expression, factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression.expression], false))); + } + else { + expression = factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression], false)); + } + pendingExpressions = undefined; } - return node; + return factory.updateComputedPropertyName(node, expression); + } + function visitConstructorDeclaration(node) { + if (currentClassContainer) { + return transformConstructor(node, currentClassContainer); + } + return fallbackVisitor(node); } function visitMethodOrAccessorDeclaration(node) { ts.Debug.assert(!ts.hasDecorators(node)); @@ -95093,13 +95708,20 @@ var ts; } var functionName = getHoistedFunctionName(node); if (functionName) { - getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return ts.isModifier(m) && !ts.isStaticModifier(m); }), node.asteriskToken, functionName, - /* typeParameters */ undefined, ts.visitParameterList(node.parameters, classElementVisitor, context), - /* type */ undefined, ts.visitFunctionBody(node.body, classElementVisitor, context)))); + getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return ts.isModifier(m) && !ts.isStaticModifier(m) && !ts.isAccessorModifier(m); }), node.asteriskToken, functionName, + /* typeParameters */ undefined, ts.visitParameterList(node.parameters, visitor, context), + /* type */ undefined, ts.visitFunctionBody(node.body, visitor, context)))); } // remove method declaration from class return undefined; } + function setCurrentStaticPropertyDeclarationOrStaticBlockAnd(current, visitor, arg) { + var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; + currentStaticPropertyDeclarationOrStaticBlock = current; + var result = visitor(arg); + currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; + return result; + } function getHoistedFunctionName(node) { ts.Debug.assert(ts.isPrivateIdentifier(node.name)); var info = accessPrivateIdentifier(node.name); @@ -95116,49 +95738,104 @@ var ts; } } } - function visitPropertyDeclaration(node) { - ts.Debug.assert(!ts.hasDecorators(node)); - if (ts.isPrivateIdentifier(node.name)) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - if (ts.isStatic(node)) { - // static fields are left as is - return ts.visitEachChild(node, visitor, context); - } - // Initializer is elided as the field is initialized in transformConstructor. - return factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, - /*questionOrExclamationToken*/ undefined, - /*type*/ undefined, - /*initializer*/ undefined); - } - // leave invalid code untransformed + function transformAutoAccessor(node) { + // transforms: + // accessor x = 1; + // into: + // #x = 1; + // get x() { return this.#x; } + // set x(value) { this.#x = value; } + ts.Debug.assertEachNode(node.modifiers, ts.isModifier); + var commentRange = ts.getCommentRange(node); + var sourceMapRange = ts.getSourceMapRange(node); + // Since we're creating two declarations where there was previously one, cache + // the expression for any computed property names. + var name = node.name; + var getterName = name; + var setterName = name; + if (ts.isComputedPropertyName(name) && !ts.isSimpleInlineableExpression(name.expression)) { + var temp = factory.createTempVariable(hoistVariableDeclaration); + ts.setSourceMapRange(temp, name.expression); + var expression = ts.visitNode(name.expression, visitor, ts.isExpression); + var assignment = factory.createAssignment(temp, expression); + ts.setSourceMapRange(assignment, name.expression); + getterName = factory.updateComputedPropertyName(name, factory.inlineExpressions([assignment, temp])); + setterName = factory.updateComputedPropertyName(name, temp); + } + var backingField = ts.createAccessorPropertyBackingField(factory, node, node.modifiers, node.initializer); + ts.setOriginalNode(backingField, node); + ts.setEmitFlags(backingField, 1536 /* EmitFlags.NoComments */); + ts.setSourceMapRange(backingField, sourceMapRange); + var getter = ts.createAccessorPropertyGetRedirector(factory, node, node.modifiers, getterName); + ts.setOriginalNode(getter, node); + ts.setCommentRange(getter, commentRange); + ts.setSourceMapRange(getter, sourceMapRange); + var setter = ts.createAccessorPropertySetRedirector(factory, node, node.modifiers, setterName); + ts.setOriginalNode(setter, node); + ts.setEmitFlags(setter, 1536 /* EmitFlags.NoComments */); + ts.setSourceMapRange(setter, sourceMapRange); + return ts.visitArray([backingField, getter, setter], accessorFieldResultVisitor, ts.isClassElement); + } + function transformPrivateFieldInitializer(node) { + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + // If we are transforming private elements into WeakMap/WeakSet, we should elide the node. var info = accessPrivateIdentifier(node.name); ts.Debug.assert(info, "Undeclared private name for property declaration."); - if (!info.isValid) { - return node; + // Leave invalid code untransformed; otherwise, elide the node as it is transformed elsewhere. + return info.isValid ? undefined : node; + } + if (shouldTransformInitializersUsingSet && !ts.isStatic(node)) { + // If we are transforming initializers using Set semantics we will elide the initializer as it will + // be moved to the constructor to preserve evaluation order next to public instance fields. We don't + // need to do this transformation for private static fields since public static fields can be + // transformed into `static {}` blocks. + return factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, + /*initializer*/ undefined); + } + return ts.visitEachChild(node, visitor, context); + } + function transformPublicFieldInitializer(node) { + if (shouldTransformInitializers) { + // Create a temporary variable to store a computed property name (if necessary). + // If it's not inlineable, then we emit an expression after the class which assigns + // the property name to the temporary variable. + var expr = getPropertyNameExpressionIfNeeded(node.name, /*shouldHoist*/ !!node.initializer || useDefineForClassFields); + if (expr) { + getPendingExpressions().push(expr); } - } - // Create a temporary variable to store a computed property name (if necessary). - // If it's not inlineable, then we emit an expression after the class which assigns - // the property name to the temporary variable. - var expr = getPropertyNameExpressionIfNeeded(node.name, !!node.initializer || useDefineForClassFields); - if (expr && !ts.isSimpleInlineableExpression(expr)) { - getPendingExpressions().push(expr); - } - if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks && !useDefineForClassFields) { - var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); - if (initializerStatement) { - var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); - ts.setOriginalNode(staticBlock, node); - ts.setCommentRange(staticBlock, node); - // Set the comment range for the statement to an empty synthetic range - // and drop synthetic comments from the statement to avoid printing them twice. - ts.setCommentRange(initializerStatement, { pos: -1, end: -1 }); - ts.setSyntheticLeadingComments(initializerStatement, undefined); - ts.setSyntheticTrailingComments(initializerStatement, undefined); - return staticBlock; + if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks) { + var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); + if (initializerStatement) { + var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); + ts.setOriginalNode(staticBlock, node); + ts.setCommentRange(staticBlock, node); + // Set the comment range for the statement to an empty synthetic range + // and drop synthetic comments from the statement to avoid printing them twice. + ts.setCommentRange(initializerStatement, { pos: -1, end: -1 }); + ts.setSyntheticLeadingComments(initializerStatement, undefined); + ts.setSyntheticTrailingComments(initializerStatement, undefined); + return staticBlock; + } } + return undefined; } - return undefined; + return ts.visitEachChild(node, classElementVisitor, context); + } + function transformFieldInitializer(node) { + ts.Debug.assert(!ts.hasDecorators(node), "Decorators should already have been transformed and elided."); + return ts.isPrivateIdentifierClassElementDeclaration(node) ? + transformPrivateFieldInitializer(node) : + transformPublicFieldInitializer(node); + } + function visitPropertyDeclaration(node) { + // If this is an auto-accessor, we defer to `transformAutoAccessor`. That function + // will in turn call `transformFieldInitializer` as needed. + if (shouldTransformAutoAccessors && ts.isAutoAccessorPropertyDeclaration(node)) { + return transformAutoAccessor(node); + } + return transformFieldInitializer(node); } function createPrivateIdentifierAccess(info, receiver) { return createPrivateIdentifierAccessHelper(info, ts.visitNode(receiver, visitor, ts.isExpression)); @@ -95222,9 +95899,11 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitPreOrPostfixUnaryExpression(node, valueIsDiscarded) { - if (node.operator === 45 /* SyntaxKind.PlusPlusToken */ || node.operator === 46 /* SyntaxKind.MinusMinusToken */) { + if (node.operator === 45 /* SyntaxKind.PlusPlusToken */ || + node.operator === 46 /* SyntaxKind.MinusMinusToken */) { var operand = ts.skipParentheses(node.operand); - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(operand)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(operand)) { var info = void 0; if (info = accessPrivateIdentifier(operand.name)) { var receiver = ts.visitNode(operand.expression, visitor, ts.isExpression); @@ -95313,7 +95992,9 @@ var ts; return { readExpression: readExpression, initializeExpression: initializeExpression }; } function visitCallExpression(node) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) { + // obj.#x() // Transform call expressions of private names to properly bind the `this` parameter. var _a = factory.createCallBinding(node.expression, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; if (ts.isCallChain(node)) { @@ -95328,6 +96009,8 @@ var ts; ts.isSuperProperty(node.expression) && currentStaticPropertyDeclarationOrStaticBlock && (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.classConstructor)) { + // super.x() + // super[x]() // converts `super.f(...)` into `Reflect.get(_baseTemp, "f", _classTemp).call(_classTemp, ...)` var invocation = factory.createFunctionCallCall(ts.visitNode(node.expression, visitor, ts.isExpression), currentClassLexicalEnvironment.classConstructor, ts.visitNodes(node.arguments, visitor, ts.isExpression)); ts.setOriginalNode(invocation, node); @@ -95337,7 +96020,8 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitTaggedTemplateExpression(node) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) { // Bind the `this` correctly for tagged template literals when the tag is a private identifier property access. var _a = factory.createCallBinding(node.tag, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; return factory.updateTaggedTemplateExpression(node, factory.createCallExpression(factory.createPropertyAccessExpression(ts.visitNode(target, visitor), "bind"), @@ -95363,11 +96047,8 @@ var ts; classLexicalEnvironmentMap.set(ts.getOriginalNodeId(node), currentClassLexicalEnvironment); } startLexicalEnvironment(); - var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = node; - var statements = ts.visitNodes(node.body.statements, visitor, ts.isStatement); + var statements = setCurrentStaticPropertyDeclarationOrStaticBlockAnd(node, function (statements) { return ts.visitNodes(statements, visitor, ts.isStatement); }, node.body.statements); statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; var iife = factory.createImmediatelyInvokedArrowFunction(statements); ts.setOriginalNode(iife, node); ts.setTextRange(iife, node); @@ -95377,9 +96058,12 @@ var ts; } function visitBinaryExpression(node, valueIsDiscarded) { if (ts.isDestructuringAssignment(node)) { + // ({ x: obj.#x } = ...) + // ({ x: super.x } = ...) + // ({ x: super[x] } = ...) var savedPendingExpressions = pendingExpressions; pendingExpressions = undefined; - node = factory.updateBinaryExpression(node, ts.visitNode(node.left, visitorDestructuringTarget), node.operatorToken, ts.visitNode(node.right, visitor)); + node = factory.updateBinaryExpression(node, ts.visitNode(node.left, assignmentTargetVisitor), node.operatorToken, ts.visitNode(node.right, visitor)); var expr = ts.some(pendingExpressions) ? factory.inlineExpressions(ts.compact(__spreadArray(__spreadArray([], pendingExpressions, true), [node], false))) : node; @@ -95387,7 +96071,9 @@ var ts; return expr; } if (ts.isAssignmentExpression(node)) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.left)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.left)) { + // obj.#x = ... var info = accessPrivateIdentifier(node.left.name); if (info) { return ts.setTextRange(ts.setOriginalNode(createPrivateIdentifierAssignment(info, node.left.expression, node.right, node.operatorToken.kind), node), node); @@ -95397,6 +96083,10 @@ var ts; ts.isSuperProperty(node.left) && currentStaticPropertyDeclarationOrStaticBlock && currentClassLexicalEnvironment) { + // super.x = ... + // super[x] = ... + // super.x += ... + // super.x -= ... var classConstructor = currentClassLexicalEnvironment.classConstructor, superClassReference = currentClassLexicalEnvironment.superClassReference, facts = currentClassLexicalEnvironment.facts; if (facts & 1 /* ClassFacts.ClassWasDecorated */) { return factory.updateBinaryExpression(node, visitInvalidSuperProperty(node.left), node.operatorToken, ts.visitNode(node.right, visitor, ts.isExpression)); @@ -95440,8 +96130,10 @@ var ts; } } } - if (node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */ && ts.isPrivateIdentifier(node.left)) { - return visitPrivateIdentifierInInExpression(node); + if (shouldTransformPrivateElementsOrClassStaticBlocks && + isPrivateIdentifierInExpression(node)) { + // #x in obj + return transformPrivateIdentifierInInExpression(node); } return ts.visitEachChild(node, visitor, context); } @@ -95466,36 +96158,6 @@ var ts; ts.Debug.assertNever(info, "Unknown private element type"); } } - /** - * Set up the environment for a class. - */ - function visitClassLike(node) { - if (!ts.forEach(node.members, doesClassElementNeedTransform)) { - return ts.visitEachChild(node, visitor, context); - } - var savedPendingExpressions = pendingExpressions; - pendingExpressions = undefined; - startClassLexicalEnvironment(); - if (shouldTransformPrivateElementsOrClassStaticBlocks) { - var name = ts.getNameOfDeclaration(node); - if (name && ts.isIdentifier(name)) { - getPrivateIdentifierEnvironment().className = ts.idText(name); - } - var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); - if (ts.some(privateInstanceMethodsAndAccessors)) { - getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); - } - } - var result = ts.isClassDeclaration(node) ? - visitClassDeclaration(node) : - visitClassExpression(node); - endClassLexicalEnvironment(); - pendingExpressions = savedPendingExpressions; - return result; - } - function doesClassElementNeedTransform(node) { - return ts.isPropertyDeclaration(node) || ts.isClassStaticBlockDeclaration(node) || (shouldTransformPrivateElementsOrClassStaticBlocks && node.name && ts.isPrivateIdentifier(node.name)); - } function getPrivateInstanceMethodsAndAccessors(node) { return ts.filter(node.members, ts.isNonStaticMethodOrAccessorWithPrivateName); } @@ -95509,7 +96171,7 @@ var ts; var member = _a[_i]; if (!ts.isStatic(member)) continue; - if (member.name && ts.isPrivateIdentifier(member.name) && shouldTransformPrivateElementsOrClassStaticBlocks) { + if (member.name && (ts.isPrivateIdentifier(member.name) || ts.isAutoAccessorPropertyDeclaration(member)) && shouldTransformPrivateElementsOrClassStaticBlocks) { facts |= 2 /* ClassFacts.NeedsClassConstructorReference */; } if (ts.isPropertyDeclaration(member) || ts.isClassStaticBlockDeclaration(member)) { @@ -95528,7 +96190,7 @@ var ts; } return facts; } - function visitExpressionWithTypeArguments(node) { + function visitExpressionWithTypeArgumentsInHeritageClause(node) { var facts = (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.facts) || 0 /* ClassFacts.None */; if (facts & 4 /* ClassFacts.NeedsClassSuperReference */) { var temp = factory.createTempVariable(hoistVariableDeclaration, /*reserveInNestedScopes*/ true); @@ -95538,7 +96200,22 @@ var ts; } return ts.visitEachChild(node, visitor, context); } - function visitClassDeclaration(node) { + function visitInNewClassLexicalEnvironment(node, visitor) { + var savedCurrentClassContainer = currentClassContainer; + var savedPendingExpressions = pendingExpressions; + currentClassContainer = node; + pendingExpressions = undefined; + startClassLexicalEnvironment(); + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + var name = ts.getNameOfDeclaration(node); + if (name && ts.isIdentifier(name)) { + getPrivateIdentifierEnvironment().className = name; + } + var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); + if (ts.some(privateInstanceMethodsAndAccessors)) { + getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); + } + } var facts = getClassFacts(node); if (facts) { getClassLexicalEnvironment().facts = facts; @@ -95546,6 +96223,16 @@ var ts; if (facts & 8 /* ClassFacts.NeedsSubstitutionForThisInClassStaticField */) { enableSubstitutionForClassStaticThisOrSuperReference(); } + var result = visitor(node, facts); + endClassLexicalEnvironment(); + currentClassContainer = savedCurrentClassContainer; + pendingExpressions = savedPendingExpressions; + return result; + } + function visitClassDeclaration(node) { + return visitInNewClassLexicalEnvironment(node, visitClassDeclarationInNewClassLexicalEnvironment); + } + function visitClassDeclarationInNewClassLexicalEnvironment(node, facts) { // If a class has private static fields, or a static field has a `this` or `super` reference, // then we need to allocate a temp variable to hold on to that reference. var pendingClassReferenceAssignment; @@ -95554,12 +96241,16 @@ var ts; getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); pendingClassReferenceAssignment = factory.createAssignment(temp, factory.getInternalName(node)); } - var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); - var statements = [ - factory.updateClassDeclaration(node, node.modifiers, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)) - ]; + var modifiers = ts.visitNodes(node.modifiers, visitor, ts.isModifierLike); + var heritageClauses = ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classDecl = factory.updateClassDeclaration(node, modifiers, node.name, + /*typeParameters*/ undefined, heritageClauses, members); + var statements = []; + if (prologue) { + statements.push(factory.createExpressionStatement(prologue)); + } + statements.push(classDecl); if (pendingClassReferenceAssignment) { getPendingExpressions().unshift(pendingClassReferenceAssignment); } @@ -95567,25 +96258,23 @@ var ts; if (ts.some(pendingExpressions)) { statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))); } - // Emit static property assignment. Because classDeclaration is lexically evaluated, - // it is safe to emit static property assignment after classDeclaration - // From ES6 specification: - // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using - // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. - var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node); - if (ts.some(staticProperties)) { - addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + if (shouldTransformInitializersUsingSet || shouldTransformPrivateElementsOrClassStaticBlocks) { + // Emit static property assignment. Because classDeclaration is lexically evaluated, + // it is safe to emit static property assignment after classDeclaration + // From ES6 specification: + // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using + // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. + var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node); + if (ts.some(staticProperties)) { + addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + } } return statements; } function visitClassExpression(node) { - var facts = getClassFacts(node); - if (facts) { - getClassLexicalEnvironment().facts = facts; - } - if (facts & 8 /* ClassFacts.NeedsSubstitutionForThisInClassStaticField */) { - enableSubstitutionForClassStaticThisOrSuperReference(); - } + return visitInNewClassLexicalEnvironment(node, visitClassExpressionInNewClassLexicalEnvironment); + } + function visitClassExpressionInNewClassLexicalEnvironment(node, facts) { // If this class expression is a transformation of a decorated class declaration, // then we want to output the pendingExpressions as statements, not as inlined // expressions with the class statement. @@ -95595,8 +96284,6 @@ var ts; // these statements after the class expression variable statement. var isDecoratedClassDeclaration = !!(facts & 1 /* ClassFacts.ClassWasDecorated */); var staticPropertiesOrClassStaticBlocks = ts.getStaticPropertiesAndClassStaticBlock(node); - var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); var isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 16777216 /* NodeCheckFlags.ClassWithConstructorReference */; var temp; function createClassTempVar() { @@ -95609,9 +96296,23 @@ var ts; temp = createClassTempVar(); getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); } - var classExpression = factory.updateClassExpression(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)); - var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(staticPropertiesOrClassStaticBlocks, function (p) { return ts.isClassStaticBlockDeclaration(p) || !!p.initializer || ts.isPrivateIdentifier(p.name); }); + var modifiers = ts.visitNodes(node.modifiers, visitor, ts.isModifierLike); + var heritageClauses = ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classExpression = factory.updateClassExpression(node, modifiers, node.name, + /*typeParameters*/ undefined, heritageClauses, members); + var expressions = []; + if (prologue) { + expressions.push(prologue); + } + // Static initializers are transformed to `static {}` blocks when `useDefineForClassFields: false` + // and not also transforming static blocks. + var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && + ts.some(staticPropertiesOrClassStaticBlocks, function (node) { + return ts.isClassStaticBlockDeclaration(node) || + ts.isPrivateIdentifierClassElementDeclaration(node) || + shouldTransformInitializers && ts.isInitializedProperty(node); + }); if (hasTransformableStatics || ts.some(pendingExpressions)) { if (isDecoratedClassDeclaration) { ts.Debug.assertIsDefined(pendingStatements, "Decorated classes transformed by TypeScript are expected to be within a variable declaration."); @@ -95623,12 +96324,16 @@ var ts; addPropertyOrClassStaticBlockStatements(pendingStatements, staticPropertiesOrClassStaticBlocks, factory.getInternalName(node)); } if (temp) { - return factory.inlineExpressions([factory.createAssignment(temp, classExpression), temp]); + expressions.push(ts.startOnNewLine(factory.createAssignment(temp, classExpression)), ts.startOnNewLine(temp)); + } + else { + expressions.push(classExpression); + if (prologue) { + ts.startOnNewLine(classExpression); + } } - return classExpression; } else { - var expressions = []; temp || (temp = createClassTempVar()); if (isClassWithConstructorReference) { // record an alias as the class name is not in scope for statics. @@ -95645,45 +96350,87 @@ var ts; ts.addRange(expressions, ts.map(pendingExpressions, ts.startOnNewLine)); ts.addRange(expressions, generateInitializedPropertyExpressionsOrClassStaticBlock(staticPropertiesOrClassStaticBlocks, temp)); expressions.push(ts.startOnNewLine(temp)); - return factory.inlineExpressions(expressions); } } - return classExpression; + else { + expressions.push(classExpression); + if (prologue) { + ts.startOnNewLine(classExpression); + } + } + return factory.inlineExpressions(expressions); } function visitClassStaticBlockDeclaration(node) { if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return ts.visitEachChild(node, classElementVisitor, context); + return ts.visitEachChild(node, visitor, context); } // ClassStaticBlockDeclaration for classes are transformed in `visitClassDeclaration` or `visitClassExpression`. return undefined; } - function transformClassMembers(node, isDerivedClass) { - var members = []; + function transformClassMembers(node) { + // Declare private names if (shouldTransformPrivateElementsOrClassStaticBlocks) { - // Declare private names. for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; if (ts.isPrivateIdentifierClassElementDeclaration(member)) { - addPrivateIdentifierToEnvironment(member); + addPrivateIdentifierToEnvironment(member, member.name, addPrivateIdentifierClassElementToEnvironment); } } if (ts.some(getPrivateInstanceMethodsAndAccessors(node))) { createBrandCheckWeakSetForPrivateMethods(); } + if (shouldTransformAutoAccessors) { + for (var _b = 0, _c = node.members; _b < _c.length; _b++) { + var member = _c[_b]; + if (ts.isAutoAccessorPropertyDeclaration(member)) { + var storageName = factory.getGeneratedPrivateNameForNode(member.name, /*prefix*/ undefined, "_accessor_storage"); + addPrivateIdentifierToEnvironment(member, storageName, addPrivateIdentifierPropertyDeclarationToEnvironment); + } + } + } } - var constructor = transformConstructor(node, isDerivedClass); - var visitedMembers = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement); - if (constructor) { - members.push(constructor); + var members = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement); + // Create a synthetic constructor if necessary + var syntheticConstructor; + if (!ts.some(members, ts.isConstructorDeclaration)) { + syntheticConstructor = transformConstructor(/*constructor*/ undefined, node); } + var prologue; + // If there are pending expressions create a class static block in which to evaluate them, but only if + // class static blocks are not also being transformed. This block will be injected at the top of the class + // to ensure that expressions from computed property names are evaluated before any other static + // initializers. + var syntheticStaticBlock; if (!shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(pendingExpressions)) { - members.push(factory.createClassStaticBlockDeclaration(factory.createBlock([ - factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)) - ]))); + var statement = factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)); + if (statement.transformFlags & 134234112 /* TransformFlags.ContainsLexicalThisOrSuper */) { + // If there are `this` or `super` references from computed property names, shift the expression + // into an arrow function to be evaluated in the outer scope so that `this` and `super` are + // properly captured. + var temp = factory.createTempVariable(hoistVariableDeclaration); + var arrow = factory.createArrowFunction( + /*modifiers*/ undefined, + /*typeParameters*/ undefined, + /*parameters*/ [], + /*type*/ undefined, + /*equalsGreaterThanToken*/ undefined, factory.createBlock([statement])); + prologue = factory.createAssignment(temp, arrow); + statement = factory.createExpressionStatement(factory.createCallExpression(temp, /*typeArguments*/ undefined, [])); + } + var block = factory.createBlock([statement]); + syntheticStaticBlock = factory.createClassStaticBlockDeclaration(block); pendingExpressions = undefined; } - ts.addRange(members, visitedMembers); - return ts.setTextRange(factory.createNodeArray(members), /*location*/ node.members); + // If we created a synthetic constructor or class static block, add them to the visited members + // and return a new array. + if (syntheticConstructor || syntheticStaticBlock) { + var membersArray = void 0; + membersArray = ts.append(membersArray, syntheticConstructor); + membersArray = ts.append(membersArray, syntheticStaticBlock); + membersArray = ts.addRange(membersArray, members); + members = ts.setTextRange(factory.createNodeArray(membersArray), /*location*/ node.members); + } + return { members: members, prologue: prologue }; } function createBrandCheckWeakSetForPrivateMethods() { var weakSetName = getPrivateIdentifierEnvironment().weakSetName; @@ -95692,35 +96439,38 @@ var ts; /*typeArguments*/ undefined, []))); } function isClassElementThatRequiresConstructorStatement(member) { - if (ts.isStatic(member) || ts.hasSyntacticModifier(ts.getOriginalNode(member), 128 /* ModifierFlags.Abstract */)) { + if (ts.isStatic(member) || ts.hasAbstractModifier(ts.getOriginalNode(member))) { return false; } - if (useDefineForClassFields) { - // If we are using define semantics and targeting ESNext or higher, - // then we don't need to transform any class properties. - return languageVersion < 9 /* ScriptTarget.ES2022 */; - } - return ts.isInitializedProperty(member) || shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member); + return shouldTransformInitializersUsingDefine && ts.isPropertyDeclaration(member) || + shouldTransformInitializersUsingSet && ts.isInitializedProperty(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && shouldTransformAutoAccessors && ts.isAutoAccessorPropertyDeclaration(member); } - function transformConstructor(node, isDerivedClass) { - var constructor = ts.visitNode(ts.getFirstConstructorWithBody(node), visitor, ts.isConstructorDeclaration); - var elements = node.members.filter(isClassElementThatRequiresConstructorStatement); - if (!ts.some(elements)) { + function transformConstructor(constructor, container) { + constructor = ts.visitNode(constructor, visitor, ts.isConstructorDeclaration); + if (!ts.some(container.members, isClassElementThatRequiresConstructorStatement)) { return constructor; } + var extendsClauseElement = ts.getEffectiveBaseTypeNode(container); + var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); var parameters = ts.visitParameterList(constructor ? constructor.parameters : undefined, visitor, context); - var body = transformConstructorBody(node, constructor, isDerivedClass); + var body = transformConstructorBody(container, constructor, isDerivedClass); if (!body) { - return undefined; + return constructor; + } + if (constructor) { + ts.Debug.assert(parameters); + return factory.updateConstructorDeclaration(constructor, /*modifiers*/ undefined, parameters, body); } return ts.startOnNewLine(ts.setOriginalNode(ts.setTextRange(factory.createConstructorDeclaration( - /*modifiers*/ undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || node), constructor)); + /*modifiers*/ undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || container), constructor)); } function transformConstructorBody(node, constructor, isDerivedClass) { - var _a; + var _a, _b; var properties = ts.getProperties(node, /*requireInitializer*/ false, /*isStatic*/ false); if (!useDefineForClassFields) { - properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name); }); + properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name) || ts.hasAccessorModifier(property); }); } var privateMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); var needsConstructorBody = ts.some(properties) || ts.some(privateMethodsAndAccessors); @@ -95772,8 +96522,8 @@ var ts; statements = statements.filter(function (statement) { return !ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor); }); } else { - for (var _i = 0, _b = constructor.body.statements; _i < _b.length; _i++) { - var statement = _b[_i]; + for (var _i = 0, _c = constructor.body.statements; _i < _c.length; _i++) { + var statement = _c[_i]; if (ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) { parameterPropertyDeclarationCount++; } @@ -95805,9 +96555,14 @@ var ts; ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue)); } statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); + if (statements.length === 0 && !constructor) { + return undefined; + } + var multiLine = (constructor === null || constructor === void 0 ? void 0 : constructor.body) && constructor.body.statements.length >= statements.length ? + (_b = constructor.body.multiLine) !== null && _b !== void 0 ? _b : statements.length > 0 : + statements.length > 0; return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), - /*location*/ constructor ? constructor.body.statements : node.members), - /*multiLine*/ true), + /*location*/ constructor ? constructor.body.statements : node.members), multiLine), /*location*/ constructor ? constructor.body : undefined); function visitBodyStatement(statement) { if (useDefineForClassFields && ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) { @@ -95843,9 +96598,10 @@ var ts; return undefined; } var statement = factory.createExpressionStatement(expression); + ts.setOriginalNode(statement, property); + ts.addEmitFlags(statement, ts.getEmitFlags(property) & 1536 /* EmitFlags.NoComments */); ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)); ts.setCommentRange(statement, property); - ts.setOriginalNode(statement, property); // `setOriginalNode` *copies* the `emitNode` from `property`, so now both // `statement` and `expression` have a copy of the synthesized comments. // Drop the comments from expression to avoid printing them twice. @@ -95868,9 +96624,10 @@ var ts; continue; } ts.startOnNewLine(expression); + ts.setOriginalNode(expression, property); + ts.addEmitFlags(expression, ts.getEmitFlags(property) & 1536 /* EmitFlags.NoComments */); ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)); ts.setCommentRange(expression, property); - ts.setOriginalNode(expression, property); expressions.push(expression); } return expressions; @@ -95897,9 +96654,11 @@ var ts; var _a; // We generate a name here in order to reuse the value cached by the relocated computed name expression (which uses the same generated name) var emitAssignment = !useDefineForClassFields; - var propertyName = ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression) - ? factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) - : property.name; + var propertyName = ts.hasAccessorModifier(property) ? + factory.getGeneratedPrivateNameForNode(property.name) : + ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression) ? + factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) : + property.name; if (ts.hasStaticModifier(property)) { currentStaticPropertyDeclarationOrStaticBlock = property; } @@ -95926,7 +96685,7 @@ var ts; return undefined; } var propertyOriginalNode = ts.getOriginalNode(property); - if (ts.hasSyntacticModifier(propertyOriginalNode, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(propertyOriginalNode, 256 /* ModifierFlags.Abstract */)) { return undefined; } var initializer = property.initializer || emitAssignment ? (_a = ts.visitNode(property.initializer, visitor, ts.isExpression)) !== null && _a !== void 0 ? _a : factory.createVoidZero() @@ -95960,17 +96719,17 @@ var ts; // substitute `this` in a static field initializer context.enableSubstitution(108 /* SyntaxKind.ThisKeyword */); // these push a new lexical environment that is not the class lexical environment - context.enableEmitNotification(256 /* SyntaxKind.FunctionDeclaration */); - context.enableEmitNotification(213 /* SyntaxKind.FunctionExpression */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(259 /* SyntaxKind.FunctionDeclaration */); + context.enableEmitNotification(215 /* SyntaxKind.FunctionExpression */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // these push a new lexical environment that is not the class lexical environment, except // when they have a computed property name - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(167 /* SyntaxKind.PropertyDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(169 /* SyntaxKind.PropertyDeclaration */); // class lexical environments are restored when entering a computed property name - context.enableEmitNotification(162 /* SyntaxKind.ComputedPropertyName */); + context.enableEmitNotification(164 /* SyntaxKind.ComputedPropertyName */); } } /** @@ -96009,13 +96768,13 @@ var ts; } } switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (ts.isArrowFunction(original) || ts.getEmitFlags(node) & 262144 /* EmitFlags.AsyncFunctionBody */) { break; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 171 /* SyntaxKind.Constructor */: { + case 259 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentClassLexicalEnvironment = undefined; @@ -96025,10 +96784,10 @@ var ts; currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; return; } - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentComputedPropertyNameClassLexicalEnvironment = currentClassLexicalEnvironment; @@ -96038,7 +96797,7 @@ var ts; currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; return; } - case 162 /* SyntaxKind.ComputedPropertyName */: { + case 164 /* SyntaxKind.ComputedPropertyName */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; @@ -96152,149 +96911,138 @@ var ts; function getPrivateIdentifierEnvironment() { var lex = getClassLexicalEnvironment(); lex.privateIdentifierEnvironment || (lex.privateIdentifierEnvironment = { - className: "", - identifiers: new ts.Map() + className: undefined, + weakSetName: undefined, + identifiers: undefined, + generatedIdentifiers: undefined, }); return lex.privateIdentifierEnvironment; } function getPendingExpressions() { - return pendingExpressions || (pendingExpressions = []); + return pendingExpressions !== null && pendingExpressions !== void 0 ? pendingExpressions : (pendingExpressions = []); } - function addPrivateIdentifierToEnvironment(node) { - var _a; - var text = ts.getTextOfPropertyName(node.name); - var lex = getClassLexicalEnvironment(); - var classConstructor = lex.classConstructor; - var privateEnv = getPrivateIdentifierEnvironment(); - var weakSetName = privateEnv.weakSetName; - var assignmentExpressions = []; - var privateName = node.name.escapedText; - var previousInfo = privateEnv.identifiers.get(privateName); - var isValid = !isReservedPrivateName(node.name) && previousInfo === undefined; - if (ts.hasStaticModifier(node)) { - ts.Debug.assert(classConstructor, "weakSetName should be set in private identifier environment"); - if (ts.isPropertyDeclaration(node)) { - var variableName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "f" /* PrivateIdentifierKind.Field */, - variableName: variableName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - else if (ts.isMethodDeclaration(node)) { - var functionName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "m" /* PrivateIdentifierKind.Method */, - methodName: functionName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - else if (ts.isGetAccessorDeclaration(node)) { - var getterName = createHoistedVariableForPrivateName(text + "_get", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: getterName, - setterName: undefined, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - } - else if (ts.isSetAccessorDeclaration(node)) { - var setterName = createHoistedVariableForPrivateName(text + "_set", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: undefined, - setterName: setterName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - } - else { - ts.Debug.assertNever(node, "Unknown class element type."); - } + function addPrivateIdentifierClassElementToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + if (ts.isAutoAccessorPropertyDeclaration(node)) { + addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); } else if (ts.isPropertyDeclaration(node)) { - var weakMapName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "f" /* PrivateIdentifierKind.Field */, - brandCheckIdentifier: weakMapName, - isStatic: false, - variableName: undefined, - isValid: isValid, - }); - assignmentExpressions.push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), - /*typeArguments*/ undefined, []))); + addPrivateIdentifierPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); } else if (ts.isMethodDeclaration(node)) { - ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); - privateEnv.identifiers.set(privateName, { - kind: "m" /* PrivateIdentifierKind.Method */, - methodName: createHoistedVariableForPrivateName(text, node), - brandCheckIdentifier: weakSetName, - isStatic: false, + addPrivateIdentifierMethodDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isGetAccessorDeclaration(node)) { + addPrivateIdentifierGetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isSetAccessorDeclaration(node)) { + addPrivateIdentifierSetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + } + function addPrivateIdentifierPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + if (isStatic) { + ts.Debug.assert(lex.classConstructor, "classConstructor should be set in private identifier environment"); + var variableName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { + kind: "f" /* PrivateIdentifierKind.Field */, + brandCheckIdentifier: lex.classConstructor, + variableName: variableName, + isStatic: true, isValid: isValid, }); } - else if (ts.isAccessor(node)) { - ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); - if (ts.isGetAccessor(node)) { - var getterName = createHoistedVariableForPrivateName(text + "_get", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && !previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: getterName, - setterName: undefined, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid: isValid, - }); - } - } - else { - var setterName = createHoistedVariableForPrivateName(text + "_set", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && !previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: undefined, - setterName: setterName, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid: isValid, - }); - } - } + else { + var weakMapName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { + kind: "f" /* PrivateIdentifierKind.Field */, + brandCheckIdentifier: weakMapName, + variableName: undefined, + isStatic: false, + isValid: isValid, + }); + getPendingExpressions().push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), + /*typeArguments*/ undefined, []))); + } + } + function addPrivateIdentifierMethodDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var methodName = createHoistedVariableForPrivateName(name); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "m" /* PrivateIdentifierKind.Method */, + methodName: methodName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + function addPrivateIdentifierGetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic === isStatic && !previousInfo.getterName) { + previousInfo.getterName = getterName; } else { - ts.Debug.assertNever(node, "Unknown class element type."); + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: getterName, + setterName: undefined, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); } - (_a = getPendingExpressions()).push.apply(_a, assignmentExpressions); } - function createHoistedVariableForClass(name, node) { + function addPrivateIdentifierSetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic === isStatic && !previousInfo.setterName) { + previousInfo.setterName = setterName; + } + else { + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: undefined, + setterName: setterName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + } + function addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: getterName, + setterName: setterName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + function addPrivateIdentifierToEnvironment(node, name, addDeclaration) { + var lex = getClassLexicalEnvironment(); + var privateEnv = getPrivateIdentifierEnvironment(); + var previousInfo = getPrivateIdentifier(privateEnv, name); + var isStatic = ts.hasStaticModifier(node); + var isValid = !isReservedPrivateName(name) && previousInfo === undefined; + addDeclaration(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + function createHoistedVariableForClass(name, node, suffix) { var className = getPrivateIdentifierEnvironment().className; - var prefix = className ? "_".concat(className) : ""; - var identifier = factory.createUniqueName("".concat(prefix, "_").concat(name), 16 /* GeneratedIdentifierFlags.Optimistic */); + var prefix = className ? { prefix: "_", node: className, suffix: "_" } : "_"; + var identifier = typeof name === "object" ? factory.getGeneratedNameForNode(name, 16 /* GeneratedIdentifierFlags.Optimistic */ | 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */, prefix, suffix) : + typeof name === "string" ? factory.createUniqueName(name, 16 /* GeneratedIdentifierFlags.Optimistic */, prefix, suffix) : + factory.createTempVariable(/*recordTempVariable*/ undefined, /*reserveInNestedScopes*/ true, prefix, suffix); if (resolver.getNodeCheckFlags(node) & 524288 /* NodeCheckFlags.BlockScopedBindingInLoop */) { addBlockScopedVariable(identifier); } @@ -96303,13 +97051,33 @@ var ts; } return identifier; } - function createHoistedVariableForPrivateName(privateName, node) { - return createHoistedVariableForClass(privateName.substring(1), node.name); - } - function accessPrivateIdentifier(name) { + function createHoistedVariableForPrivateName(name, suffix) { var _a; + var text = ts.tryGetTextOfPropertyName(name); + return createHoistedVariableForClass((_a = text === null || text === void 0 ? void 0 : text.substring(1)) !== null && _a !== void 0 ? _a : name, name, suffix); + } + /** + * Access an already defined {@link PrivateIdentifier} in the current {@link PrivateIdentifierEnvironment}. + * + * @seealso {@link addPrivateIdentifierToEnvironment} + */ + function accessPrivateIdentifier(name) { + if (ts.isGeneratedPrivateIdentifier(name)) { + return accessGeneratedPrivateIdentifier(name); + } + else { + return accessPrivateIdentifierByText(name.escapedText); + } + } + function accessPrivateIdentifierByText(text) { + return accessPrivateIdentifierWorker(getPrivateIdentifierInfo, text); + } + function accessGeneratedPrivateIdentifier(name) { + return accessPrivateIdentifierWorker(getGeneratedPrivateIdentifierInfo, ts.getNodeForGeneratedName(name)); + } + function accessPrivateIdentifierWorker(getPrivateIdentifierInfo, privateIdentifierKey) { if (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.privateIdentifierEnvironment) { - var info = currentClassLexicalEnvironment.privateIdentifierEnvironment.identifiers.get(name.escapedText); + var info = getPrivateIdentifierInfo(currentClassLexicalEnvironment.privateIdentifierEnvironment, privateIdentifierKey); if (info) { return info; } @@ -96319,9 +97087,11 @@ var ts; if (!env) { continue; } - var info = (_a = env.privateIdentifierEnvironment) === null || _a === void 0 ? void 0 : _a.identifiers.get(name.escapedText); - if (info) { - return info; + if (env.privateIdentifierEnvironment) { + var info = getPrivateIdentifierInfo(env.privateIdentifierEnvironment, privateIdentifierKey); + if (info) { + return info; + } } } return undefined; @@ -96378,7 +97148,7 @@ var ts; } } } - return ts.visitNode(node, visitorDestructuringTarget); + return ts.visitNode(node, assignmentTargetVisitor); } function visitObjectAssignmentTarget(node) { if (ts.isObjectBindingOrAssignmentElement(node) && !ts.isShorthandPropertyAssignment(node)) { @@ -96411,10 +97181,10 @@ var ts; var initializer = ts.getInitializerOfBindingOrAssignmentElement(node); return factory.updatePropertyAssignment(node, ts.visitNode(node.name, visitor, ts.isPropertyName), wrapped ? initializer ? factory.createAssignment(wrapped, ts.visitNode(initializer, visitor)) : wrapped : - ts.visitNode(node.initializer, visitorDestructuringTarget, ts.isExpression)); + ts.visitNode(node.initializer, assignmentTargetVisitor, ts.isExpression)); } if (ts.isSpreadAssignment(node)) { - return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, visitorDestructuringTarget, ts.isExpression)); + return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, assignmentTargetVisitor, ts.isExpression)); } ts.Debug.assert(wrapped === undefined, "Should not have generated a wrapped target"); } @@ -96460,7 +97230,31 @@ var ts; /*typeArguments*/ undefined, [receiver]); } function isReservedPrivateName(node) { - return node.escapedText === "#constructor"; + return !ts.isGeneratedPrivateIdentifier(node) && node.escapedText === "#constructor"; + } + function getPrivateIdentifier(privateEnv, name) { + return ts.isGeneratedPrivateIdentifier(name) ? + getGeneratedPrivateIdentifierInfo(privateEnv, ts.getNodeForGeneratedName(name)) : + getPrivateIdentifierInfo(privateEnv, name.escapedText); + } + function setPrivateIdentifier(privateEnv, name, info) { + var _a, _b; + if (ts.isGeneratedPrivateIdentifier(name)) { + (_a = privateEnv.generatedIdentifiers) !== null && _a !== void 0 ? _a : (privateEnv.generatedIdentifiers = new ts.Map()); + privateEnv.generatedIdentifiers.set(ts.getNodeForGeneratedName(name), info); + } + else { + (_b = privateEnv.identifiers) !== null && _b !== void 0 ? _b : (privateEnv.identifiers = new ts.Map()); + privateEnv.identifiers.set(name.escapedText, info); + } + } + function getPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.identifiers) === null || _a === void 0 ? void 0 : _a.get(key); + } + function getGeneratedPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.generatedIdentifiers) === null || _a === void 0 ? void 0 : _a.get(key); } })(ts || (ts = {})); /*@internal*/ @@ -96501,15 +97295,15 @@ var ts; */ function serializeTypeOfNode(node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: return serializeTypeNode(node.type); - case 173 /* SyntaxKind.SetAccessor */: - case 172 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return serializeTypeNode(getAccessorTypeNode(node)); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: return ts.factory.createIdentifier("Function"); default: return ts.factory.createVoidZero(); @@ -96545,7 +97339,7 @@ var ts; return ts.factory.createArrayLiteralExpression(expressions); } function getParametersOfDecoratedDeclaration(node, container) { - if (container && node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (container && node.kind === 174 /* SyntaxKind.GetAccessor */) { var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; if (setAccessor) { return setAccessor.parameters; @@ -96591,66 +97385,66 @@ var ts; node = ts.skipTypeParentheses(node); switch (node.kind) { case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return ts.factory.createVoidZero(); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return ts.factory.createIdentifier("Function"); - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return ts.factory.createIdentifier("Array"); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return node.assertsModifier ? ts.factory.createVoidZero() : ts.factory.createIdentifier("Boolean"); - case 133 /* SyntaxKind.BooleanKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: return ts.factory.createIdentifier("Boolean"); - case 198 /* SyntaxKind.TemplateLiteralType */: - case 150 /* SyntaxKind.StringKeyword */: + case 200 /* SyntaxKind.TemplateLiteralType */: + case 152 /* SyntaxKind.StringKeyword */: return ts.factory.createIdentifier("String"); - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return ts.factory.createIdentifier("Object"); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return serializeLiteralOfLiteralTypeNode(node.literal); - case 147 /* SyntaxKind.NumberKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: return ts.factory.createIdentifier("Number"); - case 158 /* SyntaxKind.BigIntKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: return getGlobalConstructor("BigInt", 7 /* ScriptTarget.ES2020 */); - case 151 /* SyntaxKind.SymbolKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: return getGlobalConstructor("Symbol", 2 /* ScriptTarget.ES2015 */); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return serializeTypeReferenceNode(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return serializeUnionOrIntersectionConstituents(node.types, /*isIntersection*/ true); - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return serializeUnionOrIntersectionConstituents(node.types, /*isIntersection*/ false); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return serializeUnionOrIntersectionConstituents([node.trueType, node.falseType], /*isIntersection*/ false); - case 193 /* SyntaxKind.TypeOperator */: - if (node.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { + case 195 /* SyntaxKind.TypeOperator */: + if (node.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { return serializeTypeNode(node.type); } break; - case 181 /* SyntaxKind.TypeQuery */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 195 /* SyntaxKind.MappedType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 192 /* SyntaxKind.ThisType */: - case 200 /* SyntaxKind.ImportType */: + case 183 /* SyntaxKind.TypeQuery */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 197 /* SyntaxKind.MappedType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 194 /* SyntaxKind.ThisType */: + case 202 /* SyntaxKind.ImportType */: break; // handle JSDoc types from an invalid parse - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 318 /* SyntaxKind.JSDocVariadicType */: - case 319 /* SyntaxKind.JSDocNamepathType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 321 /* SyntaxKind.JSDocVariadicType */: + case 322 /* SyntaxKind.JSDocNamepathType */: break; - case 314 /* SyntaxKind.JSDocNullableType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 316 /* SyntaxKind.JSDocOptionalType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return serializeTypeNode(node.type); default: return ts.Debug.failBadSyntaxKind(node); @@ -96662,7 +97456,7 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return ts.factory.createIdentifier("String"); - case 219 /* SyntaxKind.PrefixUnaryExpression */: { + case 221 /* SyntaxKind.PrefixUnaryExpression */: { var operand = node.operand; switch (operand.kind) { case 8 /* SyntaxKind.NumericLiteral */: @@ -96691,20 +97485,20 @@ var ts; for (var _i = 0, types_22 = types; _i < types_22.length; _i++) { var typeNode = types_22[_i]; typeNode = ts.skipTypeParentheses(typeNode); - if (typeNode.kind === 143 /* SyntaxKind.NeverKeyword */) { + if (typeNode.kind === 144 /* SyntaxKind.NeverKeyword */) { if (isIntersection) return ts.factory.createVoidZero(); // Reduce to `never` in an intersection continue; // Elide `never` in a union } - if (typeNode.kind === 155 /* SyntaxKind.UnknownKeyword */) { + if (typeNode.kind === 157 /* SyntaxKind.UnknownKeyword */) { if (!isIntersection) return ts.factory.createIdentifier("Object"); // Reduce to `unknown` in a union continue; // Elide `unknown` in an intersection } - if (typeNode.kind === 130 /* SyntaxKind.AnyKeyword */) { + if (typeNode.kind === 131 /* SyntaxKind.AnyKeyword */) { return ts.factory.createIdentifier("Object"); // Reduce to `any` in a union or intersection } - if (!strictNullChecks && ((ts.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */) || typeNode.kind === 153 /* SyntaxKind.UndefinedKeyword */)) { + if (!strictNullChecks && ((ts.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */) || typeNode.kind === 155 /* SyntaxKind.UndefinedKeyword */)) { continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks } var serializedConstituent = serializeTypeNode(typeNode); @@ -96852,7 +97646,7 @@ var ts; name.original = undefined; ts.setParent(name, ts.getParseTreeNode(currentLexicalScope)); // ensure the parent is set to a parse tree node. return name; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return serializeQualifiedNameAsExpression(node); } } @@ -96907,24 +97701,24 @@ var ts; return node; } switch (node.kind) { - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are elided. They will be emitted as part of `visitClassDeclaration`. return undefined; - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return visitClassExpression(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return visitConstructorDeclaration(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return visitMethodDeclaration(node); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitSetAccessorDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return visitGetAccessorDeclaration(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return visitPropertyDeclaration(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameterDeclaration(node); default: return ts.visitEachChild(node, visitor, context); @@ -97280,7 +98074,7 @@ var ts; var prefix = getClassMemberPrefix(node, member); var memberName = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ !ts.hasSyntacticModifier(member, 2 /* ModifierFlags.Ambient */)); var descriptor = languageVersion > 0 /* ScriptTarget.ES3 */ - ? member.kind === 167 /* SyntaxKind.PropertyDeclaration */ + ? ts.isPropertyDeclaration(member) && !ts.hasAccessorModifier(member) // We emit `void 0` here to indicate to `__decorate` that it can invoke `Object.defineProperty` directly, but that it // should not invoke `Object.getOwnPropertyDescriptor`. ? factory.createVoidZero() @@ -97543,34 +98337,34 @@ var ts; return node; } switch (node.kind) { - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // ES2017 async modifier should be elided for targets < ES2017 return undefined; - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return visitAwaitExpression(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitMethodDeclaration, node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitFunctionDeclaration, node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitFunctionExpression, node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return doWithContext(1 /* ContextFlags.NonTopLevel */, visitArrowFunction, node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { capturedSuperProperties.add(node.name.escapedText); } return ts.visitEachChild(node, visitor, context); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (capturedSuperProperties && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitDefault, node); default: return ts.visitEachChild(node, visitor, context); @@ -97579,27 +98373,27 @@ var ts; function asyncBodyVisitor(node) { if (ts.isNodeWithPossibleHoistedDeclaration(node)) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatementInAsyncBody(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatementInAsyncBody(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatementInAsyncBody(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatementInAsyncBody(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClauseInAsyncBody(node); - case 235 /* SyntaxKind.Block */: - case 249 /* SyntaxKind.SwitchStatement */: - case 263 /* SyntaxKind.CaseBlock */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 252 /* SyntaxKind.TryStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 250 /* SyntaxKind.LabeledStatement */: + case 238 /* SyntaxKind.Block */: + case 252 /* SyntaxKind.SwitchStatement */: + case 266 /* SyntaxKind.CaseBlock */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 255 /* SyntaxKind.TryStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return ts.visitEachChild(node, asyncBodyVisitor, context); default: return ts.Debug.assertNever(node, "Unhandled node."); @@ -97802,7 +98596,7 @@ var ts; var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 /* ScriptTarget.ES2015 */ ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 214 /* SyntaxKind.ArrowFunction */; + var isArrowFunction = node.kind === 216 /* SyntaxKind.ArrowFunction */; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* NodeCheckFlags.CaptureArguments */) !== 0; // An async function is emit as an outer function that calls an inner // generator function. To preserve lexical bindings, we pass the current @@ -97893,17 +98687,17 @@ var ts; enabledSubstitutions |= 1 /* ES2017SubstitutionFlags.AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(257 /* SyntaxKind.ClassDeclaration */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(260 /* SyntaxKind.ClassDeclaration */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // We need to be notified when entering the generated accessor arrow functions. - context.enableEmitNotification(237 /* SyntaxKind.VariableStatement */); + context.enableEmitNotification(240 /* SyntaxKind.VariableStatement */); } } /** @@ -97951,11 +98745,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); } return node; @@ -97987,11 +98781,11 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { @@ -98148,7 +98942,7 @@ var ts; return visitorWorker(node, /*expressionResultIsUnused*/ true); } function visitorNoAsyncModifier(node) { - if (node.kind === 131 /* SyntaxKind.AsyncKeyword */) { + if (node.kind === 132 /* SyntaxKind.AsyncKeyword */) { return undefined; } return node; @@ -98174,70 +98968,70 @@ var ts; return node; } switch (node.kind) { - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return visitAwaitExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node, expressionResultIsUnused); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node, expressionResultIsUnused); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 246 /* SyntaxKind.ForInStatement */: return doWithHierarchyFacts(visitDefault, node, 0 /* HierarchyFacts.IterationStatementExcludes */, 2 /* HierarchyFacts.IterationStatementIncludes */); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return doWithHierarchyFacts(visitForStatement, node, 0 /* HierarchyFacts.IterationStatementExcludes */, 2 /* HierarchyFacts.IterationStatementIncludes */); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return visitVoidExpression(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return doWithHierarchyFacts(visitConstructorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return doWithHierarchyFacts(visitMethodDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return doWithHierarchyFacts(visitGetAccessorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return doWithHierarchyFacts(visitSetAccessorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return doWithHierarchyFacts(visitFunctionDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return doWithHierarchyFacts(visitFunctionExpression, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return doWithHierarchyFacts(visitArrowFunction, node, 2 /* HierarchyFacts.ArrowFunctionExcludes */, 0 /* HierarchyFacts.ArrowFunctionIncludes */); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameter(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, expressionResultIsUnused); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { capturedSuperProperties.add(node.name.escapedText); } return ts.visitEachChild(node, visitor, context); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (capturedSuperProperties && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return doWithHierarchyFacts(visitDefault, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); default: return ts.visitEachChild(node, visitor, context); @@ -98273,7 +99067,7 @@ var ts; function visitLabeledStatement(node) { if (enclosingFunctionFlags & 2 /* FunctionFlags.Async */) { var statement = ts.unwrapInnermostStatementOfLabel(node); - if (statement.kind === 244 /* SyntaxKind.ForOfStatement */ && statement.awaitModifier) { + if (statement.kind === 247 /* SyntaxKind.ForOfStatement */ && statement.awaitModifier) { return visitForOfStatement(statement, node); } return factory.restoreEnclosingLabel(ts.visitNode(statement, visitor, ts.isStatement, factory.liftToBlock), node); @@ -98285,7 +99079,7 @@ var ts; var objects = []; for (var _i = 0, elements_5 = elements; _i < elements_5.length; _i++) { var e = elements_5[_i]; - if (e.kind === 298 /* SyntaxKind.SpreadAssignment */) { + if (e.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (chunkObject) { objects.push(factory.createObjectLiteralExpression(chunkObject)); chunkObject = undefined; @@ -98294,7 +99088,7 @@ var ts; objects.push(ts.visitNode(target, visitor, ts.isExpression)); } else { - chunkObject = ts.append(chunkObject, e.kind === 296 /* SyntaxKind.PropertyAssignment */ + chunkObject = ts.append(chunkObject, e.kind === 299 /* SyntaxKind.PropertyAssignment */ ? factory.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression)) : ts.visitNode(e, visitor, ts.isObjectLiteralElementLike)); } @@ -98328,7 +99122,7 @@ var ts; // If we translate the above to `__assign({}, k, l)`, the `l` will evaluate before `k` is spread and we // end up with `{ a: 1, b: 2, c: 3 }` var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (objects.length && objects[0].kind !== 207 /* SyntaxKind.ObjectLiteralExpression */) { objects.unshift(factory.createObjectLiteralExpression()); } var expression = objects[0]; @@ -98836,17 +99630,17 @@ var ts; enabledSubstitutions |= 1 /* ESNextSubstitutionFlags.AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(257 /* SyntaxKind.ClassDeclaration */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(260 /* SyntaxKind.ClassDeclaration */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // We need to be notified when entering the generated accessor arrow functions. - context.enableEmitNotification(237 /* SyntaxKind.VariableStatement */); + context.enableEmitNotification(240 /* SyntaxKind.VariableStatement */); } } /** @@ -98894,11 +99688,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); } return node; @@ -98930,11 +99724,11 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { @@ -98966,7 +99760,7 @@ var ts; return node; } switch (node.kind) { - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); default: return ts.visitEachChild(node, visitor, context); @@ -98998,25 +99792,25 @@ var ts; return node; } switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: { + case 210 /* SyntaxKind.CallExpression */: { var updated = visitNonOptionalCallExpression(node, /*captureThisArg*/ false); ts.Debug.assertNotNode(updated, ts.isSyntheticReference); return updated; } - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (ts.isOptionalChain(node)) { var updated = visitOptionalExpression(node, /*captureThisArg*/ false, /*isDelete*/ false); ts.Debug.assertNotNode(updated, ts.isSyntheticReference); return updated; } return ts.visitEachChild(node, visitor, context); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */) { return transformNullishCoalescingExpression(node); } return ts.visitEachChild(node, visitor, context); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return visitDeleteExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -99058,7 +99852,7 @@ var ts; thisArg = expression; } } - expression = node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ + expression = node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? factory.updatePropertyAccessExpression(node, expression, ts.visitNode(node.name, visitor, ts.isIdentifier)) : factory.updateElementAccessExpression(node, expression, ts.visitNode(node.argumentExpression, visitor, ts.isExpression)); return thisArg ? factory.createSyntheticReferenceExpression(expression, thisArg) : expression; @@ -99081,10 +99875,10 @@ var ts; } function visitNonOptionalExpression(node, captureThisArg, isDelete) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); - case 208 /* SyntaxKind.CallExpression */: return visitNonOptionalCallExpression(node, captureThisArg); + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); + case 210 /* SyntaxKind.CallExpression */: return visitNonOptionalCallExpression(node, captureThisArg); default: return ts.visitNode(node, visitor, ts.isExpression); } } @@ -99103,8 +99897,8 @@ var ts; for (var i = 0; i < chain.length; i++) { var segment = chain[i]; switch (segment.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (i === chain.length - 1 && captureThisArg) { if (!ts.isSimpleCopiableExpression(rightExpression)) { thisArg = factory.createTempVariable(hoistVariableDeclaration); @@ -99114,11 +99908,11 @@ var ts; thisArg = rightExpression; } } - rightExpression = segment.kind === 206 /* SyntaxKind.PropertyAccessExpression */ + rightExpression = segment.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? factory.createPropertyAccessExpression(rightExpression, ts.visitNode(segment.name, visitor, ts.isIdentifier)) : factory.createElementAccessExpression(rightExpression, ts.visitNode(segment.argumentExpression, visitor, ts.isExpression)); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (i === 0 && leftThisArg) { if (!ts.isGeneratedIdentifier(leftThisArg)) { leftThisArg = factory.cloneNode(leftThisArg); @@ -99179,7 +99973,7 @@ var ts; return node; } switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var binaryExpression = node; if (ts.isLogicalOrCoalescingAssignmentExpression(binaryExpression)) { return transformLogicalAssignment(binaryExpression); @@ -99348,13 +100142,13 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return visitJsxElement(node, /*isChild*/ false); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ false); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return visitJsxFragment(node, /*isChild*/ false); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -99364,13 +100158,13 @@ var ts; switch (node.kind) { case 11 /* SyntaxKind.JsxText */: return visitJsxText(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return visitJsxExpression(node); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return visitJsxElement(node, /*isChild*/ true); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ true); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return visitJsxFragment(node, /*isChild*/ true); default: return ts.Debug.failBadSyntaxKind(node); @@ -99551,7 +100345,7 @@ var ts; var literal = factory.createStringLiteral(tryDecodeEntities(node.text) || node.text, singleQuote); return ts.setTextRange(literal, node); } - if (node.kind === 288 /* SyntaxKind.JsxExpression */) { + if (node.kind === 291 /* SyntaxKind.JsxExpression */) { if (node.expression === undefined) { return factory.createTrue(); } @@ -99652,7 +100446,7 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 278 /* SyntaxKind.JsxElement */) { + if (node.kind === 281 /* SyntaxKind.JsxElement */) { return getTagName(node.openingElement); } else { @@ -99959,7 +100753,7 @@ var ts; return node; } switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -100184,7 +100978,7 @@ var ts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { return (hierarchyFacts & 8192 /* HierarchyFacts.ConstructorWithCapturedSuper */) !== 0 - && node.kind === 247 /* SyntaxKind.ReturnStatement */ + && node.kind === 250 /* SyntaxKind.ReturnStatement */ && !node.expression; } function isOrMayContainReturnCompletion(node) { @@ -100238,65 +101032,65 @@ var ts; switch (node.kind) { case 124 /* SyntaxKind.StaticKeyword */: return undefined; // elide static keyword - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return visitClassExpression(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameter(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return visitArrowFunction(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); case 79 /* SyntaxKind.Identifier */: return visitIdentifier(node); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return visitVariableDeclarationList(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return visitCaseBlock(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return visitBlock(node, /*isFunctionBody*/ false); - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return visitBreakOrContinueStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*outermostLabeledStatement*/ undefined); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node, /*outermostLabeledStatement*/ undefined); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return visitShorthandPropertyAssignment(node); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return visitComputedPropertyName(node); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, expressionResultIsUnused); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node, expressionResultIsUnused); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node, expressionResultIsUnused); case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 15 /* SyntaxKind.TemplateHead */: @@ -100307,30 +101101,30 @@ var ts; return visitStringLiteral(node); case 8 /* SyntaxKind.NumericLiteral */: return visitNumericLiteral(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return visitTemplateExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return visitSpreadElement(node); case 106 /* SyntaxKind.SuperKeyword */: return visitSuperKeyword(/*isExpressionOfCall*/ false); case 108 /* SyntaxKind.ThisKeyword */: return visitThisKeyword(node); - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return visitMetaProperty(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return visitMethodDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitAccessorDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return visitVoidExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -100420,14 +101214,14 @@ var ts; // it is possible if either // - break/continue is labeled and label is located inside the converted loop // - break/continue is non-labeled and located in non-converted loop/switch statement - var jump = node.kind === 246 /* SyntaxKind.BreakStatement */ ? 2 /* Jump.Break */ : 4 /* Jump.Continue */; + var jump = node.kind === 249 /* SyntaxKind.BreakStatement */ ? 2 /* Jump.Break */ : 4 /* Jump.Continue */; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(ts.idText(node.label))) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; var label = node.label; if (!label) { - if (node.kind === 246 /* SyntaxKind.BreakStatement */) { + if (node.kind === 249 /* SyntaxKind.BreakStatement */) { convertedLoopState.nonLocalJumps |= 2 /* Jump.Break */; labelMarker = "break"; } @@ -100438,7 +101232,7 @@ var ts; } } else { - if (node.kind === 246 /* SyntaxKind.BreakStatement */) { + if (node.kind === 249 /* SyntaxKind.BreakStatement */) { labelMarker = "break-".concat(label.escapedText); setLabeledJump(convertedLoopState, /*isBreak*/ true, ts.idText(label), labelMarker); } @@ -100494,7 +101288,7 @@ var ts; statements.push(statement); // Add an `export default` statement for default exports (for `--target es5 --module es6`) if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - var exportStatement = ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) + var exportStatement = ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) ? factory.createExportDefault(factory.getLocalName(node)) : factory.createExternalModuleExport(factory.getLocalName(node)); ts.setOriginalNode(exportStatement, statement); @@ -100863,11 +101657,11 @@ var ts; */ function isSufficientlyCoveredByReturnStatements(statement) { // A return statement is considered covered. - if (statement.kind === 247 /* SyntaxKind.ReturnStatement */) { + if (statement.kind === 250 /* SyntaxKind.ReturnStatement */) { return true; } // An if-statement with two covered branches is covered. - else if (statement.kind === 239 /* SyntaxKind.IfStatement */) { + else if (statement.kind === 242 /* SyntaxKind.IfStatement */) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && @@ -100875,7 +101669,7 @@ var ts; } } // A block is covered if it has a last statement which is covered. - else if (statement.kind === 235 /* SyntaxKind.Block */) { + else if (statement.kind === 238 /* SyntaxKind.Block */) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -101075,7 +101869,7 @@ var ts; * @param node A node. */ function insertCaptureThisForNodeIfNeeded(statements, node) { - if (hierarchyFacts & 65536 /* HierarchyFacts.CapturedLexicalThis */ && node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (hierarchyFacts & 65536 /* HierarchyFacts.CapturedLexicalThis */ && node.kind !== 216 /* SyntaxKind.ArrowFunction */) { insertCaptureThisForNode(statements, node, factory.createThis()); return true; } @@ -101109,22 +101903,22 @@ var ts; if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */) { var newTarget = void 0; switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return statements; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Methods and accessors cannot be constructors, so 'new.target' will // always return 'undefined'. newTarget = factory.createVoidZero(); break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: // Class constructors can only be called with `new`, so `this.constructor` // should be relatively safe to use. newTarget = factory.createPropertyAccessExpression(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), "constructor"); break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: // Functions can be called or constructed, and may have a `this` due to // being a member or when calling an imported function via `other_1.f()`. newTarget = factory.createConditionalExpression(factory.createLogicalAnd(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), factory.createBinaryExpression(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), 102 /* SyntaxKind.InstanceOfKeyword */, factory.getLocalName(node))), @@ -101159,21 +101953,21 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: statements.push(transformSemicolonClassElementToStatement(member)); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; - case 171 /* SyntaxKind.Constructor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // Constructors are handled in visitClassExpression/visitClassDeclaration break; default: @@ -101372,7 +102166,7 @@ var ts; : enterSubtree(32670 /* HierarchyFacts.FunctionExcludes */, 65 /* HierarchyFacts.FunctionIncludes */); var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */ && !name && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */)) { + if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */ && !name && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */)) { name = factory.getGeneratedNameForNode(node); } exitSubtree(ancestorFacts, 98304 /* HierarchyFacts.FunctionSubtreeExcludes */, 0 /* HierarchyFacts.None */); @@ -101418,7 +102212,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 214 /* SyntaxKind.ArrowFunction */); + ts.Debug.assert(node.kind === 216 /* SyntaxKind.ArrowFunction */); // To align with the old emitter, we use a synthetic end position on the location // for the statement list we synthesize when we down-level an arrow function with // an expression function body. This prevents both comments and source maps from @@ -101725,14 +102519,14 @@ var ts; } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitDoOrWhileStatement(node, outermostLabeledStatement); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, outermostLabeledStatement); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node, outermostLabeledStatement); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, outermostLabeledStatement); } } @@ -101918,7 +102712,7 @@ var ts; var property = properties[i]; if ((property.transformFlags & 1048576 /* TransformFlags.ContainsYield */ && hierarchyFacts & 4 /* HierarchyFacts.AsyncFunctionBody */) - || (hasComputed = ts.Debug.checkDefined(property.name).kind === 162 /* SyntaxKind.ComputedPropertyName */)) { + || (hasComputed = ts.Debug.checkDefined(property.name).kind === 164 /* SyntaxKind.ComputedPropertyName */)) { numInitialProperties = i; break; } @@ -102034,11 +102828,11 @@ var ts; } function convertIterationStatementCore(node, initializerFunction, convertedLoopBody) { switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody); - case 243 /* SyntaxKind.ForInStatement */: return convertForInStatement(node, convertedLoopBody); - case 244 /* SyntaxKind.ForOfStatement */: return convertForOfStatement(node, convertedLoopBody); - case 240 /* SyntaxKind.DoStatement */: return convertDoStatement(node, convertedLoopBody); - case 241 /* SyntaxKind.WhileStatement */: return convertWhileStatement(node, convertedLoopBody); + case 245 /* SyntaxKind.ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody); + case 246 /* SyntaxKind.ForInStatement */: return convertForInStatement(node, convertedLoopBody); + case 247 /* SyntaxKind.ForOfStatement */: return convertForOfStatement(node, convertedLoopBody); + case 243 /* SyntaxKind.DoStatement */: return convertDoStatement(node, convertedLoopBody); + case 244 /* SyntaxKind.WhileStatement */: return convertWhileStatement(node, convertedLoopBody); default: return ts.Debug.failBadSyntaxKind(node, "IterationStatement expected"); } } @@ -102063,11 +102857,11 @@ var ts; function createConvertedLoopState(node) { var loopInitializer; switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: var initializer = node.initializer; - if (initializer && initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (initializer && initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { loopInitializer = initializer; } break; @@ -102483,20 +103277,20 @@ var ts; for (var i = start; i < numProperties; i++) { var property = properties[i]; switch (property.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { expressions.push(transformAccessorsToExpression(receiver, accessors, node, !!node.multiLine)); } break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -102603,7 +103397,7 @@ var ts; var updated; var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { updated = factory.updateGetAccessorDeclaration(node, node.modifiers, node.name, parameters, node.type, body); } else { @@ -103063,13 +103857,13 @@ var ts; if ((enabledSubstitutions & 1 /* ES2015SubstitutionFlags.CapturedThis */) === 0) { enabledSubstitutions |= 1 /* ES2015SubstitutionFlags.CapturedThis */; context.enableSubstitution(108 /* SyntaxKind.ThisKeyword */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(214 /* SyntaxKind.ArrowFunction */); - context.enableEmitNotification(213 /* SyntaxKind.FunctionExpression */); - context.enableEmitNotification(256 /* SyntaxKind.FunctionDeclaration */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(216 /* SyntaxKind.ArrowFunction */); + context.enableEmitNotification(215 /* SyntaxKind.FunctionExpression */); + context.enableEmitNotification(259 /* SyntaxKind.FunctionDeclaration */); } } /** @@ -103110,10 +103904,10 @@ var ts; */ function isNameOfDeclarationWithCollidingName(node) { switch (node.parent.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return node.parent.name === node && resolver.isDeclarationWithCollidingName(node.parent); } @@ -103195,11 +103989,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 238 /* SyntaxKind.ExpressionStatement */) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 241 /* SyntaxKind.ExpressionStatement */) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 208 /* SyntaxKind.CallExpression */) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 210 /* SyntaxKind.CallExpression */) { return false; } var callTarget = statementExpression.expression; @@ -103207,7 +104001,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 225 /* SyntaxKind.SpreadElement */) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 227 /* SyntaxKind.SpreadElement */) { return false; } var expression = callArgument.expression; @@ -103233,15 +104027,15 @@ var ts; if (compilerOptions.jsx === 1 /* JsxEmit.Preserve */ || compilerOptions.jsx === 3 /* JsxEmit.ReactNative */) { previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; - context.enableEmitNotification(280 /* SyntaxKind.JsxOpeningElement */); - context.enableEmitNotification(281 /* SyntaxKind.JsxClosingElement */); - context.enableEmitNotification(279 /* SyntaxKind.JsxSelfClosingElement */); + context.enableEmitNotification(283 /* SyntaxKind.JsxOpeningElement */); + context.enableEmitNotification(284 /* SyntaxKind.JsxClosingElement */); + context.enableEmitNotification(282 /* SyntaxKind.JsxSelfClosingElement */); noSubstitution = []; } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(296 /* SyntaxKind.PropertyAssignment */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(299 /* SyntaxKind.PropertyAssignment */); return ts.chainBundle(context, transformSourceFile); /** * Transforms an ES5 source file to ES3. @@ -103260,9 +104054,9 @@ var ts; */ function onEmitNode(hint, node, emitCallback) { switch (node.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: var tagName = node.tagName; noSubstitution[ts.getOriginalNodeId(tagName)] = true; break; @@ -103597,13 +104391,13 @@ var ts; */ function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return visitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitWhileStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -103616,24 +104410,24 @@ var ts; */ function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitAccessorDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return visitBreakStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return visitContinueStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); default: if (node.transformFlags & 1048576 /* TransformFlags.ContainsYield */) { @@ -103654,23 +104448,23 @@ var ts; */ function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return visitConditionalExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return visitElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -103683,9 +104477,9 @@ var ts; */ function visitGenerator(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); default: return ts.Debug.failBadSyntaxKind(node); @@ -103892,7 +104686,7 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // [source] // a.b = yield; // @@ -103904,7 +104698,7 @@ var ts; // _a.b = %sent%; target = factory.updatePropertyAccessExpression(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // [source] // a[b] = yield; // @@ -104298,35 +105092,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return transformAndEmitBlock(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return transformAndEmitExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return transformAndEmitIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return transformAndEmitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return transformAndEmitWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return transformAndEmitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return transformAndEmitForInStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return transformAndEmitContinueStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return transformAndEmitBreakStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return transformAndEmitReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return transformAndEmitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return transformAndEmitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return transformAndEmitLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return transformAndEmitThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement)); @@ -104756,7 +105550,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 290 /* SyntaxKind.DefaultClause */ && defaultClauseIndex === -1) { + if (clause.kind === 293 /* SyntaxKind.DefaultClause */ && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -104769,7 +105563,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { if (containsYield(clause.expression) && pendingClauses.length > 0) { break; } @@ -105929,12 +106723,12 @@ var ts; var previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. - context.enableSubstitution(210 /* SyntaxKind.TaggedTemplateExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. + context.enableSubstitution(212 /* SyntaxKind.TaggedTemplateExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. context.enableSubstitution(79 /* SyntaxKind.Identifier */); // Substitutes expression identifiers with imported/exported symbols. - context.enableSubstitution(221 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(223 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var currentSourceFile; // The current file. @@ -106262,23 +107056,23 @@ var ts; */ function topLevelVisitor(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return visitor(node); @@ -106291,26 +107085,26 @@ var ts; return node; } switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, valueIsDiscarded); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(node) && currentSourceFile.impliedNodeFormat === undefined) { return visitImportCallExpression(node); } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); } return ts.visitEachChild(node, visitor, context); @@ -106326,24 +107120,24 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var elem = _a[_i]; switch (elem.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (destructuringNeedsFlattening(elem.initializer)) { return true; } break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: if (destructuringNeedsFlattening(elem.name)) { return true; } break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: if (destructuringNeedsFlattening(elem.expression)) { return true; } break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return false; default: ts.Debug.assertNever(elem, "Unhandled object member kind"); } @@ -106929,7 +107723,7 @@ var ts; // // To balance the declaration, add the exports of the elided variable // statement. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 237 /* SyntaxKind.VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240 /* SyntaxKind.VariableStatement */) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -106984,10 +107778,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding, /* liveBinding */ true); @@ -107071,7 +107865,7 @@ var ts; return statements; } if (ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */)) { - var exportName = ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); + var exportName = ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); statements = appendExportStatement(statements, exportName, factory.getLocalName(decl), /*location*/ decl); } if (decl.name) { @@ -107200,7 +107994,7 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; previousOnEmitNode(hint, node, emitCallback); @@ -107262,11 +108056,11 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return substituteTaggedTemplateExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return substituteBinaryExpression(node); } return node; @@ -107310,7 +108104,7 @@ var ts; } else if (!(ts.isGeneratedIdentifier(node) && !(node.autoGenerateFlags & 64 /* GeneratedIdentifierFlags.AllowNameSubstitution */)) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 305 /* SyntaxKind.SourceFile */) { + if (exportContainer && exportContainer.kind === 308 /* SyntaxKind.SourceFile */) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.cloneNode(node)), /*location*/ node); } @@ -107400,10 +108194,10 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(79 /* SyntaxKind.Identifier */); // Substitutes expression identifiers for imported symbols. - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols - context.enableSubstitution(221 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(231 /* SyntaxKind.MetaProperty */); // Substitutes 'import.meta' - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols + context.enableSubstitution(223 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(233 /* SyntaxKind.MetaProperty */); // Substitutes 'import.meta' + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var exportFunctionsMap = []; // The export function associated with a source file. @@ -107593,7 +108387,7 @@ var ts; ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); var exportStarFunction = addExportStarIfNeeded(statements); // TODO: GH#18217 var modifiers = node.transformFlags & 2097152 /* TransformFlags.ContainsAwait */ ? - factory.createModifiersFromModifierFlags(256 /* ModifierFlags.Async */) : + factory.createModifiersFromModifierFlags(512 /* ModifierFlags.Async */) : undefined; var moduleObject = factory.createObjectLiteralExpression([ factory.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), @@ -107627,7 +108421,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 272 /* SyntaxKind.ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 275 /* SyntaxKind.ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -107716,19 +108510,26 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(factory, entry, currentSourceFile); // TODO: GH#18217 switch (entry.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: if (!entry.importClause) { // 'import "..."' case // module is imported only for side-effects, no emit required break; } // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: ts.Debug.assert(importVariableName !== undefined); // save import into the local statements.push(factory.createExpressionStatement(factory.createAssignment(importVariableName, parameterName))); + if (ts.hasSyntacticModifier(entry, 1 /* ModifierFlags.Export */)) { + statements.push(factory.createExpressionStatement(factory.createCallExpression(exportFunction, + /*typeArguments*/ undefined, [ + factory.createStringLiteral(ts.idText(importVariableName)), + parameterName, + ]))); + } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { if (ts.isNamedExports(entry.exportClause)) { @@ -107787,13 +108588,13 @@ var ts; */ function topLevelVisitor(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); default: return topLevelNestedVisitor(node); @@ -107972,7 +108773,7 @@ var ts; function shouldHoistVariableDeclarationList(node) { // hoist only non-block scoped declarations or block scoped declarations parented by source file return (ts.getEmitFlags(node) & 2097152 /* EmitFlags.NoHoisting */) === 0 - && (enclosingBlockScopedContainer.kind === 305 /* SyntaxKind.SourceFile */ + && (enclosingBlockScopedContainer.kind === 308 /* SyntaxKind.SourceFile */ || (ts.getOriginalNode(node).flags & 3 /* NodeFlags.BlockScoped */) === 0); } /** @@ -108036,7 +108837,7 @@ var ts; // // To balance the declaration, we defer the exports of the elided variable // statement until we visit this declaration's `EndOfDeclarationMarker`. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 237 /* SyntaxKind.VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240 /* SyntaxKind.VariableStatement */) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasSyntacticModifier(node.original, 1 /* ModifierFlags.Export */); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -108098,10 +108899,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -108196,7 +108997,7 @@ var ts; } var excludeName; if (ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */)) { - var exportName = ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */) ? factory.createStringLiteral("default") : decl.name; + var exportName = ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */) ? factory.createStringLiteral("default") : decl.name; statements = appendExportStatement(statements, exportName, factory.getLocalName(decl)); excludeName = ts.getTextOfIdentifierOrLiteral(exportName); } @@ -108281,43 +109082,43 @@ var ts; */ function topLevelNestedVisitor(node) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*isTopLevel*/ true); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return visitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitWhileStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return visitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return visitCaseBlock(node); - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return visitCaseClause(node); - case 290 /* SyntaxKind.DefaultClause */: + case 293 /* SyntaxKind.DefaultClause */: return visitDefaultClause(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return visitTryStatement(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return visitBlock(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return visitor(node); @@ -108503,26 +109304,26 @@ var ts; return node; } switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*isTopLevel*/ false); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, valueIsDiscarded); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(node)) { return visitImportCallExpression(node); } break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return visitPrefixOrPostfixUnaryExpression(node, valueIsDiscarded); } return ts.visitEachChild(node, visitor, context); @@ -108602,7 +109403,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 305 /* SyntaxKind.SourceFile */; + return container !== undefined && container.kind === 308 /* SyntaxKind.SourceFile */; } else { return false; @@ -108680,7 +109481,7 @@ var ts; * @param emitCallback A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -108730,7 +109531,7 @@ var ts; */ function substituteUnspecified(node) { switch (node.kind) { - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return substituteShorthandPropertyAssignment(node); } return node; @@ -108767,9 +109568,9 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return substituteBinaryExpression(node); - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return substituteMetaProperty(node); } return node; @@ -108859,7 +109660,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); - if (exportContainer && exportContainer.kind === 305 /* SyntaxKind.SourceFile */) { + if (exportContainer && exportContainer.kind === 308 /* SyntaxKind.SourceFile */) { exportedNames = ts.append(exportedNames, factory.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -108902,7 +109703,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); context.enableSubstitution(79 /* SyntaxKind.Identifier */); var helperNameSubstitutions; var currentSourceFile; @@ -108942,14 +109743,14 @@ var ts; } function visitor(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // Though an error in es2020 modules, in node-flavor es2020 modules, we can helpfully transform this to a synthetic `require` call // To give easy access to a synchronous `require` in node-flavor esm. We do the transform even in scenarios where we error, but `import.meta.url` // is available, just because the output is reasonable for a node-like runtime. return ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.Node16 ? visitImportEqualsDeclaration(node) : undefined; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportDecl = node; return visitExportDeclaration(exportDecl); } @@ -109106,8 +109907,8 @@ var ts; var cjsOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(305 /* SyntaxKind.SourceFile */); - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); + context.enableSubstitution(308 /* SyntaxKind.SourceFile */); + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); var currentSourceFile; return transformSourceFileOrBundle; function onSubstituteNode(hint, node) { @@ -109154,7 +109955,7 @@ var ts; return result; } function transformSourceFileOrBundle(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -109214,7 +110015,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109243,7 +110044,7 @@ var ts; ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109290,7 +110091,7 @@ var ts; return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: ".concat(ts.Debug.formatSyntaxKind(node.kind))); } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109299,8 +110100,8 @@ var ts; } // This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit // The only exception here is if the constructor was marked as private. we are not emitting the constructor parameters at all. - else if (node.kind === 167 /* SyntaxKind.PropertyDeclaration */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 166 /* SyntaxKind.PropertySignature */ || - (node.kind === 164 /* SyntaxKind.Parameter */ && ts.hasSyntacticModifier(node.parent, 8 /* ModifierFlags.Private */))) { + else if (node.kind === 169 /* SyntaxKind.PropertyDeclaration */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 168 /* SyntaxKind.PropertySignature */ || + (node.kind === 166 /* SyntaxKind.Parameter */ && ts.hasSyntacticModifier(node.parent, 8 /* ModifierFlags.Private */))) { // TODO(jfreeman): Deal with computed properties in error reporting. if (ts.isStatic(node)) { return symbolAccessibilityResult.errorModuleName ? @@ -109309,7 +110110,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 166 /* SyntaxKind.Parameter */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109334,7 +110135,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (node.kind === 173 /* SyntaxKind.SetAccessor */) { + if (node.kind === 175 /* SyntaxKind.SetAccessor */) { // Getters can infer the return type from the returned expression, but setters cannot, so the // "_from_external_module_1_but_cannot_be_named" case cannot occur. if (ts.isStatic(node)) { @@ -109373,26 +110174,26 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? @@ -109400,7 +110201,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -109414,7 +110215,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -109439,30 +110240,30 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 175 /* SyntaxKind.ConstructSignature */: - case 180 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node.parent)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? @@ -109470,7 +110271,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109483,15 +110284,15 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 256 /* SyntaxKind.FunctionDeclaration */: - case 179 /* SyntaxKind.FunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 181 /* SyntaxKind.FunctionType */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; - case 173 /* SyntaxKind.SetAccessor */: - case 172 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109505,39 +110306,39 @@ var ts; // Type parameter constraints are named by user so we should always be able to name it var diagnosticMessage; switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1; break; - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node.parent)) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 179 /* SyntaxKind.FunctionType */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 181 /* SyntaxKind.FunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -109603,7 +110404,7 @@ var ts; } function isInternalDeclaration(node, currentSourceFile) { var parseTreeNode = ts.getParseTreeNode(node); - if (parseTreeNode && parseTreeNode.kind === 164 /* SyntaxKind.Parameter */) { + if (parseTreeNode && parseTreeNode.kind === 166 /* SyntaxKind.Parameter */) { var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode); var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined; var text = currentSourceFile.text; @@ -109779,7 +110580,7 @@ var ts; var _a; var primaryDeclaration = (_a = parentSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.getSourceFileOfNode(d) === containingFile; }); var augmentingDeclarations = ts.filter(symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== containingFile; }); - if (augmentingDeclarations) { + if (primaryDeclaration && augmentingDeclarations) { for (var _i = 0, augmentingDeclarations_1 = augmentingDeclarations; _i < augmentingDeclarations_1.length; _i++) { var augmentations = augmentingDeclarations_1[_i]; context.addDiagnostic(ts.addRelatedInfo(ts.createDiagnosticForNode(augmentations, ts.Diagnostics.Declaration_augments_declaration_in_another_file_This_cannot_be_serialized), ts.createDiagnosticForNode(primaryDeclaration, ts.Diagnostics.This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_file))); @@ -109809,10 +110610,10 @@ var ts; return result; } function transformRoot(node) { - if (node.kind === 305 /* SyntaxKind.SourceFile */ && node.isDeclarationFile) { + if (node.kind === 308 /* SyntaxKind.SourceFile */ && node.isDeclarationFile) { return node; } - if (node.kind === 306 /* SyntaxKind.Bundle */) { + if (node.kind === 309 /* SyntaxKind.Bundle */) { isBundledEmit = true; refs = new ts.Map(); libs = new ts.Map(); @@ -109835,14 +110636,14 @@ var ts; resultHasExternalModuleIndicator = false; // unused in external module bundle emit (all external modules are within module blocks, therefore are known to be modules) needsDeclare = false; var statements = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile, /*bundled*/ true)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements); - var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); + var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); return newFile; } needsDeclare = true; var updated = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements); return factory.updateSourceFile(sourceFile, transformAndReplaceLatePaintedStatements(updated), /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); }), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 308 /* SyntaxKind.InputFiles */) { + if (prepend.kind === 311 /* SyntaxKind.InputFiles */) { var sourceFile = ts.createUnparsedSourceFile(prepend, "dts", stripInternal); hasNoDefaultLib_1 = hasNoDefaultLib_1 || !!sourceFile.hasNoDefaultLib; collectReferences(sourceFile, refs); @@ -109983,7 +110784,7 @@ var ts; return name; } else { - if (name.kind === 202 /* SyntaxKind.ArrayBindingPattern */) { + if (name.kind === 204 /* SyntaxKind.ArrayBindingPattern */) { return factory.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement)); } else { @@ -109991,7 +110792,7 @@ var ts; } } function visitBindingElement(elem) { - if (elem.kind === 227 /* SyntaxKind.OmittedExpression */) { + if (elem.kind === 229 /* SyntaxKind.OmittedExpression */) { return elem; } if (elem.propertyName && ts.isIdentifier(elem.propertyName) && ts.isIdentifier(elem.name) && !elem.symbol.isReferenced) { @@ -110033,19 +110834,19 @@ var ts; // Literal const declarations will have an initializer ensured rather than a type return; } - var shouldUseResolverType = node.kind === 164 /* SyntaxKind.Parameter */ && + var shouldUseResolverType = node.kind === 166 /* SyntaxKind.Parameter */ && (resolver.isRequiredInitializedParameter(node) || resolver.isOptionalUninitializedParameterProperty(node)); if (type && !shouldUseResolverType) { return ts.visitNode(type, visitDeclarationSubtree); } if (!ts.getParseTreeNode(node)) { - return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } - if (node.kind === 173 /* SyntaxKind.SetAccessor */) { + if (node.kind === 175 /* SyntaxKind.SetAccessor */) { // Set accessors with no associated type node (from it's param or get accessor return) are `any` since they are never contextually typed right now // (The inferred type here will be void, but the old declaration emitter printed `any`, so this replicates that) - return factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } errorNameNode = node.name; var oldDiag; @@ -110053,12 +110854,12 @@ var ts; oldDiag = getSymbolAccessibilityDiagnostic; getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node); } - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); } - if (node.kind === 164 /* SyntaxKind.Parameter */ - || node.kind === 167 /* SyntaxKind.PropertyDeclaration */ - || node.kind === 166 /* SyntaxKind.PropertySignature */) { + if (node.kind === 166 /* SyntaxKind.Parameter */ + || node.kind === 169 /* SyntaxKind.PropertyDeclaration */ + || node.kind === 168 /* SyntaxKind.PropertySignature */) { if (ts.isPropertySignature(node) || !node.initializer) return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType)); return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType) || resolver.createTypeOfExpression(node.initializer, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); @@ -110069,28 +110870,28 @@ var ts; if (!suppressNewDiagnosticContexts) { getSymbolAccessibilityDiagnostic = oldDiag; } - return returnValue || factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return returnValue || factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } } function isDeclarationAndNotVisible(node) { node = ts.getParseTreeNode(node); switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return !resolver.isDeclarationVisible(node); // The following should be doing their own visibility checks based on filtering their members - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return !getBindingNameVisible(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: return false; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return true; } return false; @@ -110179,7 +110980,7 @@ var ts; function rewriteModuleSpecifier(parent, input) { if (!input) return undefined; // TODO: GH#18217 - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && parent.kind !== 200 /* SyntaxKind.ImportType */); + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && parent.kind !== 202 /* SyntaxKind.ImportType */); if (ts.isStringLiteralLike(input)) { if (isBundledEmit) { var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent); @@ -110199,7 +111000,7 @@ var ts; function transformImportEqualsDeclaration(decl) { if (!resolver.isDeclarationVisible(decl)) return; - if (decl.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + if (decl.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { // Rewrite external module names if necessary var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl); return factory.updateImportEqualsDeclaration(decl, decl.modifiers, decl.isTypeOnly, decl.name, factory.updateExternalModuleReference(decl.moduleReference, rewriteModuleSpecifier(decl, specifier))); @@ -110224,7 +111025,7 @@ var ts; return visibleDefaultBinding && factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, /*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)); } - if (decl.importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (decl.importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { // Namespace import (optionally with visible default) var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined; return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)) : undefined; @@ -110327,7 +111128,7 @@ var ts; // We'd see a TDZ violation at runtime var canProduceDiagnostic = ts.canProduceDiagnostics(input); var oldWithinObjectLiteralType = suppressNewDiagnosticContexts; - var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 182 /* SyntaxKind.TypeLiteral */ || input.kind === 195 /* SyntaxKind.MappedType */) && input.parent.kind !== 259 /* SyntaxKind.TypeAliasDeclaration */); + var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 184 /* SyntaxKind.TypeLiteral */ || input.kind === 197 /* SyntaxKind.MappedType */) && input.parent.kind !== 262 /* SyntaxKind.TypeAliasDeclaration */); // Emit methods which are private as properties with no type information if (ts.isMethodDeclaration(input) || ts.isMethodSignature(input)) { if (ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)) { @@ -110348,28 +111149,28 @@ var ts; } if (isProcessedComponent(input)) { switch (input.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: { + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: { if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) { checkEntityNameVisibility(input.expression, enclosingDeclaration); } var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory.updateExpressionWithTypeArguments(node, node.expression, node.typeArguments)); } - case 178 /* SyntaxKind.TypeReference */: { + case 180 /* SyntaxKind.TypeReference */: { checkEntityNameVisibility(input.typeName, enclosingDeclaration); var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory.updateTypeReferenceNode(node, node.typeName, node.typeArguments)); } - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return cleanup(factory.updateConstructSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); - case 171 /* SyntaxKind.Constructor */: { + case 173 /* SyntaxKind.Constructor */: { // A constructor declaration may not have a type annotation var ctor = factory.createConstructorDeclaration( /*modifiers*/ ensureModifiers(input), updateParamsList(input, input.parameters, 0 /* ModifierFlags.None */), /*body*/ undefined); return cleanup(ctor); } - case 169 /* SyntaxKind.MethodDeclaration */: { + case 171 /* SyntaxKind.MethodDeclaration */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } @@ -110378,7 +111179,7 @@ var ts; /*body*/ undefined); return cleanup(sig); } - case 172 /* SyntaxKind.GetAccessor */: { + case 174 /* SyntaxKind.GetAccessor */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } @@ -110386,36 +111187,36 @@ var ts; return cleanup(factory.updateGetAccessorDeclaration(input, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)), ensureType(input, accessorType), /*body*/ undefined)); } - case 173 /* SyntaxKind.SetAccessor */: { + case 175 /* SyntaxKind.SetAccessor */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updateSetAccessorDeclaration(input, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)), /*body*/ undefined)); } - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updatePropertyDeclaration(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type), ensureNoInitializer(input))); - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updatePropertySignature(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type))); - case 168 /* SyntaxKind.MethodSignature */: { + case 170 /* SyntaxKind.MethodSignature */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updateMethodSignature(input, ensureModifiers(input), input.name, input.questionToken, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 174 /* SyntaxKind.CallSignature */: { + case 176 /* SyntaxKind.CallSignature */: { return cleanup(factory.updateCallSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 176 /* SyntaxKind.IndexSignature */: { - return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */))); + case 178 /* SyntaxKind.IndexSignature */: { + return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */))); } - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { if (ts.isBindingPattern(input.name)) { return recreateBindingPattern(input.name); } @@ -110423,13 +111224,13 @@ var ts; suppressNewDiagnosticContexts = true; // Variable declaration types also suppress new diagnostic contexts, provided the contexts wouldn't be made for binding pattern types return cleanup(factory.updateVariableDeclaration(input, input.name, /*exclamationToken*/ undefined, ensureType(input, input.type), ensureNoInitializer(input))); } - case 163 /* SyntaxKind.TypeParameter */: { + case 165 /* SyntaxKind.TypeParameter */: { if (isPrivateMethodTypeParameter(input) && (input.default || input.constraint)) { return cleanup(factory.updateTypeParameterDeclaration(input, input.modifiers, input.name, /*constraint*/ undefined, /*defaultType*/ undefined)); } return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context)); } - case 189 /* SyntaxKind.ConditionalType */: { + case 191 /* SyntaxKind.ConditionalType */: { // We have to process conditional types in a special way because for visibility purposes we need to push a new enclosingDeclaration // just for the `infer` types in the true branch. It's an implicit declaration scope that only applies to _part_ of the type. var checkType = ts.visitNode(input.checkType, visitDeclarationSubtree); @@ -110441,13 +111242,13 @@ var ts; var falseType = ts.visitNode(input.falseType, visitDeclarationSubtree); return cleanup(factory.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType)); } - case 179 /* SyntaxKind.FunctionType */: { + case 181 /* SyntaxKind.FunctionType */: { return cleanup(factory.updateFunctionTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 180 /* SyntaxKind.ConstructorType */: { + case 182 /* SyntaxKind.ConstructorType */: { return cleanup(factory.updateConstructorTypeNode(input, ensureModifiers(input), ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 200 /* SyntaxKind.ImportType */: { + case 202 /* SyntaxKind.ImportType */: { if (!ts.isLiteralImportTypeNode(input)) return cleanup(input); return cleanup(factory.updateImportTypeNode(input, factory.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.assertions, input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf)); @@ -110479,7 +111280,7 @@ var ts; } } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 169 /* SyntaxKind.MethodDeclaration */ && ts.hasEffectiveModifier(node.parent, 8 /* ModifierFlags.Private */); + return node.parent.kind === 171 /* SyntaxKind.MethodDeclaration */ && ts.hasEffectiveModifier(node.parent, 8 /* ModifierFlags.Private */); } function visitDeclarationStatements(input) { if (!isPreservedDeclarationStatement(input)) { @@ -110489,7 +111290,7 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 272 /* SyntaxKind.ExportDeclaration */: { + case 275 /* SyntaxKind.ExportDeclaration */: { if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; } @@ -110498,7 +111299,7 @@ var ts; // Rewrite external module names if necessary return factory.updateExportDeclaration(input, input.modifiers, input.isTypeOnly, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier), ts.getResolutionModeOverrideForClause(input.assertClause) ? input.assertClause : undefined); } - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { // Always visible if the parent node isn't dropped for being not visible if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; @@ -110516,7 +111317,7 @@ var ts; errorFallbackNode = input; var varDecl = factory.createVariableDeclaration(newId, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); errorFallbackNode = undefined; - var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); preserveJsDoc(statement, input); ts.removeAllComments(input); return [statement, factory.updateExportAssignment(input, input.modifiers, newId)]; @@ -110529,12 +111330,12 @@ var ts; return input; } function stripExportModifiers(statement) { - if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 512 /* ModifierFlags.Default */) || !ts.canHaveModifiers(statement)) { + if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 1024 /* ModifierFlags.Default */) || !ts.canHaveModifiers(statement)) { // `export import` statements should remain as-is, as imports are _not_ implicitly exported in an ambient namespace // Likewise, `export default` classes and the like and just be `default`, so we preserve their `export` modifiers, too return statement; } - var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (257023 /* ModifierFlags.All */ ^ 1 /* ModifierFlags.Export */)); + var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (258047 /* ModifierFlags.All */ ^ 1 /* ModifierFlags.Export */)); return factory.updateModifiers(statement, modifiers); } function transformTopLevelDeclaration(input) { @@ -110545,10 +111346,10 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { return transformImportEqualsDeclaration(input); } - case 266 /* SyntaxKind.ImportDeclaration */: { + case 269 /* SyntaxKind.ImportDeclaration */: { return transformImportDeclaration(input); } } @@ -110569,12 +111370,16 @@ var ts; } var previousNeedsDeclare = needsDeclare; switch (input.kind) { - case 259 /* SyntaxKind.TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all - return cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); - case 258 /* SyntaxKind.InterfaceDeclaration */: { + case 262 /* SyntaxKind.TypeAliasDeclaration */: { + needsDeclare = false; + var clean = cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); + needsDeclare = previousNeedsDeclare; + return clean; + } + case 261 /* SyntaxKind.InterfaceDeclaration */: { return cleanup(factory.updateInterfaceDeclaration(input, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree))); } - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { // Generators lose their generator-ness, excepting their return type var clean = cleanup(factory.updateFunctionDeclaration(input, ensureModifiers(input), /*asteriskToken*/ undefined, input.name, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), @@ -110615,10 +111420,10 @@ var ts; })))); } var namespaceDecl = factory.createModuleDeclaration(ensureModifiers(input), input.name, factory.createModuleBlock(declarations), 16 /* NodeFlags.Namespace */); - if (!ts.hasEffectiveModifier(clean, 512 /* ModifierFlags.Default */)) { + if (!ts.hasEffectiveModifier(clean, 1024 /* ModifierFlags.Default */)) { return [clean, namespaceDecl]; } - var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~513 /* ModifierFlags.ExportDefault */) | 2 /* ModifierFlags.Ambient */); + var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~1025 /* ModifierFlags.ExportDefault */) | 2 /* ModifierFlags.Ambient */); var cleanDeclaration = factory.updateFunctionDeclaration(clean, modifiers, /*asteriskToken*/ undefined, clean.name, clean.typeParameters, clean.parameters, clean.type, /*body*/ undefined); @@ -110636,10 +111441,10 @@ var ts; return clean; } } - case 261 /* SyntaxKind.ModuleDeclaration */: { + case 264 /* SyntaxKind.ModuleDeclaration */: { needsDeclare = false; var inner = input.body; - if (inner && inner.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (inner && inner.kind === 265 /* SyntaxKind.ModuleBlock */) { var oldNeedsScopeFix = needsScopeFixMarker; var oldHasScopeFix = resultHasScopeMarker; resultHasScopeMarker = false; @@ -110680,7 +111485,7 @@ var ts; return cleanup(factory.updateModuleDeclaration(input, mods, input.name, body)); } } - case 257 /* SyntaxKind.ClassDeclaration */: { + case 260 /* SyntaxKind.ClassDeclaration */: { errorNameNode = input.name; errorFallbackNode = input; var modifiers = factory.createNodeArray(ensureModifiers(input)); @@ -110742,7 +111547,7 @@ var ts; typeName: input.name }); }; var varDecl = factory.createVariableDeclaration(newId_1, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(extendsClause_1.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); - var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); var heritageClauses = factory.createNodeArray(ts.map(input.heritageClauses, function (clause) { if (clause.token === 94 /* SyntaxKind.ExtendsKeyword */) { var oldDiag_2 = getSymbolAccessibilityDiagnostic; @@ -110760,10 +111565,10 @@ var ts; return cleanup(factory.updateClassDeclaration(input, modifiers, input.name, typeParameters, heritageClauses, members)); } } - case 237 /* SyntaxKind.VariableStatement */: { + case 240 /* SyntaxKind.VariableStatement */: { return cleanup(transformVariableStatement(input)); } - case 260 /* SyntaxKind.EnumDeclaration */: { + case 263 /* SyntaxKind.EnumDeclaration */: { return cleanup(factory.updateEnumDeclaration(input, factory.createNodeArray(ensureModifiers(input)), input.name, factory.createNodeArray(ts.mapDefined(input.members, function (m) { if (shouldStripInternal(m)) return; @@ -110782,7 +111587,7 @@ var ts; if (canProdiceDiagnostic) { getSymbolAccessibilityDiagnostic = oldDiag; } - if (input.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (input.kind === 264 /* SyntaxKind.ModuleDeclaration */) { needsDeclare = previousNeedsDeclare; } if (node === input) { @@ -110805,7 +111610,7 @@ var ts; return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e); })); } function recreateBindingElement(e) { - if (e.kind === 227 /* SyntaxKind.OmittedExpression */) { + if (e.kind === 229 /* SyntaxKind.OmittedExpression */) { return; } if (e.name) { @@ -110853,9 +111658,9 @@ var ts; return factory.createModifiersFromModifierFlags(newFlags); } function ensureModifierFlags(node) { - var mask = 257023 /* ModifierFlags.All */ ^ (4 /* ModifierFlags.Public */ | 256 /* ModifierFlags.Async */ | 16384 /* ModifierFlags.Override */); // No async and override modifiers in declaration files + var mask = 258047 /* ModifierFlags.All */ ^ (4 /* ModifierFlags.Public */ | 512 /* ModifierFlags.Async */ | 16384 /* ModifierFlags.Override */); // No async and override modifiers in declaration files var additions = (needsDeclare && !isAlwaysType(node)) ? 2 /* ModifierFlags.Ambient */ : 0 /* ModifierFlags.None */; - var parentIsFile = node.parent.kind === 305 /* SyntaxKind.SourceFile */; + var parentIsFile = node.parent.kind === 308 /* SyntaxKind.SourceFile */; if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) { mask ^= 2 /* ModifierFlags.Ambient */; additions = 0 /* ModifierFlags.None */; @@ -110884,7 +111689,7 @@ var ts; } ts.transformDeclarations = transformDeclarations; function isAlwaysType(node) { - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return true; } return false; @@ -110894,22 +111699,22 @@ var ts; return ts.factory.createModifiersFromModifierFlags(maskModifierFlags(node, modifierMask, modifierAdditions)); } function maskModifierFlags(node, modifierMask, modifierAdditions) { - if (modifierMask === void 0) { modifierMask = 257023 /* ModifierFlags.All */ ^ 4 /* ModifierFlags.Public */; } + if (modifierMask === void 0) { modifierMask = 258047 /* ModifierFlags.All */ ^ 4 /* ModifierFlags.Public */; } if (modifierAdditions === void 0) { modifierAdditions = 0 /* ModifierFlags.None */; } var flags = (ts.getEffectiveModifierFlags(node) & modifierMask) | modifierAdditions; - if (flags & 512 /* ModifierFlags.Default */ && !(flags & 1 /* ModifierFlags.Export */)) { + if (flags & 1024 /* ModifierFlags.Default */ && !(flags & 1 /* ModifierFlags.Export */)) { // A non-exported default is a nonsequitor - we usually try to remove all export modifiers // from statements in ambient declarations; but a default export must retain its export modifier to be syntactically valid flags ^= 1 /* ModifierFlags.Export */; } - if (flags & 512 /* ModifierFlags.Default */ && flags & 2 /* ModifierFlags.Ambient */) { + if (flags & 1024 /* ModifierFlags.Default */ && flags & 2 /* ModifierFlags.Ambient */) { flags ^= 2 /* ModifierFlags.Ambient */; // `declare` is never required alongside `default` (and would be an error if printed) } return flags; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 172 /* SyntaxKind.GetAccessor */ + return accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? accessor.type // Getter - return type : accessor.parameters.length > 0 ? accessor.parameters[0].type // Setter parameter type @@ -110918,52 +111723,52 @@ var ts; } function canHaveLiteralInitializer(node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return !ts.hasEffectiveModifier(node, 8 /* ModifierFlags.Private */); - case 164 /* SyntaxKind.Parameter */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; } return false; } function isPreservedDeclarationStatement(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: return true; } return false; } function isProcessedComponent(node) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 254 /* SyntaxKind.VariableDeclaration */: - case 163 /* SyntaxKind.TypeParameter */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 178 /* SyntaxKind.TypeReference */: - case 189 /* SyntaxKind.ConditionalType */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 200 /* SyntaxKind.ImportType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: + case 191 /* SyntaxKind.ConditionalType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 202 /* SyntaxKind.ImportType */: return true; } return false; @@ -111103,7 +111908,7 @@ var ts; * @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files. */ function transformNodes(resolver, host, factory, options, nodes, transformers, allowDtsFiles) { - var enabledSyntaxKindFeatures = new Array(355 /* SyntaxKind.Count */); + var enabledSyntaxKindFeatures = new Array(358 /* SyntaxKind.Count */); var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentStatements; @@ -111185,7 +111990,7 @@ var ts; var transformed = []; for (var _a = 0, nodes_3 = nodes; _a < nodes_3.length; _a++) { var node = nodes_3[_a]; - ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* tracing.Phase.Emit */, "transformNodes", node.kind === 305 /* SyntaxKind.SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); + ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* tracing.Phase.Emit */, "transformNodes", node.kind === 308 /* SyntaxKind.SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); transformed.push((allowDtsFiles ? transformation : transformRoot)(node)); ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop(); } @@ -111591,7 +112396,7 @@ var ts; /*@internal*/ function getOutputPathsFor(sourceFile, host, forceDtsPaths) { var options = host.getCompilerOptions(); - if (sourceFile.kind === 306 /* SyntaxKind.Bundle */) { + if (sourceFile.kind === 309 /* SyntaxKind.Bundle */) { return getOutputPathsForBundle(options, forceDtsPaths); } else { @@ -111960,8 +112765,8 @@ var ts; } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) { var sourceFileOrBundle = transform.transformed[0]; - var bundle = sourceFileOrBundle.kind === 306 /* SyntaxKind.Bundle */ ? sourceFileOrBundle : undefined; - var sourceFile = sourceFileOrBundle.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFileOrBundle : undefined; + var bundle = sourceFileOrBundle.kind === 309 /* SyntaxKind.Bundle */ ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFileOrBundle : undefined; var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; var sourceMapGenerator; if (shouldEmitSourceMaps(mapOptions, sourceFileOrBundle)) { @@ -112011,7 +112816,7 @@ var ts; } function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) { return (mapOptions.sourceMap || mapOptions.inlineSourceMap) - && (sourceFileOrBundle.kind !== 305 /* SyntaxKind.SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Extension.Json */)); + && (sourceFileOrBundle.kind !== 308 /* SyntaxKind.SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Extension.Json */)); } function getSourceRoot(mapOptions) { // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the @@ -112074,8 +112879,8 @@ var ts; } ts.getBuildInfoText = getBuildInfoText; /*@internal*/ - function getBuildInfo(buildInfoText) { - return JSON.parse(buildInfoText); + function getBuildInfo(buildInfoFile, buildInfoText) { + return ts.readJsonOrUndefined(buildInfoFile, buildInfoText); } ts.getBuildInfo = getBuildInfo; /*@internal*/ @@ -112153,17 +112958,16 @@ var ts; var buildInfo; if (host.getBuildInfo) { // If host directly provides buildinfo we can get it directly. This allows host to cache the buildinfo - var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); - if (!hostBuildInfo) - return buildInfoPath; - buildInfo = hostBuildInfo; + buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); } else { var buildInfoText = host.readFile(buildInfoPath); if (!buildInfoText) return buildInfoPath; - buildInfo = getBuildInfo(buildInfoText); + buildInfo = getBuildInfo(buildInfoPath, buildInfoText); } + if (!buildInfo) + return buildInfoPath; if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts)) return buildInfoPath; var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath)); @@ -112289,6 +113093,10 @@ var ts; var nodeIdToGeneratedName; // Map of generated names for specific nodes. var autoGeneratedIdToGeneratedName; // Map of generated names for temp and loop variables. var generatedNames; // Set of names generated by the NameGenerator. + var formattedNameTempFlagsStack; + var formattedNameTempFlags; + var privateNameTempFlagsStack; // Stack of enclosing name generation scopes. + var privateNameTempFlags; // TempFlags for the current name generation scope. var tempFlagsStack; // Stack of enclosing name generation scopes. var tempFlags; // TempFlags for the current name generation scope. var reservedNamesStack; // Stack of TempFlags reserved in enclosing name generation scopes. @@ -112354,9 +113162,9 @@ var ts; break; } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: return printFile(node); - case 306 /* SyntaxKind.Bundle */: return printBundle(node); - case 307 /* SyntaxKind.UnparsedSource */: return printUnparsedSource(node); + case 308 /* SyntaxKind.SourceFile */: return printFile(node); + case 309 /* SyntaxKind.Bundle */: return printBundle(node); + case 310 /* SyntaxKind.UnparsedSource */: return printUnparsedSource(node); } writeNode(hint, node, sourceFile, beginPrint()); return endPrint(); @@ -112547,6 +113355,10 @@ var ts; nodeIdToGeneratedName = []; autoGeneratedIdToGeneratedName = []; generatedNames = new ts.Set(); + formattedNameTempFlagsStack = []; + formattedNameTempFlags = new ts.Map(); + privateNameTempFlagsStack = []; + privateNameTempFlags = 0 /* TempFlags.Auto */; tempFlagsStack = []; tempFlags = 0 /* TempFlags.Auto */; reservedNamesStack = []; @@ -112690,315 +113502,315 @@ var ts; return emitPrivateIdentifier(node); // Parse tree nodes // Names - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return emitQualifiedName(node); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return emitComputedPropertyName(node); // Signature elements - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return emitTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return emitParameter(node); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return emitDecorator(node); // Type members - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return emitPropertySignature(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return emitPropertyDeclaration(node); - case 168 /* SyntaxKind.MethodSignature */: + case 170 /* SyntaxKind.MethodSignature */: return emitMethodSignature(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return emitMethodDeclaration(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return emitClassStaticBlockDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return emitConstructor(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return emitAccessorDeclaration(node); - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: return emitCallSignature(node); - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return emitConstructSignature(node); - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return emitIndexSignature(node); // Types - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return emitTypePredicate(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return emitTypeReference(node); - case 179 /* SyntaxKind.FunctionType */: + case 181 /* SyntaxKind.FunctionType */: return emitFunctionType(node); - case 180 /* SyntaxKind.ConstructorType */: + case 182 /* SyntaxKind.ConstructorType */: return emitConstructorType(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return emitTypeQuery(node); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return emitTypeLiteral(node); - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return emitArrayType(node); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return emitTupleType(node); - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return emitOptionalType(node); // SyntaxKind.RestType is handled below - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return emitUnionType(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return emitIntersectionType(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return emitConditionalType(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return emitInferType(node); - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return emitParenthesizedType(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return emitThisType(); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return emitTypeOperator(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return emitIndexedAccessType(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return emitMappedType(node); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return emitLiteralType(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return emitNamedTupleMember(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return emitTemplateType(node); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: + case 201 /* SyntaxKind.TemplateLiteralTypeSpan */: return emitTemplateTypeSpan(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return emitImportTypeNode(node); // Binding patterns - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return emitBindingElement(node); // Misc - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return emitTemplateSpan(node); - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: return emitSemicolonClassElement(); // Statements - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return emitBlock(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return emitVariableStatement(node); - case 236 /* SyntaxKind.EmptyStatement */: + case 239 /* SyntaxKind.EmptyStatement */: return emitEmptyStatement(/*isEmbeddedStatement*/ false); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return emitExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return emitIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return emitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return emitWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return emitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return emitForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return emitForOfStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return emitContinueStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return emitBreakStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return emitReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return emitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return emitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return emitLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return emitThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return emitTryStatement(node); - case 253 /* SyntaxKind.DebuggerStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: return emitDebuggerStatement(node); // Declarations - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return emitVariableDeclaration(node); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return emitVariableDeclarationList(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return emitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return emitClassDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return emitEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return emitModuleDeclaration(node); - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return emitModuleBlock(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return emitCaseBlock(node); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return emitNamespaceExportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return emitImportDeclaration(node); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return emitImportClause(node); - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return emitNamespaceImport(node); - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: return emitNamespaceExport(node); - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: return emitNamedImports(node); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return emitImportSpecifier(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return emitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return emitExportDeclaration(node); - case 273 /* SyntaxKind.NamedExports */: + case 276 /* SyntaxKind.NamedExports */: return emitNamedExports(node); - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return emitExportSpecifier(node); - case 293 /* SyntaxKind.AssertClause */: + case 296 /* SyntaxKind.AssertClause */: return emitAssertClause(node); - case 294 /* SyntaxKind.AssertEntry */: + case 297 /* SyntaxKind.AssertEntry */: return emitAssertEntry(node); - case 276 /* SyntaxKind.MissingDeclaration */: + case 279 /* SyntaxKind.MissingDeclaration */: return; // Module references - case 277 /* SyntaxKind.ExternalModuleReference */: + case 280 /* SyntaxKind.ExternalModuleReference */: return emitExternalModuleReference(node); // JSX (non-expression) case 11 /* SyntaxKind.JsxText */: return emitJsxText(node); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 283 /* SyntaxKind.JsxOpeningFragment */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 286 /* SyntaxKind.JsxOpeningFragment */: return emitJsxOpeningElementOrFragment(node); - case 281 /* SyntaxKind.JsxClosingElement */: - case 284 /* SyntaxKind.JsxClosingFragment */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 287 /* SyntaxKind.JsxClosingFragment */: return emitJsxClosingElementOrFragment(node); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return emitJsxAttribute(node); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return emitJsxAttributes(node); - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: return emitJsxSpreadAttribute(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return emitJsxExpression(node); // Clauses - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return emitCaseClause(node); - case 290 /* SyntaxKind.DefaultClause */: + case 293 /* SyntaxKind.DefaultClause */: return emitDefaultClause(node); - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return emitHeritageClause(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return emitCatchClause(node); // Property assignments - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return emitPropertyAssignment(node); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return emitSpreadAssignment(node); // Enum - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return emitEnumMember(node); // Unparsed - case 300 /* SyntaxKind.UnparsedPrologue */: + case 303 /* SyntaxKind.UnparsedPrologue */: return writeUnparsedNode(node); - case 307 /* SyntaxKind.UnparsedSource */: - case 301 /* SyntaxKind.UnparsedPrepend */: + case 310 /* SyntaxKind.UnparsedSource */: + case 304 /* SyntaxKind.UnparsedPrepend */: return emitUnparsedSourceOrPrepend(node); - case 302 /* SyntaxKind.UnparsedText */: - case 303 /* SyntaxKind.UnparsedInternalText */: + case 305 /* SyntaxKind.UnparsedText */: + case 306 /* SyntaxKind.UnparsedInternalText */: return emitUnparsedTextLike(node); - case 304 /* SyntaxKind.UnparsedSyntheticReference */: + case 307 /* SyntaxKind.UnparsedSyntheticReference */: return emitUnparsedSyntheticReference(node); // Top-level nodes - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return emitSourceFile(node); - case 306 /* SyntaxKind.Bundle */: + case 309 /* SyntaxKind.Bundle */: return ts.Debug.fail("Bundles should be printed using printBundle"); // SyntaxKind.UnparsedSource (handled above) - case 308 /* SyntaxKind.InputFiles */: + case 311 /* SyntaxKind.InputFiles */: return ts.Debug.fail("InputFiles should not be printed"); // JSDoc nodes (only used in codefixes currently) - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return emitJSDocTypeExpression(node); - case 310 /* SyntaxKind.JSDocNameReference */: + case 313 /* SyntaxKind.JSDocNameReference */: return emitJSDocNameReference(node); - case 312 /* SyntaxKind.JSDocAllType */: + case 315 /* SyntaxKind.JSDocAllType */: return writePunctuation("*"); - case 313 /* SyntaxKind.JSDocUnknownType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return writePunctuation("?"); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return emitJSDocNullableType(node); - case 315 /* SyntaxKind.JSDocNonNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: return emitJSDocNonNullableType(node); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return emitJSDocOptionalType(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return emitJSDocFunctionType(node); - case 186 /* SyntaxKind.RestType */: - case 318 /* SyntaxKind.JSDocVariadicType */: + case 188 /* SyntaxKind.RestType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return emitRestOrJSDocVariadicType(node); - case 319 /* SyntaxKind.JSDocNamepathType */: + case 322 /* SyntaxKind.JSDocNamepathType */: return; - case 320 /* SyntaxKind.JSDoc */: + case 323 /* SyntaxKind.JSDoc */: return emitJSDoc(node); - case 322 /* SyntaxKind.JSDocTypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: return emitJSDocTypeLiteral(node); - case 323 /* SyntaxKind.JSDocSignature */: + case 326 /* SyntaxKind.JSDocSignature */: return emitJSDocSignature(node); - case 327 /* SyntaxKind.JSDocTag */: - case 332 /* SyntaxKind.JSDocClassTag */: - case 337 /* SyntaxKind.JSDocOverrideTag */: + case 330 /* SyntaxKind.JSDocTag */: + case 335 /* SyntaxKind.JSDocClassTag */: + case 340 /* SyntaxKind.JSDocOverrideTag */: return emitJSDocSimpleTag(node); - case 328 /* SyntaxKind.JSDocAugmentsTag */: - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return emitJSDocHeritageTag(node); - case 330 /* SyntaxKind.JSDocAuthorTag */: - case 331 /* SyntaxKind.JSDocDeprecatedTag */: + case 333 /* SyntaxKind.JSDocAuthorTag */: + case 334 /* SyntaxKind.JSDocDeprecatedTag */: return; // SyntaxKind.JSDocClassTag (see JSDocTag, above) - case 333 /* SyntaxKind.JSDocPublicTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 336 /* SyntaxKind.JSDocReadonlyTag */: + case 336 /* SyntaxKind.JSDocPublicTag */: + case 337 /* SyntaxKind.JSDocPrivateTag */: + case 338 /* SyntaxKind.JSDocProtectedTag */: + case 339 /* SyntaxKind.JSDocReadonlyTag */: return; - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return emitJSDocCallbackTag(node); // SyntaxKind.JSDocEnumTag (see below) - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return emitJSDocPropertyLikeTag(node); - case 339 /* SyntaxKind.JSDocEnumTag */: - case 341 /* SyntaxKind.JSDocReturnTag */: - case 342 /* SyntaxKind.JSDocThisTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: + case 345 /* SyntaxKind.JSDocThisTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return emitJSDocSimpleTypedTag(node); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return emitJSDocTemplateTag(node); - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return emitJSDocTypedefTag(node); - case 346 /* SyntaxKind.JSDocSeeTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: return emitJSDocSeeTag(node); // SyntaxKind.JSDocPropertyTag (see JSDocParameterTag, above) // Transformation nodes - case 349 /* SyntaxKind.NotEmittedStatement */: - case 353 /* SyntaxKind.EndOfDeclarationMarker */: - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 352 /* SyntaxKind.NotEmittedStatement */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return; } if (ts.isExpression(node)) { @@ -113030,85 +113842,87 @@ var ts; case 80 /* SyntaxKind.PrivateIdentifier */: return emitPrivateIdentifier(node); // Expressions - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return emitArrayLiteralExpression(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return emitObjectLiteralExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return emitPropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return emitElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return emitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return emitNewExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return emitTypeAssertionExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return emitParenthesizedExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return emitFunctionExpression(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return emitArrowFunction(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return emitDeleteExpression(node); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return emitTypeOfExpression(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return emitVoidExpression(node); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return emitAwaitExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return emitBinaryExpression(node); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return emitConditionalExpression(node); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return emitTemplateExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return emitYieldExpression(node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return emitSpreadElement(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return emitClassExpression(node); - case 227 /* SyntaxKind.OmittedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: return; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: return emitAsExpression(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return emitNonNullExpression(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 231 /* SyntaxKind.MetaProperty */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return emitSatisfiesExpression(node); + case 233 /* SyntaxKind.MetaProperty */: return emitMetaProperty(node); - case 232 /* SyntaxKind.SyntheticExpression */: + case 234 /* SyntaxKind.SyntheticExpression */: return ts.Debug.fail("SyntheticExpression should never be printed."); // JSX - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return emitJsxElement(node); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return emitJsxFragment(node); // Synthesized list - case 348 /* SyntaxKind.SyntaxList */: + case 351 /* SyntaxKind.SyntaxList */: return ts.Debug.fail("SyntaxList should not be printed"); // Transformation nodes - case 349 /* SyntaxKind.NotEmittedStatement */: + case 352 /* SyntaxKind.NotEmittedStatement */: return; - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return emitCommaList(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return; - case 354 /* SyntaxKind.SyntheticReferenceExpression */: + case 357 /* SyntaxKind.SyntheticReferenceExpression */: return ts.Debug.fail("SyntheticReferenceExpression should not be printed"); } } @@ -113156,7 +113970,7 @@ var ts; } function emitHelpers(node) { var helpersEmitted = false; - var bundle = node.kind === 306 /* SyntaxKind.Bundle */ ? node : undefined; + var bundle = node.kind === 309 /* SyntaxKind.Bundle */ ? node : undefined; if (bundle && moduleKind === ts.ModuleKind.None) { return; } @@ -113256,7 +114070,7 @@ var ts; var pos = getTextPosWithWriteLine(); writeUnparsedNode(unparsed); if (bundleFileInfo) { - updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 302 /* SyntaxKind.UnparsedText */ ? + updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 305 /* SyntaxKind.UnparsedText */ ? "text" /* BundleFileSectionKind.Text */ : "internal" /* BundleFileSectionKind.Internal */); } @@ -113293,7 +114107,7 @@ var ts; } function emitTabStop(hint, node, snippet) { // A tab stop should only be attached to an empty node, i.e. a node that doesn't emit any text. - ts.Debug.assert(node.kind === 236 /* SyntaxKind.EmptyStatement */, "A tab stop cannot be attached to a node of kind ".concat(ts.Debug.formatSyntaxKind(node.kind), ".")); + ts.Debug.assert(node.kind === 239 /* SyntaxKind.EmptyStatement */, "A tab stop cannot be attached to a node of kind ".concat(ts.Debug.formatSyntaxKind(node.kind), ".")); ts.Debug.assert(hint !== 5 /* EmitHint.EmbeddedStatement */, "A tab stop cannot be attached to an embedded statement."); nonEscapingWrite("$".concat(snippet.order)); } @@ -113354,7 +114168,7 @@ var ts; emit(node.dotDotDotToken); emitNodeWithWriter(node.name, writeParameter); emit(node.questionToken); - if (node.parent && node.parent.kind === 317 /* SyntaxKind.JSDocFunctionType */ && !node.name) { + if (node.parent && node.parent.kind === 320 /* SyntaxKind.JSDocFunctionType */ && !node.name) { emit(node.type); } else { @@ -113415,7 +114229,7 @@ var ts; } function emitAccessorDeclaration(node) { emitDecoratorsAndModifiers(node, node.modifiers); - writeKeyword(node.kind === 172 /* SyntaxKind.GetAccessor */ ? "get" : "set"); + writeKeyword(node.kind === 174 /* SyntaxKind.GetAccessor */ ? "get" : "set"); writeSpace(); emit(node.name); emitSignatureAndBody(node, emitSignatureHead); @@ -113588,7 +114402,7 @@ var ts; function emitTypeOperator(node) { writeTokenText(node.operator, writeKeyword); writeSpace(); - var parenthesizerRule = node.operator === 145 /* SyntaxKind.ReadonlyKeyword */ ? + var parenthesizerRule = node.operator === 146 /* SyntaxKind.ReadonlyKeyword */ ? parenthesizer.parenthesizeOperandOfReadonlyTypeOperator : parenthesizer.parenthesizeOperandOfTypeOperator; emit(node.type, parenthesizerRule); @@ -113611,7 +114425,7 @@ var ts; } if (node.readonlyToken) { emit(node.readonlyToken); - if (node.readonlyToken.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { + if (node.readonlyToken.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { writeKeyword("readonly"); } writeSpace(); @@ -113857,7 +114671,7 @@ var ts; emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } function emitAwaitExpression(node) { - emitTokenWithComment(132 /* SyntaxKind.AwaitKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(133 /* SyntaxKind.AwaitKeyword */, node.pos, writeKeyword, node); writeSpace(); emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } @@ -113882,7 +114696,7 @@ var ts; // expression a prefix increment whose operand is a plus expression - (++(+x)) // The same is true of minus of course. var operand = node.operand; - return operand.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ + return operand.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && ((node.operator === 39 /* SyntaxKind.PlusToken */ && (operand.operator === 39 /* SyntaxKind.PlusToken */ || operand.operator === 45 /* SyntaxKind.PlusPlusToken */)) || (node.operator === 40 /* SyntaxKind.MinusToken */ && (operand.operator === 40 /* SyntaxKind.MinusToken */ || operand.operator === 46 /* SyntaxKind.MinusMinusToken */))); } @@ -114030,6 +114844,15 @@ var ts; emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess); writeOperator("!"); } + function emitSatisfiesExpression(node) { + emitExpression(node.expression, /*parenthesizerRules*/ undefined); + if (node.type) { + writeSpace(); + writeKeyword("satisfies"); + writeSpace(); + emit(node.type); + } + } function emitMetaProperty(node) { writeToken(node.keywordToken, node.pos, writePunctuation); writePunctuation("."); @@ -114087,7 +114910,7 @@ var ts; if (node.elseStatement) { writeLineOrSpace(node, node.thenStatement, node.elseStatement); emitTokenWithComment(91 /* SyntaxKind.ElseKeyword */, node.thenStatement.end, writeKeyword, node); - if (node.elseStatement.kind === 239 /* SyntaxKind.IfStatement */) { + if (node.elseStatement.kind === 242 /* SyntaxKind.IfStatement */) { writeSpace(); emit(node.elseStatement); } @@ -114150,7 +114973,7 @@ var ts; emitTokenWithComment(20 /* SyntaxKind.OpenParenToken */, openParenPos, writePunctuation, node); emitForBinding(node.initializer); writeSpace(); - emitTokenWithComment(160 /* SyntaxKind.OfKeyword */, node.initializer.end, writeKeyword, node); + emitTokenWithComment(162 /* SyntaxKind.OfKeyword */, node.initializer.end, writeKeyword, node); writeSpace(); emitExpression(node.expression); emitTokenWithComment(21 /* SyntaxKind.CloseParenToken */, node.expression.end, writePunctuation, node); @@ -114158,7 +114981,7 @@ var ts; } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { emit(node); } else { @@ -114195,7 +115018,7 @@ var ts; } pos = writeTokenText(token, writer, pos); if (isSimilarNode && contextNode.end !== pos) { - var isJsxExprContext = contextNode.kind === 288 /* SyntaxKind.JsxExpression */; + var isJsxExprContext = contextNode.kind === 291 /* SyntaxKind.JsxExpression */; emitTrailingCommentsOfPosition(pos, /*prefixSpace*/ !isJsxExprContext, /*forceNoNewline*/ isJsxExprContext); } return pos; @@ -114505,7 +115328,7 @@ var ts; emitTokenWithComment(100 /* SyntaxKind.ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114530,7 +115353,7 @@ var ts; if (node.importClause) { emit(node.importClause); writeSpace(); - emitTokenWithComment(156 /* SyntaxKind.FromKeyword */, node.importClause.end, writeKeyword, node); + emitTokenWithComment(158 /* SyntaxKind.FromKeyword */, node.importClause.end, writeKeyword, node); writeSpace(); } emitExpression(node.moduleSpecifier); @@ -114541,7 +115364,7 @@ var ts; } function emitImportClause(node) { if (node.isTypeOnly) { - emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114554,7 +115377,7 @@ var ts; function emitNamespaceImport(node) { var asPos = emitTokenWithComment(41 /* SyntaxKind.AsteriskToken */, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -114580,10 +115403,11 @@ var ts; writeTrailingSemicolon(); } function emitExportDeclaration(node) { + emitModifiers(node, node.modifiers); var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - nextPos = emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, nextPos, writeKeyword, node); writeSpace(); } if (node.exportClause) { @@ -114595,7 +115419,7 @@ var ts; if (node.moduleSpecifier) { writeSpace(); var fromPos = node.exportClause ? node.exportClause.end : nextPos; - emitTokenWithComment(156 /* SyntaxKind.FromKeyword */, fromPos, writeKeyword, node); + emitTokenWithComment(158 /* SyntaxKind.FromKeyword */, fromPos, writeKeyword, node); writeSpace(); emitExpression(node.moduleSpecifier); } @@ -114605,7 +115429,7 @@ var ts; writeTrailingSemicolon(); } function emitAssertClause(node) { - emitTokenWithComment(129 /* SyntaxKind.AssertKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(130 /* SyntaxKind.AssertKeyword */, node.pos, writeKeyword, node); writeSpace(); var elements = node.elements; emitList(node, elements, 526226 /* ListFormat.ImportClauseEntries */); @@ -114625,9 +115449,9 @@ var ts; function emitNamespaceExportDeclaration(node) { var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, nextPos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(142 /* SyntaxKind.NamespaceKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(143 /* SyntaxKind.NamespaceKeyword */, nextPos, writeKeyword, node); writeSpace(); emit(node.name); writeTrailingSemicolon(); @@ -114635,7 +115459,7 @@ var ts; function emitNamespaceExport(node) { var asPos = emitTokenWithComment(41 /* SyntaxKind.AsteriskToken */, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -114658,7 +115482,7 @@ var ts; if (node.propertyName) { emit(node.propertyName); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, node.propertyName.end, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, node.propertyName.end, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114879,7 +115703,7 @@ var ts; } } if (node.tags) { - if (node.tags.length === 1 && node.tags[0].kind === 343 /* SyntaxKind.JSDocTypeTag */ && !node.comment) { + if (node.tags.length === 1 && node.tags[0].kind === 346 /* SyntaxKind.JSDocTypeTag */ && !node.comment) { writeSpace(); emit(node.tags[0]); } @@ -114924,7 +115748,7 @@ var ts; function emitJSDocTypedefTag(tag) { emitJSDocTagName(tag.tagName); if (tag.typeExpression) { - if (tag.typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */) { + if (tag.typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */) { emitJSDocTypeExpression(tag.typeExpression); } else { @@ -114943,7 +115767,7 @@ var ts; emit(tag.fullName); } emitJSDocComment(tag.comment); - if (tag.typeExpression && tag.typeExpression.kind === 322 /* SyntaxKind.JSDocTypeLiteral */) { + if (tag.typeExpression && tag.typeExpression.kind === 325 /* SyntaxKind.JSDocTypeLiteral */) { emitJSDocTypeLiteral(tag.typeExpression); } } @@ -115876,13 +116700,13 @@ var ts; && (!currentSourceFile || ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile)); } function skipSynthesizedParentheses(node) { - while (node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { + while (node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; } function getTextOfNode(node, includeTrivia) { - if (ts.isGeneratedIdentifier(node)) { + if (ts.isGeneratedIdentifier(node) || ts.isGeneratedPrivateIdentifier(node)) { return generateName(node); } if (ts.isStringLiteral(node) && node.textSourceNode) { @@ -115906,7 +116730,7 @@ var ts; function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) { if (node.kind === 10 /* SyntaxKind.StringLiteral */ && node.textSourceNode) { var textSourceNode = node.textSourceNode; - if (ts.isIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) { + if (ts.isIdentifier(textSourceNode) || ts.isPrivateIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) { var text = ts.isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode(textSourceNode); return jsxAttributeEscape ? "\"".concat(ts.escapeJsxAttributeString(text), "\"") : neverAsciiEscape || (ts.getEmitFlags(node) & 16777216 /* EmitFlags.NoAsciiEscaping */) ? "\"".concat(ts.escapeString(text), "\"") : @@ -115930,7 +116754,11 @@ var ts; return; } tempFlagsStack.push(tempFlags); - tempFlags = 0; + tempFlags = 0 /* TempFlags.Auto */; + privateNameTempFlagsStack.push(privateNameTempFlags); + privateNameTempFlags = 0 /* TempFlags.Auto */; + formattedNameTempFlagsStack.push(formattedNameTempFlags); + formattedNameTempFlags = undefined; reservedNamesStack.push(reservedNames); } /** @@ -115941,6 +116769,8 @@ var ts; return; } tempFlags = tempFlagsStack.pop(); + privateNameTempFlags = privateNameTempFlagsStack.pop(); + formattedNameTempFlags = formattedNameTempFlagsStack.pop(); reservedNames = reservedNamesStack.pop(); } function reserveNameInNestedScopes(name) { @@ -115953,84 +116783,84 @@ var ts; if (!node) return; switch (node.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: ts.forEach(node.statements, generateNames); break; - case 250 /* SyntaxKind.LabeledStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 253 /* SyntaxKind.LabeledStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: generateNames(node.statement); break; - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: generateNames(node.thenStatement); generateNames(node.elseStatement); break; - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: generateNames(node.initializer); generateNames(node.statement); break; - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: generateNames(node.caseBlock); break; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: ts.forEach(node.clauses, generateNames); break; - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: ts.forEach(node.statements, generateNames); break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: generateNames(node.tryBlock); generateNames(node.catchClause); generateNames(node.finallyBlock); break; - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: generateNames(node.variableDeclaration); generateNames(node.block); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: generateNames(node.declarationList); break; - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: ts.forEach(node.declarations, generateNames); break; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: generateNameIfNeeded(node.name); break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: generateNameIfNeeded(node.name); if (ts.getEmitFlags(node) & 524288 /* EmitFlags.ReuseTempVariableScope */) { ts.forEach(node.parameters, generateNames); generateNames(node.body); } break; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: ts.forEach(node.elements, generateNames); break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: generateNames(node.importClause); break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: generateNameIfNeeded(node.name); generateNames(node.namedBindings); break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: generateNameIfNeeded(node.name); break; - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: generateNameIfNeeded(node.name); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: ts.forEach(node.elements, generateNames); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: generateNameIfNeeded(node.propertyName || node.name); break; } @@ -116039,19 +116869,19 @@ var ts; if (!node) return; switch (node.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: generateNameIfNeeded(node.name); break; } } function generateNameIfNeeded(name) { if (name) { - if (ts.isGeneratedIdentifier(name)) { + if (ts.isGeneratedIdentifier(name) || ts.isGeneratedPrivateIdentifier(name)) { generateName(name); } else if (ts.isBindingPattern(name)) { @@ -116066,7 +116896,7 @@ var ts; if ((name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) === 4 /* GeneratedIdentifierFlags.Node */) { // Node names generate unique names based on their original node // and are cached based on that node's id. - return generateNameCached(getNodeForGeneratedName(name), name.autoGenerateFlags); + return generateNameCached(ts.getNodeForGeneratedName(name), ts.isPrivateIdentifier(name), name.autoGenerateFlags, name.autoGeneratePrefix, name.autoGenerateSuffix); } else { // Auto, Loop, and Unique names are cached based on their unique @@ -116075,9 +116905,9 @@ var ts; return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = makeName(name)); } } - function generateNameCached(node, flags) { + function generateNameCached(node, privateName, flags, prefix, suffix) { var nodeId = ts.getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, flags)); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, privateName, flags !== null && flags !== void 0 ? flags : 0 /* GeneratedIdentifierFlags.None */, ts.formatGeneratedNamePart(prefix, generateName), ts.formatGeneratedNamePart(suffix))); } /** * Returns a value indicating whether a name is unique globally, within the current file, @@ -116109,20 +116939,53 @@ var ts; } return true; } + function getTempFlags(formattedNameKey) { + var _a; + switch (formattedNameKey) { + case "": + return tempFlags; + case "#": + return privateNameTempFlags; + default: + return (_a = formattedNameTempFlags === null || formattedNameTempFlags === void 0 ? void 0 : formattedNameTempFlags.get(formattedNameKey)) !== null && _a !== void 0 ? _a : 0 /* TempFlags.Auto */; + } + } + function setTempFlags(formattedNameKey, flags) { + switch (formattedNameKey) { + case "": + tempFlags = flags; + break; + case "#": + privateNameTempFlags = flags; + break; + default: + formattedNameTempFlags !== null && formattedNameTempFlags !== void 0 ? formattedNameTempFlags : (formattedNameTempFlags = new ts.Map()); + formattedNameTempFlags.set(formattedNameKey, flags); + break; + } + } /** * Return the next available name in the pattern _a ... _z, _0, _1, ... * TempFlags._i or TempFlags._n may be used to express a preference for that dedicated name. * Note that names generated by makeTempVariableName and makeUniqueName will never conflict. */ - function makeTempVariableName(flags, reservedInNestedScopes) { + function makeTempVariableName(flags, reservedInNestedScopes, privateName, prefix, suffix) { + if (prefix.length > 0 && prefix.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + prefix = prefix.slice(1); + } + // Generate a key to use to acquire a TempFlags counter based on the fixed portions of the generated name. + var key = ts.formatGeneratedName(privateName, prefix, "", suffix); + var tempFlags = getTempFlags(key); if (flags && !(tempFlags & flags)) { var name = flags === 268435456 /* TempFlags._i */ ? "_i" : "_n"; - if (isUniqueName(name)) { + var fullName = ts.formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { tempFlags |= flags; if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } while (true) { @@ -116133,11 +116996,13 @@ var ts; var name = count < 26 ? "_" + String.fromCharCode(97 /* CharacterCodes.a */ + count) : "_" + (count - 26); - if (isUniqueName(name)) { + var fullName = ts.formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } } @@ -116149,17 +117014,24 @@ var ts; * makeUniqueName are guaranteed to never conflict. * If `optimistic` is set, the first instance will use 'baseName' verbatim instead of 'baseName_1' */ - function makeUniqueName(baseName, checkFn, optimistic, scoped) { + function makeUniqueName(baseName, checkFn, optimistic, scoped, privateName, prefix, suffix) { if (checkFn === void 0) { checkFn = isUniqueName; } + if (baseName.length > 0 && baseName.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + baseName = baseName.slice(1); + } + if (prefix.length > 0 && prefix.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + prefix = prefix.slice(1); + } if (optimistic) { - if (checkFn(baseName)) { + var fullName = ts.formatGeneratedName(privateName, prefix, baseName, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(baseName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(baseName); + generatedNames.add(fullName); } - return baseName; + return fullName; } } // Find the first unique 'name_n', where n is a positive number @@ -116168,21 +117040,21 @@ var ts; } var i = 1; while (true) { - var generatedName = baseName + i; - if (checkFn(generatedName)) { + var fullName = ts.formatGeneratedName(privateName, prefix, baseName + i, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(generatedName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(generatedName); + generatedNames.add(fullName); } - return generatedName; + return fullName; } i++; } } function makeFileLevelOptimisticUniqueName(name) { - return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true); + return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a ModuleDeclaration or EnumDeclaration. @@ -116190,7 +117062,7 @@ var ts; function generateNameForModuleOrEnum(node) { var name = getTextOfNode(node.name); // Use module/enum name itself if it is unique, otherwise make a unique variation - return isUniqueLocalName(name, node) ? name : makeUniqueName(name); + return isUniqueLocalName(name, node) ? name : makeUniqueName(name, isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for an ImportDeclaration or ExportDeclaration. @@ -116199,89 +117071,76 @@ var ts; var expr = ts.getExternalModuleName(node); // TODO: GH#18217 var baseName = ts.isStringLiteral(expr) ? ts.makeIdentifierFromModuleName(expr.text) : "module"; - return makeUniqueName(baseName); + return makeUniqueName(baseName, isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a default export. */ function generateNameForExportDefault() { - return makeUniqueName("default"); + return makeUniqueName("default", isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a class expression. */ function generateNameForClassExpression() { - return makeUniqueName("class"); + return makeUniqueName("class", isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } - function generateNameForMethodOrAccessor(node) { + function generateNameForMethodOrAccessor(node, privateName, prefix, suffix) { if (ts.isIdentifier(node.name)) { - return generateNameCached(node.name); + return generateNameCached(node.name, privateName); } - return makeTempVariableName(0 /* TempFlags.Auto */); + return makeTempVariableName(0 /* TempFlags.Auto */, /*reservedInNestedScopes*/ false, privateName, prefix, suffix); } /** * Generates a unique name from a node. */ - function generateNameForNode(node, flags) { + function generateNameForNode(node, privateName, flags, prefix, suffix) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(flags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 80 /* SyntaxKind.PrivateIdentifier */: + return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(flags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), privateName, prefix, suffix); + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForModuleOrEnum(node); - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForImportOrExportDeclaration(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForExportDefault(); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForClassExpression(); - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return generateNameForMethodOrAccessor(node); - case 162 /* SyntaxKind.ComputedPropertyName */: - return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ true); + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return generateNameForMethodOrAccessor(node, privateName, prefix, suffix); + case 164 /* SyntaxKind.ComputedPropertyName */: + return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ true, privateName, prefix, suffix); default: - return makeTempVariableName(0 /* TempFlags.Auto */); + return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ false, privateName, prefix, suffix); } } /** * Generates a unique identifier for a node. */ function makeName(name) { + var prefix = ts.formatGeneratedNamePart(name.autoGeneratePrefix, generateName); + var suffix = ts.formatGeneratedNamePart(name.autoGenerateSuffix); switch (name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) { case 1 /* GeneratedIdentifierFlags.Auto */: - return makeTempVariableName(0 /* TempFlags.Auto */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + return makeTempVariableName(0 /* TempFlags.Auto */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), ts.isPrivateIdentifier(name), prefix, suffix); case 2 /* GeneratedIdentifierFlags.Loop */: - return makeTempVariableName(268435456 /* TempFlags._i */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + ts.Debug.assertNode(name, ts.isIdentifier); + return makeTempVariableName(268435456 /* TempFlags._i */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), /*privateName*/ false, prefix, suffix); case 3 /* GeneratedIdentifierFlags.Unique */: - return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32 /* GeneratedIdentifierFlags.FileLevel */) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32 /* GeneratedIdentifierFlags.FileLevel */) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), ts.isPrivateIdentifier(name), prefix, suffix); } - return ts.Debug.fail("Unsupported GeneratedIdentifierKind."); - } - /** - * Gets the node from which a name should be generated. - */ - function getNodeForGeneratedName(name) { - var autoGenerateId = name.autoGenerateId; - var node = name; - var original = node.original; - while (original) { - node = original; - // if "node" is a different generated name (having a different - // "autoGenerateId"), use it and stop traversing. - if (ts.isIdentifier(node) - && !!(node.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) - && node.autoGenerateId !== autoGenerateId) { - break; - } - original = node.original; - } - // otherwise, return the original node for the source; - return node; + return ts.Debug.fail("Unsupported GeneratedIdentifierKind: ".concat(ts.Debug.formatEnum(name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */, ts.GeneratedIdentifierFlags, /*isFlags*/ true), ".")); } // Comments function pipelineEmitWithComments(hint, node) { @@ -116327,7 +117186,7 @@ var ts; // Emit leading comments if the position is not synthesized and the node // has not opted out from emitting leading comments. if (!skipLeadingComments) { - emitLeadingComments(pos, /*isEmittedNode*/ node.kind !== 349 /* SyntaxKind.NotEmittedStatement */); + emitLeadingComments(pos, /*isEmittedNode*/ node.kind !== 352 /* SyntaxKind.NotEmittedStatement */); } if (!skipLeadingComments || (pos >= 0 && (emitFlags & 512 /* EmitFlags.NoLeadingComments */) !== 0)) { // Advance the container position if comments get emitted or if they've been disabled explicitly using NoLeadingComments. @@ -116338,7 +117197,7 @@ var ts; containerEnd = end; // To avoid invalid comment emit in a down-level binding pattern, we // keep track of the last declaration list container's end - if (node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { declarationListContainerEnd = end; } } @@ -116357,7 +117216,7 @@ var ts; declarationListContainerEnd = savedDeclarationListContainerEnd; // Emit trailing comments if the position is not synthesized and the node // has not opted out from emitting leading comments and is an emitted node. - if (!skipTrailingComments && node.kind !== 349 /* SyntaxKind.NotEmittedStatement */) { + if (!skipTrailingComments && node.kind !== 352 /* SyntaxKind.NotEmittedStatement */) { emitTrailingComments(end); } } @@ -116638,7 +117497,7 @@ var ts; } else { var source = sourceMapRange.source || sourceMapSource; - if (node.kind !== 349 /* SyntaxKind.NotEmittedStatement */ + if (node.kind !== 352 /* SyntaxKind.NotEmittedStatement */ && (emitFlags & 16 /* EmitFlags.NoLeadingSourceMap */) === 0 && sourceMapRange.pos >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, skipSourceTrivia(source, sourceMapRange.pos)); @@ -116656,7 +117515,7 @@ var ts; if (emitFlags & 64 /* EmitFlags.NoNestedSourceMaps */) { sourceMapsDisabled = false; } - if (node.kind !== 349 /* SyntaxKind.NotEmittedStatement */ + if (node.kind !== 352 /* SyntaxKind.NotEmittedStatement */ && (emitFlags & 32 /* EmitFlags.NoTrailingSourceMap */) === 0 && sourceMapRange.end >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, sourceMapRange.end); @@ -116821,7 +117680,16 @@ var ts; return cachedReadDirectoryResult.get(ts.ensureTrailingDirectorySeparator(rootDirPath)); } function getCachedFileSystemEntriesForBaseDir(path) { - return getCachedFileSystemEntries(ts.getDirectoryPath(path)); + var entries = getCachedFileSystemEntries(ts.getDirectoryPath(path)); + if (!entries) { + return entries; + } + // If we're looking for the base directory, we're definitely going to search the entries + if (!entries.sortedAndCanonicalizedFiles) { + entries.sortedAndCanonicalizedFiles = entries.files.map(getCanonicalFileName).sort(); + entries.sortedAndCanonicalizedDirectories = entries.directories.map(getCanonicalFileName).sort(); + } + return entries; } function getBaseNameOfFileName(fileName) { return ts.getBaseFileName(ts.normalizePath(fileName)); @@ -116864,21 +117732,10 @@ var ts; return undefined; } } - function fileNameEqual(name1, name2) { - return getCanonicalFileName(name1) === getCanonicalFileName(name2); - } function hasEntry(entries, name) { - return ts.some(entries, function (file) { return fileNameEqual(file, name); }); - } - function updateFileSystemEntry(entries, baseName, isValid) { - if (hasEntry(entries, baseName)) { - if (!isValid) { - return ts.filterMutate(entries, function (entry) { return !fileNameEqual(entry, baseName); }); - } - } - else if (isValid) { - return entries.push(baseName); - } + // Case-sensitive comparison since already canonicalized + var index = ts.binarySearch(entries, name, ts.identity, ts.compareStringsCaseSensitive); + return index >= 0; } function writeFile(fileName, data, writeByteOrderMark) { var path = toPath(fileName); @@ -116891,7 +117748,7 @@ var ts; function fileExists(fileName) { var path = toPath(fileName); var result = getCachedFileSystemEntriesForBaseDir(path); - return result && hasEntry(result.files, getBaseNameOfFileName(fileName)) || + return result && hasEntry(result.sortedAndCanonicalizedFiles, getCanonicalFileName(getBaseNameOfFileName(fileName))) || host.fileExists(fileName); } function directoryExists(dirPath) { @@ -116901,9 +117758,14 @@ var ts; function createDirectory(dirPath) { var path = toPath(dirPath); var result = getCachedFileSystemEntriesForBaseDir(path); - var baseFileName = getBaseNameOfFileName(dirPath); if (result) { - updateFileSystemEntry(result.directories, baseFileName, /*isValid*/ true); + var baseName = getBaseNameOfFileName(dirPath); + var canonicalizedBaseName = getCanonicalFileName(baseName); + var canonicalizedDirectories = result.sortedAndCanonicalizedDirectories; + // Case-sensitive comparison since already canonicalized + if (ts.insertSorted(canonicalizedDirectories, canonicalizedBaseName, ts.compareStringsCaseSensitive)) { + result.directories.push(baseName); + } } host.createDirectory(dirPath); } @@ -116972,7 +117834,7 @@ var ts; fileExists: host.fileExists(fileOrDirectoryPath), directoryExists: host.directoryExists(fileOrDirectoryPath) }; - if (fsQueryResult.directoryExists || hasEntry(parentResult.directories, baseName)) { + if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) { // Folder added or removed, clear the cache instead of updating the folder and its structure clearCache(); } @@ -116992,7 +117854,23 @@ var ts; } } function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists) { - updateFileSystemEntry(parentResult.files, baseName, fileExists); + var canonicalizedFiles = parentResult.sortedAndCanonicalizedFiles; + var canonicalizedBaseName = getCanonicalFileName(baseName); + if (fileExists) { + // Case-sensitive comparison since already canonicalized + if (ts.insertSorted(canonicalizedFiles, canonicalizedBaseName, ts.compareStringsCaseSensitive)) { + parentResult.files.push(baseName); + } + } + else { + // Case-sensitive comparison since already canonicalized + var sortedIndex = ts.binarySearch(canonicalizedFiles, canonicalizedBaseName, ts.identity, ts.compareStringsCaseSensitive); + if (sortedIndex >= 0) { + canonicalizedFiles.splice(sortedIndex, 1); + var unsortedIndex = parentResult.files.findIndex(function (entry) { return getCanonicalFileName(entry) === canonicalizedBaseName; }); + parentResult.files.splice(unsortedIndex, 1); + } + } } function clearCache() { cachedReadDirectoryResult.clear(); @@ -117752,7 +118630,6 @@ var ts; return resolutions; } ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache; - ; /** * Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly * provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file. @@ -118057,7 +118934,7 @@ var ts; state.failedLookupLocations = packageJsonLocations; state.affectingLocations = packageJsonLocations; var packageJsonScope = ts.getPackageScopeForPath(fileName, state); - var impliedNodeFormat = (packageJsonScope === null || packageJsonScope === void 0 ? void 0 : packageJsonScope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS; + var impliedNodeFormat = (packageJsonScope === null || packageJsonScope === void 0 ? void 0 : packageJsonScope.contents.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS; return { impliedNodeFormat: impliedNodeFormat, packageJsonLocations: packageJsonLocations, packageJsonScope: packageJsonScope }; } } @@ -119297,22 +120174,22 @@ var ts; // Return directly from the case if the given node doesnt want to visit each child // Otherwise break to visit each child switch (parent.kind) { - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: if (parent.questionToken === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?")); return "skip"; } // falls through - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 257 /* SyntaxKind.VariableDeclaration */: // type annotation if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_annotations_can_only_be_used_in_TypeScript_files)); @@ -119320,65 +120197,68 @@ var ts; } } switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "import type")); return "skip"; } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "export type")); return "skip"; } break; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, ts.isImportSpecifier(node) ? "import...type" : "export...type")); return "skip"; } break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_TypeScript_files)); return "skip"; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: var heritageClause = node; if (heritageClause.token === 117 /* SyntaxKind.ImplementsKeyword */) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: var interfaceKeyword = ts.tokenToString(118 /* SyntaxKind.InterfaceKeyword */); ts.Debug.assertIsDefined(interfaceKeyword); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, interfaceKeyword)); return "skip"; - case 261 /* SyntaxKind.ModuleDeclaration */: - var moduleKeyword = node.flags & 16 /* NodeFlags.Namespace */ ? ts.tokenToString(142 /* SyntaxKind.NamespaceKeyword */) : ts.tokenToString(141 /* SyntaxKind.ModuleKeyword */); + case 264 /* SyntaxKind.ModuleDeclaration */: + var moduleKeyword = node.flags & 16 /* NodeFlags.Namespace */ ? ts.tokenToString(143 /* SyntaxKind.NamespaceKeyword */) : ts.tokenToString(142 /* SyntaxKind.ModuleKeyword */); ts.Debug.assertIsDefined(moduleKeyword); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, moduleKeyword)); return "skip"; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files)); return "skip"; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: var enumKeyword = ts.Debug.checkDefined(ts.tokenToString(92 /* SyntaxKind.EnumKeyword */)); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, enumKeyword)); return "skip"; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Non_null_assertions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_assertion_expressions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files)); + return "skip"; + case 213 /* SyntaxKind.TypeAssertionExpression */: ts.Debug.fail(); // Won't parse these in a JS file anyway, as they are interpreted as JSX. } } @@ -119387,53 +120267,55 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning)); } switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: // Check type parameters if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files)); return "skip"; } // falls through - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // Check modifiers if (nodes === parent.modifiers) { - checkModifiers(parent.modifiers, parent.kind === 237 /* SyntaxKind.VariableStatement */); + checkModifiers(parent.modifiers, parent.kind === 240 /* SyntaxKind.VariableStatement */); return "skip"; } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // Check modifiers of property declaration if (nodes === parent.modifiers) { for (var _i = 0, _a = nodes; _i < _a.length; _i++) { var modifier = _a[_i]; - if (ts.isModifier(modifier) && modifier.kind !== 124 /* SyntaxKind.StaticKeyword */) { + if (ts.isModifier(modifier) + && modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ + && modifier.kind !== 127 /* SyntaxKind.AccessorKeyword */) { diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind))); } } return "skip"; } break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Check modifiers of parameter declaration if (nodes === parent.modifiers && ts.some(nodes, ts.isModifier)) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Parameter_modifiers_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // Check type arguments if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_arguments_can_only_be_used_in_TypeScript_files)); @@ -119455,18 +120337,19 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind))); break; // These are all legal modifiers. case 124 /* SyntaxKind.StaticKeyword */: case 93 /* SyntaxKind.ExportKeyword */: case 88 /* SyntaxKind.DefaultKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: } } } @@ -119788,7 +120671,7 @@ var ts; // It's a _little odd_ that we can't set `impliedNodeFormat` until the program step - but it's the first and only time we have a resolution cache // and a freshly made source file node on hand at the same time, and we need both to set the field. Persisting the resolution cache all the way // to the check and emit steps would be bad - so we much prefer detecting and storing the format information on the source file node upfront. - var result = getImpliedNodeFormatForFileWorker(toPath(fileName), moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options); + var result = getImpliedNodeFormatForFileWorker(ts.getNormalizedAbsolutePath(fileName, currentDirectory), moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options); var languageVersion = ts.getEmitScriptTarget(options); var setExternalModuleIndicator = ts.getSetExternalModuleIndicator(options); return typeof result === "object" ? __assign(__assign({}, result), { languageVersion: languageVersion, setExternalModuleIndicator: setExternalModuleIndicator }) : @@ -120391,10 +121274,12 @@ var ts; if (options.preserveConstEnums === false) { createDiagnosticForOptionName(ts.Diagnostics.Option_preserveConstEnums_cannot_be_disabled_when_isolatedModules_is_enabled, "preserveConstEnums", "isolatedModules"); } - var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !ts.isSourceFileJS(f) && !f.isDeclarationFile && f.scriptKind !== 6 /* ScriptKind.JSON */; }); - if (firstNonExternalModuleSourceFile) { - var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(firstNonExternalModuleSourceFile.fileName))); + for (var _a = 0, files_5 = files; _a < files_5.length; _a++) { + var file = files_5[_a]; + if (!ts.isExternalModule(file) && !ts.isSourceFileJS(file) && !file.isDeclarationFile && file.scriptKind !== 6 /* ScriptKind.JSON */) { + var span = ts.getErrorSpanForNode(file, file); + programDiagnostics.add(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(file.fileName))); + } } } else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 /* ScriptTarget.ES2015 */ && options.module === ts.ModuleKind.None) { @@ -124121,7 +125006,7 @@ var ts; }); // Sort by paths closest to importing file Name directory var sortedPaths = []; - var _loop_35 = function (directory) { + var _loop_36 = function (directory) { var directoryStart = ts.ensureTrailingDirectorySeparator(directory); var pathsInDirectory; allFileNames.forEach(function (_a, fileName) { @@ -124145,9 +125030,9 @@ var ts; }; var out_directory_1; for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) { - var state_11 = _loop_35(directory); + var state_12 = _loop_36(directory); directory = out_directory_1; - if (state_11 === "break") + if (state_12 === "break") break; } if (allFileNames.size) { @@ -124216,7 +125101,7 @@ var ts; } function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) { for (var key in paths) { - var _loop_36 = function (patternText_1) { + var _loop_37 = function (patternText_1) { var pattern = ts.normalizePath(patternText_1); var indexOfStar = pattern.indexOf("*"); // In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly, @@ -124283,9 +125168,9 @@ var ts; }; for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) { var patternText_1 = _a[_i]; - var state_12 = _loop_36(patternText_1); - if (typeof state_12 === "object") - return state_12.value; + var state_13 = _loop_37(patternText_1); + if (typeof state_13 === "object") + return state_13.value; } } function validateEnding(_a) { @@ -124449,7 +125334,7 @@ var ts; var maybeBlockedByTypesVersions = false; var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath); if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) { - var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath)); + var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath)); var importMode = overrideMode || importingSourceFile.impliedNodeFormat; if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) { var conditions = ["node", importMode === ts.ModuleKind.ESNext ? "import" : "require", "types"]; @@ -124811,7 +125696,7 @@ var ts; case ts.ModuleKind.CommonJS: if (file.packageJsonScope) { (result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages( - /*details*/ undefined, file.packageJsonScope.packageJsonContent.type ? + /*details*/ undefined, file.packageJsonScope.contents.packageJsonContent.type ? ts.Diagnostics.File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module : ts.Diagnostics.File_is_CommonJS_module_because_0_does_not_have_field_type, toFileName(ts.last(file.packageJsonLocations), fileNameConvertor))); } @@ -125230,18 +126115,14 @@ var ts; if (host.getBuildInfo) { // host provides buildinfo, get it from there. This allows host to cache it buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath); - if (!buildInfo) - return undefined; } else { var content = host.readFile(buildInfoPath); if (!content) return undefined; - buildInfo = ts.getBuildInfo(content); + buildInfo = ts.getBuildInfo(buildInfoPath, content); } - if (buildInfo.version !== ts.version) - return undefined; - if (!buildInfo.program) + if (!buildInfo || buildInfo.version !== ts.version || !buildInfo.program) return undefined; return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host); } @@ -125463,7 +126344,8 @@ var ts; } // All resolutions are invalid if user provided resolutions var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution); - if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + 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 (hasChangedConfigFileParsingErrors) { if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); @@ -125482,6 +126364,11 @@ var ts; if (host.afterProgramCreate && program !== builderProgram) { host.afterProgramCreate(builderProgram); } + compilerHost.readFile = originalReadFile; + compilerHost.fileExists = originalFileExists; + compilerHost.directoryExists = originalDirectoryExists; + compilerHost.createDirectory = originalCreateDirectory; + compilerHost.writeFile = originalWriteFile; return builderProgram; } function createNewProgram(hasInvalidatedResolution) { @@ -125959,19 +126846,20 @@ var ts; */ UpToDateStatusType[UpToDateStatusType["OutOfDateWithPrepend"] = 3] = "OutOfDateWithPrepend"; UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing"; - UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf"; - UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream"; - UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo"; - UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate"; - UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked"; - UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream"; - UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate"; - UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText"; + UpToDateStatusType[UpToDateStatusType["ErrorReadingFile"] = 5] = "ErrorReadingFile"; + UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 6] = "OutOfDateWithSelf"; + UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 7] = "OutOfDateWithUpstream"; + UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 8] = "OutOfDateBuildInfo"; + UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 9] = "UpstreamOutOfDate"; + UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 10] = "UpstreamBlocked"; + UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 11] = "ComputingUpstream"; + UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 12] = "TsVersionOutputOfDate"; + UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 13] = "UpToDateWithInputFileText"; /** * Projects with no outputs (i.e. "solution" files) */ - UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly"; - UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild"; + UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 14] = "ContainerOnly"; + UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 15] = "ForceBuild"; })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {})); function resolveConfigFileProjectName(project) { if (ts.fileExtensionIs(project, ".json" /* Extension.Json */)) { @@ -126189,6 +127077,7 @@ var ts; if (value) { return isParsedCommandLine(value) ? value : undefined; } + ts.performance.mark("SolutionBuilder::beforeConfigFileParsing"); var diagnostic; var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host; var parsed; @@ -126203,6 +127092,8 @@ var ts; parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop; } configFileCache.set(configFilePath, parsed || diagnostic); + ts.performance.mark("SolutionBuilder::afterConfigFileParsing"); + ts.performance.measure("SolutionBuilder::Config file parsing", "SolutionBuilder::beforeConfigFileParsing", "SolutionBuilder::afterConfigFileParsing"); return parsed; } function resolveProjectName(state, name) { @@ -126402,6 +127293,7 @@ var ts; if (updateOutputFileStampsPending) { updateOutputTimestamps(state, config, projectPath); } + ts.performance.mark("SolutionBuilder::Timestamps only updates"); return doneInvalidatedProject(state, projectPath); } }; @@ -126495,6 +127387,10 @@ var ts; }; function done(cancellationToken, writeFile, customTransformers) { executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers); + if (kind === InvalidatedProjectKind.Build) + ts.performance.mark("SolutionBuilder::Projects built"); + else + ts.performance.mark("SolutionBuilder::Bundles updated"); return doneInvalidatedProject(state, projectPath); } function withProgramOrUndefined(action) { @@ -126673,13 +127569,13 @@ var ts; var emitterDiagnostics = ts.createDiagnosticCollection(); var emittedOutputs = new ts.Map(); var resultFlags = BuildResultFlags.DeclarationOutputUnchanged; - var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo; + var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo || undefined; outputFiles.forEach(function (_a) { var _b, _c; var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo; emittedOutputs.set(toPath(state, name), name); if (buildInfo) { - if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { + if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo === null || existingBuildInfo === void 0 ? void 0 : existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged; } setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags); @@ -126972,8 +127868,7 @@ var ts; return existing.buildInfo || undefined; } var value = state.readFileWithCache(buildInfoPath); - var buildInfo = value ? ts.getBuildInfo(value) : undefined; - ts.Debug.assert(modifiedTime || !buildInfo); + var buildInfo = value ? ts.getBuildInfo(buildInfoPath, value) : undefined; state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime }); return buildInfo; } @@ -127058,7 +127953,14 @@ var ts; missingOutputFileName: buildInfoPath }; } - var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime)); + var buildInfo = getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime); + if (!buildInfo) { + // Error reading buildInfo + return { + type: ts.UpToDateStatusType.ErrorReadingFile, + fileName: buildInfoPath + }; + } if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) { return { type: ts.UpToDateStatusType.TsVersionOutputOfDate, @@ -127243,7 +128145,10 @@ var ts; if (prior !== undefined) { return prior; } + ts.performance.mark("SolutionBuilder::beforeUpToDateCheck"); var actual = getUpToDateStatusWorker(state, project, resolvedPath); + ts.performance.mark("SolutionBuilder::afterUpToDateCheck"); + ts.performance.measure("SolutionBuilder::Up-to-date check", "SolutionBuilder::beforeUpToDateCheck", "SolutionBuilder::afterUpToDateCheck"); state.projectStatus.set(resolvedPath, actual); return actual; } @@ -127381,6 +128286,13 @@ var ts; } } function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { + ts.performance.mark("SolutionBuilder::beforeBuild"); + var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences); + ts.performance.mark("SolutionBuilder::afterBuild"); + ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + return result; + } + function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { var buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ts.ExitStatus.InvalidProject_OutputsSkipped; @@ -127408,6 +128320,13 @@ var ts; : ts.ExitStatus.DiagnosticsPresent_OutputsSkipped; } function clean(state, project, onlyReferences) { + ts.performance.mark("SolutionBuilder::beforeClean"); + var result = cleanWorker(state, project, onlyReferences); + ts.performance.mark("SolutionBuilder::afterClean"); + ts.performance.measure("SolutionBuilder::Clean", "SolutionBuilder::beforeClean", "SolutionBuilder::afterClean"); + return result; + } + function cleanWorker(state, project, onlyReferences) { var buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ts.ExitStatus.InvalidProject_OutputsSkipped; @@ -127481,6 +128400,14 @@ var ts; state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected); } function buildNextInvalidatedProject(state, changeDetected) { + ts.performance.mark("SolutionBuilder::beforeBuild"); + var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected); + ts.performance.mark("SolutionBuilder::afterBuild"); + ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + if (buildOrder) + reportErrorSummary(state, buildOrder); + } + function buildNextInvalidatedProjectWorker(state, changeDetected) { state.timerToBuildInvalidatedProject = undefined; if (state.reportFileChangeDetected) { state.reportFileChangeDetected = false; @@ -127513,7 +128440,7 @@ var ts; } } disableCache(state); - reportErrorSummary(state, buildOrder); + return buildOrder; } function watchConfigFile(state, resolved, resolvedPath, parsed) { if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath)) @@ -127568,6 +128495,7 @@ var ts; function startWatching(state, buildOrder) { if (!state.watchAllProjectsPending) return; + ts.performance.mark("SolutionBuilder::beforeWatcherCreation"); state.watchAllProjectsPending = false; for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) { var resolved = _a[_i]; @@ -127585,6 +128513,8 @@ var ts; watchPackageJsonFiles(state, resolved, resolvedPath, cfg); } } + ts.performance.mark("SolutionBuilder::afterWatcherCreation"); + ts.performance.measure("SolutionBuilder::Watcher creation", "SolutionBuilder::beforeWatcherCreation", "SolutionBuilder::afterWatcherCreation"); } function stopWatching(state) { ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher); @@ -127698,6 +128628,8 @@ var ts; return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_1_is_older_than_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerProjectName)); case ts.UpToDateStatusType.OutputMissing: return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relName(state, configFileName), relName(state, status.missingOutputFileName)); + case ts.UpToDateStatusType.ErrorReadingFile: + return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_there_was_error_reading_file_1, relName(state, configFileName), relName(state, status.fileName)); case ts.UpToDateStatusType.OutOfDateBuildInfo: return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted, relName(state, configFileName), relName(state, status.buildInfoFile)); case ts.UpToDateStatusType.UpToDate: @@ -128405,6 +129337,8 @@ var ts; * interface Y { foo:number; } */ ScriptElementKind["memberVariableElement"] = "property"; + /** class X { [public|private]* accessor foo: number; } */ + ScriptElementKind["memberAccessorVariableElement"] = "accessor"; /** * class X { constructor() { } } * class X { static { } } @@ -128537,37 +129471,37 @@ var ts; })(SemanticMeaning = ts.SemanticMeaning || (ts.SemanticMeaning = {})); function getMeaningFromDeclaration(node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.isInJSFile(node) && ts.getJSDocEnumTag(node) ? 7 /* SemanticMeaning.All */ : 1 /* SemanticMeaning.Value */; - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 292 /* SyntaxKind.CatchClause */: - case 285 /* SyntaxKind.JsxAttribute */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 295 /* SyntaxKind.CatchClause */: + case 288 /* SyntaxKind.JsxAttribute */: return 1 /* SemanticMeaning.Value */; - case 163 /* SyntaxKind.TypeParameter */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: + case 165 /* SyntaxKind.TypeParameter */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: return 2 /* SemanticMeaning.Type */; - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: // If it has no name node, it shares the name with the value declaration below it. return node.name === undefined ? 1 /* SemanticMeaning.Value */ | 2 /* SemanticMeaning.Type */ : 2 /* SemanticMeaning.Type */; - case 299 /* SyntaxKind.EnumMember */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 260 /* SyntaxKind.ClassDeclaration */: return 1 /* SemanticMeaning.Value */ | 2 /* SemanticMeaning.Type */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.isAmbientModule(node)) { return 4 /* SemanticMeaning.Namespace */ | 1 /* SemanticMeaning.Value */; } @@ -128577,16 +129511,16 @@ var ts; else { return 4 /* SemanticMeaning.Namespace */; } - case 260 /* SyntaxKind.EnumDeclaration */: - case 269 /* SyntaxKind.NamedImports */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 272 /* SyntaxKind.NamedImports */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: return 7 /* SemanticMeaning.All */; // An external module can be a Value - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 4 /* SemanticMeaning.Namespace */ | 1 /* SemanticMeaning.Value */; } return 7 /* SemanticMeaning.All */; @@ -128595,7 +129529,7 @@ var ts; function getMeaningFromLocation(node) { node = getAdjustedReferenceLocation(node); var parent = node.parent; - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return 1 /* SemanticMeaning.Value */; } else if (ts.isExportAssignment(parent) @@ -128638,11 +129572,11 @@ var ts; // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - var name = node.kind === 161 /* SyntaxKind.QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined; - return name && name.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ ? 7 /* SemanticMeaning.All */ : 4 /* SemanticMeaning.Namespace */; + var name = node.kind === 163 /* SyntaxKind.QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined; + return name && name.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? 7 /* SemanticMeaning.All */ : 4 /* SemanticMeaning.Namespace */; } function isInRightSideOfInternalImportEqualsDeclaration(node) { - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; @@ -128654,27 +129588,27 @@ var ts; function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 161 /* SyntaxKind.QualifiedName */) { - while (root.parent && root.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + if (root.parent.kind === 163 /* SyntaxKind.QualifiedName */) { + while (root.parent && root.parent.kind === 163 /* SyntaxKind.QualifiedName */) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 178 /* SyntaxKind.TypeReference */ && !isLastClause; + return root.parent.kind === 180 /* SyntaxKind.TypeReference */ && !isLastClause; } function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (root.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && root.parent.parent.kind === 291 /* SyntaxKind.HeritageClause */) { + if (!isLastClause && root.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && root.parent.parent.kind === 294 /* SyntaxKind.HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 257 /* SyntaxKind.ClassDeclaration */ && root.parent.parent.token === 117 /* SyntaxKind.ImplementsKeyword */) || - (decl.kind === 258 /* SyntaxKind.InterfaceDeclaration */ && root.parent.parent.token === 94 /* SyntaxKind.ExtendsKeyword */); + return (decl.kind === 260 /* SyntaxKind.ClassDeclaration */ && root.parent.parent.token === 117 /* SyntaxKind.ImplementsKeyword */) || + (decl.kind === 261 /* SyntaxKind.InterfaceDeclaration */ && root.parent.parent.token === 94 /* SyntaxKind.ExtendsKeyword */); } return false; } @@ -128685,15 +129619,15 @@ var ts; switch (node.kind) { case 108 /* SyntaxKind.ThisKeyword */: return !ts.isExpressionNode(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return true; } switch (node.parent.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return true; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return !node.parent.isTypeOf; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isPartOfTypeNode(node.parent); } return false; @@ -128760,7 +129694,7 @@ var ts; ts.climbPastPropertyOrElementAccess = climbPastPropertyOrElementAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 250 /* SyntaxKind.LabeledStatement */ && referenceNode.label.escapedText === labelName) { + if (referenceNode.kind === 253 /* SyntaxKind.LabeledStatement */ && referenceNode.label.escapedText === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -128821,22 +129755,22 @@ var ts; ts.isNameOfFunctionDeclaration = isNameOfFunctionDeclaration; function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { switch (node.parent.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 299 /* SyntaxKind.EnumMember */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 302 /* SyntaxKind.EnumMember */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.getNameOfDeclaration(node.parent) === node; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return node.parent.argumentExpression === node; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return true; - case 196 /* SyntaxKind.LiteralType */: - return node.parent.parent.kind === 194 /* SyntaxKind.IndexedAccessType */; + case 198 /* SyntaxKind.LiteralType */: + return node.parent.parent.kind === 196 /* SyntaxKind.IndexedAccessType */; default: return false; } @@ -128860,17 +129794,17 @@ var ts; return undefined; } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return node; } } @@ -128878,56 +129812,56 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return ts.isExternalModule(node) ? "module" /* ScriptElementKind.moduleElement */ : "script" /* ScriptElementKind.scriptElement */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return "module" /* ScriptElementKind.moduleElement */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return "class" /* ScriptElementKind.classElement */; - case 258 /* SyntaxKind.InterfaceDeclaration */: return "interface" /* ScriptElementKind.interfaceElement */; - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return "interface" /* ScriptElementKind.interfaceElement */; + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return "type" /* ScriptElementKind.typeElement */; - case 260 /* SyntaxKind.EnumDeclaration */: return "enum" /* ScriptElementKind.enumElement */; - case 254 /* SyntaxKind.VariableDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return "enum" /* ScriptElementKind.enumElement */; + case 257 /* SyntaxKind.VariableDeclaration */: return getKindOfVariableDeclaration(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return "function" /* ScriptElementKind.functionElement */; - case 172 /* SyntaxKind.GetAccessor */: return "getter" /* ScriptElementKind.memberGetAccessorElement */; - case 173 /* SyntaxKind.SetAccessor */: return "setter" /* ScriptElementKind.memberSetAccessorElement */; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: return "getter" /* ScriptElementKind.memberGetAccessorElement */; + case 175 /* SyntaxKind.SetAccessor */: return "setter" /* ScriptElementKind.memberSetAccessorElement */; + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return "method" /* ScriptElementKind.memberFunctionElement */; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: var initializer = node.initializer; return ts.isFunctionLike(initializer) ? "method" /* ScriptElementKind.memberFunctionElement */ : "property" /* ScriptElementKind.memberVariableElement */; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return "property" /* ScriptElementKind.memberVariableElement */; - case 176 /* SyntaxKind.IndexSignature */: return "index" /* ScriptElementKind.indexSignatureElement */; - case 175 /* SyntaxKind.ConstructSignature */: return "construct" /* ScriptElementKind.constructSignatureElement */; - case 174 /* SyntaxKind.CallSignature */: return "call" /* ScriptElementKind.callSignatureElement */; - case 171 /* SyntaxKind.Constructor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: return "index" /* ScriptElementKind.indexSignatureElement */; + case 177 /* SyntaxKind.ConstructSignature */: return "construct" /* ScriptElementKind.constructSignatureElement */; + case 176 /* SyntaxKind.CallSignature */: return "call" /* ScriptElementKind.callSignatureElement */; + case 173 /* SyntaxKind.Constructor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return "constructor" /* ScriptElementKind.constructorImplementationElement */; - case 163 /* SyntaxKind.TypeParameter */: return "type parameter" /* ScriptElementKind.typeParameterElement */; - case 299 /* SyntaxKind.EnumMember */: return "enum member" /* ScriptElementKind.enumMemberElement */; - case 164 /* SyntaxKind.Parameter */: return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) ? "property" /* ScriptElementKind.memberVariableElement */ : "parameter" /* ScriptElementKind.parameterElement */; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: - case 274 /* SyntaxKind.NamespaceExport */: + case 165 /* SyntaxKind.TypeParameter */: return "type parameter" /* ScriptElementKind.typeParameterElement */; + case 302 /* SyntaxKind.EnumMember */: return "enum member" /* ScriptElementKind.enumMemberElement */; + case 166 /* SyntaxKind.Parameter */: return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) ? "property" /* ScriptElementKind.memberVariableElement */ : "parameter" /* ScriptElementKind.parameterElement */; + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: + case 277 /* SyntaxKind.NamespaceExport */: return "alias" /* ScriptElementKind.alias */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var kind = ts.getAssignmentDeclarationKind(node); var right = node.right; switch (kind) { @@ -128956,7 +129890,7 @@ var ts; } case 79 /* SyntaxKind.Identifier */: return ts.isImportClause(node.parent) ? "alias" /* ScriptElementKind.alias */ : "" /* ScriptElementKind.unknown */; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: var scriptKind = getNodeKind(node.expression); // If the expression didn't come back with something (like it does for an identifiers) return scriptKind === "" /* ScriptElementKind.unknown */ ? "const" /* ScriptElementKind.constElement */ : scriptKind; @@ -128979,7 +129913,7 @@ var ts; return true; case 79 /* SyntaxKind.Identifier */: // 'this' as a parameter - return ts.identifierIsThisKeyword(node) && node.parent.kind === 164 /* SyntaxKind.Parameter */; + return ts.identifierIsThisKeyword(node) && node.parent.kind === 166 /* SyntaxKind.Parameter */; default: return false; } @@ -129044,42 +129978,42 @@ var ts; return false; } switch (n.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 182 /* SyntaxKind.TypeLiteral */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - case 263 /* SyntaxKind.CaseBlock */: - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 184 /* SyntaxKind.TypeLiteral */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: + case 266 /* SyntaxKind.CaseBlock */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return nodeEndsWith(n, 19 /* SyntaxKind.CloseBraceToken */, sourceFile); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return isCompletedNode(n.block, sourceFile); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: if (!n.arguments) { return true; } // falls through - case 208 /* SyntaxKind.CallExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 191 /* SyntaxKind.ParenthesizedType */: + case 210 /* SyntaxKind.CallExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 193 /* SyntaxKind.ParenthesizedType */: return nodeEndsWith(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return isCompletedNode(n.type, sourceFile); - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 214 /* SyntaxKind.ArrowFunction */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 216 /* SyntaxKind.ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -129089,65 +130023,65 @@ var ts; // Even though type parameters can be unclosed, we can get away with // having at least a closing paren. return hasChildOfKind(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return !!n.body && isCompletedNode(n.body, sourceFile); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 26 /* SyntaxKind.SemicolonToken */, sourceFile); - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 162 /* SyntaxKind.ComputedPropertyName */: - case 184 /* SyntaxKind.TupleType */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 164 /* SyntaxKind.ComputedPropertyName */: + case 186 /* SyntaxKind.TupleType */: return nodeEndsWith(n, 23 /* SyntaxKind.CloseBracketToken */, sourceFile); - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 23 /* SyntaxKind.CloseBracketToken */, sourceFile); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed return false; - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; return hasChildOfKind(n, 115 /* SyntaxKind.WhileKeyword */, sourceFile) ? nodeEndsWith(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile) : isCompletedNode(n.statement, sourceFile); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 216 /* SyntaxKind.TypeOfExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 224 /* SyntaxKind.YieldExpression */: - case 225 /* SyntaxKind.SpreadElement */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 226 /* SyntaxKind.YieldExpression */: + case 227 /* SyntaxKind.SpreadElement */: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 272 /* SyntaxKind.ExportDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.nodeIsPresent(n.moduleSpecifier); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -129272,13 +130206,13 @@ var ts; function getAdjustedLocationForDeclaration(node, forRename) { if (!forRename) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return getAdjustedLocationForClass(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return getAdjustedLocationForFunction(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return node; } } @@ -129373,11 +130307,11 @@ var ts; node.kind === 98 /* SyntaxKind.FunctionKeyword */ ? ts.isFunctionDeclaration(parent) || ts.isFunctionExpression(node) : node.kind === 118 /* SyntaxKind.InterfaceKeyword */ ? ts.isInterfaceDeclaration(parent) : node.kind === 92 /* SyntaxKind.EnumKeyword */ ? ts.isEnumDeclaration(parent) : - node.kind === 152 /* SyntaxKind.TypeKeyword */ ? ts.isTypeAliasDeclaration(parent) : - node.kind === 142 /* SyntaxKind.NamespaceKeyword */ || node.kind === 141 /* SyntaxKind.ModuleKeyword */ ? ts.isModuleDeclaration(parent) : + node.kind === 154 /* SyntaxKind.TypeKeyword */ ? ts.isTypeAliasDeclaration(parent) : + node.kind === 143 /* SyntaxKind.NamespaceKeyword */ || node.kind === 142 /* SyntaxKind.ModuleKeyword */ ? ts.isModuleDeclaration(parent) : node.kind === 100 /* SyntaxKind.ImportKeyword */ ? ts.isImportEqualsDeclaration(parent) : - node.kind === 136 /* SyntaxKind.GetKeyword */ ? ts.isGetAccessorDeclaration(parent) : - node.kind === 149 /* SyntaxKind.SetKeyword */ && ts.isSetAccessorDeclaration(parent)) { + node.kind === 137 /* SyntaxKind.GetKeyword */ ? ts.isGetAccessorDeclaration(parent) : + node.kind === 151 /* SyntaxKind.SetKeyword */ && ts.isSetAccessorDeclaration(parent)) { var location = getAdjustedLocationForDeclaration(parent, forRename); if (location) { return location; @@ -129391,7 +130325,7 @@ var ts; return decl.name; } } - if (node.kind === 152 /* SyntaxKind.TypeKeyword */) { + if (node.kind === 154 /* SyntaxKind.TypeKeyword */) { // import /**/type [|name|] from ...; // import /**/type { [|name|] } from ...; // import /**/type { propertyName as [|name|] } from ...; @@ -129417,7 +130351,7 @@ var ts; // import * /**/as [|name|] ... // export { propertyName /**/as [|name|] } ... // export * /**/as [|name|] ... - if (node.kind === 127 /* SyntaxKind.AsKeyword */) { + if (node.kind === 128 /* SyntaxKind.AsKeyword */) { if (ts.isImportSpecifier(parent) && parent.propertyName || ts.isExportSpecifier(parent) && parent.propertyName || ts.isNamespaceImport(parent) || @@ -129458,12 +130392,12 @@ var ts; } } // import name = /**/require("[|module|]"); - if (node.kind === 146 /* SyntaxKind.RequireKeyword */ && ts.isExternalModuleReference(parent)) { + if (node.kind === 147 /* SyntaxKind.RequireKeyword */ && ts.isExternalModuleReference(parent)) { return parent.expression; } // import ... /**/from "[|module|]"; // export ... /**/from "[|module|]"; - if (node.kind === 156 /* SyntaxKind.FromKeyword */ && (ts.isImportDeclaration(parent) || ts.isExportDeclaration(parent)) && parent.moduleSpecifier) { + if (node.kind === 158 /* SyntaxKind.FromKeyword */ && (ts.isImportDeclaration(parent) || ts.isExportDeclaration(parent)) && parent.moduleSpecifier) { return parent.moduleSpecifier; } // class ... /**/extends [|name|] ... @@ -129488,7 +130422,7 @@ var ts; } } // ... T extends /**/infer [|U|] ? ... - if (node.kind === 137 /* SyntaxKind.InferKeyword */ && ts.isInferTypeNode(parent)) { + if (node.kind === 138 /* SyntaxKind.InferKeyword */ && ts.isInferTypeNode(parent)) { return parent.typeParameter.name; } // { [ [|K|] /**/in keyof T]: ... } @@ -129496,12 +130430,12 @@ var ts; return parent.name; } // /**/keyof [|T|] - if (node.kind === 140 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 140 /* SyntaxKind.KeyOfKeyword */ && + if (node.kind === 141 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 141 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeReferenceNode(parent.type)) { return parent.type.typeName; } // /**/readonly [|name|][] - if (node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 145 /* SyntaxKind.ReadonlyKeyword */ && + if (node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isArrayTypeNode(parent.type) && ts.isTypeReferenceNode(parent.type.elementType)) { return parent.type.elementType.typeName; } @@ -129519,7 +130453,7 @@ var ts; if (node.kind === 103 /* SyntaxKind.NewKeyword */ && ts.isNewExpression(parent) || node.kind === 114 /* SyntaxKind.VoidKeyword */ && ts.isVoidExpression(parent) || node.kind === 112 /* SyntaxKind.TypeOfKeyword */ && ts.isTypeOfExpression(parent) || - node.kind === 132 /* SyntaxKind.AwaitKeyword */ && ts.isAwaitExpression(parent) || + node.kind === 133 /* SyntaxKind.AwaitKeyword */ && ts.isAwaitExpression(parent) || node.kind === 125 /* SyntaxKind.YieldKeyword */ && ts.isYieldExpression(parent) || node.kind === 89 /* SyntaxKind.DeleteKeyword */ && ts.isDeleteExpression(parent)) { if (parent.expression) { @@ -129532,13 +130466,13 @@ var ts; return ts.skipOuterExpressions(parent.right); } // left /**/as [|name|] - if (node.kind === 127 /* SyntaxKind.AsKeyword */ && ts.isAsExpression(parent) && ts.isTypeReferenceNode(parent.type)) { + if (node.kind === 128 /* SyntaxKind.AsKeyword */ && ts.isAsExpression(parent) && ts.isTypeReferenceNode(parent.type)) { return parent.type.typeName; } // for (... /**/in [|name|]) // for (... /**/of [|name|]) if (node.kind === 101 /* SyntaxKind.InKeyword */ && ts.isForInStatement(parent) || - node.kind === 160 /* SyntaxKind.OfKeyword */ && ts.isForOfStatement(parent)) { + node.kind === 162 /* SyntaxKind.OfKeyword */ && ts.isForOfStatement(parent)) { return ts.skipOuterExpressions(parent.expression); } } @@ -129770,7 +130704,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 305 /* SyntaxKind.SourceFile */ || n.kind === 1 /* SyntaxKind.EndOfFileToken */ || ts.isJSDocCommentContainingNode(n)); + ts.Debug.assert(startNode !== undefined || n.kind === 308 /* SyntaxKind.SourceFile */ || n.kind === 1 /* SyntaxKind.EndOfFileToken */ || ts.isJSDocCommentContainingNode(n)); // Here we know that none of child token nodes embrace the position, // the only known case is when position is at the end of the file. // Try to find the rightmost token in the file without filtering. @@ -129801,7 +130735,7 @@ var ts; for (var i = exclusiveStartPosition - 1; i >= 0; i--) { var child = children[i]; if (isWhiteSpaceOnlyJsxText(child)) { - if (i === 0 && (parentKind === 11 /* SyntaxKind.JsxText */ || parentKind === 279 /* SyntaxKind.JsxSelfClosingElement */)) { + if (i === 0 && (parentKind === 11 /* SyntaxKind.JsxText */ || parentKind === 282 /* SyntaxKind.JsxSelfClosingElement */)) { ts.Debug.fail("`JsxText` tokens should not be the first child of `JsxElement | JsxSelfClosingElement`"); } } @@ -129845,17 +130779,17 @@ var ts; return true; } //
{ |
or
- if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 288 /* SyntaxKind.JsxExpression */) { + if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 291 /* SyntaxKind.JsxExpression */) { return true; } //
{ // | // } < /div> - if (token && token.kind === 19 /* SyntaxKind.CloseBraceToken */ && token.parent.kind === 288 /* SyntaxKind.JsxExpression */) { + if (token && token.kind === 19 /* SyntaxKind.CloseBraceToken */ && token.parent.kind === 291 /* SyntaxKind.JsxExpression */) { return true; } //
|
- if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 281 /* SyntaxKind.JsxClosingElement */) { + if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 284 /* SyntaxKind.JsxClosingElement */) { return true; } return false; @@ -129886,7 +130820,7 @@ var ts; function isInsideJsxElement(sourceFile, position) { function isInsideJsxElementTraversal(node) { while (node) { - if (node.kind >= 279 /* SyntaxKind.JsxSelfClosingElement */ && node.kind <= 288 /* SyntaxKind.JsxExpression */ + if (node.kind >= 282 /* SyntaxKind.JsxSelfClosingElement */ && node.kind <= 291 /* SyntaxKind.JsxExpression */ || node.kind === 11 /* SyntaxKind.JsxText */ || node.kind === 29 /* SyntaxKind.LessThanToken */ || node.kind === 31 /* SyntaxKind.GreaterThanToken */ @@ -129896,7 +130830,7 @@ var ts; || node.kind === 43 /* SyntaxKind.SlashToken */) { node = node.parent; } - else if (node.kind === 278 /* SyntaxKind.JsxElement */) { + else if (node.kind === 281 /* SyntaxKind.JsxElement */) { if (position > node.getStart(sourceFile)) return true; node = node.parent; @@ -130044,7 +130978,7 @@ var ts; // falls through case 112 /* SyntaxKind.TypeOfKeyword */: case 94 /* SyntaxKind.ExtendsKeyword */: - case 140 /* SyntaxKind.KeyOfKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: case 24 /* SyntaxKind.DotToken */: case 51 /* SyntaxKind.BarToken */: case 57 /* SyntaxKind.QuestionToken */: @@ -130065,7 +130999,7 @@ var ts; /** * Returns true if the cursor at position in sourceFile is within a comment. * - * @param tokenAtPosition Must equal `getTokenAtPosition(sourceFile, position) + * @param tokenAtPosition Must equal `getTokenAtPosition(sourceFile, position)` * @param predicate Additional predicate to test on the comment range. */ function isInComment(sourceFile, position, tokenAtPosition) { @@ -130096,7 +131030,7 @@ var ts; result.push("public" /* ScriptElementKindModifier.publicMemberModifier */); if (flags & 32 /* ModifierFlags.Static */ || ts.isClassStaticBlockDeclaration(node)) result.push("static" /* ScriptElementKindModifier.staticModifier */); - if (flags & 128 /* ModifierFlags.Abstract */) + if (flags & 256 /* ModifierFlags.Abstract */) result.push("abstract" /* ScriptElementKindModifier.abstractModifier */); if (flags & 1 /* ModifierFlags.Export */) result.push("export" /* ScriptElementKindModifier.exportedModifier */); @@ -130104,16 +131038,16 @@ var ts; result.push("deprecated" /* ScriptElementKindModifier.deprecatedModifier */); if (node.flags & 16777216 /* NodeFlags.Ambient */) result.push("declare" /* ScriptElementKindModifier.ambientModifier */); - if (node.kind === 271 /* SyntaxKind.ExportAssignment */) + if (node.kind === 274 /* SyntaxKind.ExportAssignment */) result.push("export" /* ScriptElementKindModifier.exportedModifier */); return result.length > 0 ? result.join(",") : "" /* ScriptElementKindModifier.none */; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 210 /* SyntaxKind.CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return node.typeParameters; } return undefined; @@ -130158,18 +131092,18 @@ var ts; } ts.cloneCompilerOptions = cloneCompilerOptions; function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || - node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || + node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // [a,b,c] from: // [a, b, c] = someExpression; - if (node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + if (node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && node.parent.left === node && node.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { return true; } // [a, b, c] from: // for([a, b, c] of expression) - if (node.parent.kind === 244 /* SyntaxKind.ForOfStatement */ && + if (node.parent.kind === 247 /* SyntaxKind.ForOfStatement */ && node.parent.initializer === node) { return true; } @@ -130177,7 +131111,7 @@ var ts; // [x, [a, b, c] ] = someExpression // or // {x, a: {a, b, c} } = someExpression - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ ? node.parent.parent : node.parent)) { return true; } } @@ -130239,32 +131173,32 @@ var ts; } ts.createTextChange = createTextChange; ts.typeKeywords = [ - 130 /* SyntaxKind.AnyKeyword */, - 128 /* SyntaxKind.AssertsKeyword */, - 158 /* SyntaxKind.BigIntKeyword */, - 133 /* SyntaxKind.BooleanKeyword */, + 131 /* SyntaxKind.AnyKeyword */, + 129 /* SyntaxKind.AssertsKeyword */, + 160 /* SyntaxKind.BigIntKeyword */, + 134 /* SyntaxKind.BooleanKeyword */, 95 /* SyntaxKind.FalseKeyword */, - 137 /* SyntaxKind.InferKeyword */, - 140 /* SyntaxKind.KeyOfKeyword */, - 143 /* SyntaxKind.NeverKeyword */, + 138 /* SyntaxKind.InferKeyword */, + 141 /* SyntaxKind.KeyOfKeyword */, + 144 /* SyntaxKind.NeverKeyword */, 104 /* SyntaxKind.NullKeyword */, - 147 /* SyntaxKind.NumberKeyword */, - 148 /* SyntaxKind.ObjectKeyword */, - 145 /* SyntaxKind.ReadonlyKeyword */, - 150 /* SyntaxKind.StringKeyword */, - 151 /* SyntaxKind.SymbolKeyword */, + 148 /* SyntaxKind.NumberKeyword */, + 149 /* SyntaxKind.ObjectKeyword */, + 146 /* SyntaxKind.ReadonlyKeyword */, + 152 /* SyntaxKind.StringKeyword */, + 153 /* SyntaxKind.SymbolKeyword */, 110 /* SyntaxKind.TrueKeyword */, 114 /* SyntaxKind.VoidKeyword */, - 153 /* SyntaxKind.UndefinedKeyword */, - 154 /* SyntaxKind.UniqueKeyword */, - 155 /* SyntaxKind.UnknownKeyword */, + 155 /* SyntaxKind.UndefinedKeyword */, + 156 /* SyntaxKind.UniqueKeyword */, + 157 /* SyntaxKind.UnknownKeyword */, ]; function isTypeKeyword(kind) { return ts.contains(ts.typeKeywords, kind); } ts.isTypeKeyword = isTypeKeyword; function isTypeKeywordToken(node) { - return node.kind === 152 /* SyntaxKind.TypeKeyword */; + return node.kind === 154 /* SyntaxKind.TypeKeyword */; } ts.isTypeKeywordToken = isTypeKeywordToken; function isTypeKeywordTokenOrIdentifier(node) { @@ -130301,7 +131235,7 @@ var ts; } ts.skipConstraint = skipConstraint; function getNameFromPropertyName(name) { - return name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + return name.kind === 164 /* SyntaxKind.ComputedPropertyName */ // treat computed property names where expression is string/numeric literal as just string/numeric literal ? ts.isStringOrNumericLiteralLike(name.expression) ? name.expression.text : undefined : ts.isPrivateIdentifier(name) ? ts.idText(name) : ts.getTextOfIdentifierOrLiteral(name); @@ -130451,7 +131385,7 @@ var ts; ts.findModifier = findModifier; function insertImports(changes, sourceFile, imports, blankLineBetween) { var decl = ts.isArray(imports) ? imports[0] : imports; - var importKindPredicate = decl.kind === 237 /* SyntaxKind.VariableStatement */ ? ts.isRequireVariableStatement : ts.isAnyImportSyntax; + var importKindPredicate = decl.kind === 240 /* SyntaxKind.VariableStatement */ ? ts.isRequireVariableStatement : ts.isAnyImportSyntax; var existingImportStatements = ts.filter(sourceFile.statements, importKindPredicate); var sortedNewImports = ts.isArray(imports) ? ts.stableSort(imports, ts.OrganizeImports.compareImportsOrRequireStatements) : [imports]; if (!existingImportStatements.length) { @@ -131125,15 +132059,15 @@ var ts; function getContextualTypeFromParent(node, checker) { var parent = node.parent; switch (parent.kind) { - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return checker.getContextualType(parent); - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var _a = parent, left = _a.left, operatorToken = _a.operatorToken, right = _a.right; return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node); } - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return parent.expression === node ? getSwitchedType(parent, checker) : undefined; default: return checker.getContextualType(node); @@ -131163,8 +132097,8 @@ var ts; switch (node.kind) { case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return true; default: return false; @@ -131198,38 +132132,38 @@ var ts; } ts.getTypeNodeIfAccessible = getTypeNodeIfAccessible; function syntaxRequiresTrailingCommaOrSemicolonOrASI(kind) { - return kind === 174 /* SyntaxKind.CallSignature */ - || kind === 175 /* SyntaxKind.ConstructSignature */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 168 /* SyntaxKind.MethodSignature */; + return kind === 176 /* SyntaxKind.CallSignature */ + || kind === 177 /* SyntaxKind.ConstructSignature */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 170 /* SyntaxKind.MethodSignature */; } function syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI(kind) { - return kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function syntaxRequiresTrailingModuleBlockOrSemicolonOrASI(kind) { - return kind === 261 /* SyntaxKind.ModuleDeclaration */; + return kind === 264 /* SyntaxKind.ModuleDeclaration */; } function syntaxRequiresTrailingSemicolonOrASI(kind) { - return kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 238 /* SyntaxKind.ExpressionStatement */ - || kind === 240 /* SyntaxKind.DoStatement */ - || kind === 245 /* SyntaxKind.ContinueStatement */ - || kind === 246 /* SyntaxKind.BreakStatement */ - || kind === 247 /* SyntaxKind.ReturnStatement */ - || kind === 251 /* SyntaxKind.ThrowStatement */ - || kind === 253 /* SyntaxKind.DebuggerStatement */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */; + return kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 241 /* SyntaxKind.ExpressionStatement */ + || kind === 243 /* SyntaxKind.DoStatement */ + || kind === 248 /* SyntaxKind.ContinueStatement */ + || kind === 249 /* SyntaxKind.BreakStatement */ + || kind === 250 /* SyntaxKind.ReturnStatement */ + || kind === 254 /* SyntaxKind.ThrowStatement */ + || kind === 256 /* SyntaxKind.DebuggerStatement */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */; } ts.syntaxRequiresTrailingSemicolonOrASI = syntaxRequiresTrailingSemicolonOrASI; ts.syntaxMayBeASICandidate = ts.or(syntaxRequiresTrailingCommaOrSemicolonOrASI, syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI, syntaxRequiresTrailingModuleBlockOrSemicolonOrASI, syntaxRequiresTrailingSemicolonOrASI); @@ -131259,7 +132193,7 @@ var ts; return false; } // See comment in parser’s `parseDoStatement` - if (node.kind === 240 /* SyntaxKind.DoStatement */) { + if (node.kind === 243 /* SyntaxKind.DoStatement */) { return true; } var topNode = ts.findAncestor(node, function (ancestor) { return !ancestor.parent; }); @@ -131863,14 +132797,16 @@ var ts; search: function (importingFile, preferCapitalized, matches, action) { if (importingFile !== usableByFileName) return; - exportInfo.forEach(function (info, key) { + return ts.forEachEntry(exportInfo, function (info, key) { var _a = parseKey(key), symbolName = _a.symbolName, ambientModuleName = _a.ambientModuleName; var name = preferCapitalized && info[0].capitalizedSymbolName || symbolName; if (matches(name, info[0].targetFlags)) { var rehydrated = info.map(rehydrateCachedInfo); var filtered = rehydrated.filter(function (r, i) { return isNotShadowedByDeeperNodeModulesPackage(r, info[i].packageName); }); if (filtered.length) { - action(filtered, name, !!ambientModuleName, key); + var res = action(filtered, name, !!ambientModuleName, key); + if (res !== undefined) + return res; } } }); @@ -132258,11 +133194,11 @@ var ts; angleBracketStack--; } break; - case 130 /* SyntaxKind.AnyKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: if (angleBracketStack > 0 && !syntacticClassifierAbsent) { // If it looks like we're could be in something generic, don't classify this // as a keyword. We may just get overwritten by the syntactic classifier, @@ -132451,10 +133387,11 @@ var ts; return true; } switch (keyword2) { - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - case 134 /* SyntaxKind.ConstructorKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: return true; // Allow things like "public get", "public constructor" and "public static". default: return false; // Any other keyword following "public" is actually an identifier, not a real keyword. @@ -132501,7 +133438,8 @@ var ts; case 33 /* SyntaxKind.GreaterThanEqualsToken */: case 102 /* SyntaxKind.InstanceOfKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: + case 150 /* SyntaxKind.SatisfiesKeyword */: case 34 /* SyntaxKind.EqualsEqualsToken */: case 35 /* SyntaxKind.ExclamationEqualsToken */: case 36 /* SyntaxKind.EqualsEqualsEqualsToken */: @@ -132597,13 +133535,13 @@ var ts; // That means we're calling back into the host around every 1.2k of the file we process. // Lib.d.ts has similar numbers. switch (kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } } @@ -132825,46 +133763,46 @@ var ts; pos = tag.tagName.end; var commentStart = tag.tagName.end; switch (tag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: var param = tag; processJSDocParameterTag(param); commentStart = param.isNameFirst && ((_a = param.typeExpression) === null || _a === void 0 ? void 0 : _a.end) || param.name.end; break; - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: var prop = tag; commentStart = prop.isNameFirst && ((_b = prop.typeExpression) === null || _b === void 0 ? void 0 : _b.end) || prop.name.end; break; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: processJSDocTemplateTag(tag); pos = tag.end; commentStart = tag.typeParameters.end; break; - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: var type = tag; - commentStart = ((_c = type.typeExpression) === null || _c === void 0 ? void 0 : _c.kind) === 309 /* SyntaxKind.JSDocTypeExpression */ && ((_d = type.fullName) === null || _d === void 0 ? void 0 : _d.end) || ((_e = type.typeExpression) === null || _e === void 0 ? void 0 : _e.end) || commentStart; + commentStart = ((_c = type.typeExpression) === null || _c === void 0 ? void 0 : _c.kind) === 312 /* SyntaxKind.JSDocTypeExpression */ && ((_d = type.fullName) === null || _d === void 0 ? void 0 : _d.end) || ((_e = type.typeExpression) === null || _e === void 0 ? void 0 : _e.end) || commentStart; break; - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: commentStart = tag.typeExpression.end; break; - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: processElement(tag.typeExpression); pos = tag.end; commentStart = tag.typeExpression.end; break; - case 342 /* SyntaxKind.JSDocThisTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 345 /* SyntaxKind.JSDocThisTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: commentStart = tag.typeExpression.end; break; - case 341 /* SyntaxKind.JSDocReturnTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: processElement(tag.typeExpression); pos = tag.end; commentStart = ((_f = tag.typeExpression) === null || _f === void 0 ? void 0 : _f.end) || commentStart; break; - case 346 /* SyntaxKind.JSDocSeeTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: commentStart = ((_g = tag.name) === null || _g === void 0 ? void 0 : _g.end) || commentStart; break; - case 328 /* SyntaxKind.JSDocAugmentsTag */: - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: commentStart = tag.class.end; break; } @@ -132911,7 +133849,7 @@ var ts; // defined in `ts.commentPragmas` would be excessive, but we can avoid // some obvious false positives (e.g. in XML-like doc comments) by // checking the element name. - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (!match[3] || !(match[3] in ts.commentPragmas)) { return false; } @@ -133021,22 +133959,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: if (token.parent.tagName === token) { return 19 /* ClassificationType.jsxOpenTagName */; } break; - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: if (token.parent.tagName === token) { return 20 /* ClassificationType.jsxCloseTagName */; } break; - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: if (token.parent.tagName === token) { return 21 /* ClassificationType.jsxSelfClosingTagName */; } break; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: if (token.parent.name === token) { return 22 /* ClassificationType.jsxAttribute */; } @@ -133065,17 +134003,17 @@ var ts; var parent = token.parent; if (tokenKind === 63 /* SyntaxKind.EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (parent.kind === 254 /* SyntaxKind.VariableDeclaration */ || - parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - parent.kind === 164 /* SyntaxKind.Parameter */ || - parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + if (parent.kind === 257 /* SyntaxKind.VariableDeclaration */ || + parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + parent.kind === 166 /* SyntaxKind.Parameter */ || + parent.kind === 288 /* SyntaxKind.JsxAttribute */) { return 5 /* ClassificationType.operator */; } } - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ || - parent.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || - parent.kind === 220 /* SyntaxKind.PostfixUnaryExpression */ || - parent.kind === 222 /* SyntaxKind.ConditionalExpression */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ || + parent.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || + parent.kind === 222 /* SyntaxKind.PostfixUnaryExpression */ || + parent.kind === 224 /* SyntaxKind.ConditionalExpression */) { return 5 /* ClassificationType.operator */; } } @@ -133088,7 +134026,7 @@ var ts; return 25 /* ClassificationType.bigintLiteral */; } else if (tokenKind === 10 /* SyntaxKind.StringLiteral */) { - return token && token.parent.kind === 285 /* SyntaxKind.JsxAttribute */ ? 24 /* ClassificationType.jsxAttributeStringLiteralValue */ : 6 /* ClassificationType.stringLiteral */; + return token && token.parent.kind === 288 /* SyntaxKind.JsxAttribute */ ? 24 /* ClassificationType.jsxAttributeStringLiteralValue */ : 6 /* ClassificationType.stringLiteral */; } else if (tokenKind === 13 /* SyntaxKind.RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. @@ -133104,32 +134042,32 @@ var ts; else if (tokenKind === 79 /* SyntaxKind.Identifier */) { if (token) { switch (token.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: if (token.parent.name === token) { return 11 /* ClassificationType.className */; } return; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: if (token.parent.name === token) { return 15 /* ClassificationType.typeParameterName */; } return; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* ClassificationType.interfaceName */; } return; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (token.parent.name === token) { return 12 /* ClassificationType.enumName */; } return; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (token.parent.name === token) { return 14 /* ClassificationType.moduleName */; } return; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: if (token.parent.name === token) { return ts.isThisIdentifier(token) ? 3 /* ClassificationType.keyword */ : 17 /* ClassificationType.parameterName */; } @@ -133234,13 +134172,13 @@ var ts; var inJSXElement = false; function visit(node) { switch (node.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } if (!node || !ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth()) || node.getFullWidth() === 0) { @@ -133280,7 +134218,7 @@ var ts; if (modifiers & 32 /* ModifierFlags.Static */) { modifierSet |= 1 << 1 /* TokenModifier.static */; } - if (modifiers & 256 /* ModifierFlags.Async */) { + if (modifiers & 512 /* ModifierFlags.Async */) { modifierSet |= 1 << 2 /* TokenModifier.async */; } if (typeIdx !== 0 /* TokenType.class */ && typeIdx !== 2 /* TokenType.interface */) { @@ -133386,25 +134324,25 @@ var ts; return (ts.isQualifiedName(node.parent) && node.parent.right === node) || (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node); } var tokenFromDeclarationMapping = new ts.Map([ - [254 /* SyntaxKind.VariableDeclaration */, 7 /* TokenType.variable */], - [164 /* SyntaxKind.Parameter */, 6 /* TokenType.parameter */], - [167 /* SyntaxKind.PropertyDeclaration */, 9 /* TokenType.property */], - [261 /* SyntaxKind.ModuleDeclaration */, 3 /* TokenType.namespace */], - [260 /* SyntaxKind.EnumDeclaration */, 1 /* TokenType.enum */], - [299 /* SyntaxKind.EnumMember */, 8 /* TokenType.enumMember */], - [257 /* SyntaxKind.ClassDeclaration */, 0 /* TokenType.class */], - [169 /* SyntaxKind.MethodDeclaration */, 11 /* TokenType.member */], - [256 /* SyntaxKind.FunctionDeclaration */, 10 /* TokenType.function */], - [213 /* SyntaxKind.FunctionExpression */, 10 /* TokenType.function */], - [168 /* SyntaxKind.MethodSignature */, 11 /* TokenType.member */], - [172 /* SyntaxKind.GetAccessor */, 9 /* TokenType.property */], - [173 /* SyntaxKind.SetAccessor */, 9 /* TokenType.property */], - [166 /* SyntaxKind.PropertySignature */, 9 /* TokenType.property */], - [258 /* SyntaxKind.InterfaceDeclaration */, 2 /* TokenType.interface */], - [259 /* SyntaxKind.TypeAliasDeclaration */, 5 /* TokenType.type */], - [163 /* SyntaxKind.TypeParameter */, 4 /* TokenType.typeParameter */], - [296 /* SyntaxKind.PropertyAssignment */, 9 /* TokenType.property */], - [297 /* SyntaxKind.ShorthandPropertyAssignment */, 9 /* TokenType.property */] + [257 /* SyntaxKind.VariableDeclaration */, 7 /* TokenType.variable */], + [166 /* SyntaxKind.Parameter */, 6 /* TokenType.parameter */], + [169 /* SyntaxKind.PropertyDeclaration */, 9 /* TokenType.property */], + [264 /* SyntaxKind.ModuleDeclaration */, 3 /* TokenType.namespace */], + [263 /* SyntaxKind.EnumDeclaration */, 1 /* TokenType.enum */], + [302 /* SyntaxKind.EnumMember */, 8 /* TokenType.enumMember */], + [260 /* SyntaxKind.ClassDeclaration */, 0 /* TokenType.class */], + [171 /* SyntaxKind.MethodDeclaration */, 11 /* TokenType.member */], + [259 /* SyntaxKind.FunctionDeclaration */, 10 /* TokenType.function */], + [215 /* SyntaxKind.FunctionExpression */, 10 /* TokenType.function */], + [170 /* SyntaxKind.MethodSignature */, 11 /* TokenType.member */], + [174 /* SyntaxKind.GetAccessor */, 9 /* TokenType.property */], + [175 /* SyntaxKind.SetAccessor */, 9 /* TokenType.property */], + [168 /* SyntaxKind.PropertySignature */, 9 /* TokenType.property */], + [261 /* SyntaxKind.InterfaceDeclaration */, 2 /* TokenType.interface */], + [262 /* SyntaxKind.TypeAliasDeclaration */, 5 /* TokenType.type */], + [165 /* SyntaxKind.TypeParameter */, 4 /* TokenType.typeParameter */], + [299 /* SyntaxKind.PropertyAssignment */, 9 /* TokenType.property */], + [300 /* SyntaxKind.ShorthandPropertyAssignment */, 9 /* TokenType.property */] ]); })(v2020 = classifier.v2020 || (classifier.v2020 = {})); })(classifier = ts.classifier || (ts.classifier = {})); @@ -133538,18 +134476,18 @@ var ts; function getStringLiteralCompletionEntries(sourceFile, node, position, typeChecker, compilerOptions, host, preferences) { var parent = walkUpParentheses(node.parent); switch (parent.kind) { - case 196 /* SyntaxKind.LiteralType */: { + case 198 /* SyntaxKind.LiteralType */: { var grandParent_1 = walkUpParentheses(parent.parent); switch (grandParent_1.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 178 /* SyntaxKind.TypeReference */: { + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: { var typeArgument = ts.findAncestor(parent, function (n) { return n.parent === grandParent_1; }); if (typeArgument) { return { kind: 2 /* StringLiteralCompletionKind.Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(typeArgument)), isNewIdentifier: false }; } return undefined; } - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: // Get all apparent property names // i.e. interface Foo { // foo: string; @@ -133561,9 +134499,9 @@ var ts; return undefined; } return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(objectType)); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return { kind: 0 /* StringLiteralCompletionKind.Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) }; - case 187 /* SyntaxKind.UnionType */: { + case 189 /* SyntaxKind.UnionType */: { if (!ts.isTypeReferenceNode(grandParent_1.parent)) { return undefined; } @@ -133575,7 +134513,7 @@ var ts; return undefined; } } - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (ts.isObjectLiteralExpression(parent.parent) && parent.name === node) { // Get quoted name of properties of the object literal expression // i.e. interface ConfigFiles { @@ -133592,7 +134530,7 @@ var ts; return stringLiteralCompletionsForObjectLiteral(typeChecker, parent.parent); } return fromContextualType(); - case 207 /* SyntaxKind.ElementAccessExpression */: { + case 209 /* SyntaxKind.ElementAccessExpression */: { var _b = parent, expression = _b.expression, argumentExpression = _b.argumentExpression; if (node === ts.skipParentheses(argumentExpression)) { // Get all names of properties on the expression @@ -133605,20 +134543,20 @@ var ts; } return undefined; } - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 285 /* SyntaxKind.JsxAttribute */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 288 /* SyntaxKind.JsxAttribute */: if (!isRequireCallArgument(node) && !ts.isImportCall(parent)) { - var argumentInfo = ts.SignatureHelp.getArgumentInfoForCompletions(parent.kind === 285 /* SyntaxKind.JsxAttribute */ ? parent.parent : node, position, sourceFile); + var argumentInfo = ts.SignatureHelp.getArgumentInfoForCompletions(parent.kind === 288 /* SyntaxKind.JsxAttribute */ ? parent.parent : node, position, sourceFile); // Get string literal completions from specialized signatures of the target // i.e. declare function f(a: 'A'); // f("/*completion position*/") - return argumentInfo ? getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) : fromContextualType(); + return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(); } // falls through (is `require("")` or `require(""` or `import("")`) - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 277 /* SyntaxKind.ExternalModuleReference */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 280 /* SyntaxKind.ExternalModuleReference */: // Get all known external module names or complete a path to a module // i.e. import * as ns from "/*completion position*/"; // var y = import("/*completion position*/"); @@ -133637,9 +134575,9 @@ var ts; } function walkUpParentheses(node) { switch (node.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return ts.walkUpParenthesizedTypes(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return ts.walkUpParenthesizedExpressions(node); default: return node; @@ -133669,7 +134607,7 @@ var ts; isNewIdentifier = isNewIdentifier || !!(type.flags & 4 /* TypeFlags.String */); return getStringLiteralTypes(type, uniques); }); - return { kind: 2 /* StringLiteralCompletionKind.Types */, types: types, isNewIdentifier: isNewIdentifier }; + return ts.length(types) ? { kind: 2 /* StringLiteralCompletionKind.Types */, types: types, isNewIdentifier: isNewIdentifier } : undefined; } function stringLiteralCompletionsFromProperties(type) { return type && { @@ -134187,7 +135125,7 @@ var ts; if (!dependencies) continue; for (var dep in dependencies) { - if (dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, "@types/")) { + if (ts.hasProperty(dependencies, dep) && !ts.startsWith(dep, "@types/")) { result.push(dep); } } @@ -134562,7 +135500,7 @@ var ts; } function keywordFiltersFromSyntaxKind(keywordCompletion) { switch (keywordCompletion) { - case 152 /* SyntaxKind.TypeKeyword */: return 8 /* KeywordCompletionFilters.TypeKeyword */; + case 154 /* SyntaxKind.TypeKeyword */: return 8 /* KeywordCompletionFilters.TypeKeyword */; default: ts.Debug.fail("Unknown mapping from SyntaxKind to KeywordCompletionFilters"); } } @@ -134571,7 +135509,7 @@ var ts; return (location === null || location === void 0 ? void 0 : location.kind) === 79 /* SyntaxKind.Identifier */ ? ts.createTextSpanFromNode(location) : undefined; } function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) { - var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag, importCompletionNode = completionData.importCompletionNode, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports; + var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag, importStatementCompletion = completionData.importStatementCompletion, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports; // Verify if the file is JSX language variant if (ts.getLanguageVariant(sourceFile.scriptKind) === 1 /* LanguageVariant.JSX */) { var completionInfo = getJsxClosingTagCompletion(location, sourceFile); @@ -134585,7 +135523,7 @@ var ts; return undefined; } var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, - /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag); + /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag); if (keywordFilters !== 0 /* KeywordCompletionFilters.None */) { for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) { var keywordEntry = _a[_i]; @@ -134638,12 +135576,12 @@ var ts; // We wanna walk up the tree till we find a JSX closing element var jsxClosingElement = ts.findAncestor(location, function (node) { switch (node.kind) { - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: return true; case 43 /* SyntaxKind.SlashToken */: case 31 /* SyntaxKind.GreaterThanToken */: case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return false; default: return "quit"; @@ -134703,7 +135641,7 @@ var ts; function createCompletionEntryForLiteral(sourceFile, preferences, literal) { return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* ScriptElementKind.string */, kindModifiers: "" /* ScriptElementKindModifier.none */, sortText: Completions.SortText.LocationPriority }; } - function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) { + function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) { var _a, _b; var insertText; var replacementSpan = ts.getReplacementSpanForContextToken(replacementToken); @@ -134759,8 +135697,8 @@ var ts; } if (originIsResolvedExport(origin)) { sourceDisplay = [ts.textPart(origin.moduleSpecifier)]; - if (importCompletionNode) { - (_a = getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, contextToken, origin, useSemicolons, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan); + if (importStatementCompletion) { + (_a = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan); isSnippet = preferences.includeCompletionsWithSnippetText ? true : undefined; } } @@ -134815,7 +135753,7 @@ var ts; } if (originIsExport(origin) || originIsResolvedExport(origin)) { data = originToCompletionEntryData(origin); - hasAction = !importCompletionNode; + hasAction = !importStatementCompletion; } // TODO(drosen): Right now we just permit *all* semantic meanings when calling // 'getSymbolKind' which is permissible given that it is backwards compatible; but @@ -134838,7 +135776,7 @@ var ts; labelDetails: labelDetails, isSnippet: isSnippet, isPackageJsonImport: originIsPackageJsonImport(origin) || undefined, - isImportStatementCompletion: !!importCompletionNode || undefined, + isImportStatementCompletion: !!importStatementCompletion || undefined, data: data, }; } @@ -134917,7 +135855,7 @@ var ts; // Whether the suggested member should be abstract. // e.g. in `abstract class C { abstract | }`, we should offer abstract method signatures at position `|`. var _a = getPresentModifiers(contextToken), presentModifiers = _a.modifiers, modifiersSpan = _a.span; - var isAbstract = !!(presentModifiers & 128 /* ModifierFlags.Abstract */); + var isAbstract = !!(presentModifiers & 256 /* ModifierFlags.Abstract */); var completionNodes = []; ts.codefix.addNewNodeForMemberSymbol(symbol, classLikeDeclaration, sourceFile, { program: program, host: host }, preferences, importAdder, // `addNewNodeForMemberSymbol` calls this callback function for each new member node @@ -134930,7 +135868,7 @@ var ts; function (node) { var requiredModifiers = 0 /* ModifierFlags.None */; if (isAbstract) { - requiredModifiers |= 128 /* ModifierFlags.Abstract */; + requiredModifiers |= 256 /* ModifierFlags.Abstract */; } if (ts.isClassElement(node) && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node) === 1 /* MemberOverrideStatus.NeedsOverride */) { @@ -134991,7 +135929,7 @@ var ts; span = ts.createTextSpanFromNode(contextToken); } if (ts.isPropertyDeclaration(contextToken.parent)) { - modifiers |= ts.modifiersToFlags(contextToken.parent.modifiers) & 125951 /* ModifierFlags.Modifier */; + modifiers |= ts.modifiersToFlags(contextToken.parent.modifiers) & 126975 /* ModifierFlags.Modifier */; span = ts.createTextSpanFromNode(contextToken.parent); } return { modifiers: modifiers, span: span }; @@ -135040,7 +135978,6 @@ var ts; var labelDetails = { detail: signaturePrinter.printNode(4 /* EmitHint.Unspecified */, methodSignature, sourceFile) }; return { isSnippet: isSnippet, insertText: insertText, labelDetails: labelDetails }; } - ; function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences) { var declarations = symbol.getDeclarations(); if (!(declarations && declarations.length)) { @@ -135053,10 +135990,10 @@ var ts; var quotePreference = ts.getQuotePreference(sourceFile, preferences); var builderFlags = 33554432 /* NodeBuilderFlags.OmitThisParameter */ | (quotePreference === 0 /* QuotePreference.Single */ ? 268435456 /* NodeBuilderFlags.UseSingleQuotesForStringLiteralType */ : 0 /* NodeBuilderFlags.None */); switch (declaration.kind) { - case 166 /* SyntaxKind.PropertySignature */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: { + case 168 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: { var effectiveType = type.flags & 1048576 /* TypeFlags.Union */ && type.types.length < 10 ? checker.getUnionType(type.types, 2 /* UnionReduction.Subtype */) : type; @@ -135090,7 +136027,8 @@ var ts; } var parameters = typeNode.parameters.map(function (typedParam) { return ts.factory.createParameterDeclaration( - /*modifiers*/ undefined, typedParam.dotDotDotToken, typedParam.name, typedParam.questionToken, + /*modifiers*/ undefined, typedParam.dotDotDotToken, typedParam.name, + /*questionToken*/ undefined, /*type*/ undefined, typedParam.initializer); }); return ts.factory.createMethodDeclaration( @@ -135210,20 +136148,17 @@ var ts; }; return unresolvedOrigin; } - function getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, contextToken, origin, useSemicolons, options, preferences) { - var _a, _b, _c; - var sourceFile = importCompletionNode.getSourceFile(); - var replacementSpan = ts.createTextSpanFromNode(ts.findAncestor(importCompletionNode, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)) || importCompletionNode, sourceFile); + function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) { + var replacementSpan = importStatementCompletion.replacementSpan; var quotedModuleSpecifier = ts.quote(sourceFile, preferences, origin.moduleSpecifier); var exportKind = origin.isDefaultExport ? 1 /* ExportKind.Default */ : origin.exportName === "export=" /* InternalSymbolName.ExportEquals */ ? 2 /* ExportKind.ExportEquals */ : 0 /* ExportKind.Named */; var tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : ""; var importKind = ts.codefix.getImportKind(sourceFile, exportKind, options, /*forceImportKeyword*/ true); - var isTopLevelTypeOnly = ((_b = (_a = ts.tryCast(importCompletionNode, ts.isImportDeclaration)) === null || _a === void 0 ? void 0 : _a.importClause) === null || _b === void 0 ? void 0 : _b.isTypeOnly) || ((_c = ts.tryCast(importCompletionNode, ts.isImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.isTypeOnly); - var isImportSpecifierTypeOnly = couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken); - var topLevelTypeOnlyText = isTopLevelTypeOnly ? " ".concat(ts.tokenToString(152 /* SyntaxKind.TypeKeyword */), " ") : " "; - var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? "".concat(ts.tokenToString(152 /* SyntaxKind.TypeKeyword */), " ") : ""; + var isImportSpecifierTypeOnly = importStatementCompletion.couldBeTypeOnlyImportSpecifier; + var topLevelTypeOnlyText = importStatementCompletion.isTopLevelTypeOnly ? " ".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : " "; + var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? "".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : ""; var suffix = useSemicolons ? ";" : ""; switch (importKind) { case 3 /* ImportKind.CommonJS */: return { replacementSpan: replacementSpan, insertText: "import".concat(topLevelTypeOnlyText).concat(ts.escapeSnippetText(name)).concat(tabStop, " = require(").concat(quotedModuleSpecifier, ")").concat(suffix) }; @@ -135256,7 +136191,7 @@ var ts; return CompletionSource.TypeOnlyAlias; } } - function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) { + function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) { var _a; var start = ts.timestamp(); var variableDeclaration = getVariableDeclaration(location); @@ -135277,7 +136212,7 @@ var ts; var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess; var originalSortText = (_a = symbolToSortTextMap === null || symbolToSortTextMap === void 0 ? void 0 : symbolToSortTextMap[ts.getSymbolId(symbol)]) !== null && _a !== void 0 ? _a : Completions.SortText.LocationPriority; var sortText = (isDeprecated(symbol, typeChecker) ? Completions.SortText.Deprecated(originalSortText) : originalSortText); - var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, compilerOptions, preferences, kind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag); + var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, compilerOptions, preferences, kind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag); if (!entry) { continue; } @@ -135437,7 +136372,7 @@ var ts; } case "symbol": { var symbol = symbolCompletion.symbol, location = symbolCompletion.location, contextToken_2 = symbolCompletion.contextToken, origin = symbolCompletion.origin, previousToken = symbolCompletion.previousToken; - var _a = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken_2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; + var _a = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken_2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay); // TODO: GH#18217 } case "literal": { @@ -135466,9 +136401,9 @@ var ts; return { name: name, kindModifiers: kindModifiers, kind: kind, displayParts: displayParts, documentation: documentation, tags: tags, codeActions: codeActions, source: source, sourceDisplay: source }; } Completions.createCompletionDetails = createCompletionDetails; - function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source) { + function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken) { if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) { - if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementNode) { + if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementSpan) { // Import statement completion: 'import c|' return { codeActions: undefined, sourceDisplay: [ts.textPart(data.moduleSpecifier)] }; } @@ -135498,7 +136433,7 @@ var ts; var moduleSymbol = origin.moduleSymbol; var targetSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker)); var isJsxOpeningTagName = (contextToken === null || contextToken === void 0 ? void 0 : contextToken.kind) === 29 /* SyntaxKind.LessThanToken */ && ts.isJsxOpeningLikeElement(contextToken.parent); - var _a = ts.codefix.getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), isJsxOpeningTagName), isJsxOpeningTagName, host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences), moduleSpecifier = _a.moduleSpecifier, codeAction = _a.codeAction; + var _a = ts.codefix.getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), isJsxOpeningTagName), isJsxOpeningTagName, host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences, cancellationToken), moduleSpecifier = _a.moduleSpecifier, codeAction = _a.codeAction; ts.Debug.assert(!(data === null || data === void 0 ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier); return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] }; } @@ -135541,11 +136476,11 @@ var ts; return ts.getContextualTypeFromParent(previousToken, checker); case 63 /* SyntaxKind.EqualsToken */: switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checker.getContextualType(parent.initializer); // TODO: GH#18217 - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return checker.getTypeAtLocation(parent.left); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return checker.getContextualTypeForJsxAttribute(parent); default: return undefined; @@ -135576,7 +136511,7 @@ var ts; } function isModuleSymbol(symbol) { var _a; - return !!((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.kind === 305 /* SyntaxKind.SourceFile */; })); + return !!((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.kind === 308 /* SyntaxKind.SourceFile */; })); } function getCompletionData(program, log, sourceFile, compilerOptions, position, preferences, detailsEntryId, host, formatContext, cancellationToken) { var typeChecker = program.getTypeChecker(); @@ -135633,7 +136568,7 @@ var ts; currentToken = ts.getTokenAtPosition(sourceFile, position); if (!currentToken || (!ts.isDeclarationName(currentToken) && - (currentToken.parent.kind !== 347 /* SyntaxKind.JSDocPropertyTag */ || + (currentToken.parent.kind !== 350 /* SyntaxKind.JSDocPropertyTag */ || currentToken.parent.name !== currentToken))) { // Use as type location if inside tag's type expression insideJsDocTagTypeExpression = isCurrentlyEditingNode(typeExpression); @@ -135669,34 +136604,34 @@ var ts; var isStartingCloseTag = false; var isJsxInitializer = false; var isJsxIdentifierExpected = false; - var importCompletionNode; + var importStatementCompletion; var location = ts.getTouchingPropertyName(sourceFile, position); var keywordFilters = 0 /* KeywordCompletionFilters.None */; var isNewIdentifierLocation = false; var flags = 0 /* CompletionInfoFlags.None */; if (contextToken) { - var importStatementCompletion = getImportStatementCompletionInfo(contextToken); - isNewIdentifierLocation = importStatementCompletion.isNewIdentifierLocation; - if (importStatementCompletion.keywordCompletion) { - if (importStatementCompletion.isKeywordOnlyCompletion) { + var importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken); + if (importStatementCompletionInfo.keywordCompletion) { + if (importStatementCompletionInfo.isKeywordOnlyCompletion) { return { kind: 4 /* CompletionDataKind.Keywords */, - keywordCompletions: [keywordToCompletionEntry(importStatementCompletion.keywordCompletion)], - isNewIdentifierLocation: isNewIdentifierLocation, + keywordCompletions: [keywordToCompletionEntry(importStatementCompletionInfo.keywordCompletion)], + isNewIdentifierLocation: importStatementCompletionInfo.isNewIdentifierLocation, }; } - keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletion.keywordCompletion); + keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletionInfo.keywordCompletion); } - if (importStatementCompletion.replacementNode && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) { + if (importStatementCompletionInfo.replacementSpan && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) { // Import statement completions use `insertText`, and also require the `data` property of `CompletionEntryIdentifier` // added in TypeScript 4.3 to be sent back from the client during `getCompletionEntryDetails`. Since this feature // is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients // to opt in with the `includeCompletionsForImportStatements` user preference. - importCompletionNode = importStatementCompletion.replacementNode; flags |= 2 /* CompletionInfoFlags.IsImportStatementCompletion */; + importStatementCompletion = importStatementCompletionInfo; + isNewIdentifierLocation = importStatementCompletionInfo.isNewIdentifierLocation; } // Bail out if this is a known invalid completion location - if (!importCompletionNode && isCompletionListBlocker(contextToken)) { + if (!importStatementCompletionInfo.replacementSpan && isCompletionListBlocker(contextToken)) { log("Returning an empty list because completion was requested in an invalid position."); return keywordFilters ? keywordCompletionData(keywordFilters, isJsOnlyLocation, isNewIdentifierDefinitionLocation()) @@ -135707,7 +136642,7 @@ var ts; isRightOfDot = contextToken.kind === 24 /* SyntaxKind.DotToken */; isRightOfQuestionDot = contextToken.kind === 28 /* SyntaxKind.QuestionDotToken */; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: propertyAccessToConvert = parent; node = propertyAccessToConvert.expression; var leftmostAccessExpression = ts.getLeftmostAccessExpression(propertyAccessToConvert); @@ -135723,16 +136658,16 @@ var ts; return undefined; } break; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: node = parent.left; break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: node = parent.name; break; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: node = parent; break; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: node = parent.getFirstToken(sourceFile); ts.Debug.assert(node.kind === 100 /* SyntaxKind.ImportKeyword */ || node.kind === 103 /* SyntaxKind.NewKeyword */); break; @@ -135742,11 +136677,11 @@ var ts; return undefined; } } - else if (!importCompletionNode && sourceFile.languageVariant === 1 /* LanguageVariant.JSX */) { + else if (!importStatementCompletion) { // // If the tagname is a property access expression, we will then walk up to the top most of property access expression. // Then, try to get a JSX container and its associated attributes type. - if (parent && parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (parent && parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { contextToken = parent; parent = parent.parent; } @@ -135754,46 +136689,46 @@ var ts; if (currentToken.parent === location) { switch (currentToken.kind) { case 31 /* SyntaxKind.GreaterThanToken */: - if (currentToken.parent.kind === 278 /* SyntaxKind.JsxElement */ || currentToken.parent.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (currentToken.parent.kind === 281 /* SyntaxKind.JsxElement */ || currentToken.parent.kind === 283 /* SyntaxKind.JsxOpeningElement */) { location = currentToken; } break; case 43 /* SyntaxKind.SlashToken */: - if (currentToken.parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */) { + if (currentToken.parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */) { location = currentToken; } break; } } switch (parent.kind) { - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: if (contextToken.kind === 43 /* SyntaxKind.SlashToken */) { isStartingCloseTag = true; location = contextToken; } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (!binaryExpressionMayBeOpenTag(parent)) { break; } // falls through - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 278 /* SyntaxKind.JsxElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 281 /* SyntaxKind.JsxElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: isJsxIdentifierExpected = true; if (contextToken.kind === 29 /* SyntaxKind.LessThanToken */) { isRightOfOpenTag = true; location = contextToken; } break; - case 288 /* SyntaxKind.JsxExpression */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 291 /* SyntaxKind.JsxExpression */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: // For `
`, `parent` will be `{true}` and `previousToken` will be `}` if (previousToken.kind === 19 /* SyntaxKind.CloseBraceToken */ && currentToken.kind === 31 /* SyntaxKind.GreaterThanToken */) { isJsxIdentifierExpected = true; } break; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: // For `
`, `parent` will be JsxAttribute and `previousToken` will be its initializer if (parent.initializer === previousToken && previousToken.end < position) { @@ -135885,19 +136820,19 @@ var ts; isTypeOnlyLocation: isTypeOnlyLocation, isJsxIdentifierExpected: isJsxIdentifierExpected, isRightOfOpenTag: isRightOfOpenTag, - importCompletionNode: importCompletionNode, + importStatementCompletion: importStatementCompletion, hasUnresolvedAutoImports: hasUnresolvedAutoImports, flags: flags, }; function isTagWithTypeExpression(tag) { switch (tag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 341 /* SyntaxKind.JSDocReturnTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return true; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return !!tag.constraint; default: return false; @@ -135906,7 +136841,7 @@ var ts; function tryGetTypeExpressionFromTag(tag) { if (isTagWithTypeExpression(tag)) { var typeExpression = ts.isJSDocTemplateTag(tag) ? tag.constraint : tag.typeExpression; - return typeExpression && typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */ ? typeExpression : undefined; + return typeExpression && typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */ ? typeExpression : undefined; } return undefined; } @@ -135949,7 +136884,7 @@ var ts; // If the module is merged with a value, we must get the type of the class and add its propertes (for inherited static methods). if (!isTypeLocation && symbol.declarations && - symbol.declarations.some(function (d) { return d.kind !== 305 /* SyntaxKind.SourceFile */ && d.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && d.kind !== 260 /* SyntaxKind.EnumDeclaration */; })) { + symbol.declarations.some(function (d) { return d.kind !== 308 /* SyntaxKind.SourceFile */ && d.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && d.kind !== 263 /* SyntaxKind.EnumDeclaration */; })) { var type = typeChecker.getTypeOfSymbolAtLocation(symbol, node).getNonOptionalType(); var insertQuestionDot = false; if (type.isNullableType()) { @@ -135995,7 +136930,7 @@ var ts; if (isRightOfQuestionDot && ts.some(type.getCallSignatures())) { isNewIdentifierLocation = true; } - var propertyAccess = node.kind === 200 /* SyntaxKind.ImportType */ ? node : node.parent; + var propertyAccess = node.kind === 202 /* SyntaxKind.ImportType */ ? node : node.parent; if (inCheckedFile) { for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) { var symbol = _a[_i]; @@ -136139,7 +137074,7 @@ var ts; return 1 /* GlobalsSearch.Success */; } function tryGetImportCompletionSymbols() { - if (!importCompletionNode) + if (!importStatementCompletion) return 0 /* GlobalsSearch.Continue */; isNewIdentifierLocation = true; collectAutoImports(); @@ -136202,7 +137137,7 @@ var ts; } } // Need to insert 'this.' before properties of `this` type, so only do that if `includeInsertTextCompletions` - if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 305 /* SyntaxKind.SourceFile */) { + if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 308 /* SyntaxKind.SourceFile */) { var thisType = typeChecker.tryGetThisTypeAt(scopeNode, /*includeGlobalThis*/ false, ts.isClassLike(scopeNode.parent) ? scopeNode : undefined); if (thisType && !isProbablyGlobalType(thisType, sourceFile, typeChecker)) { for (var _i = 0, _a = getPropertiesForCompletion(thisType, typeChecker); _i < _a.length; _i++) { @@ -136222,7 +137157,7 @@ var ts; } function shouldOfferImportCompletions() { // If already typing an import statement, provide completions for it. - if (importCompletionNode) + if (importStatementCompletion) return true; // If current completion is for non-contextual Object literal shortahands, ignore auto-import symbols if (isNonContextualObjectLiteral) @@ -136241,10 +137176,10 @@ var ts; } function isSnippetScope(scopeNode) { switch (scopeNode.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 223 /* SyntaxKind.TemplateExpression */: - case 288 /* SyntaxKind.JsxExpression */: - case 235 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 225 /* SyntaxKind.TemplateExpression */: + case 291 /* SyntaxKind.JsxExpression */: + case 238 /* SyntaxKind.Block */: return true; default: return ts.isStatement(scopeNode); @@ -136252,7 +137187,7 @@ var ts; } function isTypeOnlyCompletion() { return insideJsDocTagTypeExpression - || !!importCompletionNode && ts.isTypeOnlyImportOrExportDeclaration(location.parent) + || !!importStatementCompletion && ts.isTypeOnlyImportOrExportDeclaration(location.parent) || !isContextTokenValueLocation(contextToken) && (ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker) || ts.isPartOfTypeNode(location) @@ -136261,28 +137196,30 @@ var ts; function isContextTokenValueLocation(contextToken) { return contextToken && ((contextToken.kind === 112 /* SyntaxKind.TypeOfKeyword */ && - (contextToken.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isTypeOfExpression(contextToken.parent))) || - (contextToken.kind === 128 /* SyntaxKind.AssertsKeyword */ && contextToken.parent.kind === 177 /* SyntaxKind.TypePredicate */)); + (contextToken.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isTypeOfExpression(contextToken.parent))) || + (contextToken.kind === 129 /* SyntaxKind.AssertsKeyword */ && contextToken.parent.kind === 179 /* SyntaxKind.TypePredicate */)); } function isContextTokenTypeLocation(contextToken) { if (contextToken) { var parentKind = contextToken.parent.kind; switch (contextToken.kind) { case 58 /* SyntaxKind.ColonToken */: - return parentKind === 167 /* SyntaxKind.PropertyDeclaration */ || - parentKind === 166 /* SyntaxKind.PropertySignature */ || - parentKind === 164 /* SyntaxKind.Parameter */ || - parentKind === 254 /* SyntaxKind.VariableDeclaration */ || + return parentKind === 169 /* SyntaxKind.PropertyDeclaration */ || + parentKind === 168 /* SyntaxKind.PropertySignature */ || + parentKind === 166 /* SyntaxKind.Parameter */ || + parentKind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isFunctionLikeKind(parentKind); case 63 /* SyntaxKind.EqualsToken */: - return parentKind === 259 /* SyntaxKind.TypeAliasDeclaration */; - case 127 /* SyntaxKind.AsKeyword */: - return parentKind === 229 /* SyntaxKind.AsExpression */; + return parentKind === 262 /* SyntaxKind.TypeAliasDeclaration */; + case 128 /* SyntaxKind.AsKeyword */: + return parentKind === 231 /* SyntaxKind.AsExpression */; case 29 /* SyntaxKind.LessThanToken */: - return parentKind === 178 /* SyntaxKind.TypeReference */ || - parentKind === 211 /* SyntaxKind.TypeAssertionExpression */; + return parentKind === 180 /* SyntaxKind.TypeReference */ || + parentKind === 213 /* SyntaxKind.TypeAssertionExpression */; case 94 /* SyntaxKind.ExtendsKeyword */: - return parentKind === 163 /* SyntaxKind.TypeParameter */; + return parentKind === 165 /* SyntaxKind.TypeParameter */; + case 150 /* SyntaxKind.SatisfiesKeyword */: + return parentKind === 235 /* SyntaxKind.SatisfiesExpression */; } } return false; @@ -136300,8 +137237,7 @@ var ts; flags |= 1 /* CompletionInfoFlags.MayIncludeAutoImports */; // import { type | -> token text should be blank var isAfterTypeOnlyImportSpecifierModifier = previousToken === contextToken - && importCompletionNode - && couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken); + && importStatementCompletion; var lowerCaseTokenText = isAfterTypeOnlyImportSpecifierModifier ? "" : previousToken && ts.isIdentifier(previousToken) ? previousToken.text.toLowerCase() : ""; @@ -136309,14 +137245,14 @@ var ts; var exportInfo = ts.getExportInfoMap(sourceFile, host, program, preferences, cancellationToken); var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host); var packageJsonFilter = detailsEntryId ? undefined : ts.createPackageJsonImportFilter(sourceFile, preferences, host); - resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importCompletionNode, ts.isValidTypeOnlyAliasUseSite(location), function (context) { + resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importStatementCompletion, ts.isValidTypeOnlyAliasUseSite(location), function (context) { exportInfo.search(sourceFile.path, /*preferCapitalized*/ isRightOfOpenTag, function (symbolName, targetFlags) { if (!ts.isIdentifierText(symbolName, ts.getEmitScriptTarget(host.getCompilationSettings()))) return false; if (!detailsEntryId && ts.isStringANonContextualKeyword(symbolName)) return false; - if (!isTypeOnlyLocation && !importCompletionNode && !(targetFlags & 111551 /* SymbolFlags.Value */)) + if (!isTypeOnlyLocation && !importStatementCompletion && !(targetFlags & 111551 /* SymbolFlags.Value */)) return false; if (isTypeOnlyLocation && !(targetFlags & (1536 /* SymbolFlags.Module */ | 788968 /* SymbolFlags.Type */))) return false; @@ -136397,7 +137333,7 @@ var ts; return; } symbolToOriginInfoMap[symbols.length] = origin; - symbolToSortTextMap[symbolId] = importCompletionNode ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions; + symbolToSortTextMap[symbolId] = importStatementCompletion ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions; symbols.push(symbol); } /* Mutates `symbols` and `symbolToOriginInfoMap`. */ @@ -136473,18 +137409,18 @@ var ts; // - contextToken: GreaterThanToken (before cursor) // - location: JsxSelfClosingElement or JsxOpeningElement // - contextToken.parent === location - if (location === contextToken.parent && (location.kind === 280 /* SyntaxKind.JsxOpeningElement */ || location.kind === 279 /* SyntaxKind.JsxSelfClosingElement */)) { + if (location === contextToken.parent && (location.kind === 283 /* SyntaxKind.JsxOpeningElement */ || location.kind === 282 /* SyntaxKind.JsxSelfClosingElement */)) { return false; } - if (contextToken.parent.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (contextToken.parent.kind === 283 /* SyntaxKind.JsxOpeningElement */) { //
/**/ // - contextToken: GreaterThanToken (before cursor) // - location: JSXElement // - different parents (JSXOpeningElement, JSXElement) - return location.parent.kind !== 280 /* SyntaxKind.JsxOpeningElement */; + return location.parent.kind !== 283 /* SyntaxKind.JsxOpeningElement */; } - if (contextToken.parent.kind === 281 /* SyntaxKind.JsxClosingElement */ || contextToken.parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */) { - return !!contextToken.parent.parent && contextToken.parent.parent.kind === 278 /* SyntaxKind.JsxElement */; + if (contextToken.parent.kind === 284 /* SyntaxKind.JsxClosingElement */ || contextToken.parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */) { + return !!contextToken.parent.parent && contextToken.parent.parent.kind === 281 /* SyntaxKind.JsxElement */; } } return false; @@ -136496,44 +137432,44 @@ var ts; // Previous token may have been a keyword that was converted to an identifier. switch (tokenKind) { case 27 /* SyntaxKind.CommaToken */: - return containingNodeKind === 208 /* SyntaxKind.CallExpression */ // func( a, | - || containingNodeKind === 171 /* SyntaxKind.Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ - || containingNodeKind === 209 /* SyntaxKind.NewExpression */ // new C(a, | - || containingNodeKind === 204 /* SyntaxKind.ArrayLiteralExpression */ // [a, | - || containingNodeKind === 221 /* SyntaxKind.BinaryExpression */ // const x = (a, | - || containingNodeKind === 179 /* SyntaxKind.FunctionType */ // var x: (s: string, list| - || containingNodeKind === 205 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { x, | + return containingNodeKind === 210 /* SyntaxKind.CallExpression */ // func( a, | + || containingNodeKind === 173 /* SyntaxKind.Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ + || containingNodeKind === 211 /* SyntaxKind.NewExpression */ // new C(a, | + || containingNodeKind === 206 /* SyntaxKind.ArrayLiteralExpression */ // [a, | + || containingNodeKind === 223 /* SyntaxKind.BinaryExpression */ // const x = (a, | + || containingNodeKind === 181 /* SyntaxKind.FunctionType */ // var x: (s: string, list| + || containingNodeKind === 207 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { x, | case 20 /* SyntaxKind.OpenParenToken */: - return containingNodeKind === 208 /* SyntaxKind.CallExpression */ // func( | - || containingNodeKind === 171 /* SyntaxKind.Constructor */ // constructor( | - || containingNodeKind === 209 /* SyntaxKind.NewExpression */ // new C(a| - || containingNodeKind === 212 /* SyntaxKind.ParenthesizedExpression */ // const x = (a| - || containingNodeKind === 191 /* SyntaxKind.ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ + return containingNodeKind === 210 /* SyntaxKind.CallExpression */ // func( | + || containingNodeKind === 173 /* SyntaxKind.Constructor */ // constructor( | + || containingNodeKind === 211 /* SyntaxKind.NewExpression */ // new C(a| + || containingNodeKind === 214 /* SyntaxKind.ParenthesizedExpression */ // const x = (a| + || containingNodeKind === 193 /* SyntaxKind.ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ case 22 /* SyntaxKind.OpenBracketToken */: - return containingNodeKind === 204 /* SyntaxKind.ArrayLiteralExpression */ // [ | - || containingNodeKind === 176 /* SyntaxKind.IndexSignature */ // [ | : string ] - || containingNodeKind === 162 /* SyntaxKind.ComputedPropertyName */; // [ | /* this can become an index signature */ - case 141 /* SyntaxKind.ModuleKeyword */: // module | - case 142 /* SyntaxKind.NamespaceKeyword */: // namespace | + return containingNodeKind === 206 /* SyntaxKind.ArrayLiteralExpression */ // [ | + || containingNodeKind === 178 /* SyntaxKind.IndexSignature */ // [ | : string ] + || containingNodeKind === 164 /* SyntaxKind.ComputedPropertyName */; // [ | /* this can become an index signature */ + case 142 /* SyntaxKind.ModuleKeyword */: // module | + case 143 /* SyntaxKind.NamespaceKeyword */: // namespace | case 100 /* SyntaxKind.ImportKeyword */: // import | return true; case 24 /* SyntaxKind.DotToken */: - return containingNodeKind === 261 /* SyntaxKind.ModuleDeclaration */; // module A.| + return containingNodeKind === 264 /* SyntaxKind.ModuleDeclaration */; // module A.| case 18 /* SyntaxKind.OpenBraceToken */: - return containingNodeKind === 257 /* SyntaxKind.ClassDeclaration */ // class A { | - || containingNodeKind === 205 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { | + return containingNodeKind === 260 /* SyntaxKind.ClassDeclaration */ // class A { | + || containingNodeKind === 207 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { | case 63 /* SyntaxKind.EqualsToken */: - return containingNodeKind === 254 /* SyntaxKind.VariableDeclaration */ // const x = a| - || containingNodeKind === 221 /* SyntaxKind.BinaryExpression */; // x = a| + return containingNodeKind === 257 /* SyntaxKind.VariableDeclaration */ // const x = a| + || containingNodeKind === 223 /* SyntaxKind.BinaryExpression */; // x = a| case 15 /* SyntaxKind.TemplateHead */: - return containingNodeKind === 223 /* SyntaxKind.TemplateExpression */; // `aa ${| + return containingNodeKind === 225 /* SyntaxKind.TemplateExpression */; // `aa ${| case 16 /* SyntaxKind.TemplateMiddle */: - return containingNodeKind === 233 /* SyntaxKind.TemplateSpan */; // `aa ${10} dd ${| - case 131 /* SyntaxKind.AsyncKeyword */: - return containingNodeKind === 169 /* SyntaxKind.MethodDeclaration */ // const obj = { async c|() - || containingNodeKind === 297 /* SyntaxKind.ShorthandPropertyAssignment */; // const obj = { async c| + return containingNodeKind === 236 /* SyntaxKind.TemplateSpan */; // `aa ${10} dd ${| + case 132 /* SyntaxKind.AsyncKeyword */: + return containingNodeKind === 171 /* SyntaxKind.MethodDeclaration */ // const obj = { async c|() + || containingNodeKind === 300 /* SyntaxKind.ShorthandPropertyAssignment */; // const obj = { async c| case 41 /* SyntaxKind.AsteriskToken */: - return containingNodeKind === 169 /* SyntaxKind.MethodDeclaration */; // const obj = { * c| + return containingNodeKind === 171 /* SyntaxKind.MethodDeclaration */; // const obj = { * c| } if (isClassMemberCompletionKeyword(tokenKind)) { return true; @@ -136583,7 +137519,7 @@ var ts; completionKind = 0 /* CompletionKind.ObjectPropertyDeclaration */; var typeMembers; var existingMembers; - if (objectLikeContainer.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { var instantiatedType = tryGetObjectLiteralContextualType(objectLikeContainer, typeChecker); // Check completions for Object property value shorthand if (instantiatedType === undefined) { @@ -136608,7 +137544,7 @@ var ts; } } else { - ts.Debug.assert(objectLikeContainer.kind === 201 /* SyntaxKind.ObjectBindingPattern */); + ts.Debug.assert(objectLikeContainer.kind === 203 /* SyntaxKind.ObjectBindingPattern */); // We are *only* completing on properties from the type being destructured. isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); @@ -136619,12 +137555,12 @@ var ts; // through type declaration or inference. // Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed - // type of parameter will flow in from the contextual type of the function - var canGetType = ts.hasInitializer(rootDeclaration) || !!ts.getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */; - if (!canGetType && rootDeclaration.kind === 164 /* SyntaxKind.Parameter */) { + var canGetType = ts.hasInitializer(rootDeclaration) || !!ts.getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */; + if (!canGetType && rootDeclaration.kind === 166 /* SyntaxKind.Parameter */) { if (ts.isExpression(rootDeclaration.parent)) { canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); } - else if (rootDeclaration.parent.kind === 169 /* SyntaxKind.MethodDeclaration */ || rootDeclaration.parent.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (rootDeclaration.parent.kind === 171 /* SyntaxKind.MethodDeclaration */ || rootDeclaration.parent.kind === 175 /* SyntaxKind.SetAccessor */) { canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); } } @@ -136643,7 +137579,7 @@ var ts; var filteredMembers = filterObjectMembersList(typeMembers, ts.Debug.checkDefined(existingMembers)); symbols = ts.concatenate(symbols, filteredMembers); setSortTextToOptionalMember(); - if (objectLikeContainer.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ + if (objectLikeContainer.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && preferences.includeCompletionsWithObjectLiteralMethodSnippets && preferences.includeCompletionsWithInsertText) { transformObjectLiteralMembersSortText(symbolsStartIndex); @@ -136678,10 +137614,10 @@ var ts; keywordFilters = 8 /* KeywordCompletionFilters.TypeKeyword */; } // try to show exported member for imported/re-exported module - var moduleSpecifier = (namedImportsOrExports.kind === 269 /* SyntaxKind.NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier; + var moduleSpecifier = (namedImportsOrExports.kind === 272 /* SyntaxKind.NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier; if (!moduleSpecifier) { isNewIdentifierLocation = true; - return namedImportsOrExports.kind === 269 /* SyntaxKind.NamedImports */ ? 2 /* GlobalsSearch.Fail */ : 0 /* GlobalsSearch.Continue */; + return namedImportsOrExports.kind === 272 /* SyntaxKind.NamedImports */ ? 2 /* GlobalsSearch.Fail */ : 0 /* GlobalsSearch.Continue */; } var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); // TODO: GH#18217 if (!moduleSpecifierSymbol) { @@ -136826,11 +137762,11 @@ var ts; case 30 /* SyntaxKind.LessThanSlashToken */: case 43 /* SyntaxKind.SlashToken */: case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 286 /* SyntaxKind.JsxAttributes */: - case 285 /* SyntaxKind.JsxAttribute */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - if (parent && (parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */ || parent.kind === 280 /* SyntaxKind.JsxOpeningElement */)) { + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 289 /* SyntaxKind.JsxAttributes */: + case 288 /* SyntaxKind.JsxAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + if (parent && (parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || parent.kind === 283 /* SyntaxKind.JsxOpeningElement */)) { if (contextToken.kind === 31 /* SyntaxKind.GreaterThanToken */) { var precedingToken = ts.findPrecedingToken(contextToken.pos, sourceFile, /*startNode*/ undefined); if (!parent.typeArguments || (precedingToken && precedingToken.kind === 43 /* SyntaxKind.SlashToken */)) @@ -136838,7 +137774,7 @@ var ts; } return parent; } - else if (parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + else if (parent.kind === 288 /* SyntaxKind.JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136850,7 +137786,7 @@ var ts; // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 10 /* SyntaxKind.StringLiteral */: - if (parent && ((parent.kind === 285 /* SyntaxKind.JsxAttribute */) || (parent.kind === 287 /* SyntaxKind.JsxSpreadAttribute */))) { + if (parent && ((parent.kind === 288 /* SyntaxKind.JsxAttribute */) || (parent.kind === 290 /* SyntaxKind.JsxSpreadAttribute */))) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136860,8 +137796,8 @@ var ts; break; case 19 /* SyntaxKind.CloseBraceToken */: if (parent && - parent.kind === 288 /* SyntaxKind.JsxExpression */ && - parent.parent && parent.parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + parent.kind === 291 /* SyntaxKind.JsxExpression */ && + parent.parent && parent.parent.kind === 288 /* SyntaxKind.JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136869,7 +137805,7 @@ var ts; // each JsxAttribute can have initializer as JsxExpression return parent.parent.parent.parent; } - if (parent && parent.kind === 287 /* SyntaxKind.JsxSpreadAttribute */) { + if (parent && parent.kind === 290 /* SyntaxKind.JsxSpreadAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136889,54 +137825,54 @@ var ts; var containingNodeKind = parent.kind; switch (contextToken.kind) { case 27 /* SyntaxKind.CommaToken */: - return containingNodeKind === 254 /* SyntaxKind.VariableDeclaration */ || + return containingNodeKind === 257 /* SyntaxKind.VariableDeclaration */ || isVariableDeclarationListButNotTypeArgument(contextToken) || - containingNodeKind === 237 /* SyntaxKind.VariableStatement */ || - containingNodeKind === 260 /* SyntaxKind.EnumDeclaration */ || // enum a { foo, | + containingNodeKind === 240 /* SyntaxKind.VariableStatement */ || + containingNodeKind === 263 /* SyntaxKind.EnumDeclaration */ || // enum a { foo, | isFunctionLikeButNotConstructor(containingNodeKind) || - containingNodeKind === 258 /* SyntaxKind.InterfaceDeclaration */ || // interface A= contextToken.pos); case 24 /* SyntaxKind.DotToken */: - return containingNodeKind === 202 /* SyntaxKind.ArrayBindingPattern */; // var [.| + return containingNodeKind === 204 /* SyntaxKind.ArrayBindingPattern */; // var [.| case 58 /* SyntaxKind.ColonToken */: - return containingNodeKind === 203 /* SyntaxKind.BindingElement */; // var {x :html| + return containingNodeKind === 205 /* SyntaxKind.BindingElement */; // var {x :html| case 22 /* SyntaxKind.OpenBracketToken */: - return containingNodeKind === 202 /* SyntaxKind.ArrayBindingPattern */; // var [x| + return containingNodeKind === 204 /* SyntaxKind.ArrayBindingPattern */; // var [x| case 20 /* SyntaxKind.OpenParenToken */: - return containingNodeKind === 292 /* SyntaxKind.CatchClause */ || + return containingNodeKind === 295 /* SyntaxKind.CatchClause */ || isFunctionLikeButNotConstructor(containingNodeKind); case 18 /* SyntaxKind.OpenBraceToken */: - return containingNodeKind === 260 /* SyntaxKind.EnumDeclaration */; // enum a { | + return containingNodeKind === 263 /* SyntaxKind.EnumDeclaration */; // enum a { | case 29 /* SyntaxKind.LessThanToken */: - return containingNodeKind === 257 /* SyntaxKind.ClassDeclaration */ || // class A< | - containingNodeKind === 226 /* SyntaxKind.ClassExpression */ || // var C = class D< | - containingNodeKind === 258 /* SyntaxKind.InterfaceDeclaration */ || // interface A< | - containingNodeKind === 259 /* SyntaxKind.TypeAliasDeclaration */ || // type List< | + return containingNodeKind === 260 /* SyntaxKind.ClassDeclaration */ || // class A< | + containingNodeKind === 228 /* SyntaxKind.ClassExpression */ || // var C = class D< | + containingNodeKind === 261 /* SyntaxKind.InterfaceDeclaration */ || // interface A< | + containingNodeKind === 262 /* SyntaxKind.TypeAliasDeclaration */ || // type List< | ts.isFunctionLikeKind(containingNodeKind); case 124 /* SyntaxKind.StaticKeyword */: - return containingNodeKind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isClassLike(parent.parent); + return containingNodeKind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isClassLike(parent.parent); case 25 /* SyntaxKind.DotDotDotToken */: - return containingNodeKind === 164 /* SyntaxKind.Parameter */ || - (!!parent.parent && parent.parent.kind === 202 /* SyntaxKind.ArrayBindingPattern */); // var [...z| + return containingNodeKind === 166 /* SyntaxKind.Parameter */ || + (!!parent.parent && parent.parent.kind === 204 /* SyntaxKind.ArrayBindingPattern */); // var [...z| case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - return containingNodeKind === 164 /* SyntaxKind.Parameter */ && !ts.isConstructorDeclaration(parent.parent); - case 127 /* SyntaxKind.AsKeyword */: - return containingNodeKind === 270 /* SyntaxKind.ImportSpecifier */ || - containingNodeKind === 275 /* SyntaxKind.ExportSpecifier */ || - containingNodeKind === 268 /* SyntaxKind.NamespaceImport */; - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: + return containingNodeKind === 166 /* SyntaxKind.Parameter */ && !ts.isConstructorDeclaration(parent.parent); + case 128 /* SyntaxKind.AsKeyword */: + return containingNodeKind === 273 /* SyntaxKind.ImportSpecifier */ || + containingNodeKind === 278 /* SyntaxKind.ExportSpecifier */ || + containingNodeKind === 271 /* SyntaxKind.NamespaceImport */; + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: return !isFromObjectTypeDeclaration(contextToken); case 79 /* SyntaxKind.Identifier */: - if (containingNodeKind === 270 /* SyntaxKind.ImportSpecifier */ && + if (containingNodeKind === 273 /* SyntaxKind.ImportSpecifier */ && contextToken === parent.name && contextToken.text === "type") { // import { type | } @@ -136951,11 +137887,11 @@ var ts; case 100 /* SyntaxKind.ImportKeyword */: case 119 /* SyntaxKind.LetKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: return true; - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: // import { type foo| } - return containingNodeKind !== 270 /* SyntaxKind.ImportSpecifier */; + return containingNodeKind !== 273 /* SyntaxKind.ImportSpecifier */; case 41 /* SyntaxKind.AsteriskToken */: return ts.isFunctionLike(contextToken.parent) && !ts.isMethodDeclaration(contextToken.parent); } @@ -136980,7 +137916,7 @@ var ts; case 126 /* SyntaxKind.AbstractKeyword */: case 84 /* SyntaxKind.ClassKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 92 /* SyntaxKind.EnumKeyword */: case 98 /* SyntaxKind.FunctionKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: @@ -136991,7 +137927,7 @@ var ts; case 124 /* SyntaxKind.StaticKeyword */: case 113 /* SyntaxKind.VarKeyword */: return true; - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: return ts.isPropertyDeclaration(contextToken.parent); } // If we are inside a class declaration, and `constructor` is totally not present, @@ -137000,7 +137936,7 @@ var ts; if (ancestorClassLike && contextToken === previousToken && isPreviousPropertyDeclarationTerminated(contextToken, position)) { return false; // Don't block completions. } - var ancestorPropertyDeclaraion = ts.getAncestor(contextToken.parent, 167 /* SyntaxKind.PropertyDeclaration */); + var ancestorPropertyDeclaraion = ts.getAncestor(contextToken.parent, 169 /* SyntaxKind.PropertyDeclaration */); // If we are inside a class declaration and typing `constructor` after property declaration... if (ancestorPropertyDeclaraion && contextToken !== previousToken @@ -137032,7 +137968,7 @@ var ts; || !ts.positionsAreOnSameLine(contextToken.end, position, sourceFile)); } function isFunctionLikeButNotConstructor(kind) { - return ts.isFunctionLikeKind(kind) && kind !== 171 /* SyntaxKind.Constructor */; + return ts.isFunctionLikeKind(kind) && kind !== 173 /* SyntaxKind.Constructor */; } function isDotOfNumericLiteral(contextToken) { if (contextToken.kind === 8 /* SyntaxKind.NumericLiteral */) { @@ -137042,7 +137978,7 @@ var ts; return false; } function isVariableDeclarationListButNotTypeArgument(node) { - return node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */ + return node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */ && !ts.isPossiblyTypeArgumentPosition(node, sourceFile, typeChecker); } /** @@ -137060,13 +137996,13 @@ var ts; for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 296 /* SyntaxKind.PropertyAssignment */ && - m.kind !== 297 /* SyntaxKind.ShorthandPropertyAssignment */ && - m.kind !== 203 /* SyntaxKind.BindingElement */ && - m.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - m.kind !== 172 /* SyntaxKind.GetAccessor */ && - m.kind !== 173 /* SyntaxKind.SetAccessor */ && - m.kind !== 298 /* SyntaxKind.SpreadAssignment */) { + if (m.kind !== 299 /* SyntaxKind.PropertyAssignment */ && + m.kind !== 300 /* SyntaxKind.ShorthandPropertyAssignment */ && + m.kind !== 205 /* SyntaxKind.BindingElement */ && + m.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + m.kind !== 174 /* SyntaxKind.GetAccessor */ && + m.kind !== 175 /* SyntaxKind.SetAccessor */ && + m.kind !== 301 /* SyntaxKind.SpreadAssignment */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -137157,10 +138093,10 @@ var ts; for (var _i = 0, existingMembers_2 = existingMembers; _i < existingMembers_2.length; _i++) { var m = existingMembers_2[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && - m.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - m.kind !== 172 /* SyntaxKind.GetAccessor */ && - m.kind !== 173 /* SyntaxKind.SetAccessor */) { + if (m.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && + m.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + m.kind !== 174 /* SyntaxKind.GetAccessor */ && + m.kind !== 175 /* SyntaxKind.SetAccessor */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -137202,7 +138138,7 @@ var ts; if (isCurrentlyEditingNode(attr)) { continue; } - if (attr.kind === 285 /* SyntaxKind.JsxAttribute */) { + if (attr.kind === 288 /* SyntaxKind.JsxAttribute */) { seenNames.add(attr.name.escapedText); } else if (ts.isJsxSpreadAttribute(attr)) { @@ -137300,7 +138236,7 @@ var ts; var _keywordCompletions = []; var allKeywordsCompletions = ts.memoize(function () { var res = []; - for (var i = 81 /* SyntaxKind.FirstKeyword */; i <= 160 /* SyntaxKind.LastKeyword */; i++) { + for (var i = 81 /* SyntaxKind.FirstKeyword */; i <= 162 /* SyntaxKind.LastKeyword */; i++) { res.push({ name: ts.tokenToString(i), kind: "keyword" /* ScriptElementKind.keyword */, @@ -137326,12 +138262,12 @@ var ts; return false; case 1 /* KeywordCompletionFilters.All */: return isFunctionLikeBodyKeyword(kind) - || kind === 135 /* SyntaxKind.DeclareKeyword */ - || kind === 141 /* SyntaxKind.ModuleKeyword */ - || kind === 152 /* SyntaxKind.TypeKeyword */ - || kind === 142 /* SyntaxKind.NamespaceKeyword */ + || kind === 136 /* SyntaxKind.DeclareKeyword */ + || kind === 142 /* SyntaxKind.ModuleKeyword */ + || kind === 154 /* SyntaxKind.TypeKeyword */ + || kind === 143 /* SyntaxKind.NamespaceKeyword */ || kind === 126 /* SyntaxKind.AbstractKeyword */ - || ts.isTypeKeyword(kind) && kind !== 153 /* SyntaxKind.UndefinedKeyword */; + || ts.isTypeKeyword(kind) && kind !== 155 /* SyntaxKind.UndefinedKeyword */; case 5 /* KeywordCompletionFilters.FunctionLikeBodyKeywords */: return isFunctionLikeBodyKeyword(kind); case 2 /* KeywordCompletionFilters.ClassElementKeywords */: @@ -137345,7 +138281,7 @@ var ts; case 7 /* KeywordCompletionFilters.TypeKeywords */: return ts.isTypeKeyword(kind); case 8 /* KeywordCompletionFilters.TypeKeyword */: - return kind === 152 /* SyntaxKind.TypeKeyword */; + return kind === 154 /* SyntaxKind.TypeKeyword */; default: return ts.Debug.assertNever(keywordFilter); } @@ -137354,59 +138290,61 @@ var ts; function isTypeScriptOnlyKeyword(kind) { switch (kind) { case 126 /* SyntaxKind.AbstractKeyword */: - case 130 /* SyntaxKind.AnyKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 92 /* SyntaxKind.EnumKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: case 117 /* SyntaxKind.ImplementsKeyword */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 139 /* SyntaxKind.IsKeyword */: - case 140 /* SyntaxKind.KeyOfKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 140 /* SyntaxKind.IsKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: return true; default: return false; } } function isInterfaceOrTypeLiteralCompletionKeyword(kind) { - return kind === 145 /* SyntaxKind.ReadonlyKeyword */; + return kind === 146 /* SyntaxKind.ReadonlyKeyword */; } function isClassMemberCompletionKeyword(kind) { switch (kind) { case 126 /* SyntaxKind.AbstractKeyword */: - case 134 /* SyntaxKind.ConstructorKeyword */: - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: return true; default: return ts.isClassMemberModifier(kind); } } function isFunctionLikeBodyKeyword(kind) { - return kind === 131 /* SyntaxKind.AsyncKeyword */ - || kind === 132 /* SyntaxKind.AwaitKeyword */ - || kind === 127 /* SyntaxKind.AsKeyword */ - || kind === 152 /* SyntaxKind.TypeKeyword */ + return kind === 132 /* SyntaxKind.AsyncKeyword */ + || kind === 133 /* SyntaxKind.AwaitKeyword */ + || kind === 128 /* SyntaxKind.AsKeyword */ + || kind === 150 /* SyntaxKind.SatisfiesKeyword */ + || kind === 154 /* SyntaxKind.TypeKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind); } function keywordForNode(node) { @@ -137431,7 +138369,7 @@ var ts; && contextToken === parent.moduleSpecifier && tokenLine === currentLine) { entries.push({ - name: ts.tokenToString(129 /* SyntaxKind.AssertKeyword */), + name: ts.tokenToString(130 /* SyntaxKind.AssertKeyword */), kind: "keyword" /* ScriptElementKind.keyword */, kindModifiers: "" /* ScriptElementKindModifier.none */, sortText: Completions.SortText.GlobalsOrKeywords, @@ -137497,7 +138435,7 @@ var ts; function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location, position) { // class c { method() { } | method2() { } } switch (location.kind) { - case 348 /* SyntaxKind.SyntaxList */: + case 351 /* SyntaxKind.SyntaxList */: return ts.tryCast(location.parent, ts.isObjectTypeDeclaration); case 1 /* SyntaxKind.EndOfFileToken */: var cls = ts.tryCast(ts.lastOrUndefined(ts.cast(location.parent, ts.isSourceFile).statements), ts.isObjectTypeDeclaration); @@ -137523,7 +138461,7 @@ var ts; if (!contextToken) return undefined; // class C { blah; constructor/**/ } and so on - if (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ + if (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ // class C { blah \n constructor/**/ } || (ts.isIdentifier(contextToken) && ts.isPropertyDeclaration(contextToken.parent) && ts.isClassLike(location))) { return ts.findAncestor(contextToken, ts.isClassLike); @@ -137566,7 +138504,7 @@ var ts; case 26 /* SyntaxKind.SemicolonToken */: case 27 /* SyntaxKind.CommaToken */: case 79 /* SyntaxKind.Identifier */: - if (parent.kind === 166 /* SyntaxKind.PropertySignature */ && ts.isTypeLiteralNode(parent.parent)) { + if (parent.kind === 168 /* SyntaxKind.PropertySignature */ && ts.isTypeLiteralNode(parent.parent)) { return parent.parent; } break; @@ -137583,11 +138521,11 @@ var ts; if (!t) return undefined; switch (node.kind) { - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return checker.getTypeOfPropertyOfContextualType(t, node.symbol.escapedName); - case 188 /* SyntaxKind.IntersectionType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 187 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 189 /* SyntaxKind.UnionType */: return t; } } @@ -137615,7 +138553,7 @@ var ts; ? !!ts.tryGetImportFromModuleSpecifier(contextToken) : contextToken.kind === 43 /* SyntaxKind.SlashToken */ && ts.isJsxClosingElement(contextToken.parent)); case " ": - return !!contextToken && ts.isImportKeyword(contextToken) && contextToken.parent.kind === 305 /* SyntaxKind.SourceFile */; + return !!contextToken && ts.isImportKeyword(contextToken) && contextToken.parent.kind === 308 /* SyntaxKind.SourceFile */; default: return ts.Debug.assertNever(triggerCharacter); } @@ -137662,21 +138600,22 @@ var ts; return undefined; } function getImportStatementCompletionInfo(contextToken) { + var _a, _b, _c; var keywordCompletion; var isKeywordOnlyCompletion = false; var candidate = getCandidate(); return { isKeywordOnlyCompletion: isKeywordOnlyCompletion, keywordCompletion: keywordCompletion, - isNewIdentifierLocation: !!(candidate || keywordCompletion === 152 /* SyntaxKind.TypeKeyword */), - replacementNode: candidate && ts.rangeIsOnSingleLine(candidate, candidate.getSourceFile()) - ? candidate - : undefined + isNewIdentifierLocation: !!(candidate || keywordCompletion === 154 /* SyntaxKind.TypeKeyword */), + isTopLevelTypeOnly: !!((_b = (_a = ts.tryCast(candidate, ts.isImportDeclaration)) === null || _a === void 0 ? void 0 : _a.importClause) === null || _b === void 0 ? void 0 : _b.isTypeOnly) || !!((_c = ts.tryCast(candidate, ts.isImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.isTypeOnly), + couldBeTypeOnlyImportSpecifier: !!candidate && couldBeTypeOnlyImportSpecifier(candidate, contextToken), + replacementSpan: getSingleLineReplacementSpanForImportCompletionNode(candidate), }; function getCandidate() { var parent = contextToken.parent; if (ts.isImportEqualsDeclaration(parent)) { - keywordCompletion = contextToken.kind === 152 /* SyntaxKind.TypeKeyword */ ? undefined : 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = contextToken.kind === 154 /* SyntaxKind.TypeKeyword */ ? undefined : 154 /* SyntaxKind.TypeKeyword */; return isModuleSpecifierMissingOrEmpty(parent.moduleReference) ? parent : undefined; } if (couldBeTypeOnlyImportSpecifier(parent, contextToken) && canCompleteFromNamedBindings(parent.parent)) { @@ -137686,13 +138625,13 @@ var ts; if (!parent.parent.isTypeOnly && (contextToken.kind === 18 /* SyntaxKind.OpenBraceToken */ || contextToken.kind === 100 /* SyntaxKind.ImportKeyword */ || contextToken.kind === 27 /* SyntaxKind.CommaToken */)) { - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; } if (canCompleteFromNamedBindings(parent)) { // At `import { ... } |` or `import * as Foo |`, the only possible completion is `from` if (contextToken.kind === 19 /* SyntaxKind.CloseBraceToken */ || contextToken.kind === 79 /* SyntaxKind.Identifier */) { isKeywordOnlyCompletion = true; - keywordCompletion = 156 /* SyntaxKind.FromKeyword */; + keywordCompletion = 158 /* SyntaxKind.FromKeyword */; } else { return parent.parent.parent; @@ -137702,25 +138641,82 @@ var ts; } if (ts.isImportKeyword(contextToken) && ts.isSourceFile(parent)) { // A lone import keyword with nothing following it does not parse as a statement at all - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; return contextToken; } if (ts.isImportKeyword(contextToken) && ts.isImportDeclaration(parent)) { // `import s| from` - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; return isModuleSpecifierMissingOrEmpty(parent.moduleSpecifier) ? parent : undefined; } return undefined; } } + function getSingleLineReplacementSpanForImportCompletionNode(node) { + var _a, _b, _c; + if (!node) + return undefined; + var top = (_a = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration))) !== null && _a !== void 0 ? _a : node; + var sourceFile = top.getSourceFile(); + if (ts.rangeIsOnSingleLine(top, sourceFile)) { + return ts.createTextSpanFromNode(top, sourceFile); + } + // ImportKeyword was necessarily on one line; ImportSpecifier was necessarily parented in an ImportDeclaration + ts.Debug.assert(top.kind !== 100 /* SyntaxKind.ImportKeyword */ && top.kind !== 273 /* SyntaxKind.ImportSpecifier */); + // Guess which point in the import might actually be a later statement parsed as part of the import + // during parser recovery - either in the middle of named imports, or the module specifier. + var potentialSplitPoint = top.kind === 269 /* SyntaxKind.ImportDeclaration */ + ? (_c = getPotentiallyInvalidImportSpecifier((_b = top.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings)) !== null && _c !== void 0 ? _c : top.moduleSpecifier + : top.moduleReference; + var withoutModuleSpecifier = { + pos: top.getFirstToken().getStart(), + end: potentialSplitPoint.pos, + }; + // The module specifier/reference was previously found to be missing, empty, or + // not a string literal - in this last case, it's likely that statement on a following + // line was parsed as the module specifier of a partially-typed import, e.g. + // import Foo| + // interface Blah {} + // This appears to be a multiline-import, and editors can't replace multiple lines. + // But if everything but the "module specifier" is on one line, by this point we can + // assume that the "module specifier" is actually just another statement, and return + // the single-line range of the import excluding that probable statement. + if (ts.rangeIsOnSingleLine(withoutModuleSpecifier, sourceFile)) { + return ts.createTextSpanFromRange(withoutModuleSpecifier); + } + } + // Tries to identify the first named import that is not really a named import, but rather + // just parser recovery for a situation like: + // import { Foo| + // interface Bar {} + // in which `Foo`, `interface`, and `Bar` are all parsed as import specifiers. The caller + // will also check if this token is on a separate line from the rest of the import. + function getPotentiallyInvalidImportSpecifier(namedBindings) { + var _a; + return ts.find((_a = ts.tryCast(namedBindings, ts.isNamedImports)) === null || _a === void 0 ? void 0 : _a.elements, function (e) { + var _a; + return !e.propertyName && + ts.isStringANonContextualKeyword(e.name.text) && + ((_a = ts.findPrecedingToken(e.name.pos, namedBindings.getSourceFile(), namedBindings)) === null || _a === void 0 ? void 0 : _a.kind) !== 27 /* SyntaxKind.CommaToken */; + }); + } function couldBeTypeOnlyImportSpecifier(importSpecifier, contextToken) { return ts.isImportSpecifier(importSpecifier) && (importSpecifier.isTypeOnly || contextToken === importSpecifier.name && ts.isTypeKeywordTokenOrIdentifier(contextToken)); } function canCompleteFromNamedBindings(namedBindings) { - return isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) - && (ts.isNamespaceImport(namedBindings) || namedBindings.elements.length < 2) - && !namedBindings.parent.name; + if (!isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) || namedBindings.parent.name) { + return false; + } + if (ts.isNamedImports(namedBindings)) { + // We can only complete on named imports if there are no other named imports already, + // but parser recovery sometimes puts later statements in the named imports list, so + // we try to only consider the probably-valid ones. + var invalidNamedImport = getPotentiallyInvalidImportSpecifier(namedBindings); + var validImports = invalidNamedImport ? namedBindings.elements.indexOf(invalidNamedImport) : namedBindings.elements.length; + return validImports < 2; + } + return true; } function isModuleSpecifierMissingOrEmpty(specifier) { var _a; @@ -137739,7 +138735,6 @@ var ts; function isArrowFunctionBody(node) { return node.parent && ts.isArrowFunction(node.parent) && node.parent.body === node; } - ; /** True if symbol is a type or a module containing at least one type. */ function symbolCanBeReferencedAtTypeLocation(symbol, checker, seenModules) { if (seenModules === void 0) { seenModules = new ts.Map(); } @@ -137888,14 +138883,14 @@ var ts; case 115 /* SyntaxKind.WhileKeyword */: case 90 /* SyntaxKind.DoKeyword */: return useParent(node.parent, function (n) { return ts.isIterationStatement(n, /*lookInLabeledStatements*/ true); }, getLoopBreakContinueOccurrences); - case 134 /* SyntaxKind.ConstructorKeyword */: - return getFromAllDeclarations(ts.isConstructorDeclaration, [134 /* SyntaxKind.ConstructorKeyword */]); - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - return getFromAllDeclarations(ts.isAccessor, [136 /* SyntaxKind.GetKeyword */, 149 /* SyntaxKind.SetKeyword */]); - case 132 /* SyntaxKind.AwaitKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: + return getFromAllDeclarations(ts.isConstructorDeclaration, [135 /* SyntaxKind.ConstructorKeyword */]); + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + return getFromAllDeclarations(ts.isAccessor, [137 /* SyntaxKind.GetKeyword */, 151 /* SyntaxKind.SetKeyword */]); + case 133 /* SyntaxKind.AwaitKeyword */: return useParent(node.parent, ts.isAwaitExpression, getAsyncAndAwaitOccurrences); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: return highlightSpans(getAsyncAndAwaitOccurrences(node)); case 125 /* SyntaxKind.YieldKeyword */: return highlightSpans(getYieldOccurrences(node)); @@ -137942,7 +138937,7 @@ var ts; var child = throwStatement; while (child.parent) { var parent = child.parent; - if (ts.isFunctionBlock(parent) || parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (ts.isFunctionBlock(parent) || parent.kind === 308 /* SyntaxKind.SourceFile */) { return parent; } // A throw-statement is only owned by a try-statement if the try-statement has @@ -137974,16 +138969,16 @@ var ts; function getBreakOrContinueOwner(statement) { return ts.findAncestor(statement, function (node) { switch (node.kind) { - case 249 /* SyntaxKind.SwitchStatement */: - if (statement.kind === 245 /* SyntaxKind.ContinueStatement */) { + case 252 /* SyntaxKind.SwitchStatement */: + if (statement.kind === 248 /* SyntaxKind.ContinueStatement */) { return false; } // falls through - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: return !statement.label || isLabeledBy(node, statement.label.escapedText); default: // Don't cross function boundaries. @@ -137999,26 +138994,26 @@ var ts; // Types of node whose children might have modifiers. var container = declaration.parent; switch (container.kind) { - case 262 /* SyntaxKind.ModuleBlock */: - case 305 /* SyntaxKind.SourceFile */: - case 235 /* SyntaxKind.Block */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 265 /* SyntaxKind.ModuleBlock */: + case 308 /* SyntaxKind.SourceFile */: + case 238 /* SyntaxKind.Block */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // Container is either a class declaration or the declaration is a classDeclaration - if (modifierFlag & 128 /* ModifierFlags.Abstract */ && ts.isClassDeclaration(declaration)) { + if (modifierFlag & 256 /* ModifierFlags.Abstract */ && ts.isClassDeclaration(declaration)) { return __spreadArray(__spreadArray([], declaration.members, true), [declaration], false); } else { return container.statements; } - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return __spreadArray(__spreadArray([], container.parameters, true), (ts.isClassLike(container.parent) ? container.parent.members : []), true); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: var nodes = container.members; // If we're an accessibility modifier, we're in an instance member and should search // the constructor's parameter list for instance members as well. @@ -138028,12 +139023,12 @@ var ts; return __spreadArray(__spreadArray([], nodes, true), constructor.parameters, true); } } - else if (modifierFlag & 128 /* ModifierFlags.Abstract */) { + else if (modifierFlag & 256 /* ModifierFlags.Abstract */) { return __spreadArray(__spreadArray([], nodes, true), [container], false); } return nodes; // Syntactically invalid positions that the parser might produce anyway - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return undefined; default: ts.Debug.assertNever(container, "Invalid container kind."); @@ -138054,7 +139049,7 @@ var ts; var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 97 /* SyntaxKind.ForKeyword */, 115 /* SyntaxKind.WhileKeyword */, 90 /* SyntaxKind.DoKeyword */)) { // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 240 /* SyntaxKind.DoStatement */) { + if (loopNode.kind === 243 /* SyntaxKind.DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 115 /* SyntaxKind.WhileKeyword */)) { @@ -138074,13 +139069,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -138153,13 +139148,13 @@ var ts; var keywords = []; if (func.modifiers) { func.modifiers.forEach(function (modifier) { - pushKeywordIf(keywords, modifier, 131 /* SyntaxKind.AsyncKeyword */); + pushKeywordIf(keywords, modifier, 132 /* SyntaxKind.AsyncKeyword */); }); } ts.forEachChild(func, function (child) { traverseWithoutCrossingFunction(child, function (node) { if (ts.isAwaitExpression(node)) { - pushKeywordIf(keywords, node.getFirstToken(), 132 /* SyntaxKind.AwaitKeyword */); + pushKeywordIf(keywords, node.getFirstToken(), 133 /* SyntaxKind.AwaitKeyword */); } }); }); @@ -138543,14 +139538,14 @@ var ts; if (cancellationToken) cancellationToken.throwIfCancellationRequested(); switch (direct.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(direct)) { handleImportCall(direct); break; } if (!isAvailableThroughGlobal) { var parent = direct.parent; - if (exportKind === 2 /* ExportKind.ExportEquals */ && parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (exportKind === 2 /* ExportKind.ExportEquals */ && parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { var name = parent.name; if (name.kind === 79 /* SyntaxKind.Identifier */) { directImports.push(name); @@ -138561,25 +139556,25 @@ var ts; break; case 79 /* SyntaxKind.Identifier */: // for 'const x = require("y"); break; // TODO: GH#23879 - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: handleNamespaceImport(direct, direct.name, ts.hasSyntacticModifier(direct, 1 /* ModifierFlags.Export */), /*alreadyAddedDirect*/ false); break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: directImports.push(direct); var namedBindings = direct.importClause && direct.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings && namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { handleNamespaceImport(direct, namedBindings.name, /*isReExport*/ false, /*alreadyAddedDirect*/ true); } else if (!isAvailableThroughGlobal && ts.isDefaultImport(direct)) { addIndirectUser(getSourceFileLikeForImportDeclaration(direct)); // Add a check for indirect uses to handle synthetic default imports } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (!direct.exportClause) { // This is `export * from "foo"`, so imports of this module may import the export too. handleDirectImports(getContainingModuleSymbol(direct, checker)); } - else if (direct.exportClause.kind === 274 /* SyntaxKind.NamespaceExport */) { + else if (direct.exportClause.kind === 277 /* SyntaxKind.NamespaceExport */) { // `export * as foo from "foo"` add to indirect uses addIndirectUser(getSourceFileLikeForImportDeclaration(direct), /** addTransitiveDependencies */ true); } @@ -138588,7 +139583,7 @@ var ts; directImports.push(direct); } break; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: // Only check for typeof import('xyz') if (direct.isTypeOf && !direct.qualifier && isExported(direct)) { addIndirectUser(direct.getSourceFile(), /** addTransitiveDependencies */ true); @@ -138621,7 +139616,7 @@ var ts; } else if (!isAvailableThroughGlobal) { var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration); - ts.Debug.assert(sourceFileLike.kind === 305 /* SyntaxKind.SourceFile */ || sourceFileLike.kind === 261 /* SyntaxKind.ModuleDeclaration */); + ts.Debug.assert(sourceFileLike.kind === 308 /* SyntaxKind.SourceFile */ || sourceFileLike.kind === 264 /* SyntaxKind.ModuleDeclaration */); if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) { addIndirectUser(sourceFileLike, /** addTransitiveDependencies */ true); } @@ -138677,7 +139672,7 @@ var ts; } return { importSearches: importSearches, singleReferences: singleReferences }; function handleImport(decl) { - if (decl.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (decl.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { if (isExternalModuleImportEquals(decl)) { handleNamespaceImportLike(decl.name); } @@ -138687,7 +139682,7 @@ var ts; handleNamespaceImportLike(decl); return; } - if (decl.kind === 200 /* SyntaxKind.ImportType */) { + if (decl.kind === 202 /* SyntaxKind.ImportType */) { if (decl.qualifier) { var firstIdentifier = ts.getFirstIdentifier(decl.qualifier); if (firstIdentifier.escapedText === ts.symbolName(exportSymbol)) { @@ -138703,7 +139698,7 @@ var ts; if (decl.moduleSpecifier.kind !== 10 /* SyntaxKind.StringLiteral */) { return; } - if (decl.kind === 272 /* SyntaxKind.ExportDeclaration */) { + if (decl.kind === 275 /* SyntaxKind.ExportDeclaration */) { if (decl.exportClause && ts.isNamedExports(decl.exportClause)) { searchForNamedImport(decl.exportClause); } @@ -138712,10 +139707,10 @@ var ts; var _a = decl.importClause || { name: undefined, namedBindings: undefined }, name = _a.name, namedBindings = _a.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: handleNamespaceImportLike(namedBindings.name); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: // 'default' might be accessed as a named import `{ default as foo }`. if (exportKind === 0 /* ExportKind.Named */ || exportKind === 1 /* ExportKind.Default */) { searchForNamedImport(namedBindings); @@ -138765,7 +139760,7 @@ var ts; } } else { - var localSymbol = element.kind === 275 /* SyntaxKind.ExportSpecifier */ && element.propertyName + var localSymbol = element.kind === 278 /* SyntaxKind.ExportSpecifier */ && element.propertyName ? checker.getExportSpecifierLocalTargetSymbol(element) // For re-exporting under a different name, we want to get the re-exported symbol. : checker.getSymbolAtLocation(name); addSearch(name, localSymbol); @@ -138794,7 +139789,7 @@ var ts; for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { var referencingFile = sourceFiles_1[_i]; var searchSourceFile = searchModuleSymbol.valueDeclaration; - if ((searchSourceFile === null || searchSourceFile === void 0 ? void 0 : searchSourceFile.kind) === 305 /* SyntaxKind.SourceFile */) { + if ((searchSourceFile === null || searchSourceFile === void 0 ? void 0 : searchSourceFile.kind) === 308 /* SyntaxKind.SourceFile */) { for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) { var ref = _b[_a]; if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) { @@ -138842,7 +139837,7 @@ var ts; } /** Iterates over all statements at the top level or in module declarations. Returns the first truthy result. */ function forEachPossibleImportOrExportStatement(sourceFileLike, action) { - return ts.forEach(sourceFileLike.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { + return ts.forEach(sourceFileLike.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { return action(statement) || (isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action)); }); } @@ -138857,15 +139852,15 @@ var ts; else { forEachPossibleImportOrExportStatement(sourceFile, function (statement) { switch (statement.kind) { - case 272 /* SyntaxKind.ExportDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: { + case 275 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: { var decl = statement; if (decl.moduleSpecifier && ts.isStringLiteral(decl.moduleSpecifier)) { action(decl, decl.moduleSpecifier); } break; } - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { var decl = statement; if (isExternalModuleImportEquals(decl)) { action(decl, decl.moduleReference.expression); @@ -138890,7 +139885,7 @@ var ts; var parent = node.parent; var grandparent = parent.parent; if (symbol.exportSymbol) { - if (parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { // When accessing an export of a JS module, there's no alias. The symbol will still be flagged as an export even though we're at the use. // So check that we are at the declaration. return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d === parent; })) && ts.isBinaryExpression(grandparent) @@ -138974,6 +139969,8 @@ var ts; // Similarly, skip past the symbol for 'export =' if (importedSymbol.escapedName === "export=") { importedSymbol = getExportEqualsLocalSymbol(importedSymbol, checker); + if (importedSymbol === undefined) + return undefined; } // If the import has a different name than the export, do not continue searching. // If `importedName` is undefined, do continue searching as the export is anonymous. @@ -138989,25 +139986,25 @@ var ts; } // Not meant for use with export specifiers or export assignment. function getExportKindForDeclaration(node) { - return ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) ? 1 /* ExportKind.Default */ : 0 /* ExportKind.Named */; + return ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) ? 1 /* ExportKind.Default */ : 0 /* ExportKind.Named */; } } FindAllReferences.getImportOrExportSymbol = getImportOrExportSymbol; function getExportEqualsLocalSymbol(importedSymbol, checker) { if (importedSymbol.flags & 2097152 /* SymbolFlags.Alias */) { - return ts.Debug.checkDefined(checker.getImmediateAliasedSymbol(importedSymbol)); + return checker.getImmediateAliasedSymbol(importedSymbol); } var decl = ts.Debug.checkDefined(importedSymbol.valueDeclaration); if (ts.isExportAssignment(decl)) { // `export = class {}` - return ts.Debug.checkDefined(decl.expression.symbol); + return decl.expression.symbol; } else if (ts.isBinaryExpression(decl)) { // `module.exports = class {}` - return ts.Debug.checkDefined(decl.right.symbol); + return decl.right.symbol; } else if (ts.isSourceFile(decl)) { // json module - return ts.Debug.checkDefined(decl.symbol); + return decl.symbol; } - return ts.Debug.fail(); + return undefined; } // If a reference is a class expression, the exported node would be its parent. // If a reference is a variable declaration, the exported node would be the variable statement. @@ -139024,16 +140021,16 @@ var ts; function isNodeImport(node) { var parent = node.parent; switch (parent.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return parent.name === node && isExternalModuleImportEquals(parent); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: // For a rename import `{ foo as bar }`, don't search for the imported symbol. Just find local uses of `bar`. return !parent.propertyName; - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: ts.Debug.assert(parent.name === node); return true; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(parent.parent.parent); default: return false; @@ -139074,21 +140071,21 @@ var ts; return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol); } function getSourceFileLikeForImportDeclaration(node) { - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { return node.getSourceFile(); } var parent = node.parent; - if (parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */) { return parent; } - ts.Debug.assert(parent.kind === 262 /* SyntaxKind.ModuleBlock */); + ts.Debug.assert(parent.kind === 265 /* SyntaxKind.ModuleBlock */); return ts.cast(parent.parent, isAmbientModuleDeclaration); } function isAmbientModuleDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && node.name.kind === 10 /* SyntaxKind.StringLiteral */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && node.name.kind === 10 /* SyntaxKind.StringLiteral */; } function isExternalModuleImportEquals(eq) { - return eq.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* SyntaxKind.StringLiteral */; + return eq.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* SyntaxKind.StringLiteral */; } })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); @@ -139182,7 +140179,7 @@ var ts; ((ts.isImportOrExportSpecifier(node.parent) || ts.isBindingElement(node.parent)) && node.parent.propertyName === node) || // Is default export - (node.kind === 88 /* SyntaxKind.DefaultKeyword */ && ts.hasSyntacticModifier(node.parent, 513 /* ModifierFlags.ExportDefault */))) { + (node.kind === 88 /* SyntaxKind.DefaultKeyword */ && ts.hasSyntacticModifier(node.parent, 1025 /* ModifierFlags.ExportDefault */))) { return getContextNode(node.parent); } return undefined; @@ -139191,7 +140188,7 @@ var ts; if (!node) return undefined; switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return !ts.isVariableDeclarationList(node.parent) || node.parent.declarations.length !== 1 ? node : ts.isVariableStatement(node.parent.parent) ? @@ -139199,28 +140196,28 @@ var ts; ts.isForInOrOfStatement(node.parent.parent) ? getContextNode(node.parent.parent) : node.parent; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getContextNode(node.parent.parent); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent; - case 275 /* SyntaxKind.ExportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent; - case 267 /* SyntaxKind.ImportClause */: - case 274 /* SyntaxKind.NamespaceExport */: + case 270 /* SyntaxKind.ImportClause */: + case 277 /* SyntaxKind.NamespaceExport */: return node.parent; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return ts.isExpressionStatement(node.parent) ? node.parent : node; - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return { start: node.initializer, end: node.expression }; - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent) ? getContextNode(ts.findAncestor(node.parent, function (node) { return ts.isBinaryExpression(node) || ts.isForInOrOfStatement(node); @@ -139281,15 +140278,15 @@ var ts; return node.kind === 88 /* SyntaxKind.DefaultKeyword */ || !!ts.getDeclarationFromName(node) || ts.isLiteralComputedPropertyDeclarationName(node) - || (node.kind === 134 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent)); + || (node.kind === 135 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent)); } function getImplementationsAtPosition(program, cancellationToken, sourceFiles, sourceFile, position) { var node = ts.getTouchingPropertyName(sourceFile, position); var referenceEntries; var entries = getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position); - if (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || node.parent.kind === 203 /* SyntaxKind.BindingElement */ - || node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ + if (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || node.parent.kind === 205 /* SyntaxKind.BindingElement */ + || node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ || node.kind === 106 /* SyntaxKind.SuperKeyword */) { referenceEntries = entries && __spreadArray([], entries, true); } @@ -139313,13 +140310,13 @@ var ts; } FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition; function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return undefined; } var checker = program.getTypeChecker(); // If invoked directly on a shorthand property assignment, then return // the declaration of the symbol being assigned (not the symbol being assigned to). - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var result_2 = []; Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_2.push(nodeEntry(node)); }); return result_2; @@ -139495,13 +140492,13 @@ var ts; if (symbol) { return getDefinitionKindAndDisplayParts(symbol, checker, node); } - else if (node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + else if (node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return { kind: "interface" /* ScriptElementKind.interfaceElement */, displayParts: [ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */), ts.textPart("object literal"), ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)] }; } - else if (node.kind === 226 /* SyntaxKind.ClassExpression */) { + else if (node.kind === 228 /* SyntaxKind.ClassExpression */) { return { kind: "local class" /* ScriptElementKind.localClassElement */, displayParts: [ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */), ts.textPart("anonymous local class"), ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)] @@ -139555,7 +140552,7 @@ var ts; var source = ts.getDeclarationFromName(node) || (node.kind === 88 /* SyntaxKind.DefaultKeyword */ ? node.parent : ts.isLiteralComputedPropertyDeclarationName(node) ? node.parent.parent - : node.kind === 134 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent) ? node.parent.parent + : node.kind === 135 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent) ? node.parent.parent : undefined); var commonjsSource = source && ts.isBinaryExpression(source) ? source.left : undefined; return !!(source && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d === source || d === commonjsSource; }))); @@ -139570,47 +140567,47 @@ var ts; if (!!(decl.flags & 16777216 /* NodeFlags.Ambient */)) return true; switch (decl.kind) { - case 221 /* SyntaxKind.BinaryExpression */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: case 88 /* SyntaxKind.DefaultKeyword */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: // default import - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 285 /* SyntaxKind.JsxAttribute */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 274 /* SyntaxKind.NamespaceExport */: - case 164 /* SyntaxKind.Parameter */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 163 /* SyntaxKind.TypeParameter */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: // default import + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 288 /* SyntaxKind.JsxAttribute */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 277 /* SyntaxKind.NamespaceExport */: + case 166 /* SyntaxKind.Parameter */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: return true; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // In `({ x: y } = 0);`, `x` is not a write access. (Won't call this function for `y`.) return !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(decl.parent); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return !!decl.body; - case 254 /* SyntaxKind.VariableDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return !!decl.initializer || ts.isCatchClause(decl.parent); - case 168 /* SyntaxKind.MethodSignature */: - case 166 /* SyntaxKind.PropertySignature */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: + case 170 /* SyntaxKind.MethodSignature */: + case 168 /* SyntaxKind.PropertySignature */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return false; default: return ts.Debug.failBadSyntaxKind(decl); @@ -139836,10 +140833,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; switch (decl.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // Don't include the source file itself. (This may not be ideal behavior, but awkward to include an entire file as a reference.) break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (sourceFilesSet.has(decl.getSourceFile().fileName)) { references.push(nodeEntry(decl.name)); } @@ -139868,9 +140865,9 @@ var ts; } /** As in a `readonly prop: any` or `constructor(readonly prop: any)`, not a `readonly any[]`. */ function isReadonlyTypeOperator(node) { - return node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ + return node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(node.parent) - && node.parent.operator === 145 /* SyntaxKind.ReadonlyKeyword */; + && node.parent.operator === 146 /* SyntaxKind.ReadonlyKeyword */; } /** getReferencedSymbols for special node kinds. */ function getReferencedSymbolsSpecial(node, sourceFiles, cancellationToken) { @@ -139881,12 +140878,12 @@ var ts; } // A modifier readonly (like on a property declaration) is not special; // a readonly type keyword (like `readonly string[]`) is. - if (node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ && !isReadonlyTypeOperator(node)) { + if (node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && !isReadonlyTypeOperator(node)) { return undefined; } // Likewise, when we *are* looking for a special keyword, make sure we // *don’t* include readonly member modifiers. - return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken, node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ ? isReadonlyTypeOperator : undefined); + return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken, node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ ? isReadonlyTypeOperator : undefined); } if (ts.isImportMeta(node.parent) && node.parent.name === node) { return getAllReferencesForImportMeta(sourceFiles, cancellationToken); @@ -139953,8 +140950,8 @@ var ts; } function getSpecialSearchKind(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 134 /* SyntaxKind.ConstructorKeyword */: + case 173 /* SyntaxKind.Constructor */: + case 135 /* SyntaxKind.ConstructorKeyword */: return 1 /* SpecialSearchKind.Constructor */; case 79 /* SyntaxKind.Identifier */: if (ts.isClassLike(node.parent)) { @@ -140202,7 +141199,7 @@ var ts; // If this is the symbol of a named function expression or named class expression, // then named references are limited to its own scope. var declarations = symbol.declarations, flags = symbol.flags, parent = symbol.parent, valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 213 /* SyntaxKind.FunctionExpression */ || valueDeclaration.kind === 226 /* SyntaxKind.ClassExpression */)) { + if (valueDeclaration && (valueDeclaration.kind === 215 /* SyntaxKind.FunctionExpression */ || valueDeclaration.kind === 228 /* SyntaxKind.ClassExpression */)) { return valueDeclaration; } if (!declarations) { @@ -140212,7 +141209,7 @@ var ts; if (flags & (4 /* SymbolFlags.Property */ | 8192 /* SymbolFlags.Method */)) { var privateDeclaration = ts.find(declarations, function (d) { return ts.hasEffectiveModifier(d, 8 /* ModifierFlags.Private */) || ts.isPrivateIdentifierClassElementDeclaration(d); }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 257 /* SyntaxKind.ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 260 /* SyntaxKind.ClassDeclaration */); } // Else this is a public property and could be accessed from anywhere. return undefined; @@ -140241,7 +141238,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (!container || container.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { + if (!container || container.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { // This is a global variable and not an external module, any declaration defined // within this scope is visible outside the file return undefined; @@ -140499,7 +141496,7 @@ var ts; } // Use the parent symbol if the location is commonjs require syntax on javascript files only. if (ts.isInJSFile(referenceLocation) - && referenceLocation.parent.kind === 203 /* SyntaxKind.BindingElement */ + && referenceLocation.parent.kind === 205 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(referenceLocation.parent.parent.parent)) { referenceSymbol = referenceLocation.parent.symbol; // The parent will not have a symbol if it's an ObjectBindingPattern (when destructuring is used). In @@ -140606,7 +141603,7 @@ var ts; } } function addReference(referenceLocation, relatedSymbol, state) { - var _a = "kind" in relatedSymbol ? relatedSymbol : { kind: undefined, symbol: relatedSymbol }, kind = _a.kind, symbol = _a.symbol; // eslint-disable-line no-in-operator + var _a = "kind" in relatedSymbol ? relatedSymbol : { kind: undefined, symbol: relatedSymbol }, kind = _a.kind, symbol = _a.symbol; // eslint-disable-line local/no-in-operator // if rename symbol from default export anonymous function, for example `export default function() {}`, we do not need to add reference if (state.options.use === 2 /* FindReferencesUse.Rename */ && referenceLocation.kind === 88 /* SyntaxKind.DefaultKeyword */) { return; @@ -140672,15 +141669,15 @@ var ts; if (constructorSymbol && constructorSymbol.declarations) { for (var _i = 0, _a = constructorSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - var ctrKeyword = ts.findChildOfKind(decl, 134 /* SyntaxKind.ConstructorKeyword */, sourceFile); - ts.Debug.assert(decl.kind === 171 /* SyntaxKind.Constructor */ && !!ctrKeyword); + var ctrKeyword = ts.findChildOfKind(decl, 135 /* SyntaxKind.ConstructorKeyword */, sourceFile); + ts.Debug.assert(decl.kind === 173 /* SyntaxKind.Constructor */ && !!ctrKeyword); addNode(ctrKeyword); } } if (classSymbol.exports) { classSymbol.exports.forEach(function (member) { var decl = member.valueDeclaration; - if (decl && decl.kind === 169 /* SyntaxKind.MethodDeclaration */) { + if (decl && decl.kind === 171 /* SyntaxKind.MethodDeclaration */) { var body = decl.body; if (body) { forEachDescendantOfKind(body, 108 /* SyntaxKind.ThisKeyword */, function (thisKeyword) { @@ -140704,7 +141701,7 @@ var ts; } for (var _i = 0, _a = constructor.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - ts.Debug.assert(decl.kind === 171 /* SyntaxKind.Constructor */); + ts.Debug.assert(decl.kind === 173 /* SyntaxKind.Constructor */); var body = decl.body; if (body) { forEachDescendantOfKind(body, 106 /* SyntaxKind.SuperKeyword */, function (node) { @@ -140734,7 +141731,7 @@ var ts; if (refNode.kind !== 79 /* SyntaxKind.Identifier */) { return; } - if (refNode.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (refNode.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { // Go ahead and dereference the shorthand assignment by going to its definition getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference); } @@ -140754,7 +141751,7 @@ var ts; } else if (ts.isFunctionLike(typeHavingNode) && typeHavingNode.body) { var body = typeHavingNode.body; - if (body.kind === 235 /* SyntaxKind.Block */) { + if (body.kind === 238 /* SyntaxKind.Block */) { ts.forEachReturnStatement(body, function (returnStatement) { if (returnStatement.expression) addIfImplementation(returnStatement.expression); @@ -140782,13 +141779,13 @@ var ts; */ function isImplementationExpression(node) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isImplementationExpression(node.expression); - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return true; default: return false; @@ -140841,13 +141838,13 @@ var ts; // Whether 'super' occurs in a static context within a class. var staticFlag = 32 /* ModifierFlags.Static */; switch (searchSpaceNode.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; @@ -140868,43 +141865,43 @@ var ts; return [{ definition: { type: 0 /* DefinitionKind.Symbol */, symbol: searchSpaceNode.symbol }, references: references }]; } function isParameterName(node) { - return node.kind === 79 /* SyntaxKind.Identifier */ && node.parent.kind === 164 /* SyntaxKind.Parameter */ && node.parent.name === node; + return node.kind === 79 /* SyntaxKind.Identifier */ && node.parent.kind === 166 /* SyntaxKind.Parameter */ && node.parent.name === node; } function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles, cancellationToken) { var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); // Whether 'this' occurs in a static context within a class. var staticFlag = 32 /* ModifierFlags.Static */; switch (searchSpaceNode.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode)) { staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning object literals break; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (ts.isExternalModule(searchSpaceNode) || isParameterName(thisOrSuperKeyword)) { return undefined; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: break; // Computed properties in classes are not handled here because references to this are illegal, // so there is no point finding references to them. default: return undefined; } - var references = ts.flatMap(searchSpaceNode.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) { + var references = ts.flatMap(searchSpaceNode.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) { cancellationToken.throwIfCancellationRequested(); return getPossibleSymbolReferenceNodes(sourceFile, "this", ts.isSourceFile(searchSpaceNode) ? sourceFile : searchSpaceNode).filter(function (node) { if (!ts.isThis(node)) { @@ -140912,20 +141909,20 @@ var ts; } var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); switch (searchSpaceNode.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return searchSpaceNode.symbol === container.symbol; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol; - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: // Make sure the container belongs to the same class/object literals // and has the appropriate static modifier from the original container. return container.parent && searchSpaceNode.symbol === container.parent.symbol && ts.isStatic(container) === !!staticFlag; - case 305 /* SyntaxKind.SourceFile */: - return container.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node); + case 308 /* SyntaxKind.SourceFile */: + return container.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node); } }); }).map(function (n) { return nodeEntry(n); }); @@ -141036,7 +142033,7 @@ var ts; ts.Debug.assert(paramProps.length === 2 && !!(paramProps[0].flags & 1 /* SymbolFlags.FunctionScopedVariable */) && !!(paramProps[1].flags & 4 /* SymbolFlags.Property */)); // is [parameter, property] return fromRoot(symbol.flags & 1 /* SymbolFlags.FunctionScopedVariable */ ? paramProps[1] : paramProps[0]); } - var exportSpecifier = ts.getDeclarationOfKind(symbol, 275 /* SyntaxKind.ExportSpecifier */); + var exportSpecifier = ts.getDeclarationOfKind(symbol, 278 /* SyntaxKind.ExportSpecifier */); if (!isForRenamePopulateSearchSymbolSet || exportSpecifier && !exportSpecifier.propertyName) { var localSymbol = exportSpecifier && checker.getExportSpecifierLocalTargetSymbol(exportSpecifier); if (localSymbol) { @@ -141081,7 +142078,7 @@ var ts; }); } function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker) { - var bindingElement = ts.getDeclarationOfKind(symbol, 203 /* SyntaxKind.BindingElement */); + var bindingElement = ts.getDeclarationOfKind(symbol, 205 /* SyntaxKind.BindingElement */); if (bindingElement && ts.isObjectBindingElementWithoutPropertyName(bindingElement)) { return ts.getPropertySymbolFromBindingElement(checker, bindingElement); } @@ -141344,16 +142341,16 @@ var ts; return; } switch (node.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - if (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + if (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return (_a = ts.getAssignedName(node.parent)) === null || _a === void 0 ? void 0 : _a.getText(); } return (_b = ts.getNameOfDeclaration(node.parent)) === null || _b === void 0 ? void 0 : _b.getText(); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.isModuleBlock(node.parent) && ts.isIdentifier(node.parent.parent.name)) { return node.parent.parent.name.getText(); } @@ -141568,61 +142565,65 @@ var ts; } switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // do not descend into nodes that cannot contain callable nodes return; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: recordCallSite(node); return; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: // do not descend into the type side of an assertion collect(node.expression); return; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: // do not descend into the type of a variable or parameter declaration collect(node.name); collect(node.initializer); return; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: // do not descend into the type arguments of a call expression recordCallSite(node); collect(node.expression); ts.forEach(node.arguments, collect); return; - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: // do not descend into the type arguments of a new expression recordCallSite(node); collect(node.expression); ts.forEach(node.arguments, collect); return; - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // do not descend into the type arguments of a tagged template expression recordCallSite(node); collect(node.tag); collect(node.template); return; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: // do not descend into the type arguments of a JsxOpeningLikeElement recordCallSite(node); collect(node.tagName); collect(node.attributes); return; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: recordCallSite(node); collect(node.expression); return; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: recordCallSite(node); ts.forEachChild(node, collect); break; + case 235 /* SyntaxKind.SatisfiesExpression */: + // do not descend into the type side of an assertion + collect(node.expression); + return; } if (ts.isPartOfTypeNode(node)) { // do not descend into types @@ -141677,25 +142678,25 @@ var ts; var callSites = []; var collect = createCallSiteCollector(program, callSites); switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: collectCallSitesOfSourceFile(node, collect); break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: collectCallSitesOfModuleDeclaration(node, collect); break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: collectCallSitesOfFunctionLikeDeclaration(program.getTypeChecker(), node, collect); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: collectCallSitesOfClassLikeDeclaration(node, collect); break; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: collectCallSitesOfClassStaticBlockDeclaration(node, collect); break; default: @@ -141966,7 +142967,7 @@ var ts; } var parent = node.parent; var typeChecker = program.getTypeChecker(); - if (node.kind === 159 /* SyntaxKind.OverrideKeyword */ || (ts.isJSDocOverrideTag(node) && ts.rangeContainsPosition(node.tagName, position))) { + if (node.kind === 161 /* SyntaxKind.OverrideKeyword */ || (ts.isIdentifier(node) && ts.isJSDocOverrideTag(parent) && parent.tagName === node)) { return getDefinitionFromOverriddenMember(typeChecker, node) || ts.emptyArray; } // Labels @@ -142042,7 +143043,7 @@ var ts; // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var shorthandSymbol_1 = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); var definitions = (shorthandSymbol_1 === null || shorthandSymbol_1 === void 0 ? void 0 : shorthandSymbol_1.declarations) ? shorthandSymbol_1.declarations.map(function (decl) { return createDefinitionInfo(decl, typeChecker, shorthandSymbol_1, node, /*unverified*/ false, failedAliasResolution); }) : ts.emptyArray; return ts.concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node) || ts.emptyArray); @@ -142248,7 +143249,7 @@ var ts; if (node.parent === declaration) { return true; } - if (declaration.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (declaration.kind === 271 /* SyntaxKind.NamespaceImport */) { return false; } return true; @@ -142290,7 +143291,7 @@ var ts; function getConstructSignatureDefinition() { // Applicable only if we are in a new expression, or we are on a constructor declaration // and in either case the symbol has a construct signature definition, i.e. class - if (symbol.flags & 32 /* SymbolFlags.Class */ && !(symbol.flags & (16 /* SymbolFlags.Function */ | 3 /* SymbolFlags.Variable */)) && (ts.isNewExpressionTarget(node) || node.kind === 134 /* SyntaxKind.ConstructorKeyword */)) { + if (symbol.flags & 32 /* SymbolFlags.Class */ && !(symbol.flags & (16 /* SymbolFlags.Function */ | 3 /* SymbolFlags.Variable */)) && (ts.isNewExpressionTarget(node) || node.kind === 135 /* SyntaxKind.ConstructorKeyword */)) { var cls = ts.find(filteredDeclarations, ts.isClassLike) || ts.Debug.fail("Expected declaration to have at least one class-like declaration"); return getSignatureDefinition(cls.members, /*selectConstructors*/ true); } @@ -142342,22 +143343,22 @@ var ts; return isDefinitionVisible(checker, declaration.parent); // Handle some exceptions here like arrow function, members of class and object literal expression which are technically not visible but we want the definition to be determined by its parent switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: // Private/protected properties/methods are not visible if (ts.hasEffectiveModifier(declaration, 8 /* ModifierFlags.Private */)) return false; // Public properties/methods are visible if its parents are visible, so: // falls through - case 171 /* SyntaxKind.Constructor */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: return isDefinitionVisible(checker, declaration.parent); default: return false; @@ -142395,9 +143396,9 @@ var ts; } function isConstructorLike(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 173 /* SyntaxKind.Constructor */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return true; default: return false; @@ -142503,17 +143504,17 @@ var ts; ts.forEachUnique(declarations, function (declaration) { for (var _i = 0, _a = getCommentHavingNodes(declaration); _i < _a.length; _i++) { var jsdoc = _a[_i]; - var inheritDoc = ts.isJSDoc(jsdoc) && jsdoc.tags && ts.find(jsdoc.tags, function (t) { return t.kind === 327 /* SyntaxKind.JSDocTag */ && (t.tagName.escapedText === "inheritDoc" || t.tagName.escapedText === "inheritdoc"); }); + var inheritDoc = ts.isJSDoc(jsdoc) && jsdoc.tags && ts.find(jsdoc.tags, function (t) { return t.kind === 330 /* SyntaxKind.JSDocTag */ && (t.tagName.escapedText === "inheritDoc" || t.tagName.escapedText === "inheritdoc"); }); // skip comments containing @typedefs since they're not associated with particular declarations // Exceptions: // - @typedefs are themselves declarations with associated comments // - @param or @return indicate that the author thinks of it as a 'local' @typedef that's part of the function documentation if (jsdoc.comment === undefined && !inheritDoc || ts.isJSDoc(jsdoc) - && declaration.kind !== 345 /* SyntaxKind.JSDocTypedefTag */ && declaration.kind !== 338 /* SyntaxKind.JSDocCallbackTag */ + && declaration.kind !== 348 /* SyntaxKind.JSDocTypedefTag */ && declaration.kind !== 341 /* SyntaxKind.JSDocCallbackTag */ && jsdoc.tags - && jsdoc.tags.some(function (t) { return t.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 338 /* SyntaxKind.JSDocCallbackTag */; }) - && !jsdoc.tags.some(function (t) { return t.kind === 340 /* SyntaxKind.JSDocParameterTag */ || t.kind === 341 /* SyntaxKind.JSDocReturnTag */; })) { + && jsdoc.tags.some(function (t) { return t.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 341 /* SyntaxKind.JSDocCallbackTag */; }) + && !jsdoc.tags.some(function (t) { return t.kind === 343 /* SyntaxKind.JSDocParameterTag */ || t.kind === 344 /* SyntaxKind.JSDocReturnTag */; })) { continue; } var newparts = jsdoc.comment ? getDisplayPartsFromComment(jsdoc.comment, checker) : []; @@ -142533,11 +143534,11 @@ var ts; } function getCommentHavingNodes(declaration) { switch (declaration.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return [declaration]; - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return [declaration, declaration.parent]; default: return ts.getJSDocCommentsAndTags(declaration); @@ -142551,8 +143552,8 @@ var ts; // skip comments containing @typedefs since they're not associated with particular declarations // Exceptions: // - @param or @return indicate that the author thinks of it as a 'local' @typedef that's part of the function documentation - if (tags.some(function (t) { return t.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 338 /* SyntaxKind.JSDocCallbackTag */; }) - && !tags.some(function (t) { return t.kind === 340 /* SyntaxKind.JSDocParameterTag */ || t.kind === 341 /* SyntaxKind.JSDocReturnTag */; })) { + if (tags.some(function (t) { return t.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 341 /* SyntaxKind.JSDocCallbackTag */; }) + && !tags.some(function (t) { return t.kind === 343 /* SyntaxKind.JSDocParameterTag */ || t.kind === 344 /* SyntaxKind.JSDocReturnTag */; })) { return; } for (var _i = 0, tags_1 = tags; _i < tags_1.length; _i++) { @@ -142567,17 +143568,17 @@ var ts; if (typeof comment === "string") { return [ts.textPart(comment)]; } - return ts.flatMap(comment, function (node) { return node.kind === 321 /* SyntaxKind.JSDocText */ ? [ts.textPart(node.text)] : ts.buildLinkParts(node, checker); }); + return ts.flatMap(comment, function (node) { return node.kind === 324 /* SyntaxKind.JSDocText */ ? [ts.textPart(node.text)] : ts.buildLinkParts(node, checker); }); } function getCommentDisplayParts(tag, checker) { var comment = tag.comment, kind = tag.kind; var namePart = getTagNameDisplayPart(kind); switch (kind) { - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return withNode(tag.class); - case 328 /* SyntaxKind.JSDocAugmentsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: return withNode(tag.class); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: var templateTag = tag; var displayParts_3 = []; if (templateTag.constraint) { @@ -142599,13 +143600,13 @@ var ts; displayParts_3.push.apply(displayParts_3, __spreadArray([ts.spacePart()], getDisplayPartsFromComment(comment, checker), true)); } return displayParts_3; - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return withNode(tag.typeExpression); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: - case 346 /* SyntaxKind.JSDocSeeTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: var name = tag.name; return name ? withNode(name) : comment === undefined ? undefined @@ -142632,14 +143633,14 @@ var ts; } function getTagNameDisplayPart(kind) { switch (kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return ts.parameterNamePart; - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return ts.propertyNamePart; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return ts.typeParameterNamePart; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return ts.typeAliasNamePart; default: return ts.textPart; @@ -142810,24 +143811,24 @@ var ts; } function getCommentOwnerInfoWorker(commentOwner, options) { switch (commentOwner.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 168 /* SyntaxKind.MethodSignature */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 170 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: var host = commentOwner; return { commentOwner: commentOwner, parameters: host.parameters, hasReturn: hasReturn(host, options) }; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getCommentOwnerInfoWorker(commentOwner.initializer, options); - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return { commentOwner: commentOwner }; - case 237 /* SyntaxKind.VariableStatement */: { + case 240 /* SyntaxKind.VariableStatement */: { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; var host_1 = varDeclarations.length === 1 && varDeclarations[0].initializer @@ -142837,16 +143838,16 @@ var ts; ? { commentOwner: commentOwner, parameters: host_1.parameters, hasReturn: hasReturn(host_1, options) } : { commentOwner: commentOwner }; } - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return "quit"; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // If in walking up the tree, we hit a a nested namespace declaration, // then we must be somewhere within a dotted namespace name; however we don't // want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'. - return commentOwner.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? undefined : { commentOwner: commentOwner }; - case 238 /* SyntaxKind.ExpressionStatement */: + return commentOwner.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? undefined : { commentOwner: commentOwner }; + case 241 /* SyntaxKind.ExpressionStatement */: return getCommentOwnerInfoWorker(commentOwner.expression, options); - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var be = commentOwner; if (ts.getAssignmentDeclarationKind(be) === 0 /* AssignmentDeclarationKind.None */) { return "quit"; @@ -142855,7 +143856,7 @@ var ts; ? { commentOwner: commentOwner, parameters: be.right.parameters, hasReturn: hasReturn(be.right, options) } : { commentOwner: commentOwner }; } - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: var init = commentOwner.initializer; if (init && (ts.isFunctionExpression(init) || ts.isArrowFunction(init))) { return { commentOwner: commentOwner, parameters: init.parameters, hasReturn: hasReturn(init, options) }; @@ -142868,14 +143869,14 @@ var ts; || ts.isFunctionLikeDeclaration(node) && node.body && ts.isBlock(node.body) && !!ts.forEachReturnStatement(node.body, function (n) { return n; })); } function getRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (rightHandSide.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return rightHandSide; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return ts.find(rightHandSide.members, ts.isConstructorDeclaration); } } @@ -142934,9 +143935,9 @@ var ts; } function shouldKeepItem(declaration, checker) { switch (declaration.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: var importer = checker.getSymbolAtLocation(declaration.name); // TODO: GH#18217 var imported = checker.getAliasedSymbol(importer); return importer.escapedName !== imported.escapedName; @@ -142946,7 +143947,7 @@ var ts; } function tryAddSingleDeclarationName(declaration, containers) { var name = ts.getNameOfDeclaration(declaration); - return !!name && (pushLiteral(name, containers) || name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers)); + return !!name && (pushLiteral(name, containers) || name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers)); } // Only added the names of computed properties if they're simple dotted expressions, like: // @@ -142963,7 +143964,7 @@ var ts; // First, if we started with a computed property name, then add all but the last // portion into the container array. var name = ts.getNameOfDeclaration(declaration); - if (name && name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) { + if (name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) { return ts.emptyArray; } // Don't include the last portion. @@ -143180,7 +144181,7 @@ var ts; */ function hasNavigationBarName(node) { return !ts.hasDynamicName(node) || - (node.kind !== 221 /* SyntaxKind.BinaryExpression */ && + (node.kind !== 223 /* SyntaxKind.BinaryExpression */ && ts.isPropertyAccessExpression(node.name.expression) && ts.isIdentifier(node.name.expression.expression) && ts.idText(node.name.expression.expression) === "Symbol"); @@ -143193,7 +144194,7 @@ var ts; return; } switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: // Get parameter properties, and treat them as being on the *same* level as the constructor, not under it. var ctr = node; addNodeWithRecursiveChild(ctr, ctr.body); @@ -143205,25 +144206,25 @@ var ts; } } break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 170 /* SyntaxKind.MethodSignature */: if (hasNavigationBarName(node)) { addNodeWithRecursiveChild(node, node.body); } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (hasNavigationBarName(node)) { addNodeWithRecursiveInitializer(node); } break; - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (hasNavigationBarName(node)) { addLeafNode(node); } break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: var importClause = node; // Handle default import case e.g.: // import d from "mod"; @@ -143235,7 +144236,7 @@ var ts; // import {a, b as B} from "mod"; var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { addLeafNode(namedBindings); } else { @@ -143246,17 +144247,17 @@ var ts; } } break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: addNodeWithRecursiveChild(node, node.name); break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: var expression = node.expression; // Use the expression as the name of the SpreadAssignment, otherwise show as . ts.isIdentifier(expression) ? addLeafNode(node, expression) : addLeafNode(node); break; - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 254 /* SyntaxKind.VariableDeclaration */: { + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: { var child = node; if (ts.isBindingPattern(child.name)) { addChildrenRecursively(child.name); @@ -143266,7 +144267,7 @@ var ts; } break; } - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: var nameNode = node.name; // If we see a function declaration track as a possible ES5 class if (nameNode && ts.isIdentifier(nameNode)) { @@ -143274,11 +144275,11 @@ var ts; } addNodeWithRecursiveChild(node, node.body); break; - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: addNodeWithRecursiveChild(node, node.body); break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: startNode(node); for (var _e = 0, _f = node.members; _e < _f.length; _e++) { var member = _f[_e]; @@ -143288,9 +144289,9 @@ var ts; } endNode(); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: startNode(node); for (var _g = 0, _h = node.members; _g < _h.length; _g++) { var member = _h[_g]; @@ -143298,10 +144299,10 @@ var ts; } endNode(); break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var expression_1 = node.expression; var child = ts.isObjectLiteralExpression(expression_1) || ts.isCallExpression(expression_1) ? expression_1 : ts.isArrowFunction(expression_1) || ts.isFunctionExpression(expression_1) ? expression_1.body : undefined; @@ -143315,16 +144316,16 @@ var ts; } break; } - case 275 /* SyntaxKind.ExportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 176 /* SyntaxKind.IndexSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: addLeafNode(node); break; - case 208 /* SyntaxKind.CallExpression */: - case 221 /* SyntaxKind.BinaryExpression */: { + case 210 /* SyntaxKind.CallExpression */: + case 223 /* SyntaxKind.BinaryExpression */: { var special = ts.getAssignmentDeclarationKind(node); switch (special) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -143564,12 +144565,12 @@ var ts; return false; } switch (a.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return ts.isStatic(a) === ts.isStatic(b); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return areSameModule(a, b) && getFullyQualifiedModuleName(a) === getFullyQualifiedModuleName(b); default: @@ -143591,7 +144592,7 @@ var ts; if (!a.body || !b.body) { return a.body === b.body; } - return a.body.kind === b.body.kind && (a.body.kind !== 261 /* SyntaxKind.ModuleDeclaration */ || areSameModule(a.body, b.body)); + return a.body.kind === b.body.kind && (a.body.kind !== 264 /* SyntaxKind.ModuleDeclaration */ || areSameModule(a.body, b.body)); } /** Merge source into target. Source should be thrown away after this is called. */ function merge(target, source) { @@ -143621,7 +144622,7 @@ var ts; * So `new()` can still come before an `aardvark` method. */ function tryGetName(node) { - if (node.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (node.kind === 264 /* SyntaxKind.ModuleDeclaration */) { return getModuleName(node); } var declName = ts.getNameOfDeclaration(node); @@ -143630,16 +144631,16 @@ var ts; return propertyName && ts.unescapeLeadingUnderscores(propertyName); } switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 226 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: return getFunctionOrClassName(node); default: return undefined; } } function getItemName(node, name) { - if (node.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (node.kind === 264 /* SyntaxKind.ModuleDeclaration */) { return cleanText(getModuleName(node)); } if (name) { @@ -143651,32 +144652,32 @@ var ts; } } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"".concat(ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))), "\"") : ""; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return ts.isExportAssignment(node) && node.isExportEquals ? "export=" /* InternalSymbolName.ExportEquals */ : "default" /* InternalSymbolName.Default */; - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - if (ts.getSyntacticModifierFlags(node) & 512 /* ModifierFlags.Default */) { + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + if (ts.getSyntacticModifierFlags(node) & 1024 /* ModifierFlags.Default */) { return "default"; } // We may get a string with newlines or other whitespace in the case of an object dereference // (eg: "app\n.onactivated"), so we should remove the whitespace for readability in the // navigation bar. return getFunctionOrClassName(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "constructor"; - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return "new()"; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: return "()"; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return "[]"; default: return ""; @@ -143709,19 +144710,19 @@ var ts; } // Some nodes are otherwise important enough to always include in the primary navigation menu. switch (navigationBarNodeKind(item)) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 305 /* SyntaxKind.SourceFile */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return true; - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return isTopLevelFunctionDeclaration(item); default: return false; @@ -143731,10 +144732,10 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 262 /* SyntaxKind.ModuleBlock */: - case 305 /* SyntaxKind.SourceFile */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 265 /* SyntaxKind.ModuleBlock */: + case 308 /* SyntaxKind.SourceFile */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: return true; default: return false; @@ -143796,7 +144797,7 @@ var ts; function getFullyQualifiedModuleName(moduleDeclaration) { // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = [ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)]; - while (moduleDeclaration.body && moduleDeclaration.body.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 264 /* SyntaxKind.ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)); } @@ -143810,13 +144811,13 @@ var ts; return decl.body && ts.isModuleDeclaration(decl.body) ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { - return !member.name || member.name.kind === 162 /* SyntaxKind.ComputedPropertyName */; + return !member.name || member.name.kind === 164 /* SyntaxKind.ComputedPropertyName */; } function getNodeSpan(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); } function getModifiers(node) { - if (node.parent && node.parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (node.parent && node.parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { node = node.parent; } return ts.getNodeModifiers(node); @@ -143839,7 +144840,7 @@ var ts; return nodeText(parent.name); } // Default exports are named "default" - else if (ts.getSyntacticModifierFlags(node) & 512 /* ModifierFlags.Default */) { + else if (ts.getSyntacticModifierFlags(node) & 1024 /* ModifierFlags.Default */) { return "default"; } else if (ts.isClassLike(node)) { @@ -143874,9 +144875,9 @@ var ts; } function isFunctionOrClassExpression(node) { switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: return true; default: return false; @@ -144277,11 +145278,11 @@ var ts; function getModuleSpecifierExpression(declaration) { var _a; switch (declaration.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return (_a = ts.tryCast(declaration.moduleReference, ts.isExternalModuleReference)) === null || _a === void 0 ? void 0 : _a.expression; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return declaration.moduleSpecifier; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return declaration.declarationList.declarations[0].initializer.arguments[0]; } } @@ -144320,19 +145321,19 @@ var ts; function getImportKindOrder(s1) { var _a; switch (s1.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: if (!s1.importClause) return 0; if (s1.importClause.isTypeOnly) return 1; - if (((_a = s1.importClause.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 268 /* SyntaxKind.NamespaceImport */) + if (((_a = s1.importClause.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 271 /* SyntaxKind.NamespaceImport */) return 2; if (s1.importClause.name) return 3; return 4; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return 5; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return 6; } } @@ -144521,7 +145522,7 @@ var ts; } function getOutliningSpanForNode(n, sourceFile) { switch (n.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionLike(n.parent)) { return functionSpan(n.parent, n, sourceFile); } @@ -144529,16 +145530,16 @@ var ts; // If the latter, we want to collapse the block, but consider its hint span // to be the entire span of the parent. switch (n.parent.kind) { - case 240 /* SyntaxKind.DoStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 243 /* SyntaxKind.DoStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 295 /* SyntaxKind.CatchClause */: return spanForNode(n.parent); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // Could be the try-block, or the finally-block. var tryStatement = n.parent; if (tryStatement.tryBlock === n) { @@ -144555,42 +145556,42 @@ var ts; // the span of the block, independent of any parent span. return createOutliningSpan(ts.createTextSpanFromNode(n, sourceFile), "code" /* OutliningSpanKind.Code */); } - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return spanForNode(n.parent); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 263 /* SyntaxKind.CaseBlock */: - case 182 /* SyntaxKind.TypeLiteral */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 266 /* SyntaxKind.CaseBlock */: + case 184 /* SyntaxKind.TypeLiteral */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return spanForNode(n); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return spanForNode(n, /*autoCollapse*/ false, /*useFullStart*/ !ts.isTupleTypeNode(n.parent), 22 /* SyntaxKind.OpenBracketToken */); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: return spanForNodeArray(n.statements); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return spanForObjectOrArrayLiteral(n); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return spanForObjectOrArrayLiteral(n, 22 /* SyntaxKind.OpenBracketToken */); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return spanForJSXElement(n); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return spanForJSXFragment(n); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: return spanForJSXAttributes(n.attributes); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return spanForTemplateLiteral(n); - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return spanForNode(n, /*autoCollapse*/ false, /*useFullStart*/ !ts.isBindingElement(n.parent), 22 /* SyntaxKind.OpenBracketToken */); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return spanForArrowFunction(n); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return spanForCallExpression(n); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return spanForParenthesizedExpression(n); } function spanForCallExpression(node) { @@ -144663,7 +145664,7 @@ var ts; function functionSpan(node, body, sourceFile) { var openToken = tryGetFunctionOpenToken(node, body, sourceFile); var closeToken = ts.findChildOfKind(body, 19 /* SyntaxKind.CloseBraceToken */, sourceFile); - return openToken && closeToken && spanBetweenTokens(openToken, closeToken, node, sourceFile, /*autoCollapse*/ node.kind !== 214 /* SyntaxKind.ArrowFunction */); + return openToken && closeToken && spanBetweenTokens(openToken, closeToken, node, sourceFile, /*autoCollapse*/ node.kind !== 216 /* SyntaxKind.ArrowFunction */); } function spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart) { if (autoCollapse === void 0) { autoCollapse = false; } @@ -145207,10 +146208,10 @@ var ts; */ function tryConsumeDeclare() { var token = ts.scanner.getToken(); - if (token === 135 /* SyntaxKind.DeclareKeyword */) { + if (token === 136 /* SyntaxKind.DeclareKeyword */) { // declare module "mod" token = nextToken(); - if (token === 141 /* SyntaxKind.ModuleKeyword */) { + if (token === 142 /* SyntaxKind.ModuleKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { recordAmbientExternalModule(); @@ -145244,10 +146245,10 @@ var ts; return true; } else { - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); - return token !== 156 /* SyntaxKind.FromKeyword */ && (token === 41 /* SyntaxKind.AsteriskToken */ || + return token !== 158 /* SyntaxKind.FromKeyword */ && (token === 41 /* SyntaxKind.AsteriskToken */ || token === 18 /* SyntaxKind.OpenBraceToken */ || token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)); @@ -145258,7 +146259,7 @@ var ts; } if (token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import d from "mod"; @@ -145289,7 +146290,7 @@ var ts; } if (token === 19 /* SyntaxKind.CloseBraceToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import {a as A} from "mod"; @@ -145301,11 +146302,11 @@ var ts; } else if (token === 41 /* SyntaxKind.AsteriskToken */) { token = nextToken(); - if (token === 127 /* SyntaxKind.AsKeyword */) { + if (token === 128 /* SyntaxKind.AsKeyword */) { token = nextToken(); if (token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import * as NS from "mod" @@ -145326,7 +146327,7 @@ var ts; if (token === 93 /* SyntaxKind.ExportKeyword */) { markAsExternalModuleIfTopLevel(); token = nextToken(); - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); return token === 41 /* SyntaxKind.AsteriskToken */ || @@ -145345,7 +146346,7 @@ var ts; } if (token === 19 /* SyntaxKind.CloseBraceToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // export {a as A} from "mod"; @@ -145357,7 +146358,7 @@ var ts; } else if (token === 41 /* SyntaxKind.AsteriskToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // export * from "mod" @@ -145367,7 +146368,7 @@ var ts; } else if (token === 100 /* SyntaxKind.ImportKeyword */) { token = nextToken(); - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); return token === 79 /* SyntaxKind.Identifier */ || @@ -145393,7 +146394,7 @@ var ts; function tryConsumeRequireCall(skipCurrentToken, allowTemplateLiterals) { if (allowTemplateLiterals === void 0) { allowTemplateLiterals = false; } var token = skipCurrentToken ? nextToken() : ts.scanner.getToken(); - if (token === 146 /* SyntaxKind.RequireKeyword */) { + if (token === 147 /* SyntaxKind.RequireKeyword */) { token = nextToken(); if (token === 20 /* SyntaxKind.OpenParenToken */) { token = nextToken(); @@ -145605,7 +146606,7 @@ var ts; return getRenameInfoError(wouldRenameNodeModules); } var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); - var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) + var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) ? ts.stripQuotes(ts.getTextOfIdentifierOrLiteral(node)) : undefined; var displayName = specifierName || typeChecker.symbolToString(symbol); @@ -145750,6 +146751,10 @@ var ts; pushSelectionCommentRange(comment.pos, comment.end); } if (positionShouldSnapToNode(sourceFile, pos, node)) { + if (ts.isFunctionBody(node) + && ts.isFunctionLikeDeclaration(parentNode) && !ts.positionsAreOnSameLine(node.getStart(sourceFile), node.getEnd(), sourceFile)) { + pushSelectionRange(node.getStart(sourceFile), node.getEnd()); + } // 1. Blocks are effectively redundant with SyntaxLists. // 2. TemplateSpans, along with the SyntaxLists containing them, are a somewhat unintuitive grouping // of things that should be considered independently. @@ -145887,14 +146892,14 @@ var ts; ts.Debug.assertEqual(closeBraceToken.kind, 19 /* SyntaxKind.CloseBraceToken */); // Group `-/+readonly` and `-/+?` var groupedWithPlusMinusTokens = groupChildren(children, function (child) { - return child === node.readonlyToken || child.kind === 145 /* SyntaxKind.ReadonlyKeyword */ || + return child === node.readonlyToken || child.kind === 146 /* SyntaxKind.ReadonlyKeyword */ || child === node.questionToken || child.kind === 57 /* SyntaxKind.QuestionToken */; }); // Group type parameter with surrounding brackets var groupedWithBrackets = groupChildren(groupedWithPlusMinusTokens, function (_a) { var kind = _a.kind; return kind === 22 /* SyntaxKind.OpenBracketToken */ || - kind === 163 /* SyntaxKind.TypeParameter */ || + kind === 165 /* SyntaxKind.TypeParameter */ || kind === 23 /* SyntaxKind.CloseBracketToken */; }); return [ @@ -145912,7 +146917,7 @@ var ts; var children = groupChildren(node.getChildren(), function (child) { return child === node.name || ts.contains(node.modifiers, child); }); - var firstJSDocChild = ((_a = children[0]) === null || _a === void 0 ? void 0 : _a.kind) === 320 /* SyntaxKind.JSDoc */ ? children[0] : undefined; + var firstJSDocChild = ((_a = children[0]) === null || _a === void 0 ? void 0 : _a.kind) === 323 /* SyntaxKind.JSDoc */ ? children[0] : undefined; var withJSDocSeparated = firstJSDocChild ? children.slice(1) : children; var splittedChildren = splitChildren(withJSDocSeparated, function (_a) { var kind = _a.kind; @@ -146011,22 +147016,22 @@ var ts; return kind === 18 /* SyntaxKind.OpenBraceToken */ || kind === 22 /* SyntaxKind.OpenBracketToken */ || kind === 20 /* SyntaxKind.OpenParenToken */ - || kind === 280 /* SyntaxKind.JsxOpeningElement */; + || kind === 283 /* SyntaxKind.JsxOpeningElement */; } function isListCloser(token) { var kind = token && token.kind; return kind === 19 /* SyntaxKind.CloseBraceToken */ || kind === 23 /* SyntaxKind.CloseBracketToken */ || kind === 21 /* SyntaxKind.CloseParenToken */ - || kind === 281 /* SyntaxKind.JsxClosingElement */; + || kind === 284 /* SyntaxKind.JsxClosingElement */; } function getEndPos(sourceFile, node) { switch (node.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 342 /* SyntaxKind.JSDocThisTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 345 /* SyntaxKind.JSDocThisTag */: return sourceFile.getLineEndOfPosition(node.getStart()); default: return node.getEnd(); @@ -146236,10 +147241,10 @@ var ts; } return undefined; } - else if (ts.isTemplateHead(node) && parent.parent.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + else if (ts.isTemplateHead(node) && parent.parent.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { var templateExpression = parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 223 /* SyntaxKind.TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 225 /* SyntaxKind.TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position, sourceFile) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } @@ -146311,17 +147316,17 @@ var ts; return undefined; var parent = startingToken.parent; switch (parent.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: var info = getArgumentOrParameterListInfo(startingToken, position, sourceFile); if (!info) return undefined; var argumentIndex = info.argumentIndex, argumentCount = info.argumentCount, argumentsSpan = info.argumentsSpan; var contextualType = ts.isMethodDeclaration(parent) ? checker.getContextualTypeForObjectLiteralElement(parent) : checker.getContextualType(parent); return contextualType && { contextualType: contextualType, argumentIndex: argumentIndex, argumentCount: argumentCount, argumentsSpan: argumentsSpan }; - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var highestBinary = getHighestBinary(parent); var contextualType_1 = checker.getContextualType(highestBinary); var argumentIndex_1 = startingToken.kind === 20 /* SyntaxKind.OpenParenToken */ ? 0 : countBinaryExpressionParameters(parent) - 1; @@ -146392,11 +147397,11 @@ var ts; // not enough to put us in the substitution expression; we should consider ourselves part of // the *next* span's expression by offsetting the index (argIndex = (spanIndex + 1) + 1). // - /* eslint-disable no-double-space */ + /* eslint-disable local/no-double-space */ // Example: f `# abcd $#{# 1 + 1# }# efghi ${ #"#hello"# } # ` // ^ ^ ^ ^ ^ ^ ^ ^ ^ // Case: 1 1 3 2 1 3 2 2 1 - /* eslint-enable no-double-space */ + /* eslint-enable local/no-double-space */ ts.Debug.assert(position >= node.getStart(), "Assumed 'position' could not occur before node."); if (ts.isTemplateLiteralToken(node)) { if (ts.isInsideTemplateLiteral(node, position, sourceFile)) { @@ -146445,7 +147450,7 @@ var ts; // | | // This is because a Missing node has no width. However, what we actually want is to include trivia // leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail. - if (template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (template.kind === 225 /* SyntaxKind.TemplateExpression */) { var lastSpan = ts.last(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); @@ -146650,14 +147655,14 @@ var ts; return; } switch (node.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } if (!ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth())) { @@ -146801,7 +147806,7 @@ var ts; } function isHintableLiteral(node) { switch (node.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: { + case 221 /* SyntaxKind.PrefixUnaryExpression */: { var operand = node.operand; return ts.isLiteralExpression(operand) || ts.isIdentifier(operand) && ts.isInfinityOrNaNString(operand.escapedText); } @@ -146809,7 +147814,7 @@ var ts; case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return true; case 79 /* SyntaxKind.Identifier */: { var name = node.escapedText; @@ -147130,11 +148135,11 @@ var ts; function containsTopLevelCommonjs(sourceFile) { return sourceFile.statements.some(function (statement) { switch (statement.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return statement.declarationList.declarations.some(function (decl) { return !!decl.initializer && ts.isRequireCall(propertyAccessLeftHandSide(decl.initializer), /*checkArgumentIsStringLiteralLike*/ true); }); - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; if (!ts.isBinaryExpression(expression)) return ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true); @@ -147151,12 +148156,12 @@ var ts; } function importNameForConvertToDefaultImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var importClause = node.importClause, moduleSpecifier = node.moduleSpecifier; - return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ && ts.isStringLiteral(moduleSpecifier) + return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ && ts.isStringLiteral(moduleSpecifier) ? importClause.namedBindings.name : undefined; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.name; default: return undefined; @@ -147232,20 +148237,20 @@ var ts; // should be kept up to date with getTransformationBody in convertToAsyncFunction.ts function isFixablePromiseArgument(arg, checker) { switch (arg.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: var functionFlags = ts.getFunctionFlags(arg); if (functionFlags & 1 /* FunctionFlags.Generator */) { return false; } // falls through - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: visitedNestedConvertibleFunctions.set(getKeyFromNode(arg), true); // falls through case 104 /* SyntaxKind.NullKeyword */: return true; case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: { + case 208 /* SyntaxKind.PropertyAccessExpression */: { var symbol = checker.getSymbolAtLocation(arg); if (!symbol) { return false; @@ -147262,24 +148267,24 @@ var ts; } function canBeConvertedToClass(node, checker) { var _a, _b, _c, _d; - if (node.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (node.kind === 215 /* SyntaxKind.FunctionExpression */) { if (ts.isVariableDeclaration(node.parent) && ((_a = node.symbol.members) === null || _a === void 0 ? void 0 : _a.size)) { return true; } var symbol = checker.getSymbolOfExpando(node, /*allowDeclaration*/ false); return !!(symbol && (((_b = symbol.exports) === null || _b === void 0 ? void 0 : _b.size) || ((_c = symbol.members) === null || _c === void 0 ? void 0 : _c.size))); } - if (node.kind === 256 /* SyntaxKind.FunctionDeclaration */) { + if (node.kind === 259 /* SyntaxKind.FunctionDeclaration */) { return !!((_d = node.symbol.members) === null || _d === void 0 ? void 0 : _d.size); } return false; } function canBeConvertedToAsync(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: return false; @@ -147301,7 +148306,7 @@ var ts; } var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol); if (flags & 32 /* SymbolFlags.Class */) { - return ts.getDeclarationOfKind(symbol, 226 /* SyntaxKind.ClassExpression */) ? + return ts.getDeclarationOfKind(symbol, 228 /* SyntaxKind.ClassExpression */) ? "local class" /* ScriptElementKind.localClassElement */ : "class" /* ScriptElementKind.classElement */; } if (flags & 384 /* SymbolFlags.Enum */) @@ -147364,6 +148369,8 @@ var ts; return "method" /* ScriptElementKind.memberFunctionElement */; if (flags & 16384 /* SymbolFlags.Constructor */) return "constructor" /* ScriptElementKind.constructorImplementationElement */; + if (flags & 131072 /* SymbolFlags.Signature */) + return "index" /* ScriptElementKind.indexSignatureElement */; if (flags & 4 /* SymbolFlags.Property */) { if (flags & 33554432 /* SymbolFlags.Transient */ && symbol.checkFlags & 6 /* CheckFlags.Synthetic */) { // If union property is result of union of non method (property/accessors/variables), it is labeled as property @@ -147447,12 +148454,15 @@ var ts; var declaration = ts.find(symbol.declarations, function (declaration) { return declaration.name === location; }); if (declaration) { switch (declaration.kind) { - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: symbolKind = "getter" /* ScriptElementKind.memberGetAccessorElement */; break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: symbolKind = "setter" /* ScriptElementKind.memberSetAccessorElement */; break; + case 169 /* SyntaxKind.PropertyDeclaration */: + symbolKind = "accessor" /* ScriptElementKind.memberAccessorVariableElement */; + break; default: ts.Debug.assertNever(declaration); } @@ -147463,7 +148473,7 @@ var ts; } var signature = void 0; type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); - if (location.parent && location.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var right = location.parent.name; // Either the location is on the right of a property access, or on the left and the right is missing if (right === location || (right && right.getFullWidth() === 0)) { @@ -147483,7 +148493,7 @@ var ts; } if (callExpressionLike) { signature = typeChecker.getResolvedSignature(callExpressionLike); // TODO: GH#18217 - var useConstructSignatures = callExpressionLike.kind === 209 /* SyntaxKind.NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 106 /* SyntaxKind.SuperKeyword */); + var useConstructSignatures = callExpressionLike.kind === 211 /* SyntaxKind.NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 106 /* SyntaxKind.SuperKeyword */); var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (signature && !ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { // Get the first signature if there is one -- allSignatures may contain @@ -147547,29 +148557,29 @@ var ts; } } else if ((ts.isNameOfFunctionDeclaration(location) && !(symbolFlags & 98304 /* SymbolFlags.Accessor */)) || // name of function declaration - (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ && location.parent.kind === 171 /* SyntaxKind.Constructor */)) { // At constructor keyword of constructor declaration + (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ && location.parent.kind === 173 /* SyntaxKind.Constructor */)) { // At constructor keyword of constructor declaration // get the signature from the declaration and write it var functionDeclaration_1 = location.parent; // Use function declaration to write the signatures only if the symbol corresponding to this declaration var locationIsSymbolDeclaration = symbol.declarations && ts.find(symbol.declarations, function (declaration) { - return declaration === (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1); + return declaration === (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1); }); if (locationIsSymbolDeclaration) { - var allSignatures = functionDeclaration_1.kind === 171 /* SyntaxKind.Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); + var allSignatures = functionDeclaration_1.kind === 173 /* SyntaxKind.Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration_1)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration_1); // TODO: GH#18217 } else { signature = allSignatures[0]; } - if (functionDeclaration_1.kind === 171 /* SyntaxKind.Constructor */) { + if (functionDeclaration_1.kind === 173 /* SyntaxKind.Constructor */) { // show (constructor) Type(...) signature symbolKind = "constructor" /* ScriptElementKind.constructorImplementationElement */; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { // (function/method) symbol(..signature) - addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 174 /* SyntaxKind.CallSignature */ && + addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 176 /* SyntaxKind.CallSignature */ && !(type.symbol.flags & 2048 /* SymbolFlags.TypeLiteral */ || type.symbol.flags & 4096 /* SymbolFlags.ObjectLiteral */) ? type.symbol : symbol, symbolKind); } if (signature) { @@ -147582,7 +148592,7 @@ var ts; } if (symbolFlags & 32 /* SymbolFlags.Class */ && !hasAddedSymbolInfo && !isThisExpression) { addAliasPrefixIfNecessary(); - if (ts.getDeclarationOfKind(symbol, 226 /* SyntaxKind.ClassExpression */)) { + if (ts.getDeclarationOfKind(symbol, 228 /* SyntaxKind.ClassExpression */)) { // Special case for class expressions because we would like to indicate that // the class name is local to the class body (similar to function expression) // (local class) class @@ -147605,7 +148615,7 @@ var ts; } if ((symbolFlags & 524288 /* SymbolFlags.TypeAlias */) && (semanticMeaning & 2 /* SemanticMeaning.Type */)) { prefixNextMeaning(); - displayParts.push(ts.keywordPart(152 /* SyntaxKind.TypeKeyword */)); + displayParts.push(ts.keywordPart(154 /* SyntaxKind.TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); @@ -147626,9 +148636,9 @@ var ts; } if (symbolFlags & 1536 /* SymbolFlags.Module */ && !isThisExpression) { prefixNextMeaning(); - var declaration = ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.ModuleDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 264 /* SyntaxKind.ModuleDeclaration */); var isNamespace = declaration && declaration.name && declaration.name.kind === 79 /* SyntaxKind.Identifier */; - displayParts.push(ts.keywordPart(isNamespace ? 142 /* SyntaxKind.NamespaceKeyword */ : 141 /* SyntaxKind.ModuleKeyword */)); + displayParts.push(ts.keywordPart(isNamespace ? 143 /* SyntaxKind.NamespaceKeyword */ : 142 /* SyntaxKind.ModuleKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } @@ -147647,7 +148657,7 @@ var ts; } else { // Method/function type parameter - var decl = ts.getDeclarationOfKind(symbol, 163 /* SyntaxKind.TypeParameter */); + var decl = ts.getDeclarationOfKind(symbol, 165 /* SyntaxKind.TypeParameter */); if (decl === undefined) return ts.Debug.fail(); var declaration = decl.parent; @@ -147655,21 +148665,21 @@ var ts; if (ts.isFunctionLikeKind(declaration.kind)) { addInPrefix(); var signature = typeChecker.getSignatureFromDeclaration(declaration); // TODO: GH#18217 - if (declaration.kind === 175 /* SyntaxKind.ConstructSignature */) { + if (declaration.kind === 177 /* SyntaxKind.ConstructSignature */) { displayParts.push(ts.keywordPart(103 /* SyntaxKind.NewKeyword */)); displayParts.push(ts.spacePart()); } - else if (declaration.kind !== 174 /* SyntaxKind.CallSignature */ && declaration.name) { + else if (declaration.kind !== 176 /* SyntaxKind.CallSignature */ && declaration.name) { addFullSymbolName(declaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* TypeFormatFlags.WriteTypeArgumentsOfSignature */)); } - else if (declaration.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + else if (declaration.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { // Type alias type parameter // For example // type list = T[]; // Both T will go through same code path addInPrefix(); - displayParts.push(ts.keywordPart(152 /* SyntaxKind.TypeKeyword */)); + displayParts.push(ts.keywordPart(154 /* SyntaxKind.TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(declaration.symbol); writeTypeParametersOfSymbol(declaration.symbol, sourceFile); @@ -147681,7 +148691,7 @@ var ts; symbolKind = "enum member" /* ScriptElementKind.enumMemberElement */; addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]; - if ((declaration === null || declaration === void 0 ? void 0 : declaration.kind) === 299 /* SyntaxKind.EnumMember */) { + if ((declaration === null || declaration === void 0 ? void 0 : declaration.kind) === 302 /* SyntaxKind.EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -147717,17 +148727,17 @@ var ts; } if (symbol.declarations) { switch (symbol.declarations[0].kind) { - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(142 /* SyntaxKind.NamespaceKeyword */)); + displayParts.push(ts.keywordPart(143 /* SyntaxKind.NamespaceKeyword */)); break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(symbol.declarations[0].isExportEquals ? 63 /* SyntaxKind.EqualsToken */ : 88 /* SyntaxKind.DefaultKeyword */)); break; - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); break; default: @@ -147737,13 +148747,13 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (declaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); displayParts.push(ts.operatorPart(63 /* SyntaxKind.EqualsToken */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(146 /* SyntaxKind.RequireKeyword */)); + displayParts.push(ts.keywordPart(147 /* SyntaxKind.RequireKeyword */)); displayParts.push(ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */)); displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), ts.SymbolDisplayPartKind.stringLiteral)); displayParts.push(ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)); @@ -147773,16 +148783,18 @@ var ts; } // For properties, variables and local vars: show the type if (symbolKind === "property" /* ScriptElementKind.memberVariableElement */ || + symbolKind === "accessor" /* ScriptElementKind.memberAccessorVariableElement */ || symbolKind === "getter" /* ScriptElementKind.memberGetAccessorElement */ || symbolKind === "setter" /* ScriptElementKind.memberSetAccessorElement */ || symbolKind === "JSX attribute" /* ScriptElementKind.jsxAttribute */ || symbolFlags & 3 /* SymbolFlags.Variable */ || symbolKind === "local var" /* ScriptElementKind.localVariableElement */ || + symbolKind === "index" /* ScriptElementKind.indexSignatureElement */ || isThisExpression) { displayParts.push(ts.punctuationPart(58 /* SyntaxKind.ColonToken */)); displayParts.push(ts.spacePart()); // If the type is type parameter, format it specially - if (type.symbol && type.symbol.flags & 262144 /* SymbolFlags.TypeParameter */) { + if (type.symbol && type.symbol.flags & 262144 /* SymbolFlags.TypeParameter */ && symbolKind !== "index" /* ScriptElementKind.indexSignatureElement */) { var typeParameterParts = ts.mapToDisplayParts(function (writer) { var param = typeChecker.typeParameterToDeclaration(type, enclosingDeclaration, symbolDisplayNodeBuilderFlags); getPrinter().writeNode(4 /* EmitHint.Unspecified */, param, ts.getSourceFileOfNode(ts.getParseTreeNode(enclosingDeclaration)), writer); @@ -147826,10 +148838,10 @@ var ts; // For some special property access expressions like `exports.foo = foo` or `module.exports.foo = foo` // there documentation comments might be attached to the right hand side symbol of their declarations. // The pattern of such special property access is that the parent symbol is the symbol of the file. - if (symbol.parent && symbol.declarations && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 305 /* SyntaxKind.SourceFile */; })) { + if (symbol.parent && symbol.declarations && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 308 /* SyntaxKind.SourceFile */; })) { for (var _i = 0, _b = symbol.declarations; _i < _b.length; _i++) { var declaration = _b[_i]; - if (!declaration.parent || declaration.parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (!declaration.parent || declaration.parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { continue; } var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); @@ -147890,10 +148902,34 @@ var ts; displayParts.push(ts.spacePart()); } function addFullSymbolName(symbolToDisplay, enclosingDeclaration) { + var indexInfos; if (alias && symbolToDisplay === symbol) { symbolToDisplay = alias; } - var fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay, enclosingDeclaration || sourceFile, /*meaning*/ undefined, 1 /* SymbolFormatFlags.WriteTypeParametersOrArguments */ | 2 /* SymbolFormatFlags.UseOnlyExternalAliasing */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + if (symbolKind === "index" /* ScriptElementKind.indexSignatureElement */) { + indexInfos = typeChecker.getIndexInfosOfIndexSymbol(symbolToDisplay); + } + var fullSymbolDisplayParts = []; + if (symbolToDisplay.flags & 131072 /* SymbolFlags.Signature */ && indexInfos) { + if (symbolToDisplay.parent) { + fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay.parent); + } + fullSymbolDisplayParts.push(ts.punctuationPart(22 /* SyntaxKind.OpenBracketToken */)); + //Needed to handle more than one type of index + indexInfos.forEach(function (info, i) { + //Needed to handle template literals + fullSymbolDisplayParts.push.apply(fullSymbolDisplayParts, ts.typeToDisplayParts(typeChecker, info.keyType)); + if (i !== indexInfos.length - 1) { + fullSymbolDisplayParts.push(ts.spacePart()); + fullSymbolDisplayParts.push(ts.punctuationPart(51 /* SyntaxKind.BarToken */)); + fullSymbolDisplayParts.push(ts.spacePart()); + } + }); + fullSymbolDisplayParts.push(ts.punctuationPart(23 /* SyntaxKind.CloseBracketToken */)); + } + else { + fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay, enclosingDeclaration || sourceFile, /*meaning*/ undefined, 1 /* SymbolFormatFlags.WriteTypeParametersOrArguments */ | 2 /* SymbolFormatFlags.UseOnlyExternalAliasing */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + } ts.addRange(displayParts, fullSymbolDisplayParts); if (symbol.flags & 16777216 /* SymbolFlags.Optional */) { displayParts.push(ts.punctuationPart(57 /* SyntaxKind.QuestionToken */)); @@ -147959,16 +148995,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (declaration.kind === 215 /* SyntaxKind.FunctionExpression */) { return true; } - if (declaration.kind !== 254 /* SyntaxKind.VariableDeclaration */ && declaration.kind !== 256 /* SyntaxKind.FunctionDeclaration */) { + if (declaration.kind !== 257 /* SyntaxKind.VariableDeclaration */ && declaration.kind !== 259 /* SyntaxKind.FunctionDeclaration */) { return false; } // If the parent is not sourceFile or module block it is local variable for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { // Reached source file or module block - if (parent.kind === 305 /* SyntaxKind.SourceFile */ || parent.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ || parent.kind === 265 /* SyntaxKind.ModuleBlock */) { return false; } } @@ -148273,10 +149309,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 285 /* SyntaxKind.JsxAttribute */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 288 /* SyntaxKind.JsxAttribute */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: // May parse an identifier like `module-layout`; that will be scanned as a keyword at first, but we should parse the whole thing to get an identifier. return ts.isKeyword(node.kind) || node.kind === 79 /* SyntaxKind.Identifier */; } @@ -148469,7 +149505,7 @@ var ts; (function (formatting) { function getAllRules() { var allTokens = []; - for (var token = 0 /* SyntaxKind.FirstToken */; token <= 160 /* SyntaxKind.LastToken */; token++) { + for (var token = 0 /* SyntaxKind.FirstToken */; token <= 162 /* SyntaxKind.LastToken */; token++) { if (token !== 1 /* SyntaxKind.EndOfFileToken */) { allTokens.push(token); } @@ -148484,9 +149520,9 @@ var ts; var anyToken = { tokens: allTokens, isSpecific: false }; var anyTokenIncludingMultilineComments = tokenRangeFrom(__spreadArray(__spreadArray([], allTokens, true), [3 /* SyntaxKind.MultiLineCommentTrivia */], false)); var anyTokenIncludingEOF = tokenRangeFrom(__spreadArray(__spreadArray([], allTokens, true), [1 /* SyntaxKind.EndOfFileToken */], false)); - var keywords = tokenRangeFromRange(81 /* SyntaxKind.FirstKeyword */, 160 /* SyntaxKind.LastKeyword */); + var keywords = tokenRangeFromRange(81 /* SyntaxKind.FirstKeyword */, 162 /* SyntaxKind.LastKeyword */); var binaryOperators = tokenRangeFromRange(29 /* SyntaxKind.FirstBinaryOperator */, 78 /* SyntaxKind.LastBinaryOperator */); - var binaryKeywordOperators = [101 /* SyntaxKind.InKeyword */, 102 /* SyntaxKind.InstanceOfKeyword */, 160 /* SyntaxKind.OfKeyword */, 127 /* SyntaxKind.AsKeyword */, 139 /* SyntaxKind.IsKeyword */]; + var binaryKeywordOperators = [101 /* SyntaxKind.InKeyword */, 102 /* SyntaxKind.InstanceOfKeyword */, 162 /* SyntaxKind.OfKeyword */, 128 /* SyntaxKind.AsKeyword */, 140 /* SyntaxKind.IsKeyword */]; var unaryPrefixOperators = [45 /* SyntaxKind.PlusPlusToken */, 46 /* SyntaxKind.MinusMinusToken */, 54 /* SyntaxKind.TildeToken */, 53 /* SyntaxKind.ExclamationToken */]; var unaryPrefixExpressions = [ 8 /* SyntaxKind.NumericLiteral */, 9 /* SyntaxKind.BigIntLiteral */, 79 /* SyntaxKind.Identifier */, 20 /* SyntaxKind.OpenParenToken */, @@ -148517,7 +149553,7 @@ var ts; rule("SpaceAfterQuestionMarkInConditionalOperator", 57 /* SyntaxKind.QuestionToken */, anyToken, [isNonJsxSameLineTokenContext, isConditionalOperatorContext], 4 /* RuleAction.InsertSpace */), // in other cases there should be no space between '?' and next token rule("NoSpaceAfterQuestionMark", 57 /* SyntaxKind.QuestionToken */, anyToken, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), - rule("NoSpaceBeforeDot", anyToken, [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceBeforeDot", anyToken, [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], [isNonJsxSameLineTokenContext, isNotPropertyAccessOnIntegerLiteral], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceAfterDot", [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], anyToken, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceBetweenImportParenInImportType", 100 /* SyntaxKind.ImportKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext, isImportTypeContext], 16 /* RuleAction.DeleteSpace */), // Special handling of unary operators. @@ -148560,11 +149596,11 @@ var ts; // Though, we do extra check on the context to make sure we are dealing with get/set node. Example: // get x() {} // set x(val) {} - rule("SpaceAfterGetSetInMember", [136 /* SyntaxKind.GetKeyword */, 149 /* SyntaxKind.SetKeyword */], 79 /* SyntaxKind.Identifier */, [isFunctionDeclContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceAfterGetSetInMember", [137 /* SyntaxKind.GetKeyword */, 151 /* SyntaxKind.SetKeyword */], 79 /* SyntaxKind.Identifier */, [isFunctionDeclContext], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBetweenYieldKeywordAndStar", 125 /* SyntaxKind.YieldKeyword */, 41 /* SyntaxKind.AsteriskToken */, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 16 /* RuleAction.DeleteSpace */), rule("SpaceBetweenYieldOrYieldStarAndOperand", [125 /* SyntaxKind.YieldKeyword */, 41 /* SyntaxKind.AsteriskToken */], anyToken, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBetweenReturnAndSemicolon", 105 /* SyntaxKind.ReturnKeyword */, 26 /* SyntaxKind.SemicolonToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), - rule("SpaceAfterCertainKeywords", [113 /* SyntaxKind.VarKeyword */, 109 /* SyntaxKind.ThrowKeyword */, 103 /* SyntaxKind.NewKeyword */, 89 /* SyntaxKind.DeleteKeyword */, 105 /* SyntaxKind.ReturnKeyword */, 112 /* SyntaxKind.TypeOfKeyword */, 132 /* SyntaxKind.AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceAfterCertainKeywords", [113 /* SyntaxKind.VarKeyword */, 109 /* SyntaxKind.ThrowKeyword */, 103 /* SyntaxKind.NewKeyword */, 89 /* SyntaxKind.DeleteKeyword */, 105 /* SyntaxKind.ReturnKeyword */, 112 /* SyntaxKind.TypeOfKeyword */, 133 /* SyntaxKind.AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), rule("SpaceAfterLetConstInVariableDeclaration", [119 /* SyntaxKind.LetKeyword */, 85 /* SyntaxKind.ConstKeyword */], anyToken, [isNonJsxSameLineTokenContext, isStartOfVariableDeclarationList], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBeforeOpenParenInFuncCall", anyToken, 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext, isFunctionCallOrNewContext, isPreviousTokenNotComma], 16 /* RuleAction.DeleteSpace */), // Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options. @@ -148572,8 +149608,8 @@ var ts; rule("SpaceAfterBinaryKeywordOperator", binaryKeywordOperators, anyToken, [isNonJsxSameLineTokenContext, isBinaryOpContext], 4 /* RuleAction.InsertSpace */), rule("SpaceAfterVoidOperator", 114 /* SyntaxKind.VoidKeyword */, anyToken, [isNonJsxSameLineTokenContext, isVoidOpContext], 4 /* RuleAction.InsertSpace */), // Async-await - rule("SpaceBetweenAsyncAndOpenParen", 131 /* SyntaxKind.AsyncKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("SpaceBetweenAsyncAndFunctionKeyword", 131 /* SyntaxKind.AsyncKeyword */, [98 /* SyntaxKind.FunctionKeyword */, 79 /* SyntaxKind.Identifier */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenAsyncAndOpenParen", 132 /* SyntaxKind.AsyncKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenAsyncAndFunctionKeyword", 132 /* SyntaxKind.AsyncKeyword */, [98 /* SyntaxKind.FunctionKeyword */, 79 /* SyntaxKind.Identifier */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Template string rule("NoSpaceBetweenTagAndTemplateString", [79 /* SyntaxKind.Identifier */, 21 /* SyntaxKind.CloseParenToken */], [14 /* SyntaxKind.NoSubstitutionTemplateLiteral */, 15 /* SyntaxKind.TemplateHead */], [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // JSX opening elements @@ -148584,34 +149620,35 @@ var ts; rule("NoSpaceAfterEqualInJsxAttribute", 63 /* SyntaxKind.EqualsToken */, anyToken, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // TypeScript-specific rules // Use of module as a function call. e.g.: import m2 = module("m2"); - rule("NoSpaceAfterModuleImport", [141 /* SyntaxKind.ModuleKeyword */, 146 /* SyntaxKind.RequireKeyword */], 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceAfterModuleImport", [142 /* SyntaxKind.ModuleKeyword */, 147 /* SyntaxKind.RequireKeyword */], 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // Add a space around certain TypeScript keywords rule("SpaceAfterCertainTypeScriptKeywords", [ 126 /* SyntaxKind.AbstractKeyword */, + 127 /* SyntaxKind.AccessorKeyword */, 84 /* SyntaxKind.ClassKeyword */, - 135 /* SyntaxKind.DeclareKeyword */, + 136 /* SyntaxKind.DeclareKeyword */, 88 /* SyntaxKind.DefaultKeyword */, 92 /* SyntaxKind.EnumKeyword */, 93 /* SyntaxKind.ExportKeyword */, 94 /* SyntaxKind.ExtendsKeyword */, - 136 /* SyntaxKind.GetKeyword */, + 137 /* SyntaxKind.GetKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 100 /* SyntaxKind.ImportKeyword */, 118 /* SyntaxKind.InterfaceKeyword */, - 141 /* SyntaxKind.ModuleKeyword */, - 142 /* SyntaxKind.NamespaceKeyword */, + 142 /* SyntaxKind.ModuleKeyword */, + 143 /* SyntaxKind.NamespaceKeyword */, 121 /* SyntaxKind.PrivateKeyword */, 123 /* SyntaxKind.PublicKeyword */, 122 /* SyntaxKind.ProtectedKeyword */, - 145 /* SyntaxKind.ReadonlyKeyword */, - 149 /* SyntaxKind.SetKeyword */, + 146 /* SyntaxKind.ReadonlyKeyword */, + 151 /* SyntaxKind.SetKeyword */, 124 /* SyntaxKind.StaticKeyword */, - 152 /* SyntaxKind.TypeKeyword */, - 156 /* SyntaxKind.FromKeyword */, - 140 /* SyntaxKind.KeyOfKeyword */, - 137 /* SyntaxKind.InferKeyword */, + 154 /* SyntaxKind.TypeKeyword */, + 158 /* SyntaxKind.FromKeyword */, + 141 /* SyntaxKind.KeyOfKeyword */, + 138 /* SyntaxKind.InferKeyword */, ], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [94 /* SyntaxKind.ExtendsKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 156 /* SyntaxKind.FromKeyword */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [94 /* SyntaxKind.ExtendsKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 158 /* SyntaxKind.FromKeyword */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { rule("SpaceAfterModuleName", 10 /* SyntaxKind.StringLiteral */, 18 /* SyntaxKind.OpenBraceToken */, [isModuleDeclContext], 4 /* RuleAction.InsertSpace */), // Lambda expressions @@ -148642,8 +149679,8 @@ var ts; 123 /* SyntaxKind.PublicKeyword */, 121 /* SyntaxKind.PrivateKeyword */, 122 /* SyntaxKind.ProtectedKeyword */, - 136 /* SyntaxKind.GetKeyword */, - 149 /* SyntaxKind.SetKeyword */, + 137 /* SyntaxKind.GetKeyword */, + 151 /* SyntaxKind.SetKeyword */, 22 /* SyntaxKind.OpenBracketToken */, 41 /* SyntaxKind.AsteriskToken */, ], [isEndOfDecoratorContextOnSameLine], 4 /* RuleAction.InsertSpace */), @@ -148654,8 +149691,8 @@ var ts; // These rules are applied after high priority var userConfigurableRules = [ // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses - rule("SpaceAfterConstructor", 134 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("NoSpaceAfterConstructor", 134 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("SpaceAfterConstructor", 135 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("NoSpaceAfterConstructor", 135 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("SpaceAfterComma", 27 /* SyntaxKind.CommaToken */, anyToken, [isOptionEnabled("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNextTokenNotCloseBracket, isNextTokenNotCloseParen], 4 /* RuleAction.InsertSpace */), rule("NoSpaceAfterComma", 27 /* SyntaxKind.CommaToken */, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext], 16 /* RuleAction.DeleteSpace */), // Insert space after function keyword for anonymous functions @@ -148729,11 +149766,11 @@ var ts; rule("SpaceBeforeOpenBraceInTypeScriptDeclWithBlock", typeScriptOpenBraceLeftTokenRange, 18 /* SyntaxKind.OpenBraceToken */, [isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForFunctions"), isTypeScriptDeclWithBlockContext, isNotFormatOnEnter, isSameLineTokenOrBeforeBlockContext], 4 /* RuleAction.InsertSpace */, 1 /* RuleFlags.CanDeleteNewLines */), rule("NoSpaceBeforeComma", anyToken, 27 /* SyntaxKind.CommaToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // No space before and after indexer `x[]` - rule("NoSpaceBeforeOpenBracket", anyTokenExcept(131 /* SyntaxKind.AsyncKeyword */, 82 /* SyntaxKind.CaseKeyword */), 22 /* SyntaxKind.OpenBracketToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceBeforeOpenBracket", anyTokenExcept(132 /* SyntaxKind.AsyncKeyword */, 82 /* SyntaxKind.CaseKeyword */), 22 /* SyntaxKind.OpenBracketToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceAfterCloseBracket", 23 /* SyntaxKind.CloseBracketToken */, anyToken, [isNonJsxSameLineTokenContext, isNotBeforeBlockInFunctionDeclarationContext], 16 /* RuleAction.DeleteSpace */), rule("SpaceAfterSemicolon", 26 /* SyntaxKind.SemicolonToken */, anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Remove extra space between for and await - rule("SpaceBetweenForAndAwaitKeyword", 97 /* SyntaxKind.ForKeyword */, 132 /* SyntaxKind.AwaitKeyword */, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenForAndAwaitKeyword", 97 /* SyntaxKind.ForKeyword */, 133 /* SyntaxKind.AwaitKeyword */, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Add a space between statements. All keywords except (do,else,case) has open/close parens after them. // So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any] rule("SpaceBetweenStatements", [21 /* SyntaxKind.CloseParenToken */, 90 /* SyntaxKind.DoKeyword */, 91 /* SyntaxKind.ElseKeyword */, 82 /* SyntaxKind.CaseKeyword */], anyToken, [isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNotForContext], 4 /* RuleAction.InsertSpace */), @@ -148782,69 +149819,70 @@ var ts; return function (context) { return context.options && context.options[optionName] === optionValue; }; } function isOptionEnabled(optionName) { - return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !!context.options[optionName]; }; + return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !!context.options[optionName]; }; } function isOptionDisabled(optionName) { - return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !context.options[optionName]; }; + return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !context.options[optionName]; }; } function isOptionDisabledOrUndefined(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName]; }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName]; }; } function isOptionDisabledOrUndefinedOrTokensOnSameLine(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); }; } function isOptionEnabledOrUndefined(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName]; }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !!context.options[optionName]; }; } function isForContext(context) { - return context.contextNode.kind === 242 /* SyntaxKind.ForStatement */; + return context.contextNode.kind === 245 /* SyntaxKind.ForStatement */; } function isNotForContext(context) { return !isForContext(context); } function isBinaryOpContext(context) { switch (context.contextNode.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return context.contextNode.operatorToken.kind !== 27 /* SyntaxKind.CommaToken */; - case 222 /* SyntaxKind.ConditionalExpression */: - case 189 /* SyntaxKind.ConditionalType */: - case 229 /* SyntaxKind.AsExpression */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 177 /* SyntaxKind.TypePredicate */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 191 /* SyntaxKind.ConditionalType */: + case 231 /* SyntaxKind.AsExpression */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 179 /* SyntaxKind.TypePredicate */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 235 /* SyntaxKind.SatisfiesExpression */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: // equals in type X = ... // falls through - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // equal in import a = module('a'); // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // equal in export = 1 // falls through - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: // equal in let a = 0 // falls through - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: // equal in p = 0 // falls through - case 164 /* SyntaxKind.Parameter */: - case 299 /* SyntaxKind.EnumMember */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 302 /* SyntaxKind.EnumMember */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return context.currentTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */ || context.nextTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */; // "in" keyword in for (let x in []) { } - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: // "in" keyword in [P in keyof T]: T[P] // falls through - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return context.currentTokenSpan.kind === 101 /* SyntaxKind.InKeyword */ || context.nextTokenSpan.kind === 101 /* SyntaxKind.InKeyword */ || context.currentTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */ || context.nextTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 244 /* SyntaxKind.ForOfStatement */: - return context.currentTokenSpan.kind === 160 /* SyntaxKind.OfKeyword */ || context.nextTokenSpan.kind === 160 /* SyntaxKind.OfKeyword */; + case 247 /* SyntaxKind.ForOfStatement */: + return context.currentTokenSpan.kind === 162 /* SyntaxKind.OfKeyword */ || context.nextTokenSpan.kind === 162 /* SyntaxKind.OfKeyword */; } return false; } @@ -148856,22 +149894,22 @@ var ts; } function isTypeAnnotationContext(context) { var contextKind = context.contextNode.kind; - return contextKind === 167 /* SyntaxKind.PropertyDeclaration */ || - contextKind === 166 /* SyntaxKind.PropertySignature */ || - contextKind === 164 /* SyntaxKind.Parameter */ || - contextKind === 254 /* SyntaxKind.VariableDeclaration */ || + return contextKind === 169 /* SyntaxKind.PropertyDeclaration */ || + contextKind === 168 /* SyntaxKind.PropertySignature */ || + contextKind === 166 /* SyntaxKind.Parameter */ || + contextKind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isFunctionLikeKind(contextKind); } function isConditionalOperatorContext(context) { - return context.contextNode.kind === 222 /* SyntaxKind.ConditionalExpression */ || - context.contextNode.kind === 189 /* SyntaxKind.ConditionalType */; + return context.contextNode.kind === 224 /* SyntaxKind.ConditionalExpression */ || + context.contextNode.kind === 191 /* SyntaxKind.ConditionalType */; } function isSameLineTokenOrBeforeBlockContext(context) { return context.TokensAreOnSameLine() || isBeforeBlockContext(context); } function isBraceWrappedContext(context) { - return context.contextNode.kind === 201 /* SyntaxKind.ObjectBindingPattern */ || - context.contextNode.kind === 195 /* SyntaxKind.MappedType */ || + return context.contextNode.kind === 203 /* SyntaxKind.ObjectBindingPattern */ || + context.contextNode.kind === 197 /* SyntaxKind.MappedType */ || isSingleLineBlockContext(context); } // This check is done before an open brace in a control construct, a function, or a typescript block declaration @@ -148897,34 +149935,34 @@ var ts; return true; } switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 265 /* SyntaxKind.ModuleBlock */: return true; } return false; } function isFunctionDeclContext(context) { switch (context.contextNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: // case SyntaxKind.MemberFunctionDeclaration: // falls through - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // case SyntaxKind.MethodSignature: // falls through - case 174 /* SyntaxKind.CallSignature */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 214 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 216 /* SyntaxKind.ArrowFunction */: // case SyntaxKind.ConstructorDeclaration: // case SyntaxKind.SimpleArrowFunctionExpression: // case SyntaxKind.ParenthesizedArrowFunctionExpression: // falls through - case 258 /* SyntaxKind.InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one + case 261 /* SyntaxKind.InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one return true; } return false; @@ -148933,40 +149971,40 @@ var ts; return !isFunctionDeclContext(context); } function isFunctionDeclarationOrFunctionExpressionContext(context) { - return context.contextNode.kind === 256 /* SyntaxKind.FunctionDeclaration */ || context.contextNode.kind === 213 /* SyntaxKind.FunctionExpression */; + return context.contextNode.kind === 259 /* SyntaxKind.FunctionDeclaration */ || context.contextNode.kind === 215 /* SyntaxKind.FunctionExpression */; } function isTypeScriptDeclWithBlockContext(context) { return nodeIsTypeScriptDeclWithBlockContext(context.contextNode); } function nodeIsTypeScriptDeclWithBlockContext(node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 273 /* SyntaxKind.NamedExports */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 269 /* SyntaxKind.NamedImports */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 276 /* SyntaxKind.NamedExports */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 272 /* SyntaxKind.NamedImports */: return true; } return false; } function isAfterCodeBlockContext(context) { switch (context.currentTokenParent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 292 /* SyntaxKind.CatchClause */: - case 262 /* SyntaxKind.ModuleBlock */: - case 249 /* SyntaxKind.SwitchStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 295 /* SyntaxKind.CatchClause */: + case 265 /* SyntaxKind.ModuleBlock */: + case 252 /* SyntaxKind.SwitchStatement */: return true; - case 235 /* SyntaxKind.Block */: { + case 238 /* SyntaxKind.Block */: { var blockParent = context.currentTokenParent.parent; // In a codefix scenario, we can't rely on parents being set. So just always return true. - if (!blockParent || blockParent.kind !== 214 /* SyntaxKind.ArrowFunction */ && blockParent.kind !== 213 /* SyntaxKind.FunctionExpression */) { + if (!blockParent || blockParent.kind !== 216 /* SyntaxKind.ArrowFunction */ && blockParent.kind !== 215 /* SyntaxKind.FunctionExpression */) { return true; } } @@ -148975,32 +150013,32 @@ var ts; } function isControlDeclContext(context) { switch (context.contextNode.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 248 /* SyntaxKind.WithStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 251 /* SyntaxKind.WithStatement */: // TODO // case SyntaxKind.ElseClause: // falls through - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return true; default: return false; } } function isObjectContext(context) { - return context.contextNode.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return context.contextNode.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } function isFunctionCallContext(context) { - return context.contextNode.kind === 208 /* SyntaxKind.CallExpression */; + return context.contextNode.kind === 210 /* SyntaxKind.CallExpression */; } function isNewContext(context) { - return context.contextNode.kind === 209 /* SyntaxKind.NewExpression */; + return context.contextNode.kind === 211 /* SyntaxKind.NewExpression */; } function isFunctionCallOrNewContext(context) { return isFunctionCallContext(context) || isNewContext(context); @@ -149015,10 +150053,10 @@ var ts; return context.nextTokenSpan.kind !== 21 /* SyntaxKind.CloseParenToken */; } function isArrowFunctionContext(context) { - return context.contextNode.kind === 214 /* SyntaxKind.ArrowFunction */; + return context.contextNode.kind === 216 /* SyntaxKind.ArrowFunction */; } function isImportTypeContext(context) { - return context.contextNode.kind === 200 /* SyntaxKind.ImportType */; + return context.contextNode.kind === 202 /* SyntaxKind.ImportType */; } function isNonJsxSameLineTokenContext(context) { return context.TokensAreOnSameLine() && context.contextNode.kind !== 11 /* SyntaxKind.JsxText */; @@ -149027,19 +150065,19 @@ var ts; return context.contextNode.kind !== 11 /* SyntaxKind.JsxText */; } function isNonJsxElementOrFragmentContext(context) { - return context.contextNode.kind !== 278 /* SyntaxKind.JsxElement */ && context.contextNode.kind !== 282 /* SyntaxKind.JsxFragment */; + return context.contextNode.kind !== 281 /* SyntaxKind.JsxElement */ && context.contextNode.kind !== 285 /* SyntaxKind.JsxFragment */; } function isJsxExpressionContext(context) { - return context.contextNode.kind === 288 /* SyntaxKind.JsxExpression */ || context.contextNode.kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return context.contextNode.kind === 291 /* SyntaxKind.JsxExpression */ || context.contextNode.kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } function isNextTokenParentJsxAttribute(context) { - return context.nextTokenParent.kind === 285 /* SyntaxKind.JsxAttribute */; + return context.nextTokenParent.kind === 288 /* SyntaxKind.JsxAttribute */; } function isJsxAttributeContext(context) { - return context.contextNode.kind === 285 /* SyntaxKind.JsxAttribute */; + return context.contextNode.kind === 288 /* SyntaxKind.JsxAttribute */; } function isJsxSelfClosingElementContext(context) { - return context.contextNode.kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return context.contextNode.kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } function isNotBeforeBlockInFunctionDeclarationContext(context) { return !isFunctionDeclContext(context) && !isBeforeBlockContext(context); @@ -149054,45 +150092,45 @@ var ts; while (ts.isExpressionNode(node)) { node = node.parent; } - return node.kind === 165 /* SyntaxKind.Decorator */; + return node.kind === 167 /* SyntaxKind.Decorator */; } function isStartOfVariableDeclarationList(context) { - return context.currentTokenParent.kind === 255 /* SyntaxKind.VariableDeclarationList */ && + return context.currentTokenParent.kind === 258 /* SyntaxKind.VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; } function isNotFormatOnEnter(context) { return context.formattingRequestKind !== 2 /* FormattingRequestKind.FormatOnEnter */; } function isModuleDeclContext(context) { - return context.contextNode.kind === 261 /* SyntaxKind.ModuleDeclaration */; + return context.contextNode.kind === 264 /* SyntaxKind.ModuleDeclaration */; } function isObjectTypeContext(context) { - return context.contextNode.kind === 182 /* SyntaxKind.TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; + return context.contextNode.kind === 184 /* SyntaxKind.TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; } function isConstructorSignatureContext(context) { - return context.contextNode.kind === 175 /* SyntaxKind.ConstructSignature */; + return context.contextNode.kind === 177 /* SyntaxKind.ConstructSignature */; } function isTypeArgumentOrParameterOrAssertion(token, parent) { if (token.kind !== 29 /* SyntaxKind.LessThanToken */ && token.kind !== 31 /* SyntaxKind.GreaterThanToken */) { return false; } switch (parent.kind) { - case 178 /* SyntaxKind.TypeReference */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return true; default: return false; @@ -149103,28 +150141,28 @@ var ts; isTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); } function isTypeAssertionContext(context) { - return context.contextNode.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return context.contextNode.kind === 213 /* SyntaxKind.TypeAssertionExpression */; } function isVoidOpContext(context) { - return context.currentTokenSpan.kind === 114 /* SyntaxKind.VoidKeyword */ && context.currentTokenParent.kind === 217 /* SyntaxKind.VoidExpression */; + return context.currentTokenSpan.kind === 114 /* SyntaxKind.VoidKeyword */ && context.currentTokenParent.kind === 219 /* SyntaxKind.VoidExpression */; } function isYieldOrYieldStarWithOperand(context) { - return context.contextNode.kind === 224 /* SyntaxKind.YieldExpression */ && context.contextNode.expression !== undefined; + return context.contextNode.kind === 226 /* SyntaxKind.YieldExpression */ && context.contextNode.expression !== undefined; } function isNonNullAssertionContext(context) { - return context.contextNode.kind === 230 /* SyntaxKind.NonNullExpression */; + return context.contextNode.kind === 232 /* SyntaxKind.NonNullExpression */; } function isNotStatementConditionContext(context) { return !isStatementConditionContext(context); } function isStatementConditionContext(context) { switch (context.contextNode.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return true; default: return false; @@ -149149,12 +150187,12 @@ var ts; return nextTokenKind === 19 /* SyntaxKind.CloseBraceToken */ || nextTokenKind === 1 /* SyntaxKind.EndOfFileToken */; } - if (nextTokenKind === 234 /* SyntaxKind.SemicolonClassElement */ || + if (nextTokenKind === 237 /* SyntaxKind.SemicolonClassElement */ || nextTokenKind === 26 /* SyntaxKind.SemicolonToken */) { return false; } - if (context.contextNode.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - context.contextNode.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + if (context.contextNode.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + context.contextNode.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { // Can’t remove semicolon after `foo`; it would parse as a method declaration: // // interface I { @@ -149168,9 +150206,9 @@ var ts; if (ts.isPropertyDeclaration(context.currentTokenParent)) { return !context.currentTokenParent.initializer; } - return context.currentTokenParent.kind !== 242 /* SyntaxKind.ForStatement */ - && context.currentTokenParent.kind !== 236 /* SyntaxKind.EmptyStatement */ - && context.currentTokenParent.kind !== 234 /* SyntaxKind.SemicolonClassElement */ + return context.currentTokenParent.kind !== 245 /* SyntaxKind.ForStatement */ + && context.currentTokenParent.kind !== 239 /* SyntaxKind.EmptyStatement */ + && context.currentTokenParent.kind !== 237 /* SyntaxKind.SemicolonClassElement */ && nextTokenKind !== 22 /* SyntaxKind.OpenBracketToken */ && nextTokenKind !== 20 /* SyntaxKind.OpenParenToken */ && nextTokenKind !== 39 /* SyntaxKind.PlusToken */ @@ -149178,7 +150216,7 @@ var ts; && nextTokenKind !== 43 /* SyntaxKind.SlashToken */ && nextTokenKind !== 13 /* SyntaxKind.RegularExpressionLiteral */ && nextTokenKind !== 27 /* SyntaxKind.CommaToken */ - && nextTokenKind !== 223 /* SyntaxKind.TemplateExpression */ + && nextTokenKind !== 225 /* SyntaxKind.TemplateExpression */ && nextTokenKind !== 15 /* SyntaxKind.TemplateHead */ && nextTokenKind !== 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */ && nextTokenKind !== 24 /* SyntaxKind.DotToken */; @@ -149186,6 +150224,11 @@ var ts; function isSemicolonInsertionContext(context) { return ts.positionIsASICandidate(context.currentTokenSpan.end, context.currentTokenParent, context.sourceFile); } + function isNotPropertyAccessOnIntegerLiteral(context) { + return !ts.isPropertyAccessExpression(context.contextNode) + || !ts.isNumericLiteral(context.contextNode.expression) + || context.contextNode.expression.getText().indexOf(".") !== -1; + } })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); /* @internal */ @@ -149269,12 +150312,12 @@ var ts; return map; } function getRuleBucketIndex(row, column) { - ts.Debug.assert(row <= 160 /* SyntaxKind.LastKeyword */ && column <= 160 /* SyntaxKind.LastKeyword */, "Must compute formatting context from tokens"); + ts.Debug.assert(row <= 162 /* SyntaxKind.LastKeyword */ && column <= 162 /* SyntaxKind.LastKeyword */, "Must compute formatting context from tokens"); return (row * mapRowLength) + column; } var maskBitSize = 5; var mask = 31; // MaskBitSize bits - var mapRowLength = 160 /* SyntaxKind.LastToken */ + 1; + var mapRowLength = 162 /* SyntaxKind.LastToken */ + 1; var RulesPosition; (function (RulesPosition) { RulesPosition[RulesPosition["StopRulesSpecific"] = 0] = "StopRulesSpecific"; @@ -149462,17 +150505,17 @@ var ts; // i.e. parent is class declaration with the list of members and node is one of members. function isListElement(parent, node) { switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var body = parent.body; - return !!body && body.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.rangeContainsRange(body.statements, node); - case 305 /* SyntaxKind.SourceFile */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + return !!body && body.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.rangeContainsRange(body.statements, node); + case 308 /* SyntaxKind.SourceFile */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -149735,19 +150778,19 @@ var ts; return modifier.kind; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: return 84 /* SyntaxKind.ClassKeyword */; - case 258 /* SyntaxKind.InterfaceDeclaration */: return 118 /* SyntaxKind.InterfaceKeyword */; - case 256 /* SyntaxKind.FunctionDeclaration */: return 98 /* SyntaxKind.FunctionKeyword */; - case 260 /* SyntaxKind.EnumDeclaration */: return 260 /* SyntaxKind.EnumDeclaration */; - case 172 /* SyntaxKind.GetAccessor */: return 136 /* SyntaxKind.GetKeyword */; - case 173 /* SyntaxKind.SetAccessor */: return 149 /* SyntaxKind.SetKeyword */; - case 169 /* SyntaxKind.MethodDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return 84 /* SyntaxKind.ClassKeyword */; + case 261 /* SyntaxKind.InterfaceDeclaration */: return 118 /* SyntaxKind.InterfaceKeyword */; + case 259 /* SyntaxKind.FunctionDeclaration */: return 98 /* SyntaxKind.FunctionKeyword */; + case 263 /* SyntaxKind.EnumDeclaration */: return 263 /* SyntaxKind.EnumDeclaration */; + case 174 /* SyntaxKind.GetAccessor */: return 137 /* SyntaxKind.GetKeyword */; + case 175 /* SyntaxKind.SetAccessor */: return 151 /* SyntaxKind.SetKeyword */; + case 171 /* SyntaxKind.MethodDeclaration */: if (node.asteriskToken) { return 41 /* SyntaxKind.AsteriskToken */; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: var name = ts.getNameOfDeclaration(node); if (name) { return name.kind; @@ -149804,15 +150847,15 @@ var ts; case 43 /* SyntaxKind.SlashToken */: case 31 /* SyntaxKind.GreaterThanToken */: switch (container.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return false; } break; case 22 /* SyntaxKind.OpenBracketToken */: case 23 /* SyntaxKind.CloseBracketToken */: - if (container.kind !== 195 /* SyntaxKind.MappedType */) { + if (container.kind !== 197 /* SyntaxKind.MappedType */) { return false; } break; @@ -149916,11 +150959,11 @@ var ts; return inheritedIndentation; } } - var effectiveParentStartLine = child.kind === 165 /* SyntaxKind.Decorator */ ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 167 /* SyntaxKind.Decorator */ ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; - if (isFirstListItem && parent.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && inheritedIndentation === -1 /* Constants.Unknown */) { + if (isFirstListItem && parent.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && inheritedIndentation === -1 /* Constants.Unknown */) { inheritedIndentation = childIndentation.indentation; } return inheritedIndentation; @@ -150378,18 +151421,18 @@ var ts; formatting.getRangeOfEnclosingComment = getRangeOfEnclosingComment; function getOpenTokenForList(node, list) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 214 /* SyntaxKind.ArrowFunction */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: if (node.typeParameters === list) { return 29 /* SyntaxKind.LessThanToken */; } @@ -150397,8 +151440,8 @@ var ts; return 20 /* SyntaxKind.OpenParenToken */; } break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: if (node.typeArguments === list) { return 29 /* SyntaxKind.LessThanToken */; } @@ -150406,24 +151449,24 @@ var ts; return 20 /* SyntaxKind.OpenParenToken */; } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: if (node.typeParameters === list) { return 29 /* SyntaxKind.LessThanToken */; } break; - case 178 /* SyntaxKind.TypeReference */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 181 /* SyntaxKind.TypeQuery */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 200 /* SyntaxKind.ImportType */: + case 180 /* SyntaxKind.TypeReference */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 183 /* SyntaxKind.TypeQuery */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 202 /* SyntaxKind.ImportType */: if (node.typeArguments === list) { return 29 /* SyntaxKind.LessThanToken */; } break; - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return 18 /* SyntaxKind.OpenBraceToken */; } return 0 /* SyntaxKind.Unknown */; @@ -150559,11 +151602,11 @@ var ts; // y: undefined, // } // ``` - var isObjectLiteral = currentToken.kind === 18 /* SyntaxKind.OpenBraceToken */ && currentToken.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + var isObjectLiteral = currentToken.kind === 18 /* SyntaxKind.OpenBraceToken */ && currentToken.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; if (options.indentStyle === ts.IndentStyle.Block || isObjectLiteral) { return getBlockIndent(sourceFile, position, options); } - if (precedingToken.kind === 27 /* SyntaxKind.CommaToken */ && precedingToken.parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (precedingToken.kind === 27 /* SyntaxKind.CommaToken */ && precedingToken.parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1 /* Value.Unknown */) { @@ -150573,7 +151616,7 @@ var ts; var containerList = getListByPosition(position, precedingToken.parent, sourceFile); // use list position if the preceding token is before any list items if (containerList && !ts.rangeContainsRange(containerList, precedingToken)) { - var useTheSameBaseIndentation = [213 /* SyntaxKind.FunctionExpression */, 214 /* SyntaxKind.ArrowFunction */].indexOf(currentToken.parent.kind) !== -1; + var useTheSameBaseIndentation = [215 /* SyntaxKind.FunctionExpression */, 216 /* SyntaxKind.ArrowFunction */].indexOf(currentToken.parent.kind) !== -1; var indentSize = useTheSameBaseIndentation ? 0 : options.indentSize; return getActualIndentationForListStartLine(containerList, sourceFile, options) + indentSize; // TODO: GH#18217 } @@ -150738,7 +151781,7 @@ var ts; // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually // - parent and child are not on the same line var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && - (parent.kind === 305 /* SyntaxKind.SourceFile */ || !parentAndChildShareLine); + (parent.kind === 308 /* SyntaxKind.SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Value.Unknown */; } @@ -150786,7 +151829,7 @@ var ts; } SmartIndenter.isArgumentAndStartLineOverlapsExpressionBeingCalled = isArgumentAndStartLineOverlapsExpressionBeingCalled; function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 239 /* SyntaxKind.IfStatement */ && parent.elseStatement === child) { + if (parent.kind === 242 /* SyntaxKind.IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 91 /* SyntaxKind.ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -150867,42 +151910,42 @@ var ts; } function getListByRange(start, end, node, sourceFile) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return getList(node.typeArguments); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return getList(node.properties); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getList(node.elements); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return getList(node.members); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 171 /* SyntaxKind.Constructor */: - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 173 /* SyntaxKind.Constructor */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return getList(node.typeParameters) || getList(node.parameters); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return getList(node.parameters); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return getList(node.typeParameters); - case 209 /* SyntaxKind.NewExpression */: - case 208 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: return getList(node.typeArguments) || getList(node.arguments); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return getList(node.declarations); - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return getList(node.elements); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return getList(node.elements); } function getList(list) { @@ -150925,7 +151968,7 @@ var ts; return findColumnForFirstNonWhitespaceCharacterInLine(sourceFile.getLineAndCharacterOfPosition(list.pos), sourceFile, options); } function getActualIndentationForListItem(node, sourceFile, options, listIndentsChild) { - if (node.parent && node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.parent && node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */) { // VariableDeclarationList has no wrapping tokens return -1 /* Value.Unknown */; } @@ -150998,96 +152041,96 @@ var ts; function nodeWillIndentChild(settings, parent, child, sourceFile, indentByDefault) { var childKind = child ? child.kind : 0 /* SyntaxKind.Unknown */; switch (parent.kind) { - case 238 /* SyntaxKind.ExpressionStatement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 182 /* SyntaxKind.TypeLiteral */: - case 195 /* SyntaxKind.MappedType */: - case 184 /* SyntaxKind.TupleType */: - case 263 /* SyntaxKind.CaseBlock */: - case 290 /* SyntaxKind.DefaultClause */: - case 289 /* SyntaxKind.CaseClause */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 237 /* SyntaxKind.VariableStatement */: - case 271 /* SyntaxKind.ExportAssignment */: - case 247 /* SyntaxKind.ReturnStatement */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 283 /* SyntaxKind.JsxOpeningFragment */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 288 /* SyntaxKind.JsxExpression */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 164 /* SyntaxKind.Parameter */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 273 /* SyntaxKind.NamedExports */: - case 269 /* SyntaxKind.NamedImports */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 184 /* SyntaxKind.TypeLiteral */: + case 197 /* SyntaxKind.MappedType */: + case 186 /* SyntaxKind.TupleType */: + case 266 /* SyntaxKind.CaseBlock */: + case 293 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 240 /* SyntaxKind.VariableStatement */: + case 274 /* SyntaxKind.ExportAssignment */: + case 250 /* SyntaxKind.ReturnStatement */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 286 /* SyntaxKind.JsxOpeningFragment */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 291 /* SyntaxKind.JsxExpression */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 166 /* SyntaxKind.Parameter */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 276 /* SyntaxKind.NamedExports */: + case 272 /* SyntaxKind.NamedImports */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: - if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 205 /* SyntaxKind.ObjectLiteralExpression */) { // TODO: GH#18217 + case 257 /* SyntaxKind.VariableDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: + if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // TODO: GH#18217 return rangeIsOnOneLine(sourceFile, child); } - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ && sourceFile && child && childKind === 278 /* SyntaxKind.JsxElement */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ && sourceFile && child && childKind === 281 /* SyntaxKind.JsxElement */) { var parentStartLine = sourceFile.getLineAndCharacterOfPosition(ts.skipTrivia(sourceFile.text, parent.pos)).line; var childStartLine = sourceFile.getLineAndCharacterOfPosition(ts.skipTrivia(sourceFile.text, child.pos)).line; return parentStartLine !== childStartLine; } - if (parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { return true; } break; - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return childKind !== 235 /* SyntaxKind.Block */; - case 214 /* SyntaxKind.ArrowFunction */: - if (sourceFile && childKind === 212 /* SyntaxKind.ParenthesizedExpression */) { + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return childKind !== 238 /* SyntaxKind.Block */; + case 216 /* SyntaxKind.ArrowFunction */: + if (sourceFile && childKind === 214 /* SyntaxKind.ParenthesizedExpression */) { return rangeIsOnOneLine(sourceFile, child); } - return childKind !== 235 /* SyntaxKind.Block */; - case 272 /* SyntaxKind.ExportDeclaration */: - return childKind !== 273 /* SyntaxKind.NamedExports */; - case 266 /* SyntaxKind.ImportDeclaration */: - return childKind !== 267 /* SyntaxKind.ImportClause */ || - (!!child.namedBindings && child.namedBindings.kind !== 269 /* SyntaxKind.NamedImports */); - case 278 /* SyntaxKind.JsxElement */: - return childKind !== 281 /* SyntaxKind.JsxClosingElement */; - case 282 /* SyntaxKind.JsxFragment */: - return childKind !== 284 /* SyntaxKind.JsxClosingFragment */; - case 188 /* SyntaxKind.IntersectionType */: - case 187 /* SyntaxKind.UnionType */: - if (childKind === 182 /* SyntaxKind.TypeLiteral */ || childKind === 184 /* SyntaxKind.TupleType */) { + return childKind !== 238 /* SyntaxKind.Block */; + case 275 /* SyntaxKind.ExportDeclaration */: + return childKind !== 276 /* SyntaxKind.NamedExports */; + case 269 /* SyntaxKind.ImportDeclaration */: + return childKind !== 270 /* SyntaxKind.ImportClause */ || + (!!child.namedBindings && child.namedBindings.kind !== 272 /* SyntaxKind.NamedImports */); + case 281 /* SyntaxKind.JsxElement */: + return childKind !== 284 /* SyntaxKind.JsxClosingElement */; + case 285 /* SyntaxKind.JsxFragment */: + return childKind !== 287 /* SyntaxKind.JsxClosingFragment */; + case 190 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + if (childKind === 184 /* SyntaxKind.TypeLiteral */ || childKind === 186 /* SyntaxKind.TupleType */) { return false; } break; @@ -151098,11 +152141,11 @@ var ts; SmartIndenter.nodeWillIndentChild = nodeWillIndentChild; function isControlFlowEndingStatement(kind, parent) { switch (kind) { - case 247 /* SyntaxKind.ReturnStatement */: - case 251 /* SyntaxKind.ThrowStatement */: - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: - return parent.kind !== 235 /* SyntaxKind.Block */; + case 250 /* SyntaxKind.ReturnStatement */: + case 254 /* SyntaxKind.ThrowStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + return parent.kind !== 238 /* SyntaxKind.Block */; default: return false; } @@ -151319,7 +152362,7 @@ var ts; * Checks if 'candidate' argument is a legal separator in the list that contains 'node' as an element */ function isSeparator(node, candidate) { - return !!candidate && !!node.parent && (candidate.kind === 27 /* SyntaxKind.CommaToken */ || (candidate.kind === 26 /* SyntaxKind.SemicolonToken */ && node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */)); + return !!candidate && !!node.parent && (candidate.kind === 27 /* SyntaxKind.CommaToken */ || (candidate.kind === 26 /* SyntaxKind.SemicolonToken */ && node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */)); } function isThisTypeAnnotatable(containingFunction) { return ts.isFunctionExpression(containingFunction) || ts.isFunctionDeclaration(containingFunction); @@ -151551,7 +152594,7 @@ var ts; } } else { - endNode = (_a = (node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? node.exclamationToken : node.questionToken)) !== null && _a !== void 0 ? _a : node.name; + endNode = (_a = (node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? node.exclamationToken : node.questionToken)) !== null && _a !== void 0 ? _a : node.name; } this.insertNodeAt(sourceFile, endNode.end, type, { prefix: ": " }); return true; @@ -151717,18 +152760,18 @@ var ts; }; ChangeTracker.prototype.getInsertNodeAfterOptionsWorker = function (node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return { prefix: this.newLineCharacter, suffix: this.newLineCharacter }; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: case 10 /* SyntaxKind.StringLiteral */: case 79 /* SyntaxKind.Identifier */: return { prefix: ", " }; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return { suffix: "," + this.newLineCharacter }; case 93 /* SyntaxKind.ExportKeyword */: return { prefix: " " }; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return {}; default: ts.Debug.assert(ts.isStatement(node) || ts.isClassOrTypeElement(node)); // Else we haven't handled this kind of node yet -- add it @@ -151737,7 +152780,7 @@ var ts; }; ChangeTracker.prototype.insertName = function (sourceFile, node, name) { ts.Debug.assert(!node.name); - if (node.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind === 216 /* SyntaxKind.ArrowFunction */) { var arrow = ts.findChildOfKind(node, 38 /* SyntaxKind.EqualsGreaterThanToken */, sourceFile); var lparen = ts.findChildOfKind(node, 20 /* SyntaxKind.OpenParenToken */, sourceFile); if (lparen) { @@ -151751,14 +152794,14 @@ var ts; // Replacing full range of arrow to get rid of the leading space -- replace ` =>` with `)` this.replaceRange(sourceFile, arrow, ts.factory.createToken(21 /* SyntaxKind.CloseParenToken */)); } - if (node.body.kind !== 235 /* SyntaxKind.Block */) { + if (node.body.kind !== 238 /* SyntaxKind.Block */) { // `() => 0` => `function f() { return 0; }` this.insertNodesAt(sourceFile, node.body.getStart(sourceFile), [ts.factory.createToken(18 /* SyntaxKind.OpenBraceToken */), ts.factory.createToken(105 /* SyntaxKind.ReturnKeyword */)], { joiner: " ", suffix: " " }); this.insertNodesAt(sourceFile, node.body.end, [ts.factory.createToken(26 /* SyntaxKind.SemicolonToken */), ts.factory.createToken(19 /* SyntaxKind.CloseBraceToken */)], { joiner: " " }); } } else { - var pos = ts.findChildOfKind(node, node.kind === 213 /* SyntaxKind.FunctionExpression */ ? 98 /* SyntaxKind.FunctionKeyword */ : 84 /* SyntaxKind.ClassKeyword */, sourceFile).end; + var pos = ts.findChildOfKind(node, node.kind === 215 /* SyntaxKind.FunctionExpression */ ? 98 /* SyntaxKind.FunctionKeyword */ : 84 /* SyntaxKind.ClassKeyword */, sourceFile).end; this.insertNodeAt(sourceFile, pos, ts.factory.createIdentifier(name), { prefix: " " }); } }; @@ -151935,10 +152978,10 @@ var ts; }()); textChanges_3.ChangeTracker = ChangeTracker; function updateJSDocHost(parent) { - if (parent.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (parent.kind !== 216 /* SyntaxKind.ArrowFunction */) { return parent; } - var jsDocNode = parent.parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ ? + var jsDocNode = parent.parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ ? parent.parent : parent.parent.parent; jsDocNode.jsDoc = parent.jsDoc; @@ -151950,16 +152993,16 @@ var ts; return undefined; } switch (oldTag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: { + case 343 /* SyntaxKind.JSDocParameterTag */: { var oldParam = oldTag; var newParam = newTag; return ts.isIdentifier(oldParam.name) && ts.isIdentifier(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText ? ts.factory.createJSDocParameterTag(/*tagName*/ undefined, newParam.name, /*isBracketed*/ false, newParam.typeExpression, newParam.isNameFirst, oldParam.comment) : undefined; } - case 341 /* SyntaxKind.JSDocReturnTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: return ts.factory.createJSDocReturnTag(/*tagName*/ undefined, newTag.typeExpression, oldTag.comment); - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return ts.factory.createJSDocTypeTag(/*tagName*/ undefined, newTag.typeExpression, oldTag.comment); } } @@ -152353,14 +153396,14 @@ var ts; } textChanges_3.isValidLocationToAddComment = isValidLocationToAddComment; function needSemicolonBetween(a, b) { - return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ || ts.isStatementButNotDeclaration(a) && ts.isStatementButNotDeclaration(b); // TODO: only if b would start with a `(` or `[` } var deleteDeclaration; (function (deleteDeclaration_1) { function deleteDeclaration(changes, deletedNodesInLists, sourceFile, node) { switch (node.kind) { - case 164 /* SyntaxKind.Parameter */: { + case 166 /* SyntaxKind.Parameter */: { var oldFunction = node.parent; if (ts.isArrowFunction(oldFunction) && oldFunction.parameters.length === 1 && @@ -152375,17 +153418,17 @@ var ts; } break; } - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: var isFirstImport = sourceFile.imports.length && node === ts.first(sourceFile.imports).parent || node === ts.find(sourceFile.statements, ts.isAnyImportSyntax); // For first import, leave header comment in place, otherwise only delete JSDoc comments deleteNode(changes, sourceFile, node, { leadingTriviaOption: isFirstImport ? LeadingTriviaOption.Exclude : ts.hasJSDocNodes(node) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine, }); break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: var pattern = node.parent; - var preserveComma = pattern.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && node !== ts.last(pattern.elements); + var preserveComma = pattern.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && node !== ts.last(pattern.elements); if (preserveComma) { deleteNode(changes, sourceFile, node); } @@ -152393,13 +153436,13 @@ var ts; deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node); break; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: var namedImports = node.parent; if (namedImports.elements.length === 1) { deleteImportBinding(changes, sourceFile, namedImports); @@ -152408,7 +153451,7 @@ var ts; deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: deleteImportBinding(changes, sourceFile, node); break; case 26 /* SyntaxKind.SemicolonToken */: @@ -152417,8 +153460,8 @@ var ts; case 98 /* SyntaxKind.FunctionKeyword */: deleteNode(changes, sourceFile, node, { leadingTriviaOption: LeadingTriviaOption.Exclude }); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: deleteNode(changes, sourceFile, node, { leadingTriviaOption: ts.hasJSDocNodes(node) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine }); break; default: @@ -152469,13 +153512,13 @@ var ts; // Delete the entire import declaration // |import * as ns from './file'| // |import { a } from './file'| - var importDecl = ts.getAncestor(node, 266 /* SyntaxKind.ImportDeclaration */); + var importDecl = ts.getAncestor(node, 269 /* SyntaxKind.ImportDeclaration */); deleteNode(changes, sourceFile, importDecl); } } function deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node) { var parent = node.parent; - if (parent.kind === 292 /* SyntaxKind.CatchClause */) { + if (parent.kind === 295 /* SyntaxKind.CatchClause */) { // TODO: There's currently no unused diagnostic for this, could be a suggestion changes.deleteNodeRange(sourceFile, ts.findChildOfKind(parent, 20 /* SyntaxKind.OpenParenToken */, sourceFile), ts.findChildOfKind(parent, 21 /* SyntaxKind.CloseParenToken */, sourceFile)); return; @@ -152486,14 +153529,14 @@ var ts; } var gp = parent.parent; switch (gp.kind) { - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: changes.replaceNode(sourceFile, node, ts.factory.createObjectLiteralExpression()); break; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: deleteNode(changes, sourceFile, parent); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: deleteNode(changes, sourceFile, gp, { leadingTriviaOption: ts.hasJSDocNodes(gp) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine }); break; default: @@ -152680,8 +153723,8 @@ var ts; }); function makeChange(changeTracker, sourceFile, assertion) { var replacement = ts.isAsExpression(assertion) - ? ts.factory.createAsExpression(assertion.expression, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)) - : ts.factory.createTypeAssertion(ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */), assertion.expression); + ? ts.factory.createAsExpression(assertion.expression, ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)) + : ts.factory.createTypeAssertion(ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */), assertion.expression); changeTracker.replaceNode(sourceFile, assertion.expression, replacement); } function getAssertion(sourceFile, pos) { @@ -152765,7 +153808,7 @@ var ts; } } fixedDeclarations === null || fixedDeclarations === void 0 ? void 0 : fixedDeclarations.add(ts.getNodeId(insertionSite)); - var cloneWithModifier = ts.factory.updateModifiers(ts.getSynthesizedDeepClone(insertionSite, /*includeTrivia*/ true), ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(ts.getSyntacticModifierFlags(insertionSite) | 256 /* ModifierFlags.Async */))); + var cloneWithModifier = ts.factory.updateModifiers(ts.getSynthesizedDeepClone(insertionSite, /*includeTrivia*/ true), ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(ts.getSyntacticModifierFlags(insertionSite) | 512 /* ModifierFlags.Async */))); changeTracker.replaceNode(sourceFile, insertionSite, cloneWithModifier); } function getFixableErrorSpanDeclaration(sourceFile, span) { @@ -152811,7 +153854,7 @@ var ts; ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type.code, ts.Diagnostics.Operator_0_cannot_be_applied_to_type_1.code, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2.code, - ts.Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap.code, + ts.Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap.code, ts.Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined.code, ts.Diagnostics.Type_0_is_not_an_array_type.code, ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type.code, @@ -152909,7 +153952,7 @@ var ts; } var declaration = ts.tryCast(symbol.valueDeclaration, ts.isVariableDeclaration); var variableName = declaration && ts.tryCast(declaration.name, ts.isIdentifier); - var variableStatement = ts.getAncestor(declaration, 237 /* SyntaxKind.VariableStatement */); + var variableStatement = ts.getAncestor(declaration, 240 /* SyntaxKind.VariableStatement */); if (!declaration || !variableStatement || declaration.type || !declaration.initializer || @@ -152987,10 +154030,10 @@ var ts; function isInsideAwaitableBody(node) { return node.kind & 32768 /* NodeFlags.AwaitContext */ || !!ts.findAncestor(node, function (ancestor) { return ancestor.parent && ts.isArrowFunction(ancestor.parent) && ancestor.parent.body === ancestor || - ts.isBlock(ancestor) && (ancestor.parent.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - ancestor.parent.kind === 213 /* SyntaxKind.FunctionExpression */ || - ancestor.parent.kind === 214 /* SyntaxKind.ArrowFunction */ || - ancestor.parent.kind === 169 /* SyntaxKind.MethodDeclaration */); + ts.isBlock(ancestor) && (ancestor.parent.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + ancestor.parent.kind === 215 /* SyntaxKind.FunctionExpression */ || + ancestor.parent.kind === 216 /* SyntaxKind.ArrowFunction */ || + ancestor.parent.kind === 171 /* SyntaxKind.MethodDeclaration */); }); } function makeChange(changeTracker, errorCode, sourceFile, checker, insertionSite, fixedDeclarations) { @@ -153109,10 +154152,10 @@ var ts; function isPossiblyPartOfDestructuring(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return true; default: return false; @@ -153127,7 +154170,7 @@ var ts; function isPossiblyPartOfCommaSeperatedInitializer(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: case 27 /* SyntaxKind.CommaToken */: return true; default: @@ -153176,9 +154219,9 @@ var ts; return; } var declaration = token.parent; - if (declaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + if (declaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ && (!fixedNodes || ts.tryAddToSet(fixedNodes, declaration))) { - changeTracker.insertModifierBefore(sourceFile, 135 /* SyntaxKind.DeclareKeyword */, declaration); + changeTracker.insertModifierBefore(sourceFile, 136 /* SyntaxKind.DeclareKeyword */, declaration); } } })(codefix = ts.codefix || (ts.codefix = {})); @@ -153332,7 +154375,7 @@ var ts; var add = toAdd_1[_i]; var d = add.valueDeclaration; if (d && (ts.isPropertySignature(d) || ts.isPropertyDeclaration(d)) && d.type) { - var t = ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], d.type.kind === 187 /* SyntaxKind.UnionType */ ? d.type.types : [d.type], true), [ + var t = ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], d.type.kind === 189 /* SyntaxKind.UnionType */ ? d.type.types : [d.type], true), [ ts.factory.createTypeReferenceNode("undefined") ], false)); changes.replaceNode(d.getSourceFile(), d.type, t); @@ -153412,26 +154455,26 @@ var ts; } function isDeclarationWithType(node) { return ts.isFunctionLikeDeclaration(node) || - node.kind === 254 /* SyntaxKind.VariableDeclaration */ || - node.kind === 166 /* SyntaxKind.PropertySignature */ || - node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + node.kind === 257 /* SyntaxKind.VariableDeclaration */ || + node.kind === 168 /* SyntaxKind.PropertySignature */ || + node.kind === 169 /* SyntaxKind.PropertyDeclaration */; } function transformJSDocType(node) { switch (node.kind) { - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return ts.factory.createTypeReferenceNode("any", ts.emptyArray); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return transformJSDocOptionalType(node); - case 315 /* SyntaxKind.JSDocNonNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: return transformJSDocType(node.type); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return transformJSDocNullableType(node); - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return transformJSDocVariadicType(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return transformJSDocFunctionType(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return transformJSDocTypeReference(node); default: var visited = ts.visitEachChild(node, transformJSDocType, ts.nullTransformationContext); @@ -153452,11 +154495,11 @@ var ts; var _a; // TODO: This does not properly handle `function(new:C, string)` per https://github.com/google/closure-compiler/wiki/Types-in-the-Closure-Type-System#the-javascript-type-language // however we do handle it correctly in `serializeTypeForDeclaration` in checker.ts - return ts.factory.createFunctionTypeNode(ts.emptyArray, node.parameters.map(transformJSDocParameter), (_a = node.type) !== null && _a !== void 0 ? _a : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + return ts.factory.createFunctionTypeNode(ts.emptyArray, node.parameters.map(transformJSDocParameter), (_a = node.type) !== null && _a !== void 0 ? _a : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } function transformJSDocParameter(node) { var index = node.parent.parameters.indexOf(node); - var isRest = node.type.kind === 318 /* SyntaxKind.JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217 + var isRest = node.type.kind === 321 /* SyntaxKind.JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217 var name = node.name || (isRest ? "rest" : "arg" + index); var dotdotdot = isRest ? ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */) : node.dotDotDotToken; return ts.factory.createParameterDeclaration(node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer); @@ -153495,8 +154538,8 @@ var ts; function transformJSDocIndexSignature(node) { var index = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, - /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */ ? "n" : "s", - /*questionToken*/ undefined, ts.factory.createTypeReferenceNode(node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */ ? "number" : "string", []), + /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */ ? "n" : "s", + /*questionToken*/ undefined, ts.factory.createTypeReferenceNode(node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */ ? "number" : "string", []), /*initializer*/ undefined); var indexSignature = ts.factory.createTypeLiteralNode([ts.factory.createIndexSignature(/*modifiers*/ undefined, [index], node.typeArguments[1])]); ts.setEmitFlags(indexSignature, 1 /* EmitFlags.SingleLine */); @@ -153531,8 +154574,8 @@ var ts; return undefined; } var ctorDeclaration = ctorSymbol.valueDeclaration; - if (ts.isFunctionDeclaration(ctorDeclaration)) { - changes.replaceNode(sourceFile, ctorDeclaration, createClassFromFunctionDeclaration(ctorDeclaration)); + if (ts.isFunctionDeclaration(ctorDeclaration) || ts.isFunctionExpression(ctorDeclaration)) { + changes.replaceNode(sourceFile, ctorDeclaration, createClassFromFunction(ctorDeclaration)); } else if (ts.isVariableDeclaration(ctorDeclaration)) { var classDeclaration = createClassFromVariableDeclaration(ctorDeclaration); @@ -153636,7 +154679,7 @@ var ts; return; } // delete the entire statement if this expression is the sole expression to take care of the semicolon at the end - var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ + var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ ? assignmentBinaryExpression.parent : assignmentBinaryExpression; changes.delete(sourceFile, nodeToDelete); if (!assignmentExpr) { @@ -153688,7 +154731,7 @@ var ts; return createArrowFunctionExpressionMember(members, expression, name); } function createFunctionExpressionMember(members, functionExpression, name) { - var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 131 /* SyntaxKind.AsyncKeyword */)); + var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 132 /* SyntaxKind.AsyncKeyword */)); var method = ts.factory.createMethodDeclaration(fullModifiers, /*asteriskToken*/ undefined, name, /*questionToken*/ undefined, /*typeParameters*/ undefined, functionExpression.parameters, /*type*/ undefined, functionExpression.body); ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile); @@ -153699,14 +154742,14 @@ var ts; var arrowFunctionBody = arrowFunction.body; var bodyBlock; // case 1: () => { return [1,2,3] } - if (arrowFunctionBody.kind === 235 /* SyntaxKind.Block */) { + if (arrowFunctionBody.kind === 238 /* SyntaxKind.Block */) { bodyBlock = arrowFunctionBody; } // case 2: () => [1,2,3] else { bodyBlock = ts.factory.createBlock([ts.factory.createReturnStatement(arrowFunctionBody)]); } - var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 131 /* SyntaxKind.AsyncKeyword */)); + var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 132 /* SyntaxKind.AsyncKeyword */)); var method = ts.factory.createMethodDeclaration(fullModifiers, /*asteriskToken*/ undefined, name, /*questionToken*/ undefined, /*typeParameters*/ undefined, arrowFunction.parameters, /*type*/ undefined, bodyBlock); ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile); @@ -153729,7 +154772,7 @@ var ts; // Don't call copyComments here because we'll already leave them in place return cls; } - function createClassFromFunctionDeclaration(node) { + function createClassFromFunction(node) { var memberElements = createClassElementsFromSymbol(ctorSymbol); if (node.body) { memberElements.unshift(ts.factory.createConstructorDeclaration(/*modifiers*/ undefined, node.parameters, node.body)); @@ -153819,7 +154862,7 @@ var ts; return; } var pos = ts.skipTrivia(sourceFile.text, ts.moveRangePastModifiers(functionToConvert).pos); - changes.insertModifierAt(sourceFile, pos, 131 /* SyntaxKind.AsyncKeyword */, { suffix: " " }); + changes.insertModifierAt(sourceFile, pos, 132 /* SyntaxKind.AsyncKeyword */, { suffix: " " }); var _loop_12 = function (returnStatement) { ts.forEachChild(returnStatement, function visit(node) { if (ts.isCallExpression(node)) { @@ -154225,7 +155268,7 @@ var ts; case 104 /* SyntaxKind.NullKeyword */: // do not produce a transformed statement for a null argument break; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: case 79 /* SyntaxKind.Identifier */: // identifier includes undefined if (!inputArgName) { // undefined was argument passed to promise handler @@ -154247,8 +155290,8 @@ var ts; continuationArgName.types.push(transformer.checker.getAwaitedType(returnType) || returnType); } return varDeclOrAssignment; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: { + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: { var funcBody = func.body; var returnType_1 = (_a = getLastCallSignature(transformer.checker.getTypeAtLocation(func), transformer.checker)) === null || _a === void 0 ? void 0 : _a.getReturnType(); // Arrow functions with block bodies { } will enter this control flow @@ -154417,7 +155460,7 @@ var ts; name = getMapEntryOrDefault(funcNode.name); } // return undefined argName when arg is null or undefined - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (!name || "identifier" in name && name.identifier.text === "undefined") { return undefined; } @@ -154526,10 +155569,10 @@ var ts; } var importNode = ts.importFromModuleSpecifier(moduleSpecifier); switch (importNode.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: changes.replaceNode(importingFile, importNode, ts.makeImport(importNode.name, /*namedImports*/ undefined, moduleSpecifier, quotePreference)); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isRequireCall(importNode, /*checkArgumentIsStringLiteralLike*/ false)) { changes.replaceNode(importingFile, importNode, ts.factory.createPropertyAccessExpression(ts.getSynthesizedDeepClone(importNode), "default")); } @@ -154596,20 +155639,20 @@ var ts; } function convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports, useSitesToUnqualify, quotePreference) { switch (statement.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target, quotePreference); return false; - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; switch (expression.kind) { - case 208 /* SyntaxKind.CallExpression */: { + case 210 /* SyntaxKind.CallExpression */: { if (ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true)) { // For side-effecting require() call, just make a side-effecting import. changes.replaceNode(sourceFile, statement, ts.makeImport(/*name*/ undefined, /*namedImports*/ undefined, expression.arguments[0], quotePreference)); } return false; } - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var operatorToken = expression.operatorToken; return operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && convertAssignment(sourceFile, checker, expression, changes, exports, useSitesToUnqualify); } @@ -154658,8 +155701,8 @@ var ts; /** Converts `const name = require("moduleSpecifier").propertyName` */ function convertPropertyAccessImport(name, propertyName, moduleSpecifier, identifiers, quotePreference) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: { // `const [a, b] = require("c").d` --> `import { d } from "c"; const [a, b] = d;` var tmp = makeUniqueName(propertyName, identifiers); return convertedImports([ @@ -154710,16 +155753,16 @@ var ts; function tryChangeModuleExportsObject(object, useSitesToUnqualify) { var statements = ts.mapAllOrFail(object.properties, function (prop) { switch (prop.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // TODO: Maybe we should handle this? See fourslash test `refactorConvertToEs6Module_export_object_shorthand.ts`. // falls through - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return undefined; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return !ts.isIdentifier(prop.name) ? undefined : convertExportsDotXEquals_replaceNode(prop.name.text, prop.initializer, useSitesToUnqualify); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return !ts.isIdentifier(prop.name) ? undefined : functionExpressionToDeclaration(prop.name.text, [ts.factory.createToken(93 /* SyntaxKind.ExportKeyword */)], prop, useSitesToUnqualify); default: ts.Debug.assertNever(prop, "Convert to ES6 got invalid prop kind ".concat(prop.kind)); @@ -154783,7 +155826,7 @@ var ts; function convertExportsDotXEquals_replaceNode(name, exported, useSitesToUnqualify) { var modifiers = [ts.factory.createToken(93 /* SyntaxKind.ExportKeyword */)]; switch (exported.kind) { - case 213 /* SyntaxKind.FunctionExpression */: { + case 215 /* SyntaxKind.FunctionExpression */: { var expressionName = exported.name; if (expressionName && expressionName.text !== name) { // `exports.f = function g() {}` -> `export const f = function g() {}` @@ -154791,10 +155834,10 @@ var ts; } } // falls through - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // `exports.f = function() {}` --> `export function f() {}` return functionExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: // `exports.C = class {}` --> `export class C {}` return classExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify); default: @@ -154814,7 +155857,7 @@ var ts; : ts.getSynthesizedDeepCloneWithReplacements(nodeOrNodes, /*includeTrivia*/ true, replaceNode); function replaceNode(original) { // We are replacing `mod.SomeExport` wih `SomeExport`, so we only need to look at PropertyAccessExpressions - if (original.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (original.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var replacement = useSitesToUnqualify.get(original); // Remove entry from `useSitesToUnqualify` so the refactor knows it's taken care of by the parent statement we're replacing useSitesToUnqualify.delete(original); @@ -154829,7 +155872,7 @@ var ts; */ function convertSingleImport(name, moduleSpecifier, checker, identifiers, target, quotePreference) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: { var importSpecifiers = ts.mapAllOrFail(name.elements, function (e) { return e.dotDotDotToken || e.initializer || e.propertyName && !ts.isIdentifier(e.propertyName) || !ts.isIdentifier(e.name) ? undefined @@ -154840,7 +155883,7 @@ var ts; } } // falls through -- object destructuring has an interesting pattern and must be a variable declaration - case 202 /* SyntaxKind.ArrayBindingPattern */: { + case 204 /* SyntaxKind.ArrayBindingPattern */: { /* import x from "x"; const [a, b, c] = x; @@ -154933,11 +155976,11 @@ var ts; function isFreeIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return parent.name !== node; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return parent.propertyName !== node; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return parent.propertyName !== node; default: return true; @@ -155048,7 +156091,7 @@ var ts; var exportDeclaration = exportClause.parent; var typeExportSpecifiers = getTypeExportSpecifiers(exportSpecifier, context); if (typeExportSpecifiers.length === exportClause.elements.length) { - changes.insertModifierBefore(context.sourceFile, 152 /* SyntaxKind.TypeKeyword */, exportClause); + changes.insertModifierBefore(context.sourceFile, 154 /* SyntaxKind.TypeKeyword */, exportClause); } else { var valueExportDeclaration = ts.factory.updateExportDeclaration(exportDeclaration, exportDeclaration.modifiers, @@ -155284,27 +156327,29 @@ var ts; errorCodes: errorCodes, getCodeActions: function (context) { var errorCode = context.errorCode, preferences = context.preferences, sourceFile = context.sourceFile, span = context.span, program = context.program; - var info = getFixesInfo(context, errorCode, span.start, /*useAutoImportProvider*/ true); + var info = getFixInfos(context, errorCode, span.start, /*useAutoImportProvider*/ true); if (!info) return undefined; - var fixes = info.fixes, symbolName = info.symbolName, errorIdentifierText = info.errorIdentifierText; var quotePreference = ts.getQuotePreference(sourceFile, preferences); - return fixes.map(function (fix) { return codeActionForFix(context, sourceFile, symbolName, fix, - /*includeSymbolNameInDescription*/ symbolName !== errorIdentifierText, quotePreference, program.getCompilerOptions()); }); + return info.map(function (_a) { + var fix = _a.fix, symbolName = _a.symbolName, errorIdentifierText = _a.errorIdentifierText; + return codeActionForFix(context, sourceFile, symbolName, fix, + /*includeSymbolNameInDescription*/ symbolName !== errorIdentifierText, quotePreference, program.getCompilerOptions()); + }); }, fixIds: [importFixId], getAllCodeActions: function (context) { - var sourceFile = context.sourceFile, program = context.program, preferences = context.preferences, host = context.host; - var importAdder = createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ true, preferences, host); + var sourceFile = context.sourceFile, program = context.program, preferences = context.preferences, host = context.host, cancellationToken = context.cancellationToken; + var importAdder = createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ true, preferences, host, cancellationToken); codefix.eachDiagnostic(context, errorCodes, function (diag) { return importAdder.addImportFromDiagnostic(diag, context); }); return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, importAdder.writeFixes)); }, }); - function createImportAdder(sourceFile, program, preferences, host) { - return createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ false, preferences, host); + function createImportAdder(sourceFile, program, preferences, host, cancellationToken) { + return createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ false, preferences, host, cancellationToken); } codefix.createImportAdder = createImportAdder; - function createImportAdderWorker(sourceFile, program, useAutoImportProvider, preferences, host) { + function createImportAdderWorker(sourceFile, program, useAutoImportProvider, preferences, host, cancellationToken) { var compilerOptions = program.getCompilerOptions(); // Namespace fixes don't conflict, so just build a list. var addToNamespace = []; @@ -155315,27 +156360,26 @@ var ts; var newImports = new ts.Map(); return { addImportFromDiagnostic: addImportFromDiagnostic, addImportFromExportedSymbol: addImportFromExportedSymbol, writeFixes: writeFixes, hasFixes: hasFixes }; function addImportFromDiagnostic(diagnostic, context) { - var info = getFixesInfo(context, diagnostic.code, diagnostic.start, useAutoImportProvider); - if (!info || !info.fixes.length) + var info = getFixInfos(context, diagnostic.code, diagnostic.start, useAutoImportProvider); + if (!info || !info.length) return; - addImport(info); + addImport(ts.first(info)); } function addImportFromExportedSymbol(exportedSymbol, isValidTypeOnlyUseSite) { var moduleSymbol = ts.Debug.checkDefined(exportedSymbol.parent); var symbolName = ts.getNameForExportedSymbol(exportedSymbol, ts.getEmitScriptTarget(compilerOptions)); var checker = program.getTypeChecker(); var symbol = checker.getMergedSymbol(ts.skipAlias(exportedSymbol, checker)); - var exportInfo = getAllReExportingModules(sourceFile, symbol, moduleSymbol, symbolName, /*isJsxTagName*/ false, host, program, preferences, useAutoImportProvider); + var exportInfo = getAllExportInfoForSymbol(sourceFile, symbol, symbolName, /*isJsxTagName*/ false, program, host, preferences, cancellationToken); var useRequire = shouldUseRequire(sourceFile, program); - var fix = getImportFixForSymbol(sourceFile, exportInfo, moduleSymbol, program, /*useNamespaceInfo*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences); + var fix = getImportFixForSymbol(sourceFile, ts.Debug.checkDefined(exportInfo), moduleSymbol, program, /*useNamespaceInfo*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences); if (fix) { - addImport({ fixes: [fix], symbolName: symbolName, errorIdentifierText: undefined }); + addImport({ fix: fix, symbolName: symbolName, errorIdentifierText: undefined }); } } function addImport(info) { var _a, _b; - var fixes = info.fixes, symbolName = info.symbolName; - var fix = ts.first(fixes); + var fix = info.fix, symbolName = info.symbolName; switch (fix.kind) { case 0 /* ImportFixKind.UseNamespace */: addToNamespace.push(fix); @@ -155502,11 +156546,12 @@ var ts; AddAsTypeOnly[AddAsTypeOnly["Required"] = 2] = "Required"; AddAsTypeOnly[AddAsTypeOnly["NotAllowed"] = 4] = "NotAllowed"; })(AddAsTypeOnly || (AddAsTypeOnly = {})); - function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, isJsxTagName, host, program, formatContext, position, preferences) { + function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) { var compilerOptions = program.getCompilerOptions(); var exportInfos = ts.pathIsBareSpecifier(ts.stripQuotes(moduleSymbol.name)) - ? [getSymbolExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)] - : getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, isJsxTagName, host, program, preferences, /*useAutoImportProvider*/ true); + ? [getSingleExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)] + : getAllExportInfoForSymbol(sourceFile, targetSymbol, symbolName, isJsxTagName, program, host, preferences, cancellationToken); + ts.Debug.assertIsDefined(exportInfos); var useRequire = shouldUseRequire(sourceFile, program); var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(ts.getTokenAtPosition(sourceFile, position)); var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, { symbolName: symbolName, position: position }, isValidTypeOnlyUseSite, useRequire, host, preferences)); @@ -155519,7 +156564,7 @@ var ts; codefix.getImportCompletionAction = getImportCompletionAction; function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, host, formatContext, preferences) { var compilerOptions = program.getCompilerOptions(); - var symbolName = getSymbolName(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions); + var symbolName = ts.single(getSymbolNamesToImport(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions)); var fix = getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program); var includeSymbolNameInDescription = symbolName !== symbolToken.text; return fix && codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix, includeSymbolNameInDescription, 1 /* QuotePreference.Double */, compilerOptions)); @@ -155534,7 +156579,16 @@ var ts; var description = _a.description, changes = _a.changes, commands = _a.commands; return { description: description, changes: changes, commands: commands }; } - function getSymbolExportInfoForSymbol(symbol, moduleSymbol, program, host) { + function getAllExportInfoForSymbol(importingFile, symbol, symbolName, preferCapitalized, program, host, preferences, cancellationToken) { + var getChecker = createGetChecker(program, host); + return ts.getExportInfoMap(importingFile, host, program, preferences, cancellationToken) + .search(importingFile.path, preferCapitalized, function (name) { return name === symbolName; }, function (info) { + if (ts.skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol) { + return info; + } + }); + } + function getSingleExportInfoForSymbol(symbol, moduleSymbol, program, host) { var _a, _b; var compilerOptions = program.getCompilerOptions(); var mainProgramInfo = getInfoWithChecker(program.getTypeChecker(), /*isFromPackageJson*/ false); @@ -155554,35 +156608,6 @@ var ts; } } } - function getAllReExportingModules(importingFile, targetSymbol, exportingModuleSymbol, symbolName, isJsxTagName, host, program, preferences, useAutoImportProvider) { - var result = []; - var compilerOptions = program.getCompilerOptions(); - var getModuleSpecifierResolutionHost = ts.memoizeOne(function (isFromPackageJson) { - return ts.createModuleSpecifierResolutionHost(isFromPackageJson ? host.getPackageJsonAutoImportProvider() : program, host); - }); - ts.forEachExternalModuleToImportFrom(program, host, preferences, useAutoImportProvider, function (moduleSymbol, moduleFile, program, isFromPackageJson) { - var checker = program.getTypeChecker(); - // Don't import from a re-export when looking "up" like to `./index` or `../index`. - if (moduleFile && moduleSymbol !== exportingModuleSymbol && ts.startsWith(importingFile.fileName, ts.getDirectoryPath(moduleFile.fileName))) { - return; - } - var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions); - if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions), isJsxTagName) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) { - result.push({ symbol: defaultInfo.symbol, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: defaultInfo.exportKind, targetFlags: ts.skipAlias(defaultInfo.symbol, checker).flags, isFromPackageJson: isFromPackageJson }); - } - for (var _i = 0, _a = checker.getExportsAndPropertiesOfModule(moduleSymbol); _i < _a.length; _i++) { - var exported = _a[_i]; - if (exported.name === symbolName && checker.getMergedSymbol(ts.skipAlias(exported, checker)) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) { - result.push({ symbol: exported, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: 0 /* ExportKind.Named */, targetFlags: ts.skipAlias(exported, checker).flags, isFromPackageJson: isFromPackageJson }); - } - } - }); - return result; - function isImportable(program, moduleFile, isFromPackageJson) { - var _a; - return !moduleFile || ts.isImportableFile(program, importingFile, moduleFile, preferences, /*packageJsonFilter*/ undefined, getModuleSpecifierResolutionHost(isFromPackageJson), (_a = host.getModuleSpecifierCache) === null || _a === void 0 ? void 0 : _a.call(host)); - } - } function getImportFixes(exportInfos, useNamespaceInfo, /** undefined only for missing JSX namespace */ isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap, fromCacheOnly) { @@ -155633,11 +156658,11 @@ var ts; function getTargetModuleFromNamespaceLikeImport(declaration, checker) { var _a; switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checker.resolveExternalModuleName(declaration.initializer.arguments[0]); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return checker.getAliasedSymbol(declaration.symbol); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var namespaceImport = ts.tryCast((_a = declaration.importClause) === null || _a === void 0 ? void 0 : _a.namedBindings, ts.isNamespaceImport); return namespaceImport && checker.getAliasedSymbol(namespaceImport.symbol); default: @@ -155647,11 +156672,11 @@ var ts; function getNamespaceLikeImportText(declaration) { var _a, _b, _c; switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return (_a = ts.tryCast(declaration.name, ts.isIdentifier)) === null || _a === void 0 ? void 0 : _a.text; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return declaration.name.text; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return (_c = ts.tryCast((_b = declaration.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings, ts.isNamespaceImport)) === null || _c === void 0 ? void 0 : _c.name.text; default: return ts.Debug.assertNever(declaration); @@ -155678,12 +156703,12 @@ var ts; function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker, compilerOptions) { return ts.firstDefined(existingImports, function (_a) { var declaration = _a.declaration, importKind = _a.importKind, symbol = _a.symbol, targetFlags = _a.targetFlags; - if (importKind === 3 /* ImportKind.CommonJS */ || importKind === 2 /* ImportKind.Namespace */ || declaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (importKind === 3 /* ImportKind.CommonJS */ || importKind === 2 /* ImportKind.Namespace */ || declaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { // These kinds of imports are not combinable with anything return undefined; } - if (declaration.kind === 254 /* SyntaxKind.VariableDeclaration */) { - return (importKind === 0 /* ImportKind.Named */ || importKind === 1 /* ImportKind.Default */) && declaration.name.kind === 201 /* SyntaxKind.ObjectBindingPattern */ + if (declaration.kind === 257 /* SyntaxKind.VariableDeclaration */) { + return (importKind === 0 /* ImportKind.Named */ || importKind === 1 /* ImportKind.Default */) && declaration.name.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? { kind: 2 /* ImportFixKind.AddToExisting */, importClauseOrBindingPattern: declaration.name, importKind: importKind, moduleSpecifier: declaration.initializer.arguments[0].text, addAsTypeOnly: 4 /* AddAsTypeOnly.NotAllowed */ } : undefined; } @@ -155704,7 +156729,7 @@ var ts; )) return undefined; if (importKind === 0 /* ImportKind.Named */ && - (namedBindings === null || namedBindings === void 0 ? void 0 : namedBindings.kind) === 268 /* SyntaxKind.NamespaceImport */ // Cannot add a named import to a declaration that has a namespace import + (namedBindings === null || namedBindings === void 0 ? void 0 : namedBindings.kind) === 271 /* SyntaxKind.NamespaceImport */ // Cannot add a named import to a declaration that has a namespace import ) return undefined; return { @@ -155727,7 +156752,7 @@ var ts; (importMap || (importMap = ts.createMultiMap())).add(ts.getSymbolId(moduleSymbol), i.parent); } } - else if (i.kind === 266 /* SyntaxKind.ImportDeclaration */ || i.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + else if (i.kind === 269 /* SyntaxKind.ImportDeclaration */ || i.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { var moduleSymbol = checker.getSymbolAtLocation(moduleSpecifier); if (moduleSymbol) { (importMap || (importMap = ts.createMultiMap())).add(ts.getSymbolId(moduleSymbol), i); @@ -155776,11 +156801,14 @@ var ts; // 5. Literally nothing to go on return true; } + function createGetChecker(program, host) { + return ts.memoizeOne(function (isFromPackageJson) { return isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker(); }); + } function getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfo, host, preferences, fromCacheOnly) { var isJs = ts.isSourceFileJS(sourceFile); var compilerOptions = program.getCompilerOptions(); var moduleSpecifierResolutionHost = ts.createModuleSpecifierResolutionHost(program, host); - var getChecker = ts.memoizeOne(function (isFromPackageJson) { return isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker(); }); + var getChecker = createGetChecker(program, host); var rejectNodeModulesRelativePaths = ts.moduleResolutionUsesNodeModules(ts.getEmitModuleResolutionKind(compilerOptions)); var getModuleSpecifiers = fromCacheOnly ? function (moduleSymbol) { return ({ moduleSpecifiers: ts.moduleSpecifiers.tryGetModuleSpecifiersFromCache(moduleSymbol, sourceFile, moduleSpecifierResolutionHost, preferences), computedWithoutCache: false }); } @@ -155824,7 +156852,7 @@ var ts; return { kind: 3 /* ImportFixKind.AddNew */, moduleSpecifier: moduleSpecifier, importKind: importKind, addAsTypeOnly: addAsTypeOnly, useRequire: useRequire }; } } - function getFixesInfo(context, errorCode, pos, useAutoImportProvider) { + function getFixInfos(context, errorCode, pos, useAutoImportProvider) { var symbolToken = ts.getTokenAtPosition(context.sourceFile, pos); var info; if (errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) { @@ -155834,19 +156862,23 @@ var ts; return undefined; } else if (errorCode === ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code) { - var symbolName_1 = getSymbolName(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions()); + var symbolName_1 = ts.single(getSymbolNamesToImport(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions())); var fix = getTypeOnlyPromotionFix(context.sourceFile, symbolToken, symbolName_1, context.program); - return fix && { fixes: [fix], symbolName: symbolName_1, errorIdentifierText: symbolToken.text }; + return fix && [{ fix: fix, symbolName: symbolName_1, errorIdentifierText: symbolToken.text }]; } else { info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider); } var packageJsonImportFilter = ts.createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host); - return info && __assign(__assign({}, info), { fixes: sortFixes(info.fixes, context.sourceFile, context.program, packageJsonImportFilter, context.host) }); + return info && sortFixInfo(info, context.sourceFile, context.program, packageJsonImportFilter, context.host); } - function sortFixes(fixes, sourceFile, program, packageJsonImportFilter, host) { + function sortFixInfo(fixes, sourceFile, program, packageJsonImportFilter, host) { var _toPath = function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), ts.hostGetCanonicalFileName(host)); }; - return ts.sort(fixes, function (a, b) { return ts.compareValues(a.kind, b.kind) || compareModuleSpecifiers(a, b, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath); }); + return ts.sort(fixes, function (a, b) { + return ts.compareBooleans(!!a.isJsxNamespaceFix, !!b.isJsxNamespaceFix) || + ts.compareValues(a.fix.kind, b.fix.kind) || + compareModuleSpecifiers(a.fix, b.fix, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath); + }); } function getBestFix(fixes, sourceFile, program, packageJsonImportFilter, host) { if (!ts.some(fixes)) @@ -155897,7 +156929,6 @@ var ts; return 0 /* Comparison.EqualTo */; } function getFixesInfoForUMDImport(_a, token) { - var _b; var sourceFile = _a.sourceFile, program = _a.program, host = _a.host, preferences = _a.preferences; var checker = program.getTypeChecker(); var umdSymbol = getUmdSymbol(token, checker); @@ -155909,7 +156940,7 @@ var ts; var useRequire = shouldUseRequire(sourceFile, program); var position = ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined; var fixes = getImportFixes(exportInfo, position ? { position: position, symbolName: symbolName } : undefined, /*isValidTypeOnlyUseSite*/ false, useRequire, program, sourceFile, host, preferences).fixes; - return { fixes: fixes, symbolName: symbolName, errorIdentifierText: (_b = ts.tryCast(token, ts.isIdentifier)) === null || _b === void 0 ? void 0 : _b.text }; + return fixes.map(function (fix) { var _a; return ({ fix: fix, symbolName: symbolName, errorIdentifierText: (_a = ts.tryCast(token, ts.isIdentifier)) === null || _a === void 0 ? void 0 : _a.text }); }); } function getUmdSymbol(token, checker) { // try the identifier to see if it is the umd symbol @@ -155970,19 +157001,20 @@ var ts; var sourceFile = _a.sourceFile, program = _a.program, cancellationToken = _a.cancellationToken, host = _a.host, preferences = _a.preferences; var checker = program.getTypeChecker(); var compilerOptions = program.getCompilerOptions(); - var symbolName = getSymbolName(sourceFile, checker, symbolToken, compilerOptions); - // "default" is a keyword and not a legal identifier for the import, but appears as an identifier. - if (symbolName === "default" /* InternalSymbolName.Default */) { - return undefined; - } - var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken); - var useRequire = shouldUseRequire(sourceFile, program); - var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences); - var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) { - var _ = _a[0], exportInfos = _a[1]; - return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes; - })); - return { fixes: fixes, symbolName: symbolName, errorIdentifierText: symbolToken.text }; + return ts.flatMap(getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions), function (symbolName) { + // "default" is a keyword and not a legal identifier for the import, but appears as an identifier. + if (symbolName === "default" /* InternalSymbolName.Default */) { + return undefined; + } + var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken); + var useRequire = shouldUseRequire(sourceFile, program); + var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences); + var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) { + var _ = _a[0], exportInfos = _a[1]; + return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes; + })); + return fixes.map(function (fix) { return ({ fix: fix, symbolName: symbolName, errorIdentifierText: symbolToken.text, isJsxNamespaceFix: symbolName !== symbolToken.text }); }); + }); } function getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program) { var checker = program.getTypeChecker(); @@ -155994,15 +157026,16 @@ var ts; return undefined; return { kind: 4 /* ImportFixKind.PromoteTypeOnly */, typeOnlyAliasDeclaration: typeOnlyAliasDeclaration }; } - function getSymbolName(sourceFile, checker, symbolToken, compilerOptions) { + function getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions) { var parent = symbolToken.parent; if ((ts.isJsxOpeningLikeElement(parent) || ts.isJsxClosingElement(parent)) && parent.tagName === symbolToken && ts.jsxModeNeedsExplicitImport(compilerOptions.jsx)) { var jsxNamespace = checker.getJsxNamespace(sourceFile); if (needsJsxNamespaceFix(jsxNamespace, symbolToken, checker)) { - return jsxNamespace; + var needsComponentNameFix = !ts.isIntrinsicJsxName(symbolToken.text) && !checker.resolveName(symbolToken.text, symbolToken, 111551 /* SymbolFlags.Value */, /*excludeGlobals*/ false); + return needsComponentNameFix ? [symbolToken.text, jsxNamespace] : [jsxNamespace]; } } - return symbolToken.text; + return [symbolToken.text]; } function needsJsxNamespaceFix(jsxNamespace, symbolToken, checker) { if (ts.isIntrinsicJsxName(symbolToken.text)) @@ -156111,7 +157144,7 @@ var ts; case 4 /* ImportFixKind.PromoteTypeOnly */: { var typeOnlyAliasDeclaration = fix.typeOnlyAliasDeclaration; var promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration, compilerOptions, sourceFile); - return promotedDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ + return promotedDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ ? [ts.Diagnostics.Remove_type_from_import_of_0_from_1, symbolName, getModuleSpecifierText(promotedDeclaration.parent.parent)] : [ts.Diagnostics.Remove_type_from_import_declaration_from_0, getModuleSpecifierText(promotedDeclaration)]; } @@ -156121,7 +157154,7 @@ var ts; } function getModuleSpecifierText(promotedDeclaration) { var _a, _b; - return promotedDeclaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ + return promotedDeclaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? ((_b = ts.tryCast((_a = ts.tryCast(promotedDeclaration.moduleReference, ts.isExternalModuleReference)) === null || _a === void 0 ? void 0 : _a.expression, ts.isStringLiteralLike)) === null || _b === void 0 ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText() : ts.cast(promotedDeclaration.parent.moduleSpecifier, ts.isStringLiteral).text; } @@ -156129,7 +157162,7 @@ var ts; // See comment in `doAddExistingFix` on constant with the same name. var convertExistingToTypeOnly = compilerOptions.preserveValueImports && compilerOptions.isolatedModules; switch (aliasDeclaration.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: if (aliasDeclaration.isTypeOnly) { if (aliasDeclaration.parent.elements.length > 1 && ts.OrganizeImports.importSpecifiersAreSorted(aliasDeclaration.parent.elements)) { changes.delete(sourceFile, aliasDeclaration); @@ -156147,13 +157180,13 @@ var ts; promoteImportClause(aliasDeclaration.parent.parent); return aliasDeclaration.parent.parent; } - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: promoteImportClause(aliasDeclaration); return aliasDeclaration; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: promoteImportClause(aliasDeclaration.parent); return aliasDeclaration.parent; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: changes.deleteRange(sourceFile, aliasDeclaration.getChildAt(1)); return aliasDeclaration; default: @@ -156165,7 +157198,7 @@ var ts; var namedImports = ts.tryCast(importClause.namedBindings, ts.isNamedImports); if (namedImports && namedImports.elements.length > 1) { if (ts.OrganizeImports.importSpecifiersAreSorted(namedImports.elements) && - aliasDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ && + aliasDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ && namedImports.elements.indexOf(aliasDeclaration) !== 0) { // The import specifier being promoted will be the only non-type-only, // import in the NamedImports, so it should be moved to the front. @@ -156175,7 +157208,7 @@ var ts; for (var _i = 0, _a = namedImports.elements; _i < _a.length; _i++) { var element = _a[_i]; if (element !== aliasDeclaration && !element.isTypeOnly) { - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, element); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, element); } } } @@ -156184,7 +157217,7 @@ var ts; } function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImports, compilerOptions) { var _a; - if (clause.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (clause.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (defaultImport) { addElementToBindingPattern(clause, defaultImport.name, "default"); } @@ -156245,7 +157278,7 @@ var ts; if (convertExistingToTypeOnly && existingSpecifiers) { for (var _d = 0, existingSpecifiers_1 = existingSpecifiers; _d < existingSpecifiers_1.length; _d++) { var specifier = existingSpecifiers_1[_d]; - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, specifier); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, specifier); } } } @@ -156420,7 +157453,7 @@ var ts; var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; }); if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined) return; - var declaration = findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); + var declaration = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); if (declaration === undefined) return; if (ts.isIdentifier(declaration) && ts.isTypeParameterDeclaration(declaration.parent)) { @@ -156454,14 +157487,6 @@ var ts; } } } - function findAncestorMatchingSpan(sourceFile, span) { - var end = ts.textSpanEnd(span); - var token = ts.getTokenAtPosition(sourceFile, span.start); - while (token.end < end) { - token = token.parent; - } - return token; - } function tryGetConstraintFromDiagnosticMessage(messageText) { var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/`extends (.*)`/) || [], _ = _a[0], constraint = _a[1]; return constraint; @@ -156605,7 +157630,7 @@ var ts; accessibilityModifier ? accessibilityModifier.end : lastDecorator ? ts.skipTrivia(sourceFile.text, lastDecorator.end) : classElement.getStart(sourceFile); var options = accessibilityModifier || staticModifier || abstractModifier ? { prefix: " " } : { suffix: " " }; - changeTracker.insertModifierAt(sourceFile, modifierPos, 159 /* SyntaxKind.OverrideKeyword */, options); + changeTracker.insertModifierAt(sourceFile, modifierPos, 161 /* SyntaxKind.OverrideKeyword */, options); } function doRemoveOverrideModifierChange(changeTracker, sourceFile, pos) { var classElement = findContainerClassElementLike(sourceFile, pos); @@ -156619,13 +157644,13 @@ var ts; } function isClassElementLikeHasJSDoc(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return ts.isParameterPropertyDeclaration(node, node.parent); default: return false; @@ -156757,7 +157782,7 @@ var ts; }); function getNamedTupleMember(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); - return ts.findAncestor(token, function (t) { return t.kind === 197 /* SyntaxKind.NamedTupleMember */; }); + return ts.findAncestor(token, function (t) { return t.kind === 199 /* SyntaxKind.NamedTupleMember */; }); } function doChange(changes, sourceFile, namedTupleMember) { if (!namedTupleMember) { @@ -156766,11 +157791,11 @@ var ts; var unwrappedType = namedTupleMember.type; var sawOptional = false; var sawRest = false; - while (unwrappedType.kind === 185 /* SyntaxKind.OptionalType */ || unwrappedType.kind === 186 /* SyntaxKind.RestType */ || unwrappedType.kind === 191 /* SyntaxKind.ParenthesizedType */) { - if (unwrappedType.kind === 185 /* SyntaxKind.OptionalType */) { + while (unwrappedType.kind === 187 /* SyntaxKind.OptionalType */ || unwrappedType.kind === 188 /* SyntaxKind.RestType */ || unwrappedType.kind === 193 /* SyntaxKind.ParenthesizedType */) { + if (unwrappedType.kind === 187 /* SyntaxKind.OptionalType */) { sawOptional = true; } - else if (unwrappedType.kind === 186 /* SyntaxKind.RestType */) { + else if (unwrappedType.kind === 188 /* SyntaxKind.RestType */) { sawRest = true; } unwrappedType = unwrappedType.type; @@ -157041,7 +158066,7 @@ var ts; if (isFunctionType) { var sig = checker.getSignatureFromDeclaration(declaration); if (sig) { - if (ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Async */)) { + if (ts.hasSyntacticModifier(declaration, 512 /* ModifierFlags.Async */)) { exprType = checker.createPromiseType(exprType); } var newSig = checker.createSignature(declaration, sig.typeParameters, sig.thisParameter, sig.parameters, exprType, @@ -157085,19 +158110,19 @@ var ts; } function getVariableLikeInitializer(declaration) { switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: return declaration.initializer; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return declaration.initializer && (ts.isJsxExpression(declaration.initializer) ? declaration.initializer.expression : undefined); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 166 /* SyntaxKind.PropertySignature */: - case 299 /* SyntaxKind.EnumMember */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 168 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return undefined; } } @@ -157151,6 +158176,15 @@ var ts; ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code, ts.Diagnostics.Cannot_find_name_0.code ]; + var InfoKind; + (function (InfoKind) { + InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration"; + InfoKind[InfoKind["Enum"] = 1] = "Enum"; + InfoKind[InfoKind["Function"] = 2] = "Function"; + InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral"; + InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes"; + InfoKind[InfoKind["Signature"] = 5] = "Signature"; + })(InfoKind || (InfoKind = {})); codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { @@ -157159,19 +158193,19 @@ var ts; if (!info) { return undefined; } - if (info.kind === 3 /* InfoKind.ObjectLiteral */) { + if (info.kind === InfoKind.ObjectLiteral) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addObjectLiteralProperties(t, context, info); }); return [codefix.createCodeFixAction(fixMissingProperties, changes, ts.Diagnostics.Add_missing_properties, fixMissingProperties, ts.Diagnostics.Add_all_missing_properties)]; } - if (info.kind === 4 /* InfoKind.JsxAttributes */) { + if (info.kind === InfoKind.JsxAttributes) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addJsxAttributes(t, context, info); }); return [codefix.createCodeFixAction(fixMissingAttributes, changes, ts.Diagnostics.Add_missing_attributes, fixMissingAttributes, ts.Diagnostics.Add_all_missing_attributes)]; } - if (info.kind === 2 /* InfoKind.Function */) { + if (info.kind === InfoKind.Function || info.kind === InfoKind.Signature) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addFunctionDeclaration(t, context, info); }); return [codefix.createCodeFixAction(fixMissingFunctionDeclaration, changes, [ts.Diagnostics.Add_missing_function_declaration_0, info.token.text], fixMissingFunctionDeclaration, ts.Diagnostics.Add_all_missing_function_declarations)]; } - if (info.kind === 1 /* InfoKind.Enum */) { + if (info.kind === InfoKind.Enum) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addEnumMemberDeclaration(t, context.program.getTypeChecker(), info); }); return [codefix.createCodeFixAction(fixMissingMember, changes, [ts.Diagnostics.Add_missing_enum_member_0, info.token.text], fixMissingMember, ts.Diagnostics.Add_all_missing_members)]; } @@ -157189,20 +158223,20 @@ var ts; if (!info || !ts.addToSeen(seen, ts.getNodeId(info.parentDeclaration) + "#" + info.token.text)) { return; } - if (fixId === fixMissingFunctionDeclaration && info.kind === 2 /* InfoKind.Function */) { + if (fixId === fixMissingFunctionDeclaration && (info.kind === InfoKind.Function || info.kind === InfoKind.Signature)) { addFunctionDeclaration(changes, context, info); } - else if (fixId === fixMissingProperties && info.kind === 3 /* InfoKind.ObjectLiteral */) { + else if (fixId === fixMissingProperties && info.kind === InfoKind.ObjectLiteral) { addObjectLiteralProperties(changes, context, info); } - else if (fixId === fixMissingAttributes && info.kind === 4 /* InfoKind.JsxAttributes */) { + else if (fixId === fixMissingAttributes && info.kind === InfoKind.JsxAttributes) { addJsxAttributes(changes, context, info); } else { - if (info.kind === 1 /* InfoKind.Enum */) { + if (info.kind === InfoKind.Enum) { addEnumMemberDeclaration(changes, checker, info); } - if (info.kind === 0 /* InfoKind.TypeLikeDeclaration */) { + if (info.kind === InfoKind.TypeLikeDeclaration) { var parentDeclaration = info.parentDeclaration, token_1 = info.token; var infos = ts.getOrUpdate(typeDeclToMembers, parentDeclaration, function () { return []; }); if (!infos.some(function (i) { return i.token.text === token_1.text; })) { @@ -157246,14 +158280,6 @@ var ts; })); }, }); - var InfoKind; - (function (InfoKind) { - InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration"; - InfoKind[InfoKind["Enum"] = 1] = "Enum"; - InfoKind[InfoKind["Function"] = 2] = "Function"; - InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral"; - InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes"; - })(InfoKind || (InfoKind = {})); function getInfo(sourceFile, tokenPos, errorCode, checker, program) { // The identifier of the missing property. eg: // this.missing = 1; @@ -157275,7 +158301,7 @@ var ts; var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent), checker.getParameterType(signature, argIndex), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false)); if (!ts.length(properties)) return undefined; - return { kind: 3 /* InfoKind.ObjectLiteral */, token: param.name, properties: properties, parentDeclaration: parent }; + return { kind: InfoKind.ObjectLiteral, token: param.name, properties: properties, parentDeclaration: parent }; } if (!ts.isMemberName(token)) return undefined; @@ -157283,17 +158309,26 @@ var ts; var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent.initializer), checker.getTypeAtLocation(token), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false)); if (!ts.length(properties)) return undefined; - return { kind: 3 /* InfoKind.ObjectLiteral */, token: token, properties: properties, parentDeclaration: parent.initializer }; + return { kind: InfoKind.ObjectLiteral, token: token, properties: properties, parentDeclaration: parent.initializer }; } if (ts.isIdentifier(token) && ts.isJsxOpeningLikeElement(token.parent)) { var target = ts.getEmitScriptTarget(program.getCompilerOptions()); var attributes = getUnmatchedAttributes(checker, target, token.parent); if (!ts.length(attributes)) return undefined; - return { kind: 4 /* InfoKind.JsxAttributes */, token: token, attributes: attributes, parentDeclaration: token.parent }; + return { kind: InfoKind.JsxAttributes, token: token, attributes: attributes, parentDeclaration: token.parent }; } - if (ts.isIdentifier(token) && ts.isCallExpression(parent) && parent.expression === token) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* ModifierFlags.None */, parentDeclaration: sourceFile }; + if (ts.isIdentifier(token)) { + var type = checker.getContextualType(token); + if (type && ts.getObjectFlags(type) & 16 /* ObjectFlags.Anonymous */) { + var signature = ts.firstOrUndefined(checker.getSignaturesOfType(type, 0 /* SignatureKind.Call */)); + if (signature === undefined) + return undefined; + return { kind: InfoKind.Signature, token: token, signature: signature, sourceFile: sourceFile, parentDeclaration: findScope(token) }; + } + if (ts.isCallExpression(parent) && parent.expression === token) { + return { kind: InfoKind.Function, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* ModifierFlags.None */, parentDeclaration: findScope(token) }; + } } if (!ts.isPropertyAccessExpression(parent)) return undefined; @@ -157305,13 +158340,13 @@ var ts; var moduleDeclaration = ts.find(symbol.declarations, ts.isModuleDeclaration); var moduleDeclarationSourceFile = moduleDeclaration === null || moduleDeclaration === void 0 ? void 0 : moduleDeclaration.getSourceFile(); if (moduleDeclaration && moduleDeclarationSourceFile && !isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent.parent, sourceFile: sourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleDeclaration }; + return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: sourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleDeclaration }; } var moduleSourceFile = ts.find(symbol.declarations, ts.isSourceFile); if (sourceFile.commonJsModuleIndicator) return undefined; if (moduleSourceFile && !isSourceFileFromLibrary(program, moduleSourceFile)) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleSourceFile }; + return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleSourceFile }; } } var classDeclaration = ts.find(symbol.declarations, ts.isClassLike); @@ -157329,11 +158364,11 @@ var ts; (makeStatic ? 32 /* ModifierFlags.Static */ : 0 /* ModifierFlags.None */) | (ts.startsWithUnderscore(token.text) ? 8 /* ModifierFlags.Private */ : 0 /* ModifierFlags.None */); var isJSFile = ts.isSourceFileJS(declSourceFile); var call = ts.tryCast(parent.parent, ts.isCallExpression); - return { kind: 0 /* InfoKind.TypeLikeDeclaration */, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile }; + 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())) { - return { kind: 1 /* InfoKind.Enum */, token: token, parentDeclaration: enumDeclaration }; + return { kind: InfoKind.Enum, token: token, parentDeclaration: enumDeclaration }; } return undefined; } @@ -157360,7 +158395,7 @@ var ts; function addMissingMemberInJs(changeTracker, sourceFile, classDeclaration, token, makeStatic) { var tokenName = token.text; if (makeStatic) { - if (classDeclaration.kind === 226 /* SyntaxKind.ClassExpression */) { + if (classDeclaration.kind === 228 /* SyntaxKind.ClassExpression */) { return; } var className = classDeclaration.name.getText(); @@ -157411,7 +158446,7 @@ var ts; } function getTypeNode(checker, node, token) { var typeNode; - if (token.parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (token.parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */) { var binaryExpression = token.parent.parent; var otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left; var widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression))); @@ -157421,7 +158456,7 @@ var ts; var contextualType = checker.getContextualType(token.parent); typeNode = contextualType ? checker.typeToTypeNode(contextualType, /*enclosingDeclaration*/ undefined, 1 /* NodeBuilderFlags.NoTruncation */) : undefined; } - return typeNode || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return typeNode || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } function addPropertyDeclaration(changeTracker, sourceFile, node, tokenName, typeNode, modifierFlags) { var modifiers = modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; @@ -157449,7 +158484,7 @@ var ts; } function createAddIndexSignatureAction(context, sourceFile, node, tokenName, typeNode) { // Index signatures cannot have the static modifier. - var stringTypeNode = ts.factory.createKeywordTypeNode(150 /* SyntaxKind.StringKeyword */); + var stringTypeNode = ts.factory.createKeywordTypeNode(152 /* SyntaxKind.StringKeyword */); var indexingParameter = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "x", @@ -157480,7 +158515,7 @@ var ts; } function addMethodDeclaration(context, changes, callExpression, name, modifierFlags, parentDeclaration, sourceFile) { var importAdder = codefix.createImportAdder(sourceFile, context.program, context.preferences, context.host); - var kind = ts.isClassLike(parentDeclaration) ? 169 /* SyntaxKind.MethodDeclaration */ : 168 /* SyntaxKind.MethodSignature */; + var kind = ts.isClassLike(parentDeclaration) ? 171 /* SyntaxKind.MethodDeclaration */ : 170 /* SyntaxKind.MethodSignature */; var signatureDeclaration = codefix.createSignatureDeclarationFromCallExpression(kind, context, importAdder, callExpression, name, modifierFlags, parentDeclaration); var containingMethodDeclaration = tryGetContainingMethodDeclaration(parentDeclaration, callExpression); if (containingMethodDeclaration) { @@ -157509,9 +158544,17 @@ var ts; }); } function addFunctionDeclaration(changes, context, info) { + var quotePreference = ts.getQuotePreference(context.sourceFile, context.preferences); var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host); - var functionDeclaration = codefix.createSignatureDeclarationFromCallExpression(256 /* SyntaxKind.FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration); - changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration); + var functionDeclaration = info.kind === InfoKind.Function + ? codefix.createSignatureDeclarationFromCallExpression(259 /* SyntaxKind.FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration) + : codefix.createSignatureDeclarationFromSignature(259 /* SyntaxKind.FunctionDeclaration */, context, quotePreference, info.signature, codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), info.token, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ undefined, importAdder); + if (functionDeclaration === undefined) { + ts.Debug.fail("fixMissingFunctionDeclaration codefix got unexpected error."); + } + ts.isReturnStatement(info.parentDeclaration) + ? changes.insertNodeBefore(info.sourceFile, info.parentDeclaration, functionDeclaration, /*blankLineBetween*/ true) + : changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration); importAdder.writeFixes(changes); } function addJsxAttributes(changes, context, info) { @@ -157607,7 +158650,7 @@ var ts; var signature = checker.getSignaturesOfType(type, 0 /* SignatureKind.Call */); if (signature === undefined) return createUndefined(); - var func = codefix.createSignatureDeclarationFromSignature(213 /* SyntaxKind.FunctionExpression */, context, quotePreference, signature[0], codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), /*name*/ undefined, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ enclosingDeclaration, importAdder); + var func = codefix.createSignatureDeclarationFromSignature(215 /* SyntaxKind.FunctionExpression */, context, quotePreference, signature[0], codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), /*name*/ undefined, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ enclosingDeclaration, importAdder); return func !== null && func !== void 0 ? func : createUndefined(); } if (ts.getObjectFlags(type) & 1 /* ObjectFlags.Class */) { @@ -157661,14 +158704,21 @@ var ts; return declaration && declaration.parent === node ? declaration : undefined; } function createPropertyNameFromSymbol(symbol, target, quotePreference, checker) { - if (ts.isTransientSymbol(symbol) && symbol.nameType && symbol.nameType.flags & 8192 /* TypeFlags.UniqueESSymbol */) { - var expression = checker.symbolToExpression(symbol.nameType.symbol, 111551 /* SymbolFlags.Value */, symbol.valueDeclaration, 1048576 /* NodeBuilderFlags.AllowUniqueESSymbolType */); - if (expression) { - return ts.factory.createComputedPropertyName(expression); - } + if (ts.isTransientSymbol(symbol)) { + var prop = checker.symbolToNode(symbol, 111551 /* SymbolFlags.Value */, /*enclosingDeclaration*/ undefined, 1073741824 /* NodeBuilderFlags.WriteComputedProps */); + if (prop && ts.isComputedPropertyName(prop)) + return prop; } return ts.createPropertyNameNodeForIdentifierOrLiteral(symbol.name, target, quotePreference === 0 /* QuotePreference.Single */); } + function findScope(node) { + if (ts.findAncestor(node, ts.isJsxExpression)) { + var returnStatement = ts.findAncestor(node.parent, ts.isReturnStatement); + if (returnStatement) + return returnStatement; + } + return ts.getSourceFileOfNode(node); + } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); /* @internal */ @@ -157819,7 +158869,7 @@ var ts; // See `codeFixClassExtendAbstractProtectedProperty.ts` in https://github.com/Microsoft/TypeScript/pull/11547/files // (now named `codeFixClassExtendAbstractPrivateProperty.ts`) var flags = ts.getSyntacticModifierFlags(ts.first(symbol.getDeclarations())); - return !(flags & 8 /* ModifierFlags.Private */) && !!(flags & 128 /* ModifierFlags.Abstract */); + return !(flags & 8 /* ModifierFlags.Private */) && !!(flags & 256 /* ModifierFlags.Abstract */); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -157982,6 +159032,63 @@ var ts; })(ts || (ts = {})); /* @internal */ var ts; +(function (ts) { + var codefix; + (function (codefix) { + var fixId = "fixNaNEquality"; + var errorCodes = [ + ts.Diagnostics.This_condition_will_always_return_0.code, + ]; + codefix.registerCodeFix({ + errorCodes: errorCodes, + getCodeActions: function (context) { + var sourceFile = context.sourceFile, span = context.span, program = context.program; + var info = getInfo(program, sourceFile, span); + if (info === undefined) + return; + var suggestion = info.suggestion, expression = info.expression, arg = info.arg; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, arg, expression); }); + return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Use_0, suggestion], fixId, ts.Diagnostics.Use_Number_isNaN_in_all_conditions)]; + }, + fixIds: [fixId], + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(context.program, diag.file, ts.createTextSpan(diag.start, diag.length)); + if (info) { + doChange(changes, diag.file, info.arg, info.expression); + } + }); + } + }); + function getInfo(program, sourceFile, span) { + var diag = ts.find(program.getSemanticDiagnostics(sourceFile), function (diag) { return diag.start === span.start && diag.length === span.length; }); + if (diag === undefined || diag.relatedInformation === undefined) + return; + var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.Did_you_mean_0.code; }); + if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined) + return; + var token = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); + if (token === undefined) + return; + if (ts.isExpression(token) && ts.isBinaryExpression(token.parent)) { + return { suggestion: getSuggestion(related.messageText), expression: token.parent, arg: token }; + } + return undefined; + } + function doChange(changes, sourceFile, arg, expression) { + var callExpression = ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("Number"), ts.factory.createIdentifier("isNaN")), /*typeArguments*/ undefined, [arg]); + var operator = expression.operatorToken.kind; + changes.replaceNode(sourceFile, expression, operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ + ? ts.factory.createPrefixUnaryExpression(53 /* SyntaxKind.ExclamationToken */, callExpression) : callExpression); + } + function getSuggestion(messageText) { + var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/\'(.*)\'/) || [], _ = _a[0], suggestion = _a[1]; + return suggestion; + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var codefix; (function (codefix) { @@ -158299,7 +159406,7 @@ var ts; var importDeclaration = getImportDeclaration(context.sourceFile, context.program, context.span.start); if (!importDeclaration) return; - var namespaceChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return importDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ && doNamespaceImportChange(t, context.sourceFile, importDeclaration, context.program); }); + var namespaceChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return importDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ && doNamespaceImportChange(t, context.sourceFile, importDeclaration, context.program); }); var typeOnlyChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return doTypeOnlyImportChange(t, context.sourceFile, importDeclaration, context.program); }); var actions; if (namespaceChanges.length) { @@ -158314,7 +159421,7 @@ var ts; }); function getImportDeclaration(sourceFile, program, start) { var identifier = ts.tryCast(ts.getTokenAtPosition(sourceFile, start), ts.isIdentifier); - if (!identifier || identifier.parent.kind !== 178 /* SyntaxKind.TypeReference */) + if (!identifier || identifier.parent.kind !== 180 /* SyntaxKind.TypeReference */) return; var checker = program.getTypeChecker(); var symbol = checker.getSymbolAtLocation(identifier); @@ -158326,11 +159433,11 @@ var ts; // new type-only import declaration, but honestly I doubt anyone will ever use this // codefix at all, so it's probably not worth the lines of code. function doTypeOnlyImportChange(changes, sourceFile, importDeclaration, program) { - if (importDeclaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, importDeclaration.name); + if (importDeclaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, importDeclaration.name); return; } - var importClause = importDeclaration.kind === 267 /* SyntaxKind.ImportClause */ ? importDeclaration : importDeclaration.parent.parent; + var importClause = importDeclaration.kind === 270 /* SyntaxKind.ImportClause */ ? importDeclaration : importDeclaration.parent.parent; if (importClause.name && importClause.namedBindings) { // Cannot convert an import with a default import and named bindings to type-only // (it's a grammar error). @@ -158347,7 +159454,7 @@ var ts; // Don't convert it to type-only. return; } - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, importClause); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, importClause); } function doNamespaceImportChange(changes, sourceFile, importDeclaration, program) { ts.refactor.doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, importDeclaration.parent); @@ -158425,7 +159532,7 @@ var ts; ]; } var result = []; - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return changeInferToUnknown(t, sourceFile, token); }); var name = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name.text; result.push(codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Replace_infer_0_with_unknown, name], fixIdInfer, ts.Diagnostics.Replace_all_unused_infer_with_unknown)); @@ -158467,7 +159574,7 @@ var ts; break; } case fixIdDelete: { - if (token.kind === 137 /* SyntaxKind.InferKeyword */ || isImport(token)) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */ || isImport(token)) { break; // Can't delete } else if (ts.isJSDocTemplateTag(token)) { @@ -158496,7 +159603,7 @@ var ts; break; } case fixIdInfer: - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { changeInferToUnknown(changes, sourceFile, token); } break; @@ -158507,7 +159614,7 @@ var ts; }, }); function changeInferToUnknown(changes, sourceFile, token) { - changes.replaceNode(sourceFile, token.parent, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)); + changes.replaceNode(sourceFile, token.parent, ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)); } function createDeleteFix(changes, diag) { return codefix.createCodeFixAction(fixName, changes, diag, fixIdDelete, ts.Diagnostics.Delete_all_unused_declarations); @@ -158517,7 +159624,7 @@ var ts; } function isImport(token) { return token.kind === 100 /* SyntaxKind.ImportKeyword */ - || token.kind === 79 /* SyntaxKind.Identifier */ && (token.parent.kind === 270 /* SyntaxKind.ImportSpecifier */ || token.parent.kind === 267 /* SyntaxKind.ImportClause */); + || token.kind === 79 /* SyntaxKind.Identifier */ && (token.parent.kind === 273 /* SyntaxKind.ImportSpecifier */ || token.parent.kind === 270 /* SyntaxKind.ImportClause */); } /** Sometimes the diagnostic span is an entire ImportDeclaration, so we should remove the whole thing. */ function tryGetFullImport(token) { @@ -158527,7 +159634,7 @@ var ts; return ts.isVariableDeclarationList(token.parent) && ts.first(token.parent.getChildren(sourceFile)) === token; } function deleteEntireVariableStatement(changes, sourceFile, node) { - changes.delete(sourceFile, node.parent.kind === 237 /* SyntaxKind.VariableStatement */ ? node.parent : node); + changes.delete(sourceFile, node.parent.kind === 240 /* SyntaxKind.VariableStatement */ ? node.parent : node); } function deleteDestructuringElements(changes, sourceFile, node) { ts.forEach(node.elements, function (n) { return changes.delete(sourceFile, n); }); @@ -158536,7 +159643,7 @@ var ts; // Don't offer to prefix a property. if (errorCode === ts.Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code) return; - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { token = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name; } if (ts.isIdentifier(token) && canPrefix(token)) { @@ -158552,14 +159659,14 @@ var ts; } function canPrefix(token) { switch (token.parent.kind) { - case 164 /* SyntaxKind.Parameter */: - case 163 /* SyntaxKind.TypeParameter */: + case 166 /* SyntaxKind.Parameter */: + case 165 /* SyntaxKind.TypeParameter */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var varDecl = token.parent; switch (varDecl.parent.parent.kind) { - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return true; } } @@ -158614,8 +159721,8 @@ var ts; function mayDeleteParameter(checker, sourceFile, parameter, sourceFiles, program, cancellationToken, isFixAll) { var parent = parameter.parent; switch (parent.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: var index = parent.parameters.indexOf(parameter); var referent = ts.isMethodDeclaration(parent) ? parent.name : parent; var entries = ts.FindAllReferences.Core.getReferencedSymbolsForNode(parent.pos, referent, program, sourceFiles, cancellationToken); @@ -158645,20 +159752,20 @@ var ts; } } return true; - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { if (parent.name && isCallbackLike(checker, sourceFile, parent.name)) { return isLastParameter(parent, parameter, isFixAll); } return true; } - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: // Can't remove a non-last parameter in a callback. Can remove a parameter in code-fix-all if future parameters are also unused. return isLastParameter(parent, parameter, isFixAll); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Setter must have a parameter return false; - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Getter cannot have parameters return true; default: @@ -158719,7 +159826,7 @@ var ts; var container = (ts.isBlock(statement.parent) ? statement.parent : statement).parent; if (!ts.isBlock(statement.parent) || statement === ts.first(statement.parent.statements)) { switch (container.kind) { - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: if (container.elseStatement) { if (ts.isBlock(statement.parent)) { break; @@ -158730,8 +159837,8 @@ var ts; return; } // falls through - case 241 /* SyntaxKind.WhileStatement */: - case 242 /* SyntaxKind.ForStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: changes.delete(sourceFile, container); return; } @@ -158804,7 +159911,7 @@ var ts; var typeNode = info.typeNode, type = info.type; var original = typeNode.getText(sourceFile); var actions = [fix(type, fixIdPlain, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript)]; - if (typeNode.kind === 314 /* SyntaxKind.JSDocNullableType */) { + if (typeNode.kind === 317 /* SyntaxKind.JSDocNullableType */) { // for nullable types, suggest the flow-compatible `T | null | undefined` // in addition to the jsdoc/closure-compatible `T | null` actions.push(fix(checker.getNullableType(type, 32768 /* TypeFlags.Undefined */), fixIdNullable, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types)); @@ -158824,7 +159931,7 @@ var ts; if (!info) return; var typeNode = info.typeNode, type = info.type; - var fixedType = typeNode.kind === 314 /* SyntaxKind.JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* TypeFlags.Undefined */) : type; + var fixedType = typeNode.kind === 317 /* SyntaxKind.JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* TypeFlags.Undefined */) : type; doChange(changes, sourceFile, typeNode, fixedType, checker); }); } @@ -158841,22 +159948,22 @@ var ts; // NOTE: Some locations are not handled yet: // MappedTypeNode.typeParameters and SignatureDeclaration.typeParameters, as well as CallExpression.typeArguments switch (node.kind) { - case 229 /* SyntaxKind.AsExpression */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 176 /* SyntaxKind.IndexSignature */: - case 195 /* SyntaxKind.MappedType */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 173 /* SyntaxKind.SetAccessor */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 231 /* SyntaxKind.AsExpression */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 178 /* SyntaxKind.IndexSignature */: + case 197 /* SyntaxKind.MappedType */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 175 /* SyntaxKind.SetAccessor */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; default: return false; @@ -158959,14 +160066,14 @@ var ts; } var insertBefore; switch (containingFunction.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: insertBefore = containingFunction.name; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: insertBefore = ts.findChildOfKind(containingFunction, 98 /* SyntaxKind.FunctionKeyword */, sourceFile); break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: var kind = containingFunction.typeParameters ? 29 /* SyntaxKind.LessThanToken */ : 20 /* SyntaxKind.OpenParenToken */; insertBefore = ts.findChildOfKind(containingFunction, kind, sourceFile) || ts.first(containingFunction.parameters); break; @@ -158986,7 +160093,7 @@ var ts; changes.replaceNode(sourceFile, returnType, ts.factory.createTypeReferenceNode("Promise", ts.factory.createNodeArray([returnType]))); } } - changes.insertModifierBefore(sourceFile, 131 /* SyntaxKind.AsyncKeyword */, insertBefore); + changes.insertModifierBefore(sourceFile, 132 /* SyntaxKind.AsyncKeyword */, insertBefore); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -159302,7 +160409,7 @@ var ts; function annotate(changes, importAdder, sourceFile, declaration, type, program, host) { var typeNode = ts.getTypeNodeIfAccessible(type, declaration, program, host); if (typeNode) { - if (ts.isInJSFile(sourceFile) && declaration.kind !== 166 /* SyntaxKind.PropertySignature */) { + if (ts.isInJSFile(sourceFile) && declaration.kind !== 168 /* SyntaxKind.PropertySignature */) { var parent = ts.isVariableDeclaration(declaration) ? ts.tryCast(declaration.parent.parent, ts.isVariableStatement) : declaration; if (!parent) { return; @@ -159389,19 +160496,19 @@ var ts; function getFunctionReferences(containingFunction, sourceFile, program, cancellationToken) { var searchToken; switch (containingFunction.kind) { - case 171 /* SyntaxKind.Constructor */: - searchToken = ts.findChildOfKind(containingFunction, 134 /* SyntaxKind.ConstructorKeyword */, sourceFile); + case 173 /* SyntaxKind.Constructor */: + searchToken = ts.findChildOfKind(containingFunction, 135 /* SyntaxKind.ConstructorKeyword */, sourceFile); break; - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: var parent = containingFunction.parent; searchToken = (ts.isVariableDeclaration(parent) || ts.isPropertyDeclaration(parent)) && ts.isIdentifier(parent.name) ? parent.name : containingFunction.name; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: searchToken = containingFunction.name; break; } @@ -159543,24 +160650,24 @@ var ts; node = node.parent; } switch (node.parent.kind) { - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: inferTypeFromExpressionStatement(node, usage); break; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: usage.isNumber = true; break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: inferTypeFromPrefixUnaryExpression(node.parent, usage); break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: inferTypeFromBinaryExpression(node, node.parent, usage); break; - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: inferTypeFromSwitchStatementLabel(node.parent, usage); break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: if (node.parent.expression === node) { inferTypeFromCallExpression(node.parent, usage); } @@ -159568,20 +160675,20 @@ var ts; inferTypeFromContextualType(node, usage); } break; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: inferTypeFromPropertyAccessExpression(node.parent, usage); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: inferTypeFromPropertyElementExpression(node.parent, node, usage); break; - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: inferTypeFromPropertyAssignment(node.parent, usage); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: inferTypeFromPropertyDeclaration(node.parent, usage); break; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var _a = node.parent, name = _a.name, initializer = _a.initializer; if (node === name) { if (initializer) { // This can happen for `let x = null;` which still has an implicit-any error. @@ -159703,7 +160810,7 @@ var ts; case 56 /* SyntaxKind.BarBarToken */: case 60 /* SyntaxKind.QuestionQuestionToken */: if (node === parent.left && - (node.parent.parent.kind === 254 /* SyntaxKind.VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) { + (node.parent.parent.kind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) { // var x = x || {}; // TODO: use getFalsyflagsOfType addCandidateType(usage, checker.getTypeAtLocation(parent.right)); @@ -159731,7 +160838,7 @@ var ts; } } calculateUsageOfNode(parent, call.return_); - if (parent.kind === 208 /* SyntaxKind.CallExpression */) { + if (parent.kind === 210 /* SyntaxKind.CallExpression */) { (usage.calls || (usage.calls = [])).push(call); } else { @@ -160185,25 +161292,44 @@ var ts; * @param body If defined, this will be the body of the member node passed to `addClassElement`. Otherwise, the body will default to a stub. */ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional, isAmbient) { + var _a; if (preserveOptional === void 0) { preserveOptional = 3 /* PreserveOptionalFlags.All */; } if (isAmbient === void 0) { isAmbient = false; } var declarations = symbol.getDeclarations(); - if (!(declarations && declarations.length)) { - return undefined; - } + var declaration = declarations === null || declarations === void 0 ? void 0 : declarations[0]; var checker = context.program.getTypeChecker(); var scriptTarget = ts.getEmitScriptTarget(context.program.getCompilerOptions()); - var declaration = declarations[0]; - var name = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false); - var visibilityModifier = createVisibilityModifier(ts.getEffectiveModifierFlags(declaration)); - var modifiers = visibilityModifier ? ts.factory.createNodeArray([visibilityModifier]) : undefined; + /** + * (#49811) + * Note that there are cases in which the symbol declaration is not present. For example, in the code below both + * `MappedIndirect.ax` and `MappedIndirect.ay` have no declaration node attached (due to their mapped-type + * parent): + * + * ```ts + * type Base = { ax: number; ay: string }; + * type BaseKeys = keyof Base; + * type MappedIndirect = { [K in BaseKeys]: boolean }; + * ``` + * + * In such cases, we assume the declaration to be a `PropertySignature`. + */ + var kind = (_a = declaration === null || declaration === void 0 ? void 0 : declaration.kind) !== null && _a !== void 0 ? _a : 168 /* SyntaxKind.PropertySignature */; + var declarationName = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false); + var effectiveModifierFlags = declaration ? ts.getEffectiveModifierFlags(declaration) : 0 /* ModifierFlags.None */; + var modifierFlags = effectiveModifierFlags & 4 /* ModifierFlags.Public */ ? 4 /* ModifierFlags.Public */ : + effectiveModifierFlags & 16 /* ModifierFlags.Protected */ ? 16 /* ModifierFlags.Protected */ : + 0 /* ModifierFlags.None */; + if (declaration && ts.isAutoAccessorPropertyDeclaration(declaration)) { + modifierFlags |= 128 /* ModifierFlags.Accessor */; + } + var modifiers = modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration)); var optional = !!(symbol.flags & 16777216 /* SymbolFlags.Optional */); var ambient = !!(enclosingDeclaration.flags & 16777216 /* NodeFlags.Ambient */) || isAmbient; var quotePreference = ts.getQuotePreference(sourceFile, preferences); - switch (declaration.kind) { - case 166 /* SyntaxKind.PropertySignature */: - case 167 /* SyntaxKind.PropertyDeclaration */: + switch (kind) { + case 168 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: var flags = quotePreference === 0 /* QuotePreference.Single */ ? 268435456 /* NodeBuilderFlags.UseSingleQuotesForStringLiteralType */ : undefined; var typeNode = checker.typeToTypeNode(type, enclosingDeclaration, flags, getNoopSymbolTrackerWithResolver(context)); if (importAdder) { @@ -160213,11 +161339,12 @@ var ts; importSymbols(importAdder, importableReference.symbols); } } - addClassElement(ts.factory.createPropertyDeclaration(modifiers, name, optional && (preserveOptional & 2 /* PreserveOptionalFlags.Property */) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, typeNode, + addClassElement(ts.factory.createPropertyDeclaration(modifiers, declaration ? createName(declarationName) : symbol.getName(), optional && (preserveOptional & 2 /* PreserveOptionalFlags.Property */) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, typeNode, /*initializer*/ undefined)); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: { + ts.Debug.assertIsDefined(declarations); var typeNode_1 = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context)); var allAccessors = ts.getAllAccessorDeclarations(declarations, declaration); var orderedAccessors = allAccessors.secondAccessor @@ -160233,19 +161360,19 @@ var ts; for (var _i = 0, orderedAccessors_1 = orderedAccessors; _i < orderedAccessors_1.length; _i++) { var accessor = orderedAccessors_1[_i]; if (ts.isGetAccessorDeclaration(accessor)) { - addClassElement(ts.factory.createGetAccessorDeclaration(modifiers, name, ts.emptyArray, typeNode_1, ambient ? undefined : body || createStubbedMethodBody(quotePreference))); + addClassElement(ts.factory.createGetAccessorDeclaration(modifiers, createName(declarationName), ts.emptyArray, createTypeNode(typeNode_1), createBody(body, quotePreference, ambient))); } else { ts.Debug.assertNode(accessor, ts.isSetAccessorDeclaration, "The counterpart to a getter should be a setter"); var parameter = ts.getSetAccessorValueParameter(accessor); var parameterName = parameter && ts.isIdentifier(parameter.name) ? ts.idText(parameter.name) : undefined; - addClassElement(ts.factory.createSetAccessorDeclaration(modifiers, name, createDummyParameters(1, [parameterName], [typeNode_1], 1, /*inJs*/ false), ambient ? undefined : body || createStubbedMethodBody(quotePreference))); + addClassElement(ts.factory.createSetAccessorDeclaration(modifiers, createName(declarationName), createDummyParameters(1, [parameterName], [createTypeNode(typeNode_1)], 1, /*inJs*/ false), createBody(body, quotePreference, ambient))); } } break; } - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: // The signature for the implementation appears as an entry in `signatures` iff // there is only one signature. // If there are overloads and an implementation signature, it appears as an @@ -160253,6 +161380,7 @@ var ts; // If there is more than one overload but no implementation signature // (eg: an abstract method or interface declaration), there is a 1-1 // correspondence of declarations and signatures. + ts.Debug.assertIsDefined(declarations); var signatures = type.isUnion() ? ts.flatMap(type.types, function (t) { return t.getCallSignatures(); }) : type.getCallSignatures(); if (!ts.some(signatures)) { break; @@ -160260,31 +161388,41 @@ var ts; if (declarations.length === 1) { ts.Debug.assert(signatures.length === 1, "One declaration implies one signature"); var signature = signatures[0]; - outputMethod(quotePreference, signature, modifiers, name, ambient ? undefined : body || createStubbedMethodBody(quotePreference)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName), createBody(body, quotePreference, ambient)); break; } - for (var _a = 0, signatures_1 = signatures; _a < signatures_1.length; _a++) { - var signature = signatures_1[_a]; + for (var _b = 0, signatures_1 = signatures; _b < signatures_1.length; _b++) { + var signature = signatures_1[_b]; // Ensure nodes are fresh so they can have different positions when going through formatting. - outputMethod(quotePreference, signature, ts.getSynthesizedDeepClones(modifiers, /*includeTrivia*/ false), ts.getSynthesizedDeepClone(name, /*includeTrivia*/ false)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName)); } if (!ambient) { if (declarations.length > signatures.length) { var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]); - outputMethod(quotePreference, signature, modifiers, name, body || createStubbedMethodBody(quotePreference)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName), createBody(body, quotePreference)); } else { ts.Debug.assert(declarations.length === signatures.length, "Declarations and signatures should match count"); - addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), modifiers, quotePreference, body)); + addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, createName(declarationName), optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), modifiers, quotePreference, body)); } } break; } function outputMethod(quotePreference, signature, modifiers, name, body) { - var method = createSignatureDeclarationFromSignature(169 /* SyntaxKind.MethodDeclaration */, context, quotePreference, signature, body, name, modifiers, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), enclosingDeclaration, importAdder); + var method = createSignatureDeclarationFromSignature(171 /* SyntaxKind.MethodDeclaration */, context, quotePreference, signature, body, name, modifiers, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), enclosingDeclaration, importAdder); if (method) addClassElement(method); } + function createName(node) { + return ts.getSynthesizedDeepClone(node, /*includeTrivia*/ false); + } + function createBody(block, quotePreference, ambient) { + return ambient ? undefined : + ts.getSynthesizedDeepClone(block, /*includeTrivia*/ false) || createStubbedMethodBody(quotePreference); + } + function createTypeNode(typeNode) { + return ts.getSynthesizedDeepClone(typeNode, /*includeTrivia*/ false); + } } codefix.addNewNodeForMemberSymbol = addNewNodeForMemberSymbol; function createSignatureDeclarationFromSignature(kind, context, quotePreference, signature, body, name, modifiers, optional, enclosingDeclaration, importAdder) { @@ -160358,6 +161496,9 @@ var ts; if (ts.isMethodDeclaration(signatureDeclaration)) { return ts.factory.updateMethodDeclaration(signatureDeclaration, modifiers, asteriskToken, name !== null && name !== void 0 ? name : ts.factory.createIdentifier(""), questionToken, typeParameters, parameters, type, body); } + if (ts.isFunctionDeclaration(signatureDeclaration)) { + return ts.factory.updateFunctionDeclaration(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, ts.tryCast(name, ts.isIdentifier), typeParameters, parameters, type, body !== null && body !== void 0 ? body : signatureDeclaration.body); + } return undefined; } codefix.createSignatureDeclarationFromSignature = createSignatureDeclarationFromSignature; @@ -160386,13 +161527,13 @@ var ts; ? undefined : checker.typeToTypeNode(contextualType, contextNode, /*flags*/ undefined, tracker); switch (kind) { - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return ts.factory.createMethodDeclaration(modifiers, asteriskToken, name, /*questionToken*/ undefined, typeParameters, parameters, type, createStubbedMethodBody(quotePreference)); - case 168 /* SyntaxKind.MethodSignature */: + case 170 /* SyntaxKind.MethodSignature */: return ts.factory.createMethodSignature(modifiers, name, - /*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */) : type); - case 256 /* SyntaxKind.FunctionDeclaration */: + /*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */) : type); + case 259 /* SyntaxKind.FunctionDeclaration */: return ts.factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference)); default: ts.Debug.fail("Unexpected kind"); @@ -160529,7 +161670,7 @@ var ts; /*dotDotDotToken*/ undefined, /*name*/ parameterName + (parameterNameCount || ""), /*questionToken*/ minArgumentCount !== undefined && i >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, - /*type*/ inJs ? undefined : (types === null || types === void 0 ? void 0 : types[i]) || ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */), + /*type*/ inJs ? undefined : (types === null || types === void 0 ? void 0 : types[i]) || ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */), /*initializer*/ undefined); parameters.push(newParameter); } @@ -160559,7 +161700,7 @@ var ts; if (someSigHasRestParameter) { var restParameter = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */), maxArgsParameterSymbolNames[maxNonRestArgs] || "rest", - /*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)), + /*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)), /*initializer*/ undefined); parameters.push(restParameter); } @@ -160587,15 +161728,6 @@ var ts; /*multiline*/ true); } codefix.createStubbedBody = createStubbedBody; - function createVisibilityModifier(flags) { - if (flags & 4 /* ModifierFlags.Public */) { - return ts.factory.createToken(123 /* SyntaxKind.PublicKeyword */); - } - else if (flags & 16 /* ModifierFlags.Protected */) { - return ts.factory.createToken(122 /* SyntaxKind.ProtectedKeyword */); - } - return undefined; - } function setJsonCompilerOptionValues(changeTracker, configFile, options) { var tsconfigObjectLiteral = ts.getTsConfigObjectLiteralExpression(configFile); if (!tsconfigObjectLiteral) @@ -160674,6 +161806,15 @@ var ts; symbols.forEach(function (s) { return importAdder.addImportFromExportedSymbol(s, /*isValidTypeOnlyUseSite*/ true); }); } codefix.importSymbols = importSymbols; + function findAncestorMatchingSpan(sourceFile, span) { + var end = ts.textSpanEnd(span); + var token = ts.getTokenAtPosition(sourceFile, span.start); + while (token.end < end) { + token = token.parent; + } + return token; + } + codefix.findAncestorMatchingSpan = findAncestorMatchingSpan; })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); /* @internal */ @@ -160696,13 +161837,13 @@ var ts; if (ts.isClassLike(container)) { var modifierFlags = ts.getEffectiveModifierFlags(declaration); if (ts.isSourceFileJS(file)) { - var modifiers = ts.createModifiers(modifierFlags); + var modifiers = ts.factory.createModifiersFromModifierFlags(modifierFlags); accessorModifiers = modifiers; fieldModifiers = modifiers; } else { - accessorModifiers = ts.createModifiers(prepareModifierFlagsForAccessor(modifierFlags)); - fieldModifiers = ts.createModifiers(prepareModifierFlagsForField(modifierFlags)); + accessorModifiers = ts.factory.createModifiersFromModifierFlags(prepareModifierFlagsForAccessor(modifierFlags)); + fieldModifiers = ts.factory.createModifiersFromModifierFlags(prepareModifierFlagsForField(modifierFlags)); } if (ts.canHaveDecorators(declaration)) { fieldModifiers = ts.concatenate(ts.getDecorators(declaration), fieldModifiers); @@ -160771,7 +161912,7 @@ var ts; error: ts.getLocaleSpecificMessage(ts.Diagnostics.Name_is_not_valid) }; } - if (((ts.getEffectiveModifierFlags(declaration) & 125951 /* ModifierFlags.Modifier */) | meaning) !== meaning) { + if (((ts.getEffectiveModifierFlags(declaration) & 126975 /* ModifierFlags.Modifier */) | meaning) !== meaning) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_property_with_modifier) }; @@ -160784,7 +161925,7 @@ var ts; isStatic: ts.hasStaticModifier(declaration), isReadonly: ts.hasEffectiveReadonlyModifier(declaration), type: getDeclarationType(declaration, program), - container: declaration.kind === 164 /* SyntaxKind.Parameter */ ? declaration.parent.parent : declaration.parent, + container: declaration.kind === 166 /* SyntaxKind.Parameter */ ? declaration.parent.parent : declaration.parent, originalName: declaration.name.text, declaration: declaration, fieldName: fieldName, @@ -160858,7 +161999,7 @@ var ts; var type = typeChecker.getTypeFromTypeNode(typeNode); if (!typeChecker.isTypeAssignableTo(typeChecker.getUndefinedType(), type)) { var types = ts.isUnionTypeNode(typeNode) ? typeNode.types : [typeNode]; - return ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], types, true), [ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)], false)); + return ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], types, true), [ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)], false)); } } return typeNode; @@ -160916,7 +162057,7 @@ var ts; }); function getActionsForUsageOfInvalidImport(context) { var sourceFile = context.sourceFile; - var targetKind = ts.Diagnostics.This_expression_is_not_callable.code === context.errorCode ? 208 /* SyntaxKind.CallExpression */ : 209 /* SyntaxKind.NewExpression */; + var targetKind = ts.Diagnostics.This_expression_is_not_callable.code === context.errorCode ? 210 /* SyntaxKind.CallExpression */ : 211 /* SyntaxKind.NewExpression */; var node = ts.findAncestor(ts.getTokenAtPosition(sourceFile, context.span.start), function (a) { return a.kind === targetKind; }); if (!node) { return []; @@ -161042,7 +162183,7 @@ var ts; return codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Add_undefined_type_to_property_0, info.prop.name.getText()], fixIdAddUndefinedType, ts.Diagnostics.Add_undefined_type_to_all_uninitialized_properties); } function addUndefinedType(changeTracker, sourceFile, info) { - var undefinedTypeNode = ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */); + var undefinedTypeNode = ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */); var types = ts.isUnionTypeNode(info.type) ? info.type.types.concat(undefinedTypeNode) : [info.type, undefinedTypeNode]; var unionTypeNode = ts.factory.createUnionTypeNode(types); if (info.isJs) { @@ -161088,7 +162229,7 @@ var ts; } else if (type.isClass()) { var classDeclaration = ts.getClassLikeDeclarationOfSymbol(type.symbol); - if (!classDeclaration || ts.hasSyntacticModifier(classDeclaration, 128 /* ModifierFlags.Abstract */)) + if (!classDeclaration || ts.hasSyntacticModifier(classDeclaration, 256 /* ModifierFlags.Abstract */)) return undefined; var constructorDeclaration = ts.getFirstConstructorWithBody(classDeclaration); if (constructorDeclaration && constructorDeclaration.parameters.length) @@ -161265,7 +162406,7 @@ var ts; function getImportTypeNode(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); ts.Debug.assert(token.kind === 100 /* SyntaxKind.ImportKeyword */, "This token should be an ImportKeyword"); - ts.Debug.assert(token.parent.kind === 200 /* SyntaxKind.ImportType */, "Token parent should be an ImportType"); + ts.Debug.assert(token.parent.kind === 202 /* SyntaxKind.ImportType */, "Token parent should be an ImportType"); return token.parent; } function doChange(changes, sourceFile, importType) { @@ -161394,7 +162535,7 @@ var ts; var otherMembers = members.filter(function (member) { return !ts.isIndexSignatureDeclaration(member); }); var parameter = ts.first(indexSignature.parameters); var mappedTypeParameter = ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.cast(parameter.name, ts.isIdentifier), parameter.type); - var mappedIntersectionType = ts.factory.createMappedTypeNode(ts.hasEffectiveReadonlyModifier(indexSignature) ? ts.factory.createModifier(145 /* SyntaxKind.ReadonlyKeyword */) : undefined, mappedTypeParameter, + var mappedIntersectionType = ts.factory.createMappedTypeNode(ts.hasEffectiveReadonlyModifier(indexSignature) ? ts.factory.createModifier(146 /* SyntaxKind.ReadonlyKeyword */) : undefined, mappedTypeParameter, /*nameType*/ undefined, indexSignature.questionToken, indexSignature.type, /*members*/ undefined); var intersectionType = ts.factory.createIntersectionTypeNode(__spreadArray(__spreadArray(__spreadArray([], ts.getAllSuperTypeNodes(container), true), [ @@ -161452,7 +162593,7 @@ var ts; }, }); function makeChange(changeTracker, sourceFile, span) { - var awaitKeyword = ts.tryCast(ts.getTokenAtPosition(sourceFile, span.start), function (node) { return node.kind === 132 /* SyntaxKind.AwaitKeyword */; }); + var awaitKeyword = ts.tryCast(ts.getTokenAtPosition(sourceFile, span.start), function (node) { return node.kind === 133 /* SyntaxKind.AwaitKeyword */; }); var awaitExpression = awaitKeyword && ts.tryCast(awaitKeyword.parent, ts.isAwaitExpression); if (!awaitExpression) { return; @@ -161519,28 +162660,45 @@ var ts; errorCodes: errorCodes, getCodeActions: function getCodeActionsToConvertConstToLet(context) { var sourceFile = context.sourceFile, span = context.span, program = context.program; - var range = getConstTokenRange(sourceFile, span.start, program); - if (range === undefined) + var info = getInfo(sourceFile, span.start, program); + if (info === undefined) return; - var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, range); }); - return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Convert_const_to_let, fixId, ts.Diagnostics.Convert_const_to_let)]; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, info.token); }); + return [codefix.createCodeFixActionMaybeFixAll(fixId, changes, ts.Diagnostics.Convert_const_to_let, fixId, ts.Diagnostics.Convert_all_const_to_let)]; + }, + getAllCodeActions: function (context) { + var program = context.program; + var seen = new ts.Map(); + return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, function (changes) { + codefix.eachDiagnostic(context, errorCodes, function (diag) { + var info = getInfo(diag.file, diag.start, program); + if (info) { + if (ts.addToSeen(seen, ts.getSymbolId(info.symbol))) { + return doChange(changes, diag.file, info.token); + } + } + return undefined; + }); + })); }, fixIds: [fixId] }); - function getConstTokenRange(sourceFile, pos, program) { + function getInfo(sourceFile, pos, program) { var _a; var checker = program.getTypeChecker(); var symbol = checker.getSymbolAtLocation(ts.getTokenAtPosition(sourceFile, pos)); + if (symbol === undefined) + return; var declaration = ts.tryCast((_a = symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.parent, ts.isVariableDeclarationList); if (declaration === undefined) return; var constToken = ts.findChildOfKind(declaration, 85 /* SyntaxKind.ConstKeyword */, sourceFile); if (constToken === undefined) return; - return ts.createRange(constToken.pos, constToken.end); + return { symbol: symbol, token: constToken }; } - function doChange(changes, sourceFile, range) { - changes.replaceRangeWithText(sourceFile, range, "let"); + function doChange(changes, sourceFile, token) { + changes.replaceNode(sourceFile, token, ts.factory.createToken(119 /* SyntaxKind.LetKeyword */)); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -161715,7 +162873,6 @@ var ts; return { edits: edits, renameFilename: undefined, renameLocation: undefined }; }, }); - ; function getInfo(context, considerPartialSpans) { if (considerPartialSpans === void 0) { considerPartialSpans = true; } var file = context.file, program = context.program; @@ -161727,8 +162884,8 @@ var ts; } var checker = program.getTypeChecker(); var exportingModuleSymbol = getExportingModuleSymbol(exportNode, checker); - var flags = ts.getSyntacticModifierFlags(exportNode) || ((ts.isExportAssignment(exportNode) && !exportNode.isExportEquals) ? 513 /* ModifierFlags.ExportDefault */ : 0 /* ModifierFlags.None */); - var wasDefault = !!(flags & 512 /* ModifierFlags.Default */); + var flags = ts.getSyntacticModifierFlags(exportNode) || ((ts.isExportAssignment(exportNode) && !exportNode.isExportEquals) ? 1025 /* ModifierFlags.ExportDefault */ : 0 /* ModifierFlags.None */); + var wasDefault = !!(flags & 1024 /* ModifierFlags.Default */); // If source file already has a default export, don't offer refactor. if (!(flags & 1 /* ModifierFlags.Export */) || !wasDefault && exportingModuleSymbol.exports.has("default" /* InternalSymbolName.Default */)) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.This_file_already_has_a_default_export) }; @@ -161738,19 +162895,19 @@ var ts; : { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_named_export) }; }; switch (exportNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: { var node = exportNode; if (!node.name) return undefined; return noSymbolError(node.name) || { exportNode: node, exportName: node.name, wasDefault: wasDefault, exportingModuleSymbol: exportingModuleSymbol }; } - case 237 /* SyntaxKind.VariableStatement */: { + case 240 /* SyntaxKind.VariableStatement */: { var vs = exportNode; // Must be `export const x = something;`. if (!(vs.declarationList.flags & 2 /* NodeFlags.Const */) || vs.declarationList.declarations.length !== 1) { @@ -161763,7 +162920,7 @@ var ts; return noSymbolError(decl.name) || { exportNode: vs, exportName: decl.name, wasDefault: wasDefault, exportingModuleSymbol: exportingModuleSymbol }; } - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var node = exportNode; if (node.isExportEquals) return undefined; @@ -161793,12 +162950,12 @@ var ts; else { var exportKeyword = ts.Debug.checkDefined(ts.findModifier(exportNode, 93 /* SyntaxKind.ExportKeyword */), "Should find an export keyword in modifier list"); switch (exportNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: changes.insertNodeAfter(exportingSourceFile, exportKeyword, ts.factory.createToken(88 /* SyntaxKind.DefaultKeyword */)); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // If 'x' isn't used in this file and doesn't have type definition, `export const x = 0;` --> `export default 0;` var decl = ts.first(exportNode.declarationList.declarations); if (!ts.FindAllReferences.Core.isSymbolReferencedInFile(exportName, checker, exportingSourceFile) && !decl.type) { @@ -161807,9 +162964,9 @@ var ts; break; } // falls through - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // `export type T = number;` -> `type T = number; export default T;` changes.deleteModifier(exportingSourceFile, exportKeyword); changes.insertNodeAfter(exportingSourceFile, exportNode, ts.factory.createExportDefault(ts.factory.createIdentifier(exportName.text))); @@ -161838,18 +162995,18 @@ var ts; function changeDefaultToNamedImport(importingSourceFile, ref, changes, exportName) { var parent = ref.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // `a.default` --> `a.foo` changes.replaceNode(importingSourceFile, ref, ts.factory.createIdentifier(exportName)); break; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: { + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: { var spec = parent; // `default as foo` --> `foo`, `default as bar` --> `foo as bar` changes.replaceNode(importingSourceFile, spec, makeImportSpecifier(exportName, spec.name.text)); break; } - case 267 /* SyntaxKind.ImportClause */: { + case 270 /* SyntaxKind.ImportClause */: { var clause = parent; ts.Debug.assert(clause.name === ref, "Import clause name should match provided ref"); var spec = makeImportSpecifier(exportName, ref.text); @@ -161858,7 +163015,7 @@ var ts; // `import foo from "./a";` --> `import { foo } from "./a";` changes.replaceNode(importingSourceFile, ref, ts.factory.createNamedImports([spec])); } - else if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + else if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { // `import foo, * as a from "./a";` --> `import * as a from ".a/"; import { foo } from "./a";` changes.deleteRange(importingSourceFile, { pos: ref.getStart(importingSourceFile), end: namedBindings.getStart(importingSourceFile) }); var quotePreference = ts.isStringLiteral(clause.parent.moduleSpecifier) ? ts.quotePreferenceFromString(clause.parent.moduleSpecifier, importingSourceFile) : 1 /* QuotePreference.Double */; @@ -161872,7 +163029,7 @@ var ts; } break; } - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: var importTypeNode = parent; changes.replaceNode(importingSourceFile, parent, ts.factory.createImportTypeNode(importTypeNode.argument, importTypeNode.assertions, ts.factory.createIdentifier(exportName), importTypeNode.typeArguments, importTypeNode.isTypeOf)); break; @@ -161883,11 +163040,11 @@ var ts; function changeNamedToDefaultImport(importingSourceFile, ref, changes) { var parent = ref.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // `a.foo` --> `a.default` changes.replaceNode(importingSourceFile, ref, ts.factory.createIdentifier("default")); break; - case 270 /* SyntaxKind.ImportSpecifier */: { + case 273 /* SyntaxKind.ImportSpecifier */: { // `import { foo } from "./a";` --> `import foo from "./a";` // `import { foo as bar } from "./a";` --> `import bar from "./a";` var defaultImport = ts.factory.createIdentifier(parent.name.text); @@ -161900,7 +163057,7 @@ var ts; } break; } - case 275 /* SyntaxKind.ExportSpecifier */: { + case 278 /* SyntaxKind.ExportSpecifier */: { // `export { foo } from "./a";` --> `export { default as foo } from "./a";` // `export { foo as bar } from "./a";` --> `export { default as bar } from "./a";` // `export { foo as default } from "./a";` --> `export { default } from "./a";` @@ -162001,7 +163158,7 @@ var ts; if (!importClause.namedBindings) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_namespace_import_or_named_imports) }; } - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { return { convertTo: 0 /* ImportKind.Named */, import: importClause.namedBindings }; } var shouldUseDefault = getShouldUseDefault(context.program, importClause); @@ -162192,7 +163349,6 @@ var ts; }); return { edits: edits, renameFilename: undefined, renameLocation: undefined }; } - ; function isValidExpression(node) { return ts.isBinaryExpression(node) || ts.isConditionalExpression(node); } @@ -162240,7 +163396,6 @@ var ts; if (expression.operatorToken.kind !== 55 /* SyntaxKind.AmpersandAmpersandToken */) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_logical_AND_access_chains) }; } - ; var finalExpression = getFinalExpressionInChain(expression.right); if (!finalExpression) return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_convertible_access_expression) }; @@ -162450,27 +163605,27 @@ var ts; var lastDeclaration = signatureDecls[signatureDecls.length - 1]; var updated = lastDeclaration; switch (lastDeclaration.kind) { - case 168 /* SyntaxKind.MethodSignature */: { + case 170 /* SyntaxKind.MethodSignature */: { updated = ts.factory.updateMethodSignature(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.name, lastDeclaration.questionToken, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 169 /* SyntaxKind.MethodDeclaration */: { + case 171 /* SyntaxKind.MethodDeclaration */: { updated = ts.factory.updateMethodDeclaration(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.asteriskToken, lastDeclaration.name, lastDeclaration.questionToken, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type, lastDeclaration.body); break; } - case 174 /* SyntaxKind.CallSignature */: { + case 176 /* SyntaxKind.CallSignature */: { updated = ts.factory.updateCallSignature(lastDeclaration, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 171 /* SyntaxKind.Constructor */: { + case 173 /* SyntaxKind.Constructor */: { updated = ts.factory.updateConstructorDeclaration(lastDeclaration, lastDeclaration.modifiers, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.body); break; } - case 175 /* SyntaxKind.ConstructSignature */: { + case 177 /* SyntaxKind.ConstructSignature */: { updated = ts.factory.updateConstructSignature(lastDeclaration, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { updated = ts.factory.updateFunctionDeclaration(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.asteriskToken, lastDeclaration.name, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type, lastDeclaration.body); break; } @@ -162501,7 +163656,7 @@ var ts; } function convertParameterToNamedTupleMember(p) { ts.Debug.assert(ts.isIdentifier(p.name)); // This is checked during refactoring applicability checking - var result = ts.setTextRange(ts.factory.createNamedTupleMember(p.dotDotDotToken, p.name, p.questionToken, p.type || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)), p); + var result = ts.setTextRange(ts.factory.createNamedTupleMember(p.dotDotDotToken, p.name, p.questionToken, p.type || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)), p); var parameterDocComment = p.symbol && p.symbol.getDocumentationComment(checker); if (parameterDocComment) { var newComment = ts.displayPartsToString(parameterDocComment); @@ -162521,12 +163676,12 @@ var ts; } function isConvertableSignatureDeclaration(d) { switch (d.kind) { - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 174 /* SyntaxKind.CallSignature */: - case 171 /* SyntaxKind.Constructor */: - case 175 /* SyntaxKind.ConstructSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 176 /* SyntaxKind.CallSignature */: + case 173 /* SyntaxKind.Constructor */: + case 177 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: return true; } return false; @@ -162921,20 +164076,20 @@ var ts; function checkForStaticContext(nodeToCheck, containingClass) { var current = nodeToCheck; while (current !== containingClass) { - if (current.kind === 167 /* SyntaxKind.PropertyDeclaration */) { + if (current.kind === 169 /* SyntaxKind.PropertyDeclaration */) { if (ts.isStatic(current)) { rangeFacts |= RangeFacts.InStaticRegion; } break; } - else if (current.kind === 164 /* SyntaxKind.Parameter */) { + else if (current.kind === 166 /* SyntaxKind.Parameter */) { var ctorOrMethod = ts.getContainingFunction(current); - if (ctorOrMethod.kind === 171 /* SyntaxKind.Constructor */) { + if (ctorOrMethod.kind === 173 /* SyntaxKind.Constructor */) { rangeFacts |= RangeFacts.InStaticRegion; } break; } - else if (current.kind === 169 /* SyntaxKind.MethodDeclaration */) { + else if (current.kind === 171 /* SyntaxKind.MethodDeclaration */) { if (ts.isStatic(current)) { rangeFacts |= RangeFacts.InStaticRegion; } @@ -162972,9 +164127,9 @@ var ts; visit(nodeToCheck); if (rangeFacts & RangeFacts.UsesThis) { var container = ts.getThisContainer(nodeToCheck, /** includeArrowFunctions */ false); - if (container.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) || - container.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (container.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) || + container.kind === 215 /* SyntaxKind.FunctionExpression */) { rangeFacts |= RangeFacts.UsesThisInFunction; } } @@ -162985,7 +164140,7 @@ var ts; return true; } if (ts.isDeclaration(node)) { - var declaringNode = (node.kind === 254 /* SyntaxKind.VariableDeclaration */) ? node.parent.parent : node; + var declaringNode = (node.kind === 257 /* SyntaxKind.VariableDeclaration */) ? node.parent.parent : node; if (ts.hasSyntacticModifier(declaringNode, 1 /* ModifierFlags.Export */)) { // TODO: GH#18217 Silly to use `errors ||` since it's definitely not defined (see top of `visit`) // Also, if we're only pushing one error, just use `let error: Diagnostic | undefined`! @@ -162997,16 +164152,16 @@ var ts; } // Some things can't be extracted in certain situations switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractImport)); return true; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractExportedEntity)); return true; case 106 /* SyntaxKind.SuperKeyword */: // For a super *constructor call*, we have to be extracting the entire class, // but a super *method call* simply implies a 'this' reference - if (node.parent.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.parent.kind === 210 /* SyntaxKind.CallExpression */) { // Super constructor call var containingClass_1 = ts.getContainingClass(node); if (containingClass_1 === undefined || containingClass_1.pos < span.start || containingClass_1.end >= (span.start + span.length)) { @@ -163019,7 +164174,7 @@ var ts; thisNode = node; } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // check if arrow function uses this ts.forEachChild(node, function check(n) { if (ts.isThis(n)) { @@ -163034,39 +164189,39 @@ var ts; } }); // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.isSourceFile(node.parent) && node.parent.externalModuleIndicator === undefined) { // You cannot extract global declarations (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.functionWillNotBeVisibleInTheNewScope)); } // falls through - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // do not dive into functions or classes return false; } var savedPermittedJumps = permittedJumps; switch (node.kind) { - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: permittedJumps &= ~4 /* PermittedJumps.Return */; break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // forbid all jumps inside try blocks permittedJumps = 0 /* PermittedJumps.None */; break; - case 235 /* SyntaxKind.Block */: - if (node.parent && node.parent.kind === 252 /* SyntaxKind.TryStatement */ && node.parent.finallyBlock === node) { + case 238 /* SyntaxKind.Block */: + if (node.parent && node.parent.kind === 255 /* SyntaxKind.TryStatement */ && node.parent.finallyBlock === node) { // allow unconditional returns from finally blocks permittedJumps = 4 /* PermittedJumps.Return */; } break; - case 290 /* SyntaxKind.DefaultClause */: - case 289 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: // allow unlabeled break inside case clauses permittedJumps |= 1 /* PermittedJumps.Break */; break; @@ -163078,20 +164233,20 @@ var ts; break; } switch (node.kind) { - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 108 /* SyntaxKind.ThisKeyword */: rangeFacts |= RangeFacts.UsesThis; thisNode = node; break; - case 250 /* SyntaxKind.LabeledStatement */: { + case 253 /* SyntaxKind.LabeledStatement */: { var label = node.label; (seenLabels || (seenLabels = [])).push(label.escapedText); ts.forEachChild(node, visit); seenLabels.pop(); break; } - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: { + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: { var label = node.label; if (label) { if (!ts.contains(seenLabels, label.escapedText)) { @@ -163100,20 +164255,20 @@ var ts; } } else { - if (!(permittedJumps & (node.kind === 246 /* SyntaxKind.BreakStatement */ ? 1 /* PermittedJumps.Break */ : 2 /* PermittedJumps.Continue */))) { + if (!(permittedJumps & (node.kind === 249 /* SyntaxKind.BreakStatement */ ? 1 /* PermittedJumps.Break */ : 2 /* PermittedJumps.Continue */))) { // attempt to break or continue in a forbidden context (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractRangeContainingConditionalBreakOrContinueStatements)); } } break; } - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: rangeFacts |= RangeFacts.IsAsyncFunction; break; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: rangeFacts |= RangeFacts.IsGenerator; break; - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: if (permittedJumps & 4 /* PermittedJumps.Return */) { rangeFacts |= RangeFacts.HasReturn; } @@ -163183,7 +164338,7 @@ var ts; while (true) { current = current.parent; // A function parameter's initializer is actually in the outer scope, not the function declaration - if (current.kind === 164 /* SyntaxKind.Parameter */) { + if (current.kind === 166 /* SyntaxKind.Parameter */) { // Skip all the way to the outer scope of the function that declared this parameter current = ts.findAncestor(current, function (parent) { return ts.isFunctionLikeDeclaration(parent); }).parent; } @@ -163194,7 +164349,7 @@ var ts; // * Module/namespace or source file if (isScope(current)) { scopes.push(current); - if (current.kind === 305 /* SyntaxKind.SourceFile */) { + if (current.kind === 308 /* SyntaxKind.SourceFile */) { return scopes; } } @@ -163284,32 +164439,32 @@ var ts; } function getDescriptionForFunctionLikeDeclaration(scope) { switch (scope.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "constructor"; - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return scope.name ? "function '".concat(scope.name.text, "'") : ts.ANONYMOUS; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return "arrow function"; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return "method '".concat(scope.name.getText(), "'"); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return "'get ".concat(scope.name.getText(), "'"); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return "'set ".concat(scope.name.getText(), "'"); default: throw ts.Debug.assertNever(scope, "Unexpected scope kind ".concat(scope.kind)); } } function getDescriptionForClassLikeDeclaration(scope) { - return scope.kind === 257 /* SyntaxKind.ClassDeclaration */ + return scope.kind === 260 /* SyntaxKind.ClassDeclaration */ ? scope.name ? "class '".concat(scope.name.text, "'") : "anonymous class declaration" : scope.name ? "class expression '".concat(scope.name.text, "'") : "anonymous class expression"; } function getDescriptionForModuleLikeDeclaration(scope) { - return scope.kind === 262 /* SyntaxKind.ModuleBlock */ + return scope.kind === 265 /* SyntaxKind.ModuleBlock */ ? "namespace '".concat(scope.parent.name.getText(), "'") : scope.externalModuleIndicator ? 0 /* SpecialScope.Module */ : 1 /* SpecialScope.Global */; } @@ -163382,7 +164537,7 @@ var ts; modifiers.push(ts.factory.createModifier(124 /* SyntaxKind.StaticKeyword */)); } if (range.facts & RangeFacts.IsAsyncFunction) { - modifiers.push(ts.factory.createModifier(131 /* SyntaxKind.AsyncKeyword */)); + modifiers.push(ts.factory.createModifier(132 /* SyntaxKind.AsyncKeyword */)); } newFunction = ts.factory.createMethodDeclaration(modifiers.length ? modifiers : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, /*questionToken*/ undefined, typeParameters, parameters, returnType, body); @@ -163396,7 +164551,7 @@ var ts; /*questionToken*/ undefined, checker.typeToTypeNode(checker.getTypeAtLocation(range.thisNode), scope, 1 /* NodeBuilderFlags.NoTruncation */), /*initializer*/ undefined)); } - newFunction = ts.factory.createFunctionDeclaration(range.facts & RangeFacts.IsAsyncFunction ? [ts.factory.createToken(131 /* SyntaxKind.AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body); + newFunction = ts.factory.createFunctionDeclaration(range.facts & RangeFacts.IsAsyncFunction ? [ts.factory.createToken(132 /* SyntaxKind.AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body); } var changeTracker = ts.textChanges.ChangeTracker.fromContext(context); var minInsertionPos = (isReadonlyArray(range.range) ? ts.last(range.range) : range.range).end; @@ -163544,9 +164699,9 @@ var ts; while (ts.isParenthesizedTypeNode(withoutParens)) { withoutParens = withoutParens.type; } - return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 153 /* SyntaxKind.UndefinedKeyword */; }) + return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 155 /* SyntaxKind.UndefinedKeyword */; }) ? clone - : ts.factory.createUnionTypeNode([clone, ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)]); + : ts.factory.createUnionTypeNode([clone, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)]); } } /** @@ -163577,7 +164732,7 @@ var ts; if (rangeFacts & RangeFacts.InStaticRegion) { modifiers.push(ts.factory.createModifier(124 /* SyntaxKind.StaticKeyword */)); } - modifiers.push(ts.factory.createModifier(145 /* SyntaxKind.ReadonlyKeyword */)); + modifiers.push(ts.factory.createModifier(146 /* SyntaxKind.ReadonlyKeyword */)); var newVariable = ts.factory.createPropertyDeclaration(modifiers, localNameText, /*questionToken*/ undefined, variableType, initializer); var localReference = ts.factory.createPropertyAccessExpression(rangeFacts & RangeFacts.InStaticRegion @@ -163608,7 +164763,7 @@ var ts; var localReference = ts.factory.createIdentifier(localNameText); changeTracker.replaceNode(context.file, node, localReference); } - else if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) { + else if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) { // If the parent is an expression statement and the target scope is the immediately enclosing one, // replace the statement with the declaration. var newVariableStatement = ts.factory.createVariableStatement( @@ -163627,7 +164782,7 @@ var ts; changeTracker.insertNodeBefore(context.file, nodeToInsertBefore, newVariableStatement, /*blankLineBetween*/ false); } // Consume - if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */) { + if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */) { // If the parent is an expression statement, delete it. changeTracker.delete(context.file, node.parent); } @@ -164273,30 +165428,30 @@ var ts; function isExtractableExpression(node) { var parent = node.parent; switch (parent.kind) { - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return false; } switch (node.kind) { case 10 /* SyntaxKind.StringLiteral */: - return parent.kind !== 266 /* SyntaxKind.ImportDeclaration */ && - parent.kind !== 270 /* SyntaxKind.ImportSpecifier */; - case 225 /* SyntaxKind.SpreadElement */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 203 /* SyntaxKind.BindingElement */: + return parent.kind !== 269 /* SyntaxKind.ImportDeclaration */ && + parent.kind !== 273 /* SyntaxKind.ImportSpecifier */; + case 227 /* SyntaxKind.SpreadElement */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 205 /* SyntaxKind.BindingElement */: return false; case 79 /* SyntaxKind.Identifier */: - return parent.kind !== 203 /* SyntaxKind.BindingElement */ && - parent.kind !== 270 /* SyntaxKind.ImportSpecifier */ && - parent.kind !== 275 /* SyntaxKind.ExportSpecifier */; + return parent.kind !== 205 /* SyntaxKind.BindingElement */ && + parent.kind !== 273 /* SyntaxKind.ImportSpecifier */ && + parent.kind !== 278 /* SyntaxKind.ExportSpecifier */; } return true; } function isBlockLike(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 305 /* SyntaxKind.SourceFile */: - case 262 /* SyntaxKind.ModuleBlock */: - case 289 /* SyntaxKind.CaseClause */: + case 238 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 265 /* SyntaxKind.ModuleBlock */: + case 292 /* SyntaxKind.CaseClause */: return true; default: return false; @@ -164584,7 +165739,6 @@ var ts; (function (ts) { var refactor; (function (refactor) { - ; /** * Checks if some refactor info has refactor error info. */ @@ -164689,15 +165843,14 @@ var ts; // Imports will be copied to the new file anyway, and may still be needed in the old file. // Prologue directives will be copied to the new file and should be left in the old file. return !isPureImport(statement) && !ts.isPrologueDirective(statement); - ; } function isPureImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return true; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return !ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return node.declarationList.declarations.every(function (d) { return !!d.initializer && ts.isRequireCall(d.initializer, /*checkArgumentIsStringLiteralLike*/ true); }); default: return false; @@ -164793,12 +165946,12 @@ var ts; } function getNamespaceLikeImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? + case 269 /* SyntaxKind.ImportDeclaration */: + return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? node.importClause.namedBindings.name : undefined; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.name; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.tryCast(node.name, ts.isIdentifier); default: return ts.Debug.assertNever(node, "Unexpected node kind ".concat(node.kind)); @@ -164829,21 +165982,21 @@ var ts; var newNamespaceId = ts.factory.createIdentifier(newNamespaceName); var newModuleString = ts.factory.createStringLiteral(newModuleSpecifier); switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, /*name*/ undefined, ts.factory.createNamespaceImport(newNamespaceId)), newModuleString, /*assertClause*/ undefined); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.factory.createImportEqualsDeclaration(/*modifiers*/ undefined, /*isTypeOnly*/ false, newNamespaceId, ts.factory.createExternalModuleReference(newModuleString)); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.factory.createVariableDeclaration(newNamespaceId, /*exclamationToken*/ undefined, /*type*/ undefined, createRequireCall(newModuleString)); default: return ts.Debug.assertNever(node, "Unexpected node kind ".concat(node.kind)); } } function moduleSpecifierFromImport(i) { - return (i.kind === 266 /* SyntaxKind.ImportDeclaration */ ? i.moduleSpecifier - : i.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ ? i.moduleReference.expression + return (i.kind === 269 /* SyntaxKind.ImportDeclaration */ ? i.moduleSpecifier + : i.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? i.moduleReference.expression : i.initializer.arguments[0]); } function forEachImportInStatement(statement, cb) { @@ -164913,15 +166066,15 @@ var ts; } function deleteUnusedImports(sourceFile, importDecl, changes, isUnused) { switch (importDecl.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: deleteUnusedImportsInDeclaration(sourceFile, importDecl, changes, isUnused); break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: if (isUnused(importDecl.name)) { changes.delete(sourceFile, importDecl); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: deleteUnusedImportsInVariableDeclaration(sourceFile, importDecl, changes, isUnused); break; default: @@ -164934,7 +166087,7 @@ var ts; var _a = importDecl.importClause, name = _a.name, namedBindings = _a.namedBindings; var defaultUnused = !name || isUnused(name); var namedBindingsUnused = !namedBindings || - (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); })); + (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); })); if (defaultUnused && namedBindingsUnused) { changes.delete(sourceFile, importDecl); } @@ -164946,7 +166099,7 @@ var ts; if (namedBindingsUnused) { changes.replaceNode(sourceFile, importDecl.importClause, ts.factory.updateImportClause(importDecl.importClause, importDecl.importClause.isTypeOnly, name, /*namedBindings*/ undefined)); } - else if (namedBindings.kind === 269 /* SyntaxKind.NamedImports */) { + else if (namedBindings.kind === 272 /* SyntaxKind.NamedImports */) { for (var _i = 0, _b = namedBindings.elements; _i < _b.length; _i++) { var element = _b[_i]; if (isUnused(element.name)) @@ -164964,9 +166117,9 @@ var ts; changes.delete(sourceFile, name); } break; - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: break; - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: if (name.elements.every(function (e) { return ts.isIdentifier(e.name) && isUnused(e.name); })) { changes.delete(sourceFile, ts.isVariableDeclarationList(varDecl.parent) && varDecl.parent.declarations.length === 1 ? varDecl.parent.parent : varDecl); } @@ -165008,7 +166161,7 @@ var ts; if (markSeenTop(top)) { addExportToChanges(oldFile, top, name, changes, useEsModuleSyntax); } - if (ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */)) { oldFileDefault = name; } else { @@ -165096,14 +166249,14 @@ var ts; // Below should all be utilities function isInImport(decl) { switch (decl.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return isVariableDeclarationInImport(decl); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return ts.isVariableDeclaration(decl.parent.parent) && isVariableDeclarationInImport(decl.parent.parent); default: return false; @@ -165115,7 +166268,7 @@ var ts; } function filterImport(i, moduleSpecifier, keep) { switch (i.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: { + case 269 /* SyntaxKind.ImportDeclaration */: { var clause = i.importClause; if (!clause) return undefined; @@ -165125,9 +166278,9 @@ var ts; ? ts.factory.createImportDeclaration(/*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, defaultImport, namedBindings), moduleSpecifier, /*assertClause*/ undefined) : undefined; } - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return keep(i.name) ? i : undefined; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var name = filterBindingName(i.name, keep); return name ? makeVariableStatement(name, i.type, createRequireCall(moduleSpecifier), i.parent.flags) : undefined; } @@ -165136,7 +166289,7 @@ var ts; } } function filterNamedBindings(namedBindings, keep) { - if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { return keep(namedBindings.name) ? namedBindings : undefined; } else { @@ -165148,9 +166301,9 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return keep(name) ? name : undefined; - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return name; - case 201 /* SyntaxKind.ObjectBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: { // We can't handle nested destructurings or property names well here, so just copy them all. var newElements = name.elements.filter(function (prop) { return prop.propertyName || !ts.isIdentifier(prop.name) || keep(prop.name); }); return newElements.length ? ts.factory.createObjectBindingPattern(newElements) : undefined; @@ -165207,13 +166360,13 @@ var ts; } function isNonVariableTopLevelDeclaration(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return true; default: return false; @@ -165221,17 +166374,17 @@ var ts; } function forEachTopLevelDeclaration(statement, cb) { switch (statement.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return cb(statement); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.firstDefined(statement.declarationList.declarations, function (decl) { return forEachTopLevelDeclarationInBindingName(decl.name, cb); }); - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; return ts.isBinaryExpression(expression) && ts.getAssignmentDeclarationKind(expression) === 1 /* AssignmentDeclarationKind.ExportsProperty */ ? cb(statement) @@ -165243,8 +166396,8 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return cb(ts.cast(name.parent, function (x) { return ts.isVariableDeclaration(x) || ts.isBindingElement(x); })); - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return ts.firstDefined(name.elements, function (em) { return ts.isOmittedExpression(em) ? undefined : forEachTopLevelDeclarationInBindingName(em.name, cb); }); default: return ts.Debug.assertNever(name, "Unexpected name kind ".concat(name.kind)); @@ -165255,9 +166408,9 @@ var ts; } function getTopLevelDeclarationStatement(d) { switch (d.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return d.parent.parent; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getTopLevelDeclarationStatement(ts.cast(d.parent.parent, function (p) { return ts.isVariableDeclaration(p) || ts.isBindingElement(p); })); default: return d; @@ -165289,24 +166442,24 @@ var ts; function addEs6Export(d) { var modifiers = ts.canHaveModifiers(d) ? ts.concatenate([ts.factory.createModifier(93 /* SyntaxKind.ExportKeyword */)], ts.getModifiers(d)) : undefined; switch (d.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return ts.factory.updateFunctionDeclaration(d, modifiers, d.asteriskToken, d.name, d.typeParameters, d.parameters, d.type, d.body); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var decorators = ts.canHaveDecorators(d) ? ts.getDecorators(d) : undefined; return ts.factory.updateClassDeclaration(d, ts.concatenate(decorators, modifiers), d.name, d.typeParameters, d.heritageClauses, d.members); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.factory.updateVariableStatement(d, modifiers, d.declarationList); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.factory.updateModuleDeclaration(d, modifiers, d.name, d.body); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.factory.updateEnumDeclaration(d, modifiers, d.name, d.members); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return ts.factory.updateTypeAliasDeclaration(d, modifiers, d.name, d.typeParameters, d.type); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.factory.updateInterfaceDeclaration(d, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.factory.updateImportEqualsDeclaration(d, modifiers, d.isTypeOnly, d.name, d.moduleReference); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.Debug.fail(); // Shouldn't try to add 'export' keyword to `exports.x = ...` default: return ts.Debug.assertNever(d, "Unexpected declaration kind ".concat(d.kind)); @@ -165317,18 +166470,18 @@ var ts; } function getNamesToExportInCommonJS(decl) { switch (decl.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return [decl.name.text]; // TODO: GH#18217 - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.mapDefined(decl.declarationList.declarations, function (d) { return ts.isIdentifier(d.name) ? d.name.text : undefined; }); - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.emptyArray; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.Debug.fail("Can't export an ExpressionStatement"); // Shouldn't try to add 'export' keyword to `exports.x = ...` default: return ts.Debug.assertNever(decl, "Unexpected decl kind ".concat(decl.kind)); @@ -165669,15 +166822,15 @@ var ts; var parent = functionReference.parent; switch (parent.kind) { // foo(...) or super(...) or new Foo(...) - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: var callOrNewExpression = ts.tryCast(parent, ts.isCallOrNewExpression); if (callOrNewExpression && callOrNewExpression.expression === functionReference) { return callOrNewExpression; } break; // x.foo(...) - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression); if (propertyAccessExpression && propertyAccessExpression.parent && propertyAccessExpression.name === functionReference) { var callOrNewExpression_1 = ts.tryCast(propertyAccessExpression.parent, ts.isCallOrNewExpression); @@ -165687,7 +166840,7 @@ var ts; } break; // x["foo"](...) - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression); if (elementAccessExpression && elementAccessExpression.parent && elementAccessExpression.argumentExpression === functionReference) { var callOrNewExpression_2 = ts.tryCast(elementAccessExpression.parent, ts.isCallOrNewExpression); @@ -165706,14 +166859,14 @@ var ts; var parent = reference.parent; switch (parent.kind) { // `C.foo` - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression); if (propertyAccessExpression && propertyAccessExpression.expression === reference) { return propertyAccessExpression; } break; // `C["foo"]` - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression); if (elementAccessExpression && elementAccessExpression.expression === reference) { return elementAccessExpression; @@ -165759,16 +166912,16 @@ var ts; if (!isValidParameterNodeArray(functionDeclaration.parameters, checker)) return false; switch (functionDeclaration.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return hasNameOrDefault(functionDeclaration) && isSingleImplementation(functionDeclaration, checker); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: if (ts.isObjectLiteralExpression(functionDeclaration.parent)) { var contextualSymbol = getSymbolForContextualType(functionDeclaration.name, checker); // don't offer the refactor when there are multiple signatures since we won't know which ones the user wants to change return ((_a = contextualSymbol === null || contextualSymbol === void 0 ? void 0 : contextualSymbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 && isSingleImplementation(functionDeclaration, checker); } return isSingleImplementation(functionDeclaration, checker); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: if (ts.isClassDeclaration(functionDeclaration.parent)) { return hasNameOrDefault(functionDeclaration.parent) && isSingleImplementation(functionDeclaration, checker); } @@ -165776,8 +166929,8 @@ var ts; return isValidVariableDeclaration(functionDeclaration.parent.parent) && isSingleImplementation(functionDeclaration, checker); } - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return isValidVariableDeclaration(functionDeclaration.parent); } return false; @@ -165925,7 +167078,7 @@ var ts; } function getClassNames(constructorDeclaration) { switch (constructorDeclaration.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var classDeclaration = constructorDeclaration.parent; if (classDeclaration.name) return [classDeclaration.name]; @@ -165933,7 +167086,7 @@ var ts; // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault` var defaultModifier = ts.Debug.checkDefined(ts.findModifier(classDeclaration, 88 /* SyntaxKind.DefaultKeyword */), "Nameless class declaration should be a default export"); return [defaultModifier]; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: var classExpression = constructorDeclaration.parent; var variableDeclaration = constructorDeclaration.parent.parent; var className = classExpression.name; @@ -165944,25 +167097,25 @@ var ts; } function getFunctionNames(functionDeclaration) { switch (functionDeclaration.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (functionDeclaration.name) return [functionDeclaration.name]; // If the function declaration doesn't have a name, it should have a default modifier. // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault` var defaultModifier = ts.Debug.checkDefined(ts.findModifier(functionDeclaration, 88 /* SyntaxKind.DefaultKeyword */), "Nameless function declaration should be a default export"); return [defaultModifier]; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return [functionDeclaration.name]; - case 171 /* SyntaxKind.Constructor */: - var ctrKeyword = ts.Debug.checkDefined(ts.findChildOfKind(functionDeclaration, 134 /* SyntaxKind.ConstructorKeyword */, functionDeclaration.getSourceFile()), "Constructor declaration should have constructor keyword"); - if (functionDeclaration.parent.kind === 226 /* SyntaxKind.ClassExpression */) { + case 173 /* SyntaxKind.Constructor */: + var ctrKeyword = ts.Debug.checkDefined(ts.findChildOfKind(functionDeclaration, 135 /* SyntaxKind.ConstructorKeyword */, functionDeclaration.getSourceFile()), "Constructor declaration should have constructor keyword"); + if (functionDeclaration.parent.kind === 228 /* SyntaxKind.ClassExpression */) { var variableDeclaration = functionDeclaration.parent.parent; return [variableDeclaration.name, ctrKeyword]; } return [ctrKeyword]; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return [functionDeclaration.parent.name]; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (functionDeclaration.name) return [functionDeclaration.name, functionDeclaration.parent.name]; return [functionDeclaration.parent.name]; @@ -166053,11 +167206,11 @@ var ts; function getParentBinaryExpression(expr) { var container = ts.findAncestor(expr.parent, function (n) { switch (n.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return false; - case 223 /* SyntaxKind.TemplateExpression */: - case 221 /* SyntaxKind.BinaryExpression */: + case 225 /* SyntaxKind.TemplateExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return !(ts.isBinaryExpression(n.parent) && isNotEqualsOperator(n.parent)); default: return "quit"; @@ -166505,10 +167658,10 @@ var ts; } function isConvertibleDeclaration(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: return true; default: return false; @@ -166553,7 +167706,7 @@ var ts; this.kind = kind; } NodeObject.prototype.assertHasRealPosition = function (message) { - // eslint-disable-next-line debug-assert + // eslint-disable-next-line local/debug-assert ts.Debug.assert(!ts.positionIsSynthesized(this.pos) && !ts.positionIsSynthesized(this.end), message || "Node must have a real position for this operation"); }; NodeObject.prototype.getSourceFile = function () { @@ -166610,8 +167763,8 @@ var ts; if (!children.length) { return undefined; } - var child = ts.find(children, function (kid) { return kid.kind < 309 /* SyntaxKind.FirstJSDocNode */ || kid.kind > 347 /* SyntaxKind.LastJSDocNode */; }); - return child.kind < 161 /* SyntaxKind.FirstNode */ ? + var child = ts.find(children, function (kid) { return kid.kind < 312 /* SyntaxKind.FirstJSDocNode */ || kid.kind > 350 /* SyntaxKind.LastJSDocNode */; }); + return child.kind < 163 /* SyntaxKind.FirstNode */ ? child : child.getFirstToken(sourceFile); }; @@ -166622,7 +167775,7 @@ var ts; if (!child) { return undefined; } - return child.kind < 161 /* SyntaxKind.FirstNode */ ? child : child.getLastToken(sourceFile); + return child.kind < 163 /* SyntaxKind.FirstNode */ ? child : child.getLastToken(sourceFile); }; NodeObject.prototype.forEachChild = function (cbNode, cbNodeArray) { return ts.forEachChild(this, cbNode, cbNodeArray); @@ -166682,7 +167835,7 @@ var ts; } } function createSyntaxList(nodes, parent) { - var list = createNode(348 /* SyntaxKind.SyntaxList */, nodes.pos, nodes.end, parent); + var list = createNode(351 /* SyntaxKind.SyntaxList */, nodes.pos, nodes.end, parent); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { @@ -167031,7 +168184,7 @@ var ts; var _a; if (!seenSymbols_1.has(symbol)) { seenSymbols_1.add(symbol); - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) { return symbol.getContextualJsDocTags(declaration, checker); } return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 ? symbol.getJsDocTags() : undefined; @@ -167058,7 +168211,7 @@ var ts; var inheritedDocs = findBaseOfDeclaration(checker, declaration, function (symbol) { if (!seenSymbols_2.has(symbol)) { seenSymbols_2.add(symbol); - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) { return symbol.getContextualDocumentationComment(declaration, checker); } return symbol.getDocumentationComment(checker); @@ -167077,7 +168230,7 @@ var ts; } function findBaseOfDeclaration(checker, declaration, cb) { var _a; - var classOrInterfaceDeclaration = ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.kind) === 171 /* SyntaxKind.Constructor */ ? declaration.parent.parent : declaration.parent; + var classOrInterfaceDeclaration = ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.kind) === 173 /* SyntaxKind.Constructor */ ? declaration.parent.parent : declaration.parent; if (!classOrInterfaceDeclaration) return; var isStaticMember = ts.hasStaticModifier(declaration); @@ -167092,7 +168245,7 @@ var ts; __extends(SourceFileObject, _super); function SourceFileObject(kind, pos, end) { var _this = _super.call(this, kind, pos, end) || this; - _this.kind = 305 /* SyntaxKind.SourceFile */; + _this.kind = 308 /* SyntaxKind.SourceFile */; return _this; } SourceFileObject.prototype.update = function (newText, textChangeRange) { @@ -167151,10 +168304,10 @@ var ts; } function visit(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -167174,31 +168327,31 @@ var ts; } ts.forEachChild(node, visit); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 182 /* SyntaxKind.TypeLiteral */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 184 /* SyntaxKind.TypeLiteral */: addDeclaration(node); ts.forEachChild(node, visit); break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Only consider parameter properties if (!ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */)) { break; } // falls through - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: { + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: { var decl = node; if (ts.isBindingPattern(decl.name)) { ts.forEachChild(decl.name, visit); @@ -167209,12 +168362,12 @@ var ts; } } // falls through - case 299 /* SyntaxKind.EnumMember */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: addDeclaration(node); break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; var exportDeclaration = node; @@ -167227,7 +168380,7 @@ var ts; } } break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -167239,7 +168392,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -167248,7 +168401,7 @@ var ts; } } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.getAssignmentDeclarationKind(node) !== 0 /* AssignmentDeclarationKind.None */) { addDeclaration(node); } @@ -167660,6 +168813,10 @@ var ts; getCurrentDirectory: compilerHost.getCurrentDirectory, onUnRecoverableConfigFileDiagnostic: ts.noop, }; + // The call to isProgramUptoDate below may refer back to documentRegistryBucketKey; + // calculate this early so it's not undefined if downleveled to a var (or, if emitted + // 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)) { return; @@ -167669,7 +168826,6 @@ var ts; // instance. If we cancel midway through, we may end up in an inconsistent state where // the program points to old source files that have been invalidated because of // incremental parsing. - var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); var options = { rootNames: rootFileNames, options: newSettings, @@ -167965,16 +169121,16 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return !ts.isLabelName(node) && !ts.isTagName(node) && !ts.isConstTypeReference(node.parent); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: // Don't return quickInfo if inside the comment in `a/**/.b` return !ts.isInComment(sourceFile, position); case 108 /* SyntaxKind.ThisKeyword */: - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 106 /* SyntaxKind.SuperKeyword */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return true; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return ts.isImportMeta(node); default: return false; @@ -168081,15 +169237,15 @@ var ts; return undefined; } switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: case 10 /* SyntaxKind.StringLiteral */: case 95 /* SyntaxKind.FalseKeyword */: case 110 /* SyntaxKind.TrueKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 106 /* SyntaxKind.SuperKeyword */: case 108 /* SyntaxKind.ThisKeyword */: - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 79 /* SyntaxKind.Identifier */: break; // Cant create the text span @@ -168106,7 +169262,7 @@ var ts; // If this is name of a module declarations, check if this is right side of dotted module name // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of // Then this name is name from dotted module - if (nodeForStartPos.parent.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -168855,7 +170011,7 @@ var ts; */ function literalIsName(node) { return ts.isDeclarationName(node) || - node.parent.kind === 277 /* SyntaxKind.ExternalModuleReference */ || + node.parent.kind === 280 /* SyntaxKind.ExternalModuleReference */ || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node); } @@ -168873,13 +170029,13 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 8 /* SyntaxKind.NumericLiteral */: - if (node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { return ts.isObjectLiteralElement(node.parent.parent) ? node.parent.parent : undefined; } // falls through case 79 /* SyntaxKind.Identifier */: return ts.isObjectLiteralElement(node.parent) && - (node.parent.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || node.parent.parent.kind === 286 /* SyntaxKind.JsxAttributes */) && + (node.parent.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || node.parent.parent.kind === 289 /* SyntaxKind.JsxAttributes */) && node.parent.name === node ? node.parent : undefined; } return undefined; @@ -168921,7 +170077,7 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && + node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && node.parent.argumentExpression === node; } /** @@ -169014,114 +170170,114 @@ var ts; if (node) { var parent = node.parent; switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 254 /* SyntaxKind.VariableDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return spanInVariableDeclaration(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return spanInParameterDeclaration(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return spanInFunctionDeclaration(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // falls through - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return spanInBlock(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return spanInBlock(node.block); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: // Span on while(...) return textSpanEndingAtNextToken(node, node.expression); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 253 /* SyntaxKind.DebuggerStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: // set on if(..) span return textSpanEndingAtNextToken(node, node.expression); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: // span in statement return spanInNode(node.statement); - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return spanInForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: // span of for (a in ...) return textSpanEndingAtNextToken(node, node.expression); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: // span in initializer return spanInInitializerOfForLike(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: // span on switch(...) return textSpanEndingAtNextToken(node, node.expression); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 203 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 205 /* SyntaxKind.BindingElement */: // span on complete node return textSpan(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: // span in statement return spanInNode(node.statement); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return spanInNodeArray(parent.modifiers, node, ts.isDecorator); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return spanInBindingPattern(node); // No breakpoint in interface, type alias - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return undefined; // Tokens: case 26 /* SyntaxKind.SemicolonToken */: @@ -169151,7 +170307,7 @@ var ts; case 83 /* SyntaxKind.CatchKeyword */: case 96 /* SyntaxKind.FinallyKeyword */: return spanInNextNode(node); - case 160 /* SyntaxKind.OfKeyword */: + case 162 /* SyntaxKind.OfKeyword */: return spanInOfKeyword(node); default: // Destructuring pattern in destructuring assignment @@ -169164,13 +170320,13 @@ var ts; // `a` or `...c` or `d: x` from // `[a, b, ...c]` or `{ a, b }` or `{ d: x }` from destructuring pattern if ((node.kind === 79 /* SyntaxKind.Identifier */ || - node.kind === 225 /* SyntaxKind.SpreadElement */ || - node.kind === 296 /* SyntaxKind.PropertyAssignment */ || - node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) && + node.kind === 227 /* SyntaxKind.SpreadElement */ || + node.kind === 299 /* SyntaxKind.PropertyAssignment */ || + node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(parent)) { return textSpan(node); } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */) { var _a = node, left = _a.left, operatorToken = _a.operatorToken; // Set breakpoint in destructuring pattern if its destructuring assignment // [a, b, c] or {a, b, c} of @@ -169192,22 +170348,22 @@ var ts; } if (ts.isExpressionNode(node)) { switch (parent.kind) { - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // Set span as if on while keyword return spanInPreviousNode(node); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Set breakpoint on the decorator emit return spanInNode(node.parent); - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return textSpan(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (node.parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { // If this is a comma expression, the breakpoint is possible in this expression return textSpan(node); } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: if (node.parent.body === node) { // If this is body of arrow function, it is allowed to have the breakpoint return textSpan(node); @@ -169216,21 +170372,21 @@ var ts; } } switch (node.parent.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // If this is name of property assignment, set breakpoint in the initializer if (node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); } break; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: // Breakpoint in type assertion goes to its operand if (node.parent.type === node) { return spanInNextNode(node.parent.type); } break; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: { + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: { // initializer of variable/parameter declaration go to previous node var _b = node.parent, initializer = _b.initializer, type = _b.type; if (initializer === node || type === node || ts.isAssignmentOperator(node.kind)) { @@ -169238,7 +170394,7 @@ var ts; } break; } - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var left = node.parent.left; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(left) && node !== left) { // If initializer of destructuring assignment move to previous token @@ -169268,7 +170424,7 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (variableDeclaration.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { return spanInNode(variableDeclaration.parent.parent); } var parent = variableDeclaration.parent; @@ -169280,7 +170436,7 @@ var ts; // or its declaration from 'for of' if ((ts.hasOnlyExpressionInitializer(variableDeclaration) && variableDeclaration.initializer) || ts.hasSyntacticModifier(variableDeclaration, 1 /* ModifierFlags.Export */) || - parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { return textSpanFromVariableDeclaration(variableDeclaration); } if (ts.isVariableDeclarationList(variableDeclaration.parent) && @@ -169321,7 +170477,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasSyntacticModifier(functionDeclaration, 1 /* ModifierFlags.Export */) || - (functionDeclaration.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ && functionDeclaration.kind !== 171 /* SyntaxKind.Constructor */); + (functionDeclaration.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ && functionDeclaration.kind !== 173 /* SyntaxKind.Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -169344,26 +170500,26 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // Set on parent if on same line otherwise on first statement // falls through - case 241 /* SyntaxKind.WhileStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } // Default action is to set on first statement return spanInNode(block.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { - if (forLikeStatement.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (forLikeStatement.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { // Declaration list - set breakpoint in first declaration var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -169388,21 +170544,21 @@ var ts; } function spanInBindingPattern(bindingPattern) { // Set breakpoint in first binding element - var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 227 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 229 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } // Empty binding pattern of binding element, set breakpoint on binding element - if (bindingPattern.parent.kind === 203 /* SyntaxKind.BindingElement */) { + if (bindingPattern.parent.kind === 205 /* SyntaxKind.BindingElement */) { return textSpan(bindingPattern.parent); } // Variable declaration is used as the span return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { - ts.Debug.assert(node.kind !== 202 /* SyntaxKind.ArrayBindingPattern */ && node.kind !== 201 /* SyntaxKind.ObjectBindingPattern */); - var elements = node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ ? node.elements : node.properties; - var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 227 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); + ts.Debug.assert(node.kind !== 204 /* SyntaxKind.ArrayBindingPattern */ && node.kind !== 203 /* SyntaxKind.ObjectBindingPattern */); + var elements = node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ ? node.elements : node.properties; + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 229 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } @@ -169410,18 +170566,18 @@ var ts; // just nested element in another destructuring assignment // set breakpoint on assignment when parent is destructuring assignment // Otherwise set breakpoint for this element - return textSpan(node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ ? node.parent : node); + return textSpan(node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ ? node.parent : node); } // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -169429,25 +170585,25 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: // If this is not an instantiated module block, no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // falls through - case 260 /* SyntaxKind.EnumDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // Span on close brace token return textSpan(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } // falls through - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -169455,7 +170611,7 @@ var ts; return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -169471,7 +170627,7 @@ var ts; } function spanInCloseBracketToken(node) { switch (node.parent.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -169486,12 +170642,12 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 240 /* SyntaxKind.DoStatement */ || // Go to while keyword and do action instead - node.parent.kind === 208 /* SyntaxKind.CallExpression */ || - node.parent.kind === 209 /* SyntaxKind.NewExpression */) { + if (node.parent.kind === 243 /* SyntaxKind.DoStatement */ || // Go to while keyword and do action instead + node.parent.kind === 210 /* SyntaxKind.CallExpression */ || + node.parent.kind === 211 /* SyntaxKind.NewExpression */) { return spanInPreviousNode(node); } - if (node.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (node.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { return spanInNextNode(node); } // Default to parent node @@ -169500,21 +170656,21 @@ var ts; function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return spanInPreviousNode(node); // Default to parent node default: @@ -169524,20 +170680,20 @@ var ts; function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration if (ts.isFunctionLike(node.parent) || - node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ || - node.parent.kind === 164 /* SyntaxKind.Parameter */) { + node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ || + node.parent.kind === 166 /* SyntaxKind.Parameter */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (node.parent.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 240 /* SyntaxKind.DoStatement */) { + if (node.parent.kind === 243 /* SyntaxKind.DoStatement */) { // Set span on while expression return textSpanEndingAtNextToken(node, node.parent.expression); } @@ -169545,7 +170701,7 @@ var ts; return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { // Set using next token return spanInNextNode(node); } @@ -169594,7 +170750,7 @@ var debugObjectHost = (function () { return this; })(); // We need to use 'null' to interface with the managed side. -/* eslint-disable no-in-operator */ +/* eslint-disable local/no-in-operator */ /* @internal */ var ts; (function (ts) { @@ -170394,7 +171550,7 @@ var ts; }()); ts.TypeScriptServicesFactory = TypeScriptServicesFactory; })(ts || (ts = {})); -/* eslint-enable no-in-operator */ +/* eslint-enable local/no-in-operator */ // We polyfill `globalThis` here so re can reliably patch the global scope // in the contexts we want to in the same way across script and module formats /* eslint-enable no-var */ @@ -171164,7 +172320,7 @@ var ts; if (typeof value === "number") { return ts.factory.createNumericLiteral(value); } - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (typeof value === "object" && "base10Value" in value) { // PseudoBigInt return ts.factory.createBigIntLiteral(value); } @@ -171192,7 +172348,7 @@ var ts; } else { type = operatorOrType; - operator = 140 /* SyntaxKind.KeyOfKeyword */; + operator = 141 /* SyntaxKind.KeyOfKeyword */; } return ts.factory.createTypeOperatorNode(operator, type); }, factoryDeprecation); @@ -171370,7 +172526,7 @@ var ts; ts.createNode = ts.Debug.deprecate(function createNode(kind, pos, end) { if (pos === void 0) { pos = 0; } if (end === void 0) { end = 0; } - return ts.setTextRangePosEnd(kind === 305 /* SyntaxKind.SourceFile */ ? ts.parseBaseNodeFactory.createBaseSourceFileNode(kind) : + return ts.setTextRangePosEnd(kind === 308 /* SyntaxKind.SourceFile */ ? ts.parseBaseNodeFactory.createBaseSourceFileNode(kind) : kind === 79 /* SyntaxKind.Identifier */ ? ts.parseBaseNodeFactory.createBaseIdentifierNode(kind) : kind === 80 /* SyntaxKind.PrivateIdentifier */ ? ts.parseBaseNodeFactory.createBasePrivateIdentifierNode(kind) : !ts.isNodeKind(kind) ? ts.parseBaseNodeFactory.createBaseTokenNode(kind) : @@ -171400,7 +172556,7 @@ var ts; (function (ts) { /** @deprecated Use `isTypeAssertionExpression` instead. */ ts.isTypeAssertion = ts.Debug.deprecate(function isTypeAssertion(node) { - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */; }, { since: "4.0", warnAfter: "4.1", diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index 9303e787c1e..9fc19a4f74c 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -85,11 +85,11 @@ var ts; (function (ts) { // WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values. // If changing the text in this section, be sure to test `configurePrerelease` too. - ts.versionMajorMinor = "4.8"; + ts.versionMajorMinor = "4.9"; // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types - ts.version = "4.8.3"; + ts.version = "".concat(ts.versionMajorMinor, ".0-beta"); /* @internal */ var Comparison; (function (Comparison) { @@ -110,8 +110,12 @@ var ts; function tryGetNativeMap() { // Internet Explorer's Map doesn't support iteration, so don't use it. var gMap = globals === null || globals === void 0 ? void 0 : globals.Map; - // eslint-disable-next-line no-in-operator - return typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; + // eslint-disable-next-line local/no-in-operator + var constructor = typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; + if (!constructor) { + throw new Error("No compatible Map implementation found."); + } + return constructor; } NativeCollections.tryGetNativeMap = tryGetNativeMap; /** @@ -120,24 +124,19 @@ var ts; function tryGetNativeSet() { // Internet Explorer's Set doesn't support iteration, so don't use it. var gSet = globals === null || globals === void 0 ? void 0 : globals.Set; - // eslint-disable-next-line no-in-operator - return typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; + // eslint-disable-next-line local/no-in-operator + var constructor = typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; + if (!constructor) { + throw new Error("No compatible Set implementation found."); + } + return constructor; } NativeCollections.tryGetNativeSet = tryGetNativeSet; })(NativeCollections || (NativeCollections = {})); /* @internal */ - ts.Map = getCollectionImplementation("Map", "tryGetNativeMap", "createMapShim"); + ts.Map = NativeCollections.tryGetNativeMap(); /* @internal */ - ts.Set = getCollectionImplementation("Set", "tryGetNativeSet", "createSetShim"); - /* @internal */ - function getCollectionImplementation(name, nativeFactory, shimFactory) { - var _a; - // NOTE: ts.ShimCollections will be defined for typescriptServices.js but not for tsc.js, so we must test for it. - var constructor = (_a = NativeCollections[nativeFactory]()) !== null && _a !== void 0 ? _a : ts.ShimCollections === null || ts.ShimCollections === void 0 ? void 0 : ts.ShimCollections[shimFactory](ts.getIterator); - if (constructor) - return constructor; - throw new Error("TypeScript requires an environment that provides a compatible native ".concat(name, " implementation.")); - } + ts.Set = NativeCollections.tryGetNativeSet(); })(ts || (ts = {})); /* @internal */ var ts; @@ -853,15 +852,18 @@ var ts; function insertSorted(array, insert, compare, allowDuplicates) { if (array.length === 0) { array.push(insert); - return; + return true; } var insertIndex = binarySearch(array, insert, identity, compare); if (insertIndex < 0) { array.splice(~insertIndex, 0, insert); + return true; } - else if (allowDuplicates) { + if (allowDuplicates) { array.splice(insertIndex, 0, insert); + return true; } + return false; } ts.insertSorted = insertSorted; function sortAndDeduplicate(array, comparer, equalityComparer) { @@ -1141,6 +1143,13 @@ var ts; : undefined; } ts.singleOrUndefined = singleOrUndefined; + /** + * Returns the only element of an array if it contains only one element; throws otherwise. + */ + function single(array) { + return ts.Debug.checkDefined(singleOrUndefined(array)); + } + ts.single = single; function singleOrMany(array) { return array && array.length === 1 ? array[0] @@ -2664,7 +2673,7 @@ var ts; if (typeof func !== "function") { return ""; } - else if (func.hasOwnProperty("name")) { + else if (ts.hasProperty(func, "name")) { return func.name; } else { @@ -2814,7 +2823,7 @@ var ts; Debug.formatControlFlowGraph = formatControlFlowGraph; var flowNodeProto; function attachFlowNodeDebugInfoWorker(flowNode) { - if (!("__debugFlowFlags" in flowNode)) { // eslint-disable-line no-in-operator + if (!("__debugFlowFlags" in flowNode)) { // eslint-disable-line local/no-in-operator Object.defineProperties(flowNode, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { @@ -2860,7 +2869,7 @@ var ts; Debug.attachFlowNodeDebugInfo = attachFlowNodeDebugInfo; var nodeArrayProto; function attachNodeArrayDebugInfoWorker(array) { - if (!("__tsDebuggerDisplay" in array)) { // eslint-disable-line no-in-operator + if (!("__tsDebuggerDisplay" in array)) { // eslint-disable-line local/no-in-operator Object.defineProperties(array, { __tsDebuggerDisplay: { value: function (defaultValue) { @@ -2989,7 +2998,7 @@ var ts; ]; for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) { var ctor = nodeConstructors_1[_i]; - if (!ctor.prototype.hasOwnProperty("__debugKind")) { + if (!ts.hasProperty(ctor.prototype, "__debugKind")) { Object.defineProperties(ctor.prototype, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { @@ -3542,6 +3551,8 @@ var ts; typeof performance.mark === "function" && typeof performance.measure === "function" && typeof performance.now === "function" && + typeof performance.clearMarks === "function" && + typeof performance.clearMeasures === "function" && typeof PerformanceObserver === "function"; } function tryGetWebPerformanceHooks() { @@ -3586,7 +3597,9 @@ var ts; if (end === "__performance.measure-fix__") { nodePerformance_1.clearMarks("__performance.measure-fix__"); } - } + }, + clearMarks: function (name) { return nodePerformance_1.clearMarks(name); }, + clearMeasures: function (name) { return nodePerformance_1.clearMeasures(name); }, }; } return { @@ -3719,6 +3732,30 @@ var ts; durations.forEach(function (duration, measureName) { return cb(measureName, duration); }); } performance.forEachMeasure = forEachMeasure; + function forEachMark(cb) { + marks.forEach(function (_time, markName) { return cb(markName); }); + } + performance.forEachMark = forEachMark; + function clearMeasures(name) { + if (name !== undefined) + durations.delete(name); + else + durations.clear(); + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMeasures(name); + } + performance.clearMeasures = clearMeasures; + function clearMarks(name) { + if (name !== undefined) { + counts.delete(name); + marks.delete(name); + } + else { + counts.clear(); + marks.clear(); + } + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMarks(name); + } + performance.clearMarks = clearMarks; /** * Indicates whether the performance API is enabled. */ @@ -3816,7 +3853,6 @@ var ts; var typeCatalog = []; // NB: id is index + 1 var legendPath; var legend = []; - ; /** Starts tracing for the given project. */ function startTracing(tracingMode, traceDir, configFilePath) { ts.Debug.assert(!ts.tracing, "Tracing already started"); @@ -4021,7 +4057,7 @@ var ts; var substitutionType = type; substitutionProperties = { substitutionBaseType: (_o = substitutionType.baseType) === null || _o === void 0 ? void 0 : _o.id, - substituteType: (_p = substitutionType.substitute) === null || _p === void 0 ? void 0 : _p.id, + constraintType: (_p = substitutionType.constraint) === null || _p === void 0 ? void 0 : _p.id, }; } var reverseMappedProperties = {}; @@ -4221,257 +4257,260 @@ var ts; SyntaxKind[SyntaxKind["YieldKeyword"] = 125] = "YieldKeyword"; // Contextual keywords SyntaxKind[SyntaxKind["AbstractKeyword"] = 126] = "AbstractKeyword"; - SyntaxKind[SyntaxKind["AsKeyword"] = 127] = "AsKeyword"; - SyntaxKind[SyntaxKind["AssertsKeyword"] = 128] = "AssertsKeyword"; - SyntaxKind[SyntaxKind["AssertKeyword"] = 129] = "AssertKeyword"; - SyntaxKind[SyntaxKind["AnyKeyword"] = 130] = "AnyKeyword"; - SyntaxKind[SyntaxKind["AsyncKeyword"] = 131] = "AsyncKeyword"; - SyntaxKind[SyntaxKind["AwaitKeyword"] = 132] = "AwaitKeyword"; - SyntaxKind[SyntaxKind["BooleanKeyword"] = 133] = "BooleanKeyword"; - SyntaxKind[SyntaxKind["ConstructorKeyword"] = 134] = "ConstructorKeyword"; - SyntaxKind[SyntaxKind["DeclareKeyword"] = 135] = "DeclareKeyword"; - SyntaxKind[SyntaxKind["GetKeyword"] = 136] = "GetKeyword"; - SyntaxKind[SyntaxKind["InferKeyword"] = 137] = "InferKeyword"; - SyntaxKind[SyntaxKind["IntrinsicKeyword"] = 138] = "IntrinsicKeyword"; - SyntaxKind[SyntaxKind["IsKeyword"] = 139] = "IsKeyword"; - SyntaxKind[SyntaxKind["KeyOfKeyword"] = 140] = "KeyOfKeyword"; - SyntaxKind[SyntaxKind["ModuleKeyword"] = 141] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["NamespaceKeyword"] = 142] = "NamespaceKeyword"; - SyntaxKind[SyntaxKind["NeverKeyword"] = 143] = "NeverKeyword"; - SyntaxKind[SyntaxKind["OutKeyword"] = 144] = "OutKeyword"; - SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 145] = "ReadonlyKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 146] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 147] = "NumberKeyword"; - SyntaxKind[SyntaxKind["ObjectKeyword"] = 148] = "ObjectKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 149] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 150] = "StringKeyword"; - SyntaxKind[SyntaxKind["SymbolKeyword"] = 151] = "SymbolKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 152] = "TypeKeyword"; - SyntaxKind[SyntaxKind["UndefinedKeyword"] = 153] = "UndefinedKeyword"; - SyntaxKind[SyntaxKind["UniqueKeyword"] = 154] = "UniqueKeyword"; - SyntaxKind[SyntaxKind["UnknownKeyword"] = 155] = "UnknownKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 156] = "FromKeyword"; - SyntaxKind[SyntaxKind["GlobalKeyword"] = 157] = "GlobalKeyword"; - SyntaxKind[SyntaxKind["BigIntKeyword"] = 158] = "BigIntKeyword"; - SyntaxKind[SyntaxKind["OverrideKeyword"] = 159] = "OverrideKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 160] = "OfKeyword"; + SyntaxKind[SyntaxKind["AccessorKeyword"] = 127] = "AccessorKeyword"; + SyntaxKind[SyntaxKind["AsKeyword"] = 128] = "AsKeyword"; + SyntaxKind[SyntaxKind["AssertsKeyword"] = 129] = "AssertsKeyword"; + SyntaxKind[SyntaxKind["AssertKeyword"] = 130] = "AssertKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 131] = "AnyKeyword"; + SyntaxKind[SyntaxKind["AsyncKeyword"] = 132] = "AsyncKeyword"; + SyntaxKind[SyntaxKind["AwaitKeyword"] = 133] = "AwaitKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 134] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 135] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 136] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 137] = "GetKeyword"; + SyntaxKind[SyntaxKind["InferKeyword"] = 138] = "InferKeyword"; + SyntaxKind[SyntaxKind["IntrinsicKeyword"] = 139] = "IntrinsicKeyword"; + SyntaxKind[SyntaxKind["IsKeyword"] = 140] = "IsKeyword"; + SyntaxKind[SyntaxKind["KeyOfKeyword"] = 141] = "KeyOfKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 142] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["NamespaceKeyword"] = 143] = "NamespaceKeyword"; + SyntaxKind[SyntaxKind["NeverKeyword"] = 144] = "NeverKeyword"; + SyntaxKind[SyntaxKind["OutKeyword"] = 145] = "OutKeyword"; + SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 146] = "ReadonlyKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 147] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 148] = "NumberKeyword"; + SyntaxKind[SyntaxKind["ObjectKeyword"] = 149] = "ObjectKeyword"; + SyntaxKind[SyntaxKind["SatisfiesKeyword"] = 150] = "SatisfiesKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 151] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 152] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 153] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 154] = "TypeKeyword"; + SyntaxKind[SyntaxKind["UndefinedKeyword"] = 155] = "UndefinedKeyword"; + SyntaxKind[SyntaxKind["UniqueKeyword"] = 156] = "UniqueKeyword"; + SyntaxKind[SyntaxKind["UnknownKeyword"] = 157] = "UnknownKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 158] = "FromKeyword"; + SyntaxKind[SyntaxKind["GlobalKeyword"] = 159] = "GlobalKeyword"; + SyntaxKind[SyntaxKind["BigIntKeyword"] = 160] = "BigIntKeyword"; + SyntaxKind[SyntaxKind["OverrideKeyword"] = 161] = "OverrideKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 162] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 161] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 162] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 163] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 164] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 163] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 164] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 165] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 165] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 166] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 167] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 166] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 167] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 168] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 169] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["ClassStaticBlockDeclaration"] = 170] = "ClassStaticBlockDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 171] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 172] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 173] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 174] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 175] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 176] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 168] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 169] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 170] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 171] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["ClassStaticBlockDeclaration"] = 172] = "ClassStaticBlockDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 173] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 174] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 175] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 176] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 177] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 178] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypePredicate"] = 177] = "TypePredicate"; - SyntaxKind[SyntaxKind["TypeReference"] = 178] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 179] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 180] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 181] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 182] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 183] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 184] = "TupleType"; - SyntaxKind[SyntaxKind["OptionalType"] = 185] = "OptionalType"; - SyntaxKind[SyntaxKind["RestType"] = 186] = "RestType"; - SyntaxKind[SyntaxKind["UnionType"] = 187] = "UnionType"; - SyntaxKind[SyntaxKind["IntersectionType"] = 188] = "IntersectionType"; - SyntaxKind[SyntaxKind["ConditionalType"] = 189] = "ConditionalType"; - SyntaxKind[SyntaxKind["InferType"] = 190] = "InferType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 191] = "ParenthesizedType"; - SyntaxKind[SyntaxKind["ThisType"] = 192] = "ThisType"; - SyntaxKind[SyntaxKind["TypeOperator"] = 193] = "TypeOperator"; - SyntaxKind[SyntaxKind["IndexedAccessType"] = 194] = "IndexedAccessType"; - SyntaxKind[SyntaxKind["MappedType"] = 195] = "MappedType"; - SyntaxKind[SyntaxKind["LiteralType"] = 196] = "LiteralType"; - SyntaxKind[SyntaxKind["NamedTupleMember"] = 197] = "NamedTupleMember"; - SyntaxKind[SyntaxKind["TemplateLiteralType"] = 198] = "TemplateLiteralType"; - SyntaxKind[SyntaxKind["TemplateLiteralTypeSpan"] = 199] = "TemplateLiteralTypeSpan"; - SyntaxKind[SyntaxKind["ImportType"] = 200] = "ImportType"; + SyntaxKind[SyntaxKind["TypePredicate"] = 179] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 180] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 181] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 182] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 183] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 184] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 185] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 186] = "TupleType"; + SyntaxKind[SyntaxKind["OptionalType"] = 187] = "OptionalType"; + SyntaxKind[SyntaxKind["RestType"] = 188] = "RestType"; + SyntaxKind[SyntaxKind["UnionType"] = 189] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 190] = "IntersectionType"; + SyntaxKind[SyntaxKind["ConditionalType"] = 191] = "ConditionalType"; + SyntaxKind[SyntaxKind["InferType"] = 192] = "InferType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 193] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ThisType"] = 194] = "ThisType"; + SyntaxKind[SyntaxKind["TypeOperator"] = 195] = "TypeOperator"; + SyntaxKind[SyntaxKind["IndexedAccessType"] = 196] = "IndexedAccessType"; + SyntaxKind[SyntaxKind["MappedType"] = 197] = "MappedType"; + SyntaxKind[SyntaxKind["LiteralType"] = 198] = "LiteralType"; + SyntaxKind[SyntaxKind["NamedTupleMember"] = 199] = "NamedTupleMember"; + SyntaxKind[SyntaxKind["TemplateLiteralType"] = 200] = "TemplateLiteralType"; + SyntaxKind[SyntaxKind["TemplateLiteralTypeSpan"] = 201] = "TemplateLiteralTypeSpan"; + SyntaxKind[SyntaxKind["ImportType"] = 202] = "ImportType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 201] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 202] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 203] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 203] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 204] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 205] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 204] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 205] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 206] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 207] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 208] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 209] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 210] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 211] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 212] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 213] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 214] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 215] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 216] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 217] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 218] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 219] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 220] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 221] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 222] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 223] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 224] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElement"] = 225] = "SpreadElement"; - SyntaxKind[SyntaxKind["ClassExpression"] = 226] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 227] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 228] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 229] = "AsExpression"; - SyntaxKind[SyntaxKind["NonNullExpression"] = 230] = "NonNullExpression"; - SyntaxKind[SyntaxKind["MetaProperty"] = 231] = "MetaProperty"; - SyntaxKind[SyntaxKind["SyntheticExpression"] = 232] = "SyntheticExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 206] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 207] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 208] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 209] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 210] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 211] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 212] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 213] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 214] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 215] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 216] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 217] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 218] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 219] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 220] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 221] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 222] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 223] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 224] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 225] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 226] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElement"] = 227] = "SpreadElement"; + SyntaxKind[SyntaxKind["ClassExpression"] = 228] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 229] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 230] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 231] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 232] = "NonNullExpression"; + SyntaxKind[SyntaxKind["MetaProperty"] = 233] = "MetaProperty"; + SyntaxKind[SyntaxKind["SyntheticExpression"] = 234] = "SyntheticExpression"; + SyntaxKind[SyntaxKind["SatisfiesExpression"] = 235] = "SatisfiesExpression"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 233] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 234] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 236] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 237] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 235] = "Block"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 236] = "EmptyStatement"; - SyntaxKind[SyntaxKind["VariableStatement"] = 237] = "VariableStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 238] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 239] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 240] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 241] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 242] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 243] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 244] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 245] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 246] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 247] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 248] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 249] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 250] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 251] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 252] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 253] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 254] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 255] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 256] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 257] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 258] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 259] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 260] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 261] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 262] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 263] = "CaseBlock"; - SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 264] = "NamespaceExportDeclaration"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 265] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 266] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 267] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 268] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 269] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 270] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 271] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 272] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 273] = "NamedExports"; - SyntaxKind[SyntaxKind["NamespaceExport"] = 274] = "NamespaceExport"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 275] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 276] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 238] = "Block"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 239] = "EmptyStatement"; + SyntaxKind[SyntaxKind["VariableStatement"] = 240] = "VariableStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 241] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 242] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 243] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 244] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 245] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 246] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 247] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 248] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 249] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 250] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 251] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 252] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 253] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 254] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 255] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 256] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 257] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 258] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 259] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 260] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 261] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 262] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 263] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 264] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 265] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 266] = "CaseBlock"; + SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 267] = "NamespaceExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 268] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 269] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 270] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 271] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 272] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 273] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 274] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 275] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 276] = "NamedExports"; + SyntaxKind[SyntaxKind["NamespaceExport"] = 277] = "NamespaceExport"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 278] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 279] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 277] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 280] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 278] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 279] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 280] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 281] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxFragment"] = 282] = "JsxFragment"; - SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 283] = "JsxOpeningFragment"; - SyntaxKind[SyntaxKind["JsxClosingFragment"] = 284] = "JsxClosingFragment"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 285] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxAttributes"] = 286] = "JsxAttributes"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 287] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 288] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 281] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 282] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 283] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 284] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxFragment"] = 285] = "JsxFragment"; + SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 286] = "JsxOpeningFragment"; + SyntaxKind[SyntaxKind["JsxClosingFragment"] = 287] = "JsxClosingFragment"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 288] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxAttributes"] = 289] = "JsxAttributes"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 290] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 291] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 289] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 290] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 291] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 292] = "CatchClause"; - SyntaxKind[SyntaxKind["AssertClause"] = 293] = "AssertClause"; - SyntaxKind[SyntaxKind["AssertEntry"] = 294] = "AssertEntry"; - SyntaxKind[SyntaxKind["ImportTypeAssertionContainer"] = 295] = "ImportTypeAssertionContainer"; + SyntaxKind[SyntaxKind["CaseClause"] = 292] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 293] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 294] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 295] = "CatchClause"; + SyntaxKind[SyntaxKind["AssertClause"] = 296] = "AssertClause"; + SyntaxKind[SyntaxKind["AssertEntry"] = 297] = "AssertEntry"; + SyntaxKind[SyntaxKind["ImportTypeAssertionContainer"] = 298] = "ImportTypeAssertionContainer"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 296] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 297] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 298] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 299] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 300] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 301] = "SpreadAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 299] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 302] = "EnumMember"; // Unparsed - SyntaxKind[SyntaxKind["UnparsedPrologue"] = 300] = "UnparsedPrologue"; - SyntaxKind[SyntaxKind["UnparsedPrepend"] = 301] = "UnparsedPrepend"; - SyntaxKind[SyntaxKind["UnparsedText"] = 302] = "UnparsedText"; - SyntaxKind[SyntaxKind["UnparsedInternalText"] = 303] = "UnparsedInternalText"; - SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 304] = "UnparsedSyntheticReference"; + SyntaxKind[SyntaxKind["UnparsedPrologue"] = 303] = "UnparsedPrologue"; + SyntaxKind[SyntaxKind["UnparsedPrepend"] = 304] = "UnparsedPrepend"; + SyntaxKind[SyntaxKind["UnparsedText"] = 305] = "UnparsedText"; + SyntaxKind[SyntaxKind["UnparsedInternalText"] = 306] = "UnparsedInternalText"; + SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 307] = "UnparsedSyntheticReference"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 305] = "SourceFile"; - SyntaxKind[SyntaxKind["Bundle"] = 306] = "Bundle"; - SyntaxKind[SyntaxKind["UnparsedSource"] = 307] = "UnparsedSource"; - SyntaxKind[SyntaxKind["InputFiles"] = 308] = "InputFiles"; + SyntaxKind[SyntaxKind["SourceFile"] = 308] = "SourceFile"; + SyntaxKind[SyntaxKind["Bundle"] = 309] = "Bundle"; + SyntaxKind[SyntaxKind["UnparsedSource"] = 310] = "UnparsedSource"; + SyntaxKind[SyntaxKind["InputFiles"] = 311] = "InputFiles"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 309] = "JSDocTypeExpression"; - SyntaxKind[SyntaxKind["JSDocNameReference"] = 310] = "JSDocNameReference"; - SyntaxKind[SyntaxKind["JSDocMemberName"] = 311] = "JSDocMemberName"; - SyntaxKind[SyntaxKind["JSDocAllType"] = 312] = "JSDocAllType"; - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 313] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 314] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 315] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 316] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 317] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 318] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocNamepathType"] = 319] = "JSDocNamepathType"; - SyntaxKind[SyntaxKind["JSDoc"] = 320] = "JSDoc"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 312] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocNameReference"] = 313] = "JSDocNameReference"; + SyntaxKind[SyntaxKind["JSDocMemberName"] = 314] = "JSDocMemberName"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 315] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 316] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 317] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 318] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 319] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 320] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 321] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocNamepathType"] = 322] = "JSDocNamepathType"; + SyntaxKind[SyntaxKind["JSDoc"] = 323] = "JSDoc"; /** @deprecated Use SyntaxKind.JSDoc */ - SyntaxKind[SyntaxKind["JSDocComment"] = 320] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocText"] = 321] = "JSDocText"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 322] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocSignature"] = 323] = "JSDocSignature"; - SyntaxKind[SyntaxKind["JSDocLink"] = 324] = "JSDocLink"; - SyntaxKind[SyntaxKind["JSDocLinkCode"] = 325] = "JSDocLinkCode"; - SyntaxKind[SyntaxKind["JSDocLinkPlain"] = 326] = "JSDocLinkPlain"; - SyntaxKind[SyntaxKind["JSDocTag"] = 327] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 328] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocImplementsTag"] = 329] = "JSDocImplementsTag"; - SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 330] = "JSDocAuthorTag"; - SyntaxKind[SyntaxKind["JSDocDeprecatedTag"] = 331] = "JSDocDeprecatedTag"; - SyntaxKind[SyntaxKind["JSDocClassTag"] = 332] = "JSDocClassTag"; - SyntaxKind[SyntaxKind["JSDocPublicTag"] = 333] = "JSDocPublicTag"; - SyntaxKind[SyntaxKind["JSDocPrivateTag"] = 334] = "JSDocPrivateTag"; - SyntaxKind[SyntaxKind["JSDocProtectedTag"] = 335] = "JSDocProtectedTag"; - SyntaxKind[SyntaxKind["JSDocReadonlyTag"] = 336] = "JSDocReadonlyTag"; - SyntaxKind[SyntaxKind["JSDocOverrideTag"] = 337] = "JSDocOverrideTag"; - SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 338] = "JSDocCallbackTag"; - SyntaxKind[SyntaxKind["JSDocEnumTag"] = 339] = "JSDocEnumTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 340] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 341] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocThisTag"] = 342] = "JSDocThisTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 343] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 344] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 345] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocSeeTag"] = 346] = "JSDocSeeTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 347] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocComment"] = 323] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocText"] = 324] = "JSDocText"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 325] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocSignature"] = 326] = "JSDocSignature"; + SyntaxKind[SyntaxKind["JSDocLink"] = 327] = "JSDocLink"; + SyntaxKind[SyntaxKind["JSDocLinkCode"] = 328] = "JSDocLinkCode"; + SyntaxKind[SyntaxKind["JSDocLinkPlain"] = 329] = "JSDocLinkPlain"; + SyntaxKind[SyntaxKind["JSDocTag"] = 330] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 331] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocImplementsTag"] = 332] = "JSDocImplementsTag"; + SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 333] = "JSDocAuthorTag"; + SyntaxKind[SyntaxKind["JSDocDeprecatedTag"] = 334] = "JSDocDeprecatedTag"; + SyntaxKind[SyntaxKind["JSDocClassTag"] = 335] = "JSDocClassTag"; + SyntaxKind[SyntaxKind["JSDocPublicTag"] = 336] = "JSDocPublicTag"; + SyntaxKind[SyntaxKind["JSDocPrivateTag"] = 337] = "JSDocPrivateTag"; + SyntaxKind[SyntaxKind["JSDocProtectedTag"] = 338] = "JSDocProtectedTag"; + SyntaxKind[SyntaxKind["JSDocReadonlyTag"] = 339] = "JSDocReadonlyTag"; + SyntaxKind[SyntaxKind["JSDocOverrideTag"] = 340] = "JSDocOverrideTag"; + SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 341] = "JSDocCallbackTag"; + SyntaxKind[SyntaxKind["JSDocEnumTag"] = 342] = "JSDocEnumTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 343] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 344] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocThisTag"] = 345] = "JSDocThisTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 346] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 347] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 348] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocSeeTag"] = 349] = "JSDocSeeTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 350] = "JSDocPropertyTag"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 348] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 351] = "SyntaxList"; // Transformation nodes - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 349] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 350] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["CommaListExpression"] = 351] = "CommaListExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 352] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 353] = "EndOfDeclarationMarker"; - SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 354] = "SyntheticReferenceExpression"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 352] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 353] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["CommaListExpression"] = 354] = "CommaListExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 355] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 356] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 357] = "SyntheticReferenceExpression"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 355] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 358] = "Count"; // Markers SyntaxKind[SyntaxKind["FirstAssignment"] = 63] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 78] = "LastAssignment"; @@ -4480,15 +4519,15 @@ var ts; SyntaxKind[SyntaxKind["FirstReservedWord"] = 81] = "FirstReservedWord"; SyntaxKind[SyntaxKind["LastReservedWord"] = 116] = "LastReservedWord"; SyntaxKind[SyntaxKind["FirstKeyword"] = 81] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 160] = "LastKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 162] = "LastKeyword"; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 117] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 125] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 177] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 200] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 179] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 202] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 18] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 78] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 160] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 162] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; @@ -4497,15 +4536,15 @@ var ts; SyntaxKind[SyntaxKind["LastTemplateToken"] = 17] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 29] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 78] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstStatement"] = 237] = "FirstStatement"; - SyntaxKind[SyntaxKind["LastStatement"] = 253] = "LastStatement"; - SyntaxKind[SyntaxKind["FirstNode"] = 161] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 309] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 347] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 327] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 347] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstStatement"] = 240] = "FirstStatement"; + SyntaxKind[SyntaxKind["LastStatement"] = 256] = "LastStatement"; + SyntaxKind[SyntaxKind["FirstNode"] = 163] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 312] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 350] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 330] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 350] = "LastJSDocTagNode"; /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 126] = "FirstContextualKeyword"; - /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 160] = "LastContextualKeyword"; + /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 162] = "LastContextualKeyword"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); var NodeFlags; (function (NodeFlags) { @@ -4570,9 +4609,10 @@ var ts; ModifierFlags[ModifierFlags["Protected"] = 16] = "Protected"; ModifierFlags[ModifierFlags["Static"] = 32] = "Static"; ModifierFlags[ModifierFlags["Readonly"] = 64] = "Readonly"; - ModifierFlags[ModifierFlags["Abstract"] = 128] = "Abstract"; - ModifierFlags[ModifierFlags["Async"] = 256] = "Async"; - ModifierFlags[ModifierFlags["Default"] = 512] = "Default"; + ModifierFlags[ModifierFlags["Accessor"] = 128] = "Accessor"; + ModifierFlags[ModifierFlags["Abstract"] = 256] = "Abstract"; + ModifierFlags[ModifierFlags["Async"] = 512] = "Async"; + ModifierFlags[ModifierFlags["Default"] = 1024] = "Default"; ModifierFlags[ModifierFlags["Const"] = 2048] = "Const"; ModifierFlags[ModifierFlags["HasComputedJSDocModifiers"] = 4096] = "HasComputedJSDocModifiers"; ModifierFlags[ModifierFlags["Deprecated"] = 8192] = "Deprecated"; @@ -4585,10 +4625,10 @@ var ts; // Accessibility modifiers and 'readonly' can be attached to a parameter in a constructor to make it a property. ModifierFlags[ModifierFlags["ParameterPropertyModifier"] = 16476] = "ParameterPropertyModifier"; ModifierFlags[ModifierFlags["NonPublicAccessibilityModifier"] = 24] = "NonPublicAccessibilityModifier"; - ModifierFlags[ModifierFlags["TypeScriptModifier"] = 116958] = "TypeScriptModifier"; - ModifierFlags[ModifierFlags["ExportDefault"] = 513] = "ExportDefault"; - ModifierFlags[ModifierFlags["All"] = 257023] = "All"; - ModifierFlags[ModifierFlags["Modifier"] = 125951] = "Modifier"; + ModifierFlags[ModifierFlags["TypeScriptModifier"] = 117086] = "TypeScriptModifier"; + ModifierFlags[ModifierFlags["ExportDefault"] = 1025] = "ExportDefault"; + ModifierFlags[ModifierFlags["All"] = 258047] = "All"; + ModifierFlags[ModifierFlags["Modifier"] = 126975] = "Modifier"; })(ModifierFlags = ts.ModifierFlags || (ts.ModifierFlags = {})); var JsxFlags; (function (JsxFlags) { @@ -4784,6 +4824,7 @@ var ts; NodeBuilderFlags[NodeBuilderFlags["AllowEmptyTuple"] = 524288] = "AllowEmptyTuple"; NodeBuilderFlags[NodeBuilderFlags["AllowUniqueESSymbolType"] = 1048576] = "AllowUniqueESSymbolType"; NodeBuilderFlags[NodeBuilderFlags["AllowEmptyIndexInfoType"] = 2097152] = "AllowEmptyIndexInfoType"; + /* @internal */ NodeBuilderFlags[NodeBuilderFlags["WriteComputedProps"] = 1073741824] = "WriteComputedProps"; // Errors (cont.) NodeBuilderFlags[NodeBuilderFlags["AllowNodeModulesRelativePaths"] = 67108864] = "AllowNodeModulesRelativePaths"; /* @internal */ NodeBuilderFlags[NodeBuilderFlags["DoNotIncludeSymbolChain"] = 134217728] = "DoNotIncludeSymbolChain"; @@ -4844,8 +4885,10 @@ var ts; SymbolFormatFlags[SymbolFormatFlags["AllowAnyNodeKind"] = 4] = "AllowAnyNodeKind"; // Prefer aliases which are not directly visible SymbolFormatFlags[SymbolFormatFlags["UseAliasDefinedOutsideCurrentScope"] = 8] = "UseAliasDefinedOutsideCurrentScope"; + // { [E.A]: 1 } + /* @internal */ SymbolFormatFlags[SymbolFormatFlags["WriteComputedProps"] = 16] = "WriteComputedProps"; // Skip building an accessible symbol chain - /* @internal */ SymbolFormatFlags[SymbolFormatFlags["DoNotIncludeSymbolChain"] = 16] = "DoNotIncludeSymbolChain"; + /* @internal */ SymbolFormatFlags[SymbolFormatFlags["DoNotIncludeSymbolChain"] = 32] = "DoNotIncludeSymbolChain"; })(SymbolFormatFlags = ts.SymbolFormatFlags || (ts.SymbolFormatFlags = {})); /* @internal */ var SymbolAccessibility; @@ -4959,6 +5002,7 @@ var ts; SymbolFlags[SymbolFlags["MethodExcludes"] = 103359] = "MethodExcludes"; SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 46015] = "GetAccessorExcludes"; SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 78783] = "SetAccessorExcludes"; + SymbolFlags[SymbolFlags["AccessorExcludes"] = 13247] = "AccessorExcludes"; SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 526824] = "TypeParameterExcludes"; SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 788968] = "TypeAliasExcludes"; SymbolFlags[SymbolFlags["AliasExcludes"] = 2097152] = "AliasExcludes"; @@ -6085,7 +6129,6 @@ var ts; var pollingChunkSize = createPollingIntervalBasedLevels(defaultChunkLevels); /* @internal */ ts.unchangedPollThresholds = createPollingIntervalBasedLevels(defaultChunkLevels); - /* @internal */ function setCustomPollingValues(system) { if (!system.getEnvironmentVariable) { return; @@ -6128,7 +6171,6 @@ var ts; createPollingIntervalBasedLevels(customLevels ? __assign(__assign({}, defaultLevels), customLevels) : defaultLevels); } } - ts.setCustomPollingValues = setCustomPollingValues; function pollWatchedFileQueue(host, queue, pollIndex, chunkSize, callbackOnWatchFileStat) { var definedValueCopyToIndex = pollIndex; // Max visit would be all elements of the queue @@ -6174,7 +6216,6 @@ var ts; } } } - /* @internal */ function createDynamicPriorityPollingWatchFile(host) { var watchedFiles = []; var changedFilesInLastPoll = []; @@ -6283,7 +6324,6 @@ var ts; pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === PollingInterval.Low ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval)); } } - ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile; function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) { // One file can have multiple watchers var fileWatcherCallbacks = ts.createMultiMap(); @@ -6362,42 +6402,38 @@ var ts; pollScheduled = host.setTimeout(pollQueue, PollingInterval.High); } } - /* @internal */ - function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) { - var cache = new ts.Map(); - var callbacksCache = ts.createMultiMap(); + function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) { var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); - return function (fileName, callback, pollingInterval, options) { - var path = toCanonicalFileName(fileName); - var existing = cache.get(path); - if (existing) { - existing.refCount++; + var path = toCanonicalFileName(name); + var existing = cache.get(path); + if (existing) { + existing.callbacks.push(callback); + } + else { + cache.set(path, { + watcher: createWatcher(( + // Cant infer types correctly so lets satisfy checker + function (param1, param2, param3) { var _a; return (_a = cache.get(path)) === null || _a === void 0 ? void 0 : _a.callbacks.slice().forEach(function (cb) { return cb(param1, param2, param3); }); })), + callbacks: [callback] + }); + } + return { + close: function () { + var watcher = cache.get(path); + // Watcher is not expected to be undefined, but if it is normally its because + // exception was thrown somewhere else and watch state is not what it should be + if (!watcher) + return; + if (!ts.orderedRemoveItem(watcher.callbacks, callback) || watcher.callbacks.length) + return; + cache.delete(path); + ts.closeFileWatcherOf(watcher); } - else { - cache.set(path, { - watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options), - refCount: 1 - }); - } - callbacksCache.add(path, callback); - return { - close: function () { - var watcher = ts.Debug.checkDefined(cache.get(path)); - callbacksCache.remove(path, callback); - watcher.refCount--; - if (watcher.refCount) - return; - cache.delete(path); - ts.closeFileWatcherOf(watcher); - } - }; }; } - ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName; /** * Returns true if file status changed */ - /*@internal*/ function onWatchedFileStat(watchedFile, modifiedTime) { var oldTime = watchedFile.mtime.getTime(); var newTime = modifiedTime.getTime(); @@ -6409,7 +6445,6 @@ var ts; } return false; } - ts.onWatchedFileStat = onWatchedFileStat; /*@internal*/ function getFileWatcherEventKind(oldTime, newTime) { return oldTime === 0 @@ -6437,7 +6472,6 @@ var ts; * that means if this is recursive watcher, watch the children directories as well * (eg on OS that dont support recursive watch using fs.watch use fs.watchFile) */ - /*@internal*/ function createDirectoryWatcherSupportingRecursive(_a) { var watchDirectory = _a.watchDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, fileSystemEntryExists = _a.fileSystemEntryExists, realpath = _a.realpath, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout; var cache = new ts.Map(); @@ -6646,18 +6680,15 @@ var ts; return ts.stringContains(toCanonicalFilePath(path), searchPath); } } - ts.createDirectoryWatcherSupportingRecursive = createDirectoryWatcherSupportingRecursive; /*@internal*/ var FileSystemEntryKind; (function (FileSystemEntryKind) { FileSystemEntryKind[FileSystemEntryKind["File"] = 0] = "File"; FileSystemEntryKind[FileSystemEntryKind["Directory"] = 1] = "Directory"; })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {})); - /*@internal*/ function createFileWatcherCallback(callback) { return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); }; } - ts.createFileWatcherCallback = createFileWatcherCallback; function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) { return function (eventName, _relativeFileName, modifiedTime) { if (eventName === "rename") { @@ -6691,7 +6722,10 @@ var ts; } /*@internal*/ function createSystemWatchFunctions(_a) { - var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog; + var pollingWatchFileWorker = _a.pollingWatchFileWorker, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog; + var pollingWatches = new ts.Map(); + var fsWatches = new ts.Map(); + var fsWatchesRecursive = new ts.Map(); var dynamicPollingWatchFile; var fixedChunkSizePollingWatchFile; var nonPollingWatchFile; @@ -6755,7 +6789,7 @@ var ts; // Use notifications from FS to watch with falling back to fs.watchFile generateWatchFileOptions(ts.WatchFileKind.UseFsEventsOnParentDirectory, ts.PollingWatchKind.PriorityInterval, options) : // Default to do not use fixed polling interval - { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.FixedPollingInterval }; + { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.UseFsEvents }; } } function generateWatchFileOptions(watchFile, fallbackPolling, options) { @@ -6826,7 +6860,13 @@ var ts; }; } } + function pollingWatchFile(fileName, callback, pollingInterval, options) { + return createSingleWatcherPerName(pollingWatches, useCaseSensitiveFileNames, fileName, callback, function (cb) { return pollingWatchFileWorker(fileName, cb, pollingInterval, options); }); + } function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { + return createSingleWatcherPerName(recursive ? fsWatchesRecursive : fsWatches, useCaseSensitiveFileNames, fileOrDirectory, callback, function (cb) { return fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, cb, recursive, fallbackPollingInterval, fallbackOptions); }); + } + function fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { var lastDirectoryPartWithDirectorySeparator; var lastDirectoryPart; if (inodeWatching) { @@ -7005,7 +7045,7 @@ var ts; var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin"); var getCurrentDirectory = ts.memoize(function () { return process.cwd(); }); var _b = createSystemWatchFunctions({ - pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames), + pollingWatchFileWorker: fsWatchFileWorker, getModifiedTime: getModifiedTime, setTimeout: setTimeout, clearTimeout: clearTimeout, @@ -7825,12 +7865,9 @@ var ts; * Normalize path separators, converting `\` into `/`. */ function normalizeSlashes(path) { - var index = path.indexOf("\\"); - if (index === -1) { - return path; - } - backslashRegExp.lastIndex = index; // prime regex with known position - return path.replace(backslashRegExp, ts.directorySeparator); + return path.indexOf("\\") !== -1 + ? path.replace(backslashRegExp, ts.directorySeparator) + : path; } ts.normalizeSlashes = normalizeSlashes; /** @@ -8413,6 +8450,8 @@ var ts; A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled: diag(1272, ts.DiagnosticCategory.Error, "A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_w_1272", "A type referenced in a decorated signature must be imported with 'import type' or a namespace import when 'isolatedModules' and 'emitDecoratorMetadata' are enabled."), _0_modifier_cannot_appear_on_a_type_parameter: diag(1273, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_type_parameter_1273", "'{0}' modifier cannot appear on a type parameter"), _0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias: diag(1274, ts.DiagnosticCategory.Error, "_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias_1274", "'{0}' modifier can only appear on a type parameter of a class, interface or type alias"), + accessor_modifier_can_only_appear_on_a_property_declaration: diag(1275, ts.DiagnosticCategory.Error, "accessor_modifier_can_only_appear_on_a_property_declaration_1275", "'accessor' modifier can only appear on a property declaration."), + An_accessor_property_cannot_be_declared_optional: diag(1276, ts.DiagnosticCategory.Error, "An_accessor_property_cannot_be_declared_optional_1276", "An 'accessor' property cannot be declared optional."), with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."), await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."), The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, ts.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."), @@ -8463,7 +8502,7 @@ var ts; An_enum_member_name_must_be_followed_by_a_or: diag(1357, ts.DiagnosticCategory.Error, "An_enum_member_name_must_be_followed_by_a_or_1357", "An enum member name must be followed by a ',', '=', or '}'."), Tagged_template_expressions_are_not_permitted_in_an_optional_chain: diag(1358, ts.DiagnosticCategory.Error, "Tagged_template_expressions_are_not_permitted_in_an_optional_chain_1358", "Tagged template expressions are not permitted in an optional chain."), Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here: diag(1359, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here_1359", "Identifier expected. '{0}' is a reserved word that cannot be used here."), - Class_constructor_may_not_be_a_generator: diag(1360, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1360", "Class constructor may not be a generator."), + Type_0_does_not_satisfy_the_expected_type_1: diag(1360, ts.DiagnosticCategory.Error, "Type_0_does_not_satisfy_the_expected_type_1_1360", "Type '{0}' does not satisfy the expected type '{1}'."), _0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type: diag(1361, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type_1361", "'{0}' cannot be used as a value because it was imported using 'import type'."), _0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type: diag(1362, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type_1362", "'{0}' cannot be used as a value because it was exported using 'export type'."), A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both: diag(1363, ts.DiagnosticCategory.Error, "A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both_1363", "A type-only import can specify a default import or named bindings, but not both."), @@ -8471,6 +8510,7 @@ var ts; Convert_all_re_exported_types_to_type_only_exports: diag(1365, ts.DiagnosticCategory.Message, "Convert_all_re_exported_types_to_type_only_exports_1365", "Convert all re-exported types to type-only exports"), Split_into_two_separate_import_declarations: diag(1366, ts.DiagnosticCategory.Message, "Split_into_two_separate_import_declarations_1366", "Split into two separate import declarations"), Split_all_invalid_type_only_imports: diag(1367, ts.DiagnosticCategory.Message, "Split_all_invalid_type_only_imports_1367", "Split all invalid type-only imports"), + Class_constructor_may_not_be_a_generator: diag(1368, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1368", "Class constructor may not be a generator."), Did_you_mean_0: diag(1369, ts.DiagnosticCategory.Message, "Did_you_mean_0_1369", "Did you mean '{0}'?"), This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error: diag(1371, ts.DiagnosticCategory.Error, "This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set__1371", "This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'."), Convert_to_type_only_import: diag(1373, ts.DiagnosticCategory.Message, "Convert_to_type_only_import_1373", "Convert to type-only import"), @@ -8644,14 +8684,12 @@ var ts; The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."), The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."), The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."), - The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360", "The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."), - The_right_hand_side_of_an_in_expression_must_not_be_a_primitive: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361", "The right-hand side of an 'in' expression must not be a primitive."), The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."), Operator_0_cannot_be_applied_to_types_1_and_2: diag(2365, ts.DiagnosticCategory.Error, "Operator_0_cannot_be_applied_to_types_1_and_2_2365", "Operator '{0}' cannot be applied to types '{1}' and '{2}'."), Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: diag(2366, ts.DiagnosticCategory.Error, "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", "Function lacks ending return statement and return type does not include 'undefined'."), - This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367", "This condition will always return '{0}' since the types '{1}' and '{2}' have no overlap."), + This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367", "This comparison appears to be unintentional because the types '{0}' and '{1}' have no overlap."), Type_parameter_name_cannot_be_0: diag(2368, ts.DiagnosticCategory.Error, "Type_parameter_name_cannot_be_0_2368", "Type parameter name cannot be '{0}'."), A_parameter_property_is_only_allowed_in_a_constructor_implementation: diag(2369, ts.DiagnosticCategory.Error, "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", "A parameter property is only allowed in a constructor implementation."), A_rest_parameter_must_be_of_an_array_type: diag(2370, ts.DiagnosticCategory.Error, "A_rest_parameter_must_be_of_an_array_type_2370", "A rest parameter must be of an array type."), @@ -8894,6 +8932,7 @@ var ts; Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."), Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation: diag(2636, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation_2636", "Type '{0}' is not assignable to type '{1}' as implied by variance annotation."), Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types: diag(2637, ts.DiagnosticCategory.Error, "Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_t_2637", "Variance annotations are only supported in type aliases for object, function, constructor, and mapped types."), + Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator: diag(2638, ts.DiagnosticCategory.Error, "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638", "Type '{0}' may represent a primitive value, which is not permitted as the right operand of the 'in' operator."), Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."), A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."), Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."), @@ -9074,6 +9113,7 @@ var ts; _0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation: diag(2842, ts.DiagnosticCategory.Error, "_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842", "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"), We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here: diag(2843, ts.DiagnosticCategory.Error, "We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843", "We can only write a type for '{0}' by adding a type for the entire parameter here."), Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, ts.DiagnosticCategory.Error, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."), + This_condition_will_always_return_0: diag(2845, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."), Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."), Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."), Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."), @@ -9531,6 +9571,7 @@ var ts; Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved: diag(6398, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."), Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes were not emitted"), Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs to update timestamps of output files that are older than input files"), + Project_0_is_out_of_date_because_there_was_error_reading_file_1: diag(6401, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401", "Project '{0}' is out of date because there was error reading file '{1}'"), The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"), The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."), The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."), @@ -9773,6 +9814,7 @@ var ts; The_tag_was_first_specified_here: diag(8034, ts.DiagnosticCategory.Error, "The_tag_was_first_specified_here_8034", "The tag was first specified here."), You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder: diag(8035, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder_8035", "You cannot rename elements that are defined in a 'node_modules' folder."), You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder: diag(8036, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder_8036", "You cannot rename elements that are defined in another 'node_modules' folder."), + Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files: diag(8037, ts.DiagnosticCategory.Error, "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037", "Type satisfaction expressions can only be used in TypeScript files."), Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."), Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."), JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17000, ts.DiagnosticCategory.Error, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."), @@ -9944,6 +9986,7 @@ var ts; Set_the_module_option_in_your_configuration_file_to_0: diag(95099, ts.DiagnosticCategory.Message, "Set_the_module_option_in_your_configuration_file_to_0_95099", "Set the 'module' option in your configuration file to '{0}'"), Convert_invalid_character_to_its_html_entity_code: diag(95100, ts.DiagnosticCategory.Message, "Convert_invalid_character_to_its_html_entity_code_95100", "Convert invalid character to its html entity code"), Convert_all_invalid_characters_to_HTML_entity_code: diag(95101, ts.DiagnosticCategory.Message, "Convert_all_invalid_characters_to_HTML_entity_code_95101", "Convert all invalid characters to HTML entity code"), + Convert_all_const_to_let: diag(95102, ts.DiagnosticCategory.Message, "Convert_all_const_to_let_95102", "Convert all 'const' to 'let'"), Convert_function_expression_0_to_arrow_function: diag(95105, ts.DiagnosticCategory.Message, "Convert_function_expression_0_to_arrow_function_95105", "Convert function expression '{0}' to arrow function"), Convert_function_declaration_0_to_arrow_function: diag(95106, ts.DiagnosticCategory.Message, "Convert_function_declaration_0_to_arrow_function_95106", "Convert function declaration '{0}' to arrow function"), Fix_all_implicit_this_errors: diag(95107, ts.DiagnosticCategory.Message, "Fix_all_implicit_this_errors_95107", "Fix all implicit-'this' errors"), @@ -10013,6 +10056,8 @@ var ts; Delete_unused_param_tag_0: diag(95171, ts.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"), Delete_all_unused_param_tags: diag(95172, ts.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"), Rename_param_tag_name_0_to_1: diag(95173, ts.DiagnosticCategory.Message, "Rename_param_tag_name_0_to_1_95173", "Rename '@param' tag name '{0}' to '{1}'"), + Use_0: diag(95174, ts.DiagnosticCategory.Message, "Use_0_95174", "Use `{0}`."), + Use_Number_isNaN_in_all_conditions: diag(95175, ts.DiagnosticCategory.Message, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."), No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."), Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."), JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, ts.DiagnosticCategory.Error, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"), @@ -10046,6 +10091,12 @@ var ts; _0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation: diag(18042, ts.DiagnosticCategory.Error, "_0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation_18042", "'{0}' is a type and cannot be imported in JavaScript files. Use '{1}' in a JSDoc type annotation."), Types_cannot_appear_in_export_declarations_in_JavaScript_files: diag(18043, ts.DiagnosticCategory.Error, "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043", "Types cannot appear in export declarations in JavaScript files."), _0_is_automatically_exported_here: diag(18044, ts.DiagnosticCategory.Message, "_0_is_automatically_exported_here_18044", "'{0}' is automatically exported here."), + Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher: diag(18045, ts.DiagnosticCategory.Error, "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045", "Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher."), + _0_is_of_type_unknown: diag(18046, ts.DiagnosticCategory.Error, "_0_is_of_type_unknown_18046", "'{0}' is of type 'unknown'."), + _0_is_possibly_null: diag(18047, ts.DiagnosticCategory.Error, "_0_is_possibly_null_18047", "'{0}' is possibly 'null'."), + _0_is_possibly_undefined: diag(18048, ts.DiagnosticCategory.Error, "_0_is_possibly_undefined_18048", "'{0}' is possibly 'undefined'."), + _0_is_possibly_null_or_undefined: diag(18049, ts.DiagnosticCategory.Error, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."), + The_value_0_cannot_be_used_here: diag(18050, ts.DiagnosticCategory.Error, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."), }; })(ts || (ts = {})); var ts; @@ -10064,12 +10115,13 @@ var ts; /** @internal */ ts.textToKeywordObj = (_a = { abstract: 126 /* SyntaxKind.AbstractKeyword */, - any: 130 /* SyntaxKind.AnyKeyword */, - as: 127 /* SyntaxKind.AsKeyword */, - asserts: 128 /* SyntaxKind.AssertsKeyword */, - assert: 129 /* SyntaxKind.AssertKeyword */, - bigint: 158 /* SyntaxKind.BigIntKeyword */, - boolean: 133 /* SyntaxKind.BooleanKeyword */, + accessor: 127 /* SyntaxKind.AccessorKeyword */, + any: 131 /* SyntaxKind.AnyKeyword */, + as: 128 /* SyntaxKind.AsKeyword */, + asserts: 129 /* SyntaxKind.AssertsKeyword */, + assert: 130 /* SyntaxKind.AssertKeyword */, + bigint: 160 /* SyntaxKind.BigIntKeyword */, + boolean: 134 /* SyntaxKind.BooleanKeyword */, break: 81 /* SyntaxKind.BreakKeyword */, case: 82 /* SyntaxKind.CaseKeyword */, catch: 83 /* SyntaxKind.CatchKeyword */, @@ -10077,9 +10129,9 @@ var ts; continue: 86 /* SyntaxKind.ContinueKeyword */, const: 85 /* SyntaxKind.ConstKeyword */ }, - _a["" + "constructor"] = 134 /* SyntaxKind.ConstructorKeyword */, + _a["" + "constructor"] = 135 /* SyntaxKind.ConstructorKeyword */, _a.debugger = 87 /* SyntaxKind.DebuggerKeyword */, - _a.declare = 135 /* SyntaxKind.DeclareKeyword */, + _a.declare = 136 /* SyntaxKind.DeclareKeyword */, _a.default = 88 /* SyntaxKind.DefaultKeyword */, _a.delete = 89 /* SyntaxKind.DeleteKeyword */, _a.do = 90 /* SyntaxKind.DoKeyword */, @@ -10090,60 +10142,61 @@ var ts; _a.false = 95 /* SyntaxKind.FalseKeyword */, _a.finally = 96 /* SyntaxKind.FinallyKeyword */, _a.for = 97 /* SyntaxKind.ForKeyword */, - _a.from = 156 /* SyntaxKind.FromKeyword */, + _a.from = 158 /* SyntaxKind.FromKeyword */, _a.function = 98 /* SyntaxKind.FunctionKeyword */, - _a.get = 136 /* SyntaxKind.GetKeyword */, + _a.get = 137 /* SyntaxKind.GetKeyword */, _a.if = 99 /* SyntaxKind.IfKeyword */, _a.implements = 117 /* SyntaxKind.ImplementsKeyword */, _a.import = 100 /* SyntaxKind.ImportKeyword */, _a.in = 101 /* SyntaxKind.InKeyword */, - _a.infer = 137 /* SyntaxKind.InferKeyword */, + _a.infer = 138 /* SyntaxKind.InferKeyword */, _a.instanceof = 102 /* SyntaxKind.InstanceOfKeyword */, _a.interface = 118 /* SyntaxKind.InterfaceKeyword */, - _a.intrinsic = 138 /* SyntaxKind.IntrinsicKeyword */, - _a.is = 139 /* SyntaxKind.IsKeyword */, - _a.keyof = 140 /* SyntaxKind.KeyOfKeyword */, + _a.intrinsic = 139 /* SyntaxKind.IntrinsicKeyword */, + _a.is = 140 /* SyntaxKind.IsKeyword */, + _a.keyof = 141 /* SyntaxKind.KeyOfKeyword */, _a.let = 119 /* SyntaxKind.LetKeyword */, - _a.module = 141 /* SyntaxKind.ModuleKeyword */, - _a.namespace = 142 /* SyntaxKind.NamespaceKeyword */, - _a.never = 143 /* SyntaxKind.NeverKeyword */, + _a.module = 142 /* SyntaxKind.ModuleKeyword */, + _a.namespace = 143 /* SyntaxKind.NamespaceKeyword */, + _a.never = 144 /* SyntaxKind.NeverKeyword */, _a.new = 103 /* SyntaxKind.NewKeyword */, _a.null = 104 /* SyntaxKind.NullKeyword */, - _a.number = 147 /* SyntaxKind.NumberKeyword */, - _a.object = 148 /* SyntaxKind.ObjectKeyword */, + _a.number = 148 /* SyntaxKind.NumberKeyword */, + _a.object = 149 /* SyntaxKind.ObjectKeyword */, _a.package = 120 /* SyntaxKind.PackageKeyword */, _a.private = 121 /* SyntaxKind.PrivateKeyword */, _a.protected = 122 /* SyntaxKind.ProtectedKeyword */, _a.public = 123 /* SyntaxKind.PublicKeyword */, - _a.override = 159 /* SyntaxKind.OverrideKeyword */, - _a.out = 144 /* SyntaxKind.OutKeyword */, - _a.readonly = 145 /* SyntaxKind.ReadonlyKeyword */, - _a.require = 146 /* SyntaxKind.RequireKeyword */, - _a.global = 157 /* SyntaxKind.GlobalKeyword */, + _a.override = 161 /* SyntaxKind.OverrideKeyword */, + _a.out = 145 /* SyntaxKind.OutKeyword */, + _a.readonly = 146 /* SyntaxKind.ReadonlyKeyword */, + _a.require = 147 /* SyntaxKind.RequireKeyword */, + _a.global = 159 /* SyntaxKind.GlobalKeyword */, _a.return = 105 /* SyntaxKind.ReturnKeyword */, - _a.set = 149 /* SyntaxKind.SetKeyword */, + _a.satisfies = 150 /* SyntaxKind.SatisfiesKeyword */, + _a.set = 151 /* SyntaxKind.SetKeyword */, _a.static = 124 /* SyntaxKind.StaticKeyword */, - _a.string = 150 /* SyntaxKind.StringKeyword */, + _a.string = 152 /* SyntaxKind.StringKeyword */, _a.super = 106 /* SyntaxKind.SuperKeyword */, _a.switch = 107 /* SyntaxKind.SwitchKeyword */, - _a.symbol = 151 /* SyntaxKind.SymbolKeyword */, + _a.symbol = 153 /* SyntaxKind.SymbolKeyword */, _a.this = 108 /* SyntaxKind.ThisKeyword */, _a.throw = 109 /* SyntaxKind.ThrowKeyword */, _a.true = 110 /* SyntaxKind.TrueKeyword */, _a.try = 111 /* SyntaxKind.TryKeyword */, - _a.type = 152 /* SyntaxKind.TypeKeyword */, + _a.type = 154 /* SyntaxKind.TypeKeyword */, _a.typeof = 112 /* SyntaxKind.TypeOfKeyword */, - _a.undefined = 153 /* SyntaxKind.UndefinedKeyword */, - _a.unique = 154 /* SyntaxKind.UniqueKeyword */, - _a.unknown = 155 /* SyntaxKind.UnknownKeyword */, + _a.undefined = 155 /* SyntaxKind.UndefinedKeyword */, + _a.unique = 156 /* SyntaxKind.UniqueKeyword */, + _a.unknown = 157 /* SyntaxKind.UnknownKeyword */, _a.var = 113 /* SyntaxKind.VarKeyword */, _a.void = 114 /* SyntaxKind.VoidKeyword */, _a.while = 115 /* SyntaxKind.WhileKeyword */, _a.with = 116 /* SyntaxKind.WithKeyword */, _a.yield = 125 /* SyntaxKind.YieldKeyword */, - _a.async = 131 /* SyntaxKind.AsyncKeyword */, - _a.await = 132 /* SyntaxKind.AwaitKeyword */, - _a.of = 160 /* SyntaxKind.OfKeyword */, + _a.async = 132 /* SyntaxKind.AsyncKeyword */, + _a.await = 133 /* SyntaxKind.AwaitKeyword */, + _a.of = 162 /* SyntaxKind.OfKeyword */, _a); var textToKeyword = new ts.Map(ts.getEntries(ts.textToKeywordObj)); var textToToken = new ts.Map(ts.getEntries(__assign(__assign({}, ts.textToKeywordObj), { "{": 18 /* SyntaxKind.OpenBraceToken */, "}": 19 /* SyntaxKind.CloseBraceToken */, "(": 20 /* SyntaxKind.OpenParenToken */, ")": 21 /* SyntaxKind.CloseParenToken */, "[": 22 /* SyntaxKind.OpenBracketToken */, "]": 23 /* SyntaxKind.CloseBracketToken */, ".": 24 /* SyntaxKind.DotToken */, "...": 25 /* SyntaxKind.DotDotDotToken */, ";": 26 /* SyntaxKind.SemicolonToken */, ",": 27 /* SyntaxKind.CommaToken */, "<": 29 /* SyntaxKind.LessThanToken */, ">": 31 /* SyntaxKind.GreaterThanToken */, "<=": 32 /* SyntaxKind.LessThanEqualsToken */, ">=": 33 /* SyntaxKind.GreaterThanEqualsToken */, "==": 34 /* SyntaxKind.EqualsEqualsToken */, "!=": 35 /* SyntaxKind.ExclamationEqualsToken */, "===": 36 /* SyntaxKind.EqualsEqualsEqualsToken */, "!==": 37 /* SyntaxKind.ExclamationEqualsEqualsToken */, "=>": 38 /* SyntaxKind.EqualsGreaterThanToken */, "+": 39 /* SyntaxKind.PlusToken */, "-": 40 /* SyntaxKind.MinusToken */, "**": 42 /* SyntaxKind.AsteriskAsteriskToken */, "*": 41 /* SyntaxKind.AsteriskToken */, "/": 43 /* SyntaxKind.SlashToken */, "%": 44 /* SyntaxKind.PercentToken */, "++": 45 /* SyntaxKind.PlusPlusToken */, "--": 46 /* SyntaxKind.MinusMinusToken */, "<<": 47 /* SyntaxKind.LessThanLessThanToken */, ">": 48 /* SyntaxKind.GreaterThanGreaterThanToken */, ">>>": 49 /* SyntaxKind.GreaterThanGreaterThanGreaterThanToken */, "&": 50 /* SyntaxKind.AmpersandToken */, "|": 51 /* SyntaxKind.BarToken */, "^": 52 /* SyntaxKind.CaretToken */, "!": 53 /* SyntaxKind.ExclamationToken */, "~": 54 /* SyntaxKind.TildeToken */, "&&": 55 /* SyntaxKind.AmpersandAmpersandToken */, "||": 56 /* SyntaxKind.BarBarToken */, "?": 57 /* SyntaxKind.QuestionToken */, "??": 60 /* SyntaxKind.QuestionQuestionToken */, "?.": 28 /* SyntaxKind.QuestionDotToken */, ":": 58 /* SyntaxKind.ColonToken */, "=": 63 /* SyntaxKind.EqualsToken */, "+=": 64 /* SyntaxKind.PlusEqualsToken */, "-=": 65 /* SyntaxKind.MinusEqualsToken */, "*=": 66 /* SyntaxKind.AsteriskEqualsToken */, "**=": 67 /* SyntaxKind.AsteriskAsteriskEqualsToken */, "/=": 68 /* SyntaxKind.SlashEqualsToken */, "%=": 69 /* SyntaxKind.PercentEqualsToken */, "<<=": 70 /* SyntaxKind.LessThanLessThanEqualsToken */, ">>=": 71 /* SyntaxKind.GreaterThanGreaterThanEqualsToken */, ">>>=": 72 /* SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 73 /* SyntaxKind.AmpersandEqualsToken */, "|=": 74 /* SyntaxKind.BarEqualsToken */, "^=": 78 /* SyntaxKind.CaretEqualsToken */, "||=": 75 /* SyntaxKind.BarBarEqualsToken */, "&&=": 76 /* SyntaxKind.AmpersandAmpersandEqualsToken */, "??=": 77 /* SyntaxKind.QuestionQuestionEqualsToken */, "@": 59 /* SyntaxKind.AtToken */, "#": 62 /* SyntaxKind.HashToken */, "`": 61 /* SyntaxKind.BacktickToken */ }))); @@ -10266,7 +10319,7 @@ var ts; ts.stringToToken = stringToToken; /* @internal */ function computeLineStarts(text) { - var result = new Array(); + var result = []; var pos = 0; var lineStart = 0; while (pos < text.length) { @@ -11827,12 +11880,36 @@ var ts; pos++; return token = 0 /* SyntaxKind.Unknown */; } - if (isIdentifierStart(codePointAt(text, pos + 1), languageVersion)) { + var charAfterHash = codePointAt(text, pos + 1); + if (charAfterHash === 92 /* CharacterCodes.backslash */) { pos++; - scanIdentifier(codePointAt(text, pos), languageVersion); + var extendedCookedChar_1 = peekExtendedUnicodeEscape(); + if (extendedCookedChar_1 >= 0 && isIdentifierStart(extendedCookedChar_1, languageVersion)) { + pos += 3; + tokenFlags |= 8 /* TokenFlags.ExtendedUnicodeEscape */; + tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts(); + return token = 80 /* SyntaxKind.PrivateIdentifier */; + } + var cookedChar_1 = peekUnicodeEscape(); + if (cookedChar_1 >= 0 && isIdentifierStart(cookedChar_1, languageVersion)) { + pos += 6; + tokenFlags |= 1024 /* TokenFlags.UnicodeEscape */; + tokenValue = "#" + String.fromCharCode(cookedChar_1) + scanIdentifierParts(); + return token = 80 /* SyntaxKind.PrivateIdentifier */; + } + pos--; + } + if (isIdentifierStart(charAfterHash, languageVersion)) { + pos++; + // We're relying on scanIdentifier's behavior and adjusting the token kind after the fact. + // Notably absent from this block is the fact that calling a function named "scanIdentifier", + // but identifiers don't include '#', and that function doesn't deal with it at all. + // This works because 'scanIdentifier' tries to reuse source characters and builds up substrings; + // however, it starts at the 'tokenPos' which includes the '#', and will "accidentally" prepend the '#' for us. + scanIdentifier(charAfterHash, languageVersion); } else { - tokenValue = String.fromCharCode(codePointAt(text, pos)); + tokenValue = "#"; error(ts.Diagnostics.Invalid_character, pos++, charSize(ch)); } return token = 80 /* SyntaxKind.PrivateIdentifier */; @@ -12583,9 +12660,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 163 /* SyntaxKind.TypeParameter */) { + if (d && d.kind === 165 /* SyntaxKind.TypeParameter */) { for (var current = d; current; current = current.parent) { - if (isFunctionLike(current) || isClassLike(current) || current.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (isFunctionLike(current) || isClassLike(current) || current.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return current; } } @@ -12593,7 +12670,7 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node, parent) { - return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) && parent.kind === 171 /* SyntaxKind.Constructor */; + return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) && parent.kind === 173 /* SyntaxKind.Constructor */; } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; function isEmptyBindingPattern(node) { @@ -12623,14 +12700,14 @@ var ts; node = walkUpBindingElementsAndPatterns(node); } var flags = getFlags(node); - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node && node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { flags |= getFlags(node); node = node.parent; } - if (node && node.kind === 237 /* SyntaxKind.VariableStatement */) { + if (node && node.kind === 240 /* SyntaxKind.VariableStatement */) { flags |= getFlags(node); } return flags; @@ -12803,30 +12880,30 @@ var ts; } // Covers remaining cases (returning undefined if none match). switch (hostNode.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: if (hostNode.declarationList && hostNode.declarationList.declarations[0]) { return getDeclarationIdentifier(hostNode.declarationList.declarations[0]); } break; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: var expr = hostNode.expression; - if (expr.kind === 221 /* SyntaxKind.BinaryExpression */ && expr.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (expr.kind === 223 /* SyntaxKind.BinaryExpression */ && expr.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { expr = expr.left; } switch (expr.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return expr.name; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var arg = expr.argumentExpression; if (ts.isIdentifier(arg)) { return arg; } } break; - case 212 /* SyntaxKind.ParenthesizedExpression */: { + case 214 /* SyntaxKind.ParenthesizedExpression */: { return getDeclarationIdentifier(hostNode.expression); } - case 250 /* SyntaxKind.LabeledStatement */: { + case 253 /* SyntaxKind.LabeledStatement */: { if (isDeclaration(hostNode.statement) || isExpression(hostNode.statement)) { return getDeclarationIdentifier(hostNode.statement); } @@ -12863,16 +12940,16 @@ var ts; switch (declaration.kind) { case 79 /* SyntaxKind.Identifier */: return declaration; - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: { + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: { var name = declaration.name; - if (name.kind === 161 /* SyntaxKind.QualifiedName */) { + if (name.kind === 163 /* SyntaxKind.QualifiedName */) { return name.right; } break; } - case 208 /* SyntaxKind.CallExpression */: - case 221 /* SyntaxKind.BinaryExpression */: { + case 210 /* SyntaxKind.CallExpression */: + case 223 /* SyntaxKind.BinaryExpression */: { var expr_1 = declaration; switch (ts.getAssignmentDeclarationKind(expr_1)) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -12888,15 +12965,15 @@ var ts; return undefined; } } - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return getNameOfJSDocTypedef(declaration); - case 339 /* SyntaxKind.JSDocEnumTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return nameForNamelessJSDocTypedef(declaration); - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var expression = declaration.expression; return ts.isIdentifier(expression) ? expression : undefined; } - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = declaration; if (ts.isBindableStaticElementAccessExpression(expr)) { return expr.argumentExpression; @@ -12940,7 +13017,7 @@ var ts; } ts.getDecorators = getDecorators; function getModifiers(node) { - if (ts.hasSyntacticModifier(node, 125951 /* ModifierFlags.Modifier */)) { + if (ts.hasSyntacticModifier(node, 126975 /* ModifierFlags.Modifier */)) { return ts.filter(node.modifiers, isModifier); } } @@ -13201,12 +13278,12 @@ var ts; /** Gets the text of a jsdoc comment, flattening links to their text. */ function getTextOfJSDocComment(comment) { return typeof comment === "string" ? comment - : comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 321 /* SyntaxKind.JSDocText */ ? c.text : formatJSDocLink(c); }).join(""); + : comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 324 /* SyntaxKind.JSDocText */ ? c.text : formatJSDocLink(c); }).join(""); } ts.getTextOfJSDocComment = getTextOfJSDocComment; function formatJSDocLink(link) { - var kind = link.kind === 324 /* SyntaxKind.JSDocLink */ ? "link" - : link.kind === 325 /* SyntaxKind.JSDocLinkCode */ ? "linkcode" + var kind = link.kind === 327 /* SyntaxKind.JSDocLink */ ? "link" + : link.kind === 328 /* SyntaxKind.JSDocLinkCode */ ? "linkcode" : "linkplain"; var name = link.name ? ts.entityNameToString(link.name) : ""; var space = link.name && link.text.startsWith("://") ? "" : " "; @@ -13227,7 +13304,7 @@ var ts; return ts.emptyArray; } if (ts.isJSDocTypeAlias(node)) { - ts.Debug.assert(node.parent.kind === 320 /* SyntaxKind.JSDoc */); + ts.Debug.assert(node.parent.kind === 323 /* SyntaxKind.JSDoc */); return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; }); } if (node.typeParameters) { @@ -13262,7 +13339,7 @@ var ts; ts.isMemberName = isMemberName; /* @internal */ function isGetOrSetAccessorDeclaration(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */ || node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */ || node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetOrSetAccessorDeclaration = isGetOrSetAccessorDeclaration; function isPropertyAccessChain(node) { @@ -13280,10 +13357,10 @@ var ts; function isOptionalChain(node) { var kind = node.kind; return !!(node.flags & 32 /* NodeFlags.OptionalChain */) && - (kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 207 /* SyntaxKind.ElementAccessExpression */ - || kind === 208 /* SyntaxKind.CallExpression */ - || kind === 230 /* SyntaxKind.NonNullExpression */); + (kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 209 /* SyntaxKind.ElementAccessExpression */ + || kind === 210 /* SyntaxKind.CallExpression */ + || kind === 232 /* SyntaxKind.NonNullExpression */); } ts.isOptionalChain = isOptionalChain; /* @internal */ @@ -13318,7 +13395,7 @@ var ts; } ts.isOutermostOptionalChain = isOutermostOptionalChain; function isNullishCoalesce(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */; } ts.isNullishCoalesce = isNullishCoalesce; function isConstTypeReference(node) { @@ -13335,17 +13412,17 @@ var ts; } ts.isNonNullChain = isNonNullChain; function isBreakOrContinueStatement(node) { - return node.kind === 246 /* SyntaxKind.BreakStatement */ || node.kind === 245 /* SyntaxKind.ContinueStatement */; + return node.kind === 249 /* SyntaxKind.BreakStatement */ || node.kind === 248 /* SyntaxKind.ContinueStatement */; } ts.isBreakOrContinueStatement = isBreakOrContinueStatement; function isNamedExportBindings(node) { - return node.kind === 274 /* SyntaxKind.NamespaceExport */ || node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 277 /* SyntaxKind.NamespaceExport */ || node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedExportBindings = isNamedExportBindings; function isUnparsedTextLike(node) { switch (node.kind) { - case 302 /* SyntaxKind.UnparsedText */: - case 303 /* SyntaxKind.UnparsedInternalText */: + case 305 /* SyntaxKind.UnparsedText */: + case 306 /* SyntaxKind.UnparsedInternalText */: return true; default: return false; @@ -13354,12 +13431,12 @@ var ts; ts.isUnparsedTextLike = isUnparsedTextLike; function isUnparsedNode(node) { return isUnparsedTextLike(node) || - node.kind === 300 /* SyntaxKind.UnparsedPrologue */ || - node.kind === 304 /* SyntaxKind.UnparsedSyntheticReference */; + node.kind === 303 /* SyntaxKind.UnparsedPrologue */ || + node.kind === 307 /* SyntaxKind.UnparsedSyntheticReference */; } ts.isUnparsedNode = isUnparsedNode; function isJSDocPropertyLikeTag(node) { - return node.kind === 347 /* SyntaxKind.JSDocPropertyTag */ || node.kind === 340 /* SyntaxKind.JSDocParameterTag */; + return node.kind === 350 /* SyntaxKind.JSDocPropertyTag */ || node.kind === 343 /* SyntaxKind.JSDocParameterTag */; } ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; // #endregion @@ -13375,7 +13452,7 @@ var ts; ts.isNode = isNode; /* @internal */ function isNodeKind(kind) { - return kind >= 161 /* SyntaxKind.FirstNode */; + return kind >= 163 /* SyntaxKind.FirstNode */; } ts.isNodeKind = isNodeKind; /** @@ -13384,7 +13461,7 @@ var ts; * Literals are considered tokens, except TemplateLiteral, but does include TemplateHead/Middle/Tail. */ function isTokenKind(kind) { - return kind >= 0 /* SyntaxKind.FirstToken */ && kind <= 160 /* SyntaxKind.LastToken */; + return kind >= 0 /* SyntaxKind.FirstToken */ && kind <= 162 /* SyntaxKind.LastToken */; } ts.isTokenKind = isTokenKind; /** @@ -13399,7 +13476,7 @@ var ts; // Node Arrays /* @internal */ function isNodeArray(array) { - return array.hasOwnProperty("pos") && array.hasOwnProperty("end"); + return ts.hasProperty(array, "pos") && ts.hasProperty(array, "end"); } ts.isNodeArray = isNodeArray; // Literals @@ -13415,11 +13492,11 @@ var ts; /** @internal */ function isLiteralExpressionOfObject(node) { switch (node.kind) { - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: return true; } return false; @@ -13447,13 +13524,13 @@ var ts; ts.isImportOrExportSpecifier = isImportOrExportSpecifier; function isTypeOnlyImportOrExportDeclaration(node) { switch (node.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return node.isTypeOnly || node.parent.parent.isTypeOnly; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.isTypeOnly; - case 267 /* SyntaxKind.ImportClause */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 270 /* SyntaxKind.ImportClause */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.isTypeOnly; default: return false; @@ -13474,6 +13551,11 @@ var ts; return ts.isIdentifier(node) && (node.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) > 0 /* GeneratedIdentifierFlags.None */; } ts.isGeneratedIdentifier = isGeneratedIdentifier; + /* @internal */ + function isGeneratedPrivateIdentifier(node) { + return ts.isPrivateIdentifier(node) && (node.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) > 0 /* GeneratedIdentifierFlags.None */; + } + ts.isGeneratedPrivateIdentifier = isGeneratedPrivateIdentifier; // Private Identifiers /*@internal*/ function isPrivateIdentifierClassElementDeclaration(node) { @@ -13490,19 +13572,20 @@ var ts; function isModifierKind(token) { switch (token) { case 126 /* SyntaxKind.AbstractKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 88 /* SyntaxKind.DefaultKeyword */: case 93 /* SyntaxKind.ExportKeyword */: case 101 /* SyntaxKind.InKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 144 /* SyntaxKind.OutKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 145 /* SyntaxKind.OutKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: return true; } return false; @@ -13515,7 +13598,10 @@ var ts; ts.isParameterPropertyModifier = isParameterPropertyModifier; /* @internal */ function isClassMemberModifier(idToken) { - return isParameterPropertyModifier(idToken) || idToken === 124 /* SyntaxKind.StaticKeyword */ || idToken === 159 /* SyntaxKind.OverrideKeyword */; + return isParameterPropertyModifier(idToken) || + idToken === 124 /* SyntaxKind.StaticKeyword */ || + idToken === 161 /* SyntaxKind.OverrideKeyword */ || + idToken === 127 /* SyntaxKind.AccessorKeyword */; } ts.isClassMemberModifier = isClassMemberModifier; function isModifier(node) { @@ -13524,7 +13610,7 @@ var ts; ts.isModifier = isModifier; function isEntityName(node) { var kind = node.kind; - return kind === 161 /* SyntaxKind.QualifiedName */ + return kind === 163 /* SyntaxKind.QualifiedName */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isEntityName = isEntityName; @@ -13534,14 +13620,14 @@ var ts; || kind === 80 /* SyntaxKind.PrivateIdentifier */ || kind === 10 /* SyntaxKind.StringLiteral */ || kind === 8 /* SyntaxKind.NumericLiteral */ - || kind === 162 /* SyntaxKind.ComputedPropertyName */; + || kind === 164 /* SyntaxKind.ComputedPropertyName */; } ts.isPropertyName = isPropertyName; function isBindingName(node) { var kind = node.kind; return kind === 79 /* SyntaxKind.Identifier */ - || kind === 201 /* SyntaxKind.ObjectBindingPattern */ - || kind === 202 /* SyntaxKind.ArrayBindingPattern */; + || kind === 203 /* SyntaxKind.ObjectBindingPattern */ + || kind === 204 /* SyntaxKind.ArrayBindingPattern */; } ts.isBindingName = isBindingName; // Functions @@ -13566,13 +13652,13 @@ var ts; ts.isBooleanLiteral = isBooleanLiteral; function isFunctionLikeDeclarationKind(kind) { switch (kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: return false; @@ -13581,14 +13667,14 @@ var ts; /* @internal */ function isFunctionLikeKind(kind) { switch (kind) { - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return true; default: return isFunctionLikeDeclarationKind(kind); @@ -13603,36 +13689,53 @@ var ts; // Classes function isClassElement(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 234 /* SyntaxKind.SemicolonClassElement */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 237 /* SyntaxKind.SemicolonClassElement */; } ts.isClassElement = isClassElement; function isClassLike(node) { - return node && (node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */); + return node && (node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */); } ts.isClassLike = isClassLike; function isAccessor(node) { - return node && (node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */); + return node && (node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */); } ts.isAccessor = isAccessor; + function isAutoAccessorPropertyDeclaration(node) { + return ts.isPropertyDeclaration(node) && ts.hasAccessorModifier(node); + } + ts.isAutoAccessorPropertyDeclaration = isAutoAccessorPropertyDeclaration; /* @internal */ function isMethodOrAccessor(node) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; default: return false; } } ts.isMethodOrAccessor = isMethodOrAccessor; + /* @internal */ + function isNamedClassElement(node) { + switch (node.kind) { + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + return true; + default: + return false; + } + } + ts.isNamedClassElement = isNamedClassElement; // Type members function isModifierLike(node) { return isModifier(node) || ts.isDecorator(node); @@ -13640,13 +13743,13 @@ var ts; ts.isModifierLike = isModifierLike; function isTypeElement(node) { var kind = node.kind; - return kind === 175 /* SyntaxKind.ConstructSignature */ - || kind === 174 /* SyntaxKind.CallSignature */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 177 /* SyntaxKind.ConstructSignature */ + || kind === 176 /* SyntaxKind.CallSignature */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.isTypeElement = isTypeElement; function isClassOrTypeElement(node) { @@ -13655,12 +13758,12 @@ var ts; ts.isClassOrTypeElement = isClassOrTypeElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 298 /* SyntaxKind.SpreadAssignment */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 301 /* SyntaxKind.SpreadAssignment */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; // Type @@ -13675,8 +13778,8 @@ var ts; ts.isTypeNode = isTypeNode; function isFunctionOrConstructorTypeNode(node) { switch (node.kind) { - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return true; } return false; @@ -13687,8 +13790,8 @@ var ts; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 202 /* SyntaxKind.ArrayBindingPattern */ - || kind === 201 /* SyntaxKind.ObjectBindingPattern */; + return kind === 204 /* SyntaxKind.ArrayBindingPattern */ + || kind === 203 /* SyntaxKind.ObjectBindingPattern */; } return false; } @@ -13696,15 +13799,15 @@ var ts; /* @internal */ function isAssignmentPattern(node) { var kind = node.kind; - return kind === 204 /* SyntaxKind.ArrayLiteralExpression */ - || kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return kind === 206 /* SyntaxKind.ArrayLiteralExpression */ + || kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isAssignmentPattern = isAssignmentPattern; /* @internal */ function isArrayBindingElement(node) { var kind = node.kind; - return kind === 203 /* SyntaxKind.BindingElement */ - || kind === 227 /* SyntaxKind.OmittedExpression */; + return kind === 205 /* SyntaxKind.BindingElement */ + || kind === 229 /* SyntaxKind.OmittedExpression */; } ts.isArrayBindingElement = isArrayBindingElement; /** @@ -13713,9 +13816,9 @@ var ts; /* @internal */ function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: return true; } return false; @@ -13736,8 +13839,8 @@ var ts; /* @internal */ function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return true; } return false; @@ -13746,10 +13849,10 @@ var ts; /* @internal */ function isObjectBindingOrAssignmentElement(node) { switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: // AssignmentProperty - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: // AssignmentProperty - case 298 /* SyntaxKind.SpreadAssignment */: // AssignmentRestProperty + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: // AssignmentProperty + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // AssignmentProperty + case 301 /* SyntaxKind.SpreadAssignment */: // AssignmentRestProperty return true; } return false; @@ -13761,8 +13864,8 @@ var ts; /* @internal */ function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return true; } return false; @@ -13771,26 +13874,26 @@ var ts; /* @internal */ function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) { var kind = node.kind; - return kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 161 /* SyntaxKind.QualifiedName */ - || kind === 200 /* SyntaxKind.ImportType */; + return kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 163 /* SyntaxKind.QualifiedName */ + || kind === 202 /* SyntaxKind.ImportType */; } ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode; // Expression function isPropertyAccessOrQualifiedName(node) { var kind = node.kind; - return kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 161 /* SyntaxKind.QualifiedName */; + return kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 163 /* SyntaxKind.QualifiedName */; } ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName; function isCallLikeExpression(node) { switch (node.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 165 /* SyntaxKind.Decorator */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 167 /* SyntaxKind.Decorator */: return true; default: return false; @@ -13798,12 +13901,12 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function isCallOrNewExpression(node) { - return node.kind === 208 /* SyntaxKind.CallExpression */ || node.kind === 209 /* SyntaxKind.NewExpression */; + return node.kind === 210 /* SyntaxKind.CallExpression */ || node.kind === 211 /* SyntaxKind.NewExpression */; } ts.isCallOrNewExpression = isCallOrNewExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 223 /* SyntaxKind.TemplateExpression */ + return kind === 225 /* SyntaxKind.TemplateExpression */ || kind === 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */; } ts.isTemplateLiteral = isTemplateLiteral; @@ -13814,19 +13917,19 @@ var ts; ts.isLeftHandSideExpression = isLeftHandSideExpression; function isLeftHandSideExpressionKind(kind) { switch (kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: // technically this is only an Expression if it's in a `#field in expr` BinaryExpression case 13 /* SyntaxKind.RegularExpressionLiteral */: @@ -13834,15 +13937,15 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 108 /* SyntaxKind.ThisKeyword */: case 110 /* SyntaxKind.TrueKeyword */: case 106 /* SyntaxKind.SuperKeyword */: - case 230 /* SyntaxKind.NonNullExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 231 /* SyntaxKind.MetaProperty */: + case 232 /* SyntaxKind.NonNullExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 233 /* SyntaxKind.MetaProperty */: case 100 /* SyntaxKind.ImportKeyword */: // technically this is only an Expression if it's in a CallExpression return true; default: @@ -13856,13 +13959,13 @@ var ts; ts.isUnaryExpression = isUnaryExpression; function isUnaryExpressionKind(kind) { switch (kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return true; default: return isLeftHandSideExpressionKind(kind); @@ -13871,9 +13974,9 @@ var ts; /* @internal */ function isUnaryExpressionWithWrite(expr) { switch (expr.kind) { - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return true; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 45 /* SyntaxKind.PlusPlusToken */ || expr.operator === 46 /* SyntaxKind.MinusMinusToken */; default: @@ -13892,15 +13995,16 @@ var ts; ts.isExpression = isExpression; function isExpressionKind(kind) { switch (kind) { - case 222 /* SyntaxKind.ConditionalExpression */: - case 224 /* SyntaxKind.YieldExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 221 /* SyntaxKind.BinaryExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 229 /* SyntaxKind.AsExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 351 /* SyntaxKind.CommaListExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 226 /* SyntaxKind.YieldExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 223 /* SyntaxKind.BinaryExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 231 /* SyntaxKind.AsExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 354 /* SyntaxKind.CommaListExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return true; default: return isUnaryExpressionKind(kind); @@ -13908,8 +14012,8 @@ var ts; } function isAssertionExpression(node) { var kind = node.kind; - return kind === 211 /* SyntaxKind.TypeAssertionExpression */ - || kind === 229 /* SyntaxKind.AsExpression */; + return kind === 213 /* SyntaxKind.TypeAssertionExpression */ + || kind === 231 /* SyntaxKind.AsExpression */; } ts.isAssertionExpression = isAssertionExpression; /* @internal */ @@ -13920,13 +14024,13 @@ var ts; ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return true; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -13955,7 +14059,7 @@ var ts; ts.isExternalModuleIndicator = isExternalModuleIndicator; /* @internal */ function isForInOrOfStatement(node) { - return node.kind === 243 /* SyntaxKind.ForInStatement */ || node.kind === 244 /* SyntaxKind.ForOfStatement */; + return node.kind === 246 /* SyntaxKind.ForInStatement */ || node.kind === 247 /* SyntaxKind.ForOfStatement */; } ts.isForInOrOfStatement = isForInOrOfStatement; // Element @@ -13979,115 +14083,115 @@ var ts; /* @internal */ function isModuleBody(node) { var kind = node.kind; - return kind === 262 /* SyntaxKind.ModuleBlock */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ + return kind === 265 /* SyntaxKind.ModuleBlock */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isModuleBody = isModuleBody; /* @internal */ function isNamespaceBody(node) { var kind = node.kind; - return kind === 262 /* SyntaxKind.ModuleBlock */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */; + return kind === 265 /* SyntaxKind.ModuleBlock */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isNamespaceBody = isNamespaceBody; /* @internal */ function isJSDocNamespaceBody(node) { var kind = node.kind; return kind === 79 /* SyntaxKind.Identifier */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */; + || kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isJSDocNamespaceBody = isJSDocNamespaceBody; /* @internal */ function isNamedImportBindings(node) { var kind = node.kind; - return kind === 269 /* SyntaxKind.NamedImports */ - || kind === 268 /* SyntaxKind.NamespaceImport */; + return kind === 272 /* SyntaxKind.NamedImports */ + || kind === 271 /* SyntaxKind.NamespaceImport */; } ts.isNamedImportBindings = isNamedImportBindings; /* @internal */ function isModuleOrEnumDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */ || node.kind === 260 /* SyntaxKind.EnumDeclaration */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */ || node.kind === 263 /* SyntaxKind.EnumDeclaration */; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 203 /* SyntaxKind.BindingElement */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 299 /* SyntaxKind.EnumMember */ - || kind === 275 /* SyntaxKind.ExportSpecifier */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 267 /* SyntaxKind.ImportClause */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 270 /* SyntaxKind.ImportSpecifier */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 285 /* SyntaxKind.JsxAttribute */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 268 /* SyntaxKind.NamespaceImport */ - || kind === 274 /* SyntaxKind.NamespaceExport */ - || kind === 164 /* SyntaxKind.Parameter */ - || kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 163 /* SyntaxKind.TypeParameter */ - || kind === 254 /* SyntaxKind.VariableDeclaration */ - || kind === 345 /* SyntaxKind.JSDocTypedefTag */ - || kind === 338 /* SyntaxKind.JSDocCallbackTag */ - || kind === 347 /* SyntaxKind.JSDocPropertyTag */; + return kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 205 /* SyntaxKind.BindingElement */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 302 /* SyntaxKind.EnumMember */ + || kind === 278 /* SyntaxKind.ExportSpecifier */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 270 /* SyntaxKind.ImportClause */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 273 /* SyntaxKind.ImportSpecifier */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 288 /* SyntaxKind.JsxAttribute */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 271 /* SyntaxKind.NamespaceImport */ + || kind === 277 /* SyntaxKind.NamespaceExport */ + || kind === 166 /* SyntaxKind.Parameter */ + || kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 165 /* SyntaxKind.TypeParameter */ + || kind === 257 /* SyntaxKind.VariableDeclaration */ + || kind === 348 /* SyntaxKind.JSDocTypedefTag */ + || kind === 341 /* SyntaxKind.JSDocCallbackTag */ + || kind === 350 /* SyntaxKind.JSDocPropertyTag */; } function isDeclarationStatementKind(kind) { - return kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 246 /* SyntaxKind.BreakStatement */ - || kind === 245 /* SyntaxKind.ContinueStatement */ - || kind === 253 /* SyntaxKind.DebuggerStatement */ - || kind === 240 /* SyntaxKind.DoStatement */ - || kind === 238 /* SyntaxKind.ExpressionStatement */ - || kind === 236 /* SyntaxKind.EmptyStatement */ - || kind === 243 /* SyntaxKind.ForInStatement */ - || kind === 244 /* SyntaxKind.ForOfStatement */ - || kind === 242 /* SyntaxKind.ForStatement */ - || kind === 239 /* SyntaxKind.IfStatement */ - || kind === 250 /* SyntaxKind.LabeledStatement */ - || kind === 247 /* SyntaxKind.ReturnStatement */ - || kind === 249 /* SyntaxKind.SwitchStatement */ - || kind === 251 /* SyntaxKind.ThrowStatement */ - || kind === 252 /* SyntaxKind.TryStatement */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 241 /* SyntaxKind.WhileStatement */ - || kind === 248 /* SyntaxKind.WithStatement */ - || kind === 349 /* SyntaxKind.NotEmittedStatement */ - || kind === 353 /* SyntaxKind.EndOfDeclarationMarker */ - || kind === 352 /* SyntaxKind.MergeDeclarationMarker */; + return kind === 249 /* SyntaxKind.BreakStatement */ + || kind === 248 /* SyntaxKind.ContinueStatement */ + || kind === 256 /* SyntaxKind.DebuggerStatement */ + || kind === 243 /* SyntaxKind.DoStatement */ + || kind === 241 /* SyntaxKind.ExpressionStatement */ + || kind === 239 /* SyntaxKind.EmptyStatement */ + || kind === 246 /* SyntaxKind.ForInStatement */ + || kind === 247 /* SyntaxKind.ForOfStatement */ + || kind === 245 /* SyntaxKind.ForStatement */ + || kind === 242 /* SyntaxKind.IfStatement */ + || kind === 253 /* SyntaxKind.LabeledStatement */ + || kind === 250 /* SyntaxKind.ReturnStatement */ + || kind === 252 /* SyntaxKind.SwitchStatement */ + || kind === 254 /* SyntaxKind.ThrowStatement */ + || kind === 255 /* SyntaxKind.TryStatement */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 244 /* SyntaxKind.WhileStatement */ + || kind === 251 /* SyntaxKind.WithStatement */ + || kind === 352 /* SyntaxKind.NotEmittedStatement */ + || kind === 356 /* SyntaxKind.EndOfDeclarationMarker */ + || kind === 355 /* SyntaxKind.MergeDeclarationMarker */; } /* @internal */ function isDeclaration(node) { - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { - return (node.parent && node.parent.kind !== 344 /* SyntaxKind.JSDocTemplateTag */) || ts.isInJSFile(node); + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { + return (node.parent && node.parent.kind !== 347 /* SyntaxKind.JSDocTemplateTag */) || ts.isInJSFile(node); } return isDeclarationKind(node.kind); } @@ -14114,10 +14218,10 @@ var ts; } ts.isStatement = isStatement; function isBlockStatement(node) { - if (node.kind !== 235 /* SyntaxKind.Block */) + if (node.kind !== 238 /* SyntaxKind.Block */) return false; if (node.parent !== undefined) { - if (node.parent.kind === 252 /* SyntaxKind.TryStatement */ || node.parent.kind === 292 /* SyntaxKind.CatchClause */) { + if (node.parent.kind === 255 /* SyntaxKind.TryStatement */ || node.parent.kind === 295 /* SyntaxKind.CatchClause */) { return false; } } @@ -14131,15 +14235,15 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 235 /* SyntaxKind.Block */; + || kind === 238 /* SyntaxKind.Block */; } ts.isStatementOrBlock = isStatementOrBlock; // Module references /* @internal */ function isModuleReference(node) { var kind = node.kind; - return kind === 277 /* SyntaxKind.ExternalModuleReference */ - || kind === 161 /* SyntaxKind.QualifiedName */ + return kind === 280 /* SyntaxKind.ExternalModuleReference */ + || kind === 163 /* SyntaxKind.QualifiedName */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isModuleReference = isModuleReference; @@ -14149,58 +14253,58 @@ var ts; var kind = node.kind; return kind === 108 /* SyntaxKind.ThisKeyword */ || kind === 79 /* SyntaxKind.Identifier */ - || kind === 206 /* SyntaxKind.PropertyAccessExpression */; + || kind === 208 /* SyntaxKind.PropertyAccessExpression */; } ts.isJsxTagNameExpression = isJsxTagNameExpression; /* @internal */ function isJsxChild(node) { var kind = node.kind; - return kind === 278 /* SyntaxKind.JsxElement */ - || kind === 288 /* SyntaxKind.JsxExpression */ - || kind === 279 /* SyntaxKind.JsxSelfClosingElement */ + return kind === 281 /* SyntaxKind.JsxElement */ + || kind === 291 /* SyntaxKind.JsxExpression */ + || kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || kind === 11 /* SyntaxKind.JsxText */ - || kind === 282 /* SyntaxKind.JsxFragment */; + || kind === 285 /* SyntaxKind.JsxFragment */; } ts.isJsxChild = isJsxChild; /* @internal */ function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 285 /* SyntaxKind.JsxAttribute */ - || kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return kind === 288 /* SyntaxKind.JsxAttribute */ + || kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } ts.isJsxAttributeLike = isJsxAttributeLike; /* @internal */ function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 10 /* SyntaxKind.StringLiteral */ - || kind === 288 /* SyntaxKind.JsxExpression */; + || kind === 291 /* SyntaxKind.JsxExpression */; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isJsxOpeningLikeElement(node) { var kind = node.kind; - return kind === 280 /* SyntaxKind.JsxOpeningElement */ - || kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return kind === 283 /* SyntaxKind.JsxOpeningElement */ + || kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; // Clauses function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 289 /* SyntaxKind.CaseClause */ - || kind === 290 /* SyntaxKind.DefaultClause */; + return kind === 292 /* SyntaxKind.CaseClause */ + || kind === 293 /* SyntaxKind.DefaultClause */; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; // JSDoc /** True if node is of some JSDoc syntax kind. */ /* @internal */ function isJSDocNode(node) { - return node.kind >= 309 /* SyntaxKind.FirstJSDocNode */ && node.kind <= 347 /* SyntaxKind.LastJSDocNode */; + return node.kind >= 312 /* SyntaxKind.FirstJSDocNode */ && node.kind <= 350 /* SyntaxKind.LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; /** True if node is of a kind that may contain comment text. */ function isJSDocCommentContainingNode(node) { - return node.kind === 320 /* SyntaxKind.JSDoc */ - || node.kind === 319 /* SyntaxKind.JSDocNamepathType */ - || node.kind === 321 /* SyntaxKind.JSDocText */ + return node.kind === 323 /* SyntaxKind.JSDoc */ + || node.kind === 322 /* SyntaxKind.JSDocNamepathType */ + || node.kind === 324 /* SyntaxKind.JSDocText */ || isJSDocLinkLike(node) || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) @@ -14210,15 +14314,15 @@ var ts; // TODO: determine what this does before making it public. /* @internal */ function isJSDocTag(node) { - return node.kind >= 327 /* SyntaxKind.FirstJSDocTagNode */ && node.kind <= 347 /* SyntaxKind.LastJSDocTagNode */; + return node.kind >= 330 /* SyntaxKind.FirstJSDocTagNode */ && node.kind <= 350 /* SyntaxKind.LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function isSetAccessor(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */; } ts.isSetAccessor = isSetAccessor; function isGetAccessor(node) { - return node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetAccessor = isGetAccessor; /** True if has jsdoc nodes attached to it. */ @@ -14244,12 +14348,12 @@ var ts; /** True if has initializer node attached to it. */ function hasOnlyExpressionInitializer(node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 299 /* SyntaxKind.EnumMember */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 302 /* SyntaxKind.EnumMember */: return true; default: return false; @@ -14257,12 +14361,12 @@ var ts; } ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer; function isObjectLiteralElement(node) { - return node.kind === 285 /* SyntaxKind.JsxAttribute */ || node.kind === 287 /* SyntaxKind.JsxSpreadAttribute */ || isObjectLiteralElementLike(node); + return node.kind === 288 /* SyntaxKind.JsxAttribute */ || node.kind === 290 /* SyntaxKind.JsxSpreadAttribute */ || isObjectLiteralElementLike(node); } ts.isObjectLiteralElement = isObjectLiteralElement; /* @internal */ function isTypeReferenceType(node) { - return node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } ts.isTypeReferenceType = isTypeReferenceType; var MAX_SMI_X86 = 1073741823; @@ -14295,7 +14399,7 @@ var ts; } ts.isStringLiteralLike = isStringLiteralLike; function isJSDocLinkLike(node) { - return node.kind === 324 /* SyntaxKind.JSDocLink */ || node.kind === 325 /* SyntaxKind.JSDocLinkCode */ || node.kind === 326 /* SyntaxKind.JSDocLinkPlain */; + return node.kind === 327 /* SyntaxKind.JSDocLink */ || node.kind === 328 /* SyntaxKind.JSDocLinkCode */ || node.kind === 329 /* SyntaxKind.JSDocLinkPlain */; } ts.isJSDocLinkLike = isJSDocLinkLike; function hasRestParameter(s) { @@ -14305,7 +14409,7 @@ var ts; ts.hasRestParameter = hasRestParameter; function isRestParameter(node) { var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type; - return node.dotDotDotToken !== undefined || !!type && type.kind === 318 /* SyntaxKind.JSDocVariadicType */; + return node.dotDotDotToken !== undefined || !!type && type.kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isRestParameter = isRestParameter; // #endregion @@ -14563,7 +14667,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 305 /* SyntaxKind.SourceFile */) { + while (node && node.kind !== 308 /* SyntaxKind.SourceFile */) { node = node.parent; } return node; @@ -14579,11 +14683,11 @@ var ts; ts.isPlainJsFile = isPlainJsFile; function isStatementWithLocals(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return true; } return false; @@ -14779,7 +14883,7 @@ var ts; // the syntax list itself considers them as normal trivia. Therefore if we simply skip // trivia for the list, we may have skipped the JSDocComment as well. So we should process its // first child to determine the actual position of its first token. - if (node.kind === 348 /* SyntaxKind.SyntaxList */ && node._children.length > 0) { + if (node.kind === 351 /* SyntaxKind.SyntaxList */ && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, @@ -14844,7 +14948,6 @@ var ts; return emitNode && emitNode.flags || 0; } ts.getEmitFlags = getEmitFlags; - ; function getScriptTargetFeatures() { return { es2015: { @@ -15017,7 +15120,7 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { @@ -15049,11 +15152,11 @@ var ts; ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { // The only kind of module that can be missing a body is a shorthand ambient module. - return !!node && node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && (!node.body); + return !!node && node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ || - node.kind === 261 /* SyntaxKind.ModuleDeclaration */ || + return node.kind === 308 /* SyntaxKind.SourceFile */ || + node.kind === 264 /* SyntaxKind.ModuleDeclaration */ || ts.isFunctionLikeOrClassStaticBlockDeclaration(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -15070,9 +15173,9 @@ var ts; // - defined in the top level scope and source file is an external module // - defined inside ambient module declaration located in the top level scope and source file not an external module switch (node.parent.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return ts.isExternalModule(node.parent); - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -15127,26 +15230,30 @@ var ts; return false; } ts.isEffectiveStrictModeSourceFile = isEffectiveStrictModeSourceFile; + function isAmbientPropertyDeclaration(node) { + return !!(node.flags & 16777216 /* NodeFlags.Ambient */) || hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */); + } + ts.isAmbientPropertyDeclaration = isAmbientPropertyDeclaration; function isBlockScope(node, parentNode) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 263 /* SyntaxKind.CaseBlock */: - case 292 /* SyntaxKind.CatchClause */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 266 /* SyntaxKind.CaseBlock */: + case 295 /* SyntaxKind.CatchClause */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block return !ts.isFunctionLikeOrClassStaticBlockDeclaration(parentNode); @@ -15156,9 +15263,9 @@ var ts; ts.isBlockScope = isBlockScope; function isDeclarationWithTypeParameters(node) { switch (node.kind) { - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 323 /* SyntaxKind.JSDocSignature */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 326 /* SyntaxKind.JSDocSignature */: return true; default: ts.assertType(node); @@ -15168,25 +15275,25 @@ var ts; ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters; function isDeclarationWithTypeParameterChildren(node) { switch (node.kind) { - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: ts.assertType(node); @@ -15196,8 +15303,8 @@ var ts; ts.isDeclarationWithTypeParameterChildren = isDeclarationWithTypeParameterChildren; function isAnyImportSyntax(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return true; default: return false; @@ -15210,15 +15317,15 @@ var ts; ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire; function isLateVisibilityPaintedStatement(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return true; default: return false; @@ -15259,19 +15366,19 @@ var ts; } ts.getNameFromIndexInfo = getNameFromIndexInfo; function isComputedNonLiteralName(name) { - return name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression); + return name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression); } ts.isComputedNonLiteralName = isComputedNonLiteralName; function tryGetTextOfPropertyName(name) { switch (name.kind) { case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: - return name.escapedText; + return name.autoGenerateFlags ? undefined : name.escapedText; case 10 /* SyntaxKind.StringLiteral */: case 8 /* SyntaxKind.NumericLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return ts.escapeLeadingUnderscores(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: if (isStringOrNumericLiteralLike(name.expression)) return ts.escapeLeadingUnderscores(name.expression.text); return undefined; @@ -15291,16 +15398,16 @@ var ts; case 80 /* SyntaxKind.PrivateIdentifier */: case 79 /* SyntaxKind.Identifier */: return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (ts.isIdentifier(name.name) || ts.isPrivateIdentifier(name.name)) { return entityNameToString(name.expression) + "." + entityNameToString(name.name); } else { return ts.Debug.assertNever(name.name); } - case 311 /* SyntaxKind.JSDocMemberName */: + case 314 /* SyntaxKind.JSDocMemberName */: return entityNameToString(name.left) + entityNameToString(name.right); default: return ts.Debug.assertNever(name); @@ -15390,7 +15497,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 235 /* SyntaxKind.Block */) { + if (node.body && node.body.kind === 238 /* SyntaxKind.Block */) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -15404,7 +15511,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file @@ -15413,29 +15520,29 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 268 /* SyntaxKind.NamespaceImport */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 271 /* SyntaxKind.NamespaceImport */: errorNode = node.name; break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return getErrorSpanForArrowFunction(sourceFile, node); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: var start = ts.skipTrivia(sourceFile.text, node.pos); var end = node.statements.length > 0 ? node.statements[0].pos : node.end; return ts.createTextSpanFromBounds(start, end); @@ -15487,11 +15594,11 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 208 /* SyntaxKind.CallExpression */ && n.expression.kind === 106 /* SyntaxKind.SuperKeyword */; + return n.kind === 210 /* SyntaxKind.CallExpression */ && n.expression.kind === 106 /* SyntaxKind.SuperKeyword */; } ts.isSuperCall = isSuperCall; function isImportCall(n) { - return n.kind === 208 /* SyntaxKind.CallExpression */ && n.expression.kind === 100 /* SyntaxKind.ImportKeyword */; + return n.kind === 210 /* SyntaxKind.CallExpression */ && n.expression.kind === 100 /* SyntaxKind.ImportKeyword */; } ts.isImportCall = isImportCall; function isImportMeta(n) { @@ -15505,7 +15612,7 @@ var ts; } ts.isLiteralImportTypeNode = isLiteralImportTypeNode; function isPrologueDirective(node) { - return node.kind === 238 /* SyntaxKind.ExpressionStatement */ + return node.kind === 241 /* SyntaxKind.ExpressionStatement */ && node.expression.kind === 10 /* SyntaxKind.StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; @@ -15533,13 +15640,13 @@ var ts; } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; function getJSDocCommentRanges(node, text) { - var commentRanges = (node.kind === 164 /* SyntaxKind.Parameter */ || - node.kind === 163 /* SyntaxKind.TypeParameter */ || - node.kind === 213 /* SyntaxKind.FunctionExpression */ || - node.kind === 214 /* SyntaxKind.ArrowFunction */ || - node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ || - node.kind === 254 /* SyntaxKind.VariableDeclaration */ || - node.kind === 275 /* SyntaxKind.ExportSpecifier */) ? + var commentRanges = (node.kind === 166 /* SyntaxKind.Parameter */ || + node.kind === 165 /* SyntaxKind.TypeParameter */ || + node.kind === 215 /* SyntaxKind.FunctionExpression */ || + node.kind === 216 /* SyntaxKind.ArrowFunction */ || + node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || + node.kind === 257 /* SyntaxKind.VariableDeclaration */ || + node.kind === 278 /* SyntaxKind.ExportSpecifier */) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : ts.getLeadingCommentRanges(text, node.pos); // True if the comment starts with '/**' but not if it is '/**/' @@ -15555,48 +15662,48 @@ var ts; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; var defaultLibReferenceRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (177 /* SyntaxKind.FirstTypeNode */ <= node.kind && node.kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (179 /* SyntaxKind.FirstTypeNode */ <= node.kind && node.kind <= 202 /* SyntaxKind.LastTypeNode */) { return true; } switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return true; case 114 /* SyntaxKind.VoidKeyword */: - return node.parent.kind !== 217 /* SyntaxKind.VoidExpression */; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + return node.parent.kind !== 219 /* SyntaxKind.VoidExpression */; + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node); - case 163 /* SyntaxKind.TypeParameter */: - return node.parent.kind === 195 /* SyntaxKind.MappedType */ || node.parent.kind === 190 /* SyntaxKind.InferType */; + case 165 /* SyntaxKind.TypeParameter */: + return node.parent.kind === 197 /* SyntaxKind.MappedType */ || node.parent.kind === 192 /* SyntaxKind.InferType */; // Identifiers and qualified names may be type nodes, depending on their context. Climb // above them to find the lowest container case 79 /* SyntaxKind.Identifier */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 161 /* SyntaxKind.QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 163 /* SyntaxKind.QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } // At this point, node is either a qualified name or an identifier - ts.Debug.assert(node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 161 /* SyntaxKind.QualifiedName */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + ts.Debug.assert(node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 163 /* SyntaxKind.QualifiedName */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); // falls through - case 161 /* SyntaxKind.QualifiedName */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: case 108 /* SyntaxKind.ThisKeyword */: { var parent = node.parent; - if (parent.kind === 181 /* SyntaxKind.TypeQuery */) { + if (parent.kind === 183 /* SyntaxKind.TypeQuery */) { return false; } - if (parent.kind === 200 /* SyntaxKind.ImportType */) { + if (parent.kind === 202 /* SyntaxKind.ImportType */) { return !parent.isTypeOf; } // Do not recursively call isPartOfTypeNode on the parent. In the example: @@ -15605,40 +15712,40 @@ var ts; // // Calling isPartOfTypeNode would consider the qualified name A.B a type node. // Only C and A.B.C are type nodes. - if (177 /* SyntaxKind.FirstTypeNode */ <= parent.kind && parent.kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (179 /* SyntaxKind.FirstTypeNode */ <= parent.kind && parent.kind <= 202 /* SyntaxKind.LastTypeNode */) { return true; } switch (parent.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isHeritageClause(parent.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(parent); - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return node === parent.constraint; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return node === parent.constraint; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 164 /* SyntaxKind.Parameter */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: return node === parent.type; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return node === parent.type; - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return node === parent.type; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return node === parent.type; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return ts.contains(parent.typeArguments, node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -15663,23 +15770,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitor(node); - case 263 /* SyntaxKind.CaseBlock */: - case 235 /* SyntaxKind.Block */: - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 250 /* SyntaxKind.LabeledStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 266 /* SyntaxKind.CaseBlock */: + case 238 /* SyntaxKind.Block */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 253 /* SyntaxKind.LabeledStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 295 /* SyntaxKind.CatchClause */: return ts.forEachChild(node, traverse); } } @@ -15689,23 +15796,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } return; - case 260 /* SyntaxKind.EnumDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // These are not allowed inside a generator now, but eventually they may be allowed // as local types. Regardless, skip them to avoid the work. return; default: if (ts.isFunctionLike(node)) { - if (node.name && node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name && node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // Note that we will not include methods/accessors of a class because they would require // first descending into the class. This is by design. traverse(node.name.expression); @@ -15728,10 +15835,10 @@ var ts; * @param node The type node. */ function getRestParameterElementType(node) { - if (node && node.kind === 183 /* SyntaxKind.ArrayType */) { + if (node && node.kind === 185 /* SyntaxKind.ArrayType */) { return node.elementType; } - else if (node && node.kind === 178 /* SyntaxKind.TypeReference */) { + else if (node && node.kind === 180 /* SyntaxKind.TypeReference */) { return ts.singleOrUndefined(node.typeArguments); } else { @@ -15741,12 +15848,12 @@ var ts; ts.getRestParameterElementType = getRestParameterElementType; function getMembersOfDeclaration(node) { switch (node.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 182 /* SyntaxKind.TypeLiteral */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 184 /* SyntaxKind.TypeLiteral */: return node.members; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return node.properties; } } @@ -15754,14 +15861,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 299 /* SyntaxKind.EnumMember */: - case 164 /* SyntaxKind.Parameter */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 302 /* SyntaxKind.EnumMember */: + case 166 /* SyntaxKind.Parameter */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; } } @@ -15773,8 +15880,8 @@ var ts; } ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor; function isVariableDeclarationInVariableStatement(node) { - return node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */ - && node.parent.parent.kind === 237 /* SyntaxKind.VariableStatement */; + return node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */ + && node.parent.parent.kind === 240 /* SyntaxKind.VariableStatement */; } ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement; function isCommonJsExportedExpression(node) { @@ -15798,13 +15905,13 @@ var ts; ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return true; } return false; @@ -15815,7 +15922,7 @@ var ts; if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 250 /* SyntaxKind.LabeledStatement */) { + if (node.statement.kind !== 253 /* SyntaxKind.LabeledStatement */) { return node.statement; } node = node.statement; @@ -15823,17 +15930,17 @@ var ts; } ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel; function isFunctionBlock(node) { - return node && node.kind === 235 /* SyntaxKind.Block */ && ts.isFunctionLike(node.parent); + return node && node.kind === 238 /* SyntaxKind.Block */ && ts.isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 169 /* SyntaxKind.MethodDeclaration */ && node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return node && node.kind === 171 /* SyntaxKind.MethodDeclaration */ && node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethodOrAccessor(node) { - return (node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */) && - (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || - node.parent.kind === 226 /* SyntaxKind.ClassExpression */); + return (node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */) && + (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || + node.parent.kind === 228 /* SyntaxKind.ClassExpression */); } ts.isObjectLiteralOrClassExpressionMethodOrAccessor = isObjectLiteralOrClassExpressionMethodOrAccessor; function isIdentifierTypePredicate(predicate) { @@ -15846,7 +15953,7 @@ var ts; ts.isThisTypePredicate = isThisTypePredicate; function getPropertyAssignment(objectLiteral, key, key2) { return objectLiteral.properties.filter(function (property) { - if (property.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (property.kind === 299 /* SyntaxKind.PropertyAssignment */) { var propName = tryGetTextOfPropertyName(property.name); return key === propName || (!!key2 && key2 === propName); } @@ -15908,14 +16015,14 @@ var ts; } ts.getContainingFunctionOrClassStaticBlock = getContainingFunctionOrClassStaticBlock; function getThisContainer(node, includeArrowFunctions) { - ts.Debug.assert(node.kind !== 305 /* SyntaxKind.SourceFile */); + ts.Debug.assert(node.kind !== 308 /* SyntaxKind.SourceFile */); while (true) { node = node.parent; if (!node) { return ts.Debug.fail(); // If we never pass in a SourceFile, this should be unreachable, since we'll stop when we reach that. } switch (node.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'this' container. // A computed property name in a class needs to be a this container @@ -15930,9 +16037,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 164 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { + if (node.parent.kind === 166 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -15943,27 +16050,27 @@ var ts; node = node.parent; } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: if (!includeArrowFunctions) { continue; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 305 /* SyntaxKind.SourceFile */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 308 /* SyntaxKind.SourceFile */: return node; } } @@ -15976,17 +16083,17 @@ var ts; switch (node.kind) { // Arrow functions use the same scope, but may do so in a "delayed" manner // For example, `const getThis = () => this` may be before a super() call in a derived constructor - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: switch (node.parent.kind) { - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Object properties can have computed names; only method-like bodies start a new scope return true; default: @@ -16010,9 +16117,9 @@ var ts; var container = getThisContainer(node, /*includeArrowFunctions*/ false); if (container) { switch (container.kind) { - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return container; } } @@ -16034,28 +16141,28 @@ var ts; return node; } switch (node.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: node = node.parent; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (!stopOnFunctions) { continue; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return node; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 164 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { + if (node.parent.kind === 166 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -16071,14 +16178,14 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 213 /* SyntaxKind.FunctionExpression */ || func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 215 /* SyntaxKind.FunctionExpression */ || func.kind === 216 /* SyntaxKind.ArrowFunction */) { var prev = func; var parent = func.parent; - while (parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { prev = parent; parent = parent.parent; } - if (parent.kind === 208 /* SyntaxKind.CallExpression */ && parent.expression === prev) { + if (parent.kind === 210 /* SyntaxKind.CallExpression */ && parent.expression === prev) { return parent; } } @@ -16094,7 +16201,7 @@ var ts; */ function isSuperProperty(node) { var kind = node.kind; - return (kind === 206 /* SyntaxKind.PropertyAccessExpression */ || kind === 207 /* SyntaxKind.ElementAccessExpression */) + return (kind === 208 /* SyntaxKind.PropertyAccessExpression */ || kind === 209 /* SyntaxKind.ElementAccessExpression */) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */; } ts.isSuperProperty = isSuperProperty; @@ -16103,7 +16210,7 @@ var ts; */ function isThisProperty(node) { var kind = node.kind; - return (kind === 206 /* SyntaxKind.PropertyAccessExpression */ || kind === 207 /* SyntaxKind.ElementAccessExpression */) + return (kind === 208 /* SyntaxKind.PropertyAccessExpression */ || kind === 209 /* SyntaxKind.ElementAccessExpression */) && node.expression.kind === 108 /* SyntaxKind.ThisKeyword */; } ts.isThisProperty = isThisProperty; @@ -16122,15 +16229,15 @@ var ts; ts.isThisInitializedObjectBindingExpression = isThisInitializedObjectBindingExpression; function getEntityNameFromTypeNode(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return isEntityNameExpression(node.expression) ? node.expression : undefined; // TODO(rbuckton): These aren't valid TypeNodes, but we treat them as such because of `isPartOfTypeNode`, which returns `true` for things that aren't `TypeNode`s. case 79 /* SyntaxKind.Identifier */: - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return node; } return undefined; @@ -16138,10 +16245,10 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { switch (node.kind) { - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return node.tag; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return node.tagName; default: return node.expression; @@ -16154,25 +16261,25 @@ var ts; return false; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // classes are valid targets return true; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return parent.kind === 257 /* SyntaxKind.ClassDeclaration */; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + return parent.kind === 260 /* SyntaxKind.ClassDeclaration */; + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. return node.body !== undefined - && parent.kind === 257 /* SyntaxKind.ClassDeclaration */; - case 164 /* SyntaxKind.Parameter */: + && parent.kind === 260 /* SyntaxKind.ClassDeclaration */; + case 166 /* SyntaxKind.Parameter */: // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; return parent.body !== undefined - && (parent.kind === 171 /* SyntaxKind.Constructor */ - || parent.kind === 169 /* SyntaxKind.MethodDeclaration */ - || parent.kind === 173 /* SyntaxKind.SetAccessor */) - && grandparent.kind === 257 /* SyntaxKind.ClassDeclaration */; + && (parent.kind === 173 /* SyntaxKind.Constructor */ + || parent.kind === 171 /* SyntaxKind.MethodDeclaration */ + || parent.kind === 175 /* SyntaxKind.SetAccessor */) + && grandparent.kind === 260 /* SyntaxKind.ClassDeclaration */; } return false; } @@ -16188,11 +16295,11 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node, parent) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return ts.some(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); }); // TODO: GH#18217 - case 169 /* SyntaxKind.MethodDeclaration */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: return ts.some(node.parameters, function (p) { return nodeIsDecorated(p, node, parent); }); // TODO: GH#18217 default: return false; @@ -16208,9 +16315,9 @@ var ts; ts.classOrConstructorParameterIsDecorated = classOrConstructorParameterIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 280 /* SyntaxKind.JsxOpeningElement */ || - parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */ || - parent.kind === 281 /* SyntaxKind.JsxClosingElement */) { + if (parent.kind === 283 /* SyntaxKind.JsxOpeningElement */ || + parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || + parent.kind === 284 /* SyntaxKind.JsxClosingElement */) { return parent.tagName === node; } return false; @@ -16223,53 +16330,54 @@ var ts; case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 229 /* SyntaxKind.AsExpression */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 221 /* SyntaxKind.BinaryExpression */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 223 /* SyntaxKind.TemplateExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: - case 224 /* SyntaxKind.YieldExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 231 /* SyntaxKind.MetaProperty */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 225 /* SyntaxKind.TemplateExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: + case 226 /* SyntaxKind.YieldExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 233 /* SyntaxKind.MetaProperty */: return true; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return !ts.isHeritageClause(node.parent); - case 161 /* SyntaxKind.QualifiedName */: - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + case 163 /* SyntaxKind.QualifiedName */: + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); - case 311 /* SyntaxKind.JSDocMemberName */: + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); + case 314 /* SyntaxKind.JSDocMemberName */: while (ts.isJSDocMemberName(node.parent)) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); case 80 /* SyntaxKind.PrivateIdentifier */: return ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 101 /* SyntaxKind.InKeyword */; case 79 /* SyntaxKind.Identifier */: - if (node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) { + if (node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) { return true; } // falls through @@ -16287,60 +16395,62 @@ var ts; function isInExpressionContext(node) { var parent = node.parent; switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 299 /* SyntaxKind.EnumMember */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 205 /* SyntaxKind.BindingElement */: return parent.initializer === node; - case 238 /* SyntaxKind.ExpressionStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 247 /* SyntaxKind.ReturnStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 289 /* SyntaxKind.CaseClause */: - case 251 /* SyntaxKind.ThrowStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 292 /* SyntaxKind.CaseClause */: + case 254 /* SyntaxKind.ThrowStatement */: return parent.expression === node; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) || forInStatement.expression === node; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return node === parent.expression; - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return node === parent.expression; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return node === parent.expression; - case 165 /* SyntaxKind.Decorator */: - case 288 /* SyntaxKind.JsxExpression */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 167 /* SyntaxKind.Decorator */: + case 291 /* SyntaxKind.JsxExpression */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + case 301 /* SyntaxKind.SpreadAssignment */: return true; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return parent.expression === node && !isPartOfTypeNode(parent); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return parent.objectAssignmentInitializer === node; + case 235 /* SyntaxKind.SatisfiesExpression */: + return node === parent.expression; default: return isExpressionNode(parent); } } ts.isInExpressionContext = isInExpressionContext; function isPartOfTypeQuery(node) { - while (node.kind === 161 /* SyntaxKind.QualifiedName */ || node.kind === 79 /* SyntaxKind.Identifier */) { + while (node.kind === 163 /* SyntaxKind.QualifiedName */ || node.kind === 79 /* SyntaxKind.Identifier */) { node = node.parent; } - return node.kind === 181 /* SyntaxKind.TypeQuery */; + return node.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isPartOfTypeQuery = isPartOfTypeQuery; function isNamespaceReexportDeclaration(node) { @@ -16348,7 +16458,7 @@ var ts; } ts.isNamespaceReexportDeclaration = isNamespaceReexportDeclaration; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -16361,7 +16471,7 @@ var ts; } ts.getExternalModuleRequireArgument = getExternalModuleRequireArgument; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind !== 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJS(file) { @@ -16393,11 +16503,11 @@ var ts; ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && node.typeArguments && node.typeArguments.length === 2 && - (node.typeArguments[0].kind === 150 /* SyntaxKind.StringKeyword */ || node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */); + (node.typeArguments[0].kind === 152 /* SyntaxKind.StringKeyword */ || node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */); } ts.isJSDocIndexSignature = isJSDocIndexSignature; function isRequireCall(callExpression, requireStringLiteralLikeArgument) { - if (callExpression.kind !== 208 /* SyntaxKind.CallExpression */) { + if (callExpression.kind !== 210 /* SyntaxKind.CallExpression */) { return false; } var _a = callExpression, expression = _a.expression, args = _a.arguments; @@ -16506,11 +16616,11 @@ var ts; function getExpandoInitializer(initializer, isPrototypeAssignment) { if (ts.isCallExpression(initializer)) { var e = skipParentheses(initializer.expression); - return e.kind === 213 /* SyntaxKind.FunctionExpression */ || e.kind === 214 /* SyntaxKind.ArrowFunction */ ? initializer : undefined; + return e.kind === 215 /* SyntaxKind.FunctionExpression */ || e.kind === 216 /* SyntaxKind.ArrowFunction */ ? initializer : undefined; } - if (initializer.kind === 213 /* SyntaxKind.FunctionExpression */ || - initializer.kind === 226 /* SyntaxKind.ClassExpression */ || - initializer.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (initializer.kind === 215 /* SyntaxKind.FunctionExpression */ || + initializer.kind === 228 /* SyntaxKind.ClassExpression */ || + initializer.kind === 216 /* SyntaxKind.ArrowFunction */) { return initializer; } if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) { @@ -16756,7 +16866,7 @@ var ts; ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment; function isSpecialPropertyDeclaration(expr) { return isInJSFile(expr) && - expr.parent && expr.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && + expr.parent && expr.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && (!ts.isElementAccessExpression(expr) || isLiteralLikeElementAccess(expr)) && !!ts.getJSDocTypeTag(expr.parent); } @@ -16777,17 +16887,17 @@ var ts; return false; } var decl = symbol.valueDeclaration; - return decl.kind === 256 /* SyntaxKind.FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); + return decl.kind === 259 /* SyntaxKind.FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); } ts.isFunctionSymbol = isFunctionSymbol; function tryGetModuleSpecifierFromDeclaration(node) { var _a, _b; switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return (_a = ts.findAncestor(node.initializer, function (node) { return isRequireCall(node, /*requireStringLiteralLikeArgument*/ true); })) === null || _a === void 0 ? void 0 : _a.arguments[0]; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike); default: ts.Debug.assertNever(node); @@ -16800,14 +16910,14 @@ var ts; ts.importFromModuleSpecifier = importFromModuleSpecifier; function tryGetImportFromModuleSpecifier(node) { switch (node.parent.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.parent; - case 277 /* SyntaxKind.ExternalModuleReference */: + case 280 /* SyntaxKind.ExternalModuleReference */: return node.parent.parent; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return isImportCall(node.parent) || isRequireCall(node.parent, /*checkArg*/ false) ? node.parent : undefined; - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: ts.Debug.assert(ts.isStringLiteral(node)); return ts.tryCast(node.parent.parent, ts.isImportTypeNode); default: @@ -16817,16 +16927,16 @@ var ts; ts.tryGetImportFromModuleSpecifier = tryGetImportFromModuleSpecifier; function getExternalModuleName(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.moduleSpecifier; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */ ? node.moduleReference.expression : undefined; - case 200 /* SyntaxKind.ImportType */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + return node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */ ? node.moduleReference.expression : undefined; + case 202 /* SyntaxKind.ImportType */: return isLiteralImportTypeNode(node) ? node.argument.literal : undefined; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return node.arguments[0]; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return node.name.kind === 10 /* SyntaxKind.StringLiteral */ ? node.name : undefined; default: return ts.Debug.assertNever(node); @@ -16835,11 +16945,11 @@ var ts; ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.exportClause && ts.tryCast(node.exportClause, ts.isNamespaceExport); default: return ts.Debug.assertNever(node); @@ -16847,7 +16957,7 @@ var ts; } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 266 /* SyntaxKind.ImportDeclaration */ && !!node.importClause && !!node.importClause.name; + return node.kind === 269 /* SyntaxKind.ImportDeclaration */ && !!node.importClause && !!node.importClause.name; } ts.isDefaultImport = isDefaultImport; function forEachImportClauseDeclaration(node, action) { @@ -16868,13 +16978,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 164 /* SyntaxKind.Parameter */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return node.questionToken !== undefined; } } @@ -16888,7 +16998,7 @@ var ts; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function isJSDocTypeAlias(node) { - return node.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || node.kind === 338 /* SyntaxKind.JSDocCallbackTag */ || node.kind === 339 /* SyntaxKind.JSDocEnumTag */; + return node.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || node.kind === 341 /* SyntaxKind.JSDocCallbackTag */ || node.kind === 342 /* SyntaxKind.JSDocEnumTag */; } ts.isJSDocTypeAlias = isJSDocTypeAlias; function isTypeAlias(node) { @@ -16913,12 +17023,12 @@ var ts; } function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: var v = getSingleVariableOfVariableStatement(node); return v && v.initializer; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return node.initializer; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return node.initializer; } } @@ -16930,7 +17040,7 @@ var ts; function getNestedModuleDeclaration(node) { return ts.isModuleDeclaration(node) && node.body && - node.body.kind === 261 /* SyntaxKind.ModuleDeclaration */ + node.body.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? node.body : undefined; } @@ -16945,11 +17055,11 @@ var ts; if (ts.hasJSDocNodes(node)) { result = ts.addRange(result, filterOwnedJSDocTags(hostNode, ts.last(node.jsDoc))); } - if (node.kind === 164 /* SyntaxKind.Parameter */) { + if (node.kind === 166 /* SyntaxKind.Parameter */) { result = ts.addRange(result, (noCache ? ts.getJSDocParameterTagsNoCache : ts.getJSDocParameterTags)(node)); break; } - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { result = ts.addRange(result, (noCache ? ts.getJSDocTypeParameterTagsNoCache : ts.getJSDocTypeParameterTags)(node)); break; } @@ -16978,11 +17088,11 @@ var ts; } function getNextJSDocCommentLocation(node) { var parent = node.parent; - if (parent.kind === 296 /* SyntaxKind.PropertyAssignment */ || - parent.kind === 271 /* SyntaxKind.ExportAssignment */ || - parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - parent.kind === 247 /* SyntaxKind.ReturnStatement */ || + if (parent.kind === 299 /* SyntaxKind.PropertyAssignment */ || + parent.kind === 274 /* SyntaxKind.ExportAssignment */ || + parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + parent.kind === 250 /* SyntaxKind.ReturnStatement */ || getNestedModuleDeclaration(parent) || ts.isBinaryExpression(node) && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { return parent; @@ -17092,34 +17202,34 @@ var ts; var parent = node.parent; while (true) { switch (parent.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 63 /* SyntaxKind.EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* AssignmentKind.Definite */ : 2 /* AssignmentKind.Compound */ : 0 /* AssignmentKind.None */; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: var unaryOperator = parent.operator; return unaryOperator === 45 /* SyntaxKind.PlusPlusToken */ || unaryOperator === 46 /* SyntaxKind.MinusMinusToken */ ? 2 /* AssignmentKind.Compound */ : 0 /* AssignmentKind.None */; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return parent.initializer === node ? 1 /* AssignmentKind.Definite */ : 0 /* AssignmentKind.None */; - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 232 /* SyntaxKind.NonNullExpression */: node = parent; break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: node = parent.parent; break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: if (parent.name !== node) { return 0 /* AssignmentKind.None */; } node = parent.parent; break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (parent.name === node) { return 0 /* AssignmentKind.None */; } @@ -17146,22 +17256,22 @@ var ts; */ function isNodeWithPossibleHoistedDeclaration(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 237 /* SyntaxKind.VariableStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 263 /* SyntaxKind.CaseBlock */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 250 /* SyntaxKind.LabeledStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 238 /* SyntaxKind.Block */: + case 240 /* SyntaxKind.VariableStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 266 /* SyntaxKind.CaseBlock */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 253 /* SyntaxKind.LabeledStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 295 /* SyntaxKind.CatchClause */: return true; } return false; @@ -17178,11 +17288,11 @@ var ts; return node; } function walkUpParenthesizedTypes(node) { - return walkUp(node, 191 /* SyntaxKind.ParenthesizedType */); + return walkUp(node, 193 /* SyntaxKind.ParenthesizedType */); } ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes; function walkUpParenthesizedExpressions(node) { - return walkUp(node, 212 /* SyntaxKind.ParenthesizedExpression */); + return walkUp(node, 214 /* SyntaxKind.ParenthesizedExpression */); } ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions; /** @@ -17192,7 +17302,7 @@ var ts; */ function walkUpParenthesizedTypesAndGetParentAndChild(node) { var child; - while (node && node.kind === 191 /* SyntaxKind.ParenthesizedType */) { + while (node && node.kind === 193 /* SyntaxKind.ParenthesizedType */) { child = node; node = node.parent; } @@ -17214,11 +17324,11 @@ var ts; ts.skipParentheses = skipParentheses; // a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped function isDeleteTarget(node) { - if (node.kind !== 206 /* SyntaxKind.PropertyAccessExpression */ && node.kind !== 207 /* SyntaxKind.ElementAccessExpression */) { + if (node.kind !== 208 /* SyntaxKind.PropertyAccessExpression */ && node.kind !== 209 /* SyntaxKind.ElementAccessExpression */) { return false; } node = walkUpParenthesizedExpressions(node.parent); - return node && node.kind === 215 /* SyntaxKind.DeleteExpression */; + return node && node.kind === 217 /* SyntaxKind.DeleteExpression */; } ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { @@ -17271,7 +17381,7 @@ var ts; ts.getDeclarationFromName = getDeclarationFromName; function isLiteralComputedPropertyDeclarationName(node) { return isStringOrNumericLiteralLike(node) && - node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */ && + node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */ && ts.isDeclaration(node.parent.parent); } ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; @@ -17279,29 +17389,29 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 299 /* SyntaxKind.EnumMember */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 302 /* SyntaxKind.EnumMember */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: // Name on right hand side of dot in a type query or type reference return parent.right === node; - case 203 /* SyntaxKind.BindingElement */: - case 270 /* SyntaxKind.ImportSpecifier */: + case 205 /* SyntaxKind.BindingElement */: + case 273 /* SyntaxKind.ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 275 /* SyntaxKind.ExportSpecifier */: - case 285 /* SyntaxKind.JsxAttribute */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 288 /* SyntaxKind.JsxAttribute */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: // Any name in an export specifier or JSX Attribute or Jsx Element return true; } @@ -17324,14 +17434,14 @@ var ts; // const x = require("...").y // const { x } = require("...").y function isAliasSymbolDeclaration(node) { - if (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ || - node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ || - node.kind === 267 /* SyntaxKind.ImportClause */ && !!node.name || - node.kind === 268 /* SyntaxKind.NamespaceImport */ || - node.kind === 274 /* SyntaxKind.NamespaceExport */ || - node.kind === 270 /* SyntaxKind.ImportSpecifier */ || - node.kind === 275 /* SyntaxKind.ExportSpecifier */ || - node.kind === 271 /* SyntaxKind.ExportAssignment */ && exportAssignmentIsAlias(node)) { + if (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ || + node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ || + node.kind === 270 /* SyntaxKind.ImportClause */ && !!node.name || + node.kind === 271 /* SyntaxKind.NamespaceImport */ || + node.kind === 277 /* SyntaxKind.NamespaceExport */ || + node.kind === 273 /* SyntaxKind.ImportSpecifier */ || + node.kind === 278 /* SyntaxKind.ExportSpecifier */ || + node.kind === 274 /* SyntaxKind.ExportAssignment */ && exportAssignmentIsAlias(node)) { return true; } return isInJSFile(node) && (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */ && exportAssignmentIsAlias(node) || @@ -17344,18 +17454,18 @@ var ts; ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getAliasDeclarationFromName(node) { switch (node.parent.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 271 /* SyntaxKind.ExportAssignment */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 274 /* SyntaxKind.NamespaceExport */: + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 274 /* SyntaxKind.ExportAssignment */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 277 /* SyntaxKind.NamespaceExport */: return node.parent; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.parent; - } while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */); + } while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */); return getAliasDeclarationFromName(node); } } @@ -17374,7 +17484,7 @@ var ts; } ts.getExportAssignmentExpression = getExportAssignmentExpression; function getPropertyAssignmentAliasLikeExpression(node) { - return node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? node.name : node.kind === 296 /* SyntaxKind.PropertyAssignment */ ? node.initializer : + return node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? node.name : node.kind === 299 /* SyntaxKind.PropertyAssignment */ ? node.initializer : node.parent.right; } ts.getPropertyAssignmentAliasLikeExpression = getPropertyAssignmentAliasLikeExpression; @@ -17440,11 +17550,11 @@ var ts; } ts.getAncestor = getAncestor; function isKeyword(token) { - return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 160 /* SyntaxKind.LastKeyword */; + return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 162 /* SyntaxKind.LastKeyword */; } ts.isKeyword = isKeyword; function isContextualKeyword(token) { - return 126 /* SyntaxKind.FirstContextualKeyword */ <= token && token <= 160 /* SyntaxKind.LastContextualKeyword */; + return 126 /* SyntaxKind.FirstContextualKeyword */ <= token && token <= 162 /* SyntaxKind.LastContextualKeyword */; } ts.isContextualKeyword = isContextualKeyword; function isNonContextualKeyword(token) { @@ -17488,15 +17598,15 @@ var ts; } var flags = 0 /* FunctionFlags.Normal */; switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: if (node.asteriskToken) { flags |= 1 /* FunctionFlags.Generator */; } // falls through - case 214 /* SyntaxKind.ArrowFunction */: - if (hasSyntacticModifier(node, 256 /* ModifierFlags.Async */)) { + case 216 /* SyntaxKind.ArrowFunction */: + if (hasSyntacticModifier(node, 512 /* ModifierFlags.Async */)) { flags |= 2 /* FunctionFlags.Async */; } break; @@ -17509,13 +17619,13 @@ var ts; ts.getFunctionFlags = getFunctionFlags; function isAsyncFunction(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: return node.body !== undefined && node.asteriskToken === undefined - && hasSyntacticModifier(node, 256 /* ModifierFlags.Async */); + && hasSyntacticModifier(node, 512 /* ModifierFlags.Async */); } return false; } @@ -17542,7 +17652,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - if (!(name.kind === 162 /* SyntaxKind.ComputedPropertyName */ || name.kind === 207 /* SyntaxKind.ElementAccessExpression */)) { + if (!(name.kind === 164 /* SyntaxKind.ComputedPropertyName */ || name.kind === 209 /* SyntaxKind.ElementAccessExpression */)) { return false; } var expr = ts.isElementAccessExpression(name) ? skipParentheses(name.argumentExpression) : name.expression; @@ -17558,7 +17668,7 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 8 /* SyntaxKind.NumericLiteral */: return ts.escapeLeadingUnderscores(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: var nameExpression = name.expression; if (isStringOrNumericLiteralLike(nameExpression)) { return ts.escapeLeadingUnderscores(nameExpression.text); @@ -17624,11 +17734,11 @@ var ts; ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 164 /* SyntaxKind.Parameter */; + return root.kind === 166 /* SyntaxKind.Parameter */; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 203 /* SyntaxKind.BindingElement */) { + while (node.kind === 205 /* SyntaxKind.BindingElement */) { node = node.parent.parent; } return node; @@ -17636,15 +17746,15 @@ var ts; ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 305 /* SyntaxKind.SourceFile */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 308 /* SyntaxKind.SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(range) { @@ -17663,23 +17773,23 @@ var ts; })(Associativity = ts.Associativity || (ts.Associativity = {})); function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 209 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 211 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return hasArguments ? 0 /* Associativity.Left */ : 1 /* Associativity.Right */; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 224 /* SyntaxKind.YieldExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 226 /* SyntaxKind.YieldExpression */: return 1 /* Associativity.Right */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (operator) { case 42 /* SyntaxKind.AsteriskAsteriskToken */: case 63 /* SyntaxKind.EqualsToken */: @@ -17706,15 +17816,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 209 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 211 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (expression.kind === 223 /* SyntaxKind.BinaryExpression */) { return expression.operatorToken.kind; } - else if (expression.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || expression.kind === 220 /* SyntaxKind.PostfixUnaryExpression */) { + else if (expression.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || expression.kind === 222 /* SyntaxKind.PostfixUnaryExpression */) { return expression.operator; } else { @@ -17893,15 +18003,15 @@ var ts; })(OperatorPrecedence = ts.OperatorPrecedence || (ts.OperatorPrecedence = {})); function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { switch (nodeKind) { - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return 0 /* OperatorPrecedence.Comma */; - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return 1 /* OperatorPrecedence.Spread */; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return 2 /* OperatorPrecedence.Yield */; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return 4 /* OperatorPrecedence.Conditional */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (operatorKind) { case 27 /* SyntaxKind.CommaToken */: return 0 /* OperatorPrecedence.Comma */; @@ -17926,26 +18036,27 @@ var ts; return getBinaryOperatorPrecedence(operatorKind); } // TODO: Should prefix `++` and `--` be moved to the `Update` precedence? - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 218 /* SyntaxKind.AwaitExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return 16 /* OperatorPrecedence.Unary */; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return 17 /* OperatorPrecedence.Update */; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return 18 /* OperatorPrecedence.LeftHandSide */; - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return hasArguments ? 19 /* OperatorPrecedence.Member */ : 18 /* OperatorPrecedence.LeftHandSide */; - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 231 /* SyntaxKind.MetaProperty */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 233 /* SyntaxKind.MetaProperty */: return 19 /* OperatorPrecedence.Member */; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return 11 /* OperatorPrecedence.Relational */; case 108 /* SyntaxKind.ThisKeyword */: case 106 /* SyntaxKind.SuperKeyword */: @@ -17957,19 +18068,19 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 226 /* SyntaxKind.ClassExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: case 13 /* SyntaxKind.RegularExpressionLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 225 /* SyntaxKind.TemplateExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: return 20 /* OperatorPrecedence.Primary */; default: return -1 /* OperatorPrecedence.Invalid */; @@ -18001,7 +18112,8 @@ var ts; case 33 /* SyntaxKind.GreaterThanEqualsToken */: case 102 /* SyntaxKind.InstanceOfKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: + case 150 /* SyntaxKind.SatisfiesKeyword */: return 11 /* OperatorPrecedence.Relational */; case 47 /* SyntaxKind.LessThanLessThanToken */: case 48 /* SyntaxKind.GreaterThanGreaterThanToken */: @@ -18025,7 +18137,7 @@ var ts; function getSemanticJsxChildren(children) { return ts.filter(children, function (i) { switch (i.kind) { - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return !!i.expression; case 11 /* SyntaxKind.JsxText */: return !i.containsOnlyTriviaWhiteSpaces; @@ -18081,7 +18193,7 @@ var ts; } diagnostics = nonFileDiagnostics; } - ts.insertSorted(diagnostics, diagnostic, compareDiagnostics); + ts.insertSorted(diagnostics, diagnostic, compareDiagnosticsSkipRelatedInformation); } function getGlobalDiagnostics() { hasReadNonFileDiagnostics = true; @@ -18617,7 +18729,7 @@ var ts; while (ts.isQualifiedName(node.parent) && node.parent.left === node) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */; + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isThisInTypeQuery = isThisInTypeQuery; function identifierIsThisKeyword(id) { @@ -18632,10 +18744,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 172 /* SyntaxKind.GetAccessor */) { + if (accessor.kind === 174 /* SyntaxKind.GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (accessor.kind === 175 /* SyntaxKind.SetAccessor */) { setAccessor = accessor; } else { @@ -18655,10 +18767,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 172 /* SyntaxKind.GetAccessor */ && !getAccessor) { + if (member.kind === 174 /* SyntaxKind.GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 173 /* SyntaxKind.SetAccessor */ && !setAccessor) { + if (member.kind === 175 /* SyntaxKind.SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -18707,7 +18819,7 @@ var ts; ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations; /** template tags are only available when a typedef isn't already using them */ function isNonTypeAliasTemplate(tag) { - return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 320 /* SyntaxKind.JSDoc */ && tag.parent.tags.some(isJSDocTypeAlias)); + return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 323 /* SyntaxKind.JSDoc */ && tag.parent.tags.some(isJSDocTypeAlias)); } /** * Gets the effective type annotation of the value parameter of a set accessor. If the node @@ -18940,13 +19052,17 @@ var ts; } ts.hasOverrideModifier = hasOverrideModifier; function hasAbstractModifier(node) { - return hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */); + return hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */); } ts.hasAbstractModifier = hasAbstractModifier; function hasAmbientModifier(node) { return hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */); } ts.hasAmbientModifier = hasAmbientModifier; + function hasAccessorModifier(node) { + return hasSyntacticModifier(node, 128 /* ModifierFlags.Accessor */); + } + ts.hasAccessorModifier = hasAccessorModifier; function hasEffectiveReadonlyModifier(node) { return hasEffectiveModifier(node, 64 /* ModifierFlags.Readonly */); } @@ -18964,7 +19080,7 @@ var ts; } ts.getSelectedSyntacticModifierFlags = getSelectedSyntacticModifierFlags; function getModifierFlagsWorker(node, includeJSDoc, alwaysIncludeJSDoc) { - if (node.kind >= 0 /* SyntaxKind.FirstToken */ && node.kind <= 160 /* SyntaxKind.LastToken */) { + if (node.kind >= 0 /* SyntaxKind.FirstToken */ && node.kind <= 162 /* SyntaxKind.LastToken */) { return 0 /* ModifierFlags.None */; } if (!(node.modifierFlagsCache & 536870912 /* ModifierFlags.HasComputedFlags */)) { @@ -19056,25 +19172,22 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: return 4 /* ModifierFlags.Public */; case 122 /* SyntaxKind.ProtectedKeyword */: return 16 /* ModifierFlags.Protected */; case 121 /* SyntaxKind.PrivateKeyword */: return 8 /* ModifierFlags.Private */; - case 126 /* SyntaxKind.AbstractKeyword */: return 128 /* ModifierFlags.Abstract */; + case 126 /* SyntaxKind.AbstractKeyword */: return 256 /* ModifierFlags.Abstract */; + case 127 /* SyntaxKind.AccessorKeyword */: return 128 /* ModifierFlags.Accessor */; case 93 /* SyntaxKind.ExportKeyword */: return 1 /* ModifierFlags.Export */; - case 135 /* SyntaxKind.DeclareKeyword */: return 2 /* ModifierFlags.Ambient */; + case 136 /* SyntaxKind.DeclareKeyword */: return 2 /* ModifierFlags.Ambient */; case 85 /* SyntaxKind.ConstKeyword */: return 2048 /* ModifierFlags.Const */; - case 88 /* SyntaxKind.DefaultKeyword */: return 512 /* ModifierFlags.Default */; - case 131 /* SyntaxKind.AsyncKeyword */: return 256 /* ModifierFlags.Async */; - case 145 /* SyntaxKind.ReadonlyKeyword */: return 64 /* ModifierFlags.Readonly */; - case 159 /* SyntaxKind.OverrideKeyword */: return 16384 /* ModifierFlags.Override */; + case 88 /* SyntaxKind.DefaultKeyword */: return 1024 /* ModifierFlags.Default */; + case 132 /* SyntaxKind.AsyncKeyword */: return 512 /* ModifierFlags.Async */; + case 146 /* SyntaxKind.ReadonlyKeyword */: return 64 /* ModifierFlags.Readonly */; + case 161 /* SyntaxKind.OverrideKeyword */: return 16384 /* ModifierFlags.Override */; case 101 /* SyntaxKind.InKeyword */: return 32768 /* ModifierFlags.In */; - case 144 /* SyntaxKind.OutKeyword */: return 65536 /* ModifierFlags.Out */; - case 165 /* SyntaxKind.Decorator */: return 131072 /* ModifierFlags.Decorator */; + case 145 /* SyntaxKind.OutKeyword */: return 65536 /* ModifierFlags.Out */; + case 167 /* SyntaxKind.Decorator */: return 131072 /* ModifierFlags.Decorator */; } return 0 /* ModifierFlags.None */; } ts.modifierToFlag = modifierToFlag; - function createModifiers(modifierFlags) { - return modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; - } - ts.createModifiers = createModifiers; function isLogicalOperator(token) { return token === 56 /* SyntaxKind.BarBarToken */ || token === 55 /* SyntaxKind.AmpersandAmpersandToken */ @@ -19124,8 +19237,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { var kind = node.left.kind; - return kind === 205 /* SyntaxKind.ObjectLiteralExpression */ - || kind === 204 /* SyntaxKind.ArrayLiteralExpression */; + return kind === 207 /* SyntaxKind.ObjectLiteralExpression */ + || kind === 206 /* SyntaxKind.ArrayLiteralExpression */; } return false; } @@ -19142,12 +19255,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.left; } while (node.kind !== 79 /* SyntaxKind.Identifier */); return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: do { node = node.expression; } while (node.kind !== 79 /* SyntaxKind.Identifier */); @@ -19159,9 +19272,9 @@ var ts; return node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 108 /* SyntaxKind.ThisKeyword */ || node.kind === 106 /* SyntaxKind.SuperKeyword */ - || node.kind === 231 /* SyntaxKind.MetaProperty */ - || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && isDottedName(node.expression) - || node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ && isDottedName(node.expression); + || node.kind === 233 /* SyntaxKind.MetaProperty */ + || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isDottedName(node.expression) + || node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ && isDottedName(node.expression); } ts.isDottedName = isDottedName; function isPropertyAccessEntityNameExpression(node) { @@ -19192,8 +19305,8 @@ var ts; } ts.isPrototypeAccess = isPrototypeAccess; function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 161 /* SyntaxKind.QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 163 /* SyntaxKind.QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isRightSideOfAccessExpression(node) { @@ -19208,12 +19321,12 @@ var ts; } ts.isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName = isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName; function isEmptyObjectLiteral(expression) { - return expression.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + return expression.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && expression.properties.length === 0; } ts.isEmptyObjectLiteral = isEmptyObjectLiteral; function isEmptyArrayLiteral(expression) { - return expression.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && + return expression.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && expression.elements.length === 0; } ts.isEmptyArrayLiteral = isEmptyArrayLiteral; @@ -19229,7 +19342,7 @@ var ts; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; function isExportDefaultSymbol(symbol) { - return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 512 /* ModifierFlags.Default */); + return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 1024 /* ModifierFlags.Default */); } /** Return ".ts", ".d.ts", or ".tsx", if that is the extension. */ function tryExtractTSExtension(fileName) { @@ -19374,21 +19487,17 @@ var ts; return getStringFromExpandedCharCodes(expandedCharCodes); } ts.base64decode = base64decode; + function readJsonOrUndefined(path, hostOrText) { + var jsonText = ts.isString(hostOrText) ? hostOrText : hostOrText.readFile(path); + if (!jsonText) + return undefined; + // gracefully handle if readFile fails or returns not JSON + var result = ts.parseConfigFileTextToJson(path, jsonText); + return !result.error ? result.config : undefined; + } + ts.readJsonOrUndefined = readJsonOrUndefined; function readJson(path, host) { - try { - var jsonText = host.readFile(path); - if (!jsonText) - return {}; - var result = ts.parseConfigFileTextToJson(path, jsonText); - if (result.error) { - return {}; - } - return result.config; - } - catch (e) { - // gracefully handle if readFile fails or returns not JSON - return {}; - } + return readJsonOrUndefined(path, host) || {}; } ts.readJson = readJson; function directoryProbablyExists(directoryName, host) { @@ -19547,8 +19656,8 @@ var ts; var parseNode = ts.getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return parseNode === parseNode.parent.name; } } @@ -19564,7 +19673,7 @@ var ts; } function isWatchSet(options) { // Firefox has Object.prototype.watch - return options.watch && options.hasOwnProperty("watch"); + return options.watch && ts.hasProperty(options, "watch"); } ts.isWatchSet = isWatchSet; function closeFileWatcher(watcher) { @@ -19628,35 +19737,35 @@ var ts; if (!parent) return 0 /* AccessKind.Read */; switch (parent.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return accessKind(parent); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var operator = parent.operator; return operator === 45 /* SyntaxKind.PlusPlusToken */ || operator === 46 /* SyntaxKind.MinusMinusToken */ ? writeOrReadWrite() : 0 /* AccessKind.Read */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var _a = parent, left = _a.left, operatorToken = _a.operatorToken; return left === node && isAssignmentOperator(operatorToken.kind) ? operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ ? 1 /* AccessKind.Write */ : writeOrReadWrite() : 0 /* AccessKind.Read */; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return parent.name !== node ? 0 /* AccessKind.Read */ : accessKind(parent); - case 296 /* SyntaxKind.PropertyAssignment */: { + case 299 /* SyntaxKind.PropertyAssignment */: { var parentAccess = accessKind(parent.parent); // In `({ x: varname }) = { x: 1 }`, the left `x` is a read, the right `x` is a write. return node === parent.name ? reverseAccessKind(parentAccess) : parentAccess; } - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // Assume it's the local variable being accessed, since we don't check public properties for --noUnusedLocals. return node === parent.objectAssignmentInitializer ? 0 /* AccessKind.Read */ : accessKind(parent.parent); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return accessKind(parent); default: return 0 /* AccessKind.Read */; } function writeOrReadWrite() { // If grandparent is not an ExpressionStatement, this is used as an expression in addition to having a side effect. - return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 238 /* SyntaxKind.ExpressionStatement */ ? 1 /* AccessKind.Write */ : 2 /* AccessKind.ReadWrite */; + return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 241 /* SyntaxKind.ExpressionStatement */ ? 1 /* AccessKind.Write */ : 2 /* AccessKind.ReadWrite */; } } function reverseAccessKind(a) { @@ -19738,7 +19847,7 @@ var ts; function isAbstractConstructorSymbol(symbol) { if (symbol.flags & 32 /* SymbolFlags.Class */) { var declaration = getClassLikeDeclarationOfSymbol(symbol); - return !!declaration && hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */); + return !!declaration && hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */); } return false; } @@ -19800,37 +19909,37 @@ var ts; } ts.isObjectTypeDeclaration = isObjectTypeDeclaration; function isTypeNodeKind(kind) { - return (kind >= 177 /* SyntaxKind.FirstTypeNode */ && kind <= 200 /* SyntaxKind.LastTypeNode */) - || kind === 130 /* SyntaxKind.AnyKeyword */ - || kind === 155 /* SyntaxKind.UnknownKeyword */ - || kind === 147 /* SyntaxKind.NumberKeyword */ - || kind === 158 /* SyntaxKind.BigIntKeyword */ - || kind === 148 /* SyntaxKind.ObjectKeyword */ - || kind === 133 /* SyntaxKind.BooleanKeyword */ - || kind === 150 /* SyntaxKind.StringKeyword */ - || kind === 151 /* SyntaxKind.SymbolKeyword */ + return (kind >= 179 /* SyntaxKind.FirstTypeNode */ && kind <= 202 /* SyntaxKind.LastTypeNode */) + || kind === 131 /* SyntaxKind.AnyKeyword */ + || kind === 157 /* SyntaxKind.UnknownKeyword */ + || kind === 148 /* SyntaxKind.NumberKeyword */ + || kind === 160 /* SyntaxKind.BigIntKeyword */ + || kind === 149 /* SyntaxKind.ObjectKeyword */ + || kind === 134 /* SyntaxKind.BooleanKeyword */ + || kind === 152 /* SyntaxKind.StringKeyword */ + || kind === 153 /* SyntaxKind.SymbolKeyword */ || kind === 114 /* SyntaxKind.VoidKeyword */ - || kind === 153 /* SyntaxKind.UndefinedKeyword */ - || kind === 143 /* SyntaxKind.NeverKeyword */ - || kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ - || kind === 312 /* SyntaxKind.JSDocAllType */ - || kind === 313 /* SyntaxKind.JSDocUnknownType */ - || kind === 314 /* SyntaxKind.JSDocNullableType */ - || kind === 315 /* SyntaxKind.JSDocNonNullableType */ - || kind === 316 /* SyntaxKind.JSDocOptionalType */ - || kind === 317 /* SyntaxKind.JSDocFunctionType */ - || kind === 318 /* SyntaxKind.JSDocVariadicType */; + || kind === 155 /* SyntaxKind.UndefinedKeyword */ + || kind === 144 /* SyntaxKind.NeverKeyword */ + || kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ + || kind === 315 /* SyntaxKind.JSDocAllType */ + || kind === 316 /* SyntaxKind.JSDocUnknownType */ + || kind === 317 /* SyntaxKind.JSDocNullableType */ + || kind === 318 /* SyntaxKind.JSDocNonNullableType */ + || kind === 319 /* SyntaxKind.JSDocOptionalType */ + || kind === 320 /* SyntaxKind.JSDocFunctionType */ + || kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isTypeNodeKind = isTypeNodeKind; function isAccessExpression(node) { - return node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 207 /* SyntaxKind.ElementAccessExpression */; + return node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 209 /* SyntaxKind.ElementAccessExpression */; } ts.isAccessExpression = isAccessExpression; function getNameOfAccessExpression(node) { - if (node.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { return node.name; } - ts.Debug.assert(node.kind === 207 /* SyntaxKind.ElementAccessExpression */); + ts.Debug.assert(node.kind === 209 /* SyntaxKind.ElementAccessExpression */); return node.argumentExpression; } ts.getNameOfAccessExpression = getNameOfAccessExpression; @@ -19845,7 +19954,7 @@ var ts; } ts.isBundleFileTextLike = isBundleFileTextLike; function isNamedImportsOrExports(node) { - return node.kind === 269 /* SyntaxKind.NamedImports */ || node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 272 /* SyntaxKind.NamedImports */ || node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedImportsOrExports = isNamedImportsOrExports; function getLeftmostAccessExpression(expr) { @@ -19860,13 +19969,13 @@ var ts; return walkAccessExpression(name.parent); } function walkAccessExpression(access) { - if (access.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (access.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var res = action(access.name); if (res !== undefined) { return res; } } - else if (access.kind === 207 /* SyntaxKind.ElementAccessExpression */) { + else if (access.kind === 209 /* SyntaxKind.ElementAccessExpression */) { if (ts.isIdentifier(access.argumentExpression) || ts.isStringLiteralLike(access.argumentExpression)) { var res = action(access.argumentExpression); if (res !== undefined) { @@ -19893,28 +20002,29 @@ var ts; function getLeftmostExpression(node, stopAtCallExpressions) { while (true) { switch (node.kind) { - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: node = node.operand; continue; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: node = node.left; continue; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: node = node.condition; continue; - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: node = node.tag; continue; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (stopAtCallExpressions) { return node; } // falls through - case 229 /* SyntaxKind.AsExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: node = node.expression; continue; } @@ -21150,17 +21260,17 @@ var ts; return ts.isIdentifier(useSite) && ts.isShorthandPropertyAssignment(useSite.parent) && useSite.parent.name === useSite; } function isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(node) { - while (node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { node = node.parent; } - if (node.kind !== 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.kind !== 164 /* SyntaxKind.ComputedPropertyName */) { return false; } - if (hasSyntacticModifier(node.parent, 128 /* ModifierFlags.Abstract */)) { + if (hasSyntacticModifier(node.parent, 256 /* ModifierFlags.Abstract */)) { return true; } var containerKind = node.parent.parent.kind; - return containerKind === 258 /* SyntaxKind.InterfaceDeclaration */ || containerKind === 182 /* SyntaxKind.TypeLiteral */; + return containerKind === 261 /* SyntaxKind.InterfaceDeclaration */ || containerKind === 184 /* SyntaxKind.TypeLiteral */; } /** Returns true for an identifier in 1) an `implements` clause, and 2) an `extends` clause of an interface. */ function isIdentifierInNonEmittingHeritageClause(node) { @@ -21168,16 +21278,16 @@ var ts; return false; var heritageClause = ts.findAncestor(node.parent, function (parent) { switch (parent.kind) { - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return true; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return false; default: return "quit"; } }); - return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 /* SyntaxKind.ImplementsKeyword */ || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 258 /* SyntaxKind.InterfaceDeclaration */; + return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 /* SyntaxKind.ImplementsKeyword */ || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 261 /* SyntaxKind.InterfaceDeclaration */; } function isIdentifierTypeReference(node) { return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName); @@ -21338,22 +21448,22 @@ var ts; if (!node.parent) return undefined; switch (node.kind) { - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: var parent_1 = node.parent; - return parent_1.kind === 190 /* SyntaxKind.InferType */ ? undefined : parent_1.typeParameters; - case 164 /* SyntaxKind.Parameter */: + return parent_1.kind === 192 /* SyntaxKind.InferType */ ? undefined : parent_1.typeParameters; + case 166 /* SyntaxKind.Parameter */: return node.parent.parameters; - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: + case 201 /* SyntaxKind.TemplateLiteralTypeSpan */: return node.parent.templateSpans; - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return node.parent.templateSpans; - case 165 /* SyntaxKind.Decorator */: { + case 167 /* SyntaxKind.Decorator */: { var parent_2 = node.parent; return ts.canHaveDecorators(parent_2) ? parent_2.modifiers : ts.canHaveIllegalDecorators(parent_2) ? parent_2.illegalDecorators : undefined; } - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return node.parent.heritageClauses; } var parent = node.parent; @@ -21361,45 +21471,45 @@ var ts; return ts.isJSDocTypeLiteral(node.parent) ? undefined : node.parent.tags; } switch (parent.kind) { - case 182 /* SyntaxKind.TypeLiteral */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.isTypeElement(node) ? parent.members : undefined; - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return parent.types; - case 184 /* SyntaxKind.TupleType */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 351 /* SyntaxKind.CommaListExpression */: - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 186 /* SyntaxKind.TupleType */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 354 /* SyntaxKind.CommaListExpression */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return parent.elements; - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 286 /* SyntaxKind.JsxAttributes */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 289 /* SyntaxKind.JsxAttributes */: return parent.properties; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return ts.isTypeNode(node) ? parent.typeArguments : parent.expression === node ? undefined : parent.arguments; - case 278 /* SyntaxKind.JsxElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 281 /* SyntaxKind.JsxElement */: + case 285 /* SyntaxKind.JsxFragment */: return ts.isJsxChild(node) ? parent.children : undefined; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return ts.isTypeNode(node) ? parent.typeArguments : undefined; - case 235 /* SyntaxKind.Block */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 265 /* SyntaxKind.ModuleBlock */: return parent.statements; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return parent.clauses; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.isClassElement(node) ? parent.members : undefined; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.isEnumMember(node) ? parent.members : undefined; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return parent.statements; } } @@ -21411,7 +21521,7 @@ var ts; if (ts.some(node.parameters, function (p) { return !getEffectiveTypeAnnotationNode(p); })) { return true; } - if (node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind !== 216 /* SyntaxKind.ArrowFunction */) { // If the first parameter is not an explicit 'this' parameter, then the function has // an implicit 'this' parameter which is subject to contextual typing. var parameter = ts.firstOrUndefined(node.parameters); @@ -21429,7 +21539,7 @@ var ts; } ts.isInfinityOrNaNString = isInfinityOrNaNString; function isCatchClauseVariableDeclaration(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function isParameterOrCatchClauseVariable(symbol) { @@ -21438,7 +21548,7 @@ var ts; } ts.isParameterOrCatchClauseVariable = isParameterOrCatchClauseVariable; function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 213 /* SyntaxKind.FunctionExpression */ || node.kind === 214 /* SyntaxKind.ArrowFunction */; + return node.kind === 215 /* SyntaxKind.FunctionExpression */ || node.kind === 216 /* SyntaxKind.ArrowFunction */; } ts.isFunctionExpressionOrArrowFunction = isFunctionExpressionOrArrowFunction; function escapeSnippetText(text) { @@ -21535,7 +21645,7 @@ var ts; ts.getNodeModulePathParts = getNodeModulePathParts; function getParameterTypeNode(parameter) { var _a; - return parameter.kind === 340 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; + return parameter.kind === 343 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; } ts.getParameterTypeNode = getParameterTypeNode; })(ts || (ts = {})); @@ -21660,10 +21770,10 @@ var ts; // // If `a ** d` is on the left of operator `**`, we need to parenthesize to preserve // the intended order of operations: `(a ** b) ** c` - var binaryOperatorPrecedence = ts.getOperatorPrecedence(221 /* SyntaxKind.BinaryExpression */, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(221 /* SyntaxKind.BinaryExpression */, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(223 /* SyntaxKind.BinaryExpression */, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(223 /* SyntaxKind.BinaryExpression */, binaryOperator); var emittedOperand = ts.skipPartiallyEmittedExpressions(operand); - if (!isLeftSideOfBinary && operand.kind === 214 /* SyntaxKind.ArrowFunction */ && binaryOperatorPrecedence > 3 /* OperatorPrecedence.Assignment */) { + if (!isLeftSideOfBinary && operand.kind === 216 /* SyntaxKind.ArrowFunction */ && binaryOperatorPrecedence > 3 /* OperatorPrecedence.Assignment */) { // We need to parenthesize arrow functions on the right side to avoid it being // parsed as parenthesized expression: `a && (() => {})` return true; @@ -21675,7 +21785,7 @@ var ts; // and is a yield expression, then we do not need parentheses. if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 /* Associativity.Right */ - && operand.kind === 224 /* SyntaxKind.YieldExpression */) { + && operand.kind === 226 /* SyntaxKind.YieldExpression */) { return false; } return true; @@ -21744,13 +21854,15 @@ var ts; // (a|b)|c -> a|(b|c) -> a|b|c // (a&b)&c -> a&(b&c) -> a&b&c // (a^b)^c -> a^(b^c) -> a^b^c + // (a,b),c -> a,(b,c) -> a,b,c // // While addition is associative in mathematics, JavaScript's `+` is not // guaranteed to be associative as it is overloaded with string concatenation. return binaryOperator === 41 /* SyntaxKind.AsteriskToken */ || binaryOperator === 51 /* SyntaxKind.BarToken */ || binaryOperator === 50 /* SyntaxKind.AmpersandToken */ - || binaryOperator === 52 /* SyntaxKind.CaretToken */; + || binaryOperator === 52 /* SyntaxKind.CaretToken */ + || binaryOperator === 27 /* SyntaxKind.CommaToken */; } /** * This function determines whether an expression consists of a homogeneous set of @@ -21763,7 +21875,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 39 /* SyntaxKind.PlusToken */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 39 /* SyntaxKind.PlusToken */) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -21789,7 +21901,7 @@ var ts; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = ts.skipPartiallyEmittedExpressions(operand); // If the resulting expression is already parenthesized, we do not need to do any further processing. - if (skipped.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (skipped.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) @@ -21806,7 +21918,7 @@ var ts; return ts.isCommaSequence(expression) ? factory.createParenthesizedExpression(expression) : expression; } function parenthesizeConditionOfConditionalExpression(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(222 /* SyntaxKind.ConditionalExpression */, 57 /* SyntaxKind.QuestionToken */); + var conditionalPrecedence = ts.getOperatorPrecedence(224 /* SyntaxKind.ConditionalExpression */, 57 /* SyntaxKind.QuestionToken */); var emittedCondition = ts.skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) !== 1 /* Comparison.GreaterThan */) { @@ -21839,8 +21951,8 @@ var ts; var needsParens = ts.isCommaSequence(check); if (!needsParens) { switch (ts.getLeftmostExpression(check, /*stopAtCallExpression*/ false).kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: needsParens = true; } } @@ -21853,9 +21965,9 @@ var ts; function parenthesizeExpressionOfNew(expression) { var leftmostExpr = ts.getLeftmostExpression(expression, /*stopAtCallExpressions*/ true); switch (leftmostExpr.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return factory.createParenthesizedExpression(expression); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return !leftmostExpr.arguments ? factory.createParenthesizedExpression(expression) : expression; // TODO(rbuckton): Verify this assertion holds @@ -21875,7 +21987,7 @@ var ts; // var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 209 /* SyntaxKind.NewExpression */ || emittedExpression.arguments) + && (emittedExpression.kind !== 211 /* SyntaxKind.NewExpression */ || emittedExpression.arguments) && (optionalChain || !ts.isOptionalChain(emittedExpression))) { // TODO(rbuckton): Verify whether this assertion holds. return expression; @@ -21898,7 +22010,7 @@ var ts; function parenthesizeExpressionForDisallowedComma(expression) { var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(221 /* SyntaxKind.BinaryExpression */, 27 /* SyntaxKind.CommaToken */); + var commaPrecedence = ts.getOperatorPrecedence(223 /* SyntaxKind.BinaryExpression */, 27 /* SyntaxKind.CommaToken */); // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return expressionPrecedence > commaPrecedence ? expression : ts.setTextRange(factory.createParenthesizedExpression(expression), expression); } @@ -21907,21 +22019,21 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = ts.skipPartiallyEmittedExpressions(callee).kind; - if (kind === 213 /* SyntaxKind.FunctionExpression */ || kind === 214 /* SyntaxKind.ArrowFunction */) { + if (kind === 215 /* SyntaxKind.FunctionExpression */ || kind === 216 /* SyntaxKind.ArrowFunction */) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. var updated = factory.updateCallExpression(emittedExpression, ts.setTextRange(factory.createParenthesizedExpression(callee), callee), emittedExpression.typeArguments, emittedExpression.arguments); return factory.restoreOuterExpressions(expression, updated, 8 /* OuterExpressionKinds.PartiallyEmittedExpressions */); } } var leftmostExpressionKind = ts.getLeftmostExpression(emittedExpression, /*stopAtCallExpressions*/ false).kind; - if (leftmostExpressionKind === 205 /* SyntaxKind.ObjectLiteralExpression */ || leftmostExpressionKind === 213 /* SyntaxKind.FunctionExpression */) { + if (leftmostExpressionKind === 207 /* SyntaxKind.ObjectLiteralExpression */ || leftmostExpressionKind === 215 /* SyntaxKind.FunctionExpression */) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return ts.setTextRange(factory.createParenthesizedExpression(expression), expression); } return expression; } function parenthesizeConciseBodyOfArrowFunction(body) { - if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 205 /* SyntaxKind.ObjectLiteralExpression */)) { + if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 207 /* SyntaxKind.ObjectLiteralExpression */)) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return ts.setTextRange(factory.createParenthesizedExpression(body), body); } @@ -21939,16 +22051,16 @@ var ts; // - The true and false branch types (the second and third `Type` non-terminals, above) allow any type function parenthesizeCheckTypeOfConditionalType(checkType) { switch (checkType.kind) { - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 189 /* SyntaxKind.ConditionalType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 191 /* SyntaxKind.ConditionalType */: return factory.createParenthesizedType(checkType); } return checkType; } function parenthesizeExtendsTypeOfConditionalType(extendsType) { switch (extendsType.kind) { - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return factory.createParenthesizedType(extendsType); } return extendsType; @@ -21960,8 +22072,8 @@ var ts; // - A union type constituent has the same precedence as the check type of a conditional type function parenthesizeConstituentTypeOfUnionType(type) { switch (type.kind) { - case 187 /* SyntaxKind.UnionType */: // Not strictly necessary, but a union containing a union should have been flattened - case 188 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests + case 189 /* SyntaxKind.UnionType */: // Not strictly necessary, but a union containing a union should have been flattened + case 190 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests return factory.createParenthesizedType(type); } return parenthesizeCheckTypeOfConditionalType(type); @@ -21976,8 +22088,8 @@ var ts; // - An intersection type constituent does not allow function, constructor, conditional, or union types (they must be parenthesized) function parenthesizeConstituentTypeOfIntersectionType(type) { switch (type.kind) { - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but an intersection containing an intersection should have been flattened + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but an intersection containing an intersection should have been flattened return factory.createParenthesizedType(type); } return parenthesizeConstituentTypeOfUnionType(type); @@ -21994,14 +22106,14 @@ var ts; // function parenthesizeOperandOfTypeOperator(type) { switch (type.kind) { - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return factory.createParenthesizedType(type); } return parenthesizeConstituentTypeOfIntersectionType(type); } function parenthesizeOperandOfReadonlyTypeOperator(type) { switch (type.kind) { - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return factory.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); @@ -22021,9 +22133,9 @@ var ts; // function parenthesizeNonArrayTypeOfPostfixType(type) { switch (type.kind) { - case 190 /* SyntaxKind.InferType */: - case 193 /* SyntaxKind.TypeOperator */: - case 181 /* SyntaxKind.TypeQuery */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests + case 192 /* SyntaxKind.InferType */: + case 195 /* SyntaxKind.TypeOperator */: + case 183 /* SyntaxKind.TypeQuery */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests return factory.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); @@ -22217,11 +22329,11 @@ var ts; } function convertToAssignmentPattern(node) { switch (node.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return convertToArrayAssignmentPattern(node); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return convertToObjectAssignmentPattern(node); } } @@ -22315,6 +22427,8 @@ var ts; createUniqueName: createUniqueName, getGeneratedNameForNode: getGeneratedNameForNode, createPrivateIdentifier: createPrivateIdentifier, + createUniquePrivateName: createUniquePrivateName, + getGeneratedPrivateNameForNode: getGeneratedPrivateNameForNode, createToken: createToken, createSuper: createSuper, createThis: createThis, @@ -22477,6 +22591,8 @@ var ts; updateAsExpression: updateAsExpression, createNonNullExpression: createNonNullExpression, updateNonNullExpression: updateNonNullExpression, + createSatisfiesExpression: createSatisfiesExpression, + updateSatisfiesExpression: updateSatisfiesExpression, createNonNullChain: createNonNullChain, updateNonNullChain: updateNonNullChain, createMetaProperty: createMetaProperty, @@ -22574,18 +22690,18 @@ var ts; createExternalModuleReference: createExternalModuleReference, updateExternalModuleReference: updateExternalModuleReference, // lazily load factory members for JSDoc types with similar structure - get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(312 /* SyntaxKind.JSDocAllType */); }, - get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(313 /* SyntaxKind.JSDocUnknownType */); }, - get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(315 /* SyntaxKind.JSDocNonNullableType */); }, - get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(315 /* SyntaxKind.JSDocNonNullableType */); }, - get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(314 /* SyntaxKind.JSDocNullableType */); }, - get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(314 /* SyntaxKind.JSDocNullableType */); }, - get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(316 /* SyntaxKind.JSDocOptionalType */); }, - get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(316 /* SyntaxKind.JSDocOptionalType */); }, - get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(318 /* SyntaxKind.JSDocVariadicType */); }, - get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(318 /* SyntaxKind.JSDocVariadicType */); }, - get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(319 /* SyntaxKind.JSDocNamepathType */); }, - get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(319 /* SyntaxKind.JSDocNamepathType */); }, + get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(315 /* SyntaxKind.JSDocAllType */); }, + get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(316 /* SyntaxKind.JSDocUnknownType */); }, + get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(318 /* SyntaxKind.JSDocNonNullableType */); }, + get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(318 /* SyntaxKind.JSDocNonNullableType */); }, + get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(317 /* SyntaxKind.JSDocNullableType */); }, + get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(317 /* SyntaxKind.JSDocNullableType */); }, + get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(319 /* SyntaxKind.JSDocOptionalType */); }, + get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(319 /* SyntaxKind.JSDocOptionalType */); }, + get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(321 /* SyntaxKind.JSDocVariadicType */); }, + get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(321 /* SyntaxKind.JSDocVariadicType */); }, + get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(322 /* SyntaxKind.JSDocNamepathType */); }, + get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(322 /* SyntaxKind.JSDocNamepathType */); }, createJSDocFunctionType: createJSDocFunctionType, updateJSDocFunctionType: updateJSDocFunctionType, createJSDocTypeLiteral: createJSDocTypeLiteral, @@ -22621,30 +22737,30 @@ var ts; createJSDocLinkPlain: createJSDocLinkPlain, updateJSDocLinkPlain: updateJSDocLinkPlain, // lazily load factory members for JSDoc tags with similar structure - get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(343 /* SyntaxKind.JSDocTypeTag */); }, - get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(343 /* SyntaxKind.JSDocTypeTag */); }, - get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(341 /* SyntaxKind.JSDocReturnTag */); }, - get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(341 /* SyntaxKind.JSDocReturnTag */); }, - get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(342 /* SyntaxKind.JSDocThisTag */); }, - get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(342 /* SyntaxKind.JSDocThisTag */); }, - get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(339 /* SyntaxKind.JSDocEnumTag */); }, - get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(339 /* SyntaxKind.JSDocEnumTag */); }, - get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(330 /* SyntaxKind.JSDocAuthorTag */); }, - get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(330 /* SyntaxKind.JSDocAuthorTag */); }, - get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(332 /* SyntaxKind.JSDocClassTag */); }, - get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(332 /* SyntaxKind.JSDocClassTag */); }, - get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(333 /* SyntaxKind.JSDocPublicTag */); }, - get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(333 /* SyntaxKind.JSDocPublicTag */); }, - get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(334 /* SyntaxKind.JSDocPrivateTag */); }, - get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(334 /* SyntaxKind.JSDocPrivateTag */); }, - get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(335 /* SyntaxKind.JSDocProtectedTag */); }, - get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(335 /* SyntaxKind.JSDocProtectedTag */); }, - get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(336 /* SyntaxKind.JSDocReadonlyTag */); }, - get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(336 /* SyntaxKind.JSDocReadonlyTag */); }, - get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(337 /* SyntaxKind.JSDocOverrideTag */); }, - get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(337 /* SyntaxKind.JSDocOverrideTag */); }, - get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(331 /* SyntaxKind.JSDocDeprecatedTag */); }, - get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(331 /* SyntaxKind.JSDocDeprecatedTag */); }, + get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(346 /* SyntaxKind.JSDocTypeTag */); }, + get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(346 /* SyntaxKind.JSDocTypeTag */); }, + get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(344 /* SyntaxKind.JSDocReturnTag */); }, + get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(344 /* SyntaxKind.JSDocReturnTag */); }, + get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(345 /* SyntaxKind.JSDocThisTag */); }, + get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(345 /* SyntaxKind.JSDocThisTag */); }, + get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(342 /* SyntaxKind.JSDocEnumTag */); }, + get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(342 /* SyntaxKind.JSDocEnumTag */); }, + get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(333 /* SyntaxKind.JSDocAuthorTag */); }, + get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(333 /* SyntaxKind.JSDocAuthorTag */); }, + get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(335 /* SyntaxKind.JSDocClassTag */); }, + get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(335 /* SyntaxKind.JSDocClassTag */); }, + get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(336 /* SyntaxKind.JSDocPublicTag */); }, + get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(336 /* SyntaxKind.JSDocPublicTag */); }, + get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(337 /* SyntaxKind.JSDocPrivateTag */); }, + get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(337 /* SyntaxKind.JSDocPrivateTag */); }, + get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(338 /* SyntaxKind.JSDocProtectedTag */); }, + get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(338 /* SyntaxKind.JSDocProtectedTag */); }, + get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(339 /* SyntaxKind.JSDocReadonlyTag */); }, + get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(339 /* SyntaxKind.JSDocReadonlyTag */); }, + get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(340 /* SyntaxKind.JSDocOverrideTag */); }, + get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(340 /* SyntaxKind.JSDocOverrideTag */); }, + get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(334 /* SyntaxKind.JSDocDeprecatedTag */); }, + get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(334 /* SyntaxKind.JSDocDeprecatedTag */); }, createJSDocUnknownTag: createJSDocUnknownTag, updateJSDocUnknownTag: updateJSDocUnknownTag, createJSDocText: createJSDocText, @@ -22847,11 +22963,11 @@ var ts; // don't propagate child flags. if (name) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: if (ts.isIdentifier(name)) { node.transformFlags |= propagateIdentifierNameFlags(name); break; @@ -23000,10 +23116,12 @@ var ts; node.escapedText = ts.escapeLeadingUnderscores(text); return node; } - function createBaseGeneratedIdentifier(text, autoGenerateFlags) { + function createBaseGeneratedIdentifier(text, autoGenerateFlags, prefix, suffix) { var node = createBaseIdentifier(text, /*originalKeywordKind*/ undefined); node.autoGenerateFlags = autoGenerateFlags; node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; nextAutoGenerateId++; return node; } @@ -23014,7 +23132,7 @@ var ts; // NOTE: we do not use `setChildren` here because typeArguments in an identifier do not contribute to transformations node.typeArguments = createNodeArray(typeArguments); } - if (node.originalKeywordKind === 132 /* SyntaxKind.AwaitKeyword */) { + if (node.originalKeywordKind === 133 /* SyntaxKind.AwaitKeyword */) { node.transformFlags |= 67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; } return node; @@ -23026,11 +23144,11 @@ var ts; : node; } // @api - function createTempVariable(recordTempVariable, reservedInNestedScopes) { + function createTempVariable(recordTempVariable, reservedInNestedScopes, prefix, suffix) { var flags = 1 /* GeneratedIdentifierFlags.Auto */; if (reservedInNestedScopes) flags |= 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */; - var name = createBaseGeneratedIdentifier("", flags); + var name = createBaseGeneratedIdentifier("", flags, prefix, suffix); if (recordTempVariable) { recordTempVariable(name); } @@ -23042,34 +23160,69 @@ var ts; var flags = 2 /* GeneratedIdentifierFlags.Loop */; if (reservedInNestedScopes) flags |= 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */; - return createBaseGeneratedIdentifier("", flags); + return createBaseGeneratedIdentifier("", flags, /*prefix*/ undefined, /*suffix*/ undefined); } /** Create a unique name based on the supplied text. */ // @api - function createUniqueName(text, flags) { + function createUniqueName(text, flags, prefix, suffix) { if (flags === void 0) { flags = 0 /* GeneratedIdentifierFlags.None */; } ts.Debug.assert(!(flags & 7 /* GeneratedIdentifierFlags.KindMask */), "Argument out of range: flags"); ts.Debug.assert((flags & (16 /* GeneratedIdentifierFlags.Optimistic */ | 32 /* GeneratedIdentifierFlags.FileLevel */)) !== 32 /* GeneratedIdentifierFlags.FileLevel */, "GeneratedIdentifierFlags.FileLevel cannot be set without also setting GeneratedIdentifierFlags.Optimistic"); - return createBaseGeneratedIdentifier(text, 3 /* GeneratedIdentifierFlags.Unique */ | flags); + return createBaseGeneratedIdentifier(text, 3 /* GeneratedIdentifierFlags.Unique */ | flags, prefix, suffix); } /** Create a unique name generated for a node. */ // @api - function getGeneratedNameForNode(node, flags) { + function getGeneratedNameForNode(node, flags, prefix, suffix) { if (flags === void 0) { flags = 0; } ts.Debug.assert(!(flags & 7 /* GeneratedIdentifierFlags.KindMask */), "Argument out of range: flags"); - var name = createBaseGeneratedIdentifier(node && ts.isIdentifier(node) ? ts.idText(node) : "", 4 /* GeneratedIdentifierFlags.Node */ | flags); + var text = !node ? "" : + ts.isMemberName(node) ? ts.formatGeneratedName(/*privateName*/ false, prefix, node, suffix, ts.idText) : + "generated@".concat(ts.getNodeId(node)); + if (prefix || suffix) + flags |= 16 /* GeneratedIdentifierFlags.Optimistic */; + var name = createBaseGeneratedIdentifier(text, 4 /* GeneratedIdentifierFlags.Node */ | flags, prefix, suffix); name.original = node; return name; } + function createBasePrivateIdentifier(text) { + var node = baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */); + node.escapedText = ts.escapeLeadingUnderscores(text); + node.transformFlags |= 16777216 /* TransformFlags.ContainsClassFields */; + return node; + } // @api function createPrivateIdentifier(text) { if (!ts.startsWith(text, "#")) ts.Debug.fail("First character of private identifier must be #: " + text); - var node = baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */); - node.escapedText = ts.escapeLeadingUnderscores(text); - node.transformFlags |= 16777216 /* TransformFlags.ContainsClassFields */; + return createBasePrivateIdentifier(text); + } + function createBaseGeneratedPrivateIdentifier(text, autoGenerateFlags, prefix, suffix) { + var node = createBasePrivateIdentifier(text); + node.autoGenerateFlags = autoGenerateFlags; + node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; + nextAutoGenerateId++; return node; } + /** Create a unique name based on the supplied text. */ + // @api + function createUniquePrivateName(text, prefix, suffix) { + if (text && !ts.startsWith(text, "#")) + ts.Debug.fail("First character of private identifier must be #: " + text); + var autoGenerateFlags = 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */ | + (text ? 3 /* GeneratedIdentifierFlags.Unique */ : 1 /* GeneratedIdentifierFlags.Auto */); + return createBaseGeneratedPrivateIdentifier(text !== null && text !== void 0 ? text : "", autoGenerateFlags, prefix, suffix); + } + // @api + function getGeneratedPrivateNameForNode(node, prefix, suffix) { + var text = ts.isMemberName(node) ? ts.formatGeneratedName(/*privateName*/ true, prefix, node, suffix, ts.idText) : + "#generated@".concat(ts.getNodeId(node)); + var flags = prefix || suffix ? 16 /* GeneratedIdentifierFlags.Optimistic */ : 0 /* GeneratedIdentifierFlags.None */; + var name = createBaseGeneratedPrivateIdentifier(text, 4 /* GeneratedIdentifierFlags.Node */ | flags, prefix, suffix); + name.original = node; + return name; + } // // Punctuation // @@ -23077,14 +23230,14 @@ var ts; return baseFactory.createBaseTokenNode(kind); } function createToken(token) { - ts.Debug.assert(token >= 0 /* SyntaxKind.FirstToken */ && token <= 160 /* SyntaxKind.LastToken */, "Invalid token"); + ts.Debug.assert(token >= 0 /* SyntaxKind.FirstToken */ && token <= 162 /* SyntaxKind.LastToken */, "Invalid token"); ts.Debug.assert(token <= 14 /* SyntaxKind.FirstTemplateToken */ || token >= 17 /* SyntaxKind.LastTemplateToken */, "Invalid token. Use 'createTemplateLiteralLikeNode' to create template literals."); ts.Debug.assert(token <= 8 /* SyntaxKind.FirstLiteralToken */ || token >= 14 /* SyntaxKind.LastLiteralToken */, "Invalid token. Use 'createLiteralLikeNode' to create literals."); ts.Debug.assert(token !== 79 /* SyntaxKind.Identifier */, "Invalid token. Use 'createIdentifier' to create identifiers"); var node = createBaseToken(token); var transformFlags = 0 /* TransformFlags.None */; switch (token) { - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // 'async' modifier is ES2017 (async functions) or ES2018 (async generators) transformFlags = 256 /* TransformFlags.ContainsES2017 */ | @@ -23093,24 +23246,24 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 130 /* SyntaxKind.AnyKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 145 /* SyntaxKind.OutKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: // `undefined` is an Identifier in the expression case. + case 157 /* SyntaxKind.UnknownKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: // `undefined` is an Identifier in the expression case. transformFlags = 1 /* TransformFlags.ContainsTypeScript */; break; case 106 /* SyntaxKind.SuperKeyword */: @@ -23119,6 +23272,9 @@ var ts; case 124 /* SyntaxKind.StaticKeyword */: transformFlags = 1024 /* TransformFlags.ContainsES2015 */; break; + case 127 /* SyntaxKind.AccessorKeyword */: + transformFlags = 16777216 /* TransformFlags.ContainsClassFields */; + break; case 108 /* SyntaxKind.ThisKeyword */: // 'this' indicates a lexical 'this' transformFlags = 16384 /* TransformFlags.ContainsLexicalThis */; @@ -23165,8 +23321,8 @@ var ts; if (flags & 1 /* ModifierFlags.Export */) result.push(createModifier(93 /* SyntaxKind.ExportKeyword */)); if (flags & 2 /* ModifierFlags.Ambient */) - result.push(createModifier(135 /* SyntaxKind.DeclareKeyword */)); - if (flags & 512 /* ModifierFlags.Default */) + result.push(createModifier(136 /* SyntaxKind.DeclareKeyword */)); + if (flags & 1024 /* ModifierFlags.Default */) result.push(createModifier(88 /* SyntaxKind.DefaultKeyword */)); if (flags & 2048 /* ModifierFlags.Const */) result.push(createModifier(85 /* SyntaxKind.ConstKeyword */)); @@ -23176,20 +23332,22 @@ var ts; result.push(createModifier(121 /* SyntaxKind.PrivateKeyword */)); if (flags & 16 /* ModifierFlags.Protected */) result.push(createModifier(122 /* SyntaxKind.ProtectedKeyword */)); - if (flags & 128 /* ModifierFlags.Abstract */) + if (flags & 256 /* ModifierFlags.Abstract */) result.push(createModifier(126 /* SyntaxKind.AbstractKeyword */)); if (flags & 32 /* ModifierFlags.Static */) result.push(createModifier(124 /* SyntaxKind.StaticKeyword */)); if (flags & 16384 /* ModifierFlags.Override */) - result.push(createModifier(159 /* SyntaxKind.OverrideKeyword */)); + result.push(createModifier(161 /* SyntaxKind.OverrideKeyword */)); if (flags & 64 /* ModifierFlags.Readonly */) - result.push(createModifier(145 /* SyntaxKind.ReadonlyKeyword */)); - if (flags & 256 /* ModifierFlags.Async */) - result.push(createModifier(131 /* SyntaxKind.AsyncKeyword */)); + result.push(createModifier(146 /* SyntaxKind.ReadonlyKeyword */)); + if (flags & 128 /* ModifierFlags.Accessor */) + result.push(createModifier(127 /* SyntaxKind.AccessorKeyword */)); + if (flags & 512 /* ModifierFlags.Async */) + result.push(createModifier(132 /* SyntaxKind.AsyncKeyword */)); if (flags & 32768 /* ModifierFlags.In */) result.push(createModifier(101 /* SyntaxKind.InKeyword */)); if (flags & 65536 /* ModifierFlags.Out */) - result.push(createModifier(144 /* SyntaxKind.OutKeyword */)); + result.push(createModifier(145 /* SyntaxKind.OutKeyword */)); return result.length ? result : undefined; } // @@ -23197,7 +23355,7 @@ var ts; // // @api function createQualifiedName(left, right) { - var node = createBaseNode(161 /* SyntaxKind.QualifiedName */); + var node = createBaseNode(163 /* SyntaxKind.QualifiedName */); node.left = left; node.right = asName(right); node.transformFlags |= @@ -23214,7 +23372,7 @@ var ts; } // @api function createComputedPropertyName(expression) { - var node = createBaseNode(162 /* SyntaxKind.ComputedPropertyName */); + var node = createBaseNode(164 /* SyntaxKind.ComputedPropertyName */); node.expression = parenthesizerRules().parenthesizeExpressionOfComputedPropertyName(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -23233,7 +23391,7 @@ var ts; // // @api function createTypeParameterDeclaration(modifiers, name, constraint, defaultType) { - var node = createBaseNamedDeclaration(163 /* SyntaxKind.TypeParameter */, modifiers, name); + var node = createBaseNamedDeclaration(165 /* SyntaxKind.TypeParameter */, modifiers, name); node.constraint = constraint; node.default = defaultType; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23250,7 +23408,7 @@ var ts; } // @api function createParameterDeclaration(modifiers, dotDotDotToken, name, questionToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(164 /* SyntaxKind.Parameter */, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); + var node = createBaseVariableLikeDeclaration(166 /* SyntaxKind.Parameter */, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.dotDotDotToken = dotDotDotToken; node.questionToken = questionToken; if (ts.isThisIdentifier(node.name)) { @@ -23282,7 +23440,7 @@ var ts; } // @api function createDecorator(expression) { - var node = createBaseNode(165 /* SyntaxKind.Decorator */); + var node = createBaseNode(167 /* SyntaxKind.Decorator */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.transformFlags |= propagateChildFlags(node.expression) | @@ -23302,7 +23460,7 @@ var ts; // // @api function createPropertySignature(modifiers, name, questionToken, type) { - var node = createBaseNamedDeclaration(166 /* SyntaxKind.PropertySignature */, modifiers, name); + var node = createBaseNamedDeclaration(168 /* SyntaxKind.PropertySignature */, modifiers, name); node.type = type; node.questionToken = questionToken; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23328,7 +23486,7 @@ var ts; } // @api function createPropertyDeclaration(modifiers, name, questionOrExclamationToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(167 /* SyntaxKind.PropertyDeclaration */, modifiers, name, type, initializer); + var node = createBaseVariableLikeDeclaration(169 /* SyntaxKind.PropertyDeclaration */, modifiers, name, type, initializer); node.questionToken = questionOrExclamationToken && ts.isQuestionToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.exclamationToken = questionOrExclamationToken && ts.isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.transformFlags |= @@ -23356,7 +23514,7 @@ var ts; } // @api function createMethodSignature(modifiers, name, questionToken, typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(168 /* SyntaxKind.MethodSignature */, modifiers, name, typeParameters, parameters, type); + var node = createBaseSignatureDeclaration(170 /* SyntaxKind.MethodSignature */, modifiers, name, typeParameters, parameters, type); node.questionToken = questionToken; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23374,7 +23532,7 @@ var ts; } // @api function createMethodDeclaration(modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(169 /* SyntaxKind.MethodDeclaration */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(171 /* SyntaxKind.MethodDeclaration */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; node.questionToken = questionToken; node.transformFlags |= @@ -23384,7 +23542,7 @@ var ts; if (questionToken) { node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; } - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -23420,7 +23578,7 @@ var ts; } // @api function createClassStaticBlockDeclaration(body) { - var node = createBaseGenericNamedDeclaration(170 /* SyntaxKind.ClassStaticBlockDeclaration */, + var node = createBaseGenericNamedDeclaration(172 /* SyntaxKind.ClassStaticBlockDeclaration */, /*modifiers*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined); @@ -23446,7 +23604,7 @@ var ts; } // @api function createConstructorDeclaration(modifiers, parameters, body) { - var node = createBaseFunctionLikeDeclaration(171 /* SyntaxKind.Constructor */, modifiers, + var node = createBaseFunctionLikeDeclaration(173 /* SyntaxKind.Constructor */, modifiers, /*name*/ undefined, /*typeParameters*/ undefined, parameters, /*type*/ undefined, body); @@ -23475,7 +23633,7 @@ var ts; } // @api function createGetAccessorDeclaration(modifiers, name, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(172 /* SyntaxKind.GetAccessor */, modifiers, name, + var node = createBaseFunctionLikeDeclaration(174 /* SyntaxKind.GetAccessor */, modifiers, name, /*typeParameters*/ undefined, parameters, type, body); // The following properties are used only to report grammar errors node.typeParameters = undefined; @@ -23499,7 +23657,7 @@ var ts; } // @api function createSetAccessorDeclaration(modifiers, name, parameters, body) { - var node = createBaseFunctionLikeDeclaration(173 /* SyntaxKind.SetAccessor */, modifiers, name, + var node = createBaseFunctionLikeDeclaration(175 /* SyntaxKind.SetAccessor */, modifiers, name, /*typeParameters*/ undefined, parameters, /*type*/ undefined, body); // The following properties are used only to report grammar errors @@ -23525,7 +23683,7 @@ var ts; } // @api function createCallSignature(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(174 /* SyntaxKind.CallSignature */, + var node = createBaseSignatureDeclaration(176 /* SyntaxKind.CallSignature */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23541,7 +23699,7 @@ var ts; } // @api function createConstructSignature(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(175 /* SyntaxKind.ConstructSignature */, + var node = createBaseSignatureDeclaration(177 /* SyntaxKind.ConstructSignature */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23557,7 +23715,7 @@ var ts; } // @api function createIndexSignature(modifiers, parameters, type) { - var node = createBaseSignatureDeclaration(176 /* SyntaxKind.IndexSignature */, modifiers, + var node = createBaseSignatureDeclaration(178 /* SyntaxKind.IndexSignature */, modifiers, /*name*/ undefined, /*typeParameters*/ undefined, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23573,7 +23731,7 @@ var ts; } // @api function createTemplateLiteralTypeSpan(type, literal) { - var node = createBaseNode(199 /* SyntaxKind.TemplateLiteralTypeSpan */); + var node = createBaseNode(201 /* SyntaxKind.TemplateLiteralTypeSpan */); node.type = type; node.literal = literal; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23595,7 +23753,7 @@ var ts; } // @api function createTypePredicateNode(assertsModifier, parameterName, type) { - var node = createBaseNode(177 /* SyntaxKind.TypePredicate */); + var node = createBaseNode(179 /* SyntaxKind.TypePredicate */); node.assertsModifier = assertsModifier; node.parameterName = asName(parameterName); node.type = type; @@ -23612,7 +23770,7 @@ var ts; } // @api function createTypeReferenceNode(typeName, typeArguments) { - var node = createBaseNode(178 /* SyntaxKind.TypeReference */); + var node = createBaseNode(180 /* SyntaxKind.TypeReference */); node.typeName = asName(typeName); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(createNodeArray(typeArguments)); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23627,7 +23785,7 @@ var ts; } // @api function createFunctionTypeNode(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(179 /* SyntaxKind.FunctionType */, + var node = createBaseSignatureDeclaration(181 /* SyntaxKind.FunctionType */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23660,7 +23818,7 @@ var ts; ts.Debug.fail("Incorrect number of arguments specified."); } function createConstructorTypeNode1(modifiers, typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(180 /* SyntaxKind.ConstructorType */, modifiers, + var node = createBaseSignatureDeclaration(182 /* SyntaxKind.ConstructorType */, modifiers, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23693,7 +23851,7 @@ var ts; } // @api function createTypeQueryNode(exprName, typeArguments) { - var node = createBaseNode(181 /* SyntaxKind.TypeQuery */); + var node = createBaseNode(183 /* SyntaxKind.TypeQuery */); node.exprName = exprName; node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23708,7 +23866,7 @@ var ts; } // @api function createTypeLiteralNode(members) { - var node = createBaseNode(182 /* SyntaxKind.TypeLiteral */); + var node = createBaseNode(184 /* SyntaxKind.TypeLiteral */); node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23721,7 +23879,7 @@ var ts; } // @api function createArrayTypeNode(elementType) { - var node = createBaseNode(183 /* SyntaxKind.ArrayType */); + var node = createBaseNode(185 /* SyntaxKind.ArrayType */); node.elementType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(elementType); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23734,7 +23892,7 @@ var ts; } // @api function createTupleTypeNode(elements) { - var node = createBaseNode(184 /* SyntaxKind.TupleType */); + var node = createBaseNode(186 /* SyntaxKind.TupleType */); node.elements = createNodeArray(parenthesizerRules().parenthesizeElementTypesOfTupleType(elements)); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23747,7 +23905,7 @@ var ts; } // @api function createNamedTupleMember(dotDotDotToken, name, questionToken, type) { - var node = createBaseNode(197 /* SyntaxKind.NamedTupleMember */); + var node = createBaseNode(199 /* SyntaxKind.NamedTupleMember */); node.dotDotDotToken = dotDotDotToken; node.name = name; node.questionToken = questionToken; @@ -23766,7 +23924,7 @@ var ts; } // @api function createOptionalTypeNode(type) { - var node = createBaseNode(185 /* SyntaxKind.OptionalType */); + var node = createBaseNode(187 /* SyntaxKind.OptionalType */); node.type = parenthesizerRules().parenthesizeTypeOfOptionalType(type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23779,7 +23937,7 @@ var ts; } // @api function createRestTypeNode(type) { - var node = createBaseNode(186 /* SyntaxKind.RestType */); + var node = createBaseNode(188 /* SyntaxKind.RestType */); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23803,7 +23961,7 @@ var ts; } // @api function createUnionTypeNode(types) { - return createUnionOrIntersectionTypeNode(187 /* SyntaxKind.UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); + return createUnionOrIntersectionTypeNode(189 /* SyntaxKind.UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); } // @api function updateUnionTypeNode(node, types) { @@ -23811,7 +23969,7 @@ var ts; } // @api function createIntersectionTypeNode(types) { - return createUnionOrIntersectionTypeNode(188 /* SyntaxKind.IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); + return createUnionOrIntersectionTypeNode(190 /* SyntaxKind.IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); } // @api function updateIntersectionTypeNode(node, types) { @@ -23819,7 +23977,7 @@ var ts; } // @api function createConditionalTypeNode(checkType, extendsType, trueType, falseType) { - var node = createBaseNode(189 /* SyntaxKind.ConditionalType */); + var node = createBaseNode(191 /* SyntaxKind.ConditionalType */); node.checkType = parenthesizerRules().parenthesizeCheckTypeOfConditionalType(checkType); node.extendsType = parenthesizerRules().parenthesizeExtendsTypeOfConditionalType(extendsType); node.trueType = trueType; @@ -23838,7 +23996,7 @@ var ts; } // @api function createInferTypeNode(typeParameter) { - var node = createBaseNode(190 /* SyntaxKind.InferType */); + var node = createBaseNode(192 /* SyntaxKind.InferType */); node.typeParameter = typeParameter; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23851,7 +24009,7 @@ var ts; } // @api function createTemplateLiteralType(head, templateSpans) { - var node = createBaseNode(198 /* SyntaxKind.TemplateLiteralType */); + var node = createBaseNode(200 /* SyntaxKind.TemplateLiteralType */); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23867,7 +24025,7 @@ var ts; // @api function createImportTypeNode(argument, assertions, qualifier, typeArguments, isTypeOf) { if (isTypeOf === void 0) { isTypeOf = false; } - var node = createBaseNode(200 /* SyntaxKind.ImportType */); + var node = createBaseNode(202 /* SyntaxKind.ImportType */); node.argument = argument; node.assertions = assertions; node.qualifier = qualifier; @@ -23889,7 +24047,7 @@ var ts; } // @api function createParenthesizedType(type) { - var node = createBaseNode(191 /* SyntaxKind.ParenthesizedType */); + var node = createBaseNode(193 /* SyntaxKind.ParenthesizedType */); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23902,15 +24060,15 @@ var ts; } // @api function createThisTypeNode() { - var node = createBaseNode(192 /* SyntaxKind.ThisType */); + var node = createBaseNode(194 /* SyntaxKind.ThisType */); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; } // @api function createTypeOperatorNode(operator, type) { - var node = createBaseNode(193 /* SyntaxKind.TypeOperator */); + var node = createBaseNode(195 /* SyntaxKind.TypeOperator */); node.operator = operator; - node.type = operator === 145 /* SyntaxKind.ReadonlyKeyword */ ? + node.type = operator === 146 /* SyntaxKind.ReadonlyKeyword */ ? parenthesizerRules().parenthesizeOperandOfReadonlyTypeOperator(type) : parenthesizerRules().parenthesizeOperandOfTypeOperator(type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23924,7 +24082,7 @@ var ts; } // @api function createIndexedAccessTypeNode(objectType, indexType) { - var node = createBaseNode(194 /* SyntaxKind.IndexedAccessType */); + var node = createBaseNode(196 /* SyntaxKind.IndexedAccessType */); node.objectType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(objectType); node.indexType = indexType; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23939,7 +24097,7 @@ var ts; } // @api function createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members) { - var node = createBaseNode(195 /* SyntaxKind.MappedType */); + var node = createBaseNode(197 /* SyntaxKind.MappedType */); node.readonlyToken = readonlyToken; node.typeParameter = typeParameter; node.nameType = nameType; @@ -23962,7 +24120,7 @@ var ts; } // @api function createLiteralTypeNode(literal) { - var node = createBaseNode(196 /* SyntaxKind.LiteralType */); + var node = createBaseNode(198 /* SyntaxKind.LiteralType */); node.literal = literal; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23978,7 +24136,7 @@ var ts; // // @api function createObjectBindingPattern(elements) { - var node = createBaseNode(201 /* SyntaxKind.ObjectBindingPattern */); + var node = createBaseNode(203 /* SyntaxKind.ObjectBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | @@ -23999,7 +24157,7 @@ var ts; } // @api function createArrayBindingPattern(elements) { - var node = createBaseNode(202 /* SyntaxKind.ArrayBindingPattern */); + var node = createBaseNode(204 /* SyntaxKind.ArrayBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | @@ -24015,7 +24173,7 @@ var ts; } // @api function createBindingElement(dotDotDotToken, propertyName, name, initializer) { - var node = createBaseBindingLikeDeclaration(203 /* SyntaxKind.BindingElement */, + var node = createBaseBindingLikeDeclaration(205 /* SyntaxKind.BindingElement */, /*modifiers*/ undefined, name, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.propertyName = asName(propertyName); node.dotDotDotToken = dotDotDotToken; @@ -24050,7 +24208,7 @@ var ts; } // @api function createArrayLiteralExpression(elements, multiLine) { - var node = createBaseExpression(204 /* SyntaxKind.ArrayLiteralExpression */); + var node = createBaseExpression(206 /* SyntaxKind.ArrayLiteralExpression */); // Ensure we add a trailing comma for something like `[NumericLiteral(1), NumericLiteral(2), OmittedExpresion]` so that // we end up with `[1, 2, ,]` instead of `[1, 2, ]` otherwise the `OmittedExpression` will just end up being treated like // a trailing comma. @@ -24069,7 +24227,7 @@ var ts; } // @api function createObjectLiteralExpression(properties, multiLine) { - var node = createBaseExpression(205 /* SyntaxKind.ObjectLiteralExpression */); + var node = createBaseExpression(207 /* SyntaxKind.ObjectLiteralExpression */); node.properties = createNodeArray(properties); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.properties); @@ -24083,7 +24241,7 @@ var ts; } // @api function createPropertyAccessExpression(expression, name) { - var node = createBaseExpression(206 /* SyntaxKind.PropertyAccessExpression */); + var node = createBaseExpression(208 /* SyntaxKind.PropertyAccessExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.name = asName(name); node.transformFlags = @@ -24112,7 +24270,7 @@ var ts; } // @api function createPropertyAccessChain(expression, questionDotToken, name) { - var node = createBaseExpression(206 /* SyntaxKind.PropertyAccessExpression */); + var node = createBaseExpression(208 /* SyntaxKind.PropertyAccessExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24139,7 +24297,7 @@ var ts; } // @api function createElementAccessExpression(expression, index) { - var node = createBaseExpression(207 /* SyntaxKind.ElementAccessExpression */); + var node = createBaseExpression(209 /* SyntaxKind.ElementAccessExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.argumentExpression = asExpression(index); node.transformFlags |= @@ -24166,7 +24324,7 @@ var ts; } // @api function createElementAccessChain(expression, questionDotToken, index) { - var node = createBaseExpression(207 /* SyntaxKind.ElementAccessExpression */); + var node = createBaseExpression(209 /* SyntaxKind.ElementAccessExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24191,7 +24349,7 @@ var ts; } // @api function createCallExpression(expression, typeArguments, argumentsArray) { - var node = createBaseExpression(208 /* SyntaxKind.CallExpression */); + var node = createBaseExpression(210 /* SyntaxKind.CallExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.typeArguments = asNodeArray(typeArguments); node.arguments = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(createNodeArray(argumentsArray)); @@ -24223,7 +24381,7 @@ var ts; } // @api function createCallChain(expression, questionDotToken, typeArguments, argumentsArray) { - var node = createBaseExpression(208 /* SyntaxKind.CallExpression */); + var node = createBaseExpression(210 /* SyntaxKind.CallExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24255,7 +24413,7 @@ var ts; } // @api function createNewExpression(expression, typeArguments, argumentsArray) { - var node = createBaseExpression(209 /* SyntaxKind.NewExpression */); + var node = createBaseExpression(211 /* SyntaxKind.NewExpression */); node.expression = parenthesizerRules().parenthesizeExpressionOfNew(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = argumentsArray ? parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(argumentsArray) : undefined; @@ -24279,7 +24437,7 @@ var ts; } // @api function createTaggedTemplateExpression(tag, typeArguments, template) { - var node = createBaseExpression(210 /* SyntaxKind.TaggedTemplateExpression */); + var node = createBaseExpression(212 /* SyntaxKind.TaggedTemplateExpression */); node.tag = parenthesizerRules().parenthesizeLeftSideOfAccess(tag, /*optionalChain*/ false); node.typeArguments = asNodeArray(typeArguments); node.template = template; @@ -24306,7 +24464,7 @@ var ts; } // @api function createTypeAssertion(type, expression) { - var node = createBaseExpression(211 /* SyntaxKind.TypeAssertionExpression */); + var node = createBaseExpression(213 /* SyntaxKind.TypeAssertionExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.type = type; node.transformFlags |= @@ -24324,7 +24482,7 @@ var ts; } // @api function createParenthesizedExpression(expression) { - var node = createBaseExpression(212 /* SyntaxKind.ParenthesizedExpression */); + var node = createBaseExpression(214 /* SyntaxKind.ParenthesizedExpression */); node.expression = expression; node.transformFlags = propagateChildFlags(node.expression); return node; @@ -24337,13 +24495,13 @@ var ts; } // @api function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(213 /* SyntaxKind.FunctionExpression */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(215 /* SyntaxKind.FunctionExpression */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; node.transformFlags |= propagateChildFlags(node.asteriskToken); if (node.typeParameters) { node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; } - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (node.asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -24370,13 +24528,13 @@ var ts; } // @api function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { - var node = createBaseFunctionLikeDeclaration(214 /* SyntaxKind.ArrowFunction */, modifiers, + var node = createBaseFunctionLikeDeclaration(216 /* SyntaxKind.ArrowFunction */, modifiers, /*name*/ undefined, typeParameters, parameters, type, parenthesizerRules().parenthesizeConciseBodyOfArrowFunction(body)); node.equalsGreaterThanToken = equalsGreaterThanToken !== null && equalsGreaterThanToken !== void 0 ? equalsGreaterThanToken : createToken(38 /* SyntaxKind.EqualsGreaterThanToken */); node.transformFlags |= propagateChildFlags(node.equalsGreaterThanToken) | 1024 /* TransformFlags.ContainsES2015 */; - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { node.transformFlags |= 256 /* TransformFlags.ContainsES2017 */ | 16384 /* TransformFlags.ContainsLexicalThis */; } return node; @@ -24394,7 +24552,7 @@ var ts; } // @api function createDeleteExpression(expression) { - var node = createBaseExpression(215 /* SyntaxKind.DeleteExpression */); + var node = createBaseExpression(217 /* SyntaxKind.DeleteExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24407,7 +24565,7 @@ var ts; } // @api function createTypeOfExpression(expression) { - var node = createBaseExpression(216 /* SyntaxKind.TypeOfExpression */); + var node = createBaseExpression(218 /* SyntaxKind.TypeOfExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24420,7 +24578,7 @@ var ts; } // @api function createVoidExpression(expression) { - var node = createBaseExpression(217 /* SyntaxKind.VoidExpression */); + var node = createBaseExpression(219 /* SyntaxKind.VoidExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24433,7 +24591,7 @@ var ts; } // @api function createAwaitExpression(expression) { - var node = createBaseExpression(218 /* SyntaxKind.AwaitExpression */); + var node = createBaseExpression(220 /* SyntaxKind.AwaitExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24450,7 +24608,7 @@ var ts; } // @api function createPrefixUnaryExpression(operator, operand) { - var node = createBaseExpression(219 /* SyntaxKind.PrefixUnaryExpression */); + var node = createBaseExpression(221 /* SyntaxKind.PrefixUnaryExpression */); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPrefixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -24472,7 +24630,7 @@ var ts; } // @api function createPostfixUnaryExpression(operand, operator) { - var node = createBaseExpression(220 /* SyntaxKind.PostfixUnaryExpression */); + var node = createBaseExpression(222 /* SyntaxKind.PostfixUnaryExpression */); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPostfixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -24493,7 +24651,7 @@ var ts; } // @api function createBinaryExpression(left, operator, right) { - var node = createBaseExpression(221 /* SyntaxKind.BinaryExpression */); + var node = createBaseExpression(223 /* SyntaxKind.BinaryExpression */); var operatorToken = asToken(operator); var operatorKind = operatorToken.kind; node.left = parenthesizerRules().parenthesizeLeftSideOfBinary(operatorKind, left); @@ -24565,7 +24723,7 @@ var ts; } // @api function createConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse) { - var node = createBaseExpression(222 /* SyntaxKind.ConditionalExpression */); + var node = createBaseExpression(224 /* SyntaxKind.ConditionalExpression */); node.condition = parenthesizerRules().parenthesizeConditionOfConditionalExpression(condition); node.questionToken = questionToken !== null && questionToken !== void 0 ? questionToken : createToken(57 /* SyntaxKind.QuestionToken */); node.whenTrue = parenthesizerRules().parenthesizeBranchOfConditionalExpression(whenTrue); @@ -24591,7 +24749,7 @@ var ts; } // @api function createTemplateExpression(head, templateSpans) { - var node = createBaseExpression(223 /* SyntaxKind.TemplateExpression */); + var node = createBaseExpression(225 /* SyntaxKind.TemplateExpression */); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags |= @@ -24661,7 +24819,7 @@ var ts; // @api function createYieldExpression(asteriskToken, expression) { ts.Debug.assert(!asteriskToken || !!expression, "A `YieldExpression` with an asteriskToken must have an expression."); - var node = createBaseExpression(224 /* SyntaxKind.YieldExpression */); + var node = createBaseExpression(226 /* SyntaxKind.YieldExpression */); node.expression = expression && parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.asteriskToken = asteriskToken; node.transformFlags |= @@ -24681,7 +24839,7 @@ var ts; } // @api function createSpreadElement(expression) { - var node = createBaseExpression(225 /* SyntaxKind.SpreadElement */); + var node = createBaseExpression(227 /* SyntaxKind.SpreadElement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24697,7 +24855,7 @@ var ts; } // @api function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseClassLikeDeclaration(226 /* SyntaxKind.ClassExpression */, modifiers, name, typeParameters, heritageClauses, members); + var node = createBaseClassLikeDeclaration(228 /* SyntaxKind.ClassExpression */, modifiers, name, typeParameters, heritageClauses, members); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; return node; } @@ -24713,11 +24871,11 @@ var ts; } // @api function createOmittedExpression() { - return createBaseExpression(227 /* SyntaxKind.OmittedExpression */); + return createBaseExpression(229 /* SyntaxKind.OmittedExpression */); } // @api function createExpressionWithTypeArguments(expression, typeArguments) { - var node = createBaseNode(228 /* SyntaxKind.ExpressionWithTypeArguments */); + var node = createBaseNode(230 /* SyntaxKind.ExpressionWithTypeArguments */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags |= @@ -24735,7 +24893,7 @@ var ts; } // @api function createAsExpression(expression, type) { - var node = createBaseExpression(229 /* SyntaxKind.AsExpression */); + var node = createBaseExpression(231 /* SyntaxKind.AsExpression */); node.expression = expression; node.type = type; node.transformFlags |= @@ -24753,7 +24911,7 @@ var ts; } // @api function createNonNullExpression(expression) { - var node = createBaseExpression(230 /* SyntaxKind.NonNullExpression */); + var node = createBaseExpression(232 /* SyntaxKind.NonNullExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24770,8 +24928,26 @@ var ts; : node; } // @api + function createSatisfiesExpression(expression, type) { + var node = createBaseExpression(235 /* SyntaxKind.SatisfiesExpression */); + node.expression = expression; + node.type = type; + node.transformFlags |= + propagateChildFlags(node.expression) | + propagateChildFlags(node.type) | + 1 /* TransformFlags.ContainsTypeScript */; + return node; + } + // @api + function updateSatisfiesExpression(node, expression, type) { + return node.expression !== expression + || node.type !== type + ? update(createSatisfiesExpression(expression, type), node) + : node; + } + // @api function createNonNullChain(expression) { - var node = createBaseExpression(230 /* SyntaxKind.NonNullExpression */); + var node = createBaseExpression(232 /* SyntaxKind.NonNullExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.transformFlags |= @@ -24788,7 +24964,7 @@ var ts; } // @api function createMetaProperty(keywordToken, name) { - var node = createBaseExpression(231 /* SyntaxKind.MetaProperty */); + var node = createBaseExpression(233 /* SyntaxKind.MetaProperty */); node.keywordToken = keywordToken; node.name = name; node.transformFlags |= propagateChildFlags(node.name); @@ -24815,7 +24991,7 @@ var ts; // // @api function createTemplateSpan(expression, literal) { - var node = createBaseNode(233 /* SyntaxKind.TemplateSpan */); + var node = createBaseNode(236 /* SyntaxKind.TemplateSpan */); node.expression = expression; node.literal = literal; node.transformFlags |= @@ -24833,7 +25009,7 @@ var ts; } // @api function createSemicolonClassElement() { - var node = createBaseNode(234 /* SyntaxKind.SemicolonClassElement */); + var node = createBaseNode(237 /* SyntaxKind.SemicolonClassElement */); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; return node; } @@ -24842,7 +25018,7 @@ var ts; // // @api function createBlock(statements, multiLine) { - var node = createBaseNode(235 /* SyntaxKind.Block */); + var node = createBaseNode(238 /* SyntaxKind.Block */); node.statements = createNodeArray(statements); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.statements); @@ -24856,7 +25032,7 @@ var ts; } // @api function createVariableStatement(modifiers, declarationList) { - var node = createBaseDeclaration(237 /* SyntaxKind.VariableStatement */); + var node = createBaseDeclaration(240 /* SyntaxKind.VariableStatement */); node.modifiers = asNodeArray(modifiers); node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; node.transformFlags |= @@ -24876,11 +25052,11 @@ var ts; } // @api function createEmptyStatement() { - return createBaseNode(236 /* SyntaxKind.EmptyStatement */); + return createBaseNode(239 /* SyntaxKind.EmptyStatement */); } // @api function createExpressionStatement(expression) { - var node = createBaseNode(238 /* SyntaxKind.ExpressionStatement */); + var node = createBaseNode(241 /* SyntaxKind.ExpressionStatement */); node.expression = parenthesizerRules().parenthesizeExpressionOfExpressionStatement(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24893,7 +25069,7 @@ var ts; } // @api function createIfStatement(expression, thenStatement, elseStatement) { - var node = createBaseNode(239 /* SyntaxKind.IfStatement */); + var node = createBaseNode(242 /* SyntaxKind.IfStatement */); node.expression = expression; node.thenStatement = asEmbeddedStatement(thenStatement); node.elseStatement = asEmbeddedStatement(elseStatement); @@ -24913,7 +25089,7 @@ var ts; } // @api function createDoStatement(statement, expression) { - var node = createBaseNode(240 /* SyntaxKind.DoStatement */); + var node = createBaseNode(243 /* SyntaxKind.DoStatement */); node.statement = asEmbeddedStatement(statement); node.expression = expression; node.transformFlags |= @@ -24930,7 +25106,7 @@ var ts; } // @api function createWhileStatement(expression, statement) { - var node = createBaseNode(241 /* SyntaxKind.WhileStatement */); + var node = createBaseNode(244 /* SyntaxKind.WhileStatement */); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -24947,7 +25123,7 @@ var ts; } // @api function createForStatement(initializer, condition, incrementor, statement) { - var node = createBaseNode(242 /* SyntaxKind.ForStatement */); + var node = createBaseNode(245 /* SyntaxKind.ForStatement */); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -24970,7 +25146,7 @@ var ts; } // @api function createForInStatement(initializer, expression, statement) { - var node = createBaseNode(243 /* SyntaxKind.ForInStatement */); + var node = createBaseNode(246 /* SyntaxKind.ForInStatement */); node.initializer = initializer; node.expression = expression; node.statement = asEmbeddedStatement(statement); @@ -24990,7 +25166,7 @@ var ts; } // @api function createForOfStatement(awaitModifier, initializer, expression, statement) { - var node = createBaseNode(244 /* SyntaxKind.ForOfStatement */); + var node = createBaseNode(247 /* SyntaxKind.ForOfStatement */); node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); @@ -25016,7 +25192,7 @@ var ts; } // @api function createContinueStatement(label) { - var node = createBaseNode(245 /* SyntaxKind.ContinueStatement */); + var node = createBaseNode(248 /* SyntaxKind.ContinueStatement */); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | @@ -25031,7 +25207,7 @@ var ts; } // @api function createBreakStatement(label) { - var node = createBaseNode(246 /* SyntaxKind.BreakStatement */); + var node = createBaseNode(249 /* SyntaxKind.BreakStatement */); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | @@ -25046,7 +25222,7 @@ var ts; } // @api function createReturnStatement(expression) { - var node = createBaseNode(247 /* SyntaxKind.ReturnStatement */); + var node = createBaseNode(250 /* SyntaxKind.ReturnStatement */); node.expression = expression; // return in an ES2018 async generator must be awaited node.transformFlags |= @@ -25063,7 +25239,7 @@ var ts; } // @api function createWithStatement(expression, statement) { - var node = createBaseNode(248 /* SyntaxKind.WithStatement */); + var node = createBaseNode(251 /* SyntaxKind.WithStatement */); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -25080,7 +25256,7 @@ var ts; } // @api function createSwitchStatement(expression, caseBlock) { - var node = createBaseNode(249 /* SyntaxKind.SwitchStatement */); + var node = createBaseNode(252 /* SyntaxKind.SwitchStatement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.caseBlock = caseBlock; node.transformFlags |= @@ -25097,7 +25273,7 @@ var ts; } // @api function createLabeledStatement(label, statement) { - var node = createBaseNode(250 /* SyntaxKind.LabeledStatement */); + var node = createBaseNode(253 /* SyntaxKind.LabeledStatement */); node.label = asName(label); node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -25114,7 +25290,7 @@ var ts; } // @api function createThrowStatement(expression) { - var node = createBaseNode(251 /* SyntaxKind.ThrowStatement */); + var node = createBaseNode(254 /* SyntaxKind.ThrowStatement */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -25127,7 +25303,7 @@ var ts; } // @api function createTryStatement(tryBlock, catchClause, finallyBlock) { - var node = createBaseNode(252 /* SyntaxKind.TryStatement */); + var node = createBaseNode(255 /* SyntaxKind.TryStatement */); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -25147,11 +25323,11 @@ var ts; } // @api function createDebuggerStatement() { - return createBaseNode(253 /* SyntaxKind.DebuggerStatement */); + return createBaseNode(256 /* SyntaxKind.DebuggerStatement */); } // @api function createVariableDeclaration(name, exclamationToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(254 /* SyntaxKind.VariableDeclaration */, + var node = createBaseVariableLikeDeclaration(257 /* SyntaxKind.VariableDeclaration */, /*modifiers*/ undefined, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.exclamationToken = exclamationToken; node.transformFlags |= propagateChildFlags(node.exclamationToken); @@ -25172,7 +25348,7 @@ var ts; // @api function createVariableDeclarationList(declarations, flags) { if (flags === void 0) { flags = 0 /* NodeFlags.None */; } - var node = createBaseNode(255 /* SyntaxKind.VariableDeclarationList */); + var node = createBaseNode(258 /* SyntaxKind.VariableDeclarationList */); node.flags |= flags & 3 /* NodeFlags.BlockScoped */; node.declarations = createNodeArray(declarations); node.transformFlags |= @@ -25193,7 +25369,7 @@ var ts; } // @api function createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(256 /* SyntaxKind.FunctionDeclaration */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(259 /* SyntaxKind.FunctionDeclaration */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; if (!node.body || ts.modifiersToFlags(node.modifiers) & 2 /* ModifierFlags.Ambient */) { node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -25202,7 +25378,7 @@ var ts; node.transformFlags |= propagateChildFlags(node.asteriskToken) | 4194304 /* TransformFlags.ContainsHoistedDeclarationOrCompletion */; - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (node.asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -25239,7 +25415,7 @@ var ts; } // @api function createClassDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseClassLikeDeclaration(257 /* SyntaxKind.ClassDeclaration */, modifiers, name, typeParameters, heritageClauses, members); + var node = createBaseClassLikeDeclaration(260 /* SyntaxKind.ClassDeclaration */, modifiers, name, typeParameters, heritageClauses, members); if (ts.modifiersToFlags(node.modifiers) & 2 /* ModifierFlags.Ambient */) { node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; } @@ -25263,7 +25439,7 @@ var ts; } // @api function createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseInterfaceOrClassLikeDeclaration(258 /* SyntaxKind.InterfaceDeclaration */, modifiers, name, typeParameters, heritageClauses); + var node = createBaseInterfaceOrClassLikeDeclaration(261 /* SyntaxKind.InterfaceDeclaration */, modifiers, name, typeParameters, heritageClauses); node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25288,7 +25464,7 @@ var ts; } // @api function createTypeAliasDeclaration(modifiers, name, typeParameters, type) { - var node = createBaseGenericNamedDeclaration(259 /* SyntaxKind.TypeAliasDeclaration */, modifiers, name, typeParameters); + var node = createBaseGenericNamedDeclaration(262 /* SyntaxKind.TypeAliasDeclaration */, modifiers, name, typeParameters); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25312,7 +25488,7 @@ var ts; } // @api function createEnumDeclaration(modifiers, name, members) { - var node = createBaseNamedDeclaration(260 /* SyntaxKind.EnumDeclaration */, modifiers, name); + var node = createBaseNamedDeclaration(263 /* SyntaxKind.EnumDeclaration */, modifiers, name); node.members = createNodeArray(members); node.transformFlags |= propagateChildrenFlags(node.members) | @@ -25339,7 +25515,7 @@ var ts; // @api function createModuleDeclaration(modifiers, name, body, flags) { if (flags === void 0) { flags = 0 /* NodeFlags.None */; } - var node = createBaseDeclaration(261 /* SyntaxKind.ModuleDeclaration */); + var node = createBaseDeclaration(264 /* SyntaxKind.ModuleDeclaration */); node.modifiers = asNodeArray(modifiers); node.flags |= flags & (16 /* NodeFlags.Namespace */ | 4 /* NodeFlags.NestedNamespace */ | 1024 /* NodeFlags.GlobalAugmentation */); node.name = name; @@ -25375,7 +25551,7 @@ var ts; } // @api function createModuleBlock(statements) { - var node = createBaseNode(262 /* SyntaxKind.ModuleBlock */); + var node = createBaseNode(265 /* SyntaxKind.ModuleBlock */); node.statements = createNodeArray(statements); node.transformFlags |= propagateChildrenFlags(node.statements); return node; @@ -25388,7 +25564,7 @@ var ts; } // @api function createCaseBlock(clauses) { - var node = createBaseNode(263 /* SyntaxKind.CaseBlock */); + var node = createBaseNode(266 /* SyntaxKind.CaseBlock */); node.clauses = createNodeArray(clauses); node.transformFlags |= propagateChildrenFlags(node.clauses); return node; @@ -25401,7 +25577,7 @@ var ts; } // @api function createNamespaceExportDeclaration(name) { - var node = createBaseNamedDeclaration(264 /* SyntaxKind.NamespaceExportDeclaration */, + var node = createBaseNamedDeclaration(267 /* SyntaxKind.NamespaceExportDeclaration */, /*modifiers*/ undefined, name); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25424,7 +25600,7 @@ var ts; } // @api function createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference) { - var node = createBaseNamedDeclaration(265 /* SyntaxKind.ImportEqualsDeclaration */, modifiers, name); + var node = createBaseNamedDeclaration(268 /* SyntaxKind.ImportEqualsDeclaration */, modifiers, name); node.isTypeOnly = isTypeOnly; node.moduleReference = moduleReference; node.transformFlags |= propagateChildFlags(node.moduleReference); @@ -25452,7 +25628,7 @@ var ts; } // @api function createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause) { - var node = createBaseDeclaration(266 /* SyntaxKind.ImportDeclaration */); + var node = createBaseDeclaration(269 /* SyntaxKind.ImportDeclaration */); node.modifiers = asNodeArray(modifiers); node.importClause = importClause; node.moduleSpecifier = moduleSpecifier; @@ -25482,7 +25658,7 @@ var ts; } // @api function createImportClause(isTypeOnly, name, namedBindings) { - var node = createBaseNode(267 /* SyntaxKind.ImportClause */); + var node = createBaseNode(270 /* SyntaxKind.ImportClause */); node.isTypeOnly = isTypeOnly; node.name = name; node.namedBindings = namedBindings; @@ -25505,7 +25681,7 @@ var ts; } // @api function createAssertClause(elements, multiLine) { - var node = createBaseNode(293 /* SyntaxKind.AssertClause */); + var node = createBaseNode(296 /* SyntaxKind.AssertClause */); node.elements = createNodeArray(elements); node.multiLine = multiLine; node.transformFlags |= 4 /* TransformFlags.ContainsESNext */; @@ -25520,7 +25696,7 @@ var ts; } // @api function createAssertEntry(name, value) { - var node = createBaseNode(294 /* SyntaxKind.AssertEntry */); + var node = createBaseNode(297 /* SyntaxKind.AssertEntry */); node.name = name; node.value = value; node.transformFlags |= 4 /* TransformFlags.ContainsESNext */; @@ -25535,7 +25711,7 @@ var ts; } // @api function createImportTypeAssertionContainer(clause, multiLine) { - var node = createBaseNode(295 /* SyntaxKind.ImportTypeAssertionContainer */); + var node = createBaseNode(298 /* SyntaxKind.ImportTypeAssertionContainer */); node.assertClause = clause; node.multiLine = multiLine; return node; @@ -25549,7 +25725,7 @@ var ts; } // @api function createNamespaceImport(name) { - var node = createBaseNode(268 /* SyntaxKind.NamespaceImport */); + var node = createBaseNode(271 /* SyntaxKind.NamespaceImport */); node.name = name; node.transformFlags |= propagateChildFlags(node.name); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25563,7 +25739,7 @@ var ts; } // @api function createNamespaceExport(name) { - var node = createBaseNode(274 /* SyntaxKind.NamespaceExport */); + var node = createBaseNode(277 /* SyntaxKind.NamespaceExport */); node.name = name; node.transformFlags |= propagateChildFlags(node.name) | @@ -25579,7 +25755,7 @@ var ts; } // @api function createNamedImports(elements) { - var node = createBaseNode(269 /* SyntaxKind.NamedImports */); + var node = createBaseNode(272 /* SyntaxKind.NamedImports */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25593,7 +25769,7 @@ var ts; } // @api function createImportSpecifier(isTypeOnly, propertyName, name) { - var node = createBaseNode(270 /* SyntaxKind.ImportSpecifier */); + var node = createBaseNode(273 /* SyntaxKind.ImportSpecifier */); node.isTypeOnly = isTypeOnly; node.propertyName = propertyName; node.name = name; @@ -25613,7 +25789,7 @@ var ts; } // @api function createExportAssignment(modifiers, isExportEquals, expression) { - var node = createBaseDeclaration(271 /* SyntaxKind.ExportAssignment */); + var node = createBaseDeclaration(274 /* SyntaxKind.ExportAssignment */); node.modifiers = asNodeArray(modifiers); node.isExportEquals = isExportEquals; node.expression = isExportEquals @@ -25640,7 +25816,7 @@ var ts; } // @api function createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause) { - var node = createBaseDeclaration(272 /* SyntaxKind.ExportDeclaration */); + var node = createBaseDeclaration(275 /* SyntaxKind.ExportDeclaration */); node.modifiers = asNodeArray(modifiers); node.isTypeOnly = isTypeOnly; node.exportClause = exportClause; @@ -25673,7 +25849,7 @@ var ts; } // @api function createNamedExports(elements) { - var node = createBaseNode(273 /* SyntaxKind.NamedExports */); + var node = createBaseNode(276 /* SyntaxKind.NamedExports */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25687,7 +25863,7 @@ var ts; } // @api function createExportSpecifier(isTypeOnly, propertyName, name) { - var node = createBaseNode(275 /* SyntaxKind.ExportSpecifier */); + var node = createBaseNode(278 /* SyntaxKind.ExportSpecifier */); node.isTypeOnly = isTypeOnly; node.propertyName = asName(propertyName); node.name = asName(name); @@ -25707,7 +25883,7 @@ var ts; } // @api function createMissingDeclaration() { - var node = createBaseDeclaration(276 /* SyntaxKind.MissingDeclaration */); + var node = createBaseDeclaration(279 /* SyntaxKind.MissingDeclaration */); return node; } // @@ -25715,7 +25891,7 @@ var ts; // // @api function createExternalModuleReference(expression) { - var node = createBaseNode(277 /* SyntaxKind.ExternalModuleReference */); + var node = createBaseNode(280 /* SyntaxKind.ExternalModuleReference */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25773,7 +25949,7 @@ var ts; } // @api function createJSDocFunctionType(parameters, type) { - var node = createBaseSignatureDeclaration(317 /* SyntaxKind.JSDocFunctionType */, + var node = createBaseSignatureDeclaration(320 /* SyntaxKind.JSDocFunctionType */, /*modifiers*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined, parameters, type); @@ -25789,7 +25965,7 @@ var ts; // @api function createJSDocTypeLiteral(propertyTags, isArrayType) { if (isArrayType === void 0) { isArrayType = false; } - var node = createBaseNode(322 /* SyntaxKind.JSDocTypeLiteral */); + var node = createBaseNode(325 /* SyntaxKind.JSDocTypeLiteral */); node.jsDocPropertyTags = asNodeArray(propertyTags); node.isArrayType = isArrayType; return node; @@ -25803,7 +25979,7 @@ var ts; } // @api function createJSDocTypeExpression(type) { - var node = createBaseNode(309 /* SyntaxKind.JSDocTypeExpression */); + var node = createBaseNode(312 /* SyntaxKind.JSDocTypeExpression */); node.type = type; return node; } @@ -25815,7 +25991,7 @@ var ts; } // @api function createJSDocSignature(typeParameters, parameters, type) { - var node = createBaseNode(323 /* SyntaxKind.JSDocSignature */); + var node = createBaseNode(326 /* SyntaxKind.JSDocSignature */); node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; @@ -25844,7 +26020,7 @@ var ts; } // @api function createJSDocTemplateTag(tagName, constraint, typeParameters, comment) { - var node = createBaseJSDocTag(344 /* SyntaxKind.JSDocTemplateTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); + var node = createBaseJSDocTag(347 /* SyntaxKind.JSDocTemplateTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); node.constraint = constraint; node.typeParameters = createNodeArray(typeParameters); return node; @@ -25861,7 +26037,7 @@ var ts; } // @api function createJSDocTypedefTag(tagName, typeExpression, fullName, comment) { - var node = createBaseJSDocTag(345 /* SyntaxKind.JSDocTypedefTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); + var node = createBaseJSDocTag(348 /* SyntaxKind.JSDocTypedefTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = ts.getJSDocTypeAliasName(fullName); @@ -25879,7 +26055,7 @@ var ts; } // @api function createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - var node = createBaseJSDocTag(340 /* SyntaxKind.JSDocParameterTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); + var node = createBaseJSDocTag(343 /* SyntaxKind.JSDocParameterTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -25900,7 +26076,7 @@ var ts; } // @api function createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - var node = createBaseJSDocTag(347 /* SyntaxKind.JSDocPropertyTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); + var node = createBaseJSDocTag(350 /* SyntaxKind.JSDocPropertyTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -25921,7 +26097,7 @@ var ts; } // @api function createJSDocCallbackTag(tagName, typeExpression, fullName, comment) { - var node = createBaseJSDocTag(338 /* SyntaxKind.JSDocCallbackTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); + var node = createBaseJSDocTag(341 /* SyntaxKind.JSDocCallbackTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = ts.getJSDocTypeAliasName(fullName); @@ -25939,7 +26115,7 @@ var ts; } // @api function createJSDocAugmentsTag(tagName, className, comment) { - var node = createBaseJSDocTag(328 /* SyntaxKind.JSDocAugmentsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); + var node = createBaseJSDocTag(331 /* SyntaxKind.JSDocAugmentsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); node.class = className; return node; } @@ -25954,13 +26130,13 @@ var ts; } // @api function createJSDocImplementsTag(tagName, className, comment) { - var node = createBaseJSDocTag(329 /* SyntaxKind.JSDocImplementsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); + var node = createBaseJSDocTag(332 /* SyntaxKind.JSDocImplementsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); node.class = className; return node; } // @api function createJSDocSeeTag(tagName, name, comment) { - var node = createBaseJSDocTag(346 /* SyntaxKind.JSDocSeeTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); + var node = createBaseJSDocTag(349 /* SyntaxKind.JSDocSeeTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); node.name = name; return node; } @@ -25974,7 +26150,7 @@ var ts; } // @api function createJSDocNameReference(name) { - var node = createBaseNode(310 /* SyntaxKind.JSDocNameReference */); + var node = createBaseNode(313 /* SyntaxKind.JSDocNameReference */); node.name = name; return node; } @@ -25986,7 +26162,7 @@ var ts; } // @api function createJSDocMemberName(left, right) { - var node = createBaseNode(311 /* SyntaxKind.JSDocMemberName */); + var node = createBaseNode(314 /* SyntaxKind.JSDocMemberName */); node.left = left; node.right = right; node.transformFlags |= @@ -26003,7 +26179,7 @@ var ts; } // @api function createJSDocLink(name, text) { - var node = createBaseNode(324 /* SyntaxKind.JSDocLink */); + var node = createBaseNode(327 /* SyntaxKind.JSDocLink */); node.name = name; node.text = text; return node; @@ -26016,7 +26192,7 @@ var ts; } // @api function createJSDocLinkCode(name, text) { - var node = createBaseNode(325 /* SyntaxKind.JSDocLinkCode */); + var node = createBaseNode(328 /* SyntaxKind.JSDocLinkCode */); node.name = name; node.text = text; return node; @@ -26029,7 +26205,7 @@ var ts; } // @api function createJSDocLinkPlain(name, text) { - var node = createBaseNode(326 /* SyntaxKind.JSDocLinkPlain */); + var node = createBaseNode(329 /* SyntaxKind.JSDocLinkPlain */); node.name = name; node.text = text; return node; @@ -26101,7 +26277,7 @@ var ts; } // @api function createJSDocUnknownTag(tagName, comment) { - var node = createBaseJSDocTag(327 /* SyntaxKind.JSDocTag */, tagName, comment); + var node = createBaseJSDocTag(330 /* SyntaxKind.JSDocTag */, tagName, comment); return node; } // @api @@ -26113,7 +26289,7 @@ var ts; } // @api function createJSDocText(text) { - var node = createBaseNode(321 /* SyntaxKind.JSDocText */); + var node = createBaseNode(324 /* SyntaxKind.JSDocText */); node.text = text; return node; } @@ -26125,7 +26301,7 @@ var ts; } // @api function createJSDocComment(comment, tags) { - var node = createBaseNode(320 /* SyntaxKind.JSDoc */); + var node = createBaseNode(323 /* SyntaxKind.JSDoc */); node.comment = comment; node.tags = asNodeArray(tags); return node; @@ -26142,7 +26318,7 @@ var ts; // // @api function createJsxElement(openingElement, children, closingElement) { - var node = createBaseNode(278 /* SyntaxKind.JsxElement */); + var node = createBaseNode(281 /* SyntaxKind.JsxElement */); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -26163,7 +26339,7 @@ var ts; } // @api function createJsxSelfClosingElement(tagName, typeArguments, attributes) { - var node = createBaseNode(279 /* SyntaxKind.JsxSelfClosingElement */); + var node = createBaseNode(282 /* SyntaxKind.JsxSelfClosingElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -26187,7 +26363,7 @@ var ts; } // @api function createJsxOpeningElement(tagName, typeArguments, attributes) { - var node = createBaseNode(280 /* SyntaxKind.JsxOpeningElement */); + var node = createBaseNode(283 /* SyntaxKind.JsxOpeningElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -26211,7 +26387,7 @@ var ts; } // @api function createJsxClosingElement(tagName) { - var node = createBaseNode(281 /* SyntaxKind.JsxClosingElement */); + var node = createBaseNode(284 /* SyntaxKind.JsxClosingElement */); node.tagName = tagName; node.transformFlags |= propagateChildFlags(node.tagName) | @@ -26226,7 +26402,7 @@ var ts; } // @api function createJsxFragment(openingFragment, children, closingFragment) { - var node = createBaseNode(282 /* SyntaxKind.JsxFragment */); + var node = createBaseNode(285 /* SyntaxKind.JsxFragment */); node.openingFragment = openingFragment; node.children = createNodeArray(children); node.closingFragment = closingFragment; @@ -26262,19 +26438,19 @@ var ts; } // @api function createJsxOpeningFragment() { - var node = createBaseNode(283 /* SyntaxKind.JsxOpeningFragment */); + var node = createBaseNode(286 /* SyntaxKind.JsxOpeningFragment */); node.transformFlags |= 2 /* TransformFlags.ContainsJsx */; return node; } // @api function createJsxJsxClosingFragment() { - var node = createBaseNode(284 /* SyntaxKind.JsxClosingFragment */); + var node = createBaseNode(287 /* SyntaxKind.JsxClosingFragment */); node.transformFlags |= 2 /* TransformFlags.ContainsJsx */; return node; } // @api function createJsxAttribute(name, initializer) { - var node = createBaseNode(285 /* SyntaxKind.JsxAttribute */); + var node = createBaseNode(288 /* SyntaxKind.JsxAttribute */); node.name = name; node.initializer = initializer; node.transformFlags |= @@ -26292,7 +26468,7 @@ var ts; } // @api function createJsxAttributes(properties) { - var node = createBaseNode(286 /* SyntaxKind.JsxAttributes */); + var node = createBaseNode(289 /* SyntaxKind.JsxAttributes */); node.properties = createNodeArray(properties); node.transformFlags |= propagateChildrenFlags(node.properties) | @@ -26307,7 +26483,7 @@ var ts; } // @api function createJsxSpreadAttribute(expression) { - var node = createBaseNode(287 /* SyntaxKind.JsxSpreadAttribute */); + var node = createBaseNode(290 /* SyntaxKind.JsxSpreadAttribute */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression) | @@ -26322,7 +26498,7 @@ var ts; } // @api function createJsxExpression(dotDotDotToken, expression) { - var node = createBaseNode(288 /* SyntaxKind.JsxExpression */); + var node = createBaseNode(291 /* SyntaxKind.JsxExpression */); node.dotDotDotToken = dotDotDotToken; node.expression = expression; node.transformFlags |= @@ -26342,7 +26518,7 @@ var ts; // // @api function createCaseClause(expression, statements) { - var node = createBaseNode(289 /* SyntaxKind.CaseClause */); + var node = createBaseNode(292 /* SyntaxKind.CaseClause */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.statements = createNodeArray(statements); node.transformFlags |= @@ -26359,7 +26535,7 @@ var ts; } // @api function createDefaultClause(statements) { - var node = createBaseNode(290 /* SyntaxKind.DefaultClause */); + var node = createBaseNode(293 /* SyntaxKind.DefaultClause */); node.statements = createNodeArray(statements); node.transformFlags = propagateChildrenFlags(node.statements); return node; @@ -26372,7 +26548,7 @@ var ts; } // @api function createHeritageClause(token, types) { - var node = createBaseNode(291 /* SyntaxKind.HeritageClause */); + var node = createBaseNode(294 /* SyntaxKind.HeritageClause */); node.token = token; node.types = createNodeArray(types); node.transformFlags |= propagateChildrenFlags(node.types); @@ -26396,7 +26572,7 @@ var ts; } // @api function createCatchClause(variableDeclaration, block) { - var node = createBaseNode(292 /* SyntaxKind.CatchClause */); + var node = createBaseNode(295 /* SyntaxKind.CatchClause */); if (typeof variableDeclaration === "string" || variableDeclaration && !ts.isVariableDeclaration(variableDeclaration)) { variableDeclaration = createVariableDeclaration(variableDeclaration, /*exclamationToken*/ undefined, @@ -26424,7 +26600,7 @@ var ts; // // @api function createPropertyAssignment(name, initializer) { - var node = createBaseNamedDeclaration(296 /* SyntaxKind.PropertyAssignment */, + var node = createBaseNamedDeclaration(299 /* SyntaxKind.PropertyAssignment */, /*modifiers*/ undefined, name); node.initializer = parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= @@ -26456,7 +26632,7 @@ var ts; } // @api function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - var node = createBaseNamedDeclaration(297 /* SyntaxKind.ShorthandPropertyAssignment */, + var node = createBaseNamedDeclaration(300 /* SyntaxKind.ShorthandPropertyAssignment */, /*modifiers*/ undefined, name); node.objectAssignmentInitializer = objectAssignmentInitializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(objectAssignmentInitializer); node.transformFlags |= @@ -26490,7 +26666,7 @@ var ts; } // @api function createSpreadAssignment(expression) { - var node = createBaseNode(298 /* SyntaxKind.SpreadAssignment */); + var node = createBaseNode(301 /* SyntaxKind.SpreadAssignment */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -26509,7 +26685,7 @@ var ts; // // @api function createEnumMember(name, initializer) { - var node = createBaseNode(299 /* SyntaxKind.EnumMember */); + var node = createBaseNode(302 /* SyntaxKind.EnumMember */); node.name = asName(name); node.initializer = initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= @@ -26530,7 +26706,7 @@ var ts; // // @api function createSourceFile(statements, endOfFileToken, flags) { - var node = baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */); + var node = baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */); node.statements = createNodeArray(statements); node.endOfFileToken = endOfFileToken; node.flags |= flags; @@ -26547,7 +26723,7 @@ var ts; return node; } function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) { - var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */)); + var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */)); for (var p in source) { if (p === "emitNode" || ts.hasProperty(node, p) || !ts.hasProperty(source, p)) continue; @@ -26586,7 +26762,7 @@ var ts; // @api function createBundle(sourceFiles, prepends) { if (prepends === void 0) { prepends = ts.emptyArray; } - var node = createBaseNode(306 /* SyntaxKind.Bundle */); + var node = createBaseNode(309 /* SyntaxKind.Bundle */); node.prepends = prepends; node.sourceFiles = sourceFiles; return node; @@ -26601,7 +26777,7 @@ var ts; } // @api function createUnparsedSource(prologues, syntheticReferences, texts) { - var node = createBaseNode(307 /* SyntaxKind.UnparsedSource */); + var node = createBaseNode(310 /* SyntaxKind.UnparsedSource */); node.prologues = prologues; node.syntheticReferences = syntheticReferences; node.texts = texts; @@ -26619,28 +26795,28 @@ var ts; } // @api function createUnparsedPrologue(data) { - return createBaseUnparsedNode(300 /* SyntaxKind.UnparsedPrologue */, data); + return createBaseUnparsedNode(303 /* SyntaxKind.UnparsedPrologue */, data); } // @api function createUnparsedPrepend(data, texts) { - var node = createBaseUnparsedNode(301 /* SyntaxKind.UnparsedPrepend */, data); + var node = createBaseUnparsedNode(304 /* SyntaxKind.UnparsedPrepend */, data); node.texts = texts; return node; } // @api function createUnparsedTextLike(data, internal) { - return createBaseUnparsedNode(internal ? 303 /* SyntaxKind.UnparsedInternalText */ : 302 /* SyntaxKind.UnparsedText */, data); + return createBaseUnparsedNode(internal ? 306 /* SyntaxKind.UnparsedInternalText */ : 305 /* SyntaxKind.UnparsedText */, data); } // @api function createUnparsedSyntheticReference(section) { - var node = createBaseNode(304 /* SyntaxKind.UnparsedSyntheticReference */); + var node = createBaseNode(307 /* SyntaxKind.UnparsedSyntheticReference */); node.data = section.data; node.section = section; return node; } // @api function createInputFiles() { - var node = createBaseNode(308 /* SyntaxKind.InputFiles */); + var node = createBaseNode(311 /* SyntaxKind.InputFiles */); node.javascriptText = ""; node.declarationText = ""; return node; @@ -26651,7 +26827,7 @@ var ts; // @api function createSyntheticExpression(type, isSpread, tupleNameSource) { if (isSpread === void 0) { isSpread = false; } - var node = createBaseNode(232 /* SyntaxKind.SyntheticExpression */); + var node = createBaseNode(234 /* SyntaxKind.SyntheticExpression */); node.type = type; node.isSpread = isSpread; node.tupleNameSource = tupleNameSource; @@ -26659,7 +26835,7 @@ var ts; } // @api function createSyntaxList(children) { - var node = createBaseNode(348 /* SyntaxKind.SyntaxList */); + var node = createBaseNode(351 /* SyntaxKind.SyntaxList */); node._children = children; return node; } @@ -26674,7 +26850,7 @@ var ts; */ // @api function createNotEmittedStatement(original) { - var node = createBaseNode(349 /* SyntaxKind.NotEmittedStatement */); + var node = createBaseNode(352 /* SyntaxKind.NotEmittedStatement */); node.original = original; ts.setTextRange(node, original); return node; @@ -26688,7 +26864,7 @@ var ts; */ // @api function createPartiallyEmittedExpression(expression, original) { - var node = createBaseNode(350 /* SyntaxKind.PartiallyEmittedExpression */); + var node = createBaseNode(353 /* SyntaxKind.PartiallyEmittedExpression */); node.expression = expression; node.original = original; node.transformFlags |= @@ -26716,7 +26892,7 @@ var ts; } // @api function createCommaListExpression(elements) { - var node = createBaseNode(351 /* SyntaxKind.CommaListExpression */); + var node = createBaseNode(354 /* SyntaxKind.CommaListExpression */); node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)); node.transformFlags |= propagateChildrenFlags(node.elements); return node; @@ -26733,7 +26909,7 @@ var ts; */ // @api function createEndOfDeclarationMarker(original) { - var node = createBaseNode(353 /* SyntaxKind.EndOfDeclarationMarker */); + var node = createBaseNode(356 /* SyntaxKind.EndOfDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -26744,14 +26920,14 @@ var ts; */ // @api function createMergeDeclarationMarker(original) { - var node = createBaseNode(352 /* SyntaxKind.MergeDeclarationMarker */); + var node = createBaseNode(355 /* SyntaxKind.MergeDeclarationMarker */); node.emitNode = {}; node.original = original; return node; } // @api function createSyntheticReferenceExpression(expression, thisArg) { - var node = createBaseNode(354 /* SyntaxKind.SyntheticReferenceExpression */); + var node = createBaseNode(357 /* SyntaxKind.SyntheticReferenceExpression */); node.expression = expression; node.thisArg = thisArg; node.transformFlags |= @@ -26773,7 +26949,7 @@ var ts; if (node === undefined) { return node; } - var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */) : + var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */) : ts.isIdentifier(node) ? baseFactory.createBaseIdentifierNode(79 /* SyntaxKind.Identifier */) : ts.isPrivateIdentifier(node) ? baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */) : !ts.isNodeKind(node.kind) ? baseFactory.createBaseTokenNode(node.kind) : @@ -26782,7 +26958,7 @@ var ts; clone.transformFlags = node.transformFlags; setOriginalNode(clone, node); for (var key in node) { - if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { + if (ts.hasProperty(clone, key) || !ts.hasProperty(node, key)) { continue; } clone[key] = node[key]; @@ -26890,11 +27066,12 @@ var ts; } function updateOuterExpression(outerExpression, expression) { switch (outerExpression.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: return updateParenthesizedExpression(outerExpression, expression); - case 211 /* SyntaxKind.TypeAssertionExpression */: return updateTypeAssertion(outerExpression, outerExpression.type, expression); - case 229 /* SyntaxKind.AsExpression */: return updateAsExpression(outerExpression, expression, outerExpression.type); - case 230 /* SyntaxKind.NonNullExpression */: return updateNonNullExpression(outerExpression, expression); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: return updatePartiallyEmittedExpression(outerExpression, expression); + case 214 /* SyntaxKind.ParenthesizedExpression */: return updateParenthesizedExpression(outerExpression, expression); + case 213 /* SyntaxKind.TypeAssertionExpression */: return updateTypeAssertion(outerExpression, outerExpression.type, expression); + case 231 /* SyntaxKind.AsExpression */: return updateAsExpression(outerExpression, expression, outerExpression.type); + case 235 /* SyntaxKind.SatisfiesExpression */: return updateSatisfiesExpression(outerExpression, expression, outerExpression.type); + case 232 /* SyntaxKind.NonNullExpression */: return updateNonNullExpression(outerExpression, expression); + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return updatePartiallyEmittedExpression(outerExpression, expression); } } /** @@ -26948,13 +27125,13 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: return false; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return target.properties.length > 0; default: return true; @@ -27380,24 +27557,24 @@ var ts; } function getDefaultTagNameForKind(kind) { switch (kind) { - case 343 /* SyntaxKind.JSDocTypeTag */: return "type"; - case 341 /* SyntaxKind.JSDocReturnTag */: return "returns"; - case 342 /* SyntaxKind.JSDocThisTag */: return "this"; - case 339 /* SyntaxKind.JSDocEnumTag */: return "enum"; - case 330 /* SyntaxKind.JSDocAuthorTag */: return "author"; - case 332 /* SyntaxKind.JSDocClassTag */: return "class"; - case 333 /* SyntaxKind.JSDocPublicTag */: return "public"; - case 334 /* SyntaxKind.JSDocPrivateTag */: return "private"; - case 335 /* SyntaxKind.JSDocProtectedTag */: return "protected"; - case 336 /* SyntaxKind.JSDocReadonlyTag */: return "readonly"; - case 337 /* SyntaxKind.JSDocOverrideTag */: return "override"; - case 344 /* SyntaxKind.JSDocTemplateTag */: return "template"; - case 345 /* SyntaxKind.JSDocTypedefTag */: return "typedef"; - case 340 /* SyntaxKind.JSDocParameterTag */: return "param"; - case 347 /* SyntaxKind.JSDocPropertyTag */: return "prop"; - case 338 /* SyntaxKind.JSDocCallbackTag */: return "callback"; - case 328 /* SyntaxKind.JSDocAugmentsTag */: return "augments"; - case 329 /* SyntaxKind.JSDocImplementsTag */: return "implements"; + case 346 /* SyntaxKind.JSDocTypeTag */: return "type"; + case 344 /* SyntaxKind.JSDocReturnTag */: return "returns"; + case 345 /* SyntaxKind.JSDocThisTag */: return "this"; + case 342 /* SyntaxKind.JSDocEnumTag */: return "enum"; + case 333 /* SyntaxKind.JSDocAuthorTag */: return "author"; + case 335 /* SyntaxKind.JSDocClassTag */: return "class"; + case 336 /* SyntaxKind.JSDocPublicTag */: return "public"; + case 337 /* SyntaxKind.JSDocPrivateTag */: return "private"; + case 338 /* SyntaxKind.JSDocProtectedTag */: return "protected"; + case 339 /* SyntaxKind.JSDocReadonlyTag */: return "readonly"; + case 340 /* SyntaxKind.JSDocOverrideTag */: return "override"; + case 347 /* SyntaxKind.JSDocTemplateTag */: return "template"; + case 348 /* SyntaxKind.JSDocTypedefTag */: return "typedef"; + case 343 /* SyntaxKind.JSDocParameterTag */: return "param"; + case 350 /* SyntaxKind.JSDocPropertyTag */: return "prop"; + case 341 /* SyntaxKind.JSDocCallbackTag */: return "callback"; + case 331 /* SyntaxKind.JSDocAugmentsTag */: return "augments"; + case 332 /* SyntaxKind.JSDocImplementsTag */: return "implements"; default: return ts.Debug.fail("Unsupported kind: ".concat(ts.Debug.formatSyntaxKind(kind))); } @@ -27477,69 +27654,70 @@ var ts; */ /* @internal */ function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 177 /* SyntaxKind.FirstTypeNode */ && kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (kind >= 179 /* SyntaxKind.FirstTypeNode */ && kind <= 202 /* SyntaxKind.LastTypeNode */) { return -2 /* TransformFlags.TypeExcludes */; } switch (kind) { - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return -2147450880 /* TransformFlags.ArrayLiteralOrCallOrNewExcludes */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return -1941676032 /* TransformFlags.ModuleExcludes */; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return -2147483648 /* TransformFlags.ParameterExcludes */; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return -2072174592 /* TransformFlags.ArrowFunctionExcludes */; - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return -1937940480 /* TransformFlags.FunctionExcludes */; - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return -2146893824 /* TransformFlags.VariableDeclarationListExcludes */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return -2147344384 /* TransformFlags.ClassExcludes */; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return -1937948672 /* TransformFlags.ConstructorExcludes */; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return -2013249536 /* TransformFlags.PropertyExcludes */; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return -2005057536 /* TransformFlags.MethodOrAccessorExcludes */; - case 130 /* SyntaxKind.AnyKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 163 /* SyntaxKind.TypeParameter */: - case 166 /* SyntaxKind.PropertySignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: + case 168 /* SyntaxKind.PropertySignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return -2 /* TransformFlags.TypeExcludes */; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return -2147278848 /* TransformFlags.ObjectLiteralExcludes */; - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return -2147418112 /* TransformFlags.CatchClauseExcludes */; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return -2147450880 /* TransformFlags.BindingPatternExcludes */; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: case 106 /* SyntaxKind.SuperKeyword */: return -2147483648 /* TransformFlags.OuterExpressionExcludes */; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return -2147483648 /* TransformFlags.PropertyAccessExcludes */; default: return -2147483648 /* TransformFlags.NodeExcludes */; @@ -27739,9 +27917,10 @@ var ts; }; var buildInfo_1; var getAndCacheBuildInfo_1 = function (getText) { + var _a; if (buildInfo_1 === undefined) { var result = getText(); - buildInfo_1 = result !== undefined ? ts.getBuildInfo(result) : false; + buildInfo_1 = result !== undefined ? (_a = ts.getBuildInfo(node.buildInfoPath, result)) !== null && _a !== void 0 ? _a : false : false; } return buildInfo_1 || undefined; }; @@ -27795,7 +27974,7 @@ var ts; } ts.setOriginalNode = setOriginalNode; function mergeEmitNode(sourceEmitNode, destEmitNode) { - var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine; + var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine, snippetElement = sourceEmitNode.snippetElement; if (!destEmitNode) destEmitNode = {}; // We are using `.slice()` here in case `destEmitNode.leadingComments` is pushed to later. @@ -27821,6 +28000,8 @@ var ts; } if (startsOnNewLine !== undefined) destEmitNode.startsOnNewLine = startsOnNewLine; + if (snippetElement !== undefined) + destEmitNode.snippetElement = snippetElement; return destEmitNode; } function mergeTokenSourceMapRanges(sourceRanges, destRanges) { @@ -27846,7 +28027,7 @@ var ts; // To avoid holding onto transformation artifacts, we keep track of any // parse tree node we are annotating. This allows us to clean them up after // all transformations have completed. - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = (_a = ts.getSourceFileOfNode(ts.getParseTreeNode(ts.getSourceFileOfNode(node)))) !== null && _a !== void 0 ? _a : ts.Debug.fail("Could not determine parsed source file."); @@ -28924,22 +29105,22 @@ var ts; ts.isExportModifier = isExportModifier; /* @internal */ function isAsyncModifier(node) { - return node.kind === 131 /* SyntaxKind.AsyncKeyword */; + return node.kind === 132 /* SyntaxKind.AsyncKeyword */; } ts.isAsyncModifier = isAsyncModifier; /* @internal */ function isAssertsKeyword(node) { - return node.kind === 128 /* SyntaxKind.AssertsKeyword */; + return node.kind === 129 /* SyntaxKind.AssertsKeyword */; } ts.isAssertsKeyword = isAssertsKeyword; /* @internal */ function isAwaitKeyword(node) { - return node.kind === 132 /* SyntaxKind.AwaitKeyword */; + return node.kind === 133 /* SyntaxKind.AwaitKeyword */; } ts.isAwaitKeyword = isAwaitKeyword; /* @internal */ function isReadonlyKeyword(node) { - return node.kind === 145 /* SyntaxKind.ReadonlyKeyword */; + return node.kind === 146 /* SyntaxKind.ReadonlyKeyword */; } ts.isReadonlyKeyword = isReadonlyKeyword; /* @internal */ @@ -28954,9 +29135,14 @@ var ts; ts.isAbstractModifier = isAbstractModifier; /* @internal */ function isOverrideModifier(node) { - return node.kind === 159 /* SyntaxKind.OverrideKeyword */; + return node.kind === 161 /* SyntaxKind.OverrideKeyword */; } ts.isOverrideModifier = isOverrideModifier; + /* @internal */ + function isAccessorModifier(node) { + return node.kind === 127 /* SyntaxKind.AccessorKeyword */; + } + ts.isAccessorModifier = isAccessorModifier; /*@internal*/ function isSuperKeyword(node) { return node.kind === 106 /* SyntaxKind.SuperKeyword */; @@ -28969,605 +29155,609 @@ var ts; ts.isImportKeyword = isImportKeyword; // Names function isQualifiedName(node) { - return node.kind === 161 /* SyntaxKind.QualifiedName */; + return node.kind === 163 /* SyntaxKind.QualifiedName */; } ts.isQualifiedName = isQualifiedName; function isComputedPropertyName(node) { - return node.kind === 162 /* SyntaxKind.ComputedPropertyName */; + return node.kind === 164 /* SyntaxKind.ComputedPropertyName */; } ts.isComputedPropertyName = isComputedPropertyName; // Signature elements function isTypeParameterDeclaration(node) { - return node.kind === 163 /* SyntaxKind.TypeParameter */; + return node.kind === 165 /* SyntaxKind.TypeParameter */; } ts.isTypeParameterDeclaration = isTypeParameterDeclaration; // TODO(rbuckton): Rename to 'isParameterDeclaration' function isParameter(node) { - return node.kind === 164 /* SyntaxKind.Parameter */; + return node.kind === 166 /* SyntaxKind.Parameter */; } ts.isParameter = isParameter; function isDecorator(node) { - return node.kind === 165 /* SyntaxKind.Decorator */; + return node.kind === 167 /* SyntaxKind.Decorator */; } ts.isDecorator = isDecorator; // TypeMember function isPropertySignature(node) { - return node.kind === 166 /* SyntaxKind.PropertySignature */; + return node.kind === 168 /* SyntaxKind.PropertySignature */; } ts.isPropertySignature = isPropertySignature; function isPropertyDeclaration(node) { - return node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + return node.kind === 169 /* SyntaxKind.PropertyDeclaration */; } ts.isPropertyDeclaration = isPropertyDeclaration; function isMethodSignature(node) { - return node.kind === 168 /* SyntaxKind.MethodSignature */; + return node.kind === 170 /* SyntaxKind.MethodSignature */; } ts.isMethodSignature = isMethodSignature; function isMethodDeclaration(node) { - return node.kind === 169 /* SyntaxKind.MethodDeclaration */; + return node.kind === 171 /* SyntaxKind.MethodDeclaration */; } ts.isMethodDeclaration = isMethodDeclaration; function isClassStaticBlockDeclaration(node) { - return node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + return node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; } ts.isClassStaticBlockDeclaration = isClassStaticBlockDeclaration; function isConstructorDeclaration(node) { - return node.kind === 171 /* SyntaxKind.Constructor */; + return node.kind === 173 /* SyntaxKind.Constructor */; } ts.isConstructorDeclaration = isConstructorDeclaration; function isGetAccessorDeclaration(node) { - return node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetAccessorDeclaration = isGetAccessorDeclaration; function isSetAccessorDeclaration(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */; } ts.isSetAccessorDeclaration = isSetAccessorDeclaration; function isCallSignatureDeclaration(node) { - return node.kind === 174 /* SyntaxKind.CallSignature */; + return node.kind === 176 /* SyntaxKind.CallSignature */; } ts.isCallSignatureDeclaration = isCallSignatureDeclaration; function isConstructSignatureDeclaration(node) { - return node.kind === 175 /* SyntaxKind.ConstructSignature */; + return node.kind === 177 /* SyntaxKind.ConstructSignature */; } ts.isConstructSignatureDeclaration = isConstructSignatureDeclaration; function isIndexSignatureDeclaration(node) { - return node.kind === 176 /* SyntaxKind.IndexSignature */; + return node.kind === 178 /* SyntaxKind.IndexSignature */; } ts.isIndexSignatureDeclaration = isIndexSignatureDeclaration; // Type function isTypePredicateNode(node) { - return node.kind === 177 /* SyntaxKind.TypePredicate */; + return node.kind === 179 /* SyntaxKind.TypePredicate */; } ts.isTypePredicateNode = isTypePredicateNode; function isTypeReferenceNode(node) { - return node.kind === 178 /* SyntaxKind.TypeReference */; + return node.kind === 180 /* SyntaxKind.TypeReference */; } ts.isTypeReferenceNode = isTypeReferenceNode; function isFunctionTypeNode(node) { - return node.kind === 179 /* SyntaxKind.FunctionType */; + return node.kind === 181 /* SyntaxKind.FunctionType */; } ts.isFunctionTypeNode = isFunctionTypeNode; function isConstructorTypeNode(node) { - return node.kind === 180 /* SyntaxKind.ConstructorType */; + return node.kind === 182 /* SyntaxKind.ConstructorType */; } ts.isConstructorTypeNode = isConstructorTypeNode; function isTypeQueryNode(node) { - return node.kind === 181 /* SyntaxKind.TypeQuery */; + return node.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isTypeQueryNode = isTypeQueryNode; function isTypeLiteralNode(node) { - return node.kind === 182 /* SyntaxKind.TypeLiteral */; + return node.kind === 184 /* SyntaxKind.TypeLiteral */; } ts.isTypeLiteralNode = isTypeLiteralNode; function isArrayTypeNode(node) { - return node.kind === 183 /* SyntaxKind.ArrayType */; + return node.kind === 185 /* SyntaxKind.ArrayType */; } ts.isArrayTypeNode = isArrayTypeNode; function isTupleTypeNode(node) { - return node.kind === 184 /* SyntaxKind.TupleType */; + return node.kind === 186 /* SyntaxKind.TupleType */; } ts.isTupleTypeNode = isTupleTypeNode; function isNamedTupleMember(node) { - return node.kind === 197 /* SyntaxKind.NamedTupleMember */; + return node.kind === 199 /* SyntaxKind.NamedTupleMember */; } ts.isNamedTupleMember = isNamedTupleMember; function isOptionalTypeNode(node) { - return node.kind === 185 /* SyntaxKind.OptionalType */; + return node.kind === 187 /* SyntaxKind.OptionalType */; } ts.isOptionalTypeNode = isOptionalTypeNode; function isRestTypeNode(node) { - return node.kind === 186 /* SyntaxKind.RestType */; + return node.kind === 188 /* SyntaxKind.RestType */; } ts.isRestTypeNode = isRestTypeNode; function isUnionTypeNode(node) { - return node.kind === 187 /* SyntaxKind.UnionType */; + return node.kind === 189 /* SyntaxKind.UnionType */; } ts.isUnionTypeNode = isUnionTypeNode; function isIntersectionTypeNode(node) { - return node.kind === 188 /* SyntaxKind.IntersectionType */; + return node.kind === 190 /* SyntaxKind.IntersectionType */; } ts.isIntersectionTypeNode = isIntersectionTypeNode; function isConditionalTypeNode(node) { - return node.kind === 189 /* SyntaxKind.ConditionalType */; + return node.kind === 191 /* SyntaxKind.ConditionalType */; } ts.isConditionalTypeNode = isConditionalTypeNode; function isInferTypeNode(node) { - return node.kind === 190 /* SyntaxKind.InferType */; + return node.kind === 192 /* SyntaxKind.InferType */; } ts.isInferTypeNode = isInferTypeNode; function isParenthesizedTypeNode(node) { - return node.kind === 191 /* SyntaxKind.ParenthesizedType */; + return node.kind === 193 /* SyntaxKind.ParenthesizedType */; } ts.isParenthesizedTypeNode = isParenthesizedTypeNode; function isThisTypeNode(node) { - return node.kind === 192 /* SyntaxKind.ThisType */; + return node.kind === 194 /* SyntaxKind.ThisType */; } ts.isThisTypeNode = isThisTypeNode; function isTypeOperatorNode(node) { - return node.kind === 193 /* SyntaxKind.TypeOperator */; + return node.kind === 195 /* SyntaxKind.TypeOperator */; } ts.isTypeOperatorNode = isTypeOperatorNode; function isIndexedAccessTypeNode(node) { - return node.kind === 194 /* SyntaxKind.IndexedAccessType */; + return node.kind === 196 /* SyntaxKind.IndexedAccessType */; } ts.isIndexedAccessTypeNode = isIndexedAccessTypeNode; function isMappedTypeNode(node) { - return node.kind === 195 /* SyntaxKind.MappedType */; + return node.kind === 197 /* SyntaxKind.MappedType */; } ts.isMappedTypeNode = isMappedTypeNode; function isLiteralTypeNode(node) { - return node.kind === 196 /* SyntaxKind.LiteralType */; + return node.kind === 198 /* SyntaxKind.LiteralType */; } ts.isLiteralTypeNode = isLiteralTypeNode; function isImportTypeNode(node) { - return node.kind === 200 /* SyntaxKind.ImportType */; + return node.kind === 202 /* SyntaxKind.ImportType */; } ts.isImportTypeNode = isImportTypeNode; function isTemplateLiteralTypeSpan(node) { - return node.kind === 199 /* SyntaxKind.TemplateLiteralTypeSpan */; + return node.kind === 201 /* SyntaxKind.TemplateLiteralTypeSpan */; } ts.isTemplateLiteralTypeSpan = isTemplateLiteralTypeSpan; function isTemplateLiteralTypeNode(node) { - return node.kind === 198 /* SyntaxKind.TemplateLiteralType */; + return node.kind === 200 /* SyntaxKind.TemplateLiteralType */; } ts.isTemplateLiteralTypeNode = isTemplateLiteralTypeNode; // Binding patterns function isObjectBindingPattern(node) { - return node.kind === 201 /* SyntaxKind.ObjectBindingPattern */; + return node.kind === 203 /* SyntaxKind.ObjectBindingPattern */; } ts.isObjectBindingPattern = isObjectBindingPattern; function isArrayBindingPattern(node) { - return node.kind === 202 /* SyntaxKind.ArrayBindingPattern */; + return node.kind === 204 /* SyntaxKind.ArrayBindingPattern */; } ts.isArrayBindingPattern = isArrayBindingPattern; function isBindingElement(node) { - return node.kind === 203 /* SyntaxKind.BindingElement */; + return node.kind === 205 /* SyntaxKind.BindingElement */; } ts.isBindingElement = isBindingElement; // Expression function isArrayLiteralExpression(node) { - return node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */; + return node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 206 /* SyntaxKind.PropertyAccessExpression */; + return node.kind === 208 /* SyntaxKind.PropertyAccessExpression */; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 207 /* SyntaxKind.ElementAccessExpression */; + return node.kind === 209 /* SyntaxKind.ElementAccessExpression */; } ts.isElementAccessExpression = isElementAccessExpression; function isCallExpression(node) { - return node.kind === 208 /* SyntaxKind.CallExpression */; + return node.kind === 210 /* SyntaxKind.CallExpression */; } ts.isCallExpression = isCallExpression; function isNewExpression(node) { - return node.kind === 209 /* SyntaxKind.NewExpression */; + return node.kind === 211 /* SyntaxKind.NewExpression */; } ts.isNewExpression = isNewExpression; function isTaggedTemplateExpression(node) { - return node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */; + return node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */; } ts.isTaggedTemplateExpression = isTaggedTemplateExpression; function isTypeAssertionExpression(node) { - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */; } ts.isTypeAssertionExpression = isTypeAssertionExpression; function isParenthesizedExpression(node) { - return node.kind === 212 /* SyntaxKind.ParenthesizedExpression */; + return node.kind === 214 /* SyntaxKind.ParenthesizedExpression */; } ts.isParenthesizedExpression = isParenthesizedExpression; function isFunctionExpression(node) { - return node.kind === 213 /* SyntaxKind.FunctionExpression */; + return node.kind === 215 /* SyntaxKind.FunctionExpression */; } ts.isFunctionExpression = isFunctionExpression; function isArrowFunction(node) { - return node.kind === 214 /* SyntaxKind.ArrowFunction */; + return node.kind === 216 /* SyntaxKind.ArrowFunction */; } ts.isArrowFunction = isArrowFunction; function isDeleteExpression(node) { - return node.kind === 215 /* SyntaxKind.DeleteExpression */; + return node.kind === 217 /* SyntaxKind.DeleteExpression */; } ts.isDeleteExpression = isDeleteExpression; function isTypeOfExpression(node) { - return node.kind === 216 /* SyntaxKind.TypeOfExpression */; + return node.kind === 218 /* SyntaxKind.TypeOfExpression */; } ts.isTypeOfExpression = isTypeOfExpression; function isVoidExpression(node) { - return node.kind === 217 /* SyntaxKind.VoidExpression */; + return node.kind === 219 /* SyntaxKind.VoidExpression */; } ts.isVoidExpression = isVoidExpression; function isAwaitExpression(node) { - return node.kind === 218 /* SyntaxKind.AwaitExpression */; + return node.kind === 220 /* SyntaxKind.AwaitExpression */; } ts.isAwaitExpression = isAwaitExpression; function isPrefixUnaryExpression(node) { - return node.kind === 219 /* SyntaxKind.PrefixUnaryExpression */; + return node.kind === 221 /* SyntaxKind.PrefixUnaryExpression */; } ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function isPostfixUnaryExpression(node) { - return node.kind === 220 /* SyntaxKind.PostfixUnaryExpression */; + return node.kind === 222 /* SyntaxKind.PostfixUnaryExpression */; } ts.isPostfixUnaryExpression = isPostfixUnaryExpression; function isBinaryExpression(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 222 /* SyntaxKind.ConditionalExpression */; + return node.kind === 224 /* SyntaxKind.ConditionalExpression */; } ts.isConditionalExpression = isConditionalExpression; function isTemplateExpression(node) { - return node.kind === 223 /* SyntaxKind.TemplateExpression */; + return node.kind === 225 /* SyntaxKind.TemplateExpression */; } ts.isTemplateExpression = isTemplateExpression; function isYieldExpression(node) { - return node.kind === 224 /* SyntaxKind.YieldExpression */; + return node.kind === 226 /* SyntaxKind.YieldExpression */; } ts.isYieldExpression = isYieldExpression; function isSpreadElement(node) { - return node.kind === 225 /* SyntaxKind.SpreadElement */; + return node.kind === 227 /* SyntaxKind.SpreadElement */; } ts.isSpreadElement = isSpreadElement; function isClassExpression(node) { - return node.kind === 226 /* SyntaxKind.ClassExpression */; + return node.kind === 228 /* SyntaxKind.ClassExpression */; } ts.isClassExpression = isClassExpression; function isOmittedExpression(node) { - return node.kind === 227 /* SyntaxKind.OmittedExpression */; + return node.kind === 229 /* SyntaxKind.OmittedExpression */; } ts.isOmittedExpression = isOmittedExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isAsExpression(node) { - return node.kind === 229 /* SyntaxKind.AsExpression */; + return node.kind === 231 /* SyntaxKind.AsExpression */; } ts.isAsExpression = isAsExpression; + function isSatisfiesExpression(node) { + return node.kind === 235 /* SyntaxKind.SatisfiesExpression */; + } + ts.isSatisfiesExpression = isSatisfiesExpression; function isNonNullExpression(node) { - return node.kind === 230 /* SyntaxKind.NonNullExpression */; + return node.kind === 232 /* SyntaxKind.NonNullExpression */; } ts.isNonNullExpression = isNonNullExpression; function isMetaProperty(node) { - return node.kind === 231 /* SyntaxKind.MetaProperty */; + return node.kind === 233 /* SyntaxKind.MetaProperty */; } ts.isMetaProperty = isMetaProperty; function isSyntheticExpression(node) { - return node.kind === 232 /* SyntaxKind.SyntheticExpression */; + return node.kind === 234 /* SyntaxKind.SyntheticExpression */; } ts.isSyntheticExpression = isSyntheticExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 350 /* SyntaxKind.PartiallyEmittedExpression */; + return node.kind === 353 /* SyntaxKind.PartiallyEmittedExpression */; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isCommaListExpression(node) { - return node.kind === 351 /* SyntaxKind.CommaListExpression */; + return node.kind === 354 /* SyntaxKind.CommaListExpression */; } ts.isCommaListExpression = isCommaListExpression; // Misc function isTemplateSpan(node) { - return node.kind === 233 /* SyntaxKind.TemplateSpan */; + return node.kind === 236 /* SyntaxKind.TemplateSpan */; } ts.isTemplateSpan = isTemplateSpan; function isSemicolonClassElement(node) { - return node.kind === 234 /* SyntaxKind.SemicolonClassElement */; + return node.kind === 237 /* SyntaxKind.SemicolonClassElement */; } ts.isSemicolonClassElement = isSemicolonClassElement; // Elements function isBlock(node) { - return node.kind === 235 /* SyntaxKind.Block */; + return node.kind === 238 /* SyntaxKind.Block */; } ts.isBlock = isBlock; function isVariableStatement(node) { - return node.kind === 237 /* SyntaxKind.VariableStatement */; + return node.kind === 240 /* SyntaxKind.VariableStatement */; } ts.isVariableStatement = isVariableStatement; function isEmptyStatement(node) { - return node.kind === 236 /* SyntaxKind.EmptyStatement */; + return node.kind === 239 /* SyntaxKind.EmptyStatement */; } ts.isEmptyStatement = isEmptyStatement; function isExpressionStatement(node) { - return node.kind === 238 /* SyntaxKind.ExpressionStatement */; + return node.kind === 241 /* SyntaxKind.ExpressionStatement */; } ts.isExpressionStatement = isExpressionStatement; function isIfStatement(node) { - return node.kind === 239 /* SyntaxKind.IfStatement */; + return node.kind === 242 /* SyntaxKind.IfStatement */; } ts.isIfStatement = isIfStatement; function isDoStatement(node) { - return node.kind === 240 /* SyntaxKind.DoStatement */; + return node.kind === 243 /* SyntaxKind.DoStatement */; } ts.isDoStatement = isDoStatement; function isWhileStatement(node) { - return node.kind === 241 /* SyntaxKind.WhileStatement */; + return node.kind === 244 /* SyntaxKind.WhileStatement */; } ts.isWhileStatement = isWhileStatement; function isForStatement(node) { - return node.kind === 242 /* SyntaxKind.ForStatement */; + return node.kind === 245 /* SyntaxKind.ForStatement */; } ts.isForStatement = isForStatement; function isForInStatement(node) { - return node.kind === 243 /* SyntaxKind.ForInStatement */; + return node.kind === 246 /* SyntaxKind.ForInStatement */; } ts.isForInStatement = isForInStatement; function isForOfStatement(node) { - return node.kind === 244 /* SyntaxKind.ForOfStatement */; + return node.kind === 247 /* SyntaxKind.ForOfStatement */; } ts.isForOfStatement = isForOfStatement; function isContinueStatement(node) { - return node.kind === 245 /* SyntaxKind.ContinueStatement */; + return node.kind === 248 /* SyntaxKind.ContinueStatement */; } ts.isContinueStatement = isContinueStatement; function isBreakStatement(node) { - return node.kind === 246 /* SyntaxKind.BreakStatement */; + return node.kind === 249 /* SyntaxKind.BreakStatement */; } ts.isBreakStatement = isBreakStatement; function isReturnStatement(node) { - return node.kind === 247 /* SyntaxKind.ReturnStatement */; + return node.kind === 250 /* SyntaxKind.ReturnStatement */; } ts.isReturnStatement = isReturnStatement; function isWithStatement(node) { - return node.kind === 248 /* SyntaxKind.WithStatement */; + return node.kind === 251 /* SyntaxKind.WithStatement */; } ts.isWithStatement = isWithStatement; function isSwitchStatement(node) { - return node.kind === 249 /* SyntaxKind.SwitchStatement */; + return node.kind === 252 /* SyntaxKind.SwitchStatement */; } ts.isSwitchStatement = isSwitchStatement; function isLabeledStatement(node) { - return node.kind === 250 /* SyntaxKind.LabeledStatement */; + return node.kind === 253 /* SyntaxKind.LabeledStatement */; } ts.isLabeledStatement = isLabeledStatement; function isThrowStatement(node) { - return node.kind === 251 /* SyntaxKind.ThrowStatement */; + return node.kind === 254 /* SyntaxKind.ThrowStatement */; } ts.isThrowStatement = isThrowStatement; function isTryStatement(node) { - return node.kind === 252 /* SyntaxKind.TryStatement */; + return node.kind === 255 /* SyntaxKind.TryStatement */; } ts.isTryStatement = isTryStatement; function isDebuggerStatement(node) { - return node.kind === 253 /* SyntaxKind.DebuggerStatement */; + return node.kind === 256 /* SyntaxKind.DebuggerStatement */; } ts.isDebuggerStatement = isDebuggerStatement; function isVariableDeclaration(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 255 /* SyntaxKind.VariableDeclarationList */; + return node.kind === 258 /* SyntaxKind.VariableDeclarationList */; } ts.isVariableDeclarationList = isVariableDeclarationList; function isFunctionDeclaration(node) { - return node.kind === 256 /* SyntaxKind.FunctionDeclaration */; + return node.kind === 259 /* SyntaxKind.FunctionDeclaration */; } ts.isFunctionDeclaration = isFunctionDeclaration; function isClassDeclaration(node) { - return node.kind === 257 /* SyntaxKind.ClassDeclaration */; + return node.kind === 260 /* SyntaxKind.ClassDeclaration */; } ts.isClassDeclaration = isClassDeclaration; function isInterfaceDeclaration(node) { - return node.kind === 258 /* SyntaxKind.InterfaceDeclaration */; + return node.kind === 261 /* SyntaxKind.InterfaceDeclaration */; } ts.isInterfaceDeclaration = isInterfaceDeclaration; function isTypeAliasDeclaration(node) { - return node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */; + return node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */; } ts.isTypeAliasDeclaration = isTypeAliasDeclaration; function isEnumDeclaration(node) { - return node.kind === 260 /* SyntaxKind.EnumDeclaration */; + return node.kind === 263 /* SyntaxKind.EnumDeclaration */; } ts.isEnumDeclaration = isEnumDeclaration; function isModuleDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isModuleDeclaration = isModuleDeclaration; function isModuleBlock(node) { - return node.kind === 262 /* SyntaxKind.ModuleBlock */; + return node.kind === 265 /* SyntaxKind.ModuleBlock */; } ts.isModuleBlock = isModuleBlock; function isCaseBlock(node) { - return node.kind === 263 /* SyntaxKind.CaseBlock */; + return node.kind === 266 /* SyntaxKind.CaseBlock */; } ts.isCaseBlock = isCaseBlock; function isNamespaceExportDeclaration(node) { - return node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration; function isImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportDeclaration(node) { - return node.kind === 266 /* SyntaxKind.ImportDeclaration */; + return node.kind === 269 /* SyntaxKind.ImportDeclaration */; } ts.isImportDeclaration = isImportDeclaration; function isImportClause(node) { - return node.kind === 267 /* SyntaxKind.ImportClause */; + return node.kind === 270 /* SyntaxKind.ImportClause */; } ts.isImportClause = isImportClause; function isImportTypeAssertionContainer(node) { - return node.kind === 295 /* SyntaxKind.ImportTypeAssertionContainer */; + return node.kind === 298 /* SyntaxKind.ImportTypeAssertionContainer */; } ts.isImportTypeAssertionContainer = isImportTypeAssertionContainer; function isAssertClause(node) { - return node.kind === 293 /* SyntaxKind.AssertClause */; + return node.kind === 296 /* SyntaxKind.AssertClause */; } ts.isAssertClause = isAssertClause; function isAssertEntry(node) { - return node.kind === 294 /* SyntaxKind.AssertEntry */; + return node.kind === 297 /* SyntaxKind.AssertEntry */; } ts.isAssertEntry = isAssertEntry; function isNamespaceImport(node) { - return node.kind === 268 /* SyntaxKind.NamespaceImport */; + return node.kind === 271 /* SyntaxKind.NamespaceImport */; } ts.isNamespaceImport = isNamespaceImport; function isNamespaceExport(node) { - return node.kind === 274 /* SyntaxKind.NamespaceExport */; + return node.kind === 277 /* SyntaxKind.NamespaceExport */; } ts.isNamespaceExport = isNamespaceExport; function isNamedImports(node) { - return node.kind === 269 /* SyntaxKind.NamedImports */; + return node.kind === 272 /* SyntaxKind.NamedImports */; } ts.isNamedImports = isNamedImports; function isImportSpecifier(node) { - return node.kind === 270 /* SyntaxKind.ImportSpecifier */; + return node.kind === 273 /* SyntaxKind.ImportSpecifier */; } ts.isImportSpecifier = isImportSpecifier; function isExportAssignment(node) { - return node.kind === 271 /* SyntaxKind.ExportAssignment */; + return node.kind === 274 /* SyntaxKind.ExportAssignment */; } ts.isExportAssignment = isExportAssignment; function isExportDeclaration(node) { - return node.kind === 272 /* SyntaxKind.ExportDeclaration */; + return node.kind === 275 /* SyntaxKind.ExportDeclaration */; } ts.isExportDeclaration = isExportDeclaration; function isNamedExports(node) { - return node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 275 /* SyntaxKind.ExportSpecifier */; + return node.kind === 278 /* SyntaxKind.ExportSpecifier */; } ts.isExportSpecifier = isExportSpecifier; function isMissingDeclaration(node) { - return node.kind === 276 /* SyntaxKind.MissingDeclaration */; + return node.kind === 279 /* SyntaxKind.MissingDeclaration */; } ts.isMissingDeclaration = isMissingDeclaration; function isNotEmittedStatement(node) { - return node.kind === 349 /* SyntaxKind.NotEmittedStatement */; + return node.kind === 352 /* SyntaxKind.NotEmittedStatement */; } ts.isNotEmittedStatement = isNotEmittedStatement; /* @internal */ function isSyntheticReference(node) { - return node.kind === 354 /* SyntaxKind.SyntheticReferenceExpression */; + return node.kind === 357 /* SyntaxKind.SyntheticReferenceExpression */; } ts.isSyntheticReference = isSyntheticReference; /* @internal */ function isMergeDeclarationMarker(node) { - return node.kind === 352 /* SyntaxKind.MergeDeclarationMarker */; + return node.kind === 355 /* SyntaxKind.MergeDeclarationMarker */; } ts.isMergeDeclarationMarker = isMergeDeclarationMarker; /* @internal */ function isEndOfDeclarationMarker(node) { - return node.kind === 353 /* SyntaxKind.EndOfDeclarationMarker */; + return node.kind === 356 /* SyntaxKind.EndOfDeclarationMarker */; } ts.isEndOfDeclarationMarker = isEndOfDeclarationMarker; // Module References function isExternalModuleReference(node) { - return node.kind === 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 280 /* SyntaxKind.ExternalModuleReference */; } ts.isExternalModuleReference = isExternalModuleReference; // JSX function isJsxElement(node) { - return node.kind === 278 /* SyntaxKind.JsxElement */; + return node.kind === 281 /* SyntaxKind.JsxElement */; } ts.isJsxElement = isJsxElement; function isJsxSelfClosingElement(node) { - return node.kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return node.kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } ts.isJsxSelfClosingElement = isJsxSelfClosingElement; function isJsxOpeningElement(node) { - return node.kind === 280 /* SyntaxKind.JsxOpeningElement */; + return node.kind === 283 /* SyntaxKind.JsxOpeningElement */; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 281 /* SyntaxKind.JsxClosingElement */; + return node.kind === 284 /* SyntaxKind.JsxClosingElement */; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxFragment(node) { - return node.kind === 282 /* SyntaxKind.JsxFragment */; + return node.kind === 285 /* SyntaxKind.JsxFragment */; } ts.isJsxFragment = isJsxFragment; function isJsxOpeningFragment(node) { - return node.kind === 283 /* SyntaxKind.JsxOpeningFragment */; + return node.kind === 286 /* SyntaxKind.JsxOpeningFragment */; } ts.isJsxOpeningFragment = isJsxOpeningFragment; function isJsxClosingFragment(node) { - return node.kind === 284 /* SyntaxKind.JsxClosingFragment */; + return node.kind === 287 /* SyntaxKind.JsxClosingFragment */; } ts.isJsxClosingFragment = isJsxClosingFragment; function isJsxAttribute(node) { - return node.kind === 285 /* SyntaxKind.JsxAttribute */; + return node.kind === 288 /* SyntaxKind.JsxAttribute */; } ts.isJsxAttribute = isJsxAttribute; function isJsxAttributes(node) { - return node.kind === 286 /* SyntaxKind.JsxAttributes */; + return node.kind === 289 /* SyntaxKind.JsxAttributes */; } ts.isJsxAttributes = isJsxAttributes; function isJsxSpreadAttribute(node) { - return node.kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return node.kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxExpression(node) { - return node.kind === 288 /* SyntaxKind.JsxExpression */; + return node.kind === 291 /* SyntaxKind.JsxExpression */; } ts.isJsxExpression = isJsxExpression; // Clauses function isCaseClause(node) { - return node.kind === 289 /* SyntaxKind.CaseClause */; + return node.kind === 292 /* SyntaxKind.CaseClause */; } ts.isCaseClause = isCaseClause; function isDefaultClause(node) { - return node.kind === 290 /* SyntaxKind.DefaultClause */; + return node.kind === 293 /* SyntaxKind.DefaultClause */; } ts.isDefaultClause = isDefaultClause; function isHeritageClause(node) { - return node.kind === 291 /* SyntaxKind.HeritageClause */; + return node.kind === 294 /* SyntaxKind.HeritageClause */; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClause = isCatchClause; // Property assignments function isPropertyAssignment(node) { - return node.kind === 296 /* SyntaxKind.PropertyAssignment */; + return node.kind === 299 /* SyntaxKind.PropertyAssignment */; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */; + return node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isSpreadAssignment(node) { - return node.kind === 298 /* SyntaxKind.SpreadAssignment */; + return node.kind === 301 /* SyntaxKind.SpreadAssignment */; } ts.isSpreadAssignment = isSpreadAssignment; // Enum function isEnumMember(node) { - return node.kind === 299 /* SyntaxKind.EnumMember */; + return node.kind === 302 /* SyntaxKind.EnumMember */; } ts.isEnumMember = isEnumMember; // Unparsed // TODO(rbuckton): isUnparsedPrologue function isUnparsedPrepend(node) { - return node.kind === 301 /* SyntaxKind.UnparsedPrepend */; + return node.kind === 304 /* SyntaxKind.UnparsedPrepend */; } ts.isUnparsedPrepend = isUnparsedPrepend; // TODO(rbuckton): isUnparsedText @@ -29575,176 +29765,176 @@ var ts; // TODO(rbuckton): isUnparsedSyntheticReference // Top-level nodes function isSourceFile(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */; + return node.kind === 308 /* SyntaxKind.SourceFile */; } ts.isSourceFile = isSourceFile; function isBundle(node) { - return node.kind === 306 /* SyntaxKind.Bundle */; + return node.kind === 309 /* SyntaxKind.Bundle */; } ts.isBundle = isBundle; function isUnparsedSource(node) { - return node.kind === 307 /* SyntaxKind.UnparsedSource */; + return node.kind === 310 /* SyntaxKind.UnparsedSource */; } ts.isUnparsedSource = isUnparsedSource; // TODO(rbuckton): isInputFiles // JSDoc Elements function isJSDocTypeExpression(node) { - return node.kind === 309 /* SyntaxKind.JSDocTypeExpression */; + return node.kind === 312 /* SyntaxKind.JSDocTypeExpression */; } ts.isJSDocTypeExpression = isJSDocTypeExpression; function isJSDocNameReference(node) { - return node.kind === 310 /* SyntaxKind.JSDocNameReference */; + return node.kind === 313 /* SyntaxKind.JSDocNameReference */; } ts.isJSDocNameReference = isJSDocNameReference; function isJSDocMemberName(node) { - return node.kind === 311 /* SyntaxKind.JSDocMemberName */; + return node.kind === 314 /* SyntaxKind.JSDocMemberName */; } ts.isJSDocMemberName = isJSDocMemberName; function isJSDocLink(node) { - return node.kind === 324 /* SyntaxKind.JSDocLink */; + return node.kind === 327 /* SyntaxKind.JSDocLink */; } ts.isJSDocLink = isJSDocLink; function isJSDocLinkCode(node) { - return node.kind === 325 /* SyntaxKind.JSDocLinkCode */; + return node.kind === 328 /* SyntaxKind.JSDocLinkCode */; } ts.isJSDocLinkCode = isJSDocLinkCode; function isJSDocLinkPlain(node) { - return node.kind === 326 /* SyntaxKind.JSDocLinkPlain */; + return node.kind === 329 /* SyntaxKind.JSDocLinkPlain */; } ts.isJSDocLinkPlain = isJSDocLinkPlain; function isJSDocAllType(node) { - return node.kind === 312 /* SyntaxKind.JSDocAllType */; + return node.kind === 315 /* SyntaxKind.JSDocAllType */; } ts.isJSDocAllType = isJSDocAllType; function isJSDocUnknownType(node) { - return node.kind === 313 /* SyntaxKind.JSDocUnknownType */; + return node.kind === 316 /* SyntaxKind.JSDocUnknownType */; } ts.isJSDocUnknownType = isJSDocUnknownType; function isJSDocNullableType(node) { - return node.kind === 314 /* SyntaxKind.JSDocNullableType */; + return node.kind === 317 /* SyntaxKind.JSDocNullableType */; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 315 /* SyntaxKind.JSDocNonNullableType */; + return node.kind === 318 /* SyntaxKind.JSDocNonNullableType */; } ts.isJSDocNonNullableType = isJSDocNonNullableType; function isJSDocOptionalType(node) { - return node.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return node.kind === 319 /* SyntaxKind.JSDocOptionalType */; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 317 /* SyntaxKind.JSDocFunctionType */; + return node.kind === 320 /* SyntaxKind.JSDocFunctionType */; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 318 /* SyntaxKind.JSDocVariadicType */; + return node.kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isJSDocVariadicType = isJSDocVariadicType; function isJSDocNamepathType(node) { - return node.kind === 319 /* SyntaxKind.JSDocNamepathType */; + return node.kind === 322 /* SyntaxKind.JSDocNamepathType */; } ts.isJSDocNamepathType = isJSDocNamepathType; function isJSDoc(node) { - return node.kind === 320 /* SyntaxKind.JSDoc */; + return node.kind === 323 /* SyntaxKind.JSDoc */; } ts.isJSDoc = isJSDoc; function isJSDocTypeLiteral(node) { - return node.kind === 322 /* SyntaxKind.JSDocTypeLiteral */; + return node.kind === 325 /* SyntaxKind.JSDocTypeLiteral */; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; function isJSDocSignature(node) { - return node.kind === 323 /* SyntaxKind.JSDocSignature */; + return node.kind === 326 /* SyntaxKind.JSDocSignature */; } ts.isJSDocSignature = isJSDocSignature; // JSDoc Tags function isJSDocAugmentsTag(node) { - return node.kind === 328 /* SyntaxKind.JSDocAugmentsTag */; + return node.kind === 331 /* SyntaxKind.JSDocAugmentsTag */; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocAuthorTag(node) { - return node.kind === 330 /* SyntaxKind.JSDocAuthorTag */; + return node.kind === 333 /* SyntaxKind.JSDocAuthorTag */; } ts.isJSDocAuthorTag = isJSDocAuthorTag; function isJSDocClassTag(node) { - return node.kind === 332 /* SyntaxKind.JSDocClassTag */; + return node.kind === 335 /* SyntaxKind.JSDocClassTag */; } ts.isJSDocClassTag = isJSDocClassTag; function isJSDocCallbackTag(node) { - return node.kind === 338 /* SyntaxKind.JSDocCallbackTag */; + return node.kind === 341 /* SyntaxKind.JSDocCallbackTag */; } ts.isJSDocCallbackTag = isJSDocCallbackTag; function isJSDocPublicTag(node) { - return node.kind === 333 /* SyntaxKind.JSDocPublicTag */; + return node.kind === 336 /* SyntaxKind.JSDocPublicTag */; } ts.isJSDocPublicTag = isJSDocPublicTag; function isJSDocPrivateTag(node) { - return node.kind === 334 /* SyntaxKind.JSDocPrivateTag */; + return node.kind === 337 /* SyntaxKind.JSDocPrivateTag */; } ts.isJSDocPrivateTag = isJSDocPrivateTag; function isJSDocProtectedTag(node) { - return node.kind === 335 /* SyntaxKind.JSDocProtectedTag */; + return node.kind === 338 /* SyntaxKind.JSDocProtectedTag */; } ts.isJSDocProtectedTag = isJSDocProtectedTag; function isJSDocReadonlyTag(node) { - return node.kind === 336 /* SyntaxKind.JSDocReadonlyTag */; + return node.kind === 339 /* SyntaxKind.JSDocReadonlyTag */; } ts.isJSDocReadonlyTag = isJSDocReadonlyTag; function isJSDocOverrideTag(node) { - return node.kind === 337 /* SyntaxKind.JSDocOverrideTag */; + return node.kind === 340 /* SyntaxKind.JSDocOverrideTag */; } ts.isJSDocOverrideTag = isJSDocOverrideTag; function isJSDocDeprecatedTag(node) { - return node.kind === 331 /* SyntaxKind.JSDocDeprecatedTag */; + return node.kind === 334 /* SyntaxKind.JSDocDeprecatedTag */; } ts.isJSDocDeprecatedTag = isJSDocDeprecatedTag; function isJSDocSeeTag(node) { - return node.kind === 346 /* SyntaxKind.JSDocSeeTag */; + return node.kind === 349 /* SyntaxKind.JSDocSeeTag */; } ts.isJSDocSeeTag = isJSDocSeeTag; function isJSDocEnumTag(node) { - return node.kind === 339 /* SyntaxKind.JSDocEnumTag */; + return node.kind === 342 /* SyntaxKind.JSDocEnumTag */; } ts.isJSDocEnumTag = isJSDocEnumTag; function isJSDocParameterTag(node) { - return node.kind === 340 /* SyntaxKind.JSDocParameterTag */; + return node.kind === 343 /* SyntaxKind.JSDocParameterTag */; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 341 /* SyntaxKind.JSDocReturnTag */; + return node.kind === 344 /* SyntaxKind.JSDocReturnTag */; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocThisTag(node) { - return node.kind === 342 /* SyntaxKind.JSDocThisTag */; + return node.kind === 345 /* SyntaxKind.JSDocThisTag */; } ts.isJSDocThisTag = isJSDocThisTag; function isJSDocTypeTag(node) { - return node.kind === 343 /* SyntaxKind.JSDocTypeTag */; + return node.kind === 346 /* SyntaxKind.JSDocTypeTag */; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 344 /* SyntaxKind.JSDocTemplateTag */; + return node.kind === 347 /* SyntaxKind.JSDocTemplateTag */; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 345 /* SyntaxKind.JSDocTypedefTag */; + return node.kind === 348 /* SyntaxKind.JSDocTypedefTag */; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocUnknownTag(node) { - return node.kind === 327 /* SyntaxKind.JSDocTag */; + return node.kind === 330 /* SyntaxKind.JSDocTag */; } ts.isJSDocUnknownTag = isJSDocUnknownTag; function isJSDocPropertyTag(node) { - return node.kind === 347 /* SyntaxKind.JSDocPropertyTag */; + return node.kind === 350 /* SyntaxKind.JSDocPropertyTag */; } ts.isJSDocPropertyTag = isJSDocPropertyTag; function isJSDocImplementsTag(node) { - return node.kind === 329 /* SyntaxKind.JSDocImplementsTag */; + return node.kind === 332 /* SyntaxKind.JSDocImplementsTag */; } ts.isJSDocImplementsTag = isJSDocImplementsTag; // Synthesized list /* @internal */ function isSyntaxList(n) { - return n.kind === 348 /* SyntaxKind.SyntaxList */; + return n.kind === 351 /* SyntaxKind.SyntaxList */; } ts.isSyntaxList = isSyntaxList; })(ts || (ts = {})); @@ -29943,14 +30133,14 @@ var ts; ts.Debug.failBadSyntaxKind(property.name, "Private identifiers are not allowed in object literals."); } switch (property.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return createExpressionForAccessorDeclaration(factory, node.properties, property, receiver, !!node.multiLine); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return createExpressionForPropertyAssignment(factory, property, receiver); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return createExpressionForShorthandPropertyAssignment(factory, property, receiver); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return createExpressionForMethodDeclaration(factory, property, receiver); } } @@ -30058,8 +30248,8 @@ var ts; } ts.startsWithUseStrict = startsWithUseStrict; function isCommaSequence(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ || - node.kind === 351 /* SyntaxKind.CommaListExpression */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ || + node.kind === 354 /* SyntaxKind.CommaListExpression */; } ts.isCommaSequence = isCommaSequence; function isJSDocTypeAssertion(node) { @@ -30077,17 +30267,18 @@ var ts; function isOuterExpression(node, kinds) { if (kinds === void 0) { kinds = 15 /* OuterExpressionKinds.All */; } switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: if (kinds & 16 /* OuterExpressionKinds.ExcludeJSDocTypeAssertion */ && isJSDocTypeAssertion(node)) { return false; } return (kinds & 1 /* OuterExpressionKinds.Parentheses */) !== 0; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return (kinds & 2 /* OuterExpressionKinds.TypeAssertions */) !== 0; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return (kinds & 4 /* OuterExpressionKinds.NonNullAssertions */) !== 0; - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return (kinds & 8 /* OuterExpressionKinds.PartiallyEmittedExpressions */) !== 0; } return false; @@ -30208,10 +30399,10 @@ var ts; var name = namespaceDeclaration.name; return ts.isGeneratedIdentifier(name) ? name : factory.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name)); } - if (node.kind === 266 /* SyntaxKind.ImportDeclaration */ && node.importClause) { + if (node.kind === 269 /* SyntaxKind.ImportDeclaration */ && node.importClause) { return factory.getGeneratedNameForNode(node); } - if (node.kind === 272 /* SyntaxKind.ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 275 /* SyntaxKind.ExportDeclaration */ && node.moduleSpecifier) { return factory.getGeneratedNameForNode(node); } return undefined; @@ -30330,7 +30521,7 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // `b` in `({ a: b } = ...)` // `b` in `({ a: b = 1 } = ...)` // `{b}` in `({ a: {b} } = ...)` @@ -30342,11 +30533,11 @@ var ts; // `b[0]` in `({ a: b[0] } = ...)` // `b[0]` in `({ a: b[0] = 1 } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // `a` in `({ a } = ...)` // `a` in `({ a = 1 } = ...)` return bindingElement.name; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: // `a` in `({ ...a } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } @@ -30378,12 +30569,12 @@ var ts; */ function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: // `...` in `let [...a] = ...` return bindingElement.dotDotDotToken; - case 225 /* SyntaxKind.SpreadElement */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 227 /* SyntaxKind.SpreadElement */: + case 301 /* SyntaxKind.SpreadAssignment */: // `...` in `[...a] = ...` return bindingElement; } @@ -30401,7 +30592,7 @@ var ts; ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; function tryGetPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: // `a` in `let { a: b } = ...` // `[a]` in `let { [a]: b } = ...` // `"a"` in `let { "a": b } = ...` @@ -30416,7 +30607,7 @@ var ts; : propertyName; } break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // `a` in `({ a: b } = ...)` // `[a]` in `({ [a]: b } = ...)` // `"a"` in `({ "a": b } = ...)` @@ -30431,7 +30622,7 @@ var ts; : propertyName; } break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: // `a` in `({ ...a } = ...)` if (bindingElement.name && ts.isPrivateIdentifier(bindingElement.name)) { return ts.Debug.failBadSyntaxKind(bindingElement.name); @@ -30454,13 +30645,13 @@ var ts; */ function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: // `a` in `{a}` // `a` in `[a]` return name.elements; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: // `a` in `{a}` return name.properties; } @@ -30481,46 +30672,46 @@ var ts; ts.getJSDocTypeAliasName = getJSDocTypeAliasName; function canHaveIllegalType(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.canHaveIllegalType = canHaveIllegalType; function canHaveIllegalTypeParameters(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.canHaveIllegalTypeParameters = canHaveIllegalTypeParameters; function canHaveIllegalDecorators(node) { var kind = node.kind; - return kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */; + return kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */; } ts.canHaveIllegalDecorators = canHaveIllegalDecorators; function canHaveIllegalModifiers(node) { var kind = node.kind; - return kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 179 /* SyntaxKind.FunctionType */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 181 /* SyntaxKind.FunctionType */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } ts.canHaveIllegalModifiers = canHaveIllegalModifiers; ts.isTypeNodeOrTypeParameterDeclaration = ts.or(ts.isTypeNode, ts.isTypeParameterDeclaration); @@ -30794,6 +30985,83 @@ var ts; return ts.setTextRange(factory.createNodeArray([], nodes.hasTrailingComma), nodes); } ts.elideNodes = elideNodes; + /** + * Gets the node from which a name should be generated. + */ + function getNodeForGeneratedName(name) { + if (name.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) { + var autoGenerateId = name.autoGenerateId; + var node = name; + var original = node.original; + while (original) { + node = original; + // if "node" is a different generated name (having a different "autoGenerateId"), use it and stop traversing. + if (ts.isMemberName(node) + && !!(node.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) + && node.autoGenerateId !== autoGenerateId) { + break; + } + original = node.original; + } + // otherwise, return the original node for the source + return node; + } + return name; + } + ts.getNodeForGeneratedName = getNodeForGeneratedName; + function formatGeneratedNamePart(part, generateName) { + return typeof part === "object" ? formatGeneratedName(/*privateName*/ false, part.prefix, part.node, part.suffix, generateName) : + typeof part === "string" ? part.length > 0 && part.charCodeAt(0) === 35 /* CharacterCodes.hash */ ? part.slice(1) : part : + ""; + } + ts.formatGeneratedNamePart = formatGeneratedNamePart; + function formatIdentifier(name, generateName) { + return typeof name === "string" ? name : + formatIdentifierWorker(name, ts.Debug.checkDefined(generateName)); + } + function formatIdentifierWorker(node, generateName) { + return ts.isGeneratedPrivateIdentifier(node) ? generateName(node).slice(1) : + ts.isGeneratedIdentifier(node) ? generateName(node) : + ts.isPrivateIdentifier(node) ? node.escapedText.slice(1) : + ts.idText(node); + } + function formatGeneratedName(privateName, prefix, baseName, suffix, generateName) { + prefix = formatGeneratedNamePart(prefix, generateName); + suffix = formatGeneratedNamePart(suffix, generateName); + baseName = formatIdentifier(baseName, generateName); + return "".concat(privateName ? "#" : "").concat(prefix).concat(baseName).concat(suffix); + } + ts.formatGeneratedName = formatGeneratedName; + /** + * Creates a private backing field for an `accessor` {@link PropertyDeclaration}. + */ + function createAccessorPropertyBackingField(factory, node, modifiers, initializer) { + return factory.updatePropertyDeclaration(node, modifiers, factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage"), + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, initializer); + } + ts.createAccessorPropertyBackingField = createAccessorPropertyBackingField; + /** + * Creates a {@link GetAccessorDeclaration} that reads from a private backing field. + */ + function createAccessorPropertyGetRedirector(factory, node, modifiers, name) { + return factory.createGetAccessorDeclaration(modifiers, name, [], + /*type*/ undefined, factory.createBlock([ + factory.createReturnStatement(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage"))) + ])); + } + ts.createAccessorPropertyGetRedirector = createAccessorPropertyGetRedirector; + /** + * Creates a {@link SetAccessorDeclaration} that writes to a private backing field. + */ + function createAccessorPropertySetRedirector(factory, node, modifiers, name) { + return factory.createSetAccessorDeclaration(modifiers, name, [factory.createParameterDeclaration( + /*modifiers*/ undefined, + /*dotdotDotToken*/ undefined, "value")], factory.createBlock([ + factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage")), factory.createIdentifier("value"))) + ])); + } + ts.createAccessorPropertySetRedirector = createAccessorPropertySetRedirector; })(ts || (ts = {})); var ts; (function (ts) { @@ -30803,47 +31071,48 @@ var ts; ts.setTextRange = setTextRange; function canHaveModifiers(node) { var kind = node.kind; - return kind === 163 /* SyntaxKind.TypeParameter */ - || kind === 164 /* SyntaxKind.Parameter */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 180 /* SyntaxKind.ConstructorType */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */ - || kind === 272 /* SyntaxKind.ExportDeclaration */; + return kind === 165 /* SyntaxKind.TypeParameter */ + || kind === 166 /* SyntaxKind.Parameter */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 182 /* SyntaxKind.ConstructorType */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */ + || kind === 275 /* SyntaxKind.ExportDeclaration */; } ts.canHaveModifiers = canHaveModifiers; function canHaveDecorators(node) { var kind = node.kind; - return kind === 164 /* SyntaxKind.Parameter */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 257 /* SyntaxKind.ClassDeclaration */; + return kind === 166 /* SyntaxKind.Parameter */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 260 /* SyntaxKind.ClassDeclaration */; } ts.canHaveDecorators = canHaveDecorators; })(ts || (ts = {})); var ts; (function (ts) { + var _a; var SignatureFlags; (function (SignatureFlags) { SignatureFlags[SignatureFlags["None"] = 0] = "None"; @@ -30931,6 +31200,718 @@ var ts; function isImportMeta(node) { return ts.isMetaProperty(node) && node.keywordToken === 100 /* SyntaxKind.ImportKeyword */ && node.name.escapedText === "meta"; } + var forEachChildTable = (_a = {}, + _a[163 /* SyntaxKind.QualifiedName */] = function forEachChildInQualifiedName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + }, + _a[165 /* SyntaxKind.TypeParameter */] = function forEachChildInTypeParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.default) || + visitNode(cbNode, node.expression); + }, + _a[300 /* SyntaxKind.ShorthandPropertyAssignment */] = function forEachChildInShorthandPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.equalsToken) || + visitNode(cbNode, node.objectAssignmentInitializer); + }, + _a[301 /* SyntaxKind.SpreadAssignment */] = function forEachChildInSpreadAssignment(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[166 /* SyntaxKind.Parameter */] = function forEachChildInParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[169 /* SyntaxKind.PropertyDeclaration */] = function forEachChildInPropertyDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[168 /* SyntaxKind.PropertySignature */] = function forEachChildInPropertySignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[299 /* SyntaxKind.PropertyAssignment */] = function forEachChildInPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.initializer); + }, + _a[257 /* SyntaxKind.VariableDeclaration */] = function forEachChildInVariableDeclaration(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[205 /* SyntaxKind.BindingElement */] = function forEachChildInBindingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[178 /* SyntaxKind.IndexSignature */] = function forEachChildInIndexSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[182 /* SyntaxKind.ConstructorType */] = function forEachChildInConstructorType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[181 /* SyntaxKind.FunctionType */] = function forEachChildInFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[176 /* SyntaxKind.CallSignature */] = forEachChildInCallOrConstructSignature, + _a[177 /* SyntaxKind.ConstructSignature */] = forEachChildInCallOrConstructSignature, + _a[171 /* SyntaxKind.MethodDeclaration */] = function forEachChildInMethodDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[170 /* SyntaxKind.MethodSignature */] = function forEachChildInMethodSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[173 /* SyntaxKind.Constructor */] = function forEachChildInConstructor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[174 /* SyntaxKind.GetAccessor */] = function forEachChildInGetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[175 /* SyntaxKind.SetAccessor */] = function forEachChildInSetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[259 /* SyntaxKind.FunctionDeclaration */] = function forEachChildInFunctionDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[215 /* SyntaxKind.FunctionExpression */] = function forEachChildInFunctionExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[216 /* SyntaxKind.ArrowFunction */] = function forEachChildInArrowFunction(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.equalsGreaterThanToken) || + visitNode(cbNode, node.body); + }, + _a[172 /* SyntaxKind.ClassStaticBlockDeclaration */] = function forEachChildInClassStaticBlockDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.body); + }, + _a[180 /* SyntaxKind.TypeReference */] = function forEachChildInTypeReference(node, cbNode, cbNodes) { + return visitNode(cbNode, node.typeName) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[179 /* SyntaxKind.TypePredicate */] = function forEachChildInTypePredicate(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertsModifier) || + visitNode(cbNode, node.parameterName) || + visitNode(cbNode, node.type); + }, + _a[183 /* SyntaxKind.TypeQuery */] = function forEachChildInTypeQuery(node, cbNode, cbNodes) { + return visitNode(cbNode, node.exprName) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[184 /* SyntaxKind.TypeLiteral */] = function forEachChildInTypeLiteral(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.members); + }, + _a[185 /* SyntaxKind.ArrayType */] = function forEachChildInArrayType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.elementType); + }, + _a[186 /* SyntaxKind.TupleType */] = function forEachChildInTupleType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[189 /* SyntaxKind.UnionType */] = forEachChildInUnionOrIntersectionType, + _a[190 /* SyntaxKind.IntersectionType */] = forEachChildInUnionOrIntersectionType, + _a[191 /* SyntaxKind.ConditionalType */] = function forEachChildInConditionalType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.checkType) || + visitNode(cbNode, node.extendsType) || + visitNode(cbNode, node.trueType) || + visitNode(cbNode, node.falseType); + }, + _a[192 /* SyntaxKind.InferType */] = function forEachChildInInferType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.typeParameter); + }, + _a[202 /* SyntaxKind.ImportType */] = function forEachChildInImportType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.argument) || + visitNode(cbNode, node.assertions) || + visitNode(cbNode, node.qualifier) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[298 /* SyntaxKind.ImportTypeAssertionContainer */] = function forEachChildInImportTypeAssertionContainer(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertClause); + }, + _a[193 /* SyntaxKind.ParenthesizedType */] = forEachChildInParenthesizedTypeOrTypeOperator, + _a[195 /* SyntaxKind.TypeOperator */] = forEachChildInParenthesizedTypeOrTypeOperator, + _a[196 /* SyntaxKind.IndexedAccessType */] = function forEachChildInIndexedAccessType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.objectType) || + visitNode(cbNode, node.indexType); + }, + _a[197 /* SyntaxKind.MappedType */] = function forEachChildInMappedType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.readonlyToken) || + visitNode(cbNode, node.typeParameter) || + visitNode(cbNode, node.nameType) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[198 /* SyntaxKind.LiteralType */] = function forEachChildInLiteralType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.literal); + }, + _a[199 /* SyntaxKind.NamedTupleMember */] = function forEachChildInNamedTupleMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type); + }, + _a[203 /* SyntaxKind.ObjectBindingPattern */] = forEachChildInObjectOrArrayBindingPattern, + _a[204 /* SyntaxKind.ArrayBindingPattern */] = forEachChildInObjectOrArrayBindingPattern, + _a[206 /* SyntaxKind.ArrayLiteralExpression */] = function forEachChildInArrayLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[207 /* SyntaxKind.ObjectLiteralExpression */] = function forEachChildInObjectLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, + _a[208 /* SyntaxKind.PropertyAccessExpression */] = function forEachChildInPropertyAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNode(cbNode, node.name); + }, + _a[209 /* SyntaxKind.ElementAccessExpression */] = function forEachChildInElementAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNode(cbNode, node.argumentExpression); + }, + _a[210 /* SyntaxKind.CallExpression */] = forEachChildInCallOrNewExpression, + _a[211 /* SyntaxKind.NewExpression */] = forEachChildInCallOrNewExpression, + _a[212 /* SyntaxKind.TaggedTemplateExpression */] = function forEachChildInTaggedTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tag) || + visitNode(cbNode, node.questionDotToken) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNode(cbNode, node.template); + }, + _a[213 /* SyntaxKind.TypeAssertionExpression */] = function forEachChildInTypeAssertionExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.expression); + }, + _a[214 /* SyntaxKind.ParenthesizedExpression */] = function forEachChildInParenthesizedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[217 /* SyntaxKind.DeleteExpression */] = function forEachChildInDeleteExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[218 /* SyntaxKind.TypeOfExpression */] = function forEachChildInTypeOfExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[219 /* SyntaxKind.VoidExpression */] = function forEachChildInVoidExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[221 /* SyntaxKind.PrefixUnaryExpression */] = function forEachChildInPrefixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, + _a[226 /* SyntaxKind.YieldExpression */] = function forEachChildInYieldExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + }, + _a[220 /* SyntaxKind.AwaitExpression */] = function forEachChildInAwaitExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[222 /* SyntaxKind.PostfixUnaryExpression */] = function forEachChildInPostfixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, + _a[223 /* SyntaxKind.BinaryExpression */] = function forEachChildInBinaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.operatorToken) || + visitNode(cbNode, node.right); + }, + _a[231 /* SyntaxKind.AsExpression */] = function forEachChildInAsExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.type); + }, + _a[232 /* SyntaxKind.NonNullExpression */] = function forEachChildInNonNullExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[235 /* SyntaxKind.SatisfiesExpression */] = function forEachChildInSatisfiesExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); + }, + _a[233 /* SyntaxKind.MetaProperty */] = function forEachChildInMetaProperty(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[224 /* SyntaxKind.ConditionalExpression */] = function forEachChildInConditionalExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.condition) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.whenTrue) || + visitNode(cbNode, node.colonToken) || + visitNode(cbNode, node.whenFalse); + }, + _a[227 /* SyntaxKind.SpreadElement */] = function forEachChildInSpreadElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[238 /* SyntaxKind.Block */] = forEachChildInBlock, + _a[265 /* SyntaxKind.ModuleBlock */] = forEachChildInBlock, + _a[308 /* SyntaxKind.SourceFile */] = function forEachChildInSourceFile(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements) || + visitNode(cbNode, node.endOfFileToken); + }, + _a[240 /* SyntaxKind.VariableStatement */] = function forEachChildInVariableStatement(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.declarationList); + }, + _a[258 /* SyntaxKind.VariableDeclarationList */] = function forEachChildInVariableDeclarationList(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.declarations); + }, + _a[241 /* SyntaxKind.ExpressionStatement */] = function forEachChildInExpressionStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[242 /* SyntaxKind.IfStatement */] = function forEachChildInIfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.thenStatement) || + visitNode(cbNode, node.elseStatement); + }, + _a[243 /* SyntaxKind.DoStatement */] = function forEachChildInDoStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.statement) || + visitNode(cbNode, node.expression); + }, + _a[244 /* SyntaxKind.WhileStatement */] = function forEachChildInWhileStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[245 /* SyntaxKind.ForStatement */] = function forEachChildInForStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.incrementor) || + visitNode(cbNode, node.statement); + }, + _a[246 /* SyntaxKind.ForInStatement */] = function forEachChildInForInStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[247 /* SyntaxKind.ForOfStatement */] = function forEachChildInForOfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.awaitModifier) || + visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[248 /* SyntaxKind.ContinueStatement */] = forEachChildInContinueOrBreakStatement, + _a[249 /* SyntaxKind.BreakStatement */] = forEachChildInContinueOrBreakStatement, + _a[250 /* SyntaxKind.ReturnStatement */] = function forEachChildInReturnStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[251 /* SyntaxKind.WithStatement */] = function forEachChildInWithStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[252 /* SyntaxKind.SwitchStatement */] = function forEachChildInSwitchStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.caseBlock); + }, + _a[266 /* SyntaxKind.CaseBlock */] = function forEachChildInCaseBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.clauses); + }, + _a[292 /* SyntaxKind.CaseClause */] = function forEachChildInCaseClause(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNodes(cbNode, cbNodes, node.statements); + }, + _a[293 /* SyntaxKind.DefaultClause */] = function forEachChildInDefaultClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + }, + _a[253 /* SyntaxKind.LabeledStatement */] = function forEachChildInLabeledStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + }, + _a[254 /* SyntaxKind.ThrowStatement */] = function forEachChildInThrowStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[255 /* SyntaxKind.TryStatement */] = function forEachChildInTryStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tryBlock) || + visitNode(cbNode, node.catchClause) || + visitNode(cbNode, node.finallyBlock); + }, + _a[295 /* SyntaxKind.CatchClause */] = function forEachChildInCatchClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.variableDeclaration) || + visitNode(cbNode, node.block); + }, + _a[167 /* SyntaxKind.Decorator */] = function forEachChildInDecorator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[260 /* SyntaxKind.ClassDeclaration */] = forEachChildInClassDeclarationOrExpression, + _a[228 /* SyntaxKind.ClassExpression */] = forEachChildInClassDeclarationOrExpression, + _a[261 /* SyntaxKind.InterfaceDeclaration */] = function forEachChildInInterfaceDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[262 /* SyntaxKind.TypeAliasDeclaration */] = function forEachChildInTypeAliasDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNode(cbNode, node.type); + }, + _a[263 /* SyntaxKind.EnumDeclaration */] = function forEachChildInEnumDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[302 /* SyntaxKind.EnumMember */] = function forEachChildInEnumMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[264 /* SyntaxKind.ModuleDeclaration */] = function forEachChildInModuleDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); + }, + _a[268 /* SyntaxKind.ImportEqualsDeclaration */] = function forEachChildInImportEqualsDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.moduleReference); + }, + _a[269 /* SyntaxKind.ImportDeclaration */] = function forEachChildInImportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.importClause) || + visitNode(cbNode, node.moduleSpecifier) || + visitNode(cbNode, node.assertClause); + }, + _a[270 /* SyntaxKind.ImportClause */] = function forEachChildInImportClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.namedBindings); + }, + _a[296 /* SyntaxKind.AssertClause */] = function forEachChildInAssertClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[297 /* SyntaxKind.AssertEntry */] = function forEachChildInAssertEntry(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.value); + }, + _a[267 /* SyntaxKind.NamespaceExportDeclaration */] = function forEachChildInNamespaceExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNode(cbNode, node.name); + }, + _a[271 /* SyntaxKind.NamespaceImport */] = function forEachChildInNamespaceImport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[277 /* SyntaxKind.NamespaceExport */] = function forEachChildInNamespaceExport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[272 /* SyntaxKind.NamedImports */] = forEachChildInNamedImportsOrExports, + _a[276 /* SyntaxKind.NamedExports */] = forEachChildInNamedImportsOrExports, + _a[275 /* SyntaxKind.ExportDeclaration */] = function forEachChildInExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.exportClause) || + visitNode(cbNode, node.moduleSpecifier) || + visitNode(cbNode, node.assertClause); + }, + _a[273 /* SyntaxKind.ImportSpecifier */] = forEachChildInImportOrExportSpecifier, + _a[278 /* SyntaxKind.ExportSpecifier */] = forEachChildInImportOrExportSpecifier, + _a[274 /* SyntaxKind.ExportAssignment */] = function forEachChildInExportAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.expression); + }, + _a[225 /* SyntaxKind.TemplateExpression */] = function forEachChildInTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || + visitNodes(cbNode, cbNodes, node.templateSpans); + }, + _a[236 /* SyntaxKind.TemplateSpan */] = function forEachChildInTemplateSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.literal); + }, + _a[200 /* SyntaxKind.TemplateLiteralType */] = function forEachChildInTemplateLiteralType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || + visitNodes(cbNode, cbNodes, node.templateSpans); + }, + _a[201 /* SyntaxKind.TemplateLiteralTypeSpan */] = function forEachChildInTemplateLiteralTypeSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.literal); + }, + _a[164 /* SyntaxKind.ComputedPropertyName */] = function forEachChildInComputedPropertyName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[294 /* SyntaxKind.HeritageClause */] = function forEachChildInHeritageClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + }, + _a[230 /* SyntaxKind.ExpressionWithTypeArguments */] = function forEachChildInExpressionWithTypeArguments(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[280 /* SyntaxKind.ExternalModuleReference */] = function forEachChildInExternalModuleReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[279 /* SyntaxKind.MissingDeclaration */] = function forEachChildInMissingDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers); + }, + _a[354 /* SyntaxKind.CommaListExpression */] = function forEachChildInCommaListExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[281 /* SyntaxKind.JsxElement */] = function forEachChildInJsxElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingElement) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingElement); + }, + _a[285 /* SyntaxKind.JsxFragment */] = function forEachChildInJsxFragment(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingFragment) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingFragment); + }, + _a[282 /* SyntaxKind.JsxSelfClosingElement */] = forEachChildInJsxOpeningOrSelfClosingElement, + _a[283 /* SyntaxKind.JsxOpeningElement */] = forEachChildInJsxOpeningOrSelfClosingElement, + _a[289 /* SyntaxKind.JsxAttributes */] = function forEachChildInJsxAttributes(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, + _a[288 /* SyntaxKind.JsxAttribute */] = function forEachChildInJsxAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[290 /* SyntaxKind.JsxSpreadAttribute */] = function forEachChildInJsxSpreadAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[291 /* SyntaxKind.JsxExpression */] = function forEachChildInJsxExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.expression); + }, + _a[284 /* SyntaxKind.JsxClosingElement */] = function forEachChildInJsxClosingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tagName); + }, + _a[187 /* SyntaxKind.OptionalType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[188 /* SyntaxKind.RestType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[312 /* SyntaxKind.JSDocTypeExpression */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[318 /* SyntaxKind.JSDocNonNullableType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[317 /* SyntaxKind.JSDocNullableType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[319 /* SyntaxKind.JSDocOptionalType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[321 /* SyntaxKind.JSDocVariadicType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[320 /* SyntaxKind.JSDocFunctionType */] = function forEachChildInJSDocFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[323 /* SyntaxKind.JSDoc */] = function forEachChildInJSDoc(node, cbNode, cbNodes) { + return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) + || visitNodes(cbNode, cbNodes, node.tags); + }, + _a[349 /* SyntaxKind.JSDocSeeTag */] = function forEachChildInJSDocSeeTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.name) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[313 /* SyntaxKind.JSDocNameReference */] = function forEachChildInJSDocNameReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[314 /* SyntaxKind.JSDocMemberName */] = function forEachChildInJSDocMemberName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + }, + _a[343 /* SyntaxKind.JSDocParameterTag */] = forEachChildInJSDocParameterOrPropertyTag, + _a[350 /* SyntaxKind.JSDocPropertyTag */] = forEachChildInJSDocParameterOrPropertyTag, + _a[333 /* SyntaxKind.JSDocAuthorTag */] = function forEachChildInJSDocAuthorTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[332 /* SyntaxKind.JSDocImplementsTag */] = function forEachChildInJSDocImplementsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.class) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[331 /* SyntaxKind.JSDocAugmentsTag */] = function forEachChildInJSDocAugmentsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.class) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[347 /* SyntaxKind.JSDocTemplateTag */] = function forEachChildInJSDocTemplateTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.constraint) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[348 /* SyntaxKind.JSDocTypedefTag */] = function forEachChildInJSDocTypedefTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (node.typeExpression && + node.typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */ + ? visitNode(cbNode, node.typeExpression) || + visitNode(cbNode, node.fullName) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) + : visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); + }, + _a[341 /* SyntaxKind.JSDocCallbackTag */] = function forEachChildInJSDocCallbackTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[344 /* SyntaxKind.JSDocReturnTag */] = forEachChildInJSDocReturnTag, + _a[346 /* SyntaxKind.JSDocTypeTag */] = forEachChildInJSDocReturnTag, + _a[345 /* SyntaxKind.JSDocThisTag */] = forEachChildInJSDocReturnTag, + _a[342 /* SyntaxKind.JSDocEnumTag */] = forEachChildInJSDocReturnTag, + _a[326 /* SyntaxKind.JSDocSignature */] = function forEachChildInJSDocSignature(node, cbNode, _cbNodes) { + return ts.forEach(node.typeParameters, cbNode) || + ts.forEach(node.parameters, cbNode) || + visitNode(cbNode, node.type); + }, + _a[327 /* SyntaxKind.JSDocLink */] = forEachChildInJSDocLinkCodeOrPlain, + _a[328 /* SyntaxKind.JSDocLinkCode */] = forEachChildInJSDocLinkCodeOrPlain, + _a[329 /* SyntaxKind.JSDocLinkPlain */] = forEachChildInJSDocLinkCodeOrPlain, + _a[325 /* SyntaxKind.JSDocTypeLiteral */] = function forEachChildInJSDocTypeLiteral(node, cbNode, _cbNodes) { + return ts.forEach(node.jsDocPropertyTags, cbNode); + }, + _a[330 /* SyntaxKind.JSDocTag */] = forEachChildInJSDocTag, + _a[335 /* SyntaxKind.JSDocClassTag */] = forEachChildInJSDocTag, + _a[336 /* SyntaxKind.JSDocPublicTag */] = forEachChildInJSDocTag, + _a[337 /* SyntaxKind.JSDocPrivateTag */] = forEachChildInJSDocTag, + _a[338 /* SyntaxKind.JSDocProtectedTag */] = forEachChildInJSDocTag, + _a[339 /* SyntaxKind.JSDocReadonlyTag */] = forEachChildInJSDocTag, + _a[334 /* SyntaxKind.JSDocDeprecatedTag */] = forEachChildInJSDocTag, + _a[340 /* SyntaxKind.JSDocOverrideTag */] = forEachChildInJSDocTag, + _a[353 /* SyntaxKind.PartiallyEmittedExpression */] = forEachChildInPartiallyEmittedExpression, + _a); + // shared + function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + } + function forEachChildInUnionOrIntersectionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + } + function forEachChildInParenthesizedTypeOrTypeOperator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInObjectOrArrayBindingPattern(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInCallOrNewExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + // TODO: should we separate these branches out? + visitNode(cbNode, node.questionDotToken) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNodes(cbNode, cbNodes, node.arguments); + } + function forEachChildInBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + } + function forEachChildInContinueOrBreakStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label); + } + function forEachChildInClassDeclarationOrExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); + } + function forEachChildInNamedImportsOrExports(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInImportOrExportSpecifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name); + } + function forEachChildInJsxOpeningOrSelfClosingElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNode(cbNode, node.attributes); + } + function forEachChildInOptionalRestOrJSDocParameterModifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInJSDocParameterOrPropertyTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (node.isNameFirst + ? visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression) + : visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name)) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocReturnTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocLinkCodeOrPlain(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + } + function forEachChildInJSDocTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) + || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInPartiallyEmittedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + } /** * Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes * stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise, @@ -30945,562 +31926,11 @@ var ts; * that they appear in the source code. The language service depends on this property to locate nodes by position. */ function forEachChild(node, cbNode, cbNodes) { - if (!node || node.kind <= 160 /* SyntaxKind.LastToken */) { + if (node === undefined || node.kind <= 162 /* SyntaxKind.LastToken */) { return; } - switch (node.kind) { - case 161 /* SyntaxKind.QualifiedName */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); - case 163 /* SyntaxKind.TypeParameter */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.constraint) || - visitNode(cbNode, node.default) || - visitNode(cbNode, node.expression); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.equalsToken) || - visitNode(cbNode, node.objectAssignmentInitializer); - case 298 /* SyntaxKind.SpreadAssignment */: - return visitNode(cbNode, node.expression); - case 164 /* SyntaxKind.Parameter */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 166 /* SyntaxKind.PropertySignature */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 296 /* SyntaxKind.PropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.initializer); - case 254 /* SyntaxKind.VariableDeclaration */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 203 /* SyntaxKind.BindingElement */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 176 /* SyntaxKind.IndexSignature */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 180 /* SyntaxKind.ConstructorType */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 179 /* SyntaxKind.FunctionType */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - return visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 169 /* SyntaxKind.MethodDeclaration */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 168 /* SyntaxKind.MethodSignature */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 171 /* SyntaxKind.Constructor */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 172 /* SyntaxKind.GetAccessor */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 173 /* SyntaxKind.SetAccessor */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 256 /* SyntaxKind.FunctionDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 213 /* SyntaxKind.FunctionExpression */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 214 /* SyntaxKind.ArrowFunction */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.equalsGreaterThanToken) || - visitNode(cbNode, node.body); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.body); - case 178 /* SyntaxKind.TypeReference */: - return visitNode(cbNode, node.typeName) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 177 /* SyntaxKind.TypePredicate */: - return visitNode(cbNode, node.assertsModifier) || - visitNode(cbNode, node.parameterName) || - visitNode(cbNode, node.type); - case 181 /* SyntaxKind.TypeQuery */: - return visitNode(cbNode, node.exprName) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 182 /* SyntaxKind.TypeLiteral */: - return visitNodes(cbNode, cbNodes, node.members); - case 183 /* SyntaxKind.ArrayType */: - return visitNode(cbNode, node.elementType); - case 184 /* SyntaxKind.TupleType */: - return visitNodes(cbNode, cbNodes, node.elements); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - return visitNodes(cbNode, cbNodes, node.types); - case 189 /* SyntaxKind.ConditionalType */: - return visitNode(cbNode, node.checkType) || - visitNode(cbNode, node.extendsType) || - visitNode(cbNode, node.trueType) || - visitNode(cbNode, node.falseType); - case 190 /* SyntaxKind.InferType */: - return visitNode(cbNode, node.typeParameter); - case 200 /* SyntaxKind.ImportType */: - return visitNode(cbNode, node.argument) || - visitNode(cbNode, node.assertions) || - visitNode(cbNode, node.qualifier) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 295 /* SyntaxKind.ImportTypeAssertionContainer */: - return visitNode(cbNode, node.assertClause); - case 191 /* SyntaxKind.ParenthesizedType */: - case 193 /* SyntaxKind.TypeOperator */: - return visitNode(cbNode, node.type); - case 194 /* SyntaxKind.IndexedAccessType */: - return visitNode(cbNode, node.objectType) || - visitNode(cbNode, node.indexType); - case 195 /* SyntaxKind.MappedType */: - return visitNode(cbNode, node.readonlyToken) || - visitNode(cbNode, node.typeParameter) || - visitNode(cbNode, node.nameType) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNodes(cbNode, cbNodes, node.members); - case 196 /* SyntaxKind.LiteralType */: - return visitNode(cbNode, node.literal); - case 197 /* SyntaxKind.NamedTupleMember */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - return visitNodes(cbNode, cbNodes, node.elements); - case 204 /* SyntaxKind.ArrayLiteralExpression */: - return visitNodes(cbNode, cbNodes, node.elements); - case 205 /* SyntaxKind.ObjectLiteralExpression */: - return visitNodes(cbNode, cbNodes, node.properties); - case 206 /* SyntaxKind.PropertyAccessExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNode(cbNode, node.name); - case 207 /* SyntaxKind.ElementAccessExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNode(cbNode, node.argumentExpression); - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNodes(cbNode, cbNodes, node.arguments); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - return visitNode(cbNode, node.tag) || - visitNode(cbNode, node.questionDotToken) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNode(cbNode, node.template); - case 211 /* SyntaxKind.TypeAssertionExpression */: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.expression); - case 212 /* SyntaxKind.ParenthesizedExpression */: - return visitNode(cbNode, node.expression); - case 215 /* SyntaxKind.DeleteExpression */: - return visitNode(cbNode, node.expression); - case 216 /* SyntaxKind.TypeOfExpression */: - return visitNode(cbNode, node.expression); - case 217 /* SyntaxKind.VoidExpression */: - return visitNode(cbNode, node.expression); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - return visitNode(cbNode, node.operand); - case 224 /* SyntaxKind.YieldExpression */: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); - case 218 /* SyntaxKind.AwaitExpression */: - return visitNode(cbNode, node.expression); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - return visitNode(cbNode, node.operand); - case 221 /* SyntaxKind.BinaryExpression */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.operatorToken) || - visitNode(cbNode, node.right); - case 229 /* SyntaxKind.AsExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.type); - case 230 /* SyntaxKind.NonNullExpression */: - return visitNode(cbNode, node.expression); - case 231 /* SyntaxKind.MetaProperty */: - return visitNode(cbNode, node.name); - case 222 /* SyntaxKind.ConditionalExpression */: - return visitNode(cbNode, node.condition) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.whenTrue) || - visitNode(cbNode, node.colonToken) || - visitNode(cbNode, node.whenFalse); - case 225 /* SyntaxKind.SpreadElement */: - return visitNode(cbNode, node.expression); - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - return visitNodes(cbNode, cbNodes, node.statements); - case 305 /* SyntaxKind.SourceFile */: - return visitNodes(cbNode, cbNodes, node.statements) || - visitNode(cbNode, node.endOfFileToken); - case 237 /* SyntaxKind.VariableStatement */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.declarationList); - case 255 /* SyntaxKind.VariableDeclarationList */: - return visitNodes(cbNode, cbNodes, node.declarations); - case 238 /* SyntaxKind.ExpressionStatement */: - return visitNode(cbNode, node.expression); - case 239 /* SyntaxKind.IfStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.thenStatement) || - visitNode(cbNode, node.elseStatement); - case 240 /* SyntaxKind.DoStatement */: - return visitNode(cbNode, node.statement) || - visitNode(cbNode, node.expression); - case 241 /* SyntaxKind.WhileStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 242 /* SyntaxKind.ForStatement */: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.condition) || - visitNode(cbNode, node.incrementor) || - visitNode(cbNode, node.statement); - case 243 /* SyntaxKind.ForInStatement */: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 244 /* SyntaxKind.ForOfStatement */: - return visitNode(cbNode, node.awaitModifier) || - visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: - return visitNode(cbNode, node.label); - case 247 /* SyntaxKind.ReturnStatement */: - return visitNode(cbNode, node.expression); - case 248 /* SyntaxKind.WithStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 249 /* SyntaxKind.SwitchStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.caseBlock); - case 263 /* SyntaxKind.CaseBlock */: - return visitNodes(cbNode, cbNodes, node.clauses); - case 289 /* SyntaxKind.CaseClause */: - return visitNode(cbNode, node.expression) || - visitNodes(cbNode, cbNodes, node.statements); - case 290 /* SyntaxKind.DefaultClause */: - return visitNodes(cbNode, cbNodes, node.statements); - case 250 /* SyntaxKind.LabeledStatement */: - return visitNode(cbNode, node.label) || - visitNode(cbNode, node.statement); - case 251 /* SyntaxKind.ThrowStatement */: - return visitNode(cbNode, node.expression); - case 252 /* SyntaxKind.TryStatement */: - return visitNode(cbNode, node.tryBlock) || - visitNode(cbNode, node.catchClause) || - visitNode(cbNode, node.finallyBlock); - case 292 /* SyntaxKind.CatchClause */: - return visitNode(cbNode, node.variableDeclaration) || - visitNode(cbNode, node.block); - case 165 /* SyntaxKind.Decorator */: - return visitNode(cbNode, node.expression); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.heritageClauses) || - visitNodes(cbNode, cbNodes, node.members); - case 258 /* SyntaxKind.InterfaceDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.heritageClauses) || - visitNodes(cbNode, cbNodes, node.members); - case 259 /* SyntaxKind.TypeAliasDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNode(cbNode, node.type); - case 260 /* SyntaxKind.EnumDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.members); - case 299 /* SyntaxKind.EnumMember */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 261 /* SyntaxKind.ModuleDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.body); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.moduleReference); - case 266 /* SyntaxKind.ImportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.importClause) || - visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); - case 267 /* SyntaxKind.ImportClause */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.namedBindings); - case 293 /* SyntaxKind.AssertClause */: - return visitNodes(cbNode, cbNodes, node.elements); - case 294 /* SyntaxKind.AssertEntry */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.value); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNode(cbNode, node.name); - case 268 /* SyntaxKind.NamespaceImport */: - return visitNode(cbNode, node.name); - case 274 /* SyntaxKind.NamespaceExport */: - return visitNode(cbNode, node.name); - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: - return visitNodes(cbNode, cbNodes, node.elements); - case 272 /* SyntaxKind.ExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.exportClause) || - visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: - return visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name); - case 271 /* SyntaxKind.ExportAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.expression); - case 223 /* SyntaxKind.TemplateExpression */: - return visitNode(cbNode, node.head) || - visitNodes(cbNode, cbNodes, node.templateSpans); - case 233 /* SyntaxKind.TemplateSpan */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.literal); - case 198 /* SyntaxKind.TemplateLiteralType */: - return visitNode(cbNode, node.head) || - visitNodes(cbNode, cbNodes, node.templateSpans); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.literal); - case 162 /* SyntaxKind.ComputedPropertyName */: - return visitNode(cbNode, node.expression); - case 291 /* SyntaxKind.HeritageClause */: - return visitNodes(cbNode, cbNodes, node.types); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - return visitNode(cbNode, node.expression) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 277 /* SyntaxKind.ExternalModuleReference */: - return visitNode(cbNode, node.expression); - case 276 /* SyntaxKind.MissingDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers); - case 351 /* SyntaxKind.CommaListExpression */: - return visitNodes(cbNode, cbNodes, node.elements); - case 278 /* SyntaxKind.JsxElement */: - return visitNode(cbNode, node.openingElement) || - visitNodes(cbNode, cbNodes, node.children) || - visitNode(cbNode, node.closingElement); - case 282 /* SyntaxKind.JsxFragment */: - return visitNode(cbNode, node.openingFragment) || - visitNodes(cbNode, cbNodes, node.children) || - visitNode(cbNode, node.closingFragment); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - return visitNode(cbNode, node.tagName) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNode(cbNode, node.attributes); - case 286 /* SyntaxKind.JsxAttributes */: - return visitNodes(cbNode, cbNodes, node.properties); - case 285 /* SyntaxKind.JsxAttribute */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 287 /* SyntaxKind.JsxSpreadAttribute */: - return visitNode(cbNode, node.expression); - case 288 /* SyntaxKind.JsxExpression */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.expression); - case 281 /* SyntaxKind.JsxClosingElement */: - return visitNode(cbNode, node.tagName); - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 316 /* SyntaxKind.JSDocOptionalType */: - case 318 /* SyntaxKind.JSDocVariadicType */: - return visitNode(cbNode, node.type); - case 317 /* SyntaxKind.JSDocFunctionType */: - return visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 320 /* SyntaxKind.JSDoc */: - return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - || visitNodes(cbNode, cbNodes, node.tags); - case 346 /* SyntaxKind.JSDocSeeTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.name) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 310 /* SyntaxKind.JSDocNameReference */: - return visitNode(cbNode, node.name); - case 311 /* SyntaxKind.JSDocMemberName */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - return visitNode(cbNode, node.tagName) || - (node.isNameFirst - ? visitNode(cbNode, node.name) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - : visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.name) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); - case 330 /* SyntaxKind.JSDocAuthorTag */: - return visitNode(cbNode, node.tagName) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 329 /* SyntaxKind.JSDocImplementsTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.class) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 328 /* SyntaxKind.JSDocAugmentsTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.class) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 344 /* SyntaxKind.JSDocTemplateTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.constraint) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 345 /* SyntaxKind.JSDocTypedefTag */: - return visitNode(cbNode, node.tagName) || - (node.typeExpression && - node.typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */ - ? visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.fullName) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - : visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); - case 338 /* SyntaxKind.JSDocCallbackTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 341 /* SyntaxKind.JSDocReturnTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: - case 342 /* SyntaxKind.JSDocThisTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 323 /* SyntaxKind.JSDocSignature */: - return ts.forEach(node.typeParameters, cbNode) || - ts.forEach(node.parameters, cbNode) || - visitNode(cbNode, node.type); - case 324 /* SyntaxKind.JSDocLink */: - case 325 /* SyntaxKind.JSDocLinkCode */: - case 326 /* SyntaxKind.JSDocLinkPlain */: - return visitNode(cbNode, node.name); - case 322 /* SyntaxKind.JSDocTypeLiteral */: - return ts.forEach(node.jsDocPropertyTags, cbNode); - case 327 /* SyntaxKind.JSDocTag */: - case 332 /* SyntaxKind.JSDocClassTag */: - case 333 /* SyntaxKind.JSDocPublicTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 336 /* SyntaxKind.JSDocReadonlyTag */: - case 331 /* SyntaxKind.JSDocDeprecatedTag */: - return visitNode(cbNode, node.tagName) - || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - return visitNode(cbNode, node.expression); - } + var fn = forEachChildTable[node.kind]; + return fn === undefined ? undefined : fn(node, cbNode, cbNodes); } ts.forEachChild = forEachChild; /** @internal */ @@ -31547,7 +31977,7 @@ var ts; continue; return res; } - if (current.kind >= 161 /* SyntaxKind.FirstNode */) { + if (current.kind >= 163 /* SyntaxKind.FirstNode */) { // add children in reverse order to the queue, so popping gives the first child for (var _i = 0, _a = gatherPossibleChildren(current); _i < _a.length; _i++) { var child = _a[_i]; @@ -32372,7 +32802,7 @@ var ts; } // If we have a 'await' keyword, and we're in the [Await] context, then 'await' is // considered a keyword and is not an identifier. - if (token() === 132 /* SyntaxKind.AwaitKeyword */ && inAwaitContext()) { + if (token() === 133 /* SyntaxKind.AwaitKeyword */ && inAwaitContext()) { return false; } return token() > 116 /* SyntaxKind.LastReservedWord */; @@ -32618,7 +33048,7 @@ var ts; ts.isTemplateLiteralKind(kind) ? factory.createTemplateLiteralLikeNode(kind, "", "", /*templateFlags*/ undefined) : kind === 8 /* SyntaxKind.NumericLiteral */ ? factory.createNumericLiteral("", /*numericLiteralFlags*/ undefined) : kind === 10 /* SyntaxKind.StringLiteral */ ? factory.createStringLiteral("", /*isSingleQuote*/ undefined) : - kind === 276 /* SyntaxKind.MissingDeclaration */ ? factory.createMissingDeclaration() : + kind === 279 /* SyntaxKind.MissingDeclaration */ ? factory.createMissingDeclaration() : factory.createToken(kind); return finishNode(result, pos); } @@ -32717,7 +33147,7 @@ var ts; } function parsePrivateIdentifier() { var pos = getNodePos(); - var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenText())); + var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenValue())); nextToken(); return finishNode(node, pos); } @@ -32741,15 +33171,16 @@ var ts; if (token() === 88 /* SyntaxKind.DefaultKeyword */) { return lookAhead(nextTokenCanFollowDefaultKeyword); } - if (token() === 152 /* SyntaxKind.TypeKeyword */) { + if (token() === 154 /* SyntaxKind.TypeKeyword */) { return lookAhead(nextTokenCanFollowExportModifier); } return canFollowExportModifier(); case 88 /* SyntaxKind.DefaultKeyword */: return nextTokenCanFollowDefaultKeyword(); + case 127 /* SyntaxKind.AccessorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: nextToken(); return canFollowModifier(); default: @@ -32758,7 +33189,7 @@ var ts; } function canFollowExportModifier() { return token() !== 41 /* SyntaxKind.AsteriskToken */ - && token() !== 127 /* SyntaxKind.AsKeyword */ + && token() !== 128 /* SyntaxKind.AsKeyword */ && token() !== 18 /* SyntaxKind.OpenBraceToken */ && canFollowModifier(); } @@ -32781,7 +33212,7 @@ var ts; return token() === 84 /* SyntaxKind.ClassKeyword */ || token() === 98 /* SyntaxKind.FunctionKeyword */ || token() === 118 /* SyntaxKind.InterfaceKeyword */ || (token() === 126 /* SyntaxKind.AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine)) || - (token() === 131 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); + (token() === 132 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); } // True if positioned at the start of a list element function isListElement(parsingContext, inErrorRecovery) { @@ -33161,20 +33592,20 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 176 /* SyntaxKind.IndexSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 234 /* SyntaxKind.SemicolonClassElement */: + case 173 /* SyntaxKind.Constructor */: + case 178 /* SyntaxKind.IndexSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 237 /* SyntaxKind.SemicolonClassElement */: return true; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // Method declarations are not necessarily reusable. An object-literal // may have a method calls "constructor(...)" and we must reparse that // into an actual .ConstructorDeclaration. var methodDeclaration = node; var nameIsConstructor = methodDeclaration.name.kind === 79 /* SyntaxKind.Identifier */ && - methodDeclaration.name.originalKeywordKind === 134 /* SyntaxKind.ConstructorKeyword */; + methodDeclaration.name.originalKeywordKind === 135 /* SyntaxKind.ConstructorKeyword */; return !nameIsConstructor; } } @@ -33183,8 +33614,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: return true; } } @@ -33193,58 +33624,58 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 235 /* SyntaxKind.Block */: - case 239 /* SyntaxKind.IfStatement */: - case 238 /* SyntaxKind.ExpressionStatement */: - case 251 /* SyntaxKind.ThrowStatement */: - case 247 /* SyntaxKind.ReturnStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 236 /* SyntaxKind.EmptyStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 250 /* SyntaxKind.LabeledStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 253 /* SyntaxKind.DebuggerStatement */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 238 /* SyntaxKind.Block */: + case 242 /* SyntaxKind.IfStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 254 /* SyntaxKind.ThrowStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 239 /* SyntaxKind.EmptyStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 253 /* SyntaxKind.LabeledStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 299 /* SyntaxKind.EnumMember */; + return node.kind === 302 /* SyntaxKind.EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 166 /* SyntaxKind.PropertySignature */: - case 174 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 168 /* SyntaxKind.PropertySignature */: + case 176 /* SyntaxKind.CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 254 /* SyntaxKind.VariableDeclaration */) { + if (node.kind !== 257 /* SyntaxKind.VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -33265,7 +33696,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 164 /* SyntaxKind.Parameter */) { + if (node.kind !== 166 /* SyntaxKind.Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -33558,14 +33989,14 @@ var ts; // If true, we should abort parsing an error function. function typeHasArrowFunctionBlockingParseError(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return ts.nodeIsMissing(node.typeName); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: { + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: { var _a = node, parameters = _a.parameters, type = _a.type; return isMissingList(parameters) || typeHasArrowFunctionBlockingParseError(type); } - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return typeHasArrowFunctionBlockingParseError(node.type); default: return false; @@ -33644,7 +34075,7 @@ var ts; function parseJSDocType() { scanner.setInJSDocType(true); var pos = getNodePos(); - if (parseOptional(141 /* SyntaxKind.ModuleKeyword */)) { + if (parseOptional(142 /* SyntaxKind.ModuleKeyword */)) { // TODO(rbuckton): We never set the type for a JSDocNamepathType. What should we put here? var moduleTag = factory.createJSDocNamepathType(/*type*/ undefined); terminate: while (true) { @@ -33860,14 +34291,14 @@ var ts; function parseSignatureMember(kind) { var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); - if (kind === 175 /* SyntaxKind.ConstructSignature */) { + if (kind === 177 /* SyntaxKind.ConstructSignature */) { parseExpected(103 /* SyntaxKind.NewKeyword */); } var typeParameters = parseTypeParameters(); var parameters = parseParameters(4 /* SignatureFlags.Type */); var type = parseReturnType(58 /* SyntaxKind.ColonToken */, /*isType*/ true); parseTypeMemberSemicolon(); - var node = kind === 174 /* SyntaxKind.CallSignature */ + var node = kind === 176 /* SyntaxKind.CallSignature */ ? factory.createCallSignature(typeParameters, parameters, type) : factory.createConstructSignature(typeParameters, parameters, type); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -33961,8 +34392,8 @@ var ts; // Return true if we have the start of a signature member if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || - token() === 136 /* SyntaxKind.GetKeyword */ || - token() === 149 /* SyntaxKind.SetKeyword */) { + token() === 137 /* SyntaxKind.GetKeyword */ || + token() === 151 /* SyntaxKind.SetKeyword */) { return true; } var idToken = false; @@ -33994,19 +34425,19 @@ var ts; } function parseTypeMember() { if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */) { - return parseSignatureMember(174 /* SyntaxKind.CallSignature */); + return parseSignatureMember(176 /* SyntaxKind.CallSignature */); } if (token() === 103 /* SyntaxKind.NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) { - return parseSignatureMember(175 /* SyntaxKind.ConstructSignature */); + return parseSignatureMember(177 /* SyntaxKind.ConstructSignature */); } var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); var modifiers = parseModifiers(); - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 172 /* SyntaxKind.GetAccessor */, 4 /* SignatureFlags.Type */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 174 /* SyntaxKind.GetAccessor */, 4 /* SignatureFlags.Type */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 173 /* SyntaxKind.SetAccessor */, 4 /* SignatureFlags.Type */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 175 /* SyntaxKind.SetAccessor */, 4 /* SignatureFlags.Type */); } if (isIndexSignature()) { return parseIndexSignatureDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers); @@ -34047,9 +34478,9 @@ var ts; function isStartOfMappedType() { nextToken(); if (token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { - return nextToken() === 145 /* SyntaxKind.ReadonlyKeyword */; + return nextToken() === 146 /* SyntaxKind.ReadonlyKeyword */; } - if (token() === 145 /* SyntaxKind.ReadonlyKeyword */) { + if (token() === 146 /* SyntaxKind.ReadonlyKeyword */) { nextToken(); } return token() === 22 /* SyntaxKind.OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 101 /* SyntaxKind.InKeyword */; @@ -34065,15 +34496,15 @@ var ts; var pos = getNodePos(); parseExpected(18 /* SyntaxKind.OpenBraceToken */); var readonlyToken; - if (token() === 145 /* SyntaxKind.ReadonlyKeyword */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { + if (token() === 146 /* SyntaxKind.ReadonlyKeyword */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { readonlyToken = parseTokenNode(); - if (readonlyToken.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { - parseExpected(145 /* SyntaxKind.ReadonlyKeyword */); + if (readonlyToken.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { + parseExpected(146 /* SyntaxKind.ReadonlyKeyword */); } } parseExpected(22 /* SyntaxKind.OpenBracketToken */); var typeParameter = parseMappedTypeParameter(); - var nameType = parseOptional(127 /* SyntaxKind.AsKeyword */) ? parseType() : undefined; + var nameType = parseOptional(128 /* SyntaxKind.AsKeyword */) ? parseType() : undefined; parseExpected(23 /* SyntaxKind.CloseBracketToken */); var questionToken; if (token() === 57 /* SyntaxKind.QuestionToken */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { @@ -34187,7 +34618,7 @@ var ts; var openBracePosition = scanner.getTokenPos(); parseExpected(18 /* SyntaxKind.OpenBraceToken */); var multiLine = scanner.hasPrecedingLineBreak(); - parseExpected(129 /* SyntaxKind.AssertKeyword */); + parseExpected(130 /* SyntaxKind.AssertKeyword */); parseExpected(58 /* SyntaxKind.ColonToken */); var clause = parseAssertClause(/*skipAssertKeyword*/ true); if (!parseExpected(19 /* SyntaxKind.CloseBraceToken */)) { @@ -34220,16 +34651,16 @@ var ts; } function parseNonArrayType() { switch (token()) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: // If these are followed by a dot, then parse these out as a dotted type reference instead. return tryParse(parseKeywordAndNoDot) || parseTypeReference(); case 66 /* SyntaxKind.AsteriskEqualsToken */: @@ -34262,7 +34693,7 @@ var ts; return parseTokenNode(); case 108 /* SyntaxKind.ThisKeyword */: { var thisKeyword = parseThisTypeNode(); - if (token() === 139 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 140 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { return parseThisTypePredicate(thisKeyword); } else { @@ -34279,7 +34710,7 @@ var ts; return parseParenthesizedType(); case 100 /* SyntaxKind.ImportKeyword */: return parseImportType(); - case 128 /* SyntaxKind.AssertsKeyword */: + case 129 /* SyntaxKind.AssertsKeyword */: return lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine) ? parseAssertsTypePredicate() : parseTypeReference(); case 15 /* SyntaxKind.TemplateHead */: return parseTemplateType(); @@ -34289,21 +34720,21 @@ var ts; } function isStartOfType(inStartOfParameter) { switch (token()) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 108 /* SyntaxKind.ThisKeyword */: case 112 /* SyntaxKind.TypeOfKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: case 18 /* SyntaxKind.OpenBraceToken */: case 22 /* SyntaxKind.OpenBracketToken */: case 29 /* SyntaxKind.LessThanToken */: @@ -34315,14 +34746,14 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 41 /* SyntaxKind.AsteriskToken */: case 57 /* SyntaxKind.QuestionToken */: case 53 /* SyntaxKind.ExclamationToken */: case 25 /* SyntaxKind.DotDotDotToken */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: case 100 /* SyntaxKind.ImportKeyword */: - case 128 /* SyntaxKind.AssertsKeyword */: + case 129 /* SyntaxKind.AssertsKeyword */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 15 /* SyntaxKind.TemplateHead */: return true; @@ -34399,17 +34830,17 @@ var ts; } function parseInferType() { var pos = getNodePos(); - parseExpected(137 /* SyntaxKind.InferKeyword */); + parseExpected(138 /* SyntaxKind.InferKeyword */); return finishNode(factory.createInferTypeNode(parseTypeParameterOfInferType()), pos); } function parseTypeOperatorOrHigher() { var operator = token(); switch (operator) { - case 140 /* SyntaxKind.KeyOfKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: return parseTypeOperator(operator); - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: return parseInferType(); } return allowConditionalTypesAnd(parsePostfixTypeOrHigher); @@ -34529,16 +34960,16 @@ var ts; } function parseTypePredicatePrefix() { var id = parseIdentifier(); - if (token() === 139 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 140 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { nextToken(); return id; } } function parseAssertsTypePredicate() { var pos = getNodePos(); - var assertsModifier = parseExpectedToken(128 /* SyntaxKind.AssertsKeyword */); + var assertsModifier = parseExpectedToken(129 /* SyntaxKind.AssertsKeyword */); var parameterName = token() === 108 /* SyntaxKind.ThisKeyword */ ? parseThisTypeNode() : parseIdentifier(); - var type = parseOptional(139 /* SyntaxKind.IsKeyword */) ? parseType() : undefined; + var type = parseOptional(140 /* SyntaxKind.IsKeyword */) ? parseType() : undefined; return finishNode(factory.createTypePredicateNode(assertsModifier, parameterName, type), pos); } function parseType() { @@ -34608,7 +35039,7 @@ var ts; case 45 /* SyntaxKind.PlusPlusToken */: case 46 /* SyntaxKind.MinusMinusToken */: case 29 /* SyntaxKind.LessThanToken */: - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: case 125 /* SyntaxKind.YieldKeyword */: case 80 /* SyntaxKind.PrivateIdentifier */: // Yield/await always starts an expression. Either it is an identifier (in which case @@ -34796,7 +35227,7 @@ var ts; // Unknown -> There *might* be a parenthesized arrow function here. // Speculatively look ahead to be sure, and rollback if not. function isParenthesizedArrowFunctionExpression() { - if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || token() === 132 /* SyntaxKind.AsyncKeyword */) { return lookAhead(isParenthesizedArrowFunctionExpressionWorker); } if (token() === 38 /* SyntaxKind.EqualsGreaterThanToken */) { @@ -34809,7 +35240,7 @@ var ts; return 0 /* Tristate.False */; } function isParenthesizedArrowFunctionExpressionWorker() { - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { nextToken(); if (scanner.hasPrecedingLineBreak()) { return 0 /* Tristate.False */; @@ -34853,8 +35284,8 @@ var ts; // Check for "(xxx yyy", where xxx is a modifier and yyy is an identifier. This // isn't actually allowed, but we want to treat it as a lambda so we can provide // a good error message. - if (ts.isModifierKind(second) && second !== 131 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) { - if (nextToken() === 127 /* SyntaxKind.AsKeyword */) { + if (ts.isModifierKind(second) && second !== 132 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) { + if (nextToken() === 128 /* SyntaxKind.AsKeyword */) { // https://github.com/microsoft/TypeScript/issues/44466 return 0 /* Tristate.False */; } @@ -34936,7 +35367,7 @@ var ts; } function tryParseAsyncSimpleArrowFunctionExpression(allowReturnTypeInArrowFunction) { // We do a check here so that we won't be doing unnecessarily call to "lookAhead" - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* Tristate.True */) { var pos = getNodePos(); var asyncModifier = parseModifiersForArrowFunction(); @@ -34950,7 +35381,7 @@ var ts; // AsyncArrowFunctionExpression: // 1) async[no LineTerminator here]AsyncArrowBindingIdentifier[?Yield][no LineTerminator here]=>AsyncConciseBody[?In] // 2) CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In] - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { nextToken(); // If the "async" is followed by "=>" token then it is not a beginning of an async arrow-function // but instead a simple arrow-function which will be parsed inside "parseAssignmentExpressionOrHigher" @@ -35016,7 +35447,7 @@ var ts; // // So we need just a bit of lookahead to ensure that it can only be a signature. var unwrappedType = type; - while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 191 /* SyntaxKind.ParenthesizedType */) { + while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 193 /* SyntaxKind.ParenthesizedType */) { unwrappedType = unwrappedType.type; // Skip parens if need be } var hasJSDocFunctionType = unwrappedType && ts.isJSDocFunctionType(unwrappedType); @@ -35111,7 +35542,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand, pos); } function isInOrOfKeyword(t) { - return t === 101 /* SyntaxKind.InKeyword */ || t === 160 /* SyntaxKind.OfKeyword */; + return t === 101 /* SyntaxKind.InKeyword */ || t === 162 /* SyntaxKind.OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand, pos) { while (true) { @@ -35149,7 +35580,7 @@ var ts; if (token() === 101 /* SyntaxKind.InKeyword */ && inDisallowInContext()) { break; } - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */ || token() === 150 /* SyntaxKind.SatisfiesKeyword */) { // Make sure we *do* perform ASI for constructs like this: // var x = foo // as (Bar) @@ -35159,8 +35590,10 @@ var ts; break; } else { + var keywordKind = token(); nextToken(); - leftOperand = makeAsExpression(leftOperand, parseType()); + leftOperand = keywordKind === 150 /* SyntaxKind.SatisfiesKeyword */ ? makeSatisfiesExpression(leftOperand, parseType()) : + makeAsExpression(leftOperand, parseType()); } } else { @@ -35175,6 +35608,9 @@ var ts; } return ts.getBinaryOperatorPrecedence(token()) > 0; } + function makeSatisfiesExpression(left, right) { + return finishNode(factory.createSatisfiesExpression(left, right), left.pos); + } function makeBinaryExpression(left, operatorToken, right, pos) { return finishNode(factory.createBinaryExpression(left, operatorToken, right), pos); } @@ -35198,7 +35634,7 @@ var ts; return finishNode(factory.createVoidExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos); } function isAwaitExpression() { - if (token() === 132 /* SyntaxKind.AwaitKeyword */) { + if (token() === 133 /* SyntaxKind.AwaitKeyword */) { if (inAwaitContext()) { return true; } @@ -35251,7 +35687,7 @@ var ts; if (token() === 42 /* SyntaxKind.AsteriskAsteriskToken */) { var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); var end = simpleUnaryExpression.end; - if (simpleUnaryExpression.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (simpleUnaryExpression.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { parseErrorAt(pos, end, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { @@ -35292,7 +35728,7 @@ var ts; // UnaryExpression (modified): // < type > UnaryExpression return parseTypeAssertion(); - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: if (isAwaitExpression()) { return parseAwaitExpression(); } @@ -35322,7 +35758,7 @@ var ts; case 89 /* SyntaxKind.DeleteKeyword */: case 112 /* SyntaxKind.TypeOfKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: return false; case 29 /* SyntaxKind.LessThanToken */: // If we are not in JSX context, we are parsing TypeAssertion which is an UnaryExpression @@ -35505,11 +35941,11 @@ var ts; var pos = getNodePos(); var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); var result; - if (opening.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (opening.kind === 283 /* SyntaxKind.JsxOpeningElement */) { var children = parseJsxChildren(opening); var closingElement = void 0; var lastChild = children[children.length - 1]; - if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 278 /* SyntaxKind.JsxElement */ + if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 281 /* SyntaxKind.JsxElement */ && !tagNamesAreEquivalent(lastChild.openingElement.tagName, lastChild.closingElement.tagName) && tagNamesAreEquivalent(opening.tagName, lastChild.closingElement.tagName)) { // when an unclosed JsxOpeningElement incorrectly parses its parent's JsxClosingElement, @@ -35535,11 +35971,11 @@ var ts; } result = finishNode(factory.createJsxElement(opening, children, closingElement), pos); } - else if (opening.kind === 283 /* SyntaxKind.JsxOpeningFragment */) { + else if (opening.kind === 286 /* SyntaxKind.JsxOpeningFragment */) { result = finishNode(factory.createJsxFragment(opening, parseJsxChildren(opening), parseJsxClosingFragment(inExpressionContext)), pos); } else { - ts.Debug.assert(opening.kind === 279 /* SyntaxKind.JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 282 /* SyntaxKind.JsxSelfClosingElement */); // Nothing else to do for self-closing elements result = opening; } @@ -35609,7 +36045,7 @@ var ts; break; list.push(child); if (ts.isJsxOpeningElement(openingTag) - && (child === null || child === void 0 ? void 0 : child.kind) === 278 /* SyntaxKind.JsxElement */ + && (child === null || child === void 0 ? void 0 : child.kind) === 281 /* SyntaxKind.JsxElement */ && !tagNamesAreEquivalent(child.openingElement.tagName, child.closingElement.tagName) && tagNamesAreEquivalent(openingTag.tagName, child.closingElement.tagName)) { // stop after parsing a mismatched child like
...(
) in order to reattach the
higher @@ -35854,7 +36290,7 @@ var ts; } if (isTemplateStartOfTaggedTemplate()) { // Absorb type arguments into TemplateExpression when preceding expression is ExpressionWithTypeArguments - expression = !questionDotToken && expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ ? + expression = !questionDotToken && expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ ? parseTaggedTemplateRest(pos, expression.expression, questionDotToken, expression.typeArguments) : parseTaggedTemplateRest(pos, expression, questionDotToken, /*typeArguments*/ undefined); continue; @@ -35901,7 +36337,7 @@ var ts; } if (typeArguments || token() === 20 /* SyntaxKind.OpenParenToken */) { // Absorb type arguments into CallExpression when preceding expression is ExpressionWithTypeArguments - if (!questionDotToken && expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (!questionDotToken && expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -35987,7 +36423,7 @@ var ts; return parseArrayLiteralExpression(); case 18 /* SyntaxKind.OpenBraceToken */: return parseObjectLiteralExpression(); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // Async arrow functions are parsed earlier in parseAssignmentExpressionOrHigher. // If we encounter `async [no LineTerminator here] function` then this is an async // function; otherwise, its an identifier. @@ -36054,11 +36490,11 @@ var ts; } var decorators = parseDecorators(); var modifiers = parseModifiers(); - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 174 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 175 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); } var asteriskToken = parseOptionalToken(41 /* SyntaxKind.AsteriskToken */); var tokenIsIdentifier = isIdentifier(); @@ -36146,7 +36582,7 @@ var ts; var expression = parseMemberExpressionRest(expressionPos, parsePrimaryExpression(), /*allowOptionalChain*/ false); var typeArguments; // Absorb type arguments into NewExpression when preceding expression is ExpressionWithTypeArguments - if (expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -36250,7 +36686,7 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(97 /* SyntaxKind.ForKeyword */); - var awaitToken = parseOptionalToken(132 /* SyntaxKind.AwaitKeyword */); + var awaitToken = parseOptionalToken(133 /* SyntaxKind.AwaitKeyword */); parseExpected(20 /* SyntaxKind.OpenParenToken */); var initializer; if (token() !== 26 /* SyntaxKind.SemicolonToken */) { @@ -36262,7 +36698,7 @@ var ts; } } var node; - if (awaitToken ? parseExpected(160 /* SyntaxKind.OfKeyword */) : parseOptional(160 /* SyntaxKind.OfKeyword */)) { + if (awaitToken ? parseExpected(162 /* SyntaxKind.OfKeyword */) : parseOptional(162 /* SyntaxKind.OfKeyword */)) { var expression = allowInAnd(function () { return parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true); }); parseExpected(21 /* SyntaxKind.CloseParenToken */); node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement()); @@ -36289,10 +36725,10 @@ var ts; function parseBreakOrContinueStatement(kind) { var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(kind === 246 /* SyntaxKind.BreakStatement */ ? 81 /* SyntaxKind.BreakKeyword */ : 86 /* SyntaxKind.ContinueKeyword */); + parseExpected(kind === 249 /* SyntaxKind.BreakStatement */ ? 81 /* SyntaxKind.BreakKeyword */ : 86 /* SyntaxKind.ContinueKeyword */); var label = canParseSemicolon() ? undefined : parseIdentifier(); parseSemicolon(); - var node = kind === 246 /* SyntaxKind.BreakStatement */ + var node = kind === 249 /* SyntaxKind.BreakStatement */ ? factory.createBreakStatement(label) : factory.createContinueStatement(label); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -36483,25 +36919,26 @@ var ts; // // could be legal, it would add complexity for very little gain. case 118 /* SyntaxKind.InterfaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: return nextTokenIsIdentifierOnSameLine(); - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); case 126 /* SyntaxKind.AbstractKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: nextToken(); // ASI takes effect for this modifier. if (scanner.hasPrecedingLineBreak()) { return false; } continue; - case 157 /* SyntaxKind.GlobalKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: nextToken(); return token() === 18 /* SyntaxKind.OpenBraceToken */ || token() === 79 /* SyntaxKind.Identifier */ || token() === 93 /* SyntaxKind.ExportKeyword */; case 100 /* SyntaxKind.ImportKeyword */: @@ -36510,12 +36947,12 @@ var ts; token() === 18 /* SyntaxKind.OpenBraceToken */ || ts.tokenIsIdentifierOrKeyword(token()); case 93 /* SyntaxKind.ExportKeyword */: var currentToken_1 = nextToken(); - if (currentToken_1 === 152 /* SyntaxKind.TypeKeyword */) { + if (currentToken_1 === 154 /* SyntaxKind.TypeKeyword */) { currentToken_1 = lookAhead(nextToken); } if (currentToken_1 === 63 /* SyntaxKind.EqualsToken */ || currentToken_1 === 41 /* SyntaxKind.AsteriskToken */ || currentToken_1 === 18 /* SyntaxKind.OpenBraceToken */ || currentToken_1 === 88 /* SyntaxKind.DefaultKeyword */ || - currentToken_1 === 127 /* SyntaxKind.AsKeyword */) { + currentToken_1 === 128 /* SyntaxKind.AsKeyword */) { return true; } continue; @@ -36563,20 +37000,21 @@ var ts; case 85 /* SyntaxKind.ConstKeyword */: case 93 /* SyntaxKind.ExportKeyword */: return isStartOfDeclaration(); - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: // When these don't start a declaration, they're an identifier in an expression statement return true; + case 127 /* SyntaxKind.AccessorKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: // When these don't start a declaration, they may be the start of a class member if an identifier // immediately follows. Otherwise they're an identifier in an expression statement. return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); @@ -36619,9 +37057,9 @@ var ts; case 97 /* SyntaxKind.ForKeyword */: return parseForOrForInOrForOfStatement(); case 86 /* SyntaxKind.ContinueKeyword */: - return parseBreakOrContinueStatement(245 /* SyntaxKind.ContinueStatement */); + return parseBreakOrContinueStatement(248 /* SyntaxKind.ContinueStatement */); case 81 /* SyntaxKind.BreakKeyword */: - return parseBreakOrContinueStatement(246 /* SyntaxKind.BreakStatement */); + return parseBreakOrContinueStatement(249 /* SyntaxKind.BreakStatement */); case 105 /* SyntaxKind.ReturnKeyword */: return parseReturnStatement(); case 116 /* SyntaxKind.WithKeyword */: @@ -36640,12 +37078,12 @@ var ts; return parseDebuggerStatement(); case 59 /* SyntaxKind.AtToken */: return parseDeclaration(); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 85 /* SyntaxKind.ConstKeyword */: case 92 /* SyntaxKind.EnumKeyword */: case 93 /* SyntaxKind.ExportKeyword */: @@ -36654,9 +37092,10 @@ var ts; case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -36665,7 +37104,7 @@ var ts; return parseExpressionOrLabeledStatement(); } function isDeclareModifier(modifier) { - return modifier.kind === 135 /* SyntaxKind.DeclareKeyword */; + return modifier.kind === 136 /* SyntaxKind.DeclareKeyword */; } function parseDeclaration() { // `parseListElement` attempted to get the reused node at this position, @@ -36711,13 +37150,13 @@ var ts; return parseClassDeclaration(pos, hasJSDoc, decorators, modifiers); case 118 /* SyntaxKind.InterfaceKeyword */: return parseInterfaceDeclaration(pos, hasJSDoc, decorators, modifiers); - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: return parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers); case 92 /* SyntaxKind.EnumKeyword */: return parseEnumDeclaration(pos, hasJSDoc, decorators, modifiers); - case 157 /* SyntaxKind.GlobalKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: return parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers); case 100 /* SyntaxKind.ImportKeyword */: return parseImportDeclarationOrImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers); @@ -36727,7 +37166,7 @@ var ts; case 88 /* SyntaxKind.DefaultKeyword */: case 63 /* SyntaxKind.EqualsToken */: return parseExportAssignment(pos, hasJSDoc, decorators, modifiers); - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: return parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers); default: return parseExportDeclaration(pos, hasJSDoc, decorators, modifiers); @@ -36736,7 +37175,7 @@ var ts; if (decorators || modifiers) { // We reached this point because we encountered decorators and/or modifiers and assumed a declaration // would follow. For recovery and error reporting purposes, return an incomplete declaration. - var missing = createMissingNode(276 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var missing = createMissingNode(279 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); ts.setTextRangePos(missing, pos); missing.illegalDecorators = decorators; missing.modifiers = modifiers; @@ -36862,7 +37301,7 @@ var ts; // this context. // The checker will then give an error that there is an empty declaration list. var declarations; - if (token() === 160 /* SyntaxKind.OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 162 /* SyntaxKind.OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { declarations = createMissingList(); } else { @@ -36890,9 +37329,9 @@ var ts; parseExpected(98 /* SyntaxKind.FunctionKeyword */); var asteriskToken = parseOptionalToken(41 /* SyntaxKind.AsteriskToken */); // We don't parse the name here in await context, instead we will report a grammar error in the checker. - var name = modifierFlags & 512 /* ModifierFlags.Default */ ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); + var name = modifierFlags & 1024 /* ModifierFlags.Default */ ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); var isGenerator = asteriskToken ? 1 /* SignatureFlags.Yield */ : 0 /* SignatureFlags.None */; - var isAsync = modifierFlags & 256 /* ModifierFlags.Async */ ? 2 /* SignatureFlags.Await */ : 0 /* SignatureFlags.None */; + var isAsync = modifierFlags & 512 /* ModifierFlags.Async */ ? 2 /* SignatureFlags.Await */ : 0 /* SignatureFlags.None */; var typeParameters = parseTypeParameters(); if (modifierFlags & 1 /* ModifierFlags.Export */) setAwaitContext(/*value*/ true); @@ -36905,8 +37344,8 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseConstructorName() { - if (token() === 134 /* SyntaxKind.ConstructorKeyword */) { - return parseExpected(134 /* SyntaxKind.ConstructorKeyword */); + if (token() === 135 /* SyntaxKind.ConstructorKeyword */) { + return parseExpected(135 /* SyntaxKind.ConstructorKeyword */); } if (token() === 10 /* SyntaxKind.StringLiteral */ && lookAhead(nextToken) === 20 /* SyntaxKind.OpenParenToken */) { return tryParse(function () { @@ -36968,7 +37407,7 @@ var ts; var parameters = parseParameters(0 /* SignatureFlags.None */); var type = parseReturnType(58 /* SyntaxKind.ColonToken */, /*isType*/ false); var body = parseFunctionBlockOrSemicolon(flags); - var node = kind === 172 /* SyntaxKind.GetAccessor */ + var node = kind === 174 /* SyntaxKind.GetAccessor */ ? factory.createGetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, type, body) : factory.createSetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, body); // Keep track of `typeParameters` (for both) and `type` (for setters) if they were parsed those indicate grammar errors @@ -37012,7 +37451,7 @@ var ts; // If we were able to get any potential identifier... if (idToken !== undefined) { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. - if (!ts.isKeyword(idToken) || idToken === 149 /* SyntaxKind.SetKeyword */ || idToken === 136 /* SyntaxKind.GetKeyword */) { + if (!ts.isKeyword(idToken) || idToken === 151 /* SyntaxKind.SetKeyword */ || idToken === 137 /* SyntaxKind.GetKeyword */) { return true; } // If it *is* a keyword, but not an accessor, check a little farther along @@ -37055,7 +37494,7 @@ var ts; return body; } function parseDecoratorExpression() { - if (inAwaitContext() && token() === 132 /* SyntaxKind.AwaitKeyword */) { + if (inAwaitContext() && token() === 133 /* SyntaxKind.AwaitKeyword */) { // `@await` is is disallowed in an [Await] context, but can cause parsing to go off the rails // This simply parses the missing identifier and moves on. var pos = getNodePos(); @@ -37133,10 +37572,10 @@ var ts; } function parseModifiersForArrowFunction() { var modifiers; - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { var pos = getNodePos(); nextToken(); - var modifier = finishNode(factory.createToken(131 /* SyntaxKind.AsyncKeyword */), pos); + var modifier = finishNode(factory.createToken(132 /* SyntaxKind.AsyncKeyword */), pos); modifiers = createNodeArray([modifier], pos); } return modifiers; @@ -37153,13 +37592,13 @@ var ts; if (token() === 124 /* SyntaxKind.StaticKeyword */ && lookAhead(nextTokenIsOpenBrace)) { return parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers); } - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 174 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 175 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); } - if (token() === 134 /* SyntaxKind.ConstructorKeyword */ || token() === 10 /* SyntaxKind.StringLiteral */) { + if (token() === 135 /* SyntaxKind.ConstructorKeyword */ || token() === 10 /* SyntaxKind.StringLiteral */) { var constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers); if (constructorDeclaration) { return constructorDeclaration; @@ -37196,10 +37635,10 @@ var ts; return ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined, 226 /* SyntaxKind.ClassExpression */); + return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined, 228 /* SyntaxKind.ClassExpression */); } function parseClassDeclaration(pos, hasJSDoc, decorators, modifiers) { - return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 257 /* SyntaxKind.ClassDeclaration */); + return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 260 /* SyntaxKind.ClassDeclaration */); } function parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, kind) { var savedAwaitContext = inAwaitContext(); @@ -37221,7 +37660,7 @@ var ts; members = createMissingList(); } setAwaitContext(savedAwaitContext); - var node = kind === 257 /* SyntaxKind.ClassDeclaration */ + var node = kind === 260 /* SyntaxKind.ClassDeclaration */ ? factory.createClassDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members) : factory.createClassExpression(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -37258,7 +37697,7 @@ var ts; function parseExpressionWithTypeArguments() { var pos = getNodePos(); var expression = parseLeftHandSideExpressionOrHigher(); - if (expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { return expression; } var typeArguments = tryParseTypeArguments(); @@ -37285,11 +37724,11 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers) { - parseExpected(152 /* SyntaxKind.TypeKeyword */); + parseExpected(154 /* SyntaxKind.TypeKeyword */); var name = parseIdentifier(); var typeParameters = parseTypeParameters(); parseExpected(63 /* SyntaxKind.EqualsToken */); - var type = token() === 138 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); + var type = token() === 139 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); parseSemicolon(); var node = factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type); node.illegalDecorators = decorators; @@ -37348,7 +37787,7 @@ var ts; function parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { var flags = 0; var name; - if (token() === 157 /* SyntaxKind.GlobalKeyword */) { + if (token() === 159 /* SyntaxKind.GlobalKeyword */) { // parse 'global' as name of global scope augmentation name = parseIdentifier(); flags |= 1024 /* NodeFlags.GlobalAugmentation */; @@ -37370,15 +37809,15 @@ var ts; } function parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { var flags = 0; - if (token() === 157 /* SyntaxKind.GlobalKeyword */) { + if (token() === 159 /* SyntaxKind.GlobalKeyword */) { // global augmentation return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); } - else if (parseOptional(142 /* SyntaxKind.NamespaceKeyword */)) { + else if (parseOptional(143 /* SyntaxKind.NamespaceKeyword */)) { flags |= 16 /* NodeFlags.Namespace */; } else { - parseExpected(141 /* SyntaxKind.ModuleKeyword */); + parseExpected(142 /* SyntaxKind.ModuleKeyword */); if (token() === 10 /* SyntaxKind.StringLiteral */) { return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); } @@ -37386,7 +37825,7 @@ var ts; return parseModuleOrNamespaceDeclaration(pos, hasJSDoc, decorators, modifiers, flags); } function isExternalModuleReference() { - return token() === 146 /* SyntaxKind.RequireKeyword */ && + return token() === 147 /* SyntaxKind.RequireKeyword */ && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { @@ -37399,8 +37838,8 @@ var ts; return nextToken() === 43 /* SyntaxKind.SlashToken */; } function parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers) { - parseExpected(127 /* SyntaxKind.AsKeyword */); - parseExpected(142 /* SyntaxKind.NamespaceKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); + parseExpected(143 /* SyntaxKind.NamespaceKeyword */); var name = parseIdentifier(); parseSemicolon(); var node = factory.createNamespaceExportDeclaration(name); @@ -37418,7 +37857,7 @@ var ts; identifier = parseIdentifier(); } var isTypeOnly = false; - if (token() !== 156 /* SyntaxKind.FromKeyword */ && + if (token() !== 158 /* SyntaxKind.FromKeyword */ && (identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) === "type" && (isIdentifier() || tokenAfterImportDefinitelyProducesImportDeclaration())) { isTypeOnly = true; @@ -37436,11 +37875,11 @@ var ts; token() === 18 /* SyntaxKind.OpenBraceToken */ // import { ) { importClause = parseImportClause(identifier, afterImportPos, isTypeOnly); - parseExpected(156 /* SyntaxKind.FromKeyword */); + parseExpected(158 /* SyntaxKind.FromKeyword */); } var moduleSpecifier = parseModuleSpecifier(); var assertClause; - if (token() === 129 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 130 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -37458,7 +37897,7 @@ var ts; function parseAssertClause(skipAssertKeyword) { var pos = getNodePos(); if (!skipAssertKeyword) { - parseExpected(129 /* SyntaxKind.AssertKeyword */); + parseExpected(130 /* SyntaxKind.AssertKeyword */); } var openBracePosition = scanner.getTokenPos(); if (parseExpected(18 /* SyntaxKind.OpenBraceToken */)) { @@ -37483,7 +37922,7 @@ var ts; function tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration() { // In `import id ___`, the current token decides whether to produce // an ImportDeclaration or ImportEqualsDeclaration. - return token() === 27 /* SyntaxKind.CommaToken */ || token() === 156 /* SyntaxKind.FromKeyword */; + return token() === 27 /* SyntaxKind.CommaToken */ || token() === 158 /* SyntaxKind.FromKeyword */; } function parseImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers, identifier, isTypeOnly) { parseExpected(63 /* SyntaxKind.EqualsToken */); @@ -37506,7 +37945,7 @@ var ts; var namedBindings; if (!identifier || parseOptional(27 /* SyntaxKind.CommaToken */)) { - namedBindings = token() === 41 /* SyntaxKind.AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(269 /* SyntaxKind.NamedImports */); + namedBindings = token() === 41 /* SyntaxKind.AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(272 /* SyntaxKind.NamedImports */); } return finishNode(factory.createImportClause(isTypeOnly, identifier, namedBindings), pos); } @@ -37517,7 +37956,7 @@ var ts; } function parseExternalModuleReference() { var pos = getNodePos(); - parseExpected(146 /* SyntaxKind.RequireKeyword */); + parseExpected(147 /* SyntaxKind.RequireKeyword */); parseExpected(20 /* SyntaxKind.OpenParenToken */); var expression = parseModuleSpecifier(); parseExpected(21 /* SyntaxKind.CloseParenToken */); @@ -37541,7 +37980,7 @@ var ts; // * as ImportedBinding var pos = getNodePos(); parseExpected(41 /* SyntaxKind.AsteriskToken */); - parseExpected(127 /* SyntaxKind.AsKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); var name = parseIdentifier(); return finishNode(factory.createNamespaceImport(name), pos); } @@ -37554,17 +37993,17 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - var node = kind === 269 /* SyntaxKind.NamedImports */ + var node = kind === 272 /* SyntaxKind.NamedImports */ ? factory.createNamedImports(parseBracketedList(23 /* ParsingContext.ImportOrExportSpecifiers */, parseImportSpecifier, 18 /* SyntaxKind.OpenBraceToken */, 19 /* SyntaxKind.CloseBraceToken */)) : factory.createNamedExports(parseBracketedList(23 /* ParsingContext.ImportOrExportSpecifiers */, parseExportSpecifier, 18 /* SyntaxKind.OpenBraceToken */, 19 /* SyntaxKind.CloseBraceToken */)); return finishNode(node, pos); } function parseExportSpecifier() { var hasJSDoc = hasPrecedingJSDocComment(); - return withJSDoc(parseImportOrExportSpecifier(275 /* SyntaxKind.ExportSpecifier */), hasJSDoc); + return withJSDoc(parseImportOrExportSpecifier(278 /* SyntaxKind.ExportSpecifier */), hasJSDoc); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(270 /* SyntaxKind.ImportSpecifier */); + return parseImportOrExportSpecifier(273 /* SyntaxKind.ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var pos = getNodePos(); @@ -37589,10 +38028,10 @@ var ts; // import { type as } from "mod"; - isTypeOnly: true, name: as // import { type as as } from "mod"; - isTypeOnly: false, name: as, propertyName: type // import { type as as as } from "mod"; - isTypeOnly: true, name: as, propertyName: as - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */) { // { type as ...? } var firstAs = parseIdentifierName(); - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */) { // { type as as ...? } var secondAs = parseIdentifierName(); if (ts.tokenIsIdentifierOrKeyword(token())) { @@ -37627,15 +38066,15 @@ var ts; name = parseNameWithKeywordCheck(); } } - if (canParseAsKeyword && token() === 127 /* SyntaxKind.AsKeyword */) { + if (canParseAsKeyword && token() === 128 /* SyntaxKind.AsKeyword */) { propertyName = name; - parseExpected(127 /* SyntaxKind.AsKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); name = parseNameWithKeywordCheck(); } - if (kind === 270 /* SyntaxKind.ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 273 /* SyntaxKind.ImportSpecifier */ && checkIdentifierIsKeyword) { parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected); } - var node = kind === 270 /* SyntaxKind.ImportSpecifier */ + var node = kind === 273 /* SyntaxKind.ImportSpecifier */ ? factory.createImportSpecifier(isTypeOnly, propertyName, name) : factory.createExportSpecifier(isTypeOnly, propertyName, name); return finishNode(node, pos); @@ -37655,26 +38094,26 @@ var ts; var exportClause; var moduleSpecifier; var assertClause; - var isTypeOnly = parseOptional(152 /* SyntaxKind.TypeKeyword */); + var isTypeOnly = parseOptional(154 /* SyntaxKind.TypeKeyword */); var namespaceExportPos = getNodePos(); if (parseOptional(41 /* SyntaxKind.AsteriskToken */)) { - if (parseOptional(127 /* SyntaxKind.AsKeyword */)) { + if (parseOptional(128 /* SyntaxKind.AsKeyword */)) { exportClause = parseNamespaceExport(namespaceExportPos); } - parseExpected(156 /* SyntaxKind.FromKeyword */); + parseExpected(158 /* SyntaxKind.FromKeyword */); moduleSpecifier = parseModuleSpecifier(); } else { - exportClause = parseNamedImportsOrExports(273 /* SyntaxKind.NamedExports */); + exportClause = parseNamedImportsOrExports(276 /* SyntaxKind.NamedExports */); // It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios, // the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`) // If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect. - if (token() === 156 /* SyntaxKind.FromKeyword */ || (token() === 10 /* SyntaxKind.StringLiteral */ && !scanner.hasPrecedingLineBreak())) { - parseExpected(156 /* SyntaxKind.FromKeyword */); + if (token() === 158 /* SyntaxKind.FromKeyword */ || (token() === 10 /* SyntaxKind.StringLiteral */ && !scanner.hasPrecedingLineBreak())) { + parseExpected(158 /* SyntaxKind.FromKeyword */); moduleSpecifier = parseModuleSpecifier(); } } - if (moduleSpecifier && token() === 129 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (moduleSpecifier && token() === 130 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -38287,9 +38726,9 @@ var ts; } function isObjectOrObjectArrayTypeReference(node) { switch (node.kind) { - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return true; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return isObjectOrObjectArrayTypeReference(node.elementType); default: return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && !node.typeArguments; @@ -38321,12 +38760,12 @@ var ts; var child = void 0; var children = void 0; while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) { - if (child.kind === 340 /* SyntaxKind.JSDocParameterTag */ || child.kind === 347 /* SyntaxKind.JSDocPropertyTag */) { + if (child.kind === 343 /* SyntaxKind.JSDocParameterTag */ || child.kind === 350 /* SyntaxKind.JSDocPropertyTag */) { children = ts.append(children, child); } } if (children) { - var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 183 /* SyntaxKind.ArrayType */), pos); + var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 185 /* SyntaxKind.ArrayType */), pos); return finishNode(factory.createJSDocTypeExpression(literal), pos); } } @@ -38444,7 +38883,7 @@ var ts; var hasChildren = false; while (child = tryParse(function () { return parseChildPropertyTag(indent); })) { hasChildren = true; - if (child.kind === 343 /* SyntaxKind.JSDocTypeTag */) { + if (child.kind === 346 /* SyntaxKind.JSDocTypeTag */) { if (childTypeTag) { var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); if (lastError) { @@ -38461,7 +38900,7 @@ var ts; } } if (hasChildren) { - var isArrayType = typeExpression && typeExpression.type.kind === 183 /* SyntaxKind.ArrayType */; + var isArrayType = typeExpression && typeExpression.type.kind === 185 /* SyntaxKind.ArrayType */; var jsdocTypeLiteral = factory.createJSDocTypeLiteral(jsDocPropertyTags, isArrayType); typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ? childTypeTag.typeExpression : @@ -38513,7 +38952,7 @@ var ts; var returnTag = tryParse(function () { if (parseOptionalJsdoc(59 /* SyntaxKind.AtToken */)) { var tag = parseTag(indent); - if (tag && tag.kind === 341 /* SyntaxKind.JSDocReturnTag */) { + if (tag && tag.kind === 344 /* SyntaxKind.JSDocReturnTag */) { return tag; } } @@ -38548,7 +38987,7 @@ var ts; case 59 /* SyntaxKind.AtToken */: if (canParseTag) { var child = tryParseChildTag(target, indent); - if (child && (child.kind === 340 /* SyntaxKind.JSDocParameterTag */ || child.kind === 347 /* SyntaxKind.JSDocPropertyTag */) && + if (child && (child.kind === 343 /* SyntaxKind.JSDocParameterTag */ || child.kind === 350 /* SyntaxKind.JSDocPropertyTag */) && target !== 4 /* PropertyLikeParse.CallbackParameter */ && name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; @@ -39518,6 +39957,7 @@ var ts; ["es2019.object", "lib.es2019.object.d.ts"], ["es2019.string", "lib.es2019.string.d.ts"], ["es2019.symbol", "lib.es2019.symbol.d.ts"], + ["es2019.intl", "lib.es2019.intl.d.ts"], ["es2020.bigint", "lib.es2020.bigint.d.ts"], ["es2020.date", "lib.es2020.date.d.ts"], ["es2020.promise", "lib.es2020.promise.d.ts"], @@ -39638,6 +40078,7 @@ var ts; shortName: "h", type: "boolean", showInSimplifiedHelpView: true, + isCommandLineOnly: true, category: ts.Diagnostics.Command_line_Options, description: ts.Diagnostics.Print_this_message, defaultValueDescription: false, @@ -39646,6 +40087,8 @@ var ts; name: "help", shortName: "?", type: "boolean", + isCommandLineOnly: true, + category: ts.Diagnostics.Command_line_Options, defaultValueDescription: false, }, { @@ -41377,7 +41820,7 @@ var ts; var _a; var rootExpression = (_a = sourceFile.statements[0]) === null || _a === void 0 ? void 0 : _a.expression; var knownRootOptions = reportOptionsErrors ? getTsconfigRootOptionsMap() : undefined; - if (rootExpression && rootExpression.kind !== 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (rootExpression && rootExpression.kind !== 207 /* SyntaxKind.ObjectLiteralExpression */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, rootExpression, ts.Diagnostics.The_root_value_of_a_0_file_must_be_an_object, ts.getBaseFileName(sourceFile.fileName) === "jsconfig.json" ? "jsconfig.json" : "tsconfig.json")); // Last-ditch error recovery. Somewhat useful because the JSON parser will recover from some parse errors by // synthesizing a top-level array literal expression. There's a reasonable chance the first element of that @@ -41417,7 +41860,7 @@ var ts; function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) { var result = returnValue ? {} : undefined; var _loop_4 = function (element) { - if (element.kind !== 296 /* SyntaxKind.PropertyAssignment */) { + if (element.kind !== 299 /* SyntaxKind.PropertyAssignment */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); return "continue"; } @@ -41511,13 +41954,13 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: reportInvalidOptionValue(option && option.type !== "number"); return validateValue(Number(valueExpression.text)); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: if (valueExpression.operator !== 40 /* SyntaxKind.MinusToken */ || valueExpression.operand.kind !== 8 /* SyntaxKind.NumericLiteral */) { break; // not valid JSON syntax } reportInvalidOptionValue(option && option.type !== "number"); return validateValue(-Number(valueExpression.operand.text)); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: reportInvalidOptionValue(option && option.type !== "object"); var objectLiteralExpression = valueExpression; // Currently having element option declaration in the tsconfig with type "object" @@ -41534,7 +41977,7 @@ var ts; return validateValue(convertObjectLiteralExpressionToJson(objectLiteralExpression, /* knownOptions*/ undefined, /*extraKeyDiagnosticMessage */ undefined, /*parentOption*/ undefined)); } - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: reportInvalidOptionValue(option && option.type !== "list"); return validateValue(convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element)); } @@ -42718,7 +43161,7 @@ var ts; function convertCompilerOptionsForTelemetry(opts) { var out = {}; for (var key in opts) { - if (opts.hasOwnProperty(key)) { + if (ts.hasProperty(opts, key)) { var type = getOptionFromName(key); if (type !== undefined) { // Ignore unknown options out[key] = getOptionValueWithEmptyStrings(opts[key], type); @@ -42784,7 +43227,7 @@ var ts; function withPackageId(packageInfo, r) { var packageId; if (r && packageInfo) { - var packageJsonContent = packageInfo.packageJsonContent; + var packageJsonContent = packageInfo.contents.packageJsonContent; if (typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string") { packageId = { name: packageJsonContent.name, @@ -44103,16 +44546,16 @@ var ts; function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson) { if (considerPackageJson === void 0) { considerPackageJson = true; } var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : undefined; - var packageJsonContent = packageInfo && packageInfo.packageJsonContent; - var versionPaths = packageInfo && packageInfo.versionPaths; + var packageJsonContent = packageInfo && packageInfo.contents.packageJsonContent; + var versionPaths = packageInfo && packageInfo.contents.versionPaths; return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths)); } /* @internal */ function getEntrypointsFromPackageJsonInfo(packageJsonInfo, options, host, cache, resolveJs) { - if (!resolveJs && packageJsonInfo.resolvedEntrypoints !== undefined) { + if (!resolveJs && packageJsonInfo.contents.resolvedEntrypoints !== undefined) { // Cached value excludes resolutions to JS files - those could be // cached separately, but they're used rarely. - return packageJsonInfo.resolvedEntrypoints; + return packageJsonInfo.contents.resolvedEntrypoints; } var entrypoints; var extensions = resolveJs ? Extensions.JavaScript : Extensions.TypeScript; @@ -44121,13 +44564,13 @@ var ts; requireState.conditions = ["node", "require", "types"]; requireState.requestContainingDirectory = packageJsonInfo.packageDirectory; var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory, - /*onlyRecordFailures*/ false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths); + /*onlyRecordFailures*/ false, requireState, packageJsonInfo.contents.packageJsonContent, packageJsonInfo.contents.versionPaths); entrypoints = ts.append(entrypoints, requireResolution === null || requireResolution === void 0 ? void 0 : requireResolution.path); - if (features & NodeResolutionFeatures.Exports && packageJsonInfo.packageJsonContent.exports) { + if (features & NodeResolutionFeatures.Exports && packageJsonInfo.contents.packageJsonContent.exports) { for (var _i = 0, _a = [["node", "import", "types"], ["node", "require", "types"]]; _i < _a.length; _i++) { var conditions = _a[_i]; var exportState = __assign(__assign({}, requireState), { failedLookupLocations: [], conditions: conditions }); - var exportResolutions = loadEntrypointsFromExportMap(packageJsonInfo, packageJsonInfo.packageJsonContent.exports, exportState, extensions); + var exportResolutions = loadEntrypointsFromExportMap(packageJsonInfo, packageJsonInfo.contents.packageJsonContent.exports, exportState, extensions); if (exportResolutions) { for (var _b = 0, exportResolutions_1 = exportResolutions; _b < exportResolutions_1.length; _b++) { var resolution = exportResolutions_1[_b]; @@ -44136,7 +44579,7 @@ var ts; } } } - return packageJsonInfo.resolvedEntrypoints = entrypoints || false; + return packageJsonInfo.contents.resolvedEntrypoints = entrypoints || false; } ts.getEntrypointsFromPackageJsonInfo = getEntrypointsFromPackageJsonInfo; function loadEntrypointsFromExportMap(scope, exports, state, extensions) { @@ -44240,7 +44683,9 @@ var ts; if (traceEnabled) trace(host, ts.Diagnostics.File_0_exists_according_to_earlier_cached_lookups, packageJsonPath); state.affectingLocations.push(packageJsonPath); - return existing; + return existing.packageDirectory === packageDirectory ? + existing : + { packageDirectory: packageDirectory, contents: existing.contents }; } else { if (existing && traceEnabled) @@ -44256,7 +44701,7 @@ var ts; trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); } var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state); - var result = { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined }; + var result = { packageDirectory: packageDirectory, contents: { packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined } }; (_b = state.packageJsonInfoCache) === null || _b === void 0 ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result); state.affectingLocations.push(packageJsonPath); return result; @@ -44381,17 +44826,16 @@ var ts; } function loadModuleFromSelfNameReference(extensions, moduleName, directory, state, cache, redirectedReference) { var _a, _b; - var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames; - var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames)); + var directoryPath = ts.getNormalizedAbsolutePath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)); var scope = getPackageScopeForPath(directoryPath, state); - if (!scope || !scope.packageJsonContent.exports) { + if (!scope || !scope.contents.packageJsonContent.exports) { return undefined; } - if (typeof scope.packageJsonContent.name !== "string") { + if (typeof scope.contents.packageJsonContent.name !== "string") { return undefined; } var parts = ts.getPathComponents(moduleName); // unrooted paths should have `""` as their 0th entry - var nameParts = ts.getPathComponents(scope.packageJsonContent.name); + var nameParts = ts.getPathComponents(scope.contents.packageJsonContent.name); if (!ts.every(nameParts, function (p, i) { return parts[i] === p; })) { return undefined; } @@ -44399,30 +44843,30 @@ var ts; return loadModuleFromExports(scope, extensions, !ts.length(trailingParts) ? "." : ".".concat(ts.directorySeparator).concat(trailingParts.join(ts.directorySeparator)), state, cache, redirectedReference); } function loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference) { - if (!scope.packageJsonContent.exports) { + if (!scope.contents.packageJsonContent.exports) { return undefined; } if (subpath === ".") { var mainExport = void 0; - if (typeof scope.packageJsonContent.exports === "string" || Array.isArray(scope.packageJsonContent.exports) || (typeof scope.packageJsonContent.exports === "object" && noKeyStartsWithDot(scope.packageJsonContent.exports))) { - mainExport = scope.packageJsonContent.exports; + if (typeof scope.contents.packageJsonContent.exports === "string" || Array.isArray(scope.contents.packageJsonContent.exports) || (typeof scope.contents.packageJsonContent.exports === "object" && noKeyStartsWithDot(scope.contents.packageJsonContent.exports))) { + mainExport = scope.contents.packageJsonContent.exports; } - else if (ts.hasProperty(scope.packageJsonContent.exports, ".")) { - mainExport = scope.packageJsonContent.exports["."]; + else if (ts.hasProperty(scope.contents.packageJsonContent.exports, ".")) { + mainExport = scope.contents.packageJsonContent.exports["."]; } if (mainExport) { var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, subpath, scope, /*isImports*/ false); return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false); } } - else if (allKeysStartWithDot(scope.packageJsonContent.exports)) { - if (typeof scope.packageJsonContent.exports !== "object") { + else if (allKeysStartWithDot(scope.contents.packageJsonContent.exports)) { + if (typeof scope.contents.packageJsonContent.exports !== "object") { if (state.traceEnabled) { trace(state.host, ts.Diagnostics.Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1, subpath, scope.packageDirectory); } return toSearchResult(/*value*/ undefined); } - var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, subpath, scope.packageJsonContent.exports, scope, /*isImports*/ false); + var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, subpath, scope.contents.packageJsonContent.exports, scope, /*isImports*/ false); if (result) { return result; } @@ -44440,8 +44884,7 @@ var ts; } return toSearchResult(/*value*/ undefined); } - var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames; - var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames)); + var directoryPath = ts.getNormalizedAbsolutePath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)); var scope = getPackageScopeForPath(directoryPath, state); if (!scope) { if (state.traceEnabled) { @@ -44449,13 +44892,13 @@ var ts; } return toSearchResult(/*value*/ undefined); } - if (!scope.packageJsonContent.imports) { + if (!scope.contents.packageJsonContent.imports) { if (state.traceEnabled) { trace(state.host, ts.Diagnostics.package_json_scope_0_has_no_imports_defined, scope.packageDirectory); } return toSearchResult(/*value*/ undefined); } - var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, scope.packageJsonContent.imports, scope, /*isImports*/ true); + var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, scope.contents.packageJsonContent.imports, scope, /*isImports*/ true); if (result) { return result; } @@ -44800,7 +45243,7 @@ var ts; if (fromFile) { return noPackageId(fromFile); } - var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.packageJsonContent, packageInfo.versionPaths); + var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.contents.packageJsonContent, packageInfo.contents.versionPaths); return withPackageId(packageInfo, fromDirectory); } } @@ -44808,14 +45251,14 @@ var ts; 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.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { + 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.packageJsonContent, packageInfo && packageInfo.versionPaths); + loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths); if (!pathAndExtension && packageInfo // eslint-disable-next-line no-null/no-null - && (packageInfo.packageJsonContent.exports === undefined || packageInfo.packageJsonContent.exports === null) + && (packageInfo.contents.packageJsonContent.exports === undefined || packageInfo.contents.packageJsonContent.exports === null) && state.features & NodeResolutionFeatures.EsmMode) { // EsmMode disables index lookup in `loadNodeModuleFromDirectoryWorker` generally, however non-relative package resolutions still assume // a default `index.js` entrypoint if no `main` or `exports` are present @@ -44827,12 +45270,12 @@ var ts; 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. packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state); - if (packageInfo && packageInfo.versionPaths) { + 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.versionPaths.version, ts.version, rest); + 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.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); + var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); if (fromPaths) { return fromPaths.value; } @@ -45045,26 +45488,26 @@ var ts; // A module is uninstantiated if it contains only switch (node.kind) { // 1. interface declarations, type alias declarations - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return 0 /* ModuleInstanceState.NonInstantiated */; // 2. const enum declarations - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (ts.isEnumConst(node)) { return 2 /* ModuleInstanceState.ConstEnumOnly */; } break; // 3. non-exported import declarations - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: if (!(ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */))) { return 0 /* ModuleInstanceState.NonInstantiated */; } break; // 4. Export alias declarations pointing at only uninstantiated modules or things uninstantiated modules contain - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportDeclaration = node; - if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 273 /* SyntaxKind.NamedExports */) { + if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 276 /* SyntaxKind.NamedExports */) { var state = 0 /* ModuleInstanceState.NonInstantiated */; for (var _i = 0, _a = exportDeclaration.exportClause.elements; _i < _a.length; _i++) { var specifier = _a[_i]; @@ -45080,7 +45523,7 @@ var ts; } break; // 5. other uninstantiated module declarations. - case 262 /* SyntaxKind.ModuleBlock */: { + case 265 /* SyntaxKind.ModuleBlock */: { var state_1 = 0 /* ModuleInstanceState.NonInstantiated */; ts.forEachChild(node, function (n) { var childState = getModuleInstanceStateCached(n, visited); @@ -45102,7 +45545,7 @@ var ts; }); return state_1; } - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return getModuleInstanceState(node, visited); case 79 /* SyntaxKind.Identifier */: // Only jsdoc typedef definition can exist in jsdoc namespace, and it should @@ -45303,7 +45746,7 @@ var ts; // Should not be called on a declaration with a computed property name, // unless it is a well known Symbol. function getDeclarationName(node) { - if (node.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (node.kind === 274 /* SyntaxKind.ExportAssignment */) { return node.isExportEquals ? "export=" /* InternalSymbolName.ExportEquals */ : "default" /* InternalSymbolName.Default */; } var name = ts.getNameOfDeclaration(node); @@ -45312,7 +45755,7 @@ var ts; var moduleName = ts.getTextOfIdentifierOrLiteral(name); return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"".concat(moduleName, "\"")); } - if (name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { var nameExpression = name.expression; // treat computed property names where expression is string/numeric literal as just string/numeric literal if (ts.isStringOrNumericLiteralLike(nameExpression)) { @@ -45338,36 +45781,36 @@ var ts; return ts.isPropertyNameLiteral(name) ? ts.getEscapedTextOfIdentifierOrLiteral(name) : undefined; } switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "__constructor" /* InternalSymbolName.Constructor */; - case 179 /* SyntaxKind.FunctionType */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: return "__call" /* InternalSymbolName.Call */; - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return "__new" /* InternalSymbolName.New */; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return "__index" /* InternalSymbolName.Index */; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return "__export" /* InternalSymbolName.ExportStar */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // json file should behave as // module.exports = ... return "export=" /* InternalSymbolName.ExportEquals */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */) { // module.exports = ... return "export=" /* InternalSymbolName.ExportEquals */; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return (ts.isJSDocConstructSignature(node) ? "__new" /* InternalSymbolName.New */ : "__call" /* InternalSymbolName.Call */); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Parameters with names are handled at the top of this function. Parameters // without names can only come from JSDocFunctionTypes. - ts.Debug.assert(node.parent.kind === 317 /* SyntaxKind.JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); }); + ts.Debug.assert(node.parent.kind === 320 /* SyntaxKind.JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); }); var functionType = node.parent; var index = functionType.parameters.indexOf(node); return "arg" + index; @@ -45386,7 +45829,7 @@ var ts; */ function declareSymbol(symbolTable, parent, node, includes, excludes, isReplaceableByMethod, isComputedName) { ts.Debug.assert(isComputedName || !ts.hasDynamicName(node)); - var isDefaultExport = ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) || ts.isExportSpecifier(node) && node.name.escapedText === "default"; + var isDefaultExport = ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) || ts.isExportSpecifier(node) && node.name.escapedText === "default"; // The exported symbol for an export default function/class node is always named "default" var name = isComputedName ? "__computed" /* InternalSymbolName.Computed */ : isDefaultExport && parent ? "default" /* InternalSymbolName.Default */ @@ -45469,7 +45912,7 @@ var ts; // 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default // 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers) if (symbol.declarations && symbol.declarations.length && - (node.kind === 271 /* SyntaxKind.ExportAssignment */ && !node.isExportEquals)) { + (node.kind === 274 /* SyntaxKind.ExportAssignment */ && !node.isExportEquals)) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; messageNeedsName_1 = false; multipleDefaultExports_1 = true; @@ -45508,7 +45951,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = !!(ts.getCombinedModifierFlags(node) & 1 /* ModifierFlags.Export */) || jsdocTreatAsExported(node); if (symbolFlags & 2097152 /* SymbolFlags.Alias */) { - if (node.kind === 275 /* SyntaxKind.ExportSpecifier */ || (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 278 /* SyntaxKind.ExportSpecifier */ || (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -45533,7 +45976,7 @@ var ts; if (ts.isJSDocTypeAlias(node)) ts.Debug.assert(ts.isInJSFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file. if (!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 64 /* NodeFlags.ExportContext */)) { - if (!container.locals || (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) && !getDeclarationName(node))) { + if (!container.locals || (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) && !getDeclarationName(node))) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); // No local symbol for an unnamed default! } var exportKind = symbolFlags & 111551 /* SymbolFlags.Value */ ? 1048576 /* SymbolFlags.ExportValue */ : 0; @@ -45597,7 +46040,7 @@ var ts; // for it. We must clear this so we don't accidentally move any stale data forward from // a previous compilation. if (containerFlags & 1 /* ContainerFlags.IsContainer */) { - if (node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind !== 216 /* SyntaxKind.ArrowFunction */) { thisParentContainer = container; } container = blockScopeContainer = node; @@ -45619,10 +46062,10 @@ var ts; var saveActiveLabelList = activeLabelList; var saveHasExplicitReturn = hasExplicitReturn; var isImmediatelyInvoked = (containerFlags & 16 /* ContainerFlags.IsFunctionExpression */ && - !ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Async */) && + !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Async */) && !node.asteriskToken && !!ts.getImmediatelyInvokedFunctionExpression(node)) || - node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; // A non-async, non-generator IIFE is considered part of the containing control flow. Return statements behave // similarly to break statements that exit to a label just past the statement body. if (!isImmediatelyInvoked) { @@ -45633,7 +46076,7 @@ var ts; } // We create a return control flow graph for IIFEs and constructors. For constructors // we use the return control flow graph in strict property initialization checks. - currentReturnTarget = isImmediatelyInvoked || node.kind === 171 /* SyntaxKind.Constructor */ || (ts.isInJSFile(node) && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */)) ? createBranchLabel() : undefined; + currentReturnTarget = isImmediatelyInvoked || node.kind === 173 /* SyntaxKind.Constructor */ || (ts.isInJSFile(node) && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */)) ? createBranchLabel() : undefined; currentExceptionTarget = undefined; currentBreakTarget = undefined; currentContinueTarget = undefined; @@ -45648,14 +46091,14 @@ var ts; node.flags |= 512 /* NodeFlags.HasExplicitReturn */; node.endFlowNode = currentFlow; } - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { node.flags |= emitFlags; node.endFlowNode = currentFlow; } if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); currentFlow = finishFlowLabel(currentReturnTarget); - if (node.kind === 171 /* SyntaxKind.Constructor */ || node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ || (ts.isInJSFile(node) && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */))) { + if (node.kind === 173 /* SyntaxKind.Constructor */ || node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ || (ts.isInJSFile(node) && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */))) { node.returnFlowNode = currentFlow; } } @@ -45682,8 +46125,8 @@ var ts; blockScopeContainer = savedBlockScopeContainer; } function bindEachFunctionsFirst(nodes) { - bindEach(nodes, function (n) { return n.kind === 256 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); - bindEach(nodes, function (n) { return n.kind !== 256 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind === 259 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind !== 259 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); } function bindEach(nodes, bindFunction) { if (bindFunction === void 0) { bindFunction = bind; } @@ -45706,59 +46149,59 @@ var ts; inAssignmentPattern = saveInAssignmentPattern; return; } - if (node.kind >= 237 /* SyntaxKind.FirstStatement */ && node.kind <= 253 /* SyntaxKind.LastStatement */ && !options.allowUnreachableCode) { + if (node.kind >= 240 /* SyntaxKind.FirstStatement */ && node.kind <= 256 /* SyntaxKind.LastStatement */ && !options.allowUnreachableCode) { node.flowNode = currentFlow; } switch (node.kind) { - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: bindWhileStatement(node); break; - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: bindDoStatement(node); break; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: bindForStatement(node); break; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: bindForInOrForOfStatement(node); break; - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: bindIfStatement(node); break; - case 247 /* SyntaxKind.ReturnStatement */: - case 251 /* SyntaxKind.ThrowStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 254 /* SyntaxKind.ThrowStatement */: bindReturnOrThrow(node); break; - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: bindTryStatement(node); break; - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: bindSwitchStatement(node); break; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: bindCaseBlock(node); break; - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: bindCaseClause(node); break; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: bindExpressionStatement(node); break; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: bindLabeledStatement(node); break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: bindPrefixUnaryExpressionFlow(node); break; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: bindPostfixUnaryExpressionFlow(node); break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { // Carry over whether we are in an assignment pattern to // binary expressions that could actually be an initializer @@ -45768,47 +46211,50 @@ var ts; } bindBinaryExpressionFlow(node); break; - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: bindDeleteExpressionFlow(node); break; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: bindConditionalExpressionFlow(node); break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: bindVariableDeclarationFlow(node); break; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: bindAccessExpressionFlow(node); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: bindCallExpressionFlow(node); break; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: bindNonNullExpressionFlow(node); break; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: bindJSDocTypeAlias(node); break; // In source files and blocks, bind functions first to match hoisting that occurs at runtime - case 305 /* SyntaxKind.SourceFile */: { + case 308 /* SyntaxKind.SourceFile */: { bindEachFunctionsFirst(node.statements); bind(node.endOfFileToken); break; } - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: bindEachFunctionsFirst(node.statements); break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: bindBindingElementFlow(node); break; - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 225 /* SyntaxKind.SpreadElement */: + case 166 /* SyntaxKind.Parameter */: + bindParameterFlow(node); + break; + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 227 /* SyntaxKind.SpreadElement */: // Carry over whether we are in an assignment pattern of Object and Array literals // as well as their children that are valid assignment targets. inAssignmentPattern = saveInAssignmentPattern; @@ -45825,19 +46271,19 @@ var ts; case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: case 108 /* SyntaxKind.ThisKeyword */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return containsNarrowableReference(expr); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return hasNarrowableArgument(expr); - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return isNarrowingExpression(expr.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isNarrowingBinaryExpression(expr); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 53 /* SyntaxKind.ExclamationToken */ && isNarrowingExpression(expr.operand); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return isNarrowingExpression(expr.expression); } return false; @@ -45861,7 +46307,7 @@ var ts; } } } - if (expr.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + if (expr.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && containsNarrowableReference(expr.expression.expression)) { return true; } @@ -45894,9 +46340,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isNarrowableOperand(expr.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (expr.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: return isNarrowableOperand(expr.left); @@ -45972,26 +46418,26 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: return parent.expression === node; - case 242 /* SyntaxKind.ForStatement */: - case 222 /* SyntaxKind.ConditionalExpression */: + case 245 /* SyntaxKind.ForStatement */: + case 224 /* SyntaxKind.ConditionalExpression */: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (node.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { node = node.expression; } - else if (node.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && node.operator === 53 /* SyntaxKind.ExclamationToken */) { + else if (node.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && node.operator === 53 /* SyntaxKind.ExclamationToken */) { node = node.operand; } else { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ || node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */); } @@ -46037,7 +46483,7 @@ var ts; } function setContinueTarget(node, target) { var label = activeLabelList; - while (label && node.parent.kind === 250 /* SyntaxKind.LabeledStatement */) { + while (label && node.parent.kind === 253 /* SyntaxKind.LabeledStatement */) { label.continueTarget = target; label = label.next; node = node.parent; @@ -46088,12 +46534,12 @@ var ts; bind(node.expression); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; - if (node.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.kind === 247 /* SyntaxKind.ForOfStatement */) { bind(node.awaitModifier); } addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -46115,7 +46561,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 247 /* SyntaxKind.ReturnStatement */) { + if (node.kind === 250 /* SyntaxKind.ReturnStatement */) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -46132,7 +46578,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 246 /* SyntaxKind.BreakStatement */ ? breakTarget : continueTarget; + var flowLabel = node.kind === 249 /* SyntaxKind.BreakStatement */ ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -46237,7 +46683,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 290 /* SyntaxKind.DefaultClause */; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 293 /* SyntaxKind.DefaultClause */; }); // We mark a switch statement as possibly exhaustive if it has no default clause and if all // case clauses have unreachable end points (e.g. they all return). Note, we no longer need // this property in control flow analysis, it's there only for backwards compatibility. @@ -46285,7 +46731,7 @@ var ts; function maybeBindExpressionFlowIfCall(node) { // A top level or comma expression call expression with a dotted function name and at least one argument // is potentially an assertion and is therefore included in the control flow. - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { var call = node; if (call.expression.kind !== 106 /* SyntaxKind.SuperKeyword */ && ts.isDottedName(call.expression)) { currentFlow = createFlowCall(currentFlow, call); @@ -46311,7 +46757,7 @@ var ts; currentFlow = finishFlowLabel(postStatementLabel); } function bindDestructuringTargetFlow(node) { - if (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { bindAssignmentTargetFlow(node.left); } else { @@ -46322,10 +46768,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowMutation(16 /* FlowFlags.Assignment */, currentFlow, node); } - else if (node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */) { + else if (node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 225 /* SyntaxKind.SpreadElement */) { + if (e.kind === 227 /* SyntaxKind.SpreadElement */) { bindAssignmentTargetFlow(e.expression); } else { @@ -46333,16 +46779,16 @@ var ts; } } } - else if (node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + else if (node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (p.kind === 299 /* SyntaxKind.PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + else if (p.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (p.kind === 301 /* SyntaxKind.SpreadAssignment */) { bindAssignmentTargetFlow(p.expression); } } @@ -46479,7 +46925,7 @@ var ts; var operator = node.operatorToken.kind; if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 63 /* SyntaxKind.EqualsToken */ && node.left.kind === 207 /* SyntaxKind.ElementAccessExpression */) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && node.left.kind === 209 /* SyntaxKind.ElementAccessExpression */) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowMutation(256 /* FlowFlags.ArrayMutation */, currentFlow, node); @@ -46507,7 +46953,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { bindAssignmentTargetFlow(node.expression); } } @@ -46545,24 +46991,42 @@ var ts; } } function bindBindingElementFlow(node) { - if (ts.isBindingPattern(node.name)) { - // When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per: - // - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization - // - `BindingElement: BindingPattern Initializer?` - // - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization - // - `BindingElement: BindingPattern Initializer?` - bind(node.dotDotDotToken); - bind(node.propertyName); - bind(node.initializer); - bind(node.name); + // When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per: + // - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization + // - `BindingElement: BindingPattern Initializer?` + // - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization + // - `BindingElement: BindingPattern Initializer?` + bind(node.dotDotDotToken); + bind(node.propertyName); + bindInitializer(node.initializer); + bind(node.name); + } + function bindParameterFlow(node) { + bindEach(node.modifiers); + bind(node.dotDotDotToken); + bind(node.questionToken); + bind(node.type); + bindInitializer(node.initializer); + bind(node.name); + } + // a BindingElement/Parameter does not have side effects if initializers are not evaluated and used. (see GH#49759) + function bindInitializer(node) { + if (!node) { + return; } - else { - bindEachChild(node); + var entryFlow = currentFlow; + bind(node); + if (entryFlow === unreachableFlow || entryFlow === currentFlow) { + return; } + var exitFlow = createBranchLabel(); + addAntecedent(exitFlow, entryFlow); + addAntecedent(exitFlow, currentFlow); + currentFlow = finishFlowLabel(exitFlow); } function bindJSDocTypeAlias(node) { bind(node.tagName); - if (node.kind !== 339 /* SyntaxKind.JSDocEnumTag */ && node.fullName) { + if (node.kind !== 342 /* SyntaxKind.JSDocEnumTag */ && node.fullName) { // don't bind the type name yet; that's delayed until delayedBindJSDocTypedefTag ts.setParent(node.fullName, node); ts.setParentRecursive(node.fullName, /*incremental*/ false); @@ -46574,7 +47038,7 @@ var ts; function bindJSDocClassTag(node) { bindEachChild(node); var host = ts.getHostSignatureFromJSDoc(node); - if (host && host.kind !== 169 /* SyntaxKind.MethodDeclaration */) { + if (host && host.kind !== 171 /* SyntaxKind.MethodDeclaration */) { addDeclarationToSymbol(host.symbol, host, 32 /* SymbolFlags.Class */); } } @@ -46587,15 +47051,15 @@ var ts; } function bindOptionalChainRest(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: bind(node.questionDotToken); bind(node.name); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: bind(node.questionDotToken); bind(node.argumentExpression); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: bind(node.questionDotToken); bindEach(node.typeArguments); bindEach(node.arguments); @@ -46660,7 +47124,7 @@ var ts; // an immediately invoked function expression (IIFE). Initialize the flowNode property to // the current control flow (which includes evaluation of the IIFE arguments). var expr = ts.skipParentheses(node.expression); - if (expr.kind === 213 /* SyntaxKind.FunctionExpression */ || expr.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (expr.kind === 215 /* SyntaxKind.FunctionExpression */ || expr.kind === 216 /* SyntaxKind.ArrowFunction */) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -46672,7 +47136,7 @@ var ts; } } } - if (node.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var propertyAccess = node.expression; if (ts.isIdentifier(propertyAccess.name) && isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowMutation(256 /* FlowFlags.ArrayMutation */, currentFlow, node); @@ -46681,55 +47145,55 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 286 /* SyntaxKind.JsxAttributes */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 289 /* SyntaxKind.JsxAttributes */: return 1 /* ContainerFlags.IsContainer */; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return 1 /* ContainerFlags.IsContainer */ | 64 /* ContainerFlags.IsInterface */; - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 195 /* SyntaxKind.MappedType */: - case 176 /* SyntaxKind.IndexSignature */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 197 /* SyntaxKind.MappedType */: + case 178 /* SyntaxKind.IndexSignature */: return 1 /* ContainerFlags.IsContainer */ | 32 /* ContainerFlags.HasLocals */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: if (ts.isObjectLiteralOrClassExpressionMethodOrAccessor(node)) { return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */ | 128 /* ContainerFlags.IsObjectLiteralOrClassExpressionMethodOrAccessor */; } // falls through - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 179 /* SyntaxKind.FunctionType */: - case 175 /* SyntaxKind.ConstructSignature */: - case 180 /* SyntaxKind.ConstructorType */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 181 /* SyntaxKind.FunctionType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */ | 16 /* ContainerFlags.IsFunctionExpression */; - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return 4 /* ContainerFlags.IsControlFlowContainer */; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return node.initializer ? 4 /* ContainerFlags.IsControlFlowContainer */ : 0; - case 292 /* SyntaxKind.CatchClause */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 263 /* SyntaxKind.CaseBlock */: + case 295 /* SyntaxKind.CatchClause */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 266 /* SyntaxKind.CaseBlock */: return 2 /* ContainerFlags.IsBlockScopedContainer */; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: // do not treat blocks directly inside a function as a block-scoped-container. // Locals that reside in this block should go to the function locals. Otherwise 'x' // would not appear to be a redeclaration of a block scoped local in the following @@ -46762,46 +47226,46 @@ var ts; // members are declared (for example, a member of a class will go into a specific // symbol table depending on if it is static or not). We defer to specialized // handlers to take care of declaring these child members. - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 286 /* SyntaxKind.JsxAttributes */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 289 /* SyntaxKind.JsxAttributes */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the // object / type / interface declaring them). An exception is type parameters, // which are in scope without qualification (similar to 'locals'). return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 195 /* SyntaxKind.MappedType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 197 /* SyntaxKind.MappedType */: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, // they're only accessed 'lexically' (i.e. from code that exists underneath @@ -46909,10 +47373,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (ts.isExternalOrCommonJsModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -47009,7 +47473,7 @@ var ts; node.originalKeywordKind <= 125 /* SyntaxKind.LastFutureReservedWord */) { file.bindDiagnostics.push(createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); } - else if (node.originalKeywordKind === 132 /* SyntaxKind.AwaitKeyword */) { + else if (node.originalKeywordKind === 133 /* SyntaxKind.AwaitKeyword */) { if (ts.isExternalModule(file) && ts.isInTopLevelContext(node)) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module, ts.declarationNameToString(node))); } @@ -47111,8 +47575,8 @@ var ts; function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { // Report error if function is not top level function declaration - if (blockScopeContainer.kind !== 305 /* SyntaxKind.SourceFile */ && - blockScopeContainer.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && + if (blockScopeContainer.kind !== 308 /* SyntaxKind.SourceFile */ && + blockScopeContainer.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isFunctionLikeOrClassStaticBlockDeclaration(blockScopeContainer)) { // We check first if the name is inside class declaration or class expression; if so give explicit message // otherwise report generic error message. @@ -47209,7 +47673,7 @@ var ts; // the current 'container' node when it changes. This helps us know which symbol table // a local should go into for example. Since terminal nodes are known not to have // children, as an optimization we don't process those. - if (node.kind > 160 /* SyntaxKind.LastToken */) { + if (node.kind > 162 /* SyntaxKind.LastToken */) { var saveParent = parent; parent = node; var containerFlags = getContainerFlags(node); @@ -47285,23 +47749,23 @@ var ts; } // falls through case 108 /* SyntaxKind.ThisKeyword */: - if (currentFlow && (ts.isExpression(node) || parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkContextualIdentifier(node); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: if (currentFlow && ts.isPartOfTypeQuery(node)) { node.flowNode = currentFlow; } break; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: case 106 /* SyntaxKind.SuperKeyword */: node.flowNode = currentFlow; break; case 80 /* SyntaxKind.PrivateIdentifier */: return checkPrivateIdentifier(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = node; if (currentFlow && isNarrowableReference(expr)) { expr.flowNode = currentFlow; @@ -47316,7 +47780,7 @@ var ts; declareSymbol(file.locals, /*parent*/ undefined, expr.expression, 1 /* SymbolFlags.FunctionScopedVariable */ | 134217728 /* SymbolFlags.ModuleExports */, 111550 /* SymbolFlags.FunctionScopedVariableExcludes */); } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var specialKind = ts.getAssignmentDeclarationKind(node); switch (specialKind) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -47352,78 +47816,78 @@ var ts; ts.Debug.fail("Unknown binary expression special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return checkStrictModeCatchClause(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return checkStrictModeDeleteExpression(node); case 8 /* SyntaxKind.NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return checkStrictModeWithStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return checkStrictModeLabeledStatement(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: seenThisKeyword = true; return; - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: break; // Binding the children will handle everything - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return bindTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return bindParameter(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return bindVariableDeclarationOrBindingElement(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: node.flowNode = currentFlow; return bindVariableDeclarationOrBindingElement(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return bindPropertyWorker(node); - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* SymbolFlags.Property */, 0 /* SymbolFlags.PropertyExcludes */); - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* SymbolFlags.EnumMember */, 900095 /* SymbolFlags.EnumMemberExcludes */); - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* SymbolFlags.Signature */, 0 /* SymbolFlags.None */); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: // If this is an ObjectLiteralExpression method, then it sits in the same space // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes // so that it will conflict with any other object literal members with the same // name. return bindPropertyOrMethodOrAccessor(node, 8192 /* SymbolFlags.Method */ | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), ts.isObjectLiteralMethod(node) ? 0 /* SymbolFlags.PropertyExcludes */ : 103359 /* SymbolFlags.MethodExcludes */); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return bindFunctionDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* SymbolFlags.Constructor */, /*symbolExcludes:*/ 0 /* SymbolFlags.None */); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* SymbolFlags.GetAccessor */, 46015 /* SymbolFlags.GetAccessorExcludes */); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SymbolFlags.SetAccessor */, 78783 /* SymbolFlags.SetAccessorExcludes */); - case 179 /* SyntaxKind.FunctionType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 323 /* SyntaxKind.JSDocSignature */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 326 /* SyntaxKind.JSDocSignature */: + case 182 /* SyntaxKind.ConstructorType */: return bindFunctionOrConstructorType(node); - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 195 /* SyntaxKind.MappedType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 197 /* SyntaxKind.MappedType */: return bindAnonymousTypeWorker(node); - case 332 /* SyntaxKind.JSDocClassTag */: + case 335 /* SyntaxKind.JSDocClassTag */: return bindJSDocClassTag(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return bindFunctionExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: var assignmentKind = ts.getAssignmentDeclarationKind(node); switch (assignmentKind) { case 7 /* AssignmentDeclarationKind.ObjectDefinePropertyValue */: @@ -47442,70 +47906,73 @@ var ts; } break; // Members of classes, interfaces, and modules - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return bindClassLikeDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* SymbolFlags.Interface */, 788872 /* SymbolFlags.InterfaceExcludes */); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* SymbolFlags.TypeAlias */, 788968 /* SymbolFlags.TypeAliasExcludes */); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return bindEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return bindModuleDeclaration(node); // Jsx-attributes - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return bindJsxAttributes(node); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return bindJsxAttribute(node, 4 /* SymbolFlags.Property */, 0 /* SymbolFlags.PropertyExcludes */); // Imports and exports - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 2097152 /* SymbolFlags.Alias */, 2097152 /* SymbolFlags.AliasExcludes */); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return bindNamespaceExportDeclaration(node); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return bindImportClause(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return bindExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return bindExportAssignment(node); - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (!ts.isFunctionLikeOrClassStaticBlockDeclaration(node.parent)) { return; } // falls through - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return updateStrictModeStatementList(node.statements); - case 340 /* SyntaxKind.JSDocParameterTag */: - if (node.parent.kind === 323 /* SyntaxKind.JSDocSignature */) { + case 343 /* SyntaxKind.JSDocParameterTag */: + if (node.parent.kind === 326 /* SyntaxKind.JSDocSignature */) { return bindParameter(node); } - if (node.parent.kind !== 322 /* SyntaxKind.JSDocTypeLiteral */) { + if (node.parent.kind !== 325 /* SyntaxKind.JSDocTypeLiteral */) { break; } // falls through - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: var propTag = node; - var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */ ? + var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */ ? 4 /* SymbolFlags.Property */ | 16777216 /* SymbolFlags.Optional */ : 4 /* SymbolFlags.Property */; return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* SymbolFlags.PropertyExcludes */); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return (delayedTypeAliases || (delayedTypeAliases = [])).push(node); } } function bindPropertyWorker(node) { - return bindPropertyOrMethodOrAccessor(node, 4 /* SymbolFlags.Property */ | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), 0 /* SymbolFlags.PropertyExcludes */); + var isAutoAccessor = ts.isAutoAccessorPropertyDeclaration(node); + var includes = isAutoAccessor ? 98304 /* SymbolFlags.Accessor */ : 4 /* SymbolFlags.Property */; + var excludes = isAutoAccessor ? 13247 /* SymbolFlags.AccessorExcludes */ : 0 /* SymbolFlags.PropertyExcludes */; + return bindPropertyOrMethodOrAccessor(node, includes | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), excludes); } function bindAnonymousTypeWorker(node) { return bindAnonymousDeclaration(node, 2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */); @@ -47665,8 +48132,8 @@ var ts; } var thisContainer = ts.getThisContainer(node, /*includeArrowFunctions*/ false); switch (thisContainer.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: var constructorSymbol = thisContainer.symbol; // For `f.prototype.m = function() { this.x = 0; }`, `this.x = 0` should modify `f`'s members, not the function expression. if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { @@ -47688,12 +48155,12 @@ var ts; addDeclarationToSymbol(constructorSymbol, constructorSymbol.valueDeclaration, 32 /* SymbolFlags.Class */); } break; - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // this.foo assignment in a JavaScript class // Bind this property to the containing class var containingClass = thisContainer.parent; @@ -47705,7 +48172,7 @@ var ts; declareSymbol(symbolTable, containingClass.symbol, node, 4 /* SymbolFlags.Property */ | 67108864 /* SymbolFlags.Assignment */, 0 /* SymbolFlags.None */, /*isReplaceableByMethod*/ true); } break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // this.property = assignment in a source file -- declare symbol in exports for a module, in locals for a script if (ts.hasDynamicName(node)) { break; @@ -47734,7 +48201,7 @@ var ts; if (node.expression.kind === 108 /* SyntaxKind.ThisKeyword */) { bindThisPropertyAssignment(node); } - else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 308 /* SyntaxKind.SourceFile */) { if (ts.isPrototypeAccess(node.expression)) { bindPrototypePropertyAssignment(node, node.parent); } @@ -47774,7 +48241,7 @@ var ts; } function bindObjectDefinePropertyAssignment(node) { var namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0]); - var isToplevel = node.parent.parent.kind === 305 /* SyntaxKind.SourceFile */; + var isToplevel = node.parent.parent.kind === 308 /* SyntaxKind.SourceFile */; namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, node.arguments[0], isToplevel, /*isPrototypeProperty*/ false, /*containerIsClass*/ false); bindPotentiallyNewExpandoMemberToNamespace(node, namespaceSymbol, /*isPrototypeProperty*/ false); } @@ -47883,8 +48350,8 @@ var ts; } function isTopLevelNamespaceAssignment(propertyAccess) { return ts.isBinaryExpression(propertyAccess.parent) - ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 305 /* SyntaxKind.SourceFile */ - : propertyAccess.parent.parent.kind === 305 /* SyntaxKind.SourceFile */; + ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 308 /* SyntaxKind.SourceFile */ + : propertyAccess.parent.parent.kind === 308 /* SyntaxKind.SourceFile */; } function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty, containerIsClass) { var namespaceSymbol = lookupSymbolForPropertyAccess(name, container) || lookupSymbolForPropertyAccess(name, blockScopeContainer); @@ -47963,7 +48430,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 257 /* SyntaxKind.ClassDeclaration */) { + if (node.kind === 260 /* SyntaxKind.ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* SymbolFlags.Class */, 899503 /* SymbolFlags.ClassExcludes */); } else { @@ -48005,7 +48472,7 @@ var ts; checkStrictModeEvalOrArguments(node, node.name); } if (!ts.isBindingPattern(node.name)) { - var possibleVariableDecl = node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? node : node.parent.parent; + var possibleVariableDecl = node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? node : node.parent.parent; if (ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !ts.getJSDocTypeTag(node) && @@ -48033,7 +48500,7 @@ var ts; } } function bindParameter(node) { - if (node.kind === 340 /* SyntaxKind.JSDocParameterTag */ && container.kind !== 323 /* SyntaxKind.JSDocSignature */) { + if (node.kind === 343 /* SyntaxKind.JSDocParameterTag */ && container.kind !== 326 /* SyntaxKind.JSDocSignature */) { return; } if (inStrictMode && !(node.flags & 16777216 /* NodeFlags.Ambient */)) { @@ -48110,7 +48577,7 @@ var ts; declareSymbolAndAddToSymbolTable(node, 262144 /* SymbolFlags.TypeParameter */, 526824 /* SymbolFlags.TypeParameterExcludes */); } } - else if (node.parent.kind === 190 /* SyntaxKind.InferType */) { + else if (node.parent.kind === 192 /* SyntaxKind.InferType */) { var container_2 = getInferTypeContainer(node.parent); if (container_2) { if (!container_2.locals) { @@ -48138,11 +48605,11 @@ var ts; if (currentFlow === unreachableFlow) { var reportError = // report error on all statements except empty ones - (ts.isStatementButNotDeclaration(node) && node.kind !== 236 /* SyntaxKind.EmptyStatement */) || + (ts.isStatementButNotDeclaration(node) && node.kind !== 239 /* SyntaxKind.EmptyStatement */) || // report error on class declarations - node.kind === 257 /* SyntaxKind.ClassDeclaration */ || + node.kind === 260 /* SyntaxKind.ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)); + (node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)); if (reportError) { currentFlow = reportedUnreachableFlow; if (!options.allowUnreachableCode) { @@ -48186,12 +48653,12 @@ var ts; } function isPurelyTypeDeclaration(s) { switch (s.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return getModuleInstanceState(s) !== 1 /* ModuleInstanceState.Instantiated */; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.hasSyntacticModifier(s, 2048 /* ModifierFlags.Const */); default: return false; @@ -48392,7 +48859,7 @@ var ts; // (their type resolved directly to the member deeply referenced) // So to get the intervening symbols, we need to check if there's a type // query node on any of the symbol's declarations and get symbols there - if (d.type && d.type.kind === 181 /* SyntaxKind.TypeQuery */) { + if (d.type && d.type.kind === 183 /* SyntaxKind.TypeQuery */) { var query = d.type; var entity = getResolvedSymbol(getFirstIdentifier(query.exprName)); visitSymbol(entity); @@ -48803,6 +49270,7 @@ var ts; getTypeOfPropertyOfType: function (type, name) { return getTypeOfPropertyOfType(type, ts.escapeLeadingUnderscores(name)); }, getIndexInfoOfType: function (type, kind) { return getIndexInfoOfType(type, kind === 0 /* IndexKind.String */ ? stringType : numberType); }, getIndexInfosOfType: getIndexInfosOfType, + getIndexInfosOfIndexSymbol: getIndexInfosOfIndexSymbol, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: function (type, kind) { return getIndexTypeOfType(type, kind === 0 /* IndexKind.String */ ? stringType : numberType); }, getIndexType: function (type) { return getIndexType(type); }, @@ -48828,6 +49296,7 @@ var ts; signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration, symbolToEntityName: nodeBuilder.symbolToEntityName, symbolToExpression: nodeBuilder.symbolToExpression, + symbolToNode: nodeBuilder.symbolToNode, symbolToTypeParameterDeclarations: nodeBuilder.symbolToTypeParameterDeclarations, symbolToParameterDeclaration: nodeBuilder.symbolToParameterDeclaration, typeParameterToDeclaration: nodeBuilder.typeParameterToDeclaration, @@ -49076,6 +49545,7 @@ var ts; isPropertyAccessible: isPropertyAccessible, getTypeOnlyAliasDeclaration: getTypeOnlyAliasDeclaration, getMemberOverrideModifierStatus: getMemberOverrideModifierStatus, + isTypeParameterPossiblyReferenced: isTypeParameterPossiblyReferenced, }; function runWithInferenceBlockedFromSourceNode(node, fn) { var containingCall = ts.findAncestor(node, ts.isCallLikeExpression); @@ -49133,6 +49603,7 @@ var ts; var wildcardType = createIntrinsicType(1 /* TypeFlags.Any */, "any"); var errorType = createIntrinsicType(1 /* TypeFlags.Any */, "error"); var unresolvedType = createIntrinsicType(1 /* TypeFlags.Any */, "unresolved"); + var nonInferrableAnyType = createIntrinsicType(1 /* TypeFlags.Any */, "any", 65536 /* ObjectFlags.ContainsWideningType */); var intrinsicMarkerType = createIntrinsicType(1 /* TypeFlags.Any */, "intrinsic"); var unknownType = createIntrinsicType(2 /* TypeFlags.Unknown */, "unknown"); var nonNullUnknownType = createIntrinsicType(2 /* TypeFlags.Unknown */, "unknown"); @@ -49194,7 +49665,8 @@ var ts; var emptyTypeLiteralSymbol = createSymbol(2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */); emptyTypeLiteralSymbol.members = ts.createSymbolTable(); var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); - var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType; + var unknownEmptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); + var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType; var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); emptyGenericType.instantiations = new ts.Map(); var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); @@ -49308,6 +49780,8 @@ var ts; var deferredGlobalOmitSymbol; var deferredGlobalAwaitedSymbol; var deferredGlobalBigIntType; + var deferredGlobalNaNSymbol; + var deferredGlobalRecordSymbol; var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name var flowLoopStart = 0; var flowLoopCount = 0; @@ -49497,10 +49971,10 @@ var ts; } // Issue errors globally var file = ts.getSourceFileOfNode(location); - addErrorOrSuggestion(isError, "message" in message ? ts.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForFileFromMessageChain(file, message)); // eslint-disable-line no-in-operator + addErrorOrSuggestion(isError, "message" in message ? ts.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForFileFromMessageChain(file, message)); // eslint-disable-line local/no-in-operator return; } - addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line no-in-operator + addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line local/no-in-operator } function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, arg0, arg1, arg2, arg3) { var diagnostic = error(location, message, arg0, arg1, arg2, arg3); @@ -49729,7 +50203,7 @@ var ts; if (unidirectional === void 0) { unidirectional = false; } source.forEach(function (sourceSymbol, id) { var targetSymbol = target.get(id); - target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol); + target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol)); }); } function mergeModuleAugmentation(moduleName) { @@ -49817,7 +50291,7 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = new NodeLinks()); } function isGlobalSourceFile(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -49876,17 +50350,17 @@ var ts; } if (declaration.pos <= usage.pos && !(ts.isPropertyDeclaration(declaration) && ts.isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) { // declaration is before usage - if (declaration.kind === 203 /* SyntaxKind.BindingElement */) { + if (declaration.kind === 205 /* SyntaxKind.BindingElement */) { // still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2]) - var errorBindingElement = ts.getAncestor(usage, 203 /* SyntaxKind.BindingElement */); + var errorBindingElement = ts.getAncestor(usage, 205 /* SyntaxKind.BindingElement */); if (errorBindingElement) { return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) || declaration.pos < errorBindingElement.pos; } // or it might be illegal if usage happens before parent variable is declared (eg var [a] = a) - return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 254 /* SyntaxKind.VariableDeclaration */), usage); + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 257 /* SyntaxKind.VariableDeclaration */), usage); } - else if (declaration.kind === 254 /* SyntaxKind.VariableDeclaration */) { + else if (declaration.kind === 257 /* SyntaxKind.VariableDeclaration */) { // still might be illegal if usage is in the initializer of the variable declaration (eg var a = a) return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } @@ -49916,12 +50390,12 @@ var ts; // or if usage is in a type context: // 1. inside a type query (typeof in type position) // 2. inside a jsdoc comment - if (usage.parent.kind === 275 /* SyntaxKind.ExportSpecifier */ || (usage.parent.kind === 271 /* SyntaxKind.ExportAssignment */ && usage.parent.isExportEquals)) { + if (usage.parent.kind === 278 /* SyntaxKind.ExportSpecifier */ || (usage.parent.kind === 274 /* SyntaxKind.ExportAssignment */ && usage.parent.isExportEquals)) { // export specifiers do not use the variable, they only make it available for use return true; } // When resolving symbols for exports, the `usage` location passed in can be the export site directly - if (usage.kind === 271 /* SyntaxKind.ExportAssignment */ && usage.isExportEquals) { + if (usage.kind === 274 /* SyntaxKind.ExportAssignment */ && usage.isExportEquals) { return true; } if (!!(usage.flags & 8388608 /* NodeFlags.JSDoc */) || isInTypeQuery(usage) || usageInTypeDeclaration()) { @@ -49943,9 +50417,9 @@ var ts; } function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { switch (declaration.parent.parent.kind) { - case 237 /* SyntaxKind.VariableStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 240 /* SyntaxKind.VariableStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: // variable statement/for/for-of statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) if (isSameScopeDescendentOf(usage, declaration, declContainer)) { @@ -49973,7 +50447,7 @@ var ts; var initializerOfProperty = propertyDeclaration.initializer === current; if (initializerOfProperty) { if (ts.isStatic(current.parent)) { - if (declaration.kind === 169 /* SyntaxKind.MethodDeclaration */) { + if (declaration.kind === 171 /* SyntaxKind.MethodDeclaration */) { return true; } if (ts.isPropertyDeclaration(declaration) && ts.getContainingClass(usage) === ts.getContainingClass(declaration)) { @@ -49988,7 +50462,7 @@ var ts; } } else { - var isDeclarationInstanceProperty = declaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(declaration); + var isDeclarationInstanceProperty = declaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(declaration); if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) { return true; } @@ -50011,19 +50485,19 @@ var ts; return "quit"; } switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return true; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // even when stopping at any property declaration, they need to come from the same class return stopAtAnyPropertyDeclaration && (ts.isPropertyDeclaration(declaration) && node.parent === declaration.parent || ts.isParameterPropertyDeclaration(declaration, declaration.parent) && node.parent === declaration.parent.parent) ? "quit" : true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: switch (node.parent.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 175 /* SyntaxKind.SetAccessor */: return true; default: return false; @@ -50063,18 +50537,18 @@ var ts; } function requiresScopeChangeWorker(node) { switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: // do not descend into these return false; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 299 /* SyntaxKind.PropertyAssignment */: return requiresScopeChangeWorker(node.name); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // static properties in classes introduce temporary variables if (ts.hasStaticModifier(node)) { return target < 99 /* ScriptTarget.ESNext */ || !useDefineForClassFields; @@ -50103,12 +50577,13 @@ var ts; * the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with * the given name can be found. * + * @param nameNotFoundMessage If defined, we will report errors found during resolve. * @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters. */ - function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions) { + function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions) { if (excludeGlobals === void 0) { excludeGlobals = false; } - if (getSpellingSuggstions === void 0) { getSpellingSuggstions = true; } - return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions, getSymbol); + if (getSpellingSuggestions === void 0) { getSpellingSuggestions = true; } + return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol); } function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) { var _a, _b, _c; @@ -50139,14 +50614,14 @@ var ts; // - parameters are only in the scope of function body // This restriction does not apply to JSDoc comment types because they are parented // at a higher level than type parameters would normally be - if (meaning & result.flags & 788968 /* SymbolFlags.Type */ && lastLocation.kind !== 320 /* SyntaxKind.JSDoc */) { + if (meaning & result.flags & 788968 /* SymbolFlags.Type */ && lastLocation.kind !== 323 /* SyntaxKind.JSDoc */) { useResult = result.flags & 262144 /* SymbolFlags.TypeParameter */ // type parameters are visible in parameter list, return type and type parameter list ? lastLocation === location.type || - lastLocation.kind === 164 /* SyntaxKind.Parameter */ || - lastLocation.kind === 340 /* SyntaxKind.JSDocParameterTag */ || - lastLocation.kind === 341 /* SyntaxKind.JSDocReturnTag */ || - lastLocation.kind === 163 /* SyntaxKind.TypeParameter */ + lastLocation.kind === 166 /* SyntaxKind.Parameter */ || + lastLocation.kind === 343 /* SyntaxKind.JSDocParameterTag */ || + lastLocation.kind === 344 /* SyntaxKind.JSDocReturnTag */ || + lastLocation.kind === 165 /* SyntaxKind.TypeParameter */ // local types not visible outside the function body : false; } @@ -50161,13 +50636,13 @@ var ts; // however it is detected separately when checking initializers of parameters // to make sure that they reference no variables declared after them. useResult = - lastLocation.kind === 164 /* SyntaxKind.Parameter */ || + lastLocation.kind === 166 /* SyntaxKind.Parameter */ || (lastLocation === location.type && !!ts.findAncestor(result.valueDeclaration, ts.isParameter)); } } } - else if (location.kind === 189 /* SyntaxKind.ConditionalType */) { + else if (location.kind === 191 /* SyntaxKind.ConditionalType */) { // A type parameter declared using 'infer T' in a conditional type is visible only in // the true branch of the conditional type. useResult = lastLocation === location.trueType; @@ -50182,14 +50657,14 @@ var ts; } withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation); switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var moduleExports = ((_a = getSymbolOfNode(location)) === null || _a === void 0 ? void 0 : _a.exports) || emptySymbols; - if (location.kind === 305 /* SyntaxKind.SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 16777216 /* NodeFlags.Ambient */ && !ts.isGlobalScopeAugmentation(location))) { + if (location.kind === 308 /* SyntaxKind.SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 16777216 /* NodeFlags.Ambient */ && !ts.isGlobalScopeAugmentation(location))) { // It's an external module. First see if the module has an export default and if the local // name of that export default matches. if (result = moduleExports.get("default" /* InternalSymbolName.Default */)) { @@ -50213,7 +50688,7 @@ var ts; var moduleExport = moduleExports.get(name); if (moduleExport && moduleExport.flags === 2097152 /* SymbolFlags.Alias */ && - (ts.getDeclarationOfKind(moduleExport, 275 /* SyntaxKind.ExportSpecifier */) || ts.getDeclarationOfKind(moduleExport, 274 /* SyntaxKind.NamespaceExport */))) { + (ts.getDeclarationOfKind(moduleExport, 278 /* SyntaxKind.ExportSpecifier */) || ts.getDeclarationOfKind(moduleExport, 277 /* SyntaxKind.NamespaceExport */))) { break; } } @@ -50227,12 +50702,12 @@ var ts; } } break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (result = lookup(((_c = getSymbolOfNode(location)) === null || _c === void 0 ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* SymbolFlags.EnumMember */)) { break loop; } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // TypeScript 1.0 spec (April 2014): 8.4.1 // Initializer expressions for instance member variables are evaluated in the scope // of the class constructor body but are not permitted to reference parameters or @@ -50250,9 +50725,9 @@ var ts; } } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // The below is used to lookup type parameters within a class or interface, as they are added to the class/interface locals // These can never be latebound, so the symbol's raw members are sufficient. `getMembersOfNode` cannot be used, as it would // trigger resolving late-bound names, which we may already be in the process of doing while we're here! @@ -50266,12 +50741,14 @@ var ts; // TypeScript 1.0 spec (April 2014): 3.4.1 // The scope of a type parameter extends over the entire declaration with which the type // parameter list is associated, with the exception of static member declarations in classes. - error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + if (nameNotFoundMessage) { + error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + } return undefined; } break loop; } - if (location.kind === 226 /* SyntaxKind.ClassExpression */ && meaning & 32 /* SymbolFlags.Class */) { + if (location.kind === 228 /* SyntaxKind.ClassExpression */ && meaning & 32 /* SymbolFlags.Class */) { var className = location.name; if (className && name === className.escapedText) { result = location.symbol; @@ -50279,7 +50756,7 @@ var ts; } } break; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // The type parameters of a class are not in scope in the base class expression. if (lastLocation === location.expression && location.parent.token === 94 /* SyntaxKind.ExtendsKeyword */) { var container = location.parent.parent; @@ -50299,34 +50776,36 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968 /* SymbolFlags.Type */)) { - error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + if (nameNotFoundMessage) { + error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + } return undefined; } } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // when targeting ES6 or higher there is no 'arguments' in an arrow function // for lower compile targets the resolved symbol is used to emit an error if (ts.getEmitScriptTarget(compilerOptions) >= 2 /* ScriptTarget.ES2015 */) { break; } // falls through - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (meaning & 3 /* SymbolFlags.Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (meaning & 3 /* SymbolFlags.Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -50339,7 +50818,7 @@ var ts; } } break; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -50348,7 +50827,7 @@ var ts; // method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter. // } // - if (location.parent && location.parent.kind === 164 /* SyntaxKind.Parameter */) { + if (location.parent && location.parent.kind === 166 /* SyntaxKind.Parameter */) { location = location.parent; } // @@ -50363,20 +50842,20 @@ var ts; // declare function y(x: T): any; // @param(1 as T) // <-- T should resolve to the type alias outside of class C // class C {} - if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 257 /* SyntaxKind.ClassDeclaration */)) { + if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 260 /* SyntaxKind.ClassDeclaration */)) { location = location.parent; } break; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: // js type aliases do not resolve names from their host, so skip past it var root = ts.getJSDocRoot(location); if (root) { location = root.parent; } break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts.isBindingPattern(lastLocation))) { if (!associatedDeclarationForContainingInitializerOrBindingName) { @@ -50384,7 +50863,7 @@ var ts; } } break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts.isBindingPattern(lastLocation))) { if (ts.isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) { @@ -50392,7 +50871,7 @@ var ts; } } break; - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: if (meaning & 262144 /* SymbolFlags.TypeParameter */) { var parameterName = location.typeParameter.name; if (parameterName && name === parameterName.escapedText) { @@ -50418,7 +50897,7 @@ var ts; } if (!result) { if (lastLocation) { - ts.Debug.assert(lastLocation.kind === 305 /* SyntaxKind.SourceFile */); + ts.Debug.assert(lastLocation.kind === 308 /* SyntaxKind.SourceFile */); if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) { return lastLocation.symbol; } @@ -50500,7 +50979,7 @@ var ts; } return undefined; } - else if (checkAndReportErrorForInvalidInitializer()) { + else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) { return undefined; } // Perform extra checks only if error reporting was requested @@ -50548,7 +51027,7 @@ var ts; if (result && errorLocation && meaning & 111551 /* SymbolFlags.Value */ && result.flags & 2097152 /* SymbolFlags.Alias */ && !(result.flags & 111551 /* SymbolFlags.Value */) && !ts.isValidTypeOnlyAliasUseSite(errorLocation)) { var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result); if (typeOnlyDeclaration) { - var message = typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */ + var message = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type; var unescapedName = ts.unescapeLeadingUnderscores(name); @@ -50562,31 +51041,31 @@ var ts; function addTypeOnlyDeclarationRelatedInfo(diagnostic, typeOnlyDeclaration, unescapedName) { if (!typeOnlyDeclaration) return diagnostic; - return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName)); + return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName)); } function getIsDeferredContext(location, lastLocation) { - if (location.kind !== 214 /* SyntaxKind.ArrowFunction */ && location.kind !== 213 /* SyntaxKind.FunctionExpression */) { + if (location.kind !== 216 /* SyntaxKind.ArrowFunction */ && location.kind !== 215 /* SyntaxKind.FunctionExpression */) { // initializers in instance property declaration of class like entities are executed in constructor and thus deferred return ts.isTypeQueryNode(location) || ((ts.isFunctionLikeDeclaration(location) || - (location.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred + (location.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred } if (lastLocation && lastLocation === location.name) { return false; } // generator functions and async functions are not inlined in control flow when immediately invoked - if (location.asteriskToken || ts.hasSyntacticModifier(location, 256 /* ModifierFlags.Async */)) { + if (location.asteriskToken || ts.hasSyntacticModifier(location, 512 /* ModifierFlags.Async */)) { return true; } return !ts.getImmediatelyInvokedFunctionExpression(location); } function isSelfReferenceLocation(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: // For `namespace N { N; }` + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // For `namespace N { N; }` return true; default: return false; @@ -50599,7 +51078,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - if (decl.kind === 163 /* SyntaxKind.TypeParameter */) { + if (decl.kind === 165 /* SyntaxKind.TypeParameter */) { var parent = ts.isJSDocTemplateTag(decl.parent) ? ts.getJSDocHost(decl.parent) : decl.parent; if (parent === container) { return !(ts.isJSDocTemplateTag(decl.parent) && ts.find(decl.parent.parent.tags, ts.isJSDocTypeAlias)); @@ -50656,9 +51135,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: if (ts.isEntityNameExpression(node.expression)) { return node.expression; } @@ -50702,7 +51181,7 @@ var ts; return name === "any" || name === "string" || name === "number" || name === "boolean" || name === "never" || name === "unknown"; } function checkAndReportErrorForExportingPrimitiveType(errorLocation, name) { - if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) { + if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) { error(errorLocation, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, name); return true; } @@ -50793,7 +51272,7 @@ var ts; return; } // Block-scoped variables cannot be used before their definition - var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 260 /* SyntaxKind.EnumDeclaration */); }); + var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 263 /* SyntaxKind.EnumDeclaration */); }); if (declaration === undefined) return ts.Debug.fail("checkResolvedBlockScopedVariable could not find block-scoped declaration"); if (!(declaration.flags & 16777216 /* NodeFlags.Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { @@ -50830,13 +51309,13 @@ var ts; } function getAnyImportSyntax(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return node.parent; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent; default: return undefined; @@ -50861,24 +51340,24 @@ var ts; * const { x } = require ... */ function isAliasSymbolDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || node.kind === 267 /* SyntaxKind.ImportClause */ && !!node.name - || node.kind === 268 /* SyntaxKind.NamespaceImport */ - || node.kind === 274 /* SyntaxKind.NamespaceExport */ - || node.kind === 270 /* SyntaxKind.ImportSpecifier */ - || node.kind === 275 /* SyntaxKind.ExportSpecifier */ - || node.kind === 271 /* SyntaxKind.ExportAssignment */ && ts.exportAssignmentIsAlias(node) + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || node.kind === 270 /* SyntaxKind.ImportClause */ && !!node.name + || node.kind === 271 /* SyntaxKind.NamespaceImport */ + || node.kind === 277 /* SyntaxKind.NamespaceExport */ + || node.kind === 273 /* SyntaxKind.ImportSpecifier */ + || node.kind === 278 /* SyntaxKind.ExportSpecifier */ + || node.kind === 274 /* SyntaxKind.ExportAssignment */ && ts.exportAssignmentIsAlias(node) || ts.isBinaryExpression(node) && ts.getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */ && ts.exportAssignmentIsAlias(node) || ts.isAccessExpression(node) && ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && isAliasableOrJsExpression(node.parent.right) - || node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || node.kind === 296 /* SyntaxKind.PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) - || node.kind === 254 /* SyntaxKind.VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) - || node.kind === 203 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); + || node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || node.kind === 299 /* SyntaxKind.PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) + || node.kind === 257 /* SyntaxKind.VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) + || node.kind === 205 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); } function isAliasableOrJsExpression(e) { return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e); @@ -50891,7 +51370,7 @@ var ts; ? resolveSymbol(getPropertyOfType(resolveExternalModuleTypeByLiteral(name), commonJSPropertyAccess.name.escapedText)) : undefined; } - if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { var immediate = resolveExternalModuleName(node, ts.getExternalModuleRequireArgument(node) || ts.getExternalModuleImportEqualsDeclarationExpression(node)); var resolved_4 = resolveExternalModuleSymbol(immediate); markSymbolOfAliasDeclarationIfTypeOnly(node, immediate, resolved_4, /*overwriteEmpty*/ false); @@ -50904,7 +51383,7 @@ var ts; function checkAndReportErrorForResolvingImportAliasToTypeOnlySymbol(node, resolved) { if (markSymbolOfAliasDeclarationIfTypeOnly(node, /*immediateTarget*/ undefined, resolved, /*overwriteEmpty*/ false) && !node.isTypeOnly) { var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(getSymbolOfNode(node)); - var isExport = typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */; + var isExport = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */; var message = isExport ? ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type : ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type; @@ -50923,7 +51402,7 @@ var ts; return resolved; } function isSyntacticDefault(node) { - return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) || ts.isExportSpecifier(node)); + return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) || ts.isExportSpecifier(node)); } function getUsageModeForExpression(usage) { return ts.isStringLiteralLike(usage) ? ts.getModeForUsageLocation(ts.getSourceFileOfNode(usage), usage) : undefined; @@ -51023,11 +51502,11 @@ var ts; } function getModuleSpecifierForImportOrExport(node) { switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; - case 268 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier; - case 270 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier; - case 275 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier; + case 270 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier; + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier; + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier; + case 278 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier; default: return ts.Debug.assertNever(node); } } @@ -51296,31 +51775,31 @@ var ts; function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { if (dontRecursivelyResolve === void 0) { dontRecursivelyResolve = false; } switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return getTargetOfImportClause(node, dontRecursivelyResolve); - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return getTargetOfNamespaceImport(node, dontRecursivelyResolve); - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: return getTargetOfNamespaceExport(node, dontRecursivelyResolve); - case 270 /* SyntaxKind.ImportSpecifier */: - case 203 /* SyntaxKind.BindingElement */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 205 /* SyntaxKind.BindingElement */: return getTargetOfImportSpecifier(node, dontRecursivelyResolve); - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return getTargetOfExportSpecifier(node, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, dontRecursivelyResolve); - case 271 /* SyntaxKind.ExportAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: + case 274 /* SyntaxKind.ExportAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: return getTargetOfExportAssignment(node, dontRecursivelyResolve); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return resolveEntityName(node.name, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ true, dontRecursivelyResolve); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getTargetOfAliasLikeExpression(node.initializer, dontRecursivelyResolve); - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return getTargetOfAccessExpression(node, dontRecursivelyResolve); default: return ts.Debug.fail(); @@ -51472,18 +51951,18 @@ var ts; entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 79 /* SyntaxKind.Identifier */ || entityName.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + if (entityName.kind === 79 /* SyntaxKind.Identifier */ || entityName.parent.kind === 163 /* SyntaxKind.QualifiedName */) { return resolveEntityName(entityName, 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */); return resolveEntityName(entityName, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } } function getFullyQualifiedName(symbol, containingLocation) { - return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, /*meaning*/ undefined, 16 /* SymbolFormatFlags.DoNotIncludeSymbolChain */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, /*meaning*/ undefined, 32 /* SymbolFormatFlags.DoNotIncludeSymbolChain */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); } function getContainingQualifiedNameNode(node) { while (ts.isQualifiedName(node.parent)) { @@ -51524,9 +52003,9 @@ var ts; return getMergedSymbol(symbolFromJSPrototype); } } - else if (name.kind === 161 /* SyntaxKind.QualifiedName */ || name.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { - var left = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.left : name.expression; - var right = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.right : name.name; + else if (name.kind === 163 /* SyntaxKind.QualifiedName */ || name.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { + var left = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.left : name.expression; + var right = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, namespaceMeaning, ignoreErrors, /*dontResolveAlias*/ false, location); if (!namespace || ts.nodeIsMissing(right)) { return undefined; @@ -51584,7 +52063,7 @@ var ts; throw ts.Debug.assertNever(name, "Unknown entity name kind."); } ts.Debug.assert((ts.getCheckFlags(symbol) & 1 /* CheckFlags.Instantiated */) === 0, "Should never get an instantiated symbol here."); - if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 /* SymbolFlags.Alias */ || name.parent.kind === 271 /* SyntaxKind.ExportAssignment */)) { + if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 /* SymbolFlags.Alias */ || name.parent.kind === 274 /* SyntaxKind.ExportAssignment */)) { markSymbolOfAliasDeclarationIfTypeOnly(ts.getAliasDeclarationFromName(name), symbol, /*finalTarget*/ undefined, /*overwriteEmpty*/ true); } return (symbol.flags & meaning) || dontResolveAlias ? symbol : resolveAlias(symbol); @@ -51734,7 +52213,7 @@ var ts; if (ext === ".ts" /* Extension.Ts */ || ext === ".js" /* Extension.Js */ || ext === ".tsx" /* Extension.Tsx */ || ext === ".jsx" /* Extension.Jsx */) { var scope = currentSourceFile.packageJsonScope; var targetExt = ext === ".ts" /* Extension.Ts */ ? ".mts" /* Extension.Mts */ : ext === ".js" /* Extension.Js */ ? ".mjs" /* Extension.Mjs */ : undefined; - if (scope && !scope.packageJsonContent.type) { + if (scope && !scope.contents.packageJsonContent.type) { if (targetExt) { diagnosticDetails = ts.chainDiagnosticMessages( /*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1, targetExt, ts.combinePaths(scope.packageDirectory, "package.json")); @@ -51907,7 +52386,7 @@ var ts; var _a; var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); if (!dontResolveAlias && symbol) { - if (!suppressInteropError && !(symbol.flags & (1536 /* SymbolFlags.Module */ | 3 /* SymbolFlags.Variable */)) && !ts.getDeclarationOfKind(symbol, 305 /* SyntaxKind.SourceFile */)) { + if (!suppressInteropError && !(symbol.flags & (1536 /* SymbolFlags.Module */ | 3 /* SymbolFlags.Variable */)) && !ts.getDeclarationOfKind(symbol, 308 /* SyntaxKind.SourceFile */)) { var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop"; @@ -52273,7 +52752,7 @@ var ts; var members = node.members; for (var _i = 0, members_3 = members; _i < members_3.length; _i++) { var member = members_3[_i]; - if (member.kind === 171 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 173 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } @@ -52381,12 +52860,12 @@ var ts; } } switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var sym = getSymbolOfNode(location); // `sym` may not have exports if this module declaration is backed by the symbol for a `const` that's being rewritten // into a namespace - in such cases, it's best to just let the namespace appear empty (the const members couldn't have referred @@ -52395,9 +52874,9 @@ var ts; return { value: result }; } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // Type parameters are bound into `members` lists so they can merge across declarations // This is troublesome, since in all other respects, they behave like locals :cries: // TODO: the below is shared with similar code in `resolveName` - in fact, rephrasing all this symbol @@ -52492,7 +52971,7 @@ var ts; && (isLocalNameLookup ? !ts.some(symbolFromSymbolTable.declarations, ts.isNamespaceReexportDeclaration) : true) // While exports are generally considered to be in scope, export-specifier declared symbols are _not_ // See similar comment in `resolveName` for details - && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 275 /* SyntaxKind.ExportSpecifier */))) { + && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */))) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); var candidate = getCandidateListForSymbol(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification); if (candidate) { @@ -52536,7 +53015,7 @@ var ts; return true; } // Qualify if the symbol from symbol table has same meaning as expected - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 275 /* SyntaxKind.ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -52551,10 +53030,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: continue; default: return false; @@ -52684,10 +53163,10 @@ var ts; return node && getSymbolOfNode(node); } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasNonGlobalAugmentationExternalModuleSymbol(declaration) { - return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -52755,14 +53234,14 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 181 /* SyntaxKind.TypeQuery */ || - entityName.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) || - entityName.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (entityName.parent.kind === 183 /* SyntaxKind.TypeQuery */ || + entityName.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) || + entityName.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // Typeof value meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } - else if (entityName.kind === 161 /* SyntaxKind.QualifiedName */ || entityName.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - entityName.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + else if (entityName.kind === 163 /* SyntaxKind.QualifiedName */ || entityName.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + entityName.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1920 /* SymbolFlags.Namespace */; @@ -52798,15 +53277,18 @@ var ts; if (flags & 8 /* SymbolFormatFlags.UseAliasDefinedOutsideCurrentScope */) { nodeFlags |= 16384 /* NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope */; } - if (flags & 16 /* SymbolFormatFlags.DoNotIncludeSymbolChain */) { + if (flags & 32 /* SymbolFormatFlags.DoNotIncludeSymbolChain */) { nodeFlags |= 134217728 /* NodeBuilderFlags.DoNotIncludeSymbolChain */; } - var builder = flags & 4 /* SymbolFormatFlags.AllowAnyNodeKind */ ? nodeBuilder.symbolToExpression : nodeBuilder.symbolToEntityName; + if (flags & 16 /* SymbolFormatFlags.WriteComputedProps */) { + nodeFlags |= 1073741824 /* NodeBuilderFlags.WriteComputedProps */; + } + var builder = flags & 4 /* SymbolFormatFlags.AllowAnyNodeKind */ ? nodeBuilder.symbolToNode : nodeBuilder.symbolToEntityName; return writer ? symbolToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(symbolToStringWorker); function symbolToStringWorker(writer) { var entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags); // TODO: GH#18217 // add neverAsciiEscape for GH#39027 - var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 305 /* SyntaxKind.SourceFile */ ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true }); + var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 308 /* SyntaxKind.SourceFile */ ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true }); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); printer.writeNode(4 /* EmitHint.Unspecified */, entity, /*sourceFile*/ sourceFile, writer); return writer; @@ -52818,10 +53300,10 @@ var ts; function signatureToStringWorker(writer) { var sigOutput; if (flags & 262144 /* TypeFormatFlags.WriteArrowStyleSignature */) { - sigOutput = kind === 1 /* SignatureKind.Construct */ ? 180 /* SyntaxKind.ConstructorType */ : 179 /* SyntaxKind.FunctionType */; + sigOutput = kind === 1 /* SignatureKind.Construct */ ? 182 /* SyntaxKind.ConstructorType */ : 181 /* SyntaxKind.FunctionType */; } else { - sigOutput = kind === 1 /* SignatureKind.Construct */ ? 175 /* SyntaxKind.ConstructSignature */ : 174 /* SyntaxKind.CallSignature */; + sigOutput = kind === 1 /* SignatureKind.Construct */ ? 177 /* SyntaxKind.ConstructSignature */ : 176 /* SyntaxKind.CallSignature */; } var sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */); var printer = ts.createPrinter({ removeComments: true, omitTrailingSemicolon: true }); @@ -52901,7 +53383,25 @@ var ts; symbolTableToDeclarationStatements: function (symbolTable, enclosingDeclaration, flags, tracker, bundled) { return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolTableToDeclarationStatements(symbolTable, context, bundled); }); }, + symbolToNode: function (symbol, meaning, enclosingDeclaration, flags, tracker) { + return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolToNode(symbol, context, meaning); }); + }, }; + function symbolToNode(symbol, context, meaning) { + if (context.flags & 1073741824 /* NodeBuilderFlags.WriteComputedProps */) { + if (symbol.valueDeclaration) { + var name = ts.getNameOfDeclaration(symbol.valueDeclaration); + if (name && ts.isComputedPropertyName(name)) + return name; + } + var nameType = getSymbolLinks(symbol).nameType; + if (nameType && nameType.flags & (1024 /* TypeFlags.EnumLiteral */ | 8192 /* TypeFlags.UniqueESSymbol */)) { + context.enclosingDeclaration = nameType.symbol.valueDeclaration; + return ts.factory.createComputedPropertyName(symbolToExpression(nameType.symbol, context, meaning)); + } + } + return symbolToExpression(symbol, context, meaning); + } function withContext(enclosingDeclaration, flags, tracker, cb) { var _a, _b; ts.Debug.assert(enclosingDeclaration === undefined || (enclosingDeclaration.flags & 8 /* NodeFlags.Synthesized */) === 0); @@ -52986,7 +53486,7 @@ var ts; return undefined; // TODO: GH#18217 } context.approximateLength += 3; - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } if (!(context.flags & 536870912 /* NodeBuilderFlags.NoTypeReduction */)) { type = getReducedType(type); @@ -52996,29 +53496,29 @@ var ts; return ts.factory.createTypeReferenceNode(symbolToEntityNameNode(type.aliasSymbol), mapToTypeNodes(type.aliasTypeArguments, context)); } if (type === unresolvedType) { - return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */), 3 /* SyntaxKind.MultiLineCommentTrivia */, "unresolved"); + return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */), 3 /* SyntaxKind.MultiLineCommentTrivia */, "unresolved"); } context.approximateLength += 3; - return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 138 /* SyntaxKind.IntrinsicKeyword */ : 130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 139 /* SyntaxKind.IntrinsicKeyword */ : 131 /* SyntaxKind.AnyKeyword */); } if (type.flags & 2 /* TypeFlags.Unknown */) { - return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */); + return ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */); } if (type.flags & 4 /* TypeFlags.String */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(150 /* SyntaxKind.StringKeyword */); + return ts.factory.createKeywordTypeNode(152 /* SyntaxKind.StringKeyword */); } if (type.flags & 8 /* TypeFlags.Number */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(147 /* SyntaxKind.NumberKeyword */); + return ts.factory.createKeywordTypeNode(148 /* SyntaxKind.NumberKeyword */); } if (type.flags & 64 /* TypeFlags.BigInt */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(158 /* SyntaxKind.BigIntKeyword */); + return ts.factory.createKeywordTypeNode(160 /* SyntaxKind.BigIntKeyword */); } if (type.flags & 16 /* TypeFlags.Boolean */ && !type.aliasSymbol) { context.approximateLength += 7; - return ts.factory.createKeywordTypeNode(133 /* SyntaxKind.BooleanKeyword */); + return ts.factory.createKeywordTypeNode(134 /* SyntaxKind.BooleanKeyword */); } if (type.flags & 1024 /* TypeFlags.EnumLiteral */ && !(type.flags & 1048576 /* TypeFlags.Union */)) { var parentSymbol = getParentOfSymbol(type.symbol); @@ -53072,7 +53572,7 @@ var ts; } } context.approximateLength += 13; - return ts.factory.createTypeOperatorNode(154 /* SyntaxKind.UniqueKeyword */, ts.factory.createKeywordTypeNode(151 /* SyntaxKind.SymbolKeyword */)); + return ts.factory.createTypeOperatorNode(156 /* SyntaxKind.UniqueKeyword */, ts.factory.createKeywordTypeNode(153 /* SyntaxKind.SymbolKeyword */)); } if (type.flags & 16384 /* TypeFlags.Void */) { context.approximateLength += 4; @@ -53080,7 +53580,7 @@ var ts; } if (type.flags & 32768 /* TypeFlags.Undefined */) { context.approximateLength += 9; - return ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */); + return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */); } if (type.flags & 65536 /* TypeFlags.Null */) { context.approximateLength += 4; @@ -53088,15 +53588,15 @@ var ts; } if (type.flags & 131072 /* TypeFlags.Never */) { context.approximateLength += 5; - return ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */); + return ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */); } if (type.flags & 4096 /* TypeFlags.ESSymbol */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(151 /* SyntaxKind.SymbolKeyword */); + return ts.factory.createKeywordTypeNode(153 /* SyntaxKind.SymbolKeyword */); } if (type.flags & 67108864 /* TypeFlags.NonPrimitive */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(148 /* SyntaxKind.ObjectKeyword */); + return ts.factory.createKeywordTypeNode(149 /* SyntaxKind.ObjectKeyword */); } if (ts.isThisTypeParameter(type)) { if (context.flags & 4194304 /* NodeBuilderFlags.InObjectTypeLiteral */) { @@ -53185,7 +53685,7 @@ var ts; var indexedType = type.type; context.approximateLength += 6; var indexTypeNode = typeToTypeNodeHelper(indexedType, context); - return ts.factory.createTypeOperatorNode(140 /* SyntaxKind.KeyOfKeyword */, indexTypeNode); + return ts.factory.createTypeOperatorNode(141 /* SyntaxKind.KeyOfKeyword */, indexTypeNode); } if (type.flags & 134217728 /* TypeFlags.TemplateLiteral */) { var texts_1 = type.texts; @@ -53237,7 +53737,7 @@ var ts; // On the other hand, // checkType extends infer T extends checkType ? T extends extendsType ? trueType : falseType : never; // may also work with `infer ... extends ...` in, but would produce declarations only compatible with the latest TS. - return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)), ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)); + return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)), ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)); } var saveInferTypeParameters = context.inferTypeParameters; context.inferTypeParameters = type.root.inferTypeParameters; @@ -53279,7 +53779,7 @@ var ts; var name = typeParameterToName(newParam, context); newTypeVariable = ts.factory.createTypeReferenceNode(name); } - appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(140 /* SyntaxKind.KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)); + appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(141 /* SyntaxKind.KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)); } else { appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type), context); @@ -53295,7 +53795,7 @@ var ts; // wrap it with a conditional like `SomeModifiersType extends infer U ? {..the mapped type...} : never` to ensure the resulting // type stays homomorphic var originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode(type.declaration.typeParameter.constraint.type)) || unknownType, type.mapper); - return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 /* TypeFlags.Unknown */ ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)); + return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 /* TypeFlags.Unknown */ ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)); } return result; } @@ -53343,7 +53843,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* SymbolFlags.Function */) && (symbol.parent || // is exported function symbol ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 305 /* SyntaxKind.SourceFile */ || declaration.parent.kind === 262 /* SyntaxKind.ModuleBlock */; + return declaration.parent.kind === 308 /* SyntaxKind.SourceFile */ || declaration.parent.kind === 265 /* SyntaxKind.ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -53432,12 +53932,12 @@ var ts; } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { var signature = resolved.callSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 179 /* SyntaxKind.FunctionType */, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 181 /* SyntaxKind.FunctionType */, context); return signatureNode; } if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { var signature = resolved.constructSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 180 /* SyntaxKind.ConstructorType */, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 182 /* SyntaxKind.ConstructorType */, context); return signatureNode; } } @@ -53480,7 +53980,7 @@ var ts; } var elementType = typeToTypeNodeHelper(typeArguments[0], context); var arrayType = ts.factory.createArrayTypeNode(elementType); - return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, arrayType); + return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, arrayType); } else if (type.target.objectFlags & 8 /* ObjectFlags.Tuple */) { typeArguments = ts.sameMap(typeArguments, function (t, i) { return removeMissingType(t, !!(type.target.elementFlags[i] & 2 /* ElementFlags.Optional */)); }); @@ -53505,12 +54005,12 @@ var ts; } } var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode(tupleConstituentNodes), 1 /* EmitFlags.SingleLine */); - return type.target.readonly ? ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; } } if (context.encounteredError || (context.flags & 524288 /* NodeBuilderFlags.AllowEmptyTuple */)) { var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode([]), 1 /* EmitFlags.SingleLine */); - return type.target.readonly ? ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; } context.encounteredError = true; return undefined; // TODO: GH#18217 @@ -53617,13 +54117,13 @@ var ts; var typeElements = []; for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 174 /* SyntaxKind.CallSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 176 /* SyntaxKind.CallSignature */, context)); } for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; if (signature.flags & 4 /* SignatureFlags.Abstract */) continue; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 175 /* SyntaxKind.ConstructSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 177 /* SyntaxKind.ConstructSignature */, context)); } for (var _d = 0, _e = resolvedType.indexInfos; _d < _e.length; _d++) { var info = _e[_d]; @@ -53660,7 +54160,7 @@ var ts; if (!(context.flags & 1 /* NodeBuilderFlags.NoTruncation */)) { return ts.factory.createTypeReferenceNode(ts.factory.createIdentifier("..."), /*typeArguments*/ undefined); } - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } function shouldUsePlaceholderForProperty(propertySymbol, context) { var _a; @@ -53710,7 +54210,7 @@ var ts; var signatures = getSignaturesOfType(filterType(propertyType, function (t) { return !(t.flags & 32768 /* TypeFlags.Undefined */); }), 0 /* SignatureKind.Call */); for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) { var signature = signatures_1[_i]; - var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 168 /* SyntaxKind.MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); + var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 170 /* SyntaxKind.MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); typeElements.push(preserveCommentsOn(methodDeclaration)); } } @@ -53724,12 +54224,12 @@ var ts; context.reverseMappedStack || (context.reverseMappedStack = []); context.reverseMappedStack.push(propertySymbol); } - propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); if (propertyIsReverseMapped) { context.reverseMappedStack.pop(); } } - var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(145 /* SyntaxKind.ReadonlyKeyword */)] : undefined; + var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(146 /* SyntaxKind.ReadonlyKeyword */)] : undefined; if (modifiers) { context.approximateLength += 9; } @@ -53738,8 +54238,8 @@ var ts; } function preserveCommentsOn(node) { var _a; - if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 347 /* SyntaxKind.JSDocPropertyTag */; })) { - var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 347 /* SyntaxKind.JSDocPropertyTag */; }); + if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 350 /* SyntaxKind.JSDocPropertyTag */; })) { + var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 350 /* SyntaxKind.JSDocPropertyTag */; }); var commentText = ts.getTextOfJSDocComment(d.comment); if (commentText) { ts.setSyntheticLeadingComments(node, [{ kind: 3 /* SyntaxKind.MultiLineCommentTrivia */, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]); @@ -53838,7 +54338,7 @@ var ts; context.encounteredError = true; } context.approximateLength += (name.length + 4); - return ts.factory.createIndexSignature(indexInfo.isReadonly ? [ts.factory.createToken(145 /* SyntaxKind.ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); + return ts.factory.createIndexSignature(indexInfo.isReadonly ? [ts.factory.createToken(146 /* SyntaxKind.ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); } function signatureToSignatureDeclarationHelper(signature, kind, context, options) { var _a, _b, _c, _d; @@ -53856,7 +54356,7 @@ var ts; } var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0]; // If the expanded parameter list had a variadic in a non-trailing position, don't expand it - var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* CheckFlags.RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 171 /* SyntaxKind.Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); + var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* CheckFlags.RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 173 /* SyntaxKind.Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); var thisParameter = context.flags & 33554432 /* NodeBuilderFlags.OmitThisParameter */ ? undefined : tryGetThisParameterDeclaration(signature, context); if (thisParameter) { parameters.unshift(thisParameter); @@ -53865,7 +54365,7 @@ var ts; var typePredicate = getTypePredicateOfSignature(signature); if (typePredicate) { var assertsModifier = typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? - ts.factory.createToken(128 /* SyntaxKind.AssertsKeyword */) : + ts.factory.createToken(129 /* SyntaxKind.AssertsKeyword */) : undefined; var parameterName = typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.setEmitFlags(ts.factory.createIdentifier(typePredicate.parameterName), 16777216 /* EmitFlags.NoAsciiEscaping */) : @@ -53879,28 +54379,28 @@ var ts; returnTypeNode = serializeReturnTypeForSignature(context, returnType, signature, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); } else if (!suppressAny) { - returnTypeNode = ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + returnTypeNode = ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } } var modifiers = options === null || options === void 0 ? void 0 : options.modifiers; - if ((kind === 180 /* SyntaxKind.ConstructorType */) && signature.flags & 4 /* SignatureFlags.Abstract */) { + if ((kind === 182 /* SyntaxKind.ConstructorType */) && signature.flags & 4 /* SignatureFlags.Abstract */) { var flags = ts.modifiersToFlags(modifiers); - modifiers = ts.factory.createModifiersFromModifierFlags(flags | 128 /* ModifierFlags.Abstract */); + modifiers = ts.factory.createModifiersFromModifierFlags(flags | 256 /* ModifierFlags.Abstract */); } - var node = kind === 174 /* SyntaxKind.CallSignature */ ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : - kind === 175 /* SyntaxKind.ConstructSignature */ ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : - kind === 168 /* SyntaxKind.MethodSignature */ ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : - kind === 169 /* SyntaxKind.MethodDeclaration */ ? ts.factory.createMethodDeclaration(modifiers, /*asteriskToken*/ undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), /*questionToken*/ undefined, typeParameters, parameters, returnTypeNode, /*body*/ undefined) : - kind === 171 /* SyntaxKind.Constructor */ ? ts.factory.createConstructorDeclaration(modifiers, parameters, /*body*/ undefined) : - kind === 172 /* SyntaxKind.GetAccessor */ ? ts.factory.createGetAccessorDeclaration(modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, /*body*/ undefined) : - kind === 173 /* SyntaxKind.SetAccessor */ ? ts.factory.createSetAccessorDeclaration(modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, /*body*/ undefined) : - kind === 176 /* SyntaxKind.IndexSignature */ ? ts.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : - kind === 317 /* SyntaxKind.JSDocFunctionType */ ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : - kind === 179 /* SyntaxKind.FunctionType */ ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : - kind === 180 /* SyntaxKind.ConstructorType */ ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : - kind === 256 /* SyntaxKind.FunctionDeclaration */ ? ts.factory.createFunctionDeclaration(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, /*body*/ undefined) : - kind === 213 /* SyntaxKind.FunctionExpression */ ? ts.factory.createFunctionExpression(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) : - kind === 214 /* SyntaxKind.ArrowFunction */ ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, /*equalsGreaterThanToken*/ undefined, ts.factory.createBlock([])) : + var node = kind === 176 /* SyntaxKind.CallSignature */ ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : + kind === 177 /* SyntaxKind.ConstructSignature */ ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : + kind === 170 /* SyntaxKind.MethodSignature */ ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : + kind === 171 /* SyntaxKind.MethodDeclaration */ ? ts.factory.createMethodDeclaration(modifiers, /*asteriskToken*/ undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), /*questionToken*/ undefined, typeParameters, parameters, returnTypeNode, /*body*/ undefined) : + kind === 173 /* SyntaxKind.Constructor */ ? ts.factory.createConstructorDeclaration(modifiers, parameters, /*body*/ undefined) : + kind === 174 /* SyntaxKind.GetAccessor */ ? ts.factory.createGetAccessorDeclaration(modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, /*body*/ undefined) : + kind === 175 /* SyntaxKind.SetAccessor */ ? ts.factory.createSetAccessorDeclaration(modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, /*body*/ undefined) : + kind === 178 /* SyntaxKind.IndexSignature */ ? ts.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : + kind === 320 /* SyntaxKind.JSDocFunctionType */ ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : + kind === 181 /* SyntaxKind.FunctionType */ ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : + kind === 182 /* SyntaxKind.ConstructorType */ ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : + kind === 259 /* SyntaxKind.FunctionDeclaration */ ? ts.factory.createFunctionDeclaration(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, /*body*/ undefined) : + kind === 215 /* SyntaxKind.FunctionExpression */ ? ts.factory.createFunctionExpression(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) : + kind === 216 /* SyntaxKind.ArrowFunction */ ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, /*equalsGreaterThanToken*/ undefined, ts.factory.createBlock([])) : ts.Debug.assertNever(kind); if (typeArguments) { node.typeArguments = ts.factory.createNodeArray(typeArguments); @@ -53937,9 +54437,9 @@ var ts; return typeParameterToDeclarationWithConstraint(type, context, constraintNode); } function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) { - var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 164 /* SyntaxKind.Parameter */); + var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 166 /* SyntaxKind.Parameter */); if (!parameterDeclaration && !ts.isTransientSymbol(parameterSymbol)) { - parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 340 /* SyntaxKind.JSDocParameterTag */); + parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 343 /* SyntaxKind.JSDocParameterTag */); } var parameterType = getTypeOfSymbol(parameterSymbol); if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) { @@ -53951,7 +54451,7 @@ var ts; var dotDotDotToken = isRest ? ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */) : undefined; var name = parameterDeclaration ? parameterDeclaration.name ? parameterDeclaration.name.kind === 79 /* SyntaxKind.Identifier */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name), 16777216 /* EmitFlags.NoAsciiEscaping */) : - parameterDeclaration.name.kind === 161 /* SyntaxKind.QualifiedName */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216 /* EmitFlags.NoAsciiEscaping */) : + parameterDeclaration.name.kind === 163 /* SyntaxKind.QualifiedName */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216 /* EmitFlags.NoAsciiEscaping */) : cloneBindingName(parameterDeclaration.name) : ts.symbolName(parameterSymbol) : ts.symbolName(parameterSymbol); @@ -53962,22 +54462,15 @@ var ts; context.approximateLength += ts.symbolName(parameterSymbol).length + 3; return parameterNode; function cloneBindingName(node) { - return elideInitializerAndPropertyRenamingAndSetEmitFlags(node); - function elideInitializerAndPropertyRenamingAndSetEmitFlags(node) { + return elideInitializerAndSetEmitFlags(node); + function elideInitializerAndSetEmitFlags(node) { if (context.tracker.trackSymbol && ts.isComputedPropertyName(node) && isLateBindableName(node)) { trackComputedName(node.expression, context.enclosingDeclaration, context); } - var visited = ts.visitEachChild(node, elideInitializerAndPropertyRenamingAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndPropertyRenamingAndSetEmitFlags); + var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndSetEmitFlags); if (ts.isBindingElement(visited)) { - if (visited.propertyName && ts.isIdentifier(visited.propertyName) && ts.isIdentifier(visited.name)) { - visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, - /* propertyName*/ undefined, visited.propertyName, - /*initializer*/ undefined); - } - else { - visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name, - /*initializer*/ undefined); - } + visited = ts.factory.updateBindingElement(visited, visited.dotDotDotToken, visited.propertyName, visited.name, + /*initializer*/ undefined); } if (!ts.nodeIsSynthesized(visited)) { visited = ts.factory.cloneNode(visited); @@ -54122,11 +54615,11 @@ var ts; } function getSpecifierForModuleSymbol(symbol, context, overrideImportMode) { var _a; - var file = ts.getDeclarationOfKind(symbol, 305 /* SyntaxKind.SourceFile */); + var file = ts.getDeclarationOfKind(symbol, 308 /* SyntaxKind.SourceFile */); if (!file) { var equivalentFileSymbol = ts.firstDefined(symbol.declarations, function (d) { return getFileSymbolIfFileSymbolExportEqualsContainer(d, symbol); }); if (equivalentFileSymbol) { - file = ts.getDeclarationOfKind(equivalentFileSymbol, 305 /* SyntaxKind.SourceFile */); + file = ts.getDeclarationOfKind(equivalentFileSymbol, 308 /* SyntaxKind.SourceFile */); } } if (file && file.moduleName !== undefined) { @@ -54594,17 +55087,17 @@ var ts; return transformed === existing ? ts.setTextRange(ts.factory.cloneNode(existing), existing) : transformed; function visitExistingNodeTreeSymbols(node) { // We don't _actually_ support jsdoc namepath types, emit `any` instead - if (ts.isJSDocAllType(node) || node.kind === 319 /* SyntaxKind.JSDocNamepathType */) { - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + if (ts.isJSDocAllType(node) || node.kind === 322 /* SyntaxKind.JSDocNamepathType */) { + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } if (ts.isJSDocUnknownType(node)) { - return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */); + return ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */); } if (ts.isJSDocNullableType(node)) { return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createLiteralTypeNode(ts.factory.createNull())]); } if (ts.isJSDocOptionalType(node)) { - return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)]); + return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)]); } if (ts.isJSDocNonNullableType(node)) { return ts.visitNode(node.type, visitExistingNodeTreeSymbols); @@ -54618,11 +55111,11 @@ var ts; var typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode(node), name.escapedText); var overrideTypeNode = typeViaParent && t.typeExpression && getTypeFromTypeNode(t.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : undefined; return ts.factory.createPropertySignature( - /*modifiers*/ undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*modifiers*/ undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); })); } if (ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "") { - return ts.setOriginalNode(ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */), node); + return ts.setOriginalNode(ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */), node); } if ((ts.isExpressionWithTypeArguments(node) || ts.isTypeReferenceNode(node)) && ts.isJSDocIndexSignature(node)) { return ts.factory.createTypeLiteralNode([ts.factory.createIndexSignature( @@ -54637,12 +55130,12 @@ var ts; return ts.factory.createConstructorTypeNode( /*modifiers*/ undefined, ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.mapDefined(node.parameters, function (p, i) { return p.name && ts.isIdentifier(p.name) && p.name.escapedText === "new" ? (newTypeNode_1 = p.type, undefined) : ts.factory.createParameterDeclaration( /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), - /*initializer*/ undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*initializer*/ undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } else { return ts.factory.createFunctionTypeNode(ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.map(node.parameters, function (p, i) { return ts.factory.createParameterDeclaration( /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), - /*initializer*/ undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*initializer*/ undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } } if (ts.isTypeReferenceNode(node) && ts.isInJSDoc(node) && (!existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(node, getTypeFromTypeNode(node)) || getIntendedTypeFromJSDocTypeReference(node) || unknownSymbol === resolveTypeReferenceName(node, 788968 /* SymbolFlags.Type */, /*ignoreErrors*/ true))) { @@ -54710,8 +55203,8 @@ var ts; } } function symbolTableToDeclarationStatements(symbolTable, context, bundled) { - var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 169 /* SyntaxKind.MethodDeclaration */, /*useAcessors*/ true); - var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 168 /* SyntaxKind.MethodSignature */, /*useAcessors*/ false); + var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 171 /* SyntaxKind.MethodDeclaration */, /*useAcessors*/ true); + var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 170 /* SyntaxKind.MethodSignature */, /*useAcessors*/ false); // TODO: Use `setOriginalNode` on original declaration names where possible so these declarations see some kind of // declaration mapping // We save the enclosing declaration off here so it's not adjusted by well-meaning declaration @@ -54949,7 +55442,7 @@ var ts; if (needsPostExportDefault || needsExportDeclaration) { isPrivate = true; } - var modifierFlags = (!isPrivate ? 1 /* ModifierFlags.Export */ : 0) | (isDefault && !needsPostExportDefault ? 512 /* ModifierFlags.Default */ : 0); + var modifierFlags = (!isPrivate ? 1 /* ModifierFlags.Export */ : 0) | (isDefault && !needsPostExportDefault ? 1024 /* ModifierFlags.Default */ : 0); var isConstMergedWithNS = symbol.flags & 1536 /* SymbolFlags.Module */ && symbol.flags & (2 /* SymbolFlags.BlockScopedVariable */ | 1 /* SymbolFlags.FunctionScopedVariable */ | 4 /* SymbolFlags.Property */) && symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */; @@ -55133,8 +55626,8 @@ var ts; // Classes, namespaces, variables, enums, and functions all need `declare` modifiers to be valid in a declaration file top-level scope newModifierFlags |= 2 /* ModifierFlags.Ambient */; } - if ((additionalModifierFlags & 512 /* ModifierFlags.Default */) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) { - newModifierFlags |= 512 /* ModifierFlags.Default */; + if ((additionalModifierFlags & 1024 /* ModifierFlags.Default */) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) { + newModifierFlags |= 1024 /* ModifierFlags.Default */; } if (newModifierFlags) { node = ts.factory.updateModifiers(node, newModifierFlags | ts.getEffectiveModifierFlags(node)); @@ -55168,8 +55661,8 @@ var ts; var baseTypes = getBaseTypes(interfaceType); var baseType = ts.length(baseTypes) ? getIntersectionType(baseTypes) : undefined; var members = ts.flatMap(getPropertiesOfType(interfaceType), function (p) { return serializePropertySymbolForInterface(p, baseType); }); - var callSignatures = serializeSignatures(0 /* SignatureKind.Call */, interfaceType, baseType, 174 /* SyntaxKind.CallSignature */); - var constructSignatures = serializeSignatures(1 /* SignatureKind.Construct */, interfaceType, baseType, 175 /* SyntaxKind.ConstructSignature */); + var callSignatures = serializeSignatures(0 /* SignatureKind.Call */, interfaceType, baseType, 176 /* SyntaxKind.CallSignature */); + var constructSignatures = serializeSignatures(1 /* SignatureKind.Construct */, interfaceType, baseType, 177 /* SyntaxKind.ConstructSignature */); var indexSignatures = serializeIndexSignatures(interfaceType, baseType); var heritageClauses = !ts.length(baseTypes) ? undefined : [ts.factory.createHeritageClause(94 /* SyntaxKind.ExtendsKeyword */, ts.mapDefined(baseTypes, function (b) { return trySerializeAsTypeReference(b, 111551 /* SymbolFlags.Value */); }))]; addResult(ts.factory.createInterfaceDeclaration( @@ -55234,7 +55727,7 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var sig = signatures_2[_i]; // Each overload becomes a separate function declaration, in order - var decl = signatureToSignatureDeclarationHelper(sig, 256 /* SyntaxKind.FunctionDeclaration */, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); + var decl = signatureToSignatureDeclarationHelper(sig, 259 /* SyntaxKind.FunctionDeclaration */, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); addResult(ts.setTextRange(decl, getSignatureTextRangeLocation(sig)), modifierFlags); } // Module symbol emit will take care of module-y members, provided it has exports @@ -55392,7 +55885,7 @@ var ts; !ts.some(getSignaturesOfType(staticType, 1 /* SignatureKind.Construct */)); var constructors = isNonConstructableClassLikeInJsFile ? [ts.factory.createConstructorDeclaration(ts.factory.createModifiersFromModifierFlags(8 /* ModifierFlags.Private */), [], /*body*/ undefined)] : - serializeSignatures(1 /* SignatureKind.Construct */, staticType, staticBaseType, 171 /* SyntaxKind.Constructor */); + serializeSignatures(1 /* SignatureKind.Construct */, staticType, staticBaseType, 173 /* SyntaxKind.Constructor */); var indexSignatures = serializeIndexSignatures(classType, baseTypes[0]); context.enclosingDeclaration = oldEnclosing; addResult(ts.setTextRange(ts.factory.createClassDeclaration( @@ -55441,8 +55934,8 @@ var ts; var targetName = getInternalSymbolName(target, verbatimTargetName); includePrivateSymbol(target); // the target may be within the same scope - attempt to serialize it first switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 254 /* SyntaxKind.VariableDeclaration */) { + case 205 /* SyntaxKind.BindingElement */: + if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 257 /* SyntaxKind.VariableDeclaration */) { // const { SomeClass } = require('./lib'); var specifier_1 = getSpecifierForModuleSymbol(target.parent || target, context); // './lib' var propertyName = node.propertyName; @@ -55455,13 +55948,13 @@ var ts; // We don't know how to serialize this (nested?) binding element ts.Debug.failBadSyntaxKind(((_c = node.parent) === null || _c === void 0 ? void 0 : _c.parent) || node, "Unhandled binding element grandparent kind in declaration serialization"); break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 221 /* SyntaxKind.BinaryExpression */) { + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 223 /* SyntaxKind.BinaryExpression */) { // module.exports = { SomeClass } serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), targetName); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: // commonjs require: const x = require('y') if (ts.isPropertyAccessExpression(node.initializer)) { // const x = require('y').z @@ -55479,7 +55972,7 @@ var ts; break; } // else fall through and treat commonjs require just like import= - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // This _specifically_ only exists to handle json declarations - where we make aliases, but since // we emit no declarations for the json document, must not refer to it in the declarations if (target.escapedName === "export=" /* InternalSymbolName.ExportEquals */ && ts.some(target.declarations, ts.isJsonSourceFile)) { @@ -55495,13 +55988,13 @@ var ts; ? symbolToName(target, context, 67108863 /* SymbolFlags.All */, /*expectsIdentifier*/ false) : ts.factory.createExternalModuleReference(ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)))), isLocalImport ? modifierFlags : 0 /* ModifierFlags.None */); break; - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: // export as namespace foo // TODO: Not part of a file's local or export symbol tables // Is bound into file.symbol.globalExports instead, which we don't currently traverse addResult(ts.factory.createNamespaceExportDeclaration(ts.idText(node.name)), 0 /* ModifierFlags.None */); break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, ts.factory.createIdentifier(localName), /*namedBindings*/ undefined), // We use `target.parent || target` below as `target.parent` is unset when the target is a module which has been export assigned @@ -55510,17 +56003,17 @@ var ts; ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, /*importClause*/ undefined, ts.factory.createNamespaceImport(ts.factory.createIdentifier(localName))), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: addResult(ts.factory.createExportDeclaration( /*modifiers*/ undefined, /*isTypeOnly*/ false, ts.factory.createNamespaceExport(ts.factory.createIdentifier(localName)), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context))), 0 /* ModifierFlags.None */); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause( /*isTypeOnly*/ false, @@ -55530,7 +56023,7 @@ var ts; ])), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: // does not use localName because the symbol name in this case refers to the name in the exports table, // which we must exactly preserve var specifier = node.parent.parent.moduleSpecifier; @@ -55538,12 +56031,12 @@ var ts; // another file serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), specifier ? verbatimTargetName : targetName, specifier && ts.isStringLiteralLike(specifier) ? ts.factory.createStringLiteral(specifier.text) : undefined); break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: serializeMaybeAliasAssignment(symbol); break; - case 221 /* SyntaxKind.BinaryExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // Could be best encoded as though an export specifier or as though an export assignment // If name is default or export=, do an export assignment // Otherwise do an export specifier @@ -55687,7 +56180,7 @@ var ts; && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName)))) { return []; } - var flag = (modifierFlags & ~256 /* ModifierFlags.Async */) | (isStatic ? 32 /* ModifierFlags.Static */ : 0); + var flag = (modifierFlags & ~512 /* ModifierFlags.Async */) | (isStatic ? 32 /* ModifierFlags.Static */ : 0); var name = getPropertyNameNodeForSymbol(p, context); var firstPropertyLikeDecl = (_a = p.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.or(ts.isPropertyDeclaration, ts.isAccessor, ts.isVariableDeclaration, ts.isPropertySignature, ts.isBinaryExpression, ts.isPropertyAccessExpression)); if (p.flags & 98304 /* SymbolFlags.Accessor */ && useAccessors) { @@ -55709,7 +56202,7 @@ var ts; // This is an else/if as accessors and properties can't merge in TS, but might in JS // If this happens, we assume the accessor takes priority, as it imposes more constraints else if (p.flags & (4 /* SymbolFlags.Property */ | 3 /* SymbolFlags.Variable */ | 98304 /* SymbolFlags.Accessor */)) { - return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* ModifierFlags.Readonly */ : 0) | flag), name, p.flags & 16777216 /* SymbolFlags.Optional */ ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), + return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* ModifierFlags.Readonly */ : 0) | flag), name, p.flags & 16777216 /* SymbolFlags.Optional */ ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), // TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357 // interface members can't have initializers, however class members _can_ /*initializer*/ undefined), ((_d = p.declarations) === null || _d === void 0 ? void 0 : _d.find(ts.or(ts.isPropertyDeclaration, ts.isVariableDeclaration))) || firstPropertyLikeDecl); @@ -55899,7 +56392,7 @@ var ts; if (flags === void 0) { flags = 16384 /* TypeFormatFlags.UseAliasDefinedOutsideCurrentScope */; } return writer ? typePredicateToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(typePredicateToStringWorker); function typePredicateToStringWorker(writer) { - var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createToken(128 /* SyntaxKind.AssertsKeyword */) : undefined, typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */) // TODO: GH#18217 + var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createToken(129 /* SyntaxKind.AssertsKeyword */) : undefined, typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */) // TODO: GH#18217 ); var printer = ts.createPrinter({ removeComments: true }); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); @@ -55946,7 +56439,7 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* SymbolFlags.TypeLiteral */ && type.symbol.declarations) { var node = ts.walkUpParenthesizedTypes(type.symbol.declarations[0].parent); - if (node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + if (node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -55954,11 +56447,11 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && + node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isExternalModuleAugmentation(node.parent.parent); } function isDefaultBindingContext(location) { - return location.kind === 305 /* SyntaxKind.SourceFile */ || ts.isAmbientModule(location); + return location.kind === 308 /* SyntaxKind.SourceFile */ || ts.isAmbientModule(location); } function getNameOfSymbolFromNameType(symbol, context) { var nameType = getSymbolLinks(symbol).nameType; @@ -56017,17 +56510,17 @@ var ts; if (!declaration) { declaration = symbol.declarations[0]; // Declaration may be nameless, but we'll try anyway } - if (declaration.parent && declaration.parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (declaration.parent && declaration.parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { return ts.declarationNameToString(declaration.parent.name); } switch (declaration.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (context && !context.encounteredError && !(context.flags & 131072 /* NodeBuilderFlags.AllowAnonymousIdentifier */)) { context.encounteredError = true; } - return declaration.kind === 226 /* SyntaxKind.ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; + return declaration.kind === 228 /* SyntaxKind.ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; } } var name = getNameOfSymbolFromNameType(symbol, context); @@ -56044,28 +56537,28 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: // Top-level jsdoc type aliases are considered exported // First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent)); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return isDeclarationVisible(node.parent.parent); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { // If the binding pattern is empty, this variable declaration is not visible return false; } // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // external module augmentation is always visible if (ts.isExternalModuleAugmentation(node)) { return true; @@ -56073,55 +56566,55 @@ var ts; var parent = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedModifierFlags(node) & 1 /* ModifierFlags.Export */) && - !(node.kind !== 265 /* SyntaxKind.ImportEqualsDeclaration */ && parent.kind !== 305 /* SyntaxKind.SourceFile */ && parent.flags & 16777216 /* NodeFlags.Ambient */)) { + !(node.kind !== 268 /* SyntaxKind.ImportEqualsDeclaration */ && parent.kind !== 308 /* SyntaxKind.SourceFile */ && parent.flags & 16777216 /* NodeFlags.Ambient */)) { return isGlobalSourceFile(parent); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible return isDeclarationVisible(parent); - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.hasEffectiveModifier(node, 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */)) { // Private/protected properties/methods are not visible return false; } // Public properties/methods are visible if its parents are visible, so: // falls through - case 171 /* SyntaxKind.Constructor */: - case 175 /* SyntaxKind.ConstructSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 164 /* SyntaxKind.Parameter */: - case 262 /* SyntaxKind.ModuleBlock */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 178 /* SyntaxKind.TypeReference */: - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 173 /* SyntaxKind.Constructor */: + case 177 /* SyntaxKind.ConstructSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 166 /* SyntaxKind.Parameter */: + case 265 /* SyntaxKind.ModuleBlock */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 180 /* SyntaxKind.TypeReference */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: return false; // Type parameters are always visible - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: // Source file and namespace export are always visible // falls through - case 305 /* SyntaxKind.SourceFile */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return true; // Export assignments do not create name bindings outside the module - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return false; default: return false; @@ -56130,10 +56623,10 @@ var ts; } function collectLinkedAliases(node, setVisibility) { var exportSymbol; - if (node.parent && node.parent.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (node.parent && node.parent.kind === 274 /* SyntaxKind.ExportAssignment */) { exportSymbol = resolveName(node, node.escapedText, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false); } - else if (node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) { + else if (node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) { exportSymbol = getTargetOfExportSpecifier(node.parent, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */); } var result; @@ -56240,12 +56733,12 @@ var ts; function getDeclarationContainer(node) { return ts.findAncestor(ts.getRootDeclaration(node), function (node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 255 /* SyntaxKind.VariableDeclarationList */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 269 /* SyntaxKind.NamedImports */: - case 268 /* SyntaxKind.NamespaceImport */: - case 267 /* SyntaxKind.ImportClause */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 258 /* SyntaxKind.VariableDeclarationList */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 272 /* SyntaxKind.NamedImports */: + case 271 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: return false; default: return true; @@ -56375,23 +56868,23 @@ var ts; function getParentElementAccess(node) { var ancestor = node.parent.parent; switch (ancestor.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: return getSyntheticElementAccess(ancestor); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getSyntheticElementAccess(node.parent); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ancestor.initializer; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return ancestor.right; } } function getDestructuringPropertyName(node) { var parent = node.parent; - if (node.kind === 203 /* SyntaxKind.BindingElement */ && parent.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (node.kind === 205 /* SyntaxKind.BindingElement */ && parent.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { return getLiteralPropertyNameText(node.propertyName || node.name); } - if (node.kind === 296 /* SyntaxKind.PropertyAssignment */ || node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.kind === 299 /* SyntaxKind.PropertyAssignment */ || node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return getLiteralPropertyNameText(node.name); } return "" + parent.elements.indexOf(node); @@ -56421,7 +56914,7 @@ var ts; parentType = getTypeWithFacts(parentType, 524288 /* TypeFacts.NEUndefined */); } var type; - if (pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (declaration.dotDotDotToken) { parentType = getReducedType(parentType); if (parentType.flags & 2 /* TypeFlags.Unknown */ || !isValidSpreadType(parentType)) { @@ -56492,7 +56985,7 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node, /*excludeJSDocTypeAssertions*/ true); - return expr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && expr.elements.length === 0; + return expr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && expr.elements.length === 0; } function addOptionality(type, isProperty, isOptional) { if (isProperty === void 0) { isProperty = false; } @@ -56503,11 +56996,11 @@ var ts; function getTypeForVariableLikeDeclaration(declaration, includeOptionality, checkMode) { // A variable declared in a for..in statement is of type string, or of type keyof T when the // right hand expression is of a type parameter type. - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression, /*checkMode*/ checkMode))); return indexType.flags & (262144 /* TypeFlags.TypeParameter */ | 4194304 /* TypeFlags.Index */) ? getExtractStringType(indexType) : stringType; } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { // checkRightHandSideOfForOf will return undefined if the for-of expression type was // missing properties/signatures required to get its iteratedType (like // [Symbol.iterator] or next). This may be because we accessed properties from anyType, @@ -56518,7 +57011,7 @@ var ts; if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } - var isProperty = ts.isPropertyDeclaration(declaration) || ts.isPropertySignature(declaration); + var isProperty = ts.isPropertyDeclaration(declaration) && !ts.hasAccessorModifier(declaration) || ts.isPropertySignature(declaration); var isOptional = includeOptionality && (isProperty && !!declaration.questionToken || ts.isParameter(declaration) && (!!declaration.questionToken || isJSDocOptionalParameter(declaration)) || isOptionalJSDocPropertyLikeTag(declaration)); @@ -56545,8 +57038,8 @@ var ts; if (ts.isParameter(declaration)) { var func = declaration.parent; // For a parameter of a set accessor, use the type of the get accessor if one is present - if (func.kind === 173 /* SyntaxKind.SetAccessor */ && hasBindableName(func)) { - var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 172 /* SyntaxKind.GetAccessor */); + if (func.kind === 175 /* SyntaxKind.SetAccessor */ && hasBindableName(func)) { + var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 174 /* SyntaxKind.GetAccessor */); if (getter) { var getterSignature = getSignatureFromDeclaration(getter); var thisParameter = getAccessorThisParameter(func); @@ -56558,11 +57051,9 @@ var ts; return getReturnTypeOfSignature(getterSignature); } } - if (ts.isInJSFile(declaration)) { - var type_1 = getParameterTypeOfTypeTag(func, declaration); - if (type_1) - return type_1; - } + var parameterTypeOfTypeTag = getParameterTypeOfTypeTag(func, declaration); + if (parameterTypeOfTypeTag) + return parameterTypeOfTypeTag; // Use contextual parameter type if one is available var type = declaration.symbol.escapedName === "this" /* InternalSymbolName.This */ ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration); if (type) { @@ -56623,7 +57114,7 @@ var ts; links.isConstructorDeclaredProperty = !!getDeclaringConstructor(symbol) && ts.every(symbol.declarations, function (declaration) { return ts.isBinaryExpression(declaration) && isPossiblyAliasedThisProperty(declaration) && - (declaration.left.kind !== 207 /* SyntaxKind.ElementAccessExpression */ || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && + (declaration.left.kind !== 209 /* SyntaxKind.ElementAccessExpression */ || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && !getAnnotatedTypeForAssignmentDeclaration(/*declaredType*/ undefined, declaration, symbol, declaration); }); } @@ -56645,11 +57136,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; var container = ts.getThisContainer(declaration, /*includeArrowFunctions*/ false); - if (container && (container.kind === 171 /* SyntaxKind.Constructor */ || isJSConstructor(container))) { + if (container && (container.kind === 173 /* SyntaxKind.Constructor */ || isJSConstructor(container))) { return container; } } - ; } /** Create a synthetic property access flow node after the last statement of the file */ function getFlowTypeFromCommonJSExport(symbol) { @@ -56942,9 +57432,9 @@ var ts; var thisContainer = ts.getThisContainer(expression, /*includeArrowFunctions*/ false); // Properties defined in a constructor (or base constructor, or javascript constructor function) don't get undefined added. // Function expressions that are assigned to the prototype count as methods. - return thisContainer.kind === 171 /* SyntaxKind.Constructor */ || - thisContainer.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - (thisContainer.kind === 213 /* SyntaxKind.FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); + return thisContainer.kind === 173 /* SyntaxKind.Constructor */ || + thisContainer.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + (thisContainer.kind === 215 /* SyntaxKind.FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); } function getConstructorDefinedThisAssignmentTypes(types, declarations) { ts.Debug.assert(types.length === declarations.length); @@ -56972,7 +57462,11 @@ var ts; if (reportErrors && !declarationBelongsToPrivateAmbientMember(element)) { reportImplicitAny(element, anyType); } - return anyType; + // When we're including the pattern in the type (an indication we're obtaining a contextual type), we + // use a non-inferrable any type. Inference will never directly infer this type, but it is possible + // to infer a type that contains it, e.g. for a binding pattern like [foo] or { foo }. In such cases, + // widening of the binding pattern type substitutes a regular any for the non-inferrable any. + return includePatternInType ? nonInferrableAnyType : anyType; } // Return the type implied by an object binding pattern function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) { @@ -57010,7 +57504,7 @@ var ts; function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) { var elements = pattern.elements; var lastElement = ts.lastOrUndefined(elements); - var restElement = lastElement && lastElement.kind === 203 /* SyntaxKind.BindingElement */ && lastElement.dotDotDotToken ? lastElement : undefined; + var restElement = lastElement && lastElement.kind === 205 /* SyntaxKind.BindingElement */ && lastElement.dotDotDotToken ? lastElement : undefined; if (elements.length === 0 || elements.length === 1 && restElement) { return languageVersion >= 2 /* ScriptTarget.ES2015 */ ? createIterableType(anyType) : anyArrayType; } @@ -57035,7 +57529,7 @@ var ts; function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { if (includePatternInType === void 0) { includePatternInType = false; } if (reportErrors === void 0) { reportErrors = false; } - return pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ + return pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -57083,7 +57577,7 @@ var ts; } function declarationBelongsToPrivateAmbientMember(declaration) { var root = ts.getRootDeclaration(declaration); - var memberDeclaration = root.kind === 164 /* SyntaxKind.Parameter */ ? root.parent : root; + var memberDeclaration = root.kind === 166 /* SyntaxKind.Parameter */ ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function tryGetTypeFromEffectiveTypeNode(node) { @@ -57138,9 +57632,9 @@ var ts; if (typeNode === undefined) { return useUnknownInCatchVariables ? unknownType : anyType; } - var type_2 = getTypeOfNode(typeNode); + var type_1 = getTypeOfNode(typeNode); // an errorType will make `checkTryStatement` issue an error - return isTypeAny(type_2) || type_2 === unknownType ? type_2 : errorType; + return isTypeAny(type_1) || type_1 === unknownType ? type_1 : errorType; } // Handle export default expressions if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) { @@ -57163,7 +57657,7 @@ var ts; return reportCircularityError(symbol); } var type; - if (declaration.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (declaration.kind === 274 /* SyntaxKind.ExportAssignment */) { type = widenTypeForVariableLikeDeclaration(tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionCached(declaration.expression), declaration); } else if (ts.isBinaryExpression(declaration) || @@ -57231,13 +57725,17 @@ var ts; } function getAnnotatedAccessorTypeNode(accessor) { if (accessor) { - if (accessor.kind === 172 /* SyntaxKind.GetAccessor */) { - var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); - return getterTypeAnnotation; - } - else { - var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation; + switch (accessor.kind) { + case 174 /* SyntaxKind.GetAccessor */: + var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); + return getterTypeAnnotation; + case 175 /* SyntaxKind.SetAccessor */: + var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); + return setterTypeAnnotation; + case 169 /* SyntaxKind.PropertyDeclaration */: + ts.Debug.assert(ts.hasAccessorModifier(accessor)); + var accessorTypeAnnotation = ts.getEffectiveTypeAnnotationNode(accessor); + return accessorTypeAnnotation; } } return undefined; @@ -57259,14 +57757,17 @@ var ts; if (!pushTypeResolution(symbol, 0 /* TypeSystemPropertyName.Type */)) { return errorType; } - var getter = ts.getDeclarationOfKind(symbol, 172 /* SyntaxKind.GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 174 /* SyntaxKind.GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */); + var accessor = ts.tryCast(ts.getDeclarationOfKind(symbol, 169 /* SyntaxKind.PropertyDeclaration */), ts.isAutoAccessorPropertyDeclaration); // We try to resolve a getter type annotation, a setter type annotation, or a getter function // body return type inference, in that order. var type = getter && ts.isInJSFile(getter) && getTypeForDeclarationFromJSDocComment(getter) || getAnnotatedAccessorType(getter) || getAnnotatedAccessorType(setter) || - getter && getter.body && getReturnTypeFromBody(getter); + getAnnotatedAccessorType(accessor) || + getter && getter.body && getReturnTypeFromBody(getter) || + accessor && accessor.initializer && getWidenedTypeForVariableLikeDeclaration(accessor, /*includeOptionality*/ true); if (!type) { if (setter && !isPrivateWithinAmbient(setter)) { errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol)); @@ -57274,6 +57775,9 @@ var ts; else if (getter && !isPrivateWithinAmbient(getter)) { errorOrSuggestion(noImplicitAny, getter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol)); } + else if (accessor && !isPrivateWithinAmbient(accessor)) { + errorOrSuggestion(noImplicitAny, accessor, ts.Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), "any"); + } type = anyType; } if (!popTypeResolution()) { @@ -57283,6 +57787,9 @@ var ts; else if (getAnnotatedAccessorTypeNode(setter)) { error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); } + else if (getAnnotatedAccessorTypeNode(accessor)) { + error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } else if (getter && noImplicitAny) { error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } @@ -57293,12 +57800,13 @@ var ts; return links.type; } function getWriteTypeOfAccessors(symbol) { + var _a; var links = getSymbolLinks(symbol); if (!links.writeType) { if (!pushTypeResolution(symbol, 8 /* TypeSystemPropertyName.WriteType */)) { return errorType; } - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var setter = (_a = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */)) !== null && _a !== void 0 ? _a : ts.tryCast(ts.getDeclarationOfKind(symbol, 169 /* SyntaxKind.PropertyDeclaration */), ts.isAutoAccessorPropertyDeclaration); var writeType = getAnnotatedAccessorType(setter); if (!popTypeResolution()) { if (getAnnotatedAccessorTypeNode(setter)) { @@ -57338,9 +57846,9 @@ var ts; if (symbol.flags & 1536 /* SymbolFlags.Module */ && ts.isShorthandAmbientModuleSymbol(symbol)) { return anyType; } - else if (declaration && (declaration.kind === 221 /* SyntaxKind.BinaryExpression */ || + else if (declaration && (declaration.kind === 223 /* SyntaxKind.BinaryExpression */ || ts.isAccessExpression(declaration) && - declaration.parent.kind === 221 /* SyntaxKind.BinaryExpression */)) { + declaration.parent.kind === 223 /* SyntaxKind.BinaryExpression */)) { return getWidenedTypeForAssignmentDeclaration(symbol); } else if (symbol.flags & 512 /* SymbolFlags.ValueModule */ && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) { @@ -57350,11 +57858,11 @@ var ts; return errorType; } var exportEquals = getMergedSymbol(symbol.exports.get("export=" /* InternalSymbolName.ExportEquals */)); - var type_3 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule); + var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule); if (!popTypeResolution()) { return reportCircularityError(symbol); } - return type_3; + return type_2; } } var type = createObjectType(16 /* ObjectFlags.Anonymous */, symbol); @@ -57405,7 +57913,7 @@ var ts; return errorType; } // Check if variable has initializer that circularly references the variable itself - if (noImplicitAny && (declaration.kind !== 164 /* SyntaxKind.Parameter */ || declaration.initializer)) { + if (noImplicitAny && (declaration.kind !== 166 /* SyntaxKind.Parameter */ || declaration.initializer)) { error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); } // Circularities could also result from parameters in function expressions that end up @@ -57537,46 +58045,46 @@ var ts; return undefined; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 195 /* SyntaxKind.MappedType */: - case 189 /* SyntaxKind.ConditionalType */: { + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 197 /* SyntaxKind.MappedType */: + case 191 /* SyntaxKind.ConditionalType */: { var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); - if (node.kind === 195 /* SyntaxKind.MappedType */) { + if (node.kind === 197 /* SyntaxKind.MappedType */) { return ts.append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter))); } - else if (node.kind === 189 /* SyntaxKind.ConditionalType */) { + else if (node.kind === 191 /* SyntaxKind.ConditionalType */) { return ts.concatenate(outerTypeParameters, getInferTypeParameters(node)); } var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node)); var thisType = includeThisTypes && - (node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */ || node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || isJSConstructor(node)) && + (node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */ || node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || isJSConstructor(node)) && getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters; } - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: var paramSymbol = ts.getParameterSymbolFromJSDoc(node); if (paramSymbol) { node = paramSymbol.valueDeclaration; } break; - case 320 /* SyntaxKind.JSDoc */: { + case 323 /* SyntaxKind.JSDoc */: { var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); return node.tags ? appendTypeParameters(outerTypeParameters, ts.flatMap(node.tags, function (t) { return ts.isJSDocTemplateTag(t) ? t.typeParameters : undefined; })) @@ -57587,7 +58095,7 @@ var ts; } // The outer type parameters are those defined by enclosing generic classes, methods, or functions. function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 /* SymbolFlags.Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 258 /* SyntaxKind.InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* SymbolFlags.Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.InterfaceDeclaration */); ts.Debug.assert(!!declaration, "Class was missing valueDeclaration -OR- non-class had no interface declarations"); return getOuterTypeParameters(declaration); } @@ -57600,9 +58108,9 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - node.kind === 257 /* SyntaxKind.ClassDeclaration */ || - node.kind === 226 /* SyntaxKind.ClassExpression */ || + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + node.kind === 260 /* SyntaxKind.ClassDeclaration */ || + node.kind === 228 /* SyntaxKind.ClassExpression */ || isJSConstructor(node) || ts.isTypeAlias(node)) { var declaration = node; @@ -57754,7 +58262,7 @@ var ts; if (!popTypeResolution() && type.symbol.declarations) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ || declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ || declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { reportCircularBaseType(declaration, type); } } @@ -57850,7 +58358,7 @@ var ts; if (type.symbol.declarations) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getReducedType(getTypeFromTypeNode(node)); @@ -57890,7 +58398,7 @@ var ts; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { if (declaration.flags & 128 /* NodeFlags.ContainsThis */) { return false; } @@ -57969,7 +58477,7 @@ var ts; } else { type = errorType; - if (declaration.kind === 339 /* SyntaxKind.JSDocEnumTag */) { + if (declaration.kind === 342 /* SyntaxKind.JSDocEnumTag */) { error(declaration.typeExpression.type, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } else { @@ -57984,7 +58492,7 @@ var ts; if (ts.isStringLiteralLike(expr)) { return true; } - else if (expr.kind === 221 /* SyntaxKind.BinaryExpression */) { + else if (expr.kind === 223 /* SyntaxKind.BinaryExpression */) { return isStringConcatExpression(expr.left) && isStringConcatExpression(expr.right); } return false; @@ -57999,12 +58507,12 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return true; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 8 /* SyntaxKind.NumericLiteral */; case 79 /* SyntaxKind.Identifier */: return ts.nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isStringConcatExpression(expr); default: return false; @@ -58019,7 +58527,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind === 263 /* SyntaxKind.EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (member.initializer && ts.isStringLiteralLike(member.initializer)) { @@ -58048,7 +58556,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind === 263 /* SyntaxKind.EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; var value = getEnumMemberValue(member); @@ -58121,22 +58629,22 @@ var ts; */ function isThislessType(node) { switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 196 /* SyntaxKind.LiteralType */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 198 /* SyntaxKind.LiteralType */: return true; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return isThislessType(node.elementType); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return !node.typeArguments || node.typeArguments.every(isThislessType); } return false; @@ -58162,7 +58670,7 @@ var ts; function isThislessFunctionLikeDeclaration(node) { var returnType = ts.getEffectiveReturnTypeNode(node); var typeParameters = ts.getEffectiveTypeParameterDeclarations(node); - return (node.kind === 171 /* SyntaxKind.Constructor */ || (!!returnType && isThislessType(returnType))) && + return (node.kind === 173 /* SyntaxKind.Constructor */ || (!!returnType && isThislessType(returnType))) && node.parameters.every(isThislessVariableLikeDeclaration) && typeParameters.every(isThislessTypeParameter); } @@ -58178,14 +58686,14 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return isThislessVariableLikeDeclaration(declaration); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return isThislessFunctionLikeDeclaration(declaration); } } @@ -58396,8 +58904,10 @@ var ts; if (members) { for (var _b = 0, members_5 = members; _b < members_5.length; _b++) { var member = members_5[_b]; - if (isStatic_1 === ts.hasStaticModifier(member) && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic_1 === ts.hasStaticModifier(member)) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -58412,8 +58922,10 @@ var ts; || ts.isBinaryExpression(member) && isPossiblyAliasedThisProperty(member, assignmentKind) || assignmentKind === 9 /* AssignmentDeclarationKind.ObjectDefinePrototypeProperty */ || assignmentKind === 6 /* AssignmentDeclarationKind.Prototype */; // A straight `Prototype` assignment probably can never have a computed name - if (isStatic_1 === !isInstanceMember && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic_1 === !isInstanceMember) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -58600,7 +59112,7 @@ var ts; var baseConstructorType = getBaseConstructorTypeOfClass(classType); var baseSignatures = getSignaturesOfType(baseConstructorType, 1 /* SignatureKind.Construct */); var declaration = ts.getClassLikeDeclarationOfSymbol(classType.symbol); - var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */); + var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */); if (baseSignatures.length === 0) { return [createSignature(undefined, classType.localTypeParameters, undefined, ts.emptyArray, classType, /*resolvedTypePredicate*/ undefined, 0, isAbstract ? 4 /* SignatureFlags.Abstract */ : 0 /* SignatureFlags.None */)]; } @@ -59073,6 +59585,12 @@ var ts; return mapType(type, getLowerBoundOfKeyType); } if (type.flags & 2097152 /* TypeFlags.Intersection */) { + // Similarly to getTypeFromIntersectionTypeNode, we preserve the special string & {}, number & {}, + // and bigint & {} intersections that are used to prevent subtype reduction in union types. + var types = type.types; + if (types.length === 2 && !!(types[0].flags & (4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) && types[1] === emptyTypeLiteralType) { + return type; + } return getIntersectionType(ts.sameMap(type.types, getLowerBoundOfKeyType)); } return type; @@ -59216,8 +59734,8 @@ var ts; } function isMappedTypeWithKeyofConstraintDeclaration(type) { var constraintDeclaration = getConstraintDeclarationForMappedType(type); // TODO: GH#18217 - return constraintDeclaration.kind === 193 /* SyntaxKind.TypeOperator */ && - constraintDeclaration.operator === 140 /* SyntaxKind.KeyOfKeyword */; + return constraintDeclaration.kind === 195 /* SyntaxKind.TypeOperator */ && + constraintDeclaration.operator === 141 /* SyntaxKind.KeyOfKeyword */; } function getModifiersTypeFromMappedType(type) { if (!type.modifiersType) { @@ -59577,10 +60095,10 @@ var ts; var baseTypes = []; var different = false; for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var type_4 = types_7[_i]; - var baseType = getBaseConstraint(type_4); + var type_3 = types_7[_i]; + var baseType = getBaseConstraint(type_3); if (baseType) { - if (baseType !== type_4) { + if (baseType !== type_3) { different = true; } baseTypes.push(baseType); @@ -59624,7 +60142,7 @@ var ts; return constraint && getBaseConstraint(constraint); } if (t.flags & 33554432 /* TypeFlags.Substitution */) { - return getBaseConstraint(t.substitute); + return getBaseConstraint(getSubstitutionIntersection(t)); } return t; } @@ -59751,7 +60269,7 @@ var ts; var isInstantiation = (getTargetSymbol(prop) || prop) === (getTargetSymbol(singleProp) || singleProp); // If the symbols are instances of one another with identical types - consider the symbols // equivalent and just use the first one, which thus allows us to avoid eliding private - // members when intersecting a (this-)instantiations of a class with it's raw base or another instance + // members when intersecting a (this-)instantiations of a class with its raw base or another instance if (isInstantiation && compareProperties(singleProp, prop, function (a, b) { return a === b ? -1 /* Ternary.True */ : 0 /* Ternary.False */; }) === -1 /* Ternary.True */) { // If we merged instantiations of a generic type, we replicate the symbol parent resetting behavior we used // to do when we recorded multiple distinct symbols so that we still get, eg, `Array.length` printed @@ -59799,7 +60317,11 @@ var ts; } } } - if (!singleProp || isUnion && (propSet || checkFlags & 48 /* CheckFlags.Partial */) && checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */)) { + if (!singleProp || + isUnion && + (propSet || checkFlags & 48 /* CheckFlags.Partial */) && + checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */) && + !(propSet && getCommonDeclarationsOfSymbols(ts.arrayFrom(propSet.values())))) { // No property was found, or, in a union, a property has a private or protected declaration in one // constituent, but is missing or has a different declaration in another constituent. return undefined; @@ -59901,6 +60423,33 @@ var ts; } return property; } + function getCommonDeclarationsOfSymbols(symbols) { + var commonDeclarations; + var _loop_14 = function (symbol) { + if (!symbol.declarations) { + return { value: undefined }; + } + if (!commonDeclarations) { + commonDeclarations = new ts.Set(symbol.declarations); + return "continue"; + } + commonDeclarations.forEach(function (declaration) { + if (!ts.contains(symbol.declarations, declaration)) { + commonDeclarations.delete(declaration); + } + }); + if (commonDeclarations.size === 0) { + return { value: undefined }; + } + }; + for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) { + var symbol = symbols_3[_i]; + var state_4 = _loop_14(symbol); + if (typeof state_4 === "object") + return state_4.value; + } + return commonDeclarations; + } function getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment) { var property = getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment); // We need to filter out partial properties in union types @@ -60104,10 +60653,10 @@ var ts; function isJSDocOptionalParameter(node) { return ts.isInJSFile(node) && ( // node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType - node.type && node.type.kind === 316 /* SyntaxKind.JSDocOptionalType */ + node.type && node.type.kind === 319 /* SyntaxKind.JSDocOptionalType */ || ts.getJSDocParameterTags(node).some(function (_a) { var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */; })); } function tryFindAmbientModule(moduleName, withAugmentations) { @@ -60140,14 +60689,14 @@ var ts; return false; } function isOptionalPropertyDeclaration(node) { - return ts.isPropertyDeclaration(node) && node.questionToken; + return ts.isPropertyDeclaration(node) && !ts.hasAccessorModifier(node) && node.questionToken; } function isOptionalJSDocPropertyLikeTag(node) { if (!ts.isJSDocPropertyLikeTag(node)) { return false; } var isBracketed = node.isBracketed, typeExpression = node.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */; } function createTypePredicate(kind, parameterName, parameterIndex, type) { return { kind: kind, parameterName: parameterName, parameterIndex: parameterIndex, type: type }; @@ -60229,7 +60778,7 @@ var ts; else { parameters.push(paramSymbol); } - if (type && type.kind === 196 /* SyntaxKind.LiteralType */) { + if (type && type.kind === 198 /* SyntaxKind.LiteralType */) { flags |= 2 /* SignatureFlags.HasLiteralTypes */; } // Record a new minimum argument count if this is not an optional parameter @@ -60242,24 +60791,24 @@ var ts; } } // If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation - if ((declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) && + if ((declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) && hasBindableName(declaration) && (!hasThisParameter || !thisParameter)) { - var otherKind = declaration.kind === 172 /* SyntaxKind.GetAccessor */ ? 173 /* SyntaxKind.SetAccessor */ : 172 /* SyntaxKind.GetAccessor */; + var otherKind = declaration.kind === 174 /* SyntaxKind.GetAccessor */ ? 175 /* SyntaxKind.SetAccessor */ : 174 /* SyntaxKind.GetAccessor */; var other = ts.getDeclarationOfKind(getSymbolOfNode(declaration), otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); } } - var classType = declaration.kind === 171 /* SyntaxKind.Constructor */ ? + var classType = declaration.kind === 173 /* SyntaxKind.Constructor */ ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration); if (ts.hasRestParameter(declaration) || ts.isInJSFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters)) { flags |= 1 /* SignatureFlags.HasRestParameter */; } - if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */) || - ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 128 /* ModifierFlags.Abstract */)) { + if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */) || + ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 256 /* ModifierFlags.Abstract */)) { flags |= 4 /* SignatureFlags.Abstract */; } links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, @@ -60338,16 +60887,16 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node.escapedText === argumentsSymbol.escapedName && getReferencedValueSymbol(node) === argumentsSymbol; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && traverse(node.name); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return traverse(node.expression); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return traverse(node.initializer); default: return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && !!ts.forEachChild(node, traverse); @@ -60371,7 +60920,12 @@ var ts; continue; } } - result.push(getSignatureFromDeclaration(decl)); + // If this is a function or method declaration, get the signature from the @type tag for the sake of optional parameters. + // Exclude contextually-typed kinds because we already apply the @type tag to the context, plus applying it here to the initializer would supress checks that the two are compatible. + result.push((!ts.isFunctionExpressionOrArrowFunction(decl) && + !ts.isObjectLiteralMethod(decl) && + getSignatureOfTypeTag(decl)) || + getSignatureFromDeclaration(decl)); } return result; } @@ -60402,7 +60956,7 @@ var ts; else { var type = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration); var jsdocPredicate = void 0; - if (!type && ts.isInJSFile(signature.declaration)) { + if (!type) { var jsdocSignature = getSignatureOfTypeTag(signature.declaration); if (jsdocSignature && signature !== jsdocSignature) { jsdocPredicate = getTypePredicateOfSignature(jsdocSignature); @@ -60419,7 +60973,7 @@ var ts; function createTypePredicateFromTypePredicateNode(node, signature) { var parameterName = node.parameterName; var type = node.type && getTypeFromTypeNode(node.type); - return parameterName.kind === 192 /* SyntaxKind.ThisType */ ? + return parameterName.kind === 194 /* SyntaxKind.ThisType */ ? createTypePredicate(node.assertsModifier ? 2 /* TypePredicateKind.AssertsThis */ : 0 /* TypePredicateKind.This */, /*parameterName*/ undefined, /*parameterIndex*/ undefined, type) : createTypePredicate(node.assertsModifier ? 3 /* TypePredicateKind.AssertsIdentifier */ : 1 /* TypePredicateKind.Identifier */, parameterName.escapedText, ts.findIndex(signature.parameters, function (p) { return p.escapedName === parameterName.escapedText; }), type); } @@ -60465,7 +61019,7 @@ var ts; return signature.resolvedReturnType; } function getReturnTypeFromAnnotation(declaration) { - if (declaration.kind === 171 /* SyntaxKind.Constructor */) { + if (declaration.kind === 173 /* SyntaxKind.Constructor */) { return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)); } if (ts.isJSDocConstructSignature(declaration)) { @@ -60475,12 +61029,12 @@ var ts; if (typeNode) { return getTypeFromTypeNode(typeNode); } - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ && hasBindableName(declaration)) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ && hasBindableName(declaration)) { var jsDocType = ts.isInJSFile(declaration) && getTypeForDeclarationFromJSDocComment(declaration); if (jsDocType) { return jsDocType; } - var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 173 /* SyntaxKind.SetAccessor */); + var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 175 /* SyntaxKind.SetAccessor */); var setterType = getAnnotatedAccessorType(setter); if (setterType) { return setterType; @@ -60583,7 +61137,7 @@ var ts; if (!signature.isolatedSignatureType) { var kind = (_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind; // If declaration is undefined, it is likely to be the signature of the default constructor. - var isConstructor = kind === undefined || kind === 171 /* SyntaxKind.Constructor */ || kind === 175 /* SyntaxKind.ConstructSignature */ || kind === 180 /* SyntaxKind.ConstructorType */; + var isConstructor = kind === undefined || kind === 173 /* SyntaxKind.Constructor */ || kind === 177 /* SyntaxKind.ConstructSignature */ || kind === 182 /* SyntaxKind.ConstructorType */; var type = createObjectType(16 /* ObjectFlags.Anonymous */); type.members = emptySymbols; type.properties = ts.emptyArray; @@ -60610,7 +61164,7 @@ var ts; function getIndexInfosOfIndexSymbol(indexSymbol) { if (indexSymbol.declarations) { var indexInfos_4 = []; - var _loop_14 = function (declaration) { + var _loop_15 = function (declaration) { if (declaration.parameters.length === 1) { var parameter = declaration.parameters[0]; if (parameter.type) { @@ -60624,7 +61178,7 @@ var ts; }; for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - _loop_14(declaration); + _loop_15(declaration); } return indexInfos_4; } @@ -60641,14 +61195,14 @@ var ts; var _a; var inferences; if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) { - var _loop_15 = function (declaration) { - if (declaration.parent.kind === 190 /* SyntaxKind.InferType */) { + var _loop_16 = function (declaration) { + if (declaration.parent.kind === 192 /* SyntaxKind.InferType */) { // When an 'infer T' declaration is immediately contained in a type reference node // (such as 'Foo'), T's constraint is inferred from the constraint of the // corresponding type parameter in 'Foo'. When multiple 'infer T' declarations are // present, we form an intersection of the inferred constraint types. var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1]; - if (grandParent.kind === 178 /* SyntaxKind.TypeReference */ && !omitTypeReferences) { + if (grandParent.kind === 180 /* SyntaxKind.TypeReference */ && !omitTypeReferences) { var typeReference_1 = grandParent; var typeParameters_1 = getTypeParametersForTypeReference(typeReference_1); if (typeParameters_1) { @@ -60675,27 +61229,27 @@ var ts; } // When an 'infer T' declaration is immediately contained in a rest parameter declaration, a rest type // or a named rest tuple element, we infer an 'unknown[]' constraint. - else if (grandParent.kind === 164 /* SyntaxKind.Parameter */ && grandParent.dotDotDotToken || - grandParent.kind === 186 /* SyntaxKind.RestType */ || - grandParent.kind === 197 /* SyntaxKind.NamedTupleMember */ && grandParent.dotDotDotToken) { + else if (grandParent.kind === 166 /* SyntaxKind.Parameter */ && grandParent.dotDotDotToken || + grandParent.kind === 188 /* SyntaxKind.RestType */ || + grandParent.kind === 199 /* SyntaxKind.NamedTupleMember */ && grandParent.dotDotDotToken) { inferences = ts.append(inferences, createArrayType(unknownType)); } // When an 'infer T' declaration is immediately contained in a string template type, we infer a 'string' // constraint. - else if (grandParent.kind === 199 /* SyntaxKind.TemplateLiteralTypeSpan */) { + else if (grandParent.kind === 201 /* SyntaxKind.TemplateLiteralTypeSpan */) { inferences = ts.append(inferences, stringType); } // When an 'infer T' declaration is in the constraint position of a mapped type, we infer a 'keyof any' // constraint. - else if (grandParent.kind === 163 /* SyntaxKind.TypeParameter */ && grandParent.parent.kind === 195 /* SyntaxKind.MappedType */) { + else if (grandParent.kind === 165 /* SyntaxKind.TypeParameter */ && grandParent.parent.kind === 197 /* SyntaxKind.MappedType */) { inferences = ts.append(inferences, keyofConstraintType); } // When an 'infer T' declaration is the template of a mapped type, and that mapped type is the extends // clause of a conditional whose check type is also a mapped type, give it a constraint equal to the template // of the check type's mapped type - else if (grandParent.kind === 195 /* SyntaxKind.MappedType */ && grandParent.type && - ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 189 /* SyntaxKind.ConditionalType */ && - grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 195 /* SyntaxKind.MappedType */ && + else if (grandParent.kind === 197 /* SyntaxKind.MappedType */ && grandParent.type && + ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 191 /* SyntaxKind.ConditionalType */ && + grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 197 /* SyntaxKind.MappedType */ && grandParent.parent.checkType.type) { var checkMappedType_1 = grandParent.parent.checkType; var nodeType = getTypeFromTypeNode(checkMappedType_1.type); @@ -60705,7 +61259,7 @@ var ts; }; for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) { var declaration = _b[_i]; - _loop_15(declaration); + _loop_16(declaration); } } return inferences && getIntersectionType(inferences); @@ -60727,7 +61281,7 @@ var ts; if (type.flags & 1 /* TypeFlags.Any */ && !isErrorType(type)) { // Allow errorType to propegate to keep downstream errors suppressed // use keyofConstraintType as the base constraint for mapped type key constraints (unknown isn;t assignable to that, but `any` was), // use unknown otherwise - type = constraintDeclaration.parent.parent.kind === 195 /* SyntaxKind.MappedType */ ? keyofConstraintType : unknownType; + type = constraintDeclaration.parent.parent.kind === 197 /* SyntaxKind.MappedType */ ? keyofConstraintType : unknownType; } typeParameter.constraint = type; } @@ -60736,7 +61290,7 @@ var ts; return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - var tp = ts.getDeclarationOfKind(typeParameter.symbol, 163 /* SyntaxKind.TypeParameter */); + var tp = ts.getDeclarationOfKind(typeParameter.symbol, 165 /* SyntaxKind.TypeParameter */); var host = ts.isJSDocTemplateTag(tp.parent) ? ts.getEffectiveContainerForJSDocTemplateTag(tp.parent) : tp.parent; return host && getSymbolOfNode(host); } @@ -60822,8 +61376,8 @@ var ts; } var node = type.node; var typeArguments = !node ? ts.emptyArray : - node.kind === 178 /* SyntaxKind.TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : - node.kind === 183 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : + node.kind === 180 /* SyntaxKind.TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : + node.kind === 185 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); if (popTypeResolution()) { type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments; @@ -60865,7 +61419,7 @@ var ts; return errorType; } } - if (node.kind === 178 /* SyntaxKind.TypeReference */ && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) { return createDeferredTypeReference(type, node, /*mapper*/ undefined); } // In a type reference, the outer type parameters of the referenced class or interface are automatically @@ -60936,9 +61490,9 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // We only support expressions that are simple qualified names. For other // expressions this produces undefined. var expr = node.expression; @@ -60953,13 +61507,13 @@ var ts; return symbol.parent ? "".concat(getSymbolPath(symbol.parent), ".").concat(symbol.escapedName) : symbol.escapedName; } function getUnresolvedSymbolForEntityName(name) { - var identifier = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.right : - name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ ? name.name : + var identifier = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.right : + name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? name.name : name; var text = identifier.escapedText; if (text) { - var parentSymbol = name.kind === 161 /* SyntaxKind.QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) : - name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) : + var parentSymbol = name.kind === 163 /* SyntaxKind.QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) : + name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) : undefined; var path = parentSymbol ? "".concat(getSymbolPath(parentSymbol), ".").concat(text) : text; var result = unresolvedSymbols.get(path); @@ -61020,7 +61574,7 @@ var ts; var valueType = getTypeOfSymbol(symbol); var typeType = valueType; if (symbol.valueDeclaration) { - var isImportTypeWithQualifier = node.kind === 200 /* SyntaxKind.ImportType */ && node.qualifier; + var isImportTypeWithQualifier = node.kind === 202 /* SyntaxKind.ImportType */ && node.qualifier; // valueType might not have a symbol, eg, {import('./b').STRING_LITERAL} if (valueType.symbol && valueType.symbol !== symbol && isImportTypeWithQualifier) { typeType = getTypeReferenceType(node, valueType.symbol); @@ -61030,23 +61584,27 @@ var ts; } return links.resolvedJSDocType; } - function getSubstitutionType(baseType, substitute) { - if (substitute.flags & 3 /* TypeFlags.AnyOrUnknown */ || substitute === baseType) { + function getSubstitutionType(baseType, constraint) { + if (constraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || constraint === baseType || + !isGenericType(baseType) && !isGenericType(constraint)) { return baseType; } - var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(substitute)); + var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(constraint)); var cached = substitutionTypes.get(id); if (cached) { return cached; } var result = createType(33554432 /* TypeFlags.Substitution */); result.baseType = baseType; - result.substitute = substitute; + result.constraint = constraint; substitutionTypes.set(id, result); return result; } + function getSubstitutionIntersection(substitutionType) { + return getIntersectionType([substitutionType.constraint, substitutionType.baseType]); + } function isUnaryTupleTypeNode(node) { - return node.kind === 184 /* SyntaxKind.TupleType */ && node.elements.length === 1; + return node.kind === 186 /* SyntaxKind.TupleType */ && node.elements.length === 1; } function getImpliedConstraint(type, checkNode, extendsNode) { return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(type, checkNode.elements[0], extendsNode.elements[0]) : @@ -61056,16 +61614,16 @@ var ts; function getConditionalFlowTypeOfType(type, node) { var constraints; var covariant = true; - while (node && !ts.isStatement(node) && node.kind !== 320 /* SyntaxKind.JSDoc */) { + while (node && !ts.isStatement(node) && node.kind !== 323 /* SyntaxKind.JSDoc */) { var parent = node.parent; // only consider variance flipped by parameter locations - `keyof` types would usually be considered variance inverting, but // often get used in indexed accesses where they behave sortof invariantly, but our checking is lax - if (parent.kind === 164 /* SyntaxKind.Parameter */) { + if (parent.kind === 166 /* SyntaxKind.Parameter */) { covariant = !covariant; } // Always substitute on type parameters, regardless of variance, since even // in contravariant positions, they may rely on substituted constraints to be valid - if ((covariant || type.flags & 8650752 /* TypeFlags.TypeVariable */) && parent.kind === 189 /* SyntaxKind.ConditionalType */ && node === parent.trueType) { + if ((covariant || type.flags & 8650752 /* TypeFlags.TypeVariable */) && parent.kind === 191 /* SyntaxKind.ConditionalType */ && node === parent.trueType) { var constraint = getImpliedConstraint(type, parent.checkType, parent.extendsType); if (constraint) { constraints = ts.append(constraints, constraint); @@ -61073,7 +61631,7 @@ var ts; } // Given a homomorphic mapped type { [K in keyof T]: XXX }, where T is constrained to an array or tuple type, in the // template type XXX, K has an added constraint of number | `${number}`. - else if (type.flags & 262144 /* TypeFlags.TypeParameter */ && parent.kind === 195 /* SyntaxKind.MappedType */ && node === parent.type) { + else if (type.flags & 262144 /* TypeFlags.TypeParameter */ && parent.kind === 197 /* SyntaxKind.MappedType */ && node === parent.type) { var mappedType = getTypeFromTypeNode(parent); if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) { var typeParameter = getHomomorphicTypeVariable(mappedType); @@ -61087,10 +61645,10 @@ var ts; } node = parent; } - return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type; + return constraints ? getSubstitutionType(type, getIntersectionType(constraints)) : type; } function isJSDocTypeReference(node) { - return !!(node.flags & 8388608 /* NodeFlags.JSDoc */) && (node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 200 /* SyntaxKind.ImportType */); + return !!(node.flags & 8388608 /* NodeFlags.JSDoc */) && (node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 202 /* SyntaxKind.ImportType */); } function checkNoTypeArguments(node, symbol) { if (node.typeArguments) { @@ -61205,9 +61763,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return declaration; } } @@ -61358,6 +61916,13 @@ var ts; function getGlobalBigIntType() { return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType; } + function getGlobalNaNSymbol() { + return (deferredGlobalNaNSymbol || (deferredGlobalNaNSymbol = getGlobalValueSymbol("NaN", /*reportErrors*/ false))); + } + function getGlobalRecordSymbol() { + deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol); + return deferredGlobalRecordSymbol === unknownSymbol ? undefined : deferredGlobalRecordSymbol; + } /** * Instantiates a global type that is generic with some element type, and returns that instantiation. */ @@ -61375,11 +61940,11 @@ var ts; } function getTupleElementFlags(node) { switch (node.kind) { - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return 2 /* ElementFlags.Optional */; - case 186 /* SyntaxKind.RestType */: + case 188 /* SyntaxKind.RestType */: return getRestTypeElementFlags(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return node.questionToken ? 2 /* ElementFlags.Optional */ : node.dotDotDotToken ? getRestTypeElementFlags(node) : 1 /* ElementFlags.Required */; @@ -61397,14 +61962,14 @@ var ts; return readonly ? globalReadonlyArrayType : globalArrayType; } var elementFlags = ts.map(node.elements, getTupleElementFlags); - var missingName = ts.some(node.elements, function (e) { return e.kind !== 197 /* SyntaxKind.NamedTupleMember */; }); + var missingName = ts.some(node.elements, function (e) { return e.kind !== 199 /* SyntaxKind.NamedTupleMember */; }); return getTupleTargetType(elementFlags, readonly, /*associatedNames*/ missingName ? undefined : node.elements); } // Return true if the given type reference node is directly aliased or if it needs to be deferred // because it is possibly contained in a circular chain of eagerly resolved types. function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) { - return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 183 /* SyntaxKind.ArrayType */ ? mayResolveTypeAlias(node.elementType) : - node.kind === 184 /* SyntaxKind.TupleType */ ? ts.some(node.elements, mayResolveTypeAlias) : + return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 185 /* SyntaxKind.ArrayType */ ? mayResolveTypeAlias(node.elementType) : + node.kind === 186 /* SyntaxKind.TupleType */ ? ts.some(node.elements, mayResolveTypeAlias) : hasDefaultTypeArguments || ts.some(node.typeArguments, mayResolveTypeAlias)); } // Return true when the given node is transitively contained in type constructs that eagerly @@ -61413,18 +61978,18 @@ var ts; function isResolvedByTypeAlias(node) { var parent = node.parent; switch (parent.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: - case 178 /* SyntaxKind.TypeReference */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 189 /* SyntaxKind.ConditionalType */: - case 193 /* SyntaxKind.TypeOperator */: - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: + case 180 /* SyntaxKind.TypeReference */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 191 /* SyntaxKind.ConditionalType */: + case 195 /* SyntaxKind.TypeOperator */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return isResolvedByTypeAlias(parent); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; } return false; @@ -61433,28 +61998,28 @@ var ts; // of a type alias. function mayResolveTypeAlias(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return isJSDocTypeReference(node) || !!(resolveTypeReferenceName(node, 788968 /* SymbolFlags.Type */).flags & 524288 /* SymbolFlags.TypeAlias */); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return true; - case 193 /* SyntaxKind.TypeOperator */: - return node.operator !== 154 /* SyntaxKind.UniqueKeyword */ && mayResolveTypeAlias(node.type); - case 191 /* SyntaxKind.ParenthesizedType */: - case 185 /* SyntaxKind.OptionalType */: - case 197 /* SyntaxKind.NamedTupleMember */: - case 316 /* SyntaxKind.JSDocOptionalType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 195 /* SyntaxKind.TypeOperator */: + return node.operator !== 156 /* SyntaxKind.UniqueKeyword */ && mayResolveTypeAlias(node.type); + case 193 /* SyntaxKind.ParenthesizedType */: + case 187 /* SyntaxKind.OptionalType */: + case 199 /* SyntaxKind.NamedTupleMember */: + case 319 /* SyntaxKind.JSDocOptionalType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return mayResolveTypeAlias(node.type); - case 186 /* SyntaxKind.RestType */: - return node.type.kind !== 183 /* SyntaxKind.ArrayType */ || mayResolveTypeAlias(node.type.elementType); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 188 /* SyntaxKind.RestType */: + return node.type.kind !== 185 /* SyntaxKind.ArrayType */ || mayResolveTypeAlias(node.type.elementType); + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return ts.some(node.types, mayResolveTypeAlias); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return mayResolveTypeAlias(node.objectType) || mayResolveTypeAlias(node.indexType); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return mayResolveTypeAlias(node.checkType) || mayResolveTypeAlias(node.extendsType) || mayResolveTypeAlias(node.trueType) || mayResolveTypeAlias(node.falseType); } @@ -61467,19 +62032,19 @@ var ts; if (target === emptyGenericType) { links.resolvedType = emptyObjectType; } - else if (!(node.kind === 184 /* SyntaxKind.TupleType */ && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8 /* ElementFlags.Variadic */); })) && isDeferredTypeReferenceNode(node)) { - links.resolvedType = node.kind === 184 /* SyntaxKind.TupleType */ && node.elements.length === 0 ? target : + else if (!(node.kind === 186 /* SyntaxKind.TupleType */ && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8 /* ElementFlags.Variadic */); })) && isDeferredTypeReferenceNode(node)) { + links.resolvedType = node.kind === 186 /* SyntaxKind.TupleType */ && node.elements.length === 0 ? target : createDeferredTypeReference(target, node, /*mapper*/ undefined); } else { - var elementTypes = node.kind === 183 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); + var elementTypes = node.kind === 185 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); links.resolvedType = createNormalizedTypeReference(target, elementTypes); } } return links.resolvedType; } function isReadonlyTypeOperator(node) { - return ts.isTypeOperatorNode(node) && node.operator === 145 /* SyntaxKind.ReadonlyKeyword */; + return ts.isTypeOperatorNode(node) && node.operator === 146 /* SyntaxKind.ReadonlyKeyword */; } function createTupleType(elementTypes, elementFlags, readonly, namedMemberDeclarations) { if (readonly === void 0) { readonly = false; } @@ -61594,7 +62159,7 @@ var ts; var lastRequiredIndex = -1; var firstRestIndex = -1; var lastOptionalOrRestIndex = -1; - var _loop_16 = function (i) { + var _loop_17 = function (i) { var type = elementTypes[i]; var flags = target.elementFlags[i]; if (flags & 8 /* ElementFlags.Variadic */) { @@ -61624,9 +62189,9 @@ var ts; } }; for (var i = 0; i < elementTypes.length; i++) { - var state_4 = _loop_16(i); - if (typeof state_4 === "object") - return state_4.value; + var state_5 = _loop_17(i); + if (typeof state_5 === "object") + return state_5.value; } // Turn optional elements preceding the last required element into required elements for (var i = 0; i < lastRequiredIndex; i++) { @@ -61654,7 +62219,7 @@ var ts; if (flags & (2 /* ElementFlags.Optional */ | 4 /* ElementFlags.Rest */)) { lastOptionalOrRestIndex = expandedFlags.length; } - expandedTypes.push(type); + expandedTypes.push(flags & 2 /* ElementFlags.Optional */ ? addOptionality(type, /*isProperty*/ true) : type); expandedFlags.push(flags); if (expandedDeclarations && declaration) { expandedDeclarations.push(declaration); @@ -61820,7 +62385,7 @@ var ts; var templates = ts.filter(types, isPatternLiteralType); if (templates.length) { var i = types.length; - var _loop_17 = function () { + var _loop_18 = function () { i--; var t = types[i]; if (t.flags & 128 /* TypeFlags.StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) { @@ -61828,7 +62393,7 @@ var ts; } }; while (i > 0) { - _loop_17(); + _loop_18(); } } } @@ -61905,14 +62470,14 @@ var ts; var namedUnions = []; addNamedUnions(namedUnions, types); var reducedTypes = []; - var _loop_18 = function (t) { + var _loop_19 = function (t) { if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) { reducedTypes.push(t); } }; for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) { var t = typeSet_1[_i]; - _loop_18(t); + _loop_19(t); } if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) { return namedUnions[0]; @@ -62402,7 +62967,7 @@ var ts; type.flags & 16777216 /* TypeFlags.Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* TypeFlags.UnionOrIntersection */ | 134217728 /* TypeFlags.TemplateLiteral */) ? ts.every(type.types, isDistributive) : type.flags & 8388608 /* TypeFlags.IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : - type.flags & 33554432 /* TypeFlags.Substitution */ ? isDistributive(type.substitute) : + type.flags & 33554432 /* TypeFlags.Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* TypeFlags.StringMapping */ ? isDistributive(type.type) : false; } @@ -62483,15 +63048,15 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { switch (node.operator) { - case 140 /* SyntaxKind.KeyOfKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: links.resolvedType = getIndexType(getTypeFromTypeNode(node.type)); break; - case 154 /* SyntaxKind.UniqueKeyword */: - links.resolvedType = node.type.kind === 151 /* SyntaxKind.SymbolKeyword */ + case 156 /* SyntaxKind.UniqueKeyword */: + links.resolvedType = node.type.kind === 153 /* SyntaxKind.SymbolKeyword */ ? getESSymbolLikeTypeForNode(ts.walkUpParenthesizedTypes(node.parent)) : errorType; break; - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: links.resolvedType = getTypeFromTypeNode(node.type); break; default: @@ -62683,7 +63248,7 @@ var ts; } function getPropertyTypeForIndexType(originalObjectType, objectType, indexType, fullIndexType, accessNode, accessFlags) { var _a; - var accessExpression = accessNode && accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ ? accessNode : undefined; var propName = accessNode && ts.isPrivateIdentifier(accessNode) ? undefined : getPropertyNameFromIndex(indexType, accessNode); if (propName !== undefined) { if (accessFlags & 256 /* AccessFlags.Contextual */) { @@ -62854,9 +63419,9 @@ var ts; } } function getIndexNodeForAccessExpression(accessNode) { - return accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ ? accessNode.argumentExpression : - accessNode.kind === 194 /* SyntaxKind.IndexedAccessType */ ? accessNode.indexType : - accessNode.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? accessNode.expression : + return accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ ? accessNode.argumentExpression : + accessNode.kind === 196 /* SyntaxKind.IndexedAccessType */ ? accessNode.indexType : + accessNode.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? accessNode.expression : accessNode; } function isPatternLiteralPlaceholderType(type) { @@ -62885,7 +63450,7 @@ var ts; if (type.flags & 33554432 /* TypeFlags.Substitution */) { if (!(type.objectFlags & 2097152 /* ObjectFlags.IsGenericTypeComputed */)) { type.objectFlags |= 2097152 /* ObjectFlags.IsGenericTypeComputed */ | - getGenericObjectFlags(type.substitute) | getGenericObjectFlags(type.baseType); + getGenericObjectFlags(type.baseType) | getGenericObjectFlags(type.constraint); } return type.objectFlags & 12582912 /* ObjectFlags.IsGenericType */; } @@ -63036,7 +63601,7 @@ var ts; // for a generic T and a non-generic K, we eagerly resolve T[K] if it originates in an expression. This is to // preserve backwards compatibility. For example, an element access 'this["foo"]' has always been resolved // eagerly using the constraint type of 'this' at the given location. - if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 194 /* SyntaxKind.IndexedAccessType */ ? + if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 196 /* SyntaxKind.IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) { if (objectType.flags & 3 /* TypeFlags.AnyOrUnknown */) { @@ -63088,11 +63653,7 @@ var ts; var objectType = getTypeFromTypeNode(node.objectType); var indexType = getTypeFromTypeNode(node.indexType); var potentialAlias = getAliasSymbolForTypeNode(node); - var resolved = getIndexedAccessType(objectType, indexType, 0 /* AccessFlags.None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); - links.resolvedType = resolved.flags & 8388608 /* TypeFlags.IndexedAccess */ && - resolved.objectType === objectType && - resolved.indexType === indexType ? - getConditionalFlowTypeOfType(resolved, node) : resolved; + links.resolvedType = getIndexedAccessType(objectType, indexType, 0 /* AccessFlags.None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); } return links.resolvedType; } @@ -63146,7 +63707,7 @@ var ts; var result; var extraTypes; var tailCount = 0; - var _loop_19 = function () { + var _loop_20 = function () { if (tailCount === 1000) { error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite); result = errorType; @@ -63267,10 +63828,10 @@ var ts; // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive // cases we increment the tail recursion counter and stop after 1000 iterations. while (true) { - var state_5 = _loop_19(); - if (typeof state_5 === "object") - return state_5.value; - if (state_5 === "break") + var state_6 = _loop_20(); + if (typeof state_6 === "object") + return state_6.value; + if (state_6 === "break") break; } return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result; @@ -63463,7 +64024,7 @@ var ts; } function getAliasSymbolForTypeNode(node) { var host = node.parent; - while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { + while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { host = host.parent; } return ts.isTypeAlias(host) ? getSymbolOfNode(host) : undefined; @@ -63708,7 +64269,7 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */)) { if (!ts.isStatic(container) && (!ts.isConstructorDeclaration(container) || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; @@ -63743,17 +64304,17 @@ var ts; } function getArrayElementTypeNode(node) { switch (node.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return getArrayElementTypeNode(node.type); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: if (node.elements.length === 1) { node = node.elements[0]; - if (node.kind === 186 /* SyntaxKind.RestType */ || node.kind === 197 /* SyntaxKind.NamedTupleMember */ && node.dotDotDotToken) { + if (node.kind === 188 /* SyntaxKind.RestType */ || node.kind === 199 /* SyntaxKind.NamedTupleMember */ && node.dotDotDotToken) { return getArrayElementTypeNode(node.type); } } break; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return node.elementType; } return undefined; @@ -63769,99 +64330,99 @@ var ts; } function getTypeFromTypeNodeWorker(node) { switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: + case 131 /* SyntaxKind.AnyKeyword */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return anyType; - case 155 /* SyntaxKind.UnknownKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: return unknownType; - case 150 /* SyntaxKind.StringKeyword */: + case 152 /* SyntaxKind.StringKeyword */: return stringType; - case 147 /* SyntaxKind.NumberKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: return numberType; - case 158 /* SyntaxKind.BigIntKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: return bigintType; - case 133 /* SyntaxKind.BooleanKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: return booleanType; - case 151 /* SyntaxKind.SymbolKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: return esSymbolType; case 114 /* SyntaxKind.VoidKeyword */: return voidType; - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: return undefinedType; case 104 /* SyntaxKind.NullKeyword */: // TODO(rbuckton): `NullKeyword` is no longer a `TypeNode`, but we defensively allow it here because of incorrect casts in the Language Service. return nullType; - case 143 /* SyntaxKind.NeverKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return neverType; - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return node.flags & 262144 /* NodeFlags.JavaScriptFile */ && !noImplicitAny ? anyType : nonPrimitiveType; - case 138 /* SyntaxKind.IntrinsicKeyword */: + case 139 /* SyntaxKind.IntrinsicKeyword */: return intrinsicMarkerType; - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 108 /* SyntaxKind.ThisKeyword */: // TODO(rbuckton): `ThisKeyword` is no longer a `TypeNode`, but we defensively allow it here because of incorrect casts in the Language Service and because of `isPartOfTypeNode`. return getTypeFromThisTypeNode(node); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return getTypeFromLiteralTypeNode(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return getTypeFromTypeReference(node); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return node.assertsModifier ? voidType : booleanType; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return getTypeFromTypeQueryNode(node); - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return getTypeFromArrayOrTupleTypeNode(node); - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return getTypeFromOptionalTypeNode(node); - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return getTypeFromUnionTypeNode(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return getTypeFromJSDocNullableTypeNode(node); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return addOptionality(getTypeFromTypeNode(node.type)); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return getTypeFromNamedTupleTypeNode(node); - case 191 /* SyntaxKind.ParenthesizedType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return getTypeFromTypeNode(node.type); - case 186 /* SyntaxKind.RestType */: + case 188 /* SyntaxKind.RestType */: return getTypeFromRestTypeNode(node); - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 323 /* SyntaxKind.JSDocSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 326 /* SyntaxKind.JSDocSignature */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return getTypeFromTypeOperatorNode(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return getTypeFromIndexedAccessTypeNode(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return getTypeFromMappedTypeNode(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return getTypeFromConditionalTypeNode(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return getTypeFromInferTypeNode(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return getTypeFromTemplateTypeNode(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return getTypeFromImportTypeNode(node); // This function assumes that an identifier, qualified name, or property access expression is a type expression // Callers should first ensure this by calling `isPartOfTypeNode` // TODO(rbuckton): These aren't valid TypeNodes, but we treat them as such because of `isPartOfTypeNode`, which returns `true` for things that aren't `TypeNode`s. case 79 /* SyntaxKind.Identifier */: - case 161 /* SyntaxKind.QualifiedName */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var symbol = getSymbolAtLocation(node); return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType; default: @@ -63968,8 +64529,8 @@ var ts; return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* TypeMapKind.Merged */, mapper, makeUnaryTypeMapper(source, target)); } function getRestrictiveTypeParameter(tp) { - return tp.constraint === unknownType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), - tp.restrictiveInstantiation.constraint = unknownType, + return !tp.constraint && !getConstraintDeclaration(tp) || tp.constraint === noConstraintType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), + tp.restrictiveInstantiation.constraint = noConstraintType, tp.restrictiveInstantiation); } function cloneTypeParameter(typeParameter) { @@ -64083,17 +64644,18 @@ var ts; return type; } function maybeTypeParameterReference(node) { - return !(node.parent.kind === 178 /* SyntaxKind.TypeReference */ && node.parent.typeArguments && node === node.parent.typeName || - node.parent.kind === 200 /* SyntaxKind.ImportType */ && node.parent.typeArguments && node === node.parent.qualifier); + return !(node.parent.kind === 180 /* SyntaxKind.TypeReference */ && node.parent.typeArguments && node === node.parent.typeName || + node.parent.kind === 202 /* SyntaxKind.ImportType */ && node.parent.typeArguments && node === node.parent.qualifier); } function isTypeParameterPossiblyReferenced(tp, node) { - // If the type parameter doesn't have exactly one declaration, if there are invening statement blocks + // If the type parameter doesn't have exactly one declaration, if there are intervening statement blocks // between the node and the type parameter declaration, if the node contains actual references to the - // type parameter, or if the node contains type queries, we consider the type parameter possibly referenced. + // type parameter, or if the node contains type queries that we can't prove couldn't contain references to the type parameter, + // we consider the type parameter possibly referenced. if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) { var container = tp.symbol.declarations[0].parent; for (var n = node; n !== container; n = n.parent) { - if (!n || n.kind === 235 /* SyntaxKind.Block */ || n.kind === 189 /* SyntaxKind.ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) { + if (!n || n.kind === 238 /* SyntaxKind.Block */ || n.kind === 191 /* SyntaxKind.ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) { return true; } } @@ -64102,15 +64664,36 @@ var ts; return true; function containsReference(node) { switch (node.kind) { - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return !!tp.isThisType; case 79 /* SyntaxKind.Identifier */: return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) && getTypeFromTypeNodeWorker(node) === tp; // use worker because we're looking for === equality - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: + var entityName = node.exprName; + var firstIdentifier = ts.getFirstIdentifier(entityName); + var firstIdentifierSymbol = getResolvedSymbol(firstIdentifier); + var tpDeclaration = tp.symbol.declarations[0]; // There is exactly one declaration, otherwise `containsReference` is not called + var tpScope_1; + if (tpDeclaration.kind === 165 /* SyntaxKind.TypeParameter */) { // Type parameter is a regular type parameter, e.g. foo + tpScope_1 = tpDeclaration.parent; + } + else if (tp.isThisType) { + // Type parameter is the this type, and its declaration is the class declaration. + tpScope_1 = tpDeclaration; + } + else { + // Type parameter's declaration was unrecognized. + // This could happen if the type parameter comes from e.g. a JSDoc annotation, so we default to returning true. + return true; + } + if (firstIdentifierSymbol.declarations) { + return ts.some(firstIdentifierSymbol.declarations, function (idDecl) { return ts.isNodeDescendantOf(idDecl, tpScope_1); }) || + ts.some(node.typeArguments, containsReference); + } return true; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return !node.type && !!node.body || ts.some(node.typeParameters, containsReference) || ts.some(node.parameters, containsReference) || @@ -64332,17 +64915,18 @@ var ts; return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments); } if (flags & 33554432 /* TypeFlags.Substitution */) { - var maybeVariable = instantiateType(type.baseType, mapper); - if (maybeVariable.flags & 8650752 /* TypeFlags.TypeVariable */) { - return getSubstitutionType(maybeVariable, instantiateType(type.substitute, mapper)); + var newBaseType = instantiateType(type.baseType, mapper); + var newConstraint = instantiateType(type.constraint, mapper); + // A substitution type originates in the true branch of a conditional type and can be resolved + // to just the base type in the same cases as the conditional type resolves to its true branch + // (because the base type is then known to satisfy the constraint). + if (newBaseType.flags & 8650752 /* TypeFlags.TypeVariable */ && isGenericType(newConstraint)) { + return getSubstitutionType(newBaseType, newConstraint); } - else { - var sub = instantiateType(type.substitute, mapper); - if (sub.flags & 3 /* TypeFlags.AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) { - return maybeVariable; - } - return sub; + if (newConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(newBaseType), getRestrictiveInstantiation(newConstraint))) { + return newBaseType; } + return newBaseType.flags & 8650752 /* TypeFlags.TypeVariable */ ? getSubstitutionType(newBaseType, newConstraint) : getIntersectionType([newConstraint, newBaseType]); } return type; } @@ -64391,35 +64975,35 @@ var ts; // Returns true if the given expression contains (at any level of nesting) a function or arrow expression // that is subject to contextual typing. function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type return isContextSensitiveFunctionLikeDeclaration(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return ts.some(node.properties, isContextSensitive); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return ts.some(node.elements, isContextSensitive); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ || node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */) && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return isContextSensitive(node.initializer); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isContextSensitive(node.expression); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return ts.some(node.properties, isContextSensitive) || ts.isJsxOpeningElement(node.parent) && ts.some(node.parent.parent.children, isContextSensitive); - case 285 /* SyntaxKind.JsxAttribute */: { + case 288 /* SyntaxKind.JsxAttribute */: { // If there is no initializer, JSX attribute has a boolean value of true which is not context sensitive. var initializer = node.initializer; return !!initializer && isContextSensitive(initializer); } - case 288 /* SyntaxKind.JsxExpression */: { + case 291 /* SyntaxKind.JsxExpression */: { // It is possible to that node.expression is undefined (e.g
) var expression = node.expression; return !!expression && isContextSensitive(expression); @@ -64428,15 +65012,14 @@ var ts; return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return (!ts.isFunctionDeclaration(node) || ts.isInJSFile(node) && !!getTypeForDeclarationFromJSDocComment(node)) && - (ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node)); + return ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node); } function hasContextSensitiveReturnExpression(node) { // TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value. - return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 235 /* SyntaxKind.Block */ && isContextSensitive(node.body); + return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 238 /* SyntaxKind.Block */ && isContextSensitive(node.body); } function isContextSensitiveFunctionOrObjectLiteralMethod(func) { - return (ts.isInJSFile(func) && ts.isFunctionDeclaration(func) || ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && + return (ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func); } function getTypeWithoutSignatures(type) { @@ -64537,23 +65120,23 @@ var ts; return true; } switch (node.kind) { - case 288 /* SyntaxKind.JsxExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 291 /* SyntaxKind.JsxExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (node.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: case 27 /* SyntaxKind.CommaToken */: return elaborateError(node.right, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); } break; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return elaborateJsxComponents(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return elaborateArrowFunction(node, source, target, relation, containingMessageChain, errorOutputContainer); } return false; @@ -64762,7 +65345,7 @@ var ts; } function getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic) { switch (child.kind) { - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: // child is of the type of the expression return { errorNode: child, innerExpression: child.expression, nameType: nameType }; case 11 /* SyntaxKind.JsxText */: @@ -64771,9 +65354,9 @@ var ts; } // child is a string return { errorNode: child, innerExpression: undefined, nameType: nameType, errorMessage: getInvalidTextDiagnostic() }; - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: // child is of type JSX.Element return { errorNode: child, innerExpression: child, nameType: nameType }; default: @@ -64921,11 +65504,11 @@ var ts; } _b = prop.kind; switch (_b) { - case 173 /* SyntaxKind.SetAccessor */: return [3 /*break*/, 2]; - case 172 /* SyntaxKind.GetAccessor */: return [3 /*break*/, 2]; - case 169 /* SyntaxKind.MethodDeclaration */: return [3 /*break*/, 2]; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: return [3 /*break*/, 2]; - case 296 /* SyntaxKind.PropertyAssignment */: return [3 /*break*/, 4]; + case 175 /* SyntaxKind.SetAccessor */: return [3 /*break*/, 2]; + case 174 /* SyntaxKind.GetAccessor */: return [3 /*break*/, 2]; + case 171 /* SyntaxKind.MethodDeclaration */: return [3 /*break*/, 2]; + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return [3 /*break*/, 2]; + case 299 /* SyntaxKind.PropertyAssignment */: return [3 /*break*/, 4]; } return [3 /*break*/, 6]; case 2: return [4 /*yield*/, { errorNode: prop.name, innerExpression: undefined, nameType: type }]; @@ -64998,8 +65581,8 @@ var ts; void instantiateType(sourceRestType || targetRestType, reportUnreliableMarkers); } var kind = target.declaration ? target.declaration.kind : 0 /* SyntaxKind.Unknown */; - var strictVariance = !(checkMode & 3 /* SignatureCheckMode.Callback */) && strictFunctionTypes && kind !== 169 /* SyntaxKind.MethodDeclaration */ && - kind !== 168 /* SyntaxKind.MethodSignature */ && kind !== 171 /* SyntaxKind.Constructor */; + var strictVariance = !(checkMode & 3 /* SignatureCheckMode.Callback */) && strictFunctionTypes && kind !== 171 /* SyntaxKind.MethodDeclaration */ && + kind !== 170 /* SyntaxKind.MethodSignature */ && kind !== 173 /* SyntaxKind.Constructor */; var result = -1 /* Ternary.True */; var sourceThisType = getThisTypeOfSignature(source); if (sourceThisType && sourceThisType !== voidType) { @@ -65296,7 +65879,7 @@ var ts; var t = isFreshLiteralType(type) ? type.regularType : ts.getObjectFlags(type) & 4 /* ObjectFlags.Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 /* TypeFlags.UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : - type.flags & 33554432 /* TypeFlags.Substitution */ ? writing ? type.baseType : type.substitute : + type.flags & 33554432 /* TypeFlags.Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 /* TypeFlags.Simplifiable */ ? getSimplifiedType(type, writing) : type; if (t === type) @@ -65703,7 +66286,8 @@ var ts; return 0 /* Ternary.False */; } } - var isPerformingCommonPropertyChecks = relation !== comparableRelation && !(intersectionState & 2 /* IntersectionState.Target */) && + var isPerformingCommonPropertyChecks = (relation !== comparableRelation || !(source.flags & 1048576 /* TypeFlags.Union */) && isLiteralType(source)) && + !(intersectionState & 2 /* IntersectionState.Target */) && source.flags & (131068 /* TypeFlags.Primitive */ | 524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && source !== globalObjectType && target.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && isWeakType(target) && (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source)); @@ -65862,7 +66446,7 @@ var ts; reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target); checkTypes = reducedTarget.flags & 1048576 /* TypeFlags.Union */ ? reducedTarget.types : [reducedTarget]; } - var _loop_20 = function (prop) { + var _loop_21 = function (prop) { if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) { if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) { if (reportErrors) { @@ -65925,9 +66509,9 @@ var ts; }; for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) { var prop = _b[_i]; - var state_6 = _loop_20(prop); - if (typeof state_6 === "object") - return state_6.value; + var state_7 = _loop_21(prop); + if (typeof state_7 === "object") + return state_7.value; } return false; } @@ -65955,11 +66539,15 @@ var ts; // parameter 'T extends 1 | 2', the intersection 'T & 1' should be reduced to '1' such that it doesn't // appear to be comparable to '2'. if (relation === comparableRelation && target.flags & 131068 /* TypeFlags.Primitive */) { - var constraints = ts.sameMap(source.types, getBaseConstraintOrType); + var constraints = ts.sameMap(source.types, function (t) { return t.flags & 465829888 /* TypeFlags.Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t; }); if (constraints !== source.types) { source = getIntersectionType(constraints); + if (source.flags & 131072 /* TypeFlags.Never */) { + return 0 /* Ternary.False */; + } if (!(source.flags & 2097152 /* TypeFlags.Intersection */)) { - return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false); + return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false) || + isRelatedTo(target, source, 1 /* RecursionFlags.Source */, /*reportErrors*/ false); } } } @@ -66277,7 +66865,7 @@ var ts; // the type param can be compared with itself in the target (with the influence of its constraint to match other parts) // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)` var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */)); - if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself + if (constraint && !(constraint.flags & 131072 /* TypeFlags.Never */) && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState); } @@ -66329,7 +66917,11 @@ var ts; } } if (sourceFlags & 33554432 /* TypeFlags.Substitution */) { - return isRelatedTo(source.substitute, target.substitute, 3 /* RecursionFlags.Both */, /*reportErrors*/ false); + if (result = isRelatedTo(source.baseType, target.baseType, 3 /* RecursionFlags.Both */, /*reportErrors*/ false)) { + if (result &= isRelatedTo(source.constraint, target.constraint, 3 /* RecursionFlags.Both */, /*reportErrors*/ false)) { + return result; + } + } } if (!(sourceFlags & 524288 /* TypeFlags.Object */)) { return 0 /* Ternary.False */; @@ -66910,11 +67502,11 @@ var ts; // constituents of 'target'. If any combination does not have a match then 'source' is not relatable. var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes); var matchingTypes = []; - var _loop_21 = function (combination) { + var _loop_22 = function (combination) { var hasMatch = false; outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) { var type = _d[_c]; - var _loop_22 = function (i) { + var _loop_23 = function (i) { var sourceProperty = sourcePropertiesFiltered[i]; var targetProperty = getPropertyOfType(type, sourceProperty.escapedName); if (!targetProperty) @@ -66930,8 +67522,8 @@ var ts; } }; for (var i = 0; i < sourcePropertiesFiltered.length; i++) { - var state_8 = _loop_22(i); - switch (state_8) { + var state_9 = _loop_23(i); + switch (state_9) { case "continue-outer": continue outer; } } @@ -66944,9 +67536,9 @@ var ts; }; for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) { var combination = discriminantCombinations_1[_a]; - var state_7 = _loop_21(combination); - if (typeof state_7 === "object") - return state_7.value; + var state_8 = _loop_22(combination); + if (typeof state_8 === "object") + return state_8.value; } // Compare the remaining non-discriminant properties of each match. var result = -1 /* Ternary.True */; @@ -67081,7 +67673,7 @@ var ts; shouldSkipElaboration = true; // Retain top-level error for interface implementing issues, otherwise omit it } if (props.length === 1) { - var propName = symbolToString(unmatchedProperty); + var propName = symbolToString(unmatchedProperty, /*enclosingDeclaration*/ undefined, 0 /* SymbolFlags.None */, 4 /* SymbolFormatFlags.AllowAnyNodeKind */ | 16 /* SymbolFormatFlags.WriteComputedProps */); reportError.apply(void 0, __spreadArray([ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName], getTypeNamesForErrorDisplay(source, target), false)); if (ts.length(unmatchedProperty.declarations)) { associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName)); @@ -67330,7 +67922,7 @@ var ts; var targetSignature = ts.first(targetSignatures); result = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors, incompatibleReporter(sourceSignature, targetSignature)); if (!result && reportErrors && kind === 1 /* SignatureKind.Construct */ && (sourceObjectFlags & targetObjectFlags) && - (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 171 /* SyntaxKind.Constructor */ || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 171 /* SyntaxKind.Constructor */)) { + (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 173 /* SyntaxKind.Constructor */ || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 173 /* SyntaxKind.Constructor */)) { var constructSignatureToString = function (signature) { return signatureToString(signature, /*enclosingDeclaration*/ undefined, 262144 /* TypeFormatFlags.WriteArrowStyleSignature */, kind); }; @@ -67651,7 +68243,7 @@ var ts; ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* tracing.Phase.CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) }); links.variances = ts.emptyArray; var variances = []; - var _loop_23 = function (tp) { + var _loop_24 = function (tp) { var modifiers = getVarianceModifiers(tp); var variance = modifiers & 65536 /* ModifierFlags.Out */ ? modifiers & 32768 /* ModifierFlags.In */ ? 0 /* VarianceFlags.Invariant */ : 1 /* VarianceFlags.Covariant */ : @@ -67689,7 +68281,7 @@ var ts; }; for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) { var tp = typeParameters_2[_i]; - _loop_23(tp); + _loop_24(tp); } links.variances = variances; ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) }); @@ -68095,7 +68687,7 @@ var ts; var baseTypeNode = getBaseTypeNodeOfClass(target); // A base type expression may circularly reference the class itself (e.g. as an argument to function call), so we only // check for base types specified as simple qualified names. - if (baseTypeNode && baseTypeNode.expression.kind !== 79 /* SyntaxKind.Identifier */ && baseTypeNode.expression.kind !== 206 /* SyntaxKind.PropertyAccessExpression */) { + if (baseTypeNode && baseTypeNode.expression.kind !== 79 /* SyntaxKind.Identifier */ && baseTypeNode.expression.kind !== 208 /* SyntaxKind.PropertyAccessExpression */) { return undefined; } } @@ -68186,7 +68778,7 @@ var ts; if (!isLiteralOfContextualType(type, contextualType)) { type = getWidenedUniqueESSymbolType(getWidenedLiteralType(type)); } - return type; + return getRegularTypeOfLiteralType(type); } function getWidenedLiteralLikeTypeForContextualReturnTypeIfNeeded(type, contextualSignatureReturnType, isAsync) { if (type && isUnitType(type)) { @@ -68281,7 +68873,8 @@ var ts; function getOptionalType(type, isProperty) { if (isProperty === void 0) { isProperty = false; } ts.Debug.assert(strictNullChecks); - return type.flags & 32768 /* TypeFlags.Undefined */ ? type : getUnionType([type, isProperty ? missingType : undefinedType]); + var missingOrUndefined = isProperty ? missingType : undefinedType; + return type.flags & 32768 /* TypeFlags.Undefined */ || type.flags & 1048576 /* TypeFlags.Union */ && type.types[0] === missingOrUndefined ? type : getUnionType([type, missingOrUndefined]); } function getGlobalNonNullableTypeInstantiation(type) { if (!deferredGlobalNonNullableTypeAlias) { @@ -68570,12 +69163,12 @@ var ts; } var diagnostic; switch (declaration.kind) { - case 221 /* SyntaxKind.BinaryExpression */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 223 /* SyntaxKind.BinaryExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: diagnostic = noImplicitAny ? ts.Diagnostics.Member_0_implicitly_has_an_1_type : ts.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: var param = declaration; if (ts.isIdentifier(param.name) && (ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) && @@ -68591,23 +69184,23 @@ var ts; noImplicitAny ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage : noImplicitAny ? ts.Diagnostics.Parameter_0_implicitly_has_an_1_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; if (!noImplicitAny) { // Don't issue a suggestion for binding elements since the codefix doesn't yet support them. return; } break; - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: error(declaration, ts.Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (noImplicitAny && !declaration.name) { if (wideningKind === 3 /* WideningKind.GeneratorYield */) { error(declaration, ts.Diagnostics.Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation, typeAsString); @@ -68621,7 +69214,7 @@ var ts; wideningKind === 3 /* WideningKind.GeneratorYield */ ? ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type : ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; break; - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: if (noImplicitAny) { error(declaration, ts.Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type); } @@ -68738,7 +69331,7 @@ var ts; if (context.intraExpressionInferenceSites) { for (var _i = 0, _a = context.intraExpressionInferenceSites; _i < _a.length; _i++) { var _b = _a[_i], node = _b.node, type = _b.type; - var contextualType = node.kind === 169 /* SyntaxKind.MethodDeclaration */ ? + var contextualType = node.kind === 171 /* SyntaxKind.MethodDeclaration */ ? getContextualTypeForObjectLiteralMethod(node, 2 /* ContextFlags.NoConstraints */) : getContextualType(node, 2 /* ContextFlags.NoConstraints */); if (contextualType) { @@ -68801,8 +69394,8 @@ var ts; } function isNonGenericTopLevelType(type) { if (type.aliasSymbol && !type.aliasTypeArguments) { - var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 259 /* SyntaxKind.TypeAliasDeclaration */); - return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 305 /* SyntaxKind.SourceFile */ ? true : n.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? false : "quit"; })); + var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 262 /* SyntaxKind.TypeAliasDeclaration */); + return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 308 /* SyntaxKind.SourceFile */ ? true : n.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? false : "quit"; })); } return false; } @@ -69260,7 +69853,10 @@ var ts; // // This flag is infectious; if we produce Box (where never is silentNeverType), Box is // also non-inferrable. - if (ts.getObjectFlags(source) & 262144 /* ObjectFlags.NonInferrableType */) { + // + // As a special case, also ignore nonInferrableAnyType, which is a special form of the any type + // used as a stand-in for binding elements when they are being inferred. + if (ts.getObjectFlags(source) & 262144 /* ObjectFlags.NonInferrableType */ || source === nonInferrableAnyType) { return; } if (!inference.isFixed) { @@ -69333,7 +69929,7 @@ var ts; } else if (source.flags & 33554432 /* TypeFlags.Substitution */) { inferFromTypes(source.baseType, target); - inferWithPriority(source.substitute, target, 4 /* InferencePriority.SubstituteSource */); // Make substitute inference at a lower priority + inferWithPriority(getSubstitutionIntersection(source), target, 4 /* InferencePriority.SubstituteSource */); // Make substitute inference at a lower priority } else if (target.flags & 16777216 /* TypeFlags.Conditional */) { invokeOnce(source, target, inferToConditionalType); @@ -69643,7 +70239,7 @@ var ts; // upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might // succeed. That would be a pointless and confusing outcome. if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) { - var _loop_24 = function (i) { + var _loop_25 = function (i) { var source_1 = matches ? matches[i] : neverType; var target_3 = types[i]; // If we are inferring from a string literal type to a type variable whose constraint includes one of the @@ -69693,7 +70289,7 @@ var ts; inferFromTypes(source_1, target_3); }; for (var i = 0; i < types.length; i++) { - _loop_24(i); + _loop_25(i); } } } @@ -69815,7 +70411,7 @@ var ts; var saveBivariant = bivariant; var kind = target.declaration ? target.declaration.kind : 0 /* SyntaxKind.Unknown */; // Once we descend into a bivariant signature we remain bivariant for all nested inferences - bivariant = bivariant || kind === 169 /* SyntaxKind.MethodDeclaration */ || kind === 168 /* SyntaxKind.MethodSignature */ || kind === 171 /* SyntaxKind.Constructor */; + bivariant = bivariant || kind === 171 /* SyntaxKind.MethodDeclaration */ || kind === 170 /* SyntaxKind.MethodSignature */ || kind === 173 /* SyntaxKind.Constructor */; applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes); bivariant = saveBivariant; applyToReturnTypes(source, target, inferFromTypes); @@ -70014,7 +70610,7 @@ var ts; } // falls through default: - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer; } else { @@ -70035,7 +70631,7 @@ var ts; // TypeScript 1.0 spec (April 2014): 3.6.3 // A type query consists of the keyword typeof followed by an expression. // The expression is restricted to a single identifier or a sequence of identifiers separated by periods - return !!ts.findAncestor(node, function (n) { return n.kind === 181 /* SyntaxKind.TypeQuery */ ? true : n.kind === 79 /* SyntaxKind.Identifier */ || n.kind === 161 /* SyntaxKind.QualifiedName */ ? false : "quit"; }); + return !!ts.findAncestor(node, function (n) { return n.kind === 183 /* SyntaxKind.TypeQuery */ ? true : n.kind === 79 /* SyntaxKind.Identifier */ || n.kind === 163 /* SyntaxKind.QualifiedName */ ? false : "quit"; }); } // Return the flow cache key for a "dotted name" (i.e. a sequence of identifiers // separated by dots). The key consists of the id of the symbol referenced by the @@ -70051,26 +70647,26 @@ var ts; // falls through case 108 /* SyntaxKind.ThisKeyword */: return "0|".concat(flowContainer ? getNodeId(flowContainer) : "-1", "|").concat(getTypeId(declaredType), "|").concat(getTypeId(initialType)); - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: var left = getFlowCacheKey(node.left, declaredType, initialType, flowContainer); return left && left + "." + node.right.escapedText; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var propName = getAccessedPropertyName(node); if (propName !== undefined) { var key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); return key && key + "." + propName; } break; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: // Handle pseudo-references originating in getNarrowedTypeOfSymbol. return "".concat(getNodeId(node), "#").concat(getTypeId(declaredType)); } @@ -70078,16 +70674,16 @@ var ts; } function isMatchingReference(source, target) { switch (target.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return isMatchingReference(source, target.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (ts.isAssignmentExpression(target) && isMatchingReference(source, target.left)) || (ts.isBinaryExpression(target) && target.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && isMatchingReference(source, target.right)); } switch (source.kind) { - case 231 /* SyntaxKind.MetaProperty */: - return target.kind === 231 /* SyntaxKind.MetaProperty */ + case 233 /* SyntaxKind.MetaProperty */: + return target.kind === 233 /* SyntaxKind.MetaProperty */ && source.keywordToken === target.keywordToken && source.name.escapedText === target.name.escapedText; case 79 /* SyntaxKind.Identifier */: @@ -70095,26 +70691,26 @@ var ts; return ts.isThisInTypeQuery(source) ? target.kind === 108 /* SyntaxKind.ThisKeyword */ : target.kind === 79 /* SyntaxKind.Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 254 /* SyntaxKind.VariableDeclaration */ || target.kind === 203 /* SyntaxKind.BindingElement */) && + (target.kind === 257 /* SyntaxKind.VariableDeclaration */ || target.kind === 205 /* SyntaxKind.BindingElement */) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 108 /* SyntaxKind.ThisKeyword */: return target.kind === 108 /* SyntaxKind.ThisKeyword */; case 106 /* SyntaxKind.SuperKeyword */: return target.kind === 106 /* SyntaxKind.SuperKeyword */; - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isMatchingReference(source.expression, target); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var sourcePropertyName = getAccessedPropertyName(source); var targetPropertyName = ts.isAccessExpression(target) ? getAccessedPropertyName(target) : undefined; return sourcePropertyName !== undefined && targetPropertyName !== undefined && targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return ts.isAccessExpression(target) && source.right.escapedText === getAccessedPropertyName(target) && isMatchingReference(source.left, target.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (ts.isBinaryExpression(source) && source.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && isMatchingReference(source.right, target)); } return false; @@ -70157,7 +70753,7 @@ var ts; return name; } } - if (ts.hasOnlyExpressionInitializer(declaration)) { + if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) { var initializer = ts.getEffectiveInitializer(declaration); return initializer && tryGetNameFromType(getTypeOfExpression(initializer)); } @@ -70217,7 +70813,7 @@ var ts; function mapTypesByKeyProperty(types, name) { var map = new ts.Map(); var count = 0; - var _loop_25 = function (type) { + var _loop_26 = function (type) { if (type.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */)) { var discriminant = getTypeOfPropertyOfType(type, name); if (discriminant) { @@ -70243,9 +70839,9 @@ var ts; }; for (var _i = 0, types_15 = types; _i < types_15.length; _i++) { var type = types_15[_i]; - var state_9 = _loop_25(type); - if (typeof state_9 === "object") - return state_9.value; + var state_10 = _loop_26(type); + if (typeof state_10 === "object") + return state_10.value; } return count >= 10 && count * 2 >= types.length ? map : undefined; } @@ -70286,7 +70882,7 @@ var ts; } function getMatchingUnionConstituentForObjectLiteral(unionType, node) { var keyPropertyName = getKeyPropertyName(unionType); - var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 296 /* SyntaxKind.PropertyAssignment */ && + var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 299 /* SyntaxKind.PropertyAssignment */ && p.symbol.escapedName === keyPropertyName && isPossiblyDiscriminantValue(p.initializer); }); var propType = propNode && getContextFreeTypeOfExpression(propNode.initializer); return propType && getConstituentTypeForKeyType(unionType, propType); @@ -70303,7 +70899,7 @@ var ts; } } } - if (expression.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + if (expression.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isOrContainsMatchingReference(reference, expression.expression.expression)) { return true; } @@ -70503,15 +71099,15 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(65 /* IterationUse.Destructuring */, type, undefinedType, /*errorNode*/ undefined) || errorType); } function getAssignedTypeOfBinaryExpression(node) { - var isDestructuringDefaultAssignment = node.parent.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || - node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); + var isDestructuringDefaultAssignment = node.parent.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || + node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } function isDestructuringAssignmentTarget(parent) { - return parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.parent.left === parent || - parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */ && parent.parent.initializer === parent; + return parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.parent.left === parent || + parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */ && parent.parent.initializer === parent; } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element)); @@ -70528,21 +71124,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return stringType; - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return checkRightHandSideOfForOf(parent) || errorType; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return getAssignedTypeOfBinaryExpression(parent); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return undefinedType; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return getAssignedTypeOfSpreadExpression(parent); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return errorType; @@ -70550,7 +71146,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ ? + var type = pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) : @@ -70568,30 +71164,30 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (node.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { return stringType; } - if (node.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { return checkRightHandSideOfForOf(node.parent.parent) || errorType; } return errorType; } function getInitialType(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function isEmptyArrayAssignment(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.initializer && + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 203 /* SyntaxKind.BindingElement */ && node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + node.kind !== 205 /* SyntaxKind.BindingElement */ && node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getReferenceCandidate(node.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (node.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: case 75 /* SyntaxKind.BarBarEqualsToken */: @@ -70606,13 +71202,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */ || - parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.left === node || - parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && parent.right === node ? + return parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || + parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.left === node || + parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { return getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); } return neverType; @@ -70631,13 +71227,13 @@ var ts; // Get the type names from all cases in a switch on `typeof`. The default clause and/or duplicate type names are // represented as undefined. Return undefined if one or more case clause expressions are not string literals. function getSwitchClauseTypeOfWitnesses(switchStatement) { - if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 289 /* SyntaxKind.CaseClause */ && !ts.isStringLiteralLike(clause.expression); })) { + if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 292 /* SyntaxKind.CaseClause */ && !ts.isStringLiteralLike(clause.expression); })) { return undefined; } var witnesses = []; for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) { var clause = _a[_i]; - var text = clause.kind === 289 /* SyntaxKind.CaseClause */ ? clause.expression.text : undefined; + var text = clause.kind === 292 /* SyntaxKind.CaseClause */ ? clause.expression.text : undefined; witnesses.push(text && !ts.contains(witnesses, text) ? text : undefined); } return witnesses; @@ -70824,12 +71420,12 @@ var ts; var root = getReferenceRoot(node); var parent = root.parent; var isLengthPushOrUnshift = ts.isPropertyAccessExpression(parent) && (parent.name.escapedText === "length" || - parent.parent.kind === 208 /* SyntaxKind.CallExpression */ + parent.parent.kind === 210 /* SyntaxKind.CallExpression */ && ts.isIdentifier(parent.name) && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && + var isElementAssignment = parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && parent.expression === root && - parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -70857,7 +71453,7 @@ var ts; if (isDeclarationWithExplicitTypeAnnotation(declaration)) { return getTypeOfSymbol(symbol); } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { var statement = declaration.parent.parent; var expressionType = getTypeOfDottedName(statement.expression, /*diagnostic*/ undefined); if (expressionType) { @@ -70885,7 +71481,7 @@ var ts; return getExplicitThisType(node); case 106 /* SyntaxKind.SuperKeyword */: return checkSuperExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: { + case 208 /* SyntaxKind.PropertyAccessExpression */: { var type = getTypeOfDottedName(node.expression, diagnostic); if (type) { var name = node.name; @@ -70903,7 +71499,7 @@ var ts; } return undefined; } - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getTypeOfDottedName(node.expression, diagnostic); } } @@ -70917,7 +71513,7 @@ var ts; // circularities in control flow analysis, we use getTypeOfDottedName when resolving the call // target expression of an assertion. var funcType = void 0; - if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */) { + if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */) { funcType = getTypeOfDottedName(node.expression, /*diagnostic*/ undefined); } else if (node.expression.kind !== 106 /* SyntaxKind.SuperKeyword */) { @@ -70961,7 +71557,7 @@ var ts; } function isFalseExpression(expr) { var node = ts.skipParentheses(expr, /*excludeJSDocTypeAssertions*/ true); - return node.kind === 95 /* SyntaxKind.FalseKeyword */ || node.kind === 221 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ && (isFalseExpression(node.left) || isFalseExpression(node.right)) || + return node.kind === 95 /* SyntaxKind.FalseKeyword */ || node.kind === 223 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ && (isFalseExpression(node.left) || isFalseExpression(node.right)) || node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ && isFalseExpression(node.left) && isFalseExpression(node.right)); } function isReachableFlowNodeWorker(flow, noCacheCheck) { @@ -71082,8 +71678,8 @@ var ts; var symbol = getResolvedSymbol(node); return isConstVariable(symbol) || ts.isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol); } - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // The resolvedSymbol property is initialized by checkPropertyAccess or checkElementAccess before we get here. return isConstantReference(node.expression) && isReadonlySymbol(getNodeLinks(node).resolvedSymbol || unknownSymbol); } @@ -71110,7 +71706,7 @@ var ts; // on empty arrays are possible without implicit any errors and new element types can be inferred without // type mismatch errors. var resultType = ts.getObjectFlags(evolvedType) & 256 /* ObjectFlags.EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType); - if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 230 /* SyntaxKind.NonNullExpression */ && !(resultType.flags & 131072 /* TypeFlags.Never */) && getTypeWithFacts(resultType, 2097152 /* TypeFacts.NEUndefinedOrNull */).flags & 131072 /* TypeFlags.Never */) { + if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 232 /* SyntaxKind.NonNullExpression */ && !(resultType.flags & 131072 /* TypeFlags.Never */) && getTypeWithFacts(resultType, 2097152 /* TypeFacts.NEUndefinedOrNull */).flags & 131072 /* TypeFlags.Never */) { return declaredType; } // The non-null unknown type should never escape control flow analysis. @@ -71195,8 +71791,8 @@ var ts; // Check if we should continue with the control flow of the containing function. var container = flow.node; if (container && container !== flowContainer && - reference.kind !== 206 /* SyntaxKind.PropertyAccessExpression */ && - reference.kind !== 207 /* SyntaxKind.ElementAccessExpression */ && + reference.kind !== 208 /* SyntaxKind.PropertyAccessExpression */ && + reference.kind !== 209 /* SyntaxKind.ElementAccessExpression */ && reference.kind !== 108 /* SyntaxKind.ThisKeyword */) { flow = container.flowNode; continue; @@ -71221,7 +71817,7 @@ var ts; } function getInitialOrAssignedType(flow) { var node = flow.node; - return getNarrowableTypeForReference(node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */ ? + return getNarrowableTypeForReference(node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */ ? getInitialType(node) : getAssignedType(node), reference); } @@ -71261,14 +71857,14 @@ var ts; // in which case we continue control flow analysis back to the function's declaration if (ts.isVariableDeclaration(node) && (ts.isInJSFile(node) || ts.isVarConst(node))) { var init = ts.getDeclaredExpandoInitializer(node); - if (init && (init.kind === 213 /* SyntaxKind.FunctionExpression */ || init.kind === 214 /* SyntaxKind.ArrowFunction */)) { + if (init && (init.kind === 215 /* SyntaxKind.FunctionExpression */ || init.kind === 216 /* SyntaxKind.ArrowFunction */)) { return getTypeAtFlowNode(flow.antecedent); } } return declaredType; } // for (const _ in ref) acts as a nonnull on ref - if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) { + if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) { return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)))); } // Assignment doesn't affect reference @@ -71279,7 +71875,7 @@ var ts; if (node.kind === 95 /* SyntaxKind.FalseKeyword */) { return unreachableNeverType; } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */) { if (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */) { return narrowTypeByAssertion(narrowTypeByAssertion(type, node.left), node.right); } @@ -71310,7 +71906,7 @@ var ts; function getTypeAtFlowArrayMutation(flow) { if (declaredType === autoType || declaredType === autoArrayType) { var node = flow.node; - var expr = node.kind === 208 /* SyntaxKind.CallExpression */ ? + var expr = node.kind === 210 /* SyntaxKind.CallExpression */ ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -71318,7 +71914,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (ts.getObjectFlags(type) & 256 /* ObjectFlags.EvolvingArray */) { var evolvedType_1 = type; - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -71366,7 +71962,7 @@ var ts; if (isMatchingReference(reference, expr)) { type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } - else if (expr.kind === 216 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { + else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } else { @@ -71374,7 +71970,7 @@ var ts; if (optionalChainContainsReference(expr, reference)) { type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & (32768 /* TypeFlags.Undefined */ | 131072 /* TypeFlags.Never */)); }); } - else if (expr.kind === 216 /* SyntaxKind.TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { + else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & 131072 /* TypeFlags.Never */ || t.flags & 128 /* TypeFlags.StringLiteral */ && t.value === "undefined"); }); } } @@ -71602,7 +72198,7 @@ var ts; var narrowedPropType = narrowType(propType); return filterType(type, function (t) { var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName); - return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType); + return !(discriminantType.flags & 131072 /* TypeFlags.Never */) && !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType); }); } function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) { @@ -71644,18 +72240,26 @@ var ts; } function isTypePresencePossible(type, propName, assumeTrue) { var prop = getPropertyOfType(type, propName); - if (prop) { - return prop.flags & 16777216 /* SymbolFlags.Optional */ ? true : assumeTrue; - } - return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue; + return prop ? + !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue : + !!getApplicableIndexInfoForName(type, propName) || !assumeTrue; } - function narrowByInKeyword(type, name, assumeTrue) { - if (type.flags & 1048576 /* TypeFlags.Union */ - || type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type)) - || ts.isThisTypeParameter(type) - || type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) { + function narrowByInKeyword(type, nameType, assumeTrue) { + var name = getPropertyNameFromType(nameType); + var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); }); + if (isKnownProperty) { + // If the check is for a known property (i.e. a property declared in some constituent of + // the target type), we filter the target type by presence of absence of the property. return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); }); } + if (assumeTrue) { + // If the check is for an unknown property, we intersect the target type with `Record`, + // where X is the name of the property. + var recordSymbol = getGlobalRecordSymbol(); + if (recordSymbol) { + return getIntersectionType([type, getTypeAliasInstantiation(recordSymbol, [nameType, unknownType])]); + } + } return type; } function narrowTypeByBinaryExpression(type, expr, assumeTrue) { @@ -71672,10 +72276,10 @@ var ts; var operator = expr.operatorToken.kind; var left = getReferenceCandidate(expr.left); var right = getReferenceCandidate(expr.right); - if (left.kind === 216 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(right)) { + if (left.kind === 218 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(right)) { return narrowTypeByTypeof(type, left, operator, right, assumeTrue); } - if (right.kind === 216 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(left)) { + if (right.kind === 218 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(left)) { return narrowTypeByTypeof(type, right, operator, left, assumeTrue); } if (isMatchingReference(reference, left)) { @@ -71714,15 +72318,14 @@ var ts; return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue); } var target = getReferenceCandidate(expr.right); - var leftType = getTypeOfNode(expr.left); - if (leftType.flags & 128 /* TypeFlags.StringLiteral */) { - var name = ts.escapeLeadingUnderscores(leftType.value); + var leftType = getTypeOfExpression(expr.left); + if (leftType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */) { if (containsMissingType(type) && ts.isAccessExpression(reference) && isMatchingReference(reference.expression, target) && - getAccessedPropertyName(reference) === name) { + getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) { return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */); } if (isMatchingReference(reference, target)) { - return narrowByInKeyword(type, name, assumeTrue); + return narrowByInKeyword(type, leftType, assumeTrue); } } break; @@ -71784,24 +72387,11 @@ var ts; assumeTrue = !assumeTrue; } var valueType = getTypeOfExpression(value); - if (((type.flags & 2 /* TypeFlags.Unknown */) || isEmptyAnonymousObjectType(type) && !(valueType.flags & 98304 /* TypeFlags.Nullable */)) && - assumeTrue && - (operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */)) { - if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */)) { - return valueType; - } - if (valueType.flags & 524288 /* TypeFlags.Object */) { - return nonPrimitiveType; - } - if (type.flags & 2 /* TypeFlags.Unknown */) { - return type; - } - } + var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */; if (valueType.flags & 98304 /* TypeFlags.Nullable */) { if (!strictNullChecks) { return type; } - var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */; var facts = doubleEquals ? assumeTrue ? 262144 /* TypeFacts.EQUndefinedOrNull */ : 2097152 /* TypeFacts.NEUndefinedOrNull */ : valueType.flags & 65536 /* TypeFlags.Null */ ? @@ -71810,10 +72400,16 @@ var ts; return getAdjustedTypeWithFacts(type, facts); } if (assumeTrue) { - var filterFn = operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? - function (t) { return areTypesComparable(t, valueType) || isCoercibleUnderDoubleEquals(t, valueType); } : - function (t) { return areTypesComparable(t, valueType); }; - return replacePrimitivesWithLiterals(filterType(type, filterFn), valueType); + if (!doubleEquals && (type.flags & 2 /* TypeFlags.Unknown */ || someType(type, isEmptyAnonymousObjectType))) { + if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) { + return valueType; + } + if (valueType.flags & 524288 /* TypeFlags.Object */) { + return nonPrimitiveType; + } + } + var filteredType = filterType(type, function (t) { return areTypesComparable(t, valueType) || doubleEquals && isCoercibleUnderDoubleEquals(t, valueType); }); + return replacePrimitivesWithLiterals(filteredType, valueType); } if (isUnitType(valueType)) { return filterType(type, function (t) { return !(isUnitLikeType(t) && areTypesComparable(t, valueType)); }); @@ -71827,11 +72423,18 @@ var ts; } var target = getReferenceCandidate(typeOfExpr.expression); if (!isMatchingReference(reference, target)) { + var propertyAccess = getDiscriminantPropertyAccess(typeOfExpr.expression, type); + if (propertyAccess) { + return narrowTypeByDiscriminant(type, propertyAccess, function (t) { return narrowTypeByLiteralExpression(t, literal, assumeTrue); }); + } if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) { return getAdjustedTypeWithFacts(type, 2097152 /* TypeFacts.NEUndefinedOrNull */); } return type; } + return narrowTypeByLiteralExpression(type, literal, assumeTrue); + } + function narrowTypeByLiteralExpression(type, literal, assumeTrue) { return assumeTrue ? narrowTypeByTypeName(type, literal.text) : getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768 /* TypeFacts.TypeofNEHostObject */); @@ -71917,7 +72520,7 @@ var ts; return type; } // Equal start and end denotes implicit fallthrough; undefined marks explicit default clause. - var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 290 /* SyntaxKind.DefaultClause */; }); + var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 293 /* SyntaxKind.DefaultClause */; }); var hasDefaultClause = clauseStart === clauseEnd || (defaultIndex >= clauseStart && defaultIndex < clauseEnd); if (hasDefaultClause) { // In the default clause we filter constituents down to those that are not-equal to all handled cases. @@ -72121,17 +72724,17 @@ var ts; // falls through case 108 /* SyntaxKind.ThisKeyword */: case 106 /* SyntaxKind.SuperKeyword */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return narrowTypeByCallExpression(type, expr, assumeTrue); - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return narrowType(type, expr.expression, assumeTrue); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: if (expr.operator === 53 /* SyntaxKind.ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -72180,9 +72783,9 @@ var ts; function getControlFlowContainer(node) { return ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 262 /* SyntaxKind.ModuleBlock */ || - node.kind === 305 /* SyntaxKind.SourceFile */ || - node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + node.kind === 265 /* SyntaxKind.ModuleBlock */ || + node.kind === 308 /* SyntaxKind.SourceFile */ || + node.kind === 169 /* SyntaxKind.PropertyDeclaration */; }); } // Check if a parameter or catch variable is assigned anywhere @@ -72225,7 +72828,7 @@ var ts; function removeOptionalityFromDeclaredType(declaredType, declaration) { if (pushTypeResolution(declaration.symbol, 2 /* TypeSystemPropertyName.DeclaredType */)) { var annotationIncludesUndefined = strictNullChecks && - declaration.kind === 164 /* SyntaxKind.Parameter */ && + declaration.kind === 166 /* SyntaxKind.Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* TypeFacts.IsUndefined */ && !(getTypeFacts(checkExpression(declaration.initializer)) & 16777216 /* TypeFacts.IsUndefined */); @@ -72242,10 +72845,10 @@ var ts; // In an element access obj[x], we consider obj to be in a constraint position, except when obj is of // a generic type without a nullable constraint and x is a generic type. This is because when both obj // and x are of generic types T and K, we want the resulting type to be T[K]. - return parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - parent.kind === 161 /* SyntaxKind.QualifiedName */ || - parent.kind === 208 /* SyntaxKind.CallExpression */ && parent.expression === node || - parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && parent.expression === node && + return parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + parent.kind === 163 /* SyntaxKind.QualifiedName */ || + parent.kind === 210 /* SyntaxKind.CallExpression */ && parent.expression === node || + parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && parent.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression))); } function isGenericTypeWithUnionConstraint(type) { @@ -72344,15 +72947,16 @@ var ts; // destructuring from the narrowed parent type. if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) { var parent = declaration.parent.parent; - if (parent.kind === 254 /* SyntaxKind.VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* NodeFlags.Const */ || parent.kind === 164 /* SyntaxKind.Parameter */) { + if (parent.kind === 257 /* SyntaxKind.VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* NodeFlags.Const */ || parent.kind === 166 /* SyntaxKind.Parameter */) { var links = getNodeLinks(parent); if (!(links.flags & 268435456 /* NodeCheckFlags.InCheckIdentifier */)) { links.flags |= 268435456 /* NodeCheckFlags.InCheckIdentifier */; var parentType = getTypeForBindingElementParent(parent, 0 /* CheckMode.Normal */); + var parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType); links.flags &= ~268435456 /* NodeCheckFlags.InCheckIdentifier */; - if (parentType && parentType.flags & 1048576 /* TypeFlags.Union */ && !(parent.kind === 164 /* SyntaxKind.Parameter */ && isSymbolAssigned(symbol))) { + if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* TypeFlags.Union */ && !(parent.kind === 166 /* SyntaxKind.Parameter */ && isSymbolAssigned(symbol))) { var pattern = declaration.parent; - var narrowedType = getFlowTypeOfReference(pattern, parentType, parentType, /*flowContainer*/ undefined, location.flowNode); + var narrowedType = getFlowTypeOfReference(pattern, parentTypeConstraint, parentTypeConstraint, /*flowContainer*/ undefined, location.flowNode); if (narrowedType.flags & 131072 /* TypeFlags.Never */) { return neverType; } @@ -72419,10 +73023,10 @@ var ts; } var container = ts.getContainingFunction(node); if (languageVersion < 2 /* ScriptTarget.ES2015 */) { - if (container.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (container.kind === 216 /* SyntaxKind.ArrowFunction */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } - else if (ts.hasSyntacticModifier(container, 256 /* ModifierFlags.Async */)) { + else if (ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); } } @@ -72442,7 +73046,7 @@ var ts; // Due to the emit for class decorators, any reference to the class from inside of the class body // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind // behavior of class names in ES6. - if (declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ + if (declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ && ts.nodeIsDecorated(declaration)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -72454,12 +73058,12 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration.kind === 226 /* SyntaxKind.ClassExpression */) { + else if (declaration.kind === 228 /* SyntaxKind.ClassExpression */) { // When we emit a class expression with static members that contain a reference // to the constructor in the initializer, we will need to substitute that // binding with an alias as the class name is not in scope. var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); - while (container.kind !== 305 /* SyntaxKind.SourceFile */) { + while (container.kind !== 308 /* SyntaxKind.SourceFile */) { if (container.parent === declaration) { if (ts.isPropertyDeclaration(container) && ts.isStatic(container) || ts.isClassStaticBlockDeclaration(container)) { getNodeLinks(declaration).flags |= 16777216 /* NodeCheckFlags.ClassWithConstructorReference */; @@ -72517,7 +73121,7 @@ var ts; // The declaration container is the innermost function that encloses the declaration of the variable // or parameter. The flow container is the innermost function starting with which we analyze the control // flow graph to determine the control flow based type. - var isParameter = ts.getRootDeclaration(declaration).kind === 164 /* SyntaxKind.Parameter */; + var isParameter = ts.getRootDeclaration(declaration).kind === 166 /* SyntaxKind.Parameter */; var declarationContainer = getControlFlowContainer(declaration); var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; @@ -72526,8 +73130,8 @@ var ts; // When the control flow originates in a function expression or arrow function and we are referencing // a const variable or parameter from an outer function, we extend the origin of the control flow // analysis to include the immediately enclosing function. - while (flowContainer !== declarationContainer && (flowContainer.kind === 213 /* SyntaxKind.FunctionExpression */ || - flowContainer.kind === 214 /* SyntaxKind.ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 215 /* SyntaxKind.FunctionExpression */ || + flowContainer.kind === 216 /* SyntaxKind.ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter && !isSymbolAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } @@ -72536,9 +73140,9 @@ var ts; // declaration container are the same). var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || ts.isBindingElement(declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* TypeFlags.AnyOrUnknown */ | 16384 /* TypeFlags.Void */)) !== 0 || - isInTypeQuery(node) || node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) || - node.parent.kind === 230 /* SyntaxKind.NonNullExpression */ || - declaration.kind === 254 /* SyntaxKind.VariableDeclaration */ && declaration.exclamationToken || + isInTypeQuery(node) || node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) || + node.parent.kind === 232 /* SyntaxKind.NonNullExpression */ || + declaration.kind === 257 /* SyntaxKind.VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* NodeFlags.Ambient */; var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) : type === autoType || type === autoArrayType ? undefinedType : @@ -72596,7 +73200,7 @@ var ts; (symbol.flags & (2 /* SymbolFlags.BlockScopedVariable */ | 32 /* SymbolFlags.Class */)) === 0 || !symbol.valueDeclaration || ts.isSourceFile(symbol.valueDeclaration) || - symbol.valueDeclaration.parent.kind === 292 /* SyntaxKind.CatchClause */) { + symbol.valueDeclaration.parent.kind === 295 /* SyntaxKind.CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -72611,7 +73215,7 @@ var ts; // mark iteration statement as containing block-scoped binding captured in some function var capturesBlockScopeBindingInLoopBody = true; if (ts.isForStatement(container)) { - var varDeclList = ts.getAncestor(symbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); + var varDeclList = ts.getAncestor(symbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); if (varDeclList && varDeclList.parent === container) { var part = getPartOfForStatementContainingNode(node.parent, container); if (part) { @@ -72632,7 +73236,7 @@ var ts; // mark variables that are declared in loop initializer and reassigned inside the body of ForStatement. // if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back. if (ts.isForStatement(container)) { - var varDeclList = ts.getAncestor(symbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); + var varDeclList = ts.getAncestor(symbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); if (varDeclList && varDeclList.parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 4194304 /* NodeCheckFlags.NeedsLoopOutParameter */; } @@ -72651,7 +73255,7 @@ var ts; function isAssignedInBodyOfForStatement(node, container) { // skip parenthesized nodes var current = node; - while (current.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (current.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { current = current.parent; } // check if node is used as LHS in some assignment expression @@ -72659,7 +73263,7 @@ var ts; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || current.parent.kind === 220 /* SyntaxKind.PostfixUnaryExpression */)) { + else if ((current.parent.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || current.parent.kind === 222 /* SyntaxKind.PostfixUnaryExpression */)) { var expr = current.parent; isAssigned = expr.operator === 45 /* SyntaxKind.PlusPlusToken */ || expr.operator === 46 /* SyntaxKind.MinusMinusToken */; } @@ -72672,7 +73276,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* NodeCheckFlags.LexicalThis */; - if (container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || container.kind === 171 /* SyntaxKind.Constructor */) { + if (container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || container.kind === 173 /* SyntaxKind.Constructor */) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* NodeCheckFlags.CaptureThis */; } @@ -72719,31 +73323,31 @@ var ts; // tell whether 'this' needs to be captured. var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var capturedByArrowFunction = false; - if (container.kind === 171 /* SyntaxKind.Constructor */) { + if (container.kind === 173 /* SyntaxKind.Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (container.kind === 216 /* SyntaxKind.ArrowFunction */) { container = ts.getThisContainer(container, /* includeArrowFunctions */ false); capturedByArrowFunction = true; } checkThisInStaticClassFieldInitializerInDecoratedClass(node, container); switch (container.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks } break; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -72831,7 +73435,7 @@ var ts; } function getClassNameFromPrototypeMethod(container) { // Check if it's the RHS of a x.prototype.y = function [name]() { .... } - if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && + if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && ts.isBinaryExpression(container.parent) && ts.getAssignmentDeclarationKind(container.parent) === 3 /* AssignmentDeclarationKind.PrototypeProperty */) { // Get the 'x' of 'x.prototype.y = container' @@ -72841,16 +73445,16 @@ var ts; .expression; // x } // x.prototype = { method() { } } - else if (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && - container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + else if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && + container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && ts.isBinaryExpression(container.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent) === 6 /* AssignmentDeclarationKind.Prototype */) { return container.parent.parent.left.expression; } // x.prototype = { method: function() { } } - else if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && - container.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ && - container.parent.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + else if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && + container.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ && + container.parent.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && ts.isBinaryExpression(container.parent.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent.parent) === 6 /* AssignmentDeclarationKind.Prototype */) { return container.parent.parent.parent.left.expression; @@ -72858,7 +73462,7 @@ var ts; // Object.defineProperty(x, "method", { value: function() { } }); // Object.defineProperty(x, "method", { set: (x: () => void) => void }); // Object.defineProperty(x, "method", { get: () => function() { }) }); - else if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && + else if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && ts.isPropertyAssignment(container.parent) && ts.isIdentifier(container.parent.name) && (container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") && @@ -72883,7 +73487,7 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 317 /* SyntaxKind.JSDocFunctionType */) { + if (jsdocType && jsdocType.kind === 320 /* SyntaxKind.JSDocFunctionType */) { var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && @@ -72897,16 +73501,16 @@ var ts; } } function isInConstructorArgumentInitializer(node, constructorDecl) { - return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 164 /* SyntaxKind.Parameter */ && n.parent === constructorDecl; }); + return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 166 /* SyntaxKind.Parameter */ && n.parent === constructorDecl; }); } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 208 /* SyntaxKind.CallExpression */ && node.parent.expression === node; + var isCallExpression = node.parent.kind === 210 /* SyntaxKind.CallExpression */ && node.parent.expression === node; var immediateContainer = ts.getSuperContainer(node, /*stopOnFunctions*/ true); var container = immediateContainer; var needToCaptureLexicalThis = false; // adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting if (!isCallExpression) { - while (container && container.kind === 214 /* SyntaxKind.ArrowFunction */) { + while (container && container.kind === 216 /* SyntaxKind.ArrowFunction */) { container = ts.getSuperContainer(container, /*stopOnFunctions*/ true); needToCaptureLexicalThis = languageVersion < 2 /* ScriptTarget.ES2015 */; } @@ -72919,14 +73523,14 @@ var ts; // class B { // [super.foo()]() {} // } - var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 162 /* SyntaxKind.ComputedPropertyName */; }); - if (current && current.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 164 /* SyntaxKind.ComputedPropertyName */; }); + if (current && current.kind === 164 /* SyntaxKind.ComputedPropertyName */) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } - else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -72934,7 +73538,7 @@ var ts; } return errorType; } - if (!isCallExpression && immediateContainer.kind === 171 /* SyntaxKind.Constructor */) { + if (!isCallExpression && immediateContainer.kind === 173 /* SyntaxKind.Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); } if (ts.isStatic(container) || isCallExpression) { @@ -73015,7 +73619,7 @@ var ts; // as a call expression cannot be used as the target of a destructuring assignment while a property access can. // // For element access expressions (`super[x]`), we emit a generic helper that forwards the element access in both situations. - if (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && ts.hasSyntacticModifier(container, 256 /* ModifierFlags.Async */)) { + if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) { if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */; } @@ -73029,7 +73633,7 @@ var ts; // in this case they should also use correct lexical this captureLexicalThis(node.parent, container); } - if (container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return errorType; @@ -73050,7 +73654,7 @@ var ts; if (!baseClassType) { return errorType; } - if (container.kind === 171 /* SyntaxKind.Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 173 /* SyntaxKind.Constructor */ && isInConstructorArgumentInitializer(node, container)) { // issue custom error message for super property access in constructor arguments (to be aligned with old compiler) error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return errorType; @@ -73065,7 +73669,7 @@ var ts; if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes - return container.kind === 171 /* SyntaxKind.Constructor */; + return container.kind === 173 /* SyntaxKind.Constructor */; } else { // TS 1.0 SPEC (April 2014) @@ -73073,23 +73677,23 @@ var ts; // - In a constructor, instance member function, instance member accessor, or instance member variable initializer where this references a derived class instance // - In a static member function or static member accessor // topmost container must be something that is directly nested in the class declaration\object literal expression - if (ts.isClassLike(container.parent) || container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (ts.isClassLike(container.parent) || container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { if (ts.isStatic(container)) { - return container.kind === 169 /* SyntaxKind.MethodDeclaration */ || - container.kind === 168 /* SyntaxKind.MethodSignature */ || - container.kind === 172 /* SyntaxKind.GetAccessor */ || - container.kind === 173 /* SyntaxKind.SetAccessor */ || - container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - container.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + return container.kind === 171 /* SyntaxKind.MethodDeclaration */ || + container.kind === 170 /* SyntaxKind.MethodSignature */ || + container.kind === 174 /* SyntaxKind.GetAccessor */ || + container.kind === 175 /* SyntaxKind.SetAccessor */ || + container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + container.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; } else { - return container.kind === 169 /* SyntaxKind.MethodDeclaration */ || - container.kind === 168 /* SyntaxKind.MethodSignature */ || - container.kind === 172 /* SyntaxKind.GetAccessor */ || - container.kind === 173 /* SyntaxKind.SetAccessor */ || - container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - container.kind === 166 /* SyntaxKind.PropertySignature */ || - container.kind === 171 /* SyntaxKind.Constructor */; + return container.kind === 171 /* SyntaxKind.MethodDeclaration */ || + container.kind === 170 /* SyntaxKind.MethodSignature */ || + container.kind === 174 /* SyntaxKind.GetAccessor */ || + container.kind === 175 /* SyntaxKind.SetAccessor */ || + container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + container.kind === 168 /* SyntaxKind.PropertySignature */ || + container.kind === 173 /* SyntaxKind.Constructor */; } } } @@ -73097,10 +73701,10 @@ var ts; } } function getContainingObjectLiteral(func) { - return (func.kind === 169 /* SyntaxKind.MethodDeclaration */ || - func.kind === 172 /* SyntaxKind.GetAccessor */ || - func.kind === 173 /* SyntaxKind.SetAccessor */) && func.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ ? func.parent : - func.kind === 213 /* SyntaxKind.FunctionExpression */ && func.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ ? func.parent.parent : + return (func.kind === 171 /* SyntaxKind.MethodDeclaration */ || + func.kind === 174 /* SyntaxKind.GetAccessor */ || + func.kind === 175 /* SyntaxKind.SetAccessor */) && func.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ ? func.parent : + func.kind === 215 /* SyntaxKind.FunctionExpression */ && func.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ ? func.parent.parent : undefined; } function getThisTypeArgument(type) { @@ -73112,7 +73716,7 @@ var ts; }); } function getContextualThisParameterType(func) { - if (func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 216 /* SyntaxKind.ArrowFunction */) { return undefined; } if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { @@ -73139,7 +73743,7 @@ var ts; if (thisType) { return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral))); } - if (literal.parent.kind !== 296 /* SyntaxKind.PropertyAssignment */) { + if (literal.parent.kind !== 299 /* SyntaxKind.PropertyAssignment */) { break; } literal = literal.parent.parent; @@ -73153,7 +73757,7 @@ var ts; // In an assignment of the form 'obj.xxx = function(...)' or 'obj[xxx] = function(...)', the // contextual type for 'this' is 'obj'. var parent = ts.walkUpParenthesizedExpressions(func.parent); - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { var target = parent.left; if (ts.isAccessExpression(target)) { var expression = target.expression; @@ -73206,11 +73810,11 @@ var ts; return getTypeFromTypeNode(typeNode); } switch (declaration.kind) { - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return getContextuallyTypedParameterType(declaration); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getContextualTypeForBindingElement(declaration, contextFlags); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (ts.isStatic(declaration)) { return getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags); } @@ -73221,10 +73825,10 @@ var ts; var parent = declaration.parent.parent; var name = declaration.propertyName || declaration.name; var parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || - parent.kind !== 203 /* SyntaxKind.BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* CheckMode.RestBindingElement */ : 0 /* CheckMode.Normal */); + parent.kind !== 205 /* SyntaxKind.BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* CheckMode.RestBindingElement */ : 0 /* CheckMode.Normal */); if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name)) return undefined; - if (parent.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */) { + if (parent.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */) { var index = ts.indexOfNode(declaration.parent.elements, declaration); if (index < 0) return undefined; @@ -73381,7 +73985,7 @@ var ts; getTypeAtPosition(signature, argIndex); } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (template.parent.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -73500,9 +74104,11 @@ var ts; case 1 /* AssignmentDeclarationKind.ExportsProperty */: case 6 /* AssignmentDeclarationKind.Prototype */: case 3 /* AssignmentDeclarationKind.PrototypeProperty */: - var valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; - // falls through case 2 /* AssignmentDeclarationKind.ModuleExports */: + var valueDeclaration = void 0; + if (kind !== 2 /* AssignmentDeclarationKind.ModuleExports */) { + valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; + } valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration); var annotated = valueDeclaration && ts.getEffectiveTypeAnnotationNode(valueDeclaration); return annotated ? getTypeFromTypeNode(annotated) : undefined; @@ -73679,21 +74285,21 @@ var ts; case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 79 /* SyntaxKind.Identifier */: - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: return true; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isPossiblyDiscriminantValue(node.expression); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return !node.expression || isPossiblyDiscriminantValue(node.expression); } return false; } function discriminateContextualTypeByObjectMembers(node, contextualType) { - return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 296 /* SyntaxKind.PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); + return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 299 /* SyntaxKind.PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); } function discriminateContextualTypeByJSXAttributes(node, contextualType) { - return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 285 /* SyntaxKind.JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); + return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 288 /* SyntaxKind.JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); } // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily // be "pushed" onto a node using the contextualType property. @@ -73776,60 +74382,62 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 205 /* SyntaxKind.BindingElement */: return getContextualTypeForInitializerExpression(node, contextFlags); - case 214 /* SyntaxKind.ArrowFunction */: - case 247 /* SyntaxKind.ReturnStatement */: + case 216 /* SyntaxKind.ArrowFunction */: + case 250 /* SyntaxKind.ReturnStatement */: return getContextualTypeForReturnExpression(node, contextFlags); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return getContextualTypeForYieldOperand(parent, contextFlags); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return getContextualTypeForAwaitOperand(parent, contextFlags); - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return getContextualTypeForArgument(parent, node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return ts.isConstTypeReference(parent.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(parent.type); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return getContextualTypeForBinaryOperand(node, contextFlags); - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent, contextFlags); - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return getContextualType(parent.parent, contextFlags); - case 204 /* SyntaxKind.ArrayLiteralExpression */: { + case 206 /* SyntaxKind.ArrayLiteralExpression */: { var arrayLiteral = parent; var type = getApparentTypeOfContextualType(arrayLiteral, contextFlags); return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node)); } - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return getContextualTypeForConditionalOperand(node, contextFlags); - case 233 /* SyntaxKind.TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 223 /* SyntaxKind.TemplateExpression */); + case 236 /* SyntaxKind.TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 225 /* SyntaxKind.TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 212 /* SyntaxKind.ParenthesizedExpression */: { + case 214 /* SyntaxKind.ParenthesizedExpression */: { // Like in `checkParenthesizedExpression`, an `/** @type {xyz} */` comment before a parenthesized expression acts as a type cast. var tag = ts.isInJSFile(parent) ? ts.getJSDocTypeTag(parent) : undefined; return !tag ? getContextualType(parent, contextFlags) : ts.isJSDocTypeTag(tag) && ts.isConstTypeReference(tag.typeExpression.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(tag.typeExpression.type); } - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return getContextualType(parent, contextFlags); - case 271 /* SyntaxKind.ExportAssignment */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return getTypeFromTypeNode(parent.type); + case 274 /* SyntaxKind.ExportAssignment */: return tryGetTypeFromEffectiveTypeNode(parent); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return getContextualTypeForJsxExpression(parent, contextFlags); - case 285 /* SyntaxKind.JsxAttribute */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent, contextFlags); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return getContextualJsxElementAttributesType(parent, contextFlags); } return undefined; @@ -73955,9 +74563,16 @@ var ts; if (!isErrorType(intrinsicClassAttribs)) { var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); var hostClassType = getReturnTypeOfSignature(sig); - apparentAttributesType = intersectTypes(typeParams - ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context))) - : intrinsicClassAttribs, apparentAttributesType); + var libraryManagedAttributeType = void 0; + if (typeParams) { + // apply JSX.IntrinsicClassElements + var inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context)); + libraryManagedAttributeType = instantiateType(intrinsicClassAttribs, createTypeMapper(typeParams, inferredArgs)); + } + // or JSX.IntrinsicClassElements has no generics. + else + libraryManagedAttributeType = intrinsicClassAttribs; + apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType); } var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); if (!isErrorType(intrinsicAttribs)) { @@ -74080,7 +74695,7 @@ var ts; // all identical ignoring their return type, the result is same signature but with return type as // union type of return types from these signatures function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var typeTagSignature = getSignatureOfTypeTag(node); if (typeTagSignature) { return typeTagSignature; @@ -74128,8 +74743,8 @@ var ts; return node.isSpread ? getIndexedAccessType(node.type, numberType) : node.type; } function hasDefaultValue(node) { - return (node.kind === 203 /* SyntaxKind.BindingElement */ && !!node.initializer) || - (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */); + return (node.kind === 205 /* SyntaxKind.BindingElement */ && !!node.initializer) || + (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */); } function checkArrayLiteral(node, checkMode, forceTuple) { var elements = node.elements; @@ -74142,7 +74757,7 @@ var ts; var hasOmittedExpression = false; for (var i = 0; i < elementCount; i++) { var e = elements[i]; - if (e.kind === 225 /* SyntaxKind.SpreadElement */) { + if (e.kind === 227 /* SyntaxKind.SpreadElement */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { checkExternalEmitHelpers(e, compilerOptions.downlevelIteration ? 1536 /* ExternalEmitHelpers.SpreadIncludes */ : 1024 /* ExternalEmitHelpers.SpreadArray */); } @@ -74175,7 +74790,7 @@ var ts; elementFlags.push(4 /* ElementFlags.Rest */); } } - else if (exactOptionalPropertyTypes && e.kind === 227 /* SyntaxKind.OmittedExpression */) { + else if (exactOptionalPropertyTypes && e.kind === 229 /* SyntaxKind.OmittedExpression */) { hasOmittedExpression = true; elementTypes.push(missingType); elementFlags.push(2 /* ElementFlags.Optional */); @@ -74215,7 +74830,7 @@ var ts; } function isNumericName(name) { switch (name.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return isNumericComputedName(name); case 79 /* SyntaxKind.Identifier */: return ts.isNumericLiteralName(name.escapedText); @@ -74236,7 +74851,7 @@ var ts; if (!links.resolvedType) { if ((ts.isTypeLiteralNode(node.parent.parent) || ts.isClassLike(node.parent.parent) || ts.isInterfaceDeclaration(node.parent.parent)) && ts.isBinaryExpression(node.expression) && node.expression.operatorToken.kind === 101 /* SyntaxKind.InKeyword */ - && node.parent.kind !== 172 /* SyntaxKind.GetAccessor */ && node.parent.kind !== 173 /* SyntaxKind.SetAccessor */) { + && node.parent.kind !== 174 /* SyntaxKind.GetAccessor */ && node.parent.kind !== 175 /* SyntaxKind.SetAccessor */) { return links.resolvedType = errorType; } links.resolvedType = checkExpression(node.expression); @@ -74309,7 +74924,7 @@ var ts; var spread = emptyObjectType; var contextualType = getApparentTypeOfContextualType(node, /*contextFlags*/ undefined); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ || contextualType.pattern.kind === 205 /* SyntaxKind.ObjectLiteralExpression */); + (contextualType.pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ || contextualType.pattern.kind === 207 /* SyntaxKind.ObjectLiteralExpression */); var inConstContext = isConstContext(node); var checkFlags = inConstContext ? 8 /* CheckFlags.Readonly */ : 0; var isInJavascript = ts.isInJSFile(node) && !ts.isInJsonFile(node); @@ -74333,16 +74948,16 @@ var ts; for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var memberDecl = _c[_b]; var member = getSymbolOfNode(memberDecl); - var computedNameType = memberDecl.name && memberDecl.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? + var computedNameType = memberDecl.name && memberDecl.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : undefined; - if (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ || - memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ || + if (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ || + memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { - var type = memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : + var type = memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : // avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring // for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`. // we don't want to say "could not find 'a'". - memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : + memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode); if (isInJavascript) { var jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl); @@ -74365,8 +74980,8 @@ var ts; if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. - var isOptional = (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 16777216 /* SymbolFlags.Optional */; } @@ -74392,14 +75007,14 @@ var ts; member = prop; allPropertiesTable === null || allPropertiesTable === void 0 ? void 0 : allPropertiesTable.set(prop.escapedName, prop); if (contextualType && checkMode && checkMode & 2 /* CheckMode.Inferential */ && !(checkMode & 4 /* CheckMode.SkipContextSensitive */) && - (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ || memberDecl.kind === 169 /* SyntaxKind.MethodDeclaration */) && isContextSensitive(memberDecl)) { + (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ || memberDecl.kind === 171 /* SyntaxKind.MethodDeclaration */) && isContextSensitive(memberDecl)) { var inferenceContext = getInferenceContext(node); ts.Debug.assert(inferenceContext); // In CheckMode.Inferential we should always have an inference context - var inferenceNode = memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ ? memberDecl.initializer : memberDecl; + var inferenceNode = memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ ? memberDecl.initializer : memberDecl; addIntraExpressionInferenceSite(inferenceContext, inferenceNode, type); } } - else if (memberDecl.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (memberDecl.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { checkExternalEmitHelpers(memberDecl, 2 /* ExternalEmitHelpers.Assign */); } @@ -74435,7 +75050,7 @@ var ts; // an ordinary function declaration(section 6.1) with no parameters. // A set accessor declaration is processed in the same manner // as an ordinary function declaration with a single parameter and a Void return type. - ts.Debug.assert(memberDecl.kind === 172 /* SyntaxKind.GetAccessor */ || memberDecl.kind === 173 /* SyntaxKind.SetAccessor */); + ts.Debug.assert(memberDecl.kind === 174 /* SyntaxKind.GetAccessor */ || memberDecl.kind === 175 /* SyntaxKind.SetAccessor */); checkNodeDeferred(memberDecl); } if (computedNameType && !(computedNameType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */)) { @@ -74462,16 +75077,30 @@ var ts; // If object literal is contextually typed by the implied type of a binding pattern, augment the result // type with those properties for which the binding pattern specifies a default value. // If the object literal is spread into another object literal, skip this step and let the top-level object - // literal handle it instead. - if (contextualTypeHasPattern && node.parent.kind !== 298 /* SyntaxKind.SpreadAssignment */) { - for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { - var prop = _e[_d]; - if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { - if (!(prop.flags & 16777216 /* SymbolFlags.Optional */)) { - error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + // literal handle it instead. Note that this might require full traversal to the root pattern's parent + // as it's the guaranteed to be the common ancestor of the pattern node and the current object node. + // It's not possible to check if the immediate parent node is a spread assignment + // since the type flows in non-obvious ways through conditional expressions, IIFEs and more. + if (contextualTypeHasPattern) { + var rootPatternParent_1 = ts.findAncestor(contextualType.pattern.parent, function (n) { + return n.kind === 257 /* SyntaxKind.VariableDeclaration */ || + n.kind === 223 /* SyntaxKind.BinaryExpression */ || + n.kind === 166 /* SyntaxKind.Parameter */; + }); + var spreadOrOutsideRootObject = ts.findAncestor(node, function (n) { + return n === rootPatternParent_1 || + n.kind === 301 /* SyntaxKind.SpreadAssignment */; + }); + if (spreadOrOutsideRootObject.kind !== 301 /* SyntaxKind.SpreadAssignment */) { + for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { + var prop = _e[_d]; + if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { + if (!(prop.flags & 16777216 /* SymbolFlags.Optional */)) { + error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + propertiesTable.set(prop.escapedName, prop); + propertiesArray.push(prop); } - propertiesTable.set(prop.escapedName, prop); - propertiesArray.push(prop); } } } @@ -74579,6 +75208,7 @@ var ts; */ function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) { var attributes = openingLikeElement.attributes; + var attributesType = getContextualType(attributes, 0 /* ContextFlags.None */); var allAttributesTable = strictNullChecks ? ts.createSymbolTable() : undefined; var attributesTable = ts.createSymbolTable(); var spread = emptyJsxObjectType; @@ -74606,9 +75236,15 @@ var ts; if (attributeDecl.name.escapedText === jsxChildrenPropertyName) { explicitlySpecifyChildrenAttribute = true; } + if (attributesType) { + var prop = getPropertyOfType(attributesType, member.escapedName); + if (prop && prop.declarations && isDeprecatedSymbol(prop)) { + addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText); + } + } } else { - ts.Debug.assert(attributeDecl.kind === 287 /* SyntaxKind.JsxSpreadAttribute */); + ts.Debug.assert(attributeDecl.kind === 290 /* SyntaxKind.JsxSpreadAttribute */); if (attributesTable.size > 0) { spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, /*readonly*/ false); attributesTable = ts.createSymbolTable(); @@ -74635,7 +75271,7 @@ var ts; } } // Handle children attribute - var parent = openingLikeElement.parent.kind === 278 /* SyntaxKind.JsxElement */ ? openingLikeElement.parent : undefined; + var parent = openingLikeElement.parent.kind === 281 /* SyntaxKind.JsxElement */ ? openingLikeElement.parent : undefined; // We have to check that openingElement of the parent is the one we are visiting as this may not be true for selfClosingElement if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) { var childrenTypes = checkJsxChildren(parent, checkMode); @@ -74692,7 +75328,7 @@ var ts; childrenTypes.push(stringType); } } - else if (child.kind === 288 /* SyntaxKind.JsxExpression */ && !child.expression) { + else if (child.kind === 291 /* SyntaxKind.JsxExpression */ && !child.expression) { continue; // empty jsx expressions don't *really* count as present children } else { @@ -75124,9 +75760,9 @@ var ts; function checkPropertyAccessibility(node, isSuper, writing, type, prop, reportError) { if (reportError === void 0) { reportError = true; } var errorNode = !reportError ? undefined : - node.kind === 161 /* SyntaxKind.QualifiedName */ ? node.right : - node.kind === 200 /* SyntaxKind.ImportType */ ? node : - node.kind === 203 /* SyntaxKind.BindingElement */ && node.propertyName ? node.propertyName : node.name; + node.kind === 163 /* SyntaxKind.QualifiedName */ ? node.right : + node.kind === 202 /* SyntaxKind.ImportType */ ? node : + node.kind === 205 /* SyntaxKind.BindingElement */ && node.propertyName ? node.propertyName : node.name; return checkPropertyAccessibilityAtLocation(node, isSuper, writing, type, prop, errorNode); } /** @@ -75157,7 +75793,7 @@ var ts; return false; } } - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { // A method cannot be accessed in a super property access if the method is abstract. // This error could mask a private property access error. But, a member // cannot simultaneously be private and abstract, so this will trigger an @@ -75169,7 +75805,7 @@ var ts; } } // Referencing abstract properties within their own constructors is not allowed - if ((flags & 128 /* ModifierFlags.Abstract */) && symbolHasNonMethodDeclaration(prop) && + if ((flags & 256 /* ModifierFlags.Abstract */) && symbolHasNonMethodDeclaration(prop) && (ts.isThisProperty(location) || ts.isThisInitializedObjectBindingExpression(location) || ts.isObjectBindingPattern(location.parent) && ts.isThisInitializedDeclaration(location.parent.parent))) { var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) { @@ -75263,10 +75899,27 @@ var ts; return isNullableType(type) ? getNonNullableType(type) : type; } function reportObjectPossiblyNullOrUndefinedError(node, facts) { - error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? - ts.Diagnostics.Object_is_possibly_null_or_undefined : - ts.Diagnostics.Object_is_possibly_undefined : - ts.Diagnostics.Object_is_possibly_null); + var nodeText = ts.isEntityNameExpression(node) ? ts.entityNameToString(node) : undefined; + if (node.kind === 104 /* SyntaxKind.NullKeyword */) { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "null"); + return; + } + if (nodeText !== undefined && nodeText.length < 100) { + if (ts.isIdentifier(node) && nodeText === "undefined") { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "undefined"); + return; + } + error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? + ts.Diagnostics._0_is_possibly_null_or_undefined : + ts.Diagnostics._0_is_possibly_undefined : + ts.Diagnostics._0_is_possibly_null, nodeText); + } + else { + error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + } } function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) { error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? @@ -75276,6 +75929,13 @@ var ts; } function checkNonNullTypeWithReporter(type, node, reportError) { if (strictNullChecks && type.flags & 2 /* TypeFlags.Unknown */) { + if (ts.isEntityNameExpression(node)) { + var nodeText = ts.entityNameToString(node); + if (nodeText.length < 100) { + error(node, ts.Diagnostics._0_is_of_type_unknown, nodeText); + return errorType; + } + } error(node, ts.Diagnostics.Object_is_of_type_unknown); return errorType; } @@ -75293,6 +75953,17 @@ var ts; function checkNonNullNonVoidType(type, node) { var nonNullType = checkNonNullType(type, node); if (nonNullType.flags & 16384 /* TypeFlags.Void */) { + if (ts.isEntityNameExpression(node)) { + var nodeText = ts.entityNameToString(node); + if (ts.isIdentifier(node) && nodeText === "undefined") { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, nodeText); + return nonNullType; + } + if (nodeText.length < 100) { + error(node, ts.Diagnostics._0_is_possibly_undefined, nodeText); + return nonNullType; + } + } error(node, ts.Diagnostics.Object_is_possibly_undefined); } return nonNullType; @@ -75311,7 +75982,7 @@ var ts; return checkPropertyAccessExpressionOrQualifiedName(node, node.left, leftType, node.right, checkMode); } function isMethodAccessForCall(node) { - while (node.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (node.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { node = node.parent; } return ts.isCallOrNewExpression(node.parent) && node.parent.expression === node; @@ -75451,7 +76122,7 @@ var ts; } return isErrorType(apparentType) ? errorType : apparentType; } - prop = getPropertyOfType(apparentType, right.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ node.kind === 161 /* SyntaxKind.QualifiedName */); + prop = getPropertyOfType(apparentType, right.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ node.kind === 163 /* SyntaxKind.QualifiedName */); } // In `Foo.Bar.Baz`, 'Foo' is not referenced if 'Bar' is a const enum or a module containing only const enums. // `Foo` is also not referenced in `enum FooCopy { Bar = Foo.Bar }`, because the enum member value gets inlined @@ -75461,7 +76132,7 @@ var ts; // 1. if 'isolatedModules' is enabled, because the const enum value will not be inlined, and // 2. if 'preserveConstEnums' is enabled and the expression is itself an export, e.g. `export = Foo.Bar.Baz`. if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules || - !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* SymbolFlags.EnumMember */ && node.parent.kind === 299 /* SyntaxKind.EnumMember */)) || + !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* SymbolFlags.EnumMember */ && node.parent.kind === 302 /* SyntaxKind.EnumMember */)) || ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) { markAliasReferenced(parentSymbol, node); } @@ -75563,7 +76234,7 @@ var ts; if (declaration && isPropertyWithoutInitializer(declaration)) { if (!ts.isStatic(declaration)) { var flowContainer = getControlFlowContainer(node); - if (flowContainer.kind === 171 /* SyntaxKind.Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { + if (flowContainer.kind === 173 /* SyntaxKind.Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { assumeUninitialized = true; } } @@ -75598,8 +76269,8 @@ var ts; && (compilerOptions.useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) { diagnosticMessage = error(right, ts.Diagnostics.Property_0_is_used_before_its_initialization, declarationName); } - else if (valueDeclaration.kind === 257 /* SyntaxKind.ClassDeclaration */ && - node.parent.kind !== 178 /* SyntaxKind.TypeReference */ && + else if (valueDeclaration.kind === 260 /* SyntaxKind.ClassDeclaration */ && + node.parent.kind !== 180 /* SyntaxKind.TypeReference */ && !(valueDeclaration.flags & 16777216 /* NodeFlags.Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) { diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName); @@ -75611,25 +76282,25 @@ var ts; function isInPropertyInitializerOrClassStaticBlock(node) { return !!ts.findAncestor(node, function (node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 296 /* SyntaxKind.PropertyAssignment */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 298 /* SyntaxKind.SpreadAssignment */: - case 162 /* SyntaxKind.ComputedPropertyName */: - case 233 /* SyntaxKind.TemplateSpan */: - case 288 /* SyntaxKind.JsxExpression */: - case 285 /* SyntaxKind.JsxAttribute */: - case 286 /* SyntaxKind.JsxAttributes */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 291 /* SyntaxKind.HeritageClause */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 301 /* SyntaxKind.SpreadAssignment */: + case 164 /* SyntaxKind.ComputedPropertyName */: + case 236 /* SyntaxKind.TemplateSpan */: + case 291 /* SyntaxKind.JsxExpression */: + case 288 /* SyntaxKind.JsxAttribute */: + case 289 /* SyntaxKind.JsxAttributes */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 294 /* SyntaxKind.HeritageClause */: return false; - case 214 /* SyntaxKind.ArrowFunction */: - case 238 /* SyntaxKind.ExpressionStatement */: + case 216 /* SyntaxKind.ArrowFunction */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.isBlock(node.parent) && ts.isClassStaticBlockDeclaration(node.parent.parent) ? true : "quit"; default: return ts.isExpressionNode(node) ? false : "quit"; @@ -75824,7 +76495,6 @@ var ts; } return false; } - ; var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get"; if (!hasProp(suggestedMethod)) { return undefined; @@ -75904,11 +76574,11 @@ var ts; } function isValidPropertyAccess(node, propertyName) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return isValidPropertyAccessWithType(node, node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, propertyName, getWidenedType(checkExpression(node.expression))); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getWidenedType(checkExpression(node.left))); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getTypeFromTypeNode(node)); } } @@ -75923,7 +76593,7 @@ var ts; * @param property the accessed property's symbol. */ function isValidPropertyAccessForCompletions(node, type, property) { - return isPropertyAccessible(node, node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, + return isPropertyAccessible(node, node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, /* isWrite */ false, type, property); // Previously we validated the 'this' type of methods but this adversely affected performance. See #31377 for more context. } @@ -75963,7 +76633,7 @@ var ts; */ function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -75992,7 +76662,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 243 /* SyntaxKind.ForInStatement */ && + if (node.kind === 246 /* SyntaxKind.ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -76041,13 +76711,13 @@ var ts; // This gets us diagnostics for the type arguments and marks them as referenced. ts.forEach(node.typeArguments, checkSourceElement); } - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { checkExpression(node.template); } else if (ts.isJsxOpeningLikeElement(node)) { checkExpression(node.attributes); } - else if (node.kind !== 165 /* SyntaxKind.Decorator */) { + else if (node.kind !== 167 /* SyntaxKind.Decorator */) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -76111,7 +76781,7 @@ var ts; } } function isSpreadArgument(arg) { - return !!arg && (arg.kind === 225 /* SyntaxKind.SpreadElement */ || arg.kind === 232 /* SyntaxKind.SyntheticExpression */ && arg.isSpread); + return !!arg && (arg.kind === 227 /* SyntaxKind.SpreadElement */ || arg.kind === 234 /* SyntaxKind.SyntheticExpression */ && arg.isSpread); } function getSpreadArgumentIndex(args) { return ts.findIndex(args, isSpreadArgument); @@ -76128,9 +76798,9 @@ var ts; var callIsIncomplete = false; // In incomplete call we want to be lenient when we have too few arguments var effectiveParameterCount = getParameterCount(signature); var effectiveMinimumArguments = getMinArgumentCount(signature); - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { argCount = args.length; - if (node.template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (node.template.kind === 225 /* SyntaxKind.TemplateExpression */) { // If a tagged template expression lacks a tail literal, the call is incomplete. // Specifically, a template only can end in a TemplateTail or a Missing literal. var lastSpan = ts.last(node.template.templateSpans); // we should always have at least one span. @@ -76145,7 +76815,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 165 /* SyntaxKind.Decorator */) { + else if (node.kind === 167 /* SyntaxKind.Decorator */) { argCount = getDecoratorArgumentCount(node, signature); } else if (ts.isJsxOpeningLikeElement(node)) { @@ -76159,7 +76829,7 @@ var ts; } else if (!node.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(node.kind === 209 /* SyntaxKind.NewExpression */); + ts.Debug.assert(node.kind === 211 /* SyntaxKind.NewExpression */); return getMinArgumentCount(signature) === 0; } else { @@ -76262,7 +76932,7 @@ var ts; // example, given a 'function wrap(cb: (x: T) => U): (x: T) => U' and a call expression // 'let f: (x: string) => number = wrap(s => s.length)', we infer from the declared type of 'f' to the // return type of 'wrap'. - if (node.kind !== 165 /* SyntaxKind.Decorator */) { + if (node.kind !== 167 /* SyntaxKind.Decorator */) { var skipBindingPatterns = ts.every(signature.typeParameters, function (p) { return !!getDefaultFromTypeParameter(p); }); var contextualType = getContextualType(node, skipBindingPatterns ? 8 /* ContextFlags.SkipBindingPatterns */ : 0 /* ContextFlags.None */); if (contextualType) { @@ -76326,7 +76996,7 @@ var ts; } for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 227 /* SyntaxKind.OmittedExpression */ && !(checkMode & 32 /* CheckMode.IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) { + if (arg.kind !== 229 /* SyntaxKind.OmittedExpression */ && !(checkMode & 32 /* CheckMode.IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) { var paramType = getTypeAtPosition(signature, i); if (couldContainTypeVariables(paramType)) { var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode); @@ -76352,7 +77022,7 @@ var ts; if (isSpreadArgument(arg)) { // We are inferring from a spread expression in the last argument position, i.e. both the parameter // and the argument are ...x forms. - return getMutableArrayOrTupleType(arg.kind === 232 /* SyntaxKind.SyntheticExpression */ ? arg.type : + return getMutableArrayOrTupleType(arg.kind === 234 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode)); } } @@ -76362,13 +77032,13 @@ var ts; for (var i = index; i < argCount; i++) { var arg = args[i]; if (isSpreadArgument(arg)) { - var spreadType = arg.kind === 232 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpression(arg.expression); + var spreadType = arg.kind === 234 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpression(arg.expression); if (isArrayLikeType(spreadType)) { types.push(spreadType); flags.push(8 /* ElementFlags.Variadic */); } else { - types.push(checkIteratedTypeOrElementType(33 /* IterationUse.Spread */, spreadType, undefinedType, arg.kind === 225 /* SyntaxKind.SpreadElement */ ? arg.expression : arg)); + types.push(checkIteratedTypeOrElementType(33 /* IterationUse.Spread */, spreadType, undefinedType, arg.kind === 227 /* SyntaxKind.SpreadElement */ ? arg.expression : arg)); flags.push(4 /* ElementFlags.Rest */); } } @@ -76379,7 +77049,7 @@ var ts; types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType)); flags.push(1 /* ElementFlags.Required */); } - if (arg.kind === 232 /* SyntaxKind.SyntheticExpression */ && arg.tupleNameSource) { + if (arg.kind === 234 /* SyntaxKind.SyntheticExpression */ && arg.tupleNameSource) { names.push(arg.tupleNameSource); } } @@ -76523,7 +77193,7 @@ var ts; return undefined; } var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 209 /* SyntaxKind.NewExpression */) { + if (thisType && thisType !== voidType && node.kind !== 211 /* SyntaxKind.NewExpression */) { // If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType // If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible. // If the expression is a new expression, then the check is skipped. @@ -76541,7 +77211,7 @@ var ts; var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length; for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 227 /* SyntaxKind.OmittedExpression */) { + if (arg.kind !== 229 /* SyntaxKind.OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = checkExpressionWithContextualType(arg, paramType, /*inferenceContext*/ undefined, checkMode); // If one or more arguments are still excluded (as indicated by CheckMode.SkipContextSensitive), @@ -76586,8 +77256,8 @@ var ts; * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise. */ function getThisArgumentOfCall(node) { - var expression = node.kind === 208 /* SyntaxKind.CallExpression */ ? node.expression : - node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */ ? node.tag : undefined; + var expression = node.kind === 210 /* SyntaxKind.CallExpression */ ? node.expression : + node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */ ? node.tag : undefined; if (expression) { var callee = ts.skipOuterExpressions(expression); if (ts.isAccessExpression(callee)) { @@ -76605,17 +77275,17 @@ var ts; * Returns the effective arguments for an expression that works like a function invocation. */ function getEffectiveCallArguments(node) { - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { var template = node.template; var args_3 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())]; - if (template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (template.kind === 225 /* SyntaxKind.TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args_3.push(span.expression); }); } return args_3; } - if (node.kind === 165 /* SyntaxKind.Decorator */) { + if (node.kind === 167 /* SyntaxKind.Decorator */) { return getEffectiveDecoratorArguments(node); } if (ts.isJsxOpeningLikeElement(node)) { @@ -76626,10 +77296,10 @@ var ts; if (spreadIndex >= 0) { // Create synthetic arguments from spreads of tuple types. var effectiveArgs_1 = args.slice(0, spreadIndex); - var _loop_26 = function (i) { + var _loop_27 = function (i) { var arg = args[i]; // We can call checkExpressionCached because spread expressions never have a contextual type. - var spreadType = arg.kind === 225 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); + var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); if (spreadType && isTupleType(spreadType)) { ts.forEach(getTypeArguments(spreadType), function (t, i) { var _a; @@ -76643,7 +77313,7 @@ var ts; } }; for (var i = spreadIndex; i < args.length; i++) { - _loop_26(i); + _loop_27(i); } return effectiveArgs_1; } @@ -76656,30 +77326,30 @@ var ts; var parent = node.parent; var expr = node.expression; switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: // For a class decorator, the `target` is the type of the class (e.g. the // "static" or "constructor" side of the class). return [ createSyntheticExpression(expr, getTypeOfSymbol(getSymbolOfNode(parent))) ]; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // A parameter declaration decorator will have three arguments (see // `ParameterDecorator` in core.d.ts). var func = parent.parent; return [ - createSyntheticExpression(expr, parent.parent.kind === 171 /* SyntaxKind.Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), + createSyntheticExpression(expr, parent.parent.kind === 173 /* SyntaxKind.Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), createSyntheticExpression(expr, anyType), createSyntheticExpression(expr, numberType) ]; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // A method or accessor declaration decorator will have two or three arguments (see // `PropertyDecorator` and `MethodDecorator` in core.d.ts). If we are emitting decorators // for ES3, we will only pass two arguments. - var hasPropDesc = parent.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && languageVersion !== 0 /* ScriptTarget.ES3 */; + var hasPropDesc = languageVersion !== 0 /* ScriptTarget.ES3 */ && (!ts.isPropertyDeclaration(parent) || ts.hasAccessorModifier(parent)); return [ createSyntheticExpression(expr, getParentTypeOfClassElement(parent)), createSyntheticExpression(expr, getClassElementPropertyKeyType(parent)), @@ -76693,17 +77363,17 @@ var ts; */ function getDecoratorArgumentCount(node, signature) { switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return 1; - case 167 /* SyntaxKind.PropertyDeclaration */: - return 2; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + return ts.hasAccessorModifier(node.parent) ? 3 : 2; + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // For ES3 or decorators with only two parameters we supply only two arguments return languageVersion === 0 /* ScriptTarget.ES3 */ || signature.parameters.length <= 2 ? 2 : 3; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return 3; default: return ts.Debug.fail(); @@ -76845,8 +77515,8 @@ var ts; return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount); } function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags, fallbackError) { - var isTaggedTemplate = node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */; - var isDecorator = node.kind === 165 /* SyntaxKind.Decorator */; + var isTaggedTemplate = node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */; + var isDecorator = node.kind === 167 /* SyntaxKind.Decorator */; var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node); var reportErrors = !candidatesOutArray; var typeArguments; @@ -76909,7 +77579,7 @@ var ts; var result; // If we are in signature help, a trailing comma indicates that we intend to provide another argument, // so we will only accept overloads with arity at least 1 higher than the current number of provided arguments. - var signatureHelpTrailingComma = !!(checkMode & 16 /* CheckMode.IsForSignatureHelp */) && node.kind === 208 /* SyntaxKind.CallExpression */ && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = !!(checkMode & 16 /* CheckMode.IsForSignatureHelp */) && node.kind === 210 /* SyntaxKind.CallExpression */ && node.arguments.hasTrailingComma; // Section 4.12.1: // if the candidate list contains one or more signatures for which the type of each argument // expression is a subtype of each corresponding parameter type, the return type of the first @@ -76972,7 +77642,7 @@ var ts; var min_3 = Number.MAX_VALUE; var minIndex = 0; var i_1 = 0; - var _loop_27 = function (c) { + var _loop_28 = function (c) { var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); }; var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* CheckMode.Normal */, /*reportErrors*/ true, chain_2); if (diags_2) { @@ -76990,7 +77660,7 @@ var ts; }; for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) { var c = candidatesForArgumentError_1[_a]; - _loop_27(c); + _loop_28(c); } var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics); ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures"); @@ -77148,7 +77818,7 @@ var ts; } var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max; var parameters = []; - var _loop_28 = function (i) { + var _loop_29 = function (i) { var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ? i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) : i < s.parameters.length ? s.parameters[i] : undefined; }); @@ -77156,7 +77826,7 @@ var ts; parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); }))); }; for (var i = 0; i < maxNonRestParam; i++) { - _loop_28(i); + _loop_29(i); } var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; }); var flags = 0 /* SignatureFlags.None */; @@ -77398,7 +78068,7 @@ var ts; return resolveErrorCall(node); } var valueDecl = expressionType.symbol && ts.getClassLikeDeclarationOfSymbol(expressionType.symbol); - if (valueDecl && ts.hasSyntacticModifier(valueDecl, 128 /* ModifierFlags.Abstract */)) { + if (valueDecl && ts.hasSyntacticModifier(valueDecl, 256 /* ModifierFlags.Abstract */)) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_an_abstract_class); return resolveErrorCall(node); } @@ -77469,7 +78139,7 @@ var ts; var declaration = signature.declaration; var modifiers = ts.getSelectedEffectiveModifierFlags(declaration, 24 /* ModifierFlags.NonPublicAccessibilityModifier */); // (1) Public constructors and (2) constructor functions are always accessible. - if (!modifiers || declaration.kind !== 171 /* SyntaxKind.Constructor */) { + if (!modifiers || declaration.kind !== 173 /* SyntaxKind.Constructor */) { return true; } var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(declaration.parent.symbol); @@ -77613,16 +78283,16 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; default: return ts.Debug.fail(); @@ -77668,7 +78338,7 @@ var ts; // file would probably be preferable. var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 788968 /* SymbolFlags.Type */); var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 788968 /* SymbolFlags.Type */, node); - var declaration = ts.factory.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + var declaration = ts.factory.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); var parameterSymbol = createSymbol(1 /* SymbolFlags.FunctionScopedVariable */, "props"); parameterSymbol.type = result; return createSignature(declaration, @@ -77717,16 +78387,16 @@ var ts; } function resolveSignature(node, candidatesOutArray, checkMode) { switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return resolveCallExpression(node, candidatesOutArray, checkMode); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return resolveNewExpression(node, candidatesOutArray, checkMode); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return resolveDecorator(node, candidatesOutArray, checkMode); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode); } throw ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable."); @@ -77770,12 +78440,15 @@ var ts; return false; } var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node : - ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer : + (ts.isVariableDeclaration(node) || ts.isPropertyAssignment(node)) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer : undefined; if (func) { - // If the node has a @class tag, treat it like a constructor. + // If the node has a @class or @constructor tag, treat it like a constructor. if (ts.getJSDocClassTag(node)) return true; + // If the node is a property of an object literal. + if (ts.isPropertyAssignment(ts.walkUpParenthesizedExpressions(func.parent))) + return false; // If the symbol of the node has members, treat it like a constructor. var symbol = getSymbolOfNode(func); return !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.members) === null || _a === void 0 ? void 0 : _a.size); @@ -77858,7 +78531,7 @@ var ts; return false; } var parent = node.parent; - while (parent && parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (parent && parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { parent = parent.parent; } if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { @@ -77884,12 +78557,12 @@ var ts; if (node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { return voidType; } - if (node.kind === 209 /* SyntaxKind.NewExpression */) { + if (node.kind === 211 /* SyntaxKind.NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 171 /* SyntaxKind.Constructor */ && - declaration.kind !== 175 /* SyntaxKind.ConstructSignature */ && - declaration.kind !== 180 /* SyntaxKind.ConstructorType */ && + declaration.kind !== 173 /* SyntaxKind.Constructor */ && + declaration.kind !== 177 /* SyntaxKind.ConstructSignature */ && + declaration.kind !== 182 /* SyntaxKind.ConstructorType */ && !ts.isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) { // When resolved signature is a call signature (and not a construct signature) the result type is any @@ -77909,7 +78582,7 @@ var ts; if (returnType.flags & 12288 /* TypeFlags.ESSymbolLike */ && isSymbolOrSymbolForCall(node)) { return getESSymbolLikeTypeForNode(ts.walkUpParenthesizedExpressions(node.parent)); } - if (node.kind === 208 /* SyntaxKind.CallExpression */ && !node.questionDotToken && node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && + if (node.kind === 210 /* SyntaxKind.CallExpression */ && !node.questionDotToken && node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && returnType.flags & 16384 /* TypeFlags.Void */ && getTypePredicateOfSignature(signature)) { if (!ts.isDottedName(node.expression)) { error(node.expression, ts.Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name); @@ -77939,20 +78612,20 @@ var ts; function getDeprecatedSuggestionNode(node) { node = ts.skipParentheses(node); switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: - case 165 /* SyntaxKind.Decorator */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 167 /* SyntaxKind.Decorator */: + case 211 /* SyntaxKind.NewExpression */: return getDeprecatedSuggestionNode(node.expression); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return getDeprecatedSuggestionNode(node.tag); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return getDeprecatedSuggestionNode(node.tagName); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return node.argumentExpression; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.name; - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: var typeReference = node; return ts.isQualifiedName(typeReference.typeName) ? typeReference.typeName.right : typeReference; default: @@ -78023,8 +78696,8 @@ var ts; if (hasDefaultOnly && type && !isErrorType(type)) { var synthType = type; if (!synthType.defaultOnlyType) { - var type_5 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); - synthType.defaultOnlyType = type_5; + var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); + synthType.defaultOnlyType = type_4; } return synthType.defaultOnlyType; } @@ -78067,9 +78740,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 /* SymbolFlags.Function */ - ? 256 /* SyntaxKind.FunctionDeclaration */ + ? 259 /* SyntaxKind.FunctionDeclaration */ : resolvedRequire.flags & 3 /* SymbolFlags.Variable */ - ? 254 /* SyntaxKind.VariableDeclaration */ + ? 257 /* SyntaxKind.VariableDeclaration */ : 0 /* SyntaxKind.Unknown */; if (targetDeclarationKind !== 0 /* SyntaxKind.Unknown */) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -78089,7 +78762,7 @@ var ts; return getReturnTypeOfSignature(signature); } function checkAssertion(node) { - if (node.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (node.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { var file = ts.getSourceFileOfNode(node); if (file && ts.fileExtensionIsOneOf(file.fileName, [".cts" /* Extension.Cts */, ".mts" /* Extension.Mts */])) { grammarErrorOnNode(node, ts.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead); @@ -78105,19 +78778,19 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 223 /* SyntaxKind.TemplateExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return true; - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isValidConstAssertionArgument(node.expression); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var op = node.operator; var arg = node.operand; return op === 40 /* SyntaxKind.MinusToken */ && (arg.kind === 8 /* SyntaxKind.NumericLiteral */ || arg.kind === 9 /* SyntaxKind.BigIntLiteral */) || op === 39 /* SyntaxKind.PlusToken */ && arg.kind === 8 /* SyntaxKind.NumericLiteral */; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = node.expression; var symbol = getTypeOfNode(expr).symbol; if (symbol && symbol.flags & 2097152 /* SymbolFlags.Alias */) { @@ -78159,7 +78832,7 @@ var ts; } function checkExpressionWithTypeArguments(node) { checkGrammarExpressionWithTypeArguments(node); - var exprType = node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ ? checkExpression(node.expression) : + var exprType = node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ ? checkExpression(node.expression) : ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName); var typeArguments = node.typeArguments; @@ -78223,6 +78896,16 @@ var ts; }); } } + function checkSatisfiesExpression(node) { + checkSourceElement(node.type); + var targetType = getTypeFromTypeNode(node.type); + if (isErrorType(targetType)) { + return targetType; + } + var exprType = checkExpression(node.expression); + checkTypeAssignableToAndOptionallyElaborate(exprType, targetType, node.type, node.expression, ts.Diagnostics.Type_0_does_not_satisfy_the_expected_type_1); + return exprType; + } function checkMetaProperty(node) { checkGrammarMetaProperty(node); if (node.keywordToken === 103 /* SyntaxKind.NewKeyword */) { @@ -78250,7 +78933,7 @@ var ts; error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); return errorType; } - else if (container.kind === 171 /* SyntaxKind.Constructor */) { + else if (container.kind === 173 /* SyntaxKind.Constructor */) { var symbol = getSymbolOfNode(container.parent); return getTypeOfSymbol(symbol); } @@ -78302,7 +78985,7 @@ var ts; } function getParameterIdentifierNameAtPosition(signature, pos) { var _a; - if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 317 /* SyntaxKind.JSDocFunctionType */) { + if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 320 /* SyntaxKind.JSDocFunctionType */) { return undefined; } var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -78334,7 +79017,7 @@ var ts; return symbol.valueDeclaration && ts.isParameter(symbol.valueDeclaration) && ts.isIdentifier(symbol.valueDeclaration.name); } function isValidDeclarationForTupleLabel(d) { - return d.kind === 197 /* SyntaxKind.NamedTupleMember */ || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name)); + return d.kind === 199 /* SyntaxKind.NamedTupleMember */ || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name)); } function getNameableDeclarationAtPosition(signature, pos) { var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -78626,7 +79309,7 @@ var ts; var yieldType; var nextType; var fallbackReturnType = voidType; - if (func.body.kind !== 235 /* SyntaxKind.Block */) { // Async or normal arrow function + if (func.body.kind !== 238 /* SyntaxKind.Block */) { // Async or normal arrow function returnType = checkExpressionCached(func.body, checkMode && checkMode & ~8 /* CheckMode.SkipGenericFunctions */); if (isAsync) { // From within an async function you can return either a non-promise value or a promise. Any @@ -78778,7 +79461,7 @@ var ts; return links.isExhaustive !== undefined ? links.isExhaustive : (links.isExhaustive = computeExhaustiveSwitchStatement(node)); } function computeExhaustiveSwitchStatement(node) { - if (node.expression.kind === 216 /* SyntaxKind.TypeOfExpression */) { + if (node.expression.kind === 218 /* SyntaxKind.TypeOfExpression */) { var witnesses = getSwitchClauseTypeOfWitnesses(node); if (!witnesses) { return false; @@ -78844,11 +79527,11 @@ var ts; } function mayReturnNever(func) { switch (func.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; - case 169 /* SyntaxKind.MethodDeclaration */: - return func.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + case 171 /* SyntaxKind.MethodDeclaration */: + return func.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; default: return false; } @@ -78874,7 +79557,7 @@ var ts; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. // also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw - if (func.kind === 168 /* SyntaxKind.MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 235 /* SyntaxKind.Block */ || !functionHasImplicitReturn(func)) { + if (func.kind === 170 /* SyntaxKind.MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 238 /* SyntaxKind.Block */ || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 512 /* NodeFlags.HasExplicitReturn */; @@ -78908,7 +79591,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); checkNodeDeferred(node); if (ts.isFunctionExpression(node)) { checkCollisionsForDeclarationName(node, node.name); @@ -78935,7 +79618,7 @@ var ts; } // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (!hasGrammarError && node.kind === 215 /* SyntaxKind.FunctionExpression */) { checkGrammarForGenerator(node); } contextuallyCheckFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -78986,7 +79669,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var functionFlags = ts.getFunctionFlags(node); var returnType = getReturnTypeFromAnnotation(node); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); @@ -78999,7 +79682,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 235 /* SyntaxKind.Block */) { + if (node.body.kind === 238 /* SyntaxKind.Block */) { checkSourceElement(node.body); } else { @@ -79089,7 +79772,7 @@ var ts; expr.expression.kind === 108 /* SyntaxKind.ThisKeyword */) { // Look for if this is the constructor for the class that `symbol` is a property of. var ctor = ts.getContainingFunction(expr); - if (!(ctor && (ctor.kind === 171 /* SyntaxKind.Constructor */ || isJSConstructor(ctor)))) { + if (!(ctor && (ctor.kind === 173 /* SyntaxKind.Constructor */ || isJSConstructor(ctor)))) { return true; } if (symbol.valueDeclaration) { @@ -79114,7 +79797,7 @@ var ts; var symbol_2 = getNodeLinks(node).resolvedSymbol; if (symbol_2.flags & 2097152 /* SymbolFlags.Alias */) { var declaration = getDeclarationOfAliasSymbol(symbol_2); - return !!declaration && declaration.kind === 268 /* SyntaxKind.NamespaceImport */; + return !!declaration && declaration.kind === 271 /* SyntaxKind.NamespaceImport */; } } } @@ -79214,7 +79897,7 @@ var ts; if (!hasParseDiagnostics(sourceFile)) { var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos); var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); - if (container && container.kind !== 171 /* SyntaxKind.Constructor */ && (ts.getFunctionFlags(container) & 2 /* FunctionFlags.Async */) === 0) { + if (container && container.kind !== 173 /* SyntaxKind.Constructor */ && (ts.getFunctionFlags(container) & 2 /* FunctionFlags.Async */) === 0) { var relatedInfo = ts.createDiagnosticForNode(container, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); ts.addRelatedInfo(diagnostic, relatedInfo); } @@ -79382,6 +80065,9 @@ var ts; } return booleanType; } + function hasEmptyObjectIntersection(type) { + return someType(type, function (t) { return t === unknownEmptyObjectType || !!(t.flags & 2097152 /* TypeFlags.Intersection */) && ts.some(t.types, isEmptyAnonymousObjectType); }); + } function checkInExpression(left, right, leftType, rightType) { if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; @@ -79398,40 +80084,20 @@ var ts; } } else { - leftType = checkNonNullType(leftType, left); - // TypeScript 1.0 spec (April 2014): 4.15.5 - // Require the left operand to be of type Any, the String primitive type, or the Number primitive type. - if (!(allTypesAssignableToKind(leftType, 402653316 /* TypeFlags.StringLike */ | 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */) || - isTypeAssignableToKind(leftType, 4194304 /* TypeFlags.Index */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */ | 262144 /* TypeFlags.TypeParameter */))) { - error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol); + // The type of the lef operand must be assignable to string, number, or symbol. + checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left); + } + // The type of the right operand must be assignable to 'object'. + if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) { + // The {} type is assignable to the object type, yet {} might represent a primitive type. Here we + // detect and error on {} that results from narrowing the unknown type, as well as intersections + // that include {} (we know that the other types in such intersections are assignable to object + // since we already checked for that). + if (hasEmptyObjectIntersection(rightType)) { + error(right, ts.Diagnostics.Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator, typeToString(rightType)); } } - rightType = checkNonNullType(rightType, right); - // TypeScript 1.0 spec (April 2014): 4.15.5 - // The in operator requires the right operand to be - // - // 1. assignable to the non-primitive type, - // 2. an unconstrained type parameter, - // 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the - // the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the - // non-primitive type, or - // 4. a type parameter whose constraint is - // i. an object type, - // ii. the non-primitive type, or - // iii. a union or intersection with at least one constituent assignable to an object or non-primitive type. - // - // The divergent behavior for type parameters and unions containing type parameters is a workaround for type - // parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance - // it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error - // unless *all* instantiations would result in an error. - // // The result is always of the Boolean primitive type. - var rightTypeConstraint = getConstraintOfType(rightType); - if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) || - rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) || - !maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) { - error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive); - } return booleanType; } function checkObjectLiteralAssignment(node, sourceType, rightIsThis) { @@ -79449,7 +80115,7 @@ var ts; if (rightIsThis === void 0) { rightIsThis = false; } var properties = node.properties; var property = properties[propertyIndex]; - if (property.kind === 296 /* SyntaxKind.PropertyAssignment */ || property.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (property.kind === 299 /* SyntaxKind.PropertyAssignment */ || property.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var name = property.name; var exprType = getLiteralTypeFromPropertyName(name); if (isTypeUsableAsPropertyName(exprType)) { @@ -79462,9 +80128,9 @@ var ts; } var elementType = getIndexedAccessType(objectLiteralType, exprType, 32 /* AccessFlags.ExpressionPosition */, name); var type = getFlowTypeOfDestructuring(property, elementType); - return checkDestructuringAssignment(property.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? property : property.initializer, type); + return checkDestructuringAssignment(property.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? property : property.initializer, type); } - else if (property.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (property.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (propertyIndex < properties.length - 1) { error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } @@ -79502,7 +80168,7 @@ var ts; var inBoundsType = compilerOptions.noUncheckedIndexedAccess ? undefined : possiblyOutOfBoundsType; for (var i = 0; i < elements.length; i++) { var type = possiblyOutOfBoundsType; - if (node.elements[i].kind === 225 /* SyntaxKind.SpreadElement */) { + if (node.elements[i].kind === 227 /* SyntaxKind.SpreadElement */) { type = inBoundsType = inBoundsType !== null && inBoundsType !== void 0 ? inBoundsType : (checkIteratedTypeOrElementType(65 /* IterationUse.Destructuring */, sourceType, undefinedType, node) || errorType); } checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, type, checkMode); @@ -79512,8 +80178,8 @@ var ts; function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 227 /* SyntaxKind.OmittedExpression */) { - if (element.kind !== 225 /* SyntaxKind.SpreadElement */) { + if (element.kind !== 229 /* SyntaxKind.OmittedExpression */) { + if (element.kind !== 227 /* SyntaxKind.SpreadElement */) { var indexType = getNumberLiteralType(elementIndex); if (isArrayLikeType(sourceType)) { // We create a synthetic expression so that getIndexedAccessType doesn't get confused @@ -79531,7 +80197,7 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 221 /* SyntaxKind.BinaryExpression */ && restExpression.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (restExpression.kind === 223 /* SyntaxKind.BinaryExpression */ && restExpression.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -79547,7 +80213,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode, rightIsThis) { var target; - if (exprOrAssignment.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { // In strict null checking mode, if a default value of a non-undefined type is specified, remove @@ -79563,7 +80229,7 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 221 /* SyntaxKind.BinaryExpression */ && target.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (target.kind === 223 /* SyntaxKind.BinaryExpression */ && target.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { checkBinaryExpression(target, checkMode); target = target.left; // A default value is specified, so remove undefined from the final type. @@ -79571,20 +80237,20 @@ var ts; sourceType = getTypeWithFacts(sourceType, 524288 /* TypeFacts.NEUndefined */); } } - if (target.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (target.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType, rightIsThis); } - if (target.kind === 204 /* SyntaxKind.ArrayLiteralExpression */) { + if (target.kind === 206 /* SyntaxKind.ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, checkMode); } return checkReferenceAssignment(target, sourceType, checkMode); } function checkReferenceAssignment(target, sourceType, checkMode) { var targetType = checkExpression(target, checkMode); - var error = target.parent.kind === 298 /* SyntaxKind.SpreadAssignment */ ? + var error = target.parent.kind === 301 /* SyntaxKind.SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; - var optionalError = target.parent.kind === 298 /* SyntaxKind.SpreadAssignment */ ? + var optionalError = target.parent.kind === 301 /* SyntaxKind.SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access; if (checkReferenceExpression(target, error, optionalError)) { @@ -79609,36 +80275,36 @@ var ts; case 79 /* SyntaxKind.Identifier */: case 10 /* SyntaxKind.StringLiteral */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 223 /* SyntaxKind.TemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 8 /* SyntaxKind.NumericLiteral */: case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 278 /* SyntaxKind.JsxElement */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 281 /* SyntaxKind.JsxElement */: return true; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: // Unary operators ~, !, +, and - have no side effects. // The rest do. switch (node.operator) { @@ -79650,9 +80316,9 @@ var ts; } return false; // Some forms listed here for clarity - case 217 /* SyntaxKind.VoidExpression */: // Explicit opt-out - case 211 /* SyntaxKind.TypeAssertionExpression */: // Not SEF, but can produce useful type warnings - case 229 /* SyntaxKind.AsExpression */: // Not SEF, but can produce useful type warnings + case 219 /* SyntaxKind.VoidExpression */: // Explicit opt-out + case 213 /* SyntaxKind.TypeAssertionExpression */: // Not SEF, but can produce useful type warnings + case 231 /* SyntaxKind.AsExpression */: // Not SEF, but can produce useful type warnings default: return false; } @@ -79689,7 +80355,7 @@ var ts; } checkGrammarNullishCoalesceWithLogicalExpression(node); var operator = node.operatorToken.kind; - if (operator === 63 /* SyntaxKind.EqualsToken */ && (node.left.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || node.left.kind === 204 /* SyntaxKind.ArrayLiteralExpression */)) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && (node.left.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || node.left.kind === 206 /* SyntaxKind.ArrayLiteralExpression */)) { state.skip = true; setLastResult(state, checkDestructuringAssignment(node.left, checkExpression(node.right, checkMode), checkMode, node.right.kind === 108 /* SyntaxKind.ThisKeyword */)); return state; @@ -79711,11 +80377,11 @@ var ts; if (operator === 55 /* SyntaxKind.AmpersandAmpersandToken */ || operator === 56 /* SyntaxKind.BarBarToken */ || operator === 60 /* SyntaxKind.QuestionQuestionToken */) { if (operator === 55 /* SyntaxKind.AmpersandAmpersandToken */) { var parent = node.parent; - while (parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */ + while (parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || ts.isBinaryExpression(parent) && (parent.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || parent.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */)) { parent = parent.parent; } - checkTestingKnownTruthyCallableOrAwaitableType(node.left, ts.isIfStatement(parent) ? parent.thenStatement : undefined); + checkTestingKnownTruthyCallableOrAwaitableType(node.left, leftType, ts.isIfStatement(parent) ? parent.thenStatement : undefined); } checkTruthinessOfType(leftType, node.left); } @@ -79786,7 +80452,7 @@ var ts; // expression-wide checks and does not use a work stack to fold nested binary expressions into the same callstack frame function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { var operator = operatorToken.kind; - if (operator === 63 /* SyntaxKind.EqualsToken */ && (left.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || left.kind === 204 /* SyntaxKind.ArrayLiteralExpression */)) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && (left.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || left.kind === 206 /* SyntaxKind.ArrayLiteralExpression */)) { return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 108 /* SyntaxKind.ThisKeyword */); } var leftType; @@ -79942,6 +80608,7 @@ var ts; var eqType = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */; error(errorNode, ts.Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true"); } + checkNaNEquality(errorNode, operator, left, right); reportOperatorErrorUnless(function (left, right) { return isTypeEqualityComparableTo(left, right) || isTypeEqualityComparableTo(right, left); }); return booleanType; case 102 /* SyntaxKind.InstanceOfKeyword */: @@ -80137,20 +80804,35 @@ var ts; } } function tryGiveBetterPrimaryError(errNode, maybeMissingAwait, leftStr, rightStr) { - var typeName; switch (operatorToken.kind) { case 36 /* SyntaxKind.EqualsEqualsEqualsToken */: case 34 /* SyntaxKind.EqualsEqualsToken */: - typeName = "false"; - break; case 37 /* SyntaxKind.ExclamationEqualsEqualsToken */: case 35 /* SyntaxKind.ExclamationEqualsToken */: - typeName = "true"; + return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap, leftStr, rightStr); + default: + return undefined; } - if (typeName) { - return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap, typeName, leftStr, rightStr); + } + function checkNaNEquality(errorNode, operator, left, right) { + var isLeftNaN = isGlobalNaN(ts.skipParentheses(left)); + var isRightNaN = isGlobalNaN(ts.skipParentheses(right)); + if (isLeftNaN || isRightNaN) { + var err = error(errorNode, ts.Diagnostics.This_condition_will_always_return_0, ts.tokenToString(operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? 95 /* SyntaxKind.FalseKeyword */ : 110 /* SyntaxKind.TrueKeyword */)); + if (isLeftNaN && isRightNaN) + return; + var operatorString = operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ ? ts.tokenToString(53 /* SyntaxKind.ExclamationToken */) : ""; + var location = isLeftNaN ? right : left; + var expression = ts.skipParentheses(location); + ts.addRelatedInfo(err, ts.createDiagnosticForNode(location, ts.Diagnostics.Did_you_mean_0, "".concat(operatorString, "Number.isNaN(").concat(ts.isEntityNameExpression(expression) ? ts.entityNameToString(expression) : "...", ")"))); } - return undefined; + } + function isGlobalNaN(expr) { + if (ts.isIdentifier(expr) && expr.escapedText === "NaN") { + var globalNaNSymbol = getGlobalNaNSymbol(); + return !!globalNaNSymbol && globalNaNSymbol === getResolvedSymbol(expr); + } + return false; } } function getBaseTypesIfUnrelated(leftType, rightType, isRelated) { @@ -80231,8 +80913,8 @@ var ts; } } function checkConditionalExpression(node, checkMode) { - checkTruthinessExpression(node.condition); - checkTestingKnownTruthyCallableOrAwaitableType(node.condition, node.whenTrue); + var type = checkTruthinessExpression(node.condition); + checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue); var type1 = checkExpression(node.whenTrue, checkMode); var type2 = checkExpression(node.whenFalse, checkMode); return getUnionType([type1, type2], 2 /* UnionReduction.Subtype */); @@ -80261,7 +80943,7 @@ var ts; type.flags & 58982400 /* TypeFlags.InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* TypeFlags.StringLike */)); } function getContextNode(node) { - if (node.kind === 286 /* SyntaxKind.JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) { + if (node.kind === 289 /* SyntaxKind.JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) { return node.parent.parent; // Needs to be the root JsxElement, so it encompasses the attributes _and_ the children (which are essentially part of the attributes) } return node; @@ -80315,8 +80997,8 @@ var ts; } function isTypeAssertion(node) { node = ts.skipParentheses(node, /*excludeJSDocTypeAssertions*/ true); - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */ || - node.kind === 229 /* SyntaxKind.AsExpression */ || + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */ || + node.kind === 231 /* SyntaxKind.AsExpression */ || ts.isJSDocTypeAssertion(node); } function checkDeclarationInitializer(declaration, checkMode, contextualType) { @@ -80325,7 +81007,7 @@ var ts; (contextualType ? checkExpressionWithContextualType(initializer, contextualType, /*inferenceContext*/ undefined, checkMode || 0 /* CheckMode.Normal */) : checkExpressionCached(initializer, checkMode)); - return ts.isParameter(declaration) && declaration.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && + return ts.isParameter(declaration) && declaration.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ? padTupleType(type, declaration.name) : type; } @@ -80335,7 +81017,7 @@ var ts; var elementFlags = type.target.elementFlags.slice(); for (var i = getTypeReferenceArity(type); i < patternElements.length; i++) { var e = patternElements[i]; - if (i < patternElements.length - 1 || !(e.kind === 203 /* SyntaxKind.BindingElement */ && e.dotDotDotToken)) { + if (i < patternElements.length - 1 || !(e.kind === 205 /* SyntaxKind.BindingElement */ && e.dotDotDotToken)) { elementTypes.push(!ts.isOmittedExpression(e) && hasDefaultValue(e) ? getTypeFromBindingElement(e, /*includePatternInType*/ false, /*reportErrors*/ false) : anyType); elementFlags.push(2 /* ElementFlags.Optional */); if (!ts.isOmittedExpression(e) && !hasDefaultValue(e)) { @@ -80403,7 +81085,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } return checkExpressionForMutableLocation(node.initializer, checkMode); @@ -80414,7 +81096,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -80657,11 +81339,11 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 161 /* SyntaxKind.QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || - (node.parent.kind === 181 /* SyntaxKind.TypeQuery */ && node.parent.exprName === node)) || - (node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */); // We allow reexporting const enums + var ok = (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 163 /* SyntaxKind.QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || + (node.parent.kind === 183 /* SyntaxKind.TypeQuery */ && node.parent.exprName === node)) || + (node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */); // We allow reexporting const enums if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query); } @@ -80686,9 +81368,9 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } } @@ -80719,80 +81401,82 @@ var ts; return trueType; case 95 /* SyntaxKind.FalseKeyword */: return falseType; - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return checkTemplateExpression(node); case 13 /* SyntaxKind.RegularExpressionLiteral */: return globalRegExpType; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return checkArrayLiteral(node, checkMode, forceTuple); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return checkObjectLiteral(node, checkMode); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return checkPropertyAccessExpression(node, checkMode); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return checkQualifiedName(node, checkMode); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return checkIndexedAccess(node, checkMode); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (node.expression.kind === 100 /* SyntaxKind.ImportKeyword */) { return checkImportCallExpression(node); } // falls through - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return checkCallExpression(node, checkMode); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return checkParenthesizedExpression(node, checkMode); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return checkClassExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return checkTypeOfExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return checkAssertion(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return checkNonNullAssertion(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return checkExpressionWithTypeArguments(node); - case 231 /* SyntaxKind.MetaProperty */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return checkSatisfiesExpression(node); + case 233 /* SyntaxKind.MetaProperty */: return checkMetaProperty(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return checkDeleteExpression(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return checkVoidExpression(node); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return checkAwaitExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return checkBinaryExpression(node, checkMode); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return checkConditionalExpression(node, checkMode); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return checkSpreadExpression(node, checkMode); - case 227 /* SyntaxKind.OmittedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: return undefinedWideningType; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return checkYieldExpression(node); - case 232 /* SyntaxKind.SyntheticExpression */: + case 234 /* SyntaxKind.SyntheticExpression */: return checkSyntheticExpression(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return checkJsxExpression(node, checkMode); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return checkJsxElement(node, checkMode); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return checkJsxSelfClosingElement(node, checkMode); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return checkJsxFragment(node); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return checkJsxAttributes(node, checkMode); - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return errorType; @@ -80851,10 +81535,10 @@ var ts; checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); if (ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */)) { - if (!(func.kind === 171 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 173 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } - if (func.kind === 171 /* SyntaxKind.Constructor */ && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { + if (func.kind === 173 /* SyntaxKind.Constructor */ && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { error(node.name, ts.Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name); } } @@ -80865,13 +81549,13 @@ var ts; if (func.parameters.indexOf(node) !== 0) { error(node, ts.Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText); } - if (func.kind === 171 /* SyntaxKind.Constructor */ || func.kind === 175 /* SyntaxKind.ConstructSignature */ || func.kind === 180 /* SyntaxKind.ConstructorType */) { + if (func.kind === 173 /* SyntaxKind.Constructor */ || func.kind === 177 /* SyntaxKind.ConstructSignature */ || func.kind === 182 /* SyntaxKind.ConstructorType */) { error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); } - if (func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 216 /* SyntaxKind.ArrowFunction */) { error(node, ts.Diagnostics.An_arrow_function_cannot_have_a_this_parameter); } - if (func.kind === 172 /* SyntaxKind.GetAccessor */ || func.kind === 173 /* SyntaxKind.SetAccessor */) { + if (func.kind === 174 /* SyntaxKind.GetAccessor */ || func.kind === 175 /* SyntaxKind.SetAccessor */) { error(node, ts.Diagnostics.get_and_set_accessors_cannot_declare_this_parameters); } } @@ -80929,13 +81613,13 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 174 /* SyntaxKind.CallSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 179 /* SyntaxKind.FunctionType */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 181 /* SyntaxKind.FunctionType */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: var parent = node.parent; if (node === parent.type) { return parent; @@ -80953,7 +81637,7 @@ var ts; error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ || name.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + else if (name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ || name.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } @@ -80962,13 +81646,13 @@ var ts; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 176 /* SyntaxKind.IndexSignature */) { + if (node.kind === 178 /* SyntaxKind.IndexSignature */) { checkGrammarIndexSignature(node); } // TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled - else if (node.kind === 179 /* SyntaxKind.FunctionType */ || node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 180 /* SyntaxKind.ConstructorType */ || - node.kind === 174 /* SyntaxKind.CallSignature */ || node.kind === 171 /* SyntaxKind.Constructor */ || - node.kind === 175 /* SyntaxKind.ConstructSignature */) { + else if (node.kind === 181 /* SyntaxKind.FunctionType */ || node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 182 /* SyntaxKind.ConstructorType */ || + node.kind === 176 /* SyntaxKind.CallSignature */ || node.kind === 173 /* SyntaxKind.Constructor */ || + node.kind === 177 /* SyntaxKind.ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } var functionFlags = ts.getFunctionFlags(node); @@ -81000,10 +81684,10 @@ var ts; var returnTypeNode = ts.getEffectiveReturnTypeNode(node); if (noImplicitAny && !returnTypeNode) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -81033,7 +81717,7 @@ var ts; checkAsyncFunctionReturnType(node, returnTypeNode); } } - if (node.kind !== 176 /* SyntaxKind.IndexSignature */ && node.kind !== 317 /* SyntaxKind.JSDocFunctionType */) { + if (node.kind !== 178 /* SyntaxKind.IndexSignature */ && node.kind !== 320 /* SyntaxKind.JSDocFunctionType */) { registerForUnusedIdentifiersCheck(node); } } @@ -81045,7 +81729,7 @@ var ts; var privateIdentifiers = new ts.Map(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 171 /* SyntaxKind.Constructor */) { + if (member.kind === 173 /* SyntaxKind.Constructor */) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; if (ts.isParameterPropertyDeclaration(param, member) && !ts.isBindingPattern(param.name)) { @@ -81067,16 +81751,16 @@ var ts; var memberName = name && ts.getPropertyNameForPropertyNameNode(name); if (memberName) { switch (member.kind) { - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: addName(names, name, memberName, 1 /* DeclarationMeaning.GetAccessor */ | privateStaticFlags); break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: addName(names, name, memberName, 2 /* DeclarationMeaning.SetAccessor */ | privateStaticFlags); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: addName(names, name, memberName, 3 /* DeclarationMeaning.GetOrSetAccessor */ | privateStaticFlags); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: addName(names, name, memberName, 8 /* DeclarationMeaning.Method */ | privateStaticFlags); break; } @@ -81148,7 +81832,7 @@ var ts; var names = new ts.Map(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 166 /* SyntaxKind.PropertySignature */) { + if (member.kind === 168 /* SyntaxKind.PropertySignature */) { var memberName = void 0; var name = member.name; switch (name.kind) { @@ -81173,7 +81857,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); // in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration // to prevent this run check only for the first declaration of a given kind @@ -81187,7 +81871,7 @@ var ts; var indexSymbol = getIndexSymbol(getSymbolOfNode(node)); if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) { var indexSignatureMap_1 = new ts.Map(); - var _loop_29 = function (declaration) { + var _loop_30 = function (declaration) { if (declaration.parameters.length === 1 && declaration.parameters[0].type) { forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) { var entry = indexSignatureMap_1.get(getTypeId(type)); @@ -81202,7 +81886,7 @@ var ts; }; for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - _loop_29(declaration); + _loop_30(declaration); } indexSignatureMap_1.forEach(function (entry) { if (entry.declarations.length > 1) { @@ -81221,7 +81905,7 @@ var ts; checkVariableLikeDeclaration(node); setNodeLinksForPrivateIdentifierScope(node); // property signatures already report "initializer not allowed in ambient context" elsewhere - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */) && node.kind === 167 /* SyntaxKind.PropertyDeclaration */ && node.initializer) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */) && node.kind === 169 /* SyntaxKind.PropertyDeclaration */ && node.initializer) { error(node, ts.Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } } @@ -81241,7 +81925,7 @@ var ts; // Grammar checking for modifiers is done inside the function checkGrammarFunctionLikeDeclaration checkFunctionOrMethodDeclaration(node); // method signatures already report "implementation not allowed in ambient context" elsewhere - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */) && node.kind === 169 /* SyntaxKind.MethodDeclaration */ && node.body) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */) && node.kind === 171 /* SyntaxKind.MethodDeclaration */ && node.body) { error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } // Private named methods are only allowed in class declarations @@ -81294,7 +81978,7 @@ var ts; if (ts.isPrivateIdentifierClassElementDeclaration(n)) { return true; } - return n.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + return n.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(n) && !!n.initializer; } @@ -81377,7 +82061,7 @@ var ts; checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { if (!(node.flags & 16777216 /* NodeFlags.Ambient */) && ts.nodeIsPresent(node.body) && (node.flags & 256 /* NodeFlags.HasImplicitReturn */)) { if (!(node.flags & 512 /* NodeFlags.HasExplicitReturn */)) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); @@ -81387,20 +82071,20 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } if (hasBindableName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. var symbol = getSymbolOfNode(node); - var getter = ts.getDeclarationOfKind(symbol, 172 /* SyntaxKind.GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 174 /* SyntaxKind.GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */); if (getter && setter && !(getNodeCheckFlags(getter) & 1 /* NodeCheckFlags.TypeChecked */)) { getNodeLinks(getter).flags |= 1 /* NodeCheckFlags.TypeChecked */; var getterFlags = ts.getEffectiveModifierFlags(getter); var setterFlags = ts.getEffectiveModifierFlags(setter); - if ((getterFlags & 128 /* ModifierFlags.Abstract */) !== (setterFlags & 128 /* ModifierFlags.Abstract */)) { + if ((getterFlags & 256 /* ModifierFlags.Abstract */) !== (setterFlags & 256 /* ModifierFlags.Abstract */)) { error(getter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); error(setter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); } @@ -81417,7 +82101,7 @@ var ts; } } var returnType = getTypeOfAccessors(getSymbolOfNode(node)); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } @@ -81426,7 +82110,7 @@ var ts; checkDecorators(node); } function getEffectiveTypeArgumentAtIndex(node, typeParameters, index) { - if (index < typeParameters.length) { + if (node.typeArguments && index < node.typeArguments.length) { return getTypeFromTypeNode(node.typeArguments[index]); } return getEffectiveTypeArguments(node, typeParameters)[index]; @@ -81463,7 +82147,7 @@ var ts; } function checkTypeReferenceNode(node) { checkGrammarTypeArguments(node, node.typeArguments); - if (node.kind === 178 /* SyntaxKind.TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { grammarErrorAtPos(node, node.typeName.jsdocDotPos, 1, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); } ts.forEach(node.typeArguments, checkSourceElement); @@ -81521,7 +82205,7 @@ var ts; var hasNamedElement = ts.some(elementTypes, ts.isNamedTupleMember); for (var _i = 0, elementTypes_1 = elementTypes; _i < elementTypes_1.length; _i++) { var e = elementTypes_1[_i]; - if (e.kind !== 197 /* SyntaxKind.NamedTupleMember */ && hasNamedElement) { + if (e.kind !== 199 /* SyntaxKind.NamedTupleMember */ && hasNamedElement) { grammarErrorOnNode(e, ts.Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names); break; } @@ -81570,7 +82254,7 @@ var ts; var objectType = type.objectType; var indexType = type.indexType; if (isTypeAssignableTo(indexType, getIndexType(objectType, /*stringsOnly*/ false))) { - if (accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && + if (accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && ts.getObjectFlags(objectType) & 32 /* ObjectFlags.Mapped */ && getMappedTypeModifiers(objectType) & 1 /* MappedTypeModifiers.IncludeReadonly */) { error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); } @@ -81635,7 +82319,7 @@ var ts; ts.forEachChild(node, checkSourceElement); } function checkInferType(node) { - if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 189 /* SyntaxKind.ConditionalType */ && n.parent.extendsType === n; })) { + if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 191 /* SyntaxKind.ConditionalType */ && n.parent.extendsType === n; })) { grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type); } checkSourceElement(node.typeParameter); @@ -81645,7 +82329,7 @@ var ts; if (!links.typeParametersChecked) { links.typeParametersChecked = true; var typeParameter = getDeclaredTypeOfTypeParameter(symbol); - var declarations = ts.getDeclarationsOfKind(symbol, 163 /* SyntaxKind.TypeParameter */); + var declarations = ts.getDeclarationsOfKind(symbol, 165 /* SyntaxKind.TypeParameter */); if (!areTypeParametersIdentical(declarations, [typeParameter], function (decl) { return [decl]; })) { // Report an error on every conflicting declaration. var name = symbolToString(symbol); @@ -81686,10 +82370,10 @@ var ts; if (node.dotDotDotToken && node.questionToken) { grammarErrorOnNode(node, ts.Diagnostics.A_tuple_member_cannot_be_both_optional_and_rest); } - if (node.type.kind === 185 /* SyntaxKind.OptionalType */) { + if (node.type.kind === 187 /* SyntaxKind.OptionalType */) { grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type); } - if (node.type.kind === 186 /* SyntaxKind.RestType */) { + if (node.type.kind === 188 /* SyntaxKind.RestType */) { grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type); } checkSourceElement(node.type); @@ -81702,9 +82386,9 @@ var ts; var flags = ts.getCombinedModifierFlags(n); // children of classes (even ambient classes) should not be marked as ambient or export // because those flags have no useful semantics there. - if (n.parent.kind !== 258 /* SyntaxKind.InterfaceDeclaration */ && - n.parent.kind !== 257 /* SyntaxKind.ClassDeclaration */ && - n.parent.kind !== 226 /* SyntaxKind.ClassExpression */ && + if (n.parent.kind !== 261 /* SyntaxKind.InterfaceDeclaration */ && + n.parent.kind !== 260 /* SyntaxKind.ClassDeclaration */ && + n.parent.kind !== 228 /* SyntaxKind.ClassExpression */ && n.flags & 16777216 /* NodeFlags.Ambient */) { if (!(flags & 2 /* ModifierFlags.Ambient */) && !(ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent))) { // It is nested in an ambient context, which means it is automatically exported @@ -81744,7 +82428,7 @@ var ts; else if (deviation & (8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */)) { error(ts.getNameOfDeclaration(o) || o, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } - else if (deviation & 128 /* ModifierFlags.Abstract */) { + else if (deviation & 256 /* ModifierFlags.Abstract */) { error(ts.getNameOfDeclaration(o), ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract); } }); @@ -81761,7 +82445,7 @@ var ts; }); } } - var flagsToCheck = 1 /* ModifierFlags.Export */ | 2 /* ModifierFlags.Ambient */ | 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | 128 /* ModifierFlags.Abstract */; + var flagsToCheck = 1 /* ModifierFlags.Export */ | 2 /* ModifierFlags.Ambient */ | 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | 256 /* ModifierFlags.Abstract */; var someNodeFlags = 0 /* ModifierFlags.None */; var allNodeFlags = flagsToCheck; var someHaveQuestionToken = false; @@ -81800,7 +82484,7 @@ var ts; // Both are literal property names that are the same. ts.isPropertyNameLiteral(node.name) && ts.isPropertyNameLiteral(subsequentName) && ts.getEscapedTextOfIdentifierOrLiteral(node.name) === ts.getEscapedTextOfIdentifierOrLiteral(subsequentName))) { - var reportError = (node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 168 /* SyntaxKind.MethodSignature */) && + var reportError = (node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 170 /* SyntaxKind.MethodSignature */) && ts.isStatic(node) !== ts.isStatic(subsequentNode); // we can get here in two cases // 1. mixed static and instance class members @@ -81825,7 +82509,7 @@ var ts; else { // Report different errors regarding non-consecutive blocks of declarations depending on whether // the node in question is abstract. - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)) { error(errorNode, ts.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive); } else { @@ -81842,7 +82526,7 @@ var ts; var current = declarations_5[_i]; var node = current; var inAmbientContext = node.flags & 16777216 /* NodeFlags.Ambient */; - var inAmbientContextOrInterface = node.parent && (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || node.parent.kind === 182 /* SyntaxKind.TypeLiteral */) || inAmbientContext; + var inAmbientContextOrInterface = node.parent && (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || node.parent.kind === 184 /* SyntaxKind.TypeLiteral */) || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -81853,10 +82537,10 @@ var ts; // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one previousDeclaration = undefined; } - if ((node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */) && !inAmbientContext) { + if ((node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */) && !inAmbientContext) { hasNonAmbientClass = true; } - if (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 168 /* SyntaxKind.MethodSignature */ || node.kind === 171 /* SyntaxKind.Constructor */) { + if (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 170 /* SyntaxKind.MethodSignature */ || node.kind === 173 /* SyntaxKind.Constructor */) { functionDeclarations.push(node); var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; @@ -81901,12 +82585,12 @@ var ts; }); } if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 /* SymbolFlags.Function */ && declarations) { - var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 257 /* SyntaxKind.ClassDeclaration */; }) + var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 260 /* SyntaxKind.ClassDeclaration */; }) .map(function (d) { return ts.createDiagnosticForNode(d, ts.Diagnostics.Consider_adding_a_declare_modifier_to_this_class); }); ts.forEach(declarations, function (declaration) { - var diagnostic = declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ + var diagnostic = declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ ? ts.Diagnostics.Class_declaration_cannot_implement_overload_list_for_0 - : declaration.kind === 256 /* SyntaxKind.FunctionDeclaration */ + : declaration.kind === 259 /* SyntaxKind.FunctionDeclaration */ ? ts.Diagnostics.Function_with_bodies_can_only_merge_with_classes_that_are_ambient : undefined; if (diagnostic) { @@ -81916,7 +82600,7 @@ var ts; } // Abstract methods can't have an implementation -- in particular, they don't need one. if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && - !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 128 /* ModifierFlags.Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) { + !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 256 /* ModifierFlags.Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } if (hasOverloads) { @@ -81962,9 +82646,9 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var d = _a[_i]; var declarationSpaces = getDeclarationSpaces(d); - var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* ModifierFlags.Export */ | 512 /* ModifierFlags.Default */); + var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* ModifierFlags.Export */ | 1024 /* ModifierFlags.Default */); if (effectiveDeclarationFlags & 1 /* ModifierFlags.Export */) { - if (effectiveDeclarationFlags & 512 /* ModifierFlags.Default */) { + if (effectiveDeclarationFlags & 1024 /* ModifierFlags.Default */) { defaultExportedDeclarationSpaces |= declarationSpaces; } else { @@ -81997,26 +82681,26 @@ var ts; function getDeclarationSpaces(decl) { var d = decl; switch (d.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // A jsdoc typedef and callback are, by definition, type aliases. // falls through - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return 2 /* DeclarationSpaces.ExportType */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* ModuleInstanceState.NonInstantiated */ ? 4 /* DeclarationSpaces.ExportNamespace */ | 1 /* DeclarationSpaces.ExportValue */ : 4 /* DeclarationSpaces.ExportNamespace */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: return 2 /* DeclarationSpaces.ExportType */ | 1 /* DeclarationSpaces.ExportValue */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 2 /* DeclarationSpaces.ExportType */ | 1 /* DeclarationSpaces.ExportValue */ | 4 /* DeclarationSpaces.ExportNamespace */; - case 271 /* SyntaxKind.ExportAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: + case 274 /* SyntaxKind.ExportAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: var node_2 = d; var expression = ts.isExportAssignment(node_2) ? node_2.expression : node_2.right; // Export assigned entity name expressions act as aliases and should fall through, otherwise they export values @@ -82026,19 +82710,19 @@ var ts; d = expression; // The below options all declare an Alias, which is allowed to merge with other values within the importing module. // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 267 /* SyntaxKind.ImportClause */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: var result_12 = 0 /* DeclarationSpaces.None */; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_12 |= getDeclarationSpaces(d); }); return result_12; - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 case 79 /* SyntaxKind.Identifier */: // https://github.com/microsoft/TypeScript/issues/36098 // Identifiers are used as declarations of assignment declarations whose parents may be // SyntaxKind.CallExpression - `Object.defineProperty(thing, "aField", {value: 42});` @@ -82451,20 +83135,20 @@ var ts; var headMessage; var expectedReturnType; switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: headMessage = ts.Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any; expectedReturnType = voidType; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); @@ -82523,15 +83207,15 @@ var ts; function getEntityNameForDecoratorMetadata(node) { if (node) { switch (node.kind) { - case 188 /* SyntaxKind.IntersectionType */: - case 187 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: return getEntityNameForDecoratorMetadataFromTypeList(node.types); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]); - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: return getEntityNameForDecoratorMetadata(node.type); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; } } @@ -82540,13 +83224,13 @@ var ts; var commonEntityName; for (var _i = 0, types_21 = types; _i < types_21.length; _i++) { var typeNode = types_21[_i]; - while (typeNode.kind === 191 /* SyntaxKind.ParenthesizedType */ || typeNode.kind === 197 /* SyntaxKind.NamedTupleMember */) { + while (typeNode.kind === 193 /* SyntaxKind.ParenthesizedType */ || typeNode.kind === 199 /* SyntaxKind.NamedTupleMember */) { typeNode = typeNode.type; // Skip parens if need be } - if (typeNode.kind === 143 /* SyntaxKind.NeverKeyword */) { + if (typeNode.kind === 144 /* SyntaxKind.NeverKeyword */) { continue; // Always elide `never` from the union/intersection if possible } - if (!strictNullChecks && (typeNode.kind === 196 /* SyntaxKind.LiteralType */ && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */ || typeNode.kind === 153 /* SyntaxKind.UndefinedKeyword */)) { + if (!strictNullChecks && (typeNode.kind === 198 /* SyntaxKind.LiteralType */ && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */ || typeNode.kind === 155 /* SyntaxKind.UndefinedKeyword */)) { continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks } var individualEntityName = getEntityNameForDecoratorMetadata(typeNode); @@ -82592,14 +83276,14 @@ var ts; return; } checkExternalEmitHelpers(firstDecorator, 8 /* ExternalEmitHelpers.Decorate */); - if (node.kind === 164 /* SyntaxKind.Parameter */) { + if (node.kind === 166 /* SyntaxKind.Parameter */) { checkExternalEmitHelpers(firstDecorator, 32 /* ExternalEmitHelpers.Param */); } if (compilerOptions.emitDecoratorMetadata) { checkExternalEmitHelpers(firstDecorator, 16 /* ExternalEmitHelpers.Metadata */); // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -82608,23 +83292,23 @@ var ts; } } break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - var otherKind = node.kind === 172 /* SyntaxKind.GetAccessor */ ? 173 /* SyntaxKind.SetAccessor */ : 172 /* SyntaxKind.GetAccessor */; + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + var otherKind = node.kind === 174 /* SyntaxKind.GetAccessor */ ? 175 /* SyntaxKind.SetAccessor */ : 174 /* SyntaxKind.GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind); markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor)); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveReturnTypeNode(node)); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveTypeAnnotationNode(node)); break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); var containingSignature = node.parent; for (var _d = 0, _e = containingSignature.parameters; _d < _e.length; _d++) { @@ -82726,7 +83410,7 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.name; default: return undefined; @@ -82740,7 +83424,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name && node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name && node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -82766,7 +83450,7 @@ var ts; checkFunctionOrConstructorSymbol(symbol); } } - var body = node.kind === 168 /* SyntaxKind.MethodSignature */ ? undefined : node.body; + var body = node.kind === 170 /* SyntaxKind.MethodSignature */ ? undefined : node.body; checkSourceElement(body); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, getReturnTypeFromAnnotation(node)); addLazyDiagnostic(checkFunctionOrMethodDeclarationDiagnostics); @@ -82812,42 +83496,42 @@ var ts; for (var _i = 0, potentiallyUnusedIdentifiers_1 = potentiallyUnusedIdentifiers; _i < potentiallyUnusedIdentifiers_1.length; _i++) { var node = potentiallyUnusedIdentifiers_1[_i]; switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: checkUnusedClassMembers(node, addDiagnostic); checkUnusedTypeParameters(node, addDiagnostic); break; - case 305 /* SyntaxKind.SourceFile */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 308 /* SyntaxKind.SourceFile */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: checkUnusedLocalsAndParameters(node, addDiagnostic); break; - case 171 /* SyntaxKind.Constructor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: if (node.body) { // Don't report unused parameters in overloads checkUnusedLocalsAndParameters(node, addDiagnostic); } checkUnusedTypeParameters(node, addDiagnostic); break; - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: checkUnusedTypeParameters(node, addDiagnostic); break; - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: checkUnusedInferTypeParameter(node, addDiagnostic); break; default: @@ -82867,11 +83551,11 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - if (member.kind === 173 /* SyntaxKind.SetAccessor */ && member.symbol.flags & 32768 /* SymbolFlags.GetAccessor */) { + case 171 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + if (member.kind === 175 /* SyntaxKind.SetAccessor */ && member.symbol.flags & 32768 /* SymbolFlags.GetAccessor */) { // Already would have reported an error on the getter. break; } @@ -82882,7 +83566,7 @@ var ts; addDiagnostic(member, 0 /* UnusedKind.Local */, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol))); } break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; if (!parameter.symbol.isReferenced && ts.hasSyntacticModifier(parameter, 8 /* ModifierFlags.Private */)) { @@ -82890,9 +83574,9 @@ var ts; } } break; - case 176 /* SyntaxKind.IndexSignature */: - case 234 /* SyntaxKind.SemicolonClassElement */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: + case 237 /* SyntaxKind.SemicolonClassElement */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // Can't be private break; default: @@ -82920,7 +83604,7 @@ var ts; continue; var name = ts.idText(typeParameter.name); var parent = typeParameter.parent; - if (parent.kind !== 190 /* SyntaxKind.InferType */ && parent.typeParameters.every(isTypeParameterUnused)) { + if (parent.kind !== 192 /* SyntaxKind.InferType */ && parent.typeParameters.every(isTypeParameterUnused)) { if (ts.tryAddToSet(seenParentsWithEveryUnused, parent)) { var sourceFile = ts.getSourceFileOfNode(parent); var range = ts.isJSDocTemplateTag(parent) @@ -83026,7 +83710,7 @@ var ts; var importDecl = importClause.parent; var nDeclarations = (importClause.name ? 1 : 0) + (importClause.namedBindings ? - (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? 1 : importClause.namedBindings.elements.length) + (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? 1 : importClause.namedBindings.elements.length) : 0); if (nDeclarations === unuseds.length) { addDiagnostic(importDecl, 0 /* UnusedKind.Local */, unuseds.length === 1 @@ -83044,7 +83728,7 @@ var ts; var bindingPattern = _a[0], bindingElements = _a[1]; var kind = tryGetRootParameterDeclaration(bindingPattern.parent) ? 1 /* UnusedKind.Parameter */ : 0 /* UnusedKind.Local */; if (bindingPattern.elements.length === bindingElements.length) { - if (bindingElements.length === 1 && bindingPattern.parent.kind === 254 /* SyntaxKind.VariableDeclaration */ && bindingPattern.parent.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (bindingElements.length === 1 && bindingPattern.parent.kind === 257 /* SyntaxKind.VariableDeclaration */ && bindingPattern.parent.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */) { addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId); } else { @@ -83065,7 +83749,7 @@ var ts; if (declarationList.declarations.length === declarations.length) { addDiagnostic(declarationList, 0 /* UnusedKind.Local */, declarations.length === 1 ? ts.createDiagnosticForNode(ts.first(declarations).name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(ts.first(declarations).name)) - : ts.createDiagnosticForNode(declarationList.parent.kind === 237 /* SyntaxKind.VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); + : ts.createDiagnosticForNode(declarationList.parent.kind === 240 /* SyntaxKind.VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); } else { for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { @@ -83095,22 +83779,22 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return ts.idText(name); - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return bindingNameText(ts.cast(ts.first(name.elements), ts.isBindingElement).name); default: return ts.Debug.assertNever(name); } } function isImportedDeclaration(node) { - return node.kind === 267 /* SyntaxKind.ImportClause */ || node.kind === 270 /* SyntaxKind.ImportSpecifier */ || node.kind === 268 /* SyntaxKind.NamespaceImport */; + return node.kind === 270 /* SyntaxKind.ImportClause */ || node.kind === 273 /* SyntaxKind.ImportSpecifier */ || node.kind === 271 /* SyntaxKind.NamespaceImport */; } function importClauseFromImported(decl) { - return decl.kind === 267 /* SyntaxKind.ImportClause */ ? decl : decl.kind === 268 /* SyntaxKind.NamespaceImport */ ? decl.parent : decl.parent.parent; + return decl.kind === 270 /* SyntaxKind.ImportClause */ ? decl : decl.kind === 271 /* SyntaxKind.NamespaceImport */ ? decl.parent : decl.parent.parent; } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 235 /* SyntaxKind.Block */) { + if (node.kind === 238 /* SyntaxKind.Block */) { checkGrammarStatementInAmbientContext(node); } if (ts.isFunctionOrModuleBlock(node)) { @@ -83145,13 +83829,13 @@ var ts; if ((identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) !== name) { return false; } - if (node.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - node.kind === 166 /* SyntaxKind.PropertySignature */ || - node.kind === 169 /* SyntaxKind.MethodDeclaration */ || - node.kind === 168 /* SyntaxKind.MethodSignature */ || - node.kind === 172 /* SyntaxKind.GetAccessor */ || - node.kind === 173 /* SyntaxKind.SetAccessor */ || - node.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (node.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + node.kind === 168 /* SyntaxKind.PropertySignature */ || + node.kind === 171 /* SyntaxKind.MethodDeclaration */ || + node.kind === 170 /* SyntaxKind.MethodSignature */ || + node.kind === 174 /* SyntaxKind.GetAccessor */ || + node.kind === 175 /* SyntaxKind.SetAccessor */ || + node.kind === 299 /* SyntaxKind.PropertyAssignment */) { // it is ok to have member named '_super', '_this', `Promise`, etc. - member access is always qualified return false; } @@ -83217,7 +83901,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -83232,7 +83916,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048 /* NodeFlags.HasAsyncFunctions */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048 /* NodeFlags.HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -83332,7 +84016,7 @@ var ts; // skip variable declarations that don't have initializers // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern // so we'll always treat binding elements as initialized - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ && !node.initializer) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -83344,17 +84028,17 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* SymbolFlags.BlockScopedVariable */) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* NodeFlags.BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); - var container = varDeclList.parent.kind === 237 /* SyntaxKind.VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); + var container = varDeclList.parent.kind === 240 /* SyntaxKind.VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; // names of block-scoped and function scoped variables can collide only // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) var namesShareScope = container && - (container.kind === 235 /* SyntaxKind.Block */ && ts.isFunctionLike(container.parent) || - container.kind === 262 /* SyntaxKind.ModuleBlock */ || - container.kind === 261 /* SyntaxKind.ModuleDeclaration */ || - container.kind === 305 /* SyntaxKind.SourceFile */); + (container.kind === 238 /* SyntaxKind.Block */ && ts.isFunctionLike(container.parent) || + container.kind === 265 /* SyntaxKind.ModuleBlock */ || + container.kind === 264 /* SyntaxKind.ModuleDeclaration */ || + container.kind === 308 /* SyntaxKind.SourceFile */); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error // otherwise if variable has an initializer - show error that initialization will fail @@ -83385,7 +84069,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); if (ts.hasOnlyExpressionInitializer(node) && node.initializer) { checkExpressionCached(node.initializer); @@ -83407,7 +84091,7 @@ var ts; checkExternalEmitHelpers(node, 4 /* ExternalEmitHelpers.Rest */); } // check computed properties inside property names of binding elements - if (node.propertyName && node.propertyName.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.propertyName && node.propertyName.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.propertyName); } // check private/protected variable access @@ -83429,7 +84113,7 @@ var ts; } // For a binding pattern, check contained binding elements if (ts.isBindingPattern(node.name)) { - if (node.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && languageVersion < 2 /* ScriptTarget.ES2015 */ && compilerOptions.downlevelIteration) { + if (node.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && languageVersion < 2 /* ScriptTarget.ES2015 */ && compilerOptions.downlevelIteration) { checkExternalEmitHelpers(node, 512 /* ExternalEmitHelpers.Read */); } ts.forEach(node.name.elements, checkSourceElement); @@ -83441,7 +84125,7 @@ var ts; } // For a binding pattern, validate the initializer and exit if (ts.isBindingPattern(node.name)) { - var needCheckInitializer = ts.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */; + var needCheckInitializer = ts.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */; var needCheckWidenedType = !ts.some(node.name.elements, ts.not(ts.isOmittedExpression)); if (needCheckInitializer || needCheckWidenedType) { // Don't validate for-in initializer as it is already an error @@ -83469,7 +84153,7 @@ var ts; } // For a commonjs `const x = require`, validate the alias and exit var symbol = getSymbolOfNode(node); - if (symbol.flags & 2097152 /* SymbolFlags.Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 203 /* SyntaxKind.BindingElement */ ? node.parent.parent : node)) { + if (symbol.flags & 2097152 /* SymbolFlags.Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 205 /* SyntaxKind.BindingElement */ ? node.parent.parent : node)) { checkAliasSymbol(node); return; } @@ -83483,7 +84167,7 @@ var ts; ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || ts.isPrototypeAccess(node.name)) && !!((_a = symbol.exports) === null || _a === void 0 ? void 0 : _a.size); - if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */) { + if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */) { checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(initializer), type, node, initializer, /*headMessage*/ undefined); } } @@ -83509,10 +84193,10 @@ var ts; error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name)); } } - if (node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 166 /* SyntaxKind.PropertySignature */) { + if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 168 /* SyntaxKind.PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionsForDeclarationName(node, node.name); @@ -83520,7 +84204,7 @@ var ts; } function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) { var nextDeclarationName = ts.getNameOfDeclaration(nextDeclaration); - var message = nextDeclaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ || nextDeclaration.kind === 166 /* SyntaxKind.PropertySignature */ + var message = nextDeclaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ || nextDeclaration.kind === 168 /* SyntaxKind.PropertySignature */ ? ts.Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2 : ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2; var declName = ts.declarationNameToString(nextDeclarationName); @@ -83530,8 +84214,8 @@ var ts; } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 164 /* SyntaxKind.Parameter */ && right.kind === 254 /* SyntaxKind.VariableDeclaration */) || - (left.kind === 254 /* SyntaxKind.VariableDeclaration */ && right.kind === 164 /* SyntaxKind.Parameter */)) { + if ((left.kind === 166 /* SyntaxKind.Parameter */ && right.kind === 257 /* SyntaxKind.VariableDeclaration */) || + (left.kind === 257 /* SyntaxKind.VariableDeclaration */ && right.kind === 166 /* SyntaxKind.Parameter */)) { // Differences in optionality between parameters and variables are allowed. return true; } @@ -83540,8 +84224,8 @@ var ts; } var interestingFlags = 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | - 256 /* ModifierFlags.Async */ | - 128 /* ModifierFlags.Abstract */ | + 512 /* ModifierFlags.Async */ | + 256 /* ModifierFlags.Abstract */ | 64 /* ModifierFlags.Readonly */ | 32 /* ModifierFlags.Static */; return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags); @@ -83570,15 +84254,15 @@ var ts; function checkIfStatement(node) { // Grammar checking checkGrammarStatementInAmbientContext(node); - checkTruthinessExpression(node.expression); - checkTestingKnownTruthyCallableOrAwaitableType(node.expression, node.thenStatement); + var type = checkTruthinessExpression(node.expression); + checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 236 /* SyntaxKind.EmptyStatement */) { + if (node.thenStatement.kind === 239 /* SyntaxKind.EmptyStatement */) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); } - function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, body) { + function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, condType, body) { if (!strictNullChecks) return; helper(condExpr, body); @@ -83593,7 +84277,7 @@ var ts; : condExpr; if (ts.isModuleExportsAccessExpression(location)) return; - var type = checkTruthinessExpression(location); + var type = location === condExpr ? condType : checkTruthinessExpression(location); var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression); if (!(getTypeFacts(type) & 4194304 /* TypeFacts.Truthy */) || isPropertyExpressionCast) return; @@ -83707,12 +84391,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -83752,14 +84436,14 @@ var ts; // via checkRightHandSideOfForOf. // If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference. // Then check that the RHS is assignable to it. - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node); // There may be a destructuring assignment on the left side - if (varExpr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (varExpr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // iteratedType may be undefined. In this case, we still want to check the structure of // varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like // to short circuit the type relation checking as much as possible, so we pass the unknownType. @@ -83791,7 +84475,7 @@ var ts; // for (let VarDecl in Expr) Statement // VarDecl must be a variable declaration without a type annotation that declares a variable of type Any, // and Expr must be an expression of type Any, an object type, or a type parameter type. - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -83805,7 +84489,7 @@ var ts; // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (varExpr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { @@ -84605,12 +85289,12 @@ var ts; var functionFlags = ts.getFunctionFlags(container); if (strictNullChecks || node.expression || returnType.flags & 131072 /* TypeFlags.Never */) { var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; - if (container.kind === 173 /* SyntaxKind.SetAccessor */) { + if (container.kind === 175 /* SyntaxKind.SetAccessor */) { if (node.expression) { error(node, ts.Diagnostics.Setters_cannot_return_a_value); } } - else if (container.kind === 171 /* SyntaxKind.Constructor */) { + else if (container.kind === 173 /* SyntaxKind.Constructor */) { if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) { error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -84628,7 +85312,7 @@ var ts; } } } - else if (container.kind !== 171 /* SyntaxKind.Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { + else if (container.kind !== 173 /* SyntaxKind.Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { // The function has a return type, but the return statement doesn't have an expression. error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); } @@ -84657,7 +85341,7 @@ var ts; var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 290 /* SyntaxKind.DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 293 /* SyntaxKind.DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -84666,7 +85350,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { addLazyDiagnostic(createLazyCaseClauseDiagnostics(clause)); } ts.forEach(clause.statements, checkSourceElement); @@ -84703,7 +85387,7 @@ var ts; if (ts.isFunctionLike(current)) { return "quit"; } - if (current.kind === 250 /* SyntaxKind.LabeledStatement */ && current.label.escapedText === node.label.escapedText) { + if (current.kind === 253 /* SyntaxKind.LabeledStatement */ && current.label.escapedText === node.label.escapedText) { grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label)); return true; } @@ -84798,11 +85482,11 @@ var ts; return; } var indexInfos = getApplicableIndexInfos(type, propNameType); - var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* SyntaxKind.InterfaceDeclaration */) : undefined; - var propDeclaration = declaration && declaration.kind === 221 /* SyntaxKind.BinaryExpression */ || - name && name.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined; + var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined; + var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ || + name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined; var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined; - var _loop_30 = function (info) { + var _loop_31 = function (info) { var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined; // We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared // in the containing type, or (c) the containing type is an interface and no base interface contains both the property and @@ -84819,15 +85503,15 @@ var ts; }; for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) { var info = indexInfos_9[_i]; - _loop_30(info); + _loop_31(info); } } function checkIndexConstraintForIndexSignature(type, checkInfo) { var declaration = checkInfo.declaration; var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType); - var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* SyntaxKind.InterfaceDeclaration */) : undefined; + var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined; var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined; - var _loop_31 = function (info) { + var _loop_32 = function (info) { if (info === checkInfo) return "continue"; var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined; @@ -84842,7 +85526,7 @@ var ts; }; for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) { var info = indexInfos_10[_i]; - _loop_31(info); + _loop_32(info); } } function checkTypeNameIsReserved(name, message) { @@ -84945,7 +85629,7 @@ var ts; function checkTypeParametersNotReferenced(root, typeParameters, index) { visit(root); function visit(node) { - if (node.kind === 178 /* SyntaxKind.TypeReference */) { + if (node.kind === 180 /* SyntaxKind.TypeReference */) { var type = getTypeFromTypeReference(node); if (type.flags & 262144 /* TypeFlags.TypeParameter */) { for (var i = index; i < typeParameters.length; i++) { @@ -85035,7 +85719,7 @@ var ts; if (firstDecorator && ts.some(node.members, function (p) { return ts.hasStaticModifier(p) && ts.isPrivateIdentifierClassElementDeclaration(p); })) { grammarErrorOnNode(firstDecorator, ts.Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator); } - if (!node.name && !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (!node.name && !ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); } checkClassLikeDeclaration(node); @@ -85102,7 +85786,7 @@ var ts; } else { var constructSignatures = getSignaturesOfType(baseConstructorType, 1 /* SignatureKind.Construct */); - if (constructSignatures.some(function (signature) { return signature.flags & 4 /* SignatureFlags.Abstract */; }) && !ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)) { + if (constructSignatures.some(function (signature) { return signature.flags & 4 /* SignatureFlags.Abstract */; }) && !ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)) { error(node.name || node, ts.Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract); } } @@ -85162,7 +85846,7 @@ var ts; var baseTypes = baseTypeNode && getBaseTypes(type); var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined; var baseStaticType = getBaseConstructorTypeOfClass(type); - var _loop_32 = function (member) { + var _loop_33 = function (member) { if (ts.hasAmbientModifier(member)) { return "continue"; } @@ -85179,7 +85863,7 @@ var ts; }; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - _loop_32(member); + _loop_33(member); } } /** @@ -85267,7 +85951,7 @@ var ts; function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) { // iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible var issuedMemberError = false; - var _loop_33 = function (member) { + var _loop_34 = function (member) { if (ts.isStatic(member)) { return "continue"; } @@ -85286,7 +85970,7 @@ var ts; }; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - _loop_33(member); + _loop_34(member); } if (!issuedMemberError) { // check again with diagnostics to generate a less-specific error @@ -85337,7 +86021,7 @@ var ts; } function getClassOrInterfaceDeclarationsOfSymbol(symbol) { return ts.filter(symbol.declarations, function (d) { - return d.kind === 257 /* SyntaxKind.ClassDeclaration */ || d.kind === 258 /* SyntaxKind.InterfaceDeclaration */; + return d.kind === 260 /* SyntaxKind.ClassDeclaration */ || d.kind === 261 /* SyntaxKind.InterfaceDeclaration */; }); } function checkKindsOfPropertyMemberOverrides(type, baseType) { @@ -85357,7 +86041,7 @@ var ts; var _a, _b, _c, _d; // NOTE: assignability is checked in checkClassDeclaration var baseProperties = getPropertiesOfType(baseType); - var _loop_34 = function (baseProperty) { + var _loop_35 = function (baseProperty) { var base = getTargetSymbol(baseProperty); if (base.flags & 4194304 /* SymbolFlags.Prototype */) { return "continue"; @@ -85378,7 +86062,7 @@ var ts; // It is an error to inherit an abstract member without implementing it or being declared abstract. // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. - if (baseDeclarationFlags & 128 /* ModifierFlags.Abstract */ && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 128 /* ModifierFlags.Abstract */))) { + if (baseDeclarationFlags & 256 /* ModifierFlags.Abstract */ && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 256 /* ModifierFlags.Abstract */))) { // Searches other base types for a declaration that would satisfy the inherited abstract member. // (The class may have more than one base type via declaration merging with an interface with the // same name.) @@ -85392,7 +86076,7 @@ var ts; return "continue-basePropertyCheck"; } } - if (derivedClassDecl.kind === 226 /* SyntaxKind.ClassExpression */) { + if (derivedClassDecl.kind === 228 /* SyntaxKind.ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -85427,11 +86111,11 @@ var ts; error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_1, symbolToString(base), typeToString(baseType), typeToString(type)); } else if (useDefineForClassFields) { - var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !d.initializer; }); + var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !d.initializer; }); if (uninitialized && !(derived.flags & 33554432 /* SymbolFlags.Transient */) - && !(baseDeclarationFlags & 128 /* ModifierFlags.Abstract */) - && !(derivedDeclarationFlags & 128 /* ModifierFlags.Abstract */) + && !(baseDeclarationFlags & 256 /* ModifierFlags.Abstract */) + && !(derivedDeclarationFlags & 256 /* ModifierFlags.Abstract */) && !((_d = derived.declarations) === null || _d === void 0 ? void 0 : _d.some(function (d) { return !!(d.flags & 16777216 /* NodeFlags.Ambient */); }))) { var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol)); var propName = uninitialized.name; @@ -85467,14 +86151,14 @@ var ts; }; basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) { var baseProperty = baseProperties_1[_i]; - var state_10 = _loop_34(baseProperty); - switch (state_10) { + var state_11 = _loop_35(baseProperty); + switch (state_11) { case "continue-basePropertyCheck": continue basePropertyCheck; } } } function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) { - return baseDeclarationFlags & 128 /* ModifierFlags.Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer) + return baseDeclarationFlags & 256 /* ModifierFlags.Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer) || ts.isInterfaceDeclaration(declaration.parent); } function getNonInheritedProperties(type, baseTypes, properties) { @@ -85556,7 +86240,7 @@ var ts; } } function isPropertyWithoutInitializer(node) { - return node.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + return node.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.hasAbstractModifier(node) && !node.exclamationToken && !node.initializer; @@ -85599,7 +86283,7 @@ var ts; var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(symbol); // Only check this symbol once - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 258 /* SyntaxKind.InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.InterfaceDeclaration */); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -85632,7 +86316,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0); checkExportsOnMergedDeclarations(node); checkTypeParameters(node.typeParameters); - if (node.type.kind === 138 /* SyntaxKind.IntrinsicKeyword */) { + if (node.type.kind === 139 /* SyntaxKind.IntrinsicKeyword */) { if (!intrinsicTypeKinds.has(node.name.escapedText) || ts.length(node.typeParameters) !== 1) { error(node.type, ts.Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types); } @@ -85718,7 +86402,7 @@ var ts; return value; function evaluate(expr) { switch (expr.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var value_2 = evaluate(expr.operand); if (typeof value_2 === "number") { switch (expr.operator) { @@ -85728,7 +86412,7 @@ var ts; } } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var left = evaluate(expr.left); var right = evaluate(expr.right); if (typeof left === "number" && typeof right === "number") { @@ -85757,7 +86441,7 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: checkGrammarNumericLiteral(expr); return +expr.text; - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return evaluate(expr.expression); case 79 /* SyntaxKind.Identifier */: var identifier = expr; @@ -85765,13 +86449,13 @@ var ts; return +(identifier.escapedText); } return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText); - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (isConstantMemberAccess(expr)) { var type = getTypeOfExpression(expr.expression); if (type.symbol && type.symbol.flags & 384 /* SymbolFlags.Enum */) { var name = void 0; - if (expr.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (expr.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { name = expr.name.escapedText; } else { @@ -85808,8 +86492,8 @@ var ts; return false; } return node.kind === 79 /* SyntaxKind.Identifier */ || - node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || - node.kind === 207 /* SyntaxKind.ElementAccessExpression */ && isConstantMemberAccess(node.expression) && + node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || + node.kind === 209 /* SyntaxKind.ElementAccessExpression */ && isConstantMemberAccess(node.expression) && ts.isStringLiteralLike(node.argumentExpression); } function checkEnumDeclaration(node) { @@ -85843,7 +86527,7 @@ var ts; var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind !== 263 /* SyntaxKind.EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -85872,8 +86556,8 @@ var ts; if (declarations) { for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { var declaration = declarations_9[_i]; - if ((declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ || - (declaration.kind === 256 /* SyntaxKind.FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ || + (declaration.kind === 259 /* SyntaxKind.FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { return declaration; } @@ -85944,7 +86628,7 @@ var ts; } // if the module merges with a class declaration in the same lexical scope, // we need to track this to ensure the correct emit. - var mergedClass = ts.getDeclarationOfKind(symbol, 257 /* SyntaxKind.ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 260 /* SyntaxKind.ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* NodeCheckFlags.LexicalModuleMergesWithClass */; @@ -85989,23 +86673,23 @@ var ts; function checkModuleAugmentationElement(node, isGlobalAugmentation) { var _a; switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // error each individual name in variable statement instead of marking the entire variable statement for (var _i = 0, _b = node.declarationList.declarations; _i < _b.length; _i++) { var decl = _b[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 203 /* SyntaxKind.BindingElement */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: var name = node.name; if (ts.isBindingPattern(name)) { for (var _c = 0, _d = name.elements; _c < _d.length; _c++) { @@ -86016,12 +86700,12 @@ var ts; break; } // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: if (isGlobalAugmentation) { return; } @@ -86044,12 +86728,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.left; } while (node.kind !== 79 /* SyntaxKind.Identifier */); return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: do { if (ts.isModuleExportsAccessExpression(node.expression) && !ts.isPrivateIdentifier(node.name)) { return node.name; @@ -86069,9 +86753,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 305 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 272 /* SyntaxKind.ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 308 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 275 /* SyntaxKind.ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -86118,8 +86802,8 @@ var ts; var errorNode = ts.isImportOrExportSpecifier(node) ? node.propertyName || node.name : ts.isNamedDeclaration(node) ? node.name : node; - ts.Debug.assert(node.kind !== 274 /* SyntaxKind.NamespaceExport */); - if (node.kind === 275 /* SyntaxKind.ExportSpecifier */) { + ts.Debug.assert(node.kind !== 277 /* SyntaxKind.NamespaceExport */); + if (node.kind === 278 /* SyntaxKind.ExportSpecifier */) { var diag = error(errorNode, ts.Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files); var alreadyExportedSymbol = (_b = (_a = ts.getSourceFileOfNode(node).symbol) === null || _a === void 0 ? void 0 : _a.exports) === null || _b === void 0 ? void 0 : _b.get((node.propertyName || node.name).escapedText); if (alreadyExportedSymbol === target) { @@ -86130,7 +86814,7 @@ var ts; } } else { - ts.Debug.assert(node.kind !== 254 /* SyntaxKind.VariableDeclaration */); + ts.Debug.assert(node.kind !== 257 /* SyntaxKind.VariableDeclaration */); var importDeclaration = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)); var moduleSpecifier = (_e = (importDeclaration && ((_d = ts.tryGetModuleSpecifierFromDeclaration(importDeclaration)) === null || _d === void 0 ? void 0 : _d.text))) !== null && _e !== void 0 ? _e : "..."; var importedIdentifier = ts.unescapeLeadingUnderscores(ts.isIdentifier(errorNode) ? errorNode.escapedText : symbol.escapedName); @@ -86142,7 +86826,7 @@ var ts; (symbol.flags & 788968 /* SymbolFlags.Type */ ? 788968 /* SymbolFlags.Type */ : 0) | (symbol.flags & 1920 /* SymbolFlags.Namespace */ ? 1920 /* SymbolFlags.Namespace */ : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 275 /* SyntaxKind.ExportSpecifier */ ? + var message = node.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -86154,23 +86838,23 @@ var ts; var isType = !(target.flags & 111551 /* SymbolFlags.Value */); if (isType || typeOnlyAlias) { switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { if (compilerOptions.preserveValueImports) { ts.Debug.assertIsDefined(node.name, "An ImportClause with a symbol should have a name"); var message = isType ? ts.Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled : ts.Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled; - var name = ts.idText(node.kind === 270 /* SyntaxKind.ImportSpecifier */ ? node.propertyName || node.name : node.name); + var name = ts.idText(node.kind === 273 /* SyntaxKind.ImportSpecifier */ ? node.propertyName || node.name : node.name); addTypeOnlyDeclarationRelatedInfo(error(node, message, name), isType ? undefined : typeOnlyAlias, name); } - if (isType && node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && ts.hasEffectiveModifier(node, 1 /* ModifierFlags.Export */)) { + if (isType && node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && ts.hasEffectiveModifier(node, 1 /* ModifierFlags.Export */)) { error(node, ts.Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided); } break; } - case 275 /* SyntaxKind.ExportSpecifier */: { + case 278 /* SyntaxKind.ExportSpecifier */: { // Don't allow re-exporting an export that will be elided when `--isolatedModules` is set. // The exception is that `import type { A } from './a'; export { A }` is allowed // because single-file analysis can determine that the export should be dropped. @@ -86229,7 +86913,7 @@ var ts; function checkImportBinding(node) { checkCollisionsForDeclarationName(node, node.name); checkAliasSymbol(node); - if (node.kind === 270 /* SyntaxKind.ImportSpecifier */ && + if (node.kind === 273 /* SyntaxKind.ImportSpecifier */ && ts.idText(node.propertyName || node.name) === "default" && ts.getESModuleInterop(compilerOptions) && moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) { @@ -86279,7 +86963,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { checkImportBinding(importClause.namedBindings); if (moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) && ts.getESModuleInterop(compilerOptions)) { // import * as ns from "foo"; @@ -86308,7 +86992,7 @@ var ts; if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { markExportAsReferenced(node); } - if (node.moduleReference.kind !== 277 /* SyntaxKind.ExternalModuleReference */) { + if (node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */) { var target = resolveAlias(getSymbolOfNode(node)); if (target !== unknownSymbol) { if (target.flags & 111551 /* SymbolFlags.Value */) { @@ -86351,10 +87035,10 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && + var inAmbientExternalModule = node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && !node.moduleSpecifier && node.flags & 16777216 /* NodeFlags.Ambient */; - if (node.parent.kind !== 305 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + if (node.parent.kind !== 308 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -86389,7 +87073,7 @@ var ts; function checkGrammarExportDeclaration(node) { var _a; if (node.isTypeOnly) { - if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 273 /* SyntaxKind.NamedExports */) { + if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 276 /* SyntaxKind.NamedExports */) { return checkGrammarNamedImportsOrExports(node.exportClause); } else { @@ -86399,7 +87083,7 @@ var ts; return false; } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 305 /* SyntaxKind.SourceFile */ || node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */; + var isInAppropriateContext = node.parent.kind === 308 /* SyntaxKind.SourceFile */ || node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -86479,8 +87163,8 @@ var ts; // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors. return; } - var container = node.parent.kind === 305 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 261 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 308 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); } @@ -86612,181 +87296,181 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } - if (kind >= 237 /* SyntaxKind.FirstStatement */ && kind <= 253 /* SyntaxKind.LastStatement */ && node.flowNode && !isReachableFlowNode(node.flowNode)) { + if (kind >= 240 /* SyntaxKind.FirstStatement */ && kind <= 256 /* SyntaxKind.LastStatement */ && node.flowNode && !isReachableFlowNode(node.flowNode)) { errorOrSuggestion(compilerOptions.allowUnreachableCode === false, node, ts.Diagnostics.Unreachable_code_detected); } switch (kind) { - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return checkTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return checkParameter(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return checkPropertyDeclaration(node); - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return checkPropertySignature(node); - case 180 /* SyntaxKind.ConstructorType */: - case 179 /* SyntaxKind.FunctionType */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return checkSignatureDeclaration(node); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return checkMethodDeclaration(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return checkClassStaticBlockDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return checkConstructorDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return checkAccessorDeclaration(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return checkTypeReferenceNode(node); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return checkTypePredicate(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return checkTypeQuery(node); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return checkTypeLiteral(node); - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return checkArrayType(node); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return checkTupleType(node); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return checkUnionOrIntersectionType(node); - case 191 /* SyntaxKind.ParenthesizedType */: - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 187 /* SyntaxKind.OptionalType */: + case 188 /* SyntaxKind.RestType */: return checkSourceElement(node.type); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return checkThisType(node); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return checkTypeOperator(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return checkConditionalType(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return checkInferType(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return checkTemplateLiteralType(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return checkImportType(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return checkNamedTupleMember(node); - case 328 /* SyntaxKind.JSDocAugmentsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: return checkJSDocAugmentsTag(node); - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return checkJSDocImplementsTag(node); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return checkJSDocTypeAliasTag(node); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return checkJSDocTemplateTag(node); - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return checkJSDocTypeTag(node); - case 324 /* SyntaxKind.JSDocLink */: - case 325 /* SyntaxKind.JSDocLinkCode */: - case 326 /* SyntaxKind.JSDocLinkPlain */: + case 327 /* SyntaxKind.JSDocLink */: + case 328 /* SyntaxKind.JSDocLinkCode */: + case 329 /* SyntaxKind.JSDocLinkPlain */: return checkJSDocLinkLikeTag(node); - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return checkJSDocParameterTag(node); - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return checkJSDocPropertyTag(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: checkJSDocFunctionType(node); // falls through - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: checkJSDocTypeIsInJsFile(node); ts.forEachChild(node, checkSourceElement); return; - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: checkJSDocVariadicType(node); return; - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return checkSourceElement(node.type); - case 333 /* SyntaxKind.JSDocPublicTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: + case 336 /* SyntaxKind.JSDocPublicTag */: + case 338 /* SyntaxKind.JSDocProtectedTag */: + case 337 /* SyntaxKind.JSDocPrivateTag */: return checkJSDocAccessibilityModifiers(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return checkIndexedAccessType(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return checkMappedType(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return checkFunctionDeclaration(node); - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: return checkBlock(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return checkVariableStatement(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return checkExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return checkIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return checkDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return checkWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return checkForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return checkForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return checkForOfStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: return checkBreakOrContinueStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return checkReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return checkWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return checkSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return checkLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return checkThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return checkTryStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checkVariableDeclaration(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return checkBindingElement(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return checkClassDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return checkEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return checkModuleDeclaration(node); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return checkImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return checkExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return checkExportAssignment(node); - case 236 /* SyntaxKind.EmptyStatement */: - case 253 /* SyntaxKind.DebuggerStatement */: + case 239 /* SyntaxKind.EmptyStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 276 /* SyntaxKind.MissingDeclaration */: + case 279 /* SyntaxKind.MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -86893,36 +87577,36 @@ var ts; currentNode = node; instantiationCount = 0; switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 165 /* SyntaxKind.Decorator */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 167 /* SyntaxKind.Decorator */: + case 283 /* SyntaxKind.JsxOpeningElement */: // These node kinds are deferred checked when overload resolution fails // To save on work, we ensure the arguments are checked just once, in // a deferred way resolveUntypedCall(node); break; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: checkAccessorDeclaration(node); break; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: checkClassExpressionDeferred(node); break; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: checkTypeParameterDeferred(node); break; - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: checkJsxSelfClosingElementDeferred(node); break; - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: checkJsxElementDeferred(node); break; } @@ -87095,17 +87779,17 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalModule(location)) break; // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: copyLocallyVisibleExportSymbols(getSymbolOfNode(location).exports, meaning & 2623475 /* SymbolFlags.ModuleMember */); break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* SymbolFlags.EnumMember */); break; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: var className = location.name; if (className) { copySymbol(location.symbol, meaning); @@ -87113,8 +87797,8 @@ var ts; // this fall-through is necessary because we would like to handle // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration. // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // If we didn't come from static member of class or interface, // add the type parameters into the symbol table // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol. @@ -87123,7 +87807,7 @@ var ts; copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 788968 /* SymbolFlags.Type */); } break; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -87167,7 +87851,7 @@ var ts; if (meaning) { source.forEach(function (symbol) { // Similar condition as in `resolveNameHelper` - if (!ts.getDeclarationOfKind(symbol, 275 /* SyntaxKind.ExportSpecifier */) && !ts.getDeclarationOfKind(symbol, 274 /* SyntaxKind.NamespaceExport */)) { + if (!ts.getDeclarationOfKind(symbol, 278 /* SyntaxKind.ExportSpecifier */) && !ts.getDeclarationOfKind(symbol, 277 /* SyntaxKind.NamespaceExport */)) { copySymbol(symbol, meaning); } }); @@ -87181,19 +87865,19 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 163 /* SyntaxKind.TypeParameter */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 165 /* SyntaxKind.TypeParameter */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return true; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return node.isTypeOnly; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.isTypeOnly; default: return false; @@ -87201,16 +87885,16 @@ var ts; } // True if the given identifier is part of a type reference function isTypeReferenceIdentifier(node) { - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } - return node.parent.kind === 178 /* SyntaxKind.TypeReference */; + return node.parent.kind === 180 /* SyntaxKind.TypeReference */; } function isHeritageClauseElementIdentifier(node) { - while (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { node = node.parent; } - return node.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } function forEachEnclosingClass(node, callback) { var result; @@ -87238,13 +87922,13 @@ var ts; return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (nodeOnRightSide.parent.kind === 163 /* SyntaxKind.QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } - if (nodeOnRightSide.parent.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 274 /* SyntaxKind.ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } return undefined; @@ -87270,7 +87954,7 @@ var ts; node = parent; parent = parent.parent; } - if (parent && parent.kind === 200 /* SyntaxKind.ImportType */ && parent.qualifier === node) { + if (parent && parent.kind === 202 /* SyntaxKind.ImportType */ && parent.qualifier === node) { return parent; } return undefined; @@ -87280,7 +87964,7 @@ var ts; return getSymbolOfNode(name.parent); } if (ts.isInJSFile(name) && - name.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + name.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && name.parent === name.parent.parent.left) { // Check if this is a special property assignment if (!ts.isPrivateIdentifier(name) && !ts.isJSDocMemberName(name)) { @@ -87290,7 +87974,7 @@ var ts; } } } - if (name.parent.kind === 271 /* SyntaxKind.ExportAssignment */ && ts.isEntityNameExpression(name)) { + if (name.parent.kind === 274 /* SyntaxKind.ExportAssignment */ && ts.isEntityNameExpression(name)) { // Even an entity name expression that doesn't resolve as an entityname may still typecheck as a property access expression var success = resolveEntityName(name, /*all meanings*/ 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */, /*ignoreErrors*/ true); @@ -87300,7 +87984,7 @@ var ts; } else if (ts.isEntityName(name) && isInRightSideOfImportOrExportAssignment(name)) { // Since we already checked for ExportAssignment, this really could only be an Import - var importEqualsDeclaration = ts.getAncestor(name, 265 /* SyntaxKind.ImportEqualsDeclaration */); + var importEqualsDeclaration = ts.getAncestor(name, 268 /* SyntaxKind.ImportEqualsDeclaration */); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(name, /*dontResolveAlias*/ true); } @@ -87318,7 +88002,7 @@ var ts; if (isHeritageClauseElementIdentifier(name)) { var meaning = 0 /* SymbolFlags.None */; // In an interface or class, we're definitely interested in a type. - if (name.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (name.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { meaning = 788968 /* SymbolFlags.Type */; // In a class 'extends' clause we are also looking for a value. if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(name.parent)) { @@ -87334,10 +88018,10 @@ var ts; return entityNameSymbol; } } - if (name.parent.kind === 340 /* SyntaxKind.JSDocParameterTag */) { + if (name.parent.kind === 343 /* SyntaxKind.JSDocParameterTag */) { return ts.getParameterSymbolFromJSDoc(name.parent); } - if (name.parent.kind === 163 /* SyntaxKind.TypeParameter */ && name.parent.parent.kind === 344 /* SyntaxKind.JSDocTemplateTag */) { + if (name.parent.kind === 165 /* SyntaxKind.TypeParameter */ && name.parent.parent.kind === 347 /* SyntaxKind.JSDocTemplateTag */) { ts.Debug.assert(!ts.isInJSFile(name)); // Otherwise `isDeclarationName` would have been true. var typeParameter = ts.getTypeParameterFromJsDoc(name.parent); return typeParameter && typeParameter.symbol; @@ -87361,18 +88045,53 @@ var ts; return resolveJSDocMemberName(name, /*ignoreErrors*/ false, getSymbolOfNode(container)); } } + if (result && isJSDoc_1) { + var container = ts.getJSDocHost(name); + if (container && ts.isEnumMember(container) && container === result.valueDeclaration) { + return resolveEntityName(name, meaning, /*ignoreErrors*/ true, /* dontResolveAlias */ true, ts.getSourceFileOfNode(container)) || result; + } + } return result; } else if (ts.isPrivateIdentifier(name)) { return getSymbolForPrivateIdentifierExpression(name); } - else if (name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || name.kind === 161 /* SyntaxKind.QualifiedName */) { + else if (name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || name.kind === 163 /* SyntaxKind.QualifiedName */) { var links = getNodeLinks(name); if (links.resolvedSymbol) { return links.resolvedSymbol; } - if (name.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (name.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { checkPropertyAccessExpression(name, 0 /* CheckMode.Normal */); + if (!links.resolvedSymbol) { + var expressionType = checkExpressionCached(name.expression); + var infos = getApplicableIndexInfos(expressionType, getLiteralTypeFromPropertyName(name.name)); + if (infos.length && expressionType.members) { + var resolved = resolveStructuredTypeMembers(expressionType); + var symbol = resolved.members.get("__index" /* InternalSymbolName.Index */); + if (infos === getIndexInfosOfType(expressionType)) { + links.resolvedSymbol = symbol; + } + else if (symbol) { + var symbolLinks_1 = getSymbolLinks(symbol); + var declarationList = ts.mapDefined(infos, function (i) { return i.declaration; }); + var nodeListId = ts.map(declarationList, getNodeId).join(","); + if (!symbolLinks_1.filteredIndexSymbolCache) { + symbolLinks_1.filteredIndexSymbolCache = new ts.Map(); + } + if (symbolLinks_1.filteredIndexSymbolCache.has(nodeListId)) { + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + else { + var copy = createSymbol(131072 /* SymbolFlags.Signature */, "__index" /* InternalSymbolName.Index */); + copy.declarations = ts.mapDefined(infos, function (i) { return i.declaration; }); + copy.parent = expressionType.aliasSymbol ? expressionType.aliasSymbol : expressionType.symbol ? expressionType.symbol : getSymbolAtLocation(copy.declarations[0].parent); + symbolLinks_1.filteredIndexSymbolCache.set(nodeListId, copy); + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + } + } + } } else { checkQualifiedName(name, 0 /* CheckMode.Normal */); @@ -87387,11 +88106,11 @@ var ts; } } else if (isTypeReferenceIdentifier(name)) { - var meaning = name.parent.kind === 178 /* SyntaxKind.TypeReference */ ? 788968 /* SymbolFlags.Type */ : 1920 /* SymbolFlags.Namespace */; + var meaning = name.parent.kind === 180 /* SyntaxKind.TypeReference */ ? 788968 /* SymbolFlags.Type */ : 1920 /* SymbolFlags.Namespace */; var symbol = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); return symbol && symbol !== unknownSymbol ? symbol : getUnresolvedSymbolForEntityName(name); } - if (name.parent.kind === 177 /* SyntaxKind.TypePredicate */) { + if (name.parent.kind === 179 /* SyntaxKind.TypePredicate */) { return resolveEntityName(name, /*meaning*/ 1 /* SymbolFlags.FunctionScopedVariable */); } return undefined; @@ -87425,7 +88144,7 @@ var ts; } } function getSymbolAtLocation(node, ignoreErrors) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } var parent = node.parent; @@ -87448,8 +88167,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } - else if (parent.kind === 203 /* SyntaxKind.BindingElement */ && - grandParent.kind === 201 /* SyntaxKind.ObjectBindingPattern */ && + else if (parent.kind === 205 /* SyntaxKind.BindingElement */ && + grandParent.kind === 203 /* SyntaxKind.ObjectBindingPattern */ && node === parent.propertyName) { var typeOfPattern = getTypeOfNode(grandParent); var propertyDeclaration = getPropertyOfType(typeOfPattern, node.escapedText); @@ -87476,8 +88195,8 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: if (!ts.isThisInTypeQuery(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } @@ -87494,14 +88213,14 @@ var ts; return checkExpression(node).symbol; } // falls through - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return getTypeFromThisTypeNode(node).symbol; case 106 /* SyntaxKind.SuperKeyword */: return checkExpression(node).symbol; - case 134 /* SyntaxKind.ConstructorKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 171 /* SyntaxKind.Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 173 /* SyntaxKind.Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; @@ -87512,7 +88231,7 @@ var ts; // 3). Dynamic import call or require in javascript // 4). type A = import("./f/*gotToDefinitionHere*/oo") if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 266 /* SyntaxKind.ImportDeclaration */ || node.parent.kind === 272 /* SyntaxKind.ExportDeclaration */) && node.parent.moduleSpecifier === node) || + ((node.parent.kind === 269 /* SyntaxKind.ImportDeclaration */ || node.parent.kind === 275 /* SyntaxKind.ExportDeclaration */) && node.parent.moduleSpecifier === node) || ((ts.isInJSFile(node) && ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false)) || ts.isImportCall(node.parent)) || (ts.isLiteralTypeNode(node.parent) && ts.isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent)) { return resolveExternalModuleName(node, node, ignoreErrors); @@ -87534,14 +88253,14 @@ var ts; case 38 /* SyntaxKind.EqualsGreaterThanToken */: case 84 /* SyntaxKind.ClassKeyword */: return getSymbolOfNode(node.parent); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal, ignoreErrors) : undefined; case 93 /* SyntaxKind.ExportKeyword */: return ts.isExportAssignment(node.parent) ? ts.Debug.checkDefined(node.parent.symbol) : undefined; case 100 /* SyntaxKind.ImportKeyword */: case 103 /* SyntaxKind.NewKeyword */: return ts.isMetaProperty(node.parent) ? checkMetaPropertyKeyword(node.parent).symbol : undefined; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return checkExpression(node).symbol; default: return undefined; @@ -87557,7 +88276,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (location && location.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 111551 /* SymbolFlags.Value */ | 2097152 /* SymbolFlags.Alias */); } return undefined; @@ -87639,23 +88358,23 @@ var ts; // [ a ] from // [a] = [ some array ...] function getTypeOfAssignmentPattern(expr) { - ts.Debug.assert(expr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || expr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */); + ts.Debug.assert(expr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || expr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */); // If this is from "for of" // for ( { a } of elems) { // } - if (expr.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (expr.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { var iteratedType = checkRightHandSideOfForOf(expr.parent); return checkDestructuringAssignment(expr, iteratedType || errorType); } // If this is from "for" initializer // for ({a } = elems[0];.....) { } - if (expr.parent.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (expr.parent.kind === 223 /* SyntaxKind.BinaryExpression */) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || errorType); } // If this is from nested object binding pattern // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { - if (expr.parent.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (expr.parent.kind === 299 /* SyntaxKind.PropertyAssignment */) { var node_3 = ts.cast(expr.parent.parent, ts.isObjectLiteralExpression); var typeOfParentObjectLiteral = getTypeOfAssignmentPattern(node_3) || errorType; var propertyIndex = ts.indexOfNode(node_3.properties, expr.parent); @@ -87703,7 +88422,7 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 10 /* SyntaxKind.StringLiteral */: return getStringLiteralType(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: var nameType = checkComputedPropertyName(name); return isTypeAssignableToKind(nameType, 12288 /* TypeFlags.ESSymbolLike */) ? nameType : stringType; default: @@ -87821,7 +88540,7 @@ var ts; } var parentSymbol_1 = getParentOfSymbol(symbol); if (parentSymbol_1) { - if (parentSymbol_1.flags & 512 /* SymbolFlags.ValueModule */ && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 305 /* SyntaxKind.SourceFile */) { + if (parentSymbol_1.flags & 512 /* SymbolFlags.ValueModule */ && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 308 /* SyntaxKind.SourceFile */) { var symbolFile = parentSymbol_1.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); // If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined. @@ -87841,7 +88560,7 @@ var ts; } var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier); if (node) { - var symbol = getReferencedValueSymbol(node); + var symbol = getReferencedValueOrAliasSymbol(node); // We should only get the declaration of an alias if there isn't a local value // declaration for the symbol if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol)) { @@ -87853,7 +88572,7 @@ var ts; function isSymbolOfDestructuredElementOfCatchBinding(symbol) { return symbol.valueDeclaration && ts.isBindingElement(symbol.valueDeclaration) - && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 292 /* SyntaxKind.CatchClause */; + && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 295 /* SyntaxKind.CatchClause */; } function isSymbolOfDeclarationWithCollidingName(symbol) { if (symbol.flags & 418 /* SymbolFlags.BlockScoped */ && symbol.valueDeclaration && !ts.isSourceFile(symbol.valueDeclaration)) { @@ -87884,7 +88603,7 @@ var ts; // they will not collide with anything var isDeclaredInLoop = nodeLinks_1.flags & 524288 /* NodeCheckFlags.BlockScopedBindingInLoop */; var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false); - var inLoopBodyBlock = container.kind === 235 /* SyntaxKind.Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + var inLoopBodyBlock = container.kind === 238 /* SyntaxKind.Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -87925,19 +88644,19 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: var symbol = getSymbolOfNode(node); return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportClause = node.exportClause; return !!exportClause && (ts.isNamespaceExport(exportClause) || ts.some(exportClause.elements, isValueAliasDeclaration)); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return node.expression && node.expression.kind === 79 /* SyntaxKind.Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; @@ -87946,7 +88665,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(nodeIn) { var node = ts.getParseTreeNode(nodeIn, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 305 /* SyntaxKind.SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 308 /* SyntaxKind.SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -88056,15 +88775,15 @@ var ts; } function canHaveConstantValue(node) { switch (node.kind) { - case 299 /* SyntaxKind.EnumMember */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 302 /* SyntaxKind.EnumMember */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return true; } return false; } function getConstantValue(node) { - if (node.kind === 299 /* SyntaxKind.EnumMember */) { + if (node.kind === 302 /* SyntaxKind.EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -88157,7 +88876,7 @@ var ts; function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker, addUndefined) { var declaration = ts.getParseTreeNode(declarationIn, ts.isVariableLikeOrAccessor); if (!declaration) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } // Get type of the symbol if this is the valid symbol otherwise get type at location var symbol = getSymbolOfNode(declaration); @@ -88176,7 +88895,7 @@ var ts; function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) { var signatureDeclaration = ts.getParseTreeNode(signatureDeclarationIn, ts.isFunctionLike); if (!signatureDeclaration) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } var signature = getSignatureFromDeclaration(signatureDeclaration); return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, flags | 1024 /* NodeBuilderFlags.MultilineObjectLiterals */, tracker); @@ -88184,7 +88903,7 @@ var ts; function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) { var expr = ts.getParseTreeNode(exprIn, ts.isExpression); if (!expr) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } var type = getWidenedType(getRegularTypeOfExpression(expr)); return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024 /* NodeBuilderFlags.MultilineObjectLiterals */, tracker); @@ -88208,6 +88927,25 @@ var ts; } return resolveName(location, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true); } + /** + * Get either a value-meaning symbol or an alias symbol. + * Unlike `getReferencedValueSymbol`, if the cached resolved symbol is the unknown symbol, + * we call `resolveName` to find a symbol. + * This is because when caching the resolved symbol, we only consider value symbols, but here + * we want to also get an alias symbol if one exists. + */ + function getReferencedValueOrAliasSymbol(reference) { + var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; + if (resolvedSymbol && resolvedSymbol !== unknownSymbol) { + return resolvedSymbol; + } + return resolveName(reference, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, + /*nodeNotFoundMessage*/ undefined, + /*nameArg*/ undefined, + /*isUse*/ true, + /*excludeGlobals*/ undefined, + /*getSpellingSuggestions*/ undefined); + } function getReferencedValueDeclaration(referenceIn) { if (!ts.isGeneratedIdentifier(referenceIn)) { var reference = ts.getParseTreeNode(referenceIn, ts.isIdentifier); @@ -88341,12 +89079,12 @@ var ts; getJsxFragmentFactoryEntity: getJsxFragmentFactoryEntity, getAllAccessorDeclarations: function (accessor) { accessor = ts.getParseTreeNode(accessor, ts.isGetOrSetAccessorDeclaration); // TODO: GH#18217 - var otherKind = accessor.kind === 173 /* SyntaxKind.SetAccessor */ ? 172 /* SyntaxKind.GetAccessor */ : 173 /* SyntaxKind.SetAccessor */; + var otherKind = accessor.kind === 175 /* SyntaxKind.SetAccessor */ ? 174 /* SyntaxKind.GetAccessor */ : 175 /* SyntaxKind.SetAccessor */; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(accessor), otherKind); var firstAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? otherAccessor : accessor; var secondAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? accessor : otherAccessor; - var setAccessor = accessor.kind === 173 /* SyntaxKind.SetAccessor */ ? accessor : otherAccessor; - var getAccessor = accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? accessor : otherAccessor; + var setAccessor = accessor.kind === 175 /* SyntaxKind.SetAccessor */ ? accessor : otherAccessor; + var getAccessor = accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? accessor : otherAccessor; return { firstAccessor: firstAccessor, secondAccessor: secondAccessor, @@ -88362,7 +89100,7 @@ var ts; }, getDeclarationStatementsForSourceFile: function (node, flags, tracker, bundled) { var n = ts.getParseTreeNode(node); - ts.Debug.assert(n && n.kind === 305 /* SyntaxKind.SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile"); + ts.Debug.assert(n && n.kind === 308 /* SyntaxKind.SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile"); var sym = getSymbolOfNode(node); if (!sym) { return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker, bundled); @@ -88399,7 +89137,7 @@ var ts; return false; } function isInHeritageClause(node) { - return node.parent && node.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 291 /* SyntaxKind.HeritageClause */; + return node.parent && node.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 294 /* SyntaxKind.HeritageClause */; } // defined here to avoid outer scope pollution function getTypeReferenceDirectivesForEntityName(node) { @@ -88412,12 +89150,12 @@ var ts; // qualified names can only be used as types\namespaces // identifiers are treated as values only if they appear in type queries var meaning; - if (node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } else { meaning = 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */; - if ((node.kind === 79 /* SyntaxKind.Identifier */ && isInTypeQuery(node)) || (node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && !isInHeritageClause(node))) { + if ((node.kind === 79 /* SyntaxKind.Identifier */ && isInTypeQuery(node)) || (node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && !isInHeritageClause(node))) { meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } } @@ -88466,7 +89204,7 @@ var ts; break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 305 /* SyntaxKind.SourceFile */ && current.flags & 512 /* SymbolFlags.ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 308 /* SyntaxKind.SourceFile */ && current.flags & 512 /* SymbolFlags.ValueModule */) { return false; } // check that at least one declaration of top level symbol originates from type declaration file @@ -88494,12 +89232,12 @@ var ts; } } function getExternalModuleFileFromDeclaration(declaration) { - var specifier = declaration.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); + var specifier = declaration.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, /*moduleNotFoundError*/ undefined); // TODO: GH#18217 if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 305 /* SyntaxKind.SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 308 /* SyntaxKind.SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors @@ -88711,14 +89449,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node, node.parent, node.parent.parent)) { - if (node.kind === 169 /* SyntaxKind.MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { + if (node.kind === 171 /* SyntaxKind.MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } } - else if (node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (ts.hasDecorators(accessors.firstAccessor) && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -88737,26 +89475,26 @@ var ts; var modifier = _a[_i]; if (ts.isDecorator(modifier)) continue; - if (modifier.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { - if (node.kind === 166 /* SyntaxKind.PropertySignature */ || node.kind === 168 /* SyntaxKind.MethodSignature */) { + if (modifier.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { + if (node.kind === 168 /* SyntaxKind.PropertySignature */ || node.kind === 170 /* SyntaxKind.MethodSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 176 /* SyntaxKind.IndexSignature */ && (modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ || !ts.isClassLike(node.parent))) { + if (node.kind === 178 /* SyntaxKind.IndexSignature */ && (modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ || !ts.isClassLike(node.parent))) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } - if (modifier.kind !== 101 /* SyntaxKind.InKeyword */ && modifier.kind !== 144 /* SyntaxKind.OutKeyword */) { - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { + if (modifier.kind !== 101 /* SyntaxKind.InKeyword */ && modifier.kind !== 145 /* SyntaxKind.OutKeyword */) { + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_parameter, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { case 85 /* SyntaxKind.ConstKeyword */: - if (node.kind !== 260 /* SyntaxKind.EnumDeclaration */) { + if (node.kind !== 263 /* SyntaxKind.EnumDeclaration */) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(85 /* SyntaxKind.ConstKeyword */)); } break; - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "override"); @@ -88767,7 +89505,10 @@ var ts; else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "accessor"); + } + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "async"); } flags |= 16384 /* ModifierFlags.Override */; @@ -88786,16 +89527,19 @@ var ts; else if (flags & 32 /* ModifierFlags.Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "accessor"); + } else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { if (modifier.kind === 121 /* SyntaxKind.PrivateKeyword */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } @@ -88815,16 +89559,19 @@ var ts; else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "accessor"); + } + else if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } else if (flags & 16384 /* ModifierFlags.Override */) { @@ -88833,11 +89580,26 @@ var ts; flags |= 32 /* ModifierFlags.Static */; lastStatic = modifier; break; - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "accessor"); + } + else if (flags & 64 /* ModifierFlags.Readonly */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "readonly"); + } + else if (flags & 2 /* ModifierFlags.Ambient */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "declare"); + } + else if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */) { + return grammarErrorOnNode(modifier, ts.Diagnostics.accessor_modifier_can_only_appear_on_a_property_declaration); + } + flags |= 128 /* ModifierFlags.Accessor */; + break; + case 146 /* SyntaxKind.ReadonlyKeyword */: if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 166 /* SyntaxKind.PropertySignature */ && node.kind !== 176 /* SyntaxKind.IndexSignature */ && node.kind !== 164 /* SyntaxKind.Parameter */) { + else if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 168 /* SyntaxKind.PropertySignature */ && node.kind !== 178 /* SyntaxKind.IndexSignature */ && node.kind !== 166 /* SyntaxKind.Parameter */) { // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } @@ -88850,35 +89612,35 @@ var ts; else if (flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "abstract"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } else if (ts.isClassLike(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "export"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1 /* ModifierFlags.Export */; break; case 88 /* SyntaxKind.DefaultKeyword */: - var container = node.parent.kind === 305 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 261 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 308 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } else if (!(flags & 1 /* ModifierFlags.Export */)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "default"); } - flags |= 512 /* ModifierFlags.Default */; + flags |= 1024 /* ModifierFlags.Default */; break; - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: if (flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } else if (flags & 16384 /* ModifierFlags.Override */) { @@ -88887,10 +89649,10 @@ var ts; else if (ts.isClassLike(node.parent) && !ts.isPropertyDeclaration(node)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "declare"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if ((node.parent.flags & 16777216 /* NodeFlags.Ambient */) && node.parent.kind === 262 /* SyntaxKind.ModuleBlock */) { + else if ((node.parent.flags & 16777216 /* NodeFlags.Ambient */) && node.parent.kind === 265 /* SyntaxKind.ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } else if (ts.isPrivateIdentifierClassElementDeclaration(node)) { @@ -88900,18 +89662,18 @@ var ts; lastDeclare = modifier; break; case 126 /* SyntaxKind.AbstractKeyword */: - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 257 /* SyntaxKind.ClassDeclaration */ && - node.kind !== 180 /* SyntaxKind.ConstructorType */) { - if (node.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && - node.kind !== 172 /* SyntaxKind.GetAccessor */ && - node.kind !== 173 /* SyntaxKind.SetAccessor */) { + if (node.kind !== 260 /* SyntaxKind.ClassDeclaration */ && + node.kind !== 182 /* SyntaxKind.ConstructorType */) { + if (node.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && + node.kind !== 174 /* SyntaxKind.GetAccessor */ && + node.kind !== 175 /* SyntaxKind.SetAccessor */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ && ts.hasSyntacticModifier(node.parent, 128 /* ModifierFlags.Abstract */))) { + if (!(node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ && ts.hasSyntacticModifier(node.parent, 256 /* ModifierFlags.Abstract */))) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32 /* ModifierFlags.Static */) { @@ -88920,39 +89682,42 @@ var ts; if (flags & 8 /* ModifierFlags.Private */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract"); } - if (flags & 256 /* ModifierFlags.Async */ && lastAsync) { + if (flags & 512 /* ModifierFlags.Async */ && lastAsync) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); } if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "override"); } + if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "accessor"); + } } if (ts.isNamedDeclaration(node) && node.name.kind === 80 /* SyntaxKind.PrivateIdentifier */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "abstract"); } - flags |= 128 /* ModifierFlags.Abstract */; + flags |= 256 /* ModifierFlags.Abstract */; break; - case 131 /* SyntaxKind.AsyncKeyword */: - if (flags & 256 /* ModifierFlags.Async */) { + case 132 /* SyntaxKind.AsyncKeyword */: + if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } else if (flags & 2 /* ModifierFlags.Ambient */ || node.parent.flags & 16777216 /* NodeFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); } - flags |= 256 /* ModifierFlags.Async */; + flags |= 512 /* ModifierFlags.Async */; lastAsync = modifier; break; case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: var inOutFlag = modifier.kind === 101 /* SyntaxKind.InKeyword */ ? 32768 /* ModifierFlags.In */ : 65536 /* ModifierFlags.Out */; var inOutText = modifier.kind === 101 /* SyntaxKind.InKeyword */ ? "in" : "out"; - if (node.kind !== 163 /* SyntaxKind.TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) { + if (node.kind !== 165 /* SyntaxKind.TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText); } if (flags & inOutFlag) { @@ -88965,28 +89730,28 @@ var ts; break; } } - if (node.kind === 171 /* SyntaxKind.Constructor */) { + if (node.kind === 173 /* SyntaxKind.Constructor */) { if (flags & 32 /* ModifierFlags.Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(lastOverride, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "override"); // TODO: GH#18217 } - if (flags & 256 /* ModifierFlags.Async */) { + if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); } return false; } - else if ((node.kind === 266 /* SyntaxKind.ImportDeclaration */ || node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) && flags & 2 /* ModifierFlags.Ambient */) { + else if ((node.kind === 269 /* SyntaxKind.ImportDeclaration */ || node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) && flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 166 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); } - else if (node.kind === 164 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && node.dotDotDotToken) { + else if (node.kind === 166 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && node.dotDotDotToken) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } - if (flags & 256 /* ModifierFlags.Async */) { + if (flags & 512 /* ModifierFlags.Async */) { return checkGrammarAsyncModifier(node, lastAsync); } return false; @@ -89004,47 +89769,47 @@ var ts; } function shouldReportBadModifier(node) { switch (node.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 164 /* SyntaxKind.Parameter */: - case 163 /* SyntaxKind.TypeParameter */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 166 /* SyntaxKind.Parameter */: + case 165 /* SyntaxKind.TypeParameter */: return false; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - case 179 /* SyntaxKind.FunctionType */: - case 276 /* SyntaxKind.MissingDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: + case 181 /* SyntaxKind.FunctionType */: + case 279 /* SyntaxKind.MissingDeclaration */: return true; default: - if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return false; } switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - return nodeHasAnyModifiersExcept(node, 131 /* SyntaxKind.AsyncKeyword */); - case 257 /* SyntaxKind.ClassDeclaration */: - case 180 /* SyntaxKind.ConstructorType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + return nodeHasAnyModifiersExcept(node, 132 /* SyntaxKind.AsyncKeyword */); + case 260 /* SyntaxKind.ClassDeclaration */: + case 182 /* SyntaxKind.ConstructorType */: return nodeHasAnyModifiersExcept(node, 126 /* SyntaxKind.AbstractKeyword */); - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return nodeHasAnyModifiersExcept(node, 85 /* SyntaxKind.ConstKeyword */); default: ts.Debug.assertNever(node); @@ -89062,10 +89827,10 @@ var ts; } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return false; } return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); @@ -89294,20 +90059,20 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.kind !== 164 /* SyntaxKind.ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 221 /* SyntaxKind.BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { + if (computedPropertyName.expression.kind === 223 /* SyntaxKind.BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } return false; } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - node.kind === 213 /* SyntaxKind.FunctionExpression */ || - node.kind === 169 /* SyntaxKind.MethodDeclaration */); + ts.Debug.assert(node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + node.kind === 215 /* SyntaxKind.FunctionExpression */ || + node.kind === 171 /* SyntaxKind.MethodDeclaration */); if (node.flags & 16777216 /* NodeFlags.Ambient */) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -89326,7 +90091,7 @@ var ts; var seen = new ts.Map(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 298 /* SyntaxKind.SpreadAssignment */) { + if (prop.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (inDestructuring) { // a rest property cannot be destructured any further var expression = ts.skipParentheses(prop.expression); @@ -89337,11 +90102,11 @@ var ts; continue; } var name = prop.name; - if (name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name); } - if (prop.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern); @@ -89353,7 +90118,7 @@ var ts; if (ts.canHaveModifiers(prop) && prop.modifiers) { for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { var mod = _c[_b]; - if (ts.isModifier(mod) && (mod.kind !== 131 /* SyntaxKind.AsyncKeyword */ || prop.kind !== 169 /* SyntaxKind.MethodDeclaration */)) { + if (ts.isModifier(mod) && (mod.kind !== 132 /* SyntaxKind.AsyncKeyword */ || prop.kind !== 171 /* SyntaxKind.MethodDeclaration */)) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } } @@ -89374,8 +90139,8 @@ var ts; // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = void 0; switch (prop.kind) { - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidExclamationToken(prop.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); @@ -89384,13 +90149,13 @@ var ts; } currentKind = 4 /* DeclarationMeaning.PropertyAssignment */; break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: currentKind = 8 /* DeclarationMeaning.Method */; break; - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: currentKind = 1 /* DeclarationMeaning.GetAccessor */; break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: currentKind = 2 /* DeclarationMeaning.SetAccessor */; break; default: @@ -89433,7 +90198,7 @@ var ts; var seen = new ts.Map(); for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 287 /* SyntaxKind.JsxSpreadAttribute */) { + if (attr.kind === 290 /* SyntaxKind.JsxSpreadAttribute */) { continue; } var name = attr.name, initializer = attr.initializer; @@ -89443,7 +90208,7 @@ var ts; else { return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } - if (initializer && initializer.kind === 288 /* SyntaxKind.JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 291 /* SyntaxKind.JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -89478,7 +90243,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.kind === 244 /* SyntaxKind.ForOfStatement */ && forInOrOfStatement.awaitModifier) { + if (forInOrOfStatement.kind === 247 /* SyntaxKind.ForOfStatement */ && forInOrOfStatement.awaitModifier) { if (!(forInOrOfStatement.flags & 32768 /* NodeFlags.AwaitContext */)) { var sourceFile = ts.getSourceFileOfNode(forInOrOfStatement); if (ts.isInTopLevelContext(forInOrOfStatement)) { @@ -89512,7 +90277,7 @@ var ts; if (!hasParseDiagnostics(sourceFile)) { var diagnostic = ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); var func = ts.getContainingFunction(forInOrOfStatement); - if (func && func.kind !== 171 /* SyntaxKind.Constructor */) { + if (func && func.kind !== 173 /* SyntaxKind.Constructor */) { ts.Debug.assert((ts.getFunctionFlags(func) & 2 /* FunctionFlags.Async */) === 0, "Enclosing function should never be an async function."); var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); ts.addRelatedInfo(diagnostic, relatedInfo); @@ -89529,7 +90294,7 @@ var ts; grammarErrorOnNode(forInOrOfStatement.initializer, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async); return false; } - if (forInOrOfStatement.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -89544,20 +90309,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -89567,22 +90332,22 @@ var ts; return false; } function checkGrammarAccessor(accessor) { - if (!(accessor.flags & 16777216 /* NodeFlags.Ambient */) && (accessor.parent.kind !== 182 /* SyntaxKind.TypeLiteral */) && (accessor.parent.kind !== 258 /* SyntaxKind.InterfaceDeclaration */)) { + if (!(accessor.flags & 16777216 /* NodeFlags.Ambient */) && (accessor.parent.kind !== 184 /* SyntaxKind.TypeLiteral */) && (accessor.parent.kind !== 261 /* SyntaxKind.InterfaceDeclaration */)) { if (languageVersion < 1 /* ScriptTarget.ES5 */) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); } if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isPrivateIdentifier(accessor.name)) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } - if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 128 /* ModifierFlags.Abstract */)) { + if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 256 /* ModifierFlags.Abstract */)) { return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } if (accessor.body) { - if (ts.hasSyntacticModifier(accessor, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(accessor, 256 /* ModifierFlags.Abstract */)) { return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); } - if (accessor.parent.kind === 182 /* SyntaxKind.TypeLiteral */ || accessor.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (accessor.parent.kind === 184 /* SyntaxKind.TypeLiteral */ || accessor.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return grammarErrorOnNode(accessor.body, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } } @@ -89590,11 +90355,11 @@ var ts; return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } if (!doesAccessorHaveCorrectParameterCount(accessor)) { - return grammarErrorOnNode(accessor.name, accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? + return grammarErrorOnNode(accessor.name, accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? ts.Diagnostics.A_get_accessor_cannot_have_parameters : ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - if (accessor.kind === 173 /* SyntaxKind.SetAccessor */) { + if (accessor.kind === 175 /* SyntaxKind.SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -89616,17 +90381,17 @@ var ts; * A set accessor has one parameter or a `this` parameter and one more parameter. */ function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? 1 : 2)) { + if (accessor.parameters.length === (accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? 1 : 2)) { return ts.getThisParameter(accessor); } } function checkGrammarTypeOperatorNode(node) { - if (node.operator === 154 /* SyntaxKind.UniqueKeyword */) { - if (node.type.kind !== 151 /* SyntaxKind.SymbolKeyword */) { - return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(151 /* SyntaxKind.SymbolKeyword */)); + if (node.operator === 156 /* SyntaxKind.UniqueKeyword */) { + if (node.type.kind !== 153 /* SyntaxKind.SymbolKeyword */) { + return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(153 /* SyntaxKind.SymbolKeyword */)); } var parent = ts.walkUpParenthesizedTypes(node.parent); if (ts.isInJSFile(parent) && ts.isJSDocTypeExpression(parent)) { @@ -89636,7 +90401,7 @@ var ts; } } switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: var decl = parent; if (decl.name.kind !== 79 /* SyntaxKind.Identifier */) { return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name); @@ -89648,13 +90413,13 @@ var ts; return grammarErrorOnNode(parent.name, ts.Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const); } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (!ts.isStatic(parent) || !ts.hasEffectiveReadonlyModifier(parent)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly); } break; - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (!ts.hasSyntacticModifier(parent, 64 /* ModifierFlags.Readonly */)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly); } @@ -89663,9 +90428,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_are_not_allowed_here); } } - else if (node.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { - if (node.type.kind !== 183 /* SyntaxKind.ArrayType */ && node.type.kind !== 184 /* SyntaxKind.TupleType */) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(151 /* SyntaxKind.SymbolKeyword */)); + else if (node.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { + if (node.type.kind !== 185 /* SyntaxKind.ArrayType */ && node.type.kind !== 186 /* SyntaxKind.TupleType */) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(153 /* SyntaxKind.SymbolKeyword */)); } } } @@ -89678,10 +90443,10 @@ var ts; if (checkGrammarFunctionLikeDeclaration(node)) { return true; } - if (node.kind === 169 /* SyntaxKind.MethodDeclaration */) { - if (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (node.kind === 171 /* SyntaxKind.MethodDeclaration */) { + if (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // We only disallow modifier on a method declaration if it is a property of object-literal-expression - if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 131 /* SyntaxKind.AsyncKeyword */)) { + if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 132 /* SyntaxKind.AsyncKeyword */)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } else if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { @@ -89710,14 +90475,14 @@ var ts; if (node.flags & 16777216 /* NodeFlags.Ambient */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.kind === 169 /* SyntaxKind.MethodDeclaration */ && !node.body) { + else if (node.kind === 171 /* SyntaxKind.MethodDeclaration */ && !node.body) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } - else if (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + else if (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.parent.kind === 182 /* SyntaxKind.TypeLiteral */) { + else if (node.parent.kind === 184 /* SyntaxKind.TypeLiteral */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } @@ -89728,11 +90493,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: if (node.label && current.label.escapedText === node.label.escapedText) { // found matching label - verify that label usage is correct // continue can only target labels that are on iteration statements - var isMisplacedContinueLabel = node.kind === 245 /* SyntaxKind.ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 248 /* SyntaxKind.ContinueStatement */ && !ts.isIterationStatement(current.statement, /*lookInLabeledStatement*/ true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -89740,8 +90505,8 @@ var ts; return false; } break; - case 249 /* SyntaxKind.SwitchStatement */: - if (node.kind === 246 /* SyntaxKind.BreakStatement */ && !node.label) { + case 252 /* SyntaxKind.SwitchStatement */: + if (node.kind === 249 /* SyntaxKind.BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -89756,13 +90521,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 246 /* SyntaxKind.BreakStatement */ + var message = node.kind === 249 /* SyntaxKind.BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 246 /* SyntaxKind.BreakStatement */ + var message = node.kind === 249 /* SyntaxKind.BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -89786,12 +90551,12 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return ts.isStringOrNumericLiteralLike(expr) || - expr.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && + expr.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 8 /* SyntaxKind.NumericLiteral */; } function isBigIntLiteralExpression(expr) { return expr.kind === 9 /* SyntaxKind.BigIntLiteral */ || - expr.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && + expr.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 9 /* SyntaxKind.BigIntLiteral */; } function isSimpleLiteralEnumReference(expr) { @@ -89819,7 +90584,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */ && node.parent.parent.kind !== 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */ && node.parent.parent.kind !== 247 /* SyntaxKind.ForOfStatement */) { if (node.flags & 16777216 /* NodeFlags.Ambient */) { checkAmbientInitializer(node); } @@ -89832,7 +90597,7 @@ var ts; } } } - if (node.exclamationToken && (node.parent.parent.kind !== 237 /* SyntaxKind.VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* NodeFlags.Ambient */)) { + if (node.exclamationToken && (node.parent.parent.kind !== 240 /* SyntaxKind.VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* NodeFlags.Ambient */)) { var message = node.initializer ? ts.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type @@ -89899,15 +90664,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return false; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -90001,8 +90766,14 @@ var ts; if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isPrivateIdentifier(node.name)) { return grammarErrorOnNode(node.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } + if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isAutoAccessorPropertyDeclaration(node)) { + return grammarErrorOnNode(node.name, ts.Diagnostics.Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher); + } + if (ts.isAutoAccessorPropertyDeclaration(node) && checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_accessor_property_cannot_be_declared_optional)) { + return true; + } } - else if (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + else if (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) { return true; } @@ -90048,14 +90819,14 @@ var ts; // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */ || - node.kind === 266 /* SyntaxKind.ImportDeclaration */ || - node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ || - node.kind === 272 /* SyntaxKind.ExportDeclaration */ || - node.kind === 271 /* SyntaxKind.ExportAssignment */ || - node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ || - ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */ | 1 /* ModifierFlags.Export */ | 512 /* ModifierFlags.Default */)) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */ || + node.kind === 269 /* SyntaxKind.ImportDeclaration */ || + node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ || + node.kind === 275 /* SyntaxKind.ExportDeclaration */ || + node.kind === 274 /* SyntaxKind.ExportAssignment */ || + node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ || + ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */ | 1 /* ModifierFlags.Export */ | 1024 /* ModifierFlags.Default */)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier); @@ -90063,7 +90834,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 237 /* SyntaxKind.VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 240 /* SyntaxKind.VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -90086,7 +90857,7 @@ var ts; // to prevent noisiness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 235 /* SyntaxKind.Block */ || node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.parent.kind === 238 /* SyntaxKind.Block */ || node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { var links_2 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_2.hasReportedStatementInAmbientContext) { @@ -90108,10 +90879,10 @@ var ts; if (languageVersion >= 1 /* ScriptTarget.ES5 */) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 196 /* SyntaxKind.LiteralType */)) { + else if (ts.isChildOfNodeWithKind(node, 198 /* SyntaxKind.LiteralType */)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 299 /* SyntaxKind.EnumMember */)) { + else if (ts.isChildOfNodeWithKind(node, 302 /* SyntaxKind.EnumMember */)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -90183,7 +90954,7 @@ var ts; if (node.isTypeOnly && node.name && node.namedBindings) { return grammarErrorOnNode(node, ts.Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both); } - if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 269 /* SyntaxKind.NamedImports */) { + if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 272 /* SyntaxKind.NamedImports */) { return checkGrammarNamedImportsOrExports(node.namedBindings); } return false; @@ -90191,7 +90962,7 @@ var ts; function checkGrammarNamedImportsOrExports(namedBindings) { return !!ts.forEach(namedBindings.elements, function (specifier) { if (specifier.isTypeOnly) { - return grammarErrorOnFirstToken(specifier, specifier.kind === 270 /* SyntaxKind.ImportSpecifier */ + return grammarErrorOnFirstToken(specifier, specifier.kind === 273 /* SyntaxKind.ImportSpecifier */ ? ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement : ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement); } @@ -90205,7 +90976,7 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments); } var nodeArguments = node.arguments; - if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext) { + if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext && moduleKind !== ts.ModuleKind.Node16) { // We are allowed trailing comma after proposal-import-assertions. checkGrammarForDisallowedTrailingComma(nodeArguments); if (nodeArguments.length > 1) { @@ -90314,14 +91085,14 @@ var ts; return !ts.isAccessor(declaration); } function isNotOverload(declaration) { - return (declaration.kind !== 256 /* SyntaxKind.FunctionDeclaration */ && declaration.kind !== 169 /* SyntaxKind.MethodDeclaration */) || + return (declaration.kind !== 259 /* SyntaxKind.FunctionDeclaration */ && declaration.kind !== 171 /* SyntaxKind.MethodDeclaration */) || !!declaration.body; } /** Like 'isDeclarationName', but returns true for LHS of `import { x as y }` or `export { x as y }`. */ function isDeclarationNameOrImportPropertyName(name) { switch (name.parent.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return ts.isIdentifier(name); default: return ts.isDeclarationName(name); @@ -90357,6 +91128,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { + var _a; function visitNode(node, visitor, test, lift) { if (node === undefined || visitor === undefined) { return node; @@ -90423,7 +91195,6 @@ var ts; return nodes; } ts.visitNodes = visitNodes; - /* @internal */ function visitArray(nodes, visitor, test, start, count) { if (nodes === undefined) { return nodes; @@ -90571,12 +91342,10 @@ var ts; return updated; } ts.visitFunctionBody = visitFunctionBody; - /** - * Visits an iteration body, adding any block-scoped variables required by the transformation. - */ - function visitIterationBody(body, visitor, context) { + function visitIterationBody(body, visitor, context, nodeVisitor) { + if (nodeVisitor === void 0) { nodeVisitor = visitNode; } context.startBlockScope(); - var updated = visitNode(body, visitor, ts.isStatement, context.factory.liftToBlock); + var updated = nodeVisitor(body, visitor, ts.isStatement, context.factory.liftToBlock); var declarations = context.endBlockScope(); if (ts.some(declarations)) { if (ts.isBlock(updated)) { @@ -90595,456 +91364,446 @@ var ts; if (node === undefined) { return undefined; } - var kind = node.kind; - // No need to visit nodes with no children. - if ((kind > 0 /* SyntaxKind.FirstToken */ && kind <= 160 /* SyntaxKind.LastToken */) || kind === 192 /* SyntaxKind.ThisType */) { - return node; - } - var factory = context.factory; - switch (kind) { - // Names - case 79 /* SyntaxKind.Identifier */: - ts.Debug.type(node); - return factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration)); - case 161 /* SyntaxKind.QualifiedName */: - ts.Debug.type(node); - return factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier)); - case 162 /* SyntaxKind.ComputedPropertyName */: - ts.Debug.type(node); - return factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Signature elements - case 163 /* SyntaxKind.TypeParameter */: - ts.Debug.type(node); - return factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode)); - case 164 /* SyntaxKind.Parameter */: - ts.Debug.type(node); - return factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 165 /* SyntaxKind.Decorator */: - ts.Debug.type(node); - return factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Type elements - case 166 /* SyntaxKind.PropertySignature */: - ts.Debug.type(node); - return factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 167 /* SyntaxKind.PropertyDeclaration */: - ts.Debug.type(node); - return factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), - // QuestionToken and ExclamationToken is uniqued in Property Declaration and the signature of 'updateProperty' is that too - nodeVisitor(node.questionToken || node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 168 /* SyntaxKind.MethodSignature */: - ts.Debug.type(node); - return factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 169 /* SyntaxKind.MethodDeclaration */: - ts.Debug.type(node); - return factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 171 /* SyntaxKind.Constructor */: - ts.Debug.type(node); - return factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 172 /* SyntaxKind.GetAccessor */: - ts.Debug.type(node); - return factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 173 /* SyntaxKind.SetAccessor */: - ts.Debug.type(node); - return factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - ts.Debug.type(node); - context.startLexicalEnvironment(); - context.suspendLexicalEnvironment(); - return factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 174 /* SyntaxKind.CallSignature */: - ts.Debug.type(node); - return factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 175 /* SyntaxKind.ConstructSignature */: - ts.Debug.type(node); - return factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 176 /* SyntaxKind.IndexSignature */: - ts.Debug.type(node); - return factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - // Types - case 177 /* SyntaxKind.TypePredicate */: - ts.Debug.type(node); - return factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 178 /* SyntaxKind.TypeReference */: - ts.Debug.type(node); - return factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 179 /* SyntaxKind.FunctionType */: - ts.Debug.type(node); - return factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 180 /* SyntaxKind.ConstructorType */: - ts.Debug.type(node); - return factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 181 /* SyntaxKind.TypeQuery */: - ts.Debug.type(node); - return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 182 /* SyntaxKind.TypeLiteral */: - ts.Debug.type(node); - return factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 183 /* SyntaxKind.ArrayType */: - ts.Debug.type(node); - return factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode)); - case 184 /* SyntaxKind.TupleType */: - ts.Debug.type(node); - return factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode)); - case 185 /* SyntaxKind.OptionalType */: - ts.Debug.type(node); - return factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 186 /* SyntaxKind.RestType */: - ts.Debug.type(node); - return factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 187 /* SyntaxKind.UnionType */: - ts.Debug.type(node); - return factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 188 /* SyntaxKind.IntersectionType */: - ts.Debug.type(node); - return factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 189 /* SyntaxKind.ConditionalType */: - ts.Debug.type(node); - return factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode)); - case 190 /* SyntaxKind.InferType */: - ts.Debug.type(node); - return factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); - case 200 /* SyntaxKind.ImportType */: - ts.Debug.type(node); - return factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isNode), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); - case 295 /* SyntaxKind.ImportTypeAssertionContainer */: - ts.Debug.type(node); - return factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isNode), node.multiLine); - case 197 /* SyntaxKind.NamedTupleMember */: - ts.Debug.type(node); - return factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 191 /* SyntaxKind.ParenthesizedType */: - ts.Debug.type(node); - return factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 193 /* SyntaxKind.TypeOperator */: - ts.Debug.type(node); - return factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 194 /* SyntaxKind.IndexedAccessType */: - ts.Debug.type(node); - return factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode)); - case 195 /* SyntaxKind.MappedType */: - ts.Debug.type(node); - return factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 196 /* SyntaxKind.LiteralType */: - ts.Debug.type(node); - return factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression)); - case 198 /* SyntaxKind.TemplateLiteralType */: - ts.Debug.type(node); - return factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan)); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: - ts.Debug.type(node); - return factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - // Binding patterns - case 201 /* SyntaxKind.ObjectBindingPattern */: - ts.Debug.type(node); - return factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); - case 202 /* SyntaxKind.ArrayBindingPattern */: - ts.Debug.type(node); - return factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); - case 203 /* SyntaxKind.BindingElement */: - ts.Debug.type(node); - return factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - // Expression - case 204 /* SyntaxKind.ArrayLiteralExpression */: - ts.Debug.type(node); - return factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - case 205 /* SyntaxKind.ObjectLiteralExpression */: - ts.Debug.type(node); - return factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); - case 206 /* SyntaxKind.PropertyAccessExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName)); - } - ts.Debug.type(node); - return factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName)); - case 207 /* SyntaxKind.ElementAccessExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); - case 208 /* SyntaxKind.CallExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 209 /* SyntaxKind.NewExpression */: - ts.Debug.type(node); - return factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - ts.Debug.type(node); - return factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral)); - case 211 /* SyntaxKind.TypeAssertionExpression */: - ts.Debug.type(node); - return factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 212 /* SyntaxKind.ParenthesizedExpression */: - ts.Debug.type(node); - return factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 213 /* SyntaxKind.FunctionExpression */: - ts.Debug.type(node); - return factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 214 /* SyntaxKind.ArrowFunction */: - ts.Debug.type(node); - return factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 215 /* SyntaxKind.DeleteExpression */: - ts.Debug.type(node); - return factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 216 /* SyntaxKind.TypeOfExpression */: - ts.Debug.type(node); - return factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 217 /* SyntaxKind.VoidExpression */: - ts.Debug.type(node); - return factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 218 /* SyntaxKind.AwaitExpression */: - ts.Debug.type(node); - return factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - ts.Debug.type(node); - return factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - ts.Debug.type(node); - return factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); - case 221 /* SyntaxKind.BinaryExpression */: - ts.Debug.type(node); - return factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression)); - case 222 /* SyntaxKind.ConditionalExpression */: - ts.Debug.type(node); - return factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression)); - case 223 /* SyntaxKind.TemplateExpression */: - ts.Debug.type(node); - return factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); - case 224 /* SyntaxKind.YieldExpression */: - ts.Debug.type(node); - return factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 225 /* SyntaxKind.SpreadElement */: - ts.Debug.type(node); - return factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 226 /* SyntaxKind.ClassExpression */: - ts.Debug.type(node); - return factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - ts.Debug.type(node); - return factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 229 /* SyntaxKind.AsExpression */: - ts.Debug.type(node); - return factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 230 /* SyntaxKind.NonNullExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 231 /* SyntaxKind.MetaProperty */: - ts.Debug.type(node); - return factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - // Misc - case 233 /* SyntaxKind.TemplateSpan */: - ts.Debug.type(node); - return factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - // Element - case 235 /* SyntaxKind.Block */: - ts.Debug.type(node); - return factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 237 /* SyntaxKind.VariableStatement */: - ts.Debug.type(node); - return factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 238 /* SyntaxKind.ExpressionStatement */: - ts.Debug.type(node); - return factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 239 /* SyntaxKind.IfStatement */: - ts.Debug.type(node); - return factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, factory.liftToBlock)); - case 240 /* SyntaxKind.DoStatement */: - ts.Debug.type(node); - return factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 241 /* SyntaxKind.WhileStatement */: - ts.Debug.type(node); - return factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 242 /* SyntaxKind.ForStatement */: - ts.Debug.type(node); - return factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 243 /* SyntaxKind.ForInStatement */: - ts.Debug.type(node); - return factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 244 /* SyntaxKind.ForOfStatement */: - ts.Debug.type(node); - return factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 245 /* SyntaxKind.ContinueStatement */: - ts.Debug.type(node); - return factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); - case 246 /* SyntaxKind.BreakStatement */: - ts.Debug.type(node); - return factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); - case 247 /* SyntaxKind.ReturnStatement */: - ts.Debug.type(node); - return factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 248 /* SyntaxKind.WithStatement */: - ts.Debug.type(node); - return factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock)); - case 249 /* SyntaxKind.SwitchStatement */: - ts.Debug.type(node); - return factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock)); - case 250 /* SyntaxKind.LabeledStatement */: - ts.Debug.type(node); - return factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock)); - case 251 /* SyntaxKind.ThrowStatement */: - ts.Debug.type(node); - return factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 252 /* SyntaxKind.TryStatement */: - ts.Debug.type(node); - return factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock)); - case 254 /* SyntaxKind.VariableDeclaration */: - ts.Debug.type(node); - return factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 255 /* SyntaxKind.VariableDeclarationList */: - ts.Debug.type(node); - return factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); - case 256 /* SyntaxKind.FunctionDeclaration */: - ts.Debug.type(node); - return factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 257 /* SyntaxKind.ClassDeclaration */: - ts.Debug.type(node); - return factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 258 /* SyntaxKind.InterfaceDeclaration */: - ts.Debug.type(node); - return factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 259 /* SyntaxKind.TypeAliasDeclaration */: - ts.Debug.type(node); - return factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 260 /* SyntaxKind.EnumDeclaration */: - ts.Debug.type(node); - return factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); - case 261 /* SyntaxKind.ModuleDeclaration */: - ts.Debug.type(node); - return factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody)); - case 262 /* SyntaxKind.ModuleBlock */: - ts.Debug.type(node); - return factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 263 /* SyntaxKind.CaseBlock */: - ts.Debug.type(node); - return factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - ts.Debug.type(node); - return factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - ts.Debug.type(node); - return factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference)); - case 266 /* SyntaxKind.ImportDeclaration */: - ts.Debug.type(node); - return factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); - case 293 /* SyntaxKind.AssertClause */: - ts.Debug.type(node); - return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine); - case 294 /* SyntaxKind.AssertEntry */: - ts.Debug.type(node); - return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode)); - case 267 /* SyntaxKind.ImportClause */: - ts.Debug.type(node); - return factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings)); - case 268 /* SyntaxKind.NamespaceImport */: - ts.Debug.type(node); - return factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 274 /* SyntaxKind.NamespaceExport */: - ts.Debug.type(node); - return factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 269 /* SyntaxKind.NamedImports */: - ts.Debug.type(node); - return factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); - case 270 /* SyntaxKind.ImportSpecifier */: - ts.Debug.type(node); - return factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 271 /* SyntaxKind.ExportAssignment */: - ts.Debug.type(node); - return factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 272 /* SyntaxKind.ExportDeclaration */: - ts.Debug.type(node); - return factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); - case 273 /* SyntaxKind.NamedExports */: - ts.Debug.type(node); - return factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); - case 275 /* SyntaxKind.ExportSpecifier */: - ts.Debug.type(node); - return factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); - // Module references - case 277 /* SyntaxKind.ExternalModuleReference */: - ts.Debug.type(node); - return factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // JSX - case 278 /* SyntaxKind.JsxElement */: - ts.Debug.type(node); - return factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement)); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - ts.Debug.type(node); - return factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); - case 280 /* SyntaxKind.JsxOpeningElement */: - ts.Debug.type(node); - return factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); - case 281 /* SyntaxKind.JsxClosingElement */: - ts.Debug.type(node); - return factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 282 /* SyntaxKind.JsxFragment */: - ts.Debug.type(node); - return factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment)); - case 285 /* SyntaxKind.JsxAttribute */: - ts.Debug.type(node); - return factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 286 /* SyntaxKind.JsxAttributes */: - ts.Debug.type(node); - return factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); - case 287 /* SyntaxKind.JsxSpreadAttribute */: - ts.Debug.type(node); - return factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 288 /* SyntaxKind.JsxExpression */: - ts.Debug.type(node); - return factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Clauses - case 289 /* SyntaxKind.CaseClause */: - ts.Debug.type(node); - return factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); - case 290 /* SyntaxKind.DefaultClause */: - ts.Debug.type(node); - return factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 291 /* SyntaxKind.HeritageClause */: - ts.Debug.type(node); - return factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 292 /* SyntaxKind.CatchClause */: - ts.Debug.type(node); - return factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock)); - // Property assignments - case 296 /* SyntaxKind.PropertyAssignment */: - ts.Debug.type(node); - return factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - ts.Debug.type(node); - return factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 298 /* SyntaxKind.SpreadAssignment */: - ts.Debug.type(node); - return factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Enum - case 299 /* SyntaxKind.EnumMember */: - ts.Debug.type(node); - return factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - // Top-level nodes - case 305 /* SyntaxKind.SourceFile */: - ts.Debug.type(node); - return factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context)); - // Transformation nodes - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - ts.Debug.type(node); - return factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 351 /* SyntaxKind.CommaListExpression */: - ts.Debug.type(node); - return factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - default: - // No need to visit nodes with no children. - return node; - } + var fn = visitEachChildTable[node.kind]; + return fn === undefined ? node : fn(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor); } ts.visitEachChild = visitEachChild; + // NOTE: Before you can add a new method to `visitEachChildTable`, you must first ensure the `Node` subtype you + // wish to add is defined in the `HasChildren` union in types.ts. + var visitEachChildTable = (_a = {}, + _a[79 /* SyntaxKind.Identifier */] = function visitEachChildOfIdentifier(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration)); + }, + _a[163 /* SyntaxKind.QualifiedName */] = function visitEachChildOfQualifiedName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier)); + }, + _a[164 /* SyntaxKind.ComputedPropertyName */] = function visitEachChildOfComputedPropertyName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Signature elements + _a[165 /* SyntaxKind.TypeParameter */] = function visitEachChildOfTypeParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode)); + }, + _a[166 /* SyntaxKind.Parameter */] = function visitEachChildOfParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[167 /* SyntaxKind.Decorator */] = function visitEachChildOfDecorator(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Type elements + _a[168 /* SyntaxKind.PropertySignature */] = function visitEachChildOfPropertySignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[169 /* SyntaxKind.PropertyDeclaration */] = function visitEachChildOfPropertyDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + var _a; + return context.factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), + // QuestionToken and ExclamationToken are mutually exclusive in PropertyDeclaration + nodeVisitor((_a = node.questionToken) !== null && _a !== void 0 ? _a : node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[170 /* SyntaxKind.MethodSignature */] = function visitEachChildOfMethodSignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[171 /* SyntaxKind.MethodDeclaration */] = function visitEachChildOfMethodDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[173 /* SyntaxKind.Constructor */] = function visitEachChildOfConstructorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[174 /* SyntaxKind.GetAccessor */] = function visitEachChildOfGetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[175 /* SyntaxKind.SetAccessor */] = function visitEachChildOfSetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[172 /* SyntaxKind.ClassStaticBlockDeclaration */] = function visitEachChildOfClassStaticBlockDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + context.startLexicalEnvironment(); + context.suspendLexicalEnvironment(); + return context.factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[176 /* SyntaxKind.CallSignature */] = function visitEachChildOfCallSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[177 /* SyntaxKind.ConstructSignature */] = function visitEachChildOfConstructSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[178 /* SyntaxKind.IndexSignature */] = function visitEachChildOfIndexSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + // Types + _a[179 /* SyntaxKind.TypePredicate */] = function visitEachChildOfTypePredicateNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[180 /* SyntaxKind.TypeReference */] = function visitEachChildOfTypeReferenceNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[181 /* SyntaxKind.FunctionType */] = function visitEachChildOfFunctionTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[182 /* SyntaxKind.ConstructorType */] = function visitEachChildOfConstructorTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[183 /* SyntaxKind.TypeQuery */] = function visitEachChildOfTypeQueryNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[184 /* SyntaxKind.TypeLiteral */] = function visitEachChildOfTypeLiteralNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[185 /* SyntaxKind.ArrayType */] = function visitEachChildOfArrayTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode)); + }, + _a[186 /* SyntaxKind.TupleType */] = function visitEachChildOfTupleTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode)); + }, + _a[187 /* SyntaxKind.OptionalType */] = function visitEachChildOfOptionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[188 /* SyntaxKind.RestType */] = function visitEachChildOfRestTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[189 /* SyntaxKind.UnionType */] = function visitEachChildOfUnionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + }, + _a[190 /* SyntaxKind.IntersectionType */] = function visitEachChildOfIntersectionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + }, + _a[191 /* SyntaxKind.ConditionalType */] = function visitEachChildOfConditionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode)); + }, + _a[192 /* SyntaxKind.InferType */] = function visitEachChildOfInferTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); + }, + _a[202 /* SyntaxKind.ImportType */] = function visitEachChildOfImportTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isImportTypeAssertionContainer), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); + }, + _a[298 /* SyntaxKind.ImportTypeAssertionContainer */] = function visitEachChildOfImportTypeAssertionContainer(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isAssertClause), node.multiLine); + }, + _a[199 /* SyntaxKind.NamedTupleMember */] = function visitEachChildOfNamedTupleMember(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[193 /* SyntaxKind.ParenthesizedType */] = function visitEachChildOfParenthesizedType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[195 /* SyntaxKind.TypeOperator */] = function visitEachChildOfTypeOperatorNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[196 /* SyntaxKind.IndexedAccessType */] = function visitEachChildOfIndexedAccessType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode)); + }, + _a[197 /* SyntaxKind.MappedType */] = function visitEachChildOfMappedType(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[198 /* SyntaxKind.LiteralType */] = function visitEachChildOfLiteralTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression)); + }, + _a[200 /* SyntaxKind.TemplateLiteralType */] = function visitEachChildOfTemplateLiteralType(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan)); + }, + _a[201 /* SyntaxKind.TemplateLiteralTypeSpan */] = function visitEachChildOfTemplateLiteralTypeSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + }, + // Binding patterns + _a[203 /* SyntaxKind.ObjectBindingPattern */] = function visitEachChildOfObjectBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); + }, + _a[204 /* SyntaxKind.ArrayBindingPattern */] = function visitEachChildOfArrayBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); + }, + _a[205 /* SyntaxKind.BindingElement */] = function visitEachChildOfBindingElement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + // Expression + _a[206 /* SyntaxKind.ArrayLiteralExpression */] = function visitEachChildOfArrayLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + }, + _a[207 /* SyntaxKind.ObjectLiteralExpression */] = function visitEachChildOfObjectLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); + }, + _a[208 /* SyntaxKind.PropertyAccessExpression */] = function visitEachChildOfPropertyAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isPropertyAccessChain(node) ? + context.factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName)) : + context.factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName)); + }, + _a[209 /* SyntaxKind.ElementAccessExpression */] = function visitEachChildOfElementAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isElementAccessChain(node) ? + context.factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)) : + context.factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); + }, + _a[210 /* SyntaxKind.CallExpression */] = function visitEachChildOfCallExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isCallChain(node) ? + context.factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)) : + context.factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + }, + _a[211 /* SyntaxKind.NewExpression */] = function visitEachChildOfNewExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + }, + _a[212 /* SyntaxKind.TaggedTemplateExpression */] = function visitEachChildOfTaggedTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral)); + }, + _a[213 /* SyntaxKind.TypeAssertionExpression */] = function visitEachChildOfTypeAssertionExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[214 /* SyntaxKind.ParenthesizedExpression */] = function visitEachChildOfParenthesizedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[215 /* SyntaxKind.FunctionExpression */] = function visitEachChildOfFunctionExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[216 /* SyntaxKind.ArrowFunction */] = function visitEachChildOfArrowFunction(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[217 /* SyntaxKind.DeleteExpression */] = function visitEachChildOfDeleteExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[218 /* SyntaxKind.TypeOfExpression */] = function visitEachChildOfTypeOfExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[219 /* SyntaxKind.VoidExpression */] = function visitEachChildOfVoidExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[220 /* SyntaxKind.AwaitExpression */] = function visitEachChildOfAwaitExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[221 /* SyntaxKind.PrefixUnaryExpression */] = function visitEachChildOfPrefixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); + }, + _a[222 /* SyntaxKind.PostfixUnaryExpression */] = function visitEachChildOfPostfixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); + }, + _a[223 /* SyntaxKind.BinaryExpression */] = function visitEachChildOfBinaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression)); + }, + _a[224 /* SyntaxKind.ConditionalExpression */] = function visitEachChildOfConditionalExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression)); + }, + _a[225 /* SyntaxKind.TemplateExpression */] = function visitEachChildOfTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); + }, + _a[226 /* SyntaxKind.YieldExpression */] = function visitEachChildOfYieldExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[227 /* SyntaxKind.SpreadElement */] = function visitEachChildOfSpreadElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[228 /* SyntaxKind.ClassExpression */] = function visitEachChildOfClassExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + }, + _a[230 /* SyntaxKind.ExpressionWithTypeArguments */] = function visitEachChildOfExpressionWithTypeArguments(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[231 /* SyntaxKind.AsExpression */] = function visitEachChildOfAsExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[235 /* SyntaxKind.SatisfiesExpression */] = function visitEachChildOfSatisfiesExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSatisfiesExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[232 /* SyntaxKind.NonNullExpression */] = function visitEachChildOfNonNullExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return ts.isOptionalChain(node) ? + context.factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression)) : + context.factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[233 /* SyntaxKind.MetaProperty */] = function visitEachChildOfMetaProperty(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + // Misc + _a[236 /* SyntaxKind.TemplateSpan */] = function visitEachChildOfTemplateSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + }, + // Element + _a[238 /* SyntaxKind.Block */] = function visitEachChildOfBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[240 /* SyntaxKind.VariableStatement */] = function visitEachChildOfVariableStatement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList)); + }, + _a[241 /* SyntaxKind.ExpressionStatement */] = function visitEachChildOfExpressionStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[242 /* SyntaxKind.IfStatement */] = function visitEachChildOfIfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, context.factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[243 /* SyntaxKind.DoStatement */] = function visitEachChildOfDoStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context, nodeVisitor), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[244 /* SyntaxKind.WhileStatement */] = function visitEachChildOfWhileStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[245 /* SyntaxKind.ForStatement */] = function visitEachChildOfForStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[246 /* SyntaxKind.ForInStatement */] = function visitEachChildOfForInStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[247 /* SyntaxKind.ForOfStatement */] = function visitEachChildOfForOfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[248 /* SyntaxKind.ContinueStatement */] = function visitEachChildOfContinueStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); + }, + _a[249 /* SyntaxKind.BreakStatement */] = function visitEachChildOfBreakStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); + }, + _a[250 /* SyntaxKind.ReturnStatement */] = function visitEachChildOfReturnStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[251 /* SyntaxKind.WithStatement */] = function visitEachChildOfWithStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[252 /* SyntaxKind.SwitchStatement */] = function visitEachChildOfSwitchStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock)); + }, + _a[253 /* SyntaxKind.LabeledStatement */] = function visitEachChildOfLabeledStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[254 /* SyntaxKind.ThrowStatement */] = function visitEachChildOfThrowStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[255 /* SyntaxKind.TryStatement */] = function visitEachChildOfTryStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock)); + }, + _a[257 /* SyntaxKind.VariableDeclaration */] = function visitEachChildOfVariableDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[258 /* SyntaxKind.VariableDeclarationList */] = function visitEachChildOfVariableDeclarationList(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); + }, + _a[259 /* SyntaxKind.FunctionDeclaration */] = function visitEachChildOfFunctionDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[260 /* SyntaxKind.ClassDeclaration */] = function visitEachChildOfClassDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + }, + _a[261 /* SyntaxKind.InterfaceDeclaration */] = function visitEachChildOfInterfaceDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[262 /* SyntaxKind.TypeAliasDeclaration */] = function visitEachChildOfTypeAliasDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[263 /* SyntaxKind.EnumDeclaration */] = function visitEachChildOfEnumDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); + }, + _a[264 /* SyntaxKind.ModuleDeclaration */] = function visitEachChildOfModuleDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody)); + }, + _a[265 /* SyntaxKind.ModuleBlock */] = function visitEachChildOfModuleBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[266 /* SyntaxKind.CaseBlock */] = function visitEachChildOfCaseBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); + }, + _a[267 /* SyntaxKind.NamespaceExportDeclaration */] = function visitEachChildOfNamespaceExportDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[268 /* SyntaxKind.ImportEqualsDeclaration */] = function visitEachChildOfImportEqualsDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference)); + }, + _a[269 /* SyntaxKind.ImportDeclaration */] = function visitEachChildOfImportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); + }, + _a[296 /* SyntaxKind.AssertClause */] = function visitEachChildOfAssertClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine); + }, + _a[297 /* SyntaxKind.AssertEntry */] = function visitEachChildOfAssertEntry(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpression)); + }, + _a[270 /* SyntaxKind.ImportClause */] = function visitEachChildOfImportClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings)); + }, + _a[271 /* SyntaxKind.NamespaceImport */] = function visitEachChildOfNamespaceImport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[277 /* SyntaxKind.NamespaceExport */] = function visitEachChildOfNamespaceExport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[272 /* SyntaxKind.NamedImports */] = function visitEachChildOfNamedImports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); + }, + _a[273 /* SyntaxKind.ImportSpecifier */] = function visitEachChildOfImportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[274 /* SyntaxKind.ExportAssignment */] = function visitEachChildOfExportAssignment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[275 /* SyntaxKind.ExportDeclaration */] = function visitEachChildOfExportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); + }, + _a[276 /* SyntaxKind.NamedExports */] = function visitEachChildOfNamedExports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); + }, + _a[278 /* SyntaxKind.ExportSpecifier */] = function visitEachChildOfExportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + // Module references + _a[280 /* SyntaxKind.ExternalModuleReference */] = function visitEachChildOfExternalModuleReference(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // JSX + _a[281 /* SyntaxKind.JsxElement */] = function visitEachChildOfJsxElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement)); + }, + _a[282 /* SyntaxKind.JsxSelfClosingElement */] = function visitEachChildOfJsxSelfClosingElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); + }, + _a[283 /* SyntaxKind.JsxOpeningElement */] = function visitEachChildOfJsxOpeningElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); + }, + _a[284 /* SyntaxKind.JsxClosingElement */] = function visitEachChildOfJsxClosingElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression)); + }, + _a[285 /* SyntaxKind.JsxFragment */] = function visitEachChildOfJsxFragment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment)); + }, + _a[288 /* SyntaxKind.JsxAttribute */] = function visitEachChildOfJsxAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); + }, + _a[289 /* SyntaxKind.JsxAttributes */] = function visitEachChildOfJsxAttributes(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); + }, + _a[290 /* SyntaxKind.JsxSpreadAttribute */] = function visitEachChildOfJsxSpreadAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[291 /* SyntaxKind.JsxExpression */] = function visitEachChildOfJsxExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Clauses + _a[292 /* SyntaxKind.CaseClause */] = function visitEachChildOfCaseClause(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[293 /* SyntaxKind.DefaultClause */] = function visitEachChildOfDefaultClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[294 /* SyntaxKind.HeritageClause */] = function visitEachChildOfHeritageClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); + }, + _a[295 /* SyntaxKind.CatchClause */] = function visitEachChildOfCatchClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock)); + }, + // Property assignments + _a[299 /* SyntaxKind.PropertyAssignment */] = function visitEachChildOfPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[300 /* SyntaxKind.ShorthandPropertyAssignment */] = function visitEachChildOfShorthandPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression)); + }, + _a[301 /* SyntaxKind.SpreadAssignment */] = function visitEachChildOfSpreadAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Enum + _a[302 /* SyntaxKind.EnumMember */] = function visitEachChildOfEnumMember(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + // Top-level nodes + _a[308 /* SyntaxKind.SourceFile */] = function visitEachChildOfSourceFile(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context, /*start*/ undefined, /*ensureUseStrict*/ undefined, nodesVisitor)); + }, + // Transformation nodes + _a[353 /* SyntaxKind.PartiallyEmittedExpression */] = function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[354 /* SyntaxKind.CommaListExpression */] = function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + }, + _a); /** * Extracts the single node from a NodeArray. * @@ -91112,7 +91871,7 @@ var ts; exit(); return sourceIndex; } - /* eslint-disable boolean-trivia, no-null/no-null */ + /* eslint-disable local/boolean-trivia, no-null/no-null */ function setSourceContent(sourceIndex, content) { enter(); if (content !== null) { @@ -91125,7 +91884,7 @@ var ts; } exit(); } - /* eslint-enable boolean-trivia, no-null/no-null */ + /* eslint-enable local/boolean-trivia, no-null/no-null */ function addName(name) { enter(); if (!nameToNameIndexMap) @@ -91727,7 +92486,7 @@ var ts; function chainBundle(context, transformSourceFile) { return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -91778,7 +92537,7 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: // import "mod" // import x from "mod" // import * as x from "mod" @@ -91791,13 +92550,13 @@ var ts; hasImportDefault = true; } break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - if (node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + if (node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { // import x = require("mod") externalImports.push(node); } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -91828,13 +92587,13 @@ var ts; addExportedNamesForExportDeclaration(node); } break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; } break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { for (var _b = 0, _c = node.declarationList.declarations; _b < _c.length; _b++) { var decl = _c[_b]; @@ -91842,9 +92601,9 @@ var ts; } } break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - if (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { // export default function() { } if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); @@ -91862,9 +92621,9 @@ var ts; } } break; - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - if (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { // export default class { } if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); @@ -92042,7 +92801,7 @@ var ts; * @param isStatic A value indicating whether the member should be a static or instance member. */ function isInitializedProperty(member) { - return member.kind === 167 /* SyntaxKind.PropertyDeclaration */ + return member.kind === 169 /* SyntaxKind.PropertyDeclaration */ && member.initializer !== undefined; } ts.isInitializedProperty = isInitializedProperty; @@ -92052,7 +92811,7 @@ var ts; * @param member The class element node. */ function isNonStaticMethodOrAccessorWithPrivateName(member) { - return !ts.isStatic(member) && ts.isMethodOrAccessor(member) && ts.isPrivateIdentifier(member.name); + return !ts.isStatic(member) && (ts.isMethodOrAccessor(member) || ts.isAutoAccessorPropertyDeclaration(member)) && ts.isPrivateIdentifier(member.name); } ts.isNonStaticMethodOrAccessorWithPrivateName = isNonStaticMethodOrAccessorWithPrivateName; /** @@ -92106,12 +92865,12 @@ var ts; */ function getAllDecoratorsOfClassElement(member, parent) { switch (member.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return getAllDecoratorsOfAccessors(member, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return getAllDecoratorsOfMethod(member); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return getAllDecoratorsOfProperty(member); default: return undefined; @@ -92772,8 +93531,8 @@ var ts; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; // Enable substitution for property/element access to emit const enum values. - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // These variables contain state that changes as we descend into the tree. var currentSourceFile; var currentNamespace; @@ -92793,14 +93552,14 @@ var ts; var applicableSubstitutions; return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - if (node.kind === 306 /* SyntaxKind.Bundle */) { + if (node.kind === 309 /* SyntaxKind.Bundle */) { return transformBundle(node); } return transformSourceFile(node); } function transformBundle(node) { return factory.createBundle(node.sourceFiles.map(transformSourceFile), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 308 /* SyntaxKind.InputFiles */) { + if (prepend.kind === 311 /* SyntaxKind.InputFiles */) { return ts.createUnparsedSourceFile(prepend, "js"); } return prepend; @@ -92849,15 +93608,15 @@ var ts; */ function onBeforeVisitNode(node) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 263 /* SyntaxKind.CaseBlock */: - case 262 /* SyntaxKind.ModuleBlock */: - case 235 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 266 /* SyntaxKind.CaseBlock */: + case 265 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: currentLexicalScope = node; currentScopeFirstDeclarationsOfName = undefined; break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */)) { break; } @@ -92869,7 +93628,7 @@ var ts; // These nodes should always have names unless they are default-exports; // however, class declaration parsing allows for undefined names, so syntactically invalid // programs may also have an undefined name. - ts.Debug.assert(node.kind === 257 /* SyntaxKind.ClassDeclaration */ || ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)); + ts.Debug.assert(node.kind === 260 /* SyntaxKind.ClassDeclaration */ || ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)); } break; } @@ -92908,10 +93667,10 @@ var ts; */ function sourceElementVisitorWorker(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitElidableStatement(node); default: return visitorWorker(node); @@ -92932,13 +93691,13 @@ var ts; return node; } switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); default: ts.Debug.fail("Unhandled ellided statement"); @@ -92958,11 +93717,11 @@ var ts; * @param node The node to visit. */ function namespaceElementVisitorWorker(node) { - if (node.kind === 272 /* SyntaxKind.ExportDeclaration */ || - node.kind === 266 /* SyntaxKind.ImportDeclaration */ || - node.kind === 267 /* SyntaxKind.ImportClause */ || - (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && - node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */)) { + if (node.kind === 275 /* SyntaxKind.ExportDeclaration */ || + node.kind === 269 /* SyntaxKind.ImportDeclaration */ || + node.kind === 270 /* SyntaxKind.ImportClause */ || + (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && + node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */)) { // do not emit ES6 imports and exports since they are illegal inside a namespace return undefined; } @@ -92986,27 +93745,27 @@ var ts; */ function classElementVisitorWorker(node, parent) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return visitConstructor(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // Property declarations are not TypeScript syntax, but they must be visited // for the decorator transformation. return visitPropertyDeclaration(node, parent); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node, parent); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node, parent); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return ts.visitEachChild(node, visitor, context); - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: return node; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Index signatures are elided return; default: @@ -93018,17 +93777,17 @@ var ts; } function objectLiteralElementVisitorWorker(node, parent) { switch (node.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return visitor(node); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node, parent); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node, parent); @@ -93039,7 +93798,7 @@ var ts; function modifierVisitor(node) { if (ts.isDecorator(node)) return undefined; - if (ts.modifierToFlag(node.kind) & 116958 /* ModifierFlags.TypeScriptModifier */) { + if (ts.modifierToFlag(node.kind) & 117086 /* ModifierFlags.TypeScriptModifier */) { return undefined; } else if (currentNamespace && node.kind === 93 /* SyntaxKind.ExportKeyword */) { @@ -93067,58 +93826,58 @@ var ts; case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: // TypeScript accessibility and readonly modifiers are elided // falls through - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 177 /* SyntaxKind.TypePredicate */: - case 163 /* SyntaxKind.TypeParameter */: - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: + case 187 /* SyntaxKind.OptionalType */: + case 188 /* SyntaxKind.RestType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 179 /* SyntaxKind.TypePredicate */: + case 165 /* SyntaxKind.TypeParameter */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 180 /* SyntaxKind.ConstructorType */: - case 179 /* SyntaxKind.FunctionType */: - case 181 /* SyntaxKind.TypeQuery */: - case 178 /* SyntaxKind.TypeReference */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 189 /* SyntaxKind.ConditionalType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 192 /* SyntaxKind.ThisType */: - case 193 /* SyntaxKind.TypeOperator */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 195 /* SyntaxKind.MappedType */: - case 196 /* SyntaxKind.LiteralType */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 182 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 183 /* SyntaxKind.TypeQuery */: + case 180 /* SyntaxKind.TypeReference */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 191 /* SyntaxKind.ConditionalType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 194 /* SyntaxKind.ThisType */: + case 195 /* SyntaxKind.TypeOperator */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 197 /* SyntaxKind.MappedType */: + case 198 /* SyntaxKind.LiteralType */: // TypeScript type nodes are elided. // falls through - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // TypeScript index signatures are elided. return undefined; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // TypeScript type-only declarations are elided. return factory.createNotEmittedStatement(node); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: // TypeScript namespace export declarations are elided. return undefined; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // TypeScript interfaces are elided, but some comments may be preserved. // See the implementation of `getLeadingComments` in comments.ts for more details. return factory.createNotEmittedStatement(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // This may be a class declaration with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -93128,7 +93887,7 @@ var ts; // - index signatures // - method overload signatures return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: // This may be a class expression with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -93138,34 +93897,34 @@ var ts; // - index signatures // - method overload signatures return visitClassExpression(node); - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: // This may be a heritage clause with TypeScript syntax extensions. // // TypeScript heritage clause extensions include: // - `implements` clause return visitHeritageClause(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // TypeScript supports type arguments on an expression in an `extends` heritage clause. return visitExpressionWithTypeArguments(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return ts.Debug.fail("Class and object literal elements must be visited with their respective visitors"); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: // Typescript function declarations can have modifiers, decorators, and type annotations. return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: // TypeScript function expressions can have modifiers and type annotations. return visitFunctionExpression(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // TypeScript arrow functions can have modifiers and type annotations. return visitArrowFunction(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // This may be a parameter declaration with TypeScript syntax extensions. // // TypeScript parameter declaration syntax extensions include: @@ -93175,40 +93934,42 @@ var ts; // - type annotations // - this parameters return visitParameter(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: // ParenthesizedExpressions are TypeScript if their expression is a // TypeAssertion or AsExpression return visitParenthesizedExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: // TypeScript type assertions are removed, but their subtrees are preserved. return visitAssertionExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return visitSatisfiesExpression(node); + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: // TypeScript non-null expressions are removed, but their subtrees are preserved. return visitNonNullExpression(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: // TypeScript enum declarations do not exist in ES6 and must be rewritten. return visitEnumDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // TypeScript namespace exports for variable statements must be transformed. return visitVariableStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // TypeScript namespace declarations must be transformed. return visitModuleDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // TypeScript namespace or external module import. return visitImportEqualsDeclaration(node); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node); - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: return visitJsxJsxOpeningElement(node); default: // node contains some other TypeScript syntax @@ -93478,10 +94239,10 @@ var ts; */ function shouldAddTypeMetadata(node) { var kind = node.kind; - return kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */; + return kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */; } /** * Determines whether to emit the "design:returntype" metadata based on the node's kind. @@ -93491,7 +94252,7 @@ var ts; * @param node The node to test. */ function shouldAddReturnTypeMetadata(node) { - return node.kind === 169 /* SyntaxKind.MethodDeclaration */; + return node.kind === 171 /* SyntaxKind.MethodDeclaration */; } /** * Determines whether to emit the "design:paramtypes" metadata based on the node's kind. @@ -93502,12 +94263,12 @@ var ts; */ function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.getFirstConstructorWithBody(node) !== undefined; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; } return false; @@ -93597,7 +94358,7 @@ var ts; return !ts.nodeIsMissing(node.body); } function visitPropertyDeclaration(node, parent) { - var isAmbient = node.flags & 16777216 /* NodeFlags.Ambient */ || ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */); + var isAmbient = node.flags & 16777216 /* NodeFlags.Ambient */ || ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */); if (isAmbient && !ts.hasDecorators(node)) { return undefined; } @@ -93705,7 +94466,7 @@ var ts; * @param node The declaration node. */ function shouldEmitAccessorDeclaration(node) { - return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)); + return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)); } function visitGetAccessor(node, parent) { if (!(node.transformFlags & 1 /* TransformFlags.ContainsTypeScript */)) { @@ -93847,6 +94608,10 @@ var ts; var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression); return factory.createPartiallyEmittedExpression(expression, node); } + function visitSatisfiesExpression(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + return factory.createPartiallyEmittedExpression(expression, node); + } function visitCallExpression(node) { return factory.updateCallExpression(node, ts.visitNode(node.expression, visitor, ts.isExpression), /*typeArguments*/ undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression)); @@ -94060,12 +94825,12 @@ var ts; // enums in any other scope are emitted as a `let` declaration. var statement = factory.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), factory.createVariableDeclarationList([ factory.createVariableDeclaration(factory.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)) - ], currentLexicalScope.kind === 305 /* SyntaxKind.SourceFile */ ? 0 /* NodeFlags.None */ : 1 /* NodeFlags.Let */)); + ], currentLexicalScope.kind === 308 /* SyntaxKind.SourceFile */ ? 0 /* NodeFlags.None */ : 1 /* NodeFlags.Let */)); ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { // Adjust the source map emit to match the old emitter. - if (node.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (node.kind === 263 /* SyntaxKind.EnumDeclaration */) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -94190,7 +94955,7 @@ var ts; var statementsLocation; var blockLocation; if (node.body) { - if (node.body.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (node.body.kind === 265 /* SyntaxKind.ModuleBlock */) { saveStateAndInvoke(node.body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = node.body.statements; blockLocation = node.body; @@ -94237,13 +95002,13 @@ var ts; // })(hi = hello.hi || (hello.hi = {})); // })(hello || (hello = {})); // We only want to emit comment on the namespace which contains block body itself, not the containing namespaces. - if (!node.body || node.body.kind !== 262 /* SyntaxKind.ModuleBlock */) { + if (!node.body || node.body.kind !== 265 /* SyntaxKind.ModuleBlock */) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* EmitFlags.NoComments */); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 264 /* SyntaxKind.ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -94290,7 +95055,7 @@ var ts; * @param node The named import bindings node. */ function visitNamedImportBindings(node) { - if (node.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (node.kind === 271 /* SyntaxKind.NamespaceImport */) { // Elide a namespace import if it is not referenced. return shouldEmitAliasDeclaration(node) ? node : undefined; } @@ -94448,7 +95213,7 @@ var ts; */ function isNamedExternalModuleExport(node) { return isExternalModuleExport(node) - && !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */); + && !ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */); } /** * Gets a value indicating whether the node is the default export of an external module. @@ -94457,7 +95222,7 @@ var ts; */ function isDefaultExternalModuleExport(node) { return isExternalModuleExport(node) - && ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */); + && ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */); } function addExportMemberAssignment(statements, node) { var expression = factory.createAssignment(factory.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true), factory.getLocalName(node)); @@ -94502,16 +95267,16 @@ var ts; // We need to enable substitutions for identifiers and shorthand property assignments. This allows us to // substitute the names of exported members of a namespace. context.enableSubstitution(79 /* SyntaxKind.Identifier */); - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // We need to be notified when entering and exiting namespaces. - context.enableEmitNotification(261 /* SyntaxKind.ModuleDeclaration */); + context.enableEmitNotification(264 /* SyntaxKind.ModuleDeclaration */); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 261 /* SyntaxKind.ModuleDeclaration */; + return ts.getOriginalNode(node).kind === 264 /* SyntaxKind.ModuleDeclaration */; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 260 /* SyntaxKind.EnumDeclaration */; + return ts.getOriginalNode(node).kind === 263 /* SyntaxKind.EnumDeclaration */; } /** * Hook for node emit. @@ -94572,9 +95337,9 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); } return node; @@ -94589,9 +95354,9 @@ var ts; // If we are nested within a namespace declaration, we may need to qualifiy // an identifier that is exported from a merged namespace. var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false); - if (container && container.kind !== 305 /* SyntaxKind.SourceFile */) { - var substitute = (applicableSubstitutions & 2 /* TypeScriptSubstitutionFlags.NamespaceExports */ && container.kind === 261 /* SyntaxKind.ModuleDeclaration */) || - (applicableSubstitutions & 8 /* TypeScriptSubstitutionFlags.NonQualifiedEnumMembers */ && container.kind === 260 /* SyntaxKind.EnumDeclaration */); + if (container && container.kind !== 308 /* SyntaxKind.SourceFile */) { + var substitute = (applicableSubstitutions & 2 /* TypeScriptSubstitutionFlags.NamespaceExports */ && container.kind === 264 /* SyntaxKind.ModuleDeclaration */) || + (applicableSubstitutions & 8 /* TypeScriptSubstitutionFlags.NonQualifiedEnumMembers */ && container.kind === 263 /* SyntaxKind.EnumDeclaration */); if (substitute) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(container), node), /*location*/ node); @@ -94630,9 +95395,10 @@ var ts; return ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node) ? resolver.getConstantValue(node) : undefined; } function shouldEmitAliasDeclaration(node) { - return compilerOptions.preserveValueImports - ? resolver.isValueAliasDeclaration(node) - : resolver.isReferencedAliasDeclaration(node); + return ts.isInJSFile(node) || + (compilerOptions.preserveValueImports + ? resolver.isValueAliasDeclaration(node) + : resolver.isReferencedAliasDeclaration(node)); } } ts.transformTypeScript = transformTypeScript; @@ -94680,13 +95446,24 @@ var ts; var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); var useDefineForClassFields = ts.getUseDefineForClassFields(compilerOptions); + // Always transform field initializers using Set semantics when `useDefineForClassFields: false`. + var shouldTransformInitializersUsingSet = !useDefineForClassFields; + // Transform field initializers using Define semantics when `useDefineForClassFields: true` and target < ES2022. + var shouldTransformInitializersUsingDefine = useDefineForClassFields && languageVersion < 9 /* ScriptTarget.ES2022 */; + var shouldTransformInitializers = shouldTransformInitializersUsingSet || shouldTransformInitializersUsingDefine; + // We need to transform private members and class static blocks when target < ES2022. var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < 9 /* ScriptTarget.ES2022 */; + // We need to transform `accessor` fields when target < ESNext + var shouldTransformAutoAccessors = languageVersion < 99 /* ScriptTarget.ESNext */; // We need to transform `this` in a static initializer into a reference to the class - // when targeting < ES2022 since the assignment will be moved outside of the class body. + // when target < ES2022 since the assignment will be moved outside of the class body. var shouldTransformThisInStaticInitializers = languageVersion < 9 /* ScriptTarget.ES2022 */; - // We don't need to transform `super` property access when targeting ES5, ES3 because + // We don't need to transform `super` property access when target <= ES5 because // the es2015 transformation handles those. var shouldTransformSuperInStaticInitializers = shouldTransformThisInStaticInitializers && languageVersion >= 2 /* ScriptTarget.ES2015 */; + var shouldTransformAnything = shouldTransformInitializers || + shouldTransformPrivateElementsOrClassStaticBlocks || + shouldTransformAutoAccessors; var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; var previousOnEmitNode = context.onEmitNode; @@ -94706,98 +95483,149 @@ var ts; var classLexicalEnvironmentStack = []; var classLexicalEnvironmentMap = new ts.Map(); var currentClassLexicalEnvironment; + var currentClassContainer; var currentComputedPropertyNameClassLexicalEnvironment; var currentStaticPropertyDeclarationOrStaticBlock; return ts.chainBundle(context, transformSourceFile); function transformSourceFile(node) { - var options = context.getCompilerOptions(); - if (node.isDeclarationFile - || useDefineForClassFields && ts.getEmitScriptTarget(options) >= 9 /* ScriptTarget.ES2022 */) { + if (node.isDeclarationFile || !shouldTransformAnything) { return node; } var visited = ts.visitEachChild(node, visitor, context); ts.addEmitHelpers(visited, context.readEmitHelpers()); return visited; } - function visitorWorker(node, valueIsDiscarded) { - if (node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */) { - switch (node.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - return visitClassLike(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitPropertyDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: - return visitVariableStatement(node); - case 80 /* SyntaxKind.PrivateIdentifier */: - return visitPrivateIdentifier(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitClassStaticBlockDeclaration(node); - } + function visitor(node) { + if (!(node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */) && + !(node.transformFlags & 134234112 /* TransformFlags.ContainsLexicalThisOrSuper */)) { + return node; } - if (node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */ || - node.transformFlags & 134217728 /* TransformFlags.ContainsLexicalSuper */ && - shouldTransformSuperInStaticInitializers && - currentStaticPropertyDeclarationOrStaticBlock && - currentClassLexicalEnvironment) { - switch (node.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); - case 221 /* SyntaxKind.BinaryExpression */: - return visitBinaryExpression(node, valueIsDiscarded); - case 208 /* SyntaxKind.CallExpression */: - return visitCallExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - return visitTaggedTemplateExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: - return visitPropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: - return visitElementAccessExpression(node); - case 238 /* SyntaxKind.ExpressionStatement */: - return visitExpressionStatement(node); - case 242 /* SyntaxKind.ForStatement */: - return visitForStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: { - var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = undefined; - var result = ts.visitEachChild(node, visitor, context); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; - return result; - } + switch (node.kind) { + case 127 /* SyntaxKind.AccessorKeyword */: + return shouldTransformAutoAccessors ? undefined : node; + case 260 /* SyntaxKind.ClassDeclaration */: + return visitClassDeclaration(node); + case 228 /* SyntaxKind.ClassExpression */: + return visitClassExpression(node); + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + return visitClassStaticBlockDeclaration(node); + case 169 /* SyntaxKind.PropertyDeclaration */: + return visitPropertyDeclaration(node); + case 240 /* SyntaxKind.VariableStatement */: + return visitVariableStatement(node); + case 80 /* SyntaxKind.PrivateIdentifier */: + return visitPrivateIdentifier(node); + case 208 /* SyntaxKind.PropertyAccessExpression */: + return visitPropertyAccessExpression(node); + case 209 /* SyntaxKind.ElementAccessExpression */: + return visitElementAccessExpression(node); + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + return visitPreOrPostfixUnaryExpression(node, /*valueIsDiscarded*/ false); + case 223 /* SyntaxKind.BinaryExpression */: + return visitBinaryExpression(node, /*valueIsDiscarded*/ false); + case 210 /* SyntaxKind.CallExpression */: + return visitCallExpression(node); + case 241 /* SyntaxKind.ExpressionStatement */: + return visitExpressionStatement(node); + case 212 /* SyntaxKind.TaggedTemplateExpression */: + return visitTaggedTemplateExpression(node); + case 245 /* SyntaxKind.ForStatement */: + return visitForStatement(node); + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: { + // If we are descending into a new scope, clear the current static property or block + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, fallbackVisitor, node); } + default: + return fallbackVisitor(node); } + } + function fallbackVisitor(node) { return ts.visitEachChild(node, visitor, context); } + /** + * Visits a node in an expression whose result is discarded. + */ function discardedValueVisitor(node) { - return visitorWorker(node, /*valueIsDiscarded*/ true); - } - function visitor(node) { - return visitorWorker(node, /*valueIsDiscarded*/ false); + switch (node.kind) { + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + return visitPreOrPostfixUnaryExpression(node, /*valueIsDiscarded*/ true); + case 223 /* SyntaxKind.BinaryExpression */: + return visitBinaryExpression(node, /*valueIsDiscarded*/ true); + default: + return visitor(node); + } } + /** + * Visits a node in a {@link HeritageClause}. + */ function heritageClauseVisitor(node) { switch (node.kind) { - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return ts.visitEachChild(node, heritageClauseVisitor, context); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - return visitExpressionWithTypeArguments(node); + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + return visitExpressionWithTypeArgumentsInHeritageClause(node); + default: + return visitor(node); } - return visitor(node); } - function visitorDestructuringTarget(node) { + /** + * Visits the assignment target of a destructuring assignment. + */ + function assignmentTargetVisitor(node) { switch (node.kind) { - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitAssignmentPattern(node); default: return visitor(node); } } + /** + * Visits a member of a class. + */ + function classElementVisitor(node) { + switch (node.kind) { + case 173 /* SyntaxKind.Constructor */: + return visitConstructorDeclaration(node); + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, visitMethodOrAccessorDeclaration, node); + case 169 /* SyntaxKind.PropertyDeclaration */: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, visitPropertyDeclaration, node); + case 164 /* SyntaxKind.ComputedPropertyName */: + return visitComputedPropertyName(node); + case 237 /* SyntaxKind.SemicolonClassElement */: + return node; + default: + return visitor(node); + } + } + /** + * Visits the results of an auto-accessor field transformation in a second pass. + */ + function accessorFieldResultVisitor(node) { + switch (node.kind) { + case 169 /* SyntaxKind.PropertyDeclaration */: + return transformFieldInitializer(node); + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return classElementVisitor(node); + default: + ts.Debug.assertMissingNode(node, "Expected node to either be a PropertyDeclaration, GetAccessorDeclaration, or SetAccessorDeclaration"); + break; + } + } /** * If we visit a private name, this means it is an undeclared private name. * Replace it with an empty identifier to indicate a problem with the code, @@ -94813,17 +95641,15 @@ var ts; } return ts.setOriginalNode(factory.createIdentifier(""), node); } + function isPrivateIdentifierInExpression(node) { + return ts.isPrivateIdentifier(node.left) + && node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */; + } /** * Visits `#id in expr` */ - function visitPrivateIdentifierInInExpression(node) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return node; - } - var privId = node.left; - ts.Debug.assertNode(privId, ts.isPrivateIdentifier); - ts.Debug.assert(node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */); - var info = accessPrivateIdentifier(privId); + function transformPrivateIdentifierInInExpression(node) { + var info = accessPrivateIdentifier(node.left); if (info) { var receiver = ts.visitNode(node.right, visitor, ts.isExpression); return ts.setOriginalNode(context.getEmitHelperFactory().createClassPrivateFieldInHelper(info.brandCheckIdentifier, receiver), node); @@ -94831,31 +95657,6 @@ var ts; // Private name has not been declared. Subsequent transformers will handle this error return ts.visitEachChild(node, visitor, context); } - /** - * Visits the members of a class that has fields. - * - * @param node The node to visit. - */ - function classElementVisitor(node) { - switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - // Constructors for classes using class fields are transformed in - // `visitClassDeclaration` or `visitClassExpression`. - return undefined; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - return visitMethodOrAccessorDeclaration(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitPropertyDeclaration(node); - case 162 /* SyntaxKind.ComputedPropertyName */: - return visitComputedPropertyName(node); - case 234 /* SyntaxKind.SemicolonClassElement */: - return node; - default: - return visitor(node); - } - } function visitVariableStatement(node) { var savedPendingStatements = pendingStatements; pendingStatements = []; @@ -94865,15 +95666,24 @@ var ts; pendingStatements = savedPendingStatements; return statement; } - function visitComputedPropertyName(name) { - var node = ts.visitEachChild(name, visitor, context); + function visitComputedPropertyName(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); if (ts.some(pendingExpressions)) { - var expressions = pendingExpressions; - expressions.push(node.expression); - pendingExpressions = []; - node = factory.updateComputedPropertyName(node, factory.inlineExpressions(expressions)); + if (ts.isParenthesizedExpression(expression)) { + expression = factory.updateParenthesizedExpression(expression, factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression.expression], false))); + } + else { + expression = factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression], false)); + } + pendingExpressions = undefined; } - return node; + return factory.updateComputedPropertyName(node, expression); + } + function visitConstructorDeclaration(node) { + if (currentClassContainer) { + return transformConstructor(node, currentClassContainer); + } + return fallbackVisitor(node); } function visitMethodOrAccessorDeclaration(node) { ts.Debug.assert(!ts.hasDecorators(node)); @@ -94888,13 +95698,20 @@ var ts; } var functionName = getHoistedFunctionName(node); if (functionName) { - getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return ts.isModifier(m) && !ts.isStaticModifier(m); }), node.asteriskToken, functionName, - /* typeParameters */ undefined, ts.visitParameterList(node.parameters, classElementVisitor, context), - /* type */ undefined, ts.visitFunctionBody(node.body, classElementVisitor, context)))); + getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return ts.isModifier(m) && !ts.isStaticModifier(m) && !ts.isAccessorModifier(m); }), node.asteriskToken, functionName, + /* typeParameters */ undefined, ts.visitParameterList(node.parameters, visitor, context), + /* type */ undefined, ts.visitFunctionBody(node.body, visitor, context)))); } // remove method declaration from class return undefined; } + function setCurrentStaticPropertyDeclarationOrStaticBlockAnd(current, visitor, arg) { + var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; + currentStaticPropertyDeclarationOrStaticBlock = current; + var result = visitor(arg); + currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; + return result; + } function getHoistedFunctionName(node) { ts.Debug.assert(ts.isPrivateIdentifier(node.name)); var info = accessPrivateIdentifier(node.name); @@ -94911,49 +95728,104 @@ var ts; } } } - function visitPropertyDeclaration(node) { - ts.Debug.assert(!ts.hasDecorators(node)); - if (ts.isPrivateIdentifier(node.name)) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - if (ts.isStatic(node)) { - // static fields are left as is - return ts.visitEachChild(node, visitor, context); - } - // Initializer is elided as the field is initialized in transformConstructor. - return factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, - /*questionOrExclamationToken*/ undefined, - /*type*/ undefined, - /*initializer*/ undefined); - } - // leave invalid code untransformed + function transformAutoAccessor(node) { + // transforms: + // accessor x = 1; + // into: + // #x = 1; + // get x() { return this.#x; } + // set x(value) { this.#x = value; } + ts.Debug.assertEachNode(node.modifiers, ts.isModifier); + var commentRange = ts.getCommentRange(node); + var sourceMapRange = ts.getSourceMapRange(node); + // Since we're creating two declarations where there was previously one, cache + // the expression for any computed property names. + var name = node.name; + var getterName = name; + var setterName = name; + if (ts.isComputedPropertyName(name) && !ts.isSimpleInlineableExpression(name.expression)) { + var temp = factory.createTempVariable(hoistVariableDeclaration); + ts.setSourceMapRange(temp, name.expression); + var expression = ts.visitNode(name.expression, visitor, ts.isExpression); + var assignment = factory.createAssignment(temp, expression); + ts.setSourceMapRange(assignment, name.expression); + getterName = factory.updateComputedPropertyName(name, factory.inlineExpressions([assignment, temp])); + setterName = factory.updateComputedPropertyName(name, temp); + } + var backingField = ts.createAccessorPropertyBackingField(factory, node, node.modifiers, node.initializer); + ts.setOriginalNode(backingField, node); + ts.setEmitFlags(backingField, 1536 /* EmitFlags.NoComments */); + ts.setSourceMapRange(backingField, sourceMapRange); + var getter = ts.createAccessorPropertyGetRedirector(factory, node, node.modifiers, getterName); + ts.setOriginalNode(getter, node); + ts.setCommentRange(getter, commentRange); + ts.setSourceMapRange(getter, sourceMapRange); + var setter = ts.createAccessorPropertySetRedirector(factory, node, node.modifiers, setterName); + ts.setOriginalNode(setter, node); + ts.setEmitFlags(setter, 1536 /* EmitFlags.NoComments */); + ts.setSourceMapRange(setter, sourceMapRange); + return ts.visitArray([backingField, getter, setter], accessorFieldResultVisitor, ts.isClassElement); + } + function transformPrivateFieldInitializer(node) { + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + // If we are transforming private elements into WeakMap/WeakSet, we should elide the node. var info = accessPrivateIdentifier(node.name); ts.Debug.assert(info, "Undeclared private name for property declaration."); - if (!info.isValid) { - return node; + // Leave invalid code untransformed; otherwise, elide the node as it is transformed elsewhere. + return info.isValid ? undefined : node; + } + if (shouldTransformInitializersUsingSet && !ts.isStatic(node)) { + // If we are transforming initializers using Set semantics we will elide the initializer as it will + // be moved to the constructor to preserve evaluation order next to public instance fields. We don't + // need to do this transformation for private static fields since public static fields can be + // transformed into `static {}` blocks. + return factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, + /*initializer*/ undefined); + } + return ts.visitEachChild(node, visitor, context); + } + function transformPublicFieldInitializer(node) { + if (shouldTransformInitializers) { + // Create a temporary variable to store a computed property name (if necessary). + // If it's not inlineable, then we emit an expression after the class which assigns + // the property name to the temporary variable. + var expr = getPropertyNameExpressionIfNeeded(node.name, /*shouldHoist*/ !!node.initializer || useDefineForClassFields); + if (expr) { + getPendingExpressions().push(expr); } - } - // Create a temporary variable to store a computed property name (if necessary). - // If it's not inlineable, then we emit an expression after the class which assigns - // the property name to the temporary variable. - var expr = getPropertyNameExpressionIfNeeded(node.name, !!node.initializer || useDefineForClassFields); - if (expr && !ts.isSimpleInlineableExpression(expr)) { - getPendingExpressions().push(expr); - } - if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks && !useDefineForClassFields) { - var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); - if (initializerStatement) { - var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); - ts.setOriginalNode(staticBlock, node); - ts.setCommentRange(staticBlock, node); - // Set the comment range for the statement to an empty synthetic range - // and drop synthetic comments from the statement to avoid printing them twice. - ts.setCommentRange(initializerStatement, { pos: -1, end: -1 }); - ts.setSyntheticLeadingComments(initializerStatement, undefined); - ts.setSyntheticTrailingComments(initializerStatement, undefined); - return staticBlock; + if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks) { + var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); + if (initializerStatement) { + var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); + ts.setOriginalNode(staticBlock, node); + ts.setCommentRange(staticBlock, node); + // Set the comment range for the statement to an empty synthetic range + // and drop synthetic comments from the statement to avoid printing them twice. + ts.setCommentRange(initializerStatement, { pos: -1, end: -1 }); + ts.setSyntheticLeadingComments(initializerStatement, undefined); + ts.setSyntheticTrailingComments(initializerStatement, undefined); + return staticBlock; + } } + return undefined; } - return undefined; + return ts.visitEachChild(node, classElementVisitor, context); + } + function transformFieldInitializer(node) { + ts.Debug.assert(!ts.hasDecorators(node), "Decorators should already have been transformed and elided."); + return ts.isPrivateIdentifierClassElementDeclaration(node) ? + transformPrivateFieldInitializer(node) : + transformPublicFieldInitializer(node); + } + function visitPropertyDeclaration(node) { + // If this is an auto-accessor, we defer to `transformAutoAccessor`. That function + // will in turn call `transformFieldInitializer` as needed. + if (shouldTransformAutoAccessors && ts.isAutoAccessorPropertyDeclaration(node)) { + return transformAutoAccessor(node); + } + return transformFieldInitializer(node); } function createPrivateIdentifierAccess(info, receiver) { return createPrivateIdentifierAccessHelper(info, ts.visitNode(receiver, visitor, ts.isExpression)); @@ -95017,9 +95889,11 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitPreOrPostfixUnaryExpression(node, valueIsDiscarded) { - if (node.operator === 45 /* SyntaxKind.PlusPlusToken */ || node.operator === 46 /* SyntaxKind.MinusMinusToken */) { + if (node.operator === 45 /* SyntaxKind.PlusPlusToken */ || + node.operator === 46 /* SyntaxKind.MinusMinusToken */) { var operand = ts.skipParentheses(node.operand); - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(operand)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(operand)) { var info = void 0; if (info = accessPrivateIdentifier(operand.name)) { var receiver = ts.visitNode(operand.expression, visitor, ts.isExpression); @@ -95108,7 +95982,9 @@ var ts; return { readExpression: readExpression, initializeExpression: initializeExpression }; } function visitCallExpression(node) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) { + // obj.#x() // Transform call expressions of private names to properly bind the `this` parameter. var _a = factory.createCallBinding(node.expression, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; if (ts.isCallChain(node)) { @@ -95123,6 +95999,8 @@ var ts; ts.isSuperProperty(node.expression) && currentStaticPropertyDeclarationOrStaticBlock && (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.classConstructor)) { + // super.x() + // super[x]() // converts `super.f(...)` into `Reflect.get(_baseTemp, "f", _classTemp).call(_classTemp, ...)` var invocation = factory.createFunctionCallCall(ts.visitNode(node.expression, visitor, ts.isExpression), currentClassLexicalEnvironment.classConstructor, ts.visitNodes(node.arguments, visitor, ts.isExpression)); ts.setOriginalNode(invocation, node); @@ -95132,7 +96010,8 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitTaggedTemplateExpression(node) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) { // Bind the `this` correctly for tagged template literals when the tag is a private identifier property access. var _a = factory.createCallBinding(node.tag, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; return factory.updateTaggedTemplateExpression(node, factory.createCallExpression(factory.createPropertyAccessExpression(ts.visitNode(target, visitor), "bind"), @@ -95158,11 +96037,8 @@ var ts; classLexicalEnvironmentMap.set(ts.getOriginalNodeId(node), currentClassLexicalEnvironment); } startLexicalEnvironment(); - var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = node; - var statements = ts.visitNodes(node.body.statements, visitor, ts.isStatement); + var statements = setCurrentStaticPropertyDeclarationOrStaticBlockAnd(node, function (statements) { return ts.visitNodes(statements, visitor, ts.isStatement); }, node.body.statements); statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; var iife = factory.createImmediatelyInvokedArrowFunction(statements); ts.setOriginalNode(iife, node); ts.setTextRange(iife, node); @@ -95172,9 +96048,12 @@ var ts; } function visitBinaryExpression(node, valueIsDiscarded) { if (ts.isDestructuringAssignment(node)) { + // ({ x: obj.#x } = ...) + // ({ x: super.x } = ...) + // ({ x: super[x] } = ...) var savedPendingExpressions = pendingExpressions; pendingExpressions = undefined; - node = factory.updateBinaryExpression(node, ts.visitNode(node.left, visitorDestructuringTarget), node.operatorToken, ts.visitNode(node.right, visitor)); + node = factory.updateBinaryExpression(node, ts.visitNode(node.left, assignmentTargetVisitor), node.operatorToken, ts.visitNode(node.right, visitor)); var expr = ts.some(pendingExpressions) ? factory.inlineExpressions(ts.compact(__spreadArray(__spreadArray([], pendingExpressions, true), [node], false))) : node; @@ -95182,7 +96061,9 @@ var ts; return expr; } if (ts.isAssignmentExpression(node)) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.left)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.left)) { + // obj.#x = ... var info = accessPrivateIdentifier(node.left.name); if (info) { return ts.setTextRange(ts.setOriginalNode(createPrivateIdentifierAssignment(info, node.left.expression, node.right, node.operatorToken.kind), node), node); @@ -95192,6 +96073,10 @@ var ts; ts.isSuperProperty(node.left) && currentStaticPropertyDeclarationOrStaticBlock && currentClassLexicalEnvironment) { + // super.x = ... + // super[x] = ... + // super.x += ... + // super.x -= ... var classConstructor = currentClassLexicalEnvironment.classConstructor, superClassReference = currentClassLexicalEnvironment.superClassReference, facts = currentClassLexicalEnvironment.facts; if (facts & 1 /* ClassFacts.ClassWasDecorated */) { return factory.updateBinaryExpression(node, visitInvalidSuperProperty(node.left), node.operatorToken, ts.visitNode(node.right, visitor, ts.isExpression)); @@ -95235,8 +96120,10 @@ var ts; } } } - if (node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */ && ts.isPrivateIdentifier(node.left)) { - return visitPrivateIdentifierInInExpression(node); + if (shouldTransformPrivateElementsOrClassStaticBlocks && + isPrivateIdentifierInExpression(node)) { + // #x in obj + return transformPrivateIdentifierInInExpression(node); } return ts.visitEachChild(node, visitor, context); } @@ -95261,36 +96148,6 @@ var ts; ts.Debug.assertNever(info, "Unknown private element type"); } } - /** - * Set up the environment for a class. - */ - function visitClassLike(node) { - if (!ts.forEach(node.members, doesClassElementNeedTransform)) { - return ts.visitEachChild(node, visitor, context); - } - var savedPendingExpressions = pendingExpressions; - pendingExpressions = undefined; - startClassLexicalEnvironment(); - if (shouldTransformPrivateElementsOrClassStaticBlocks) { - var name = ts.getNameOfDeclaration(node); - if (name && ts.isIdentifier(name)) { - getPrivateIdentifierEnvironment().className = ts.idText(name); - } - var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); - if (ts.some(privateInstanceMethodsAndAccessors)) { - getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); - } - } - var result = ts.isClassDeclaration(node) ? - visitClassDeclaration(node) : - visitClassExpression(node); - endClassLexicalEnvironment(); - pendingExpressions = savedPendingExpressions; - return result; - } - function doesClassElementNeedTransform(node) { - return ts.isPropertyDeclaration(node) || ts.isClassStaticBlockDeclaration(node) || (shouldTransformPrivateElementsOrClassStaticBlocks && node.name && ts.isPrivateIdentifier(node.name)); - } function getPrivateInstanceMethodsAndAccessors(node) { return ts.filter(node.members, ts.isNonStaticMethodOrAccessorWithPrivateName); } @@ -95304,7 +96161,7 @@ var ts; var member = _a[_i]; if (!ts.isStatic(member)) continue; - if (member.name && ts.isPrivateIdentifier(member.name) && shouldTransformPrivateElementsOrClassStaticBlocks) { + if (member.name && (ts.isPrivateIdentifier(member.name) || ts.isAutoAccessorPropertyDeclaration(member)) && shouldTransformPrivateElementsOrClassStaticBlocks) { facts |= 2 /* ClassFacts.NeedsClassConstructorReference */; } if (ts.isPropertyDeclaration(member) || ts.isClassStaticBlockDeclaration(member)) { @@ -95323,7 +96180,7 @@ var ts; } return facts; } - function visitExpressionWithTypeArguments(node) { + function visitExpressionWithTypeArgumentsInHeritageClause(node) { var facts = (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.facts) || 0 /* ClassFacts.None */; if (facts & 4 /* ClassFacts.NeedsClassSuperReference */) { var temp = factory.createTempVariable(hoistVariableDeclaration, /*reserveInNestedScopes*/ true); @@ -95333,7 +96190,22 @@ var ts; } return ts.visitEachChild(node, visitor, context); } - function visitClassDeclaration(node) { + function visitInNewClassLexicalEnvironment(node, visitor) { + var savedCurrentClassContainer = currentClassContainer; + var savedPendingExpressions = pendingExpressions; + currentClassContainer = node; + pendingExpressions = undefined; + startClassLexicalEnvironment(); + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + var name = ts.getNameOfDeclaration(node); + if (name && ts.isIdentifier(name)) { + getPrivateIdentifierEnvironment().className = name; + } + var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); + if (ts.some(privateInstanceMethodsAndAccessors)) { + getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); + } + } var facts = getClassFacts(node); if (facts) { getClassLexicalEnvironment().facts = facts; @@ -95341,6 +96213,16 @@ var ts; if (facts & 8 /* ClassFacts.NeedsSubstitutionForThisInClassStaticField */) { enableSubstitutionForClassStaticThisOrSuperReference(); } + var result = visitor(node, facts); + endClassLexicalEnvironment(); + currentClassContainer = savedCurrentClassContainer; + pendingExpressions = savedPendingExpressions; + return result; + } + function visitClassDeclaration(node) { + return visitInNewClassLexicalEnvironment(node, visitClassDeclarationInNewClassLexicalEnvironment); + } + function visitClassDeclarationInNewClassLexicalEnvironment(node, facts) { // If a class has private static fields, or a static field has a `this` or `super` reference, // then we need to allocate a temp variable to hold on to that reference. var pendingClassReferenceAssignment; @@ -95349,12 +96231,16 @@ var ts; getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); pendingClassReferenceAssignment = factory.createAssignment(temp, factory.getInternalName(node)); } - var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); - var statements = [ - factory.updateClassDeclaration(node, node.modifiers, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)) - ]; + var modifiers = ts.visitNodes(node.modifiers, visitor, ts.isModifierLike); + var heritageClauses = ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classDecl = factory.updateClassDeclaration(node, modifiers, node.name, + /*typeParameters*/ undefined, heritageClauses, members); + var statements = []; + if (prologue) { + statements.push(factory.createExpressionStatement(prologue)); + } + statements.push(classDecl); if (pendingClassReferenceAssignment) { getPendingExpressions().unshift(pendingClassReferenceAssignment); } @@ -95362,25 +96248,23 @@ var ts; if (ts.some(pendingExpressions)) { statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))); } - // Emit static property assignment. Because classDeclaration is lexically evaluated, - // it is safe to emit static property assignment after classDeclaration - // From ES6 specification: - // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using - // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. - var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node); - if (ts.some(staticProperties)) { - addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + if (shouldTransformInitializersUsingSet || shouldTransformPrivateElementsOrClassStaticBlocks) { + // Emit static property assignment. Because classDeclaration is lexically evaluated, + // it is safe to emit static property assignment after classDeclaration + // From ES6 specification: + // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using + // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. + var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node); + if (ts.some(staticProperties)) { + addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + } } return statements; } function visitClassExpression(node) { - var facts = getClassFacts(node); - if (facts) { - getClassLexicalEnvironment().facts = facts; - } - if (facts & 8 /* ClassFacts.NeedsSubstitutionForThisInClassStaticField */) { - enableSubstitutionForClassStaticThisOrSuperReference(); - } + return visitInNewClassLexicalEnvironment(node, visitClassExpressionInNewClassLexicalEnvironment); + } + function visitClassExpressionInNewClassLexicalEnvironment(node, facts) { // If this class expression is a transformation of a decorated class declaration, // then we want to output the pendingExpressions as statements, not as inlined // expressions with the class statement. @@ -95390,8 +96274,6 @@ var ts; // these statements after the class expression variable statement. var isDecoratedClassDeclaration = !!(facts & 1 /* ClassFacts.ClassWasDecorated */); var staticPropertiesOrClassStaticBlocks = ts.getStaticPropertiesAndClassStaticBlock(node); - var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); var isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 16777216 /* NodeCheckFlags.ClassWithConstructorReference */; var temp; function createClassTempVar() { @@ -95404,9 +96286,23 @@ var ts; temp = createClassTempVar(); getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); } - var classExpression = factory.updateClassExpression(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)); - var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(staticPropertiesOrClassStaticBlocks, function (p) { return ts.isClassStaticBlockDeclaration(p) || !!p.initializer || ts.isPrivateIdentifier(p.name); }); + var modifiers = ts.visitNodes(node.modifiers, visitor, ts.isModifierLike); + var heritageClauses = ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classExpression = factory.updateClassExpression(node, modifiers, node.name, + /*typeParameters*/ undefined, heritageClauses, members); + var expressions = []; + if (prologue) { + expressions.push(prologue); + } + // Static initializers are transformed to `static {}` blocks when `useDefineForClassFields: false` + // and not also transforming static blocks. + var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && + ts.some(staticPropertiesOrClassStaticBlocks, function (node) { + return ts.isClassStaticBlockDeclaration(node) || + ts.isPrivateIdentifierClassElementDeclaration(node) || + shouldTransformInitializers && ts.isInitializedProperty(node); + }); if (hasTransformableStatics || ts.some(pendingExpressions)) { if (isDecoratedClassDeclaration) { ts.Debug.assertIsDefined(pendingStatements, "Decorated classes transformed by TypeScript are expected to be within a variable declaration."); @@ -95418,12 +96314,16 @@ var ts; addPropertyOrClassStaticBlockStatements(pendingStatements, staticPropertiesOrClassStaticBlocks, factory.getInternalName(node)); } if (temp) { - return factory.inlineExpressions([factory.createAssignment(temp, classExpression), temp]); + expressions.push(ts.startOnNewLine(factory.createAssignment(temp, classExpression)), ts.startOnNewLine(temp)); + } + else { + expressions.push(classExpression); + if (prologue) { + ts.startOnNewLine(classExpression); + } } - return classExpression; } else { - var expressions = []; temp || (temp = createClassTempVar()); if (isClassWithConstructorReference) { // record an alias as the class name is not in scope for statics. @@ -95440,45 +96340,87 @@ var ts; ts.addRange(expressions, ts.map(pendingExpressions, ts.startOnNewLine)); ts.addRange(expressions, generateInitializedPropertyExpressionsOrClassStaticBlock(staticPropertiesOrClassStaticBlocks, temp)); expressions.push(ts.startOnNewLine(temp)); - return factory.inlineExpressions(expressions); } } - return classExpression; + else { + expressions.push(classExpression); + if (prologue) { + ts.startOnNewLine(classExpression); + } + } + return factory.inlineExpressions(expressions); } function visitClassStaticBlockDeclaration(node) { if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return ts.visitEachChild(node, classElementVisitor, context); + return ts.visitEachChild(node, visitor, context); } // ClassStaticBlockDeclaration for classes are transformed in `visitClassDeclaration` or `visitClassExpression`. return undefined; } - function transformClassMembers(node, isDerivedClass) { - var members = []; + function transformClassMembers(node) { + // Declare private names if (shouldTransformPrivateElementsOrClassStaticBlocks) { - // Declare private names. for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; if (ts.isPrivateIdentifierClassElementDeclaration(member)) { - addPrivateIdentifierToEnvironment(member); + addPrivateIdentifierToEnvironment(member, member.name, addPrivateIdentifierClassElementToEnvironment); } } if (ts.some(getPrivateInstanceMethodsAndAccessors(node))) { createBrandCheckWeakSetForPrivateMethods(); } + if (shouldTransformAutoAccessors) { + for (var _b = 0, _c = node.members; _b < _c.length; _b++) { + var member = _c[_b]; + if (ts.isAutoAccessorPropertyDeclaration(member)) { + var storageName = factory.getGeneratedPrivateNameForNode(member.name, /*prefix*/ undefined, "_accessor_storage"); + addPrivateIdentifierToEnvironment(member, storageName, addPrivateIdentifierPropertyDeclarationToEnvironment); + } + } + } } - var constructor = transformConstructor(node, isDerivedClass); - var visitedMembers = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement); - if (constructor) { - members.push(constructor); + var members = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement); + // Create a synthetic constructor if necessary + var syntheticConstructor; + if (!ts.some(members, ts.isConstructorDeclaration)) { + syntheticConstructor = transformConstructor(/*constructor*/ undefined, node); } + var prologue; + // If there are pending expressions create a class static block in which to evaluate them, but only if + // class static blocks are not also being transformed. This block will be injected at the top of the class + // to ensure that expressions from computed property names are evaluated before any other static + // initializers. + var syntheticStaticBlock; if (!shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(pendingExpressions)) { - members.push(factory.createClassStaticBlockDeclaration(factory.createBlock([ - factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)) - ]))); + var statement = factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)); + if (statement.transformFlags & 134234112 /* TransformFlags.ContainsLexicalThisOrSuper */) { + // If there are `this` or `super` references from computed property names, shift the expression + // into an arrow function to be evaluated in the outer scope so that `this` and `super` are + // properly captured. + var temp = factory.createTempVariable(hoistVariableDeclaration); + var arrow = factory.createArrowFunction( + /*modifiers*/ undefined, + /*typeParameters*/ undefined, + /*parameters*/ [], + /*type*/ undefined, + /*equalsGreaterThanToken*/ undefined, factory.createBlock([statement])); + prologue = factory.createAssignment(temp, arrow); + statement = factory.createExpressionStatement(factory.createCallExpression(temp, /*typeArguments*/ undefined, [])); + } + var block = factory.createBlock([statement]); + syntheticStaticBlock = factory.createClassStaticBlockDeclaration(block); pendingExpressions = undefined; } - ts.addRange(members, visitedMembers); - return ts.setTextRange(factory.createNodeArray(members), /*location*/ node.members); + // If we created a synthetic constructor or class static block, add them to the visited members + // and return a new array. + if (syntheticConstructor || syntheticStaticBlock) { + var membersArray = void 0; + membersArray = ts.append(membersArray, syntheticConstructor); + membersArray = ts.append(membersArray, syntheticStaticBlock); + membersArray = ts.addRange(membersArray, members); + members = ts.setTextRange(factory.createNodeArray(membersArray), /*location*/ node.members); + } + return { members: members, prologue: prologue }; } function createBrandCheckWeakSetForPrivateMethods() { var weakSetName = getPrivateIdentifierEnvironment().weakSetName; @@ -95487,35 +96429,38 @@ var ts; /*typeArguments*/ undefined, []))); } function isClassElementThatRequiresConstructorStatement(member) { - if (ts.isStatic(member) || ts.hasSyntacticModifier(ts.getOriginalNode(member), 128 /* ModifierFlags.Abstract */)) { + if (ts.isStatic(member) || ts.hasAbstractModifier(ts.getOriginalNode(member))) { return false; } - if (useDefineForClassFields) { - // If we are using define semantics and targeting ESNext or higher, - // then we don't need to transform any class properties. - return languageVersion < 9 /* ScriptTarget.ES2022 */; - } - return ts.isInitializedProperty(member) || shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member); + return shouldTransformInitializersUsingDefine && ts.isPropertyDeclaration(member) || + shouldTransformInitializersUsingSet && ts.isInitializedProperty(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && shouldTransformAutoAccessors && ts.isAutoAccessorPropertyDeclaration(member); } - function transformConstructor(node, isDerivedClass) { - var constructor = ts.visitNode(ts.getFirstConstructorWithBody(node), visitor, ts.isConstructorDeclaration); - var elements = node.members.filter(isClassElementThatRequiresConstructorStatement); - if (!ts.some(elements)) { + function transformConstructor(constructor, container) { + constructor = ts.visitNode(constructor, visitor, ts.isConstructorDeclaration); + if (!ts.some(container.members, isClassElementThatRequiresConstructorStatement)) { return constructor; } + var extendsClauseElement = ts.getEffectiveBaseTypeNode(container); + var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); var parameters = ts.visitParameterList(constructor ? constructor.parameters : undefined, visitor, context); - var body = transformConstructorBody(node, constructor, isDerivedClass); + var body = transformConstructorBody(container, constructor, isDerivedClass); if (!body) { - return undefined; + return constructor; + } + if (constructor) { + ts.Debug.assert(parameters); + return factory.updateConstructorDeclaration(constructor, /*modifiers*/ undefined, parameters, body); } return ts.startOnNewLine(ts.setOriginalNode(ts.setTextRange(factory.createConstructorDeclaration( - /*modifiers*/ undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || node), constructor)); + /*modifiers*/ undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || container), constructor)); } function transformConstructorBody(node, constructor, isDerivedClass) { - var _a; + var _a, _b; var properties = ts.getProperties(node, /*requireInitializer*/ false, /*isStatic*/ false); if (!useDefineForClassFields) { - properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name); }); + properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name) || ts.hasAccessorModifier(property); }); } var privateMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); var needsConstructorBody = ts.some(properties) || ts.some(privateMethodsAndAccessors); @@ -95567,8 +96512,8 @@ var ts; statements = statements.filter(function (statement) { return !ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor); }); } else { - for (var _i = 0, _b = constructor.body.statements; _i < _b.length; _i++) { - var statement = _b[_i]; + for (var _i = 0, _c = constructor.body.statements; _i < _c.length; _i++) { + var statement = _c[_i]; if (ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) { parameterPropertyDeclarationCount++; } @@ -95600,9 +96545,14 @@ var ts; ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue)); } statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); + if (statements.length === 0 && !constructor) { + return undefined; + } + var multiLine = (constructor === null || constructor === void 0 ? void 0 : constructor.body) && constructor.body.statements.length >= statements.length ? + (_b = constructor.body.multiLine) !== null && _b !== void 0 ? _b : statements.length > 0 : + statements.length > 0; return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), - /*location*/ constructor ? constructor.body.statements : node.members), - /*multiLine*/ true), + /*location*/ constructor ? constructor.body.statements : node.members), multiLine), /*location*/ constructor ? constructor.body : undefined); function visitBodyStatement(statement) { if (useDefineForClassFields && ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) { @@ -95638,9 +96588,10 @@ var ts; return undefined; } var statement = factory.createExpressionStatement(expression); + ts.setOriginalNode(statement, property); + ts.addEmitFlags(statement, ts.getEmitFlags(property) & 1536 /* EmitFlags.NoComments */); ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)); ts.setCommentRange(statement, property); - ts.setOriginalNode(statement, property); // `setOriginalNode` *copies* the `emitNode` from `property`, so now both // `statement` and `expression` have a copy of the synthesized comments. // Drop the comments from expression to avoid printing them twice. @@ -95663,9 +96614,10 @@ var ts; continue; } ts.startOnNewLine(expression); + ts.setOriginalNode(expression, property); + ts.addEmitFlags(expression, ts.getEmitFlags(property) & 1536 /* EmitFlags.NoComments */); ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)); ts.setCommentRange(expression, property); - ts.setOriginalNode(expression, property); expressions.push(expression); } return expressions; @@ -95692,9 +96644,11 @@ var ts; var _a; // We generate a name here in order to reuse the value cached by the relocated computed name expression (which uses the same generated name) var emitAssignment = !useDefineForClassFields; - var propertyName = ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression) - ? factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) - : property.name; + var propertyName = ts.hasAccessorModifier(property) ? + factory.getGeneratedPrivateNameForNode(property.name) : + ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression) ? + factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) : + property.name; if (ts.hasStaticModifier(property)) { currentStaticPropertyDeclarationOrStaticBlock = property; } @@ -95721,7 +96675,7 @@ var ts; return undefined; } var propertyOriginalNode = ts.getOriginalNode(property); - if (ts.hasSyntacticModifier(propertyOriginalNode, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(propertyOriginalNode, 256 /* ModifierFlags.Abstract */)) { return undefined; } var initializer = property.initializer || emitAssignment ? (_a = ts.visitNode(property.initializer, visitor, ts.isExpression)) !== null && _a !== void 0 ? _a : factory.createVoidZero() @@ -95755,17 +96709,17 @@ var ts; // substitute `this` in a static field initializer context.enableSubstitution(108 /* SyntaxKind.ThisKeyword */); // these push a new lexical environment that is not the class lexical environment - context.enableEmitNotification(256 /* SyntaxKind.FunctionDeclaration */); - context.enableEmitNotification(213 /* SyntaxKind.FunctionExpression */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(259 /* SyntaxKind.FunctionDeclaration */); + context.enableEmitNotification(215 /* SyntaxKind.FunctionExpression */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // these push a new lexical environment that is not the class lexical environment, except // when they have a computed property name - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(167 /* SyntaxKind.PropertyDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(169 /* SyntaxKind.PropertyDeclaration */); // class lexical environments are restored when entering a computed property name - context.enableEmitNotification(162 /* SyntaxKind.ComputedPropertyName */); + context.enableEmitNotification(164 /* SyntaxKind.ComputedPropertyName */); } } /** @@ -95804,13 +96758,13 @@ var ts; } } switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (ts.isArrowFunction(original) || ts.getEmitFlags(node) & 262144 /* EmitFlags.AsyncFunctionBody */) { break; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 171 /* SyntaxKind.Constructor */: { + case 259 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentClassLexicalEnvironment = undefined; @@ -95820,10 +96774,10 @@ var ts; currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; return; } - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentComputedPropertyNameClassLexicalEnvironment = currentClassLexicalEnvironment; @@ -95833,7 +96787,7 @@ var ts; currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; return; } - case 162 /* SyntaxKind.ComputedPropertyName */: { + case 164 /* SyntaxKind.ComputedPropertyName */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; @@ -95947,149 +96901,138 @@ var ts; function getPrivateIdentifierEnvironment() { var lex = getClassLexicalEnvironment(); lex.privateIdentifierEnvironment || (lex.privateIdentifierEnvironment = { - className: "", - identifiers: new ts.Map() + className: undefined, + weakSetName: undefined, + identifiers: undefined, + generatedIdentifiers: undefined, }); return lex.privateIdentifierEnvironment; } function getPendingExpressions() { - return pendingExpressions || (pendingExpressions = []); + return pendingExpressions !== null && pendingExpressions !== void 0 ? pendingExpressions : (pendingExpressions = []); } - function addPrivateIdentifierToEnvironment(node) { - var _a; - var text = ts.getTextOfPropertyName(node.name); - var lex = getClassLexicalEnvironment(); - var classConstructor = lex.classConstructor; - var privateEnv = getPrivateIdentifierEnvironment(); - var weakSetName = privateEnv.weakSetName; - var assignmentExpressions = []; - var privateName = node.name.escapedText; - var previousInfo = privateEnv.identifiers.get(privateName); - var isValid = !isReservedPrivateName(node.name) && previousInfo === undefined; - if (ts.hasStaticModifier(node)) { - ts.Debug.assert(classConstructor, "weakSetName should be set in private identifier environment"); - if (ts.isPropertyDeclaration(node)) { - var variableName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "f" /* PrivateIdentifierKind.Field */, - variableName: variableName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - else if (ts.isMethodDeclaration(node)) { - var functionName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "m" /* PrivateIdentifierKind.Method */, - methodName: functionName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - else if (ts.isGetAccessorDeclaration(node)) { - var getterName = createHoistedVariableForPrivateName(text + "_get", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: getterName, - setterName: undefined, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - } - else if (ts.isSetAccessorDeclaration(node)) { - var setterName = createHoistedVariableForPrivateName(text + "_set", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: undefined, - setterName: setterName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - } - else { - ts.Debug.assertNever(node, "Unknown class element type."); - } + function addPrivateIdentifierClassElementToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + if (ts.isAutoAccessorPropertyDeclaration(node)) { + addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); } else if (ts.isPropertyDeclaration(node)) { - var weakMapName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "f" /* PrivateIdentifierKind.Field */, - brandCheckIdentifier: weakMapName, - isStatic: false, - variableName: undefined, - isValid: isValid, - }); - assignmentExpressions.push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), - /*typeArguments*/ undefined, []))); + addPrivateIdentifierPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); } else if (ts.isMethodDeclaration(node)) { - ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); - privateEnv.identifiers.set(privateName, { - kind: "m" /* PrivateIdentifierKind.Method */, - methodName: createHoistedVariableForPrivateName(text, node), - brandCheckIdentifier: weakSetName, - isStatic: false, + addPrivateIdentifierMethodDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isGetAccessorDeclaration(node)) { + addPrivateIdentifierGetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isSetAccessorDeclaration(node)) { + addPrivateIdentifierSetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + } + function addPrivateIdentifierPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + if (isStatic) { + ts.Debug.assert(lex.classConstructor, "classConstructor should be set in private identifier environment"); + var variableName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { + kind: "f" /* PrivateIdentifierKind.Field */, + brandCheckIdentifier: lex.classConstructor, + variableName: variableName, + isStatic: true, isValid: isValid, }); } - else if (ts.isAccessor(node)) { - ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); - if (ts.isGetAccessor(node)) { - var getterName = createHoistedVariableForPrivateName(text + "_get", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && !previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: getterName, - setterName: undefined, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid: isValid, - }); - } - } - else { - var setterName = createHoistedVariableForPrivateName(text + "_set", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && !previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: undefined, - setterName: setterName, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid: isValid, - }); - } - } + else { + var weakMapName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { + kind: "f" /* PrivateIdentifierKind.Field */, + brandCheckIdentifier: weakMapName, + variableName: undefined, + isStatic: false, + isValid: isValid, + }); + getPendingExpressions().push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), + /*typeArguments*/ undefined, []))); + } + } + function addPrivateIdentifierMethodDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var methodName = createHoistedVariableForPrivateName(name); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "m" /* PrivateIdentifierKind.Method */, + methodName: methodName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + function addPrivateIdentifierGetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic === isStatic && !previousInfo.getterName) { + previousInfo.getterName = getterName; } else { - ts.Debug.assertNever(node, "Unknown class element type."); + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: getterName, + setterName: undefined, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); } - (_a = getPendingExpressions()).push.apply(_a, assignmentExpressions); } - function createHoistedVariableForClass(name, node) { + function addPrivateIdentifierSetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic === isStatic && !previousInfo.setterName) { + previousInfo.setterName = setterName; + } + else { + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: undefined, + setterName: setterName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + } + function addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: getterName, + setterName: setterName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + function addPrivateIdentifierToEnvironment(node, name, addDeclaration) { + var lex = getClassLexicalEnvironment(); + var privateEnv = getPrivateIdentifierEnvironment(); + var previousInfo = getPrivateIdentifier(privateEnv, name); + var isStatic = ts.hasStaticModifier(node); + var isValid = !isReservedPrivateName(name) && previousInfo === undefined; + addDeclaration(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + function createHoistedVariableForClass(name, node, suffix) { var className = getPrivateIdentifierEnvironment().className; - var prefix = className ? "_".concat(className) : ""; - var identifier = factory.createUniqueName("".concat(prefix, "_").concat(name), 16 /* GeneratedIdentifierFlags.Optimistic */); + var prefix = className ? { prefix: "_", node: className, suffix: "_" } : "_"; + var identifier = typeof name === "object" ? factory.getGeneratedNameForNode(name, 16 /* GeneratedIdentifierFlags.Optimistic */ | 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */, prefix, suffix) : + typeof name === "string" ? factory.createUniqueName(name, 16 /* GeneratedIdentifierFlags.Optimistic */, prefix, suffix) : + factory.createTempVariable(/*recordTempVariable*/ undefined, /*reserveInNestedScopes*/ true, prefix, suffix); if (resolver.getNodeCheckFlags(node) & 524288 /* NodeCheckFlags.BlockScopedBindingInLoop */) { addBlockScopedVariable(identifier); } @@ -96098,13 +97041,33 @@ var ts; } return identifier; } - function createHoistedVariableForPrivateName(privateName, node) { - return createHoistedVariableForClass(privateName.substring(1), node.name); - } - function accessPrivateIdentifier(name) { + function createHoistedVariableForPrivateName(name, suffix) { var _a; + var text = ts.tryGetTextOfPropertyName(name); + return createHoistedVariableForClass((_a = text === null || text === void 0 ? void 0 : text.substring(1)) !== null && _a !== void 0 ? _a : name, name, suffix); + } + /** + * Access an already defined {@link PrivateIdentifier} in the current {@link PrivateIdentifierEnvironment}. + * + * @seealso {@link addPrivateIdentifierToEnvironment} + */ + function accessPrivateIdentifier(name) { + if (ts.isGeneratedPrivateIdentifier(name)) { + return accessGeneratedPrivateIdentifier(name); + } + else { + return accessPrivateIdentifierByText(name.escapedText); + } + } + function accessPrivateIdentifierByText(text) { + return accessPrivateIdentifierWorker(getPrivateIdentifierInfo, text); + } + function accessGeneratedPrivateIdentifier(name) { + return accessPrivateIdentifierWorker(getGeneratedPrivateIdentifierInfo, ts.getNodeForGeneratedName(name)); + } + function accessPrivateIdentifierWorker(getPrivateIdentifierInfo, privateIdentifierKey) { if (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.privateIdentifierEnvironment) { - var info = currentClassLexicalEnvironment.privateIdentifierEnvironment.identifiers.get(name.escapedText); + var info = getPrivateIdentifierInfo(currentClassLexicalEnvironment.privateIdentifierEnvironment, privateIdentifierKey); if (info) { return info; } @@ -96114,9 +97077,11 @@ var ts; if (!env) { continue; } - var info = (_a = env.privateIdentifierEnvironment) === null || _a === void 0 ? void 0 : _a.identifiers.get(name.escapedText); - if (info) { - return info; + if (env.privateIdentifierEnvironment) { + var info = getPrivateIdentifierInfo(env.privateIdentifierEnvironment, privateIdentifierKey); + if (info) { + return info; + } } } return undefined; @@ -96173,7 +97138,7 @@ var ts; } } } - return ts.visitNode(node, visitorDestructuringTarget); + return ts.visitNode(node, assignmentTargetVisitor); } function visitObjectAssignmentTarget(node) { if (ts.isObjectBindingOrAssignmentElement(node) && !ts.isShorthandPropertyAssignment(node)) { @@ -96206,10 +97171,10 @@ var ts; var initializer = ts.getInitializerOfBindingOrAssignmentElement(node); return factory.updatePropertyAssignment(node, ts.visitNode(node.name, visitor, ts.isPropertyName), wrapped ? initializer ? factory.createAssignment(wrapped, ts.visitNode(initializer, visitor)) : wrapped : - ts.visitNode(node.initializer, visitorDestructuringTarget, ts.isExpression)); + ts.visitNode(node.initializer, assignmentTargetVisitor, ts.isExpression)); } if (ts.isSpreadAssignment(node)) { - return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, visitorDestructuringTarget, ts.isExpression)); + return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, assignmentTargetVisitor, ts.isExpression)); } ts.Debug.assert(wrapped === undefined, "Should not have generated a wrapped target"); } @@ -96255,7 +97220,31 @@ var ts; /*typeArguments*/ undefined, [receiver]); } function isReservedPrivateName(node) { - return node.escapedText === "#constructor"; + return !ts.isGeneratedPrivateIdentifier(node) && node.escapedText === "#constructor"; + } + function getPrivateIdentifier(privateEnv, name) { + return ts.isGeneratedPrivateIdentifier(name) ? + getGeneratedPrivateIdentifierInfo(privateEnv, ts.getNodeForGeneratedName(name)) : + getPrivateIdentifierInfo(privateEnv, name.escapedText); + } + function setPrivateIdentifier(privateEnv, name, info) { + var _a, _b; + if (ts.isGeneratedPrivateIdentifier(name)) { + (_a = privateEnv.generatedIdentifiers) !== null && _a !== void 0 ? _a : (privateEnv.generatedIdentifiers = new ts.Map()); + privateEnv.generatedIdentifiers.set(ts.getNodeForGeneratedName(name), info); + } + else { + (_b = privateEnv.identifiers) !== null && _b !== void 0 ? _b : (privateEnv.identifiers = new ts.Map()); + privateEnv.identifiers.set(name.escapedText, info); + } + } + function getPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.identifiers) === null || _a === void 0 ? void 0 : _a.get(key); + } + function getGeneratedPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.generatedIdentifiers) === null || _a === void 0 ? void 0 : _a.get(key); } })(ts || (ts = {})); /*@internal*/ @@ -96296,15 +97285,15 @@ var ts; */ function serializeTypeOfNode(node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: return serializeTypeNode(node.type); - case 173 /* SyntaxKind.SetAccessor */: - case 172 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return serializeTypeNode(getAccessorTypeNode(node)); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: return ts.factory.createIdentifier("Function"); default: return ts.factory.createVoidZero(); @@ -96340,7 +97329,7 @@ var ts; return ts.factory.createArrayLiteralExpression(expressions); } function getParametersOfDecoratedDeclaration(node, container) { - if (container && node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (container && node.kind === 174 /* SyntaxKind.GetAccessor */) { var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; if (setAccessor) { return setAccessor.parameters; @@ -96386,66 +97375,66 @@ var ts; node = ts.skipTypeParentheses(node); switch (node.kind) { case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return ts.factory.createVoidZero(); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return ts.factory.createIdentifier("Function"); - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return ts.factory.createIdentifier("Array"); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return node.assertsModifier ? ts.factory.createVoidZero() : ts.factory.createIdentifier("Boolean"); - case 133 /* SyntaxKind.BooleanKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: return ts.factory.createIdentifier("Boolean"); - case 198 /* SyntaxKind.TemplateLiteralType */: - case 150 /* SyntaxKind.StringKeyword */: + case 200 /* SyntaxKind.TemplateLiteralType */: + case 152 /* SyntaxKind.StringKeyword */: return ts.factory.createIdentifier("String"); - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return ts.factory.createIdentifier("Object"); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return serializeLiteralOfLiteralTypeNode(node.literal); - case 147 /* SyntaxKind.NumberKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: return ts.factory.createIdentifier("Number"); - case 158 /* SyntaxKind.BigIntKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: return getGlobalConstructor("BigInt", 7 /* ScriptTarget.ES2020 */); - case 151 /* SyntaxKind.SymbolKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: return getGlobalConstructor("Symbol", 2 /* ScriptTarget.ES2015 */); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return serializeTypeReferenceNode(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return serializeUnionOrIntersectionConstituents(node.types, /*isIntersection*/ true); - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return serializeUnionOrIntersectionConstituents(node.types, /*isIntersection*/ false); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return serializeUnionOrIntersectionConstituents([node.trueType, node.falseType], /*isIntersection*/ false); - case 193 /* SyntaxKind.TypeOperator */: - if (node.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { + case 195 /* SyntaxKind.TypeOperator */: + if (node.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { return serializeTypeNode(node.type); } break; - case 181 /* SyntaxKind.TypeQuery */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 195 /* SyntaxKind.MappedType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 192 /* SyntaxKind.ThisType */: - case 200 /* SyntaxKind.ImportType */: + case 183 /* SyntaxKind.TypeQuery */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 197 /* SyntaxKind.MappedType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 194 /* SyntaxKind.ThisType */: + case 202 /* SyntaxKind.ImportType */: break; // handle JSDoc types from an invalid parse - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 318 /* SyntaxKind.JSDocVariadicType */: - case 319 /* SyntaxKind.JSDocNamepathType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 321 /* SyntaxKind.JSDocVariadicType */: + case 322 /* SyntaxKind.JSDocNamepathType */: break; - case 314 /* SyntaxKind.JSDocNullableType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 316 /* SyntaxKind.JSDocOptionalType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return serializeTypeNode(node.type); default: return ts.Debug.failBadSyntaxKind(node); @@ -96457,7 +97446,7 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return ts.factory.createIdentifier("String"); - case 219 /* SyntaxKind.PrefixUnaryExpression */: { + case 221 /* SyntaxKind.PrefixUnaryExpression */: { var operand = node.operand; switch (operand.kind) { case 8 /* SyntaxKind.NumericLiteral */: @@ -96486,20 +97475,20 @@ var ts; for (var _i = 0, types_22 = types; _i < types_22.length; _i++) { var typeNode = types_22[_i]; typeNode = ts.skipTypeParentheses(typeNode); - if (typeNode.kind === 143 /* SyntaxKind.NeverKeyword */) { + if (typeNode.kind === 144 /* SyntaxKind.NeverKeyword */) { if (isIntersection) return ts.factory.createVoidZero(); // Reduce to `never` in an intersection continue; // Elide `never` in a union } - if (typeNode.kind === 155 /* SyntaxKind.UnknownKeyword */) { + if (typeNode.kind === 157 /* SyntaxKind.UnknownKeyword */) { if (!isIntersection) return ts.factory.createIdentifier("Object"); // Reduce to `unknown` in a union continue; // Elide `unknown` in an intersection } - if (typeNode.kind === 130 /* SyntaxKind.AnyKeyword */) { + if (typeNode.kind === 131 /* SyntaxKind.AnyKeyword */) { return ts.factory.createIdentifier("Object"); // Reduce to `any` in a union or intersection } - if (!strictNullChecks && ((ts.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */) || typeNode.kind === 153 /* SyntaxKind.UndefinedKeyword */)) { + if (!strictNullChecks && ((ts.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */) || typeNode.kind === 155 /* SyntaxKind.UndefinedKeyword */)) { continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks } var serializedConstituent = serializeTypeNode(typeNode); @@ -96647,7 +97636,7 @@ var ts; name.original = undefined; ts.setParent(name, ts.getParseTreeNode(currentLexicalScope)); // ensure the parent is set to a parse tree node. return name; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return serializeQualifiedNameAsExpression(node); } } @@ -96702,24 +97691,24 @@ var ts; return node; } switch (node.kind) { - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are elided. They will be emitted as part of `visitClassDeclaration`. return undefined; - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return visitClassExpression(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return visitConstructorDeclaration(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return visitMethodDeclaration(node); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitSetAccessorDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return visitGetAccessorDeclaration(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return visitPropertyDeclaration(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameterDeclaration(node); default: return ts.visitEachChild(node, visitor, context); @@ -97075,7 +98064,7 @@ var ts; var prefix = getClassMemberPrefix(node, member); var memberName = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ !ts.hasSyntacticModifier(member, 2 /* ModifierFlags.Ambient */)); var descriptor = languageVersion > 0 /* ScriptTarget.ES3 */ - ? member.kind === 167 /* SyntaxKind.PropertyDeclaration */ + ? ts.isPropertyDeclaration(member) && !ts.hasAccessorModifier(member) // We emit `void 0` here to indicate to `__decorate` that it can invoke `Object.defineProperty` directly, but that it // should not invoke `Object.getOwnPropertyDescriptor`. ? factory.createVoidZero() @@ -97338,34 +98327,34 @@ var ts; return node; } switch (node.kind) { - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // ES2017 async modifier should be elided for targets < ES2017 return undefined; - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return visitAwaitExpression(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitMethodDeclaration, node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitFunctionDeclaration, node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitFunctionExpression, node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return doWithContext(1 /* ContextFlags.NonTopLevel */, visitArrowFunction, node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { capturedSuperProperties.add(node.name.escapedText); } return ts.visitEachChild(node, visitor, context); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (capturedSuperProperties && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitDefault, node); default: return ts.visitEachChild(node, visitor, context); @@ -97374,27 +98363,27 @@ var ts; function asyncBodyVisitor(node) { if (ts.isNodeWithPossibleHoistedDeclaration(node)) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatementInAsyncBody(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatementInAsyncBody(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatementInAsyncBody(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatementInAsyncBody(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClauseInAsyncBody(node); - case 235 /* SyntaxKind.Block */: - case 249 /* SyntaxKind.SwitchStatement */: - case 263 /* SyntaxKind.CaseBlock */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 252 /* SyntaxKind.TryStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 250 /* SyntaxKind.LabeledStatement */: + case 238 /* SyntaxKind.Block */: + case 252 /* SyntaxKind.SwitchStatement */: + case 266 /* SyntaxKind.CaseBlock */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 255 /* SyntaxKind.TryStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return ts.visitEachChild(node, asyncBodyVisitor, context); default: return ts.Debug.assertNever(node, "Unhandled node."); @@ -97597,7 +98586,7 @@ var ts; var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 /* ScriptTarget.ES2015 */ ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 214 /* SyntaxKind.ArrowFunction */; + var isArrowFunction = node.kind === 216 /* SyntaxKind.ArrowFunction */; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* NodeCheckFlags.CaptureArguments */) !== 0; // An async function is emit as an outer function that calls an inner // generator function. To preserve lexical bindings, we pass the current @@ -97688,17 +98677,17 @@ var ts; enabledSubstitutions |= 1 /* ES2017SubstitutionFlags.AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(257 /* SyntaxKind.ClassDeclaration */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(260 /* SyntaxKind.ClassDeclaration */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // We need to be notified when entering the generated accessor arrow functions. - context.enableEmitNotification(237 /* SyntaxKind.VariableStatement */); + context.enableEmitNotification(240 /* SyntaxKind.VariableStatement */); } } /** @@ -97746,11 +98735,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); } return node; @@ -97782,11 +98771,11 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { @@ -97943,7 +98932,7 @@ var ts; return visitorWorker(node, /*expressionResultIsUnused*/ true); } function visitorNoAsyncModifier(node) { - if (node.kind === 131 /* SyntaxKind.AsyncKeyword */) { + if (node.kind === 132 /* SyntaxKind.AsyncKeyword */) { return undefined; } return node; @@ -97969,70 +98958,70 @@ var ts; return node; } switch (node.kind) { - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return visitAwaitExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node, expressionResultIsUnused); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node, expressionResultIsUnused); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 246 /* SyntaxKind.ForInStatement */: return doWithHierarchyFacts(visitDefault, node, 0 /* HierarchyFacts.IterationStatementExcludes */, 2 /* HierarchyFacts.IterationStatementIncludes */); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return doWithHierarchyFacts(visitForStatement, node, 0 /* HierarchyFacts.IterationStatementExcludes */, 2 /* HierarchyFacts.IterationStatementIncludes */); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return visitVoidExpression(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return doWithHierarchyFacts(visitConstructorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return doWithHierarchyFacts(visitMethodDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return doWithHierarchyFacts(visitGetAccessorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return doWithHierarchyFacts(visitSetAccessorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return doWithHierarchyFacts(visitFunctionDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return doWithHierarchyFacts(visitFunctionExpression, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return doWithHierarchyFacts(visitArrowFunction, node, 2 /* HierarchyFacts.ArrowFunctionExcludes */, 0 /* HierarchyFacts.ArrowFunctionIncludes */); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameter(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, expressionResultIsUnused); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { capturedSuperProperties.add(node.name.escapedText); } return ts.visitEachChild(node, visitor, context); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (capturedSuperProperties && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return doWithHierarchyFacts(visitDefault, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); default: return ts.visitEachChild(node, visitor, context); @@ -98068,7 +99057,7 @@ var ts; function visitLabeledStatement(node) { if (enclosingFunctionFlags & 2 /* FunctionFlags.Async */) { var statement = ts.unwrapInnermostStatementOfLabel(node); - if (statement.kind === 244 /* SyntaxKind.ForOfStatement */ && statement.awaitModifier) { + if (statement.kind === 247 /* SyntaxKind.ForOfStatement */ && statement.awaitModifier) { return visitForOfStatement(statement, node); } return factory.restoreEnclosingLabel(ts.visitNode(statement, visitor, ts.isStatement, factory.liftToBlock), node); @@ -98080,7 +99069,7 @@ var ts; var objects = []; for (var _i = 0, elements_5 = elements; _i < elements_5.length; _i++) { var e = elements_5[_i]; - if (e.kind === 298 /* SyntaxKind.SpreadAssignment */) { + if (e.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (chunkObject) { objects.push(factory.createObjectLiteralExpression(chunkObject)); chunkObject = undefined; @@ -98089,7 +99078,7 @@ var ts; objects.push(ts.visitNode(target, visitor, ts.isExpression)); } else { - chunkObject = ts.append(chunkObject, e.kind === 296 /* SyntaxKind.PropertyAssignment */ + chunkObject = ts.append(chunkObject, e.kind === 299 /* SyntaxKind.PropertyAssignment */ ? factory.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression)) : ts.visitNode(e, visitor, ts.isObjectLiteralElementLike)); } @@ -98123,7 +99112,7 @@ var ts; // If we translate the above to `__assign({}, k, l)`, the `l` will evaluate before `k` is spread and we // end up with `{ a: 1, b: 2, c: 3 }` var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (objects.length && objects[0].kind !== 207 /* SyntaxKind.ObjectLiteralExpression */) { objects.unshift(factory.createObjectLiteralExpression()); } var expression = objects[0]; @@ -98631,17 +99620,17 @@ var ts; enabledSubstitutions |= 1 /* ESNextSubstitutionFlags.AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(257 /* SyntaxKind.ClassDeclaration */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(260 /* SyntaxKind.ClassDeclaration */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // We need to be notified when entering the generated accessor arrow functions. - context.enableEmitNotification(237 /* SyntaxKind.VariableStatement */); + context.enableEmitNotification(240 /* SyntaxKind.VariableStatement */); } } /** @@ -98689,11 +99678,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); } return node; @@ -98725,11 +99714,11 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { @@ -98761,7 +99750,7 @@ var ts; return node; } switch (node.kind) { - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); default: return ts.visitEachChild(node, visitor, context); @@ -98793,25 +99782,25 @@ var ts; return node; } switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: { + case 210 /* SyntaxKind.CallExpression */: { var updated = visitNonOptionalCallExpression(node, /*captureThisArg*/ false); ts.Debug.assertNotNode(updated, ts.isSyntheticReference); return updated; } - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (ts.isOptionalChain(node)) { var updated = visitOptionalExpression(node, /*captureThisArg*/ false, /*isDelete*/ false); ts.Debug.assertNotNode(updated, ts.isSyntheticReference); return updated; } return ts.visitEachChild(node, visitor, context); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */) { return transformNullishCoalescingExpression(node); } return ts.visitEachChild(node, visitor, context); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return visitDeleteExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -98853,7 +99842,7 @@ var ts; thisArg = expression; } } - expression = node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ + expression = node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? factory.updatePropertyAccessExpression(node, expression, ts.visitNode(node.name, visitor, ts.isIdentifier)) : factory.updateElementAccessExpression(node, expression, ts.visitNode(node.argumentExpression, visitor, ts.isExpression)); return thisArg ? factory.createSyntheticReferenceExpression(expression, thisArg) : expression; @@ -98876,10 +99865,10 @@ var ts; } function visitNonOptionalExpression(node, captureThisArg, isDelete) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); - case 208 /* SyntaxKind.CallExpression */: return visitNonOptionalCallExpression(node, captureThisArg); + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); + case 210 /* SyntaxKind.CallExpression */: return visitNonOptionalCallExpression(node, captureThisArg); default: return ts.visitNode(node, visitor, ts.isExpression); } } @@ -98898,8 +99887,8 @@ var ts; for (var i = 0; i < chain.length; i++) { var segment = chain[i]; switch (segment.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (i === chain.length - 1 && captureThisArg) { if (!ts.isSimpleCopiableExpression(rightExpression)) { thisArg = factory.createTempVariable(hoistVariableDeclaration); @@ -98909,11 +99898,11 @@ var ts; thisArg = rightExpression; } } - rightExpression = segment.kind === 206 /* SyntaxKind.PropertyAccessExpression */ + rightExpression = segment.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? factory.createPropertyAccessExpression(rightExpression, ts.visitNode(segment.name, visitor, ts.isIdentifier)) : factory.createElementAccessExpression(rightExpression, ts.visitNode(segment.argumentExpression, visitor, ts.isExpression)); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (i === 0 && leftThisArg) { if (!ts.isGeneratedIdentifier(leftThisArg)) { leftThisArg = factory.cloneNode(leftThisArg); @@ -98974,7 +99963,7 @@ var ts; return node; } switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var binaryExpression = node; if (ts.isLogicalOrCoalescingAssignmentExpression(binaryExpression)) { return transformLogicalAssignment(binaryExpression); @@ -99143,13 +100132,13 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return visitJsxElement(node, /*isChild*/ false); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ false); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return visitJsxFragment(node, /*isChild*/ false); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -99159,13 +100148,13 @@ var ts; switch (node.kind) { case 11 /* SyntaxKind.JsxText */: return visitJsxText(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return visitJsxExpression(node); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return visitJsxElement(node, /*isChild*/ true); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ true); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return visitJsxFragment(node, /*isChild*/ true); default: return ts.Debug.failBadSyntaxKind(node); @@ -99346,7 +100335,7 @@ var ts; var literal = factory.createStringLiteral(tryDecodeEntities(node.text) || node.text, singleQuote); return ts.setTextRange(literal, node); } - if (node.kind === 288 /* SyntaxKind.JsxExpression */) { + if (node.kind === 291 /* SyntaxKind.JsxExpression */) { if (node.expression === undefined) { return factory.createTrue(); } @@ -99447,7 +100436,7 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 278 /* SyntaxKind.JsxElement */) { + if (node.kind === 281 /* SyntaxKind.JsxElement */) { return getTagName(node.openingElement); } else { @@ -99754,7 +100743,7 @@ var ts; return node; } switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -99979,7 +100968,7 @@ var ts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { return (hierarchyFacts & 8192 /* HierarchyFacts.ConstructorWithCapturedSuper */) !== 0 - && node.kind === 247 /* SyntaxKind.ReturnStatement */ + && node.kind === 250 /* SyntaxKind.ReturnStatement */ && !node.expression; } function isOrMayContainReturnCompletion(node) { @@ -100033,65 +101022,65 @@ var ts; switch (node.kind) { case 124 /* SyntaxKind.StaticKeyword */: return undefined; // elide static keyword - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return visitClassExpression(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameter(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return visitArrowFunction(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); case 79 /* SyntaxKind.Identifier */: return visitIdentifier(node); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return visitVariableDeclarationList(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return visitCaseBlock(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return visitBlock(node, /*isFunctionBody*/ false); - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return visitBreakOrContinueStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*outermostLabeledStatement*/ undefined); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node, /*outermostLabeledStatement*/ undefined); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return visitShorthandPropertyAssignment(node); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return visitComputedPropertyName(node); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, expressionResultIsUnused); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node, expressionResultIsUnused); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node, expressionResultIsUnused); case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 15 /* SyntaxKind.TemplateHead */: @@ -100102,30 +101091,30 @@ var ts; return visitStringLiteral(node); case 8 /* SyntaxKind.NumericLiteral */: return visitNumericLiteral(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return visitTemplateExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return visitSpreadElement(node); case 106 /* SyntaxKind.SuperKeyword */: return visitSuperKeyword(/*isExpressionOfCall*/ false); case 108 /* SyntaxKind.ThisKeyword */: return visitThisKeyword(node); - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return visitMetaProperty(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return visitMethodDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitAccessorDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return visitVoidExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -100215,14 +101204,14 @@ var ts; // it is possible if either // - break/continue is labeled and label is located inside the converted loop // - break/continue is non-labeled and located in non-converted loop/switch statement - var jump = node.kind === 246 /* SyntaxKind.BreakStatement */ ? 2 /* Jump.Break */ : 4 /* Jump.Continue */; + var jump = node.kind === 249 /* SyntaxKind.BreakStatement */ ? 2 /* Jump.Break */ : 4 /* Jump.Continue */; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(ts.idText(node.label))) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; var label = node.label; if (!label) { - if (node.kind === 246 /* SyntaxKind.BreakStatement */) { + if (node.kind === 249 /* SyntaxKind.BreakStatement */) { convertedLoopState.nonLocalJumps |= 2 /* Jump.Break */; labelMarker = "break"; } @@ -100233,7 +101222,7 @@ var ts; } } else { - if (node.kind === 246 /* SyntaxKind.BreakStatement */) { + if (node.kind === 249 /* SyntaxKind.BreakStatement */) { labelMarker = "break-".concat(label.escapedText); setLabeledJump(convertedLoopState, /*isBreak*/ true, ts.idText(label), labelMarker); } @@ -100289,7 +101278,7 @@ var ts; statements.push(statement); // Add an `export default` statement for default exports (for `--target es5 --module es6`) if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - var exportStatement = ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) + var exportStatement = ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) ? factory.createExportDefault(factory.getLocalName(node)) : factory.createExternalModuleExport(factory.getLocalName(node)); ts.setOriginalNode(exportStatement, statement); @@ -100658,11 +101647,11 @@ var ts; */ function isSufficientlyCoveredByReturnStatements(statement) { // A return statement is considered covered. - if (statement.kind === 247 /* SyntaxKind.ReturnStatement */) { + if (statement.kind === 250 /* SyntaxKind.ReturnStatement */) { return true; } // An if-statement with two covered branches is covered. - else if (statement.kind === 239 /* SyntaxKind.IfStatement */) { + else if (statement.kind === 242 /* SyntaxKind.IfStatement */) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && @@ -100670,7 +101659,7 @@ var ts; } } // A block is covered if it has a last statement which is covered. - else if (statement.kind === 235 /* SyntaxKind.Block */) { + else if (statement.kind === 238 /* SyntaxKind.Block */) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -100870,7 +101859,7 @@ var ts; * @param node A node. */ function insertCaptureThisForNodeIfNeeded(statements, node) { - if (hierarchyFacts & 65536 /* HierarchyFacts.CapturedLexicalThis */ && node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (hierarchyFacts & 65536 /* HierarchyFacts.CapturedLexicalThis */ && node.kind !== 216 /* SyntaxKind.ArrowFunction */) { insertCaptureThisForNode(statements, node, factory.createThis()); return true; } @@ -100904,22 +101893,22 @@ var ts; if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */) { var newTarget = void 0; switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return statements; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Methods and accessors cannot be constructors, so 'new.target' will // always return 'undefined'. newTarget = factory.createVoidZero(); break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: // Class constructors can only be called with `new`, so `this.constructor` // should be relatively safe to use. newTarget = factory.createPropertyAccessExpression(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), "constructor"); break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: // Functions can be called or constructed, and may have a `this` due to // being a member or when calling an imported function via `other_1.f()`. newTarget = factory.createConditionalExpression(factory.createLogicalAnd(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), factory.createBinaryExpression(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), 102 /* SyntaxKind.InstanceOfKeyword */, factory.getLocalName(node))), @@ -100954,21 +101943,21 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: statements.push(transformSemicolonClassElementToStatement(member)); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; - case 171 /* SyntaxKind.Constructor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // Constructors are handled in visitClassExpression/visitClassDeclaration break; default: @@ -101167,7 +102156,7 @@ var ts; : enterSubtree(32670 /* HierarchyFacts.FunctionExcludes */, 65 /* HierarchyFacts.FunctionIncludes */); var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */ && !name && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */)) { + if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */ && !name && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */)) { name = factory.getGeneratedNameForNode(node); } exitSubtree(ancestorFacts, 98304 /* HierarchyFacts.FunctionSubtreeExcludes */, 0 /* HierarchyFacts.None */); @@ -101213,7 +102202,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 214 /* SyntaxKind.ArrowFunction */); + ts.Debug.assert(node.kind === 216 /* SyntaxKind.ArrowFunction */); // To align with the old emitter, we use a synthetic end position on the location // for the statement list we synthesize when we down-level an arrow function with // an expression function body. This prevents both comments and source maps from @@ -101520,14 +102509,14 @@ var ts; } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitDoOrWhileStatement(node, outermostLabeledStatement); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, outermostLabeledStatement); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node, outermostLabeledStatement); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, outermostLabeledStatement); } } @@ -101713,7 +102702,7 @@ var ts; var property = properties[i]; if ((property.transformFlags & 1048576 /* TransformFlags.ContainsYield */ && hierarchyFacts & 4 /* HierarchyFacts.AsyncFunctionBody */) - || (hasComputed = ts.Debug.checkDefined(property.name).kind === 162 /* SyntaxKind.ComputedPropertyName */)) { + || (hasComputed = ts.Debug.checkDefined(property.name).kind === 164 /* SyntaxKind.ComputedPropertyName */)) { numInitialProperties = i; break; } @@ -101829,11 +102818,11 @@ var ts; } function convertIterationStatementCore(node, initializerFunction, convertedLoopBody) { switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody); - case 243 /* SyntaxKind.ForInStatement */: return convertForInStatement(node, convertedLoopBody); - case 244 /* SyntaxKind.ForOfStatement */: return convertForOfStatement(node, convertedLoopBody); - case 240 /* SyntaxKind.DoStatement */: return convertDoStatement(node, convertedLoopBody); - case 241 /* SyntaxKind.WhileStatement */: return convertWhileStatement(node, convertedLoopBody); + case 245 /* SyntaxKind.ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody); + case 246 /* SyntaxKind.ForInStatement */: return convertForInStatement(node, convertedLoopBody); + case 247 /* SyntaxKind.ForOfStatement */: return convertForOfStatement(node, convertedLoopBody); + case 243 /* SyntaxKind.DoStatement */: return convertDoStatement(node, convertedLoopBody); + case 244 /* SyntaxKind.WhileStatement */: return convertWhileStatement(node, convertedLoopBody); default: return ts.Debug.failBadSyntaxKind(node, "IterationStatement expected"); } } @@ -101858,11 +102847,11 @@ var ts; function createConvertedLoopState(node) { var loopInitializer; switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: var initializer = node.initializer; - if (initializer && initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (initializer && initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { loopInitializer = initializer; } break; @@ -102278,20 +103267,20 @@ var ts; for (var i = start; i < numProperties; i++) { var property = properties[i]; switch (property.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { expressions.push(transformAccessorsToExpression(receiver, accessors, node, !!node.multiLine)); } break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -102398,7 +103387,7 @@ var ts; var updated; var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { updated = factory.updateGetAccessorDeclaration(node, node.modifiers, node.name, parameters, node.type, body); } else { @@ -102858,13 +103847,13 @@ var ts; if ((enabledSubstitutions & 1 /* ES2015SubstitutionFlags.CapturedThis */) === 0) { enabledSubstitutions |= 1 /* ES2015SubstitutionFlags.CapturedThis */; context.enableSubstitution(108 /* SyntaxKind.ThisKeyword */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(214 /* SyntaxKind.ArrowFunction */); - context.enableEmitNotification(213 /* SyntaxKind.FunctionExpression */); - context.enableEmitNotification(256 /* SyntaxKind.FunctionDeclaration */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(216 /* SyntaxKind.ArrowFunction */); + context.enableEmitNotification(215 /* SyntaxKind.FunctionExpression */); + context.enableEmitNotification(259 /* SyntaxKind.FunctionDeclaration */); } } /** @@ -102905,10 +103894,10 @@ var ts; */ function isNameOfDeclarationWithCollidingName(node) { switch (node.parent.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return node.parent.name === node && resolver.isDeclarationWithCollidingName(node.parent); } @@ -102990,11 +103979,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 238 /* SyntaxKind.ExpressionStatement */) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 241 /* SyntaxKind.ExpressionStatement */) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 208 /* SyntaxKind.CallExpression */) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 210 /* SyntaxKind.CallExpression */) { return false; } var callTarget = statementExpression.expression; @@ -103002,7 +103991,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 225 /* SyntaxKind.SpreadElement */) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 227 /* SyntaxKind.SpreadElement */) { return false; } var expression = callArgument.expression; @@ -103028,15 +104017,15 @@ var ts; if (compilerOptions.jsx === 1 /* JsxEmit.Preserve */ || compilerOptions.jsx === 3 /* JsxEmit.ReactNative */) { previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; - context.enableEmitNotification(280 /* SyntaxKind.JsxOpeningElement */); - context.enableEmitNotification(281 /* SyntaxKind.JsxClosingElement */); - context.enableEmitNotification(279 /* SyntaxKind.JsxSelfClosingElement */); + context.enableEmitNotification(283 /* SyntaxKind.JsxOpeningElement */); + context.enableEmitNotification(284 /* SyntaxKind.JsxClosingElement */); + context.enableEmitNotification(282 /* SyntaxKind.JsxSelfClosingElement */); noSubstitution = []; } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(296 /* SyntaxKind.PropertyAssignment */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(299 /* SyntaxKind.PropertyAssignment */); return ts.chainBundle(context, transformSourceFile); /** * Transforms an ES5 source file to ES3. @@ -103055,9 +104044,9 @@ var ts; */ function onEmitNode(hint, node, emitCallback) { switch (node.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: var tagName = node.tagName; noSubstitution[ts.getOriginalNodeId(tagName)] = true; break; @@ -103392,13 +104381,13 @@ var ts; */ function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return visitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitWhileStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -103411,24 +104400,24 @@ var ts; */ function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitAccessorDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return visitBreakStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return visitContinueStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); default: if (node.transformFlags & 1048576 /* TransformFlags.ContainsYield */) { @@ -103449,23 +104438,23 @@ var ts; */ function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return visitConditionalExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return visitElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -103478,9 +104467,9 @@ var ts; */ function visitGenerator(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); default: return ts.Debug.failBadSyntaxKind(node); @@ -103687,7 +104676,7 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // [source] // a.b = yield; // @@ -103699,7 +104688,7 @@ var ts; // _a.b = %sent%; target = factory.updatePropertyAccessExpression(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // [source] // a[b] = yield; // @@ -104093,35 +105082,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return transformAndEmitBlock(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return transformAndEmitExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return transformAndEmitIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return transformAndEmitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return transformAndEmitWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return transformAndEmitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return transformAndEmitForInStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return transformAndEmitContinueStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return transformAndEmitBreakStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return transformAndEmitReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return transformAndEmitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return transformAndEmitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return transformAndEmitLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return transformAndEmitThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement)); @@ -104551,7 +105540,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 290 /* SyntaxKind.DefaultClause */ && defaultClauseIndex === -1) { + if (clause.kind === 293 /* SyntaxKind.DefaultClause */ && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -104564,7 +105553,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { if (containsYield(clause.expression) && pendingClauses.length > 0) { break; } @@ -105724,12 +106713,12 @@ var ts; var previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. - context.enableSubstitution(210 /* SyntaxKind.TaggedTemplateExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. + context.enableSubstitution(212 /* SyntaxKind.TaggedTemplateExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. context.enableSubstitution(79 /* SyntaxKind.Identifier */); // Substitutes expression identifiers with imported/exported symbols. - context.enableSubstitution(221 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(223 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var currentSourceFile; // The current file. @@ -106057,23 +107046,23 @@ var ts; */ function topLevelVisitor(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return visitor(node); @@ -106086,26 +107075,26 @@ var ts; return node; } switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, valueIsDiscarded); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(node) && currentSourceFile.impliedNodeFormat === undefined) { return visitImportCallExpression(node); } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); } return ts.visitEachChild(node, visitor, context); @@ -106121,24 +107110,24 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var elem = _a[_i]; switch (elem.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (destructuringNeedsFlattening(elem.initializer)) { return true; } break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: if (destructuringNeedsFlattening(elem.name)) { return true; } break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: if (destructuringNeedsFlattening(elem.expression)) { return true; } break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return false; default: ts.Debug.assertNever(elem, "Unhandled object member kind"); } @@ -106724,7 +107713,7 @@ var ts; // // To balance the declaration, add the exports of the elided variable // statement. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 237 /* SyntaxKind.VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240 /* SyntaxKind.VariableStatement */) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -106779,10 +107768,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding, /* liveBinding */ true); @@ -106866,7 +107855,7 @@ var ts; return statements; } if (ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */)) { - var exportName = ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); + var exportName = ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); statements = appendExportStatement(statements, exportName, factory.getLocalName(decl), /*location*/ decl); } if (decl.name) { @@ -106995,7 +107984,7 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; previousOnEmitNode(hint, node, emitCallback); @@ -107057,11 +108046,11 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return substituteTaggedTemplateExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return substituteBinaryExpression(node); } return node; @@ -107105,7 +108094,7 @@ var ts; } else if (!(ts.isGeneratedIdentifier(node) && !(node.autoGenerateFlags & 64 /* GeneratedIdentifierFlags.AllowNameSubstitution */)) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 305 /* SyntaxKind.SourceFile */) { + if (exportContainer && exportContainer.kind === 308 /* SyntaxKind.SourceFile */) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.cloneNode(node)), /*location*/ node); } @@ -107195,10 +108184,10 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(79 /* SyntaxKind.Identifier */); // Substitutes expression identifiers for imported symbols. - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols - context.enableSubstitution(221 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(231 /* SyntaxKind.MetaProperty */); // Substitutes 'import.meta' - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols + context.enableSubstitution(223 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(233 /* SyntaxKind.MetaProperty */); // Substitutes 'import.meta' + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var exportFunctionsMap = []; // The export function associated with a source file. @@ -107388,7 +108377,7 @@ var ts; ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); var exportStarFunction = addExportStarIfNeeded(statements); // TODO: GH#18217 var modifiers = node.transformFlags & 2097152 /* TransformFlags.ContainsAwait */ ? - factory.createModifiersFromModifierFlags(256 /* ModifierFlags.Async */) : + factory.createModifiersFromModifierFlags(512 /* ModifierFlags.Async */) : undefined; var moduleObject = factory.createObjectLiteralExpression([ factory.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), @@ -107422,7 +108411,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 272 /* SyntaxKind.ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 275 /* SyntaxKind.ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -107511,19 +108500,26 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(factory, entry, currentSourceFile); // TODO: GH#18217 switch (entry.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: if (!entry.importClause) { // 'import "..."' case // module is imported only for side-effects, no emit required break; } // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: ts.Debug.assert(importVariableName !== undefined); // save import into the local statements.push(factory.createExpressionStatement(factory.createAssignment(importVariableName, parameterName))); + if (ts.hasSyntacticModifier(entry, 1 /* ModifierFlags.Export */)) { + statements.push(factory.createExpressionStatement(factory.createCallExpression(exportFunction, + /*typeArguments*/ undefined, [ + factory.createStringLiteral(ts.idText(importVariableName)), + parameterName, + ]))); + } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { if (ts.isNamedExports(entry.exportClause)) { @@ -107582,13 +108578,13 @@ var ts; */ function topLevelVisitor(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); default: return topLevelNestedVisitor(node); @@ -107767,7 +108763,7 @@ var ts; function shouldHoistVariableDeclarationList(node) { // hoist only non-block scoped declarations or block scoped declarations parented by source file return (ts.getEmitFlags(node) & 2097152 /* EmitFlags.NoHoisting */) === 0 - && (enclosingBlockScopedContainer.kind === 305 /* SyntaxKind.SourceFile */ + && (enclosingBlockScopedContainer.kind === 308 /* SyntaxKind.SourceFile */ || (ts.getOriginalNode(node).flags & 3 /* NodeFlags.BlockScoped */) === 0); } /** @@ -107831,7 +108827,7 @@ var ts; // // To balance the declaration, we defer the exports of the elided variable // statement until we visit this declaration's `EndOfDeclarationMarker`. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 237 /* SyntaxKind.VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240 /* SyntaxKind.VariableStatement */) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasSyntacticModifier(node.original, 1 /* ModifierFlags.Export */); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -107893,10 +108889,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -107991,7 +108987,7 @@ var ts; } var excludeName; if (ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */)) { - var exportName = ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */) ? factory.createStringLiteral("default") : decl.name; + var exportName = ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */) ? factory.createStringLiteral("default") : decl.name; statements = appendExportStatement(statements, exportName, factory.getLocalName(decl)); excludeName = ts.getTextOfIdentifierOrLiteral(exportName); } @@ -108076,43 +109072,43 @@ var ts; */ function topLevelNestedVisitor(node) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*isTopLevel*/ true); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return visitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitWhileStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return visitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return visitCaseBlock(node); - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return visitCaseClause(node); - case 290 /* SyntaxKind.DefaultClause */: + case 293 /* SyntaxKind.DefaultClause */: return visitDefaultClause(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return visitTryStatement(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return visitBlock(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return visitor(node); @@ -108298,26 +109294,26 @@ var ts; return node; } switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*isTopLevel*/ false); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, valueIsDiscarded); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(node)) { return visitImportCallExpression(node); } break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return visitPrefixOrPostfixUnaryExpression(node, valueIsDiscarded); } return ts.visitEachChild(node, visitor, context); @@ -108397,7 +109393,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 305 /* SyntaxKind.SourceFile */; + return container !== undefined && container.kind === 308 /* SyntaxKind.SourceFile */; } else { return false; @@ -108475,7 +109471,7 @@ var ts; * @param emitCallback A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -108525,7 +109521,7 @@ var ts; */ function substituteUnspecified(node) { switch (node.kind) { - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return substituteShorthandPropertyAssignment(node); } return node; @@ -108562,9 +109558,9 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return substituteBinaryExpression(node); - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return substituteMetaProperty(node); } return node; @@ -108654,7 +109650,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); - if (exportContainer && exportContainer.kind === 305 /* SyntaxKind.SourceFile */) { + if (exportContainer && exportContainer.kind === 308 /* SyntaxKind.SourceFile */) { exportedNames = ts.append(exportedNames, factory.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -108697,7 +109693,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); context.enableSubstitution(79 /* SyntaxKind.Identifier */); var helperNameSubstitutions; var currentSourceFile; @@ -108737,14 +109733,14 @@ var ts; } function visitor(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // Though an error in es2020 modules, in node-flavor es2020 modules, we can helpfully transform this to a synthetic `require` call // To give easy access to a synchronous `require` in node-flavor esm. We do the transform even in scenarios where we error, but `import.meta.url` // is available, just because the output is reasonable for a node-like runtime. return ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.Node16 ? visitImportEqualsDeclaration(node) : undefined; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportDecl = node; return visitExportDeclaration(exportDecl); } @@ -108901,8 +109897,8 @@ var ts; var cjsOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(305 /* SyntaxKind.SourceFile */); - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); + context.enableSubstitution(308 /* SyntaxKind.SourceFile */); + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); var currentSourceFile; return transformSourceFileOrBundle; function onSubstituteNode(hint, node) { @@ -108949,7 +109945,7 @@ var ts; return result; } function transformSourceFileOrBundle(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -109009,7 +110005,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109038,7 +110034,7 @@ var ts; ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109085,7 +110081,7 @@ var ts; return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: ".concat(ts.Debug.formatSyntaxKind(node.kind))); } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109094,8 +110090,8 @@ var ts; } // This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit // The only exception here is if the constructor was marked as private. we are not emitting the constructor parameters at all. - else if (node.kind === 167 /* SyntaxKind.PropertyDeclaration */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 166 /* SyntaxKind.PropertySignature */ || - (node.kind === 164 /* SyntaxKind.Parameter */ && ts.hasSyntacticModifier(node.parent, 8 /* ModifierFlags.Private */))) { + else if (node.kind === 169 /* SyntaxKind.PropertyDeclaration */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 168 /* SyntaxKind.PropertySignature */ || + (node.kind === 166 /* SyntaxKind.Parameter */ && ts.hasSyntacticModifier(node.parent, 8 /* ModifierFlags.Private */))) { // TODO(jfreeman): Deal with computed properties in error reporting. if (ts.isStatic(node)) { return symbolAccessibilityResult.errorModuleName ? @@ -109104,7 +110100,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 166 /* SyntaxKind.Parameter */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109129,7 +110125,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (node.kind === 173 /* SyntaxKind.SetAccessor */) { + if (node.kind === 175 /* SyntaxKind.SetAccessor */) { // Getters can infer the return type from the returned expression, but setters cannot, so the // "_from_external_module_1_but_cannot_be_named" case cannot occur. if (ts.isStatic(node)) { @@ -109168,26 +110164,26 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? @@ -109195,7 +110191,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -109209,7 +110205,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -109234,30 +110230,30 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 175 /* SyntaxKind.ConstructSignature */: - case 180 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node.parent)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? @@ -109265,7 +110261,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109278,15 +110274,15 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 256 /* SyntaxKind.FunctionDeclaration */: - case 179 /* SyntaxKind.FunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 181 /* SyntaxKind.FunctionType */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; - case 173 /* SyntaxKind.SetAccessor */: - case 172 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109300,39 +110296,39 @@ var ts; // Type parameter constraints are named by user so we should always be able to name it var diagnosticMessage; switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1; break; - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node.parent)) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 179 /* SyntaxKind.FunctionType */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 181 /* SyntaxKind.FunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -109398,7 +110394,7 @@ var ts; } function isInternalDeclaration(node, currentSourceFile) { var parseTreeNode = ts.getParseTreeNode(node); - if (parseTreeNode && parseTreeNode.kind === 164 /* SyntaxKind.Parameter */) { + if (parseTreeNode && parseTreeNode.kind === 166 /* SyntaxKind.Parameter */) { var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode); var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined; var text = currentSourceFile.text; @@ -109574,7 +110570,7 @@ var ts; var _a; var primaryDeclaration = (_a = parentSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.getSourceFileOfNode(d) === containingFile; }); var augmentingDeclarations = ts.filter(symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== containingFile; }); - if (augmentingDeclarations) { + if (primaryDeclaration && augmentingDeclarations) { for (var _i = 0, augmentingDeclarations_1 = augmentingDeclarations; _i < augmentingDeclarations_1.length; _i++) { var augmentations = augmentingDeclarations_1[_i]; context.addDiagnostic(ts.addRelatedInfo(ts.createDiagnosticForNode(augmentations, ts.Diagnostics.Declaration_augments_declaration_in_another_file_This_cannot_be_serialized), ts.createDiagnosticForNode(primaryDeclaration, ts.Diagnostics.This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_file))); @@ -109604,10 +110600,10 @@ var ts; return result; } function transformRoot(node) { - if (node.kind === 305 /* SyntaxKind.SourceFile */ && node.isDeclarationFile) { + if (node.kind === 308 /* SyntaxKind.SourceFile */ && node.isDeclarationFile) { return node; } - if (node.kind === 306 /* SyntaxKind.Bundle */) { + if (node.kind === 309 /* SyntaxKind.Bundle */) { isBundledEmit = true; refs = new ts.Map(); libs = new ts.Map(); @@ -109630,14 +110626,14 @@ var ts; resultHasExternalModuleIndicator = false; // unused in external module bundle emit (all external modules are within module blocks, therefore are known to be modules) needsDeclare = false; var statements = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile, /*bundled*/ true)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements); - var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); + var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); return newFile; } needsDeclare = true; var updated = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements); return factory.updateSourceFile(sourceFile, transformAndReplaceLatePaintedStatements(updated), /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); }), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 308 /* SyntaxKind.InputFiles */) { + if (prepend.kind === 311 /* SyntaxKind.InputFiles */) { var sourceFile = ts.createUnparsedSourceFile(prepend, "dts", stripInternal); hasNoDefaultLib_1 = hasNoDefaultLib_1 || !!sourceFile.hasNoDefaultLib; collectReferences(sourceFile, refs); @@ -109778,7 +110774,7 @@ var ts; return name; } else { - if (name.kind === 202 /* SyntaxKind.ArrayBindingPattern */) { + if (name.kind === 204 /* SyntaxKind.ArrayBindingPattern */) { return factory.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement)); } else { @@ -109786,7 +110782,7 @@ var ts; } } function visitBindingElement(elem) { - if (elem.kind === 227 /* SyntaxKind.OmittedExpression */) { + if (elem.kind === 229 /* SyntaxKind.OmittedExpression */) { return elem; } if (elem.propertyName && ts.isIdentifier(elem.propertyName) && ts.isIdentifier(elem.name) && !elem.symbol.isReferenced) { @@ -109828,19 +110824,19 @@ var ts; // Literal const declarations will have an initializer ensured rather than a type return; } - var shouldUseResolverType = node.kind === 164 /* SyntaxKind.Parameter */ && + var shouldUseResolverType = node.kind === 166 /* SyntaxKind.Parameter */ && (resolver.isRequiredInitializedParameter(node) || resolver.isOptionalUninitializedParameterProperty(node)); if (type && !shouldUseResolverType) { return ts.visitNode(type, visitDeclarationSubtree); } if (!ts.getParseTreeNode(node)) { - return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } - if (node.kind === 173 /* SyntaxKind.SetAccessor */) { + if (node.kind === 175 /* SyntaxKind.SetAccessor */) { // Set accessors with no associated type node (from it's param or get accessor return) are `any` since they are never contextually typed right now // (The inferred type here will be void, but the old declaration emitter printed `any`, so this replicates that) - return factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } errorNameNode = node.name; var oldDiag; @@ -109848,12 +110844,12 @@ var ts; oldDiag = getSymbolAccessibilityDiagnostic; getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node); } - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); } - if (node.kind === 164 /* SyntaxKind.Parameter */ - || node.kind === 167 /* SyntaxKind.PropertyDeclaration */ - || node.kind === 166 /* SyntaxKind.PropertySignature */) { + if (node.kind === 166 /* SyntaxKind.Parameter */ + || node.kind === 169 /* SyntaxKind.PropertyDeclaration */ + || node.kind === 168 /* SyntaxKind.PropertySignature */) { if (ts.isPropertySignature(node) || !node.initializer) return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType)); return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType) || resolver.createTypeOfExpression(node.initializer, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); @@ -109864,28 +110860,28 @@ var ts; if (!suppressNewDiagnosticContexts) { getSymbolAccessibilityDiagnostic = oldDiag; } - return returnValue || factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return returnValue || factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } } function isDeclarationAndNotVisible(node) { node = ts.getParseTreeNode(node); switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return !resolver.isDeclarationVisible(node); // The following should be doing their own visibility checks based on filtering their members - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return !getBindingNameVisible(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: return false; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return true; } return false; @@ -109974,7 +110970,7 @@ var ts; function rewriteModuleSpecifier(parent, input) { if (!input) return undefined; // TODO: GH#18217 - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && parent.kind !== 200 /* SyntaxKind.ImportType */); + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && parent.kind !== 202 /* SyntaxKind.ImportType */); if (ts.isStringLiteralLike(input)) { if (isBundledEmit) { var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent); @@ -109994,7 +110990,7 @@ var ts; function transformImportEqualsDeclaration(decl) { if (!resolver.isDeclarationVisible(decl)) return; - if (decl.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + if (decl.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { // Rewrite external module names if necessary var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl); return factory.updateImportEqualsDeclaration(decl, decl.modifiers, decl.isTypeOnly, decl.name, factory.updateExternalModuleReference(decl.moduleReference, rewriteModuleSpecifier(decl, specifier))); @@ -110019,7 +111015,7 @@ var ts; return visibleDefaultBinding && factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, /*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)); } - if (decl.importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (decl.importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { // Namespace import (optionally with visible default) var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined; return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)) : undefined; @@ -110122,7 +111118,7 @@ var ts; // We'd see a TDZ violation at runtime var canProduceDiagnostic = ts.canProduceDiagnostics(input); var oldWithinObjectLiteralType = suppressNewDiagnosticContexts; - var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 182 /* SyntaxKind.TypeLiteral */ || input.kind === 195 /* SyntaxKind.MappedType */) && input.parent.kind !== 259 /* SyntaxKind.TypeAliasDeclaration */); + var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 184 /* SyntaxKind.TypeLiteral */ || input.kind === 197 /* SyntaxKind.MappedType */) && input.parent.kind !== 262 /* SyntaxKind.TypeAliasDeclaration */); // Emit methods which are private as properties with no type information if (ts.isMethodDeclaration(input) || ts.isMethodSignature(input)) { if (ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)) { @@ -110143,28 +111139,28 @@ var ts; } if (isProcessedComponent(input)) { switch (input.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: { + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: { if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) { checkEntityNameVisibility(input.expression, enclosingDeclaration); } var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory.updateExpressionWithTypeArguments(node, node.expression, node.typeArguments)); } - case 178 /* SyntaxKind.TypeReference */: { + case 180 /* SyntaxKind.TypeReference */: { checkEntityNameVisibility(input.typeName, enclosingDeclaration); var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory.updateTypeReferenceNode(node, node.typeName, node.typeArguments)); } - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return cleanup(factory.updateConstructSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); - case 171 /* SyntaxKind.Constructor */: { + case 173 /* SyntaxKind.Constructor */: { // A constructor declaration may not have a type annotation var ctor = factory.createConstructorDeclaration( /*modifiers*/ ensureModifiers(input), updateParamsList(input, input.parameters, 0 /* ModifierFlags.None */), /*body*/ undefined); return cleanup(ctor); } - case 169 /* SyntaxKind.MethodDeclaration */: { + case 171 /* SyntaxKind.MethodDeclaration */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } @@ -110173,7 +111169,7 @@ var ts; /*body*/ undefined); return cleanup(sig); } - case 172 /* SyntaxKind.GetAccessor */: { + case 174 /* SyntaxKind.GetAccessor */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } @@ -110181,36 +111177,36 @@ var ts; return cleanup(factory.updateGetAccessorDeclaration(input, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)), ensureType(input, accessorType), /*body*/ undefined)); } - case 173 /* SyntaxKind.SetAccessor */: { + case 175 /* SyntaxKind.SetAccessor */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updateSetAccessorDeclaration(input, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)), /*body*/ undefined)); } - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updatePropertyDeclaration(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type), ensureNoInitializer(input))); - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updatePropertySignature(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type))); - case 168 /* SyntaxKind.MethodSignature */: { + case 170 /* SyntaxKind.MethodSignature */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updateMethodSignature(input, ensureModifiers(input), input.name, input.questionToken, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 174 /* SyntaxKind.CallSignature */: { + case 176 /* SyntaxKind.CallSignature */: { return cleanup(factory.updateCallSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 176 /* SyntaxKind.IndexSignature */: { - return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */))); + case 178 /* SyntaxKind.IndexSignature */: { + return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */))); } - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { if (ts.isBindingPattern(input.name)) { return recreateBindingPattern(input.name); } @@ -110218,13 +111214,13 @@ var ts; suppressNewDiagnosticContexts = true; // Variable declaration types also suppress new diagnostic contexts, provided the contexts wouldn't be made for binding pattern types return cleanup(factory.updateVariableDeclaration(input, input.name, /*exclamationToken*/ undefined, ensureType(input, input.type), ensureNoInitializer(input))); } - case 163 /* SyntaxKind.TypeParameter */: { + case 165 /* SyntaxKind.TypeParameter */: { if (isPrivateMethodTypeParameter(input) && (input.default || input.constraint)) { return cleanup(factory.updateTypeParameterDeclaration(input, input.modifiers, input.name, /*constraint*/ undefined, /*defaultType*/ undefined)); } return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context)); } - case 189 /* SyntaxKind.ConditionalType */: { + case 191 /* SyntaxKind.ConditionalType */: { // We have to process conditional types in a special way because for visibility purposes we need to push a new enclosingDeclaration // just for the `infer` types in the true branch. It's an implicit declaration scope that only applies to _part_ of the type. var checkType = ts.visitNode(input.checkType, visitDeclarationSubtree); @@ -110236,13 +111232,13 @@ var ts; var falseType = ts.visitNode(input.falseType, visitDeclarationSubtree); return cleanup(factory.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType)); } - case 179 /* SyntaxKind.FunctionType */: { + case 181 /* SyntaxKind.FunctionType */: { return cleanup(factory.updateFunctionTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 180 /* SyntaxKind.ConstructorType */: { + case 182 /* SyntaxKind.ConstructorType */: { return cleanup(factory.updateConstructorTypeNode(input, ensureModifiers(input), ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 200 /* SyntaxKind.ImportType */: { + case 202 /* SyntaxKind.ImportType */: { if (!ts.isLiteralImportTypeNode(input)) return cleanup(input); return cleanup(factory.updateImportTypeNode(input, factory.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.assertions, input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf)); @@ -110274,7 +111270,7 @@ var ts; } } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 169 /* SyntaxKind.MethodDeclaration */ && ts.hasEffectiveModifier(node.parent, 8 /* ModifierFlags.Private */); + return node.parent.kind === 171 /* SyntaxKind.MethodDeclaration */ && ts.hasEffectiveModifier(node.parent, 8 /* ModifierFlags.Private */); } function visitDeclarationStatements(input) { if (!isPreservedDeclarationStatement(input)) { @@ -110284,7 +111280,7 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 272 /* SyntaxKind.ExportDeclaration */: { + case 275 /* SyntaxKind.ExportDeclaration */: { if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; } @@ -110293,7 +111289,7 @@ var ts; // Rewrite external module names if necessary return factory.updateExportDeclaration(input, input.modifiers, input.isTypeOnly, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier), ts.getResolutionModeOverrideForClause(input.assertClause) ? input.assertClause : undefined); } - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { // Always visible if the parent node isn't dropped for being not visible if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; @@ -110311,7 +111307,7 @@ var ts; errorFallbackNode = input; var varDecl = factory.createVariableDeclaration(newId, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); errorFallbackNode = undefined; - var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); preserveJsDoc(statement, input); ts.removeAllComments(input); return [statement, factory.updateExportAssignment(input, input.modifiers, newId)]; @@ -110324,12 +111320,12 @@ var ts; return input; } function stripExportModifiers(statement) { - if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 512 /* ModifierFlags.Default */) || !ts.canHaveModifiers(statement)) { + if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 1024 /* ModifierFlags.Default */) || !ts.canHaveModifiers(statement)) { // `export import` statements should remain as-is, as imports are _not_ implicitly exported in an ambient namespace // Likewise, `export default` classes and the like and just be `default`, so we preserve their `export` modifiers, too return statement; } - var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (257023 /* ModifierFlags.All */ ^ 1 /* ModifierFlags.Export */)); + var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (258047 /* ModifierFlags.All */ ^ 1 /* ModifierFlags.Export */)); return factory.updateModifiers(statement, modifiers); } function transformTopLevelDeclaration(input) { @@ -110340,10 +111336,10 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { return transformImportEqualsDeclaration(input); } - case 266 /* SyntaxKind.ImportDeclaration */: { + case 269 /* SyntaxKind.ImportDeclaration */: { return transformImportDeclaration(input); } } @@ -110364,12 +111360,16 @@ var ts; } var previousNeedsDeclare = needsDeclare; switch (input.kind) { - case 259 /* SyntaxKind.TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all - return cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); - case 258 /* SyntaxKind.InterfaceDeclaration */: { + case 262 /* SyntaxKind.TypeAliasDeclaration */: { + needsDeclare = false; + var clean = cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); + needsDeclare = previousNeedsDeclare; + return clean; + } + case 261 /* SyntaxKind.InterfaceDeclaration */: { return cleanup(factory.updateInterfaceDeclaration(input, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree))); } - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { // Generators lose their generator-ness, excepting their return type var clean = cleanup(factory.updateFunctionDeclaration(input, ensureModifiers(input), /*asteriskToken*/ undefined, input.name, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), @@ -110410,10 +111410,10 @@ var ts; })))); } var namespaceDecl = factory.createModuleDeclaration(ensureModifiers(input), input.name, factory.createModuleBlock(declarations), 16 /* NodeFlags.Namespace */); - if (!ts.hasEffectiveModifier(clean, 512 /* ModifierFlags.Default */)) { + if (!ts.hasEffectiveModifier(clean, 1024 /* ModifierFlags.Default */)) { return [clean, namespaceDecl]; } - var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~513 /* ModifierFlags.ExportDefault */) | 2 /* ModifierFlags.Ambient */); + var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~1025 /* ModifierFlags.ExportDefault */) | 2 /* ModifierFlags.Ambient */); var cleanDeclaration = factory.updateFunctionDeclaration(clean, modifiers, /*asteriskToken*/ undefined, clean.name, clean.typeParameters, clean.parameters, clean.type, /*body*/ undefined); @@ -110431,10 +111431,10 @@ var ts; return clean; } } - case 261 /* SyntaxKind.ModuleDeclaration */: { + case 264 /* SyntaxKind.ModuleDeclaration */: { needsDeclare = false; var inner = input.body; - if (inner && inner.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (inner && inner.kind === 265 /* SyntaxKind.ModuleBlock */) { var oldNeedsScopeFix = needsScopeFixMarker; var oldHasScopeFix = resultHasScopeMarker; resultHasScopeMarker = false; @@ -110475,7 +111475,7 @@ var ts; return cleanup(factory.updateModuleDeclaration(input, mods, input.name, body)); } } - case 257 /* SyntaxKind.ClassDeclaration */: { + case 260 /* SyntaxKind.ClassDeclaration */: { errorNameNode = input.name; errorFallbackNode = input; var modifiers = factory.createNodeArray(ensureModifiers(input)); @@ -110537,7 +111537,7 @@ var ts; typeName: input.name }); }; var varDecl = factory.createVariableDeclaration(newId_1, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(extendsClause_1.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); - var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); var heritageClauses = factory.createNodeArray(ts.map(input.heritageClauses, function (clause) { if (clause.token === 94 /* SyntaxKind.ExtendsKeyword */) { var oldDiag_2 = getSymbolAccessibilityDiagnostic; @@ -110555,10 +111555,10 @@ var ts; return cleanup(factory.updateClassDeclaration(input, modifiers, input.name, typeParameters, heritageClauses, members)); } } - case 237 /* SyntaxKind.VariableStatement */: { + case 240 /* SyntaxKind.VariableStatement */: { return cleanup(transformVariableStatement(input)); } - case 260 /* SyntaxKind.EnumDeclaration */: { + case 263 /* SyntaxKind.EnumDeclaration */: { return cleanup(factory.updateEnumDeclaration(input, factory.createNodeArray(ensureModifiers(input)), input.name, factory.createNodeArray(ts.mapDefined(input.members, function (m) { if (shouldStripInternal(m)) return; @@ -110577,7 +111577,7 @@ var ts; if (canProdiceDiagnostic) { getSymbolAccessibilityDiagnostic = oldDiag; } - if (input.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (input.kind === 264 /* SyntaxKind.ModuleDeclaration */) { needsDeclare = previousNeedsDeclare; } if (node === input) { @@ -110600,7 +111600,7 @@ var ts; return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e); })); } function recreateBindingElement(e) { - if (e.kind === 227 /* SyntaxKind.OmittedExpression */) { + if (e.kind === 229 /* SyntaxKind.OmittedExpression */) { return; } if (e.name) { @@ -110648,9 +111648,9 @@ var ts; return factory.createModifiersFromModifierFlags(newFlags); } function ensureModifierFlags(node) { - var mask = 257023 /* ModifierFlags.All */ ^ (4 /* ModifierFlags.Public */ | 256 /* ModifierFlags.Async */ | 16384 /* ModifierFlags.Override */); // No async and override modifiers in declaration files + var mask = 258047 /* ModifierFlags.All */ ^ (4 /* ModifierFlags.Public */ | 512 /* ModifierFlags.Async */ | 16384 /* ModifierFlags.Override */); // No async and override modifiers in declaration files var additions = (needsDeclare && !isAlwaysType(node)) ? 2 /* ModifierFlags.Ambient */ : 0 /* ModifierFlags.None */; - var parentIsFile = node.parent.kind === 305 /* SyntaxKind.SourceFile */; + var parentIsFile = node.parent.kind === 308 /* SyntaxKind.SourceFile */; if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) { mask ^= 2 /* ModifierFlags.Ambient */; additions = 0 /* ModifierFlags.None */; @@ -110679,7 +111679,7 @@ var ts; } ts.transformDeclarations = transformDeclarations; function isAlwaysType(node) { - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return true; } return false; @@ -110689,22 +111689,22 @@ var ts; return ts.factory.createModifiersFromModifierFlags(maskModifierFlags(node, modifierMask, modifierAdditions)); } function maskModifierFlags(node, modifierMask, modifierAdditions) { - if (modifierMask === void 0) { modifierMask = 257023 /* ModifierFlags.All */ ^ 4 /* ModifierFlags.Public */; } + if (modifierMask === void 0) { modifierMask = 258047 /* ModifierFlags.All */ ^ 4 /* ModifierFlags.Public */; } if (modifierAdditions === void 0) { modifierAdditions = 0 /* ModifierFlags.None */; } var flags = (ts.getEffectiveModifierFlags(node) & modifierMask) | modifierAdditions; - if (flags & 512 /* ModifierFlags.Default */ && !(flags & 1 /* ModifierFlags.Export */)) { + if (flags & 1024 /* ModifierFlags.Default */ && !(flags & 1 /* ModifierFlags.Export */)) { // A non-exported default is a nonsequitor - we usually try to remove all export modifiers // from statements in ambient declarations; but a default export must retain its export modifier to be syntactically valid flags ^= 1 /* ModifierFlags.Export */; } - if (flags & 512 /* ModifierFlags.Default */ && flags & 2 /* ModifierFlags.Ambient */) { + if (flags & 1024 /* ModifierFlags.Default */ && flags & 2 /* ModifierFlags.Ambient */) { flags ^= 2 /* ModifierFlags.Ambient */; // `declare` is never required alongside `default` (and would be an error if printed) } return flags; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 172 /* SyntaxKind.GetAccessor */ + return accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? accessor.type // Getter - return type : accessor.parameters.length > 0 ? accessor.parameters[0].type // Setter parameter type @@ -110713,52 +111713,52 @@ var ts; } function canHaveLiteralInitializer(node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return !ts.hasEffectiveModifier(node, 8 /* ModifierFlags.Private */); - case 164 /* SyntaxKind.Parameter */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; } return false; } function isPreservedDeclarationStatement(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: return true; } return false; } function isProcessedComponent(node) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 254 /* SyntaxKind.VariableDeclaration */: - case 163 /* SyntaxKind.TypeParameter */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 178 /* SyntaxKind.TypeReference */: - case 189 /* SyntaxKind.ConditionalType */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 200 /* SyntaxKind.ImportType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: + case 191 /* SyntaxKind.ConditionalType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 202 /* SyntaxKind.ImportType */: return true; } return false; @@ -110898,7 +111898,7 @@ var ts; * @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files. */ function transformNodes(resolver, host, factory, options, nodes, transformers, allowDtsFiles) { - var enabledSyntaxKindFeatures = new Array(355 /* SyntaxKind.Count */); + var enabledSyntaxKindFeatures = new Array(358 /* SyntaxKind.Count */); var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentStatements; @@ -110980,7 +111980,7 @@ var ts; var transformed = []; for (var _a = 0, nodes_3 = nodes; _a < nodes_3.length; _a++) { var node = nodes_3[_a]; - ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* tracing.Phase.Emit */, "transformNodes", node.kind === 305 /* SyntaxKind.SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); + ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* tracing.Phase.Emit */, "transformNodes", node.kind === 308 /* SyntaxKind.SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); transformed.push((allowDtsFiles ? transformation : transformRoot)(node)); ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop(); } @@ -111386,7 +112386,7 @@ var ts; /*@internal*/ function getOutputPathsFor(sourceFile, host, forceDtsPaths) { var options = host.getCompilerOptions(); - if (sourceFile.kind === 306 /* SyntaxKind.Bundle */) { + if (sourceFile.kind === 309 /* SyntaxKind.Bundle */) { return getOutputPathsForBundle(options, forceDtsPaths); } else { @@ -111755,8 +112755,8 @@ var ts; } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) { var sourceFileOrBundle = transform.transformed[0]; - var bundle = sourceFileOrBundle.kind === 306 /* SyntaxKind.Bundle */ ? sourceFileOrBundle : undefined; - var sourceFile = sourceFileOrBundle.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFileOrBundle : undefined; + var bundle = sourceFileOrBundle.kind === 309 /* SyntaxKind.Bundle */ ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFileOrBundle : undefined; var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; var sourceMapGenerator; if (shouldEmitSourceMaps(mapOptions, sourceFileOrBundle)) { @@ -111806,7 +112806,7 @@ var ts; } function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) { return (mapOptions.sourceMap || mapOptions.inlineSourceMap) - && (sourceFileOrBundle.kind !== 305 /* SyntaxKind.SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Extension.Json */)); + && (sourceFileOrBundle.kind !== 308 /* SyntaxKind.SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Extension.Json */)); } function getSourceRoot(mapOptions) { // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the @@ -111869,8 +112869,8 @@ var ts; } ts.getBuildInfoText = getBuildInfoText; /*@internal*/ - function getBuildInfo(buildInfoText) { - return JSON.parse(buildInfoText); + function getBuildInfo(buildInfoFile, buildInfoText) { + return ts.readJsonOrUndefined(buildInfoFile, buildInfoText); } ts.getBuildInfo = getBuildInfo; /*@internal*/ @@ -111948,17 +112948,16 @@ var ts; var buildInfo; if (host.getBuildInfo) { // If host directly provides buildinfo we can get it directly. This allows host to cache the buildinfo - var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); - if (!hostBuildInfo) - return buildInfoPath; - buildInfo = hostBuildInfo; + buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); } else { var buildInfoText = host.readFile(buildInfoPath); if (!buildInfoText) return buildInfoPath; - buildInfo = getBuildInfo(buildInfoText); + buildInfo = getBuildInfo(buildInfoPath, buildInfoText); } + if (!buildInfo) + return buildInfoPath; if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts)) return buildInfoPath; var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath)); @@ -112084,6 +113083,10 @@ var ts; var nodeIdToGeneratedName; // Map of generated names for specific nodes. var autoGeneratedIdToGeneratedName; // Map of generated names for temp and loop variables. var generatedNames; // Set of names generated by the NameGenerator. + var formattedNameTempFlagsStack; + var formattedNameTempFlags; + var privateNameTempFlagsStack; // Stack of enclosing name generation scopes. + var privateNameTempFlags; // TempFlags for the current name generation scope. var tempFlagsStack; // Stack of enclosing name generation scopes. var tempFlags; // TempFlags for the current name generation scope. var reservedNamesStack; // Stack of TempFlags reserved in enclosing name generation scopes. @@ -112149,9 +113152,9 @@ var ts; break; } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: return printFile(node); - case 306 /* SyntaxKind.Bundle */: return printBundle(node); - case 307 /* SyntaxKind.UnparsedSource */: return printUnparsedSource(node); + case 308 /* SyntaxKind.SourceFile */: return printFile(node); + case 309 /* SyntaxKind.Bundle */: return printBundle(node); + case 310 /* SyntaxKind.UnparsedSource */: return printUnparsedSource(node); } writeNode(hint, node, sourceFile, beginPrint()); return endPrint(); @@ -112342,6 +113345,10 @@ var ts; nodeIdToGeneratedName = []; autoGeneratedIdToGeneratedName = []; generatedNames = new ts.Set(); + formattedNameTempFlagsStack = []; + formattedNameTempFlags = new ts.Map(); + privateNameTempFlagsStack = []; + privateNameTempFlags = 0 /* TempFlags.Auto */; tempFlagsStack = []; tempFlags = 0 /* TempFlags.Auto */; reservedNamesStack = []; @@ -112485,315 +113492,315 @@ var ts; return emitPrivateIdentifier(node); // Parse tree nodes // Names - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return emitQualifiedName(node); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return emitComputedPropertyName(node); // Signature elements - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return emitTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return emitParameter(node); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return emitDecorator(node); // Type members - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return emitPropertySignature(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return emitPropertyDeclaration(node); - case 168 /* SyntaxKind.MethodSignature */: + case 170 /* SyntaxKind.MethodSignature */: return emitMethodSignature(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return emitMethodDeclaration(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return emitClassStaticBlockDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return emitConstructor(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return emitAccessorDeclaration(node); - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: return emitCallSignature(node); - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return emitConstructSignature(node); - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return emitIndexSignature(node); // Types - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return emitTypePredicate(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return emitTypeReference(node); - case 179 /* SyntaxKind.FunctionType */: + case 181 /* SyntaxKind.FunctionType */: return emitFunctionType(node); - case 180 /* SyntaxKind.ConstructorType */: + case 182 /* SyntaxKind.ConstructorType */: return emitConstructorType(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return emitTypeQuery(node); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return emitTypeLiteral(node); - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return emitArrayType(node); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return emitTupleType(node); - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return emitOptionalType(node); // SyntaxKind.RestType is handled below - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return emitUnionType(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return emitIntersectionType(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return emitConditionalType(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return emitInferType(node); - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return emitParenthesizedType(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return emitThisType(); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return emitTypeOperator(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return emitIndexedAccessType(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return emitMappedType(node); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return emitLiteralType(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return emitNamedTupleMember(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return emitTemplateType(node); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: + case 201 /* SyntaxKind.TemplateLiteralTypeSpan */: return emitTemplateTypeSpan(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return emitImportTypeNode(node); // Binding patterns - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return emitBindingElement(node); // Misc - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return emitTemplateSpan(node); - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: return emitSemicolonClassElement(); // Statements - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return emitBlock(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return emitVariableStatement(node); - case 236 /* SyntaxKind.EmptyStatement */: + case 239 /* SyntaxKind.EmptyStatement */: return emitEmptyStatement(/*isEmbeddedStatement*/ false); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return emitExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return emitIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return emitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return emitWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return emitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return emitForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return emitForOfStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return emitContinueStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return emitBreakStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return emitReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return emitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return emitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return emitLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return emitThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return emitTryStatement(node); - case 253 /* SyntaxKind.DebuggerStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: return emitDebuggerStatement(node); // Declarations - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return emitVariableDeclaration(node); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return emitVariableDeclarationList(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return emitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return emitClassDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return emitEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return emitModuleDeclaration(node); - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return emitModuleBlock(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return emitCaseBlock(node); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return emitNamespaceExportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return emitImportDeclaration(node); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return emitImportClause(node); - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return emitNamespaceImport(node); - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: return emitNamespaceExport(node); - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: return emitNamedImports(node); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return emitImportSpecifier(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return emitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return emitExportDeclaration(node); - case 273 /* SyntaxKind.NamedExports */: + case 276 /* SyntaxKind.NamedExports */: return emitNamedExports(node); - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return emitExportSpecifier(node); - case 293 /* SyntaxKind.AssertClause */: + case 296 /* SyntaxKind.AssertClause */: return emitAssertClause(node); - case 294 /* SyntaxKind.AssertEntry */: + case 297 /* SyntaxKind.AssertEntry */: return emitAssertEntry(node); - case 276 /* SyntaxKind.MissingDeclaration */: + case 279 /* SyntaxKind.MissingDeclaration */: return; // Module references - case 277 /* SyntaxKind.ExternalModuleReference */: + case 280 /* SyntaxKind.ExternalModuleReference */: return emitExternalModuleReference(node); // JSX (non-expression) case 11 /* SyntaxKind.JsxText */: return emitJsxText(node); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 283 /* SyntaxKind.JsxOpeningFragment */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 286 /* SyntaxKind.JsxOpeningFragment */: return emitJsxOpeningElementOrFragment(node); - case 281 /* SyntaxKind.JsxClosingElement */: - case 284 /* SyntaxKind.JsxClosingFragment */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 287 /* SyntaxKind.JsxClosingFragment */: return emitJsxClosingElementOrFragment(node); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return emitJsxAttribute(node); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return emitJsxAttributes(node); - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: return emitJsxSpreadAttribute(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return emitJsxExpression(node); // Clauses - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return emitCaseClause(node); - case 290 /* SyntaxKind.DefaultClause */: + case 293 /* SyntaxKind.DefaultClause */: return emitDefaultClause(node); - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return emitHeritageClause(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return emitCatchClause(node); // Property assignments - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return emitPropertyAssignment(node); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return emitSpreadAssignment(node); // Enum - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return emitEnumMember(node); // Unparsed - case 300 /* SyntaxKind.UnparsedPrologue */: + case 303 /* SyntaxKind.UnparsedPrologue */: return writeUnparsedNode(node); - case 307 /* SyntaxKind.UnparsedSource */: - case 301 /* SyntaxKind.UnparsedPrepend */: + case 310 /* SyntaxKind.UnparsedSource */: + case 304 /* SyntaxKind.UnparsedPrepend */: return emitUnparsedSourceOrPrepend(node); - case 302 /* SyntaxKind.UnparsedText */: - case 303 /* SyntaxKind.UnparsedInternalText */: + case 305 /* SyntaxKind.UnparsedText */: + case 306 /* SyntaxKind.UnparsedInternalText */: return emitUnparsedTextLike(node); - case 304 /* SyntaxKind.UnparsedSyntheticReference */: + case 307 /* SyntaxKind.UnparsedSyntheticReference */: return emitUnparsedSyntheticReference(node); // Top-level nodes - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return emitSourceFile(node); - case 306 /* SyntaxKind.Bundle */: + case 309 /* SyntaxKind.Bundle */: return ts.Debug.fail("Bundles should be printed using printBundle"); // SyntaxKind.UnparsedSource (handled above) - case 308 /* SyntaxKind.InputFiles */: + case 311 /* SyntaxKind.InputFiles */: return ts.Debug.fail("InputFiles should not be printed"); // JSDoc nodes (only used in codefixes currently) - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return emitJSDocTypeExpression(node); - case 310 /* SyntaxKind.JSDocNameReference */: + case 313 /* SyntaxKind.JSDocNameReference */: return emitJSDocNameReference(node); - case 312 /* SyntaxKind.JSDocAllType */: + case 315 /* SyntaxKind.JSDocAllType */: return writePunctuation("*"); - case 313 /* SyntaxKind.JSDocUnknownType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return writePunctuation("?"); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return emitJSDocNullableType(node); - case 315 /* SyntaxKind.JSDocNonNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: return emitJSDocNonNullableType(node); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return emitJSDocOptionalType(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return emitJSDocFunctionType(node); - case 186 /* SyntaxKind.RestType */: - case 318 /* SyntaxKind.JSDocVariadicType */: + case 188 /* SyntaxKind.RestType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return emitRestOrJSDocVariadicType(node); - case 319 /* SyntaxKind.JSDocNamepathType */: + case 322 /* SyntaxKind.JSDocNamepathType */: return; - case 320 /* SyntaxKind.JSDoc */: + case 323 /* SyntaxKind.JSDoc */: return emitJSDoc(node); - case 322 /* SyntaxKind.JSDocTypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: return emitJSDocTypeLiteral(node); - case 323 /* SyntaxKind.JSDocSignature */: + case 326 /* SyntaxKind.JSDocSignature */: return emitJSDocSignature(node); - case 327 /* SyntaxKind.JSDocTag */: - case 332 /* SyntaxKind.JSDocClassTag */: - case 337 /* SyntaxKind.JSDocOverrideTag */: + case 330 /* SyntaxKind.JSDocTag */: + case 335 /* SyntaxKind.JSDocClassTag */: + case 340 /* SyntaxKind.JSDocOverrideTag */: return emitJSDocSimpleTag(node); - case 328 /* SyntaxKind.JSDocAugmentsTag */: - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return emitJSDocHeritageTag(node); - case 330 /* SyntaxKind.JSDocAuthorTag */: - case 331 /* SyntaxKind.JSDocDeprecatedTag */: + case 333 /* SyntaxKind.JSDocAuthorTag */: + case 334 /* SyntaxKind.JSDocDeprecatedTag */: return; // SyntaxKind.JSDocClassTag (see JSDocTag, above) - case 333 /* SyntaxKind.JSDocPublicTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 336 /* SyntaxKind.JSDocReadonlyTag */: + case 336 /* SyntaxKind.JSDocPublicTag */: + case 337 /* SyntaxKind.JSDocPrivateTag */: + case 338 /* SyntaxKind.JSDocProtectedTag */: + case 339 /* SyntaxKind.JSDocReadonlyTag */: return; - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return emitJSDocCallbackTag(node); // SyntaxKind.JSDocEnumTag (see below) - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return emitJSDocPropertyLikeTag(node); - case 339 /* SyntaxKind.JSDocEnumTag */: - case 341 /* SyntaxKind.JSDocReturnTag */: - case 342 /* SyntaxKind.JSDocThisTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: + case 345 /* SyntaxKind.JSDocThisTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return emitJSDocSimpleTypedTag(node); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return emitJSDocTemplateTag(node); - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return emitJSDocTypedefTag(node); - case 346 /* SyntaxKind.JSDocSeeTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: return emitJSDocSeeTag(node); // SyntaxKind.JSDocPropertyTag (see JSDocParameterTag, above) // Transformation nodes - case 349 /* SyntaxKind.NotEmittedStatement */: - case 353 /* SyntaxKind.EndOfDeclarationMarker */: - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 352 /* SyntaxKind.NotEmittedStatement */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return; } if (ts.isExpression(node)) { @@ -112825,85 +113832,87 @@ var ts; case 80 /* SyntaxKind.PrivateIdentifier */: return emitPrivateIdentifier(node); // Expressions - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return emitArrayLiteralExpression(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return emitObjectLiteralExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return emitPropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return emitElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return emitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return emitNewExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return emitTypeAssertionExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return emitParenthesizedExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return emitFunctionExpression(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return emitArrowFunction(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return emitDeleteExpression(node); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return emitTypeOfExpression(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return emitVoidExpression(node); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return emitAwaitExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return emitBinaryExpression(node); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return emitConditionalExpression(node); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return emitTemplateExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return emitYieldExpression(node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return emitSpreadElement(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return emitClassExpression(node); - case 227 /* SyntaxKind.OmittedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: return; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: return emitAsExpression(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return emitNonNullExpression(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 231 /* SyntaxKind.MetaProperty */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return emitSatisfiesExpression(node); + case 233 /* SyntaxKind.MetaProperty */: return emitMetaProperty(node); - case 232 /* SyntaxKind.SyntheticExpression */: + case 234 /* SyntaxKind.SyntheticExpression */: return ts.Debug.fail("SyntheticExpression should never be printed."); // JSX - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return emitJsxElement(node); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return emitJsxFragment(node); // Synthesized list - case 348 /* SyntaxKind.SyntaxList */: + case 351 /* SyntaxKind.SyntaxList */: return ts.Debug.fail("SyntaxList should not be printed"); // Transformation nodes - case 349 /* SyntaxKind.NotEmittedStatement */: + case 352 /* SyntaxKind.NotEmittedStatement */: return; - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return emitCommaList(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return; - case 354 /* SyntaxKind.SyntheticReferenceExpression */: + case 357 /* SyntaxKind.SyntheticReferenceExpression */: return ts.Debug.fail("SyntheticReferenceExpression should not be printed"); } } @@ -112951,7 +113960,7 @@ var ts; } function emitHelpers(node) { var helpersEmitted = false; - var bundle = node.kind === 306 /* SyntaxKind.Bundle */ ? node : undefined; + var bundle = node.kind === 309 /* SyntaxKind.Bundle */ ? node : undefined; if (bundle && moduleKind === ts.ModuleKind.None) { return; } @@ -113051,7 +114060,7 @@ var ts; var pos = getTextPosWithWriteLine(); writeUnparsedNode(unparsed); if (bundleFileInfo) { - updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 302 /* SyntaxKind.UnparsedText */ ? + updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 305 /* SyntaxKind.UnparsedText */ ? "text" /* BundleFileSectionKind.Text */ : "internal" /* BundleFileSectionKind.Internal */); } @@ -113088,7 +114097,7 @@ var ts; } function emitTabStop(hint, node, snippet) { // A tab stop should only be attached to an empty node, i.e. a node that doesn't emit any text. - ts.Debug.assert(node.kind === 236 /* SyntaxKind.EmptyStatement */, "A tab stop cannot be attached to a node of kind ".concat(ts.Debug.formatSyntaxKind(node.kind), ".")); + ts.Debug.assert(node.kind === 239 /* SyntaxKind.EmptyStatement */, "A tab stop cannot be attached to a node of kind ".concat(ts.Debug.formatSyntaxKind(node.kind), ".")); ts.Debug.assert(hint !== 5 /* EmitHint.EmbeddedStatement */, "A tab stop cannot be attached to an embedded statement."); nonEscapingWrite("$".concat(snippet.order)); } @@ -113149,7 +114158,7 @@ var ts; emit(node.dotDotDotToken); emitNodeWithWriter(node.name, writeParameter); emit(node.questionToken); - if (node.parent && node.parent.kind === 317 /* SyntaxKind.JSDocFunctionType */ && !node.name) { + if (node.parent && node.parent.kind === 320 /* SyntaxKind.JSDocFunctionType */ && !node.name) { emit(node.type); } else { @@ -113210,7 +114219,7 @@ var ts; } function emitAccessorDeclaration(node) { emitDecoratorsAndModifiers(node, node.modifiers); - writeKeyword(node.kind === 172 /* SyntaxKind.GetAccessor */ ? "get" : "set"); + writeKeyword(node.kind === 174 /* SyntaxKind.GetAccessor */ ? "get" : "set"); writeSpace(); emit(node.name); emitSignatureAndBody(node, emitSignatureHead); @@ -113383,7 +114392,7 @@ var ts; function emitTypeOperator(node) { writeTokenText(node.operator, writeKeyword); writeSpace(); - var parenthesizerRule = node.operator === 145 /* SyntaxKind.ReadonlyKeyword */ ? + var parenthesizerRule = node.operator === 146 /* SyntaxKind.ReadonlyKeyword */ ? parenthesizer.parenthesizeOperandOfReadonlyTypeOperator : parenthesizer.parenthesizeOperandOfTypeOperator; emit(node.type, parenthesizerRule); @@ -113406,7 +114415,7 @@ var ts; } if (node.readonlyToken) { emit(node.readonlyToken); - if (node.readonlyToken.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { + if (node.readonlyToken.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { writeKeyword("readonly"); } writeSpace(); @@ -113652,7 +114661,7 @@ var ts; emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } function emitAwaitExpression(node) { - emitTokenWithComment(132 /* SyntaxKind.AwaitKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(133 /* SyntaxKind.AwaitKeyword */, node.pos, writeKeyword, node); writeSpace(); emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } @@ -113677,7 +114686,7 @@ var ts; // expression a prefix increment whose operand is a plus expression - (++(+x)) // The same is true of minus of course. var operand = node.operand; - return operand.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ + return operand.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && ((node.operator === 39 /* SyntaxKind.PlusToken */ && (operand.operator === 39 /* SyntaxKind.PlusToken */ || operand.operator === 45 /* SyntaxKind.PlusPlusToken */)) || (node.operator === 40 /* SyntaxKind.MinusToken */ && (operand.operator === 40 /* SyntaxKind.MinusToken */ || operand.operator === 46 /* SyntaxKind.MinusMinusToken */))); } @@ -113825,6 +114834,15 @@ var ts; emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess); writeOperator("!"); } + function emitSatisfiesExpression(node) { + emitExpression(node.expression, /*parenthesizerRules*/ undefined); + if (node.type) { + writeSpace(); + writeKeyword("satisfies"); + writeSpace(); + emit(node.type); + } + } function emitMetaProperty(node) { writeToken(node.keywordToken, node.pos, writePunctuation); writePunctuation("."); @@ -113882,7 +114900,7 @@ var ts; if (node.elseStatement) { writeLineOrSpace(node, node.thenStatement, node.elseStatement); emitTokenWithComment(91 /* SyntaxKind.ElseKeyword */, node.thenStatement.end, writeKeyword, node); - if (node.elseStatement.kind === 239 /* SyntaxKind.IfStatement */) { + if (node.elseStatement.kind === 242 /* SyntaxKind.IfStatement */) { writeSpace(); emit(node.elseStatement); } @@ -113945,7 +114963,7 @@ var ts; emitTokenWithComment(20 /* SyntaxKind.OpenParenToken */, openParenPos, writePunctuation, node); emitForBinding(node.initializer); writeSpace(); - emitTokenWithComment(160 /* SyntaxKind.OfKeyword */, node.initializer.end, writeKeyword, node); + emitTokenWithComment(162 /* SyntaxKind.OfKeyword */, node.initializer.end, writeKeyword, node); writeSpace(); emitExpression(node.expression); emitTokenWithComment(21 /* SyntaxKind.CloseParenToken */, node.expression.end, writePunctuation, node); @@ -113953,7 +114971,7 @@ var ts; } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { emit(node); } else { @@ -113990,7 +115008,7 @@ var ts; } pos = writeTokenText(token, writer, pos); if (isSimilarNode && contextNode.end !== pos) { - var isJsxExprContext = contextNode.kind === 288 /* SyntaxKind.JsxExpression */; + var isJsxExprContext = contextNode.kind === 291 /* SyntaxKind.JsxExpression */; emitTrailingCommentsOfPosition(pos, /*prefixSpace*/ !isJsxExprContext, /*forceNoNewline*/ isJsxExprContext); } return pos; @@ -114300,7 +115318,7 @@ var ts; emitTokenWithComment(100 /* SyntaxKind.ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114325,7 +115343,7 @@ var ts; if (node.importClause) { emit(node.importClause); writeSpace(); - emitTokenWithComment(156 /* SyntaxKind.FromKeyword */, node.importClause.end, writeKeyword, node); + emitTokenWithComment(158 /* SyntaxKind.FromKeyword */, node.importClause.end, writeKeyword, node); writeSpace(); } emitExpression(node.moduleSpecifier); @@ -114336,7 +115354,7 @@ var ts; } function emitImportClause(node) { if (node.isTypeOnly) { - emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114349,7 +115367,7 @@ var ts; function emitNamespaceImport(node) { var asPos = emitTokenWithComment(41 /* SyntaxKind.AsteriskToken */, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -114375,10 +115393,11 @@ var ts; writeTrailingSemicolon(); } function emitExportDeclaration(node) { + emitModifiers(node, node.modifiers); var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - nextPos = emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, nextPos, writeKeyword, node); writeSpace(); } if (node.exportClause) { @@ -114390,7 +115409,7 @@ var ts; if (node.moduleSpecifier) { writeSpace(); var fromPos = node.exportClause ? node.exportClause.end : nextPos; - emitTokenWithComment(156 /* SyntaxKind.FromKeyword */, fromPos, writeKeyword, node); + emitTokenWithComment(158 /* SyntaxKind.FromKeyword */, fromPos, writeKeyword, node); writeSpace(); emitExpression(node.moduleSpecifier); } @@ -114400,7 +115419,7 @@ var ts; writeTrailingSemicolon(); } function emitAssertClause(node) { - emitTokenWithComment(129 /* SyntaxKind.AssertKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(130 /* SyntaxKind.AssertKeyword */, node.pos, writeKeyword, node); writeSpace(); var elements = node.elements; emitList(node, elements, 526226 /* ListFormat.ImportClauseEntries */); @@ -114420,9 +115439,9 @@ var ts; function emitNamespaceExportDeclaration(node) { var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, nextPos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(142 /* SyntaxKind.NamespaceKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(143 /* SyntaxKind.NamespaceKeyword */, nextPos, writeKeyword, node); writeSpace(); emit(node.name); writeTrailingSemicolon(); @@ -114430,7 +115449,7 @@ var ts; function emitNamespaceExport(node) { var asPos = emitTokenWithComment(41 /* SyntaxKind.AsteriskToken */, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -114453,7 +115472,7 @@ var ts; if (node.propertyName) { emit(node.propertyName); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, node.propertyName.end, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, node.propertyName.end, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114674,7 +115693,7 @@ var ts; } } if (node.tags) { - if (node.tags.length === 1 && node.tags[0].kind === 343 /* SyntaxKind.JSDocTypeTag */ && !node.comment) { + if (node.tags.length === 1 && node.tags[0].kind === 346 /* SyntaxKind.JSDocTypeTag */ && !node.comment) { writeSpace(); emit(node.tags[0]); } @@ -114719,7 +115738,7 @@ var ts; function emitJSDocTypedefTag(tag) { emitJSDocTagName(tag.tagName); if (tag.typeExpression) { - if (tag.typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */) { + if (tag.typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */) { emitJSDocTypeExpression(tag.typeExpression); } else { @@ -114738,7 +115757,7 @@ var ts; emit(tag.fullName); } emitJSDocComment(tag.comment); - if (tag.typeExpression && tag.typeExpression.kind === 322 /* SyntaxKind.JSDocTypeLiteral */) { + if (tag.typeExpression && tag.typeExpression.kind === 325 /* SyntaxKind.JSDocTypeLiteral */) { emitJSDocTypeLiteral(tag.typeExpression); } } @@ -115671,13 +116690,13 @@ var ts; && (!currentSourceFile || ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile)); } function skipSynthesizedParentheses(node) { - while (node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { + while (node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; } function getTextOfNode(node, includeTrivia) { - if (ts.isGeneratedIdentifier(node)) { + if (ts.isGeneratedIdentifier(node) || ts.isGeneratedPrivateIdentifier(node)) { return generateName(node); } if (ts.isStringLiteral(node) && node.textSourceNode) { @@ -115701,7 +116720,7 @@ var ts; function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) { if (node.kind === 10 /* SyntaxKind.StringLiteral */ && node.textSourceNode) { var textSourceNode = node.textSourceNode; - if (ts.isIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) { + if (ts.isIdentifier(textSourceNode) || ts.isPrivateIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) { var text = ts.isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode(textSourceNode); return jsxAttributeEscape ? "\"".concat(ts.escapeJsxAttributeString(text), "\"") : neverAsciiEscape || (ts.getEmitFlags(node) & 16777216 /* EmitFlags.NoAsciiEscaping */) ? "\"".concat(ts.escapeString(text), "\"") : @@ -115725,7 +116744,11 @@ var ts; return; } tempFlagsStack.push(tempFlags); - tempFlags = 0; + tempFlags = 0 /* TempFlags.Auto */; + privateNameTempFlagsStack.push(privateNameTempFlags); + privateNameTempFlags = 0 /* TempFlags.Auto */; + formattedNameTempFlagsStack.push(formattedNameTempFlags); + formattedNameTempFlags = undefined; reservedNamesStack.push(reservedNames); } /** @@ -115736,6 +116759,8 @@ var ts; return; } tempFlags = tempFlagsStack.pop(); + privateNameTempFlags = privateNameTempFlagsStack.pop(); + formattedNameTempFlags = formattedNameTempFlagsStack.pop(); reservedNames = reservedNamesStack.pop(); } function reserveNameInNestedScopes(name) { @@ -115748,84 +116773,84 @@ var ts; if (!node) return; switch (node.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: ts.forEach(node.statements, generateNames); break; - case 250 /* SyntaxKind.LabeledStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 253 /* SyntaxKind.LabeledStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: generateNames(node.statement); break; - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: generateNames(node.thenStatement); generateNames(node.elseStatement); break; - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: generateNames(node.initializer); generateNames(node.statement); break; - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: generateNames(node.caseBlock); break; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: ts.forEach(node.clauses, generateNames); break; - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: ts.forEach(node.statements, generateNames); break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: generateNames(node.tryBlock); generateNames(node.catchClause); generateNames(node.finallyBlock); break; - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: generateNames(node.variableDeclaration); generateNames(node.block); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: generateNames(node.declarationList); break; - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: ts.forEach(node.declarations, generateNames); break; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: generateNameIfNeeded(node.name); break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: generateNameIfNeeded(node.name); if (ts.getEmitFlags(node) & 524288 /* EmitFlags.ReuseTempVariableScope */) { ts.forEach(node.parameters, generateNames); generateNames(node.body); } break; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: ts.forEach(node.elements, generateNames); break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: generateNames(node.importClause); break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: generateNameIfNeeded(node.name); generateNames(node.namedBindings); break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: generateNameIfNeeded(node.name); break; - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: generateNameIfNeeded(node.name); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: ts.forEach(node.elements, generateNames); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: generateNameIfNeeded(node.propertyName || node.name); break; } @@ -115834,19 +116859,19 @@ var ts; if (!node) return; switch (node.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: generateNameIfNeeded(node.name); break; } } function generateNameIfNeeded(name) { if (name) { - if (ts.isGeneratedIdentifier(name)) { + if (ts.isGeneratedIdentifier(name) || ts.isGeneratedPrivateIdentifier(name)) { generateName(name); } else if (ts.isBindingPattern(name)) { @@ -115861,7 +116886,7 @@ var ts; if ((name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) === 4 /* GeneratedIdentifierFlags.Node */) { // Node names generate unique names based on their original node // and are cached based on that node's id. - return generateNameCached(getNodeForGeneratedName(name), name.autoGenerateFlags); + return generateNameCached(ts.getNodeForGeneratedName(name), ts.isPrivateIdentifier(name), name.autoGenerateFlags, name.autoGeneratePrefix, name.autoGenerateSuffix); } else { // Auto, Loop, and Unique names are cached based on their unique @@ -115870,9 +116895,9 @@ var ts; return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = makeName(name)); } } - function generateNameCached(node, flags) { + function generateNameCached(node, privateName, flags, prefix, suffix) { var nodeId = ts.getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, flags)); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, privateName, flags !== null && flags !== void 0 ? flags : 0 /* GeneratedIdentifierFlags.None */, ts.formatGeneratedNamePart(prefix, generateName), ts.formatGeneratedNamePart(suffix))); } /** * Returns a value indicating whether a name is unique globally, within the current file, @@ -115904,20 +116929,53 @@ var ts; } return true; } + function getTempFlags(formattedNameKey) { + var _a; + switch (formattedNameKey) { + case "": + return tempFlags; + case "#": + return privateNameTempFlags; + default: + return (_a = formattedNameTempFlags === null || formattedNameTempFlags === void 0 ? void 0 : formattedNameTempFlags.get(formattedNameKey)) !== null && _a !== void 0 ? _a : 0 /* TempFlags.Auto */; + } + } + function setTempFlags(formattedNameKey, flags) { + switch (formattedNameKey) { + case "": + tempFlags = flags; + break; + case "#": + privateNameTempFlags = flags; + break; + default: + formattedNameTempFlags !== null && formattedNameTempFlags !== void 0 ? formattedNameTempFlags : (formattedNameTempFlags = new ts.Map()); + formattedNameTempFlags.set(formattedNameKey, flags); + break; + } + } /** * Return the next available name in the pattern _a ... _z, _0, _1, ... * TempFlags._i or TempFlags._n may be used to express a preference for that dedicated name. * Note that names generated by makeTempVariableName and makeUniqueName will never conflict. */ - function makeTempVariableName(flags, reservedInNestedScopes) { + function makeTempVariableName(flags, reservedInNestedScopes, privateName, prefix, suffix) { + if (prefix.length > 0 && prefix.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + prefix = prefix.slice(1); + } + // Generate a key to use to acquire a TempFlags counter based on the fixed portions of the generated name. + var key = ts.formatGeneratedName(privateName, prefix, "", suffix); + var tempFlags = getTempFlags(key); if (flags && !(tempFlags & flags)) { var name = flags === 268435456 /* TempFlags._i */ ? "_i" : "_n"; - if (isUniqueName(name)) { + var fullName = ts.formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { tempFlags |= flags; if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } while (true) { @@ -115928,11 +116986,13 @@ var ts; var name = count < 26 ? "_" + String.fromCharCode(97 /* CharacterCodes.a */ + count) : "_" + (count - 26); - if (isUniqueName(name)) { + var fullName = ts.formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } } @@ -115944,17 +117004,24 @@ var ts; * makeUniqueName are guaranteed to never conflict. * If `optimistic` is set, the first instance will use 'baseName' verbatim instead of 'baseName_1' */ - function makeUniqueName(baseName, checkFn, optimistic, scoped) { + function makeUniqueName(baseName, checkFn, optimistic, scoped, privateName, prefix, suffix) { if (checkFn === void 0) { checkFn = isUniqueName; } + if (baseName.length > 0 && baseName.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + baseName = baseName.slice(1); + } + if (prefix.length > 0 && prefix.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + prefix = prefix.slice(1); + } if (optimistic) { - if (checkFn(baseName)) { + var fullName = ts.formatGeneratedName(privateName, prefix, baseName, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(baseName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(baseName); + generatedNames.add(fullName); } - return baseName; + return fullName; } } // Find the first unique 'name_n', where n is a positive number @@ -115963,21 +117030,21 @@ var ts; } var i = 1; while (true) { - var generatedName = baseName + i; - if (checkFn(generatedName)) { + var fullName = ts.formatGeneratedName(privateName, prefix, baseName + i, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(generatedName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(generatedName); + generatedNames.add(fullName); } - return generatedName; + return fullName; } i++; } } function makeFileLevelOptimisticUniqueName(name) { - return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true); + return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a ModuleDeclaration or EnumDeclaration. @@ -115985,7 +117052,7 @@ var ts; function generateNameForModuleOrEnum(node) { var name = getTextOfNode(node.name); // Use module/enum name itself if it is unique, otherwise make a unique variation - return isUniqueLocalName(name, node) ? name : makeUniqueName(name); + return isUniqueLocalName(name, node) ? name : makeUniqueName(name, isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for an ImportDeclaration or ExportDeclaration. @@ -115994,89 +117061,76 @@ var ts; var expr = ts.getExternalModuleName(node); // TODO: GH#18217 var baseName = ts.isStringLiteral(expr) ? ts.makeIdentifierFromModuleName(expr.text) : "module"; - return makeUniqueName(baseName); + return makeUniqueName(baseName, isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a default export. */ function generateNameForExportDefault() { - return makeUniqueName("default"); + return makeUniqueName("default", isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a class expression. */ function generateNameForClassExpression() { - return makeUniqueName("class"); + return makeUniqueName("class", isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } - function generateNameForMethodOrAccessor(node) { + function generateNameForMethodOrAccessor(node, privateName, prefix, suffix) { if (ts.isIdentifier(node.name)) { - return generateNameCached(node.name); + return generateNameCached(node.name, privateName); } - return makeTempVariableName(0 /* TempFlags.Auto */); + return makeTempVariableName(0 /* TempFlags.Auto */, /*reservedInNestedScopes*/ false, privateName, prefix, suffix); } /** * Generates a unique name from a node. */ - function generateNameForNode(node, flags) { + function generateNameForNode(node, privateName, flags, prefix, suffix) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(flags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 80 /* SyntaxKind.PrivateIdentifier */: + return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(flags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), privateName, prefix, suffix); + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForModuleOrEnum(node); - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForImportOrExportDeclaration(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForExportDefault(); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForClassExpression(); - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return generateNameForMethodOrAccessor(node); - case 162 /* SyntaxKind.ComputedPropertyName */: - return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ true); + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return generateNameForMethodOrAccessor(node, privateName, prefix, suffix); + case 164 /* SyntaxKind.ComputedPropertyName */: + return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ true, privateName, prefix, suffix); default: - return makeTempVariableName(0 /* TempFlags.Auto */); + return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ false, privateName, prefix, suffix); } } /** * Generates a unique identifier for a node. */ function makeName(name) { + var prefix = ts.formatGeneratedNamePart(name.autoGeneratePrefix, generateName); + var suffix = ts.formatGeneratedNamePart(name.autoGenerateSuffix); switch (name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) { case 1 /* GeneratedIdentifierFlags.Auto */: - return makeTempVariableName(0 /* TempFlags.Auto */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + return makeTempVariableName(0 /* TempFlags.Auto */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), ts.isPrivateIdentifier(name), prefix, suffix); case 2 /* GeneratedIdentifierFlags.Loop */: - return makeTempVariableName(268435456 /* TempFlags._i */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + ts.Debug.assertNode(name, ts.isIdentifier); + return makeTempVariableName(268435456 /* TempFlags._i */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), /*privateName*/ false, prefix, suffix); case 3 /* GeneratedIdentifierFlags.Unique */: - return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32 /* GeneratedIdentifierFlags.FileLevel */) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32 /* GeneratedIdentifierFlags.FileLevel */) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), ts.isPrivateIdentifier(name), prefix, suffix); } - return ts.Debug.fail("Unsupported GeneratedIdentifierKind."); - } - /** - * Gets the node from which a name should be generated. - */ - function getNodeForGeneratedName(name) { - var autoGenerateId = name.autoGenerateId; - var node = name; - var original = node.original; - while (original) { - node = original; - // if "node" is a different generated name (having a different - // "autoGenerateId"), use it and stop traversing. - if (ts.isIdentifier(node) - && !!(node.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) - && node.autoGenerateId !== autoGenerateId) { - break; - } - original = node.original; - } - // otherwise, return the original node for the source; - return node; + return ts.Debug.fail("Unsupported GeneratedIdentifierKind: ".concat(ts.Debug.formatEnum(name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */, ts.GeneratedIdentifierFlags, /*isFlags*/ true), ".")); } // Comments function pipelineEmitWithComments(hint, node) { @@ -116122,7 +117176,7 @@ var ts; // Emit leading comments if the position is not synthesized and the node // has not opted out from emitting leading comments. if (!skipLeadingComments) { - emitLeadingComments(pos, /*isEmittedNode*/ node.kind !== 349 /* SyntaxKind.NotEmittedStatement */); + emitLeadingComments(pos, /*isEmittedNode*/ node.kind !== 352 /* SyntaxKind.NotEmittedStatement */); } if (!skipLeadingComments || (pos >= 0 && (emitFlags & 512 /* EmitFlags.NoLeadingComments */) !== 0)) { // Advance the container position if comments get emitted or if they've been disabled explicitly using NoLeadingComments. @@ -116133,7 +117187,7 @@ var ts; containerEnd = end; // To avoid invalid comment emit in a down-level binding pattern, we // keep track of the last declaration list container's end - if (node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { declarationListContainerEnd = end; } } @@ -116152,7 +117206,7 @@ var ts; declarationListContainerEnd = savedDeclarationListContainerEnd; // Emit trailing comments if the position is not synthesized and the node // has not opted out from emitting leading comments and is an emitted node. - if (!skipTrailingComments && node.kind !== 349 /* SyntaxKind.NotEmittedStatement */) { + if (!skipTrailingComments && node.kind !== 352 /* SyntaxKind.NotEmittedStatement */) { emitTrailingComments(end); } } @@ -116433,7 +117487,7 @@ var ts; } else { var source = sourceMapRange.source || sourceMapSource; - if (node.kind !== 349 /* SyntaxKind.NotEmittedStatement */ + if (node.kind !== 352 /* SyntaxKind.NotEmittedStatement */ && (emitFlags & 16 /* EmitFlags.NoLeadingSourceMap */) === 0 && sourceMapRange.pos >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, skipSourceTrivia(source, sourceMapRange.pos)); @@ -116451,7 +117505,7 @@ var ts; if (emitFlags & 64 /* EmitFlags.NoNestedSourceMaps */) { sourceMapsDisabled = false; } - if (node.kind !== 349 /* SyntaxKind.NotEmittedStatement */ + if (node.kind !== 352 /* SyntaxKind.NotEmittedStatement */ && (emitFlags & 32 /* EmitFlags.NoTrailingSourceMap */) === 0 && sourceMapRange.end >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, sourceMapRange.end); @@ -116616,7 +117670,16 @@ var ts; return cachedReadDirectoryResult.get(ts.ensureTrailingDirectorySeparator(rootDirPath)); } function getCachedFileSystemEntriesForBaseDir(path) { - return getCachedFileSystemEntries(ts.getDirectoryPath(path)); + var entries = getCachedFileSystemEntries(ts.getDirectoryPath(path)); + if (!entries) { + return entries; + } + // If we're looking for the base directory, we're definitely going to search the entries + if (!entries.sortedAndCanonicalizedFiles) { + entries.sortedAndCanonicalizedFiles = entries.files.map(getCanonicalFileName).sort(); + entries.sortedAndCanonicalizedDirectories = entries.directories.map(getCanonicalFileName).sort(); + } + return entries; } function getBaseNameOfFileName(fileName) { return ts.getBaseFileName(ts.normalizePath(fileName)); @@ -116659,21 +117722,10 @@ var ts; return undefined; } } - function fileNameEqual(name1, name2) { - return getCanonicalFileName(name1) === getCanonicalFileName(name2); - } function hasEntry(entries, name) { - return ts.some(entries, function (file) { return fileNameEqual(file, name); }); - } - function updateFileSystemEntry(entries, baseName, isValid) { - if (hasEntry(entries, baseName)) { - if (!isValid) { - return ts.filterMutate(entries, function (entry) { return !fileNameEqual(entry, baseName); }); - } - } - else if (isValid) { - return entries.push(baseName); - } + // Case-sensitive comparison since already canonicalized + var index = ts.binarySearch(entries, name, ts.identity, ts.compareStringsCaseSensitive); + return index >= 0; } function writeFile(fileName, data, writeByteOrderMark) { var path = toPath(fileName); @@ -116686,7 +117738,7 @@ var ts; function fileExists(fileName) { var path = toPath(fileName); var result = getCachedFileSystemEntriesForBaseDir(path); - return result && hasEntry(result.files, getBaseNameOfFileName(fileName)) || + return result && hasEntry(result.sortedAndCanonicalizedFiles, getCanonicalFileName(getBaseNameOfFileName(fileName))) || host.fileExists(fileName); } function directoryExists(dirPath) { @@ -116696,9 +117748,14 @@ var ts; function createDirectory(dirPath) { var path = toPath(dirPath); var result = getCachedFileSystemEntriesForBaseDir(path); - var baseFileName = getBaseNameOfFileName(dirPath); if (result) { - updateFileSystemEntry(result.directories, baseFileName, /*isValid*/ true); + var baseName = getBaseNameOfFileName(dirPath); + var canonicalizedBaseName = getCanonicalFileName(baseName); + var canonicalizedDirectories = result.sortedAndCanonicalizedDirectories; + // Case-sensitive comparison since already canonicalized + if (ts.insertSorted(canonicalizedDirectories, canonicalizedBaseName, ts.compareStringsCaseSensitive)) { + result.directories.push(baseName); + } } host.createDirectory(dirPath); } @@ -116767,7 +117824,7 @@ var ts; fileExists: host.fileExists(fileOrDirectoryPath), directoryExists: host.directoryExists(fileOrDirectoryPath) }; - if (fsQueryResult.directoryExists || hasEntry(parentResult.directories, baseName)) { + if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) { // Folder added or removed, clear the cache instead of updating the folder and its structure clearCache(); } @@ -116787,7 +117844,23 @@ var ts; } } function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists) { - updateFileSystemEntry(parentResult.files, baseName, fileExists); + var canonicalizedFiles = parentResult.sortedAndCanonicalizedFiles; + var canonicalizedBaseName = getCanonicalFileName(baseName); + if (fileExists) { + // Case-sensitive comparison since already canonicalized + if (ts.insertSorted(canonicalizedFiles, canonicalizedBaseName, ts.compareStringsCaseSensitive)) { + parentResult.files.push(baseName); + } + } + else { + // Case-sensitive comparison since already canonicalized + var sortedIndex = ts.binarySearch(canonicalizedFiles, canonicalizedBaseName, ts.identity, ts.compareStringsCaseSensitive); + if (sortedIndex >= 0) { + canonicalizedFiles.splice(sortedIndex, 1); + var unsortedIndex = parentResult.files.findIndex(function (entry) { return getCanonicalFileName(entry) === canonicalizedBaseName; }); + parentResult.files.splice(unsortedIndex, 1); + } + } } function clearCache() { cachedReadDirectoryResult.clear(); @@ -117547,7 +118620,6 @@ var ts; return resolutions; } ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache; - ; /** * Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly * provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file. @@ -117852,7 +118924,7 @@ var ts; state.failedLookupLocations = packageJsonLocations; state.affectingLocations = packageJsonLocations; var packageJsonScope = ts.getPackageScopeForPath(fileName, state); - var impliedNodeFormat = (packageJsonScope === null || packageJsonScope === void 0 ? void 0 : packageJsonScope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS; + var impliedNodeFormat = (packageJsonScope === null || packageJsonScope === void 0 ? void 0 : packageJsonScope.contents.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS; return { impliedNodeFormat: impliedNodeFormat, packageJsonLocations: packageJsonLocations, packageJsonScope: packageJsonScope }; } } @@ -119092,22 +120164,22 @@ var ts; // Return directly from the case if the given node doesnt want to visit each child // Otherwise break to visit each child switch (parent.kind) { - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: if (parent.questionToken === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?")); return "skip"; } // falls through - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 257 /* SyntaxKind.VariableDeclaration */: // type annotation if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_annotations_can_only_be_used_in_TypeScript_files)); @@ -119115,65 +120187,68 @@ var ts; } } switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "import type")); return "skip"; } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "export type")); return "skip"; } break; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, ts.isImportSpecifier(node) ? "import...type" : "export...type")); return "skip"; } break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_TypeScript_files)); return "skip"; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: var heritageClause = node; if (heritageClause.token === 117 /* SyntaxKind.ImplementsKeyword */) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: var interfaceKeyword = ts.tokenToString(118 /* SyntaxKind.InterfaceKeyword */); ts.Debug.assertIsDefined(interfaceKeyword); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, interfaceKeyword)); return "skip"; - case 261 /* SyntaxKind.ModuleDeclaration */: - var moduleKeyword = node.flags & 16 /* NodeFlags.Namespace */ ? ts.tokenToString(142 /* SyntaxKind.NamespaceKeyword */) : ts.tokenToString(141 /* SyntaxKind.ModuleKeyword */); + case 264 /* SyntaxKind.ModuleDeclaration */: + var moduleKeyword = node.flags & 16 /* NodeFlags.Namespace */ ? ts.tokenToString(143 /* SyntaxKind.NamespaceKeyword */) : ts.tokenToString(142 /* SyntaxKind.ModuleKeyword */); ts.Debug.assertIsDefined(moduleKeyword); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, moduleKeyword)); return "skip"; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files)); return "skip"; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: var enumKeyword = ts.Debug.checkDefined(ts.tokenToString(92 /* SyntaxKind.EnumKeyword */)); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, enumKeyword)); return "skip"; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Non_null_assertions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_assertion_expressions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files)); + return "skip"; + case 213 /* SyntaxKind.TypeAssertionExpression */: ts.Debug.fail(); // Won't parse these in a JS file anyway, as they are interpreted as JSX. } } @@ -119182,53 +120257,55 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning)); } switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: // Check type parameters if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files)); return "skip"; } // falls through - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // Check modifiers if (nodes === parent.modifiers) { - checkModifiers(parent.modifiers, parent.kind === 237 /* SyntaxKind.VariableStatement */); + checkModifiers(parent.modifiers, parent.kind === 240 /* SyntaxKind.VariableStatement */); return "skip"; } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // Check modifiers of property declaration if (nodes === parent.modifiers) { for (var _i = 0, _a = nodes; _i < _a.length; _i++) { var modifier = _a[_i]; - if (ts.isModifier(modifier) && modifier.kind !== 124 /* SyntaxKind.StaticKeyword */) { + if (ts.isModifier(modifier) + && modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ + && modifier.kind !== 127 /* SyntaxKind.AccessorKeyword */) { diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind))); } } return "skip"; } break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Check modifiers of parameter declaration if (nodes === parent.modifiers && ts.some(nodes, ts.isModifier)) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Parameter_modifiers_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // Check type arguments if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_arguments_can_only_be_used_in_TypeScript_files)); @@ -119250,18 +120327,19 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind))); break; // These are all legal modifiers. case 124 /* SyntaxKind.StaticKeyword */: case 93 /* SyntaxKind.ExportKeyword */: case 88 /* SyntaxKind.DefaultKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: } } } @@ -119583,7 +120661,7 @@ var ts; // It's a _little odd_ that we can't set `impliedNodeFormat` until the program step - but it's the first and only time we have a resolution cache // and a freshly made source file node on hand at the same time, and we need both to set the field. Persisting the resolution cache all the way // to the check and emit steps would be bad - so we much prefer detecting and storing the format information on the source file node upfront. - var result = getImpliedNodeFormatForFileWorker(toPath(fileName), moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options); + var result = getImpliedNodeFormatForFileWorker(ts.getNormalizedAbsolutePath(fileName, currentDirectory), moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options); var languageVersion = ts.getEmitScriptTarget(options); var setExternalModuleIndicator = ts.getSetExternalModuleIndicator(options); return typeof result === "object" ? __assign(__assign({}, result), { languageVersion: languageVersion, setExternalModuleIndicator: setExternalModuleIndicator }) : @@ -120186,10 +121264,12 @@ var ts; if (options.preserveConstEnums === false) { createDiagnosticForOptionName(ts.Diagnostics.Option_preserveConstEnums_cannot_be_disabled_when_isolatedModules_is_enabled, "preserveConstEnums", "isolatedModules"); } - var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !ts.isSourceFileJS(f) && !f.isDeclarationFile && f.scriptKind !== 6 /* ScriptKind.JSON */; }); - if (firstNonExternalModuleSourceFile) { - var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(firstNonExternalModuleSourceFile.fileName))); + for (var _a = 0, files_5 = files; _a < files_5.length; _a++) { + var file = files_5[_a]; + if (!ts.isExternalModule(file) && !ts.isSourceFileJS(file) && !file.isDeclarationFile && file.scriptKind !== 6 /* ScriptKind.JSON */) { + var span = ts.getErrorSpanForNode(file, file); + programDiagnostics.add(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(file.fileName))); + } } } else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 /* ScriptTarget.ES2015 */ && options.module === ts.ModuleKind.None) { @@ -123916,7 +124996,7 @@ var ts; }); // Sort by paths closest to importing file Name directory var sortedPaths = []; - var _loop_35 = function (directory) { + var _loop_36 = function (directory) { var directoryStart = ts.ensureTrailingDirectorySeparator(directory); var pathsInDirectory; allFileNames.forEach(function (_a, fileName) { @@ -123940,9 +125020,9 @@ var ts; }; var out_directory_1; for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) { - var state_11 = _loop_35(directory); + var state_12 = _loop_36(directory); directory = out_directory_1; - if (state_11 === "break") + if (state_12 === "break") break; } if (allFileNames.size) { @@ -124011,7 +125091,7 @@ var ts; } function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) { for (var key in paths) { - var _loop_36 = function (patternText_1) { + var _loop_37 = function (patternText_1) { var pattern = ts.normalizePath(patternText_1); var indexOfStar = pattern.indexOf("*"); // In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly, @@ -124078,9 +125158,9 @@ var ts; }; for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) { var patternText_1 = _a[_i]; - var state_12 = _loop_36(patternText_1); - if (typeof state_12 === "object") - return state_12.value; + var state_13 = _loop_37(patternText_1); + if (typeof state_13 === "object") + return state_13.value; } } function validateEnding(_a) { @@ -124244,7 +125324,7 @@ var ts; var maybeBlockedByTypesVersions = false; var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath); if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) { - var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath)); + var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath)); var importMode = overrideMode || importingSourceFile.impliedNodeFormat; if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) { var conditions = ["node", importMode === ts.ModuleKind.ESNext ? "import" : "require", "types"]; @@ -124606,7 +125686,7 @@ var ts; case ts.ModuleKind.CommonJS: if (file.packageJsonScope) { (result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages( - /*details*/ undefined, file.packageJsonScope.packageJsonContent.type ? + /*details*/ undefined, file.packageJsonScope.contents.packageJsonContent.type ? ts.Diagnostics.File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module : ts.Diagnostics.File_is_CommonJS_module_because_0_does_not_have_field_type, toFileName(ts.last(file.packageJsonLocations), fileNameConvertor))); } @@ -125025,18 +126105,14 @@ var ts; if (host.getBuildInfo) { // host provides buildinfo, get it from there. This allows host to cache it buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath); - if (!buildInfo) - return undefined; } else { var content = host.readFile(buildInfoPath); if (!content) return undefined; - buildInfo = ts.getBuildInfo(content); + buildInfo = ts.getBuildInfo(buildInfoPath, content); } - if (buildInfo.version !== ts.version) - return undefined; - if (!buildInfo.program) + if (!buildInfo || buildInfo.version !== ts.version || !buildInfo.program) return undefined; return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host); } @@ -125258,7 +126334,8 @@ var ts; } // All resolutions are invalid if user provided resolutions var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution); - if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + 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 (hasChangedConfigFileParsingErrors) { if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); @@ -125277,6 +126354,11 @@ var ts; if (host.afterProgramCreate && program !== builderProgram) { host.afterProgramCreate(builderProgram); } + compilerHost.readFile = originalReadFile; + compilerHost.fileExists = originalFileExists; + compilerHost.directoryExists = originalDirectoryExists; + compilerHost.createDirectory = originalCreateDirectory; + compilerHost.writeFile = originalWriteFile; return builderProgram; } function createNewProgram(hasInvalidatedResolution) { @@ -125754,19 +126836,20 @@ var ts; */ UpToDateStatusType[UpToDateStatusType["OutOfDateWithPrepend"] = 3] = "OutOfDateWithPrepend"; UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing"; - UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf"; - UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream"; - UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo"; - UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate"; - UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked"; - UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream"; - UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate"; - UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText"; + UpToDateStatusType[UpToDateStatusType["ErrorReadingFile"] = 5] = "ErrorReadingFile"; + UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 6] = "OutOfDateWithSelf"; + UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 7] = "OutOfDateWithUpstream"; + UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 8] = "OutOfDateBuildInfo"; + UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 9] = "UpstreamOutOfDate"; + UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 10] = "UpstreamBlocked"; + UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 11] = "ComputingUpstream"; + UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 12] = "TsVersionOutputOfDate"; + UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 13] = "UpToDateWithInputFileText"; /** * Projects with no outputs (i.e. "solution" files) */ - UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly"; - UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild"; + UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 14] = "ContainerOnly"; + UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 15] = "ForceBuild"; })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {})); function resolveConfigFileProjectName(project) { if (ts.fileExtensionIs(project, ".json" /* Extension.Json */)) { @@ -125984,6 +127067,7 @@ var ts; if (value) { return isParsedCommandLine(value) ? value : undefined; } + ts.performance.mark("SolutionBuilder::beforeConfigFileParsing"); var diagnostic; var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host; var parsed; @@ -125998,6 +127082,8 @@ var ts; parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop; } configFileCache.set(configFilePath, parsed || diagnostic); + ts.performance.mark("SolutionBuilder::afterConfigFileParsing"); + ts.performance.measure("SolutionBuilder::Config file parsing", "SolutionBuilder::beforeConfigFileParsing", "SolutionBuilder::afterConfigFileParsing"); return parsed; } function resolveProjectName(state, name) { @@ -126197,6 +127283,7 @@ var ts; if (updateOutputFileStampsPending) { updateOutputTimestamps(state, config, projectPath); } + ts.performance.mark("SolutionBuilder::Timestamps only updates"); return doneInvalidatedProject(state, projectPath); } }; @@ -126290,6 +127377,10 @@ var ts; }; function done(cancellationToken, writeFile, customTransformers) { executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers); + if (kind === InvalidatedProjectKind.Build) + ts.performance.mark("SolutionBuilder::Projects built"); + else + ts.performance.mark("SolutionBuilder::Bundles updated"); return doneInvalidatedProject(state, projectPath); } function withProgramOrUndefined(action) { @@ -126468,13 +127559,13 @@ var ts; var emitterDiagnostics = ts.createDiagnosticCollection(); var emittedOutputs = new ts.Map(); var resultFlags = BuildResultFlags.DeclarationOutputUnchanged; - var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo; + var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo || undefined; outputFiles.forEach(function (_a) { var _b, _c; var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo; emittedOutputs.set(toPath(state, name), name); if (buildInfo) { - if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { + if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo === null || existingBuildInfo === void 0 ? void 0 : existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged; } setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags); @@ -126767,8 +127858,7 @@ var ts; return existing.buildInfo || undefined; } var value = state.readFileWithCache(buildInfoPath); - var buildInfo = value ? ts.getBuildInfo(value) : undefined; - ts.Debug.assert(modifiedTime || !buildInfo); + var buildInfo = value ? ts.getBuildInfo(buildInfoPath, value) : undefined; state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime }); return buildInfo; } @@ -126853,7 +127943,14 @@ var ts; missingOutputFileName: buildInfoPath }; } - var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime)); + var buildInfo = getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime); + if (!buildInfo) { + // Error reading buildInfo + return { + type: ts.UpToDateStatusType.ErrorReadingFile, + fileName: buildInfoPath + }; + } if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) { return { type: ts.UpToDateStatusType.TsVersionOutputOfDate, @@ -127038,7 +128135,10 @@ var ts; if (prior !== undefined) { return prior; } + ts.performance.mark("SolutionBuilder::beforeUpToDateCheck"); var actual = getUpToDateStatusWorker(state, project, resolvedPath); + ts.performance.mark("SolutionBuilder::afterUpToDateCheck"); + ts.performance.measure("SolutionBuilder::Up-to-date check", "SolutionBuilder::beforeUpToDateCheck", "SolutionBuilder::afterUpToDateCheck"); state.projectStatus.set(resolvedPath, actual); return actual; } @@ -127176,6 +128276,13 @@ var ts; } } function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { + ts.performance.mark("SolutionBuilder::beforeBuild"); + var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences); + ts.performance.mark("SolutionBuilder::afterBuild"); + ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + return result; + } + function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { var buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ts.ExitStatus.InvalidProject_OutputsSkipped; @@ -127203,6 +128310,13 @@ var ts; : ts.ExitStatus.DiagnosticsPresent_OutputsSkipped; } function clean(state, project, onlyReferences) { + ts.performance.mark("SolutionBuilder::beforeClean"); + var result = cleanWorker(state, project, onlyReferences); + ts.performance.mark("SolutionBuilder::afterClean"); + ts.performance.measure("SolutionBuilder::Clean", "SolutionBuilder::beforeClean", "SolutionBuilder::afterClean"); + return result; + } + function cleanWorker(state, project, onlyReferences) { var buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ts.ExitStatus.InvalidProject_OutputsSkipped; @@ -127276,6 +128390,14 @@ var ts; state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected); } function buildNextInvalidatedProject(state, changeDetected) { + ts.performance.mark("SolutionBuilder::beforeBuild"); + var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected); + ts.performance.mark("SolutionBuilder::afterBuild"); + ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + if (buildOrder) + reportErrorSummary(state, buildOrder); + } + function buildNextInvalidatedProjectWorker(state, changeDetected) { state.timerToBuildInvalidatedProject = undefined; if (state.reportFileChangeDetected) { state.reportFileChangeDetected = false; @@ -127308,7 +128430,7 @@ var ts; } } disableCache(state); - reportErrorSummary(state, buildOrder); + return buildOrder; } function watchConfigFile(state, resolved, resolvedPath, parsed) { if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath)) @@ -127363,6 +128485,7 @@ var ts; function startWatching(state, buildOrder) { if (!state.watchAllProjectsPending) return; + ts.performance.mark("SolutionBuilder::beforeWatcherCreation"); state.watchAllProjectsPending = false; for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) { var resolved = _a[_i]; @@ -127380,6 +128503,8 @@ var ts; watchPackageJsonFiles(state, resolved, resolvedPath, cfg); } } + ts.performance.mark("SolutionBuilder::afterWatcherCreation"); + ts.performance.measure("SolutionBuilder::Watcher creation", "SolutionBuilder::beforeWatcherCreation", "SolutionBuilder::afterWatcherCreation"); } function stopWatching(state) { ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher); @@ -127493,6 +128618,8 @@ var ts; return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_1_is_older_than_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerProjectName)); case ts.UpToDateStatusType.OutputMissing: return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relName(state, configFileName), relName(state, status.missingOutputFileName)); + case ts.UpToDateStatusType.ErrorReadingFile: + return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_there_was_error_reading_file_1, relName(state, configFileName), relName(state, status.fileName)); case ts.UpToDateStatusType.OutOfDateBuildInfo: return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted, relName(state, configFileName), relName(state, status.buildInfoFile)); case ts.UpToDateStatusType.UpToDate: diff --git a/lib/zh-cn/diagnosticMessages.generated.json b/lib/zh-cn/diagnosticMessages.generated.json index bc09e0e369a..5764216af59 100644 --- a/lib/zh-cn/diagnosticMessages.generated.json +++ b/lib/zh-cn/diagnosticMessages.generated.json @@ -3,8 +3,8 @@ "A_0_modifier_cannot_be_used_with_an_import_declaration_1079": "“{0}”修饰符不能与导入声明一起使用。", "A_0_parameter_must_be_the_first_parameter_2680": "“{0}”参数必须是第一个参数。", "A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags_8033": "JSDoc \"@typedef\" 注释不能包含多个 \"@type\" 标记。", - "A_bigint_literal_cannot_use_exponential_notation_1352": "bigint 文本不能使用指数符号。", - "A_bigint_literal_must_be_an_integer_1353": "bigint 文本必须是整数。", + "A_bigint_literal_cannot_use_exponential_notation_1352": "BigInt 字面量中不能使用指数符号。", + "A_bigint_literal_must_be_an_integer_1353": "BigInt 字面量必须是整数。", "A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature_2463": "绑定模式参数在实现签名中不能为可选参数。", "A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement_1105": "\"break\" 语句只能在封闭迭代或 switch 语句内使用。", "A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement_1116": "\"break\" 语句只能跳转到封闭语句的标签。", @@ -20,7 +20,7 @@ "A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_t_1165": "环境上下文中的计算属性名称必须引用类型为文本类型或 \"unique symbol\" 类型的表达式。", "A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_1169": "接口中的计算属性名称必须引用必须引用类型为文本类型或 \"unique symbol\" 的表达式。", "A_computed_property_name_must_be_of_type_string_number_symbol_or_any_2464": "计算属性名的类型必须为 \"string\"、\"number\"、\"symbol\" 或 \"any\"。", - "A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array__1355": "\"const\" 断言只能用于引用枚举成员、字符串、数字、布尔值、数组或对象文本。", + "A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array__1355": "'const' 断言只能作用于枚举成员、字符串、数字、布尔值、数组或对象字面量。", "A_const_enum_member_can_only_be_accessed_using_a_string_literal_2476": "只有使用字符串文本才能访问常数枚举成员。", "A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_refere_1254": "环境上下文中的 \"const\" 初始化表达式必须为字符串、数字文本或文本枚举引用。", "A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005": "当构造函数的类扩展 \"null\" 时,它不能包含 \"super\" 调用。", @@ -38,7 +38,7 @@ "A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES20_2711": "动态导入调用返回 “Promise”。请确保具有对 “Promise” 的声明或在 “--lib” 选项中包含了 “ES2015”。", "A_file_cannot_have_a_reference_to_itself_1006": "文件不能引用自身。", "A_function_returning_never_cannot_have_a_reachable_end_point_2534": "返回“从不”的函数不能具有可访问的终结点。", - "A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void_2679": "使用 \"new\" 关键字调用的函数不可具有“失效”的 \"this\" 类型。", + "A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void_2679": "使用 'new' 关键字调用的函数的 'this' 类型不能为 'void'。", "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355": "其声明类型不为 \"void\" 或 \"any\" 的函数必须返回值。", "A_generator_cannot_have_a_void_type_annotation_2505": "生成器不能具有 \"void\" 类型批注。", "A_get_accessor_cannot_have_parameters_1054": "\"get\" 访问器不能具有参数。", @@ -57,13 +57,13 @@ "A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module_1235": "命名空间声明只允许位于命名空间或模块的顶层。", "A_non_dry_build_would_build_project_0_6357": "非 -dry 生成将生成项目“{0}”", "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "非 -dry 生成将删除以下文件: {0}", - "A_non_dry_build_would_update_output_of_project_0_6375": "非干燥生成将更新项目 \"{0}\" 的输出", - "A_non_dry_build_would_update_timestamps_for_output_of_project_0_6374": "非干燥生成将更新项目 \"{0}\" 的输出的时间戳", + "A_non_dry_build_would_update_output_of_project_0_6375": "非 dry 生成将更新项目 '{0}' 的输出", + "A_non_dry_build_would_update_timestamps_for_output_of_project_0_6374": "非 dry 生成将更新项目 '{0}' 的输出的时间戳", "A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371": "只允许在函数或构造函数实现中使用参数初始化表达式。", "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317": "不能使用 rest 参数声明参数属性。", "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369": "只允许在构造函数实现中使用参数属性。", "A_parameter_property_may_not_be_declared_using_a_binding_pattern_1187": "不能使用绑定模式声明参数属性。", - "A_promise_must_have_a_then_method_1059": "承诺必须具有 \"then\" 方法。", + "A_promise_must_have_a_then_method_1059": "'Promise' 必须具有 'then' 方法。", "A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly_1331": "类型为 \"unique symbol\" 的类的属性必须同时为 \"static\" 和 \"readonly\"。", "A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly_1330": "类型为 \"unique symbol\" 的接口或类型文本的属性必须为 \"readonly\"。", "A_required_element_cannot_follow_an_optional_element_1257": "必选元素不能位于可选元素后。", @@ -116,13 +116,13 @@ "Add_all_missing_async_modifiers_95041": "添加所有缺失的 \"async\" 修饰符", "Add_all_missing_attributes_95168": "添加所有缺少的属性", "Add_all_missing_call_parentheses_95068": "添加所有缺失的调用括号", - "Add_all_missing_function_declarations_95157": "添加缺少的所有函数声明", + "Add_all_missing_function_declarations_95157": "添加所有缺少的函数声明", "Add_all_missing_imports_95064": "添加所有缺少的导入", "Add_all_missing_members_95022": "添加所有缺少的成员", "Add_all_missing_override_modifiers_95162": "添加所有缺失的 \"override\" 修饰符", "Add_all_missing_properties_95166": "添加所有缺少的属性", "Add_all_missing_return_statement_95114": "添加所有缺少的 return 语句", - "Add_all_missing_super_calls_95039": "添加所有缺失的超级调用", + "Add_all_missing_super_calls_95039": "添加所有缺失的 super() 调用", "Add_async_modifier_to_containing_function_90029": "将异步修饰符添加到包含函数", "Add_await_95083": "添加 \"await\"", "Add_await_to_initializer_for_0_95084": "将 \"await\" 添加到 \"{0}\" 的初始值设定项", @@ -158,18 +158,18 @@ "Add_undefined_to_a_type_when_accessed_using_an_index_6674": "使用索引访问时,将 “undefined” 添加到类型。", "Add_undefined_to_optional_property_type_95169": "将 “undefined” 添加到可选属性类型", "Add_undefined_type_to_all_uninitialized_properties_95029": "将未定义的类型添加到未初始化的所有属性", - "Add_undefined_type_to_property_0_95018": "向属性“{0}”添加“未定义”类型", + "Add_undefined_type_to_property_0_95018": "向属性“{0}”添加 \"undefined\" 类型", "Add_unknown_conversion_for_non_overlapping_types_95069": "为非重叠类型添加 \"unknown\" 转换", "Add_unknown_to_all_conversions_of_non_overlapping_types_95070": "将 \"unknown\" 添加到非重叠类型的所有转换", - "Add_void_to_Promise_resolved_without_a_value_95143": "将 \"void\" 添加到已解析但没有值的承诺", - "Add_void_to_all_Promises_resolved_without_a_value_95144": "将 \"void\" 添加到所有已解析但没有值的承诺", + "Add_void_to_Promise_resolved_without_a_value_95143": "将 \"void\" 添加到已解析但没有值的 Promise", + "Add_void_to_all_Promises_resolved_without_a_value_95144": "将 \"void\" 添加到所有已解析但没有值的 Promise", "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "添加 tsconfig.json 文件有助于组织包含 TypeScript 和 JavaScript 文件的项目。有关详细信息,请访问 https://aka.ms/tsconfig。", "All_declarations_of_0_must_have_identical_constraints_2838": "\"{0}\" 的所有声明必须具有相同的限制。", "All_declarations_of_0_must_have_identical_modifiers_2687": "“{0}”的所有声明必须具有相同的修饰符。", "All_declarations_of_0_must_have_identical_type_parameters_2428": "“{0}”的所有声明都必须具有相同的类型参数。", "All_declarations_of_an_abstract_method_must_be_consecutive_2516": "抽象方法的所有声明必须是连续的。", - "All_destructured_elements_are_unused_6198": "未取消使用任何解构元素。", - "All_imports_in_import_declaration_are_unused_6192": "未使用导入声明中的所有导入。", + "All_destructured_elements_are_unused_6198": "所有解构出的成员都未使用。", + "All_imports_in_import_declaration_are_unused_6192": "导入声明中的所有导入都未使用。", "All_type_parameters_are_unused_6205": "未使用任何类型参数。", "All_variables_are_unused_6199": "所有变量均未使用。", "Allow_JavaScript_files_to_be_a_part_of_your_program_Use_the_checkJS_option_to_get_errors_from_these__6600": "允许 JavaScript 文件成为程序的一部分。使用 “checkJS” 选项从这些文件中获取错误。", @@ -186,6 +186,7 @@ "An_abstract_accessor_cannot_have_an_implementation_1318": "抽象访问器不能有实现。", "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "可访问性修饰符不能与专用标识符一起使用。", "An_accessor_cannot_have_type_parameters_1094": "访问器不能具有类型参数。", + "An_accessor_property_cannot_be_declared_optional_1276": "\"accessor\" 属性不能声明为可选。", "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "只允许在文件的顶层中使用环境模块声明。", "An_argument_for_0_was_not_provided_6210": "未提供 \"{0}\" 的自变量。", "An_argument_matching_this_binding_pattern_was_not_provided_6211": "未提供与此绑定模式匹配的自变量。", @@ -208,7 +209,7 @@ "An_export_declaration_cannot_have_modifiers_1193": "导出声明不能有修饰符。", "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345": "无法测试 \"void\" 类型的表达式的真实性。", "An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive_1198": "扩展的 Unicode 转义值必须介于(含) 0x0 和 0x10FFFF 之间。", - "An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal_1351": "标识符或关键字不能紧跟在数字文本之后。", + "An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal_1351": "标识符或关键字不能紧跟在数字字面量之后。", "An_implementation_cannot_be_declared_in_ambient_contexts_1183": "不能在环境上下文中声明实现。", "An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type_1379": "导入别名不能引用使用 \"export type\" 导出的声明。", "An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type_1380": "导入别名不能引用使用 \"import type\" 导入的声明。", @@ -260,14 +261,14 @@ "Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_2669": "全局范围的扩大仅可直接嵌套在外部模块中或环境模块声明中。", "Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambien_2670": "全局范围的扩大应具有 \"declare\" 修饰符,除非它们显示在已有的环境上下文中。", "Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using__6140": "项目“{0}”中启用了键入内容的自动发现。使用缓存位置“{2}”运行模块“{1}”的额外解决传递。", - "Await_expression_cannot_be_used_inside_a_class_static_block_18037": "无法在类静态块内使用 Await 表达式。", + "Await_expression_cannot_be_used_inside_a_class_static_block_18037": "无法在类静态块内使用 await 表达式。", "BUILD_OPTIONS_6919": "生成选项", - "Backwards_Compatibility_6253": "后向兼容性", + "Backwards_Compatibility_6253": "向后兼容性", "Base_class_expressions_cannot_reference_class_type_parameters_2562": "基类表达式无法引用类类型参数。", "Base_constructor_return_type_0_is_not_an_object_type_or_intersection_of_object_types_with_statically_2509": "基构造函数返回类型 \"{0}\" 不是具有静态已知成员的对象类型或对象类型的交集。", "Base_constructors_must_all_have_the_same_return_type_2510": "所有的基构造函数必须具有相同的返回类型。", "Base_directory_to_resolve_non_absolute_module_names_6083": "用于解析非绝对模块名的基目录。", - "BigInt_literals_are_not_available_when_targeting_lower_than_ES2020_2737": "目标低于 ES2020 时,bigInt 文本不可用。", + "BigInt_literals_are_not_available_when_targeting_lower_than_ES2020_2737": "目标低于 ES2020 时,BigInt 字面量不可用。", "Binary_digit_expected_1177": "需要二进制数字。", "Binding_element_0_implicitly_has_an_1_type_7031": "绑定元素“{0}”隐式具有“{1}”类型。", "Block_scoped_variable_0_used_before_its_declaration_2448": "声明之前已使用的块范围变量“{0}”。", @@ -296,11 +297,11 @@ "Cannot_assign_to_0_because_it_is_a_constant_2588": "无法分配到 \"{0}\" ,因为它是常数。", "Cannot_assign_to_0_because_it_is_a_function_2630": "无法为“{0}”赋值,因为它是函数。", "Cannot_assign_to_0_because_it_is_a_namespace_2631": "无法为“{0}”赋值,因为它是命名空间。", - "Cannot_assign_to_0_because_it_is_a_read_only_property_2540": "无法分配到 \"{0}\" ,因为它是只读属性。", + "Cannot_assign_to_0_because_it_is_a_read_only_property_2540": "无法为“{0}”赋值,因为它是只读属性。", "Cannot_assign_to_0_because_it_is_an_enum_2628": "无法为“{0}”赋值,因为它是枚举。", "Cannot_assign_to_0_because_it_is_an_import_2632": "无法为“{0}”赋值,因为它是导入。", - "Cannot_assign_to_0_because_it_is_not_a_variable_2539": "无法分配到“{0}”,因为它不是变量。", - "Cannot_assign_to_private_method_0_Private_methods_are_not_writable_2803": "无法分配给专用方法 \"{0}\"。专用方法不可写。", + "Cannot_assign_to_0_because_it_is_not_a_variable_2539": "无法为“{0}”赋值,因为它不是变量。", + "Cannot_assign_to_private_method_0_Private_methods_are_not_writable_2803": "无法赋值给私有方法“{0}”。私有方法不可写。", "Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity_2671": "无法扩大模块“{0}”,因为它解析为非模块实体。", "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649": "无法扩充具有值导出的模块“{0}”,因为它解析为一个非模块的实体。", "Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131": "无法使用选项“{0}”来编译模块,除非 \"--module\" 标记为 \"amd\" 或 \"system\"。", @@ -308,7 +309,7 @@ "Cannot_delegate_iteration_to_value_because_the_next_method_of_its_iterator_expects_type_1_but_the_co_2766": "无法将迭代委托到值,因为其迭代器的 \"next\" 方法需要类型 \"{1}\",但包含它的生成器将始终发送 \"{0}\"。", "Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module_2661": "无法导出“{0}”。仅可从模块中导出本地声明。", "Cannot_extend_a_class_0_Class_constructor_is_marked_as_private_2675": "无法扩展类“{0}”。类构造函数标记为私有。", - "Cannot_extend_an_interface_0_Did_you_mean_implements_2689": "无法扩展接口‘{0}’。您的意思是‘实施’吗?", + "Cannot_extend_an_interface_0_Did_you_mean_implements_2689": "无法扩展接口“{0}”。您是否想使用 \"implements\"?", "Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0_5081": "无法在当前目录找到 tsconfig.json 文件: {0}。", "Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057": "无法在指定目录找到 tsconfig.json 文件:“{0}”。", "Cannot_find_global_type_0_2318": "找不到全局类型“{0}”。", @@ -329,8 +330,8 @@ "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_type_2593": "找不到名称“{0}”。是否需要安装测试运行器的类型定义? 请尝试使用 `npm i --save-dev @types/jest` 或 `npm i --save-dev @types/mocha`,然后将 “jest” 或 “mocha” 添加到 tsconfig 中的类型字段。。", "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slash_2581": "找不到名称 \"{0}\"。是否需要安装 jQuery 的类型定义? 请尝试使用 `npm i --save-dev @types/jquery`。", "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slash_2592": "找不到名称“{0}”。是否需要安装 jQuery 的类型定义? 请尝试使用 `npm i --save-dev @types/jquery`,然后将 “jquery” 添加到 teconfig 中的类型字段。", - "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashno_2580": "找不到名称 \"{0}\"。是否需要为节点安装类型定义? 请尝试使用 `npm i --save-dev @types/node`。", - "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashno_2591": "找不到名称“{0}”。是否需要为节点安装类型定义? 请尝试使用 `npm i --save-dev @types/node`,然后将 “node” 添加到类型字段。", + "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashno_2580": "找不到名称“{0}”。是否需要安装 Node.js 的类型定义? 请尝试运行 `npm i --save-dev @types/node`。", + "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashno_2591": "找不到名称“{0}”。是否需要安装 Node.js 的类型定义? 请尝试运行 `npm i --save-dev @types/node`,然后将 \"node\" 添加到 tsconfig 的 types 字段。", "Cannot_find_namespace_0_2503": "找不到命名空间“{0}”。", "Cannot_find_namespace_0_Did_you_mean_1_2833": "找不到命名空间“{0}”。你是否指的是“{1}”?", "Cannot_find_parameter_0_1225": "找不到参数“{0}”。", @@ -365,8 +366,8 @@ "Catch_clause_variable_type_annotation_must_be_any_or_unknown_if_specified_1196": "Catch 子句变量类型注释必须为 \"any\" 或 \"unknown\" (若已指定)。", "Change_0_to_1_90014": "将“{0}”更改为“{1}”", "Change_all_extended_interfaces_to_implements_95038": "将所有扩展接口都更改为 \"implements\"", - "Change_all_jsdoc_style_types_to_TypeScript_95030": "将所有 jsdoc 样式类型都更改为 TypeScript", - "Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types_95031": "将所有 jsdoc 样式类型都更改为 TypeScript (并将 \"| undefined\" 添加到可以为 null 的类型)", + "Change_all_jsdoc_style_types_to_TypeScript_95030": "将所有 JSDoc 样式类型都更改为 TypeScript", + "Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types_95031": "将所有 JSDoc 样式类型都更改为 TypeScript (并将 \"| undefined\" 添加到可以为 null 的类型)", "Change_extends_to_implements_90003": "将 \"extends\" 改为 \"implements\"", "Change_spelling_to_0_90022": "将拼写更改为“{0}”", "Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor_6700": "检查是否有已声明但未在构造函数中设置的类属性。", @@ -382,7 +383,7 @@ "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720": "类“{0}”错误实现类“{1}”。你是想扩展“{1}”并将其成员作为子类继承吗?", "Class_0_incorrectly_implements_interface_1_2420": "类“{0}”错误实现接口“{1}”。", "Class_0_used_before_its_declaration_2449": "类“{0}”用于其声明前。", - "Class_constructor_may_not_be_a_generator_1360": "类构造函数可能不是生成器。", + "Class_constructor_may_not_be_a_generator_1368": "类构造函数可能不是生成器。", "Class_constructor_may_not_be_an_accessor_1341": "类构造函数可能不是访问器。", "Class_declaration_cannot_implement_overload_list_for_0_2813": "类声明无法实现“{0}”的重载列表。", "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025": "类声明不能有多个 “@augments” 或 “@extends” 标记。", @@ -430,13 +431,14 @@ "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "类型 \"{0}\" 到类型 \"{1}\" 的转换可能是错误的,因为两种类型不能充分重叠。如果这是有意的,请先将表达式转换为 \"unknown\"。", "Convert_0_to_1_in_0_95003": "将“{0}”转换为 {0} 中的 {1}", "Convert_0_to_mapped_object_type_95055": "将“{0}”转换为映射对象类型", + "Convert_all_const_to_let_95102": "将所有 'const' 转换为 'let'", "Convert_all_constructor_functions_to_classes_95045": "将所有构造函数都转换为类", "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "将不用作值的所有导入转换为仅类型导入", "Convert_all_invalid_characters_to_HTML_entity_code_95101": "将所有无效字符转换为 HTML 实体代码", "Convert_all_re_exported_types_to_type_only_exports_1365": "将所有重新导出的类型转换为仅类型导出", "Convert_all_require_to_import_95048": "将所有 \"require\" 转换为 \"import\"", "Convert_all_to_async_functions_95066": "全部转换为异步函数", - "Convert_all_to_bigint_numeric_literals_95092": "全部转换为 bigint 数字文本", + "Convert_all_to_bigint_numeric_literals_95092": "全部转换为 BigInt 数字字面量", "Convert_all_to_default_imports_95035": "全部转换为默认导入", "Convert_all_type_literals_to_mapped_type_95021": "将所有类型文本转换为映射类型", "Convert_arrow_function_or_function_expression_95122": "转换箭头函数或函数表达式", @@ -454,7 +456,7 @@ "Convert_parameters_to_destructured_object_95075": "将参数转换为析构对象", "Convert_require_to_import_95047": "将 \"require\" 转换为 \"import\"", "Convert_to_ES_module_95017": "转换为 ES 模块", - "Convert_to_a_bigint_numeric_literal_95091": "转换为 bigint 数字文本", + "Convert_to_a_bigint_numeric_literal_95091": "转换为 BigInt 数字字面量", "Convert_to_anonymous_function_95123": "转换为异步函数", "Convert_to_arrow_function_95125": "转换为箭头函数", "Convert_to_async_function_95065": "转换为异步函数", @@ -729,7 +731,7 @@ "Fix_all_expressions_possibly_missing_await_95085": "修复可能缺少 \"await\" 的所有表达式", "Fix_all_implicit_this_errors_95107": "修复所有 implicit-'this' 错误", "Fix_all_incorrect_return_type_of_an_async_functions_90037": "修复所有错误的异步函数返回类型", - "For_await_loops_cannot_be_used_inside_a_class_static_block_18038": "无法在类静态块内使用 “For await 循环。", + "For_await_loops_cannot_be_used_inside_a_class_static_block_18038": "无法在类静态块内使用 for...await 循环。", "Found_0_errors_6217": "找到 {0} 个错误。", "Found_0_errors_Watching_for_file_changes_6194": "找到 {0} 个错误。注意文件更改。", "Found_0_errors_in_1_files_6261": "在 {1} 个文件中找到 {0} 个错误。", @@ -919,7 +921,7 @@ "Method_not_implemented_95158": "方法未实现。", "Modifiers_cannot_appear_here_1184": "修饰符不能出现在此处。", "Module_0_can_only_be_default_imported_using_the_1_flag_1259": "模块 \"{0}\" 只能在使用 \"{1}\" 标志时进行默认导入", - "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "无法使用此构造导入模块 '{0}'。说明符仅解析为无法同步导入的 ES 模块。请改用动态导入。", + "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "无法使用此构造导入模块“{0}”。说明符仅解析为 ES 模块,后者不能使用“require”进行导入。请改用 ECMAScript 导入。", "Module_0_declares_1_locally_but_it_is_exported_as_2_2460": "模块 \"{0}\" 在本地声明 \"{1}\",但它被导出为 \"{2}\"。", "Module_0_declares_1_locally_but_it_is_not_exported_2459": "模块 \"{0}\" 在本地声明 \"{1}\",但未导出它。", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340": "模块 \"{0}\" 不引用类型,但在此处用作类型。你是想使用 \"typeof import('{0}')\" 吗?", @@ -978,9 +980,9 @@ "Object_is_possibly_null_2531": "对象可能为 \"null\"。", "Object_is_possibly_null_or_undefined_2533": "对象可能为 \"null\" 或“未定义”。", "Object_is_possibly_undefined_2532": "对象可能为“未定义”。", - "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353": "对象文字可以只指定已知属性,并且“{0}”不在类型“{1}”中。", - "Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_writ_2561": "对象文字只能指定已知的属性,但“{0}”中不存在类型“{1}”。是否要写入 {2}?", - "Object_literal_s_property_0_implicitly_has_an_1_type_7018": "对象文字的属性“{0}”隐式含有“{1}”类型。", + "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353": "对象字面量只能指定已知属性,并且“{0}”不在类型“{1}”中。", + "Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_writ_2561": "对象字面量只能指定已知的属性,但“{0}”中不存在类型“{1}”。是否要写入 {2}?", + "Object_literal_s_property_0_implicitly_has_an_1_type_7018": "对象字面量的属性“{0}”隐式含有“{1}”类型。", "Octal_digit_expected_1178": "需要八进制数字。", "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017": "八进制文本类型必须使用 ES2015 语法。请使用语法“{0}”。", "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018": "枚举成员初始值设定项中不允许有八进制文本。请使用语法“{0}”。", @@ -1103,6 +1105,7 @@ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "项目“{0}”已过期,因为输出文件“{1}”不存在", "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "项目 \"{0}\" 已过期,因为其输出是使用与当前版本 \"{2}\" 不同的版本 \"{1}\" 生成的", "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "项目 \"{0}\" 已过期,因为其依赖项 \"{1}\" 的输出已更改", + "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401": "项目“{0}”已过期,因为读取文件“{1}”时出错", "Project_0_is_up_to_date_6361": "“{0}”项目已是最新", "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "项目“{0}”是最新的,因为最新的输入“{1}”早于输出“{2}”", "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "项目“{0}”是最新的,但需要更新早于输入文件的输出文件的时间戳", @@ -1110,6 +1113,7 @@ "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "项目引用不能形成环形图。检测到循环: {0}", "Projects_6255": "项目", "Projects_in_this_build_Colon_0_6355": "此生成中的项目: {0}", + "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "只有在面向 ECMAScript 2015 及更高版本时,才可使用带有 \"accessor\" 修饰符的属性。", "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "属性“{0}”不能具有初始化表杰式,因为它标记为摘要。", "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "属性“{0}”来自索引签名,因此必须使用[“{0}”]访问它。", "Property_0_does_not_exist_on_type_1_2339": "类型“{1}”上不存在属性“{0}”。", @@ -1151,7 +1155,7 @@ "Property_assignment_expected_1136": "应为属性分配。", "Property_destructuring_pattern_expected_1180": "应为属性析构模式。", "Property_or_signature_expected_1131": "应为属性或签名。", - "Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_li_1328": "属性值只能是字符串文本、数字文本、\"true\"、\"false\"、\"null\"、对象文字或数组文本。", + "Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_li_1328": "属性值只能是字符串、数字、\"true\"、\"false\"、\"null\"、对象或数组等类型的字面量。", "Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3_6179": "以 \"ES5\" 或 \"ES3\" 设为目标时,对 \"for-of\"、传播和析构中的可迭代项提供完全支持。", "Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4098": "导出类的公共方法“{0}”具有或正在使用外部模块“{2}”中的名称“{1}”,但不能为其命名。", "Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4099": "导出类的公共方法“{0}”具有或正在使用私有模块“{2}”中的名称“{1}”。", @@ -1350,8 +1354,8 @@ "Statements_are_not_allowed_in_ambient_contexts_1036": "不允许在环境上下文中使用语句。", "Static_members_cannot_reference_class_type_parameters_2302": "静态成员不能引用类类型参数。", "Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1_2699": "静态属性“{0}”与构造函数“{1}”的内置属性函数“{0}”冲突。", - "String_literal_expected_1141": "应为字符串文本。", - "String_literal_with_double_quotes_expected_1327": "应为带双引号的字符串文字。", + "String_literal_expected_1141": "应为字符串字面量。", + "String_literal_with_double_quotes_expected_1327": "应为带双引号的字符串字面量。", "Stylize_errors_and_messages_using_color_and_context_experimental_6073": "使用颜色和上下文风格化错误和消息(实验)。", "Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_t_2717": "后续属性声明必须属于同一类型。属性“{0}”的类型必须为“{1}”,但此处却为类型“{2}”。", "Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_t_2403": "后续变量声明必须属于同一类型。变量“{0}”必须属于类型“{1}”,但此处却为类型“{2}”。", @@ -1361,7 +1365,7 @@ "Substitutions_for_pattern_0_shouldn_t_be_an_empty_array_5066": "模式“{0}”的替换模式不应为空数组。", "Successfully_created_a_tsconfig_json_file_6071": "已成功创建 tsconfig.json 文件。", "Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors_2337": "不允许在构造函数外部或在构造函数内的嵌套函数中进行 Super 调用。", - "Suppress_excess_property_checks_for_object_literals_6072": "取消对象文字的多余属性检查。", + "Suppress_excess_property_checks_for_object_literals_6072": "取消对对象字面量的多余属性检查。", "Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures_6055": "抑制缺少索引签名的索引对象的 noImplicitAny 错误。", "Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures_6703": "在对缺少索引签名的对象编制索引时,抑制 “noImplicitAny” 错误。", "Switch_each_misused_0_to_1_95138": "将每个误用的“{0}”切换到“{1}”", @@ -1385,6 +1389,7 @@ "The_containing_arrow_function_captures_the_global_value_of_this_7041": "包含箭头函数捕获 \"this\" 的全局值。", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "包含函数或模块体对于控制流分析而言太大。", "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "当前文件是 CommonJS 模块,因此不能在顶级使用 “await”。", + "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479": "当前文件是 CommonJS 模块,其导入将生成“require”调用;但是,引用的文件是 ECMAScript 模块,它不能使用“require”进行导入。请考虑改为编写动态“import(\"{0}\")”调用。", "The_current_host_does_not_support_the_0_option_5001": "当前主机不支持“{0}”选项。", "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "你可能打算使用的 \"{0}\" 的声明在此处定义", "The_declaration_was_marked_as_deprecated_here_2798": "该声明曾在此处标记为已弃用。", @@ -1464,13 +1469,14 @@ "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490": "迭代器的 \"{0}()\" 方法返回的类型必须具有 \"value\" 属性。", "The_types_of_0_are_incompatible_between_these_types_2200": "在这些类型中,\"{0}\" 的类型不兼容。", "The_types_returned_by_0_are_incompatible_between_these_types_2201": "在这些类型中,\"{0}\" 返回的类型不兼容。", + "The_value_0_cannot_be_used_here_18050": "此处不能使用值“{0}”。", "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "\"for...in\" 语句的变量声明不能有初始化表达式。", "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "\"for...of\" 语句的变量声明不能有初始化表达式。", "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "不支持 \"with\" 语句。\"with\" 程序块中的所有符号都将具有类型 \"any\"。", "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_since_JavaScript_compares_objects_by_reference_not_value_2839": "此条件将始终返回“{0}”,因为 JavaScript 按引用而不是值比较对象。", - "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367": "此条件将始终返回 \"{0}\",因为类型 \"{1}\" 和 \"{2}\" 没有重叠。", "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,因为始终定义了函数。你是想改为调用它吗?", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "此构造函数可能会转换为类声明。", @@ -1491,7 +1497,7 @@ "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114": "此成员必须有 \"override\" 修饰符,因为它替代基类 \"{0}\" 中的一个成员。", "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "此成员必须有 \"override\" 修饰符,因为它替代基类 \"{0}\" 中声明的一个抽象方法。", "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "只能通过启用 \"{0}\" 标志并引用其默认导出,使用 ECMAScript 导入/导出来引用此模块。", - "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594": "此模块是使用 \"export =\" 声明的,只能在使用 \"{0}\" 标志时进行默认导入。", + "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "此模块是使用 “export =” 声明的,只能在使用“{0}”标志时用于默认导入。", "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "此重载签名与其实现签名不兼容。", "This_parameter_is_not_allowed_with_use_strict_directive_1346": "此参数不允许与 \"use strict\" 指令一起使用。", "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120": "此参数属性必须具有带 “@override” 标记的 JSDoc 注释,因为它将替代基类“{0}”中的成员。", @@ -1504,6 +1510,10 @@ "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "此语法需要一个名为 \"{1}\" 且包含 {2} 参数的导入帮助程序,该帮助程序与 \"{0}\" 中的相应帮助程序不兼容。请考虑升级 \"{0}\" 的版本。", "This_type_parameter_might_need_an_extends_0_constraint_2208": "此类型参数可能需要 `extends {0}` 约束。", "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "“import” 的这种用法无效。可以写入 “import()” 调用,但它们必须具有括号,并且不能带有类型参数。", + "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482": "若要将此文件转换为 ECMAScript 模块,请将字段“\"type\": \"module\"”添加到“{0}”。", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481": "若要将此文件转换为 ECMAScript 模块,请将其文件扩展名更改为“{0}”,或将字段“\"type\": \"module\"”添加到“{1}”。", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480": "若要将此文件转换为 ECMAScript 模块,请将其文件扩展名更改为“{0}”,或者使用“{ \"type\": \"module\" }”创建本地 package.json 文件。", + "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483": "若要将此文件转换为 ECMAScript 模块,请使用“{ \"type\": \"module\" }”创建本地 package.json 文件。", "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "仅当 “module” 选项设置为 “es2022”、“esnext”、“system”、“node16” 或 “nodenext”,且 “target” 选项设置为 “es2017” 或更高版本时,才允许使用顶级 “await” 表达式。", "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": ".d.ts 文件中的顶级声明必须以 \"declare\" 或 \"export\" 修饰符开头。", "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "仅当 “module” 选项设置为 “es2022”、“esnext”、“system”、“node16” 或 “nodenext”,且 “target” 选项设置为 “es2017” 或更高版本时,才允许使用顶级 “for await” 循环。", @@ -1519,6 +1529,7 @@ "Type_0_cannot_be_used_as_an_index_type_2538": "类型“{0}”不能作为索引类型使用。", "Type_0_cannot_be_used_to_index_type_1_2536": "类型“{0}”无法用于索引类型“{1}”。", "Type_0_does_not_satisfy_the_constraint_1_2344": "类型“{0}”不满足约束“{1}”。", + "Type_0_does_not_satisfy_the_expected_type_1_1360": "类型“{0}”不满足预期类型“{1}”。", "Type_0_has_no_call_signatures_2757": "类型 \"{0}\" 没有调用签名。", "Type_0_has_no_construct_signatures_2761": "类型 \"{0}\" 没有构造签名。", "Type_0_has_no_matching_index_signature_for_type_1_2537": "类型“{0}”没有匹配的类型“{1}”的索引签名。", @@ -1596,6 +1607,7 @@ "Type_reference_directive_0_was_not_resolved_6120": "======== 未解析类型引用指令“{0}”。========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== 类型引用指令“{0}”已成功解析为“{1}”,主要: {2}。========", "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219": "======== 类型引用指令 \"{0}\" 已成功解析为 \"{1}\" ,包 ID 为 \"{2}\",主要: {3}。========", + "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037": "类型满意度表达式只能在 TypeScript 文件中使用。", "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043": "类型不能出现在 JavaScript 文件的导出声明中。", "Types_have_separate_declarations_of_a_private_property_0_2442": "类型具有私有属性“{0}”的单独声明。", "Types_of_construct_signatures_are_incompatible_2419": "构造签名的类型不兼容。", @@ -1627,9 +1639,9 @@ "Unreachable_code_detected_7027": "检测到无法访问的代码。", "Unterminated_Unicode_escape_sequence_1199": "未终止的 Unicode 转义序列。", "Unterminated_quoted_string_in_response_file_0_6045": "响应文件“{0}”中引号不配对。", - "Unterminated_regular_expression_literal_1161": "未终止的正则表达式文本。", - "Unterminated_string_literal_1002": "未终止的字符串文本。", - "Unterminated_template_literal_1160": "未终止的模板文本。", + "Unterminated_regular_expression_literal_1161": "未终止的正则表达式字面量。", + "Unterminated_string_literal_1002": "未终止的字符串字面量。", + "Unterminated_template_literal_1160": "未终止的模板字面量。", "Untyped_function_calls_may_not_accept_type_arguments_2347": "非类型化函数调用不能接受类型参数。", "Unused_label_7028": "未使用的标签。", "Unused_ts_expect_error_directive_2578": "未使用的 \"@ts-expect-error\" 指令。", @@ -1667,11 +1679,11 @@ "When_type_checking_take_into_account_null_and_undefined_6699": "进行类型检查时,请考虑 “null” 和 “undefined”。", "Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191": "是否在监视模式下保留过时的控制台输出,而不是清除屏幕。", "Wrap_all_invalid_characters_in_an_expression_container_95109": "包装表达式容器中的所有无效字符", - "Wrap_all_object_literal_with_parentheses_95116": "用括号将所有对象文字括起来", + "Wrap_all_object_literal_with_parentheses_95116": "用括号括起所有对象字面量", "Wrap_all_unparented_JSX_in_JSX_fragment_95121": "将所有没有父级的 JSX 包装在 JSX 片段中", "Wrap_in_JSX_fragment_95120": "包装在 JSX 片段中", "Wrap_invalid_character_in_an_expression_container_95108": "包装表达式容器中的无效字符", - "Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal_95113": "用括号将以下应为对象文字的正文括起来", + "Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal_95113": "用括号括起以下应为对象字面量的内容", "You_can_learn_about_all_of_the_compiler_options_at_0_6913": "你可以在 {0} 了解编译器选项的所有内容", "You_cannot_rename_a_module_via_a_global_import_8031": "不能通过全局导入对模块进行重命名。", "You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder_8035": "不能重命名已在 “node_modules” 文件夹中定义的元素。", @@ -1717,6 +1729,10 @@ "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "“{0}”不是关键字“{1}”的有效元属性。是否是指“{2}”?", "_0_is_not_allowed_as_a_parameter_name_1390": "不允许将 '{0}' 作为参数名。", "_0_is_not_allowed_as_a_variable_declaration_name_1389": "“{0}”不得用作变量声明名称。", + "_0_is_of_type_unknown_18046": "“{0}”的类型为“未知”。", + "_0_is_possibly_null_18047": "“{0}”可能为 “null”。", + "_0_is_possibly_null_or_undefined_18049": "{0}可能为 “null” 或“未定义”。", + "_0_is_possibly_undefined_18048": "“{0}”可能为“未定义”。", "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "“{0}”在其自身的基表达式中得到直接或间接引用。", "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "“{0}”在其自身的类型批注中得到直接或间接引用。", "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783": "多次指定了 \"{0}\",因此将重写此用法。", @@ -1752,6 +1768,7 @@ "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "缺少返回类型批注的“{0}”隐式具有“{1}”返回类型。", "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "缺少返回类型批注的 \"{0}\" 隐式具有 \"{1}\" 产出类型。", "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "\"abstract\" 修饰符仅可出现在类、方法或属性声明中。", + "accessor_modifier_can_only_appear_on_a_property_declaration_1275": "\"accessor\" 修饰符只能出现在属性声明中。", "and_here_6204": "并在这里。", "arguments_cannot_be_referenced_in_property_initializers_2815": "无法在属性初始化表达式中引用 \"arguments\"。", "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "“auto”: 将带有导入、导出、import.meta、jsx (带有 jsx: react-jsx)或 esm 格式(带模块: node16+)的文件视为模块。", @@ -1767,7 +1784,7 @@ "const_declarations_must_be_initialized_1155": "必须初始化 \"const\" 声明。", "const_enum_member_initializer_was_evaluated_to_a_non_finite_value_2477": "\"const\" 枚举成员初始化表达式的求值结果为非有限值。", "const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478": "\"const\" 枚举成员初始化表达式的求值结果为不允许使用的值 \"NaN\"。", - "const_enum_member_initializers_can_only_contain_literal_values_and_other_computed_enum_values_2474": "常量枚举成员初始值设定项只能包含文字值和其他计算的枚举值。", + "const_enum_member_initializers_can_only_contain_literal_values_and_other_computed_enum_values_2474": "常量枚举成员初始值设定项只能包含字面量值和其他计算的枚举值。", "const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475": "\"const\" 枚举仅可在属性、索引访问表达式、导入声明的右侧、导出分配或类型查询中使用。", "constructor_cannot_be_used_as_a_parameter_property_name_2398": "“构造函数”不能用作参数属性名称。", "constructor_is_a_reserved_word_18012": "\"#constructor\" 是保留字。", @@ -1815,8 +1832,8 @@ "package_json_scope_0_has_no_imports_defined_6273": "package.json 作用域 '{0}' 未定义导入。", "paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0_6091": "指定了 \"paths“ 选项,正在查找模式以匹配模块名“{0}”。", "readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature_1024": "\"readonly\" 修饰符仅可出现在属性声明或索引签名中。", - "readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types_1354": "仅允许对数组和元组文本类型使用 \"readonly\" 类型修饰符。", - "require_call_may_be_converted_to_an_import_80005": "可将“要求”调用转换为导入。", + "readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types_1354": "仅允许对数组和元组字面量类型使用 \"readonly\" 类型修饰符。", + "require_call_may_be_converted_to_an_import_80005": "可将 \"require\" 调用转换为 import 语句。", "resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext_1452": "仅当“moduleResolution”为“node16”或“nodenext”时才支持“resolution-mode”断言。", "resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_wi_4125": "“resolution-mode”断言不稳定。请使用夜间 TypeScript 消除此错误。请尝试使用“npm install -D typescript@next”进行更新。", "resolution_mode_can_only_be_set_for_type_only_imports_1454": "只能为仅类型导入设置 \"resolution-mode\"。", @@ -1824,10 +1841,10 @@ "resolution_mode_should_be_either_require_or_import_1453": "“resolution-mode”应为“require”或“import”。", "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107": "设置了 \"rootDirs\" 选项,可将其用于解析相对模块名称“{0}”。", "super_can_only_be_referenced_in_a_derived_class_2335": "只能在派生类中引用 \"super\"。", - "super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660": "仅可在派生类或对象文字表达式的成员中引用 \"super\"。", + "super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660": "仅可在派生类或对象字面量表达式的成员中引用 \"super\"。", "super_cannot_be_referenced_in_a_computed_property_name_2466": "不能在计算属性名中引用 \"super\"。", "super_cannot_be_referenced_in_constructor_arguments_2336": "不能在构造函数参数中引用 \"super\"。", - "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659": "\"target\" 选项为 \"ES2015\" 或更高版本时,仅对象文字表达式的成员中允许 \"super\"。", + "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659": "\"target\" 选项为 \"ES2015\" 或更高版本时,仅对象字面量表达式的成员中允许 \"super\"。", "super_may_not_use_type_arguments_2754": "\"super\" 不能使用类型参数。", "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011": "访问派生类构造函数中的 \"super\" 属性前,必须调用 \"super\"。", "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009": "访问派生类的构造函数中的 \"this\" 前,必须调用 \"super\"。", diff --git a/lib/zh-tw/diagnosticMessages.generated.json b/lib/zh-tw/diagnosticMessages.generated.json index eed2d3e67f6..7ce669bd2f0 100644 --- a/lib/zh-tw/diagnosticMessages.generated.json +++ b/lib/zh-tw/diagnosticMessages.generated.json @@ -186,6 +186,7 @@ "An_abstract_accessor_cannot_have_an_implementation_1318": "抽象存取子無法實作。", "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "協助工具修飾元不可搭配私人識別碼使用。", "An_accessor_cannot_have_type_parameters_1094": "存取子不得有類型參數。", + "An_accessor_property_cannot_be_declared_optional_1276": "無法將 'accessor' 屬性宣告為選擇性。", "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "環境模組宣告只可出現在檔案的最上層。", "An_argument_for_0_was_not_provided_6210": "未提供 '{0}' 的引數。", "An_argument_matching_this_binding_pattern_was_not_provided_6211": "未提供符合此繫結模式的引數。", @@ -382,7 +383,7 @@ "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720": "類別 '{0}' 不當實作類別 '{1}'。您是否要擴充 '{1}',並繼承其成員以成為子類別?", "Class_0_incorrectly_implements_interface_1_2420": "類別 '{0}' 不正確地實作介面 '{1}'。", "Class_0_used_before_its_declaration_2449": "類別 '{0}' 的位置在其宣告之前。", - "Class_constructor_may_not_be_a_generator_1360": "類別建構函式可能不是產生器。", + "Class_constructor_may_not_be_a_generator_1368": "類別建構函式可能不是產生器。", "Class_constructor_may_not_be_an_accessor_1341": "類別建構函式可能不是存取子。", "Class_declaration_cannot_implement_overload_list_for_0_2813": "類別宣告無法為 '{0}' 實作多載清單。", "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025": "類別宣告不能有一個以上的 `@augments` 或 `@extends` 標籤。", @@ -430,6 +431,7 @@ "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "將類型 '{0}' 轉換為類型 '{1}' 可能會發生錯誤,原因是這兩個類型彼此並未充分重疊。如果是故意轉換的,請先將運算式轉換為 'unknown'。", "Convert_0_to_1_in_0_95003": "將 '{0}' 轉換成 '{1} in {0}'", "Convert_0_to_mapped_object_type_95055": "將 '{0}' 轉換為對應的物件類型", + "Convert_all_const_to_let_95102": "將所有 'const' 轉換為 'let'", "Convert_all_constructor_functions_to_classes_95045": "將所有建構函式轉換為類別", "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "將所有未作為值使用的匯入轉換為僅限類型的匯入", "Convert_all_invalid_characters_to_HTML_entity_code_95101": "將所有無效字元轉換為 HTML 實體代碼", @@ -919,7 +921,7 @@ "Method_not_implemented_95158": "未實作方法。", "Modifiers_cannot_appear_here_1184": "此處不得出現修飾元。", "Module_0_can_only_be_default_imported_using_the_1_flag_1259": "模組 '{0}' 只能依預設使用 '{1}' 旗標匯入", - "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "無法使用此構造匯入模組 '{0}'。指定名稱只能解析成無法同步匯入的 ES 模組。請改為使用動態匯入。", + "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "無法使用此建構匯入模組 '{0}'。指定名稱只能解析成無法以 'require' 匯入的 ES 模組。請改為使用 ECMAScript 匯入。", "Module_0_declares_1_locally_but_it_is_exported_as_2_2460": "模組 '{0}' 區域性地宣告 '{1}',但卻將該模組匯出為 '{2}'。", "Module_0_declares_1_locally_but_it_is_not_exported_2459": "模組 '{0}' 區域性地宣告 '{1}',但並未匯出該模組。", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340": "模組 '{0}' 不是類型,但在此處卻作為類型使用。您是指 'typeof import('{0}')' 嗎?", @@ -1103,6 +1105,7 @@ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "因為輸出檔案 '{1}' 不存在,所以專案 '{0}' 已過期", "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "因為專案 '{0}' 的輸出使用版本 '{1}' 產生而成,與目前的版本 '{2}' 不同,所以該專案已過期", "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "因為專案 '{0}' 的相依性 '{1}' 輸出已變更,所以該專案已過期", + "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401": "專案 '{0}' 已過期,因為讀取檔案 '{1}' 時發生錯誤", "Project_0_is_up_to_date_6361": "專案 '{0}' 為最新狀態", "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "因為最新的輸入 '{1}' 早於最舊的輸出 '{2}',所以專案 '{0}' 為最新狀態", "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "專案 '{0}' 為最新狀態,但需要更新比輸入檔案還舊的輸出檔案時間戳記", @@ -1110,6 +1113,7 @@ "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "專案參考不會形成循環圖。但偵測到循環: {0}", "Projects_6255": "專案", "Projects_in_this_build_Colon_0_6355": "此組建中的專案: {0}", + "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "只有以 ECMAScript 2015 及更新版本為目標時,才可使用具有 'accessor' 修飾詞的屬性。", "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "屬性 '{0}' 已標記為抽象,因此不得有初始設定式。", "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "屬性 '{0}' 來自索引簽章,因此必須使用 ['{0}'] 存取。", "Property_0_does_not_exist_on_type_1_2339": "類型 '{1}' 沒有屬性 '{0}'。", @@ -1385,6 +1389,7 @@ "The_containing_arrow_function_captures_the_global_value_of_this_7041": "包含的箭號函式會擷取 'this' 的全域值。", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "內含的函式或模組主體對控制流程分析而言過大。", "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "目前的檔案是 CommonJS 模組,無法在最上層使用 'await'。", + "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479": "目前的檔案是 CommonJS 模組,其匯入將會產生 'require' 呼叫;不過,參考的檔案是 ECMAScript 模組,無法以 'require' 匯入。請考慮改為撰寫動態 'import(\"{0}\")' 呼叫。", "The_current_host_does_not_support_the_0_option_5001": "目前的主機不支援 '{0}' 選項。", "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "您可能要使用的 '{0}' 宣告定義於此處", "The_declaration_was_marked_as_deprecated_here_2798": "該宣告在這裡標示為已淘汰。", @@ -1422,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": "對使用者顯示訊息時所使用的地區設定 (例如 'zh-tw')", "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136": "在 node_modules 及載入 JavaScript 檔案下搜尋時的最大相依性深度。", @@ -1443,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}' 的隱蔽宣告定義於此處", @@ -1464,13 +1467,14 @@ "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490": "迭代器 '{0}()' 方法所傳回的類型必須具有 'value' 屬性。", "The_types_of_0_are_incompatible_between_these_types_2200": "'{0}' 的類型在這些類型之間不相容。", "The_types_returned_by_0_are_incompatible_between_these_types_2201": "'{0}' 所傳回的類型在這些類型之間不相容。", + "The_value_0_cannot_be_used_here_18050": "此處無法使用值 '{0}'。", "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "'for...in' 陳述式的變數宣告不得有初始設定式。", "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "'for...of' 陳述式的變數宣告不得有初始設定式。", "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "不支援 'with' 陳述式。'with' 區塊中的所有符號都會有類型 'any'。", "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_since_JavaScript_compares_objects_by_reference_not_value_2839": "此條件一律會傳回 '{0}',因為 JavaScript 會依參照而非值比較物件。", - "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367": "因為類型 '{1}' 與 '{2}' 未重疊,所以此條件永遠會傳回 '{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。您是要改為呼叫該條件嗎?", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "此建構函式可轉換為類別宣告。", @@ -1491,7 +1495,7 @@ "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114": "因為此成員會覆寫基底類別 '{0}' 中的成員,所以其必須具有 'override' 修飾元。", "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "因為此成員會覆寫基底類別 '{0}' 中宣告的抽象方法,所以其必須具有 'override' 修飾元。", "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "只能以 ECMAScript 匯入/匯出來參考此模組,方法為開啟 '{0}' 旗標並參考其預設匯出。", - "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594": "此模組使用 'export =' 宣告,只能在使用 '{0}' 旗標時搭配預設匯入使用。", + "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "此模組使用 'export =' 宣告,只能在使用 '{0}' 旗標時搭配預設匯入使用。", "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "此多載簽章與其實作簽章不相容。", "This_parameter_is_not_allowed_with_use_strict_directive_1346": "不允許此參數搭配 'use strict' 指示詞使用。", "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120": "此參數屬性必須包含具有 '@override' 標籤的 JSDoc 註解,因為其會覆寫基底類別 '{0}' 中的成員。", @@ -1504,6 +1508,10 @@ "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "此語法需要名為 '{1}' 且具有 {2} 參數的匯入協助程式,其與 '{0}' 中的參數不相容。請考慮升級 '{0}' 的版本。", "This_type_parameter_might_need_an_extends_0_constraint_2208": "此類型參數可能需要 'extends {0}' 限制式。", "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "此 'import' 的使用方式無效。'import()' 呼叫可以寫入,但必須有括弧,而且不能有類型引數。", + "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482": "若要將此檔案轉換為 ECMAScript 模組,請將欄位 `{ \"type\": \"module\" }` 新增至 '{0}'。", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481": "若要將此檔案轉換為 ECMAScript 模組,請將其副檔名變更為 '{0}',或將欄位 `\"type\": \"module\"` 新增至 '{1}'。", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480": "若要將此檔案轉換為 ECMAScript 模組,請將其副檔名變更為 '{0}',或使用 `{ \"type\": \"module\" }` 建立本機 package.json 檔案。", + "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483": "若要將此檔案轉換為 ECMAScript 模組,請建立具有 `{ \"type\": \"module\" }` 的本機 package.json 檔案。", "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "只有在 'module' 選項設定為 'es2022'、'esnext'、'system'、'node16' 或 'nodenext',而且 'target' 選項設定為 'es2017' 或更高版本時,才允許最上層的 'await' 運算式。", "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": ".d.ts 檔案中的最上層宣告必須以 'declare' 或 'export' 修飾元開頭。", "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "只有在 'module' 選項設為 'es2022'、'esnext'、'system'、'node16' 或 'nodenext',而且 'target' 選項設為 'es2017' 或更高版本時,才允許最上層的 'for await' 迴圈。", @@ -1519,6 +1527,7 @@ "Type_0_cannot_be_used_as_an_index_type_2538": "類型 '{0}' 無法作為索引類型。", "Type_0_cannot_be_used_to_index_type_1_2536": "類型 '{0}' 無法用來為類型 '{1}' 編制索引。", "Type_0_does_not_satisfy_the_constraint_1_2344": "類型 '{0}' 不符合條件約束 '{1}'。", + "Type_0_does_not_satisfy_the_expected_type_1_1360": "類型 '{0}' 不符合預期類型 '{1}'。", "Type_0_has_no_call_signatures_2757": "類型 '{0}' 沒有任何呼叫簽章。", "Type_0_has_no_construct_signatures_2761": "類型 '{0}' 沒有任何建構簽章。", "Type_0_has_no_matching_index_signature_for_type_1_2537": "類型 '{0}' 沒有與類型 '{1}' 相符的索引簽章。", @@ -1540,6 +1549,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}' 的項目。", @@ -1596,6 +1606,7 @@ "Type_reference_directive_0_was_not_resolved_6120": "======== 類型參考指示詞 '{0}' 未解析。========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== 類型參考指示詞 '{0}' 已成功解析為 '{1}',主要: {2}。========", "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219": "======== 類型參考指示詞 '{0}' 已成功解析為 '{1}',套件識別碼為 '{2}',主要: {3}。========", + "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037": "類型滿足運算式只可用於 TypeScript 檔案。", "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043": "類型不能出現在 JavaScript 檔案的匯出宣告中。", "Types_have_separate_declarations_of_a_private_property_0_2442": "類型具有私用屬性 '{0}' 的個別宣告。", "Types_of_construct_signatures_are_incompatible_2419": "建構簽章的類型不相容。", @@ -1717,6 +1728,10 @@ "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "'{0}' 對關鍵字 '{1}' 而言不是有效的中繼屬性。您是指 '{2}' 嗎?", "_0_is_not_allowed_as_a_parameter_name_1390": "不允許 '{0}' 做為參數名稱。", "_0_is_not_allowed_as_a_variable_declaration_name_1389": "'{0}' 不能是變數宣告名稱。", + "_0_is_of_type_unknown_18046": "'{0}' 的類型為 'unknown'。", + "_0_is_possibly_null_18047": "'{0}' 可能是 'null'。", + "_0_is_possibly_null_or_undefined_18049": "'{0}' 可能為「null」或「未定義」。", + "_0_is_possibly_undefined_18048": "'{0}' 可能為「未定義」。", "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "'{0}' 在其本身的基底運算式中直接或間接受到參考。", "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "'{0}' 在其本身的類型註釋中直接或間接受到參考。", "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783": "多次指定 '{0}',因此將會覆寫此使用方式。", @@ -1752,6 +1767,7 @@ "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "缺少傳回型別註解的 '{0}' 隱含了 '{1}' 傳回型別。", "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "缺少傳回型別註解的 '{0}' 隱含 '{1}' 產生類型。", "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "'abstract' 修飾元只能出現在類別宣告、方法宣告或屬性宣告。", + "accessor_modifier_can_only_appear_on_a_property_declaration_1275": "'accessor' 修飾詞只能出現在屬性宣告。", "and_here_6204": "及此處。", "arguments_cannot_be_referenced_in_property_initializers_2815": "屬性初始設定式中不得參考 'arguments'。", "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "\"auto\": 處理具有 imports、exports、import.meta, jsx (具有 jsx: react-jsx) 的檔案,或以 esm 格式 (具有 module: node16+) 作為模組。", diff --git a/package.json b/package.json index 0d80542b7fa..a1e11035708 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "https://www.typescriptlang.org/", - "version": "4.9.0", + "version": "4.9.0-beta", "license": "Apache-2.0", "description": "TypeScript is a language for application scale JavaScript development", "keywords": [ @@ -126,4 +126,4 @@ "node": "14.20.0", "npm": "8.15.0" } -} +} \ No newline at end of file diff --git a/src/compiler/corePublic.ts b/src/compiler/corePublic.ts index b13857a27fb..91b07765cf9 100644 --- a/src/compiler/corePublic.ts +++ b/src/compiler/corePublic.ts @@ -5,7 +5,7 @@ namespace ts { // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types - export const version: string = `${versionMajorMinor}.0-dev`; + export const version: string = `${versionMajorMinor}.0-beta`; /** * Type of objects whose values are all of the same type. diff --git a/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.errors.txt b/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.errors.txt new file mode 100644 index 00000000000..65b88328267 --- /dev/null +++ b/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.errors.txt @@ -0,0 +1,80 @@ +tests/cases/conformance/node/other.cts(3,14): error TS2841: The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. +tests/cases/conformance/node/other.cts(4,14): error TS2841: The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. +tests/cases/conformance/node/other2.cts(3,14): error TS2841: The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. + + +==== tests/cases/conformance/node/index.ts (0 errors) ==== + // esm format file + export {}; +==== tests/cases/conformance/node/index.mts (0 errors) ==== + // esm format file + export {}; +==== tests/cases/conformance/node/index.cts (0 errors) ==== + // cjs format file + export {}; +==== tests/cases/conformance/node/other.ts (0 errors) ==== + // esm format file + export const a = await import("package/cjs"); + export const b = await import("package/mjs"); + export const c = await import("package"); + export const f = await import("inner"); +==== tests/cases/conformance/node/other2.ts (0 errors) ==== + // esm format file + export const d = await import("inner/cjs"); + export const e = await import("inner/mjs"); +==== tests/cases/conformance/node/other.mts (0 errors) ==== + // esm format file + export const a = await import("package/cjs"); + export const b = await import("package/mjs"); + export const c = await import("package"); + export const f = await import("inner"); +==== tests/cases/conformance/node/other2.mts (0 errors) ==== + // esm format file + export const d = await import("inner/cjs"); + export const e = await import("inner/mjs"); +==== tests/cases/conformance/node/other.cts (2 errors) ==== + // cjs format file, no TLA + export const a = import("package/cjs"); + export const b = import("package/mjs"); + ~ +!!! error TS2841: The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. + export const c = import("package"); + ~ +!!! error TS2841: The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. + export const f = import("inner"); +==== tests/cases/conformance/node/other2.cts (1 errors) ==== + // cjs format file, no TLA + export const d = import("inner/cjs"); + export const e = import("inner/mjs"); + ~ +!!! error TS2841: The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. +==== tests/cases/conformance/node/node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const cjsMain = true; +==== tests/cases/conformance/node/node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const esm = true; +==== tests/cases/conformance/node/node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsNonmain = true; +==== tests/cases/conformance/node/package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module", + "exports": { + "./cjs": "./index.cjs", + "./mjs": "./index.mjs", + ".": "./index.js" + } + } +==== tests/cases/conformance/node/node_modules/inner/package.json (0 errors) ==== + { + "name": "inner", + "private": true, + "exports": { + "./cjs": "./index.cjs", + "./mjs": "./index.mjs", + ".": "./index.js" + } + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.js b/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.js index 9bc4bb789c5..beb51a1f5e5 100644 --- a/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.js +++ b/tests/baselines/reference/nodeModulesDeclarationEmitDynamicImportWithPackageExports.js @@ -153,19 +153,3 @@ export declare const d: { cjsNonmain: true; }; export declare const e: typeof import("inner/mjs"); -//// [other.d.cts] -export declare const a: Promise<{ - default: typeof import("./index.cjs"); -}>; -export declare const b: Promise; -export declare const c: Promise; -export declare const f: Promise<{ - default: typeof import("inner"); - cjsMain: true; -}>; -//// [other2.d.cts] -export declare const d: Promise<{ - default: typeof import("inner/cjs"); - cjsNonmain: true; -}>; -export declare const e: Promise; diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt index a8a76a05152..1216d882007 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt @@ -1,26 +1,44 @@ +/index.ts(1,45): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. +/index.ts(2,44): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /index.ts(6,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +/index.ts(6,50): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. /index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +/index.ts(7,49): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. +/index.ts(10,45): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. +/index.ts(11,44): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -==== /index.ts (3 errors) ==== +==== /index.ts (9 errors) ==== import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).js index 1b8bc65976e..e24fd94dba7 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).js +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).js @@ -30,16 +30,3 @@ export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); - - -//// [index.d.ts] -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; -export interface LocalInterface extends RequireInterface, ImportInterface { -} -import { type RequireInterface as Req } from "pkg" assert { "resolution-mode": "require" }; -import { type ImportInterface as Imp } from "pkg" assert { "resolution-mode": "import" }; -export interface Loc extends Req, Imp { -} -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt index 5aaee4a285e..097bebc6d34 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt @@ -1,26 +1,44 @@ +/index.ts(1,45): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. +/index.ts(2,44): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /index.ts(6,50): error TS2836: Import assertions are not allowed on statements that transpile to commonjs 'require' calls. +/index.ts(6,50): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. /index.ts(7,49): error TS2836: Import assertions are not allowed on statements that transpile to commonjs 'require' calls. +/index.ts(7,49): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. +/index.ts(10,45): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. +/index.ts(11,44): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -==== /index.ts (3 errors) ==== +==== /index.ts (9 errors) ==== import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that transpile to commonjs 'require' calls. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that transpile to commonjs 'require' calls. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).js index 1b8bc65976e..e24fd94dba7 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).js +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).js @@ -30,16 +30,3 @@ export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); - - -//// [index.d.ts] -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; -export interface LocalInterface extends RequireInterface, ImportInterface { -} -import { type RequireInterface as Req } from "pkg" assert { "resolution-mode": "require" }; -import { type ImportInterface as Imp } from "pkg" assert { "resolution-mode": "import" }; -export interface Loc extends Req, Imp { -} -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt index 0403a6e026f..299c92f3b0d 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt @@ -1,11 +1,21 @@ +/index.ts(1,45): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. +/index.ts(2,44): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. /index.ts(6,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +/index.ts(6,50): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +/index.ts(7,49): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. +/index.ts(10,45): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. +/index.ts(11,44): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -==== /index.ts (3 errors) ==== +==== /index.ts (9 errors) ==== import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export interface LocalInterface extends RequireInterface, ImportInterface {} @@ -14,13 +24,21 @@ !!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).js index fad19d466a6..817fbde7e07 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).js +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).js @@ -34,16 +34,3 @@ export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" //// [index.js] export {}; - - -//// [index.d.ts] -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; -export interface LocalInterface extends RequireInterface, ImportInterface { -} -import { type RequireInterface as Req } from "pkg" assert { "resolution-mode": "require" }; -import { type ImportInterface as Imp } from "pkg" assert { "resolution-mode": "import" }; -export interface Loc extends Req, Imp { -} -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt index 47c2ad040c0..d0ae4f1ef1a 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt @@ -1,11 +1,21 @@ +/index.ts(1,45): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. +/index.ts(2,44): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. /index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(6,50): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(7,49): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. +/index.ts(10,45): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. +/index.ts(11,44): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. -==== /index.ts (3 errors) ==== +==== /index.ts (9 errors) ==== import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export interface LocalInterface extends RequireInterface, ImportInterface {} @@ -14,13 +24,21 @@ !!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1454: `resolution-mode` can only be set for type-only imports. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1454: `resolution-mode` can only be set for type-only imports. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).js index fad19d466a6..817fbde7e07 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).js +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).js @@ -34,16 +34,3 @@ export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" //// [index.js] export {}; - - -//// [index.d.ts] -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; -export interface LocalInterface extends RequireInterface, ImportInterface { -} -import { type RequireInterface as Req } from "pkg" assert { "resolution-mode": "require" }; -import { type ImportInterface as Imp } from "pkg" assert { "resolution-mode": "import" }; -export interface Loc extends Req, Imp { -} -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt index bc3eb30565c..4934625b136 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt @@ -2,10 +2,11 @@ /index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. /index.ts(4,39): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. +/index.ts(4,39): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /index.ts(6,76): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. -==== /index.ts (5 errors) ==== +==== /index.ts (6 errors) ==== // incorrect mode import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -18,6 +19,8 @@ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. // not exclusively type-only import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).js index 3b2af2656d0..7daaa0cda7e 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).js +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).js @@ -30,10 +30,3 @@ export interface LocalInterface extends RequireInterface, ImportInterface {} //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); - - -//// [index.d.ts] -import type { RequireInterface } from "pkg"; -import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; -export interface LocalInterface extends RequireInterface, ImportInterface { -} diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt index 49a86cf5980..4d564793b0c 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt @@ -2,10 +2,11 @@ /index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. /index.ts(4,39): error TS2836: Import assertions are not allowed on statements that transpile to commonjs 'require' calls. +/index.ts(4,39): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /index.ts(6,76): error TS2836: Import assertions are not allowed on statements that transpile to commonjs 'require' calls. -==== /index.ts (5 errors) ==== +==== /index.ts (6 errors) ==== // incorrect mode import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -18,6 +19,8 @@ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2836: Import assertions are not allowed on statements that transpile to commonjs 'require' calls. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. // not exclusively type-only import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).js index 3b2af2656d0..7daaa0cda7e 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).js +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).js @@ -30,10 +30,3 @@ export interface LocalInterface extends RequireInterface, ImportInterface {} //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); - - -//// [index.d.ts] -import type { RequireInterface } from "pkg"; -import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; -export interface LocalInterface extends RequireInterface, ImportInterface { -} diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node16).errors.txt new file mode 100644 index 00000000000..224e7b20e2d --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node16).errors.txt @@ -0,0 +1,38 @@ +/index.ts(2,31): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. +/index.ts(3,31): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. +/index.ts(5,58): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. +/index.ts(6,14): error TS2841: The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. +/index.ts(6,58): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. + + +==== /index.ts (5 errors) ==== + export type LocalInterface = + & import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. + & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. + + export const a = (null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. + export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); + ~ +!!! error TS2841: The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. + +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export interface ImportInterface {} +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export interface RequireInterface {} \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node16).js b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node16).js index 1b444aae0df..ac1cb24c8b3 100644 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node16).js +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=node16).js @@ -28,9 +28,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.b = exports.a = void 0; exports.a = null; exports.b = null; - - -//// [index.d.ts] -export type LocalInterface = import("pkg", { assert: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; -export declare const a: import("pkg").RequireInterface; -export declare const b: import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).errors.txt new file mode 100644 index 00000000000..224e7b20e2d --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).errors.txt @@ -0,0 +1,38 @@ +/index.ts(2,31): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. +/index.ts(3,31): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. +/index.ts(5,58): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. +/index.ts(6,14): error TS2841: The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. +/index.ts(6,58): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. + + +==== /index.ts (5 errors) ==== + export type LocalInterface = + & import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. + & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. + + export const a = (null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. + export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); + ~ +!!! error TS2841: The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. + +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export interface ImportInterface {} +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export interface RequireInterface {} \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).js b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).js index 1b444aae0df..ac1cb24c8b3 100644 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).js +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).js @@ -28,9 +28,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.b = exports.a = void 0; exports.a = null; exports.b = null; - - -//// [index.d.ts] -export type LocalInterface = import("pkg", { assert: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; -export declare const a: import("pkg").RequireInterface; -export declare const b: import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt index b8b88af5ded..f95d9176a3f 100644 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt @@ -1,5 +1,8 @@ /index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(3,31): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /index.ts(5,78): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(6,14): error TS2841: The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. +/index.ts(6,58): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other.ts(3,22): error TS1005: 'assert' expected. /other.ts(3,39): error TS1005: ';' expected. @@ -89,17 +92,23 @@ export interface ImportInterface {} ==== /node_modules/pkg/require.d.ts (0 errors) ==== export interface RequireInterface {} -==== /index.ts (2 errors) ==== +==== /index.ts (5 errors) ==== export type LocalInterface = & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); + ~ +!!! error TS2841: The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. ==== /other.ts (27 errors) ==== // missing assert: export type LocalInterface = diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).js b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).js index 6b34fb98748..258fffcef2b 100644 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).js +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).js @@ -119,10 +119,6 @@ exports.a = null; exports.b = null; -//// [index.d.ts] -export type LocalInterface = import("pkg", { assert: { "resolution-mode": "foobar" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; -export declare const a: import("pkg").RequireInterface; -export declare const b: import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] export type LocalInterface = import("pkg", { assert: {} }); export declare const a: any; diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt index b8b88af5ded..f95d9176a3f 100644 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt @@ -1,5 +1,8 @@ /index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(3,31): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /index.ts(5,78): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(6,14): error TS2841: The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. +/index.ts(6,58): error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other.ts(3,22): error TS1005: 'assert' expected. /other.ts(3,39): error TS1005: ';' expected. @@ -89,17 +92,23 @@ export interface ImportInterface {} ==== /node_modules/pkg/require.d.ts (0 errors) ==== export interface RequireInterface {} -==== /index.ts (2 errors) ==== +==== /index.ts (5 errors) ==== export type LocalInterface = & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); + ~ +!!! error TS2841: The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS4125: 'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'. ==== /other.ts (27 errors) ==== // missing assert: export type LocalInterface = diff --git a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).js b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).js index 6b34fb98748..258fffcef2b 100644 --- a/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).js +++ b/tests/baselines/reference/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).js @@ -119,10 +119,6 @@ exports.a = null; exports.b = null; -//// [index.d.ts] -export type LocalInterface = import("pkg", { assert: { "resolution-mode": "foobar" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; -export declare const a: import("pkg").RequireInterface; -export declare const b: import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] export type LocalInterface = import("pkg", { assert: {} }); export declare const a: any;